@univerjs/preset-docs-core 0.7.0-nightly.202505091607 → 0.7.0-nightly.202505101606

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/lib/umd/index.js CHANGED
@@ -19,13 +19,16 @@
19
19
  univer-justify-center univer-rounded univer-text-sm univer-text-gray-800 univer-transition-all
20
20
  dark:univer-text-white dark:hover:univer-bg-gray-700
21
21
  hover:univer-bg-gray-100
22
- `,children:[r,"%"]})})]})}function d2(e,t,...r){return e.t(t)}const f2=(e,t)=>{const r=s.useRef(!1);s.useEffect(()=>{if(r.current)return e();r.current=!0},t)};function h2(e,t){const r=I1(t.handler);s.useEffect(()=>{const n=i=>{e.current&&i.target&&!e.current.contains(i.target)&&r()};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[r,e])}function v2(e,t=300){const r=s.useRef(null);return s.useCallback((...n)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...n)},t)},[e,t])}const M9=e=>typeof e=="number";function C2(e){const t=s.useRef(e);return t.current=e,t}const g2=(e,t)=>{const{containerTarget:r,itemHeight:n,overscan:i=5}=t,a=C2(n),[o,c]=s.useState(null),v=s.useRef(!1),[m,L]=s.useState([]),[d,_]=s.useState({height:void 0,marginTop:void 0}),S=(w,A)=>{if(typeof a.current=="number")return Math.ceil(w/a.current);let M=0,N=0;for(let Z=A;Z<e.length;Z++){const R=a.current(Z,e[Z]);if(M+=R,N=Z,M>=w)break}return N-A},H=w=>{if(M9(a.current))return Math.floor(w/a.current);let A=0,M=0;for(let N=0;N<e.length;N++){const Z=a.current(N,e[N]);if(A+=Z,A>=w){M=N;break}}return M+1},V=w=>typeof a.current=="number"?w*a.current:e.slice(0,w).reduce((M,N,Z)=>M+a.current(Z,e[Z]),0),E=s.useMemo(()=>M9(a.current)?e.length*a.current:e.reduce((w,A,M)=>w+a.current(M,e[M]),0),[e]),D=()=>{const w=r.current;if(w){const{scrollTop:A,clientHeight:M}=w,N=H(A),Z=S(M,N),R=Math.max(0,N-i),G=Math.min(e.length,N+Z+i),Y=V(R);_({height:`${E-Y}px`,marginTop:`${Y}px`}),L(e.slice(R,G).map((K,J)=>({data:K,index:J+R})))}};return s.useEffect(()=>{if(r.current){const w=()=>{const M=r.current.clientWidth,N=r.current.clientHeight;(M!==(o==null?void 0:o.width)||N!==(o==null?void 0:o.height))&&c({width:M,height:N})};w();const A=new ResizeObserver(w);return A.observe(r.current),()=>{A.disconnect()}}},[]),s.useEffect(()=>{!(o!=null&&o.width)||!(o!=null&&o.height)||D()},[o==null?void 0:o.width,o==null?void 0:o.height,e]),[m,{wrapperStyle:d,scrollTo:I1(w=>{const A=r.current;A&&(v.current=!0,A.scrollTop=V(w),D())}),containerProps:{onScroll:w=>{if(v.current){v.current=!1;return}w.preventDefault(),D()}}}]},z1="ui.config",w9={},H9=s.createContext({current:void 0}),T1=8;function E9(e){const{position:t,width:r,height:n,containerHeight:i,containerWidth:a,direction:o="vertical",noPushMinimumGap:c=!1}=e,v=c?-1/0:T1,m=c?1/0:i-n-T1,L=c?-1/0:T1,d=c?1/0:a-r-T1;if(o==="vertical"||o.indexOf("top")===0||o.indexOf("bottom")===0){const{left:k,top:w,right:A,bottom:M}=t,N=o==="vertical"&&M>m||o.indexOf("top")>-1?{top:Math.max(w-n,v)}:{top:Math.min(M,m)};let Z;if(o.includes("center")){const G=(A-k-r)/2;Z=Math.max(k+G,L)+r>a?{left:Math.max(Math.min(d,A-r-G),L)}:{left:Math.max(L,Math.min(k+G,d))}}else o.includes("left")?Z={left:Math.max(A-r,L)}:o.includes("right")?Z={left:Math.min(k,d)}:Z=k+r>a?Math.max(A-r,L)<T1?{left:Math.min(k,d)}:{left:Math.max(A-r,L)}:{left:Math.min(k,d)};return{...N,...Z}}const{left:_,top:S,right:H,bottom:V}=t,E=o.includes("left")?{left:Math.max(_-r,L)}:{left:Math.min(H,d)};let D;if(o.includes("center")){const w=(V-S-n)/2;D=Math.max(S+w,v)+n>i?{top:Math.max(Math.min(m,V-n-w),v)}:{top:Math.max(v,Math.min(S+w,m))}}else o.includes("top")?D={top:Math.min(S,m)}:o.includes("bottom")?D={top:Math.max(V-n,v)}:D=S+n>i?Math.max(V-n,v)<T1?{top:Math.min(S,m)}:{top:Math.max(V-n,v)}:{top:Math.min(S,m)};return{...D,...E}}function K1(e){var e1;const{mask:t,portal:r,children:n,anchorRect$:i,direction:a="vertical",onClickOutside:o,excludeOutside:c,excludeRects:v,onPointerEnter:m,onPointerLeave:L,onClick:d,hidden:_,onContextMenu:S,zIndex:H=1020,maskZIndex:V=100,onMaskClick:E,noPushMinimumGap:D,autoRelayout:k=!0}=e,w=s.useRef(null),A=I1(o!=null?o:()=>{}),M=I1(S!=null?S:()=>{}),N=s.useRef({top:-9999,left:-9999}),Z=v,R=x.useDependency(h.IConfigService),G=s.useRef(void 0),Y=R.getConfig(z1),K=(e1=Y==null?void 0:Y.popupRootId)!=null?e1:"univer-popup-portal",J=I1(W=>{requestAnimationFrame(()=>{if(!w.current)return;const{clientWidth:t1,clientHeight:u1}=w.current,L1=window.innerWidth,H1=window.innerHeight;N.current=E9({position:W,width:t1,height:u1,containerWidth:L1,containerHeight:H1,direction:a,noPushMinimumGap:D}),w.current.style.top=`${N.current.top}px`,w.current.style.left=`${N.current.left}px`})});s.useEffect(()=>{let W;return w.current&&(W=new ResizeObserver(()=>{k&&G.current&&J(G.current)}),W.observe(w.current)),()=>{W==null||W.disconnect()}},[w.current,k]),s.useEffect(()=>{const W=i.subscribe(t1=>{G.current=t1,J(t1)});return()=>W.unsubscribe()},[i,a]),s.useEffect(()=>{const W=t1=>{var V1;if(c&&(c.indexOf(t1.target)>-1||c.some(o1=>o1.contains(t1.target))))return;const u1=t1.clientX,L1=t1.clientY,H1=[...(V1=Z==null?void 0:Z.current)!=null?V1:[]];G.current&&H1.push(G.current);for(const o1 of H1)if(u1<=o1.right&&u1>=o1.left&&L1<=o1.bottom&&L1>=o1.top)return;A(t1)};return window.addEventListener("pointerdown",W),()=>{window.removeEventListener("pointerdown",W)}},[A,c,Z]),s.useEffect(()=>{const W=t1=>{t1.ctrlKey&&t1.button===0||M()};return window.addEventListener("contextmenu",W),()=>{window.removeEventListener("contextmenu",W)}},[M]);const q=C.jsxs(C.Fragment,{children:[t&&C.jsx("div",{className:"univer-fixed univer-bottom-0 univer-left-0 univer-right-0 univer-top-0 univer-z-[100]",style:{zIndex:V},onClick:E}),C.jsx("section",{ref:w,className:`
22
+ `,children:[r,"%"]})})]})}function d2(e,t,...r){return e.t(t)}const f2=(e,t)=>{const r=s.useRef(!1);s.useEffect(()=>{if(r.current)return e();r.current=!0},t)};function h2(e,t){const r=I1(t.handler);s.useEffect(()=>{const n=i=>{e.current&&i.target&&!e.current.contains(i.target)&&r()};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[r,e])}function v2(e,t=300){const r=s.useRef(null);return s.useCallback((...n)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...n)},t)},[e,t])}const M9=e=>typeof e=="number";function C2(e){const t=s.useRef(e);return t.current=e,t}const g2=(e,t)=>{const{containerTarget:r,itemHeight:n,overscan:i=5}=t,a=C2(n),[o,c]=s.useState(null),v=s.useRef(!1),[m,L]=s.useState([]),[d,_]=s.useState({height:void 0,marginTop:void 0}),S=(w,A)=>{if(typeof a.current=="number")return Math.ceil(w/a.current);let M=0,N=0;for(let Z=A;Z<e.length;Z++){const R=a.current(Z,e[Z]);if(M+=R,N=Z,M>=w)break}return N-A},H=w=>{if(M9(a.current))return Math.floor(w/a.current);let A=0,M=0;for(let N=0;N<e.length;N++){const Z=a.current(N,e[N]);if(A+=Z,A>=w){M=N;break}}return M+1},V=w=>typeof a.current=="number"?w*a.current:e.slice(0,w).reduce((M,N,Z)=>M+a.current(Z,e[Z]),0),E=s.useMemo(()=>M9(a.current)?e.length*a.current:e.reduce((w,A,M)=>w+a.current(M,e[M]),0),[e]),D=()=>{const w=r.current;if(w){const{scrollTop:A,clientHeight:M}=w,N=H(A),Z=S(M,N),R=Math.max(0,N-i),G=Math.min(e.length,N+Z+i),Y=V(R);_({height:`${E-Y}px`,marginTop:`${Y}px`}),L(e.slice(R,G).map((K,J)=>({data:K,index:J+R})))}};return s.useEffect(()=>{if(r.current){const w=()=>{const M=r.current.clientWidth,N=r.current.clientHeight;(M!==(o==null?void 0:o.width)||N!==(o==null?void 0:o.height))&&c({width:M,height:N})};w();const A=new ResizeObserver(w);return A.observe(r.current),()=>{A.disconnect()}}},[]),s.useEffect(()=>{!(o!=null&&o.width)||!(o!=null&&o.height)||D()},[o==null?void 0:o.width,o==null?void 0:o.height,e]),[m,{wrapperStyle:d,scrollTo:I1(w=>{const A=r.current;A&&(v.current=!0,A.scrollTop=V(w),D())}),containerProps:{onScroll:w=>{if(v.current){v.current=!1;return}w.preventDefault(),D()}}}]},z1="ui.config",w9={},H9=s.createContext({current:void 0}),T1=8;function E9(e){const{position:t,width:r,height:n,containerHeight:i,containerWidth:a,direction:o="vertical",noPushMinimumGap:c=!1}=e,v=c?-1/0:T1,m=c?1/0:i-n-T1,L=c?-1/0:T1,d=c?1/0:a-r-T1;if(o==="vertical"||o.indexOf("top")===0||o.indexOf("bottom")===0){const{left:k,top:w,right:A,bottom:M}=t,N=o==="vertical"&&M>m||o.indexOf("top")>-1?{top:Math.max(w-n,v)}:{top:Math.min(M,m)};let Z;if(o.includes("center")){const G=(A-k-r)/2;Z=Math.max(k+G,L)+r>a?{left:Math.max(Math.min(d,A-r-G),L)}:{left:Math.max(L,Math.min(k+G,d))}}else o.includes("left")?Z={left:Math.max(A-r,L)}:o.includes("right")?Z={left:Math.min(k,d)}:Z=k+r>a?Math.max(A-r,L)<T1?{left:Math.min(k,d)}:{left:Math.max(A-r,L)}:{left:Math.min(k,d)};return{...N,...Z}}const{left:_,top:S,right:H,bottom:V}=t,E=o.includes("left")?{left:Math.max(_-r,L)}:{left:Math.min(H,d)};let D;if(o.includes("center")){const w=(V-S-n)/2;D=Math.max(S+w,v)+n>i?{top:Math.max(Math.min(m,V-n-w),v)}:{top:Math.max(v,Math.min(S+w,m))}}else o.includes("top")?D={top:Math.min(S,m)}:o.includes("bottom")?D={top:Math.max(V-n,v)}:D=S+n>i?Math.max(V-n,v)<T1?{top:Math.min(S,m)}:{top:Math.max(V-n,v)}:{top:Math.min(S,m)};return{...D,...E}}function K1(e){var e1;const{mask:t,portal:r,children:n,anchorRect$:i,direction:a="vertical",onClickOutside:o,excludeOutside:c,excludeRects:v,onPointerEnter:m,onPointerLeave:L,onClick:d,hidden:_,onContextMenu:S,zIndex:H=1020,maskZIndex:V=100,onMaskClick:E,noPushMinimumGap:D,autoRelayout:k=!0}=e,w=s.useRef(null),A=I1(o!=null?o:()=>{}),M=I1(S!=null?S:()=>{}),N=s.useRef({top:-9999,left:-9999}),Z=v,R=x.useDependency(h.IConfigService),G=s.useRef(void 0),Y=R.getConfig(z1),K=(e1=Y==null?void 0:Y.popupRootId)!=null?e1:"univer-popup-portal",J=I1(W=>{requestAnimationFrame(()=>{if(!w.current)return;const{clientWidth:t1,clientHeight:u1}=w.current,L1=window.innerWidth,H1=window.innerHeight;N.current=E9({position:W,width:t1,height:u1,containerWidth:L1,containerHeight:H1,direction:a,noPushMinimumGap:D}),w.current.style.top=`${N.current.top}px`,w.current.style.left=`${N.current.left}px`})});s.useEffect(()=>{let W;return w.current&&(W=new ResizeObserver(()=>{k&&G.current&&J(G.current)}),W.observe(w.current)),()=>{W==null||W.disconnect()}},[w.current,k]),s.useEffect(()=>{const W=i.subscribe(t1=>{G.current=t1,J(t1)});return()=>W.unsubscribe()},[i,a]),s.useEffect(()=>{const W=t1=>{var V1;if(c&&(c.indexOf(t1.target)>-1||c.some(o1=>o1.contains(t1.target))))return;const u1=t1.clientX,L1=t1.clientY,H1=[...(V1=Z==null?void 0:Z.current)!=null?V1:[]];G.current&&H1.push(G.current);for(const o1 of H1)if(u1<=o1.right&&u1>=o1.left&&L1<=o1.bottom&&L1>=o1.top)return;A(t1)};return window.addEventListener("pointerdown",W),()=>{window.removeEventListener("pointerdown",W)}},[A,c,Z]),s.useEffect(()=>{const W=t1=>{t1.ctrlKey&&t1.button===0||M()};return window.addEventListener("contextmenu",W),()=>{window.removeEventListener("contextmenu",W)}},[M]);const q=C.jsxs(C.Fragment,{children:[t&&C.jsx("div",{"data-u-comp":"rect-popup-mask",className:"univer-fixed univer-bottom-0 univer-left-0 univer-right-0 univer-top-0 univer-z-[100]",style:{zIndex:V},onClick:E}),C.jsx("section",{"data-u-comp":"rect-popup",ref:w,className:`
23
23
  univer-pointer-events-auto univer-fixed univer-left-[-9999px] univer-top-[-9999px] univer-z-[1020]
24
24
  `,style:{...N.current,..._?{display:"none"}:null,zIndex:H},onPointerDown:W=>W.stopPropagation(),onClick:d,onPointerEnter:m,onPointerLeave:L,children:C.jsx(H9.Provider,{value:G,children:n})})]});return r?document.getElementById(K)?v3.createPortal(q,document.getElementById(K)):null:q}K1.calcPopupPosition=E9,K1.useContext=()=>s.useContext(H9);var m2=Object.getOwnPropertyDescriptor,p2=(e,t,r,n)=>{for(var i=n>1?void 0:n?m2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},O9=(e,t)=>(r,n)=>t(r,n,e);const b2="FOCUSING_UNIVER",L2=["app-layout","button","sheet-bar-append-button","render-canvas","workbench-layout"],y1=h.createIdentifier("ui.layout-service");f.DesktopLayoutService=class extends h.Disposable{constructor(r,n){super();F(this,"_rootContainerElement",null);F(this,"_isFocused",!1);F(this,"_focusHandlers",new Map);F(this,"_contentElements",[]);F(this,"_allContainers",[]);this._contextService=r,this._univerInstanceService=n,this._initUniverFocusListener(),this._initEditorStatus()}get isFocused(){return this._isFocused}get rootContainerElement(){return this._rootContainerElement}focus(){const r=this._univerInstanceService.getFocusedUnit();if(!r)return;let n;r instanceof h.Workbook?n=this._focusHandlers.get(h.UniverInstanceType.UNIVER_SHEET):r instanceof h.DocumentDataModel?n=this._focusHandlers.get(h.UniverInstanceType.UNIVER_DOC):r instanceof h.SlideDataModel&&(n=this._focusHandlers.get(h.UniverInstanceType.UNIVER_SLIDE)),n&&n(r.getUnitId())}registerFocusHandler(r,n){if(this._focusHandlers.has(r))throw new Error(`[DesktopLayoutService]: handler of type ${r} bas been registered!`);return this._focusHandlers.set(r,n),h.toDisposable(()=>this._focusHandlers.delete(r))}registerContentElement(r){if(this._contentElements.indexOf(r)===-1)return this._contentElements.push(r),h.toDisposable(()=>h.remove(this._contentElements,r));throw new Error("[DesktopLayoutService]: content container already registered!")}getContentElement(){return this._contentElements[0]}registerRootContainerElement(r){if(this._rootContainerElement)throw new Error("[DesktopLayoutService]: root container already registered!");this._rootContainerElement=r;const n=this.registerContainerElement(r);return h.toDisposable(()=>{this._rootContainerElement=null,n.dispose()})}registerContainerElement(r){if(this._allContainers.indexOf(r)===-1)return this._allContainers.push(r),h.toDisposable(()=>h.remove(this._allContainers,r));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentContainers(r){return this._allContainers.some(n=>n.contains(r))}checkContentIsFocused(){return this._contentElements.some(r=>r===document.activeElement||r.contains(document.activeElement))}_initUniverFocusListener(){this.disposeWithMe(j.fromEvent(window,"focusin").subscribe(r=>{var i;const n=r.target;if((i=this._rootContainerElement)!=null&&i.contains(n)&&L2.some(a=>n.dataset.uComp===a)){queueMicrotask(()=>this.focus());return}n&&this.checkElementInCurrentContainers(n)?this._isFocused=!0:this._isFocused=!1,this._contextService.setContextValue(b2,this._isFocused),this._contextService.setContextValue(h.FOCUSING_UNIVER_EDITOR,I9())}))}_initEditorStatus(){this._contextService.setContextValue(h.FOCUSING_UNIVER_EDITOR,I9())}},f.DesktopLayoutService=p2([O9(0,h.IContextService),O9(1,h.IUniverInstanceService)],f.DesktopLayoutService);function I9(){var e;return((e=document.activeElement)==null?void 0:e.dataset.uComp)==="editor"}var f1=(e=>(e[e.BUTTON=0]="BUTTON",e[e.SELECTOR=1]="SELECTOR",e[e.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",e[e.SUBITEMS=3]="SUBITEMS",e))(f1||{}),Z1=(e=>(e.RIBBON="ribbon",e.CONTEXT_MENU="contextMenu",e))(Z1||{}),_1=(e=>(e.START="ribbon.start",e.INSERT="ribbon.insert",e.FORMULAS="ribbon.formulas",e.DATA="ribbon.data",e.VIEW="ribbon.view",e.OTHERS="ribbon.others",e))(_1||{}),p1=(e=>(e.HISTORY="ribbon.start.history",e.FORMAT="ribbon.start.format",e.LAYOUT="ribbon.start.layout",e.FORMULAS_INSERT="ribbon.start.insert",e.FORMULAS_VIEW="ribbon.start.view",e.FILE="ribbon.start.file",e.OTHERS="ribbon.start.others",e))(p1||{}),Se=(e=>(e.OTHERS="ribbon.insert.others",e))(Se||{}),Me=(e=>(e.OTHERS="ribbon.formulas.others",e))(Me||{}),we=(e=>(e.OTHERS="ribbon.data.others",e))(we||{}),He=(e=>(e.OTHERS="ribbon.view.others",e))(He||{}),Ee=(e=>(e.OTHERS="ribbon.others.others",e))(Ee||{}),S1=(e=>(e.MAIN_AREA="contextMenu.mainArea",e.COL_HEADER="contextMenu.colHeader",e.ROW_HEADER="contextMenu.rowHeader",e.FOOTER_TABS="contextMenu.footerTabs",e.FOOTER_MENU="contextMenu.footerMenu",e.PARAGRAPH="contextMenu.paragraph",e))(S1||{}),n1=(e=>(e.QUICK="contextMenu.quick",e.FORMAT="contextMenu.format",e.LAYOUT="contextMenu.layout",e.DATA="contextMenu.data",e.OTHERS="contextMenu.others",e))(n1||{}),y2=Object.getOwnPropertyDescriptor,_2=(e,t,r,n)=>{for(var i=n>1?void 0:n?y2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},D9=(e,t)=>(r,n)=>t(r,n,e);const b1=h.createIdentifier("univer.menu-manager-service");f.MenuManagerService=class extends h.Disposable{constructor(r,n){super();F(this,"menuChanged$",new j.Subject);F(this,"_menu",{[Z1.RIBBON]:{[_1.START]:{order:0,[p1.HISTORY]:{order:0},[p1.FORMAT]:{order:1},[p1.LAYOUT]:{order:2},[p1.FORMULAS_INSERT]:{order:3},[p1.FORMULAS_VIEW]:{order:4},[p1.FILE]:{order:5},[p1.OTHERS]:{order:6}},[_1.INSERT]:{order:1,[Se.OTHERS]:{order:0}},[_1.FORMULAS]:{order:2,[Me.OTHERS]:{order:0}},[_1.DATA]:{order:3,[we.OTHERS]:{order:0}},[_1.VIEW]:{order:4,[He.OTHERS]:{order:0}},[_1.OTHERS]:{order:5,[Ee.OTHERS]:{order:0}}},[Z1.CONTEXT_MENU]:{[S1.MAIN_AREA]:{order:0,[n1.QUICK]:{order:-1},[n1.FORMAT]:{order:0},[n1.LAYOUT]:{order:1},[n1.DATA]:{order:2},[n1.OTHERS]:{order:3}},[S1.PARAGRAPH]:{order:0,[n1.QUICK]:{order:-1},[n1.FORMAT]:{order:0},[n1.LAYOUT]:{order:1},[n1.DATA]:{order:2},[n1.OTHERS]:{order:3}},[S1.COL_HEADER]:{order:1,[n1.FORMAT]:{order:0},[n1.LAYOUT]:{order:1},[n1.DATA]:{order:2},[n1.OTHERS]:{order:3}},[S1.ROW_HEADER]:{order:2,[n1.FORMAT]:{order:0},[n1.LAYOUT]:{order:1},[n1.DATA]:{order:2},[n1.OTHERS]:{order:3}},[S1.FOOTER_TABS]:{order:3,[n1.FORMAT]:{order:0},[n1.LAYOUT]:{order:1},[n1.DATA]:{order:2},[n1.OTHERS]:{order:3}},[S1.FOOTER_MENU]:{order:4,[n1.OTHERS]:{order:3}}}});this._injector=r,this._configService=n}dispose(){this.menuChanged$.complete()}mergeMenu(r,n){const i=n!=null?n:this._menu;for(const[a,o]of Object.entries(i))if(a in r){const c=a;i[c]=h.merge({},i[c],r[c]),this.menuChanged$.next()}else typeof o=="object"&&this.mergeMenu(r,o)}appendRootMenu(r){this._menu=h.merge({},this._menu,r),this.menuChanged$.next()}_buildMenuSchema(r){const n=[];for(const[i,a]of Object.entries(r)){const o={key:i,order:a.order,title:a.title};if(a.menuItemFactory){const c=this._injector.invoke(a.menuItemFactory);if(c){const v=this._configService.getConfig("menu");if(v&&c.id in v){const m=c.id;o.item=g9(c,v[m])}else o.item=c}}if(typeof a=="object"){const c=this._buildMenuSchema(a);c.length>0&&(o.children=c.sort((v,m)=>v.order-m.order)),(o.item||o.children)&&n.push(o)}}return n}getMenuByPositionKey(r){const n=i=>{if(r in i)return this._buildMenuSchema(i[r]);for(const a in i){if(a===r)return this._buildMenuSchema(i[a]);if(typeof i[a]=="object"){const o=n(i[a]);if(o)return o}}};return n(this._menu)}getFlatMenuByPositionKey(r){const n=this.getMenuByPositionKey(r);function i(a){return a.reduce((o,c)=>c.children?[...o,c,...i(c.children)]:[...o,c],[])}return i(n)}},f.MenuManagerService=_2([D9(0,h.Inject(h.Injector)),D9(1,h.IConfigService)],f.MenuManagerService);function S2(e){const{item:t,onOptionSelect:r}=e,[n,i]=s.useState([]),a=x.useDependency(d1),o=x.useDependency(h.LocaleService);return s.useEffect(()=>{if(!t.children)return;const c=t.children.map(m=>{var L,d;return h.convertObservableToBehaviorSubject((d=(L=m.item)==null?void 0:L.activated$)!=null?d:j.of(!1),!1)}),v=j.combineLatest(c).subscribe(m=>{const L=m.map((d,_)=>({actived:d,item:t.children[_].item.id})).filter(d=>d.actived);L.length===0?i([]):i(L.map(d=>d.item))});return()=>{v.unsubscribe(),c.forEach(m=>{m.complete()})}},[t]),t.children?C.jsx(z.TinyMenuGroup,{items:t.children.map(c=>{var v,m;return{key:c.key,onClick:()=>{var L,d,_,S;r==null||r({value:"",label:c.key,commandId:(L=c.item)==null?void 0:L.commandId,id:(d=c.item)==null?void 0:d.id,tooltip:((_=c.item)==null?void 0:_.tooltip)&&o.t((S=c.item)==null?void 0:S.tooltip)})},className:"",Icon:a.get(c.item.icon),active:n.includes((m=(v=c.item)==null?void 0:v.id)!=null?m:"")}})}):null}const B1="univer-inline-flex univer-gap-2 univer-items-center",V9="univer-size-3.5 univer-text-gray-900 dark:univer-text-white";function T9(e){const{menuType:t,onOptionSelect:r}=e,n=x.useDependency(h.LocaleService),i=x.useDependency(b1),a=s.useMemo(()=>t?i.getMenuByPositionKey(t):[],[t,i]),[o,c]=s.useState({}),v=s.useMemo(()=>a.filter(m=>{var d;if(!m.children)return m;const L=((d=m.key)==null?void 0:d.toString())||"";return!o[L]}),[a,o]);return s.useEffect(()=>{const m=a.map(L=>{if(!L.children)return null;const d=L.children.map(_=>{var S,H;return(H=(S=_.item)==null?void 0:S.hidden$)!=null?H:j.of(!1)});return j.combineLatest(d).subscribe(_=>{const S=_.every(H=>H===!0);c(H=>({...H,[L.key]:S}))})});return()=>{m.forEach(L=>L==null?void 0:L.unsubscribe()),c({})}},[a]),t?v&&v.map(m=>{var L;return m.item?C.jsx(k9,{menuItem:m.item,onClick:d=>{r==null||r({value:"",label:m.key,...d})}},m.key):(L=m.children)!=null&&L.length?m.key===n1.QUICK?C.jsx(S2,{item:m,onOptionSelect:r},m.key):C.jsx(z.MenuItemGroup,{eventKey:m.key,title:m.title?n.t(m.title):void 0,children:m.children.map(d=>d.item&&C.jsx(k9,{menuItem:d.item,onClick:_=>{r==null||r({value:"",label:d.key,..._})}},d.key))},m.key):null}):null}function N9(e){var a;const{options:t,value:r,onOptionSelect:n,parentKey:i}=e;return(a=t==null?void 0:t.map((o,c)=>{var _,S,H;const v=`${i}-${(_=o.label)!=null?_:o.id}-${c}`,m=V=>{n==null||n({value:V,label:o==null?void 0:o.label,commandId:o==null?void 0:o.commandId})},L=()=>{typeof o.value>"u"||n==null||n({...o})},d=z.clsx({"univer-bg-none":typeof o.label!="string"&&!((S=o.label)!=null&&S.hoverable)});return C.jsx(z.MenuItem,{disabled:o.disabled,eventKey:v,className:d,onClick:L,children:C.jsxs("span",{className:z.clsx(B1,{"univer-relative univer-pl-5":!(typeof o.label!="string"&&!((H=o.label)!=null&&H.hoverable))}),children:[typeof r<"u"&&String(r)===String(o.value)&&C.jsx("span",{className:"univer-absolute univer-left-0 univer-inline-flex univer-items-center",children:C.jsx(be,{className:"univer-text-primary-600"})}),C.jsx(l1,{value$:o.value$,value:o.value,label:o.label,icon:o.icon,onChange:m})]})},v)}))!=null?a:null}const Oe=e=>{const{overViewport:t,style:r,...n}=e,[i,a]=s.useState(),o=x.useDependency(y1);_9(t==="scroll"?i:null,o.rootContainerElement);function c(v){v&&a(v.list)}return C.jsxs(z.Menu,{style:r,ref:c,selectable:!1,children:[C.jsx(N9,{...n}),C.jsx(T9,{...n})]})};function k9({menuItem:e,onClick:t}){const r=x.useDependency(b1),n=x.useObservable(e.disabled$,!1),i=x.useObservable(e.activated$,!1),a=x.useObservable(e.hidden$,!1),o=x.useObservable(e.value$),c=e,v=x.useObservable(j.isObservable(c.selections)?c.selections:void 0),[m,L]=s.useState(o);if(s.useEffect(()=>{L(o)},[o]),a)return null;const d=E=>{const D=h.isRealNum(E)&&typeof E=="string"?Number.parseInt(E):E;L(D)},_=()=>{const E=e,{title:D,label:k}=E;return C.jsx(z.MenuItem,{eventKey:E.id,disabled:n,className:z.clsx({"univer-bg-gray-200":i}),onClick:()=>{t({commandId:E.commandId,value:m,id:E.id})},children:C.jsx("span",{className:B1,children:C.jsx(l1,{value:o,title:D,label:k,icon:E.icon,onChange:d})})},E.id)},S=()=>{var D;const E=(D=v!=null?v:c.selections)!=null?D:[];return E.length>0?C.jsx(z.SubMenu,{eventKey:c.id,popupOffset:[18,0],title:C.jsxs("span",{className:B1,children:[C.jsx(l1,{title:c.title,value:m,onChange:d,icon:c.icon,label:c.label}),c.shortcut&&` (${c.shortcut})`]}),expandIcon:C.jsx(ye,{className:V9}),children:C.jsx(z.MenuItemGroup,{children:E.length>0&&C.jsx(N9,{parentKey:c.id,menuType:c.id,options:E,onOptionSelect:k=>{t({value:k.value,id:c.id,commandId:k.commandId})}})})},c.id):C.jsx(z.MenuItem,{eventKey:c.id,children:C.jsxs("span",{className:B1,children:[C.jsx(l1,{title:c.title,value:m,icon:c.icon,label:c.label,onChange:d}),c.shortcut&&` (${c.shortcut})`]})},c.id)},H=e.id?r.getMenuByPositionKey(e.id):[],V=()=>{const E=e;return C.jsx(z.SubMenu,{eventKey:E.id,popupOffset:[18,0],title:C.jsx("span",{className:B1,children:C.jsx(l1,{title:E.title,icon:E.icon,label:E.label,onChange:d})}),expandIcon:C.jsx(ye,{className:V9}),children:C.jsx(z.MenuItemGroup,{children:H.length&&C.jsx(T9,{menuType:E.id,parentKey:E.id,onOptionSelect:t})})},E.id)};return C.jsxs(C.Fragment,{children:[e.type===f1.SELECTOR&&S(),e.type===f1.SUBITEMS&&V(),e.type===f1.BUTTON&&_()]})}function M2(e){const{barColor:t,progress:r,onTerminate:n,onClearProgress:i}=e,{count:a,done:o,label:c=""}=r,v=s.useRef(null),[m,L]=s.useState(!1);return s.useEffect(()=>{const d=v.current;if(a===0&&o===0){L(!1),d.style.width="0%";return}else if(a>0){L(!0);const S=Math.floor(o/a*100);o===a?requestAnimationFrame(()=>{d.style.width=`${S-1}%`,requestAnimationFrame(()=>{d.style.width=`${S}%`})}):d.style.width=`${S}%`}const _=()=>{o===a&&(L(!1),i&&i())};return d.addEventListener("transitionend",_),()=>{d.removeEventListener("transitionend",_)}},[a,o]),C.jsxs("div",{className:z.clsx("univer-mx-2 univer-flex univer-items-center univer-gap-2",{"univer-flex":m,"univer-hidden univer-w-0":!m}),children:[C.jsx(z.Tooltip,{showIfEllipsis:!0,title:c,children:C.jsx("span",{className:"univer-w-24 univer-truncate univer-text-right univer-text-xs",children:c})}),C.jsx("div",{className:"univer-h-1 univer-w-40 univer-overflow-hidden univer-rounded-lg univer-bg-gray-200",children:C.jsx("div",{ref:v,className:"univer-h-full univer-bg-primary-600 univer-transition-[width]",style:{backgroundColor:t}})}),C.jsx("button",{className:`
25
25
  univer-flex univer-size-4 univer-cursor-pointer univer-items-center univer-justify-center
26
26
  univer-border-none univer-bg-transparent univer-p-0
27
27
  hover:univer-opacity-50
28
- `,type:"button",onClick:n,children:C.jsx(Le,{className:"univer-size-3.5 univer-text-gray-900"})})]})}const w2="UNI_DISABLE_CHANGING_FOCUS",ee=h.createIdentifier("ui.message.service");var H2=Object.getOwnPropertyDescriptor,E2=(e,t,r,n)=>{for(var i=n>1?void 0:n?H2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},x9=(e,t)=>(r,n)=>t(r,n,e);f.ErrorController=class extends h.Disposable{constructor(t,r){super(),this._errorService=t,this._messageService=r,this.disposeWithMe(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:z.MessageType.Error})}))}},f.ErrorController=E2([x9(0,h.Inject(h.ErrorService)),x9(1,ee)],f.ErrorController);class te extends h.Disposable{constructor(){super(...arguments);F(this,"_open$",new j.BehaviorSubject(!1));F(this,"open$",this._open$.pipe(j.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){super.dispose(),this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const O2=h.createIdentifier("ui.left-sidebar.service"),N1=h.createIdentifier("ui.sidebar.service"),A9="ShortcutPanel",F1={id:"base-ui.operation.toggle-shortcut-panel",type:h.CommandType.OPERATION,handler:e=>{const t=e.get(te),r=e.get(N1);return t.isOpen?(t.close(),r.close()):(t.open(),r.open({header:{title:"shortcut-panel.title"},children:{label:A9}})),!0}};function I2(e){return{id:F1.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:f1.BUTTON,hidden$:C9(e,h.UniverInstanceType.UNIVER_SHEET)}}const $9=(e,t)=>{const r=e.get(h.IUndoRedoService),n=e.get(h.IContextService);return j.combineLatest([r.undoRedoStatus$.pipe(C3.map(i=>t?i.undos<=0:i.redos<=0)),j.merge([j.of({}),n.contextChanged$])]).pipe(C3.map(([i])=>i||n.getContextValue(h.EDITOR_ACTIVATED)||n.getContextValue(h.FOCUSING_FX_BAR_EDITOR)))};function D2(e){return{id:h.UndoCommand.id,type:f1.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",disabled$:$9(e,!0)}}function V2(e){return{id:h.RedoCommand.id,type:f1.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",disabled$:$9(e,!1)}}const P9={[p1.HISTORY]:{[h.UndoCommand.id]:{order:0,menuItemFactory:D2},[h.RedoCommand.id]:{order:1,menuItemFactory:V2}},[p1.OTHERS]:{[F1.id]:{order:99,menuItemFactory:I2}}},U9="univer.command.copy",Ie={id:U9,name:U9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:()=>!0},z9="univer.command.cut",De={id:z9,name:z9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},Z9="univer.command.paste",Ve={id:Z9,name:Z9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:()=>!0},T2="sheet.command.paste-by-short-key";var M1=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.EQUAL=187]="EQUAL",e[e.COMMA=188]="COMMA",e[e.MINUS=189]="MINUS",e[e.PERIOD=190]="PERIOD",e[e.BACK_SLASH=220]="BACK_SLASH",e))(M1||{});const N2={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",189:"-",187:"=",190:".",188:",",220:"\\"};var c1=(e=>(e[e.SHIFT=1024]="SHIFT",e[e.ALT=2048]="ALT",e[e.CTRL_COMMAND=4096]="CTRL_COMMAND",e[e.MAC_CTRL=8192]="MAC_CTRL",e))(c1||{});function k2(e,t,r){return window.addEventListener(e,t,r),h.toDisposable(()=>window.removeEventListener(e,t,r))}const re=h.createIdentifier("ui.platform.service");class Te{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}}var x2=Object.getOwnPropertyDescriptor,A2=(e,t,r,n)=>{for(var i=n>1?void 0:n?x2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ne=(e,t)=>(r,n)=>t(r,n,e);const k1=h.createIdentifier("ui.shortcut.service");f.ShortcutService=class extends h.Disposable{constructor(r,n,i,a){super();F(this,"_shortCutMapping",new Map);F(this,"_commandIDMapping",new Map);F(this,"_shortcutChanged$",new j.Subject);F(this,"shortcutChanged$",this._shortcutChanged$.asObservable());F(this,"_forceEscaped",!1);F(this,"_forceDisabled",!1);this._commandService=r,this._platformService=n,this._contextService=i,this._layoutService=a,this.disposeWithMe(k2("keydown",o=>{this._resolveKeyboardEvent(o)},{capture:!0}))}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(r=>Array.from(r.values())).flat()}registerShortcut(r){const n=this._getBindingFromItem(r);if(!n)return h.toDisposable(()=>{});const i=this._shortCutMapping.get(n);i?i.add(r):this._shortCutMapping.set(n,new Set([r]));const a=r.id,o=this._commandIDMapping.get(a);return o?o.add(r):this._commandIDMapping.set(a,new Set([r])),this._emitShortcutChanged(),h.toDisposable(()=>{var c,v,m,L;(c=this._shortCutMapping.get(n))==null||c.delete(r),((v=this._shortCutMapping.get(n))==null?void 0:v.size)===0&&this._shortCutMapping.delete(n),(m=this._commandIDMapping.get(a))==null||m.delete(r),((L=this._commandIDMapping.get(a))==null?void 0:L.size)===0&&this._commandIDMapping.delete(a),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(r){const n=this._commandIDMapping.get(r);if(!n)return null;const i=n.values().next().value;return i?this.getShortcutDisplay(i):null}getShortcutDisplay(r){var m;const n=this._getBindingFromItem(r);if(!n)return null;const i=n&c1.CTRL_COMMAND,a=n&c1.SHIFT,o=n&c1.ALT,c=n&c1.MAC_CTRL,v=(m=N2[n&255])!=null?m:"<->";return this._platformService.isMac?`${i?"⌘+":""}${a?"⇧+":""}${o?"⌥+":""}${c?"⌃+":""}${v}`:`${i?"Ctrl+":""}${a?"Shift+":""}${o?"Alt+":""}${v}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,h.toDisposable(()=>this._forceEscaped=!1)}forceDisable(){return this._forceDisabled=!0,h.toDisposable(()=>{this._forceDisabled=!1})}_resolveKeyboardEvent(r){const n=this.dispatch(r);n&&(this._commandService.executeCommand(n.id,n.staticParameters),r.preventDefault())}dispatch(r){if(this._forceEscaped||this._forceDisabled||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(r.target))return;const n=this._deriveBindingFromEvent(r);if(n===null)return;const i=this._shortCutMapping.get(n);return i===void 0?void 0:Array.from(i).sort((o,c)=>{var v,m;return((v=c.priority)!=null?v:0)-((m=o.priority)!=null?m:0)}).find(o=>{var c,v;return(v=(c=o.preconditions)==null?void 0:c.call(o,this._contextService))!=null?v:!0})}_getBindingFromItem(r){return this._platformService.isMac&&r.mac?r.mac:this._platformService.isWindows&&r.win?r.win:this._platformService.isLinux&&r.linux?r.linux:r.binding}_deriveBindingFromEvent(r){const{shiftKey:n,metaKey:i,altKey:a,keyCode:o}=r;let c=o;return n&&(c|=c1.SHIFT),a&&(c|=c1.ALT),(this._platformService.isMac?i:r.ctrlKey)&&(c|=c1.CTRL_COMMAND),this._platformService.isMac&&r.ctrlKey&&(c|=c1.MAC_CTRL),c}},f.ShortcutService=A2([ne(0,h.ICommandService),ne(1,re),ne(2,h.IContextService),ne(3,h.Optional(y1))],f.ShortcutService);var $2=Object.getOwnPropertyDescriptor,P2=(e,t,r,n)=>{for(var i=n>1?void 0:n?$2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},B9=(e,t)=>(r,n)=>t(r,n,e);function F9(e){return e.getContextValue(h.FOCUSING_UNIVER_EDITOR)}function j9(e){return e.getContextValue(h.FOCUSING_UNIVER_EDITOR)&&!(e.getContextValue(h.EDITOR_ACTIVATED)||e.getContextValue(h.FOCUSING_FX_BAR_EDITOR))}const R9={id:Ie.id,description:"shortcut.copy",group:"1_common-edit",binding:M1.C|c1.CTRL_COMMAND,preconditions:F9},G9={id:De.id,description:"shortcut.cut",group:"1_common-edit",binding:M1.X|c1.CTRL_COMMAND,preconditions:F9},U2={id:Ve.id,description:"shortcut.paste",group:"1_common-edit",binding:M1.V|c1.CTRL_COMMAND,preconditions:()=>!1},W9={id:h.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:M1.Z|c1.CTRL_COMMAND,preconditions:j9},Y9={id:h.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:M1.Y|c1.CTRL_COMMAND,preconditions:j9};f.SharedController=class extends h.Disposable{constructor(t,r){super(),this._shortcutService=t,this._commandService=r,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts()}_registerCommands(){[De,Ie,Ve].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_registerShortcuts(){const t=[W9,Y9];t.push(G9,R9,U2),t.forEach(r=>this.disposeWithMe(this._shortcutService.registerShortcut(r)))}},f.SharedController=P2([B9(0,k1),B9(1,h.ICommandService)],f.SharedController);function z2(){const e=x.useDependency(k1),t=x.useDependency(h.LocaleService),r=x.useObservable(t.currentLocale$),[n,i]=s.useState([]),a=s.useCallback(()=>{var m;const o=new Map,c=e.getAllShortcuts().filter(L=>!!L.group);for(const L of c){const d=L.group,_={title:t.t((m=L.description)!=null?m:L.id),shortcut:e.getShortcutDisplay(L)};if(!/\d+_[a-zA-Z0-9]/.test(d))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${d}!`);o.has(d)||o.set(d,[]),o.get(d).push(_)}const v=Array.from(o.entries()).map(([L,d])=>{const _=L.split("_")[0],S=L.slice(_.length+1);return{sequence:+_,name:t.t(S),items:h.dedupeBy(d,H=>H.title+H.shortcut)}}).sort((L,d)=>L.sequence-d.sequence);i(v)},[e,t,r]);return s.useEffect(()=>{a();const o=e.shortcutChanged$.subscribe(()=>a());return()=>o.unsubscribe()},[e,a]),C.jsx("ul",{className:`
28
+ `,type:"button",onClick:n,children:C.jsx(Le,{className:`
29
+ univer-size-3.5
30
+ dark:univer-text-white
31
+ `})})]})}const w2="UNI_DISABLE_CHANGING_FOCUS",ee=h.createIdentifier("ui.message.service");var H2=Object.getOwnPropertyDescriptor,E2=(e,t,r,n)=>{for(var i=n>1?void 0:n?H2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},x9=(e,t)=>(r,n)=>t(r,n,e);f.ErrorController=class extends h.Disposable{constructor(t,r){super(),this._errorService=t,this._messageService=r,this.disposeWithMe(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:z.MessageType.Error})}))}},f.ErrorController=E2([x9(0,h.Inject(h.ErrorService)),x9(1,ee)],f.ErrorController);class te extends h.Disposable{constructor(){super(...arguments);F(this,"_open$",new j.BehaviorSubject(!1));F(this,"open$",this._open$.pipe(j.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){super.dispose(),this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const O2=h.createIdentifier("ui.left-sidebar.service"),N1=h.createIdentifier("ui.sidebar.service"),A9="ShortcutPanel",F1={id:"base-ui.operation.toggle-shortcut-panel",type:h.CommandType.OPERATION,handler:e=>{const t=e.get(te),r=e.get(N1);return t.isOpen?(t.close(),r.close()):(t.open(),r.open({header:{title:"shortcut-panel.title"},children:{label:A9}})),!0}};function I2(e){return{id:F1.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:f1.BUTTON,hidden$:C9(e,h.UniverInstanceType.UNIVER_SHEET)}}const $9=(e,t)=>{const r=e.get(h.IUndoRedoService),n=e.get(h.IContextService);return j.combineLatest([r.undoRedoStatus$.pipe(C3.map(i=>t?i.undos<=0:i.redos<=0)),j.merge([j.of({}),n.contextChanged$])]).pipe(C3.map(([i])=>i||n.getContextValue(h.EDITOR_ACTIVATED)||n.getContextValue(h.FOCUSING_FX_BAR_EDITOR)))};function D2(e){return{id:h.UndoCommand.id,type:f1.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",disabled$:$9(e,!0)}}function V2(e){return{id:h.RedoCommand.id,type:f1.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",disabled$:$9(e,!1)}}const P9={[p1.HISTORY]:{[h.UndoCommand.id]:{order:0,menuItemFactory:D2},[h.RedoCommand.id]:{order:1,menuItemFactory:V2}},[p1.OTHERS]:{[F1.id]:{order:99,menuItemFactory:I2}}},U9="univer.command.copy",Ie={id:U9,name:U9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:()=>!0},z9="univer.command.cut",De={id:z9,name:z9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},Z9="univer.command.paste",Ve={id:Z9,name:Z9,multi:!0,priority:0,type:h.CommandType.COMMAND,preconditions:()=>!1,handler:()=>!0},T2="sheet.command.paste-by-short-key";var M1=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.EQUAL=187]="EQUAL",e[e.COMMA=188]="COMMA",e[e.MINUS=189]="MINUS",e[e.PERIOD=190]="PERIOD",e[e.BACK_SLASH=220]="BACK_SLASH",e))(M1||{});const N2={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",189:"-",187:"=",190:".",188:",",220:"\\"};var c1=(e=>(e[e.SHIFT=1024]="SHIFT",e[e.ALT=2048]="ALT",e[e.CTRL_COMMAND=4096]="CTRL_COMMAND",e[e.MAC_CTRL=8192]="MAC_CTRL",e))(c1||{});function k2(e,t,r){return window.addEventListener(e,t,r),h.toDisposable(()=>window.removeEventListener(e,t,r))}const re=h.createIdentifier("ui.platform.service");class Te{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}}var x2=Object.getOwnPropertyDescriptor,A2=(e,t,r,n)=>{for(var i=n>1?void 0:n?x2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ne=(e,t)=>(r,n)=>t(r,n,e);const k1=h.createIdentifier("ui.shortcut.service");f.ShortcutService=class extends h.Disposable{constructor(r,n,i,a){super();F(this,"_shortCutMapping",new Map);F(this,"_commandIDMapping",new Map);F(this,"_shortcutChanged$",new j.Subject);F(this,"shortcutChanged$",this._shortcutChanged$.asObservable());F(this,"_forceEscaped",!1);F(this,"_forceDisabled",!1);this._commandService=r,this._platformService=n,this._contextService=i,this._layoutService=a,this.disposeWithMe(k2("keydown",o=>{this._resolveKeyboardEvent(o)},{capture:!0}))}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(r=>Array.from(r.values())).flat()}registerShortcut(r){const n=this._getBindingFromItem(r);if(!n)return h.toDisposable(()=>{});const i=this._shortCutMapping.get(n);i?i.add(r):this._shortCutMapping.set(n,new Set([r]));const a=r.id,o=this._commandIDMapping.get(a);return o?o.add(r):this._commandIDMapping.set(a,new Set([r])),this._emitShortcutChanged(),h.toDisposable(()=>{var c,v,m,L;(c=this._shortCutMapping.get(n))==null||c.delete(r),((v=this._shortCutMapping.get(n))==null?void 0:v.size)===0&&this._shortCutMapping.delete(n),(m=this._commandIDMapping.get(a))==null||m.delete(r),((L=this._commandIDMapping.get(a))==null?void 0:L.size)===0&&this._commandIDMapping.delete(a),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(r){const n=this._commandIDMapping.get(r);if(!n)return null;const i=n.values().next().value;return i?this.getShortcutDisplay(i):null}getShortcutDisplay(r){var m;const n=this._getBindingFromItem(r);if(!n)return null;const i=n&c1.CTRL_COMMAND,a=n&c1.SHIFT,o=n&c1.ALT,c=n&c1.MAC_CTRL,v=(m=N2[n&255])!=null?m:"<->";return this._platformService.isMac?`${i?"⌘+":""}${a?"⇧+":""}${o?"⌥+":""}${c?"⌃+":""}${v}`:`${i?"Ctrl+":""}${a?"Shift+":""}${o?"Alt+":""}${v}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,h.toDisposable(()=>this._forceEscaped=!1)}forceDisable(){return this._forceDisabled=!0,h.toDisposable(()=>{this._forceDisabled=!1})}_resolveKeyboardEvent(r){const n=this.dispatch(r);n&&(this._commandService.executeCommand(n.id,n.staticParameters),r.preventDefault())}dispatch(r){if(this._forceEscaped||this._forceDisabled||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(r.target))return;const n=this._deriveBindingFromEvent(r);if(n===null)return;const i=this._shortCutMapping.get(n);return i===void 0?void 0:Array.from(i).sort((o,c)=>{var v,m;return((v=c.priority)!=null?v:0)-((m=o.priority)!=null?m:0)}).find(o=>{var c,v;return(v=(c=o.preconditions)==null?void 0:c.call(o,this._contextService))!=null?v:!0})}_getBindingFromItem(r){return this._platformService.isMac&&r.mac?r.mac:this._platformService.isWindows&&r.win?r.win:this._platformService.isLinux&&r.linux?r.linux:r.binding}_deriveBindingFromEvent(r){const{shiftKey:n,metaKey:i,altKey:a,keyCode:o}=r;let c=o;return n&&(c|=c1.SHIFT),a&&(c|=c1.ALT),(this._platformService.isMac?i:r.ctrlKey)&&(c|=c1.CTRL_COMMAND),this._platformService.isMac&&r.ctrlKey&&(c|=c1.MAC_CTRL),c}},f.ShortcutService=A2([ne(0,h.ICommandService),ne(1,re),ne(2,h.IContextService),ne(3,h.Optional(y1))],f.ShortcutService);var $2=Object.getOwnPropertyDescriptor,P2=(e,t,r,n)=>{for(var i=n>1?void 0:n?$2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},B9=(e,t)=>(r,n)=>t(r,n,e);function F9(e){return e.getContextValue(h.FOCUSING_UNIVER_EDITOR)}function j9(e){return e.getContextValue(h.FOCUSING_UNIVER_EDITOR)&&!(e.getContextValue(h.EDITOR_ACTIVATED)||e.getContextValue(h.FOCUSING_FX_BAR_EDITOR))}const R9={id:Ie.id,description:"shortcut.copy",group:"1_common-edit",binding:M1.C|c1.CTRL_COMMAND,preconditions:F9},G9={id:De.id,description:"shortcut.cut",group:"1_common-edit",binding:M1.X|c1.CTRL_COMMAND,preconditions:F9},U2={id:Ve.id,description:"shortcut.paste",group:"1_common-edit",binding:M1.V|c1.CTRL_COMMAND,preconditions:()=>!1},W9={id:h.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:M1.Z|c1.CTRL_COMMAND,preconditions:j9},Y9={id:h.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:M1.Y|c1.CTRL_COMMAND,preconditions:j9};f.SharedController=class extends h.Disposable{constructor(t,r){super(),this._shortcutService=t,this._commandService=r,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts()}_registerCommands(){[De,Ie,Ve].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_registerShortcuts(){const t=[W9,Y9];t.push(G9,R9,U2),t.forEach(r=>this.disposeWithMe(this._shortcutService.registerShortcut(r)))}},f.SharedController=P2([B9(0,k1),B9(1,h.ICommandService)],f.SharedController);function z2(){const e=x.useDependency(k1),t=x.useDependency(h.LocaleService),r=x.useObservable(t.currentLocale$),[n,i]=s.useState([]),a=s.useCallback(()=>{var m;const o=new Map,c=e.getAllShortcuts().filter(L=>!!L.group);for(const L of c){const d=L.group,_={title:t.t((m=L.description)!=null?m:L.id),shortcut:e.getShortcutDisplay(L)};if(!/\d+_[a-zA-Z0-9]/.test(d))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${d}!`);o.has(d)||o.set(d,[]),o.get(d).push(_)}const v=Array.from(o.entries()).map(([L,d])=>{const _=L.split("_")[0],S=L.slice(_.length+1);return{sequence:+_,name:t.t(S),items:h.dedupeBy(d,H=>H.title+H.shortcut)}}).sort((L,d)=>L.sequence-d.sequence);i(v)},[e,t,r]);return s.useEffect(()=>{a();const o=e.shortcutChanged$.subscribe(()=>a());return()=>o.unsubscribe()},[e,a]),C.jsx("ul",{className:`
29
32
  univer-m-0 univer-list-none univer-p-0 univer-text-gray-900
30
33
  dark:univer-text-white
31
34
  `,children:n.map(o=>C.jsxs("li",{children:[C.jsx("div",{className:"univer-flex univer-h-10 univer-items-center univer-text-sm univer-font-semibold",children:o.name}),C.jsx("ul",{className:z.clsx("univer-list-none univer-p-0",z.divideYClassName),children:o.items.map(c=>C.jsxs("li",{className:`
@@ -35,9 +38,8 @@
35
38
  univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center univer-justify-center
36
39
  univer-rounded univer-border-none univer-bg-transparent univer-p-0 univer-text-base univer-text-gray-900
37
40
  univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
38
- dark:univer-text-white dark:hover:univer-bg-gray-700
39
- disabled:univer-cursor-not-allowed disabled:univer-text-gray-200 disabled:univer-text-gray-800/20
40
- disabled:hover:univer-bg-transparent
41
+ dark:univer-text-white dark:hover:univer-bg-gray-700 dark:disabled:univer-text-gray-600
42
+ disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
41
43
  hover:univer-bg-gray-100
42
44
  `,{"univer-p-4":o,"!univer-bg-gray-200 dark:!univer-bg-gray-500":a}),style:n,disabled:i,onClick:L,onDoubleClick:d,...m,children:t})}function J9(e){const{disabled$:t,hidden$:r,activated$:n,value$:i}=e,[a,o]=s.useState(),[c,v]=s.useState(!1),[m,L]=s.useState(!1),[d,_]=s.useState(!1);return s.useEffect(()=>{const S=[];return t&&S.push(t.subscribe(H=>v(H))),r&&S.push(r.subscribe(H=>_(H))),n&&S.push(n.subscribe(H=>L(H))),i&&S.push(i.subscribe(H=>o(H))),()=>S.forEach(H=>H.unsubscribe())},[n,t,r,i]),{disabled:c,value:a,activated:m,hidden:d}}const Pe=s.createContext({dropdownVisible:!1,setDropdownVisible:e=>{}}),Q9=s.forwardRef((e,t)=>{const{children:r,...n}=e,i=s.useRef(null),[a,o]=s.useState(!1),[c,v]=s.useState(!1);function m(_){o(c?!1:_)}function L(_){v(_),o(!1)}const d=s.useMemo(()=>({dropdownVisible:c,setDropdownVisible:L}),[c]);return s.useImperativeHandle(t,()=>({el:i.current})),C.jsx(z.Tooltip,{...n,visible:a,onVisibleChange:m,children:C.jsx("span",{ref:i,children:C.jsx(Pe.Provider,{value:d,children:r})})})});function K9(e){const{children:t,overlay:r,disabled:n,align:i="start"}=e,{setDropdownVisible:a}=s.useContext(Pe);function o(c){a(c)}return C.jsx(z.Dropdown,{align:i,overlay:C.jsx("div",{className:"univer-grid univer-gap-2",children:r}),disabled:n,onOpenChange:o,children:C.jsx("div",{className:"univer-h-full",onClick:c=>c.stopPropagation(),children:t})})}function ae({icon:e,value:t,option:r,onOptionSelect:n}){var o;const i=c=>{n==null||n({value:c,label:r==null?void 0:r.label,commandId:r==null?void 0:r.commandId})},a=typeof r.label=="string"||typeof r.label=="object"&&((o=r.label)==null?void 0:o.selectable)!==!1;return C.jsxs("div",{className:z.clsx("univer-relative univer-flex univer-items-center univer-gap-2",{"univer-pl-6":a}),children:[a&&String(t)===String(r.value)&&C.jsx(be,{className:"univer-absolute univer-left-1 univer-top-0.5 univer-text-primary-600"}),C.jsx(l1,{className:"univer-text-sm",icon:e,value$:r.value$,value:r.value,label:r.label,onChange:i})]})}function e6({menuId:e,slot:t,value:r,options:n,children:i,disabled:a,onOptionSelect:o}){var H;const{setDropdownVisible:c}=s.useContext(Pe),v=x.useDependency(b1),[m,L]=s.useState({}),d=s.useMemo(()=>e?v.getMenuByPositionKey(e):[],[e]),_=s.useMemo(()=>d.filter(V=>{var D;if(!V.children)return V;const E=((D=V.key)==null?void 0:D.toString())||"";return!m[E]}),[d,m]);function S(V){c(V)}if(s.useEffect(()=>{const V=d.map(E=>{if(!E.children)return null;const D=E.children.map(k=>{var w,A;return(A=(w=k.item)==null?void 0:w.hidden$)!=null?A:j.of(!1)});return j.combineLatest(D).subscribe(k=>{const w=k.every(A=>A===!0);L(A=>({...A,[E.key]:w}))})});return()=>{V.forEach(E=>E==null?void 0:E.unsubscribe()),L({})}},[d]),t)return C.jsx(K9,{disabled:a,overlay:n.map((V,E)=>C.jsx(ae,{value:r,option:V,onOptionSelect:o},E)),children:i});if(n!=null&&n.length){const V=n.map(E=>{var D;return{type:"item",className:z.clsx({"focus:univer-bg-white":typeof E.label!="string"&&((D=E.label)==null?void 0:D.hoverable)===!1}),children:C.jsx(ae,{icon:E.icon,value:r,option:E,onOptionSelect:o}),disabled:E.disabled,onSelect:()=>{typeof E.value>"u"||o==null||o({...E})}}});for(const E of _){if(!E.item)continue;const{title:D,id:k,commandId:w,icon:A}=E.item;if(!D)throw new Error("Menu item title is required");V.push({type:"item",children:C.jsx(ae,{icon:A,value:r,option:{label:{name:D,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:w,id:k})}})}return C.jsx(z.DropdownMenu,{align:"start",items:V,disabled:a,onOpenChange:S,children:i})}else{const V=[];for(const E of _)if(E.item){const{title:D,id:k,commandId:w,icon:A}=E.item;if(!D)throw new Error("Menu item title is required");V.push({type:"item",children:C.jsx(ae,{icon:A,value:r,option:{label:{name:D,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:w,id:k})}})}else(H=E.children)!=null&&H.length;return C.jsx(z.DropdownMenu,{align:"start",items:V,disabled:a,onOpenChange:S,children:i})}}const x1=s.forwardRef((e,t)=>{const r=x.useDependency(h.LocaleService),n=x.useDependency(h.ICommandService),i=x.useDependency(y1),a=x.useDependency(d1),{value:o,hidden:c,disabled:v,activated:m}=J9(e),L=(q,e1)=>{i.focus(),n.executeCommand(q,e1)},{tooltip:d,shortcut:_,icon:S,title:H,label:V,id:E,commandId:D,type:k,slot:w}=e,A=r.t(d!=null?d:"")+(_?` (${_})`:""),{selections:M}=e,N=s.useMemo(()=>j.isObservable(M)?M:new j.Observable(q=>{q.next(M)}),[M]),Z=x.useObservable(N),R=s.useMemo(()=>j.isObservable(S)?S:new j.Observable(q=>{var W,t1;const e1=(t1=(W=Z==null?void 0:Z.find(u1=>u1.value===o))==null?void 0:W.icon)!=null?t1:S;q.next(e1)}),[S,Z,o]),G=x.useObservable(R,void 0,!0);function Y(q){var V1;const e1=e.selectionsCommandId,W=D!=null?D:E,t1=(V1=e1!=null?e1:D)!=null?V1:E;function u1(o1){if(v)return;let Y1=t1;o1.id&&(Y1=o1.id),L(Y1,{value:o1.value})}function L1(o1){v||L(t1,{value:o1})}function H1(){v||q===f1.BUTTON_SELECTOR&&L(W,{value:o})}return q===f1.BUTTON_SELECTOR?C.jsxs("div",{className:z.clsx(`
43
45
  univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center
@@ -45,7 +47,7 @@
45
47
  univer-fade-in
46
48
  dark:hover:univer-bg-gray-700
47
49
  hover:univer-bg-gray-100
48
- `,{"univer-text-gray-900 dark:univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-800/20":v}),"data-disabled":v,children:[C.jsx("div",{className:z.clsx(`
50
+ `,{"univer-text-gray-900 dark:univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:univer-text-gray-600":v}),"data-disabled":v,children:[C.jsx("div",{className:z.clsx(`
49
51
  univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l
50
52
  univer-px-1 univer-transition-colors
51
53
  dark:hover:univer-bg-gray-600
@@ -56,13 +58,13 @@
56
58
  univer-transition-colors
57
59
  dark:hover:univer-bg-gray-600
58
60
  hover:univer-bg-gray-200
59
- `,{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-800/20":v,"univer-bg-gray-200 dark:univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),"data-disabled":v,children:C.jsx(J1,{})})})]}):C.jsx(e6,{menuId:E,slot:w,value:o,options:Z,disabled:v,onOptionSelect:u1,children:C.jsxs("div",{className:z.clsx(`
61
+ `,{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:univer-text-gray-600":v,"univer-bg-gray-200 dark:univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),"data-disabled":v,children:C.jsx(J1,{})})})]}):C.jsx(e6,{menuId:E,slot:w,value:o,options:Z,disabled:v,onOptionSelect:u1,children:C.jsxs("div",{className:z.clsx(`
60
62
  univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-gap-2
61
63
  univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors univer-animate-in
62
64
  univer-fade-in
63
65
  dark:hover:univer-bg-gray-700
64
66
  hover:univer-bg-gray-100
65
- `,{"univer-text-gray-900 dark:univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-800/20":v,"univer-bg-gray-200":m,"univer-bg-gray-100":m&&v}),children:[C.jsx(l1,{icon:G,title:H,value:o,label:V,onChange:L1}),C.jsx("div",{className:z.clsx("univer-flex univer-h-full univer-items-center",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-800/20":v}),children:C.jsx(J1,{})})]})})}function K(){var e1;const q=a.get(typeof V=="string"?V:(e1=V==null?void 0:V.name)!=null?e1:"");return C.jsx($e,{noIcon:!S,active:m,disabled:v,onClick:()=>{var W;return L((W=e.commandId)!=null?W:e.id)},onDoubleClick:()=>e.subId&&L(e.subId),children:q?C.jsx(l1,{title:H,value:o,label:V}):S?C.jsx(l1,{icon:S}):C.jsx(l1,{title:H})})}function J(){switch(k){case f1.BUTTON_SELECTOR:case f1.SELECTOR:case f1.SUBITEMS:return Y(k);case f1.BUTTON:default:return K()}}return!c&&(A?C.jsx(Q9,{ref:t,title:A,placement:"bottom",children:J()}):J())});function t6(e){const{headerMenuComponents:t,headerMenu:r=!0}=e,n=x.useDependency(b1),i=x.useDependency(h.LocaleService),a=s.useRef(null),o=s.useRef({}),[c,v]=s.useState([]),[m,L]=s.useState(_1.START),[d,_]=s.useState(!1),[S,H]=s.useState([]),V=`[&>*:last-child:after]:univer-absolute [&>*:last-child:after]:-univer-right-2
67
+ `,{"univer-text-gray-900 dark:univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:univer-text-gray-600":v,"univer-bg-gray-200":m,"univer-bg-gray-100":m&&v}),children:[C.jsx(l1,{icon:G,title:H,value:o,label:V,onChange:L1}),C.jsx("div",{className:z.clsx("univer-flex univer-h-full univer-items-center",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:univer-text-gray-600":v}),children:C.jsx(J1,{})})]})})}function K(){var e1;const q=a.get(typeof V=="string"?V:(e1=V==null?void 0:V.name)!=null?e1:"");return C.jsx($e,{noIcon:!S,active:m,disabled:v,onClick:()=>{var W;return L((W=e.commandId)!=null?W:e.id)},onDoubleClick:()=>e.subId&&L(e.subId),children:q?C.jsx(l1,{title:H,value:o,label:V}):S?C.jsx(l1,{icon:S}):C.jsx(l1,{title:H})})}function J(){switch(k){case f1.BUTTON_SELECTOR:case f1.SELECTOR:case f1.SUBITEMS:return Y(k);case f1.BUTTON:default:return K()}}return!c&&(A?C.jsx(Q9,{ref:t,title:A,placement:"bottom",children:J()}):J())});function t6(e){const{headerMenuComponents:t,headerMenu:r=!0}=e,n=x.useDependency(b1),i=x.useDependency(h.LocaleService),a=s.useRef(null),o=s.useRef({}),[c,v]=s.useState([]),[m,L]=s.useState(_1.START),[d,_]=s.useState(!1),[S,H]=s.useState([]),V=`[&>*:last-child:after]:univer-absolute [&>*:last-child:after]:-univer-right-2
66
68
  [&>*:last-child:after]:univer-top-1/2 [&>*:last-child:after]:univer-h-5 [&>*:last-child:after]:univer-translate-x-[3px]
67
69
  [&>*:last-child:after]:univer-w-px [&>*:last-child:after]:-univer-translate-y-1/2
68
70
  [&>*:last-child:after]:univer-bg-gray-200 [&>*:last-child:after]:univer-content-['']
@@ -160,9 +162,9 @@ ${n}
160
162
 
161
163
 
162
164
  // @univerjs/docs-ui/index
163
- (function(T,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("react"),require("react/jsx-runtime"),require("@univerjs/design"),require("rxjs"),require("rxjs/operators"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs","@univerjs/engine-render","@univerjs/ui","react","react/jsx-runtime","@univerjs/design","rxjs","rxjs/operators","@univerjs/drawing"],s):(T=typeof globalThis<"u"?globalThis:T||self,s(T.UniverDocsUi={},T.UniverCore,T.UniverDocs,T.UniverEngineRender,T.UniverUi,T.React,T.React,T.UniverDesign,T.rxjs,T.rxjs.operators,T.UniverDrawing))})(this,function(T,s,D,_,I,U,P,J,L,At,Dn){"use strict";var UA=Object.defineProperty;var wA=(T,s,D)=>s in T?UA(T,s,{enumerable:!0,configurable:!0,writable:!0,value:D}):T[s]=D;var B=(T,s,D)=>wA(T,typeof s!="symbol"?s+"":s,D);var Ia=Object.getOwnPropertyDescriptor,va=(i,t,e,n)=>{for(var o=n>1?void 0:n?Ia(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},oo=(i,t)=>(e,n)=>t(e,n,i);T.DocAutoFormatService=class extends s.Disposable{constructor(e,n){super();B(this,"_matches",new Map);this._univerInstanceService=e,this._textSelectionManagerService=n}registerAutoFormat(e){const n=this._matches.get(e.id);return n?(n.push(e),n.sort((o,a)=>{var r,c;return((r=a.priority)!=null?r:0)-((c=o.priority)!=null?c:0)})):this._matches.set(e.id,[e]),s.toDisposable(()=>{const o=this._matches.get(e.id);if(o){const a=o.findIndex(r=>r===e);a>=0&&o.splice(a,1)}})}onAutoFormat(e,n){var l,A,d,u,m,h,g,p,f;const o=(l=this._matches.get(e))!=null?l:[],a=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=this._textSelectionManagerService.getDocRanges(),c=(A=r.find(S=>S.isActive))!=null?A:r[0];if(a&&c){const S=a.getSelfOrHeaderFooterModel(c.segmentId),E={unit:S,selection:c,isBody:!c.segmentId,paragraphs:s.BuildTextUtils.range.getParagraphsInRange(c,(u=(d=S.getBody())==null?void 0:d.paragraphs)!=null?u:[],(h=(m=S.getBody())==null?void 0:m.dataStream)!=null?h:""),customRanges:s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(c,(p=(g=S.getBody())==null?void 0:g.customRanges)!=null?p:[]),commandId:e,commandParams:n},C=o.find(b=>b.match(E));return(f=C==null?void 0:C.getMutations(E))!=null?f:[]}return[]}},T.DocAutoFormatService=va([oo(0,s.IUniverInstanceService),oo(1,s.Inject(D.DocSelectionManagerService))],T.DocAutoFormatService);const so={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},ao={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},ro="DOC_UI_PLUGIN";var Ae=(i=>(i.MAIN="__Document_Render_Main__",i.BACKGROUND="__Document_Render_Background__",i))(Ae||{}),ae=(i=>(i.VIEW_MAIN="viewMain",i.VIEW_TOP="viewTop",i.VIEW_LEFT="viewLeft",i.VIEW_LEFT_TOP="viewLeftTop",i))(ae||{});const co=0,Lt=2,lo=4,Bn=10,Ea="normalTextSelectionPluginName";function Ie(i){const{mainComponent:t,scene:e,engine:n,components:o}=i,a=t,r=o.get(Ae.BACKGROUND);return{document:a,docBackground:r,scene:e,engine:n}}function Ao(i,t){const e=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!e)return null;const n=e.getUnitId(),o=t.getRenderById(n);if(o==null)return;const{mainComponent:a,scene:r,engine:c,components:l}=o,A=a,d=l.get(Ae.BACKGROUND);return{document:A,docBackground:d,scene:r,engine:c}}function Ca(i,t){const e=t.getRenderById(i);if(e==null)return;const{mainComponent:n,scene:o,engine:a,components:r}=e,c=n,l=r.get(Ae.BACKGROUND);return{document:c,docBackground:l,scene:o,engine:a}}function uo(i){const{unitId:t,ranges:e,id:n,type:o,segmentId:a}=i,r={id:D.RichTextEditingMutation.id,params:{unitId:t,actions:[],textRanges:void 0,segmentId:a}},c=s.JSONX.getInstance(),l=s.BuildTextUtils.customDecoration.add({ranges:e,id:n,type:o});return r.params.actions=c.editOp(l.serialize()),r}function Ta(i,t){const{segmentId:e,id:n,type:o,unitId:a}=t,r=i.get(D.DocSelectionManagerService),c=i.get(s.IUniverInstanceService),l=a?c.getUnit(a,s.UniverInstanceType.UNIVER_DOC):c.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!l)return!1;const A=l.getUnitId(),d=r.getTextRanges({unitId:A,subUnitId:A});return!d||!l.getBody()?!1:uo({unitId:A,ranges:d,id:n,type:o,segmentId:e})}function ya(i,t){const{unitId:e,id:n,segmentId:o}=t,r=i.get(s.IUniverInstanceService).getUnit(e);if(!r)return!1;const c={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:void 0,segmentId:o}},l=s.BuildTextUtils.customDecoration.delete({id:n,segmentId:o,documentDataModel:r});if(!l)return!1;const A=s.JSONX.getInstance();return c.params.actions=A.editOp(l.serialize()),c}function ba(i,t){return t.some(e=>i.startIndex>e.startIndex&&i.startIndex<e.endIndex)}function Qt(i,t,e,n,o){const{textRuns:a=[],dataStream:r}=i,c=o&&r.startsWith("="),l={st:0,ed:0,ts:{}};if(c)return l;for(let A=a.length-1;A>=0;A--){const d=a[A],{st:u,ed:m}=d;t>u&&t<=m&&(l.st=u,l.ed=m,l.ts={...l.ts,...d.ts})}if(t===0){const A=a==null?void 0:a[0];A&&A.st===0&&(l.ts={...l.ts,...A.ts})}return n&&(l.ts={...l.ts,...n}),l}function _n(i,t,e){if(e){const o=i.find(a=>t>=a.startIndex&&t<=a.endIndex+1);return o!=null&&o.wholeEntity?null:o}const n=i.find(o=>t>o.startIndex&&t<=o.endIndex);return n!=null&&n.wholeEntity?null:n}function Nn(i,t){return i.filter(e=>t>e.startIndex&&t<=e.endIndex)}function Oa(i){return{left:i.positionH.posOffset,top:i.positionV.posOffset,width:i.size.width,height:i.size.height}}function Ra(i,t=0,e=0){return{size:{width:i.width,height:i.height},positionH:{relativeFrom:s.ObjectRelativeFromH.MARGIN,posOffset:(i.left||0)-t},positionV:{relativeFrom:s.ObjectRelativeFromV.PAGE,posOffset:(i.top||0)-e},angle:i.angle||0}}function ho(i,t,e){const n=I.useDependency(s.ICommandService),o=I.useDependency(I.IShortcutService),a=U.useMemo(()=>s.generateRandomId(4),[]);U.useEffect(()=>{if(!e||!i||!t)return;const c=`sheet.operation.editor-${e.getEditorId()}-keyboard-${a}`,l=new s.DisposableCollection;return l.add(n.registerCommand({id:c,type:s.CommandType.OPERATION,handler(A,d){const{keyCode:u,metaKey:m}=d;t.handler(u,m)}})),t.keyCodes.map(A=>({id:c,binding:A.metaKey?A.keyCode|A.metaKey:A.keyCode,preconditions:()=>!0,priority:901,staticParameters:{eventType:_.DeviceInputEventType.Keyboard,keyCode:A.keyCode,metaKey:A.metaKey}})).forEach(A=>{l.add(o.registerShortcut(A))}),()=>{l.dispose()}},[n,t,e,i,a,o])}const go=(i,t=!0,e,n)=>{const o=U.useCallback(()=>{if(i){const{scene:r,mainComponent:c}=i.render,l=i.render.with(D.DocSkeletonManagerService),{width:A,height:d}=i.getBoundingClientRect();l.getViewModel().getDataModel().updateDocumentDataPageSize(t?1/0:A,1/0),r.transformByState({width:A,height:d}),c==null||c.resize(A,d)}},[i,t]),a=U.useMemo(()=>s.debounce(()=>{var E,C;if(!e||!i||!e)return;const c=i.render.with(D.DocSkeletonManagerService).getSkeleton(),{scene:l,mainComponent:A}=i.render,d=l.getViewport(ae.VIEW_MAIN),{actualWidth:u,actualHeight:m}=c.getActualSize(),{width:h,height:g}=i.getBoundingClientRect();let p=d==null?void 0:d.getScrollBar();const f=Math.max(u,h),S=Math.max(m,g);l.transformByState({width:f,height:S}),A==null||A.resize(f,S),t?u>h?(p==null?d&&new _.ScrollBar(d,{barSize:8,enableVertical:!1,enableHorizontal:!0,minThumbSizeV:8}):d==null||d.resetCanvasSizeAndUpdateScroll(),n&&(d==null||d.scrollToBarPos({x:1/0,y:0}))):(p=null,d==null||d.scrollToBarPos({x:0,y:0}),(C=d==null?void 0:d.getScrollBar())==null||C.dispose()):m>g?(p==null?d&&(p=new _.ScrollBar(d,{enableHorizontal:!1,enableVertical:!0,barSize:8,minThumbSizeV:8})):d==null||d.resetCanvasSizeAndUpdateScroll(),n&&(d==null||d.scrollToBarPos({x:0,y:1/0}))):(p=null,d==null||d.scrollToBarPos({x:0,y:0}),(E=d==null?void 0:d.getScrollBar())==null||E.dispose())},30),[i,e,t,n]);return U.useEffect(()=>{if(e&&i){const r=setTimeout(()=>{o(),a()},500);return()=>{clearTimeout(r)}}},[i,e,o,a]),U.useEffect(()=>{if(e&&i){const r=i.input$.subscribe(()=>{a()});return()=>{r.unsubscribe()}}},[i,e,a]),{resize:o,checkScrollBar:a}};function re(i,t){var n;return(n=i.get(_.IRenderManagerService).getRenderById(t))==null?void 0:n.with(D.DocSkeletonManagerService)}function Z(i,t=""){if(!t)return["body"];const{headers:e,footers:n}=i.getSnapshot();if(e==null&&n==null)throw new Error("Document data model must have headers or footers when update by segment id");if((e==null?void 0:e[t])!=null)return["headers",t,"body"];if((n==null?void 0:n[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const Pn={id:"doc.command-replace-snapshot",type:s.CommandType.COMMAND,handler:(i,t)=>{const{unitId:e,snapshot:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=i.get(D.DocSelectionManagerService),d=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(a).getSnapshot();if(d==null||u==null)return!1;const{body:m,tableSource:h,footers:g,headers:p,lists:f,drawings:S,drawingsOrder:E,documentStyle:C}=s.Tools.deepClone(n),{body:b,tableSource:R,footers:v,headers:O,lists:M,drawings:y,drawingsOrder:N,documentStyle:x}=u;if(m==null||b==null)return!1;if(s.Tools.diffValue(m,b)&&o)return A.replaceDocRanges(o,{unitId:e,subUnitId:e},!1),!0;const w={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:o}};r&&(w.params.options=r);const H=[],V=s.JSONX.getInstance();if(!s.Tools.diffValue(x,C)){const Q=V.replaceOp(["documentStyle"],x,C);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(m,b)){const Q=V.replaceOp(["body"],b,m);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(h,R)){const Q=V.replaceOp(["tableSource"],R,h);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(g,v)){const Q=V.replaceOp(["footers"],v,g);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(p,O)){const Q=V.replaceOp(["headers"],O,p);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(f,M)){const Q=V.replaceOp(["lists"],M,f);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(S,y)){const Q=V.replaceOp(["drawings"],y,S);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(E,N)){const Q=V.replaceOp(["drawingsOrder"],N,E);Q!=null&&H.push(Q)}return w.params.actions=H.reduce((Q,j)=>s.JSONX.compose(Q,j),null),!!l.syncExecuteCommand(w.id,w.params)}},mo={id:"doc.command-replace-content",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{unitId:e,body:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=i.get(D.DocSelectionManagerService),d=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(a).getSnapshot().body;if(d==null||u==null)return!1;const m=fo(e,a,d,u,n);return m.params.textRanges=o,r&&(m.params.options=r),m.params.actions==null&&o?(A.replaceDocRanges(o,{unitId:e,subUnitId:e},!1),!0):!!l.syncExecuteCommand(m.id,m.params)}},po={id:"doc.command-cover-content",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{unitId:e,body:n,segmentId:o=""}=t,a=i.get(s.IUniverInstanceService),r=i.get(s.ICommandService),c=i.get(s.IUndoRedoService),l=a.getUniverDocInstance(e),A=l==null?void 0:l.getSnapshot().body;if(l==null||A==null)return!1;const d=fo(e,o,l,A,n);return d.params.noNeedSetTextRange=!0,d.params.noHistory=!0,r.syncExecuteCommand(d.id,d.params),c.clearUndoRedo(e),!0}};function Ma(i,t,e,n){const o=new s.TextX,a=s.JSONX.getInstance(),r=(e==null?void 0:e.dataStream.length)-2;r>0&&o.push({t:s.TextXActionType.DELETE,len:r}),n.dataStream.length>0&&o.push({t:s.TextXActionType.INSERT,body:n,len:n.dataStream.length});const c=Z(t,i);return a.editOp(o.serialize(),c)}function fo(i,t,e,n,o){const a={id:D.RichTextEditingMutation.id,params:{unitId:i,actions:[],textRanges:[]}},r=Ma(t,e,n,o);return a.params.actions=r,a}const Un={id:"doc.command.replace-selection",type:s.CommandType.COMMAND,handler(i,t){var g;if(!t)return!1;const e=i.get(s.ICommandService),{unitId:n,body:o,textRanges:a}=t,c=i.get(s.IUniverInstanceService).getUnit(n),l=i.get(D.DocSelectionManagerService);if(!c)return!1;const A=c.getBody(),d=(g=t.selection)!=null?g:l.getActiveTextRange();if(!d||!A)return!1;const u={id:D.RichTextEditingMutation.id,params:{unitId:n,actions:[],textRanges:a,debounce:!0}},m=new s.TextX,h=s.JSONX.getInstance();return m.push(...s.BuildTextUtils.selection.delete([d],A,0,o)),u.params.actions=h.editOp(m.serialize()),e.syncExecuteCommand(u.id,u.params)}},So={id:"doc.command.replace-text-runs",type:s.CommandType.COMMAND,handler:(i,t)=>{const{unitId:e,body:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),d=A==null?void 0:A.getSelfOrHeaderFooterModel(a).getSnapshot().body;if(A==null||d==null)return!1;const u=s.BuildTextUtils.selection.replaceTextRuns({doc:A,body:n,selection:{startOffset:0,endOffset:d.dataStream.length-2,collapsed:!1}});if(!u)return!1;const m={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:o,noHistory:!0}},h=s.JSONX.getInstance(),g=Z(A,a);return m.params.actions=h.editOp(u.serialize(),g),m.params.textRanges=o,r&&(m.params.options=r),!!l.syncExecuteCommand(m.id,m.params)}};var Ft=(i=>(i[i.page=0]="page",i[i.section=1]="section",i[i.column=2]="column",i[i.line=3]="line",i[i.divide=4]="divide",i[i.glyph=5]="glyph",i))(Ft||{});const Ye={page:0,section:1,column:2,line:3,divide:4,glyph:5};function wn(i,t){return i.page>t.page?!1:i.page<t.page?!0:i.section>t.section?!1:i.section<t.section?!0:i.column>t.column?!1:i.column<t.column?!0:i.line>t.line?!1:i.line<t.line?!0:i.divide>t.divide?!1:i.divide<t.divide?!0:i.glyph>t.glyph?!1:(i.glyph<t.glyph,!0)}function Ln(i,t){return wn(i,t)?{start:i,end:t}:{start:t,end:i}}function Qn(i){const t=i.length;if(t===0)return;const e=i[0],n=i[t-1],o=i.length===1&&e.collapsed;return{startOffset:e.startOffset,endOffset:n.endOffset,collapsed:o}}function xa(i,t,e,n){let o=n,a=n;for(let r=0;r<i.length;r++){const l=i[r].count;r<t&&(o+=l),r<e&&(a+=l)}return{startOffset:o,endOffset:a}}function Fn(i){const{startX:t,startY:e,endX:n,endY:o}=i,a=[];return a.push({x:t,y:e}),a.push({x:n,y:e}),a.push({x:n,y:o}),a.push({x:t,y:o}),a.push({x:t,y:e}),a}class ve{constructor(t,e){B(this,"_liquid",new _.Liquid);B(this,"_currentStartState",{page:0,section:0,column:0,line:0,divide:0,glyph:0});B(this,"_currentEndState",{page:0,section:0,column:0,line:0,divide:0,glyph:0});this._documentOffsetConfig=t,this._docSkeleton=e}getRangePointData(t,e){const n=[],o=[],a=[];if(t==null||e==null)return{borderBoxPointGroup:n,contentBoxPointGroup:o,cursorList:a};if(!this._isValidPosition(t,e))throw new Error(`
165
+ (function(T,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("react"),require("react/jsx-runtime"),require("@univerjs/design"),require("rxjs"),require("rxjs/operators"),require("@univerjs/drawing")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs","@univerjs/engine-render","@univerjs/ui","react","react/jsx-runtime","@univerjs/design","rxjs","rxjs/operators","@univerjs/drawing"],s):(T=typeof globalThis<"u"?globalThis:T||self,s(T.UniverDocsUi={},T.UniverCore,T.UniverDocs,T.UniverEngineRender,T.UniverUi,T.React,T.React,T.UniverDesign,T.rxjs,T.rxjs.operators,T.UniverDrawing))})(this,function(T,s,D,_,v,U,P,J,L,At,Dn){"use strict";var UA=Object.defineProperty;var wA=(T,s,D)=>s in T?UA(T,s,{enumerable:!0,configurable:!0,writable:!0,value:D}):T[s]=D;var B=(T,s,D)=>wA(T,typeof s!="symbol"?s+"":s,D);var va=Object.getOwnPropertyDescriptor,Ia=(i,t,e,n)=>{for(var o=n>1?void 0:n?va(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},oo=(i,t)=>(e,n)=>t(e,n,i);T.DocAutoFormatService=class extends s.Disposable{constructor(e,n){super();B(this,"_matches",new Map);this._univerInstanceService=e,this._textSelectionManagerService=n}registerAutoFormat(e){const n=this._matches.get(e.id);return n?(n.push(e),n.sort((o,a)=>{var r,c;return((r=a.priority)!=null?r:0)-((c=o.priority)!=null?c:0)})):this._matches.set(e.id,[e]),s.toDisposable(()=>{const o=this._matches.get(e.id);if(o){const a=o.findIndex(r=>r===e);a>=0&&o.splice(a,1)}})}onAutoFormat(e,n){var l,A,d,u,m,h,g,p,f;const o=(l=this._matches.get(e))!=null?l:[],a=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=this._textSelectionManagerService.getDocRanges(),c=(A=r.find(S=>S.isActive))!=null?A:r[0];if(a&&c){const S=a.getSelfOrHeaderFooterModel(c.segmentId),E={unit:S,selection:c,isBody:!c.segmentId,paragraphs:s.BuildTextUtils.range.getParagraphsInRange(c,(u=(d=S.getBody())==null?void 0:d.paragraphs)!=null?u:[],(h=(m=S.getBody())==null?void 0:m.dataStream)!=null?h:""),customRanges:s.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(c,(p=(g=S.getBody())==null?void 0:g.customRanges)!=null?p:[]),commandId:e,commandParams:n},C=o.find(b=>b.match(E));return(f=C==null?void 0:C.getMutations(E))!=null?f:[]}return[]}},T.DocAutoFormatService=Ia([oo(0,s.IUniverInstanceService),oo(1,s.Inject(D.DocSelectionManagerService))],T.DocAutoFormatService);const so={undo:!0,redo:!0,font:!0,fontSize:!0,bold:!0,italic:!0,strikethrough:!0,underline:!0,textColor:!0,fillColor:!0,horizontalAlignMode:!0,verticalAlignMode:!0,textWrapMode:!0,textRotateMode:!0},ao={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},ro="DOC_UI_PLUGIN";var Ae=(i=>(i.MAIN="__Document_Render_Main__",i.BACKGROUND="__Document_Render_Background__",i))(Ae||{}),ae=(i=>(i.VIEW_MAIN="viewMain",i.VIEW_TOP="viewTop",i.VIEW_LEFT="viewLeft",i.VIEW_LEFT_TOP="viewLeftTop",i))(ae||{});const co=0,Lt=2,lo=4,Bn=10,Ea="normalTextSelectionPluginName";function ve(i){const{mainComponent:t,scene:e,engine:n,components:o}=i,a=t,r=o.get(Ae.BACKGROUND);return{document:a,docBackground:r,scene:e,engine:n}}function Ao(i,t){const e=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!e)return null;const n=e.getUnitId(),o=t.getRenderById(n);if(o==null)return;const{mainComponent:a,scene:r,engine:c,components:l}=o,A=a,d=l.get(Ae.BACKGROUND);return{document:A,docBackground:d,scene:r,engine:c}}function Ca(i,t){const e=t.getRenderById(i);if(e==null)return;const{mainComponent:n,scene:o,engine:a,components:r}=e,c=n,l=r.get(Ae.BACKGROUND);return{document:c,docBackground:l,scene:o,engine:a}}function uo(i){const{unitId:t,ranges:e,id:n,type:o,segmentId:a}=i,r={id:D.RichTextEditingMutation.id,params:{unitId:t,actions:[],textRanges:void 0,segmentId:a}},c=s.JSONX.getInstance(),l=s.BuildTextUtils.customDecoration.add({ranges:e,id:n,type:o});return r.params.actions=c.editOp(l.serialize()),r}function Ta(i,t){const{segmentId:e,id:n,type:o,unitId:a}=t,r=i.get(D.DocSelectionManagerService),c=i.get(s.IUniverInstanceService),l=a?c.getUnit(a,s.UniverInstanceType.UNIVER_DOC):c.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!l)return!1;const A=l.getUnitId(),d=r.getTextRanges({unitId:A,subUnitId:A});return!d||!l.getBody()?!1:uo({unitId:A,ranges:d,id:n,type:o,segmentId:e})}function ya(i,t){const{unitId:e,id:n,segmentId:o}=t,r=i.get(s.IUniverInstanceService).getUnit(e);if(!r)return!1;const c={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:void 0,segmentId:o}},l=s.BuildTextUtils.customDecoration.delete({id:n,segmentId:o,documentDataModel:r});if(!l)return!1;const A=s.JSONX.getInstance();return c.params.actions=A.editOp(l.serialize()),c}function ba(i,t){return t.some(e=>i.startIndex>e.startIndex&&i.startIndex<e.endIndex)}function Qt(i,t,e,n,o){const{textRuns:a=[],dataStream:r}=i,c=o&&r.startsWith("="),l={st:0,ed:0,ts:{}};if(c)return l;for(let A=a.length-1;A>=0;A--){const d=a[A],{st:u,ed:m}=d;t>u&&t<=m&&(l.st=u,l.ed=m,l.ts={...l.ts,...d.ts})}if(t===0){const A=a==null?void 0:a[0];A&&A.st===0&&(l.ts={...l.ts,...A.ts})}return n&&(l.ts={...l.ts,...n}),l}function _n(i,t,e){if(e){const o=i.find(a=>t>=a.startIndex&&t<=a.endIndex+1);return o!=null&&o.wholeEntity?null:o}const n=i.find(o=>t>o.startIndex&&t<=o.endIndex);return n!=null&&n.wholeEntity?null:n}function Nn(i,t){return i.filter(e=>t>e.startIndex&&t<=e.endIndex)}function Oa(i){return{left:i.positionH.posOffset,top:i.positionV.posOffset,width:i.size.width,height:i.size.height}}function Ra(i,t=0,e=0){return{size:{width:i.width,height:i.height},positionH:{relativeFrom:s.ObjectRelativeFromH.MARGIN,posOffset:(i.left||0)-t},positionV:{relativeFrom:s.ObjectRelativeFromV.PAGE,posOffset:(i.top||0)-e},angle:i.angle||0}}function ho(i,t,e){const n=v.useDependency(s.ICommandService),o=v.useDependency(v.IShortcutService),a=U.useMemo(()=>s.generateRandomId(4),[]);U.useEffect(()=>{if(!e||!i||!t)return;const c=`sheet.operation.editor-${e.getEditorId()}-keyboard-${a}`,l=new s.DisposableCollection;return l.add(n.registerCommand({id:c,type:s.CommandType.OPERATION,handler(A,d){const{keyCode:u,metaKey:m}=d;t.handler(u,m)}})),t.keyCodes.map(A=>({id:c,binding:A.metaKey?A.keyCode|A.metaKey:A.keyCode,preconditions:()=>!0,priority:901,staticParameters:{eventType:_.DeviceInputEventType.Keyboard,keyCode:A.keyCode,metaKey:A.metaKey}})).forEach(A=>{l.add(o.registerShortcut(A))}),()=>{l.dispose()}},[n,t,e,i,a,o])}const go=(i,t=!0,e,n)=>{const o=U.useCallback(()=>{if(i){const{scene:r,mainComponent:c}=i.render,l=i.render.with(D.DocSkeletonManagerService),{width:A,height:d}=i.getBoundingClientRect();l.getViewModel().getDataModel().updateDocumentDataPageSize(t?1/0:A,1/0),r.transformByState({width:A,height:d}),c==null||c.resize(A,d)}},[i,t]),a=U.useMemo(()=>s.debounce(()=>{var E,C;if(!e||!i||!e)return;const c=i.render.with(D.DocSkeletonManagerService).getSkeleton(),{scene:l,mainComponent:A}=i.render,d=l.getViewport(ae.VIEW_MAIN),{actualWidth:u,actualHeight:m}=c.getActualSize(),{width:h,height:g}=i.getBoundingClientRect();let p=d==null?void 0:d.getScrollBar();const f=Math.max(u,h),S=Math.max(m,g);l.transformByState({width:f,height:S}),A==null||A.resize(f,S),t?u>h?(p==null?d&&new _.ScrollBar(d,{barSize:8,enableVertical:!1,enableHorizontal:!0,minThumbSizeV:8}):d==null||d.resetCanvasSizeAndUpdateScroll(),n&&(d==null||d.scrollToBarPos({x:1/0,y:0}))):(p=null,d==null||d.scrollToBarPos({x:0,y:0}),(C=d==null?void 0:d.getScrollBar())==null||C.dispose()):m>g?(p==null?d&&(p=new _.ScrollBar(d,{enableHorizontal:!1,enableVertical:!0,barSize:8,minThumbSizeV:8})):d==null||d.resetCanvasSizeAndUpdateScroll(),n&&(d==null||d.scrollToBarPos({x:0,y:1/0}))):(p=null,d==null||d.scrollToBarPos({x:0,y:0}),(E=d==null?void 0:d.getScrollBar())==null||E.dispose())},30),[i,e,t,n]);return U.useEffect(()=>{if(e&&i){const r=setTimeout(()=>{o(),a()},500);return()=>{clearTimeout(r)}}},[i,e,o,a]),U.useEffect(()=>{if(e&&i){const r=i.input$.subscribe(()=>{a()});return()=>{r.unsubscribe()}}},[i,e,a]),{resize:o,checkScrollBar:a}};function re(i,t){var n;return(n=i.get(_.IRenderManagerService).getRenderById(t))==null?void 0:n.with(D.DocSkeletonManagerService)}function Z(i,t=""){if(!t)return["body"];const{headers:e,footers:n}=i.getSnapshot();if(e==null&&n==null)throw new Error("Document data model must have headers or footers when update by segment id");if((e==null?void 0:e[t])!=null)return["headers",t,"body"];if((n==null?void 0:n[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const Pn={id:"doc.command-replace-snapshot",type:s.CommandType.COMMAND,handler:(i,t)=>{const{unitId:e,snapshot:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=i.get(D.DocSelectionManagerService),d=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(a).getSnapshot();if(d==null||u==null)return!1;const{body:m,tableSource:h,footers:g,headers:p,lists:f,drawings:S,drawingsOrder:E,documentStyle:C}=s.Tools.deepClone(n),{body:b,tableSource:R,footers:I,headers:O,lists:M,drawings:y,drawingsOrder:N,documentStyle:x}=u;if(m==null||b==null)return!1;if(s.Tools.diffValue(m,b)&&o)return A.replaceDocRanges(o,{unitId:e,subUnitId:e},!1),!0;const w={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:o}};r&&(w.params.options=r);const H=[],V=s.JSONX.getInstance();if(!s.Tools.diffValue(x,C)){const Q=V.replaceOp(["documentStyle"],x,C);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(m,b)){const Q=V.replaceOp(["body"],b,m);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(h,R)){const Q=V.replaceOp(["tableSource"],R,h);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(g,I)){const Q=V.replaceOp(["footers"],I,g);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(p,O)){const Q=V.replaceOp(["headers"],O,p);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(f,M)){const Q=V.replaceOp(["lists"],M,f);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(S,y)){const Q=V.replaceOp(["drawings"],y,S);Q!=null&&H.push(Q)}if(!s.Tools.diffValue(E,N)){const Q=V.replaceOp(["drawingsOrder"],N,E);Q!=null&&H.push(Q)}return w.params.actions=H.reduce((Q,j)=>s.JSONX.compose(Q,j),null),!!l.syncExecuteCommand(w.id,w.params)}},mo={id:"doc.command-replace-content",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{unitId:e,body:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=i.get(D.DocSelectionManagerService),d=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(a).getSnapshot().body;if(d==null||u==null)return!1;const m=fo(e,a,d,u,n);return m.params.textRanges=o,r&&(m.params.options=r),m.params.actions==null&&o?(A.replaceDocRanges(o,{unitId:e,subUnitId:e},!1),!0):!!l.syncExecuteCommand(m.id,m.params)}},po={id:"doc.command-cover-content",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{unitId:e,body:n,segmentId:o=""}=t,a=i.get(s.IUniverInstanceService),r=i.get(s.ICommandService),c=i.get(s.IUndoRedoService),l=a.getUniverDocInstance(e),A=l==null?void 0:l.getSnapshot().body;if(l==null||A==null)return!1;const d=fo(e,o,l,A,n);return d.params.noNeedSetTextRange=!0,d.params.noHistory=!0,r.syncExecuteCommand(d.id,d.params),c.clearUndoRedo(e),!0}};function Ma(i,t,e,n){const o=new s.TextX,a=s.JSONX.getInstance(),r=(e==null?void 0:e.dataStream.length)-2;r>0&&o.push({t:s.TextXActionType.DELETE,len:r}),n.dataStream.length>0&&o.push({t:s.TextXActionType.INSERT,body:n,len:n.dataStream.length});const c=Z(t,i);return a.editOp(o.serialize(),c)}function fo(i,t,e,n,o){const a={id:D.RichTextEditingMutation.id,params:{unitId:i,actions:[],textRanges:[]}},r=Ma(t,e,n,o);return a.params.actions=r,a}const Un={id:"doc.command.replace-selection",type:s.CommandType.COMMAND,handler(i,t){var g;if(!t)return!1;const e=i.get(s.ICommandService),{unitId:n,body:o,textRanges:a}=t,c=i.get(s.IUniverInstanceService).getUnit(n),l=i.get(D.DocSelectionManagerService);if(!c)return!1;const A=c.getBody(),d=(g=t.selection)!=null?g:l.getActiveTextRange();if(!d||!A)return!1;const u={id:D.RichTextEditingMutation.id,params:{unitId:n,actions:[],textRanges:a,debounce:!0}},m=new s.TextX,h=s.JSONX.getInstance();return m.push(...s.BuildTextUtils.selection.delete([d],A,0,o)),u.params.actions=h.editOp(m.serialize()),e.syncExecuteCommand(u.id,u.params)}},So={id:"doc.command.replace-text-runs",type:s.CommandType.COMMAND,handler:(i,t)=>{const{unitId:e,body:n,textRanges:o,segmentId:a="",options:r}=t,c=i.get(s.IUniverInstanceService),l=i.get(s.ICommandService),A=c.getUnit(e,s.UniverInstanceType.UNIVER_DOC),d=A==null?void 0:A.getSelfOrHeaderFooterModel(a).getSnapshot().body;if(A==null||d==null)return!1;const u=s.BuildTextUtils.selection.replaceTextRuns({doc:A,body:n,selection:{startOffset:0,endOffset:d.dataStream.length-2,collapsed:!1}});if(!u)return!1;const m={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:o,noHistory:!0}},h=s.JSONX.getInstance(),g=Z(A,a);return m.params.actions=h.editOp(u.serialize(),g),m.params.textRanges=o,r&&(m.params.options=r),!!l.syncExecuteCommand(m.id,m.params)}};var Ft=(i=>(i[i.page=0]="page",i[i.section=1]="section",i[i.column=2]="column",i[i.line=3]="line",i[i.divide=4]="divide",i[i.glyph=5]="glyph",i))(Ft||{});const Ye={page:0,section:1,column:2,line:3,divide:4,glyph:5};function wn(i,t){return i.page>t.page?!1:i.page<t.page?!0:i.section>t.section?!1:i.section<t.section?!0:i.column>t.column?!1:i.column<t.column?!0:i.line>t.line?!1:i.line<t.line?!0:i.divide>t.divide?!1:i.divide<t.divide?!0:i.glyph>t.glyph?!1:(i.glyph<t.glyph,!0)}function Ln(i,t){return wn(i,t)?{start:i,end:t}:{start:t,end:i}}function Qn(i){const t=i.length;if(t===0)return;const e=i[0],n=i[t-1],o=i.length===1&&e.collapsed;return{startOffset:e.startOffset,endOffset:n.endOffset,collapsed:o}}function xa(i,t,e,n){let o=n,a=n;for(let r=0;r<i.length;r++){const l=i[r].count;r<t&&(o+=l),r<e&&(a+=l)}return{startOffset:o,endOffset:a}}function Fn(i){const{startX:t,startY:e,endX:n,endY:o}=i,a=[];return a.push({x:t,y:e}),a.push({x:n,y:e}),a.push({x:n,y:o}),a.push({x:t,y:o}),a.push({x:t,y:e}),a}class Ie{constructor(t,e){B(this,"_liquid",new _.Liquid);B(this,"_currentStartState",{page:0,section:0,column:0,line:0,divide:0,glyph:0});B(this,"_currentEndState",{page:0,section:0,column:0,line:0,divide:0,glyph:0});this._documentOffsetConfig=t,this._docSkeleton=e}getRangePointData(t,e){const n=[],o=[],a=[];if(t==null||e==null)return{borderBoxPointGroup:n,contentBoxPointGroup:o,cursorList:a};if(!this._isValidPosition(t,e))throw new Error(`
164
166
  Invalid positions in NodePositionConvertToCursor,
165
- they are not in the same segment page when in header or footer.`);const{start:c,end:l}=Ln(t,e);return this._selectionIterator(c,l,(A,d,u,m,h,g)=>{const{lineHeight:p,asc:f,paddingTop:S,marginTop:E,marginBottom:C}=g,{glyphGroup:b,st:R}=h;if(b.length===0)return;const{x:v,y:O}=this._liquid;let M,y;const N=b[A],x=b[d],w=b[A-1],H=(N==null?void 0:N.left)||0,V=(N==null?void 0:N.width)||0,F=(x==null?void 0:x.left)||0,Q=(x==null?void 0:x.width)||0,j=(N==null?void 0:N.glyphType)===_.GlyphType.LIST,{startOffset:G,endOffset:k}=xa(b,A,d,R),W=c.glyph===A&&u?c.isBack:!0,z=l.glyph===d&&m?l.isBack:!1,X=c===l,Y=W&&w!=null?w:N;if(A===0&&d===b.length-1)M={startX:v+H+(j?V:0),startY:O,endX:v+F+(z?0:Q),endY:O+p-E-C},y={startX:v+H+(j?V:0),startY:O+S+f-Y.bBox.ba,endX:v+F+(z?0:Q),endY:O+S+f+Y.bBox.bd};else{const q=W&&!j;M={startX:v+H+(q?0:V),startY:O,endX:v+F+(z?0:Q),endY:O+p-E-C},y={startX:v+H+(q?0:V),startY:O+S+f-Y.bBox.ba,endX:v+F+(z?0:Q),endY:O+S+f+Y.bBox.bd}}n.push(Fn(M)),o.push(Fn(y)),a.push({startOffset:W?G:G+N.count,endOffset:z?k:k+x.count,collapsed:X})}),{borderBoxPointGroup:n,contentBoxPointGroup:o,cursorList:a}}_isValidPosition(t,e){const{segmentPage:n,pageType:o}=t,{segmentPage:a,pageType:r}=e;return o!==r?!1:o===_.DocumentSkeletonPageType.HEADER||o===_.DocumentSkeletonPageType.FOOTER?n===a:!0}_resetCurrentNodePositionState(){this._currentStartState={page:0,section:0,column:0,line:0,divide:0,glyph:0},this._currentEndState={page:0,section:0,column:0,line:0,divide:0,glyph:0}}_setNodePositionState(t=0,e,n,o){o===e?this._currentStartState[t]=1:this._currentStartState[t]=0,o===n?this._currentEndState[t]=2:this._currentEndState[t]=0}_checkPreviousNodePositionState(t,e=!0){let n=t,o;for(;n>=0;){const a=Ft[n];let r;if(e?r=this._currentStartState[a]:r=this._currentEndState[a],r===void 0)return;if(o===void 0&&(o=r),r!==o)return 0;n--}return o}_getSelectionRuler(t,e,n,o,a){let r=0,c=o;const l=Ft[t],A=Ft[t+1];if(A===null||l===null)return{start_next:r,end_next:c};const d=e[l],u=n[l];this._setNodePositionState(l,d,u,a);const m=this._checkPreviousNodePositionState(t),h=this._checkPreviousNodePositionState(t,!1);return m===1&&(r=e[A]),h===2&&(c=n[A]),{start_next:r,end_next:c}}_selectionIterator(t,e,n){var b,R;const o=this._docSkeleton;if(!o)return[];const{pageType:a,path:r}=t;this._liquid.reset();const c=o.getSkeletonData();if(c==null)return[];const{pages:l,skeHeaders:A,skeFooters:d}=c,{page:u,segmentPage:m}=t,{page:h,segmentPage:g}=e;if(this._resetCurrentNodePositionState(),this._documentOffsetConfig==null)return[];const{pageLayoutType:p,pageMarginLeft:f,pageMarginTop:S}=this._documentOffsetConfig,E=a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?u:m;for(let v=0;v<E;v++){const O=l[v];this._liquid.translatePage(O,p,f,S)}const C=a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?h:g;for(let v=E;v<=C;v++){const O=l[v],{headerId:M,footerId:y,pageWidth:N}=O;let x=O;if(a===_.DocumentSkeletonPageType.HEADER?x=(b=A.get(M))==null?void 0:b.get(N):a===_.DocumentSkeletonPageType.FOOTER?x=(R=d.get(y))==null?void 0:R.get(N):a===_.DocumentSkeletonPageType.CELL&&(x=_.getPageFromPath(c,r)),x==null){this._liquid.translatePage(O,p,f,S);continue}const w=x.sections,{start_next:H,end_next:V}=this._getSelectionRuler(Ye.page,t,e,w.length-1,a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?v:0);switch(this._liquid.translateSave(),a){case _.DocumentSkeletonPageType.HEADER:this._liquid.translatePagePadding({...x,marginLeft:O.marginLeft});break;case _.DocumentSkeletonPageType.FOOTER:{const F=O.pageHeight-x.height-x.marginBottom;this._liquid.translate(O.marginLeft,F);break}case _.DocumentSkeletonPageType.CELL:{this._liquid.translatePagePadding(O);const F=x.parent,Q=F.parent,{left:j}=x,{top:G,left:k}=Q,{top:W}=F;this._liquid.translate(k+j,G+W),this._liquid.translatePagePadding(x);break}default:this._liquid.translatePagePadding(O);break}for(let F=H;F<=V;F++){const Q=w[F],j=Q.columns,{start_next:G,end_next:k}=this._getSelectionRuler(Ye.section,t,e,j.length-1,F);this._liquid.translateSection(Q);for(let W=G;W<=k;W++){const z=j[W],X=z.lines,{start_next:Y,end_next:q}=this._getSelectionRuler(Ye.column,t,e,X.length-1,W);this._liquid.translateColumn(z);for(let K=Y;K<=q;K++){const $=X[K],{divides:ie}=$,{start_next:fe,end_next:Fe}=this._getSelectionRuler(Ye.line,t,e,ie.length-1,K);this._liquid.translateSave(),this._liquid.translateLine($,!0,!1);for(let Se=fe;Se<=Fe;Se++){const io=ie[Se];this._liquid.translateSave(),this._liquid.translateDivide(io);const{glyphGroup:_A}=io,{start_next:NA,end_next:PA}=this._getSelectionRuler(Ye.divide,t,e,_A.length-1,Se);let fa=!1,Sa=!1;v===E&&F===H&&W===G&&K===Y&&Se===fe&&(fa=!0),v===C&&F===V&&W===k&&K===q&&Se===Fe&&(Sa=!0),n&&n(NA,PA,fa,Sa,io,$,z,Q,x),this._liquid.translateRestore()}this._liquid.translateRestore()}}}this._liquid.translateRestore(),this._liquid.translatePage(O,p,f,S)}}}function Io(i,t){const{path:e}=i,{path:n}=t;if(e.length!==n.length||e.indexOf("cells")===-1)return!1;const o=e.indexOf("skeTables")+1,a=e.indexOf("rows")+1,r=e.indexOf("cells")+1,{tableId:c,sliceIndex:l}=_.getTableIdAndSliceIndex(e[o]),{tableId:A,sliceIndex:d}=_.getTableIdAndSliceIndex(n[o]);if(c!==A)return!1;const u=e[a],m=n[a],h=e[r],g=n[r];return!(u===m&&h===g&&l===d)}function Hn(i,t){const{path:e}=i,{path:n}=t;return e.indexOf("cells")===-1||n.indexOf("cells")===-1||e.length!==n.length?!1:s.Tools.diffValue(e,n)}function vo(i,t,e){var h,g,p,f,S,E,C,b;const{path:n}=t,{path:o}=e;if(n.indexOf("cells")===-1||o.indexOf("cells")===-1)return!1;const a=i.findGlyphByPosition(t),r=i.findGlyphByPosition(e),c=(f=(p=(g=(h=a==null?void 0:a.parent)==null?void 0:h.parent)==null?void 0:g.parent)==null?void 0:p.parent)==null?void 0:f.parent,l=(b=(C=(E=(S=r==null?void 0:r.parent)==null?void 0:S.parent)==null?void 0:E.parent)==null?void 0:C.parent)==null?void 0:b.parent;if(c==null||l==null)return!1;const A=c.parent,d=l.parent,u=A.cells.indexOf(c),m=d.cells.indexOf(l);return u===m&&A.index===d.index}function kn(i,t){if(Hn(i,t))return wn(i,t);const{path:e}=i,{path:n}=t,o=e[e.length-5],a=n[n.length-5];if(o!==a&&typeof o=="string"&&typeof a=="string"){const d=o.split("#-#")[1],u=a.split("#-#")[1];return+d<+u}const r=e[e.length-3],c=n[n.length-3],l=e[e.length-1],A=n[n.length-1];return r<c?!0:r>c?!1:l<=A}function qe(i){return i.sections[0].columns[0].lines.length===0}function Da(i,t,e){let n=t,o=e,a=i[n],r=i[o];for(;n<o&&(qe(a)||qe(r));)qe(a)?(n++,a=i[n]):qe(r)&&(o--,r=i[o]);if(!qe(a)&&!qe(r))return[a,r]}class Vn{constructor(t,e){B(this,"_liquid",new _.Liquid);this._documentOffsetConfig=t,this._docSkeleton=e}getRangePointData(t,e){const n=[],a=this._docSkeleton.getSkeletonData();if(a==null)return;const{pages:r}=a,{segmentPage:c,page:l,pageType:A}=t,d=this._getTableRectRangeInfo(t,e);if(d==null)return;const{tableId:u,startRowIndex:m,startColumnIndex:h,endRowIndex:g,endColumnIndex:p}=d;this._liquid.reset();const{pageLayoutType:f,pageMarginLeft:S,pageMarginTop:E}=this._documentOffsetConfig,C=A===_.DocumentSkeletonPageType.BODY||A===_.DocumentSkeletonPageType.CELL?l:c;for(let b=0;b<C;b++){const R=r[b];this._liquid.translatePage(R,f,S,E)}for(let b=C;b<r.length;b++){const R=r[b];this._liquid.translatePagePadding(R);const{skeTables:v}=R;let O=null;for(const[x,w]of v.entries())x.startsWith(u)&&(O=w);if(O==null){this._liquid.restorePagePadding(R),this._liquid.translatePage(R,f,S,E);continue}this._liquid.translateSave(),this._liquid.translate(0,O.top);const{x:M,y}=this._liquid,{left:N}=O;for(const x of O.rows)if(x.index>=m&&x.index<=g){const w=Da(x.cells,h,p);if(w==null)continue;const[H,V]=w,F={startX:M+H.left+N,startY:y+x.top,endX:M+V.left+V.pageWidth+N,endY:y+x.top+x.height};n.push(Fn(F))}this._liquid.translateRestore(),this._liquid.restorePagePadding(R),this._liquid.translatePage(R,f,S,E)}return{pointGroup:n,startRow:m,startColumn:h,endRow:g,endColumn:p,tableId:u}}getNodePositionGroup(t,e){const n=[],o=this._docSkeleton.findCharIndexByPosition(t),a=this._docSkeleton.findCharIndexByPosition(e);if(o==null||a==null)return;const r=o<a,c=this._getTableRectRangeInfo(t,e);if(c==null)return;const{tableId:l,startRowIndex:A,startColumnIndex:d,endRowIndex:u,endColumnIndex:m}=c,h=this._docSkeleton.getViewModel().findTableNodeById(l);if(h==null)return;const g=h.children[0].children.length;if(d===0&&m===g-1){const f=h.children[A].children[d],S=this._docSkeleton.findNodePositionByCharIndex(f.startIndex+1),E=h.children[u].children[m],C=this._docSkeleton.findNodePositionByCharIndex(E.endIndex-2);if(S==null||C==null)return;n.push({anchor:r?S:C,focus:r?C:S})}else for(let f=A;f<=u;f++){const S=h.children[f],E=S.children[d],C=S.children[m],b=this._docSkeleton.findNodePositionByCharIndex(E.startIndex+1),R=this._docSkeleton.findNodePositionByCharIndex(C.endIndex-2);if(b==null||R==null)return;n.push({anchor:r?b:R,focus:r?R:b})}return n}_getTableRectRangeInfo(t,e){const o=this._docSkeleton.getSkeletonData();if(o==null)return;const{pages:a}=o,{path:r}=t,{path:c}=e,l=_.getPageFromPath(o,r),A=_.getPageFromPath(o,c);if(l==null||A==null)return;const d=l.segmentId,u=l.parent.index,m=l.parent.cells.indexOf(l),h=(A==null?void 0:A.parent).index,g=(A==null?void 0:A.parent).cells.indexOf(A),p=Math.min(u,h),f=Math.max(u,h),S=Math.min(m,g),E=Math.max(m,g);return{pages:a,tableId:d,startRowIndex:p,startColumnIndex:S,endRowIndex:f,endColumnIndex:E}}}const Ba="__TestSelectionRange__",_a="__TestSelectionAnchor__",Eo=6,Wn=500,Na=500,Ht=3;function ut(i){const t=i[0],e=t[0],n=t[2],{x:o,y:a}=e,{x:r,y:c}=n;return{left:o,top:a,width:r-o,height:c-a}}function kt(i){return i.map(t=>{let e=1/0,n=-1/0,o=1/0,a=-1/0;return t.forEach(r=>{e=Math.min(r.x,e),n=Math.max(r.x,n),a=Math.max(r.y,a),o=Math.min(r.y,o)}),{left:e,right:n,top:o,bottom:a}})}class He{constructor(t,e,n,o,a,r=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,c="",l=-1){B(this,"rangeType",s.DOC_RANGE_TYPE.TEXT);B(this,"_current",!1);B(this,"_rangeShape");B(this,"_anchorShape");B(this,"_cursorList",[]);B(this,"_anchorBlinkTimer",null);this._scene=t,this._document=e,this._docSkeleton=n,this.anchorNodePosition=o,this.focusNodePosition=a,this.style=r,this._segmentId=c,this._segmentPage=l,this._anchorBlink(),this.refresh()}_anchorBlink(){setTimeout(()=>{this._anchorShape&&this._anchorShape.visible&&this.deactivateStatic()},Wn),this._anchorBlinkTimer=setInterval(()=>{this._anchorShape&&this._anchorShape.visible&&(this.activeStatic(),setTimeout(()=>{this.deactivateStatic()},Wn))},Na+Wn)}get startOffset(){var o;const{startOffset:t}=(o=Qn(this._cursorList))!=null?o:{},e=this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId).getBody();if(t==null||e==null)return t;const n=e.dataStream.length-2;return Math.min(n,t)}get endOffset(){var o;const{endOffset:t}=(o=Qn(this._cursorList))!=null?o:{},e=this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId).getBody();if(t==null||e==null)return t;const n=e.dataStream.length-2;return Math.min(t,n)}get collapsed(){const{startOffset:t,endOffset:e}=this;return t!=null&&t===e}get startNodePosition(){if(this.anchorNodePosition==null)return null;if(this.focusNodePosition==null)return this.anchorNodePosition;const{start:t}=Ln(this.anchorNodePosition,this.focusNodePosition);return t}get endNodePosition(){if(this.anchorNodePosition==null)return this.focusNodePosition;if(this.focusNodePosition==null)return null;const{end:t}=Ln(this.anchorNodePosition,this.focusNodePosition);return t}get direction(){const{collapsed:t,anchorNodePosition:e,focusNodePosition:n}=this;return t||e==null||n==null?s.RANGE_DIRECTION.NONE:wn(e,n)?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD}get segmentId(){return this._segmentId}get segmentPage(){return this._segmentPage}getAbsolutePosition(){const t=this.anchorNodePosition,e=this.focusNodePosition;if(this._isEmpty())return;const n=this._document.getOffsetConfig(),{docsLeft:o,docsTop:a}=n,r=new ve(n,this._docSkeleton);if(this._isCollapsed()){const{contentBoxPointGroup:d,cursorList:u}=r.getRangePointData(t,t);if(this._setCursorList(u),d.length===0)return;const m=ut(d);return{...m,left:m.left+o,top:m.top+a}}const{borderBoxPointGroup:c,cursorList:l}=r.getRangePointData(t,e);if(this._setCursorList(l),c.length===0)return;const A=ut(c);return{...A,left:A.left+o,top:A.top+a}}getAnchor(){return this._anchorShape}activeStatic(){var t,e;(e=this._anchorShape)==null||e.setProps({stroke:((t=this.style)==null?void 0:t.strokeActive)||_.getColor(s.COLORS.black,1)})}deactivateStatic(){var t,e;(e=this._anchorShape)==null||e.setProps({stroke:((t=this.style)==null?void 0:t.stroke)||_.getColor(s.COLORS.black,0)})}isActive(){return this._current===!0}activate(){this._current=!0}deactivate(){this._current=!1}dispose(){var t,e;(t=this._rangeShape)==null||t.dispose(),this._rangeShape=null,(e=this._anchorShape)==null||e.dispose(),this._anchorShape=null,this._anchorBlinkTimer&&(clearInterval(this._anchorBlinkTimer),this._anchorBlinkTimer=null)}isIntersection(t){const{startOffset:e,endOffset:n}=this,{startOffset:o,endOffset:a}=t;return e==null||n==null||o==null||a==null?!1:e<=a&&n>=o}refresh(){var u,m;const{_document:t,_docSkeleton:e}=this,n=this.anchorNodePosition,o=this.focusNodePosition;if((u=this._anchorShape)==null||u.hide(),(m=this._rangeShape)==null||m.hide(),this._isEmpty())return;const a=t.getOffsetConfig(),{docsLeft:r,docsTop:c}=a,l=new ve(a,e);if(this._isCollapsed()){const{contentBoxPointGroup:h,cursorList:g}=l.getRangePointData(n,n);if(this._setCursorList(g),h.length>0){const p=e.findGlyphByPosition(n);this._createOrUpdateAnchor(h,r,c,p)}return}const{borderBoxPointGroup:A,cursorList:d}=l.getRangePointData(n,o);this._setCursorList(d),A.length>0&&this._createOrUpdateRange(A,r,c)}_isEmpty(){return this.anchorNodePosition==null&&this.focusNodePosition==null}_isCollapsed(){const t=this.anchorNodePosition,e=this.focusNodePosition;if(t!=null&&e==null)return!0;if(t==null||e==null)return!1;const n=Object.keys(Ye);for(const o of n){const a=t[o],r=e[o];if(a!==r)return!1}return t.isBack===e.isBack}_createOrUpdateRange(t,e,n){var r;if(this._rangeShape){this._rangeShape.translate(e,n),this._rangeShape.updatePointGroup(t),this._rangeShape.show();return}const o=.3,a=new _.RegularPolygon(Ba+s.Tools.generateRandomId(Eo),{pointsGroup:t,fill:((r=this.style)==null?void 0:r.fill)||_.getColor(s.COLORS.black,o),left:e,top:n,evented:!1,debounceParentDirty:!1});this._rangeShape=a,this._scene.addObject(a,Ht)}_createOrUpdateAnchor(t,e,n,o){var p,f,S;const a=ut(t),{left:r}=a;let{top:c,height:l}=a;const A=14;l<A&&(c-=A-l,l=A);const d=12;let u=r+e;const m=c+n,h=((p=o==null?void 0:o.ts)==null?void 0:p.it)===s.BooleanNumber.TRUE;if(h&&(u+=l*Math.tan(d*Math.PI/180)/2),this._anchorShape){this._anchorShape.transformByState({left:u,top:m,height:l}),this._anchorShape.show(),h?this._anchorShape.skew(-12,0):this._anchorShape.skew(0,0);return}const g=new _.Rect(_a+s.generateRandomId(Eo),{left:u,top:m,height:l,strokeWidth:((f=this.style)==null?void 0:f.strokeWidth)||1,stroke:((S=this.style)==null?void 0:S.strokeActive)||_.getColor(s.COLORS.black,1),evented:!1});h&&g.skew(-12,0),this._anchorShape=g,this._scene.addObject(g,Ht),this.activeStatic()}_setCursorList(t){t.length!==0&&(this._cursorList=t)}}const Pa="__DocTableRectRange__",Ua=6;function Vt(i,t,e,n,o,a=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,r="",c=-1){const l=t.getOffsetConfig(),d=new Vn(l,e).getNodePositionGroup(n,o);return(d!=null?d:[]).map(u=>new zn(i,t,e,u.anchor,u.focus,a,r,c))}class zn{constructor(t,e,n,o,a,r=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,c="",l=-1){B(this,"rangeType",s.DOC_RANGE_TYPE.RECT);B(this,"_rangeShape");B(this,"_current",!1);B(this,"_startRow");B(this,"_startCol");B(this,"_endRow");B(this,"_endCol");B(this,"_tableId");this._scene=t,this._document=e,this._docSkeleton=n,this.anchorNodePosition=o,this.focusNodePosition=a,this.style=r,this._segmentId=c,this._segmentPage=l,this.refresh()}get startOffset(){const{startNodePosition:t}=this;return this._docSkeleton.findCharIndexByPosition(t)}get endOffset(){const{endNodePosition:t}=this;return this._docSkeleton.findCharIndexByPosition(t)}get collapsed(){return!1}get startRow(){return this._startRow}get startColumn(){return this._startCol}get endRow(){return this._endRow}get endColumn(){return this._endCol}get tableId(){return this._tableId}get segmentId(){return this._segmentId}get segmentPage(){return this._segmentPage}get spanEntireRow(){var r;const e=(r=this._docSkeleton.getViewModel().getSnapshot().tableSource)==null?void 0:r[this._tableId],{_startCol:n,_endCol:o}=this;if(e==null)throw new Error("Table is not found.");const{tableColumns:a}=e;return n===0&&o===a.length-1}get spanEntireColumn(){var r;const e=(r=this._docSkeleton.getViewModel().getSnapshot().tableSource)==null?void 0:r[this._tableId],{_startRow:n,_endRow:o}=this;if(e==null)throw new Error("Table is not found.");const{tableRows:a}=e;return n===0&&o===a.length-1}get spanEntireTable(){return this.spanEntireRow&&this.spanEntireColumn}get startNodePosition(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?t:e}get endNodePosition(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?e:t}get direction(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD}isActive(){return this._current===!0}activate(){this._current=!0}deactivate(){this._current=!1}dispose(){var t;(t=this._rangeShape)==null||t.dispose(),this._rangeShape=null}isIntersection(t){const{startRow:e,startColumn:n,endRow:o,endColumn:a}=this,{startRow:r,startColumn:c,endRow:l,endColumn:A}=t,d={left:n,top:e,right:a,bottom:o},u={left:c,top:r,right:A,bottom:l};return s.Rectangle.hasIntersectionBetweenTwoRect(d,u)}refresh(){var f;(f=this._rangeShape)==null||f.hide();const{startNodePosition:t,endNodePosition:e,_document:n,_docSkeleton:o}=this,a=n.getOffsetConfig(),{docsLeft:r,docsTop:c}=a,A=new Vn(a,o).getRangePointData(t,e);if(A==null)return;const{pointGroup:d=[],startRow:u,endRow:m,startColumn:h,endColumn:g,tableId:p}=A;(d==null?void 0:d.length)>0&&this._createOrUpdateRange(d,r,c),this._updateTableInfo(u,m,h,g,p)}_updateTableInfo(t,e,n,o,a){this._startRow=t,this._endRow=e,this._startCol=n,this._endCol=o,this._tableId=a}_createOrUpdateRange(t,e,n){var r;if(this._rangeShape){this._rangeShape.translate(e,n),this._rangeShape.updatePointGroup(t),this._rangeShape.show();return}const o=.3,a=new _.RegularPolygon(Pa+s.Tools.generateRandomId(Ua),{pointsGroup:t,fill:((r=this.style)==null?void 0:r.fill)||_.getColor(s.COLORS.black,o),left:e,top:n,evented:!1,debounceParentDirty:!1});this._rangeShape=a,this._scene.addObject(a,Ht)}}function Co(i,t,e,n,o,a,r,c,l=!0,A=!0){const d=o.findNodePositionByCharIndex(i,l,r,c),u=o.findNodePositionByCharIndex(t,A,r,c);if(!(d==null||u==null))return new He(e,n,o,d,u,a,r,c)}function wa(i,t,e,n,o,a,r,c){const l=o.findNodePositionByCharIndex(i,!0,r,c),A=o.findNodePositionByCharIndex(t,!0,r,c);if(!(l==null||A==null))return new zn(e,n,o,l,A,a,r,c)}function La(i,t,e,n,o,a,r,c){const l=o.findNodePositionByCharIndex(i,!0,r,c),A=o.findNodePositionByCharIndex(t,!0,r,c);if(!(l==null||A==null))return Gn(l,A,e,n,o,a,r,c)}function Gn(i,t,e,n,o,a,r,c){const l=[],A=[],d=[e,n,o,i,t,a,r,c];if(vo(o,i,t)){if(Hn(i,t))return l.push(new He(...d)),{textRanges:l,rectRanges:A};{const C=Vt(...d);return A.push(...C),{textRanges:l,rectRanges:A}}}if(Io(i,t)){const C=Vt(...d);return A.push(...C),{textRanges:l,rectRanges:A}}const u=o.getViewModel().getSelfOrHeaderFooterViewModel(r),m=o.findCharIndexByPosition(i),h=o.findCharIndexByPosition(t);if(m==null||h==null)return;const g=m<=h?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD,p=Math.min(m,h),f=Math.max(m,h);let S=p,E=f;for(const C of u.getChildren())for(const b of C.children){const{startIndex:R,endIndex:v,children:O}=b,M=C.children.indexOf(b),y=C.children[M+1],N=O[0];let x=!1;if(N){const{startIndex:w,endIndex:H,children:V}=N;let F=null,Q=null;const j=V.find(k=>k.startIndex<=p&&k.endIndex>=p),G=V.find(k=>k.startIndex<=f&&k.endIndex>=f);if(p>w&&p<H)F=o.findNodePositionByCharIndex(j.startIndex+2,!0,r,c),Q=o.findNodePositionByCharIndex(H-4,!0,r,c),S=H+1;else if(f>w&&f<H)F=o.findNodePositionByCharIndex(w+3,!0,r,c),Q=o.findNodePositionByCharIndex(G.endIndex-3,!0,r,c),E=w-1,x=!0;else if(w>p&&H<f){if(F=o.findNodePositionByCharIndex(w+3,!0,r,c),Q=o.findNodePositionByCharIndex(H-4,!0,r,c),S<=w-1){const k=o.findNodePositionByCharIndex(S,!0,r,c),W=o.findNodePositionByCharIndex(w-1,!1,r,c),z=g===s.RANGE_DIRECTION.FORWARD?k:W,X=g===s.RANGE_DIRECTION.FORWARD?W:k;l.push(new He(e,n,o,z,X,a,r,c))}S=H+1}if(F&&Q){const k=g===s.RANGE_DIRECTION.FORWARD?F:Q,W=g===s.RANGE_DIRECTION.FORWARD?Q:F;A.push(...Vt(e,n,o,k,W,a,r,c))}}if(E===v+1&&!x&&y&&y.children.length&&(E=v,x=!0),E>=R&&E<=v||x){const w=o.findNodePositionByCharIndex(S,!0,r,c),H=o.findNodePositionByCharIndex(E,!x,r,c),V=g===s.RANGE_DIRECTION.FORWARD?w:H,F=g===s.RANGE_DIRECTION.FORWARD?H:w;if(A.length&&s.Tools.diffValue(V,F))continue;l.push(new He(e,n,o,V,F,a,r,c))}}return{textRanges:l,rectRanges:A}}function To(i){const t=i==null?void 0:i.getCanvasElement();if(!t)return{left:0,top:0};const{top:e,left:n}=_.getOffsetRectForDom(t);return{left:n,top:e}}function yo(i){var l;const t=(l=i.parent)==null?void 0:l.parent,e=t==null?void 0:t.parent;if(t==null||e==null)return;const{paragraphIndex:n}=t,o=e.lines.filter(A=>A.paragraphIndex===n);let a=-1,r="",c=!1;for(const A of o)for(const d of A.divides)for(const u of d.glyphGroup)c||(a+=u.count),u===i&&(c=!0),r+=u.count>0?u.content:"";return{st:o[0].st,ed:n,content:r,nodeIndex:a}}function jn(i){const{startOffset:t,endOffset:e,collapsed:n,rangeType:o,startNodePosition:a,endNodePosition:r,direction:c,segmentId:l,segmentPage:A}=i;return{startOffset:t,endOffset:e,collapsed:n,rangeType:o,startNodePosition:a,endNodePosition:r,direction:c,segmentId:l,segmentPage:A,isActive:i.isActive()}}function Qa(i){const t=jn(i),{startRow:e,startColumn:n,endRow:o,endColumn:a,tableId:r,spanEntireRow:c,spanEntireColumn:l,spanEntireTable:A}=i;return{...t,startRow:e,startColumn:n,endRow:o,endColumn:a,tableId:r,spanEntireRow:c,spanEntireColumn:l,spanEntireTable:A}}var Fa=Object.getOwnPropertyDescriptor,Ha=(i,t,e,n)=>{for(var o=n>1?void 0:n?Fa(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Wt=(i,t)=>(e,n)=>t(e,n,i);T.DocSelectionRenderService=class extends s.RxDisposable{constructor(e,n,o,a,r){super();B(this,"_onInputBefore$",new L.Subject);B(this,"onInputBefore$",this._onInputBefore$.asObservable());B(this,"_onKeydown$",new L.Subject);B(this,"onKeydown$",this._onKeydown$.asObservable());B(this,"_onInput$",new L.Subject);B(this,"onInput$",this._onInput$.asObservable());B(this,"_onCompositionstart$",new L.BehaviorSubject(null));B(this,"onCompositionstart$",this._onCompositionstart$.asObservable());B(this,"_onCompositionupdate$",new L.BehaviorSubject(null));B(this,"onCompositionupdate$",this._onCompositionupdate$.asObservable());B(this,"_onCompositionend$",new L.BehaviorSubject(null));B(this,"onCompositionend$",this._onCompositionend$.asObservable());B(this,"_onSelectionStart$",new L.BehaviorSubject(null));B(this,"onSelectionStart$",this._onSelectionStart$.asObservable());B(this,"onChangeByEvent$",L.merge(this._onInput$,this._onKeydown$.pipe(L.filter(e=>e.event.keyCode===I.KeyCode.BACKSPACE)),this._onCompositionend$));B(this,"_onPaste$",new L.Subject);B(this,"onPaste$",this._onPaste$.asObservable());B(this,"_textSelectionInner$",new L.BehaviorSubject(null));B(this,"textSelectionInner$",this._textSelectionInner$.asObservable());B(this,"_onFocus$",new L.Subject);B(this,"onFocus$",this._onFocus$.asObservable());B(this,"_onBlur$",new L.Subject);B(this,"onBlur$",this._onBlur$.asObservable());B(this,"_onPointerDown$",new L.Subject);B(this,"onPointerDown$",this._onPointerDown$.asObservable());B(this,"_container");B(this,"_inputParent");B(this,"_input");B(this,"_scrollTimers",[]);B(this,"_rangeList",[]);B(this,"_rangeListCache",[]);B(this,"_rectRangeList",[]);B(this,"_rectRangeListCache",[]);B(this,"_anchorNodePosition",null);B(this,"_focusNodePosition",null);B(this,"_currentSegmentId","");B(this,"_currentSegmentPage",-1);B(this,"_selectionStyle",_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE);B(this,"_onPointerEvent",!1);B(this,"_viewPortObserverMap",new Map);B(this,"_isIMEInputApply",!1);B(this,"_scenePointerMoveSubs",[]);B(this,"_scenePointerUpSubs",[]);B(this,"_reserveRanges",!1);this._context=e,this._layoutService=n,this._logService=o,this._univerInstanceService=a,this._docSkeletonManagerService=r,this._initDOM(),this._registerContainer(),this._setSystemHighlightColorToStyle(),this._listenCurrentUnitChange()}get isOnPointerEvent(){return this._onPointerEvent}get isFocusing(){return this._input===document.activeElement}get canFocusing(){return this.isFocusing||document.activeElement===document.body||document.activeElement===null}_listenCurrentUnitChange(){this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;e.getUnitId()!==this._context.unitId&&!this._reserveRanges&&this.removeAllRanges()})}get activeViewPort(){return this._context.scene.getViewports()[0]}setSegment(e){this._currentSegmentId=e}getSegment(){return this._currentSegmentId}setSegmentPage(e){this._currentSegmentPage=e}getSegmentPage(){return this._currentSegmentPage}setReserveRangesStatus(e){this._reserveRanges=e}_setRangeStyle(e=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE){this._selectionStyle=e}addDocRanges(e,n=!0,o){const{_currentSegmentId:a,_currentSegmentPage:r,_selectionStyle:c}=this,{scene:l,mainComponent:A}=this._context,d=A,u=this._docSkeletonManagerService.getSkeleton(),m=(h,g)=>{const p=La(h,g,l,d,u,c,a,r);if(p==null)return;const{textRanges:f,rectRanges:S}=p;for(const E of f)this._addTextRange(E);this._addRectRanges(S)};for(const h of e){const{startOffset:g,endOffset:p,rangeType:f,startNodePosition:S,endNodePosition:E}=h;if(f===s.DOC_RANGE_TYPE.RECT){const C=wa(g,p,l,d,u,c,a,r);C&&this._addRectRanges([C])}else if(f===s.DOC_RANGE_TYPE.TEXT)try{let C=null;S&&E?C=Co(S.isBack?g:g-1,E.isBack?p:p-1,l,d,u,c,a,r,S.isBack,E.isBack):C=Co(g,p,l,d,u,c,a,r),C&&this._addTextRange(C)}catch{m(g,p)}else m(g,p)}this._textSelectionInner$.next({textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:a,segmentPage:r,style:c,isEditing:n,options:o}),!(!e.length||(o==null?void 0:o.shouldFocus)===!1)&&this._updateInputPosition(o==null?void 0:o.forceFocus)}setCursorManually(e,n){const o=this._findNodeByCoord(e,n,{strict:!0,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage}),a=this._getNodePosition(o);if(a==null){this._removeAllRanges();return}(o==null?void 0:o.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(a.isBack=!0),this._createTextRangeByAnchorPosition(a),this._textSelectionInner$.next({textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage,style:this._selectionStyle,isEditing:!1})}sync(){this._updateInputPosition()}activate(e,n,o=!1){this._container.style.left=`${e}px`,this._container.style.top=`${n}px`,this._container.style.zIndex="1000",(this.canFocusing||o)&&this.focus()}hasFocus(){return document.activeElement===this._input}focus(){this._input.focus()}blur(){this._input.blur()}deactivate(){this._container.style.left="0px",this._container.style.top="0px"}__handleDblClick(e){const{offsetX:n,offsetY:o}=e,a=this._findNodeByCoord(n,o,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage});if(a==null||a.node==null)return;const r=yo(a.node);if(r==null)return;const{content:c,st:l,nodeIndex:A}=r;if(A===-1||Intl.Segmenter==null)return;const u=new Intl.Segmenter(void 0,{granularity:"word"}).segment(c);let m=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const{segment:g,index:p,isWordLike:f}of u)if(p<=A&&A<p+g.length&&f){m=p+l,h=p+l+g.length;break}if(Number.isFinite(m)&&Number.isFinite(h)){this.removeAllRanges();const g=[{startOffset:m,endOffset:h}];this.addDocRanges(g,!1,{forceFocus:!0})}}__handleTripleClick(e){const{offsetX:n,offsetY:o}=e,a=this._findNodeByCoord(n,o,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage});if(a==null||a.node==null)return;const r=yo(a.node);if(r==null)return;this.removeAllRanges();const{st:c,ed:l}=r,A=[{startOffset:c,endOffset:l}];this.addDocRanges(A,!1,{forceFocus:!0})}__onPointDown(e){var f,S;const{scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton(),{offsetX:r,offsetY:c}=e,l=this._findNodeByCoord(r,c,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage}),A=this._getNodePosition(l);if(A==null||l==null){this._removeAllRanges();return}(l==null?void 0:l.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(A.isBack=!0);const d=this._textSelectionInner$.value;if(l&&e.button===2&&d){const E=a.findCharIndexByPosition(A);if(typeof E=="number"&&d.textRanges.some(C=>C.startOffset<=E&&C.endOffset>E)||typeof E=="number"&&d.rectRanges.some(C=>C.startOffset<=E&&C.endOffset>=E))return}const{segmentId:u,segmentPage:m}=l;u&&this._currentSegmentId&&u!==this._currentSegmentId&&this.setSegment(u),u&&m!==this._currentSegmentPage&&this.setSegmentPage(m),this._anchorNodePosition=A,e.shiftKey&&this._getActiveRangeInstance()?this._updateActiveRangePosition(A):e.ctrlKey?this._removeAllCollapsedTextRanges():this._isEmpty()||this._removeAllRanges(),n.disableObjectsEvent();const h=_.ScrollTimer.create(n);this._scrollTimers.push(h),h.startScroll(r,c),this._onSelectionStart$.next((f=this._getActiveRangeInstance())==null?void 0:f.startNodePosition),(S=n.getTransformer())==null||S.clearSelectedObjects();let g=r,p=c;this._onPointerEvent=!0,this._scenePointerMoveSubs.push(n.onPointerMove$.subscribeEvent(E=>{const{offsetX:C,offsetY:b}=E;n.setCursor(_.CURSOR_TYPE.TEXT),!(Math.sqrt((C-g)**2+(b-p)**2)<3)&&(this._moving(C,b),h.scrolling(C,b,()=>{this._moving(C,b)}),g=C,p=b)})),this._scenePointerUpSubs.push(n.onPointerUp$.subscribeEvent(()=>{if([...this._scenePointerMoveSubs,...this._scenePointerUpSubs].forEach(C=>{C.unsubscribe()}),this._onPointerEvent=!1,n.enableObjectsEvent(),this._anchorNodePosition&&!this._focusNodePosition){if(e.ctrlKey){this._disposeScrollTimers();return}const C=new He(n,o,a,this._anchorNodePosition,void 0,this._selectionStyle,this._currentSegmentId,this._currentSegmentPage);this._addTextRange(C)}else if(this._anchorNodePosition&&this._focusNodePosition){for(const C of this._rangeListCache)e.ctrlKey?C.collapsed?C.dispose():this._addTextRange(C):this._addTextRange(C);this._addRectRanges(this._rectRangeListCache),this._rangeListCache=[],this._rectRangeListCache=[]}this._anchorNodePosition=null,this._focusNodePosition=null;const E={textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage,style:this._selectionStyle,isEditing:!1};this._textSelectionInner$.next(E),this._disposeScrollTimers(),this._updateInputPosition(!0)}))}removeAllRanges(){this._removeAllRanges(),this.deactivate()}getActiveTextRange(){return this._getActiveRangeInstance()}_disposeScrollTimers(){this._scrollTimers.forEach(e=>{e==null||e.dispose()}),this._scrollTimers=[]}_setSystemHighlightColorToStyle(){const{r:e,g:n,b:o,a}=_.getSystemHighlightColor(),r={strokeWidth:1,stroke:"rgba(0, 0, 0, 0)",strokeActive:"rgba(0, 0, 0, 1)",fill:`rgba(${e}, ${n}, ${o}, ${a!=null?a:.3})`};this._setRangeStyle(r)}_getAllTextRanges(){return this._rangeList.map(jn)}_getAllRectRanges(){return this._rectRangeList.map(Qa)}getAllTextRanges(){return this._getAllTextRanges()}getAllRectRanges(){return this._getAllRectRanges()}_getActiveRange(){const e=this._rangeList.find(a=>a.isActive());if(e==null)return null;const{startOffset:n,endOffset:o}=e;return n==null||o==null?null:jn(e)}_getActiveRangeInstance(){return this._rangeList.find(e=>e.isActive())}dispose(){super.dispose(),this._detachEvent(),this._removeAllRanges(),this._container.remove()}_initDOM(){const{unitId:e}=this._context,n=document.createElement("div");n.style.position="fixed",n.style.left="0px",n.style.top="0px",n.id=`univer-doc-selection-container-${e}`;const o=document.createElement("div"),a=document.createElement("div");o.appendChild(a),n.appendChild(o),this._container=n,this._inputParent=o,this._input=a,this._initInput(),this._initInputEvents(),document.body.appendChild(n)}_registerContainer(){this.disposeWithMe(this._layoutService.registerContainerElement(this._container))}_initInput(){this._inputParent.style.cssText=`
167
+ they are not in the same segment page when in header or footer.`);const{start:c,end:l}=Ln(t,e);return this._selectionIterator(c,l,(A,d,u,m,h,g)=>{const{lineHeight:p,asc:f,paddingTop:S,marginTop:E,marginBottom:C}=g,{glyphGroup:b,st:R}=h;if(b.length===0)return;const{x:I,y:O}=this._liquid;let M,y;const N=b[A],x=b[d],w=b[A-1],H=(N==null?void 0:N.left)||0,V=(N==null?void 0:N.width)||0,F=(x==null?void 0:x.left)||0,Q=(x==null?void 0:x.width)||0,j=(N==null?void 0:N.glyphType)===_.GlyphType.LIST,{startOffset:G,endOffset:k}=xa(b,A,d,R),W=c.glyph===A&&u?c.isBack:!0,z=l.glyph===d&&m?l.isBack:!1,X=c===l,Y=W&&w!=null?w:N;if(A===0&&d===b.length-1)M={startX:I+H+(j?V:0),startY:O,endX:I+F+(z?0:Q),endY:O+p-E-C},y={startX:I+H+(j?V:0),startY:O+S+f-Y.bBox.ba,endX:I+F+(z?0:Q),endY:O+S+f+Y.bBox.bd};else{const q=W&&!j;M={startX:I+H+(q?0:V),startY:O,endX:I+F+(z?0:Q),endY:O+p-E-C},y={startX:I+H+(q?0:V),startY:O+S+f-Y.bBox.ba,endX:I+F+(z?0:Q),endY:O+S+f+Y.bBox.bd}}n.push(Fn(M)),o.push(Fn(y)),a.push({startOffset:W?G:G+N.count,endOffset:z?k:k+x.count,collapsed:X})}),{borderBoxPointGroup:n,contentBoxPointGroup:o,cursorList:a}}_isValidPosition(t,e){const{segmentPage:n,pageType:o}=t,{segmentPage:a,pageType:r}=e;return o!==r?!1:o===_.DocumentSkeletonPageType.HEADER||o===_.DocumentSkeletonPageType.FOOTER?n===a:!0}_resetCurrentNodePositionState(){this._currentStartState={page:0,section:0,column:0,line:0,divide:0,glyph:0},this._currentEndState={page:0,section:0,column:0,line:0,divide:0,glyph:0}}_setNodePositionState(t=0,e,n,o){o===e?this._currentStartState[t]=1:this._currentStartState[t]=0,o===n?this._currentEndState[t]=2:this._currentEndState[t]=0}_checkPreviousNodePositionState(t,e=!0){let n=t,o;for(;n>=0;){const a=Ft[n];let r;if(e?r=this._currentStartState[a]:r=this._currentEndState[a],r===void 0)return;if(o===void 0&&(o=r),r!==o)return 0;n--}return o}_getSelectionRuler(t,e,n,o,a){let r=0,c=o;const l=Ft[t],A=Ft[t+1];if(A===null||l===null)return{start_next:r,end_next:c};const d=e[l],u=n[l];this._setNodePositionState(l,d,u,a);const m=this._checkPreviousNodePositionState(t),h=this._checkPreviousNodePositionState(t,!1);return m===1&&(r=e[A]),h===2&&(c=n[A]),{start_next:r,end_next:c}}_selectionIterator(t,e,n){var b,R;const o=this._docSkeleton;if(!o)return[];const{pageType:a,path:r}=t;this._liquid.reset();const c=o.getSkeletonData();if(c==null)return[];const{pages:l,skeHeaders:A,skeFooters:d}=c,{page:u,segmentPage:m}=t,{page:h,segmentPage:g}=e;if(this._resetCurrentNodePositionState(),this._documentOffsetConfig==null)return[];const{pageLayoutType:p,pageMarginLeft:f,pageMarginTop:S}=this._documentOffsetConfig,E=a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?u:m;for(let I=0;I<E;I++){const O=l[I];this._liquid.translatePage(O,p,f,S)}const C=a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?h:g;for(let I=E;I<=C;I++){const O=l[I],{headerId:M,footerId:y,pageWidth:N}=O;let x=O;if(a===_.DocumentSkeletonPageType.HEADER?x=(b=A.get(M))==null?void 0:b.get(N):a===_.DocumentSkeletonPageType.FOOTER?x=(R=d.get(y))==null?void 0:R.get(N):a===_.DocumentSkeletonPageType.CELL&&(x=_.getPageFromPath(c,r)),x==null){this._liquid.translatePage(O,p,f,S);continue}const w=x.sections,{start_next:H,end_next:V}=this._getSelectionRuler(Ye.page,t,e,w.length-1,a===_.DocumentSkeletonPageType.BODY||a===_.DocumentSkeletonPageType.CELL?I:0);switch(this._liquid.translateSave(),a){case _.DocumentSkeletonPageType.HEADER:this._liquid.translatePagePadding({...x,marginLeft:O.marginLeft});break;case _.DocumentSkeletonPageType.FOOTER:{const F=O.pageHeight-x.height-x.marginBottom;this._liquid.translate(O.marginLeft,F);break}case _.DocumentSkeletonPageType.CELL:{this._liquid.translatePagePadding(O);const F=x.parent,Q=F.parent,{left:j}=x,{top:G,left:k}=Q,{top:W}=F;this._liquid.translate(k+j,G+W),this._liquid.translatePagePadding(x);break}default:this._liquid.translatePagePadding(O);break}for(let F=H;F<=V;F++){const Q=w[F],j=Q.columns,{start_next:G,end_next:k}=this._getSelectionRuler(Ye.section,t,e,j.length-1,F);this._liquid.translateSection(Q);for(let W=G;W<=k;W++){const z=j[W],X=z.lines,{start_next:Y,end_next:q}=this._getSelectionRuler(Ye.column,t,e,X.length-1,W);this._liquid.translateColumn(z);for(let K=Y;K<=q;K++){const $=X[K],{divides:ie}=$,{start_next:fe,end_next:Fe}=this._getSelectionRuler(Ye.line,t,e,ie.length-1,K);this._liquid.translateSave(),this._liquid.translateLine($,!0,!1);for(let Se=fe;Se<=Fe;Se++){const io=ie[Se];this._liquid.translateSave(),this._liquid.translateDivide(io);const{glyphGroup:_A}=io,{start_next:NA,end_next:PA}=this._getSelectionRuler(Ye.divide,t,e,_A.length-1,Se);let fa=!1,Sa=!1;I===E&&F===H&&W===G&&K===Y&&Se===fe&&(fa=!0),I===C&&F===V&&W===k&&K===q&&Se===Fe&&(Sa=!0),n&&n(NA,PA,fa,Sa,io,$,z,Q,x),this._liquid.translateRestore()}this._liquid.translateRestore()}}}this._liquid.translateRestore(),this._liquid.translatePage(O,p,f,S)}}}function vo(i,t){const{path:e}=i,{path:n}=t;if(e.length!==n.length||e.indexOf("cells")===-1)return!1;const o=e.indexOf("skeTables")+1,a=e.indexOf("rows")+1,r=e.indexOf("cells")+1,{tableId:c,sliceIndex:l}=_.getTableIdAndSliceIndex(e[o]),{tableId:A,sliceIndex:d}=_.getTableIdAndSliceIndex(n[o]);if(c!==A)return!1;const u=e[a],m=n[a],h=e[r],g=n[r];return!(u===m&&h===g&&l===d)}function Hn(i,t){const{path:e}=i,{path:n}=t;return e.indexOf("cells")===-1||n.indexOf("cells")===-1||e.length!==n.length?!1:s.Tools.diffValue(e,n)}function Io(i,t,e){var h,g,p,f,S,E,C,b;const{path:n}=t,{path:o}=e;if(n.indexOf("cells")===-1||o.indexOf("cells")===-1)return!1;const a=i.findGlyphByPosition(t),r=i.findGlyphByPosition(e),c=(f=(p=(g=(h=a==null?void 0:a.parent)==null?void 0:h.parent)==null?void 0:g.parent)==null?void 0:p.parent)==null?void 0:f.parent,l=(b=(C=(E=(S=r==null?void 0:r.parent)==null?void 0:S.parent)==null?void 0:E.parent)==null?void 0:C.parent)==null?void 0:b.parent;if(c==null||l==null)return!1;const A=c.parent,d=l.parent,u=A.cells.indexOf(c),m=d.cells.indexOf(l);return u===m&&A.index===d.index}function kn(i,t){if(Hn(i,t))return wn(i,t);const{path:e}=i,{path:n}=t,o=e[e.length-5],a=n[n.length-5];if(o!==a&&typeof o=="string"&&typeof a=="string"){const d=o.split("#-#")[1],u=a.split("#-#")[1];return+d<+u}const r=e[e.length-3],c=n[n.length-3],l=e[e.length-1],A=n[n.length-1];return r<c?!0:r>c?!1:l<=A}function qe(i){return i.sections[0].columns[0].lines.length===0}function Da(i,t,e){let n=t,o=e,a=i[n],r=i[o];for(;n<o&&(qe(a)||qe(r));)qe(a)?(n++,a=i[n]):qe(r)&&(o--,r=i[o]);if(!qe(a)&&!qe(r))return[a,r]}class Vn{constructor(t,e){B(this,"_liquid",new _.Liquid);this._documentOffsetConfig=t,this._docSkeleton=e}getRangePointData(t,e){const n=[],a=this._docSkeleton.getSkeletonData();if(a==null)return;const{pages:r}=a,{segmentPage:c,page:l,pageType:A}=t,d=this._getTableRectRangeInfo(t,e);if(d==null)return;const{tableId:u,startRowIndex:m,startColumnIndex:h,endRowIndex:g,endColumnIndex:p}=d;this._liquid.reset();const{pageLayoutType:f,pageMarginLeft:S,pageMarginTop:E}=this._documentOffsetConfig,C=A===_.DocumentSkeletonPageType.BODY||A===_.DocumentSkeletonPageType.CELL?l:c;for(let b=0;b<C;b++){const R=r[b];this._liquid.translatePage(R,f,S,E)}for(let b=C;b<r.length;b++){const R=r[b];this._liquid.translatePagePadding(R);const{skeTables:I}=R;let O=null;for(const[x,w]of I.entries())x.startsWith(u)&&(O=w);if(O==null){this._liquid.restorePagePadding(R),this._liquid.translatePage(R,f,S,E);continue}this._liquid.translateSave(),this._liquid.translate(0,O.top);const{x:M,y}=this._liquid,{left:N}=O;for(const x of O.rows)if(x.index>=m&&x.index<=g){const w=Da(x.cells,h,p);if(w==null)continue;const[H,V]=w,F={startX:M+H.left+N,startY:y+x.top,endX:M+V.left+V.pageWidth+N,endY:y+x.top+x.height};n.push(Fn(F))}this._liquid.translateRestore(),this._liquid.restorePagePadding(R),this._liquid.translatePage(R,f,S,E)}return{pointGroup:n,startRow:m,startColumn:h,endRow:g,endColumn:p,tableId:u}}getNodePositionGroup(t,e){const n=[],o=this._docSkeleton.findCharIndexByPosition(t),a=this._docSkeleton.findCharIndexByPosition(e);if(o==null||a==null)return;const r=o<a,c=this._getTableRectRangeInfo(t,e);if(c==null)return;const{tableId:l,startRowIndex:A,startColumnIndex:d,endRowIndex:u,endColumnIndex:m}=c,h=this._docSkeleton.getViewModel().findTableNodeById(l);if(h==null)return;const g=h.children[0].children.length;if(d===0&&m===g-1){const f=h.children[A].children[d],S=this._docSkeleton.findNodePositionByCharIndex(f.startIndex+1),E=h.children[u].children[m],C=this._docSkeleton.findNodePositionByCharIndex(E.endIndex-2);if(S==null||C==null)return;n.push({anchor:r?S:C,focus:r?C:S})}else for(let f=A;f<=u;f++){const S=h.children[f],E=S.children[d],C=S.children[m],b=this._docSkeleton.findNodePositionByCharIndex(E.startIndex+1),R=this._docSkeleton.findNodePositionByCharIndex(C.endIndex-2);if(b==null||R==null)return;n.push({anchor:r?b:R,focus:r?R:b})}return n}_getTableRectRangeInfo(t,e){const o=this._docSkeleton.getSkeletonData();if(o==null)return;const{pages:a}=o,{path:r}=t,{path:c}=e,l=_.getPageFromPath(o,r),A=_.getPageFromPath(o,c);if(l==null||A==null)return;const d=l.segmentId,u=l.parent.index,m=l.parent.cells.indexOf(l),h=(A==null?void 0:A.parent).index,g=(A==null?void 0:A.parent).cells.indexOf(A),p=Math.min(u,h),f=Math.max(u,h),S=Math.min(m,g),E=Math.max(m,g);return{pages:a,tableId:d,startRowIndex:p,startColumnIndex:S,endRowIndex:f,endColumnIndex:E}}}const Ba="__TestSelectionRange__",_a="__TestSelectionAnchor__",Eo=6,Wn=500,Na=500,Ht=3;function ut(i){const t=i[0],e=t[0],n=t[2],{x:o,y:a}=e,{x:r,y:c}=n;return{left:o,top:a,width:r-o,height:c-a}}function kt(i){return i.map(t=>{let e=1/0,n=-1/0,o=1/0,a=-1/0;return t.forEach(r=>{e=Math.min(r.x,e),n=Math.max(r.x,n),a=Math.max(r.y,a),o=Math.min(r.y,o)}),{left:e,right:n,top:o,bottom:a}})}class He{constructor(t,e,n,o,a,r=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,c="",l=-1){B(this,"rangeType",s.DOC_RANGE_TYPE.TEXT);B(this,"_current",!1);B(this,"_rangeShape");B(this,"_anchorShape");B(this,"_cursorList",[]);B(this,"_anchorBlinkTimer",null);this._scene=t,this._document=e,this._docSkeleton=n,this.anchorNodePosition=o,this.focusNodePosition=a,this.style=r,this._segmentId=c,this._segmentPage=l,this._anchorBlink(),this.refresh()}_anchorBlink(){setTimeout(()=>{this._anchorShape&&this._anchorShape.visible&&this.deactivateStatic()},Wn),this._anchorBlinkTimer=setInterval(()=>{this._anchorShape&&this._anchorShape.visible&&(this.activeStatic(),setTimeout(()=>{this.deactivateStatic()},Wn))},Na+Wn)}get startOffset(){var o;const{startOffset:t}=(o=Qn(this._cursorList))!=null?o:{},e=this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId).getBody();if(t==null||e==null)return t;const n=e.dataStream.length-2;return Math.min(n,t)}get endOffset(){var o;const{endOffset:t}=(o=Qn(this._cursorList))!=null?o:{},e=this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId).getBody();if(t==null||e==null)return t;const n=e.dataStream.length-2;return Math.min(t,n)}get collapsed(){const{startOffset:t,endOffset:e}=this;return t!=null&&t===e}get startNodePosition(){if(this.anchorNodePosition==null)return null;if(this.focusNodePosition==null)return this.anchorNodePosition;const{start:t}=Ln(this.anchorNodePosition,this.focusNodePosition);return t}get endNodePosition(){if(this.anchorNodePosition==null)return this.focusNodePosition;if(this.focusNodePosition==null)return null;const{end:t}=Ln(this.anchorNodePosition,this.focusNodePosition);return t}get direction(){const{collapsed:t,anchorNodePosition:e,focusNodePosition:n}=this;return t||e==null||n==null?s.RANGE_DIRECTION.NONE:wn(e,n)?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD}get segmentId(){return this._segmentId}get segmentPage(){return this._segmentPage}getAbsolutePosition(){const t=this.anchorNodePosition,e=this.focusNodePosition;if(this._isEmpty())return;const n=this._document.getOffsetConfig(),{docsLeft:o,docsTop:a}=n,r=new Ie(n,this._docSkeleton);if(this._isCollapsed()){const{contentBoxPointGroup:d,cursorList:u}=r.getRangePointData(t,t);if(this._setCursorList(u),d.length===0)return;const m=ut(d);return{...m,left:m.left+o,top:m.top+a}}const{borderBoxPointGroup:c,cursorList:l}=r.getRangePointData(t,e);if(this._setCursorList(l),c.length===0)return;const A=ut(c);return{...A,left:A.left+o,top:A.top+a}}getAnchor(){return this._anchorShape}activeStatic(){var t,e;(e=this._anchorShape)==null||e.setProps({stroke:((t=this.style)==null?void 0:t.strokeActive)||_.getColor(s.COLORS.black,1)})}deactivateStatic(){var t,e;(e=this._anchorShape)==null||e.setProps({stroke:((t=this.style)==null?void 0:t.stroke)||_.getColor(s.COLORS.black,0)})}isActive(){return this._current===!0}activate(){this._current=!0}deactivate(){this._current=!1}dispose(){var t,e;(t=this._rangeShape)==null||t.dispose(),this._rangeShape=null,(e=this._anchorShape)==null||e.dispose(),this._anchorShape=null,this._anchorBlinkTimer&&(clearInterval(this._anchorBlinkTimer),this._anchorBlinkTimer=null)}isIntersection(t){const{startOffset:e,endOffset:n}=this,{startOffset:o,endOffset:a}=t;return e==null||n==null||o==null||a==null?!1:e<=a&&n>=o}refresh(){var u,m;const{_document:t,_docSkeleton:e}=this,n=this.anchorNodePosition,o=this.focusNodePosition;if((u=this._anchorShape)==null||u.hide(),(m=this._rangeShape)==null||m.hide(),this._isEmpty())return;const a=t.getOffsetConfig(),{docsLeft:r,docsTop:c}=a,l=new Ie(a,e);if(this._isCollapsed()){const{contentBoxPointGroup:h,cursorList:g}=l.getRangePointData(n,n);if(this._setCursorList(g),h.length>0){const p=e.findGlyphByPosition(n);this._createOrUpdateAnchor(h,r,c,p)}return}const{borderBoxPointGroup:A,cursorList:d}=l.getRangePointData(n,o);this._setCursorList(d),A.length>0&&this._createOrUpdateRange(A,r,c)}_isEmpty(){return this.anchorNodePosition==null&&this.focusNodePosition==null}_isCollapsed(){const t=this.anchorNodePosition,e=this.focusNodePosition;if(t!=null&&e==null)return!0;if(t==null||e==null)return!1;const n=Object.keys(Ye);for(const o of n){const a=t[o],r=e[o];if(a!==r)return!1}return t.isBack===e.isBack}_createOrUpdateRange(t,e,n){var r;if(this._rangeShape){this._rangeShape.translate(e,n),this._rangeShape.updatePointGroup(t),this._rangeShape.show();return}const o=.3,a=new _.RegularPolygon(Ba+s.Tools.generateRandomId(Eo),{pointsGroup:t,fill:((r=this.style)==null?void 0:r.fill)||_.getColor(s.COLORS.black,o),left:e,top:n,evented:!1,debounceParentDirty:!1});this._rangeShape=a,this._scene.addObject(a,Ht)}_createOrUpdateAnchor(t,e,n,o){var p,f,S;const a=ut(t),{left:r}=a;let{top:c,height:l}=a;const A=14;l<A&&(c-=A-l,l=A);const d=12;let u=r+e;const m=c+n,h=((p=o==null?void 0:o.ts)==null?void 0:p.it)===s.BooleanNumber.TRUE;if(h&&(u+=l*Math.tan(d*Math.PI/180)/2),this._anchorShape){this._anchorShape.transformByState({left:u,top:m,height:l}),this._anchorShape.show(),h?this._anchorShape.skew(-12,0):this._anchorShape.skew(0,0);return}const g=new _.Rect(_a+s.generateRandomId(Eo),{left:u,top:m,height:l,strokeWidth:((f=this.style)==null?void 0:f.strokeWidth)||1,stroke:((S=this.style)==null?void 0:S.strokeActive)||_.getColor(s.COLORS.black,1),evented:!1});h&&g.skew(-12,0),this._anchorShape=g,this._scene.addObject(g,Ht),this.activeStatic()}_setCursorList(t){t.length!==0&&(this._cursorList=t)}}const Pa="__DocTableRectRange__",Ua=6;function Vt(i,t,e,n,o,a=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,r="",c=-1){const l=t.getOffsetConfig(),d=new Vn(l,e).getNodePositionGroup(n,o);return(d!=null?d:[]).map(u=>new zn(i,t,e,u.anchor,u.focus,a,r,c))}class zn{constructor(t,e,n,o,a,r=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE,c="",l=-1){B(this,"rangeType",s.DOC_RANGE_TYPE.RECT);B(this,"_rangeShape");B(this,"_current",!1);B(this,"_startRow");B(this,"_startCol");B(this,"_endRow");B(this,"_endCol");B(this,"_tableId");this._scene=t,this._document=e,this._docSkeleton=n,this.anchorNodePosition=o,this.focusNodePosition=a,this.style=r,this._segmentId=c,this._segmentPage=l,this.refresh()}get startOffset(){const{startNodePosition:t}=this;return this._docSkeleton.findCharIndexByPosition(t)}get endOffset(){const{endNodePosition:t}=this;return this._docSkeleton.findCharIndexByPosition(t)}get collapsed(){return!1}get startRow(){return this._startRow}get startColumn(){return this._startCol}get endRow(){return this._endRow}get endColumn(){return this._endCol}get tableId(){return this._tableId}get segmentId(){return this._segmentId}get segmentPage(){return this._segmentPage}get spanEntireRow(){var r;const e=(r=this._docSkeleton.getViewModel().getSnapshot().tableSource)==null?void 0:r[this._tableId],{_startCol:n,_endCol:o}=this;if(e==null)throw new Error("Table is not found.");const{tableColumns:a}=e;return n===0&&o===a.length-1}get spanEntireColumn(){var r;const e=(r=this._docSkeleton.getViewModel().getSnapshot().tableSource)==null?void 0:r[this._tableId],{_startRow:n,_endRow:o}=this;if(e==null)throw new Error("Table is not found.");const{tableRows:a}=e;return n===0&&o===a.length-1}get spanEntireTable(){return this.spanEntireRow&&this.spanEntireColumn}get startNodePosition(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?t:e}get endNodePosition(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?e:t}get direction(){const{anchorNodePosition:t,focusNodePosition:e}=this;return kn(t,e)?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD}isActive(){return this._current===!0}activate(){this._current=!0}deactivate(){this._current=!1}dispose(){var t;(t=this._rangeShape)==null||t.dispose(),this._rangeShape=null}isIntersection(t){const{startRow:e,startColumn:n,endRow:o,endColumn:a}=this,{startRow:r,startColumn:c,endRow:l,endColumn:A}=t,d={left:n,top:e,right:a,bottom:o},u={left:c,top:r,right:A,bottom:l};return s.Rectangle.hasIntersectionBetweenTwoRect(d,u)}refresh(){var f;(f=this._rangeShape)==null||f.hide();const{startNodePosition:t,endNodePosition:e,_document:n,_docSkeleton:o}=this,a=n.getOffsetConfig(),{docsLeft:r,docsTop:c}=a,A=new Vn(a,o).getRangePointData(t,e);if(A==null)return;const{pointGroup:d=[],startRow:u,endRow:m,startColumn:h,endColumn:g,tableId:p}=A;(d==null?void 0:d.length)>0&&this._createOrUpdateRange(d,r,c),this._updateTableInfo(u,m,h,g,p)}_updateTableInfo(t,e,n,o,a){this._startRow=t,this._endRow=e,this._startCol=n,this._endCol=o,this._tableId=a}_createOrUpdateRange(t,e,n){var r;if(this._rangeShape){this._rangeShape.translate(e,n),this._rangeShape.updatePointGroup(t),this._rangeShape.show();return}const o=.3,a=new _.RegularPolygon(Pa+s.Tools.generateRandomId(Ua),{pointsGroup:t,fill:((r=this.style)==null?void 0:r.fill)||_.getColor(s.COLORS.black,o),left:e,top:n,evented:!1,debounceParentDirty:!1});this._rangeShape=a,this._scene.addObject(a,Ht)}}function Co(i,t,e,n,o,a,r,c,l=!0,A=!0){const d=o.findNodePositionByCharIndex(i,l,r,c),u=o.findNodePositionByCharIndex(t,A,r,c);if(!(d==null||u==null))return new He(e,n,o,d,u,a,r,c)}function wa(i,t,e,n,o,a,r,c){const l=o.findNodePositionByCharIndex(i,!0,r,c),A=o.findNodePositionByCharIndex(t,!0,r,c);if(!(l==null||A==null))return new zn(e,n,o,l,A,a,r,c)}function La(i,t,e,n,o,a,r,c){const l=o.findNodePositionByCharIndex(i,!0,r,c),A=o.findNodePositionByCharIndex(t,!0,r,c);if(!(l==null||A==null))return Gn(l,A,e,n,o,a,r,c)}function Gn(i,t,e,n,o,a,r,c){const l=[],A=[],d=[e,n,o,i,t,a,r,c];if(Io(o,i,t)){if(Hn(i,t))return l.push(new He(...d)),{textRanges:l,rectRanges:A};{const C=Vt(...d);return A.push(...C),{textRanges:l,rectRanges:A}}}if(vo(i,t)){const C=Vt(...d);return A.push(...C),{textRanges:l,rectRanges:A}}const u=o.getViewModel().getSelfOrHeaderFooterViewModel(r),m=o.findCharIndexByPosition(i),h=o.findCharIndexByPosition(t);if(m==null||h==null)return;const g=m<=h?s.RANGE_DIRECTION.FORWARD:s.RANGE_DIRECTION.BACKWARD,p=Math.min(m,h),f=Math.max(m,h);let S=p,E=f;for(const C of u.getChildren())for(const b of C.children){const{startIndex:R,endIndex:I,children:O}=b,M=C.children.indexOf(b),y=C.children[M+1],N=O[0];let x=!1;if(N){const{startIndex:w,endIndex:H,children:V}=N;let F=null,Q=null;const j=V.find(k=>k.startIndex<=p&&k.endIndex>=p),G=V.find(k=>k.startIndex<=f&&k.endIndex>=f);if(p>w&&p<H)F=o.findNodePositionByCharIndex(j.startIndex+2,!0,r,c),Q=o.findNodePositionByCharIndex(H-4,!0,r,c),S=H+1;else if(f>w&&f<H)F=o.findNodePositionByCharIndex(w+3,!0,r,c),Q=o.findNodePositionByCharIndex(G.endIndex-3,!0,r,c),E=w-1,x=!0;else if(w>p&&H<f){if(F=o.findNodePositionByCharIndex(w+3,!0,r,c),Q=o.findNodePositionByCharIndex(H-4,!0,r,c),S<=w-1){const k=o.findNodePositionByCharIndex(S,!0,r,c),W=o.findNodePositionByCharIndex(w-1,!1,r,c),z=g===s.RANGE_DIRECTION.FORWARD?k:W,X=g===s.RANGE_DIRECTION.FORWARD?W:k;l.push(new He(e,n,o,z,X,a,r,c))}S=H+1}if(F&&Q){const k=g===s.RANGE_DIRECTION.FORWARD?F:Q,W=g===s.RANGE_DIRECTION.FORWARD?Q:F;A.push(...Vt(e,n,o,k,W,a,r,c))}}if(E===I+1&&!x&&y&&y.children.length&&(E=I,x=!0),E>=R&&E<=I||x){const w=o.findNodePositionByCharIndex(S,!0,r,c),H=o.findNodePositionByCharIndex(E,!x,r,c),V=g===s.RANGE_DIRECTION.FORWARD?w:H,F=g===s.RANGE_DIRECTION.FORWARD?H:w;if(A.length&&s.Tools.diffValue(V,F))continue;l.push(new He(e,n,o,V,F,a,r,c))}}return{textRanges:l,rectRanges:A}}function To(i){const t=i==null?void 0:i.getCanvasElement();if(!t)return{left:0,top:0};const{top:e,left:n}=_.getOffsetRectForDom(t);return{left:n,top:e}}function yo(i){var l;const t=(l=i.parent)==null?void 0:l.parent,e=t==null?void 0:t.parent;if(t==null||e==null)return;const{paragraphIndex:n}=t,o=e.lines.filter(A=>A.paragraphIndex===n);let a=-1,r="",c=!1;for(const A of o)for(const d of A.divides)for(const u of d.glyphGroup)c||(a+=u.count),u===i&&(c=!0),r+=u.count>0?u.content:"";return{st:o[0].st,ed:n,content:r,nodeIndex:a}}function jn(i){const{startOffset:t,endOffset:e,collapsed:n,rangeType:o,startNodePosition:a,endNodePosition:r,direction:c,segmentId:l,segmentPage:A}=i;return{startOffset:t,endOffset:e,collapsed:n,rangeType:o,startNodePosition:a,endNodePosition:r,direction:c,segmentId:l,segmentPage:A,isActive:i.isActive()}}function Qa(i){const t=jn(i),{startRow:e,startColumn:n,endRow:o,endColumn:a,tableId:r,spanEntireRow:c,spanEntireColumn:l,spanEntireTable:A}=i;return{...t,startRow:e,startColumn:n,endRow:o,endColumn:a,tableId:r,spanEntireRow:c,spanEntireColumn:l,spanEntireTable:A}}var Fa=Object.getOwnPropertyDescriptor,Ha=(i,t,e,n)=>{for(var o=n>1?void 0:n?Fa(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Wt=(i,t)=>(e,n)=>t(e,n,i);T.DocSelectionRenderService=class extends s.RxDisposable{constructor(e,n,o,a,r){super();B(this,"_onInputBefore$",new L.Subject);B(this,"onInputBefore$",this._onInputBefore$.asObservable());B(this,"_onKeydown$",new L.Subject);B(this,"onKeydown$",this._onKeydown$.asObservable());B(this,"_onInput$",new L.Subject);B(this,"onInput$",this._onInput$.asObservable());B(this,"_onCompositionstart$",new L.BehaviorSubject(null));B(this,"onCompositionstart$",this._onCompositionstart$.asObservable());B(this,"_onCompositionupdate$",new L.BehaviorSubject(null));B(this,"onCompositionupdate$",this._onCompositionupdate$.asObservable());B(this,"_onCompositionend$",new L.BehaviorSubject(null));B(this,"onCompositionend$",this._onCompositionend$.asObservable());B(this,"_onSelectionStart$",new L.BehaviorSubject(null));B(this,"onSelectionStart$",this._onSelectionStart$.asObservable());B(this,"onChangeByEvent$",L.merge(this._onInput$,this._onKeydown$.pipe(L.filter(e=>e.event.keyCode===v.KeyCode.BACKSPACE)),this._onCompositionend$));B(this,"_onPaste$",new L.Subject);B(this,"onPaste$",this._onPaste$.asObservable());B(this,"_textSelectionInner$",new L.BehaviorSubject(null));B(this,"textSelectionInner$",this._textSelectionInner$.asObservable());B(this,"_onFocus$",new L.Subject);B(this,"onFocus$",this._onFocus$.asObservable());B(this,"_onBlur$",new L.Subject);B(this,"onBlur$",this._onBlur$.asObservable());B(this,"_onPointerDown$",new L.Subject);B(this,"onPointerDown$",this._onPointerDown$.asObservable());B(this,"_container");B(this,"_inputParent");B(this,"_input");B(this,"_scrollTimers",[]);B(this,"_rangeList",[]);B(this,"_rangeListCache",[]);B(this,"_rectRangeList",[]);B(this,"_rectRangeListCache",[]);B(this,"_anchorNodePosition",null);B(this,"_focusNodePosition",null);B(this,"_currentSegmentId","");B(this,"_currentSegmentPage",-1);B(this,"_selectionStyle",_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE);B(this,"_onPointerEvent",!1);B(this,"_viewPortObserverMap",new Map);B(this,"_isIMEInputApply",!1);B(this,"_scenePointerMoveSubs",[]);B(this,"_scenePointerUpSubs",[]);B(this,"_reserveRanges",!1);this._context=e,this._layoutService=n,this._logService=o,this._univerInstanceService=a,this._docSkeletonManagerService=r,this._initDOM(),this._registerContainer(),this._setSystemHighlightColorToStyle(),this._listenCurrentUnitChange()}get isOnPointerEvent(){return this._onPointerEvent}get isFocusing(){return this._input===document.activeElement}get canFocusing(){return this.isFocusing||document.activeElement===document.body||document.activeElement===null}_listenCurrentUnitChange(){this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(e=>{if(e==null)return;e.getUnitId()!==this._context.unitId&&!this._reserveRanges&&this.removeAllRanges()})}get activeViewPort(){return this._context.scene.getViewports()[0]}setSegment(e){this._currentSegmentId=e}getSegment(){return this._currentSegmentId}setSegmentPage(e){this._currentSegmentPage=e}getSegmentPage(){return this._currentSegmentPage}setReserveRangesStatus(e){this._reserveRanges=e}_setRangeStyle(e=_.NORMAL_TEXT_SELECTION_PLUGIN_STYLE){this._selectionStyle=e}addDocRanges(e,n=!0,o){const{_currentSegmentId:a,_currentSegmentPage:r,_selectionStyle:c}=this,{scene:l,mainComponent:A}=this._context,d=A,u=this._docSkeletonManagerService.getSkeleton(),m=(h,g)=>{const p=La(h,g,l,d,u,c,a,r);if(p==null)return;const{textRanges:f,rectRanges:S}=p;for(const E of f)this._addTextRange(E);this._addRectRanges(S)};for(const h of e){const{startOffset:g,endOffset:p,rangeType:f,startNodePosition:S,endNodePosition:E}=h;if(f===s.DOC_RANGE_TYPE.RECT){const C=wa(g,p,l,d,u,c,a,r);C&&this._addRectRanges([C])}else if(f===s.DOC_RANGE_TYPE.TEXT)try{let C=null;S&&E?C=Co(S.isBack?g:g-1,E.isBack?p:p-1,l,d,u,c,a,r,S.isBack,E.isBack):C=Co(g,p,l,d,u,c,a,r),C&&this._addTextRange(C)}catch{m(g,p)}else m(g,p)}this._textSelectionInner$.next({textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:a,segmentPage:r,style:c,isEditing:n,options:o}),!(!e.length||(o==null?void 0:o.shouldFocus)===!1)&&this._updateInputPosition(o==null?void 0:o.forceFocus)}setCursorManually(e,n){const o=this._findNodeByCoord(e,n,{strict:!0,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage}),a=this._getNodePosition(o);if(a==null){this._removeAllRanges();return}(o==null?void 0:o.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(a.isBack=!0),this._createTextRangeByAnchorPosition(a),this._textSelectionInner$.next({textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage,style:this._selectionStyle,isEditing:!1})}sync(){this._updateInputPosition()}activate(e,n,o=!1){this._container.style.left=`${e}px`,this._container.style.top=`${n}px`,this._container.style.zIndex="1000",(this.canFocusing||o)&&this.focus()}hasFocus(){return document.activeElement===this._input}focus(){this._input.focus()}blur(){this._input.blur()}deactivate(){this._container.style.left="0px",this._container.style.top="0px"}__handleDblClick(e){const{offsetX:n,offsetY:o}=e,a=this._findNodeByCoord(n,o,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage});if(a==null||a.node==null)return;const r=yo(a.node);if(r==null)return;const{content:c,st:l,nodeIndex:A}=r;if(A===-1||Intl.Segmenter==null)return;const u=new Intl.Segmenter(void 0,{granularity:"word"}).segment(c);let m=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const{segment:g,index:p,isWordLike:f}of u)if(p<=A&&A<p+g.length&&f){m=p+l,h=p+l+g.length;break}if(Number.isFinite(m)&&Number.isFinite(h)){this.removeAllRanges();const g=[{startOffset:m,endOffset:h}];this.addDocRanges(g,!1,{forceFocus:!0})}}__handleTripleClick(e){const{offsetX:n,offsetY:o}=e,a=this._findNodeByCoord(n,o,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage});if(a==null||a.node==null)return;const r=yo(a.node);if(r==null)return;this.removeAllRanges();const{st:c,ed:l}=r,A=[{startOffset:c,endOffset:l}];this.addDocRanges(A,!1,{forceFocus:!0})}__onPointDown(e){var f,S;const{scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton(),{offsetX:r,offsetY:c}=e,l=this._findNodeByCoord(r,c,{strict:!1,segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage}),A=this._getNodePosition(l);if(A==null||l==null){this._removeAllRanges();return}(l==null?void 0:l.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(A.isBack=!0);const d=this._textSelectionInner$.value;if(l&&e.button===2&&d){const E=a.findCharIndexByPosition(A);if(typeof E=="number"&&d.textRanges.some(C=>C.startOffset<=E&&C.endOffset>E)||typeof E=="number"&&d.rectRanges.some(C=>C.startOffset<=E&&C.endOffset>=E))return}const{segmentId:u,segmentPage:m}=l;u&&this._currentSegmentId&&u!==this._currentSegmentId&&this.setSegment(u),u&&m!==this._currentSegmentPage&&this.setSegmentPage(m),this._anchorNodePosition=A,e.shiftKey&&this._getActiveRangeInstance()?this._updateActiveRangePosition(A):e.ctrlKey?this._removeAllCollapsedTextRanges():this._isEmpty()||this._removeAllRanges(),n.disableObjectsEvent();const h=_.ScrollTimer.create(n);this._scrollTimers.push(h),h.startScroll(r,c),this._onSelectionStart$.next((f=this._getActiveRangeInstance())==null?void 0:f.startNodePosition),(S=n.getTransformer())==null||S.clearSelectedObjects();let g=r,p=c;this._onPointerEvent=!0,this._scenePointerMoveSubs.push(n.onPointerMove$.subscribeEvent(E=>{const{offsetX:C,offsetY:b}=E;n.setCursor(_.CURSOR_TYPE.TEXT),!(Math.sqrt((C-g)**2+(b-p)**2)<3)&&(this._moving(C,b),h.scrolling(C,b,()=>{this._moving(C,b)}),g=C,p=b)})),this._scenePointerUpSubs.push(n.onPointerUp$.subscribeEvent(()=>{if([...this._scenePointerMoveSubs,...this._scenePointerUpSubs].forEach(C=>{C.unsubscribe()}),this._onPointerEvent=!1,n.enableObjectsEvent(),this._anchorNodePosition&&!this._focusNodePosition){if(e.ctrlKey){this._disposeScrollTimers();return}const C=new He(n,o,a,this._anchorNodePosition,void 0,this._selectionStyle,this._currentSegmentId,this._currentSegmentPage);this._addTextRange(C)}else if(this._anchorNodePosition&&this._focusNodePosition){for(const C of this._rangeListCache)e.ctrlKey?C.collapsed?C.dispose():this._addTextRange(C):this._addTextRange(C);this._addRectRanges(this._rectRangeListCache),this._rangeListCache=[],this._rectRangeListCache=[]}this._anchorNodePosition=null,this._focusNodePosition=null;const E={textRanges:this._getAllTextRanges(),rectRanges:this._getAllRectRanges(),segmentId:this._currentSegmentId,segmentPage:this._currentSegmentPage,style:this._selectionStyle,isEditing:!1};this._textSelectionInner$.next(E),this._disposeScrollTimers(),this._updateInputPosition(!0)}))}removeAllRanges(){this._removeAllRanges(),this.deactivate()}getActiveTextRange(){return this._getActiveRangeInstance()}_disposeScrollTimers(){this._scrollTimers.forEach(e=>{e==null||e.dispose()}),this._scrollTimers=[]}_setSystemHighlightColorToStyle(){const{r:e,g:n,b:o,a}=_.getSystemHighlightColor(),r={strokeWidth:1,stroke:"rgba(0, 0, 0, 0)",strokeActive:"rgba(0, 0, 0, 1)",fill:`rgba(${e}, ${n}, ${o}, ${a!=null?a:.3})`};this._setRangeStyle(r)}_getAllTextRanges(){return this._rangeList.map(jn)}_getAllRectRanges(){return this._rectRangeList.map(Qa)}getAllTextRanges(){return this._getAllTextRanges()}getAllRectRanges(){return this._getAllRectRanges()}_getActiveRange(){const e=this._rangeList.find(a=>a.isActive());if(e==null)return null;const{startOffset:n,endOffset:o}=e;return n==null||o==null?null:jn(e)}_getActiveRangeInstance(){return this._rangeList.find(e=>e.isActive())}dispose(){super.dispose(),this._detachEvent(),this._removeAllRanges(),this._container.remove()}_initDOM(){const{unitId:e}=this._context,n=document.createElement("div");n.style.position="fixed",n.style.left="0px",n.style.top="0px",n.id=`univer-doc-selection-container-${e}`;const o=document.createElement("div"),a=document.createElement("div");o.appendChild(a),n.appendChild(o),this._container=n,this._inputParent=o,this._input=a,this._initInput(),this._initInputEvents(),document.body.appendChild(n)}_registerContainer(){this.disposeWithMe(this._layoutService.registerContainerElement(this._container))}_initInput(){this._inputParent.style.cssText=`
166
168
  position:absolute;
167
169
  height:1px;
168
170
  width:1px;
@@ -178,37 +180,49 @@ ${n}
178
180
  caret-color: transparent;
179
181
  white-space: pre-wrap;
180
182
  user-select: text;
181
- `}_getNodePosition(e){if(e==null)return;const{node:n,ratioX:o,segmentPage:a}=e,c=this._docSkeletonManagerService.getSkeleton().findPositionByGlyph(n,a);if(c==null)return;let A=o<.5;return n.glyphType===_.GlyphType.LIST&&(A=!0),{...c,isBack:A}}_interactTextRanges(e){const n=[];for(const o of this._rangeList){if(e.some(a=>a.isIntersection(o))){o.dispose();continue}n.push(o)}this._rangeList=n}_interactRectRanges(e){const n=[];for(const o of this._rectRangeList){if(e.some(a=>a.isIntersection(o))){o.dispose();continue}n.push(o)}this._rectRangeList=n}_removeAllRanges(){this._removeAllTextRanges(),this._removeAllRectRanges()}_removeAllCacheRanges(){this._rangeListCache.forEach(e=>{e.dispose()}),this._rectRangeListCache.forEach(e=>{e.dispose()}),this._rangeListCache=[],this._rectRangeListCache=[]}_removeAllTextRanges(){this._rangeList.forEach(e=>{e.dispose()}),this._rangeList=[]}_removeAllRectRanges(){this._rectRangeList.forEach(e=>{e.dispose()}),this._rectRangeList=[]}_removeAllCollapsedTextRanges(){for(const e of this._rangeList)e.collapsed&&e.dispose()}_deactivateAllTextRanges(){this._rangeList.forEach(e=>{e.deactivate()})}_deactivateAllRectRanges(){this._rectRangeList.forEach(e=>{e.deactivate()})}_addTextRangesToCache(e){this._rangeListCache.push(...e)}_addTextRange(e){this._deactivateAllTextRanges(),e.activate(),this._rangeList.push(e)}_addRectRangesToCache(e){this._rectRangeListCache.push(...e)}_addRectRanges(e){e.length!==0&&(this._deactivateAllRectRanges(),e[e.length-1].activate(),this._rectRangeList.push(...e))}_createTextRangeByAnchorPosition(e){this._removeAllRanges();const{scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton(),r=new He(n,o,a,e,void 0,this._selectionStyle,this._currentSegmentId,this._currentSegmentPage);this._addTextRange(r)}_updateActiveRangePosition(e){const n=this._getActiveRangeInstance();if(n==null||n.anchorNodePosition==null){this._logService.error("[DocSelectionRenderService] _updateActiveRangeFocusPosition: active range has no anchor");return}this._removeAllRanges(),this._anchorNodePosition=n.anchorNodePosition,this._focusNodePosition=e;const{scene:o,mainComponent:a}=this._context,r=this._docSkeletonManagerService.getSkeleton(),{_anchorNodePosition:c,_focusNodePosition:l,_selectionStyle:A,_currentSegmentId:d,_currentSegmentPage:u}=this;if(c==null||l==null||a==null)return;const m=Gn(c,l,o,a,r,A,d,u);if(m==null)return;const{textRanges:h,rectRanges:g}=m;this._addTextRangesToCache(h),this._addRectRangesToCache(g),this.deactivate()}_isEmpty(){return this._rangeList.length===0&&this._rectRangeList.length===0}_getCanvasOffset(){var n;const e=(n=this._context.scene)==null?void 0:n.getEngine();return To(e)}_updateInputPosition(e=!1){const n=this._getActiveRangeInstance(),o=n==null?void 0:n.getAnchor();if(!o||o&&!o.visible||this.activeViewPort==null){this.focus();return}const{left:a,top:r}=o,c=this.activeViewPort.getAbsoluteVector(_.Vector2.FromArray([a,r])),{x:l,y:A}=c;let{left:d,top:u}=this._getCanvasOffset();d+=l,u+=A,this.activate(d,u,e)}_moving(e,n){var E,C;const{_currentSegmentId:o,_currentSegmentPage:a}=this,r=this._findNodeByCoord(e,n,{strict:!0,segmentId:o,segmentPage:a}),c=this._getNodePosition(r);if(c==null||r==null)return;const l=r==null?void 0:r.node.parent,A=l==null?void 0:l.glyphGroup[l.glyphGroup.indexOf(r.node)+1];(r==null?void 0:r.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(A==null?void 0:A.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK&&(c.isBack=!0),this._focusNodePosition=c,this._removeAllCacheRanges();const{_anchorNodePosition:d,_selectionStyle:u}=this,{scene:m,mainComponent:h}=this._context,g=this._docSkeletonManagerService.getSkeleton();if(d==null||h==null)return;const p=Gn(d,c,m,h,g,u,o,a);if(p==null)return;const{textRanges:f,rectRanges:S}=p;this._rangeList.length>0&&f.length>0&&this._interactTextRanges(f),this._rectRangeList.length>0&&S.length>0&&this._interactRectRanges(S),this._addTextRangesToCache(f),this._addRectRangesToCache(S),this.deactivate(),(C=(E=this._context.scene)==null?void 0:E.getEngine())==null||C.setCapture()}__attachScrollEvent(){const e=this.activeViewPort;if(!e)return;const{unitId:n}=this._context;if(this._viewPortObserverMap.has(n))return;const o=e.onScrollAfter$.subscribeEvent(r=>{if(!r.viewport)return;const l=this._getActiveRangeInstance();l==null||l.activeStatic()}),a=e.onScrollEnd$.subscribeEvent(r=>{const c=r.viewport;if(!c)return;const l=c.getBounding(),A=this._getActiveRangeInstance(),d=A==null?void 0:A.getAnchor();if(!(!d||d&&!d.visible)){if(l){const{left:u,top:m,right:h,bottom:g}=l.viewBound;if(d.left<u||d.left>h||d.top<m||d.top>g){A==null||A.deactivateStatic();return}}this._updateInputPosition()}});this._viewPortObserverMap.set(n,{scrollBefore:o,scrollStop:a})}_initInputEvents(){this.disposeWithMe(L.fromEvent(this._input,"keydown").subscribe(e=>{this._isIMEInputApply||this._eventHandle(e,n=>{this._onKeydown$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"input").subscribe(e=>{if(!(e.inputType==="historyUndo"||e.inputType==="historyRedo")){if(this._rectRangeList.length>0)return e.stopPropagation(),e.preventDefault();this._isIMEInputApply||this._eventHandle(e,n=>{this._onInputBefore$.next(n),this._onInput$.next(n)})}})),this.disposeWithMe(L.fromEvent(this._input,"compositionstart").subscribe(e=>{if(this._rectRangeList.length>0)return e.stopPropagation(),e.preventDefault();this._isIMEInputApply=!0,this._eventHandle(e,n=>{this._onCompositionstart$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"compositionend").subscribe(e=>{this._isIMEInputApply=!1,this._eventHandle(e,n=>{this._onCompositionend$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"compositionupdate").subscribe(e=>{this._eventHandle(e,n=>{this._onInputBefore$.next(n),this._onCompositionupdate$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"paste").subscribe(e=>{this._eventHandle(e,n=>{this._onPaste$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"focus").subscribe(e=>{this._eventHandle(e,n=>{this._onFocus$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"blur").subscribe(e=>{this._eventHandle(e,n=>{this._onBlur$.next(n)})}))}_eventHandle(e,n){const o=this._input.textContent||"";this._input.innerHTML="";const a=this._getActiveRange(),r=this._getAllTextRanges();n({event:e,content:o,activeRange:a,rangeList:r})}_getTransformCoordForDocumentOffset(e,n){const o=this._context.mainComponent,{documentTransform:a}=o.getOffsetConfig();if(this.activeViewPort==null||a==null)return;const r=this.activeViewPort.transformVector2SceneCoord(_.Vector2.FromArray([e,n]));if(r)return a.clone().invert().applyPoint(r)}_findNodeByCoord(e,n,o){const a=this._getTransformCoordForDocumentOffset(e,n);if(a==null)return;const r=this._context.mainComponent,c=this._docSkeletonManagerService.getSkeleton(),{pageLayoutType:l=_.PageLayoutType.VERTICAL,pageMarginLeft:A,pageMarginTop:d}=r.getOffsetConfig();return c.findNodeByCoord(a,l,A,d,o)}_detachEvent(){this._onInputBefore$.complete(),this._onKeydown$.complete(),this._onInput$.complete(),this._onCompositionstart$.complete(),this._onCompositionupdate$.complete(),this._onCompositionend$.complete(),this._onSelectionStart$.complete(),this._textSelectionInner$.complete(),this._onPaste$.complete(),this._onFocus$.complete(),this._onBlur$.complete(),this._onPointerDown$.complete()}},T.DocSelectionRenderService=Ha([Wt(1,I.ILayoutService),Wt(2,s.ILogService),Wt(3,s.IUniverInstanceService),Wt(4,s.Inject(D.DocSkeletonManagerService))],T.DocSelectionRenderService);class bo extends s.Disposable{constructor(e,n,o,a,r,c){super();B(this,"_change$",new L.Subject);B(this,"change$",this._change$.asObservable());B(this,"_input$",new L.Subject);B(this,"input$",this._input$.asObservable());B(this,"_paste$",new L.Subject);B(this,"paste$",this._paste$.asObservable());B(this,"_focus$",new L.Subject);B(this,"focus$",this._focus$.asObservable());B(this,"_blur$",new L.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_selectionChange$",new L.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());this._param=e,this._univerInstanceService=n,this._docSelectionManagerService=o,this._commandService=a,this._undoRedoService=r,this._injector=c,this._listenSelection()}get docSelectionRenderService(){return this._param.render.with(T.DocSelectionRenderService)}_listenSelection(){const e=this._param.render.with(T.DocSelectionRenderService);this.disposeWithMe(e.onBlur$.subscribe(n=>{this._blur$.next(n);const o=this.getDocumentData();this._change$.next({target:this,data:o})})),this.disposeWithMe(e.onFocus$.subscribe(n=>{this._focus$.next(n)})),this.disposeWithMe(e.onPaste$.subscribe(n=>{this._paste$.next(n)})),this.disposeWithMe(L.merge(e.onInput$,e.onKeydown$.pipe(At.filter(n=>{const o=n.event;return o.ctrlKey||o.metaKey?[I.KeyCode.X,I.KeyCode.V].includes(o.keyCode):[I.KeyCode.BACKSPACE].includes(o.keyCode)})),e.onCompositionupdate$,e.onCompositionend$,e.onPaste$).subscribe(n=>{if(n==null)return;const{content:o=""}=n,a=this.getDocumentData();this._input$.next({target:this,content:o,data:a,isComposing:n.event.type==="compositionupdate"})})),this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(n=>{if(n==null)return;const{unitId:o,subUnitId:a,...r}=n,c=this.getEditorId();o===c&&this._selectionChange$.next(r)}))}isFocus(){const e=this._param.render.with(T.DocSelectionRenderService);return e.isFocusing&&!!e.getActiveTextRange()}focus(){const e=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),n=this.getEditorId();(e==null||e.getUnitId()!==n)&&this._univerInstanceService.setCurrentUnitForType(n),this._param.render.with(T.DocSelectionRenderService).focus()}blur(){this._param.render.with(T.DocSelectionRenderService).blur()}select(){const e=this.getDocumentData();return this.setSelectionRanges([{startOffset:0,endOffset:e.body?e.body.dataStream.length-2:0}])}setSelectionRanges(e,n=!0){const o=this.getEditorId(),a={unitId:o,subUnitId:o};return this._docSelectionManagerService.replaceDocRanges(e,a,!1,{shouldFocus:n})}getSelectionRanges(){const e=this.getEditorId(),n={unitId:e,subUnitId:e};return this._docSelectionManagerService.getDocRanges(n)}getCursorPosition(){var n,o;return(o=(n=this.getSelectionRanges().find(a=>a.collapsed))==null?void 0:n.startOffset)!=null?o:-1}getEditorId(){return this._getEditorId()}getDocumentData(){return this._getDocDataModel().getSnapshot()}getDocumentDataModel(){return this._getDocDataModel()}setDocumentData(e,n){this._commandService.syncExecuteCommand(Pn.id,{unitId:this.getEditorId(),snapshot:e,textRanges:n})}replaceText(e,n=!0){const o=this.getDocumentData();this.setDocumentData({...o,body:{dataStream:`${e}\r
182
- `,paragraphs:[{startIndex:0}],customRanges:[],sectionBreaks:[],tables:[],textRuns:[]}},typeof n=="object"?n:n?[{startOffset:e.length,endOffset:e.length,collapsed:!0}]:null)}clearUndoRedoHistory(){const e=this.getEditorId();return this._undoRedoService.clearUndoRedo(e)}dispose(){this._getDocDataModel().dispose()}get editorUnitId(){return this._param.editorUnitId}get params(){return this._param}get cancelDefaultResizeListener(){return this._param.cancelDefaultResizeListener}get render(){return this._param.render}isReadOnly(){return this._param.readonly===!0}getBoundingClientRect(){return this._param.editorDom.getBoundingClientRect()}get editorDOM(){return this._param.editorDom}isVisible(){return this._param.visible}getSkeleton(){var n;return(n=this._injector.get(_.IRenderManagerService).getRenderById(this._getEditorId()))==null?void 0:n.with(D.DocSkeletonManagerService).getSkeleton()}isSheetEditor(){return s.isInternalEditorID(this._getEditorId())}getValue(){var o;return(((o=this._getDocDataModel().getBody())==null?void 0:o.dataStream)||"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,"")}getBody(){return this._getDocDataModel().getBody()}update(e){this._param={...this._param,...e}}updateCanvasStyle(){var o;const e=this._getDocDataModel();if(e==null)return;const n={};(o=this._param.canvasStyle)!=null&&o.fontSize&&(n.textStyle==null&&(n.textStyle={}),n.textStyle.fs=this._param.canvasStyle.fontSize),e.updateDocumentStyle(n)}_getDocDataModel(){const e=this._getEditorId();return this._univerInstanceService.getUnit(e,s.UniverInstanceType.UNIVER_DOC)}_getEditorId(){var e;return((e=this._param.initialSnapshot)==null?void 0:e.id)||this._param.editorUnitId||""}}var ka=Object.getOwnPropertyDescriptor,Va=(i,t,e,n)=>{for(var o=n>1?void 0:n?ka(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ke=(i,t)=>(e,n)=>t(e,n,i);const Wa=["editor","render-canvas"];T.EditorService=class extends s.Disposable{constructor(e,n,o,a,r,c,l){super();B(this,"_editors",new Map);B(this,"_focusEditorUnitId");B(this,"_blur$",new L.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_focus$",new L.Subject);B(this,"focus$",this._focus$.asObservable());this._univerInstanceService=e,this._renderManagerService=n,this._docSelectionManagerService=o,this._contextService=a,this._commandService=r,this._undoRedoService=c,this._injector=l,this._initUniverFocusListener()}_initUniverFocusListener(){this.disposeWithMe(L.fromEvent(window,"focusin").subscribe(e=>{const n=e.target;this._blurSheetEditor(n)}))}_blurSheetEditor(e){if(Wa.some(o=>e.dataset.uComp===o))return;const n=this.getFocusEditor();n&&n.isSheetEditor()!==!0&&this.blur()}_setFocusId(e){this._focusEditorUnitId=e}getFocusId(){return this._focusEditorUnitId}getFocusEditor(){if(this._focusEditorUnitId)return this.getEditor(this._focusEditorUnitId)}isEditor(e){return this._editors.has(e)}isSheetEditor(e){const n=this._editors.get(e);return!!(n&&n.isSheetEditor())}blur(e){const n=this.getFocusEditor();e&&(n==null||n.setSelectionRanges([])),n==null||n.blur(),this._contextService.setContextValue(s.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(s.FOCUSING_EDITOR_STANDALONE,!1),this._setFocusId(null),this._blur$.next(null)}focus(e){if(e===this._focusEditorUnitId||(this._focusEditorUnitId&&this.blur(),e==null))return;const n=this.getEditor(e);if(n==null)return;this._univerInstanceService.setCurrentUnitForType(e);const o=n.getValue().length;this._contextService.setContextValue(s.EDITOR_ACTIVATED,!0),s.isInternalEditorID(e)||this._contextService.setContextValue(s.FOCUSING_EDITOR_STANDALONE,!0),n.focus(),this._setFocusId(e),this._focus$.next({startOffset:o,endOffset:o})}dispose(){this._editors.clear(),super.dispose()}getEditor(e=this._getCurrentEditorUnitId()){return this._editors.get(e)}getAllEditor(){return this._editors}register(e,n){var A,d,u,m;const{initialSnapshot:o,canvasStyle:a={}}=e,r=o.id;this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_DOC)==null&&this._univerInstanceService.createUnit(s.UniverInstanceType.UNIVER_DOC,o||this._getBlank(r),{makeCurrent:!1});let l=this._renderManagerService.getRenderById(r);if(l==null&&(this._renderManagerService.create(r),l=this._renderManagerService.getRenderById(r)),l){l.engine.setContainer(n);const h=new bo({...e,render:l,editorDom:n,canvasStyle:a},this._univerInstanceService,this._docSelectionManagerService,this._commandService,this._undoRedoService,this._injector);this._editors.set(r,h),e.scrollBar||(m=(u=(d=(A=l.mainComponent)==null?void 0:A.getScene())==null?void 0:d.getViewports())==null?void 0:u[0].getScrollBar())==null||m.dispose()}return s.toDisposable(()=>{this._unRegister(r)})}_unRegister(e){const n=this._editors.get(e);n!=null&&(this._renderManagerService.removeRender(e),n.dispose(),this._editors.delete(e),this._univerInstanceService.disposeUnit(e))}_getCurrentEditorUnitId(){return this._univerInstanceService.getCurrentUniverDocInstance().getUnitId()}_getBlank(e){return{id:e,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{renderConfig:{verticalAlign:s.VerticalAlign.TOP,horizontalAlign:s.HorizontalAlign.LEFT},marginLeft:3,marginTop:0,marginRight:3}}}},T.EditorService=Va([ke(0,s.IUniverInstanceService),ke(1,_.IRenderManagerService),ke(2,s.Inject(D.DocSelectionManagerService)),ke(3,s.IContextService),ke(4,s.ICommandService),ke(5,s.IUndoRedoService),ke(6,s.Inject(s.Injector))],T.EditorService);const ce=s.createIdentifier("univer.editor.service");function za(i){const{editorId:t,initialValue:e,container:n,autoFocus:o,isSingle:a}=i,r=U.useMemo(()=>o!=null?o:!1,[]),[c,l]=U.useState(),A=I.useDependency(ce);return U.useLayoutEffect(()=>{var d,u;if(n.current){const m=typeof e=="string"?void 0:s.Tools.deepClone(e),h={body:{dataStream:typeof e=="string"?`${e}\r
183
+ `}_getNodePosition(e){if(e==null)return;const{node:n,ratioX:o,segmentPage:a}=e,c=this._docSkeletonManagerService.getSkeleton().findPositionByGlyph(n,a);if(c==null)return;let A=o<.5;return n.glyphType===_.GlyphType.LIST&&(A=!0),{...c,isBack:A}}_interactTextRanges(e){const n=[];for(const o of this._rangeList){if(e.some(a=>a.isIntersection(o))){o.dispose();continue}n.push(o)}this._rangeList=n}_interactRectRanges(e){const n=[];for(const o of this._rectRangeList){if(e.some(a=>a.isIntersection(o))){o.dispose();continue}n.push(o)}this._rectRangeList=n}_removeAllRanges(){this._removeAllTextRanges(),this._removeAllRectRanges()}_removeAllCacheRanges(){this._rangeListCache.forEach(e=>{e.dispose()}),this._rectRangeListCache.forEach(e=>{e.dispose()}),this._rangeListCache=[],this._rectRangeListCache=[]}_removeAllTextRanges(){this._rangeList.forEach(e=>{e.dispose()}),this._rangeList=[]}_removeAllRectRanges(){this._rectRangeList.forEach(e=>{e.dispose()}),this._rectRangeList=[]}_removeAllCollapsedTextRanges(){for(const e of this._rangeList)e.collapsed&&e.dispose()}_deactivateAllTextRanges(){this._rangeList.forEach(e=>{e.deactivate()})}_deactivateAllRectRanges(){this._rectRangeList.forEach(e=>{e.deactivate()})}_addTextRangesToCache(e){this._rangeListCache.push(...e)}_addTextRange(e){this._deactivateAllTextRanges(),e.activate(),this._rangeList.push(e)}_addRectRangesToCache(e){this._rectRangeListCache.push(...e)}_addRectRanges(e){e.length!==0&&(this._deactivateAllRectRanges(),e[e.length-1].activate(),this._rectRangeList.push(...e))}_createTextRangeByAnchorPosition(e){this._removeAllRanges();const{scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton(),r=new He(n,o,a,e,void 0,this._selectionStyle,this._currentSegmentId,this._currentSegmentPage);this._addTextRange(r)}_updateActiveRangePosition(e){const n=this._getActiveRangeInstance();if(n==null||n.anchorNodePosition==null){this._logService.error("[DocSelectionRenderService] _updateActiveRangeFocusPosition: active range has no anchor");return}this._removeAllRanges(),this._anchorNodePosition=n.anchorNodePosition,this._focusNodePosition=e;const{scene:o,mainComponent:a}=this._context,r=this._docSkeletonManagerService.getSkeleton(),{_anchorNodePosition:c,_focusNodePosition:l,_selectionStyle:A,_currentSegmentId:d,_currentSegmentPage:u}=this;if(c==null||l==null||a==null)return;const m=Gn(c,l,o,a,r,A,d,u);if(m==null)return;const{textRanges:h,rectRanges:g}=m;this._addTextRangesToCache(h),this._addRectRangesToCache(g),this.deactivate()}_isEmpty(){return this._rangeList.length===0&&this._rectRangeList.length===0}_getCanvasOffset(){var n;const e=(n=this._context.scene)==null?void 0:n.getEngine();return To(e)}_updateInputPosition(e=!1){const n=this._getActiveRangeInstance(),o=n==null?void 0:n.getAnchor();if(!o||o&&!o.visible||this.activeViewPort==null){this.focus();return}const{left:a,top:r}=o,c=this.activeViewPort.getAbsoluteVector(_.Vector2.FromArray([a,r])),{x:l,y:A}=c;let{left:d,top:u}=this._getCanvasOffset();d+=l,u+=A,this.activate(d,u,e)}_moving(e,n){var E,C;const{_currentSegmentId:o,_currentSegmentPage:a}=this,r=this._findNodeByCoord(e,n,{strict:!0,segmentId:o,segmentPage:a}),c=this._getNodePosition(r);if(c==null||r==null)return;const l=r==null?void 0:r.node.parent,A=l==null?void 0:l.glyphGroup[l.glyphGroup.indexOf(r.node)+1];(r==null?void 0:r.node.streamType)===s.DataStreamTreeTokenType.PARAGRAPH&&(A==null?void 0:A.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK&&(c.isBack=!0),this._focusNodePosition=c,this._removeAllCacheRanges();const{_anchorNodePosition:d,_selectionStyle:u}=this,{scene:m,mainComponent:h}=this._context,g=this._docSkeletonManagerService.getSkeleton();if(d==null||h==null)return;const p=Gn(d,c,m,h,g,u,o,a);if(p==null)return;const{textRanges:f,rectRanges:S}=p;this._rangeList.length>0&&f.length>0&&this._interactTextRanges(f),this._rectRangeList.length>0&&S.length>0&&this._interactRectRanges(S),this._addTextRangesToCache(f),this._addRectRangesToCache(S),this.deactivate(),(C=(E=this._context.scene)==null?void 0:E.getEngine())==null||C.setCapture()}__attachScrollEvent(){const e=this.activeViewPort;if(!e)return;const{unitId:n}=this._context;if(this._viewPortObserverMap.has(n))return;const o=e.onScrollAfter$.subscribeEvent(r=>{if(!r.viewport)return;const l=this._getActiveRangeInstance();l==null||l.activeStatic()}),a=e.onScrollEnd$.subscribeEvent(r=>{const c=r.viewport;if(!c)return;const l=c.getBounding(),A=this._getActiveRangeInstance(),d=A==null?void 0:A.getAnchor();if(!(!d||d&&!d.visible)){if(l){const{left:u,top:m,right:h,bottom:g}=l.viewBound;if(d.left<u||d.left>h||d.top<m||d.top>g){A==null||A.deactivateStatic();return}}this._updateInputPosition()}});this._viewPortObserverMap.set(n,{scrollBefore:o,scrollStop:a})}_initInputEvents(){this.disposeWithMe(L.fromEvent(this._input,"keydown").subscribe(e=>{this._isIMEInputApply||this._eventHandle(e,n=>{this._onKeydown$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"input").subscribe(e=>{if(!(e.inputType==="historyUndo"||e.inputType==="historyRedo")){if(this._rectRangeList.length>0)return e.stopPropagation(),e.preventDefault();this._isIMEInputApply||this._eventHandle(e,n=>{this._onInputBefore$.next(n),this._onInput$.next(n)})}})),this.disposeWithMe(L.fromEvent(this._input,"compositionstart").subscribe(e=>{if(this._rectRangeList.length>0)return e.stopPropagation(),e.preventDefault();this._isIMEInputApply=!0,this._eventHandle(e,n=>{this._onCompositionstart$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"compositionend").subscribe(e=>{this._isIMEInputApply=!1,this._eventHandle(e,n=>{this._onCompositionend$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"compositionupdate").subscribe(e=>{this._eventHandle(e,n=>{this._onInputBefore$.next(n),this._onCompositionupdate$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"paste").subscribe(e=>{this._eventHandle(e,n=>{this._onPaste$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"focus").subscribe(e=>{this._eventHandle(e,n=>{this._onFocus$.next(n)})})),this.disposeWithMe(L.fromEvent(this._input,"blur").subscribe(e=>{this._eventHandle(e,n=>{this._onBlur$.next(n)})}))}_eventHandle(e,n){const o=this._input.textContent||"";this._input.innerHTML="";const a=this._getActiveRange(),r=this._getAllTextRanges();n({event:e,content:o,activeRange:a,rangeList:r})}_getTransformCoordForDocumentOffset(e,n){const o=this._context.mainComponent,{documentTransform:a}=o.getOffsetConfig();if(this.activeViewPort==null||a==null)return;const r=this.activeViewPort.transformVector2SceneCoord(_.Vector2.FromArray([e,n]));if(r)return a.clone().invert().applyPoint(r)}_findNodeByCoord(e,n,o){const a=this._getTransformCoordForDocumentOffset(e,n);if(a==null)return;const r=this._context.mainComponent,c=this._docSkeletonManagerService.getSkeleton(),{pageLayoutType:l=_.PageLayoutType.VERTICAL,pageMarginLeft:A,pageMarginTop:d}=r.getOffsetConfig();return c.findNodeByCoord(a,l,A,d,o)}_detachEvent(){this._onInputBefore$.complete(),this._onKeydown$.complete(),this._onInput$.complete(),this._onCompositionstart$.complete(),this._onCompositionupdate$.complete(),this._onCompositionend$.complete(),this._onSelectionStart$.complete(),this._textSelectionInner$.complete(),this._onPaste$.complete(),this._onFocus$.complete(),this._onBlur$.complete(),this._onPointerDown$.complete()}},T.DocSelectionRenderService=Ha([Wt(1,v.ILayoutService),Wt(2,s.ILogService),Wt(3,s.IUniverInstanceService),Wt(4,s.Inject(D.DocSkeletonManagerService))],T.DocSelectionRenderService);class bo extends s.Disposable{constructor(e,n,o,a,r,c){super();B(this,"_change$",new L.Subject);B(this,"change$",this._change$.asObservable());B(this,"_input$",new L.Subject);B(this,"input$",this._input$.asObservable());B(this,"_paste$",new L.Subject);B(this,"paste$",this._paste$.asObservable());B(this,"_focus$",new L.Subject);B(this,"focus$",this._focus$.asObservable());B(this,"_blur$",new L.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_selectionChange$",new L.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());this._param=e,this._univerInstanceService=n,this._docSelectionManagerService=o,this._commandService=a,this._undoRedoService=r,this._injector=c,this._listenSelection()}get docSelectionRenderService(){return this._param.render.with(T.DocSelectionRenderService)}_listenSelection(){const e=this._param.render.with(T.DocSelectionRenderService);this.disposeWithMe(e.onBlur$.subscribe(n=>{this._blur$.next(n);const o=this.getDocumentData();this._change$.next({target:this,data:o})})),this.disposeWithMe(e.onFocus$.subscribe(n=>{this._focus$.next(n)})),this.disposeWithMe(e.onPaste$.subscribe(n=>{this._paste$.next(n)})),this.disposeWithMe(L.merge(e.onInput$,e.onKeydown$.pipe(At.filter(n=>{const o=n.event;return o.ctrlKey||o.metaKey?[v.KeyCode.X,v.KeyCode.V].includes(o.keyCode):[v.KeyCode.BACKSPACE].includes(o.keyCode)})),e.onCompositionupdate$,e.onCompositionend$,e.onPaste$).subscribe(n=>{if(n==null)return;const{content:o=""}=n,a=this.getDocumentData();this._input$.next({target:this,content:o,data:a,isComposing:n.event.type==="compositionupdate"})})),this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(n=>{if(n==null)return;const{unitId:o,subUnitId:a,...r}=n,c=this.getEditorId();o===c&&this._selectionChange$.next(r)}))}isFocus(){const e=this._param.render.with(T.DocSelectionRenderService);return e.isFocusing&&!!e.getActiveTextRange()}focus(){const e=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),n=this.getEditorId();(e==null||e.getUnitId()!==n)&&this._univerInstanceService.setCurrentUnitForType(n),this._param.render.with(T.DocSelectionRenderService).focus()}blur(){this._param.render.with(T.DocSelectionRenderService).blur()}select(){const e=this.getDocumentData();return this.setSelectionRanges([{startOffset:0,endOffset:e.body?e.body.dataStream.length-2:0}])}setSelectionRanges(e,n=!0){const o=this.getEditorId(),a={unitId:o,subUnitId:o};return this._docSelectionManagerService.replaceDocRanges(e,a,!1,{shouldFocus:n})}getSelectionRanges(){const e=this.getEditorId(),n={unitId:e,subUnitId:e};return this._docSelectionManagerService.getDocRanges(n)}getCursorPosition(){var n,o;return(o=(n=this.getSelectionRanges().find(a=>a.collapsed))==null?void 0:n.startOffset)!=null?o:-1}getEditorId(){return this._getEditorId()}getDocumentData(){return this._getDocDataModel().getSnapshot()}getDocumentDataModel(){return this._getDocDataModel()}setDocumentData(e,n){this._commandService.syncExecuteCommand(Pn.id,{unitId:this.getEditorId(),snapshot:e,textRanges:n})}replaceText(e,n=!0){const o=this.getDocumentData();this.setDocumentData({...o,body:{dataStream:`${e}\r
184
+ `,paragraphs:[{startIndex:0}],customRanges:[],sectionBreaks:[],tables:[],textRuns:[]}},typeof n=="object"?n:n?[{startOffset:e.length,endOffset:e.length,collapsed:!0}]:null)}clearUndoRedoHistory(){const e=this.getEditorId();return this._undoRedoService.clearUndoRedo(e)}dispose(){this._getDocDataModel().dispose()}get editorUnitId(){return this._param.editorUnitId}get params(){return this._param}get cancelDefaultResizeListener(){return this._param.cancelDefaultResizeListener}get render(){return this._param.render}isReadOnly(){return this._param.readonly===!0}getBoundingClientRect(){return this._param.editorDom.getBoundingClientRect()}get editorDOM(){return this._param.editorDom}isVisible(){return this._param.visible}getSkeleton(){var n;return(n=this._injector.get(_.IRenderManagerService).getRenderById(this._getEditorId()))==null?void 0:n.with(D.DocSkeletonManagerService).getSkeleton()}isSheetEditor(){return s.isInternalEditorID(this._getEditorId())}getValue(){var o;return(((o=this._getDocDataModel().getBody())==null?void 0:o.dataStream)||"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,"")}getBody(){return this._getDocDataModel().getBody()}update(e){this._param={...this._param,...e}}updateCanvasStyle(){var o;const e=this._getDocDataModel();if(e==null)return;const n={};(o=this._param.canvasStyle)!=null&&o.fontSize&&(n.textStyle==null&&(n.textStyle={}),n.textStyle.fs=this._param.canvasStyle.fontSize),e.updateDocumentStyle(n)}_getDocDataModel(){const e=this._getEditorId();return this._univerInstanceService.getUnit(e,s.UniverInstanceType.UNIVER_DOC)}_getEditorId(){var e;return((e=this._param.initialSnapshot)==null?void 0:e.id)||this._param.editorUnitId||""}}var ka=Object.getOwnPropertyDescriptor,Va=(i,t,e,n)=>{for(var o=n>1?void 0:n?ka(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ke=(i,t)=>(e,n)=>t(e,n,i);const Wa=["editor","render-canvas"];T.EditorService=class extends s.Disposable{constructor(e,n,o,a,r,c,l){super();B(this,"_editors",new Map);B(this,"_focusEditorUnitId");B(this,"_blur$",new L.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_focus$",new L.Subject);B(this,"focus$",this._focus$.asObservable());this._univerInstanceService=e,this._renderManagerService=n,this._docSelectionManagerService=o,this._contextService=a,this._commandService=r,this._undoRedoService=c,this._injector=l,this._initUniverFocusListener()}_initUniverFocusListener(){this.disposeWithMe(L.fromEvent(window,"focusin").subscribe(e=>{const n=e.target;this._blurSheetEditor(n)}))}_blurSheetEditor(e){if(Wa.some(o=>e.dataset.uComp===o))return;const n=this.getFocusEditor();n&&n.isSheetEditor()!==!0&&this.blur()}_setFocusId(e){this._focusEditorUnitId=e}getFocusId(){return this._focusEditorUnitId}getFocusEditor(){if(this._focusEditorUnitId)return this.getEditor(this._focusEditorUnitId)}isEditor(e){return this._editors.has(e)}isSheetEditor(e){const n=this._editors.get(e);return!!(n&&n.isSheetEditor())}blur(e){const n=this.getFocusEditor();e&&(n==null||n.setSelectionRanges([])),n==null||n.blur(),this._contextService.setContextValue(s.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(s.FOCUSING_EDITOR_STANDALONE,!1),this._setFocusId(null),this._blur$.next(null)}focus(e){if(e===this._focusEditorUnitId||(this._focusEditorUnitId&&this.blur(),e==null))return;const n=this.getEditor(e);if(n==null)return;this._univerInstanceService.setCurrentUnitForType(e);const o=n.getValue().length;this._contextService.setContextValue(s.EDITOR_ACTIVATED,!0),s.isInternalEditorID(e)||this._contextService.setContextValue(s.FOCUSING_EDITOR_STANDALONE,!0),n.focus(),this._setFocusId(e),this._focus$.next({startOffset:o,endOffset:o})}dispose(){this._editors.clear(),super.dispose()}getEditor(e=this._getCurrentEditorUnitId()){return this._editors.get(e)}getAllEditor(){return this._editors}register(e,n){var A,d,u,m;const{initialSnapshot:o,canvasStyle:a={}}=e,r=o.id;this._univerInstanceService.getUnit(r,s.UniverInstanceType.UNIVER_DOC)==null&&this._univerInstanceService.createUnit(s.UniverInstanceType.UNIVER_DOC,o||this._getBlank(r),{makeCurrent:!1});let l=this._renderManagerService.getRenderById(r);if(l==null&&(this._renderManagerService.create(r),l=this._renderManagerService.getRenderById(r)),l){l.engine.setContainer(n);const h=new bo({...e,render:l,editorDom:n,canvasStyle:a},this._univerInstanceService,this._docSelectionManagerService,this._commandService,this._undoRedoService,this._injector);this._editors.set(r,h),e.scrollBar||(m=(u=(d=(A=l.mainComponent)==null?void 0:A.getScene())==null?void 0:d.getViewports())==null?void 0:u[0].getScrollBar())==null||m.dispose()}return s.toDisposable(()=>{this._unRegister(r)})}_unRegister(e){const n=this._editors.get(e);n!=null&&(this._renderManagerService.removeRender(e),n.dispose(),this._editors.delete(e),this._univerInstanceService.disposeUnit(e))}_getCurrentEditorUnitId(){return this._univerInstanceService.getCurrentUniverDocInstance().getUnitId()}_getBlank(e){return{id:e,body:{dataStream:`${s.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{renderConfig:{verticalAlign:s.VerticalAlign.TOP,horizontalAlign:s.HorizontalAlign.LEFT},marginLeft:3,marginTop:0,marginRight:3}}}},T.EditorService=Va([ke(0,s.IUniverInstanceService),ke(1,_.IRenderManagerService),ke(2,s.Inject(D.DocSelectionManagerService)),ke(3,s.IContextService),ke(4,s.ICommandService),ke(5,s.IUndoRedoService),ke(6,s.Inject(s.Injector))],T.EditorService);const ce=s.createIdentifier("univer.editor.service");function za(i){const{editorId:t,initialValue:e,container:n,autoFocus:o,isSingle:a}=i,r=U.useMemo(()=>o!=null?o:!1,[]),[c,l]=U.useState(),A=v.useDependency(ce);return U.useLayoutEffect(()=>{var d,u;if(n.current){const m=typeof e=="string"?void 0:s.Tools.deepClone(e),h={body:{dataStream:typeof e=="string"?`${e}\r
183
185
  `:`\r
184
- `,textRuns:[],customBlocks:[],customDecorations:[],customRanges:[],paragraphs:[{startIndex:0}]},...m,documentStyle:{...m==null?void 0:m.documentStyle,pageSize:{width:a?1/0:n.current.clientWidth,height:1/0}},id:t},g=A.register({autofocus:!0,editorUnitId:t,initialSnapshot:h},n.current),p=A.getEditor(t);if(l(p),r){p.focus();const f=((u=(d=h.body)==null?void 0:d.dataStream.length)!=null?u:2)-2;p.setSelectionRanges([{startOffset:f,endOffset:f}])}return()=>{g==null||g.dispose()}}},[]),c}const Ee={id:"doc.operation.move-cursor",type:s.CommandType.OPERATION,handler:(i,t)=>!!t},Ce={id:"doc.operation.move-selection",type:s.CommandType.OPERATION,handler:(i,t)=>!!t},Ga=(i,t,e,n)=>{const o=I.useDependency(s.ICommandService),a=I.useDependency(I.IShortcutService),r=U.useRef(t);r.current=t;const c=U.useRef(n);c.current=n,U.useEffect(()=>{if(!e||!i)return;const A=`sheet.formula-embedding-editor.${e.getEditorId()}`,d=new s.DisposableCollection,u=(h,g)=>{if(c.current){c.current(h,g);return}let p=s.Direction.LEFT;h===I.KeyCode.ARROW_DOWN?p=s.Direction.DOWN:h===I.KeyCode.ARROW_UP?p=s.Direction.UP:h===I.KeyCode.ARROW_RIGHT&&(p=s.Direction.RIGHT),g===I.MetaKeys.SHIFT?o.executeCommand(Ce.id,{direction:p}):o.executeCommand(Ee.id,{direction:p})};return d.add(o.registerCommand({id:A,type:s.CommandType.OPERATION,handler(h,g){const{keyCode:p}=g;u(p)}})),[{keyCode:I.KeyCode.ARROW_DOWN},{keyCode:I.KeyCode.ARROW_LEFT},{keyCode:I.KeyCode.ARROW_RIGHT},{keyCode:I.KeyCode.ARROW_UP},{keyCode:I.KeyCode.ARROW_DOWN,metaKey:I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_LEFT,metaKey:I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_RIGHT,metaKey:I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_UP,metaKey:I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_DOWN,metaKey:I.MetaKeys.CTRL_COMMAND},{keyCode:I.KeyCode.ARROW_LEFT,metaKey:I.MetaKeys.CTRL_COMMAND},{keyCode:I.KeyCode.ARROW_RIGHT,metaKey:I.MetaKeys.CTRL_COMMAND},{keyCode:I.KeyCode.ARROW_UP,metaKey:I.MetaKeys.CTRL_COMMAND},{keyCode:I.KeyCode.ARROW_DOWN,metaKey:I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_LEFT,metaKey:I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_RIGHT,metaKey:I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT},{keyCode:I.KeyCode.ARROW_UP,metaKey:I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT}].map(({keyCode:h,metaKey:g})=>({id:A,binding:g?h|g:h,preconditions:()=>!0,priority:900,staticParameters:{eventType:_.DeviceInputEventType.Keyboard,keyCode:h}})).forEach(h=>{d.add(a.registerShortcut(h))}),()=>{d.dispose()}},[o,e,i,a])};function ja(i,t){const e=I.useDependency(s.ICommandService);U.useEffect(()=>{if(!i)return;const n=e.onCommandExecuted(o=>{var a,r;if(o.id===D.RichTextEditingMutation.id){if(o.params.unitId!==i.getEditorId())return;const l=i.getDocumentData();t(l,s.getPlainText((r=(a=l.body)==null?void 0:a.dataStream)!=null?r:""))}});return()=>{n.dispose()}},[i,t,e])}const Xa=i=>{var W;const{className:t,autoFocus:e,onFocusChange:n,initialValue:o,onClickOutside:a,keyboardEventConfig:r,moveCursor:c=!0,style:l,isSingle:A,editorId:d,onHeightChange:u,onChange:m,defaultHeight:h=32,maxHeight:g=32,icon:p,editorRef:f,placeholder:S}=i,E=I.useDependency(ce),C=I.useEvent(n),b=I.useEvent(a),[R,v]=U.useState(h),O=U.useRef(null),M=U.useMemo(()=>d!=null?d:s.createInternalEditorID(`RICH_TEXT_EDITOR-${s.generateRandomId(4)}`),[d]),y=za({editorId:M,initialValue:o,container:O,autoFocus:e,isSingle:A}),x=I.useDependency(_.IRenderManagerService).getRenderById(M),w=x==null?void 0:x.with(T.DocSelectionRenderService),H=I.useObservable(w==null?void 0:w.textSelectionInner$),V=!!((W=w==null?void 0:w.isFocusing)!=null&&W&&(H!=null&&H.textRanges.some(z=>z.collapsed))),F=U.useRef(null),[Q,j]=U.useState(()=>{var z,X;return!s.BuildTextUtils.transform.getPlainText((X=(z=y==null?void 0:y.getDocumentData().body)==null?void 0:z.dataStream)!=null?X:"")}),{checkScrollBar:G}=go(y,A,!0,!0);U.useLayoutEffect(()=>{if(!(!f||!y)){if(typeof f=="function"){f(y);return}f.current=y}},[y]);const k=I.useEvent(z=>{var q,K;const X=x==null?void 0:x.with(D.DocSkeletonManagerService),Y=X==null?void 0:X.getSkeleton().getActualSize();Y&&(u==null||u(Y.actualHeight),v(Math.max(h,Math.min(Y.actualHeight+10,g)))),m==null||m(z,s.getPlainText((K=(q=z.body)==null?void 0:q.dataStream)!=null?K:"")),G()});return U.useEffect(()=>{var X,Y;j(!s.BuildTextUtils.transform.getPlainText((Y=(X=y==null?void 0:y.getDocumentData().body)==null?void 0:X.dataStream)!=null?Y:""));const z=y==null?void 0:y.selectionChange$.subscribe(()=>{var q,K;j(!s.BuildTextUtils.transform.getPlainText((K=(q=y==null?void 0:y.getDocumentData().body)==null?void 0:q.dataStream)!=null?K:""))});return()=>z==null?void 0:z.unsubscribe()},[y]),I.useObservable(y==null?void 0:y.blur$),I.useObservable(y==null?void 0:y.focus$),U.useEffect(()=>{var X,Y;const z=y==null?void 0:y.getDocumentData();C==null||C(V,s.getPlainText((Y=(X=z==null?void 0:z.body)==null?void 0:X.dataStream)!=null?Y:""))},[V,C]),U.useEffect(()=>{const z=Y=>{var K,$;E.getFocusId()!==M||(($=(K=Y.target)==null?void 0:K.dataset)==null?void 0:$.editorid)===M||F.current&&!F.current.contains(Y.target)&&(b==null||b())},X=setTimeout(()=>{document.addEventListener("click",z)},100);return()=>{document.removeEventListener("click",z),clearTimeout(X)}},[y,M,E,b]),Ga(V&&c,!1,y),ho(V,r,y),ja(y,k),P.jsx("div",{className:t,style:l,children:P.jsxs("div",{className:J.clsx(`
186
+ `,textRuns:[],customBlocks:[],customDecorations:[],customRanges:[],paragraphs:[{startIndex:0}]},...m,documentStyle:{...m==null?void 0:m.documentStyle,pageSize:{width:a?1/0:n.current.clientWidth,height:1/0}},id:t},g=A.register({autofocus:!0,editorUnitId:t,initialSnapshot:h},n.current),p=A.getEditor(t);if(l(p),r){p.focus();const f=((u=(d=h.body)==null?void 0:d.dataStream.length)!=null?u:2)-2;p.setSelectionRanges([{startOffset:f,endOffset:f}])}return()=>{g==null||g.dispose()}}},[]),c}const Ee={id:"doc.operation.move-cursor",type:s.CommandType.OPERATION,handler:(i,t)=>!!t},Ce={id:"doc.operation.move-selection",type:s.CommandType.OPERATION,handler:(i,t)=>!!t},Ga=(i,t,e,n)=>{const o=v.useDependency(s.ICommandService),a=v.useDependency(v.IShortcutService),r=U.useRef(t);r.current=t;const c=U.useRef(n);c.current=n,U.useEffect(()=>{if(!e||!i)return;const A=`sheet.formula-embedding-editor.${e.getEditorId()}`,d=new s.DisposableCollection,u=(h,g)=>{if(c.current){c.current(h,g);return}let p=s.Direction.LEFT;h===v.KeyCode.ARROW_DOWN?p=s.Direction.DOWN:h===v.KeyCode.ARROW_UP?p=s.Direction.UP:h===v.KeyCode.ARROW_RIGHT&&(p=s.Direction.RIGHT),g===v.MetaKeys.SHIFT?o.executeCommand(Ce.id,{direction:p}):o.executeCommand(Ee.id,{direction:p})};return d.add(o.registerCommand({id:A,type:s.CommandType.OPERATION,handler(h,g){const{keyCode:p}=g;u(p)}})),[{keyCode:v.KeyCode.ARROW_DOWN},{keyCode:v.KeyCode.ARROW_LEFT},{keyCode:v.KeyCode.ARROW_RIGHT},{keyCode:v.KeyCode.ARROW_UP},{keyCode:v.KeyCode.ARROW_DOWN,metaKey:v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_LEFT,metaKey:v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_RIGHT,metaKey:v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_UP,metaKey:v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_DOWN,metaKey:v.MetaKeys.CTRL_COMMAND},{keyCode:v.KeyCode.ARROW_LEFT,metaKey:v.MetaKeys.CTRL_COMMAND},{keyCode:v.KeyCode.ARROW_RIGHT,metaKey:v.MetaKeys.CTRL_COMMAND},{keyCode:v.KeyCode.ARROW_UP,metaKey:v.MetaKeys.CTRL_COMMAND},{keyCode:v.KeyCode.ARROW_DOWN,metaKey:v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_LEFT,metaKey:v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_RIGHT,metaKey:v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT},{keyCode:v.KeyCode.ARROW_UP,metaKey:v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT}].map(({keyCode:h,metaKey:g})=>({id:A,binding:g?h|g:h,preconditions:()=>!0,priority:900,staticParameters:{eventType:_.DeviceInputEventType.Keyboard,keyCode:h}})).forEach(h=>{d.add(a.registerShortcut(h))}),()=>{d.dispose()}},[o,e,i,a])};function ja(i,t){const e=v.useDependency(s.ICommandService);U.useEffect(()=>{if(!i)return;const n=e.onCommandExecuted(o=>{var a,r;if(o.id===D.RichTextEditingMutation.id){if(o.params.unitId!==i.getEditorId())return;const l=i.getDocumentData();t(l,s.getPlainText((r=(a=l.body)==null?void 0:a.dataStream)!=null?r:""))}});return()=>{n.dispose()}},[i,t,e])}const Xa=i=>{var W;const{className:t,autoFocus:e,onFocusChange:n,initialValue:o,onClickOutside:a,keyboardEventConfig:r,moveCursor:c=!0,style:l,isSingle:A,editorId:d,onHeightChange:u,onChange:m,defaultHeight:h=32,maxHeight:g=32,icon:p,editorRef:f,placeholder:S}=i,E=v.useDependency(ce),C=v.useEvent(n),b=v.useEvent(a),[R,I]=U.useState(h),O=U.useRef(null),M=U.useMemo(()=>d!=null?d:s.createInternalEditorID(`RICH_TEXT_EDITOR-${s.generateRandomId(4)}`),[d]),y=za({editorId:M,initialValue:o,container:O,autoFocus:e,isSingle:A}),x=v.useDependency(_.IRenderManagerService).getRenderById(M),w=x==null?void 0:x.with(T.DocSelectionRenderService),H=v.useObservable(w==null?void 0:w.textSelectionInner$),V=!!((W=w==null?void 0:w.isFocusing)!=null&&W&&(H!=null&&H.textRanges.some(z=>z.collapsed))),F=U.useRef(null),[Q,j]=U.useState(()=>{var z,X;return!s.BuildTextUtils.transform.getPlainText((X=(z=y==null?void 0:y.getDocumentData().body)==null?void 0:z.dataStream)!=null?X:"")}),{checkScrollBar:G}=go(y,A,!0,!0);U.useLayoutEffect(()=>{if(!(!f||!y)){if(typeof f=="function"){f(y);return}f.current=y}},[y]);const k=v.useEvent(z=>{var q,K;const X=x==null?void 0:x.with(D.DocSkeletonManagerService),Y=X==null?void 0:X.getSkeleton().getActualSize();Y&&(u==null||u(Y.actualHeight),I(Math.max(h,Math.min(Y.actualHeight+10,g)))),m==null||m(z,s.getPlainText((K=(q=z.body)==null?void 0:q.dataStream)!=null?K:"")),G()});return U.useEffect(()=>{var X,Y;j(!s.BuildTextUtils.transform.getPlainText((Y=(X=y==null?void 0:y.getDocumentData().body)==null?void 0:X.dataStream)!=null?Y:""));const z=y==null?void 0:y.selectionChange$.subscribe(()=>{var q,K;j(!s.BuildTextUtils.transform.getPlainText((K=(q=y==null?void 0:y.getDocumentData().body)==null?void 0:q.dataStream)!=null?K:""))});return()=>z==null?void 0:z.unsubscribe()},[y]),v.useObservable(y==null?void 0:y.blur$),v.useObservable(y==null?void 0:y.focus$),U.useEffect(()=>{var X,Y;const z=y==null?void 0:y.getDocumentData();C==null||C(V,s.getPlainText((Y=(X=z==null?void 0:z.body)==null?void 0:X.dataStream)!=null?Y:""))},[V,C]),U.useEffect(()=>{const z=Y=>{var K,$;E.getFocusId()!==M||(($=(K=Y.target)==null?void 0:K.dataset)==null?void 0:$.editorid)===M||F.current&&!F.current.contains(Y.target)&&(b==null||b())},X=setTimeout(()=>{document.addEventListener("click",z)},100);return()=>{document.removeEventListener("click",z),clearTimeout(X)}},[y,M,E,b]),Ga(V&&c,!1,y),ho(V,r,y),ja(y,k),P.jsx("div",{className:t,style:l,children:P.jsxs("div",{className:J.clsx(`
185
187
  univer-relative univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
186
188
  univer-justify-around univer-gap-2 univer-rounded-md univer-pb-0.5 univer-pl-1.5 univer-pr-2
187
189
  univer-pt-1.5
188
190
  `,J.borderClassName,{"univer-border-primary-500":V}),style:{height:R},ref:F,children:[P.jsx("div",{ref:O,className:"univer-relative univer-size-full",onMouseUp:()=>y==null?void 0:y.focus()}),p,Q?P.jsx("div",{className:`
189
191
  univer-absolute univer-left-[5px] univer-top-[5px] univer-text-sm univer-text-gray-500
190
- `,children:S}):null]})})};var le=function(){return le=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},le.apply(this,arguments)},Ka=function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(i);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(i,n[o])&&(e[n[o]]=i[n[o]]);return e},ne=U.forwardRef(function(i,t){var e=i.icon,n=i.id,o=i.className,a=i.extend,r=Ka(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=U.useRef("_".concat(Ja()));return Oo(e,"".concat(n),{defIds:e.defIds,idSuffix:l.current},le({ref:t,className:c},r),a)});function Oo(i,t,e,n,o){return U.createElement(i.tag,le(le({key:t},Ya(i,e,o)),n),(qa(i,e).children||[]).map(function(a,r){return Oo(a,"".concat(t,"-").concat(i.tag,"-").concat(r),e,void 0,o)}))}function Ya(i,t,e){var n=le({},i.attrs);e!=null&&e.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=e.colorChannel1),i.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(a){var r=a[0],c=a[1];r==="mask"&&typeof c=="string"&&(n[r]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var r=a[0],c=a[1];typeof c=="string"&&(n[r]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function qa(i,t){var e,n=t.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((e=i.children)===null||e===void 0)&&e.length)?le(le({},i),{children:i.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?le(le({},o),{attrs:le(le({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):i}function Ja(){return Math.random().toString(36).substring(2,8)}ne.displayName="UniverIcon";var Za={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM1.9999 5.56641C1.66853 5.56641 1.3999 5.83504 1.3999 6.16641 1.3999 6.49778 1.66853 6.76641 1.9999 6.76641H13.9999C14.3313 6.76641 14.5999 6.49778 14.5999 6.16641 14.5999 5.83504 14.3313 5.56641 13.9999 5.56641H1.9999zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM1.9999 12.9004C1.66853 12.9004 1.3999 13.169 1.3999 13.5004 1.3999 13.8318 1.66853 14.1004 1.9999 14.1004H13.9999C14.3313 14.1004 14.5999 13.8318 14.5999 13.5004 14.5999 13.169 14.3313 12.9004 13.9999 12.9004H1.9999z"}}]},Ro=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"align-text-both-single",ref:t,icon:Za}))});Ro.displayName="AlignTextBothSingle";var $a={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9834 3.98332C1.9834 3.61513 2.28188 3.31665 2.65007 3.31665H13.3167C13.6849 3.31665 13.9834 3.61513 13.9834 3.98332 13.9834 4.35151 13.6849 4.64998 13.3167 4.64998H2.65007C2.28188 4.64998 1.9834 4.35151 1.9834 3.98332zM1.9834 7.98267C1.9834 7.61448 2.28188 7.316 2.65007 7.316H10.6501C11.0183 7.316 11.3167 7.61448 11.3167 7.98267 11.3167 8.35086 11.0183 8.64933 10.6501 8.64933H2.65007C2.28188 8.64933 1.9834 8.35086 1.9834 7.98267zM2.65007 11.316C2.28188 11.316 1.9834 11.6145 1.9834 11.9827 1.9834 12.3509 2.28188 12.6493 2.65007 12.6493H7.9834C8.35159 12.6493 8.65006 12.3509 8.65006 11.9827 8.65006 11.6145 8.35159 11.316 7.9834 11.316H2.65007z"}}]},Mo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"catalogue-single",ref:t,icon:$a}))});Mo.displayName="CatalogueSingle";var er={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.50095 1.84399C2.73322 1.60765 3.11311 1.60435 3.34945 1.83662L8.00012 6.40726L12.6508 1.83662C12.8871 1.60435 13.267 1.60765 13.4993 1.84399C13.7316 2.08032 13.7283 2.46021 13.4919 2.69248L8.85611 7.24852L10.8941 9.25146C11.1382 9.17563 11.3976 9.13477 11.6667 9.13477C13.1026 9.13477 14.2667 10.2988 14.2667 11.7348C14.2667 13.1707 13.1026 14.3348 11.6667 14.3348C10.2307 14.3348 9.06665 13.1707 9.06665 11.7348C9.06665 11.0143 9.35973 10.3622 9.83319 9.89129L8.00012 8.08978L6.16708 9.89127C6.64055 10.3622 6.93364 11.0142 6.93364 11.7348C6.93364 13.1707 5.76958 14.3348 4.33364 14.3348C2.8977 14.3348 1.73364 13.1707 1.73364 11.7348C1.73364 10.2988 2.8977 9.13477 4.33364 9.13477C4.60263 9.13477 4.86208 9.17562 5.10612 9.25145L7.14413 7.24852L2.50831 2.69248C2.27197 2.46021 2.26868 2.08032 2.50095 1.84399ZM2.93364 11.7348C2.93364 10.9616 3.56044 10.3348 4.33364 10.3348C5.10684 10.3348 5.73364 10.9616 5.73364 11.7348C5.73364 12.508 5.10684 13.1348 4.33364 13.1348C3.56044 13.1348 2.93364 12.508 2.93364 11.7348ZM10.2667 11.7348C10.2667 10.9616 10.8935 10.3348 11.6667 10.3348C12.4398 10.3348 13.0667 10.9616 13.0667 11.7348C13.0667 12.508 12.4398 13.1348 11.6667 13.1348C10.8935 13.1348 10.2667 12.508 10.2667 11.7348Z",fillRule:"evenodd",clipRule:"evenodd"}}]},xo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"cut-single",ref:t,icon:er}))});xo.displayName="CutSingle";var tr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Do=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"delete-single",ref:t,icon:tr}))});Do.displayName="DeleteSingle";var nr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.9913 10.8779C11.4971 10.8779 11.9073 11.2882 11.9073 11.7939C11.9073 12.2997 11.4971 12.71 10.9913 12.71C10.4857 12.7099 10.0754 12.2996 10.0753 11.7939C10.0753 11.2882 10.4857 10.878 10.9913 10.8779Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11.9572 8.51465C12.5471 8.51471 13.0936 8.82742 13.3927 9.33594L14.3419 10.9502C14.6291 11.4386 14.6479 12.037 14.3966 12.5391L14.3419 12.6377L13.3927 14.252C13.0936 14.7605 12.5471 15.0732 11.9572 15.0732H10.0255C9.50941 15.0731 9.02688 14.8339 8.71399 14.4336L8.59094 14.252L7.64075 12.6377C7.33466 12.1169 7.33466 11.471 7.64075 10.9502L8.59094 9.33594L8.71399 9.1543C9.02688 8.75387 9.50935 8.51477 10.0255 8.51465H11.9572ZM10.0255 9.84473C9.93678 9.84483 9.85287 9.87988 9.79114 9.94043L9.73743 10.0098L8.78723 11.624C8.72565 11.7288 8.72564 11.8591 8.78723 11.9639L9.73743 13.5781L9.79114 13.6475C9.85286 13.7079 9.93684 13.7431 10.0255 13.7432H11.9572C12.0757 13.7431 12.186 13.6803 12.2462 13.5781L13.1954 11.9639L13.2306 11.8809C13.2536 11.7953 13.2415 11.7025 13.1954 11.624L12.2462 10.0098C12.186 9.90756 12.0758 9.84479 11.9572 9.84473H10.0255Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.5031 0.926758C11.9748 0.926758 13.1679 2.12013 13.1681 3.5918V6.41602C13.1679 6.78314 12.8702 7.08105 12.5031 7.08105C12.1361 7.08084 11.8382 6.783 11.838 6.41602V3.5918C11.8378 2.85467 11.2402 2.25684 10.5031 2.25684H4.0929C3.35572 2.25684 2.75813 2.85467 2.75793 3.5918V12.085C2.75818 12.8221 3.35574 13.4199 4.0929 13.4199H6.18958L6.32434 13.4326C6.62712 13.4947 6.85444 13.7639 6.85461 14.085C6.8544 14.406 6.62705 14.6742 6.32434 14.7363L6.18958 14.75H4.0929C2.62121 14.75 1.4281 13.5566 1.42786 12.085V3.5918C1.42806 2.12013 2.62118 0.926758 4.0929 0.926758H10.5031Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.04993 6.42969C8.35293 6.49172 8.58118 6.75971 8.58118 7.08105 8.581 7.40229 8.35289 7.67047 8.04993 7.73242L7.91614 7.74609H4.73547C4.36833 7.74609 4.07063 7.44816 4.07043 7.08105 4.07043 6.71379 4.3682 6.41602 4.73547 6.41602H7.91614L8.04993 6.42969zM10.1007 3.92188C10.4034 3.98418 10.631 4.25215 10.631 4.57324 10.6309 4.8943 10.4033 5.16233 10.1007 5.22461L9.96594 5.23828H4.73547C4.36824 5.23828 4.0705 4.94046 4.07043 4.57324 4.07043 4.20597 4.3682 3.9082 4.73547 3.9082H9.96594L10.1007 3.92188z"}}]},Bo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"doc-setting-single",ref:t,icon:nr}))});Bo.displayName="DocSettingSingle";var ir={tag:"svg",attrs:{fill:"none",viewBox:"0 0 20 20",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.5547 14.1884C10.2599 14.5214 9.74019 14.5214 9.4454 14.1884L3.71321 7.71335C3.29002 7.23532 3.6294 6.48161 4.26784 6.48161L15.7322 6.48161C16.3707 6.48161 16.7101 7.23532 16.2869 7.71335L10.5547 14.1884Z"}}]},_o=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"down-single",ref:t,icon:ir}))});_o.displayName="DownSingle";var or={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.0999 2.66689C3.0999 2.33552 2.83127 2.06689 2.4999 2.06689 2.16853 2.06689 1.8999 2.33552 1.8999 2.66689V13.3336C1.8999 13.6649 2.16853 13.9336 2.4999 13.9336 2.83127 13.9336 3.0999 13.6649 3.0999 13.3336V8.5999H8.2334V13.3336C8.2334 13.6649 8.50203 13.9336 8.8334 13.9336 9.16477 13.9336 9.4334 13.6649 9.4334 13.3336V2.66689C9.4334 2.33552 9.16477 2.06689 8.8334 2.06689 8.50203 2.06689 8.2334 2.33552 8.2334 2.66689V7.3999H3.0999V2.66689zM14.0999 6.33879C14.0999 6.09377 13.9509 5.87336 13.7236 5.78203 13.4962 5.6907 13.2362 5.74679 13.0667 5.92373L11.4753 7.58486C11.2461 7.82415 11.2542 8.20396 11.4935 8.43319 11.7328 8.66243 12.1126 8.65427 12.3419 8.41499L12.8999 7.83245V13.3333C12.8999 13.6646 13.1686 13.9333 13.4999 13.9333 13.8313 13.9333 14.0999 13.6646 14.0999 13.3333V6.33879z"}}]},No=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h1-single",ref:t,icon:or}))});No.displayName="H1Single";var sr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM11.2667 8.33356C11.2667 7.67245 11.8201 7.26689 12.3333 7.26689 12.8465 7.26689 13.4 7.67244 13.4 8.33356 13.4 8.62807 13.2712 8.94814 12.9954 9.32391 12.7183 9.70153 12.3394 10.0744 11.9174 10.4803L11.8355 10.559C11.4524 10.9268 11.0365 11.3263 10.7149 11.7373 10.3718 12.1759 10.0667 12.7122 10.0667 13.3336 10.0667 13.6649 10.3353 13.9336 10.6667 13.9336H14C14.3314 13.9336 14.6 13.6649 14.6 13.3336 14.6 13.0022 14.3314 12.7336 14 12.7336H11.4782C11.5286 12.6531 11.5889 12.5676 11.6601 12.4767 11.9269 12.1355 12.2843 11.792 12.6877 11.4043L12.7492 11.3452C13.1606 10.9496 13.615 10.5079 13.9629 10.0338 14.3122 9.55787 14.6 8.98906 14.6 8.33356 14.6 6.88362 13.3757 6.06689 12.3333 6.06689 11.291 6.06689 10.0667 6.88361 10.0667 8.33356 10.0667 8.66493 10.3353 8.93356 10.6667 8.93356 10.998 8.93356 11.2667 8.66493 11.2667 8.33356z"}}]},Po=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h2-single",ref:t,icon:sr}))});Po.displayName="H2Single";var ar={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM10.6667 6.06689C10.3353 6.06689 10.0667 6.33552 10.0667 6.66689 10.0667 6.99827 10.3353 7.26689 10.6667 7.26689H12.7732L11.193 9.29853C11.0524 9.47942 11.027 9.72465 11.1277 9.93051 11.2283 10.1364 11.4375 10.2669 11.6667 10.2669 12.2418 10.2669 12.6786 10.4115 12.9585 10.6354 13.2204 10.845 13.4 11.166 13.4 11.6669 13.4 12.1622 13.2254 12.3937 13.0567 12.5202 12.8588 12.6686 12.5829 12.7336 12.3333 12.7336 11.7271 12.7336 11.3432 12.4858 11.1106 12.23 10.8877 11.9848 10.5082 11.9667 10.2631 12.1896 10.0179 12.4125 9.99979 12.792 10.2227 13.0372 10.6568 13.5147 11.3522 13.9336 12.3333 13.9336 12.7504 13.9336 13.3078 13.8319 13.7767 13.4802 14.2746 13.1068 14.6 12.5049 14.6 11.6669 14.6 10.8345 14.2796 10.1555 13.7081 9.69837 13.4342 9.47923 13.117 9.32231 12.7746 9.21971L14.4736 7.03526C14.6143 6.85437 14.6397 6.60914 14.539 6.40328 14.4383 6.19743 14.2291 6.06689 14 6.06689H10.6667z"}}]},Uo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h3-single",ref:t,icon:ar}))});Uo.displayName="H3Single";var rr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.4334 2.66689C2.4334 2.33552 2.16477 2.06689 1.8334 2.06689C1.50203 2.06689 1.2334 2.33552 1.2334 2.66689V13.3336C1.2334 13.6649 1.50203 13.9336 1.8334 13.9336C2.16477 13.9336 2.4334 13.6649 2.4334 13.3336V8.5999H7.2334V13.3336C7.2334 13.6649 7.50203 13.9336 7.8334 13.9336C8.16477 13.9336 8.4334 13.6649 8.4334 13.3336V2.66689C8.4334 2.33552 8.16477 2.06689 7.8334 2.06689C7.50203 2.06689 7.2334 2.33552 7.2334 2.66689V7.3999H2.4334V2.66689Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13.7591 6.66645C13.7591 6.40387 13.5884 6.1718 13.3377 6.09364C13.087 6.01549 12.8147 6.10941 12.6654 6.32546L9.67321 10.6577C9.60398 10.7579 9.56689 10.8769 9.56689 10.9987V11.6731C9.56689 12.0045 9.83552 12.2731 10.1669 12.2731H12.5591V13.3331C12.5591 13.6645 12.8278 13.9331 13.1591 13.9331C13.4905 13.9331 13.7591 13.6645 13.7591 13.3331V12.2731H14.1669C14.4983 12.2731 14.7669 12.0045 14.7669 11.6731C14.7669 11.3417 14.4983 11.0731 14.1669 11.0731H13.7591V6.66645ZM12.5591 8.59091V11.0731H10.8447L12.5591 8.59091Z",fillRule:"evenodd",clipRule:"evenodd"}}]},wo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h4-single",ref:t,icon:rr}))});wo.displayName="H4Single";var cr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM10.6669 6.40332C10.3355 6.40332 10.0669 6.67195 10.0669 7.00332V9.34492C10.0669 9.67629 10.3355 9.94492 10.6669 9.94492 10.7822 9.94492 10.8899 9.91238 10.9814 9.85599 10.9901 9.85195 11.0027 9.84632 11.0192 9.83936 11.0764 9.81533 11.1692 9.78033 11.2927 9.74447 11.5397 9.67268 11.8996 9.60022 12.3336 9.60022 12.4975 9.60022 12.5978 9.63412 12.6624 9.67167 12.7263 9.70877 12.79 9.76953 12.8503 9.87834 12.983 10.1181 13.0669 10.5337 13.0669 11.1669 13.0669 11.8061 12.9802 12.1936 12.8338 12.414 12.7252 12.5775 12.5275 12.7336 12.0002 12.7336 11.6445 12.7336 11.4936 12.622 11.4192 12.5328 11.3289 12.4245 11.2669 12.2453 11.2669 12.0028 11.2669 11.6714 10.9983 11.4028 10.6669 11.4028 10.3355 11.4028 10.0669 11.6714 10.0669 12.0028 10.0669 12.4244 10.1716 12.9106 10.4979 13.3016 10.8401 13.7118 11.356 13.9336 12.0002 13.9336 12.8063 13.9336 13.4419 13.6673 13.8334 13.0779 14.1869 12.5456 14.2669 11.8497 14.2669 11.1669 14.2669 10.4781 14.1841 9.81027 13.9002 9.29724 13.7521 9.02964 13.545 8.79662 13.2651 8.63403 12.986 8.4719 12.6697 8.40022 12.3336 8.40022 11.9239 8.40022 11.5627 8.44957 11.2669 8.51389V7.60332H13.3336C13.6649 7.60332 13.9336 7.33469 13.9336 7.00332 13.9336 6.67195 13.6649 6.40332 13.3336 6.40332H10.6669z"}}]},Lo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h5-single",ref:t,icon:cr}))});Lo.displayName="H5Single";var lr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM3.33315 5.56641C3.00178 5.56641 2.73315 5.83504 2.73315 6.16641 2.73315 6.49778 3.00178 6.76641 3.33315 6.76641H12.6665C12.9979 6.76641 13.2665 6.49778 13.2665 6.16641 13.2665 5.83504 12.9979 5.56641 12.6665 5.56641H3.33315zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM3.33315 12.9004C3.00178 12.9004 2.73315 13.169 2.73315 13.5004 2.73315 13.8318 3.00178 14.1004 3.33315 14.1004H12.6665C12.9979 14.1004 13.2665 13.8318 13.2665 13.5004 13.2665 13.169 12.9979 12.9004 12.6665 12.9004H3.33315z"}}]},Qo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"horizontally-single",ref:t,icon:lr}))});Qo.displayName="HorizontallySingle";var dr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM1.9999 5.56641C1.66853 5.56641 1.3999 5.83504 1.3999 6.16641 1.3999 6.49778 1.66853 6.76641 1.9999 6.76641H11.3332C11.6646 6.76641 11.9332 6.49778 11.9332 6.16641 11.9332 5.83504 11.6646 5.56641 11.3332 5.56641H1.9999zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM1.9999 12.9004C1.66853 12.9004 1.3999 13.169 1.3999 13.5004 1.3999 13.8318 1.66853 14.1004 1.9999 14.1004H11.3332C11.6646 14.1004 11.9332 13.8318 11.9332 13.5004 11.9332 13.169 11.6646 12.9004 11.3332 12.9004H1.9999z"}}]},Fo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"left-justifying-single",ref:t,icon:dr}))});Fo.displayName="LeftJustifyingSingle";var Ar={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.4713 3.52876C10.7317 3.78911 10.7317 4.21122 10.4713 4.47157L6.94273 8.00016L10.4713 11.5288C10.7317 11.7891 10.7317 12.2112 10.4713 12.4716C10.211 12.7319 9.78886 12.7319 9.52851 12.4716L5.52851 8.47157C5.26816 8.21122 5.26816 7.78911 5.52851 7.52876L9.52851 3.52876C9.78886 3.26841 10.211 3.26841 10.4713 3.52876Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ho=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"left-single",ref:t,icon:Ar}))});Ho.displayName="LeftSingle";var ur={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM4.66665 5.56641C4.33528 5.56641 4.06665 5.83504 4.06665 6.16641 4.06665 6.49778 4.33528 6.76641 4.66665 6.76641H14C14.3314 6.76641 14.6 6.49778 14.6 6.16641 14.6 5.83504 14.3314 5.56641 14 5.56641H4.66665zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM4.66665 12.9004C4.33528 12.9004 4.06665 13.169 4.06665 13.5004 4.06665 13.8318 4.33528 14.1004 4.66665 14.1004H14C14.3314 14.1004 14.6 13.8318 14.6 13.5004 14.6 13.169 14.3314 12.9004 14 12.9004H4.66665z"}}]},ko=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"right-justifying-single",ref:t,icon:ur}))});ko.displayName="RightJustifyingSingle";var hr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.06641 1.9999C2.06641 1.66853 2.33504 1.3999 2.66641 1.3999H13.3331C13.6644 1.3999 13.9331 1.66853 13.9331 1.9999V3.64434C13.9331 3.97571 13.6644 4.24434 13.3331 4.24434C13.0017 4.24434 12.7331 3.97571 12.7331 3.64434V2.5999H8.59966V13.3999H10.6665C10.9979 13.3999 11.2665 13.6685 11.2665 13.9999C11.2665 14.3313 10.9979 14.5999 10.6665 14.5999L7.99966 14.5999L5.33315 14.5999C5.00178 14.5999 4.73315 14.3313 4.73315 13.9999C4.73315 13.6685 5.00178 13.3999 5.33315 13.3999H7.39966V2.5999H3.26641V3.64434C3.26641 3.97571 2.99778 4.24434 2.66641 4.24434C2.33504 4.24434 2.06641 3.97571 2.06641 3.64434V1.9999Z"}}]},ht=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"text-type-single",ref:t,icon:hr}))});ht.displayName="TextTypeSingle";var gr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.96372 2.59116C5.19803 2.35684 5.19803 1.97695 4.96372 1.74263 4.7294 1.50832 4.3495 1.50832 4.11519 1.74263L2.53945 3.31837 1.96372 2.74263C1.7294 2.50832 1.3495 2.50832 1.11519 2.74263.880874 2.97695.880874 3.35684 1.11519 3.59116L2.11519 4.59116C2.3495 4.82547 2.7294 4.82547 2.96372 4.59116L4.96372 2.59116zM14.4605 2.56689H6.8981C6.56672 2.56689 6.2981 2.83552 6.2981 3.16689 6.2981 3.49827 6.56672 3.76689 6.8981 3.76689H14.4605C14.7918 3.76689 15.0605 3.49827 15.0605 3.16689 15.0605 2.83552 14.7918 2.56689 14.4605 2.56689zM6.8981 7.2334C6.56672 7.2334 6.2981 7.50203 6.2981 7.8334 6.2981 8.16477 6.56672 8.4334 6.8981 8.4334H14.4605C14.7918 8.4334 15.0605 8.16477 15.0605 7.8334 15.0605 7.50203 14.7918 7.2334 14.4605 7.2334H6.8981zM6.2981 12.4999C6.2981 12.1685 6.56672 11.8999 6.8981 11.8999H14.4605C14.7918 11.8999 15.0605 12.1685 15.0605 12.4999 15.0605 12.8313 14.7918 13.0999 14.4605 13.0999H6.8981C6.56672 13.0999 6.2981 12.8313 6.2981 12.4999z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.87279 5.8999C1.80504 5.8999.939453 6.76549.939453 7.83324.939453 8.90099 1.80504 9.76657 2.87279 9.76657 3.94054 9.76657 4.80612 8.90099 4.80612 7.83324 4.80612 6.76549 3.94054 5.8999 2.87279 5.8999zM2.13945 7.83324C2.13945 7.42823 2.46778 7.0999 2.87279 7.0999 3.2778 7.0999 3.60612 7.42823 3.60612 7.83324 3.60612 8.23824 3.2778 8.56657 2.87279 8.56657 2.46778 8.56657 2.13945 8.23824 2.13945 7.83324zM.939453 12.5002C.939453 11.4325 1.80504 10.5669 2.87279 10.5669 3.94054 10.5669 4.80612 11.4325 4.80612 12.5002 4.80612 13.568 3.94054 14.4336 2.87279 14.4336 1.80504 14.4336.939453 13.568.939453 12.5002zM2.87279 11.7669C2.46778 11.7669 2.13945 12.0952 2.13945 12.5002 2.13945 12.9052 2.46778 13.2336 2.87279 13.2336 3.2778 13.2336 3.60612 12.9052 3.60612 12.5002 3.60612 12.0952 3.2778 11.7669 2.87279 11.7669z",fillRule:"evenodd",clipRule:"evenodd"}}]},Vo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"todo-list",ref:t,icon:gr}))});Vo.displayName="TodoList";function Wo(i){var n;const{dataStream:t}=(n=i.body)!=null?n:{},e=[s.DataStreamTreeTokenType.TABLE_START,s.DataStreamTreeTokenType.TABLE_CELL_END,s.DataStreamTreeTokenType.TABLE_CELL_START,s.DataStreamTreeTokenType.TABLE_END,s.DataStreamTreeTokenType.TABLE_ROW_END,s.DataStreamTreeTokenType.TABLE_ROW_START,s.DataStreamTreeTokenType.COLUMN_BREAK,s.DataStreamTreeTokenType.PAGE_BREAK,s.DataStreamTreeTokenType.TAB,s.DataStreamTreeTokenType.DOCS_END,s.DataStreamTreeTokenType.CUSTOM_BLOCK];if(typeof t=="string")for(let o=0;o<t.length;o++){const a=t[o];if(!e.includes(a))return o}return 0}const Xn="COMPONENT_DOC_HEADER_FOOTER_PANEL";function mr(i,t,e){const{useFirstPageHeaderFooter:n,evenAndOddHeaders:o,defaultHeaderId:a,defaultFooterId:r,firstPageHeaderId:c,firstPageFooterId:l,evenPageHeaderId:A,evenPageFooterId:d}=i;return t===_.DocumentEditArea.HEADER?n===s.BooleanNumber.TRUE&&e===0?c:o===s.BooleanNumber.TRUE&&e%2===1?A:a:n===s.BooleanNumber.TRUE&&e===0?l:o===s.BooleanNumber.TRUE&&e%2===1?d:r}const pr=i=>{const t=I.useDependency(s.LocaleService),e=I.useDependency(s.IUniverInstanceService),n=I.useDependency(_.IRenderManagerService),o=I.useDependency(s.ICommandService),a=I.useDependency(I.ILayoutService),{unitId:r}=i,c=n.getRenderById(r).with(T.DocSelectionRenderService),[l,A]=U.useState({}),d=(h,g)=>{var O;A(M=>({...M,[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}));const p=e.getUniverDocInstance(r),f=p==null?void 0:p.getSnapshot().documentStyle,S=(O=n.getRenderById(r))==null?void 0:O.with(D.DocSkeletonManagerService),E=S==null?void 0:S.getViewModel();if(f==null||E==null)return;const C=E.getEditArea();let b=!1;const R=c.getSegmentPage();let v=!1;if(g==="useFirstPageHeaderFooter"&&h===!0&&((C===_.DocumentEditArea.HEADER&&!f.firstPageHeaderId||C===_.DocumentEditArea.FOOTER&&!f.firstPageFooterId)&&(b=!0),b&&R===0&&(v=!0)),g==="evenAndOddHeaders"&&h===!0&&((C===_.DocumentEditArea.HEADER&&!f.evenPageHeaderId||C===_.DocumentEditArea.FOOTER&&!f.evenPageFooterId)&&(b=!0),b&&R%2===1&&(v=!0)),b){const y=s.Tools.generateRandomId(6);v&&c.setSegment(y),o.executeCommand(Gt,{unitId:r,segmentId:y,headerFooterProps:{[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}})}else{const M=c.getSegmentPage(),y=c.getSegment(),N=mr({...f,[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE},C,M);N&&N!==y&&c.setSegment(N),o.executeCommand(Gt,{unitId:r,headerFooterProps:{[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}})}a.focus()},u=async(h,g)=>{A(p=>({...p,[g]:h})),await o.executeCommand(Gt,{unitId:r,headerFooterProps:{[g]:h}}),c.removeAllRanges(),c.blur()},m=()=>{o.executeCommand($n.id,{unitId:r})};return U.useEffect(()=>{const h=e.getUniverDocInstance(r),g=h==null?void 0:h.getSnapshot().documentStyle;if(g){const{marginHeader:p=0,marginFooter:f=0,useFirstPageHeaderFooter:S=s.BooleanNumber.FALSE,evenAndOddHeaders:E=s.BooleanNumber.FALSE}=g;A({marginHeader:p,marginFooter:f,useFirstPageHeaderFooter:S,evenAndOddHeaders:E})}},[r]),P.jsxs("div",{className:"univer-grid univer-gap-4",children:[P.jsxs("div",{className:"univer-grid univer-gap-2",children:[P.jsx("div",{children:P.jsx(J.Checkbox,{checked:l.useFirstPageHeaderFooter===s.BooleanNumber.TRUE,onChange:h=>{d(h,"useFirstPageHeaderFooter")},children:t.t("headerFooter.firstPageCheckBox")})}),P.jsx("div",{children:P.jsx(J.Checkbox,{checked:l.evenAndOddHeaders===s.BooleanNumber.TRUE,onChange:h=>{d(h,"evenAndOddHeaders")},children:t.t("headerFooter.oddEvenCheckBox")})})]}),P.jsxs("div",{className:"univer-mb-1 univer-flex",children:[P.jsxs("div",{children:[P.jsx("span",{children:t.t("headerFooter.headerTopMargin")}),P.jsx(J.InputNumber,{className:"univer-mt-1.5 univer-w-4/5",min:0,max:200,precision:1,value:l.marginHeader,onChange:h=>{u(h,"marginHeader")}})]}),P.jsxs("div",{children:[P.jsx("span",{children:t.t("headerFooter.footerBottomMargin")}),P.jsx(J.InputNumber,{className:"univer-mt-1.5 univer-w-4/5",min:0,max:200,precision:1,value:l.marginFooter,onChange:h=>{u(h,"marginFooter")}})]})]}),P.jsx("div",{className:"univer-flex univer-justify-end",children:P.jsx(J.Button,{onClick:m,children:t.t("headerFooter.closeHeaderFooter")})})]})},fr=()=>{var A;const i=I.useDependency(s.LocaleService),t=I.useDependency(_.IRenderManagerService),o=I.useDependency(s.IUniverInstanceService).getCurrentUniverDocInstance().getUnitId(),r=((A=t.getRenderById(o))==null?void 0:A.with(D.DocSkeletonManagerService)).getViewModel(),[c,l]=U.useState(!0);return U.useEffect(()=>{const d=r.getEditArea();l(d!==_.DocumentEditArea.BODY);const u=r.editAreaChange$.subscribe(m=>{m!=null&&l(m!==_.DocumentEditArea.BODY)});return()=>{u.unsubscribe()}},[]),P.jsx("div",{className:"univer-text-sm",children:c?P.jsx(pr,{unitId:o}):P.jsx("div",{className:"univer-text-gray-400",children:i.t("headerFooter.disableText")})})},zo=18,Go=200,Kn=6,Sr=4;function Ir(i,t){let{radius:e,width:n,height:o}=t;e=e!=null?e:0,n=n!=null?n:30,o=o!=null?o:30;let a=0;a=Math.min(e,n/2,o/2),i.beginPath(),i.moveTo(0,0),i.lineTo(n,0),i.lineTo(n,o-a),i.arc(n-a,o-a,a,0,Math.PI/2,!1),i.lineTo(0,o),i.lineTo(0,0),i.closePath(),t.fill&&(i.save(),i.fillStyle=t.fill,t.fillRule==="evenodd"?i.fill("evenodd"):i.fill(),i.restore())}class zt extends _.Shape{constructor(e,n){super(e,n);B(this,"color");B(this,"text");this.color=n==null?void 0:n.color,this.text=n==null?void 0:n.text}static drawWith(e,n){const{text:o,color:a}=n;e.save(),e.font="13px Source Han Sans CN";const r=e.measureText(o).width,c=Math.min(r+2*Kn,Go);Ir(e,{height:zo,width:c,radius:4,fill:a}),e.fillStyle="rgba(58, 96, 247, 1)";const l=Kn,A=zo-Sr,d=Go-2*Kn;if(r>d){let u="",m=0;for(const h of o){const g=e.measureText(h).width;if(m+g<=d-e.measureText("...").width)u+=h,m+=g;else{u+="...";break}}e.fillText(u,l,A)}else e.fillText(o,l,A);e.restore()}_draw(e){zt.drawWith(e,this)}}var vr=Object.getOwnPropertyDescriptor,Er=(i,t,e,n)=>{for(var o=n>1?void 0:n?vr(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Me=(i,t)=>(e,n)=>t(e,n,i);const jo="rgba(58, 96, 247, 1)",Xo="rgba(58, 96, 247, 0.08)";var se=(i=>(i[i.FIRST_PAGE_HEADER=0]="FIRST_PAGE_HEADER",i[i.FIRST_PAGE_FOOTER=1]="FIRST_PAGE_FOOTER",i[i.DEFAULT_HEADER=2]="DEFAULT_HEADER",i[i.DEFAULT_FOOTER=3]="DEFAULT_FOOTER",i[i.EVEN_PAGE_HEADER=4]="EVEN_PAGE_HEADER",i[i.EVEN_PAGE_FOOTER=5]="EVEN_PAGE_FOOTER",i))(se||{});function Cr(i,t,e){const{documentStyle:n}=i.getDataModel().getSnapshot(),{defaultHeaderId:o,defaultFooterId:a,evenPageHeaderId:r,evenPageFooterId:c,firstPageHeaderId:l,firstPageFooterId:A,evenAndOddHeaders:d,useFirstPageHeaderFooter:u}=n;switch(t){case _.DocumentEditArea.BODY:return{createType:null,headerFooterId:null};case _.DocumentEditArea.HEADER:return u===s.BooleanNumber.TRUE&&!l?{createType:0,headerFooterId:null}:d===s.BooleanNumber.TRUE&&e%2===0&&!r?{createType:4,headerFooterId:null}:o?{createType:null,headerFooterId:o}:{createType:2,headerFooterId:null};case _.DocumentEditArea.FOOTER:return u===s.BooleanNumber.TRUE&&!A?{createType:1,headerFooterId:null}:d===s.BooleanNumber.TRUE&&e%2===0&&!c?{createType:5,headerFooterId:null}:a?{createType:null,headerFooterId:a}:{createType:3,headerFooterId:null};default:throw new Error(`Invalid editArea: ${t}`)}}let Yn=class extends s.Disposable{constructor(t,e,n,o,a,r,c,l,A){super();B(this,"_loadedMap",new WeakSet);this._context=t,this._commandService=e,this._editorService=n,this._instanceSrv=o,this._renderManagerService=a,this._docSkeletonManagerService=r,this._docSelectionRenderService=c,this._localeService=l,this._componentManager=A,this._initialize()}_initialize(){this._init(),this._drawHeaderFooterLabel(),this._initCustomComponents(),this._listenSwitchMode()}_listenSwitchMode(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(D.RichTextEditingMutation.id===t.id){const e=this._context.unit,o=this._docSkeletonManagerService.getViewModel().getEditArea(),a=e.getSnapshot().documentStyle.documentFlavor;o!==_.DocumentEditArea.BODY&&a===s.DocumentFlavor.MODERN&&this._commandService.executeCommand($n.id,{unitId:this._context.unitId})}}))}_initCustomComponents(){this._componentManager.get(Xn)||this.disposeWithMe(this._componentManager.register(Xn,fr))}_init(){const{unitId:t}=this._context,e=Ie(this._context);e==null||e.document==null||this._loadedMap.has(e.document)||(this._initialMain(t),this._loadedMap.add(e.document))}_initialMain(t){const e=Ie(this._context),{document:n}=e;this.disposeWithMe(n.onDblclick$.subscribeEvent(async o=>{if(this._isEditorReadOnly(t)||!this._isTraditionalMode())return;const{offsetX:a,offsetY:r}=o,{pageLayoutType:c=_.PageLayoutType.VERTICAL,pageMarginLeft:l,pageMarginTop:A}=n.getOffsetConfig(),d=this._getTransformCoordForDocumentOffset(a,r);if(d==null)return;const u=this._docSkeletonManagerService.getViewModel(),m=this._docSkeletonManagerService.getSkeleton(),h=u.getEditArea(),{editArea:g,pageNumber:p}=m.findEditAreaByCoord(d,c,l,A);if(h===g)return;u.setEditArea(g);const{createType:f,headerFooterId:S}=Cr(u,g,p);if(g===_.DocumentEditArea.BODY)this._docSelectionRenderService.setSegment(""),this._docSelectionRenderService.setSegmentPage(-1),this._docSelectionRenderService.setCursorManually(a,r);else if(f!=null){const C=s.Tools.generateRandomId(6);this._docSelectionRenderService.setSegment(C),this._docSelectionRenderService.setSegmentPage(p),await this._commandService.executeCommand(Yo.id,{unitId:t,createType:f,segmentId:C})}else S!=null&&(this._docSelectionRenderService.setSegment(S),this._docSelectionRenderService.setSegmentPage(p),this._docSelectionRenderService.setCursorManually(a,r))}))}_getTransformCoordForDocumentOffset(t,e){const n=Ie(this._context),{document:o,scene:a}=n,{documentTransform:r}=o.getOffsetConfig(),c=a.getViewports()[0];if(c==null)return;const l=c.transformVector2SceneCoord(_.Vector2.FromArray([t,e]));return r.clone().invert().applyPoint(l)}_drawHeaderFooterLabel(){const t=this._localeService;this._instanceSrv.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC).subscribe(e=>{if(e==null)return;const n=e.getUnitId(),o=this._renderManagerService.getRenderById(n);if(this._editorService.isEditor(n)||this._instanceSrv.getUniverDocInstance(n)==null||o==null)return;const{mainComponent:a}=o,r=a;this.disposeWithMe(s.toDisposable(r.pageRender$.subscribe(c=>{if(this._editorService.isEditor(n)||!this._isTraditionalMode())return;const d=this._docSkeletonManagerService.getViewModel().getEditArea()===_.DocumentEditArea.BODY,{page:u,pageLeft:m,pageTop:h,ctx:g}=c,{pageWidth:p,pageHeight:f,marginTop:S,marginBottom:E}=u;if(g.save(),g.translate(m-.5,h-.5),d?(_.Rect.drawWith(g,{left:0,top:0,width:p,height:S,fill:"rgba(255, 255, 255, 0.5)"}),g.save(),g.translate(0,f-E),_.Rect.drawWith(g,{left:0,top:0,width:p,height:E,fill:"rgba(255, 255, 255, 0.5)"}),g.restore()):(g.save(),g.translate(0,S),_.Rect.drawWith(g,{left:0,top:S,width:p,height:f-S-E,fill:"rgba(255, 255, 255, 0.5)"}),g.restore()),!d){const C={dataArray:[{command:"M",points:[0,S]},{command:"L",points:[p,S]}],strokeWidth:1,stroke:jo},b={dataArray:[{command:"M",points:[0,f-E]},{command:"L",points:[p,f-E]}],strokeWidth:1,stroke:jo};_.Path.drawWith(g,C),_.Path.drawWith(g,b),g.translate(0,S+1),zt.drawWith(g,{text:t.t("headerFooter.header"),color:Xo}),g.translate(0,f-S-E),zt.drawWith(g,{text:t.t("headerFooter.footer"),color:Xo})}g.restore()})))})}_isEditorReadOnly(t){const e=this._editorService.getEditor(t);return e?e.isReadOnly():!1}_isTraditionalMode(){return this._context.unit.getSnapshot().documentStyle.documentFlavor===s.DocumentFlavor.TRADITIONAL}};Yn=Er([Me(1,s.ICommandService),Me(2,ce),Me(3,s.IUniverInstanceService),Me(4,_.IRenderManagerService),Me(5,s.Inject(D.DocSkeletonManagerService)),Me(6,s.Inject(T.DocSelectionRenderService)),Me(7,s.Inject(s.LocaleService)),Me(8,s.Inject(I.ComponentManager))],Yn);const qn={id:"sidebar.operation.doc-header-footer-panel",type:s.CommandType.OPERATION,handler:async(i,t)=>{const e=i.get(I.ISidebarService),n=i.get(s.LocaleService);switch(t.value){case"open":e.open({header:{title:n.t("headerFooter.panel")},children:{label:Xn},onClose:()=>{},width:400});break;case"close":default:e.close();break}return!0}};function Ko(){return{dataStream:`\r
191
- `,textRuns:[{st:0,ed:0,ts:{fs:9}}],customBlocks:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:0},lineSpacing:1.5,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]}}function Jn(i,t,e,n){const o=s.JSONX.getInstance(),a=6,r=i!=null?i:s.Tools.generateRandomId(a),c=t===se.DEFAULT_HEADER||t===se.FIRST_PAGE_HEADER||t===se.EVEN_PAGE_HEADER,l=o.insertOp([c?"headers":"footers",r],{[c?"headerId":"footerId"]:r,body:Ko()});n.push(l);const A=s.Tools.generateRandomId(a),d=o.insertOp([c?"footers":"headers",A],{[c?"footerId":"headerId"]:A,body:Ko()});n.push(d);let u="defaultHeaderId",m="defaultFooterId";switch(t){case se.DEFAULT_HEADER:u="defaultHeaderId",m="defaultFooterId";break;case se.DEFAULT_FOOTER:u="defaultFooterId",m="defaultHeaderId";break;case se.FIRST_PAGE_HEADER:u="firstPageHeaderId",m="firstPageFooterId";break;case se.FIRST_PAGE_FOOTER:u="firstPageFooterId",m="firstPageHeaderId";break;case se.EVEN_PAGE_HEADER:u="evenPageHeaderId",m="evenPageFooterId";break;case se.EVEN_PAGE_FOOTER:u="evenPageFooterId",m="evenPageHeaderId";break;default:throw new Error(`Unknown header footer type: ${t}`)}for(const[h,g]of[[u,r],[m,A]])if(e[h]!=null){const p=o.replaceOp(["documentStyle",h],e[h],g);n.push(p)}else{const p=o.insertOp(["documentStyle",h],g);n.push(p)}return n}const Gt="doc.command.core-header-footer",Yo={id:Gt,type:s.CommandType.COMMAND,handler:async(i,t)=>{var b;const e=i.get(s.ICommandService),n=i.get(s.IUniverInstanceService),o=i.get(_.IRenderManagerService),{unitId:a,segmentId:r,createType:c,headerFooterProps:l}=t,A=(b=o.getRenderById(a))==null?void 0:b.with(D.DocSkeletonManagerService),d=n.getUniverDocInstance(a),u=A==null?void 0:A.getViewModel();if(d==null||u==null)return!1;const m=u.getEditArea(),{documentStyle:h}=d.getSnapshot(),g=(l==null?void 0:l.marginFooter)!=null||(l==null?void 0:l.marginHeader)!=null,p=[{startOffset:0,endOffset:0,collapsed:!0}],f={id:D.RichTextEditingMutation.id,params:{unitId:a,actions:[],textRanges:p,debounce:!0}};g&&(f.params.noNeedSetTextRange=!0);const S=s.JSONX.getInstance(),E=[];return c!=null&&Jn(r,c,h,E),l!=null&&Object.keys(l).forEach(R=>{const v=l[R],O=h[R];if(v===O)return;let M;if(O===void 0?M=S.insertOp(["documentStyle",R],v):M=S.replaceOp(["documentStyle",R],O,v),E.push(M),R==="useFirstPageHeaderFooter"&&v===s.BooleanNumber.TRUE&&!h.firstPageHeaderId){const y=m===_.DocumentEditArea.HEADER?se.FIRST_PAGE_HEADER:se.FIRST_PAGE_FOOTER;Jn(r,y,h,E)}else if(R==="evenAndOddHeaders"&&v===s.BooleanNumber.TRUE&&!h.evenPageHeaderId){const y=m===_.DocumentEditArea.HEADER?se.EVEN_PAGE_HEADER:se.EVEN_PAGE_FOOTER;Jn(r,y,h,E)}}),E.length===0?!1:(f.params.actions=E.reduce((R,v)=>s.JSONX.compose(R,v),null),!!e.syncExecuteCommand(f.id,f.params))}},Zn={id:"doc.command.open-header-footer-panel",type:s.CommandType.COMMAND,handler:async(i,t)=>i.get(s.ICommandService).executeCommand(qn.id,{value:"open"})},$n={id:"doc.command.close-header-footer",type:s.CommandType.COMMAND,handler:async(i,t)=>{var g;const e=i.get(s.ICommandService),n=i.get(_.IRenderManagerService),o=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService),{unitId:r}=t,c=n.getRenderById(r);if(c==null)return!1;const{scene:l}=c,A=l.getTransformerByCreate(),d=c.with(D.DocSkeletonManagerService),u=c.with(T.DocSelectionRenderService),m=d==null?void 0:d.getSkeleton(),h=d==null?void 0:d.getViewModel();return h==null||m==null?!1:(o.replaceDocRanges([]),A.clearSelectedObjects(),u.setSegment(""),u.setSegmentPage(-1),h.setEditArea(_.DocumentEditArea.BODY),m.calculate(),(g=c.mainComponent)==null||g.makeDirty(!0),queueMicrotask(()=>{const p=a.getUnit(r),f=p==null?void 0:p.getSnapshot();if(f==null)return;const S=Wo(f);o.replaceDocRanges([{startOffset:S,endOffset:S}])}),e.executeCommand(qn.id,{value:"close"}),!0)}},Je="UI_PLUGIN_DOCS",ei=`${Je}_COLOR_PICKER_COMPONENT`,qo=`${Je}_FONT_FAMILY_COMPONENT`,Jo=`${Je}_FONT_FAMILY_ITEM_COMPONENT`,Zo=`${Je}_FONT_SIZE_COMPONENT`,$o=i=>{const{value:t,onChange:e,options:n}=i;return P.jsx("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 univer-p-1.5",children:n.map(o=>P.jsx("a",{className:J.clsx(`
192
+ `,children:S}):null]})})};var le=function(){return le=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},le.apply(this,arguments)},Ka=function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(i);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(i,n[o])&&(e[n[o]]=i[n[o]]);return e},ne=U.forwardRef(function(i,t){var e=i.icon,n=i.id,o=i.className,a=i.extend,r=Ka(i,["icon","id","className","extend"]),c="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),l=U.useRef("_".concat(Ja()));return Oo(e,"".concat(n),{defIds:e.defIds,idSuffix:l.current},le({ref:t,className:c},r),a)});function Oo(i,t,e,n,o){return U.createElement(i.tag,le(le({key:t},Ya(i,e,o)),n),(qa(i,e).children||[]).map(function(a,r){return Oo(a,"".concat(t,"-").concat(i.tag,"-").concat(r),e,void 0,o)}))}function Ya(i,t,e){var n=le({},i.attrs);e!=null&&e.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=e.colorChannel1),i.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(a){var r=a[0],c=a[1];r==="mask"&&typeof c=="string"&&(n[r]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(a){var r=a[0],c=a[1];typeof c=="string"&&(n[r]=c.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function qa(i,t){var e,n=t.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((e=i.children)===null||e===void 0)&&e.length)?le(le({},i),{children:i.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?le(le({},o),{attrs:le(le({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):i}function Ja(){return Math.random().toString(36).substring(2,8)}ne.displayName="UniverIcon";var Za={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM1.9999 5.56641C1.66853 5.56641 1.3999 5.83504 1.3999 6.16641 1.3999 6.49778 1.66853 6.76641 1.9999 6.76641H13.9999C14.3313 6.76641 14.5999 6.49778 14.5999 6.16641 14.5999 5.83504 14.3313 5.56641 13.9999 5.56641H1.9999zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM1.9999 12.9004C1.66853 12.9004 1.3999 13.169 1.3999 13.5004 1.3999 13.8318 1.66853 14.1004 1.9999 14.1004H13.9999C14.3313 14.1004 14.5999 13.8318 14.5999 13.5004 14.5999 13.169 14.3313 12.9004 13.9999 12.9004H1.9999z"}}]},Ro=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"align-text-both-single",ref:t,icon:Za}))});Ro.displayName="AlignTextBothSingle";var $a={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9834 3.98332C1.9834 3.61513 2.28188 3.31665 2.65007 3.31665H13.3167C13.6849 3.31665 13.9834 3.61513 13.9834 3.98332 13.9834 4.35151 13.6849 4.64998 13.3167 4.64998H2.65007C2.28188 4.64998 1.9834 4.35151 1.9834 3.98332zM1.9834 7.98267C1.9834 7.61448 2.28188 7.316 2.65007 7.316H10.6501C11.0183 7.316 11.3167 7.61448 11.3167 7.98267 11.3167 8.35086 11.0183 8.64933 10.6501 8.64933H2.65007C2.28188 8.64933 1.9834 8.35086 1.9834 7.98267zM2.65007 11.316C2.28188 11.316 1.9834 11.6145 1.9834 11.9827 1.9834 12.3509 2.28188 12.6493 2.65007 12.6493H7.9834C8.35159 12.6493 8.65006 12.3509 8.65006 11.9827 8.65006 11.6145 8.35159 11.316 7.9834 11.316H2.65007z"}}]},Mo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"catalogue-single",ref:t,icon:$a}))});Mo.displayName="CatalogueSingle";var er={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.50095 1.84399C2.73322 1.60765 3.11311 1.60435 3.34945 1.83662L8.00012 6.40726L12.6508 1.83662C12.8871 1.60435 13.267 1.60765 13.4993 1.84399C13.7316 2.08032 13.7283 2.46021 13.4919 2.69248L8.85611 7.24852L10.8941 9.25146C11.1382 9.17563 11.3976 9.13477 11.6667 9.13477C13.1026 9.13477 14.2667 10.2988 14.2667 11.7348C14.2667 13.1707 13.1026 14.3348 11.6667 14.3348C10.2307 14.3348 9.06665 13.1707 9.06665 11.7348C9.06665 11.0143 9.35973 10.3622 9.83319 9.89129L8.00012 8.08978L6.16708 9.89127C6.64055 10.3622 6.93364 11.0142 6.93364 11.7348C6.93364 13.1707 5.76958 14.3348 4.33364 14.3348C2.8977 14.3348 1.73364 13.1707 1.73364 11.7348C1.73364 10.2988 2.8977 9.13477 4.33364 9.13477C4.60263 9.13477 4.86208 9.17562 5.10612 9.25145L7.14413 7.24852L2.50831 2.69248C2.27197 2.46021 2.26868 2.08032 2.50095 1.84399ZM2.93364 11.7348C2.93364 10.9616 3.56044 10.3348 4.33364 10.3348C5.10684 10.3348 5.73364 10.9616 5.73364 11.7348C5.73364 12.508 5.10684 13.1348 4.33364 13.1348C3.56044 13.1348 2.93364 12.508 2.93364 11.7348ZM10.2667 11.7348C10.2667 10.9616 10.8935 10.3348 11.6667 10.3348C12.4398 10.3348 13.0667 10.9616 13.0667 11.7348C13.0667 12.508 12.4398 13.1348 11.6667 13.1348C10.8935 13.1348 10.2667 12.508 10.2667 11.7348Z",fillRule:"evenodd",clipRule:"evenodd"}}]},xo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"cut-single",ref:t,icon:er}))});xo.displayName="CutSingle";var tr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Do=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"delete-single",ref:t,icon:tr}))});Do.displayName="DeleteSingle";var nr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.9913 10.8779C11.4971 10.8779 11.9073 11.2882 11.9073 11.7939C11.9073 12.2997 11.4971 12.71 10.9913 12.71C10.4857 12.7099 10.0754 12.2996 10.0753 11.7939C10.0753 11.2882 10.4857 10.878 10.9913 10.8779Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11.9572 8.51465C12.5471 8.51471 13.0936 8.82742 13.3927 9.33594L14.3419 10.9502C14.6291 11.4386 14.6479 12.037 14.3966 12.5391L14.3419 12.6377L13.3927 14.252C13.0936 14.7605 12.5471 15.0732 11.9572 15.0732H10.0255C9.50941 15.0731 9.02688 14.8339 8.71399 14.4336L8.59094 14.252L7.64075 12.6377C7.33466 12.1169 7.33466 11.471 7.64075 10.9502L8.59094 9.33594L8.71399 9.1543C9.02688 8.75387 9.50935 8.51477 10.0255 8.51465H11.9572ZM10.0255 9.84473C9.93678 9.84483 9.85287 9.87988 9.79114 9.94043L9.73743 10.0098L8.78723 11.624C8.72565 11.7288 8.72564 11.8591 8.78723 11.9639L9.73743 13.5781L9.79114 13.6475C9.85286 13.7079 9.93684 13.7431 10.0255 13.7432H11.9572C12.0757 13.7431 12.186 13.6803 12.2462 13.5781L13.1954 11.9639L13.2306 11.8809C13.2536 11.7953 13.2415 11.7025 13.1954 11.624L12.2462 10.0098C12.186 9.90756 12.0758 9.84479 11.9572 9.84473H10.0255Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.5031 0.926758C11.9748 0.926758 13.1679 2.12013 13.1681 3.5918V6.41602C13.1679 6.78314 12.8702 7.08105 12.5031 7.08105C12.1361 7.08084 11.8382 6.783 11.838 6.41602V3.5918C11.8378 2.85467 11.2402 2.25684 10.5031 2.25684H4.0929C3.35572 2.25684 2.75813 2.85467 2.75793 3.5918V12.085C2.75818 12.8221 3.35574 13.4199 4.0929 13.4199H6.18958L6.32434 13.4326C6.62712 13.4947 6.85444 13.7639 6.85461 14.085C6.8544 14.406 6.62705 14.6742 6.32434 14.7363L6.18958 14.75H4.0929C2.62121 14.75 1.4281 13.5566 1.42786 12.085V3.5918C1.42806 2.12013 2.62118 0.926758 4.0929 0.926758H10.5031Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M8.04993 6.42969C8.35293 6.49172 8.58118 6.75971 8.58118 7.08105 8.581 7.40229 8.35289 7.67047 8.04993 7.73242L7.91614 7.74609H4.73547C4.36833 7.74609 4.07063 7.44816 4.07043 7.08105 4.07043 6.71379 4.3682 6.41602 4.73547 6.41602H7.91614L8.04993 6.42969zM10.1007 3.92188C10.4034 3.98418 10.631 4.25215 10.631 4.57324 10.6309 4.8943 10.4033 5.16233 10.1007 5.22461L9.96594 5.23828H4.73547C4.36824 5.23828 4.0705 4.94046 4.07043 4.57324 4.07043 4.20597 4.3682 3.9082 4.73547 3.9082H9.96594L10.1007 3.92188z"}}]},Bo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"doc-setting-single",ref:t,icon:nr}))});Bo.displayName="DocSettingSingle";var ir={tag:"svg",attrs:{fill:"none",viewBox:"0 0 20 20",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.5547 14.1884C10.2599 14.5214 9.74019 14.5214 9.4454 14.1884L3.71321 7.71335C3.29002 7.23532 3.6294 6.48161 4.26784 6.48161L15.7322 6.48161C16.3707 6.48161 16.7101 7.23532 16.2869 7.71335L10.5547 14.1884Z"}}]},_o=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"down-single",ref:t,icon:ir}))});_o.displayName="DownSingle";var or={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M3.0999 2.66689C3.0999 2.33552 2.83127 2.06689 2.4999 2.06689 2.16853 2.06689 1.8999 2.33552 1.8999 2.66689V13.3336C1.8999 13.6649 2.16853 13.9336 2.4999 13.9336 2.83127 13.9336 3.0999 13.6649 3.0999 13.3336V8.5999H8.2334V13.3336C8.2334 13.6649 8.50203 13.9336 8.8334 13.9336 9.16477 13.9336 9.4334 13.6649 9.4334 13.3336V2.66689C9.4334 2.33552 9.16477 2.06689 8.8334 2.06689 8.50203 2.06689 8.2334 2.33552 8.2334 2.66689V7.3999H3.0999V2.66689zM14.0999 6.33879C14.0999 6.09377 13.9509 5.87336 13.7236 5.78203 13.4962 5.6907 13.2362 5.74679 13.0667 5.92373L11.4753 7.58486C11.2461 7.82415 11.2542 8.20396 11.4935 8.43319 11.7328 8.66243 12.1126 8.65427 12.3419 8.41499L12.8999 7.83245V13.3333C12.8999 13.6646 13.1686 13.9333 13.4999 13.9333 13.8313 13.9333 14.0999 13.6646 14.0999 13.3333V6.33879z"}}]},No=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h1-single",ref:t,icon:or}))});No.displayName="H1Single";var sr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM11.2667 8.33356C11.2667 7.67245 11.8201 7.26689 12.3333 7.26689 12.8465 7.26689 13.4 7.67244 13.4 8.33356 13.4 8.62807 13.2712 8.94814 12.9954 9.32391 12.7183 9.70153 12.3394 10.0744 11.9174 10.4803L11.8355 10.559C11.4524 10.9268 11.0365 11.3263 10.7149 11.7373 10.3718 12.1759 10.0667 12.7122 10.0667 13.3336 10.0667 13.6649 10.3353 13.9336 10.6667 13.9336H14C14.3314 13.9336 14.6 13.6649 14.6 13.3336 14.6 13.0022 14.3314 12.7336 14 12.7336H11.4782C11.5286 12.6531 11.5889 12.5676 11.6601 12.4767 11.9269 12.1355 12.2843 11.792 12.6877 11.4043L12.7492 11.3452C13.1606 10.9496 13.615 10.5079 13.9629 10.0338 14.3122 9.55787 14.6 8.98906 14.6 8.33356 14.6 6.88362 13.3757 6.06689 12.3333 6.06689 11.291 6.06689 10.0667 6.88361 10.0667 8.33356 10.0667 8.66493 10.3353 8.93356 10.6667 8.93356 10.998 8.93356 11.2667 8.66493 11.2667 8.33356z"}}]},Po=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h2-single",ref:t,icon:sr}))});Po.displayName="H2Single";var ar={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM10.6667 6.06689C10.3353 6.06689 10.0667 6.33552 10.0667 6.66689 10.0667 6.99827 10.3353 7.26689 10.6667 7.26689H12.7732L11.193 9.29853C11.0524 9.47942 11.027 9.72465 11.1277 9.93051 11.2283 10.1364 11.4375 10.2669 11.6667 10.2669 12.2418 10.2669 12.6786 10.4115 12.9585 10.6354 13.2204 10.845 13.4 11.166 13.4 11.6669 13.4 12.1622 13.2254 12.3937 13.0567 12.5202 12.8588 12.6686 12.5829 12.7336 12.3333 12.7336 11.7271 12.7336 11.3432 12.4858 11.1106 12.23 10.8877 11.9848 10.5082 11.9667 10.2631 12.1896 10.0179 12.4125 9.99979 12.792 10.2227 13.0372 10.6568 13.5147 11.3522 13.9336 12.3333 13.9336 12.7504 13.9336 13.3078 13.8319 13.7767 13.4802 14.2746 13.1068 14.6 12.5049 14.6 11.6669 14.6 10.8345 14.2796 10.1555 13.7081 9.69837 13.4342 9.47923 13.117 9.32231 12.7746 9.21971L14.4736 7.03526C14.6143 6.85437 14.6397 6.60914 14.539 6.40328 14.4383 6.19743 14.2291 6.06689 14 6.06689H10.6667z"}}]},Uo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h3-single",ref:t,icon:ar}))});Uo.displayName="H3Single";var rr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.4334 2.66689C2.4334 2.33552 2.16477 2.06689 1.8334 2.06689C1.50203 2.06689 1.2334 2.33552 1.2334 2.66689V13.3336C1.2334 13.6649 1.50203 13.9336 1.8334 13.9336C2.16477 13.9336 2.4334 13.6649 2.4334 13.3336V8.5999H7.2334V13.3336C7.2334 13.6649 7.50203 13.9336 7.8334 13.9336C8.16477 13.9336 8.4334 13.6649 8.4334 13.3336V2.66689C8.4334 2.33552 8.16477 2.06689 7.8334 2.06689C7.50203 2.06689 7.2334 2.33552 7.2334 2.66689V7.3999H2.4334V2.66689Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M13.7591 6.66645C13.7591 6.40387 13.5884 6.1718 13.3377 6.09364C13.087 6.01549 12.8147 6.10941 12.6654 6.32546L9.67321 10.6577C9.60398 10.7579 9.56689 10.8769 9.56689 10.9987V11.6731C9.56689 12.0045 9.83552 12.2731 10.1669 12.2731H12.5591V13.3331C12.5591 13.6645 12.8278 13.9331 13.1591 13.9331C13.4905 13.9331 13.7591 13.6645 13.7591 13.3331V12.2731H14.1669C14.4983 12.2731 14.7669 12.0045 14.7669 11.6731C14.7669 11.3417 14.4983 11.0731 14.1669 11.0731H13.7591V6.66645ZM12.5591 8.59091V11.0731H10.8447L12.5591 8.59091Z",fillRule:"evenodd",clipRule:"evenodd"}}]},wo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h4-single",ref:t,icon:rr}))});wo.displayName="H4Single";var cr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.5999 2.66689C2.5999 2.33552 2.33127 2.06689 1.9999 2.06689 1.66853 2.06689 1.3999 2.33552 1.3999 2.66689V13.3336C1.3999 13.6649 1.66853 13.9336 1.9999 13.9336 2.33127 13.9336 2.5999 13.6649 2.5999 13.3336V8.5999H7.3999V13.3336C7.3999 13.6649 7.66853 13.9336 7.9999 13.9336 8.33127 13.9336 8.5999 13.6649 8.5999 13.3336V2.66689C8.5999 2.33552 8.33127 2.06689 7.9999 2.06689 7.66853 2.06689 7.3999 2.33552 7.3999 2.66689V7.3999H2.5999V2.66689zM10.6669 6.40332C10.3355 6.40332 10.0669 6.67195 10.0669 7.00332V9.34492C10.0669 9.67629 10.3355 9.94492 10.6669 9.94492 10.7822 9.94492 10.8899 9.91238 10.9814 9.85599 10.9901 9.85195 11.0027 9.84632 11.0192 9.83936 11.0764 9.81533 11.1692 9.78033 11.2927 9.74447 11.5397 9.67268 11.8996 9.60022 12.3336 9.60022 12.4975 9.60022 12.5978 9.63412 12.6624 9.67167 12.7263 9.70877 12.79 9.76953 12.8503 9.87834 12.983 10.1181 13.0669 10.5337 13.0669 11.1669 13.0669 11.8061 12.9802 12.1936 12.8338 12.414 12.7252 12.5775 12.5275 12.7336 12.0002 12.7336 11.6445 12.7336 11.4936 12.622 11.4192 12.5328 11.3289 12.4245 11.2669 12.2453 11.2669 12.0028 11.2669 11.6714 10.9983 11.4028 10.6669 11.4028 10.3355 11.4028 10.0669 11.6714 10.0669 12.0028 10.0669 12.4244 10.1716 12.9106 10.4979 13.3016 10.8401 13.7118 11.356 13.9336 12.0002 13.9336 12.8063 13.9336 13.4419 13.6673 13.8334 13.0779 14.1869 12.5456 14.2669 11.8497 14.2669 11.1669 14.2669 10.4781 14.1841 9.81027 13.9002 9.29724 13.7521 9.02964 13.545 8.79662 13.2651 8.63403 12.986 8.4719 12.6697 8.40022 12.3336 8.40022 11.9239 8.40022 11.5627 8.44957 11.2669 8.51389V7.60332H13.3336C13.6649 7.60332 13.9336 7.33469 13.9336 7.00332 13.9336 6.67195 13.6649 6.40332 13.3336 6.40332H10.6669z"}}]},Lo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"h5-single",ref:t,icon:cr}))});Lo.displayName="H5Single";var lr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM3.33315 5.56641C3.00178 5.56641 2.73315 5.83504 2.73315 6.16641 2.73315 6.49778 3.00178 6.76641 3.33315 6.76641H12.6665C12.9979 6.76641 13.2665 6.49778 13.2665 6.16641 13.2665 5.83504 12.9979 5.56641 12.6665 5.56641H3.33315zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM3.33315 12.9004C3.00178 12.9004 2.73315 13.169 2.73315 13.5004 2.73315 13.8318 3.00178 14.1004 3.33315 14.1004H12.6665C12.9979 14.1004 13.2665 13.8318 13.2665 13.5004 13.2665 13.169 12.9979 12.9004 12.6665 12.9004H3.33315z"}}]},Qo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"horizontally-single",ref:t,icon:lr}))});Qo.displayName="HorizontallySingle";var dr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM1.9999 5.56641C1.66853 5.56641 1.3999 5.83504 1.3999 6.16641 1.3999 6.49778 1.66853 6.76641 1.9999 6.76641H11.3332C11.6646 6.76641 11.9332 6.49778 11.9332 6.16641 11.9332 5.83504 11.6646 5.56641 11.3332 5.56641H1.9999zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM1.9999 12.9004C1.66853 12.9004 1.3999 13.169 1.3999 13.5004 1.3999 13.8318 1.66853 14.1004 1.9999 14.1004H11.3332C11.6646 14.1004 11.9332 13.8318 11.9332 13.5004 11.9332 13.169 11.6646 12.9004 11.3332 12.9004H1.9999z"}}]},Fo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"left-justifying-single",ref:t,icon:dr}))});Fo.displayName="LeftJustifyingSingle";var Ar={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M10.4713 3.52876C10.7317 3.78911 10.7317 4.21122 10.4713 4.47157L6.94273 8.00016L10.4713 11.5288C10.7317 11.7891 10.7317 12.2112 10.4713 12.4716C10.211 12.7319 9.78886 12.7319 9.52851 12.4716L5.52851 8.47157C5.26816 8.21122 5.26816 7.78911 5.52851 7.52876L9.52851 3.52876C9.78886 3.26841 10.211 3.26841 10.4713 3.52876Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ho=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"left-single",ref:t,icon:Ar}))});Ho.displayName="LeftSingle";var ur={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9999 1.89941C1.66853 1.89941 1.3999 2.16804 1.3999 2.49941 1.3999 2.83078 1.66853 3.09941 1.9999 3.09941H13.9999C14.3313 3.09941 14.5999 2.83078 14.5999 2.49941 14.5999 2.16804 14.3313 1.89941 13.9999 1.89941H1.9999zM4.66665 5.56641C4.33528 5.56641 4.06665 5.83504 4.06665 6.16641 4.06665 6.49778 4.33528 6.76641 4.66665 6.76641H14C14.3314 6.76641 14.6 6.49778 14.6 6.16641 14.6 5.83504 14.3314 5.56641 14 5.56641H4.66665zM1.3999 9.8334C1.3999 9.50203 1.66853 9.2334 1.9999 9.2334H13.9999C14.3313 9.2334 14.5999 9.50203 14.5999 9.8334 14.5999 10.1648 14.3313 10.4334 13.9999 10.4334H1.9999C1.66853 10.4334 1.3999 10.1648 1.3999 9.8334zM4.66665 12.9004C4.33528 12.9004 4.06665 13.169 4.06665 13.5004 4.06665 13.8318 4.33528 14.1004 4.66665 14.1004H14C14.3314 14.1004 14.6 13.8318 14.6 13.5004 14.6 13.169 14.3314 12.9004 14 12.9004H4.66665z"}}]},ko=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"right-justifying-single",ref:t,icon:ur}))});ko.displayName="RightJustifyingSingle";var hr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.06641 1.9999C2.06641 1.66853 2.33504 1.3999 2.66641 1.3999H13.3331C13.6644 1.3999 13.9331 1.66853 13.9331 1.9999V3.64434C13.9331 3.97571 13.6644 4.24434 13.3331 4.24434C13.0017 4.24434 12.7331 3.97571 12.7331 3.64434V2.5999H8.59966V13.3999H10.6665C10.9979 13.3999 11.2665 13.6685 11.2665 13.9999C11.2665 14.3313 10.9979 14.5999 10.6665 14.5999L7.99966 14.5999L5.33315 14.5999C5.00178 14.5999 4.73315 14.3313 4.73315 13.9999C4.73315 13.6685 5.00178 13.3999 5.33315 13.3999H7.39966V2.5999H3.26641V3.64434C3.26641 3.97571 2.99778 4.24434 2.66641 4.24434C2.33504 4.24434 2.06641 3.97571 2.06641 3.64434V1.9999Z"}}]},ht=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"text-type-single",ref:t,icon:hr}))});ht.displayName="TextTypeSingle";var gr={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.96372 2.59116C5.19803 2.35684 5.19803 1.97695 4.96372 1.74263 4.7294 1.50832 4.3495 1.50832 4.11519 1.74263L2.53945 3.31837 1.96372 2.74263C1.7294 2.50832 1.3495 2.50832 1.11519 2.74263.880874 2.97695.880874 3.35684 1.11519 3.59116L2.11519 4.59116C2.3495 4.82547 2.7294 4.82547 2.96372 4.59116L4.96372 2.59116zM14.4605 2.56689H6.8981C6.56672 2.56689 6.2981 2.83552 6.2981 3.16689 6.2981 3.49827 6.56672 3.76689 6.8981 3.76689H14.4605C14.7918 3.76689 15.0605 3.49827 15.0605 3.16689 15.0605 2.83552 14.7918 2.56689 14.4605 2.56689zM6.8981 7.2334C6.56672 7.2334 6.2981 7.50203 6.2981 7.8334 6.2981 8.16477 6.56672 8.4334 6.8981 8.4334H14.4605C14.7918 8.4334 15.0605 8.16477 15.0605 7.8334 15.0605 7.50203 14.7918 7.2334 14.4605 7.2334H6.8981zM6.2981 12.4999C6.2981 12.1685 6.56672 11.8999 6.8981 11.8999H14.4605C14.7918 11.8999 15.0605 12.1685 15.0605 12.4999 15.0605 12.8313 14.7918 13.0999 14.4605 13.0999H6.8981C6.56672 13.0999 6.2981 12.8313 6.2981 12.4999z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.87279 5.8999C1.80504 5.8999.939453 6.76549.939453 7.83324.939453 8.90099 1.80504 9.76657 2.87279 9.76657 3.94054 9.76657 4.80612 8.90099 4.80612 7.83324 4.80612 6.76549 3.94054 5.8999 2.87279 5.8999zM2.13945 7.83324C2.13945 7.42823 2.46778 7.0999 2.87279 7.0999 3.2778 7.0999 3.60612 7.42823 3.60612 7.83324 3.60612 8.23824 3.2778 8.56657 2.87279 8.56657 2.46778 8.56657 2.13945 8.23824 2.13945 7.83324zM.939453 12.5002C.939453 11.4325 1.80504 10.5669 2.87279 10.5669 3.94054 10.5669 4.80612 11.4325 4.80612 12.5002 4.80612 13.568 3.94054 14.4336 2.87279 14.4336 1.80504 14.4336.939453 13.568.939453 12.5002zM2.87279 11.7669C2.46778 11.7669 2.13945 12.0952 2.13945 12.5002 2.13945 12.9052 2.46778 13.2336 2.87279 13.2336 3.2778 13.2336 3.60612 12.9052 3.60612 12.5002 3.60612 12.0952 3.2778 11.7669 2.87279 11.7669z",fillRule:"evenodd",clipRule:"evenodd"}}]},Vo=U.forwardRef(function(i,t){return U.createElement(ne,Object.assign({},i,{id:"todo-list",ref:t,icon:gr}))});Vo.displayName="TodoList";function Wo(i){var n;const{dataStream:t}=(n=i.body)!=null?n:{},e=[s.DataStreamTreeTokenType.TABLE_START,s.DataStreamTreeTokenType.TABLE_CELL_END,s.DataStreamTreeTokenType.TABLE_CELL_START,s.DataStreamTreeTokenType.TABLE_END,s.DataStreamTreeTokenType.TABLE_ROW_END,s.DataStreamTreeTokenType.TABLE_ROW_START,s.DataStreamTreeTokenType.COLUMN_BREAK,s.DataStreamTreeTokenType.PAGE_BREAK,s.DataStreamTreeTokenType.TAB,s.DataStreamTreeTokenType.DOCS_END,s.DataStreamTreeTokenType.CUSTOM_BLOCK];if(typeof t=="string")for(let o=0;o<t.length;o++){const a=t[o];if(!e.includes(a))return o}return 0}const Xn="COMPONENT_DOC_HEADER_FOOTER_PANEL";function mr(i,t,e){const{useFirstPageHeaderFooter:n,evenAndOddHeaders:o,defaultHeaderId:a,defaultFooterId:r,firstPageHeaderId:c,firstPageFooterId:l,evenPageHeaderId:A,evenPageFooterId:d}=i;return t===_.DocumentEditArea.HEADER?n===s.BooleanNumber.TRUE&&e===0?c:o===s.BooleanNumber.TRUE&&e%2===1?A:a:n===s.BooleanNumber.TRUE&&e===0?l:o===s.BooleanNumber.TRUE&&e%2===1?d:r}const pr=i=>{const t=v.useDependency(s.LocaleService),e=v.useDependency(s.IUniverInstanceService),n=v.useDependency(_.IRenderManagerService),o=v.useDependency(s.ICommandService),a=v.useDependency(v.ILayoutService),{unitId:r}=i,c=n.getRenderById(r).with(T.DocSelectionRenderService),[l,A]=U.useState({}),d=(h,g)=>{var O;A(M=>({...M,[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}));const p=e.getUniverDocInstance(r),f=p==null?void 0:p.getSnapshot().documentStyle,S=(O=n.getRenderById(r))==null?void 0:O.with(D.DocSkeletonManagerService),E=S==null?void 0:S.getViewModel();if(f==null||E==null)return;const C=E.getEditArea();let b=!1;const R=c.getSegmentPage();let I=!1;if(g==="useFirstPageHeaderFooter"&&h===!0&&((C===_.DocumentEditArea.HEADER&&!f.firstPageHeaderId||C===_.DocumentEditArea.FOOTER&&!f.firstPageFooterId)&&(b=!0),b&&R===0&&(I=!0)),g==="evenAndOddHeaders"&&h===!0&&((C===_.DocumentEditArea.HEADER&&!f.evenPageHeaderId||C===_.DocumentEditArea.FOOTER&&!f.evenPageFooterId)&&(b=!0),b&&R%2===1&&(I=!0)),b){const y=s.Tools.generateRandomId(6);I&&c.setSegment(y),o.executeCommand(Gt,{unitId:r,segmentId:y,headerFooterProps:{[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}})}else{const M=c.getSegmentPage(),y=c.getSegment(),N=mr({...f,[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE},C,M);N&&N!==y&&c.setSegment(N),o.executeCommand(Gt,{unitId:r,headerFooterProps:{[g]:h?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE}})}a.focus()},u=async(h,g)=>{A(p=>({...p,[g]:h})),await o.executeCommand(Gt,{unitId:r,headerFooterProps:{[g]:h}}),c.removeAllRanges(),c.blur()},m=()=>{o.executeCommand($n.id,{unitId:r})};return U.useEffect(()=>{const h=e.getUniverDocInstance(r),g=h==null?void 0:h.getSnapshot().documentStyle;if(g){const{marginHeader:p=0,marginFooter:f=0,useFirstPageHeaderFooter:S=s.BooleanNumber.FALSE,evenAndOddHeaders:E=s.BooleanNumber.FALSE}=g;A({marginHeader:p,marginFooter:f,useFirstPageHeaderFooter:S,evenAndOddHeaders:E})}},[r]),P.jsxs("div",{className:"univer-grid univer-gap-4",children:[P.jsxs("div",{className:"univer-grid univer-gap-2",children:[P.jsx("div",{children:P.jsx(J.Checkbox,{checked:l.useFirstPageHeaderFooter===s.BooleanNumber.TRUE,onChange:h=>{d(h,"useFirstPageHeaderFooter")},children:t.t("headerFooter.firstPageCheckBox")})}),P.jsx("div",{children:P.jsx(J.Checkbox,{checked:l.evenAndOddHeaders===s.BooleanNumber.TRUE,onChange:h=>{d(h,"evenAndOddHeaders")},children:t.t("headerFooter.oddEvenCheckBox")})})]}),P.jsxs("div",{className:"univer-mb-1 univer-flex",children:[P.jsxs("div",{children:[P.jsx("span",{children:t.t("headerFooter.headerTopMargin")}),P.jsx(J.InputNumber,{className:"univer-mt-1.5 univer-w-4/5",min:0,max:200,precision:1,value:l.marginHeader,onChange:h=>{u(h,"marginHeader")}})]}),P.jsxs("div",{children:[P.jsx("span",{children:t.t("headerFooter.footerBottomMargin")}),P.jsx(J.InputNumber,{className:"univer-mt-1.5 univer-w-4/5",min:0,max:200,precision:1,value:l.marginFooter,onChange:h=>{u(h,"marginFooter")}})]})]}),P.jsx("div",{className:"univer-flex univer-justify-end",children:P.jsx(J.Button,{onClick:m,children:t.t("headerFooter.closeHeaderFooter")})})]})},fr=()=>{var A;const i=v.useDependency(s.LocaleService),t=v.useDependency(_.IRenderManagerService),o=v.useDependency(s.IUniverInstanceService).getCurrentUniverDocInstance().getUnitId(),r=((A=t.getRenderById(o))==null?void 0:A.with(D.DocSkeletonManagerService)).getViewModel(),[c,l]=U.useState(!0);return U.useEffect(()=>{const d=r.getEditArea();l(d!==_.DocumentEditArea.BODY);const u=r.editAreaChange$.subscribe(m=>{m!=null&&l(m!==_.DocumentEditArea.BODY)});return()=>{u.unsubscribe()}},[]),P.jsx("div",{className:"univer-text-sm",children:c?P.jsx(pr,{unitId:o}):P.jsx("div",{className:"univer-text-gray-400",children:i.t("headerFooter.disableText")})})},zo=18,Go=200,Kn=6,Sr=4;function vr(i,t){let{radius:e,width:n,height:o}=t;e=e!=null?e:0,n=n!=null?n:30,o=o!=null?o:30;let a=0;a=Math.min(e,n/2,o/2),i.beginPath(),i.moveTo(0,0),i.lineTo(n,0),i.lineTo(n,o-a),i.arc(n-a,o-a,a,0,Math.PI/2,!1),i.lineTo(0,o),i.lineTo(0,0),i.closePath(),t.fill&&(i.save(),i.fillStyle=t.fill,t.fillRule==="evenodd"?i.fill("evenodd"):i.fill(),i.restore())}class zt extends _.Shape{constructor(e,n){super(e,n);B(this,"color");B(this,"text");this.color=n==null?void 0:n.color,this.text=n==null?void 0:n.text}static drawWith(e,n){const{text:o,color:a}=n;e.save(),e.font="13px Source Han Sans CN";const r=e.measureText(o).width,c=Math.min(r+2*Kn,Go);vr(e,{height:zo,width:c,radius:4,fill:a}),e.fillStyle="rgba(58, 96, 247, 1)";const l=Kn,A=zo-Sr,d=Go-2*Kn;if(r>d){let u="",m=0;for(const h of o){const g=e.measureText(h).width;if(m+g<=d-e.measureText("...").width)u+=h,m+=g;else{u+="...";break}}e.fillText(u,l,A)}else e.fillText(o,l,A);e.restore()}_draw(e){zt.drawWith(e,this)}}var Ir=Object.getOwnPropertyDescriptor,Er=(i,t,e,n)=>{for(var o=n>1?void 0:n?Ir(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Me=(i,t)=>(e,n)=>t(e,n,i);const jo="rgba(58, 96, 247, 1)",Xo="rgba(58, 96, 247, 0.08)";var se=(i=>(i[i.FIRST_PAGE_HEADER=0]="FIRST_PAGE_HEADER",i[i.FIRST_PAGE_FOOTER=1]="FIRST_PAGE_FOOTER",i[i.DEFAULT_HEADER=2]="DEFAULT_HEADER",i[i.DEFAULT_FOOTER=3]="DEFAULT_FOOTER",i[i.EVEN_PAGE_HEADER=4]="EVEN_PAGE_HEADER",i[i.EVEN_PAGE_FOOTER=5]="EVEN_PAGE_FOOTER",i))(se||{});function Cr(i,t,e){const{documentStyle:n}=i.getDataModel().getSnapshot(),{defaultHeaderId:o,defaultFooterId:a,evenPageHeaderId:r,evenPageFooterId:c,firstPageHeaderId:l,firstPageFooterId:A,evenAndOddHeaders:d,useFirstPageHeaderFooter:u}=n;switch(t){case _.DocumentEditArea.BODY:return{createType:null,headerFooterId:null};case _.DocumentEditArea.HEADER:return u===s.BooleanNumber.TRUE&&!l?{createType:0,headerFooterId:null}:d===s.BooleanNumber.TRUE&&e%2===0&&!r?{createType:4,headerFooterId:null}:o?{createType:null,headerFooterId:o}:{createType:2,headerFooterId:null};case _.DocumentEditArea.FOOTER:return u===s.BooleanNumber.TRUE&&!A?{createType:1,headerFooterId:null}:d===s.BooleanNumber.TRUE&&e%2===0&&!c?{createType:5,headerFooterId:null}:a?{createType:null,headerFooterId:a}:{createType:3,headerFooterId:null};default:throw new Error(`Invalid editArea: ${t}`)}}let Yn=class extends s.Disposable{constructor(t,e,n,o,a,r,c,l,A){super();B(this,"_loadedMap",new WeakSet);this._context=t,this._commandService=e,this._editorService=n,this._instanceSrv=o,this._renderManagerService=a,this._docSkeletonManagerService=r,this._docSelectionRenderService=c,this._localeService=l,this._componentManager=A,this._initialize()}_initialize(){this._init(),this._drawHeaderFooterLabel(),this._initCustomComponents(),this._listenSwitchMode()}_listenSwitchMode(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(D.RichTextEditingMutation.id===t.id){const e=this._context.unit,o=this._docSkeletonManagerService.getViewModel().getEditArea(),a=e.getSnapshot().documentStyle.documentFlavor;o!==_.DocumentEditArea.BODY&&a===s.DocumentFlavor.MODERN&&this._commandService.executeCommand($n.id,{unitId:this._context.unitId})}}))}_initCustomComponents(){this._componentManager.get(Xn)||this.disposeWithMe(this._componentManager.register(Xn,fr))}_init(){const{unitId:t}=this._context,e=ve(this._context);e==null||e.document==null||this._loadedMap.has(e.document)||(this._initialMain(t),this._loadedMap.add(e.document))}_initialMain(t){const e=ve(this._context),{document:n}=e;this.disposeWithMe(n.onDblclick$.subscribeEvent(async o=>{if(this._isEditorReadOnly(t)||!this._isTraditionalMode())return;const{offsetX:a,offsetY:r}=o,{pageLayoutType:c=_.PageLayoutType.VERTICAL,pageMarginLeft:l,pageMarginTop:A}=n.getOffsetConfig(),d=this._getTransformCoordForDocumentOffset(a,r);if(d==null)return;const u=this._docSkeletonManagerService.getViewModel(),m=this._docSkeletonManagerService.getSkeleton(),h=u.getEditArea(),{editArea:g,pageNumber:p}=m.findEditAreaByCoord(d,c,l,A);if(h===g)return;u.setEditArea(g);const{createType:f,headerFooterId:S}=Cr(u,g,p);if(g===_.DocumentEditArea.BODY)this._docSelectionRenderService.setSegment(""),this._docSelectionRenderService.setSegmentPage(-1),this._docSelectionRenderService.setCursorManually(a,r);else if(f!=null){const C=s.Tools.generateRandomId(6);this._docSelectionRenderService.setSegment(C),this._docSelectionRenderService.setSegmentPage(p),await this._commandService.executeCommand(Yo.id,{unitId:t,createType:f,segmentId:C})}else S!=null&&(this._docSelectionRenderService.setSegment(S),this._docSelectionRenderService.setSegmentPage(p),this._docSelectionRenderService.setCursorManually(a,r))}))}_getTransformCoordForDocumentOffset(t,e){const n=ve(this._context),{document:o,scene:a}=n,{documentTransform:r}=o.getOffsetConfig(),c=a.getViewports()[0];if(c==null)return;const l=c.transformVector2SceneCoord(_.Vector2.FromArray([t,e]));return r.clone().invert().applyPoint(l)}_drawHeaderFooterLabel(){const t=this._localeService;this._instanceSrv.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC).subscribe(e=>{if(e==null)return;const n=e.getUnitId(),o=this._renderManagerService.getRenderById(n);if(this._editorService.isEditor(n)||this._instanceSrv.getUniverDocInstance(n)==null||o==null)return;const{mainComponent:a}=o,r=a;this.disposeWithMe(s.toDisposable(r.pageRender$.subscribe(c=>{if(this._editorService.isEditor(n)||!this._isTraditionalMode())return;const d=this._docSkeletonManagerService.getViewModel().getEditArea()===_.DocumentEditArea.BODY,{page:u,pageLeft:m,pageTop:h,ctx:g}=c,{pageWidth:p,pageHeight:f,marginTop:S,marginBottom:E}=u;if(g.save(),g.translate(m-.5,h-.5),d?(_.Rect.drawWith(g,{left:0,top:0,width:p,height:S,fill:"rgba(255, 255, 255, 0.5)"}),g.save(),g.translate(0,f-E),_.Rect.drawWith(g,{left:0,top:0,width:p,height:E,fill:"rgba(255, 255, 255, 0.5)"}),g.restore()):(g.save(),g.translate(0,S),_.Rect.drawWith(g,{left:0,top:S,width:p,height:f-S-E,fill:"rgba(255, 255, 255, 0.5)"}),g.restore()),!d){const C={dataArray:[{command:"M",points:[0,S]},{command:"L",points:[p,S]}],strokeWidth:1,stroke:jo},b={dataArray:[{command:"M",points:[0,f-E]},{command:"L",points:[p,f-E]}],strokeWidth:1,stroke:jo};_.Path.drawWith(g,C),_.Path.drawWith(g,b),g.translate(0,S+1),zt.drawWith(g,{text:t.t("headerFooter.header"),color:Xo}),g.translate(0,f-S-E),zt.drawWith(g,{text:t.t("headerFooter.footer"),color:Xo})}g.restore()})))})}_isEditorReadOnly(t){const e=this._editorService.getEditor(t);return e?e.isReadOnly():!1}_isTraditionalMode(){return this._context.unit.getSnapshot().documentStyle.documentFlavor===s.DocumentFlavor.TRADITIONAL}};Yn=Er([Me(1,s.ICommandService),Me(2,ce),Me(3,s.IUniverInstanceService),Me(4,_.IRenderManagerService),Me(5,s.Inject(D.DocSkeletonManagerService)),Me(6,s.Inject(T.DocSelectionRenderService)),Me(7,s.Inject(s.LocaleService)),Me(8,s.Inject(v.ComponentManager))],Yn);const qn={id:"sidebar.operation.doc-header-footer-panel",type:s.CommandType.OPERATION,handler:async(i,t)=>{const e=i.get(v.ISidebarService),n=i.get(s.LocaleService);switch(t.value){case"open":e.open({header:{title:n.t("headerFooter.panel")},children:{label:Xn},onClose:()=>{},width:400});break;case"close":default:e.close();break}return!0}};function Ko(){return{dataStream:`\r
193
+ `,textRuns:[{st:0,ed:0,ts:{fs:9}}],customBlocks:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:0},lineSpacing:1.5,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]}}function Jn(i,t,e,n){const o=s.JSONX.getInstance(),a=6,r=i!=null?i:s.Tools.generateRandomId(a),c=t===se.DEFAULT_HEADER||t===se.FIRST_PAGE_HEADER||t===se.EVEN_PAGE_HEADER,l=o.insertOp([c?"headers":"footers",r],{[c?"headerId":"footerId"]:r,body:Ko()});n.push(l);const A=s.Tools.generateRandomId(a),d=o.insertOp([c?"footers":"headers",A],{[c?"footerId":"headerId"]:A,body:Ko()});n.push(d);let u="defaultHeaderId",m="defaultFooterId";switch(t){case se.DEFAULT_HEADER:u="defaultHeaderId",m="defaultFooterId";break;case se.DEFAULT_FOOTER:u="defaultFooterId",m="defaultHeaderId";break;case se.FIRST_PAGE_HEADER:u="firstPageHeaderId",m="firstPageFooterId";break;case se.FIRST_PAGE_FOOTER:u="firstPageFooterId",m="firstPageHeaderId";break;case se.EVEN_PAGE_HEADER:u="evenPageHeaderId",m="evenPageFooterId";break;case se.EVEN_PAGE_FOOTER:u="evenPageFooterId",m="evenPageHeaderId";break;default:throw new Error(`Unknown header footer type: ${t}`)}for(const[h,g]of[[u,r],[m,A]])if(e[h]!=null){const p=o.replaceOp(["documentStyle",h],e[h],g);n.push(p)}else{const p=o.insertOp(["documentStyle",h],g);n.push(p)}return n}const Gt="doc.command.core-header-footer",Yo={id:Gt,type:s.CommandType.COMMAND,handler:async(i,t)=>{var b;const e=i.get(s.ICommandService),n=i.get(s.IUniverInstanceService),o=i.get(_.IRenderManagerService),{unitId:a,segmentId:r,createType:c,headerFooterProps:l}=t,A=(b=o.getRenderById(a))==null?void 0:b.with(D.DocSkeletonManagerService),d=n.getUniverDocInstance(a),u=A==null?void 0:A.getViewModel();if(d==null||u==null)return!1;const m=u.getEditArea(),{documentStyle:h}=d.getSnapshot(),g=(l==null?void 0:l.marginFooter)!=null||(l==null?void 0:l.marginHeader)!=null,p=[{startOffset:0,endOffset:0,collapsed:!0}],f={id:D.RichTextEditingMutation.id,params:{unitId:a,actions:[],textRanges:p,debounce:!0}};g&&(f.params.noNeedSetTextRange=!0);const S=s.JSONX.getInstance(),E=[];return c!=null&&Jn(r,c,h,E),l!=null&&Object.keys(l).forEach(R=>{const I=l[R],O=h[R];if(I===O)return;let M;if(O===void 0?M=S.insertOp(["documentStyle",R],I):M=S.replaceOp(["documentStyle",R],O,I),E.push(M),R==="useFirstPageHeaderFooter"&&I===s.BooleanNumber.TRUE&&!h.firstPageHeaderId){const y=m===_.DocumentEditArea.HEADER?se.FIRST_PAGE_HEADER:se.FIRST_PAGE_FOOTER;Jn(r,y,h,E)}else if(R==="evenAndOddHeaders"&&I===s.BooleanNumber.TRUE&&!h.evenPageHeaderId){const y=m===_.DocumentEditArea.HEADER?se.EVEN_PAGE_HEADER:se.EVEN_PAGE_FOOTER;Jn(r,y,h,E)}}),E.length===0?!1:(f.params.actions=E.reduce((R,I)=>s.JSONX.compose(R,I),null),!!e.syncExecuteCommand(f.id,f.params))}},Zn={id:"doc.command.open-header-footer-panel",type:s.CommandType.COMMAND,handler:async(i,t)=>i.get(s.ICommandService).executeCommand(qn.id,{value:"open"})},$n={id:"doc.command.close-header-footer",type:s.CommandType.COMMAND,handler:async(i,t)=>{var g;const e=i.get(s.ICommandService),n=i.get(_.IRenderManagerService),o=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService),{unitId:r}=t,c=n.getRenderById(r);if(c==null)return!1;const{scene:l}=c,A=l.getTransformerByCreate(),d=c.with(D.DocSkeletonManagerService),u=c.with(T.DocSelectionRenderService),m=d==null?void 0:d.getSkeleton(),h=d==null?void 0:d.getViewModel();return h==null||m==null?!1:(o.replaceDocRanges([]),A.clearSelectedObjects(),u.setSegment(""),u.setSegmentPage(-1),h.setEditArea(_.DocumentEditArea.BODY),m.calculate(),(g=c.mainComponent)==null||g.makeDirty(!0),queueMicrotask(()=>{const p=a.getUnit(r),f=p==null?void 0:p.getSnapshot();if(f==null)return;const S=Wo(f);o.replaceDocRanges([{startOffset:S,endOffset:S}])}),e.executeCommand(qn.id,{value:"close"}),!0)}},Je="UI_PLUGIN_DOCS",ei=`${Je}_COLOR_PICKER_COMPONENT`,qo=`${Je}_FONT_FAMILY_COMPONENT`,Jo=`${Je}_FONT_FAMILY_ITEM_COMPONENT`,Zo=`${Je}_FONT_SIZE_COMPONENT`,$o=i=>{const{value:t,onChange:e,options:n}=i;return P.jsx("div",{className:"univer-grid univer-grid-cols-3 univer-gap-2 univer-p-1.5",children:n.map(o=>P.jsx("a",{className:J.clsx(`
192
194
  univer-block univer-h-20 univer-w-[72px] univer-cursor-pointer univer-overflow-hidden
193
195
  univer-rounded univer-transition-all
194
196
  hover:univer-border-primary-500
195
197
  `,J.borderClassName,{"univer-border-primary-500":t===o.value}),onClick:()=>{e(o.value)},children:P.jsx("img",{className:"univer-size-full",src:o.img,draggable:!1})},o.value))})},Tr=[{value:s.PresetListType.ORDER_LIST,img:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEA2ADYAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/CABEIAPQA2AMBEQACEQEDEQH/xAAzAAEAAgMBAQEAAAAAAAAAAAAABwkGCAoFBAMBAQADAQEAAAAAAAAAAAAAAAACAwQBBf/aAAwDAQACEAMQAAAA7+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACrPRXpvZDoUx3gAAAAAAAAAAAfgc027P0wYdAxI12AAAAAAAAMuNiAADmf3Z7hc1u7dU/iMYAAAAAAAAPtMnAAINnHyDYmEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANdZxpZ1VSZHt8mS4YwQUAAAAAZOTqAAAAVM6K9WLIaG3Q6j/P0zhHvmGCAAAAAHqGdAAAAESy5UDpqsJpnjnW+VMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVPortYz2AAAAAAAAAAAACnDTVcfmtGPkOgAGQkwgAAAAAAAHN1to6MMV/qnikYgAHtEnAAAAAAAAGgN0Isly1HPYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEcuUc66bn8tuwcJAAAAAAAAAAACn7TVaznt5wNufpnw6BhZhYAAAAAAAPaJOABBE488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H0GfUi0kscS4pGCjlXU+AGpPS09/d6rF2F9Y989OS+VT4jif3tYIligAYgdqQjslj3io1OehNBSmRFnd5GxOxZtyfgNh4DL2o//EADQRAAIAAgYGCAcBAQAAAAAAAAECAxEAITFBUWESIkBxgZEEEGChscHR8BMjMkJScuFDgv/aAAgBAwEBPwDsoA6OyoRKWkqNYReAZ1EGzG00WICdEzRvxao8DYRhLltUapQ4qZCCM51FeNGj6Yk0NTxMxuNopCjPMLIuObAb6p8eY2npDzYILqzmxsHAeOVIfR2at9UYfcfTxyoqqgkokPHeb9pSGqTNrGssbSTbu4dsDEZiRCAIFRdvpByx93W/PWvUcYVg8DKXOdEcOJioiplNoOB998xtEUlYbEWylzIHnRFCqqi4d954mvqI0Yykf6KwP/InPwG0OumrLiO+48DSG8xoNU61EG+VhGMxh4SoSAJkgDE0T5kT4ktRQVQ2TN53Wj+g7SyI/wBSg538xXQQIYrkT+xJHL17Yu6w1meAvJ92m6kKPpGTyEzqm4ZHyPPaXcQ10jwGJwo7s7aTcBcBgOqDGsRzkp8j5HaGUMCrCYPvnSJDMM4g2HyOfVBg6Os31XD8f74bSyhgVYTB986Q4AQlidIz1ch69oVjSJWIJFTIsAdHInCYsuOVLaxWDtUTUYRPtOpE/U2E1XG3KQoSi1woirihM0Pmp3bqqJGR6jqtZImYO42HuOG09IeShBa1u4ep8DRVZzJQSfdpsHGidHUVvrHD7f73DI7T8ExGLxJgGxRbK6ZrAzAvnZRVCiSgAZe69/aj/9k="}],Or=i=>P.jsx($o,{...i,options:br}),es=`${Je}_ORDER_LIST_TYPE_COMPONENT`,ts=`${Je}_BULLET_LIST_TYPE_COMPONENT`;var jt=(i=>(i[i.ABOVE=0]="ABOVE",i[i.BELLOW=1]="BELLOW",i))(jt||{}),ti=(i=>(i[i.LEFT=0]="LEFT",i[i.RIGHT=1]="RIGHT",i))(ti||{});function Rr(i,t){let e=s.DataStreamTreeTokenType.TABLE_START;const n=[],o=[];for(let a=0;a<i;a++){e+=s.DataStreamTreeTokenType.TABLE_ROW_START;for(let r=0;r<t;r++)e+=`${s.DataStreamTreeTokenType.TABLE_CELL_START}\r
196
198
  ${s.DataStreamTreeTokenType.TABLE_CELL_END}`,n.push({startIndex:e.length-3,paragraphStyle:{spaceAbove:{v:3},lineSpacing:2,spaceBelow:{v:0}}}),o.push({startIndex:e.length-2});e+=s.DataStreamTreeTokenType.TABLE_ROW_END}return e+=s.DataStreamTreeTokenType.TABLE_END,{dataStream:e,paragraphs:n,sectionBreaks:o}}function Xt(){return{margin:{start:{v:10},end:{v:10},top:{v:5},bottom:{v:5}}}}function Kt(i){const t=Xt();return{tableCells:[...new Array(i).fill(null).map(()=>s.Tools.deepClone(t))],trHeight:{val:{v:30},hRule:s.TableRowHeightRule.AUTO}}}function Yt(i){return{size:{type:s.TableSizeType.SPECIFIED,width:{v:i}}}}function ni(i,t,e){const n=Yt(e/t),o=Kt(t),a=[...new Array(i).fill(null).map(()=>s.Tools.deepClone(o))],r=[...new Array(t).fill(null).map(()=>s.Tools.deepClone(n))],c=s.generateRandomId(6);return{tableRows:a,tableColumns:r,tableId:c,align:s.TableAlignmentType.START,indent:{v:0},textWrap:s.TableTextWrapType.NONE,position:{positionH:{relativeFrom:s.ObjectRelativeFromH.PAGE,posOffset:0},positionV:{relativeFrom:s.ObjectRelativeFromV.PAGE,posOffset:0}},dist:{distB:0,distL:0,distR:0,distT:0},cellMargin:{start:{v:10},end:{v:10},top:{v:5},bottom:{v:5}},size:{type:s.TableSizeType.UNSPECIFIED,width:{v:e}}}}function gt(i,t){if(!i&&!t)return null;if(t&&t.length>0){let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;const o="";for(const a of t){const{startOffset:r,endOffset:c,segmentId:l}=a;r==null||c==null||l==null||(e=Math.min(e,r),n=Math.max(n,c))}if(Number.isFinite(e)&&Number.isFinite(n))return{startOffset:e,endOffset:n,segmentId:o}}else if(i){const{startOffset:e,endOffset:n,segmentId:o}=i;return e==null||n==null||o==null?null:{startOffset:e,endOffset:n,segmentId:o}}}function Mr(i){let t=s.DataStreamTreeTokenType.TABLE_ROW_START;const e=[],n=[];for(let o=0;o<i;o++)t+=`${s.DataStreamTreeTokenType.TABLE_CELL_START}\r
197
199
  ${s.DataStreamTreeTokenType.TABLE_CELL_END}`,e.push({startIndex:t.length-3,paragraphStyle:{spaceAbove:{v:3},lineSpacing:2,spaceBelow:{v:0}}}),n.push({startIndex:t.length-2});return t+=s.DataStreamTreeTokenType.TABLE_ROW_END,{dataStream:t,paragraphs:e,sectionBreaks:n}}function xr(){const i=`${s.DataStreamTreeTokenType.TABLE_CELL_START}\r
198
- ${s.DataStreamTreeTokenType.TABLE_CELL_END}`,t=[],e=[];return t.push({startIndex:1,paragraphStyle:{spaceAbove:{v:3},lineSpacing:2,spaceBelow:{v:0}}}),e.push({startIndex:2}),{dataStream:i,paragraphs:t,sectionBreaks:e}}function Dr(i,t,e){var u,m,h;const{startOffset:n,endOffset:o,segmentId:a}=i,r=e.getSelfOrHeaderFooterViewModel(a),c=t===0?n:o;let l=null;const A=(h=(m=(u=e.getBody())==null?void 0:u.tables)==null?void 0:m.find(g=>c>=g.startIndex&&c<=g.endIndex))==null?void 0:h.tableId;let d=0;for(const g of r.getChildren()){for(const p of g.children){const{children:f}=p,S=f[0];if(S){for(const E of S.children)if(E.startIndex<=c&&c<=E.endIndex){d=S.children.indexOf(E),l=E;break}}if(l)break}if(l)break}return l==null||A==null?null:{offset:t===0?l.startIndex:l.endIndex+1,colCount:l.children.length,tableId:A,insertRowIndex:t===0?d:d+1}}function Br(i,t,e){var h,g,p;const{startOffset:n,endOffset:o,segmentId:a}=i,r=e.getSelfOrHeaderFooterViewModel(a),c=t===0?n:o,l=(p=(g=(h=e.getBody())==null?void 0:h.tables)==null?void 0:g.find(f=>c>=f.startIndex&&c<=f.endIndex))==null?void 0:p.tableId,A=[];let d=null,u=-1;for(const f of r.getChildren()){for(const S of f.children){const{children:E}=S,C=E[0];if(C){if(c<C.startIndex||c>C.endIndex)continue;d=C;for(const b of C.children){for(const R of b.children){const v=b.children.indexOf(R);if(c>=R.startIndex&&c<=R.endIndex){u=v;break}}if(u!==-1)break}}if(d)break}if(d)break}if(d==null||l==null||u===-1)return null;let m=0;for(const f of d.children){const S=f.children[u],E=t===0?S.startIndex:S.endIndex+1;A.push(E-m),m=E}return{offsets:A,tableId:l,columnIndex:u,rowCount:d.children.length}}function _r(i,t,e){const n=[];let o=t[e].size.width.v,a=0;for(let r=0;r<t.length;r++)a+=t[r].size.width.v;a+=o;for(let r=0;r<t.length;r++)n.push(t[r].size.width.v/a*i);return o=o/a*i,{widths:n,newColWidth:o}}function ns(i,t){var m,h,g;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(g=(h=(m=t.getBody())==null?void 0:m.tables)==null?void 0:h.find(p=>e>=p.startIndex&&n<=p.endIndex))==null?void 0:g.tableId,c=[];let l=-1,A=0,d=-1,u=!1;for(const p of a.getChildren()){for(const f of p.children){const{children:S}=f,E=S[0];if(E){if(e<E.startIndex||n>E.endIndex)continue;d=E.startIndex+3;for(const C of E.children){const b=E.children.indexOf(C),{startIndex:R,endIndex:v}=C;e>=R&&e<=v?(l=R,c.push(b),A+=v-R+1):(R>e&&v<n||n>=R&&n<=v)&&(c.push(b),A+=v-R+1),c.length===E.children.length&&(u=!0)}}if(c.length)break}if(c.length)break}return r==null||c.length===0?null:{tableId:r,rowIndexes:c,offset:l,len:A,cursor:d,selectWholeTable:u}}function Nr(i,t){var g,p,f;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(f=(p=(g=t.getBody())==null?void 0:g.tables)==null?void 0:p.find(S=>e>=S.startIndex&&n<=S.endIndex))==null?void 0:f.tableId,c=[];let l=null;const A=[];let d=-1,u=-1,m=-1;for(const S of a.getChildren()){for(const E of S.children){const{children:C}=E,b=C[0];if(b){if(e<b.startIndex||n>b.endIndex)continue;l=b;for(const R of b.children)for(const v of R.children){const O=R.children.indexOf(v);e>=v.startIndex&&e<=v.endIndex&&(u=O),n>=v.startIndex&&n<=v.endIndex&&(m=O)}}if(l)break}if(l)break}if(l==null||r==null)return null;for(let S=u;S<=m;S++)A.push(S);let h=0;for(const S of l.children){const E=S.children[u],C=S.children[m];c.push({retain:E.startIndex-h,delete:C.endIndex-E.startIndex+1}),h=C.endIndex+1}return d=l.startIndex+3,{offsets:c,tableId:r,columnIndexes:A,cursor:d,selectWholeTable:A.length===l.children[0].children.length,rowCount:l.children.length}}function is(i,t){var d,u,m;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(m=(u=(d=t.getBody())==null?void 0:d.tables)==null?void 0:u.find(h=>e>=h.startIndex&&n<=h.endIndex))==null?void 0:m.tableId;let c=-1,l=0,A=-1;for(const h of a.getChildren()){for(const g of h.children){const{children:p}=g,f=p[0];if(f){if(e<f.startIndex||n>f.endIndex)continue;c=f.startIndex,l=f.endIndex-f.startIndex+1,A=f.startIndex}if(f)break}if(l>0)break}return r==null?null:{tableId:r,offset:c,len:l,cursor:A}}function Pr(i,t){var g,p,f;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(f=(p=(g=t.getBody())==null?void 0:g.tables)==null?void 0:p.find(S=>e>=S.startIndex&&n<=S.endIndex))==null?void 0:f.tableId,c=[];let l=null,A=-1,d=-1,u=-1,m=-1;for(const S of a.getChildren()){for(const E of S.children){const{children:C}=E,b=C[0];if(b){if(e<b.startIndex||n>b.endIndex)continue;l=b;for(const R of b.children){const v=b.children.indexOf(R);for(const O of R.children){const M=R.children.indexOf(O);e>=O.startIndex&&e<=O.endIndex&&(d=v,u=M),n>=O.startIndex&&n<=O.endIndex&&(m=M)}}}if(l)break}if(l)break}if(l==null||r==null||d===-1)return null;const h=l.children[d];for(let S=u;S<=m;S++){const E=h.children[S];c.push({retain:E.startIndex+1,delete:E.endIndex-E.startIndex-3})}return A=l.startIndex+3,{offsets:c,tableId:r,cursor:A,rowCount:l.children.length}}var ii=(i=>(i[i.NEXT=0]="NEXT",i[i.PREV=1]="PREV",i))(ii||{});function os(i,t,e){const{startOffset:n}=t;let o=null;for(const A of i.getChildren()){for(const d of A.children){const u=d.children[0];if(u&&n>u.startIndex&&n<u.endIndex){o=u;break}}if(o)break}if(o==null)return null;let a=-1,r=-1,c=null;for(const A of o.children){for(const d of A.children)if(n>d.startIndex&&n<d.endIndex){a=A.children.indexOf(d),r=o.children.indexOf(A),c=A;break}if(a>-1)break}if(a===-1||r===-1||c==null)return null;let l=null;if(e===0){if(l=c.children[a+1],!l){const A=o.children[r+1];A&&(l=A.children[0])}}else if(l=c.children[a-1],!l){const A=o.children[r-1];A&&(l=A.children[A.children.length-1])}if(l){const{startIndex:A,endIndex:d}=l;return{startOffset:A+1,endOffset:d-2}}}function ss(i,t){const e=[],{customBlocks:n=[]}=i;for(const o of t){const{startOffset:a,endOffset:r}=o;if(!(a==null||r==null))for(const c of n){const{startIndex:l}=c;l>=a&&l<r&&e.push(c.blockId)}}return e}function Ur(i){return i.some(t=>{const{startNodePosition:e}=t;return e?(e==null?void 0:e.path.indexOf("cells"))>-1:!1})}const wr=s.SHEET_EDITOR_UNITS,oi={id:"doc.command.inner-paste",type:s.CommandType.COMMAND,handler:async(i,t)=>{var y,N,x,w,H,V;const{segmentId:e,textRanges:n,doc:o}=t,a=i.get(s.ICommandService),r=i.get(D.DocSelectionManagerService),c=i.get(s.IUniverInstanceService),l=r.getTextRanges(),A=r.getRectRanges(),{body:d,tableSource:u,drawings:m}=o;if(!Array.isArray(l)||l.length===0||d==null)return!1;const h=c.getCurrentUniverDocInstance(),g=h==null?void 0:h.getSelfOrHeaderFooterModel(e).getBody();if(h==null||g==null)return!1;const p=h.getUnitId(),f={id:D.RichTextEditingMutation.id,params:{unitId:p,actions:[],textRanges:n,segmentId:e}},S=new s.MemoryCursor;S.reset();const E=new s.TextX,C=s.JSONX.getInstance(),b=[],R=!!((y=d.tables)!=null&&y.length),v=!!((N=d.customBlocks)!=null&&N.length);if(R&&e||R&&Ur(l)||l.length&&(A!=null&&A.length))return!1;for(let F=0;F<l.length;F++){const Q=l[F],{startOffset:j,endOffset:G,collapsed:k}=Q,W=j-S.cursor,z=s.Tools.deepClone(d);if(R)for(const q of z.tables){const{tableId:K}=q,$=s.Tools.generateRandomId(6);q.tableId=$;const ie=s.Tools.deepClone(u[K]);ie.tableId=$;const fe=C.insertOp(["tableSource",$],ie);b.push(fe)}if(v&&m){const q=(w=(x=h.getSnapshot().drawingsOrder)==null?void 0:x.length)!=null?w:0;for(const K of z.customBlocks){const{blockId:$}=K,ie=s.Tools.generateRandomId(6);K.blockId=ie;const fe=s.Tools.deepClone(m[$]);fe.drawingId=ie;const Fe=C.insertOp(["drawings",ie],fe),Se=C.insertOp(["drawingsOrder",q],ie);b.push(Fe),b.push(Se)}}const X=_n((H=g.customRanges)!=null?H:[],G,wr.includes(p)),Y=Nn((V=g.customDecorations)!=null?V:[],G);if(X&&(z.customRanges=[{...X,startIndex:0,endIndex:d.dataStream.length-1}]),Y.length&&(z.customDecorations=Y.map(q=>({...q,startIndex:0,endIndex:d.dataStream.length-1}))),k)E.push({t:s.TextXActionType.RETAIN,len:W}),E.push({t:s.TextXActionType.INSERT,body:z,len:d.dataStream.length});else{const q=s.BuildTextUtils.selection.delete([Q],d,S.cursor,z,l.length===1);E.push(...q)}S.reset(),S.moveCursor(G)}const O=Z(h,e);return b.push(C.editOp(E.serialize(),O)),f.params.actions=b.reduce((F,Q)=>s.JSONX.compose(F,Q),null),!!a.syncExecuteCommand(f.id,f.params)}};function Lr(i,t){const{startOffset:e,endOffset:n}=i,o=t.some(r=>r.startIndex===n),a=Math.max(e,o?n-1:n);return{...i,endOffset:a,collapsed:e===a}}function Qr(i,t,e){var g,p;const n=t.getSelfOrHeaderFooterModel(e).getBody(),o=new s.TextX,a=s.JSONX.getInstance(),r=[];if(n==null)return r;const{tables:c=[]}=n,l=new s.MemoryCursor;l.reset();for(let f=0;f<i.length;f++){const S=Lr(i[f],c),{startOffset:E,endOffset:C,collapsed:b}=S,R=E-l.cursor;b?o.push({t:s.TextXActionType.RETAIN,len:R}):o.push(...s.BuildTextUtils.selection.delete([S],n,l.cursor,null,!1)),l.reset(),l.moveCursor(C)}const A=Z(t,e);r.push(a.editOp(o.serialize(),A));const d=ss(n,i),u=(g=t.getDrawings())!=null?g:{},m=(p=t.getDrawingsOrder())!=null?p:[],h=d.sort((f,S)=>m.indexOf(f)>m.indexOf(S)?-1:m.indexOf(f)<m.indexOf(S)?1:0);if(h.length>0)for(const f of h){const S=u[f],E=m.indexOf(f);if(S==null||E<0)continue;const C=a.removeOp(["drawings",f],S),b=a.removeOp(["drawingsOrder",E],f);r.push(C),r.push(b)}return r.reduce((f,S)=>s.JSONX.compose(f,S),null)}function Fr(i,t,e,n){const o=[];if(t.getSelfOrHeaderFooterModel(n).getBody()==null)return o;const r=new s.TextX,c=s.JSONX.getInstance(),l=new s.MemoryCursor;l.reset();for(const d of i){const{startOffset:u,endOffset:m,spanEntireRow:h,spanEntireTable:g}=d;if(!(u==null||m==null))if(g){const p=is({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offset:f,len:S,tableId:E}=p;f-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:f-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:S});const C=c.removeOp(["tableSource",E]);o.push(C),l.moveCursorTo(f+S)}else if(h){const p=ns({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offset:f,rowIndexes:S,len:E,tableId:C}=p;f-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:f-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:E});for(const b of S.reverse()){const R=c.removeOp(["tableSource",C,"tableRows",b]);o.push(R)}l.moveCursorTo(f+E)}else{const p=Pr({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offsets:f}=p;for(const S of f){const{retain:E,delete:C}=S;E-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:E-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:C}),l.moveCursorTo(E+C)}}}const A=Z(t,n);return o.push(c.editOp(r.serialize(),A)),o.reduce((d,u)=>s.JSONX.compose(d,u),null)}function as(i,t,e,n,o){let a=[];if(Array.isArray(i)&&(i==null?void 0:i.length)!==0&&(a=Qr(i,e,o)),Array.isArray(t)&&(t==null?void 0:t.length)!==0){const r=Fr(t,e,n,o);a==null||a.length===0?a=r:a=s.JSONX.compose(a,s.JSONX.transform(r,a,"right"))}return a}const Ve={id:"doc.command.inner-cut",type:s.CommandType.COMMAND,handler:(i,t)=>{var p;const e=i.get(D.DocSelectionManagerService),n=i.get(s.ICommandService),o=i.get(s.IUniverInstanceService),{segmentId:a,textRanges:r,selections:c=e.getTextRanges(),rectRanges:l=e.getRectRanges()}=t;if((!Array.isArray(c)||c.length===0)&&(!Array.isArray(l)||l.length===0))return!1;const A=(p=o.getCurrentUniverDocInstance())==null?void 0:p.getUnitId();if(!A)return!1;const d=o.getUniverDocInstance(A);if(d==null)return!1;const u=re(i,A);if(u==null)return!1;const m=u.getViewModel(),h={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:r}};return h.params.actions=as(c,l,d,m,a),!!n.syncExecuteCommand(h.id,h.params)}};var oe=(i=>(i[i.LEFT=0]="LEFT",i[i.RIGHT=1]="RIGHT",i))(oe||{});const rs="doc.command.insert-text",si={id:rs,type:s.CommandType.COMMAND,handler:async(i,t)=>{var v;const e=i.get(s.ICommandService),{range:n,segmentId:o,body:a,unitId:r,cursorOffset:c}=t,l=i.get(D.DocSelectionManagerService),d=i.get(s.IUniverInstanceService).getUnit(r,s.UniverInstanceType.UNIVER_DOC);if(d==null)return!1;const u=l.getActiveTextRange(),m=d.getSelfOrHeaderFooterModel((v=u==null?void 0:u.segmentId)!=null?v:"").getBody();if(m==null)return!1;const{startOffset:h,collapsed:g}=n,p=c!=null?c:a.dataStream.length,f=[{startOffset:h+p,endOffset:h+p,style:u==null?void 0:u.style,collapsed:g}],S={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:f,debounce:!0}},E=new s.TextX,C=s.JSONX.getInstance();if(g)h>0&&E.push({t:s.TextXActionType.RETAIN,len:h}),E.push({t:s.TextXActionType.INSERT,body:a,len:a.dataStream.length});else{const O=s.BuildTextUtils.selection.delete([n],m,0,a);E.push(...O)}S.params.textRanges=[{startOffset:h+p,endOffset:h+p,collapsed:g}];const b=Z(d,o);return S.params.actions=C.editOp(E.serialize(),b),!!e.syncExecuteCommand(S.id,S.params)}},Ze={id:"doc.command.delete-text",type:s.CommandType.COMMAND,handler:async(i,t)=>{var R;const e=i.get(s.ICommandService),n=i.get(s.IUniverInstanceService),{range:o,segmentId:a,unitId:r,direction:c,len:l=1}=t,A=n.getUnit(r,s.UniverInstanceType.UNIVER_DOC),d=A==null?void 0:A.getSelfOrHeaderFooterModel(a).getBody();if(A==null||d==null)return!1;const{startOffset:u}=o;let m=c===oe.LEFT?u-l:u,h=c===oe.LEFT?u-1:u+l-1;const g=(R=d.customRanges)==null?void 0:R.find(v=>v.startIndex<=m&&v.endIndex>=h);g!=null&&g.wholeEntity&&(m=g.startIndex,h=Math.max(h,g.endIndex));const p={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:[{startOffset:m,endOffset:m,collapsed:!0}],debounce:!0}},f=new s.TextX,S=s.JSONX.getInstance();f.push({t:s.TextXActionType.RETAIN,len:m-0}),f.push({t:s.TextXActionType.DELETE,len:h-m+1});const C=Z(A,a);return p.params.actions=S.editOp(f.serialize(),C),!!e.syncExecuteCommand(p.id,p.params)}},ai={id:"doc.command.update-text",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{range:e,segmentId:n,updateBody:o,coverType:a,unitId:r,textRanges:c}=t,l=i.get(s.ICommandService),d=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(d==null)return!1;const u={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:c}},m=new s.TextX,h=s.JSONX.getInstance(),{startOffset:g,endOffset:p}=e;m.push({t:s.TextXActionType.RETAIN,len:g}),m.push({t:s.TextXActionType.RETAIN,body:o,len:p-g,coverType:a});const f=Z(d,n);return u.params.actions=h.editOp(m.serialize(),f),!!l.syncExecuteCommand(u.id,u.params)}};function mt(i){var r,c,l,A;const t=i.get(s.IUniverInstanceService),n=i.get(D.DocSelectionManagerService).getActiveTextRange(),o=t.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);return!n||!n.collapsed||!o||n.segmentId?!1:s.BuildTextUtils.range.getParagraphsInRange(n,(c=(r=o.getBody())==null?void 0:r.paragraphs)!=null?c:[],(A=(l=o.getBody())==null?void 0:l.dataStream)!=null?A:"")[0]}const qt={id:"doc.command.delete-custom-block",type:s.CommandType.COMMAND,handler:async(i,t)=>{var x;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=e.getActiveTextRange(),r=n.getCurrentUniverDocInstance();if(a==null||r==null)return!1;const{direction:c,range:l,unitId:A,drawingId:d}=t,{startOffset:u,segmentId:m,style:h}=a,g=c===oe.LEFT?u-1:u,p=[{startOffset:g,endOffset:g,style:h}],f={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:p,prevTextRanges:[l]}},S=new s.TextX,E=s.JSONX.getInstance(),C=[];u>0&&S.push({t:s.TextXActionType.RETAIN,len:c===oe.LEFT?u-1:u}),S.push({t:s.TextXActionType.DELETE,len:1});const b=Z(r,m);C.push(E.editOp(S.serialize(),b));const R=((x=r.getDrawings())!=null?x:{})[d],O=r.getDrawingsOrder().indexOf(d),M=E.removeOp(["drawings",d],R),y=E.removeOp(["drawingsOrder",O],d);return C.push(M),C.push(y),f.params.actions=C.reduce((w,H)=>s.JSONX.compose(w,H),null),!!o.syncExecuteCommand(f.id,f.params)}},Jt={id:"doc.command.merge-two-paragraph",type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{direction:a,range:r}=t,c=e.getActiveTextRange(),l=e.getTextRanges();if(c==null||l==null)return!1;const{segmentId:A,style:d}=c,u=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),m=u==null?void 0:u.getSelfOrHeaderFooterModel(A).getBody();if(u==null||m==null)return!1;const h=m.dataStream,g=c,p=u.getUnitId(),{startOffset:f,collapsed:S}=g;if(!S)return!1;const E=a===oe.LEFT?f:f+1;let C,b;for(const V of m.paragraphs){if(V.startIndex>=E){b=V;break}C=V}if(C==null||b==null)return!1;const R=a===oe.LEFT?f-1:f,v=[{startOffset:R,endOffset:R,style:d}],O={id:D.RichTextEditingMutation.id,params:{unitId:p,actions:[],textRanges:v,prevTextRanges:[r]}},M=new s.TextX,y=s.JSONX.getInstance();C.startIndex>0&&M.push({t:s.TextXActionType.RETAIN,len:C.startIndex}),M.push({t:s.TextXActionType.DELETE,len:1}),b.startIndex>C.startIndex+1&&M.push({t:s.TextXActionType.RETAIN,len:b.startIndex-C.startIndex-1});const N=Object.values(s.DataStreamTreeTokenType),x=h[C.startIndex-1];(x&&!N.includes(x)||x===" ")&&M.push({t:s.TextXActionType.RETAIN,len:1,coverType:s.UpdateDocsAttributeType.REPLACE,body:{dataStream:"",paragraphs:[{...s.Tools.deepClone(C),startIndex:0}]}});const w=Z(u,A);return O.params.actions=y.editOp(M.serialize(),w),!!o.syncExecuteCommand(O.id,O.params)}},cs={id:"doc.command.remove-horizontal-line",type:s.CommandType.COMMAND,handler:async i=>{var R;const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getActiveTextRange(),a=t.getTextRanges();if(o==null||a==null)return!1;const{segmentId:r,style:c}=o,l=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),A=l==null?void 0:l.getSelfOrHeaderFooterModel(r).getBody();if(l==null||A==null)return!1;const d=o,u=l.getUnitId(),{startOffset:m,collapsed:h}=d;if(!h)return!1;const g=(R=A.paragraphs)==null?void 0:R.find(v=>v.startIndex===m-1);if(g==null)return!1;const p=[{startOffset:m,endOffset:m,style:c}],f={id:D.RichTextEditingMutation.id,params:{unitId:u,actions:[],textRanges:p}},S=new s.TextX,E=s.JSONX.getInstance();g.startIndex>0&&S.push({t:s.TextXActionType.RETAIN,len:g.startIndex}),S.push({t:s.TextXActionType.RETAIN,len:1,coverType:s.UpdateDocsAttributeType.REPLACE,body:{dataStream:"",paragraphs:[{...s.Tools.deepClone({...g,paragraphStyle:{...g.paragraphStyle,borderBottom:void 0}}),startIndex:0}]}});const C=Z(l,r);return f.params.actions=E.editOp(S.serialize(),C),!!n.syncExecuteCommand(f.id,f.params)}};function Zt(i,t){let e=0;if(i==null||i.length===0){if(typeof t[0].startOffset=="number"){const n=t[0],{spanEntireRow:o,spanEntireTable:a}=n;a?e=n.startOffset-3:o?n.startRow>0?e=n.startOffset-6:e=n.startOffset:e=t[0].startOffset}}else if(i.length>0&&t.length>0){const n=i[0],o=t[0];if(n.startOffset!=null&&o.startOffset!=null){if(n.startOffset<o.startOffset)e=n.startOffset;else if(n.startOffset>=o.startOffset){const{spanEntireRow:a,spanEntireTable:r}=o;r?e=o.startOffset-3:a&&(e=o.startOffset-6)}}}return e}const pt={id:"doc.command.delete-left",type:s.CommandType.COMMAND,handler:async i=>{var y,N,x,w,H,V;const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService);let o=!0;const a=e.getCurrentUniverDocInstance();if(a==null)return!1;const r=a.getUnitId(),c=re(i,r),l=t.getActiveTextRange(),A=t.getRectRanges(),d=t.getTextRanges(),u=c==null?void 0:c.getSkeleton();if(u==null)return!1;if(A!=null&&A.length){const F=Zt(d,A),Q=A[0].segmentId,j=[{startOffset:F,endOffset:F}];return n.executeCommand(Ve.id,{segmentId:Q,textRanges:j})}if(l==null||d==null)return!1;const{segmentId:m,style:h,segmentPage:g}=l,p=a.getSelfOrHeaderFooterModel(m).getBody();if(p==null)return!1;const f=l,{startOffset:S,collapsed:E}=f,C=u.findNodeByCharIndex(S,m,g),b=_.hasListGlyph(C),R=_.isIndentByGlyph(C,p);let v=S;const O=u.findNodeByCharIndex(S-1,m,g);if(_.isFirstGlyph(C)&&O!==C&&(b===!0||R===!0)&&E){const F=_.getParagraphByGlyph(C,p);if(F==null)return!1;const Q=F==null?void 0:F.startIndex,j={startIndex:0},G=F.paragraphStyle;if(b===!0){const W=F.paragraphStyle;if(W){j.paragraphStyle=W;const{hanging:z}=W;z&&(j.paragraphStyle.indentStart=z,j.paragraphStyle.hanging=void 0)}}else if(R===!0){const W=F.bullet;W&&(j.bullet=W),G!=null&&(j.paragraphStyle={...G},delete j.paragraphStyle.hanging,delete j.paragraphStyle.indentStart)}const k=[{startOffset:v,endOffset:v,style:h}];o=await n.executeCommand(ai.id,{unitId:a.getUnitId(),updateBody:{dataStream:"",paragraphs:[{...j}]},range:{startOffset:Q,endOffset:Q+1},textRanges:k,coverType:s.UpdateDocsAttributeType.REPLACE,segmentId:m})}else if(E===!0){if(O==null)return!0;if(O.content==="\r"){const F=(y=p.paragraphs)==null?void 0:y.find(Q=>Q.startIndex===S-1);(N=F==null?void 0:F.paragraphStyle)!=null&&N.borderBottom?o=await n.executeCommand(cs.id):o=await n.executeCommand(Jt.id,{direction:oe.LEFT,range:f})}else if(O.streamType==="\b"){const F=(w=a.getSnapshot().drawings)==null?void 0:w[(x=O.drawingId)!=null?x:""];if(F==null)return!0;const Q=(V=(H=a.getBody())==null?void 0:H.customBlocks)==null?void 0:V.find(G=>G.blockId===O.drawingId);if(F.layoutType===s.PositionedObjectLayoutType.INLINE||(Q==null?void 0:Q.blockType)===s.BlockType.CUSTOM){const G=a.getUnitId();o=await n.executeCommand(qt.id,{direction:oe.LEFT,range:l,unitId:G,drawingId:O.drawingId})}else{const G=u.findNodeByCharIndex(S-2);if(G==null)return!0;v-=O.count,v-=G.count;const k=[{startOffset:v,endOffset:v,style:h}];o=await n.executeCommand(Ze.id,{unitId:a.getUnitId(),range:{...l,startOffset:l.startOffset-1,endOffset:l.endOffset-1},segmentId:m,direction:oe.LEFT,len:G.count,textRanges:k})}}else v-=O.count,o=await n.executeCommand(Ze.id,{unitId:a.getUnitId(),range:f,segmentId:m,direction:oe.LEFT,len:O.count})}else{const F=ls(f,[f]);o=await n.executeCommand(Ve.id,{segmentId:m,textRanges:F,selections:[f]})}return o}},ri={id:"doc.command.delete-right",type:s.CommandType.COMMAND,handler:async i=>{var C,b;const t=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(!n)return!1;const o=re(i,n.getUnitId()),a=i.get(s.ICommandService),r=t.getActiveTextRange(),c=t.getRectRanges(),l=t.getTextRanges(),A=o==null?void 0:o.getSkeleton();if(c!=null&&c.length){const R=Zt(l,c),v=c[0].segmentId,O=[{startOffset:R,endOffset:R}];return a.executeCommand(Ve.id,{segmentId:v,textRanges:O})}if(r==null||A==null||l==null)return!1;const{segmentId:d,style:u,segmentPage:m}=r,h=n==null?void 0:n.getSelfOrHeaderFooterModel(d).getBody();if(!n||!h)return!1;const g=r,{startOffset:p,endOffset:f,collapsed:S}=g;if(p===h.dataStream.length-2&&S)return!0;let E=!1;if(S===!0){const R=A.findNodeByCharIndex(p,d,m),v=A.findNodeByCharIndex(p+1);if(R.streamType===s.DataStreamTreeTokenType.PARAGRAPH&&(v==null?void 0:v.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK)return!1;if(R.content==="\r")E=await a.executeCommand(Jt.id,{direction:oe.RIGHT,range:r});else if(R.streamType==="\b"){const O=(b=n.getSnapshot().drawings)==null?void 0:b[(C=R.drawingId)!=null?C:""];if(O==null)return!0;if(O.layoutType===s.PositionedObjectLayoutType.INLINE){const y=n.getUnitId();E=await a.executeCommand(qt.id,{direction:oe.RIGHT,range:r,unitId:y,drawingId:R.drawingId})}else{if(v==null)return!0;const y=[{startOffset:p+1,endOffset:p+1,style:u}];E=await a.executeCommand(Ze.id,{unitId:n.getUnitId(),range:{...r,startOffset:p+1,endOffset:f+1},segmentId:d,direction:oe.RIGHT,textRanges:y,len:v.count})}}else{const O=[{startOffset:p,endOffset:p,style:u}];E=await a.executeCommand(Ze.id,{unitId:n.getUnitId(),range:g,segmentId:d,direction:oe.RIGHT,textRanges:O,len:R.count})}}else{const R=ls(g,[g]);E=await a.executeCommand(Ve.id,{segmentId:d,textRanges:R,selections:[g]})}return E}};function ls(i,t){let e=i.endOffset;for(const o of t){const{startOffset:a,endOffset:r}=o;a==null||r==null||r<=i.endOffset&&(e-=r-a)}return[{startOffset:e,endOffset:e,style:i.style}]}const ci={id:"doc.command.delete-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{var A,d;const t=i.get(s.IUniverInstanceService),e=i.get(s.ICommandService),n=t.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!n)return!1;const o=(d=(A=n.getBody())==null?void 0:A.dataStream)!=null?d:"",a=mt(i);if(!a)return!1;const r=s.BuildTextUtils.selection.delete([{startOffset:a.paragraphStart,endOffset:o[a.paragraphEnd+1]===`
200
+ ${s.DataStreamTreeTokenType.TABLE_CELL_END}`,t=[],e=[];return t.push({startIndex:1,paragraphStyle:{spaceAbove:{v:3},lineSpacing:2,spaceBelow:{v:0}}}),e.push({startIndex:2}),{dataStream:i,paragraphs:t,sectionBreaks:e}}function Dr(i,t,e){var u,m,h;const{startOffset:n,endOffset:o,segmentId:a}=i,r=e.getSelfOrHeaderFooterViewModel(a),c=t===0?n:o;let l=null;const A=(h=(m=(u=e.getBody())==null?void 0:u.tables)==null?void 0:m.find(g=>c>=g.startIndex&&c<=g.endIndex))==null?void 0:h.tableId;let d=0;for(const g of r.getChildren()){for(const p of g.children){const{children:f}=p,S=f[0];if(S){for(const E of S.children)if(E.startIndex<=c&&c<=E.endIndex){d=S.children.indexOf(E),l=E;break}}if(l)break}if(l)break}return l==null||A==null?null:{offset:t===0?l.startIndex:l.endIndex+1,colCount:l.children.length,tableId:A,insertRowIndex:t===0?d:d+1}}function Br(i,t,e){var h,g,p;const{startOffset:n,endOffset:o,segmentId:a}=i,r=e.getSelfOrHeaderFooterViewModel(a),c=t===0?n:o,l=(p=(g=(h=e.getBody())==null?void 0:h.tables)==null?void 0:g.find(f=>c>=f.startIndex&&c<=f.endIndex))==null?void 0:p.tableId,A=[];let d=null,u=-1;for(const f of r.getChildren()){for(const S of f.children){const{children:E}=S,C=E[0];if(C){if(c<C.startIndex||c>C.endIndex)continue;d=C;for(const b of C.children){for(const R of b.children){const I=b.children.indexOf(R);if(c>=R.startIndex&&c<=R.endIndex){u=I;break}}if(u!==-1)break}}if(d)break}if(d)break}if(d==null||l==null||u===-1)return null;let m=0;for(const f of d.children){const S=f.children[u],E=t===0?S.startIndex:S.endIndex+1;A.push(E-m),m=E}return{offsets:A,tableId:l,columnIndex:u,rowCount:d.children.length}}function _r(i,t,e){const n=[];let o=t[e].size.width.v,a=0;for(let r=0;r<t.length;r++)a+=t[r].size.width.v;a+=o;for(let r=0;r<t.length;r++)n.push(t[r].size.width.v/a*i);return o=o/a*i,{widths:n,newColWidth:o}}function ns(i,t){var m,h,g;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(g=(h=(m=t.getBody())==null?void 0:m.tables)==null?void 0:h.find(p=>e>=p.startIndex&&n<=p.endIndex))==null?void 0:g.tableId,c=[];let l=-1,A=0,d=-1,u=!1;for(const p of a.getChildren()){for(const f of p.children){const{children:S}=f,E=S[0];if(E){if(e<E.startIndex||n>E.endIndex)continue;d=E.startIndex+3;for(const C of E.children){const b=E.children.indexOf(C),{startIndex:R,endIndex:I}=C;e>=R&&e<=I?(l=R,c.push(b),A+=I-R+1):(R>e&&I<n||n>=R&&n<=I)&&(c.push(b),A+=I-R+1),c.length===E.children.length&&(u=!0)}}if(c.length)break}if(c.length)break}return r==null||c.length===0?null:{tableId:r,rowIndexes:c,offset:l,len:A,cursor:d,selectWholeTable:u}}function Nr(i,t){var g,p,f;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(f=(p=(g=t.getBody())==null?void 0:g.tables)==null?void 0:p.find(S=>e>=S.startIndex&&n<=S.endIndex))==null?void 0:f.tableId,c=[];let l=null;const A=[];let d=-1,u=-1,m=-1;for(const S of a.getChildren()){for(const E of S.children){const{children:C}=E,b=C[0];if(b){if(e<b.startIndex||n>b.endIndex)continue;l=b;for(const R of b.children)for(const I of R.children){const O=R.children.indexOf(I);e>=I.startIndex&&e<=I.endIndex&&(u=O),n>=I.startIndex&&n<=I.endIndex&&(m=O)}}if(l)break}if(l)break}if(l==null||r==null)return null;for(let S=u;S<=m;S++)A.push(S);let h=0;for(const S of l.children){const E=S.children[u],C=S.children[m];c.push({retain:E.startIndex-h,delete:C.endIndex-E.startIndex+1}),h=C.endIndex+1}return d=l.startIndex+3,{offsets:c,tableId:r,columnIndexes:A,cursor:d,selectWholeTable:A.length===l.children[0].children.length,rowCount:l.children.length}}function is(i,t){var d,u,m;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(m=(u=(d=t.getBody())==null?void 0:d.tables)==null?void 0:u.find(h=>e>=h.startIndex&&n<=h.endIndex))==null?void 0:m.tableId;let c=-1,l=0,A=-1;for(const h of a.getChildren()){for(const g of h.children){const{children:p}=g,f=p[0];if(f){if(e<f.startIndex||n>f.endIndex)continue;c=f.startIndex,l=f.endIndex-f.startIndex+1,A=f.startIndex}if(f)break}if(l>0)break}return r==null?null:{tableId:r,offset:c,len:l,cursor:A}}function Pr(i,t){var g,p,f;const{startOffset:e,endOffset:n,segmentId:o}=i,a=t.getSelfOrHeaderFooterViewModel(o),r=(f=(p=(g=t.getBody())==null?void 0:g.tables)==null?void 0:p.find(S=>e>=S.startIndex&&n<=S.endIndex))==null?void 0:f.tableId,c=[];let l=null,A=-1,d=-1,u=-1,m=-1;for(const S of a.getChildren()){for(const E of S.children){const{children:C}=E,b=C[0];if(b){if(e<b.startIndex||n>b.endIndex)continue;l=b;for(const R of b.children){const I=b.children.indexOf(R);for(const O of R.children){const M=R.children.indexOf(O);e>=O.startIndex&&e<=O.endIndex&&(d=I,u=M),n>=O.startIndex&&n<=O.endIndex&&(m=M)}}}if(l)break}if(l)break}if(l==null||r==null||d===-1)return null;const h=l.children[d];for(let S=u;S<=m;S++){const E=h.children[S];c.push({retain:E.startIndex+1,delete:E.endIndex-E.startIndex-3})}return A=l.startIndex+3,{offsets:c,tableId:r,cursor:A,rowCount:l.children.length}}var ii=(i=>(i[i.NEXT=0]="NEXT",i[i.PREV=1]="PREV",i))(ii||{});function os(i,t,e){const{startOffset:n}=t;let o=null;for(const A of i.getChildren()){for(const d of A.children){const u=d.children[0];if(u&&n>u.startIndex&&n<u.endIndex){o=u;break}}if(o)break}if(o==null)return null;let a=-1,r=-1,c=null;for(const A of o.children){for(const d of A.children)if(n>d.startIndex&&n<d.endIndex){a=A.children.indexOf(d),r=o.children.indexOf(A),c=A;break}if(a>-1)break}if(a===-1||r===-1||c==null)return null;let l=null;if(e===0){if(l=c.children[a+1],!l){const A=o.children[r+1];A&&(l=A.children[0])}}else if(l=c.children[a-1],!l){const A=o.children[r-1];A&&(l=A.children[A.children.length-1])}if(l){const{startIndex:A,endIndex:d}=l;return{startOffset:A+1,endOffset:d-2}}}function ss(i,t){const e=[],{customBlocks:n=[]}=i;for(const o of t){const{startOffset:a,endOffset:r}=o;if(!(a==null||r==null))for(const c of n){const{startIndex:l}=c;l>=a&&l<r&&e.push(c.blockId)}}return e}function Ur(i){return i.some(t=>{const{startNodePosition:e}=t;return e?(e==null?void 0:e.path.indexOf("cells"))>-1:!1})}const wr=s.SHEET_EDITOR_UNITS,oi={id:"doc.command.inner-paste",type:s.CommandType.COMMAND,handler:async(i,t)=>{var y,N,x,w,H,V;const{segmentId:e,textRanges:n,doc:o}=t,a=i.get(s.ICommandService),r=i.get(D.DocSelectionManagerService),c=i.get(s.IUniverInstanceService),l=r.getTextRanges(),A=r.getRectRanges(),{body:d,tableSource:u,drawings:m}=o;if(!Array.isArray(l)||l.length===0||d==null)return!1;const h=c.getCurrentUniverDocInstance(),g=h==null?void 0:h.getSelfOrHeaderFooterModel(e).getBody();if(h==null||g==null)return!1;const p=h.getUnitId(),f={id:D.RichTextEditingMutation.id,params:{unitId:p,actions:[],textRanges:n,segmentId:e}},S=new s.MemoryCursor;S.reset();const E=new s.TextX,C=s.JSONX.getInstance(),b=[],R=!!((y=d.tables)!=null&&y.length),I=!!((N=d.customBlocks)!=null&&N.length);if(R&&e||R&&Ur(l)||l.length&&(A!=null&&A.length))return!1;for(let F=0;F<l.length;F++){const Q=l[F],{startOffset:j,endOffset:G,collapsed:k}=Q,W=j-S.cursor,z=s.Tools.deepClone(d);if(R)for(const q of z.tables){const{tableId:K}=q,$=s.Tools.generateRandomId(6);q.tableId=$;const ie=s.Tools.deepClone(u[K]);ie.tableId=$;const fe=C.insertOp(["tableSource",$],ie);b.push(fe)}if(I&&m){const q=(w=(x=h.getSnapshot().drawingsOrder)==null?void 0:x.length)!=null?w:0;for(const K of z.customBlocks){const{blockId:$}=K,ie=s.Tools.generateRandomId(6);K.blockId=ie;const fe=s.Tools.deepClone(m[$]);fe.drawingId=ie;const Fe=C.insertOp(["drawings",ie],fe),Se=C.insertOp(["drawingsOrder",q],ie);b.push(Fe),b.push(Se)}}const X=_n((H=g.customRanges)!=null?H:[],G,wr.includes(p)),Y=Nn((V=g.customDecorations)!=null?V:[],G);if(X&&(z.customRanges=[{...X,startIndex:0,endIndex:d.dataStream.length-1}]),Y.length&&(z.customDecorations=Y.map(q=>({...q,startIndex:0,endIndex:d.dataStream.length-1}))),k)E.push({t:s.TextXActionType.RETAIN,len:W}),E.push({t:s.TextXActionType.INSERT,body:z,len:d.dataStream.length});else{const q=s.BuildTextUtils.selection.delete([Q],d,S.cursor,z,l.length===1);E.push(...q)}S.reset(),S.moveCursor(G)}const O=Z(h,e);return b.push(C.editOp(E.serialize(),O)),f.params.actions=b.reduce((F,Q)=>s.JSONX.compose(F,Q),null),!!a.syncExecuteCommand(f.id,f.params)}};function Lr(i,t){const{startOffset:e,endOffset:n}=i,o=t.some(r=>r.startIndex===n),a=Math.max(e,o?n-1:n);return{...i,endOffset:a,collapsed:e===a}}function Qr(i,t,e){var g,p;const n=t.getSelfOrHeaderFooterModel(e).getBody(),o=new s.TextX,a=s.JSONX.getInstance(),r=[];if(n==null)return r;const{tables:c=[]}=n,l=new s.MemoryCursor;l.reset();for(let f=0;f<i.length;f++){const S=Lr(i[f],c),{startOffset:E,endOffset:C,collapsed:b}=S,R=E-l.cursor;b?o.push({t:s.TextXActionType.RETAIN,len:R}):o.push(...s.BuildTextUtils.selection.delete([S],n,l.cursor,null,!1)),l.reset(),l.moveCursor(C)}const A=Z(t,e);r.push(a.editOp(o.serialize(),A));const d=ss(n,i),u=(g=t.getDrawings())!=null?g:{},m=(p=t.getDrawingsOrder())!=null?p:[],h=d.sort((f,S)=>m.indexOf(f)>m.indexOf(S)?-1:m.indexOf(f)<m.indexOf(S)?1:0);if(h.length>0)for(const f of h){const S=u[f],E=m.indexOf(f);if(S==null||E<0)continue;const C=a.removeOp(["drawings",f],S),b=a.removeOp(["drawingsOrder",E],f);r.push(C),r.push(b)}return r.reduce((f,S)=>s.JSONX.compose(f,S),null)}function Fr(i,t,e,n){const o=[];if(t.getSelfOrHeaderFooterModel(n).getBody()==null)return o;const r=new s.TextX,c=s.JSONX.getInstance(),l=new s.MemoryCursor;l.reset();for(const d of i){const{startOffset:u,endOffset:m,spanEntireRow:h,spanEntireTable:g}=d;if(!(u==null||m==null))if(g){const p=is({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offset:f,len:S,tableId:E}=p;f-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:f-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:S});const C=c.removeOp(["tableSource",E]);o.push(C),l.moveCursorTo(f+S)}else if(h){const p=ns({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offset:f,rowIndexes:S,len:E,tableId:C}=p;f-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:f-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:E});for(const b of S.reverse()){const R=c.removeOp(["tableSource",C,"tableRows",b]);o.push(R)}l.moveCursorTo(f+E)}else{const p=Pr({startOffset:u,endOffset:m,segmentId:n},e);if(p==null)continue;const{offsets:f}=p;for(const S of f){const{retain:E,delete:C}=S;E-l.cursor>0&&r.push({t:s.TextXActionType.RETAIN,len:E-l.cursor}),r.push({t:s.TextXActionType.DELETE,len:C}),l.moveCursorTo(E+C)}}}const A=Z(t,n);return o.push(c.editOp(r.serialize(),A)),o.reduce((d,u)=>s.JSONX.compose(d,u),null)}function as(i,t,e,n,o){let a=[];if(Array.isArray(i)&&(i==null?void 0:i.length)!==0&&(a=Qr(i,e,o)),Array.isArray(t)&&(t==null?void 0:t.length)!==0){const r=Fr(t,e,n,o);a==null||a.length===0?a=r:a=s.JSONX.compose(a,s.JSONX.transform(r,a,"right"))}return a}const Ve={id:"doc.command.inner-cut",type:s.CommandType.COMMAND,handler:(i,t)=>{var p;const e=i.get(D.DocSelectionManagerService),n=i.get(s.ICommandService),o=i.get(s.IUniverInstanceService),{segmentId:a,textRanges:r,selections:c=e.getTextRanges(),rectRanges:l=e.getRectRanges()}=t;if((!Array.isArray(c)||c.length===0)&&(!Array.isArray(l)||l.length===0))return!1;const A=(p=o.getCurrentUniverDocInstance())==null?void 0:p.getUnitId();if(!A)return!1;const d=o.getUniverDocInstance(A);if(d==null)return!1;const u=re(i,A);if(u==null)return!1;const m=u.getViewModel(),h={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:r}};return h.params.actions=as(c,l,d,m,a),!!n.syncExecuteCommand(h.id,h.params)}};var oe=(i=>(i[i.LEFT=0]="LEFT",i[i.RIGHT=1]="RIGHT",i))(oe||{});const rs="doc.command.insert-text",si={id:rs,type:s.CommandType.COMMAND,handler:async(i,t)=>{var I;const e=i.get(s.ICommandService),{range:n,segmentId:o,body:a,unitId:r,cursorOffset:c}=t,l=i.get(D.DocSelectionManagerService),d=i.get(s.IUniverInstanceService).getUnit(r,s.UniverInstanceType.UNIVER_DOC);if(d==null)return!1;const u=l.getActiveTextRange(),m=d.getSelfOrHeaderFooterModel((I=u==null?void 0:u.segmentId)!=null?I:"").getBody();if(m==null)return!1;const{startOffset:h,collapsed:g}=n,p=c!=null?c:a.dataStream.length,f=[{startOffset:h+p,endOffset:h+p,style:u==null?void 0:u.style,collapsed:g}],S={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:f,debounce:!0}},E=new s.TextX,C=s.JSONX.getInstance();if(g)h>0&&E.push({t:s.TextXActionType.RETAIN,len:h}),E.push({t:s.TextXActionType.INSERT,body:a,len:a.dataStream.length});else{const O=s.BuildTextUtils.selection.delete([n],m,0,a);E.push(...O)}S.params.textRanges=[{startOffset:h+p,endOffset:h+p,collapsed:g}];const b=Z(d,o);return S.params.actions=C.editOp(E.serialize(),b),!!e.syncExecuteCommand(S.id,S.params)}},Ze={id:"doc.command.delete-text",type:s.CommandType.COMMAND,handler:async(i,t)=>{var R;const e=i.get(s.ICommandService),n=i.get(s.IUniverInstanceService),{range:o,segmentId:a,unitId:r,direction:c,len:l=1}=t,A=n.getUnit(r,s.UniverInstanceType.UNIVER_DOC),d=A==null?void 0:A.getSelfOrHeaderFooterModel(a).getBody();if(A==null||d==null)return!1;const{startOffset:u}=o;let m=c===oe.LEFT?u-l:u,h=c===oe.LEFT?u-1:u+l-1;const g=(R=d.customRanges)==null?void 0:R.find(I=>I.startIndex<=m&&I.endIndex>=h);g!=null&&g.wholeEntity&&(m=g.startIndex,h=Math.max(h,g.endIndex));const p={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:[{startOffset:m,endOffset:m,collapsed:!0}],debounce:!0}},f=new s.TextX,S=s.JSONX.getInstance();f.push({t:s.TextXActionType.RETAIN,len:m-0}),f.push({t:s.TextXActionType.DELETE,len:h-m+1});const C=Z(A,a);return p.params.actions=S.editOp(f.serialize(),C),!!e.syncExecuteCommand(p.id,p.params)}},ai={id:"doc.command.update-text",type:s.CommandType.COMMAND,handler:async(i,t)=>{const{range:e,segmentId:n,updateBody:o,coverType:a,unitId:r,textRanges:c}=t,l=i.get(s.ICommandService),d=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(d==null)return!1;const u={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:c}},m=new s.TextX,h=s.JSONX.getInstance(),{startOffset:g,endOffset:p}=e;m.push({t:s.TextXActionType.RETAIN,len:g}),m.push({t:s.TextXActionType.RETAIN,body:o,len:p-g,coverType:a});const f=Z(d,n);return u.params.actions=h.editOp(m.serialize(),f),!!l.syncExecuteCommand(u.id,u.params)}};function mt(i){var r,c,l,A;const t=i.get(s.IUniverInstanceService),n=i.get(D.DocSelectionManagerService).getActiveTextRange(),o=t.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);return!n||!n.collapsed||!o||n.segmentId?!1:s.BuildTextUtils.range.getParagraphsInRange(n,(c=(r=o.getBody())==null?void 0:r.paragraphs)!=null?c:[],(A=(l=o.getBody())==null?void 0:l.dataStream)!=null?A:"")[0]}const qt={id:"doc.command.delete-custom-block",type:s.CommandType.COMMAND,handler:async(i,t)=>{var x;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=e.getActiveTextRange(),r=n.getCurrentUniverDocInstance();if(a==null||r==null)return!1;const{direction:c,range:l,unitId:A,drawingId:d}=t,{startOffset:u,segmentId:m,style:h}=a,g=c===oe.LEFT?u-1:u,p=[{startOffset:g,endOffset:g,style:h}],f={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:p,prevTextRanges:[l]}},S=new s.TextX,E=s.JSONX.getInstance(),C=[];u>0&&S.push({t:s.TextXActionType.RETAIN,len:c===oe.LEFT?u-1:u}),S.push({t:s.TextXActionType.DELETE,len:1});const b=Z(r,m);C.push(E.editOp(S.serialize(),b));const R=((x=r.getDrawings())!=null?x:{})[d],O=r.getDrawingsOrder().indexOf(d),M=E.removeOp(["drawings",d],R),y=E.removeOp(["drawingsOrder",O],d);return C.push(M),C.push(y),f.params.actions=C.reduce((w,H)=>s.JSONX.compose(w,H),null),!!o.syncExecuteCommand(f.id,f.params)}},Jt={id:"doc.command.merge-two-paragraph",type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{direction:a,range:r}=t,c=e.getActiveTextRange(),l=e.getTextRanges();if(c==null||l==null)return!1;const{segmentId:A,style:d}=c,u=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),m=u==null?void 0:u.getSelfOrHeaderFooterModel(A).getBody();if(u==null||m==null)return!1;const h=m.dataStream,g=c,p=u.getUnitId(),{startOffset:f,collapsed:S}=g;if(!S)return!1;const E=a===oe.LEFT?f:f+1;let C,b;for(const V of m.paragraphs){if(V.startIndex>=E){b=V;break}C=V}if(C==null||b==null)return!1;const R=a===oe.LEFT?f-1:f,I=[{startOffset:R,endOffset:R,style:d}],O={id:D.RichTextEditingMutation.id,params:{unitId:p,actions:[],textRanges:I,prevTextRanges:[r]}},M=new s.TextX,y=s.JSONX.getInstance();C.startIndex>0&&M.push({t:s.TextXActionType.RETAIN,len:C.startIndex}),M.push({t:s.TextXActionType.DELETE,len:1}),b.startIndex>C.startIndex+1&&M.push({t:s.TextXActionType.RETAIN,len:b.startIndex-C.startIndex-1});const N=Object.values(s.DataStreamTreeTokenType),x=h[C.startIndex-1];(x&&!N.includes(x)||x===" ")&&M.push({t:s.TextXActionType.RETAIN,len:1,coverType:s.UpdateDocsAttributeType.REPLACE,body:{dataStream:"",paragraphs:[{...s.Tools.deepClone(C),startIndex:0}]}});const w=Z(u,A);return O.params.actions=y.editOp(M.serialize(),w),!!o.syncExecuteCommand(O.id,O.params)}},cs={id:"doc.command.remove-horizontal-line",type:s.CommandType.COMMAND,handler:async i=>{var R;const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getActiveTextRange(),a=t.getTextRanges();if(o==null||a==null)return!1;const{segmentId:r,style:c}=o,l=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),A=l==null?void 0:l.getSelfOrHeaderFooterModel(r).getBody();if(l==null||A==null)return!1;const d=o,u=l.getUnitId(),{startOffset:m,collapsed:h}=d;if(!h)return!1;const g=(R=A.paragraphs)==null?void 0:R.find(I=>I.startIndex===m-1);if(g==null)return!1;const p=[{startOffset:m,endOffset:m,style:c}],f={id:D.RichTextEditingMutation.id,params:{unitId:u,actions:[],textRanges:p}},S=new s.TextX,E=s.JSONX.getInstance();g.startIndex>0&&S.push({t:s.TextXActionType.RETAIN,len:g.startIndex}),S.push({t:s.TextXActionType.RETAIN,len:1,coverType:s.UpdateDocsAttributeType.REPLACE,body:{dataStream:"",paragraphs:[{...s.Tools.deepClone({...g,paragraphStyle:{...g.paragraphStyle,borderBottom:void 0}}),startIndex:0}]}});const C=Z(l,r);return f.params.actions=E.editOp(S.serialize(),C),!!n.syncExecuteCommand(f.id,f.params)}};function Zt(i,t){let e=0;if(i==null||i.length===0){if(typeof t[0].startOffset=="number"){const n=t[0],{spanEntireRow:o,spanEntireTable:a}=n;a?e=n.startOffset-3:o?n.startRow>0?e=n.startOffset-6:e=n.startOffset:e=t[0].startOffset}}else if(i.length>0&&t.length>0){const n=i[0],o=t[0];if(n.startOffset!=null&&o.startOffset!=null){if(n.startOffset<o.startOffset)e=n.startOffset;else if(n.startOffset>=o.startOffset){const{spanEntireRow:a,spanEntireTable:r}=o;r?e=o.startOffset-3:a&&(e=o.startOffset-6)}}}return e}const pt={id:"doc.command.delete-left",type:s.CommandType.COMMAND,handler:async i=>{var y,N,x,w,H,V;const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService);let o=!0;const a=e.getCurrentUniverDocInstance();if(a==null)return!1;const r=a.getUnitId(),c=re(i,r),l=t.getActiveTextRange(),A=t.getRectRanges(),d=t.getTextRanges(),u=c==null?void 0:c.getSkeleton();if(u==null)return!1;if(A!=null&&A.length){const F=Zt(d,A),Q=A[0].segmentId,j=[{startOffset:F,endOffset:F}];return n.executeCommand(Ve.id,{segmentId:Q,textRanges:j})}if(l==null||d==null)return!1;const{segmentId:m,style:h,segmentPage:g}=l,p=a.getSelfOrHeaderFooterModel(m).getBody();if(p==null)return!1;const f=l,{startOffset:S,collapsed:E}=f,C=u.findNodeByCharIndex(S,m,g),b=_.hasListGlyph(C),R=_.isIndentByGlyph(C,p);let I=S;const O=u.findNodeByCharIndex(S-1,m,g);if(_.isFirstGlyph(C)&&O!==C&&(b===!0||R===!0)&&E){const F=_.getParagraphByGlyph(C,p);if(F==null)return!1;const Q=F==null?void 0:F.startIndex,j={startIndex:0},G=F.paragraphStyle;if(b===!0){const W=F.paragraphStyle;if(W){j.paragraphStyle=W;const{hanging:z}=W;z&&(j.paragraphStyle.indentStart=z,j.paragraphStyle.hanging=void 0)}}else if(R===!0){const W=F.bullet;W&&(j.bullet=W),G!=null&&(j.paragraphStyle={...G},delete j.paragraphStyle.hanging,delete j.paragraphStyle.indentStart)}const k=[{startOffset:I,endOffset:I,style:h}];o=await n.executeCommand(ai.id,{unitId:a.getUnitId(),updateBody:{dataStream:"",paragraphs:[{...j}]},range:{startOffset:Q,endOffset:Q+1},textRanges:k,coverType:s.UpdateDocsAttributeType.REPLACE,segmentId:m})}else if(E===!0){if(O==null)return!0;if(O.content==="\r"){const F=(y=p.paragraphs)==null?void 0:y.find(Q=>Q.startIndex===S-1);(N=F==null?void 0:F.paragraphStyle)!=null&&N.borderBottom?o=await n.executeCommand(cs.id):o=await n.executeCommand(Jt.id,{direction:oe.LEFT,range:f})}else if(O.streamType==="\b"){const F=(w=a.getSnapshot().drawings)==null?void 0:w[(x=O.drawingId)!=null?x:""];if(F==null)return!0;const Q=(V=(H=a.getBody())==null?void 0:H.customBlocks)==null?void 0:V.find(G=>G.blockId===O.drawingId);if(F.layoutType===s.PositionedObjectLayoutType.INLINE||(Q==null?void 0:Q.blockType)===s.BlockType.CUSTOM){const G=a.getUnitId();o=await n.executeCommand(qt.id,{direction:oe.LEFT,range:l,unitId:G,drawingId:O.drawingId})}else{const G=u.findNodeByCharIndex(S-2);if(G==null)return!0;I-=O.count,I-=G.count;const k=[{startOffset:I,endOffset:I,style:h}];o=await n.executeCommand(Ze.id,{unitId:a.getUnitId(),range:{...l,startOffset:l.startOffset-1,endOffset:l.endOffset-1},segmentId:m,direction:oe.LEFT,len:G.count,textRanges:k})}}else I-=O.count,o=await n.executeCommand(Ze.id,{unitId:a.getUnitId(),range:f,segmentId:m,direction:oe.LEFT,len:O.count})}else{const F=ls(f,[f]);o=await n.executeCommand(Ve.id,{segmentId:m,textRanges:F,selections:[f]})}return o}},ri={id:"doc.command.delete-right",type:s.CommandType.COMMAND,handler:async i=>{var C,b;const t=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(!n)return!1;const o=re(i,n.getUnitId()),a=i.get(s.ICommandService),r=t.getActiveTextRange(),c=t.getRectRanges(),l=t.getTextRanges(),A=o==null?void 0:o.getSkeleton();if(c!=null&&c.length){const R=Zt(l,c),I=c[0].segmentId,O=[{startOffset:R,endOffset:R}];return a.executeCommand(Ve.id,{segmentId:I,textRanges:O})}if(r==null||A==null||l==null)return!1;const{segmentId:d,style:u,segmentPage:m}=r,h=n==null?void 0:n.getSelfOrHeaderFooterModel(d).getBody();if(!n||!h)return!1;const g=r,{startOffset:p,endOffset:f,collapsed:S}=g;if(p===h.dataStream.length-2&&S)return!0;let E=!1;if(S===!0){const R=A.findNodeByCharIndex(p,d,m),I=A.findNodeByCharIndex(p+1);if(R.streamType===s.DataStreamTreeTokenType.PARAGRAPH&&(I==null?void 0:I.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK)return!1;if(R.content==="\r")E=await a.executeCommand(Jt.id,{direction:oe.RIGHT,range:r});else if(R.streamType==="\b"){const O=(b=n.getSnapshot().drawings)==null?void 0:b[(C=R.drawingId)!=null?C:""];if(O==null)return!0;if(O.layoutType===s.PositionedObjectLayoutType.INLINE){const y=n.getUnitId();E=await a.executeCommand(qt.id,{direction:oe.RIGHT,range:r,unitId:y,drawingId:R.drawingId})}else{if(I==null)return!0;const y=[{startOffset:p+1,endOffset:p+1,style:u}];E=await a.executeCommand(Ze.id,{unitId:n.getUnitId(),range:{...r,startOffset:p+1,endOffset:f+1},segmentId:d,direction:oe.RIGHT,textRanges:y,len:I.count})}}else{const O=[{startOffset:p,endOffset:p,style:u}];E=await a.executeCommand(Ze.id,{unitId:n.getUnitId(),range:g,segmentId:d,direction:oe.RIGHT,textRanges:O,len:R.count})}}else{const R=ls(g,[g]);E=await a.executeCommand(Ve.id,{segmentId:d,textRanges:R,selections:[g]})}return E}};function ls(i,t){let e=i.endOffset;for(const o of t){const{startOffset:a,endOffset:r}=o;a==null||r==null||r<=i.endOffset&&(e-=r-a)}return[{startOffset:e,endOffset:e,style:i.style}]}const ci={id:"doc.command.delete-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{var A,d;const t=i.get(s.IUniverInstanceService),e=i.get(s.ICommandService),n=t.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!n)return!1;const o=(d=(A=n.getBody())==null?void 0:A.dataStream)!=null?d:"",a=mt(i);if(!a)return!1;const r=s.BuildTextUtils.selection.delete([{startOffset:a.paragraphStart,endOffset:o[a.paragraphEnd+1]===`
199
201
  `?a.paragraphEnd:a.paragraphEnd+1,collapsed:!1}],n.getBody(),0,void 0,!0),c=Z(n),l={unitId:n.getUnitId(),actions:s.JSONX.getInstance().editOp(r,c),textRanges:[{startOffset:a.paragraphStart,endOffset:a.paragraphStart,collapsed:!0}]};return e.syncExecuteCommand(D.RichTextEditingMutation.id,l)}},Hr=10,kr=6;function Vr(){return s.Tools.generateRandomId(kr)}function Wr(i){const t=i.match(/data-copy-id="([^\s]+)"/);return t&&t[1]?t[1]:null}class zr{constructor(){B(this,"_cache",new s.LRUMap(Hr))}set(t,e){this._cache.set(t,e)}get(t){return this._cache.get(t)}clear(){this._cache.clear()}}const li=new zr;function di(i){const t=i.style,e={},n=i.tagName.toLowerCase();switch(n){case"b":case"em":case"strong":{e.bl=s.BooleanNumber.TRUE;break}case"s":{e.st={s:s.BooleanNumber.TRUE};break}case"u":{e.ul={s:s.BooleanNumber.TRUE};break}case"i":{e.it=s.BooleanNumber.TRUE;break}case"sub":case"sup":{e.va=n==="sup"?s.BaselineOffset.SUPERSCRIPT:s.BaselineOffset.SUBSCRIPT;break}}for(let o=0;o<t.length;o++){const a=t[o],r=t.getPropertyValue(a);switch(a){case"font-family":{e.ff=r.replace(/^"/g,"").replace(/"$/g,"");break}case"font-size":{const c=Number.parseInt(r);Number.isNaN(c)||(r.endsWith("pt")?e.fs=c:r.endsWith("px")&&(e.fs=_.pixelToPt(c)));break}case"font-style":{r==="italic"&&(e.it=s.BooleanNumber.TRUE);break}case"font-weight":{(Number(r)>400||String(r)==="bold")&&(e.bl=s.BooleanNumber.TRUE);break}case"text-decoration":{/underline/.test(r)?e.ul={s:s.BooleanNumber.TRUE}:/overline/.test(r)?e.ol={s:s.BooleanNumber.TRUE}:/line-through/.test(r)&&(e.st={s:s.BooleanNumber.TRUE});break}case"color":{try{const c=new s.ColorKit(r);c.isValid&&(e.cl={rgb:c.toRgbString()})}catch{}break}case"background-color":{const c=new s.ColorKit(r);c.isValid&&(e.bg={rgb:c.toRgbString()});break}}}return e}function Gr(i){const t=new DOMParser,e=`<x-univer id="univer-root">${i}</x-univer>`;return t.parseFromString(e,"text/html").querySelector("#univer-root")}function ds(i,t){const e=i.tagName.toLowerCase();return typeof t=="string"?e===t:Array.isArray(t)?t.some(n=>n===e):t(i)}const As=660,xn=class xn{constructor(){B(this,"_tableCache",[]);B(this,"_styleCache",new Map);B(this,"_styleRules",[]);B(this,"_afterProcessRules",[])}static use(t){if(this._pluginList.includes(t))throw new Error(`Univer paste plugin ${t.name} already added`);this._pluginList.push(t)}convert(t,e={}){var c;const n=xn._pluginList.find(l=>l.checkPasteType(t)),o=Gr(t),r={body:{dataStream:"",paragraphs:[],sectionBreaks:[],tables:[],textRuns:[],customBlocks:[]},tableSource:{},id:(c=e==null?void 0:e.unitId)!=null?c:""};return n&&(this._styleRules=[...n.stylesRules],this._afterProcessRules=[...n.afterProcessRules]),this._tableCache=[],this._styleCache.clear(),this._process(null,o.childNodes,r),this._styleCache.clear(),this._styleRules=[],this._afterProcessRules=[],r}_process(t,e,n){var a,r,c,l;const o=n.body;for(const A of e)if(A.nodeType===Node.TEXT_NODE){if(((a=A.nodeValue)==null?void 0:a.trim())==="")continue;const d=(r=A.nodeValue)==null?void 0:r.replace(/[\r\n]/g,"");let u;t&&this._styleCache.has(t)&&(u=this._styleCache.get(t)),o.dataStream+=d,u&&Object.getOwnPropertyNames(u).length&&o.textRuns.push({st:o.dataStream.length-d.length,ed:o.dataStream.length,ts:u})}else if(A.nodeName==="IMG"){const d=A,u=d.dataset.imageSourceType,m=u===Dn.ImageSourceType.UUID?d.dataset.source:d.src;if(m&&u){const h=Number(d.dataset.width||100),g=Number(d.dataset.height||100),p=Number(d.dataset.docTransformWidth||h),f=Number(d.dataset.docTransformHeight||g),S=s.Tools.generateRandomId(6);(l=(c=n.body)==null?void 0:c.customBlocks)==null||l.push({startIndex:o.dataStream.length,blockId:S}),o.dataStream+="\b",n.drawings||(n.drawings={}),n.drawings[S]={drawingId:S,title:"",description:"",imageSourceType:u,source:m,transform:{width:h,height:g,left:0},docTransform:{size:{width:p,height:f},angle:0,positionH:{relativeFrom:s.ObjectRelativeFromH.PAGE,posOffset:0},positionV:{relativeFrom:s.ObjectRelativeFromV.PARAGRAPH,posOffset:0}},layoutType:s.PositionedObjectLayoutType.INLINE,drawingType:s.DrawingTypeEnum.DRAWING_IMAGE,unitId:n.id||"",subUnitId:n.id||""}}}else{if(s.skipParseTagNames.includes(A.nodeName.toLowerCase()))continue;if(A.nodeType===Node.ELEMENT_NODE){const d=A,u=this._processBeforeLink(d,n),m=t?this._styleCache.get(t):{},h=this._styleRules.find(({filter:S})=>ds(A,S)),g=h?h.getStyle(A):di(A);this._styleCache.set(A,{...m,...g});const{childNodes:p}=A;this._processBeforeTable(A,n),this._process(A,p,n),this._processAfterTable(A,n);const f=this._afterProcessRules.find(({filter:S})=>ds(A,S));f&&f.handler(n,A),this._processAfterLink(d,n,u)}}}_processBeforeTable(t,e){var a;const n=t.tagName.toUpperCase(),o=e.body;switch(n){case"TABLE":{o.dataStream[o.dataStream.length-1]!=="\r"&&(o.dataStream+="\r",o.paragraphs==null&&(o.paragraphs=[]),(a=o.paragraphs)==null||a.push({startIndex:o.dataStream.length-1}));const r=ni(0,0,As);this._tableCache.push({table:r,startIndex:o.dataStream.length}),o.dataStream+=s.DataStreamTreeTokenType.TABLE_START;break}case"TR":{const r=Kt(0);this._tableCache[this._tableCache.length-1].table.tableRows.push(r),o.dataStream+=s.DataStreamTreeTokenType.TABLE_ROW_START;break}case"TD":{const r=Xt(),c=this._tableCache[this._tableCache.length-1].table;c.tableRows[c.tableRows.length-1].tableCells.push(r),o.dataStream+=s.DataStreamTreeTokenType.TABLE_CELL_START;break}}}_processAfterTable(t,e){var r,c;const n=t.tagName.toUpperCase(),o=e.body;e.tableSource==null&&(e.tableSource={}),o.tables==null&&(o.tables=[]),o.sectionBreaks==null&&(o.sectionBreaks=[]);const{tableSource:a}=e;switch(n){case"TABLE":{const l=this._tableCache.pop(),{startIndex:A,table:d}=l,u=d.tableRows[0].tableCells.length,m=Yt(As/u),h=[...new Array(u).fill(null).map(()=>s.Tools.deepClone(m))];d.tableColumns=h,a[d.tableId]=d,o.dataStream+=s.DataStreamTreeTokenType.TABLE_END,o.tables.push({startIndex:A,endIndex:o.dataStream.length,tableId:d.tableId});break}case"TR":{o.dataStream+=s.DataStreamTreeTokenType.TABLE_ROW_END;break}case"TD":{o.dataStream[o.dataStream.length-1]!=="\r"&&((r=o.paragraphs)==null||r.push({startIndex:o.dataStream.length}),o.dataStream+="\r"),(c=o.sectionBreaks)==null||c.push({startIndex:o.dataStream.length}),o.dataStream+=`
200
202
  ${s.DataStreamTreeTokenType.TABLE_CELL_END}`;break}}}_processBeforeLink(t,e){return e.body.dataStream.length}_processAfterLink(t,e,n){var r,c;const o=e.body,a=t;a.tagName.toUpperCase()==="A"&&(o.customRanges=(r=o.customRanges)!=null?r:[],o.customRanges.push({startIndex:n,endIndex:o.dataStream.length-1,rangeId:(c=a.dataset.rangeid)!=null?c:s.generateRandomId(),rangeType:s.CustomRangeType.HYPERLINK,properties:{url:a.href}}))}};B(xn,"_pluginList",[]);let $e=xn;const us={name:"univer-doc-paste-plugin-lark",checkPasteType(i){return/lark-record-clipboard/i.test(i)},stylesRules:[{filter:["s"],getStyle(i){const t=di(i);return{st:{s:s.BooleanNumber.TRUE},...t}}}],afterProcessRules:[{filter(i){return i.tagName==="DIV"&&/ace-line/i.test(i.className)},handler(i){const t=i.body;t.paragraphs==null&&(t.paragraphs=[]),t.paragraphs.push({startIndex:t.dataStream.length}),t.dataStream+="\r"}}]};function hs(i){const t=i.style,e={};for(let n=0;n<t.length;n++){const o=t[n],a=t.getPropertyValue(o);switch(o){case"margin-top":{const r=Number.parseInt(a);e.spaceAbove={v:/pt/.test(a)?_.ptToPixel(r):r};break}case"margin-bottom":{const r=Number.parseInt(a);e.spaceBelow={v:/pt/.test(a)?_.ptToPixel(r):r};break}case"line-height":{let r=Number.parseFloat(a);a.endsWith("%")&&(r/=100),e.lineSpacing=r;break}}}return Object.getOwnPropertyNames(e).length?e:null}const gs={name:"univer-doc-paste-plugin-univer",checkPasteType(i){return/UniverNormal/i.test(i)},stylesRules:[],afterProcessRules:[{filter(i){return i.tagName==="P"&&/UniverNormal/i.test(i.className)},handler(i,t){const e=i.body;e.paragraphs==null&&(e.paragraphs=[]);const n={startIndex:e.dataStream.length},o=hs(t);o&&(n.paragraphStyle=o),e.paragraphs.push(n),e.dataStream+="\r"}}]},ms={name:"univer-doc-paste-plugin-word",checkPasteType(i){return/word|mso/i.test(i)},stylesRules:[{filter:["b"],getStyle(i){const t=di(i);return{bl:s.BooleanNumber.TRUE,...t}}}],afterProcessRules:[{filter(i){return i.tagName==="P"},handler(i,t){const e=i.body;e.paragraphs==null&&(e.paragraphs=[]);const n={startIndex:e.dataStream.length},o=hs(t);o&&(n.paragraphStyle=o),e.paragraphs.push(n),e.dataStream+="\r"}}]};function jr(i){var n,o;const t=a=>{let r="";return Object.keys(a).forEach(c=>{a[c]!==void 0&&(r+=` ${c}=${a[c]}`)}),r},e={"data-doc-transform-height":i.docTransform.size.height,"data-doc-transform-width":i.docTransform.size.width,"data-width":(n=i.transform)==null?void 0:n.width,"data-height":(o=i.transform)==null?void 0:o.height,"data-image-source-type":i.imageSourceType,"data-source":i.imageSourceType===Dn.ImageSourceType.UUID?i.source:void 0,src:i.source};return`<img ${t(e)}></img>`}function ps(i,t){const{st:e,ed:n,ts:o={}}=t,{ff:a,fs:r,it:c,bl:l,ul:A,st:d,ol:u,bg:m,cl:h,va:g}=o;let p=i.slice(e,n);const f=[];return c===s.BooleanNumber.TRUE&&(p=`<i>${p}</i>`),g===s.BaselineOffset.SUPERSCRIPT?p=`<sup>${p}</sup>`:g===s.BaselineOffset.SUBSCRIPT&&(p=`<sub>${p}</sub>`),(A==null?void 0:A.s)===s.BooleanNumber.TRUE&&(p=`<u>${p}</u>`),(d==null?void 0:d.s)===s.BooleanNumber.TRUE&&(p=`<s>${p}</s>`),l===s.BooleanNumber.TRUE&&(p=`<strong>${p}</strong>`),a&&f.push(`font-family: ${a}`),h&&f.push(`color: ${h.rgb}`),r&&f.push(`font-size: ${r}pt`),u&&f.push("text-decoration: overline"),m&&f.push(`background: ${m.rgb}`),f.length?`<span style="${f.join("; ")};">${p}</span>`:p}function Ai(i,t,e){const{dataStream:n,textRuns:o=[]}=i;if(t===e)return"";let a=t;const r=[];for(const c of o){const{st:l,ed:A}=c;s.Tools.hasIntersectionBetweenTwoRanges(t,e,l,A)&&(l>a?(r.push(n.slice(a,l)),r.push(ps(n,{...c,ed:Math.min(A,e)}))):r.push(ps(n,{...c,st:a,ed:Math.min(A,e)}))),a=Math.max(t,Math.min(A,e))}return a!==e&&r.push(n.slice(a,e)),r.join("")}function Xr(i,t,e){const n=i.body,o=i.drawings||{},{customRanges:a=[],customBlocks:r=[]}=n||{},c=[...r],l=a.filter(h=>h.startIndex>=t&&h.endIndex<=e);let A=t,d="";const u=(h,g)=>{let p="",f=0,S=h,E=c.findIndex(C=>h<=C.startIndex&&g>=C.startIndex);if(E===-1)return p=Ai(n,h,g),{sliceHtml:p,customBlockLength:f};for(;E!==-1;){const C=c[E];c.splice(E,1),p+=Ai(n,S,C.startIndex);const b=o[C.blockId];if(b)switch(b.drawingType){case s.DrawingTypeEnum.DRAWING_IMAGE:{p+=jr(b),f++;break}}S=C.startIndex+1,E=c.findIndex(R=>S<=R.startIndex&&g>=R.startIndex)}return p=p+Ai(n,S,g+1),{sliceHtml:p,customBlockLength:f}};l.forEach(h=>{var b,R;const{startIndex:g,endIndex:p,rangeType:f,rangeId:S}=h,E=u(A,g);d+=E.sliceHtml;const C=u(g,p+1);switch(f){case s.CustomRangeType.HYPERLINK:{d+=`<a data-rangeid="${S}" href="${(R=(b=h.properties)==null?void 0:b.url)!=null?R:""}">${C.sliceHtml}</a>`;break}default:{d+=C.sliceHtml;break}}A=p+1+(E.customBlockLength+C.customBlockLength)});const m=u(A,e);return d+=m.sliceHtml,d}function fs(i){const t=i.body||{},{paragraphs:e=[],sectionBreaks:n=[]}=t;let{dataStream:o=""}=t;o.endsWith(`\r
201
203
  `)||(o+=`\r
202
204
  `,e.push({startIndex:o.length-2}),n.push({startIndex:o.length-1}),t.dataStream=o,t.paragraphs=e,t.sectionBreaks=n);const a={html:""},r=_.parseDataStreamToTree(o).sectionList;for(const c of r)et(c,i,a);return a.html}function et(i,t,e){var n,o;switch(i.nodeType){case s.DataStreamTreeNodeType.SECTION_BREAK:{for(const a of i.children)et(a,t,e);break}case s.DataStreamTreeNodeType.PARAGRAPH:{const{children:a,startIndex:r,endIndex:c}=i,l=(o=(n=t.body)==null?void 0:n.paragraphs.find(g=>g.startIndex===c))!=null?o:{},{paragraphStyle:A={}}=l,{spaceAbove:d,spaceBelow:u,lineSpacing:m}=A,h=[];if(d!=null&&(typeof d=="number"?h.push(`margin-top: ${d}px`):h.push(`margin-top: ${d.v}px`)),u!=null&&(typeof u=="number"?h.push(`margin-bottom: ${u}px`):h.push(`margin-bottom: ${u.v}px`)),m!=null&&h.push(`line-height: ${m}`),e.html+=`<p class="UniverNormal" ${h.length?`style="${h.join("; ")};"`:""}>`,a.length)for(const g of a)et(g,t,e);e.html+=`${Xr(t,r,c)}</p>`;break}case s.DataStreamTreeNodeType.TABLE:{const{children:a}=i;e.html+='<table class="UniverTable" style="width: 100%; border-collapse: collapse;"><tbody>';for(const r of a)et(r,t,e);e.html+="</tbody></table>";break}case s.DataStreamTreeNodeType.TABLE_ROW:{const{children:a}=i;e.html+='<tr class="UniverTableRow">';for(const r of a)et(r,t,e);e.html+="</tr>";break}case s.DataStreamTreeNodeType.TABLE_CELL:{const{children:a}=i;e.html+='<td class="UniverTableCell">';for(const r of a)et(r,t,e);e.html+="</td>";break}default:throw new Error(`Unknown node type: ${i.nodeType}`)}}class Kr{convert(t){if(t.length===0)throw new Error("The bodyList length at least to be 1");let e="";for(const n of s.Tools.deepClone(t))e+=fs(n);return e}}var Yr=Object.getOwnPropertyDescriptor,qr=(i,t,e,n)=>{for(var o=n>1?void 0:n?Yr(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ft=(i,t)=>(e,n)=>t(e,n,i);$e.use(ms),$e.use(us),$e.use(gs);function Ss(i,t,e){var a,r,c;const n=s.getBodySlice(i,t,e+2),o=s.DataStreamTreeTokenType.TABLE_START+s.DataStreamTreeTokenType.TABLE_ROW_START+s.DataStreamTreeTokenType.TABLE_CELL_START+n.dataStream+s.DataStreamTreeTokenType.TABLE_CELL_END+s.DataStreamTreeTokenType.TABLE_ROW_END+s.DataStreamTreeTokenType.TABLE_END;return n.dataStream=o,(a=n.textRuns)==null||a.forEach(l=>{const{st:A,ed:d}=l;l.st=A+3,l.ed=d+3}),(r=n.tables)==null||r.forEach(l=>{const{startIndex:A,endIndex:d}=l;l.startIndex=A+3,l.endIndex=d+3}),(c=n.paragraphs)==null||c.forEach(l=>{const{startIndex:A}=l;l.startIndex=A+3}),n}const xe=s.createIdentifier("doc.clipboard-service");let ui=class extends s.Disposable{constructor(t,e,n,o,a){super();B(this,"_clipboardHooks",[]);B(this,"_htmlToUDM",new $e);B(this,"_umdToHtml",new Kr);this._univerInstanceService=t,this._logService=e,this._commandService=n,this._clipboardInterfaceService=o,this._docSelectionManagerService=a}async copy(t=s.SliceBodyType.copy,e){var c,l;const{newSnapshotList:n=[],needCache:o=!1,snapshot:a,ranges:r}=(c=this._getDocumentBodyInRanges(t,e))!=null?c:{};if(n.length===0||a==null)return!1;try{const A=!!((l=r==null?void 0:r[0])!=null&&l.segmentId);this._setClipboardData(n,!A&&o)}catch(A){return this._logService.error("[DocClipboardService] copy failed",A),!1}return!0}async cut(t){return this._cut(t)}async paste(t){const e=await this._genDocDataFromClipboardItems(t);return this._paste(e)}async legacyPaste(t){let{html:e,text:n,files:o}=t;const a=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=(a==null?void 0:a.getUnitId())||"";!e&&!n&&o.length&&(e=await this._createImagePasteHtml(o));const c=this._genDocDataFromHtmlAndText(e,n,r);if(r===s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY)if(n){const l=s.BuildTextUtils.transform.fromPlainText(n);return this._paste({body:l})}else c.body.textRuns=[];return this._paste(c)}async _cut(t){var c,l,A,d,u;const e=(l=(c=t==null?void 0:t.filter(m=>m.rangeType===s.DOC_RANGE_TYPE.TEXT))!=null?c:this._docSelectionManagerService.getTextRanges())!=null?l:[],n=(d=(A=t==null?void 0:t.filter(m=>m.rangeType===s.DOC_RANGE_TYPE.RECT))!=null?A:this._docSelectionManagerService.getRectRanges())!=null?d:[],{segmentId:o,endOffset:a,style:r}=(u=e[0])!=null?u:{};if(o==null&&this._logService.error("[DocClipboardController] segmentId is not existed"),e.length===0&&n.length===0)return!1;this.copy(s.SliceBodyType.cut,t);try{let m=0;if(n.length>0)m=Zt(e,n);else if(a!=null){m=a;for(const g of e){const{startOffset:p,endOffset:f}=g;p==null||f==null||f<=a&&(m-=f-p)}}const h=[{startOffset:m,endOffset:m,style:r}];return this._commandService.executeCommand(Ve.id,{segmentId:o,textRanges:h,rectRanges:n,selections:e})}catch{return this._logService.error("[DocClipboardController] cut content failed"),!1}}async _paste(t){var d,u,m;const{body:e}=t;if(e==null)return!1;let n=s.normalizeBody(e);if(!((d=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:d.getUnitId()))return!1;this._clipboardHooks.forEach(h=>{h.onBeforePaste&&(n=h.onBeforePaste(n))}),n.customRanges=(u=n.customRanges)==null?void 0:u.map(s.BuildTextUtils.customRange.copyCustomRange),(m=n.paragraphs)==null||m.forEach(h=>{var g;(g=h.paragraphStyle)!=null&&g.headingId&&(h.paragraphStyle.headingId=s.generateRandomId(6))});const a=this._docSelectionManagerService.getActiveTextRange(),{segmentId:r,endOffset:c,style:l}=a||{},A=this._docSelectionManagerService.getTextRanges();if(r==null&&this._logService.error("[DocClipboardController] segmentId does not exist!"),c==null||A==null)return!1;try{let h=c;for(const p of A){const{startOffset:f,endOffset:S}=p;f==null||S==null||S<=c&&(h+=n.dataStream.length-(S-f))}const g=[{startOffset:h,endOffset:h,style:l}];return this._commandService.executeCommand(oi.id,{doc:{...t,body:n},segmentId:r,textRanges:g})}catch{return this._logService.error("[DocClipboardController]","clipboard is empty."),!1}}async _setClipboardData(t,e=!0){var r,c,l,A;const n=Vr(),o=(t.length>1?t.map(d=>{var u;return((u=d.body)==null?void 0:u.dataStream)||""}).join(`
203
205
  `):((r=t[0].body)==null?void 0:r.dataStream)||"").replaceAll(s.DataStreamTreeTokenType.TABLE_START,"").replaceAll(s.DataStreamTreeTokenType.TABLE_END,"").replaceAll(s.DataStreamTreeTokenType.TABLE_ROW_START,"").replaceAll(s.DataStreamTreeTokenType.TABLE_ROW_END,"").replaceAll(s.DataStreamTreeTokenType.TABLE_CELL_START,"").replaceAll(s.DataStreamTreeTokenType.TABLE_CELL_END,"").replaceAll(`\r
204
- `," ");let a=this._umdToHtml.convert(t);if(t.length===1&&e){a=a.replace(/(<[a-z]+)/,(m,h)=>`${h} data-copy-id="${n}"`);const d=t[0],u={body:d.body};if((l=(c=d.body)==null?void 0:c.customBlocks)!=null&&l.length){u.drawings={};for(const m of d.body.customBlocks){const{blockId:h}=m,g=(A=d.drawings)==null?void 0:A[h];if(g){const p=s.Tools.generateRandomId(6);m.blockId=p,u.drawings[p]={...s.Tools.deepClone(g),drawingId:p}}}}li.set(n,u)}return this._clipboardInterfaceService.write(o,a)}addClipboardHook(t){return this._clipboardHooks.push(t),s.toDisposable(()=>{const e=this._clipboardHooks.indexOf(t);e>-1&&this._clipboardHooks.splice(e,1)})}_getDocumentBodyInRanges(t,e){var d;const n=this._univerInstanceService.getCurrentUniverDocInstance(),o=e!=null?e:this._docSelectionManagerService.getDocRanges(),a=[];let r=!0;if(n==null||o.length===0)return;const c=o[0].segmentId,l=(d=n==null?void 0:n.getSelfOrHeaderFooterModel(c))==null?void 0:d.getBody(),A=n.getSnapshot();if(l!=null){for(const u of o){const{startOffset:m,endOffset:h,collapsed:g,rangeType:p}=u;if(g||m==null||h==null)continue;if(p===s.DOC_RANGE_TYPE.RECT){r=!1;const{spanEntireRow:E}=u;let C;C=Ss(l,m,h),a.push(C);continue}const f={startOffset:m,endOffset:h},S=n.getSelfOrHeaderFooterModel(c).sliceBody(f.startOffset,f.endOffset,t);S!=null&&a.push(S)}return{newSnapshotList:a.map(u=>({...A,body:u})),needCache:r,snapshot:A,ranges:o}}}async _genDocDataFromClipboardItems(t){try{let e="",n="";const o=[];for(const a of t)for(const r of a.types)switch(r){case I.PLAIN_TEXT_CLIPBOARD_MIME_TYPE:{n=await a.getType(r).then(c=>c&&c.text());break}case I.HTML_CLIPBOARD_MIME_TYPE:{e=await a.getType(r).then(c=>c&&c.text());break}case I.FILE__BMP_CLIPBOARD_MIME_TYPE:case I.FILE__JPEG_CLIPBOARD_MIME_TYPE:case I.FILE__WEBP_CLIPBOARD_MIME_TYPE:case I.FILE_PNG_CLIPBOARD_MIME_TYPE:{const c=await a.getType(r),l=new File([c],`pasted_image.${r.split("/")[1]}`,{type:r});o.push(l);break}}return!e&&!n&&o.length&&(e=await this._createImagePasteHtml(o)),this._genDocDataFromHtmlAndText(e,n)}catch(e){return Promise.reject(e)}}_genDocDataFromHtmlAndText(t,e,n){if(!t){if(e)return{body:s.BuildTextUtils.transform.fromPlainText(e)};throw new Error("[DocClipboardService] html and text cannot be both empty!")}const o=Wr(t);if(o){const r=li.get(o);if(r)return r}if(!n){const r=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);n=(r==null?void 0:r.getUnitId())||""}const a=this._htmlToUDM.convert(t,{unitId:n});return o&&li.set(o,a),a}async _createImagePasteHtml(t){var c,l;const e={id:"",documentStyle:{},body:{dataStream:"",customBlocks:[]},drawings:{}},n=async A=>{const d=new FileReader;return new Promise(u=>{d.onloadend=function(){u({source:d.result,imageSourceType:Dn.ImageSourceType.BASE64})},d.readAsDataURL(A)})},o=A=>{const d=new Image,u=500;return new Promise(m=>{d.src=typeof A=="string"?A:URL.createObjectURL(A),d.onload=()=>{const h=Math.min(u,d.naturalWidth),g=d.naturalHeight/d.naturalWidth;m({width:h,height:h*g})}})},a=(l=(c=this._clipboardHooks.find(A=>A.onBeforePasteImage))==null?void 0:c.onBeforePasteImage)!=null?l:n;return await Promise.all(t.map(async(A,d)=>{var S;const u=await a(A);if(!u)return Promise.resolve();const{width:m=100,height:h=100}=await o(A),g=`paste_image_id_${d}`,p=e.body,f=e.drawings;p.dataStream+="\b",(S=p.customBlocks)==null||S.push({startIndex:d,blockId:g}),f[g]={drawingId:g,unitId:"",subUnitId:"",imageSourceType:u.imageSourceType,title:"",source:u.source,description:"",layoutType:s.PositionedObjectLayoutType.INLINE,drawingType:s.DrawingTypeEnum.DRAWING_IMAGE,transform:{width:m,height:h,angle:0},docTransform:{angle:0,size:{width:m,height:h},positionH:{relativeFrom:s.ObjectRelativeFromH.CHARACTER,posOffset:0},positionV:{relativeFrom:s.ObjectRelativeFromV.LINE,posOffset:0}}}})),this._umdToHtml.convert([e])}};ui=qr([ft(0,s.IUniverInstanceService),ft(1,s.ILogService),ft(2,s.ICommandService),ft(3,I.IClipboardInterfaceService),ft(4,s.Inject(D.DocSelectionManagerService))],ui);function $t(i){return i.getContextValue(s.FOCUSING_DOC)||i.getContextValue(s.EDITOR_ACTIVATED)}const hi=999,St={id:I.CopyCommand.id,name:"doc.command.copy",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>i.get(xe).copy()},gi={id:"doc.command.copy-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(xe),e=mt(i);return e?t.copy(s.SliceBodyType.copy,[{startOffset:e.paragraphStart,endOffset:e.paragraphEnd+1,collapsed:!1}]):!1}},en={id:I.CutCommand.id,name:"doc.command.cut",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>i.get(xe).cut()},mi={id:"doc.command.cut-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(xe),e=mt(i);return e?t.cut([{startOffset:e.paragraphStart,endOffset:e.paragraphEnd+1,collapsed:!1,rangeType:s.DOC_RANGE_TYPE.TEXT}]):!1}},tn={id:I.PasteCommand.id,name:"doc.command.paste",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>{const t=i.get(xe),n=await i.get(I.IClipboardInterfaceService).read();return n.length===0?!1:t.paste(n)}};var Jr=Object.getOwnPropertyDescriptor,Zr=(i,t,e,n)=>{for(var o=n>1?void 0:n?Jr(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},pi=(i,t)=>(e,n)=>t(e,n,i);const $r=11,ec=9,nn={ff:"Arial",fs:$r};let Te=class extends s.Disposable{constructor(t,e,n){super();B(this,"_cacheStyle",null);this._textSelectionManagerService=t,this._univerInstanceService=e,this._renderManagerService=n,this._init()}_init(){this._listenDocRangeChange()}_listenDocRangeChange(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(()=>{this._clearStyleCache()}))}getStyleCache(){return this._cacheStyle}getDefaultStyle(){var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(t==null)return{...nn};const e=t==null?void 0:t.getUnitId(),n=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.with(D.DocSkeletonManagerService),o=n==null?void 0:n.getViewModel();return o==null?{...nn}:o.getEditArea()===_.DocumentEditArea.BODY?{...nn}:{...nn,fs:ec}}setStyleCache(t){this._cacheStyle={...this._cacheStyle,...t}}_clearStyleCache(){this._cacheStyle=null}};Te=Zr([pi(0,s.Inject(D.DocSelectionManagerService)),pi(1,s.IUniverInstanceService),pi(2,_.IRenderManagerService)],Te);function fi(i,t,e){const n=[];for(let o=0,a=i.length;o<a;o++)i[o]===s.DataStreamTreeTokenType.PARAGRAPH&&n.push({startIndex:o});if(t)for(const o of n)t.bullet&&(o.bullet=s.Tools.deepClone(t.bullet)),t.paragraphStyle&&(o.paragraphStyle=s.Tools.deepClone(t.paragraphStyle),delete o.paragraphStyle.borderBottom,t.paragraphStyle.headingId&&(o.paragraphStyle.headingId=s.generateRandomId(6)));if(e)for(const o of n)o.paragraphStyle||(o.paragraphStyle={}),o.paragraphStyle.borderBottom=e;return n}const on={id:"doc.command.break-line",type:s.CommandType.COMMAND,handler:(i,t)=>{var Q,j,G,k,W;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=i.get(Te),r=(Q=t==null?void 0:t.textRange)!=null?Q:e.getActiveTextRange(),c=e.getRectRanges();if(r==null)return!1;if(c&&c.length){const{startOffset:z}=r;return e.replaceDocRanges([{startOffset:z,endOffset:z}]),!0}const{horizontalLine:l}=t!=null?t:{},{segmentId:A}=r,d=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A!=null?A:"").getBody();if(d==null||u==null)return!1;const m=d.getUnitId(),{startOffset:h,endOffset:g}=r,f=((j=u.paragraphs)!=null?j:[]).find(z=>z.startIndex>=h);if(!f)return!1;const S=h===f.startIndex,E=f.startIndex,C=a.getDefaultStyle(),b=a.getStyleCache(),R=Qt(u,g,C,b),v={dataStream:s.DataStreamTreeTokenType.PARAGRAPH,paragraphs:fi(s.DataStreamTreeTokenType.PARAGRAPH,f,l),textRuns:[{st:0,ed:1,ts:{...R.ts}}]};if(d==null)return!1;const O=e.getActiveTextRange();if(u==null)return!1;const{collapsed:M}=r,y=v.dataStream.length,N=[{startOffset:h+y,endOffset:h+y,style:O==null?void 0:O.style,collapsed:M}],x={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:N,debounce:!0}},w=new s.TextX,H=s.JSONX.getInstance();if(M)h>0&&w.push({t:s.TextXActionType.RETAIN,len:h}),w.push({t:s.TextXActionType.INSERT,body:v,len:v.dataStream.length});else{const z=s.BuildTextUtils.selection.delete([r],u,0,v);w.push(...z)}(((G=f.bullet)==null?void 0:G.listType)===s.PresetListType.CHECK_LIST_CHECKED||(k=f.paragraphStyle)!=null&&k.headingId)&&(r.endOffset<E&&w.push({t:s.TextXActionType.RETAIN,len:E-r.endOffset}),w.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...f,paragraphStyle:{...f.paragraphStyle,...S?{headingId:void 0,namedStyleType:void 0}:null},startIndex:0,bullet:(W=f.paragraphStyle)!=null&&W.headingId?void 0:{...f.bullet,listType:s.PresetListType.CHECK_LIST}}]},coverType:s.UpdateDocsAttributeType.REPLACE})),x.params.textRanges=[{startOffset:h+y,endOffset:h+y,collapsed:M}];const V=Z(d,A);return x.params.actions=H.editOp(w.serialize(),V),!!o.syncExecuteCommand(x.id,x.params)}},It={id:"doc.command.horizontal-line",type:s.CommandType.COMMAND,handler:(i,t)=>i.get(s.ICommandService).syncExecuteCommand(on.id,{horizontalLine:{padding:5,color:{rgb:"#CDD0D8"},width:1,dashStyle:s.DashStyleType.SOLID},textRange:t==null?void 0:t.insertRange})},Si={id:"doc.command.insert-horizontal-line-bellow",type:s.CommandType.COMMAND,handler:i=>{const t=i.get(s.ICommandService),e=mt(i);return e?t.syncExecuteCommand(It.id,{insertRange:{startOffset:e.startIndex+1,endOffset:e.startIndex+1}}):!1}};function ue(i,t,e){return e.executeCommand(be.id,{preCommandId:i,...t!=null?t:{}})}const Is="doc.command.set-inline-format-bold",De={id:Is,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Is,t,e)}},vs="doc.command.set-inline-format-italic",Be={id:vs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(vs,t,e)}},Es="doc.command.set-inline-format-underline",_e={id:Es,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Es,t,e)}},Cs="doc.command.set-inline-format-strikethrough",Ne={id:Cs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Cs,t,e)}},Ts="doc.command.set-inline-format-subscript",ye={id:Ts,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Ts,t,e)}},ys="doc.command.set-inline-format-superscript",Pe={id:ys,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(ys,t,e)}},bs="doc.command.set-inline-format-fontsize",ge={id:bs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(bs,t,e)}},Os="doc.command.set-inline-format-font-family",We={id:Os,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Os,t,e)}},Rs="doc.command.set-inline-format-text-color",Ue={id:Rs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Rs,t,e)}},Ms="doc.command.set-inline-format-text-background-color",we={id:Ms,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Ms,t,e)}},xs="doc.command.reset-inline-format-text-background-color",tt={id:xs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(xs,t,e)}},Ii={[De.id]:"bl",[Be.id]:"it",[_e.id]:"ul",[Ne.id]:"st",[ge.id]:"fs",[We.id]:"ff",[Ue.id]:"cl",[we.id]:"bg",[tt.id]:"bg",[ye.id]:"va",[Pe.id]:"va"},be={id:"doc.command.set-inline-format",type:s.CommandType.COMMAND,handler:async(i,t)=>{var R;const{value:e,preCommandId:n}=t,o=i.get(s.ICommandService),a=i.get(D.DocSelectionManagerService),r=i.get(s.IUniverInstanceService),c=i.get(Te),l=a.getDocRanges(),A=(R=l.find(v=>v.isActive))!=null?R:l[0];if(l.length===0)return!1;const{segmentId:d}=l[0],u=r.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(u==null)return!1;const m=u.getSelfOrHeaderFooterModel(d).getBody();if(m==null)return!1;const h=u.getUnitId();let g;switch(n){case De.id:case Be.id:case _e.id:case Ne.id:case ye.id:case Pe.id:{const v=c.getDefaultStyle(),O=Bs(m,A,v);g=nc(O,n);break}case ge.id:case We.id:{g=e;break}case Ue.id:case we.id:{g={rgb:e};break}case tt.id:{g={rgb:null};break}default:throw new Error(`Unknown command: ${n} in handleInlineFormat`)}const p={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:l}},f=new s.TextX,S=s.JSONX.getInstance(),E=new s.MemoryCursor;E.reset();for(const v of l){let{startOffset:O,endOffset:M,rangeType:y}=v;if(O==null||M==null)continue;if(y===s.DOC_RANGE_TYPE.RECT&&(O=O-1),O===M){const w=c.getStyleCache(),H=Ii[n];c.setStyleCache({[H]:(w==null?void 0:w[H])!==void 0?Ds(w,H,n):g});continue}const N={dataStream:"",textRuns:[{st:0,ed:M-O,ts:{[Ii[n]]:g}}]},x=O-E.cursor;x!==0&&f.push({t:s.TextXActionType.RETAIN,len:x}),f.push({t:s.TextXActionType.RETAIN,body:N,len:M-O}),E.reset(),E.moveCursor(M)}const C=Z(u,d);return p.params.actions=S.editOp(f.serialize(),C),!!o.syncExecuteCommand(p.id,p.params)}};function tc(i){return i!==null&&typeof i=="object"}function Ds(i,t,e){if(/bl|it/.test(t))return(i==null?void 0:i[t])===s.BooleanNumber.TRUE?s.BooleanNumber.FALSE:s.BooleanNumber.TRUE;if(/ul|st/.test(t))return tc(i==null?void 0:i[t])&&(i==null?void 0:i[t]).s===s.BooleanNumber.TRUE?{s:s.BooleanNumber.FALSE}:{s:s.BooleanNumber.TRUE};if(/va/.test(t))return e===ye.id?(i==null?void 0:i[t])===s.BaselineOffset.SUBSCRIPT?s.BaselineOffset.NORMAL:s.BaselineOffset.SUBSCRIPT:(i==null?void 0:i[t])===s.BaselineOffset.SUPERSCRIPT?s.BaselineOffset.NORMAL:s.BaselineOffset.SUPERSCRIPT}function Bs(i,t,e){var d,u,m,h,g,p,f,S,E,C,b,R,v,O;const{startOffset:n,endOffset:o,collapsed:a}=t;if(a){const M=(d=i.textRuns)!=null?d:[];let y=null;for(let N=M.length-1;N>=0;N--){const x=M[N];if(x.st<n&&n<=x.ed){y=x;break}}return y!=null&&y.ts?{...e,...y.ts}:e}const{textRuns:r=[]}=s.getBodySlice(i,n,o),c=s.Tools.deepClone(e),l=r.map(M=>{var y;return(y=M==null?void 0:M.ts)==null?void 0:y.fs}).filter(Boolean);c.fs=c.fs?Math.max(c.fs,...l):l.length?Math.max(...l):void 0,c.fs=!c.fs||Number.isNaN(c.fs)?void 0:c.fs,c.ff=(h=(m=(u=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.ff)!=null}))==null?void 0:u.ts)==null?void 0:m.ff)!=null?h:c.ff,c.it=r.length&&r.every(M=>{var y;return((y=M.ts)==null?void 0:y.it)===s.BooleanNumber.TRUE})?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,c.bl=r.length&&r.every(M=>{var y;return((y=M.ts)==null?void 0:y.bl)===s.BooleanNumber.TRUE})?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,c.ul=r.length&&r.every(M=>{var y,N;return((N=(y=M.ts)==null?void 0:y.ul)==null?void 0:N.s)===s.BooleanNumber.TRUE})?(g=r[0].ts)==null?void 0:g.ul:c.ul,c.st=r.length&&r.every(M=>{var y,N;return((N=(y=M.ts)==null?void 0:y.st)==null?void 0:N.s)===s.BooleanNumber.TRUE})?(p=r[0].ts)==null?void 0:p.st:c.st,c.bg=(E=(S=(f=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.bg)!=null}))==null?void 0:f.ts)==null?void 0:S.bg)!=null?E:c.bg,c.cl=(R=(b=(C=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.cl)!=null}))==null?void 0:C.ts)==null?void 0:b.cl)!=null?R:c.cl;const A=r.filter(M=>{var y;return((y=M==null?void 0:M.ts)==null?void 0:y.va)!=null});if(A.length>0&&A.length===r.length){const M=(v=A[0].ts)==null?void 0:v.va;let y=!0;for(let N=1;N<A.length;N++)if(((O=A[N].ts)==null?void 0:O.va)!==M){y=!1;break}y&&(c.va=M)}return c}function nc(i,t){const e=Ii[t];return Ds(i,e,t)}const nt={id:"doc.command.list-operation",type:s.CommandType.COMMAND,handler:(i,t)=>{var b,R,v,O,M,y;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=t.listType,r=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=(R=(b=t.docRange)!=null?b:e.getDocRanges())!=null?R:[];if(r==null||c.length===0)return!1;const l=c[0].segmentId,A=r.getSelfOrHeaderFooterModel(l),d=(O=(v=A.getBody())==null?void 0:v.paragraphs)!=null?O:[],u=(y=(M=A.getBody())==null?void 0:M.dataStream)!=null?y:"";if(!d.length)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c,isEditing:!1}};new s.MemoryCursor().reset();const f=s.BuildTextUtils.paragraph.bullet.switch({paragraphs:m,listType:a,document:r,segmentId:l}),S=s.JSONX.getInstance(),E=Z(r,l);return g.params.actions=S.editOp(f.serialize(),E),!!o.syncExecuteCommand(g.id,g.params)}},vt={id:"doc.command.change-list-type",type:s.CommandType.COMMAND,handler:(i,t)=>{var C,b,R,v,O;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{listType:a}=t,r=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=(C=t.docRange)!=null?C:e.getDocRanges();if(r==null||c==null||!c.length)return!1;const{segmentId:l}=c[0],A=r.getSelfOrHeaderFooterModel(l),d=(R=(b=A.getBody())==null?void 0:b.paragraphs)!=null?R:[],u=(O=(v=A.getBody())==null?void 0:v.dataStream)!=null?O:"";if(!d.length)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g=s.BuildTextUtils.paragraph.bullet.set({paragraphs:m,listType:a,segmentId:l,document:r});if(!g)return!1;const p=s.JSONX.getInstance(),f={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c,isEditing:!1}},S=Z(r,l);return f.params.actions=p.editOp(g.serialize(),S),!!o.syncExecuteCommand(f.id,f.params)}};var Et=(i=>(i[i.increase=1]="increase",i[i.decrease=-1]="decrease",i))(Et||{});const sn={id:"doc.command.change-list-nesting-level",type:s.CommandType.COMMAND,handler:(i,t)=>{var b,R,v,O,M;if(!t)return!1;const{type:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=n.getActiveTextRange();if(r==null||c==null)return!1;const{segmentId:l}=c,A=(b=n.getDocRanges())!=null?b:[],d=r.getSelfOrHeaderFooterModel(l),u=(v=(R=d.getBody())==null?void 0:R.paragraphs)!=null?v:[],m=(M=(O=d.getBody())==null?void 0:O.dataStream)!=null?M:"";if(!u.length)return!1;const h=s.BuildTextUtils.range.getParagraphsInRange(c,u,m),g=r.getUnitId(),p=s.JSONX.getInstance(),f=s.BuildTextUtils.paragraph.bullet.changeNestLevel({paragraphs:h,type:e,segmentId:l,document:r}),S={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:A,isEditing:!1}},E=Z(r,l);return S.params.actions=p.editOp(f.serialize(),E),!!a.syncExecuteCommand(S.id,S.params)}},it={id:"doc.command.bullet-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(vt.id,{listType:t.value,docRange:t.docRange}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.BULLET_LIST,docRange:t==null?void 0:t.docRange})}},Ct={id:"doc.command.check-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(vt.id,{listType:t.value,docRange:t.docRange}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.CHECK_LIST,docRange:t==null?void 0:t.docRange})}},vi={id:"doc.command.toggle-check-list",type:s.CommandType.COMMAND,handler:(i,t)=>{var p;if(!t)return!1;const e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),{index:o,segmentId:a,textRanges:r}=t,c=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(c==null||((p=c.getSelfOrHeaderFooterModel(a).getBody())==null?void 0:p.paragraphs)==null)return!1;const A=c.getUnitId(),d={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:r!=null?r:[],segmentId:a,isEditing:!1}},u=s.BuildTextUtils.paragraph.bullet.toggleChecklist({document:c,paragraphIndex:o,segmentId:a});if(!u)return!1;const m=s.JSONX.getInstance(),h=Z(c,a);return d.params.actions=m.editOp(u.serialize(),h),!!n.syncExecuteCommand(d.id,d.params)}},ot={id:"doc.command.order-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(vt.id,{listType:t.value}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.ORDER_LIST})}},Ei={id:"doc.command.quick-list",type:s.CommandType.COMMAND,handler(i,t){var X,Y,q,K,$;if(!t)return!1;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=e.getActiveTextRange();if(a==null||r==null)return!1;const{segmentId:c,startOffset:l}=r,{listType:A,paragraph:d}=t,{paragraphStart:u,paragraphEnd:m}=d,h=new s.TextX,g=s.JSONX.getInstance(),{defaultTabStop:p=36}=a.getSnapshot().documentStyle,f=(Y=(X=a.getSelfOrHeaderFooterModel(c).getBody())==null?void 0:X.sectionBreaks)!=null?Y:[],{startIndex:S,paragraphStyle:E={}}=d,{indentFirstLine:C,snapToGrid:b,indentStart:R}=E,v=s.PRESET_LIST_TYPE[A].nestingLevel[0].paragraphProperties||{},{hanging:O,indentStart:M}=v,y=v.textStyle,{charSpace:N,gridType:x}=ic(S,f)||{charSpace:0,gridType:s.GridType.LINES},w=_.getCharSpaceApply(N,p,x,b);let V=s.Tools.generateRandomId(6);const F=(K=(q=a.getBody())==null?void 0:q.paragraphs)!=null?K:[],Q=F.findIndex(ie=>ie.startIndex===d.startIndex),j=F[Q-1],G=F[Q+1];j&&j.bullet&&j.bullet.listType.indexOf(A)===0?V=j.bullet.listId:G&&G.bullet&&G.bullet.listType.indexOf(A)===0&&(V=G.bullet.listId);const k={id:D.RichTextEditingMutation.id,params:{unitId:a.getUnitId(),actions:[],textRanges:[{startOffset:u,endOffset:u,collapsed:!0}],isEditing:!1}};h.push({t:s.TextXActionType.RETAIN,len:u}),h.push({t:s.TextXActionType.DELETE,len:l-u}),m>l&&h.push({t:s.TextXActionType.RETAIN,len:m-l}),h.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...E,textStyle:{...E.textStyle,...y},indentFirstLine:void 0,hanging:O,indentStart:{v:_.getNumberUnitValue(M,w)-_.getNumberUnitValue(O,w)+_.getNumberUnitValue(C,w)+_.getNumberUnitValue(R,w)}},bullet:{...($=d.bullet)!=null?$:{nestingLevel:0,textStyle:{fs:20}},listType:A,listId:V}}]}});const W=Z(a,c);return k.params.actions=g.editOp(h.serialize(),W),!!o.syncExecuteCommand(k.id,k.params)}};function Ci(i,t){var d,u;const e=i.get(s.ICommandService),n=mt(i);if(!n)return!1;const o=i.get(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!o)return!1;const a=s.BuildTextUtils.selection.replace({doc:o,selection:{startOffset:n.startIndex+1,endOffset:n.startIndex+1,collapsed:!0},body:{dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:{...n.paragraphStyle},bullet:{listType:t,listId:((d=n.bullet)==null?void 0:d.listType)===t?n.bullet.listId:s.Tools.generateRandomId(6),nestingLevel:((u=n.bullet)==null?void 0:u.listType)===t?n.bullet.nestingLevel:0}}]}});if(!a)return!1;const r={id:D.RichTextEditingMutation.id,params:{unitId:o.getUnitId(),actions:[],textRanges:[{startOffset:n.startIndex+1,endOffset:n.startIndex+1,collapsed:!0}],isEditing:!1}},c=s.JSONX.getInstance(),l=Z(o);return r.params.actions=c.editOp(a.serialize(),l),!!e.syncExecuteCommand(r.id,r.params)}const Ti={id:"doc.command.insert-bullet-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.BULLET_LIST)},yi={id:"doc.command.insert-order-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.ORDER_LIST)},bi={id:"doc.command.insert-check-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.CHECK_LIST)};function ic(i,t){const e=t.sort(s.sortRulesFactory("startIndex"));for(let n=0;n<e.length;n++){const o=t[n];if(o.startIndex>=i)return o}}const de={id:"doc.command.set-paragraph-named-style",type:s.CommandType.COMMAND,handler(i,t){var g;if(!t)return!1;const n=i.get(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!n)return!1;const o=n.getUnitId(),a=i.get(D.DocSelectionManagerService),r=(g=t.textRanges)!=null?g:a.getTextRanges({unitId:o,subUnitId:o});if(!(r!=null&&r.length))return!1;const c=r[0].segmentId,l=s.BuildTextUtils.paragraph.style.set({document:n.getSelfOrHeaderFooterModel(c),textRanges:r,style:{namedStyleType:t.value,headingId:!t.value||t.value===s.NamedStyleType.NORMAL_TEXT?void 0:s.generateRandomId(6),spaceAbove:void 0,spaceBelow:void 0},paragraphTextRun:{}}),A={id:D.RichTextEditingMutation.id,params:{actions:[],textRanges:r,unitId:o,segmentId:c}},d=s.JSONX.getInstance(),u=Z(n,c);return A.params.actions=d.editOp(l.serialize(),u),!!i.get(s.ICommandService).syncExecuteCommand(A.id,A.params)}},_s={id:"doc.command.quick-heading",type:s.CommandType.COMMAND,handler(i,t){var R,v,O,M;if(!t)return!1;const{value:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=n.getActiveTextRange();if(r==null||c==null||!c.collapsed)return!1;const{segmentId:l,startOffset:A}=c,d=r.getSelfOrHeaderFooterModel(l),u=(v=(R=d.getBody())==null?void 0:R.paragraphs)!=null?v:[],m=(M=(O=d.getBody())==null?void 0:O.dataStream)!=null?M:"",h=s.BuildTextUtils.paragraph.util.getParagraphsInRange(c,u,m)[0];if(!h)return!1;const{paragraphStart:g}=h,p=new s.TextX,f=s.JSONX.getInstance(),{paragraphStyle:S={}}=h,E={id:D.RichTextEditingMutation.id,params:{unitId:r.getUnitId(),actions:[],textRanges:[{startOffset:g,endOffset:g,collapsed:!0}],isEditing:!1}};p.push({t:s.TextXActionType.RETAIN,len:g}),s.BuildTextUtils.paragraph.style.set({textRanges:[c],document:r,style:{...S,headingId:s.generateRandomId(6),namedStyleType:e},cursor:A,deleteLen:A-g,textX:p,paragraphTextRun:{}});const C=Z(r,l);return E.params.actions=f.editOp(p.serialize(),C),!!a.syncExecuteCommand(E.id,E.params)}},Oi={"#":s.NamedStyleType.HEADING_1,"##":s.NamedStyleType.HEADING_2,"###":s.NamedStyleType.HEADING_3,"####":s.NamedStyleType.HEADING_4,"#####":s.NamedStyleType.HEADING_5},Ri={id:"doc.command.h1-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_1})},Mi={id:"doc.command.h2-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_2})},xi={id:"doc.command.h3-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_3})},Di={id:"doc.command.h4-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_4})},Bi={id:"doc.command.h5-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_5})},an={id:"doc.command.normal-text-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.NORMAL_TEXT})},Ns={id:"doc.command.title",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.TITLE})},Ps={id:"doc.command.subtitle-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.SUBTITLE})},me={id:"doc.command.align-action",type:s.CommandType.COMMAND,handler:(i,t)=>{var R,v,O,M;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{alignType:a}=t,r=n.getCurrentUniverDocInstance();if(r==null)return!1;const c=e.getDocRanges();if(c.length===0)return!1;const l=c[0].segmentId,A=r.getSelfOrHeaderFooterModel(l),d=(v=(R=A.getBody())==null?void 0:R.paragraphs)!=null?v:[],u=(M=(O=A.getBody())==null?void 0:O.dataStream)!=null?M:"";if(d==null)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g=m.every(y=>{var N;return((N=y.paragraphStyle)==null?void 0:N.horizontalAlign)===a}),p={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c}},f=new s.MemoryCursor;f.reset();const S=new s.TextX,E=s.JSONX.getInstance();for(const y of m){const{startIndex:N}=y;S.push({t:s.TextXActionType.RETAIN,len:N-f.cursor});const x={...y.paragraphStyle,horizontalAlign:g?s.HorizontalAlign.UNSPECIFIED:a};S.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...y,paragraphStyle:x,startIndex:0}]},coverType:s.UpdateDocsAttributeType.REPLACE}),f.moveCursorTo(N+1)}const C=Z(r,l);return p.params.actions=E.editOp(S.serialize(),C),!!o.syncExecuteCommand(p.id,p.params)}},Tt={id:"doc.command.align-left",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.LEFT})},yt={id:"doc.command.align-center",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.CENTER})},bt={id:"doc.command.align-right",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.RIGHT})},Ot={id:"doc.command.align-justify",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.JUSTIFIED})},Rt={id:"doc.command.switch-mode",type:s.CommandType.COMMAND,handler:i=>{var E,C,b,R,v;const t=i.get(s.ICommandService),e=i.get(_.IRenderManagerService),n=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(a==null)return!1;const r=a.getUnitId(),c=(E=e.getRenderById(r))==null?void 0:E.with(D.DocSkeletonManagerService).getSkeleton(),l=(C=e.getRenderById(r))==null?void 0:C.with(T.DocSelectionRenderService);if(c==null||l==null)return!1;const A=l==null?void 0:l.getSegment(),d=l==null?void 0:l.getSegmentPage(),u=a.getSnapshot().documentStyle.documentFlavor,m=n.getDocRanges(),h={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:u===s.DocumentFlavor.TRADITIONAL&&A?[]:m}},g=s.JSONX.getInstance(),p=[];let f;if(u===void 0?f=g.insertOp(["documentStyle","documentFlavor"],s.DocumentFlavor.MODERN):u===s.DocumentFlavor.MODERN?f=g.replaceOp(["documentStyle","documentFlavor"],u,s.DocumentFlavor.TRADITIONAL):f=g.replaceOp(["documentStyle","documentFlavor"],u,s.DocumentFlavor.MODERN),f)p.push(f);else return!1;if(u!==s.DocumentFlavor.MODERN){const O=a.getSnapshot(),{drawings:M={},body:y}=O,N=(b=y==null?void 0:y.customBlocks)!=null?b:[];for(const x in M){const w=M[x],H=N.find($=>$.blockId===x);if(H==null)continue;const V=w.docTransform.positionV,{relativeFrom:F,posOffset:Q}=V;if(F===s.ObjectRelativeFromV.PARAGRAPH)continue;const{startIndex:j}=H,G=c.findNodeByCharIndex(j,A,d),k=(R=G==null?void 0:G.parent)==null?void 0:R.parent,W=k==null?void 0:k.parent,z=W==null?void 0:W.lines.find($=>$.paragraphIndex===(k==null?void 0:k.paragraphIndex)&&$.paragraphStart),X=(v=W==null?void 0:W.parent)==null?void 0:v.parent;if(G==null||k==null||z==null||W==null||X==null)continue;let Y=0;F===s.ObjectRelativeFromV.LINE?Y-=k.top:F===s.ObjectRelativeFromV.PAGE&&(Y+=X.marginTop),Y+=z.top;const q={...V,relativeFrom:s.ObjectRelativeFromV.PARAGRAPH,posOffset:(Q!=null?Q:0)-Y},K=g.replaceOp(["drawings",x,"docTransform","positionV"],V,q);K&&p.push(K)}}return h.params.actions=p.reduce((O,M)=>s.JSONX.compose(O,M),null),!!t.syncExecuteCommand(h.id,h.params)}},Us="COMPONENT_DOC_CREATE_TABLE_CONFIRM",_i={id:"doc.command.create-table",type:s.CommandType.COMMAND,handler:async(i,t)=>{var q,K,$,ie,fe;const{rowCount:e,colCount:n}=t,o=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService),r=i.get(s.ICommandService),c=i.get(Te),l=o.getActiveTextRange();if(l==null)return!1;const{segmentId:A,segmentPage:d}=l,u=a.getCurrentUniverDocInstance(),m=u==null?void 0:u.getSelfOrHeaderFooterModel(A).getBody();if(u==null||m==null)return!1;const h=u.getUnitId(),g=re(i,h),p=g==null?void 0:g.getSkeleton();if(p==null)return!1;const{startOffset:f}=l,E=((q=m.paragraphs)!=null?q:[]).find(Fe=>Fe.startIndex>=f),C=p.findNodeByCharIndex(f,A,d);if(C==null)return!1;const b=new s.TextX,R=s.JSONX.getInstance(),v=[],O=f+4,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:M}};f>0&&b.push({t:s.TextXActionType.RETAIN,len:f}),b.push({t:s.TextXActionType.INSERT,body:{dataStream:s.DataStreamTreeTokenType.PARAGRAPH,paragraphs:fi(s.DataStreamTreeTokenType.PARAGRAPH,E)},len:1});const N=c.getDefaultStyle(),x=c.getStyleCache(),w=Qt(m,f,N,x),{dataStream:H,paragraphs:V,sectionBreaks:F}=Rr(e,n),Q=(fe=(ie=($=(K=C.parent)==null?void 0:K.parent)==null?void 0:$.parent)==null?void 0:ie.parent)==null?void 0:fe.parent;if(Q==null)return!1;const{pageWidth:j,marginLeft:G,marginRight:k}=Q,W=ni(e,n,j-G-k);b.push({t:s.TextXActionType.INSERT,body:{dataStream:H,paragraphs:V,sectionBreaks:F,textRuns:[{...w,st:0,ed:H.length}],tables:[{startIndex:0,endIndex:H.length,tableId:W.tableId}]},len:H.length});const z=Z(u,A);v.push(R.editOp(b.serialize(),z));const X=R.insertOp(["tableSource",W.tableId],W);return v.push(X),y.params.actions=v.reduce((Fe,Se)=>s.JSONX.compose(Fe,Se),null),!!r.syncExecuteCommand(y.id,y.params)}},Ni="doc.component.create-table-confirm",rn={id:"doc.operation.create-table",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(s.LocaleService),e=i.get(I.IConfirmService),n=i.get(s.ICommandService),o={rowCount:3,colCount:5},a=(r,c)=>{o.rowCount=r,o.colCount=c};return await e.open({id:Ni,children:{label:{name:Us,props:{handleRowColChange:a,tableCreateParams:o}}},width:400,title:{title:t.t("toolbar.table.insert")},onConfirm:()=>{n.executeCommand(_i.id,o),e.close(Ni)},onClose:()=>{e.close(Ni)}}),!0}},oc=i=>{const e=Object.keys(s.PAGE_SIZE).find(n=>{const{width:o,height:a}=s.PAGE_SIZE[n];return i.width===o&&i.height===a});return e!=null?e:"A4"};function sc(i){const{hooks:t}=i,o=I.useDependency(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC).getDocumentStyle(),a=I.useDependency(s.LocaleService),[r,c]=U.useState(()=>{var d,u,m,h,g;return{paperSize:oc(o.pageSize),orientation:(d=o.pageOrient)!=null?d:s.PageOrientType.PORTRAIT,margins:{top:(u=o.marginTop)!=null?u:0,bottom:(m=o.marginBottom)!=null?m:0,left:(h=o.marginLeft)!=null?h:0,right:(g=o.marginRight)!=null?g:0}}});U.useEffect(()=>{t.beforeClose=()=>r,t.beforeConfirm=()=>r},[r]);const l=d=>{c(u=>({...u,paperSize:d}))},A=(d,u)=>{c(m=>({...m,margins:{...m.margins,[d]:u||0}}))};return P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-4",children:[P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-900",children:a.t("page-settings.paper-size")}),P.jsx(J.Select,{value:r.paperSize,onChange:l,options:s.PAPER_TYPES.map(d=>({label:a.t(`page-settings.page-size.${d.toLocaleLowerCase()}`),value:d}))})]}),P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-900",children:a.t("page-settings.custom-paper-size")}),P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.top")}),P.jsx(J.InputNumber,{value:r.margins.top,onChange:d=>A("top",d)})]}),P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.bottom")}),P.jsx(J.InputNumber,{value:r.margins.bottom,onChange:d=>A("bottom",d)})]})]}),P.jsxs("div",{className:"univer-flex univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.left")}),P.jsx(J.InputNumber,{value:r.margins.left,onChange:d=>A("left",d)})]}),P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.right")}),P.jsx(J.InputNumber,{value:r.margins.right,onChange:d=>A("right",d)})]})]})]})]})]})}const Pi="docs.component.page-setting",ws={id:"docs.command.page-setup",type:s.CommandType.COMMAND,handler:(i,t)=>{if(!t)return!1;const e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=e.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!o)return!1;const{marginLeft:a,marginRight:r,marginBottom:c,marginTop:l,pageOrient:A,pageSize:d}=t,u=s.JSONX.getInstance(),m=o.getDocumentStyle(),{marginBottom:h,marginLeft:g,marginRight:p,marginTop:f,pageOrient:S,pageSize:E}=m,C=[];if(h===void 0){const v=u.insertOp(["documentStyle","marginBottom"],c);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","marginBottom"],h,c);v&&C.push(v)}if(g===void 0){const v=u.insertOp(["documentStyle","marginLeft"],a);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","marginLeft"],g,a);v&&C.push(v)}if(p===void 0){const v=u.insertOp(["documentStyle","marginRight"],r);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","marginRight"],p,r);v&&C.push(v)}if(f===void 0){const v=u.insertOp(["documentStyle","marginTop"],l);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","marginTop"],f,l);v&&C.push(v)}if(E===void 0){const v=u.insertOp(["documentStyle","pageSize"],d);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","pageSize"],E,d);v&&C.push(v)}if(S===void 0){const v=u.insertOp(["documentStyle","pageOrient"],A);v&&C.push(v)}else{const v=u.replaceOp(["documentStyle","pageOrient"],S,A);v&&C.push(v)}const b={id:D.RichTextEditingMutation.id,params:{unitId:o.getUnitId(),actions:[],textRanges:void 0}};return b.params.actions=C.reduce((v,O)=>s.JSONX.compose(v,O),null),!!n.syncExecuteCommand(b.id,b.params)}},Ui={id:"docs.operation.open-page-setting",type:s.CommandType.OPERATION,handler:i=>{const t=i.get(I.IConfirmService),e=i.get(s.ICommandService),n=i.get(s.LocaleService),o=t.open({id:Pi,title:{label:n.t("page-settings.document-setting")},children:{label:Pi},width:528,onClose:()=>{o.dispose()},onConfirm:a=>{if(o.dispose(),!a)return;const r=s.PAGE_SIZE[a.paperSize];e.executeCommand(ws.id,{pageOrient:a.orientation,marginTop:a.margins.top,marginBottom:a.margins.bottom,marginLeft:a.margins.left,marginRight:a.margins.right,pageSize:r})}});return!0}};function ac(i){const t=i.get(s.IUniverInstanceService),e=i.get(_.IRenderManagerService);return new L.Observable(n=>{const o=t.focused$.subscribe(a=>{if(a==null||t.getUnitType(a)!==s.UniverInstanceType.UNIVER_DOC)return n.next(!0);const c=e.getRenderById(a);if(c==null)return n.next(!0);c.with(D.DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe(A=>{n.next(A===_.DocumentEditArea.HEADER||A===_.DocumentEditArea.FOOTER)})});return()=>o.unsubscribe()})}function rc(i){const t=i.get(s.IUniverInstanceService),e=i.get(s.ICommandService);return new L.Observable(n=>{const o=e.onCommandExecuted(l=>{if(l.id===D.RichTextEditingMutation.id){const{unitId:A}=l.params,d=t.getUnit(A);if(d==null){n.next(!0);return}const{documentStyle:u}=d.getSnapshot();n.next((u==null?void 0:u.documentFlavor)!==s.DocumentFlavor.TRADITIONAL)}}),a=t.focused$.subscribe(l=>{if(l==null)return n.next(!0);const A=t.getUniverDocInstance(l),d=A==null?void 0:A.getSnapshot().documentStyle.documentFlavor;n.next(d!==s.DocumentFlavor.TRADITIONAL)}),r=t.getCurrentUniverDocInstance();if(r==null)return n.next(!0);const c=r==null?void 0:r.getSnapshot().documentStyle.documentFlavor;return n.next(c!==s.DocumentFlavor.TRADITIONAL),()=>{o.dispose(),a.unsubscribe()}})}function cc(i){const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService);return new L.Observable(n=>{const o=t.textSelection$.subscribe(a=>{if(a==null){n.next(!0);return}const{textRanges:r}=a;if(r.length!==1){n.next(!0);return}const c=r[0],{collapsed:l,startNodePosition:A,startOffset:d}=c;if(!l||d==null){n.next(!0);return}const u=e.getCurrentUniverDocInstance();if(u==null){n.next(!0);return}const m=re(i,u.getUnitId());if(m==null){n.next(!0);return}if(m.getViewModel().getCustomRangeRaw(d)){n.next(!0);return}if(A!=null){const{path:p}=A;if(p.indexOf("cells")!==-1){n.next(!0);return}}n.next(!1)});return()=>o.unsubscribe()})}function te(i){const t=i.get(D.DocSelectionManagerService);return new L.Observable(e=>{const n=t.textSelection$.subscribe(o=>{if(o==null){e.next(!0);return}const{textRanges:a,rectRanges:r}=o;if(a.length===0&&r.length===0){e.next(!0);return}e.next(!1)});return()=>n.unsubscribe()})}function lc(i){const t=i.get(s.ICommandService);return{id:De.id,type:I.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.bl;e.next(r===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function dc(i){const t=i.get(s.ICommandService);return{id:Be.id,type:I.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.it;e.next(r===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Ac(i){const t=i.get(s.ICommandService);return{id:_e.id,type:I.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.ul;e.next((r==null?void 0:r.s)===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function uc(i){const t=i.get(s.ICommandService);return{id:Ne.id,type:I.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.st;e.next((r==null?void 0:r.s)===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function hc(i){const t=i.get(s.ICommandService);return{id:ye.id,type:I.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.va;e.next(r===s.BaselineOffset.SUBSCRIPT)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function gc(i){const t=i.get(s.ICommandService);return{id:Pe.id,type:I.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.va;e.next(r===s.BaselineOffset.SUPERSCRIPT)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function mc(i){const t=i.get(s.ICommandService);return{id:We.id,tooltip:"toolbar.font",type:I.MenuItemType.SELECTOR,label:qo,selections:I.FONT_FAMILY_LIST.map(e=>({label:{name:Jo},value:e.value})),value$:new L.Observable(e=>{const n=s.DEFAULT_STYLES.ff,o=()=>{var l;const r=Le(i);if(r==null){e.next(n);return}const c=(l=r.ts)==null?void 0:l.ff;e.next(c!=null?c:n)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===We.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function pc(i){const t=i.get(s.ICommandService);return{id:ge.id,type:I.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:Zo,props:{min:1,max:400}},selections:I.FONT_SIZE_LIST,value$:new L.Observable(e=>{const n=s.DEFAULT_STYLES.fs,o=()=>{var l;const r=Le(i);if(r==null){e.next(n);return}const c=(l=r.ts)==null?void 0:l.fs;e.next(c!=null?c:n)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===ge.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function fc(i){const t=i.get(s.ICommandService);return{id:de.id,type:I.MenuItemType.SELECTOR,tooltip:"toolbar.heading.tooltip",label:{name:I.COMMON_LABEL_COMPONENT,props:{selections:I.HEADING_LIST}},selections:I.HEADING_LIST.map(e=>({label:{name:I.HEADING_ITEM_COMPONENT,props:{value:e.value,text:e.label}},value:e.value})),value$:new L.Observable(e=>{const n=s.NamedStyleType.NORMAL_TEXT,o=()=>{var l,A;const r=ze(i);if(r==null){e.next(n);return}const c=(A=(l=r.paragraphStyle)==null?void 0:l.namedStyleType)!=null?A:n;e.next(c)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===ge.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Sc(i){const t=i.get(s.ICommandService),e=i.get(s.ThemeService);return{id:Ue.id,icon:"FontColor",tooltip:"toolbar.textColor.main",type:I.MenuItemType.BUTTON_SELECTOR,selections:[{label:{name:ei,hoverable:!1,selectable:!1}}],value$:new L.Observable(n=>{const o=e.getColorFromTheme("gray.900"),a=t.onCommandExecuted(r=>{if(r.id===Ue.id){const c=r.params.value;n.next(c!=null?c:o)}});return n.next(o),a.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Ic(i){return{id:Zn.id,type:I.MenuItemType.BUTTON,icon:"HeaderFooterSingle",tooltip:"toolbar.headerFooter",hidden$:L.combineLatest(I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),rc(i),(t,e)=>t||e)}}const vc="GridSingle",Ls="doc.menu.table";function Ec(i){return{id:Ls,type:I.MenuItemType.SUBITEMS,icon:vc,tooltip:"toolbar.table.main",disabled$:cc(i),hidden$:L.combineLatest(I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),ac(i),(t,e)=>t||e)}}function Cc(i){return{id:rn.id,title:"toolbar.table.insert",type:I.MenuItemType.BUTTON,hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Tc(i){const t=i.get(s.ICommandService);return{id:Tt.id,type:I.MenuItemType.BUTTON,icon:"LeftJustifyingSingle",tooltip:"toolbar.alignLeft",disabled$:te(i),activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.LEFT)}});return e.next(!1),n.dispose}),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function yc(i){const t=i.get(s.ICommandService);return{id:yt.id,type:I.MenuItemType.BUTTON,icon:"HorizontallySingle",tooltip:"toolbar.alignCenter",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.CENTER)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function bc(i){const t=i.get(s.ICommandService);return{id:bt.id,type:I.MenuItemType.BUTTON,icon:"RightJustifyingSingle",tooltip:"toolbar.alignRight",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.RIGHT)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function Oc(i){const t=i.get(s.ICommandService);return{id:Ot.id,type:I.MenuItemType.BUTTON,icon:"AlignTextBothSingle",tooltip:"toolbar.alignJustify",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.JUSTIFIED)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function Rc(i){return{id:It.id,type:I.MenuItemType.BUTTON,icon:"ReduceSingle",tooltip:"toolbar.horizontalLine",disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}const Mt=i=>new L.Observable(t=>{const e=i.get(s.IUniverInstanceService),n=i.get(D.DocSelectionManagerService);let o;const a=e.focused$.subscribe(r=>{if(o==null||o.unsubscribe(),r==null)return;const c=e.getUniverDocInstance(r);c!=null&&(o=n.textSelection$.subscribe(()=>{var d,u,m,h,g;const l=n.getDocRanges(),A=(d=l.find(p=>p.isActive))!=null?d:l[0];if(A){const p=c.getSelfOrHeaderFooterModel(A==null?void 0:A.segmentId),f=s.BuildTextUtils.range.getParagraphsInRange(A,(m=(u=p.getBody())==null?void 0:u.paragraphs)!=null?m:[],(g=(h=p.getBody())==null?void 0:h.dataStream)!=null?g:"");let S;if(f.every(E=>{var C;return S||(S=(C=E.bullet)==null?void 0:C.listType),E.bullet&&E.bullet.listType===S})){t.next(S);return}}t.next(void 0)}))});return()=>{a.unsubscribe(),o==null||o.unsubscribe()}});function Qs(i){return{id:ot.id,type:I.MenuItemType.BUTTON_SELECTOR,slot:!0,selections:[{label:{name:es,hoverable:!1,selectable:!1},value$:Mt(i)}],icon:"OrderSingle",tooltip:"toolbar.order",hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),disabled$:te(i),activated$:Mt(i).pipe(L.map(t=>t&&t.indexOf("ORDER_LIST")===0))}}function Fs(i){return{id:it.id,type:I.MenuItemType.BUTTON_SELECTOR,slot:!0,selections:[{label:{name:ts,hoverable:!1,selectable:!1},value$:Mt(i)}],icon:"UnorderSingle",tooltip:"toolbar.unorder",disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),activated$:Mt(i).pipe(L.map(t=>t&&t.indexOf("BULLET_LIST")===0))}}function Hs(i){return{id:Ct.id,type:I.MenuItemType.BUTTON,icon:"TodoList",tooltip:"toolbar.checklist",disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),activated$:Mt(i).pipe(L.map(t=>t&&t.indexOf("CHECK_LIST")===0))}}function Mc(i){const t=i.get(s.ICommandService),e=i.get(s.IUniverInstanceService);return{id:Rt.id,type:I.MenuItemType.BUTTON,icon:"KeyboardSingle",tooltip:"toolbar.documentFlavor",hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),activated$:new L.Observable(n=>{var r;const o=t.onCommandExecuted(c=>{var l;if(c.id===D.RichTextEditingMutation.id){const A=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);n.next(((l=A==null?void 0:A.getSnapshot())==null?void 0:l.documentStyle.documentFlavor)===s.DocumentFlavor.MODERN)}}),a=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);return n.next(((r=a==null?void 0:a.getSnapshot())==null?void 0:r.documentStyle.documentFlavor)===s.DocumentFlavor.MODERN),()=>o.dispose()})}}function xc(i){return{id:tt.id,type:I.MenuItemType.BUTTON,title:"toolbar.resetColor",icon:"NoColor"}}function Dc(i){const t=i.get(s.ICommandService),e=i.get(s.ThemeService);return{id:we.id,tooltip:"toolbar.fillColor.main",type:I.MenuItemType.BUTTON_SELECTOR,icon:"PaintBucket",selections:[{label:{name:ei,hoverable:!1,selectable:!1}}],value$:new L.Observable(n=>{const o=e.getColorFromTheme("primary.600"),a=t.onCommandExecuted(r=>{if(r.id===we.id){const c=r.params.value;n.next(c!=null?c:o)}});return n.next(o),a.dispose}),disabled$:te(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Le(i){var g,p,f,S;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=i.get(Te),o=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),a=e.getDocRanges(),r=(g=a.find(E=>E.isActive))!=null?g:a[0],c=n.getDefaultStyle(),l=(p=n.getStyleCache())!=null?p:{},A=ze(i),d=(f=A==null?void 0:A.paragraphStyle)!=null&&f.namedStyleType?s.NAMED_STYLE_MAP[(S=A==null?void 0:A.paragraphStyle)==null?void 0:S.namedStyleType]:null;if(o==null||r==null)return{ts:{...c,...d,...l}};const{segmentId:u}=r,m=o.getSelfOrHeaderFooterModel(u).getBody();if(m==null)return{ts:{...c,...d,...l}};const h=Bs(m,r,{});return s.Tools.deleteNull(h),{ts:{...c,...d,...h,...l}}}function ze(i){var d,u;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=t.getCurrentUniverDocInstance(),o=e.getDocRanges(),a=(d=o.find(m=>m.isActive))!=null?d:o[0];if(n==null||a==null)return;const{startOffset:r,segmentId:c}=a,l=(u=n.getSelfOrHeaderFooterModel(c).getBody())==null?void 0:u.paragraphs;if(l==null)return;let A=-1;for(const m of l){const{startIndex:h}=m;if(r>A&&r<=h)return m;A=h}return null}function Bc(i){return{id:Ui.id,type:I.MenuItemType.BUTTON,icon:"DocumentSettingSingle",tooltip:"toolbar.pageSetup",hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const _c={[s.NamedStyleType.HEADING_1]:Ri,[s.NamedStyleType.HEADING_2]:Mi,[s.NamedStyleType.HEADING_3]:xi,[s.NamedStyleType.HEADING_4]:Di,[s.NamedStyleType.HEADING_5]:Bi,[s.NamedStyleType.NORMAL_TEXT]:an,[s.NamedStyleType.TITLE]:Ns,[s.NamedStyleType.SUBTITLE]:Ps,[s.NamedStyleType.NAMED_STYLE_TYPE_UNSPECIFIED]:an},ks={[s.NamedStyleType.HEADING_1]:{key:"H1Single",component:No},[s.NamedStyleType.HEADING_2]:{key:"H2Single",component:Po},[s.NamedStyleType.HEADING_3]:{key:"H3Single",component:Uo},[s.NamedStyleType.HEADING_4]:{key:"H4Single",component:wo},[s.NamedStyleType.HEADING_5]:{key:"H5Single",component:Lo},[s.NamedStyleType.NORMAL_TEXT]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.TITLE]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.SUBTITLE]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.NAMED_STYLE_TYPE_UNSPECIFIED]:{key:"TextTypeSingle",component:ht}},Qe=i=>t=>{const e=t.get(s.ICommandService),n=t.get(I.ComponentManager),o=ks[i];return n.get(o.key)||n.register(o.key,o.component),{id:_c[i].id,type:I.MenuItemType.BUTTON,icon:o.key,tooltip:"toolbar.heading.tooltip",disabled$:te(t),hidden$:I.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_DOC),activated$:new L.Observable(a=>{const r=s.NamedStyleType.NORMAL_TEXT,c=()=>{var u,m;const A=ze(t);if(A==null){a.next(r===i);return}const d=(m=(u=A.paragraphStyle)==null?void 0:u.namedStyleType)!=null?m:r;a.next(d===i)},l=e.onCommandExecuted(A=>{const d=A.id;(d===D.SetTextSelectionsOperation.id||d===ge.id)&&c()});return c(),l.dispose})}},Nc=Qe(s.NamedStyleType.HEADING_1),Pc=Qe(s.NamedStyleType.HEADING_2),Uc=Qe(s.NamedStyleType.HEADING_3),wc=Qe(s.NamedStyleType.HEADING_4),Lc=Qe(s.NamedStyleType.HEADING_5),Qc=Qe(s.NamedStyleType.NORMAL_TEXT);Qe(s.NamedStyleType.TITLE),Qe(s.NamedStyleType.SUBTITLE);const Fc=i=>({id:gi.id,type:I.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.copy"}),Hc=i=>({id:mi.id,type:I.MenuItemType.BUTTON,icon:"CutSingle",title:"rightClick.cut"}),kc=i=>({id:ci.id,type:I.MenuItemType.BUTTON,icon:"DeleteSingle",title:"rightClick.delete"}),Vc=i=>({id:Ti.id,type:I.MenuItemType.BUTTON,icon:"UnorderSingle",title:"rightClick.bulletList"}),Wc=i=>({id:yi.id,type:I.MenuItemType.BUTTON,icon:"OrderSingle",title:"rightClick.orderList"}),zc=i=>({id:bi.id,type:I.MenuItemType.BUTTON,icon:"TodoList",title:"rightClick.checkList"}),Gc=i=>({id:Si.id,type:I.MenuItemType.BUTTON,icon:"ReduceSingle",title:"toolbar.horizontalLine"}),Vs="doc.menu.insert-bellow";function jc(i){return{id:Vs,type:I.MenuItemType.SUBITEMS,title:"rightClick.insertBellow"}}const wi=4,Xc=(i,t)=>{const e=i.get(s.IUniverInstanceService).getUniverDocInstance(t.unitId),n=(e==null?void 0:e.zoomRatio)||1;return{...s.Tools.deepClone(t),zoomRatio:n}},he={id:"doc.operation.set-zoom-ratio",type:s.CommandType.OPERATION,handler:(i,t)=>{const e=i.get(s.IUniverInstanceService).getUniverDocInstance(t.unitId);if(!e)return!1;const n=e.getSnapshot();return n.settings==null?n.settings={zoomRatio:t.zoomRatio}:n.settings.zoomRatio=t.zoomRatio,!0}};var Kc=Object.getOwnPropertyDescriptor,Yc=(i,t,e,n)=>{for(var o=n>1?void 0:n?Kc(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},cn=(i,t)=>(e,n)=>t(e,n,i);function Ws(i,t){const e=zs(i.left,i.top,t),n=zs(i.right,i.bottom,t);return{left:e.x,top:e.y,right:n.x,bottom:n.y}}function zs(i,t,e){const{scaleX:n,scaleY:o}=e.getAncestorScale(),a=e.getViewport(ae.VIEW_MAIN);if(!a)return{x:i,y:t};const{viewportScrollX:r,viewportScrollY:c}=a,l=(i-r)*n,A=(t-c)*o;return{x:l,y:A}}function Gs(i,t,e){const{scaleX:n,scaleY:o}=e.getAncestorScale(),a=e.getViewport(ae.VIEW_MAIN);if(!a)return{x:i,y:t};const{viewportScrollX:r,viewportScrollY:c}=a,l=i/n+r,A=t/o+c;return{x:l,y:A}}const ln=(i,t)=>{const{scene:e,mainComponent:n,engine:o}=t,a=t.with(D.DocSkeletonManagerService).getSkeleton(),r=a.findNodePositionByCharIndex(i.startOffset,!0,i.segmentId,i.segmentPage),c=i.collapsed?i.startOffset:i.endOffset-1,l=a.findNodePositionByCharIndex(c,!0,i.segmentId,i.segmentPage),A=n;if(!l||!r)return;const d=A.getOffsetConfig(),{docsLeft:u,docsTop:m}=d,h=o.getCanvasElement(),g=h.getBoundingClientRect(),p=_.pxToNum(h.style.width),{top:f,left:S,width:E}=g,C=E/p,{scaleX:b,scaleY:R}=e.getAncestorScale(),v=new ve(d,a),{borderBoxPointGroup:O}=v.getRangePointData(r,l);return kt(O).map(N=>Ws(N,e)).map(N=>({left:(N.left+u*b)*C+S,right:(N.right+u*b)*C+S,top:(N.top+m*R)*C+f,bottom:(N.bottom+m*R)*C+f}))};T.DocCanvasPopManagerService=class extends s.Disposable{constructor(t,e,n,o){super(),this._globalPopupManagerService=t,this._renderManagerService=e,this._univerInstanceService=n,this._commandService=o}_createRectPositionObserver(t,e){const n=()=>{const{scene:l,engine:A}=e,d=typeof t=="function"?t():t,u=A.getCanvasElement(),m=u.getBoundingClientRect(),h=_.pxToNum(u.style.width),g=Ws(d,l),{top:p,left:f,width:S}=m,E=S/h;return{left:g.left*E+f,right:g.right*E+f,top:g.top*E+p,bottom:g.bottom*E+p}},o=n(),a=new L.BehaviorSubject(o),r=new s.DisposableCollection;r.add(this._commandService.onCommandExecuted(l=>{if(l.id===he.id||l.id===D.RichTextEditingMutation.id){const A=n();A&&a.next(A)}}));const c=e.scene.getViewport(ae.VIEW_MAIN);return c&&r.add(c.onScrollAfter$.subscribeEvent(()=>{a.next(n())})),{position:o,position$:a,disposable:r}}_createObjectPositionObserver(t,e){const n=()=>{const{left:o,top:a,width:r,height:c}=t;return{left:o,right:o+r,top:a,bottom:a+c}};return this._createRectPositionObserver(n,e)}_createRangePositionObserver(t,e){var c;const n=(c=ln(t,e))!=null?c:[],o=new L.BehaviorSubject(n),a=new s.DisposableCollection;a.add(this._commandService.onCommandExecuted(l=>{if((l.id===he.id||l.id===D.RichTextEditingMutation.id)&&l.params.unitId===e.unitId){const d=ln(t,e);d&&o.next(d)}}));const r=e.scene.getViewport(ae.VIEW_MAIN);return r&&a.add(r.onScrollAfter$.subscribeEvent(()=>{const l=ln(t,e);l&&o.next(l)})),{positions:n,positions$:o,disposable:a}}attachPopupToRect(t,e,n){const o=this._renderManagerService.getRenderById(n);if(!o)throw new Error(`Current render not found, unitId: ${n}`);const{position:a,position$:r,disposable:c}=this._createRectPositionObserver(t,o),l=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a,anchorRect$:r,canvasElement:o.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(l),r.complete(),c.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==l}}attachPopupToObject(t,e,n){const o=this._renderManagerService.getRenderById(n);if(!o)throw new Error(`Current render not found, unitId: ${n}`);const{position:a,position$:r,disposable:c}=this._createObjectPositionObserver(t,o),l=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a,anchorRect$:r,canvasElement:o.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(l),r.complete(),c.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==l}}attachPopupToRange(t,e,n){if(!this._univerInstanceService.getUnit(n))throw new Error(`Document not found, unitId: ${n}`);const{direction:a="top",multipleDirection:r}=e,c=this._renderManagerService.getRenderById(n);if(!c)throw new Error(`Current render not found, unitId: ${n}`);const{positions:l,positions$:A,disposable:d}=this._createRangePositionObserver(t,c),u=A.pipe(L.map(h=>a.includes("top")?h[0]:h[h.length-1])),m=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a.includes("top")?l[0]:l[l.length-1],anchorRect$:u,excludeRects:l,excludeRects$:A,direction:["top","bottom","horizontal"].some(h=>a.includes(h))&&l.length>1&&r!=null?r:a,canvasElement:c.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(m),A.complete(),d.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==m}}},T.DocCanvasPopManagerService=Yc([cn(0,s.Inject(I.ICanvasPopupService)),cn(1,_.IRenderManagerService),cn(2,s.IUniverInstanceService),cn(3,s.ICommandService)],T.DocCanvasPopManagerService);var qc=Object.getOwnPropertyDescriptor,Jc=(i,t,e,n)=>{for(var o=n>1?void 0:n?qc(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Zc=(i,t)=>(e,n)=>t(e,n,i);const $c=(i,t,e,n)=>{var m,h,g,p,f;const o=e.findNodePositionByCharIndex(i.startOffset,!0,i.segmentId,n),a=e.getSkeletonData();let r=i.endOffset-1;if(i.segmentId){const S=(f=Array.from((h=(m=a==null?void 0:a.skeFooters.get(i.segmentId))==null?void 0:m.values())!=null?h:[])[0])!=null?f:Array.from((p=(g=a==null?void 0:a.skeHeaders.get(i.segmentId))==null?void 0:g.values())!=null?p:[])[0];S&&(r=Math.min(S.ed,r))}const c=e.findNodePositionByCharIndex(r,!0,i.segmentId,n);if(!c||!o)return;const l=t.getOffsetConfig(),A=new ve(l,e),{borderBoxPointGroup:d}=A.getRangePointData(o,c);return kt(d).map(S=>({top:S.top+l.docsTop-wi,bottom:S.bottom+l.docsTop+wi,left:S.left+l.docsLeft,right:S.right+l.docsLeft}))},js=(i,t,e,n)=>{const o=[];for(const a of i){const r=a.top;for(const c of a.columns){const l=c.left,A=a.colCount===1?n:c.width;let d=null;for(const u of c.lines){const m=u.paragraphIndex;if(u.paragraphStart){d&&(o.push(d),d=null);const h={top:t+r+u.top,left:e+l,right:e+l+A,bottom:t+r+u.top+u.lineHeight};d={paragraphStart:u.st,paragraphEnd:m,startIndex:m,rect:h,fisrtLine:{top:t+r+u.top+u.marginTop+u.paddingTop,left:e+l,right:e+l+A,bottom:t+r+u.top+u.marginTop+u.paddingTop+u.contentHeight}}}else d&&d.startIndex===m&&(d.rect.bottom=t+r+u.top+u.lineHeight)}d&&o.push(d)}}return o},el=(i,t,e,n=-1)=>{const o=e.findPositionByGlyph(i,n);if(!o)return;const a=t.getOffsetConfig(),r={...o,isBack:!0},c=new ve(a,e),{borderBoxPointGroup:l}=c.getRangePointData(r,r),d=kt(l)[0];return{top:d.top+a.docsTop,bottom:d.bottom+a.docsTop,left:d.left+a.docsLeft,right:d.left+a.docsLeft+i.width}};function Ge(i,t,e){const{left:n,right:o,top:a,bottom:r}=e;return i>=n&&i<=o&&t>=a&&t<=r}T.DocEventManagerService=class extends s.Disposable{constructor(e,n){super();B(this,"_hoverCustomRanges$",new L.BehaviorSubject([]));B(this,"hoverCustomRanges$",this._hoverCustomRanges$.pipe(L.distinctUntilChanged((e,n)=>e.length===n.length&&e.every((o,a)=>n[a].range.rangeId===o.range.rangeId&&n[a].segmentId===o.segmentId&&n[a].segmentPageIndex===o.segmentPageIndex&&n[a].range.startIndex===o.range.startIndex))));B(this,"_clickCustomRanges$",new L.Subject);B(this,"clickCustomRanges$",this._clickCustomRanges$.asObservable());B(this,"_hoverBullet$",new L.Subject);B(this,"hoverBullet$",this._hoverBullet$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.paragraph.startIndex)===(n==null?void 0:n.paragraph.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.segmentPageIndex)===(n==null?void 0:n.segmentPageIndex))));B(this,"_clickBullet$",new L.Subject);B(this,"clickBullets$",this._clickBullet$.asObservable());B(this,"_hoverParagraph$",new L.BehaviorSubject(null));B(this,"hoverParagraph$",this._hoverParagraph$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.startIndex)===(n==null?void 0:n.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverParagraphRealTime$",this._hoverParagraph$.asObservable());B(this,"_hoverParagraphLeft$",new L.BehaviorSubject(null));B(this,"hoverParagraphLeft$",this._hoverParagraphLeft$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.startIndex)===(n==null?void 0:n.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverParagraphLeftRealTime$",this._hoverParagraphLeft$.asObservable());B(this,"_hoverTableCell$",new L.Subject);B(this,"hoverTableCell$",this._hoverTableCell$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.rowIndex)===(n==null?void 0:n.rowIndex)&&(e==null?void 0:e.colIndex)===(n==null?void 0:n.colIndex)&&(e==null?void 0:e.tableId)===(n==null?void 0:n.tableId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverTableCellRealTime$",this._hoverTableCell$.asObservable());B(this,"_hoverTable$",new L.Subject);B(this,"hoverTable$",this._hoverTable$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.tableId)===(n==null?void 0:n.tableId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverTableRealTime$",this._hoverTable$.asObservable());B(this,"_customRangeDirty",!0);B(this,"_bulletDirty",!0);B(this,"_paragraphDirty",!0);B(this,"_customRangeBounds",[]);B(this,"_bulletBounds",[]);B(this,"_paragraphBounds",new Map);B(this,"_paragraphLeftBounds",[]);B(this,"_tableParagraphBounds",new Map);B(this,"_segmentParagraphBounds",new Map);B(this,"_tableCellBounds",new Map);B(this,"_tableBounds",new Map);this._context=e,this._docSkeletonManagerService=n,this._initResetDirty(),this._initEvents(),this._initPointer()}get hoverParagraph(){return this._hoverParagraph$.value}get hoverParagraphLeft(){return this._hoverParagraphLeft$.value}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}get _documents(){return this._context.mainComponent}dispose(){this._hoverCustomRanges$.complete(),this._clickCustomRanges$.complete(),super.dispose()}_initPointer(){let e=_.CURSOR_TYPE.TEXT;this.disposeWithMe(this.hoverCustomRanges$.subscribe(n=>{n.length?(e=this._context.scene.getCursor(),this._context.scene.setCursor(_.CURSOR_TYPE.POINTER)):this._context.scene.setCursor(e)}))}_initResetDirty(){this.disposeWithMe(this._skeleton.dirty$.subscribe(()=>{this._customRangeDirty=!0,this._bulletDirty=!0,this._paragraphDirty=!0})),this.disposeWithMe(s.fromEventSubject(this._context.engine.onTransformChange$).pipe(L.filter(e=>e.type===_.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize)).subscribe(()=>{this._customRangeDirty=!0,this._bulletDirty=!0,this._paragraphDirty=!0}))}_initEvents(){this.disposeWithMe(s.fromEventSubject(this._context.scene.onPointerMove$).pipe(L.throttleTime(30)).subscribe(o=>{if(o.buttons>0){this._hoverBullet$.next(null),this._hoverCustomRanges$.next([]),this._hoverParagraph$.next(null),this._hoverParagraphLeft$.next(null),this._hoverTableCell$.next(null),this._hoverTable$.next(null);return}const{x:a,y:r}=Gs(o.offsetX,o.offsetY,this._context.scene);this._hoverCustomRanges$.next(this._calcActiveRanges({x:a,y:r})),this._hoverParagraph$.next(this._calcActiveParagraph({x:a,y:r})),this._hoverParagraphLeft$.next(this._calcActiveParagraphLeft({x:a,y:r})),this._hoverBullet$.next(this._calcActiveBullet({x:a,y:r}))})),this.disposeWithMe(this._context.scene.onPointerEnter$.subscribeEvent(()=>{this._hoverBullet$.next(null),this._hoverCustomRanges$.next([])}));const e=s.fromEventSubject(this._context.mainComponent.onPointerDown$),n=s.fromEventSubject(this._context.scene.onPointerUp$);this.disposeWithMe(e.pipe(L.switchMap(o=>n.pipe(L.take(1),L.map(a=>({down:o,up:a})))),L.filter(({down:o,up:a})=>o.target===a.target&&a.timeStamp-o.timeStamp<300)).subscribe(({down:o})=>{if(o.button===2)return;const a=Gs(o.offsetX,o.offsetY,this._context.scene),r=this._calcActiveRanges(a);r.length&&this._clickCustomRanges$.next(r.pop());const c=this._calcActiveBullet(a);c&&this._clickBullet$.next(c)}))}_buildCustomRangeBoundsBySegment(e,n=-1){var r,c,l;const o=(l=(c=(r=this._context.unit.getSelfOrHeaderFooterModel(e))==null?void 0:r.getBody())==null?void 0:c.customRanges)!=null?l:[],a=[];return o.forEach(A=>{const d={startOffset:A.startIndex,endOffset:A.endIndex+1,segmentId:e},u=$c(d,this._documents,this._skeleton,n);if(!u)return null;a.push({customRange:A,rects:u,segmentId:e,segmentPageIndex:n})}),a}_buildCustomRangeBounds(){var n;if(!this._customRangeDirty)return;this._customRangeDirty=!1;const e=[];e.push(...this._buildCustomRangeBoundsBySegment()),(n=this._skeleton.getSkeletonData())==null||n.pages.forEach((o,a)=>{o.headerId&&e.push(...this._buildCustomRangeBoundsBySegment(o.headerId,a)),o.footerId&&e.push(...this._buildCustomRangeBoundsBySegment(o.footerId,a))}),this._customRangeBounds=e}_calcActiveRanges(e){this._buildCustomRangeBounds();const{x:n,y:o}=e;return this._customRangeBounds.filter(r=>r.rects.some(c=>Ge(n,o,c))).map(r=>({segmentId:r.segmentId,range:r.customRange,segmentPageIndex:r.segmentPageIndex,rects:r.rects}))}_buildBulletBoundsBySegment(e,n=-1){var A,d,u,m,h;const o=(A=this._context.unit.getSelfOrHeaderFooterModel(e))==null?void 0:A.getBody(),a=((d=o==null?void 0:o.paragraphs)!=null?d:[]).filter(g=>g.bullet&&g.bullet.listType.indexOf("CHECK_LIST")===0),r=[],c=this._skeleton.getSkeletonData();if(!c)return r;const l=g=>{var p,f,S;for(const E of g){const C=[...E.sections];if(E.skeTables){const b=Array.from(E.skeTables.values());C.push(...b.map(R=>R.rows.map(v=>v.cells.map(O=>O.sections))).flat(4))}for(const b of C)for(const R of b.columns)for(const v of R.lines)if(v.paragraphStart){const O=a.find(M=>M.startIndex===v.paragraphIndex);if(O){const M=v,y=(S=(f=(p=M==null?void 0:M.divides)==null?void 0:p[0])==null?void 0:f.glyphGroup)==null?void 0:S[0];if(!y)continue;const N=el(y,this._documents,this._skeleton,n);if(!N)continue;r.push({rect:N,segmentId:e,segmentPageIndex:n,paragraph:O})}}}return r};if(e){const g=(h=(u=c.skeFooters.get(e))==null?void 0:u.values())!=null?h:(m=c.skeHeaders.get(e))==null?void 0:m.values();return g?l(Array.from(g)):r}return l(c.pages)}_buildBulletBounds(){var e;this._bulletDirty&&(this._bulletDirty=!1,this._bulletBounds=[],this._bulletBounds.push(...this._buildBulletBoundsBySegment()),(e=this._skeleton.getSkeletonData())==null||e.pages.forEach((n,o)=>{n.headerId&&this._bulletBounds.push(...this._buildBulletBoundsBySegment(n.headerId,o)),n.footerId&&this._bulletBounds.push(...this._buildBulletBoundsBySegment(n.footerId,o))}))}_calcActiveBullet(e){this._buildBulletBounds();const{x:n,y:o}=e;return this._bulletBounds.find(r=>Ge(n,o,r.rect))}_buildParagraphBoundsBySegment(e){var c,l,A;const n=this._skeleton.getSkeletonData(),a=this._documents.getOffsetConfig();if(!n)return null;const r=d=>{const u=new Map,m=(h,g,p,f)=>{js(h.sections,p,f,h.pageWidth-h.marginLeft-h.marginRight).forEach(E=>{if(!u.has(E.startIndex))u.set(E.startIndex,{rect:E.rect,paragraphStart:E.paragraphStart,paragraphEnd:E.paragraphEnd,startIndex:E.startIndex,rects:[E.rect],pageIndex:g,segmentId:e,firstLine:E.fisrtLine});else{const C=u.get(E.startIndex);C&&(C.rect.bottom=E.rect.bottom,C.rects.push(E.rect))}})};for(let h=0;h<d.length;h++){const g=d[h],p=((g.pageHeight===1/0?0:g.pageHeight)+a.pageMarginTop)*h+g.marginTop+a.docsTop,f=g.marginLeft+a.docsLeft;g.skeTables&&Array.from(g.skeTables.values()).forEach(S=>{const E=S.left+f,C=S.top+p,b=E+S.width,R=C+S.height,v=S.tableId;this._tableBounds.set(v,{rect:{left:E,top:C,right:b,bottom:R},pageIndex:h,tableId:v}),S.rows.forEach((O,M)=>{O.cells.forEach((y,N)=>{const x=((g.pageHeight===1/0?0:g.pageHeight)+a.pageMarginTop)*h+S.top+a.docsTop+g.marginTop+O.top+y.marginTop,w=S.left+a.docsLeft+g.marginLeft+y.left+y.marginLeft,H=js(y.sections,x,w,y.pageWidth-y.marginLeft-y.marginRight);let V=this._tableParagraphBounds.get(v);V||(V=[],this._tableParagraphBounds.set(v,V)),V.push(...H.map(Q=>({rect:Q.rect,paragraphStart:Q.paragraphStart,paragraphEnd:Q.paragraphEnd,startIndex:Q.startIndex,pageIndex:h,segmentId:e,rowIndex:M,colIndex:N,firstLine:Q.fisrtLine,tableId:v})));let F=this._tableCellBounds.get(v);F||(F=[],this._tableCellBounds.set(v,F)),F.push({rect:{top:x,left:w,right:w+y.pageWidth-y.marginLeft-y.marginRight,bottom:x+y.pageHeight-y.marginBottom-y.marginTop},pageIndex:h,rowIndex:M,colIndex:N,tableId:v})})})}),m(g,h,p,f)}return u};if(e){const d=(A=(c=n.skeFooters.get(e))==null?void 0:c.values())!=null?A:(l=n.skeHeaders.get(e))==null?void 0:l.values();return d?r(Array.from(d)):null}return r(n.pages)}_buildParagraphBounds(){var n,o;if(!this._paragraphDirty)return;this._paragraphDirty=!1,this._tableParagraphBounds=new Map,this._tableCellBounds=new Map,this._tableBounds=new Map,this._paragraphBounds=(n=this._buildParagraphBoundsBySegment())!=null?n:new Map,this._paragraphLeftBounds=Array.from(this._paragraphBounds.values()).map(a=>({...a,rect:{left:a.rect.left-60,right:a.rect.left,top:a.rect.top,bottom:a.rect.bottom}}));const e=a=>{var r;this._segmentParagraphBounds.set(a,(r=this._buildParagraphBoundsBySegment(a))!=null?r:new Map)};(o=this._skeleton.getSkeletonData())==null||o.pages.forEach(a=>{a.headerId&&e(a.headerId),a.footerId&&e(a.footerId)})}_calcActiveParagraph(e){var c,l;this._buildParagraphBounds();const{x:n,y:o}=e,a=Array.from(this._tableBounds.values()).find(A=>Ge(n,o,A.rect));if(this._hoverTable$.next(a),a){const A=(c=this._tableCellBounds.get(a.tableId))==null?void 0:c.find(m=>Ge(n,o,m.rect));if(this._hoverTableCell$.next(A),!A)return null;const d=(l=this._tableParagraphBounds.get(A.tableId))==null?void 0:l.filter(m=>m.colIndex===A.colIndex&&m.rowIndex===A.rowIndex),u=d==null?void 0:d.find(m=>Ge(n,o,m.rect));return u&&{...u,rects:[u.rect]}}return this._paragraphBounds.values().find(A=>A.rects.some(d=>Ge(n,o,d)))}_calcActiveParagraphLeft(e){this._buildParagraphBounds();const{x:n,y:o}=e;return this._paragraphLeftBounds.find(r=>Ge(n,o,r.rect))}get paragraphBounds(){return this._buildParagraphBounds(),this._paragraphBounds}findParagraphBoundByIndex(e){this._buildParagraphBounds();const n=this._paragraphBounds.get(e);return n||Array.from(this._tableParagraphBounds.values()).flat().find(a=>a.startIndex===e)}},T.DocEventManagerService=Jc([Zc(1,s.Inject(D.DocSkeletonManagerService))],T.DocEventManagerService);const tl=[ge.id,De.id,Be.id,_e.id,Ne.id,ye.id,Pe.id,Ue.id,we.id];function nl(i){const{avaliableMenus:t=tl}=i,e=I.useDependency(I.IMenuManagerService),[n,o]=U.useState([]);return U.useEffect(()=>{function a(){const c=e.getFlatMenuByPositionKey(I.MenuManagerPosition.RIBBON),l=[];for(const A of t){const d=c.find(u=>u.key===A);d&&l.push(d)}o(l)}a();const r=e.menuChanged$.subscribe(a);return()=>{r.unsubscribe()}},[e]),P.jsx("div",{className:J.clsx(`
206
+ `," ");let a=this._umdToHtml.convert(t);if(t.length===1&&e){a=a.replace(/(<[a-z]+)/,(m,h)=>`${h} data-copy-id="${n}"`);const d=t[0],u={body:d.body};if((l=(c=d.body)==null?void 0:c.customBlocks)!=null&&l.length){u.drawings={};for(const m of d.body.customBlocks){const{blockId:h}=m,g=(A=d.drawings)==null?void 0:A[h];if(g){const p=s.Tools.generateRandomId(6);m.blockId=p,u.drawings[p]={...s.Tools.deepClone(g),drawingId:p}}}}li.set(n,u)}return this._clipboardInterfaceService.write(o,a)}addClipboardHook(t){return this._clipboardHooks.push(t),s.toDisposable(()=>{const e=this._clipboardHooks.indexOf(t);e>-1&&this._clipboardHooks.splice(e,1)})}_getDocumentBodyInRanges(t,e){var d;const n=this._univerInstanceService.getCurrentUniverDocInstance(),o=e!=null?e:this._docSelectionManagerService.getDocRanges(),a=[];let r=!0;if(n==null||o.length===0)return;const c=o[0].segmentId,l=(d=n==null?void 0:n.getSelfOrHeaderFooterModel(c))==null?void 0:d.getBody(),A=n.getSnapshot();if(l!=null){for(const u of o){const{startOffset:m,endOffset:h,collapsed:g,rangeType:p}=u;if(g||m==null||h==null)continue;if(p===s.DOC_RANGE_TYPE.RECT){r=!1;const{spanEntireRow:E}=u;let C;C=Ss(l,m,h),a.push(C);continue}const f={startOffset:m,endOffset:h},S=n.getSelfOrHeaderFooterModel(c).sliceBody(f.startOffset,f.endOffset,t);S!=null&&a.push(S)}return{newSnapshotList:a.map(u=>({...A,body:u})),needCache:r,snapshot:A,ranges:o}}}async _genDocDataFromClipboardItems(t){try{let e="",n="";const o=[];for(const a of t)for(const r of a.types)switch(r){case v.PLAIN_TEXT_CLIPBOARD_MIME_TYPE:{n=await a.getType(r).then(c=>c&&c.text());break}case v.HTML_CLIPBOARD_MIME_TYPE:{e=await a.getType(r).then(c=>c&&c.text());break}case v.FILE__BMP_CLIPBOARD_MIME_TYPE:case v.FILE__JPEG_CLIPBOARD_MIME_TYPE:case v.FILE__WEBP_CLIPBOARD_MIME_TYPE:case v.FILE_PNG_CLIPBOARD_MIME_TYPE:{const c=await a.getType(r),l=new File([c],`pasted_image.${r.split("/")[1]}`,{type:r});o.push(l);break}}return!e&&!n&&o.length&&(e=await this._createImagePasteHtml(o)),this._genDocDataFromHtmlAndText(e,n)}catch(e){return Promise.reject(e)}}_genDocDataFromHtmlAndText(t,e,n){if(!t){if(e)return{body:s.BuildTextUtils.transform.fromPlainText(e)};throw new Error("[DocClipboardService] html and text cannot be both empty!")}const o=Wr(t);if(o){const r=li.get(o);if(r)return r}if(!n){const r=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);n=(r==null?void 0:r.getUnitId())||""}const a=this._htmlToUDM.convert(t,{unitId:n});return o&&li.set(o,a),a}async _createImagePasteHtml(t){var c,l;const e={id:"",documentStyle:{},body:{dataStream:"",customBlocks:[]},drawings:{}},n=async A=>{const d=new FileReader;return new Promise(u=>{d.onloadend=function(){u({source:d.result,imageSourceType:Dn.ImageSourceType.BASE64})},d.readAsDataURL(A)})},o=A=>{const d=new Image,u=500;return new Promise(m=>{d.src=typeof A=="string"?A:URL.createObjectURL(A),d.onload=()=>{const h=Math.min(u,d.naturalWidth),g=d.naturalHeight/d.naturalWidth;m({width:h,height:h*g})}})},a=(l=(c=this._clipboardHooks.find(A=>A.onBeforePasteImage))==null?void 0:c.onBeforePasteImage)!=null?l:n;return await Promise.all(t.map(async(A,d)=>{var S;const u=await a(A);if(!u)return Promise.resolve();const{width:m=100,height:h=100}=await o(A),g=`paste_image_id_${d}`,p=e.body,f=e.drawings;p.dataStream+="\b",(S=p.customBlocks)==null||S.push({startIndex:d,blockId:g}),f[g]={drawingId:g,unitId:"",subUnitId:"",imageSourceType:u.imageSourceType,title:"",source:u.source,description:"",layoutType:s.PositionedObjectLayoutType.INLINE,drawingType:s.DrawingTypeEnum.DRAWING_IMAGE,transform:{width:m,height:h,angle:0},docTransform:{angle:0,size:{width:m,height:h},positionH:{relativeFrom:s.ObjectRelativeFromH.CHARACTER,posOffset:0},positionV:{relativeFrom:s.ObjectRelativeFromV.LINE,posOffset:0}}}})),this._umdToHtml.convert([e])}};ui=qr([ft(0,s.IUniverInstanceService),ft(1,s.ILogService),ft(2,s.ICommandService),ft(3,v.IClipboardInterfaceService),ft(4,s.Inject(D.DocSelectionManagerService))],ui);function $t(i){return i.getContextValue(s.FOCUSING_DOC)||i.getContextValue(s.EDITOR_ACTIVATED)}const hi=999,St={id:v.CopyCommand.id,name:"doc.command.copy",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>i.get(xe).copy()},gi={id:"doc.command.copy-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(xe),e=mt(i);return e?t.copy(s.SliceBodyType.copy,[{startOffset:e.paragraphStart,endOffset:e.paragraphEnd+1,collapsed:!1}]):!1}},en={id:v.CutCommand.id,name:"doc.command.cut",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>i.get(xe).cut()},mi={id:"doc.command.cut-current-paragraph",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(xe),e=mt(i);return e?t.cut([{startOffset:e.paragraphStart,endOffset:e.paragraphEnd+1,collapsed:!1,rangeType:s.DOC_RANGE_TYPE.TEXT}]):!1}},tn={id:v.PasteCommand.id,name:"doc.command.paste",type:s.CommandType.COMMAND,multi:!0,priority:hi,preconditions:$t,handler:async i=>{const t=i.get(xe),n=await i.get(v.IClipboardInterfaceService).read();return n.length===0?!1:t.paste(n)}};var Jr=Object.getOwnPropertyDescriptor,Zr=(i,t,e,n)=>{for(var o=n>1?void 0:n?Jr(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},pi=(i,t)=>(e,n)=>t(e,n,i);const $r=11,ec=9,nn={ff:"Arial",fs:$r};let Te=class extends s.Disposable{constructor(t,e,n){super();B(this,"_cacheStyle",null);this._textSelectionManagerService=t,this._univerInstanceService=e,this._renderManagerService=n,this._init()}_init(){this._listenDocRangeChange()}_listenDocRangeChange(){this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(()=>{this._clearStyleCache()}))}getStyleCache(){return this._cacheStyle}getDefaultStyle(){var r;const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(t==null)return{...nn};const e=t==null?void 0:t.getUnitId(),n=(r=this._renderManagerService.getRenderById(e))==null?void 0:r.with(D.DocSkeletonManagerService),o=n==null?void 0:n.getViewModel();return o==null?{...nn}:o.getEditArea()===_.DocumentEditArea.BODY?{...nn}:{...nn,fs:ec}}setStyleCache(t){this._cacheStyle={...this._cacheStyle,...t}}_clearStyleCache(){this._cacheStyle=null}};Te=Zr([pi(0,s.Inject(D.DocSelectionManagerService)),pi(1,s.IUniverInstanceService),pi(2,_.IRenderManagerService)],Te);function fi(i,t,e){const n=[];for(let o=0,a=i.length;o<a;o++)i[o]===s.DataStreamTreeTokenType.PARAGRAPH&&n.push({startIndex:o});if(t)for(const o of n)t.bullet&&(o.bullet=s.Tools.deepClone(t.bullet)),t.paragraphStyle&&(o.paragraphStyle=s.Tools.deepClone(t.paragraphStyle),delete o.paragraphStyle.borderBottom,t.paragraphStyle.headingId&&(o.paragraphStyle.headingId=s.generateRandomId(6)));if(e)for(const o of n)o.paragraphStyle||(o.paragraphStyle={}),o.paragraphStyle.borderBottom=e;return n}const on={id:"doc.command.break-line",type:s.CommandType.COMMAND,handler:(i,t)=>{var Q,j,G,k,W;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=i.get(Te),r=(Q=t==null?void 0:t.textRange)!=null?Q:e.getActiveTextRange(),c=e.getRectRanges();if(r==null)return!1;if(c&&c.length){const{startOffset:z}=r;return e.replaceDocRanges([{startOffset:z,endOffset:z}]),!0}const{horizontalLine:l}=t!=null?t:{},{segmentId:A}=r,d=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A!=null?A:"").getBody();if(d==null||u==null)return!1;const m=d.getUnitId(),{startOffset:h,endOffset:g}=r,f=((j=u.paragraphs)!=null?j:[]).find(z=>z.startIndex>=h);if(!f)return!1;const S=h===f.startIndex,E=f.startIndex,C=a.getDefaultStyle(),b=a.getStyleCache(),R=Qt(u,g,C,b),I={dataStream:s.DataStreamTreeTokenType.PARAGRAPH,paragraphs:fi(s.DataStreamTreeTokenType.PARAGRAPH,f,l),textRuns:[{st:0,ed:1,ts:{...R.ts}}]};if(d==null)return!1;const O=e.getActiveTextRange();if(u==null)return!1;const{collapsed:M}=r,y=I.dataStream.length,N=[{startOffset:h+y,endOffset:h+y,style:O==null?void 0:O.style,collapsed:M}],x={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:N,debounce:!0}},w=new s.TextX,H=s.JSONX.getInstance();if(M)h>0&&w.push({t:s.TextXActionType.RETAIN,len:h}),w.push({t:s.TextXActionType.INSERT,body:I,len:I.dataStream.length});else{const z=s.BuildTextUtils.selection.delete([r],u,0,I);w.push(...z)}(((G=f.bullet)==null?void 0:G.listType)===s.PresetListType.CHECK_LIST_CHECKED||(k=f.paragraphStyle)!=null&&k.headingId)&&(r.endOffset<E&&w.push({t:s.TextXActionType.RETAIN,len:E-r.endOffset}),w.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...f,paragraphStyle:{...f.paragraphStyle,...S?{headingId:void 0,namedStyleType:void 0}:null},startIndex:0,bullet:(W=f.paragraphStyle)!=null&&W.headingId?void 0:{...f.bullet,listType:s.PresetListType.CHECK_LIST}}]},coverType:s.UpdateDocsAttributeType.REPLACE})),x.params.textRanges=[{startOffset:h+y,endOffset:h+y,collapsed:M}];const V=Z(d,A);return x.params.actions=H.editOp(w.serialize(),V),!!o.syncExecuteCommand(x.id,x.params)}},vt={id:"doc.command.horizontal-line",type:s.CommandType.COMMAND,handler:(i,t)=>i.get(s.ICommandService).syncExecuteCommand(on.id,{horizontalLine:{padding:5,color:{rgb:"#CDD0D8"},width:1,dashStyle:s.DashStyleType.SOLID},textRange:t==null?void 0:t.insertRange})},Si={id:"doc.command.insert-horizontal-line-bellow",type:s.CommandType.COMMAND,handler:i=>{const t=i.get(s.ICommandService),e=mt(i);return e?t.syncExecuteCommand(vt.id,{insertRange:{startOffset:e.startIndex+1,endOffset:e.startIndex+1}}):!1}};function ue(i,t,e){return e.executeCommand(be.id,{preCommandId:i,...t!=null?t:{}})}const vs="doc.command.set-inline-format-bold",De={id:vs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(vs,t,e)}},Is="doc.command.set-inline-format-italic",Be={id:Is,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Is,t,e)}},Es="doc.command.set-inline-format-underline",_e={id:Es,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Es,t,e)}},Cs="doc.command.set-inline-format-strikethrough",Ne={id:Cs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Cs,t,e)}},Ts="doc.command.set-inline-format-subscript",ye={id:Ts,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Ts,t,e)}},ys="doc.command.set-inline-format-superscript",Pe={id:ys,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(ys,t,e)}},bs="doc.command.set-inline-format-fontsize",ge={id:bs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(bs,t,e)}},Os="doc.command.set-inline-format-font-family",We={id:Os,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Os,t,e)}},Rs="doc.command.set-inline-format-text-color",Ue={id:Rs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Rs,t,e)}},Ms="doc.command.set-inline-format-text-background-color",we={id:Ms,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(Ms,t,e)}},xs="doc.command.reset-inline-format-text-background-color",tt={id:xs,type:s.CommandType.COMMAND,handler:async(i,t)=>{const e=i.get(s.ICommandService);return ue(xs,t,e)}},vi={[De.id]:"bl",[Be.id]:"it",[_e.id]:"ul",[Ne.id]:"st",[ge.id]:"fs",[We.id]:"ff",[Ue.id]:"cl",[we.id]:"bg",[tt.id]:"bg",[ye.id]:"va",[Pe.id]:"va"},be={id:"doc.command.set-inline-format",type:s.CommandType.COMMAND,handler:async(i,t)=>{var R;const{value:e,preCommandId:n}=t,o=i.get(s.ICommandService),a=i.get(D.DocSelectionManagerService),r=i.get(s.IUniverInstanceService),c=i.get(Te),l=a.getDocRanges(),A=(R=l.find(I=>I.isActive))!=null?R:l[0];if(l.length===0)return!1;const{segmentId:d}=l[0],u=r.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(u==null)return!1;const m=u.getSelfOrHeaderFooterModel(d).getBody();if(m==null)return!1;const h=u.getUnitId();let g;switch(n){case De.id:case Be.id:case _e.id:case Ne.id:case ye.id:case Pe.id:{const I=c.getDefaultStyle(),O=Bs(m,A,I);g=nc(O,n);break}case ge.id:case We.id:{g=e;break}case Ue.id:case we.id:{g={rgb:e};break}case tt.id:{g={rgb:null};break}default:throw new Error(`Unknown command: ${n} in handleInlineFormat`)}const p={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:l}},f=new s.TextX,S=s.JSONX.getInstance(),E=new s.MemoryCursor;E.reset();for(const I of l){let{startOffset:O,endOffset:M,rangeType:y}=I;if(O==null||M==null)continue;if(y===s.DOC_RANGE_TYPE.RECT&&(O=O-1),O===M){const w=c.getStyleCache(),H=vi[n];c.setStyleCache({[H]:(w==null?void 0:w[H])!==void 0?Ds(w,H,n):g});continue}const N={dataStream:"",textRuns:[{st:0,ed:M-O,ts:{[vi[n]]:g}}]},x=O-E.cursor;x!==0&&f.push({t:s.TextXActionType.RETAIN,len:x}),f.push({t:s.TextXActionType.RETAIN,body:N,len:M-O}),E.reset(),E.moveCursor(M)}const C=Z(u,d);return p.params.actions=S.editOp(f.serialize(),C),!!o.syncExecuteCommand(p.id,p.params)}};function tc(i){return i!==null&&typeof i=="object"}function Ds(i,t,e){if(/bl|it/.test(t))return(i==null?void 0:i[t])===s.BooleanNumber.TRUE?s.BooleanNumber.FALSE:s.BooleanNumber.TRUE;if(/ul|st/.test(t))return tc(i==null?void 0:i[t])&&(i==null?void 0:i[t]).s===s.BooleanNumber.TRUE?{s:s.BooleanNumber.FALSE}:{s:s.BooleanNumber.TRUE};if(/va/.test(t))return e===ye.id?(i==null?void 0:i[t])===s.BaselineOffset.SUBSCRIPT?s.BaselineOffset.NORMAL:s.BaselineOffset.SUBSCRIPT:(i==null?void 0:i[t])===s.BaselineOffset.SUPERSCRIPT?s.BaselineOffset.NORMAL:s.BaselineOffset.SUPERSCRIPT}function Bs(i,t,e){var d,u,m,h,g,p,f,S,E,C,b,R,I,O;const{startOffset:n,endOffset:o,collapsed:a}=t;if(a){const M=(d=i.textRuns)!=null?d:[];let y=null;for(let N=M.length-1;N>=0;N--){const x=M[N];if(x.st<n&&n<=x.ed){y=x;break}}return y!=null&&y.ts?{...e,...y.ts}:e}const{textRuns:r=[]}=s.getBodySlice(i,n,o),c=s.Tools.deepClone(e),l=r.map(M=>{var y;return(y=M==null?void 0:M.ts)==null?void 0:y.fs}).filter(Boolean);c.fs=c.fs?Math.max(c.fs,...l):l.length?Math.max(...l):void 0,c.fs=!c.fs||Number.isNaN(c.fs)?void 0:c.fs,c.ff=(h=(m=(u=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.ff)!=null}))==null?void 0:u.ts)==null?void 0:m.ff)!=null?h:c.ff,c.it=r.length&&r.every(M=>{var y;return((y=M.ts)==null?void 0:y.it)===s.BooleanNumber.TRUE})?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,c.bl=r.length&&r.every(M=>{var y;return((y=M.ts)==null?void 0:y.bl)===s.BooleanNumber.TRUE})?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,c.ul=r.length&&r.every(M=>{var y,N;return((N=(y=M.ts)==null?void 0:y.ul)==null?void 0:N.s)===s.BooleanNumber.TRUE})?(g=r[0].ts)==null?void 0:g.ul:c.ul,c.st=r.length&&r.every(M=>{var y,N;return((N=(y=M.ts)==null?void 0:y.st)==null?void 0:N.s)===s.BooleanNumber.TRUE})?(p=r[0].ts)==null?void 0:p.st:c.st,c.bg=(E=(S=(f=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.bg)!=null}))==null?void 0:f.ts)==null?void 0:S.bg)!=null?E:c.bg,c.cl=(R=(b=(C=r.find(M=>{var y;return((y=M.ts)==null?void 0:y.cl)!=null}))==null?void 0:C.ts)==null?void 0:b.cl)!=null?R:c.cl;const A=r.filter(M=>{var y;return((y=M==null?void 0:M.ts)==null?void 0:y.va)!=null});if(A.length>0&&A.length===r.length){const M=(I=A[0].ts)==null?void 0:I.va;let y=!0;for(let N=1;N<A.length;N++)if(((O=A[N].ts)==null?void 0:O.va)!==M){y=!1;break}y&&(c.va=M)}return c}function nc(i,t){const e=vi[t];return Ds(i,e,t)}const nt={id:"doc.command.list-operation",type:s.CommandType.COMMAND,handler:(i,t)=>{var b,R,I,O,M,y;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=t.listType,r=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=(R=(b=t.docRange)!=null?b:e.getDocRanges())!=null?R:[];if(r==null||c.length===0)return!1;const l=c[0].segmentId,A=r.getSelfOrHeaderFooterModel(l),d=(O=(I=A.getBody())==null?void 0:I.paragraphs)!=null?O:[],u=(y=(M=A.getBody())==null?void 0:M.dataStream)!=null?y:"";if(!d.length)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c,isEditing:!1}};new s.MemoryCursor().reset();const f=s.BuildTextUtils.paragraph.bullet.switch({paragraphs:m,listType:a,document:r,segmentId:l}),S=s.JSONX.getInstance(),E=Z(r,l);return g.params.actions=S.editOp(f.serialize(),E),!!o.syncExecuteCommand(g.id,g.params)}},It={id:"doc.command.change-list-type",type:s.CommandType.COMMAND,handler:(i,t)=>{var C,b,R,I,O;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{listType:a}=t,r=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=(C=t.docRange)!=null?C:e.getDocRanges();if(r==null||c==null||!c.length)return!1;const{segmentId:l}=c[0],A=r.getSelfOrHeaderFooterModel(l),d=(R=(b=A.getBody())==null?void 0:b.paragraphs)!=null?R:[],u=(O=(I=A.getBody())==null?void 0:I.dataStream)!=null?O:"";if(!d.length)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g=s.BuildTextUtils.paragraph.bullet.set({paragraphs:m,listType:a,segmentId:l,document:r});if(!g)return!1;const p=s.JSONX.getInstance(),f={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c,isEditing:!1}},S=Z(r,l);return f.params.actions=p.editOp(g.serialize(),S),!!o.syncExecuteCommand(f.id,f.params)}};var Et=(i=>(i[i.increase=1]="increase",i[i.decrease=-1]="decrease",i))(Et||{});const sn={id:"doc.command.change-list-nesting-level",type:s.CommandType.COMMAND,handler:(i,t)=>{var b,R,I,O,M;if(!t)return!1;const{type:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=n.getActiveTextRange();if(r==null||c==null)return!1;const{segmentId:l}=c,A=(b=n.getDocRanges())!=null?b:[],d=r.getSelfOrHeaderFooterModel(l),u=(I=(R=d.getBody())==null?void 0:R.paragraphs)!=null?I:[],m=(M=(O=d.getBody())==null?void 0:O.dataStream)!=null?M:"";if(!u.length)return!1;const h=s.BuildTextUtils.range.getParagraphsInRange(c,u,m),g=r.getUnitId(),p=s.JSONX.getInstance(),f=s.BuildTextUtils.paragraph.bullet.changeNestLevel({paragraphs:h,type:e,segmentId:l,document:r}),S={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:A,isEditing:!1}},E=Z(r,l);return S.params.actions=p.editOp(f.serialize(),E),!!a.syncExecuteCommand(S.id,S.params)}},it={id:"doc.command.bullet-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(It.id,{listType:t.value,docRange:t.docRange}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.BULLET_LIST,docRange:t==null?void 0:t.docRange})}},Ct={id:"doc.command.check-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(It.id,{listType:t.value,docRange:t.docRange}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.CHECK_LIST,docRange:t==null?void 0:t.docRange})}},Ii={id:"doc.command.toggle-check-list",type:s.CommandType.COMMAND,handler:(i,t)=>{var p;if(!t)return!1;const e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),{index:o,segmentId:a,textRanges:r}=t,c=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(c==null||((p=c.getSelfOrHeaderFooterModel(a).getBody())==null?void 0:p.paragraphs)==null)return!1;const A=c.getUnitId(),d={id:D.RichTextEditingMutation.id,params:{unitId:A,actions:[],textRanges:r!=null?r:[],segmentId:a,isEditing:!1}},u=s.BuildTextUtils.paragraph.bullet.toggleChecklist({document:c,paragraphIndex:o,segmentId:a});if(!u)return!1;const m=s.JSONX.getInstance(),h=Z(c,a);return d.params.actions=m.editOp(u.serialize(),h),!!n.syncExecuteCommand(d.id,d.params)}},ot={id:"doc.command.order-list",type:s.CommandType.COMMAND,handler:(i,t)=>{const e=i.get(s.ICommandService);return t!=null&&t.value?e.syncExecuteCommand(It.id,{listType:t.value}):e.syncExecuteCommand(nt.id,{listType:s.PresetListType.ORDER_LIST})}},Ei={id:"doc.command.quick-list",type:s.CommandType.COMMAND,handler(i,t){var X,Y,q,K,$;if(!t)return!1;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=e.getActiveTextRange();if(a==null||r==null)return!1;const{segmentId:c,startOffset:l}=r,{listType:A,paragraph:d}=t,{paragraphStart:u,paragraphEnd:m}=d,h=new s.TextX,g=s.JSONX.getInstance(),{defaultTabStop:p=36}=a.getSnapshot().documentStyle,f=(Y=(X=a.getSelfOrHeaderFooterModel(c).getBody())==null?void 0:X.sectionBreaks)!=null?Y:[],{startIndex:S,paragraphStyle:E={}}=d,{indentFirstLine:C,snapToGrid:b,indentStart:R}=E,I=s.PRESET_LIST_TYPE[A].nestingLevel[0].paragraphProperties||{},{hanging:O,indentStart:M}=I,y=I.textStyle,{charSpace:N,gridType:x}=ic(S,f)||{charSpace:0,gridType:s.GridType.LINES},w=_.getCharSpaceApply(N,p,x,b);let V=s.Tools.generateRandomId(6);const F=(K=(q=a.getBody())==null?void 0:q.paragraphs)!=null?K:[],Q=F.findIndex(ie=>ie.startIndex===d.startIndex),j=F[Q-1],G=F[Q+1];j&&j.bullet&&j.bullet.listType.indexOf(A)===0?V=j.bullet.listId:G&&G.bullet&&G.bullet.listType.indexOf(A)===0&&(V=G.bullet.listId);const k={id:D.RichTextEditingMutation.id,params:{unitId:a.getUnitId(),actions:[],textRanges:[{startOffset:u,endOffset:u,collapsed:!0}],isEditing:!1}};h.push({t:s.TextXActionType.RETAIN,len:u}),h.push({t:s.TextXActionType.DELETE,len:l-u}),m>l&&h.push({t:s.TextXActionType.RETAIN,len:m-l}),h.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...E,textStyle:{...E.textStyle,...y},indentFirstLine:void 0,hanging:O,indentStart:{v:_.getNumberUnitValue(M,w)-_.getNumberUnitValue(O,w)+_.getNumberUnitValue(C,w)+_.getNumberUnitValue(R,w)}},bullet:{...($=d.bullet)!=null?$:{nestingLevel:0,textStyle:{fs:20}},listType:A,listId:V}}]}});const W=Z(a,c);return k.params.actions=g.editOp(h.serialize(),W),!!o.syncExecuteCommand(k.id,k.params)}};function Ci(i,t){var d,u;const e=i.get(s.ICommandService),n=mt(i);if(!n)return!1;const o=i.get(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!o)return!1;const a=s.BuildTextUtils.selection.replace({doc:o,selection:{startOffset:n.startIndex+1,endOffset:n.startIndex+1,collapsed:!0},body:{dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:{...n.paragraphStyle},bullet:{listType:t,listId:((d=n.bullet)==null?void 0:d.listType)===t?n.bullet.listId:s.Tools.generateRandomId(6),nestingLevel:((u=n.bullet)==null?void 0:u.listType)===t?n.bullet.nestingLevel:0}}]}});if(!a)return!1;const r={id:D.RichTextEditingMutation.id,params:{unitId:o.getUnitId(),actions:[],textRanges:[{startOffset:n.startIndex+1,endOffset:n.startIndex+1,collapsed:!0}],isEditing:!1}},c=s.JSONX.getInstance(),l=Z(o);return r.params.actions=c.editOp(a.serialize(),l),!!e.syncExecuteCommand(r.id,r.params)}const Ti={id:"doc.command.insert-bullet-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.BULLET_LIST)},yi={id:"doc.command.insert-order-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.ORDER_LIST)},bi={id:"doc.command.insert-check-list-bellow",type:s.CommandType.COMMAND,handler:i=>Ci(i,s.PresetListType.CHECK_LIST)};function ic(i,t){const e=t.sort(s.sortRulesFactory("startIndex"));for(let n=0;n<e.length;n++){const o=t[n];if(o.startIndex>=i)return o}}const de={id:"doc.command.set-paragraph-named-style",type:s.CommandType.COMMAND,handler(i,t){var g;if(!t)return!1;const n=i.get(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!n)return!1;const o=n.getUnitId(),a=i.get(D.DocSelectionManagerService),r=(g=t.textRanges)!=null?g:a.getTextRanges({unitId:o,subUnitId:o});if(!(r!=null&&r.length))return!1;const c=r[0].segmentId,l=s.BuildTextUtils.paragraph.style.set({document:n.getSelfOrHeaderFooterModel(c),textRanges:r,style:{namedStyleType:t.value,headingId:!t.value||t.value===s.NamedStyleType.NORMAL_TEXT?void 0:s.generateRandomId(6),spaceAbove:void 0,spaceBelow:void 0},paragraphTextRun:{}}),A={id:D.RichTextEditingMutation.id,params:{actions:[],textRanges:r,unitId:o,segmentId:c}},d=s.JSONX.getInstance(),u=Z(n,c);return A.params.actions=d.editOp(l.serialize(),u),!!i.get(s.ICommandService).syncExecuteCommand(A.id,A.params)}},_s={id:"doc.command.quick-heading",type:s.CommandType.COMMAND,handler(i,t){var R,I,O,M;if(!t)return!1;const{value:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),c=n.getActiveTextRange();if(r==null||c==null||!c.collapsed)return!1;const{segmentId:l,startOffset:A}=c,d=r.getSelfOrHeaderFooterModel(l),u=(I=(R=d.getBody())==null?void 0:R.paragraphs)!=null?I:[],m=(M=(O=d.getBody())==null?void 0:O.dataStream)!=null?M:"",h=s.BuildTextUtils.paragraph.util.getParagraphsInRange(c,u,m)[0];if(!h)return!1;const{paragraphStart:g}=h,p=new s.TextX,f=s.JSONX.getInstance(),{paragraphStyle:S={}}=h,E={id:D.RichTextEditingMutation.id,params:{unitId:r.getUnitId(),actions:[],textRanges:[{startOffset:g,endOffset:g,collapsed:!0}],isEditing:!1}};p.push({t:s.TextXActionType.RETAIN,len:g}),s.BuildTextUtils.paragraph.style.set({textRanges:[c],document:r,style:{...S,headingId:s.generateRandomId(6),namedStyleType:e},cursor:A,deleteLen:A-g,textX:p,paragraphTextRun:{}});const C=Z(r,l);return E.params.actions=f.editOp(p.serialize(),C),!!a.syncExecuteCommand(E.id,E.params)}},Oi={"#":s.NamedStyleType.HEADING_1,"##":s.NamedStyleType.HEADING_2,"###":s.NamedStyleType.HEADING_3,"####":s.NamedStyleType.HEADING_4,"#####":s.NamedStyleType.HEADING_5},Ri={id:"doc.command.h1-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_1})},Mi={id:"doc.command.h2-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_2})},xi={id:"doc.command.h3-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_3})},Di={id:"doc.command.h4-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_4})},Bi={id:"doc.command.h5-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.HEADING_5})},an={id:"doc.command.normal-text-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.NORMAL_TEXT})},Ns={id:"doc.command.title",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.TITLE})},Ps={id:"doc.command.subtitle-heading",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(de.id,{value:s.NamedStyleType.SUBTITLE})},me={id:"doc.command.align-action",type:s.CommandType.COMMAND,handler:(i,t)=>{var R,I,O,M;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),{alignType:a}=t,r=n.getCurrentUniverDocInstance();if(r==null)return!1;const c=e.getDocRanges();if(c.length===0)return!1;const l=c[0].segmentId,A=r.getSelfOrHeaderFooterModel(l),d=(I=(R=A.getBody())==null?void 0:R.paragraphs)!=null?I:[],u=(M=(O=A.getBody())==null?void 0:O.dataStream)!=null?M:"";if(d==null)return!1;const m=s.BuildTextUtils.range.getParagraphsInRanges(c,d,u),h=r.getUnitId(),g=m.every(y=>{var N;return((N=y.paragraphStyle)==null?void 0:N.horizontalAlign)===a}),p={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:c}},f=new s.MemoryCursor;f.reset();const S=new s.TextX,E=s.JSONX.getInstance();for(const y of m){const{startIndex:N}=y;S.push({t:s.TextXActionType.RETAIN,len:N-f.cursor});const x={...y.paragraphStyle,horizontalAlign:g?s.HorizontalAlign.UNSPECIFIED:a};S.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...y,paragraphStyle:x,startIndex:0}]},coverType:s.UpdateDocsAttributeType.REPLACE}),f.moveCursorTo(N+1)}const C=Z(r,l);return p.params.actions=E.editOp(S.serialize(),C),!!o.syncExecuteCommand(p.id,p.params)}},Tt={id:"doc.command.align-left",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.LEFT})},yt={id:"doc.command.align-center",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.CENTER})},bt={id:"doc.command.align-right",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.RIGHT})},Ot={id:"doc.command.align-justify",type:s.CommandType.COMMAND,handler:i=>i.get(s.ICommandService).syncExecuteCommand(me.id,{alignType:s.HorizontalAlign.JUSTIFIED})},Rt={id:"doc.command.switch-mode",type:s.CommandType.COMMAND,handler:i=>{var E,C,b,R,I;const t=i.get(s.ICommandService),e=i.get(_.IRenderManagerService),n=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(a==null)return!1;const r=a.getUnitId(),c=(E=e.getRenderById(r))==null?void 0:E.with(D.DocSkeletonManagerService).getSkeleton(),l=(C=e.getRenderById(r))==null?void 0:C.with(T.DocSelectionRenderService);if(c==null||l==null)return!1;const A=l==null?void 0:l.getSegment(),d=l==null?void 0:l.getSegmentPage(),u=a.getSnapshot().documentStyle.documentFlavor,m=n.getDocRanges(),h={id:D.RichTextEditingMutation.id,params:{unitId:r,actions:[],textRanges:u===s.DocumentFlavor.TRADITIONAL&&A?[]:m}},g=s.JSONX.getInstance(),p=[];let f;if(u===void 0?f=g.insertOp(["documentStyle","documentFlavor"],s.DocumentFlavor.MODERN):u===s.DocumentFlavor.MODERN?f=g.replaceOp(["documentStyle","documentFlavor"],u,s.DocumentFlavor.TRADITIONAL):f=g.replaceOp(["documentStyle","documentFlavor"],u,s.DocumentFlavor.MODERN),f)p.push(f);else return!1;if(u!==s.DocumentFlavor.MODERN){const O=a.getSnapshot(),{drawings:M={},body:y}=O,N=(b=y==null?void 0:y.customBlocks)!=null?b:[];for(const x in M){const w=M[x],H=N.find($=>$.blockId===x);if(H==null)continue;const V=w.docTransform.positionV,{relativeFrom:F,posOffset:Q}=V;if(F===s.ObjectRelativeFromV.PARAGRAPH)continue;const{startIndex:j}=H,G=c.findNodeByCharIndex(j,A,d),k=(R=G==null?void 0:G.parent)==null?void 0:R.parent,W=k==null?void 0:k.parent,z=W==null?void 0:W.lines.find($=>$.paragraphIndex===(k==null?void 0:k.paragraphIndex)&&$.paragraphStart),X=(I=W==null?void 0:W.parent)==null?void 0:I.parent;if(G==null||k==null||z==null||W==null||X==null)continue;let Y=0;F===s.ObjectRelativeFromV.LINE?Y-=k.top:F===s.ObjectRelativeFromV.PAGE&&(Y+=X.marginTop),Y+=z.top;const q={...V,relativeFrom:s.ObjectRelativeFromV.PARAGRAPH,posOffset:(Q!=null?Q:0)-Y},K=g.replaceOp(["drawings",x,"docTransform","positionV"],V,q);K&&p.push(K)}}return h.params.actions=p.reduce((O,M)=>s.JSONX.compose(O,M),null),!!t.syncExecuteCommand(h.id,h.params)}},Us="COMPONENT_DOC_CREATE_TABLE_CONFIRM",_i={id:"doc.command.create-table",type:s.CommandType.COMMAND,handler:async(i,t)=>{var q,K,$,ie,fe;const{rowCount:e,colCount:n}=t,o=i.get(D.DocSelectionManagerService),a=i.get(s.IUniverInstanceService),r=i.get(s.ICommandService),c=i.get(Te),l=o.getActiveTextRange();if(l==null)return!1;const{segmentId:A,segmentPage:d}=l,u=a.getCurrentUniverDocInstance(),m=u==null?void 0:u.getSelfOrHeaderFooterModel(A).getBody();if(u==null||m==null)return!1;const h=u.getUnitId(),g=re(i,h),p=g==null?void 0:g.getSkeleton();if(p==null)return!1;const{startOffset:f}=l,E=((q=m.paragraphs)!=null?q:[]).find(Fe=>Fe.startIndex>=f),C=p.findNodeByCharIndex(f,A,d);if(C==null)return!1;const b=new s.TextX,R=s.JSONX.getInstance(),I=[],O=f+4,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:h,actions:[],textRanges:M}};f>0&&b.push({t:s.TextXActionType.RETAIN,len:f}),b.push({t:s.TextXActionType.INSERT,body:{dataStream:s.DataStreamTreeTokenType.PARAGRAPH,paragraphs:fi(s.DataStreamTreeTokenType.PARAGRAPH,E)},len:1});const N=c.getDefaultStyle(),x=c.getStyleCache(),w=Qt(m,f,N,x),{dataStream:H,paragraphs:V,sectionBreaks:F}=Rr(e,n),Q=(fe=(ie=($=(K=C.parent)==null?void 0:K.parent)==null?void 0:$.parent)==null?void 0:ie.parent)==null?void 0:fe.parent;if(Q==null)return!1;const{pageWidth:j,marginLeft:G,marginRight:k}=Q,W=ni(e,n,j-G-k);b.push({t:s.TextXActionType.INSERT,body:{dataStream:H,paragraphs:V,sectionBreaks:F,textRuns:[{...w,st:0,ed:H.length}],tables:[{startIndex:0,endIndex:H.length,tableId:W.tableId}]},len:H.length});const z=Z(u,A);I.push(R.editOp(b.serialize(),z));const X=R.insertOp(["tableSource",W.tableId],W);return I.push(X),y.params.actions=I.reduce((Fe,Se)=>s.JSONX.compose(Fe,Se),null),!!r.syncExecuteCommand(y.id,y.params)}},Ni="doc.component.create-table-confirm",rn={id:"doc.operation.create-table",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(s.LocaleService),e=i.get(v.IConfirmService),n=i.get(s.ICommandService),o={rowCount:3,colCount:5},a=(r,c)=>{o.rowCount=r,o.colCount=c};return await e.open({id:Ni,children:{label:{name:Us,props:{handleRowColChange:a,tableCreateParams:o}}},width:400,title:{title:t.t("toolbar.table.insert")},onConfirm:()=>{n.executeCommand(_i.id,o),e.close(Ni)},onClose:()=>{e.close(Ni)}}),!0}},oc=i=>{const e=Object.keys(s.PAGE_SIZE).find(n=>{const{width:o,height:a}=s.PAGE_SIZE[n];return i.width===o&&i.height===a});return e!=null?e:"A4"};function sc(i){const{hooks:t}=i,o=v.useDependency(s.IUniverInstanceService).getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC).getDocumentStyle(),a=v.useDependency(s.LocaleService),[r,c]=U.useState(()=>{var d,u,m,h,g;return{paperSize:oc(o.pageSize),orientation:(d=o.pageOrient)!=null?d:s.PageOrientType.PORTRAIT,margins:{top:(u=o.marginTop)!=null?u:0,bottom:(m=o.marginBottom)!=null?m:0,left:(h=o.marginLeft)!=null?h:0,right:(g=o.marginRight)!=null?g:0}}});U.useEffect(()=>{t.beforeClose=()=>r,t.beforeConfirm=()=>r},[r]);const l=d=>{c(u=>({...u,paperSize:d}))},A=(d,u)=>{c(m=>({...m,margins:{...m.margins,[d]:u||0}}))};return P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-4",children:[P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2",children:[P.jsx("label",{className:`
207
+ univer-text-sm univer-font-medium univer-text-gray-900
208
+ dark:univer-text-white
209
+ `,children:a.t("page-settings.paper-size")}),P.jsx(J.Select,{value:r.paperSize,onChange:l,options:s.PAPER_TYPES.map(d=>({label:a.t(`page-settings.page-size.${d.toLocaleLowerCase()}`),value:d}))})]}),P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2",children:[P.jsx("label",{className:`
210
+ univer-text-sm univer-font-medium univer-text-gray-900
211
+ dark:univer-text-white
212
+ `,children:a.t("page-settings.custom-paper-size")}),P.jsxs("div",{className:"univer-flex univer-flex-col univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.top")}),P.jsx(J.InputNumber,{value:r.margins.top,onChange:d=>A("top",d)})]}),P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.bottom")}),P.jsx(J.InputNumber,{value:r.margins.bottom,onChange:d=>A("bottom",d)})]})]}),P.jsxs("div",{className:"univer-flex univer-gap-2.5",children:[P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.left")}),P.jsx(J.InputNumber,{value:r.margins.left,onChange:d=>A("left",d)})]}),P.jsxs("div",{className:"univer-flex univer-flex-1 univer-flex-col univer-gap-2",children:[P.jsx("label",{className:"univer-text-sm univer-font-medium univer-text-gray-500",children:a.t("page-settings.right")}),P.jsx(J.InputNumber,{value:r.margins.right,onChange:d=>A("right",d)})]})]})]})]})]})}const Pi="docs.component.page-setting",ws={id:"docs.command.page-setup",type:s.CommandType.COMMAND,handler:(i,t)=>{if(!t)return!1;const e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=e.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!o)return!1;const{marginLeft:a,marginRight:r,marginBottom:c,marginTop:l,pageOrient:A,pageSize:d}=t,u=s.JSONX.getInstance(),m=o.getDocumentStyle(),{marginBottom:h,marginLeft:g,marginRight:p,marginTop:f,pageOrient:S,pageSize:E}=m,C=[];if(h===void 0){const I=u.insertOp(["documentStyle","marginBottom"],c);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","marginBottom"],h,c);I&&C.push(I)}if(g===void 0){const I=u.insertOp(["documentStyle","marginLeft"],a);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","marginLeft"],g,a);I&&C.push(I)}if(p===void 0){const I=u.insertOp(["documentStyle","marginRight"],r);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","marginRight"],p,r);I&&C.push(I)}if(f===void 0){const I=u.insertOp(["documentStyle","marginTop"],l);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","marginTop"],f,l);I&&C.push(I)}if(E===void 0){const I=u.insertOp(["documentStyle","pageSize"],d);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","pageSize"],E,d);I&&C.push(I)}if(S===void 0){const I=u.insertOp(["documentStyle","pageOrient"],A);I&&C.push(I)}else{const I=u.replaceOp(["documentStyle","pageOrient"],S,A);I&&C.push(I)}const b={id:D.RichTextEditingMutation.id,params:{unitId:o.getUnitId(),actions:[],textRanges:void 0}};return b.params.actions=C.reduce((I,O)=>s.JSONX.compose(I,O),null),!!n.syncExecuteCommand(b.id,b.params)}},Ui={id:"docs.operation.open-page-setting",type:s.CommandType.OPERATION,handler:i=>{const t=i.get(v.IConfirmService),e=i.get(s.ICommandService),n=i.get(s.LocaleService),o=t.open({id:Pi,title:{label:n.t("page-settings.document-setting")},children:{label:Pi},width:528,onClose:()=>{o.dispose()},onConfirm:a=>{if(o.dispose(),!a)return;const r=s.PAGE_SIZE[a.paperSize];e.executeCommand(ws.id,{pageOrient:a.orientation,marginTop:a.margins.top,marginBottom:a.margins.bottom,marginLeft:a.margins.left,marginRight:a.margins.right,pageSize:r})}});return!0}};function ac(i){const t=i.get(s.IUniverInstanceService),e=i.get(_.IRenderManagerService);return new L.Observable(n=>{const o=t.focused$.subscribe(a=>{if(a==null||t.getUnitType(a)!==s.UniverInstanceType.UNIVER_DOC)return n.next(!0);const c=e.getRenderById(a);if(c==null)return n.next(!0);c.with(D.DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe(A=>{n.next(A===_.DocumentEditArea.HEADER||A===_.DocumentEditArea.FOOTER)})});return()=>o.unsubscribe()})}function rc(i){const t=i.get(s.IUniverInstanceService),e=i.get(s.ICommandService);return new L.Observable(n=>{const o=e.onCommandExecuted(l=>{if(l.id===D.RichTextEditingMutation.id){const{unitId:A}=l.params,d=t.getUnit(A);if(d==null){n.next(!0);return}const{documentStyle:u}=d.getSnapshot();n.next((u==null?void 0:u.documentFlavor)!==s.DocumentFlavor.TRADITIONAL)}}),a=t.focused$.subscribe(l=>{if(l==null)return n.next(!0);const A=t.getUniverDocInstance(l),d=A==null?void 0:A.getSnapshot().documentStyle.documentFlavor;n.next(d!==s.DocumentFlavor.TRADITIONAL)}),r=t.getCurrentUniverDocInstance();if(r==null)return n.next(!0);const c=r==null?void 0:r.getSnapshot().documentStyle.documentFlavor;return n.next(c!==s.DocumentFlavor.TRADITIONAL),()=>{o.dispose(),a.unsubscribe()}})}function cc(i){const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService);return new L.Observable(n=>{const o=t.textSelection$.subscribe(a=>{if(a==null){n.next(!0);return}const{textRanges:r}=a;if(r.length!==1){n.next(!0);return}const c=r[0],{collapsed:l,startNodePosition:A,startOffset:d}=c;if(!l||d==null){n.next(!0);return}const u=e.getCurrentUniverDocInstance();if(u==null){n.next(!0);return}const m=re(i,u.getUnitId());if(m==null){n.next(!0);return}if(m.getViewModel().getCustomRangeRaw(d)){n.next(!0);return}if(A!=null){const{path:p}=A;if(p.indexOf("cells")!==-1){n.next(!0);return}}n.next(!1)});return()=>o.unsubscribe()})}function te(i){const t=i.get(D.DocSelectionManagerService);return new L.Observable(e=>{const n=t.textSelection$.subscribe(o=>{if(o==null){e.next(!0);return}const{textRanges:a,rectRanges:r}=o;if(a.length===0&&r.length===0){e.next(!0);return}e.next(!1)});return()=>n.unsubscribe()})}function lc(i){const t=i.get(s.ICommandService);return{id:De.id,type:v.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.bl;e.next(r===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function dc(i){const t=i.get(s.ICommandService);return{id:Be.id,type:v.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.it;e.next(r===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Ac(i){const t=i.get(s.ICommandService);return{id:_e.id,type:v.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.ul;e.next((r==null?void 0:r.s)===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function uc(i){const t=i.get(s.ICommandService);return{id:Ne.id,type:v.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.st;e.next((r==null?void 0:r.s)===s.BooleanNumber.TRUE)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function hc(i){const t=i.get(s.ICommandService);return{id:ye.id,type:v.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.va;e.next(r===s.BaselineOffset.SUBSCRIPT)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function gc(i){const t=i.get(s.ICommandService);return{id:Pe.id,type:v.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",activated$:new L.Observable(e=>{const n=()=>{var c;const a=Le(i);if(a==null){e.next(!1);return}const r=(c=a.ts)==null?void 0:c.va;e.next(r===s.BaselineOffset.SUPERSCRIPT)},o=t.onCommandExecuted(a=>{const r=a.id;(r===D.SetTextSelectionsOperation.id||r===be.id)&&n()});return n(),o.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function mc(i){const t=i.get(s.ICommandService);return{id:We.id,tooltip:"toolbar.font",type:v.MenuItemType.SELECTOR,label:qo,selections:v.FONT_FAMILY_LIST.map(e=>({label:{name:Jo},value:e.value})),value$:new L.Observable(e=>{const n=s.DEFAULT_STYLES.ff,o=()=>{var l;const r=Le(i);if(r==null){e.next(n);return}const c=(l=r.ts)==null?void 0:l.ff;e.next(c!=null?c:n)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===We.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function pc(i){const t=i.get(s.ICommandService);return{id:ge.id,type:v.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:Zo,props:{min:1,max:400}},selections:v.FONT_SIZE_LIST,value$:new L.Observable(e=>{const n=s.DEFAULT_STYLES.fs,o=()=>{var l;const r=Le(i);if(r==null){e.next(n);return}const c=(l=r.ts)==null?void 0:l.fs;e.next(c!=null?c:n)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===ge.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function fc(i){const t=i.get(s.ICommandService);return{id:de.id,type:v.MenuItemType.SELECTOR,tooltip:"toolbar.heading.tooltip",label:{name:v.COMMON_LABEL_COMPONENT,props:{selections:v.HEADING_LIST}},selections:v.HEADING_LIST.map(e=>({label:{name:v.HEADING_ITEM_COMPONENT,props:{value:e.value,text:e.label}},value:e.value})),value$:new L.Observable(e=>{const n=s.NamedStyleType.NORMAL_TEXT,o=()=>{var l,A;const r=ze(i);if(r==null){e.next(n);return}const c=(A=(l=r.paragraphStyle)==null?void 0:l.namedStyleType)!=null?A:n;e.next(c)},a=t.onCommandExecuted(r=>{const c=r.id;(c===D.SetTextSelectionsOperation.id||c===ge.id)&&o()});return o(),a.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Sc(i){const t=i.get(s.ICommandService),e=i.get(s.ThemeService);return{id:Ue.id,icon:"FontColor",tooltip:"toolbar.textColor.main",type:v.MenuItemType.BUTTON_SELECTOR,selections:[{label:{name:ei,hoverable:!1,selectable:!1}}],value$:new L.Observable(n=>{const o=e.getColorFromTheme("gray.900"),a=t.onCommandExecuted(r=>{if(r.id===Ue.id){const c=r.params.value;n.next(c!=null?c:o)}});return n.next(o),a.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function vc(i){return{id:Zn.id,type:v.MenuItemType.BUTTON,icon:"HeaderFooterSingle",tooltip:"toolbar.headerFooter",hidden$:L.combineLatest(v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),rc(i),(t,e)=>t||e)}}const Ic="GridSingle",Ls="doc.menu.table";function Ec(i){return{id:Ls,type:v.MenuItemType.SUBITEMS,icon:Ic,tooltip:"toolbar.table.main",disabled$:cc(i),hidden$:L.combineLatest(v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),ac(i),(t,e)=>t||e)}}function Cc(i){return{id:rn.id,title:"toolbar.table.insert",type:v.MenuItemType.BUTTON,hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Tc(i){const t=i.get(s.ICommandService);return{id:Tt.id,type:v.MenuItemType.BUTTON,icon:"LeftJustifyingSingle",tooltip:"toolbar.alignLeft",disabled$:te(i),activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.LEFT)}});return e.next(!1),n.dispose}),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function yc(i){const t=i.get(s.ICommandService);return{id:yt.id,type:v.MenuItemType.BUTTON,icon:"HorizontallySingle",tooltip:"toolbar.alignCenter",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.CENTER)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function bc(i){const t=i.get(s.ICommandService);return{id:bt.id,type:v.MenuItemType.BUTTON,icon:"RightJustifyingSingle",tooltip:"toolbar.alignRight",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.RIGHT)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function Oc(i){const t=i.get(s.ICommandService);return{id:Ot.id,type:v.MenuItemType.BUTTON,icon:"AlignTextBothSingle",tooltip:"toolbar.alignJustify",activated$:new L.Observable(e=>{const n=t.onCommandExecuted(o=>{var r;const a=o.id;if(a===D.SetTextSelectionsOperation.id||a===me.id){const c=ze(i);if(c==null)return;const l=(r=c.paragraphStyle)==null?void 0:r.horizontalAlign;e.next(l===s.HorizontalAlign.JUSTIFIED)}});return e.next(!1),n.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}function Rc(i){return{id:vt.id,type:v.MenuItemType.BUTTON,icon:"ReduceSingle",tooltip:"toolbar.horizontalLine",disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)}}const Mt=i=>new L.Observable(t=>{const e=i.get(s.IUniverInstanceService),n=i.get(D.DocSelectionManagerService);let o;const a=e.focused$.subscribe(r=>{if(o==null||o.unsubscribe(),r==null)return;const c=e.getUniverDocInstance(r);c!=null&&(o=n.textSelection$.subscribe(()=>{var d,u,m,h,g;const l=n.getDocRanges(),A=(d=l.find(p=>p.isActive))!=null?d:l[0];if(A){const p=c.getSelfOrHeaderFooterModel(A==null?void 0:A.segmentId),f=s.BuildTextUtils.range.getParagraphsInRange(A,(m=(u=p.getBody())==null?void 0:u.paragraphs)!=null?m:[],(g=(h=p.getBody())==null?void 0:h.dataStream)!=null?g:"");let S;if(f.every(E=>{var C;return S||(S=(C=E.bullet)==null?void 0:C.listType),E.bullet&&E.bullet.listType===S})){t.next(S);return}}t.next(void 0)}))});return()=>{a.unsubscribe(),o==null||o.unsubscribe()}});function Qs(i){return{id:ot.id,type:v.MenuItemType.BUTTON_SELECTOR,slot:!0,selections:[{label:{name:es,hoverable:!1,selectable:!1},value$:Mt(i)}],icon:"OrderSingle",tooltip:"toolbar.order",hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),disabled$:te(i),activated$:Mt(i).pipe(L.map(t=>!!(t&&t.indexOf("ORDER_LIST")===0)))}}function Fs(i){return{id:it.id,type:v.MenuItemType.BUTTON_SELECTOR,slot:!0,selections:[{label:{name:ts,hoverable:!1,selectable:!1},value$:Mt(i)}],icon:"UnorderSingle",tooltip:"toolbar.unorder",disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),activated$:Mt(i).pipe(L.map(t=>!!(t&&t.indexOf("BULLET_LIST")===0)))}}function Hs(i){return{id:Ct.id,type:v.MenuItemType.BUTTON,icon:"TodoList",tooltip:"toolbar.checklist",disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),activated$:Mt(i).pipe(L.map(t=>!!(t&&t.indexOf("CHECK_LIST")===0)))}}function Mc(i){const t=i.get(s.ICommandService),e=i.get(s.IUniverInstanceService);return{id:Rt.id,type:v.MenuItemType.BUTTON,icon:"KeyboardSingle",tooltip:"toolbar.documentFlavor",hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC,void 0,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY),activated$:new L.Observable(n=>{var r;const o=t.onCommandExecuted(c=>{var l;if(c.id===D.RichTextEditingMutation.id){const A=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);n.next(((l=A==null?void 0:A.getSnapshot())==null?void 0:l.documentStyle.documentFlavor)===s.DocumentFlavor.MODERN)}}),a=e.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);return n.next(((r=a==null?void 0:a.getSnapshot())==null?void 0:r.documentStyle.documentFlavor)===s.DocumentFlavor.MODERN),()=>o.dispose()})}}function xc(i){return{id:tt.id,type:v.MenuItemType.BUTTON,title:"toolbar.resetColor",icon:"NoColor"}}function Dc(i){const t=i.get(s.ICommandService),e=i.get(s.ThemeService);return{id:we.id,tooltip:"toolbar.fillColor.main",type:v.MenuItemType.BUTTON_SELECTOR,icon:"PaintBucket",selections:[{label:{name:ei,hoverable:!1,selectable:!1}}],value$:new L.Observable(n=>{const o=e.getColorFromTheme("primary.600"),a=t.onCommandExecuted(r=>{if(r.id===we.id){const c=r.params.value;n.next(c!=null?c:o)}});return n.next(o),a.dispose}),disabled$:te(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Le(i){var g,p,f,S;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=i.get(Te),o=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),a=e.getDocRanges(),r=(g=a.find(E=>E.isActive))!=null?g:a[0],c=n.getDefaultStyle(),l=(p=n.getStyleCache())!=null?p:{},A=ze(i),d=(f=A==null?void 0:A.paragraphStyle)!=null&&f.namedStyleType?s.NAMED_STYLE_MAP[(S=A==null?void 0:A.paragraphStyle)==null?void 0:S.namedStyleType]:null;if(o==null||r==null)return{ts:{...c,...d,...l}};const{segmentId:u}=r,m=o.getSelfOrHeaderFooterModel(u).getBody();if(m==null)return{ts:{...c,...d,...l}};const h=Bs(m,r,{});return s.Tools.deleteNull(h),{ts:{...c,...d,...h,...l}}}function ze(i){var d,u;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=t.getCurrentUniverDocInstance(),o=e.getDocRanges(),a=(d=o.find(m=>m.isActive))!=null?d:o[0];if(n==null||a==null)return;const{startOffset:r,segmentId:c}=a,l=(u=n.getSelfOrHeaderFooterModel(c).getBody())==null?void 0:u.paragraphs;if(l==null)return;let A=-1;for(const m of l){const{startIndex:h}=m;if(r>A&&r<=h)return m;A=h}return null}function Bc(i){return{id:Ui.id,type:v.MenuItemType.BUTTON,icon:"DocumentSettingSingle",tooltip:"toolbar.pageSetup",hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const _c={[s.NamedStyleType.HEADING_1]:Ri,[s.NamedStyleType.HEADING_2]:Mi,[s.NamedStyleType.HEADING_3]:xi,[s.NamedStyleType.HEADING_4]:Di,[s.NamedStyleType.HEADING_5]:Bi,[s.NamedStyleType.NORMAL_TEXT]:an,[s.NamedStyleType.TITLE]:Ns,[s.NamedStyleType.SUBTITLE]:Ps,[s.NamedStyleType.NAMED_STYLE_TYPE_UNSPECIFIED]:an},ks={[s.NamedStyleType.HEADING_1]:{key:"H1Single",component:No},[s.NamedStyleType.HEADING_2]:{key:"H2Single",component:Po},[s.NamedStyleType.HEADING_3]:{key:"H3Single",component:Uo},[s.NamedStyleType.HEADING_4]:{key:"H4Single",component:wo},[s.NamedStyleType.HEADING_5]:{key:"H5Single",component:Lo},[s.NamedStyleType.NORMAL_TEXT]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.TITLE]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.SUBTITLE]:{key:"TextTypeSingle",component:ht},[s.NamedStyleType.NAMED_STYLE_TYPE_UNSPECIFIED]:{key:"TextTypeSingle",component:ht}},Qe=i=>t=>{const e=t.get(s.ICommandService),n=t.get(v.ComponentManager),o=ks[i];return n.get(o.key)||n.register(o.key,o.component),{id:_c[i].id,type:v.MenuItemType.BUTTON,icon:o.key,tooltip:"toolbar.heading.tooltip",disabled$:te(t),hidden$:v.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_DOC),activated$:new L.Observable(a=>{const r=s.NamedStyleType.NORMAL_TEXT,c=()=>{var u,m;const A=ze(t);if(A==null){a.next(r===i);return}const d=(m=(u=A.paragraphStyle)==null?void 0:u.namedStyleType)!=null?m:r;a.next(d===i)},l=e.onCommandExecuted(A=>{const d=A.id;(d===D.SetTextSelectionsOperation.id||d===ge.id)&&c()});return c(),l.dispose})}},Nc=Qe(s.NamedStyleType.HEADING_1),Pc=Qe(s.NamedStyleType.HEADING_2),Uc=Qe(s.NamedStyleType.HEADING_3),wc=Qe(s.NamedStyleType.HEADING_4),Lc=Qe(s.NamedStyleType.HEADING_5),Qc=Qe(s.NamedStyleType.NORMAL_TEXT);Qe(s.NamedStyleType.TITLE),Qe(s.NamedStyleType.SUBTITLE);const Fc=i=>({id:gi.id,type:v.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.copy"}),Hc=i=>({id:mi.id,type:v.MenuItemType.BUTTON,icon:"CutSingle",title:"rightClick.cut"}),kc=i=>({id:ci.id,type:v.MenuItemType.BUTTON,icon:"DeleteSingle",title:"rightClick.delete"}),Vc=i=>({id:Ti.id,type:v.MenuItemType.BUTTON,icon:"UnorderSingle",title:"rightClick.bulletList"}),Wc=i=>({id:yi.id,type:v.MenuItemType.BUTTON,icon:"OrderSingle",title:"rightClick.orderList"}),zc=i=>({id:bi.id,type:v.MenuItemType.BUTTON,icon:"TodoList",title:"rightClick.checkList"}),Gc=i=>({id:Si.id,type:v.MenuItemType.BUTTON,icon:"ReduceSingle",title:"toolbar.horizontalLine"}),Vs="doc.menu.insert-bellow";function jc(i){return{id:Vs,type:v.MenuItemType.SUBITEMS,title:"rightClick.insertBellow"}}const wi=4,Xc=(i,t)=>{const e=i.get(s.IUniverInstanceService).getUniverDocInstance(t.unitId),n=(e==null?void 0:e.zoomRatio)||1;return{...s.Tools.deepClone(t),zoomRatio:n}},he={id:"doc.operation.set-zoom-ratio",type:s.CommandType.OPERATION,handler:(i,t)=>{const e=i.get(s.IUniverInstanceService).getUniverDocInstance(t.unitId);if(!e)return!1;const n=e.getSnapshot();return n.settings==null?n.settings={zoomRatio:t.zoomRatio}:n.settings.zoomRatio=t.zoomRatio,!0}};var Kc=Object.getOwnPropertyDescriptor,Yc=(i,t,e,n)=>{for(var o=n>1?void 0:n?Kc(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},cn=(i,t)=>(e,n)=>t(e,n,i);function Ws(i,t){const e=zs(i.left,i.top,t),n=zs(i.right,i.bottom,t);return{left:e.x,top:e.y,right:n.x,bottom:n.y}}function zs(i,t,e){const{scaleX:n,scaleY:o}=e.getAncestorScale(),a=e.getViewport(ae.VIEW_MAIN);if(!a)return{x:i,y:t};const{viewportScrollX:r,viewportScrollY:c}=a,l=(i-r)*n,A=(t-c)*o;return{x:l,y:A}}function Gs(i,t,e){const{scaleX:n,scaleY:o}=e.getAncestorScale(),a=e.getViewport(ae.VIEW_MAIN);if(!a)return{x:i,y:t};const{viewportScrollX:r,viewportScrollY:c}=a,l=i/n+r,A=t/o+c;return{x:l,y:A}}const ln=(i,t)=>{const{scene:e,mainComponent:n,engine:o}=t,a=t.with(D.DocSkeletonManagerService).getSkeleton(),r=a.findNodePositionByCharIndex(i.startOffset,!0,i.segmentId,i.segmentPage),c=i.collapsed?i.startOffset:i.endOffset-1,l=a.findNodePositionByCharIndex(c,!0,i.segmentId,i.segmentPage),A=n;if(!l||!r)return;const d=A.getOffsetConfig(),{docsLeft:u,docsTop:m}=d,h=o.getCanvasElement(),g=h.getBoundingClientRect(),p=_.pxToNum(h.style.width),{top:f,left:S,width:E}=g,C=E/p,{scaleX:b,scaleY:R}=e.getAncestorScale(),I=new Ie(d,a),{borderBoxPointGroup:O}=I.getRangePointData(r,l);return kt(O).map(N=>Ws(N,e)).map(N=>({left:(N.left+u*b)*C+S,right:(N.right+u*b)*C+S,top:(N.top+m*R)*C+f,bottom:(N.bottom+m*R)*C+f}))};T.DocCanvasPopManagerService=class extends s.Disposable{constructor(t,e,n,o){super(),this._globalPopupManagerService=t,this._renderManagerService=e,this._univerInstanceService=n,this._commandService=o}_createRectPositionObserver(t,e){const n=()=>{const{scene:l,engine:A}=e,d=typeof t=="function"?t():t,u=A.getCanvasElement(),m=u.getBoundingClientRect(),h=_.pxToNum(u.style.width),g=Ws(d,l),{top:p,left:f,width:S}=m,E=S/h;return{left:g.left*E+f,right:g.right*E+f,top:g.top*E+p,bottom:g.bottom*E+p}},o=n(),a=new L.BehaviorSubject(o),r=new s.DisposableCollection;r.add(this._commandService.onCommandExecuted(l=>{if(l.id===he.id||l.id===D.RichTextEditingMutation.id){const A=n();A&&a.next(A)}}));const c=e.scene.getViewport(ae.VIEW_MAIN);return c&&r.add(c.onScrollAfter$.subscribeEvent(()=>{a.next(n())})),{position:o,position$:a,disposable:r}}_createObjectPositionObserver(t,e){const n=()=>{const{left:o,top:a,width:r,height:c}=t;return{left:o,right:o+r,top:a,bottom:a+c}};return this._createRectPositionObserver(n,e)}_createRangePositionObserver(t,e){var c;const n=(c=ln(t,e))!=null?c:[],o=new L.BehaviorSubject(n),a=new s.DisposableCollection;a.add(this._commandService.onCommandExecuted(l=>{if((l.id===he.id||l.id===D.RichTextEditingMutation.id)&&l.params.unitId===e.unitId){const d=ln(t,e);d&&o.next(d)}}));const r=e.scene.getViewport(ae.VIEW_MAIN);return r&&a.add(r.onScrollAfter$.subscribeEvent(()=>{const l=ln(t,e);l&&o.next(l)})),{positions:n,positions$:o,disposable:a}}attachPopupToRect(t,e,n){const o=this._renderManagerService.getRenderById(n);if(!o)throw new Error(`Current render not found, unitId: ${n}`);const{position:a,position$:r,disposable:c}=this._createRectPositionObserver(t,o),l=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a,anchorRect$:r,canvasElement:o.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(l),r.complete(),c.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==l}}attachPopupToObject(t,e,n){const o=this._renderManagerService.getRenderById(n);if(!o)throw new Error(`Current render not found, unitId: ${n}`);const{position:a,position$:r,disposable:c}=this._createObjectPositionObserver(t,o),l=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a,anchorRect$:r,canvasElement:o.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(l),r.complete(),c.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==l}}attachPopupToRange(t,e,n){if(!this._univerInstanceService.getUnit(n))throw new Error(`Document not found, unitId: ${n}`);const{direction:a="top",multipleDirection:r}=e,c=this._renderManagerService.getRenderById(n);if(!c)throw new Error(`Current render not found, unitId: ${n}`);const{positions:l,positions$:A,disposable:d}=this._createRangePositionObserver(t,c),u=A.pipe(L.map(h=>a.includes("top")?h[0]:h[h.length-1])),m=this._globalPopupManagerService.addPopup({...e,unitId:n,subUnitId:"default",anchorRect:a.includes("top")?l[0]:l[l.length-1],anchorRect$:u,excludeRects:l,excludeRects$:A,direction:["top","bottom","horizontal"].some(h=>a.includes(h))&&l.length>1&&r!=null?r:a,canvasElement:c.engine.getCanvasElement()});return{dispose:()=>{this._globalPopupManagerService.removePopup(m),A.complete(),d.dispose()},canDispose:()=>this._globalPopupManagerService.activePopupId!==m}}},T.DocCanvasPopManagerService=Yc([cn(0,s.Inject(v.ICanvasPopupService)),cn(1,_.IRenderManagerService),cn(2,s.IUniverInstanceService),cn(3,s.ICommandService)],T.DocCanvasPopManagerService);var qc=Object.getOwnPropertyDescriptor,Jc=(i,t,e,n)=>{for(var o=n>1?void 0:n?qc(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Zc=(i,t)=>(e,n)=>t(e,n,i);const $c=(i,t,e,n)=>{var m,h,g,p,f;const o=e.findNodePositionByCharIndex(i.startOffset,!0,i.segmentId,n),a=e.getSkeletonData();let r=i.endOffset-1;if(i.segmentId){const S=(f=Array.from((h=(m=a==null?void 0:a.skeFooters.get(i.segmentId))==null?void 0:m.values())!=null?h:[])[0])!=null?f:Array.from((p=(g=a==null?void 0:a.skeHeaders.get(i.segmentId))==null?void 0:g.values())!=null?p:[])[0];S&&(r=Math.min(S.ed,r))}const c=e.findNodePositionByCharIndex(r,!0,i.segmentId,n);if(!c||!o)return;const l=t.getOffsetConfig(),A=new Ie(l,e),{borderBoxPointGroup:d}=A.getRangePointData(o,c);return kt(d).map(S=>({top:S.top+l.docsTop-wi,bottom:S.bottom+l.docsTop+wi,left:S.left+l.docsLeft,right:S.right+l.docsLeft}))},js=(i,t,e,n)=>{const o=[];for(const a of i){const r=a.top;for(const c of a.columns){const l=c.left,A=a.colCount===1?n:c.width;let d=null;for(const u of c.lines){const m=u.paragraphIndex;if(u.paragraphStart){d&&(o.push(d),d=null);const h={top:t+r+u.top,left:e+l,right:e+l+A,bottom:t+r+u.top+u.lineHeight};d={paragraphStart:u.st,paragraphEnd:m,startIndex:m,rect:h,fisrtLine:{top:t+r+u.top+u.marginTop+u.paddingTop,left:e+l,right:e+l+A,bottom:t+r+u.top+u.marginTop+u.paddingTop+u.contentHeight}}}else d&&d.startIndex===m&&(d.rect.bottom=t+r+u.top+u.lineHeight)}d&&o.push(d)}}return o},el=(i,t,e,n=-1)=>{const o=e.findPositionByGlyph(i,n);if(!o)return;const a=t.getOffsetConfig(),r={...o,isBack:!0},c=new Ie(a,e),{borderBoxPointGroup:l}=c.getRangePointData(r,r),d=kt(l)[0];return{top:d.top+a.docsTop,bottom:d.bottom+a.docsTop,left:d.left+a.docsLeft,right:d.left+a.docsLeft+i.width}};function Ge(i,t,e){const{left:n,right:o,top:a,bottom:r}=e;return i>=n&&i<=o&&t>=a&&t<=r}T.DocEventManagerService=class extends s.Disposable{constructor(e,n){super();B(this,"_hoverCustomRanges$",new L.BehaviorSubject([]));B(this,"hoverCustomRanges$",this._hoverCustomRanges$.pipe(L.distinctUntilChanged((e,n)=>e.length===n.length&&e.every((o,a)=>n[a].range.rangeId===o.range.rangeId&&n[a].segmentId===o.segmentId&&n[a].segmentPageIndex===o.segmentPageIndex&&n[a].range.startIndex===o.range.startIndex))));B(this,"_clickCustomRanges$",new L.Subject);B(this,"clickCustomRanges$",this._clickCustomRanges$.asObservable());B(this,"_hoverBullet$",new L.Subject);B(this,"hoverBullet$",this._hoverBullet$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.paragraph.startIndex)===(n==null?void 0:n.paragraph.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.segmentPageIndex)===(n==null?void 0:n.segmentPageIndex))));B(this,"_clickBullet$",new L.Subject);B(this,"clickBullets$",this._clickBullet$.asObservable());B(this,"_hoverParagraph$",new L.BehaviorSubject(null));B(this,"hoverParagraph$",this._hoverParagraph$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.startIndex)===(n==null?void 0:n.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverParagraphRealTime$",this._hoverParagraph$.asObservable());B(this,"_hoverParagraphLeft$",new L.BehaviorSubject(null));B(this,"hoverParagraphLeft$",this._hoverParagraphLeft$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.startIndex)===(n==null?void 0:n.startIndex)&&(e==null?void 0:e.segmentId)===(n==null?void 0:n.segmentId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverParagraphLeftRealTime$",this._hoverParagraphLeft$.asObservable());B(this,"_hoverTableCell$",new L.Subject);B(this,"hoverTableCell$",this._hoverTableCell$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.rowIndex)===(n==null?void 0:n.rowIndex)&&(e==null?void 0:e.colIndex)===(n==null?void 0:n.colIndex)&&(e==null?void 0:e.tableId)===(n==null?void 0:n.tableId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverTableCellRealTime$",this._hoverTableCell$.asObservable());B(this,"_hoverTable$",new L.Subject);B(this,"hoverTable$",this._hoverTable$.pipe(L.distinctUntilChanged((e,n)=>(e==null?void 0:e.tableId)===(n==null?void 0:n.tableId)&&(e==null?void 0:e.pageIndex)===(n==null?void 0:n.pageIndex))));B(this,"hoverTableRealTime$",this._hoverTable$.asObservable());B(this,"_customRangeDirty",!0);B(this,"_bulletDirty",!0);B(this,"_paragraphDirty",!0);B(this,"_customRangeBounds",[]);B(this,"_bulletBounds",[]);B(this,"_paragraphBounds",new Map);B(this,"_paragraphLeftBounds",[]);B(this,"_tableParagraphBounds",new Map);B(this,"_segmentParagraphBounds",new Map);B(this,"_tableCellBounds",new Map);B(this,"_tableBounds",new Map);this._context=e,this._docSkeletonManagerService=n,this._initResetDirty(),this._initEvents(),this._initPointer()}get hoverParagraph(){return this._hoverParagraph$.value}get hoverParagraphLeft(){return this._hoverParagraphLeft$.value}get _skeleton(){return this._docSkeletonManagerService.getSkeleton()}get _documents(){return this._context.mainComponent}dispose(){this._hoverCustomRanges$.complete(),this._clickCustomRanges$.complete(),super.dispose()}_initPointer(){let e=_.CURSOR_TYPE.TEXT;this.disposeWithMe(this.hoverCustomRanges$.subscribe(n=>{n.length?(e=this._context.scene.getCursor(),this._context.scene.setCursor(_.CURSOR_TYPE.POINTER)):this._context.scene.setCursor(e)}))}_initResetDirty(){this.disposeWithMe(this._skeleton.dirty$.subscribe(()=>{this._customRangeDirty=!0,this._bulletDirty=!0,this._paragraphDirty=!0})),this.disposeWithMe(s.fromEventSubject(this._context.engine.onTransformChange$).pipe(L.filter(e=>e.type===_.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize)).subscribe(()=>{this._customRangeDirty=!0,this._bulletDirty=!0,this._paragraphDirty=!0}))}_initEvents(){this.disposeWithMe(s.fromEventSubject(this._context.scene.onPointerMove$).pipe(L.throttleTime(30)).subscribe(o=>{if(o.buttons>0){this._hoverBullet$.next(null),this._hoverCustomRanges$.next([]),this._hoverParagraph$.next(null),this._hoverParagraphLeft$.next(null),this._hoverTableCell$.next(null),this._hoverTable$.next(null);return}const{x:a,y:r}=Gs(o.offsetX,o.offsetY,this._context.scene);this._hoverCustomRanges$.next(this._calcActiveRanges({x:a,y:r})),this._hoverParagraph$.next(this._calcActiveParagraph({x:a,y:r})),this._hoverParagraphLeft$.next(this._calcActiveParagraphLeft({x:a,y:r})),this._hoverBullet$.next(this._calcActiveBullet({x:a,y:r}))})),this.disposeWithMe(this._context.scene.onPointerEnter$.subscribeEvent(()=>{this._hoverBullet$.next(null),this._hoverCustomRanges$.next([])}));const e=s.fromEventSubject(this._context.mainComponent.onPointerDown$),n=s.fromEventSubject(this._context.scene.onPointerUp$);this.disposeWithMe(e.pipe(L.switchMap(o=>n.pipe(L.take(1),L.map(a=>({down:o,up:a})))),L.filter(({down:o,up:a})=>o.target===a.target&&a.timeStamp-o.timeStamp<300)).subscribe(({down:o})=>{if(o.button===2)return;const a=Gs(o.offsetX,o.offsetY,this._context.scene),r=this._calcActiveRanges(a);r.length&&this._clickCustomRanges$.next(r.pop());const c=this._calcActiveBullet(a);c&&this._clickBullet$.next(c)}))}_buildCustomRangeBoundsBySegment(e,n=-1){var r,c,l;const o=(l=(c=(r=this._context.unit.getSelfOrHeaderFooterModel(e))==null?void 0:r.getBody())==null?void 0:c.customRanges)!=null?l:[],a=[];return o.forEach(A=>{const d={startOffset:A.startIndex,endOffset:A.endIndex+1,segmentId:e},u=$c(d,this._documents,this._skeleton,n);if(!u)return null;a.push({customRange:A,rects:u,segmentId:e,segmentPageIndex:n})}),a}_buildCustomRangeBounds(){var n;if(!this._customRangeDirty)return;this._customRangeDirty=!1;const e=[];e.push(...this._buildCustomRangeBoundsBySegment()),(n=this._skeleton.getSkeletonData())==null||n.pages.forEach((o,a)=>{o.headerId&&e.push(...this._buildCustomRangeBoundsBySegment(o.headerId,a)),o.footerId&&e.push(...this._buildCustomRangeBoundsBySegment(o.footerId,a))}),this._customRangeBounds=e}_calcActiveRanges(e){this._buildCustomRangeBounds();const{x:n,y:o}=e;return this._customRangeBounds.filter(r=>r.rects.some(c=>Ge(n,o,c))).map(r=>({segmentId:r.segmentId,range:r.customRange,segmentPageIndex:r.segmentPageIndex,rects:r.rects}))}_buildBulletBoundsBySegment(e,n=-1){var A,d,u,m,h;const o=(A=this._context.unit.getSelfOrHeaderFooterModel(e))==null?void 0:A.getBody(),a=((d=o==null?void 0:o.paragraphs)!=null?d:[]).filter(g=>g.bullet&&g.bullet.listType.indexOf("CHECK_LIST")===0),r=[],c=this._skeleton.getSkeletonData();if(!c)return r;const l=g=>{var p,f,S;for(const E of g){const C=[...E.sections];if(E.skeTables){const b=Array.from(E.skeTables.values());C.push(...b.map(R=>R.rows.map(I=>I.cells.map(O=>O.sections))).flat(4))}for(const b of C)for(const R of b.columns)for(const I of R.lines)if(I.paragraphStart){const O=a.find(M=>M.startIndex===I.paragraphIndex);if(O){const M=I,y=(S=(f=(p=M==null?void 0:M.divides)==null?void 0:p[0])==null?void 0:f.glyphGroup)==null?void 0:S[0];if(!y)continue;const N=el(y,this._documents,this._skeleton,n);if(!N)continue;r.push({rect:N,segmentId:e,segmentPageIndex:n,paragraph:O})}}}return r};if(e){const g=(h=(u=c.skeFooters.get(e))==null?void 0:u.values())!=null?h:(m=c.skeHeaders.get(e))==null?void 0:m.values();return g?l(Array.from(g)):r}return l(c.pages)}_buildBulletBounds(){var e;this._bulletDirty&&(this._bulletDirty=!1,this._bulletBounds=[],this._bulletBounds.push(...this._buildBulletBoundsBySegment()),(e=this._skeleton.getSkeletonData())==null||e.pages.forEach((n,o)=>{n.headerId&&this._bulletBounds.push(...this._buildBulletBoundsBySegment(n.headerId,o)),n.footerId&&this._bulletBounds.push(...this._buildBulletBoundsBySegment(n.footerId,o))}))}_calcActiveBullet(e){this._buildBulletBounds();const{x:n,y:o}=e;return this._bulletBounds.find(r=>Ge(n,o,r.rect))}_buildParagraphBoundsBySegment(e){var c,l,A;const n=this._skeleton.getSkeletonData(),a=this._documents.getOffsetConfig();if(!n)return null;const r=d=>{const u=new Map,m=(h,g,p,f)=>{js(h.sections,p,f,h.pageWidth-h.marginLeft-h.marginRight).forEach(E=>{if(!u.has(E.startIndex))u.set(E.startIndex,{rect:E.rect,paragraphStart:E.paragraphStart,paragraphEnd:E.paragraphEnd,startIndex:E.startIndex,rects:[E.rect],pageIndex:g,segmentId:e,firstLine:E.fisrtLine});else{const C=u.get(E.startIndex);C&&(C.rect.bottom=E.rect.bottom,C.rects.push(E.rect))}})};for(let h=0;h<d.length;h++){const g=d[h],p=((g.pageHeight===1/0?0:g.pageHeight)+a.pageMarginTop)*h+g.marginTop+a.docsTop,f=g.marginLeft+a.docsLeft;g.skeTables&&Array.from(g.skeTables.values()).forEach(S=>{const E=S.left+f,C=S.top+p,b=E+S.width,R=C+S.height,I=S.tableId;this._tableBounds.set(I,{rect:{left:E,top:C,right:b,bottom:R},pageIndex:h,tableId:I}),S.rows.forEach((O,M)=>{O.cells.forEach((y,N)=>{const x=((g.pageHeight===1/0?0:g.pageHeight)+a.pageMarginTop)*h+S.top+a.docsTop+g.marginTop+O.top+y.marginTop,w=S.left+a.docsLeft+g.marginLeft+y.left+y.marginLeft,H=js(y.sections,x,w,y.pageWidth-y.marginLeft-y.marginRight);let V=this._tableParagraphBounds.get(I);V||(V=[],this._tableParagraphBounds.set(I,V)),V.push(...H.map(Q=>({rect:Q.rect,paragraphStart:Q.paragraphStart,paragraphEnd:Q.paragraphEnd,startIndex:Q.startIndex,pageIndex:h,segmentId:e,rowIndex:M,colIndex:N,firstLine:Q.fisrtLine,tableId:I})));let F=this._tableCellBounds.get(I);F||(F=[],this._tableCellBounds.set(I,F)),F.push({rect:{top:x,left:w,right:w+y.pageWidth-y.marginLeft-y.marginRight,bottom:x+y.pageHeight-y.marginBottom-y.marginTop},pageIndex:h,rowIndex:M,colIndex:N,tableId:I})})})}),m(g,h,p,f)}return u};if(e){const d=(A=(c=n.skeFooters.get(e))==null?void 0:c.values())!=null?A:(l=n.skeHeaders.get(e))==null?void 0:l.values();return d?r(Array.from(d)):null}return r(n.pages)}_buildParagraphBounds(){var n,o;if(!this._paragraphDirty)return;this._paragraphDirty=!1,this._tableParagraphBounds=new Map,this._tableCellBounds=new Map,this._tableBounds=new Map,this._paragraphBounds=(n=this._buildParagraphBoundsBySegment())!=null?n:new Map,this._paragraphLeftBounds=Array.from(this._paragraphBounds.values()).map(a=>({...a,rect:{left:a.rect.left-60,right:a.rect.left,top:a.rect.top,bottom:a.rect.bottom}}));const e=a=>{var r;this._segmentParagraphBounds.set(a,(r=this._buildParagraphBoundsBySegment(a))!=null?r:new Map)};(o=this._skeleton.getSkeletonData())==null||o.pages.forEach(a=>{a.headerId&&e(a.headerId),a.footerId&&e(a.footerId)})}_calcActiveParagraph(e){var c,l;this._buildParagraphBounds();const{x:n,y:o}=e,a=Array.from(this._tableBounds.values()).find(A=>Ge(n,o,A.rect));if(this._hoverTable$.next(a),a){const A=(c=this._tableCellBounds.get(a.tableId))==null?void 0:c.find(m=>Ge(n,o,m.rect));if(this._hoverTableCell$.next(A),!A)return null;const d=(l=this._tableParagraphBounds.get(A.tableId))==null?void 0:l.filter(m=>m.colIndex===A.colIndex&&m.rowIndex===A.rowIndex),u=d==null?void 0:d.find(m=>Ge(n,o,m.rect));return u&&{...u,rects:[u.rect]}}return this._paragraphBounds.values().find(A=>A.rects.some(d=>Ge(n,o,d)))}_calcActiveParagraphLeft(e){this._buildParagraphBounds();const{x:n,y:o}=e;return this._paragraphLeftBounds.find(r=>Ge(n,o,r.rect))}get paragraphBounds(){return this._buildParagraphBounds(),this._paragraphBounds}findParagraphBoundByIndex(e){this._buildParagraphBounds();const n=this._paragraphBounds.get(e);return n||Array.from(this._tableParagraphBounds.values()).flat().find(a=>a.startIndex===e)}},T.DocEventManagerService=Jc([Zc(1,s.Inject(D.DocSkeletonManagerService))],T.DocEventManagerService);const tl=[ge.id,De.id,Be.id,_e.id,Ne.id,ye.id,Pe.id,Ue.id,we.id];function nl(i){const{avaliableMenus:t=tl}=i,e=v.useDependency(v.IMenuManagerService),[n,o]=U.useState([]);return U.useEffect(()=>{function a(){const c=e.getFlatMenuByPositionKey(v.MenuManagerPosition.RIBBON),l=[];for(const A of t){const d=c.find(u=>u.key===A);d&&l.push(d)}o(l)}a();const r=e.menuChanged$.subscribe(a);return()=>{r.unsubscribe()}},[e]),P.jsx("div",{className:J.clsx(`
205
213
  univer-box-border univer-flex univer-rounded univer-bg-white univer-py-1.5 univer-shadow-sm
206
- dark:univer-bg-gray-900
207
- `,J.borderClassName),children:n.map(a=>a.item&&P.jsx("div",{className:"univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",children:P.jsx(I.ToolbarItem,{...a.item},a.key)},a.key))})}var il=Object.getOwnPropertyDescriptor,ol=(i,t,e,n)=>{for(var o=n>1?void 0:n?il(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},xt=(i,t)=>(e,n)=>t(e,n,i);const Xs="univer.doc.float-menu";function sl(i,t){if(i==null||t==null)return!1;const{glyph:e,...n}=i,{glyph:o,...a}=t;return s.deepCompare(n,a)}const al=[s.DataStreamTreeTokenType.CUSTOM_BLOCK,s.DataStreamTreeTokenType.PARAGRAPH];let dn=class extends s.Disposable{constructor(t,e,n,o,a,r){super();B(this,"_floatMenu",null);this._context=t,this._docSelectionManagerService=e,this._docCanvasPopManagerService=n,this._componentManager=o,this._univerInstanceService=a,this._docSelectionRenderService=r,!s.isInternalEditorID(this._context.unitId)&&(this._registerFloatMenu(),this._initSelectionChange(),this.disposeWithMe(()=>{this._hideFloatMenu()}))}get floatMenu(){return this._floatMenu}_registerFloatMenu(){this.disposeWithMe(this._componentManager.register(Xs,nl))}_initSelectionChange(){this.disposeWithMe(this._docSelectionRenderService.onSelectionStart$.subscribe(()=>{this._hideFloatMenu()})),this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(t=>{var a,r;const{unitId:e,textRanges:n}=t;if(e!==this._context.unitId)return;const o=n.length>0&&n.find(c=>!c.collapsed);if(o){if(o.startOffset===((a=this._floatMenu)==null?void 0:a.start)&&o.endOffset===((r=this._floatMenu)==null?void 0:r.end))return;this._hideFloatMenu(),this._showFloatMenu(e,o);return}this._hideFloatMenu()}))}_hideFloatMenu(){var t;(t=this._floatMenu)==null||t.disposable.dispose(),this._floatMenu=null}_showFloatMenu(t,e){var r,c,l;const n=this._univerInstanceService.getUnit(t,s.UniverInstanceType.UNIVER_DOC);if(!n||n.getDisabled())return;const o=(r=n.getBody())==null?void 0:r.dataStream[e.startOffset];if(e.endOffset-e.startOffset===1&&o&&al.includes(o))return;const a=(l=(c=n.getBody())==null?void 0:c.customRanges)==null?void 0:l.filter(A=>A.wholeEntity);if(!(a!=null&&a.some(A=>A.startIndex===e.startOffset&&A.endIndex===e.endOffset-1)))return this._floatMenu={disposable:this._docCanvasPopManagerService.attachPopupToRange(e,{componentKey:Xs,direction:e.direction==="backward"||sl(e.startNodePosition,e.endNodePosition)?"top-center":"bottom-center",offset:[0,4]},t),start:e.startOffset,end:e.endOffset},s.toDisposable(()=>this._hideFloatMenu())}};dn=ol([xt(1,s.Inject(D.DocSelectionManagerService)),xt(2,s.Inject(T.DocCanvasPopManagerService)),xt(3,s.Inject(I.ComponentManager)),xt(4,s.Inject(s.IUniverInstanceService)),xt(5,s.Inject(T.DocSelectionRenderService))],dn);var rl=Object.getOwnPropertyDescriptor,cl=(i,t,e,n)=>{for(var o=n>1?void 0:n?rl(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Dt=(i,t)=>(e,n)=>t(e,n,i);let An=class extends s.Disposable{constructor(t,e,n,o,a,r){super();B(this,"_paragrahMenu",null);this._context=t,this._docSelectionManagerService=e,this._docEventManagerService=n,this._docPopupManagerService=o,this._docSkeletonManagerService=a,this._floatMenuService=r,!s.isInternalEditorID(this._context.unitId)&&this._init()}get activeParagraph(){var t;return(t=this._paragrahMenu)==null?void 0:t.paragraph}_isCursorInActiveParagraph(){if(!this._paragrahMenu)return!1;const t=this._docSelectionManagerService.getActiveTextRange();return!(!(t!=null&&t.collapsed)||!(t!=null&&t.collapsed)||t.startOffset<this._paragrahMenu.paragraph.paragraphStart||t.startOffset>this._paragrahMenu.paragraph.paragraphEnd)}setParagraphMenuActive(t){this._paragrahMenu&&(this._paragrahMenu.active=t,this._isCursorInActiveParagraph()||this._docSelectionManagerService.replaceDocRanges([{startOffset:this._paragrahMenu.paragraph.paragraphStart,endOffset:this._paragrahMenu.paragraph.paragraphStart}]))}_init(){const t=n=>{var a;if(this._docSkeletonManagerService.getViewModel().getEditArea()===_.DocumentEditArea.BODY&&!this._floatMenuService.floatMenu&&!this._context.unit.getDisabled()){if((a=this._paragrahMenu)!=null&&a.active)return;if(n){this.showParagraphMenu(n);return}}this.hideParagraphMenu(!0)};this.disposeWithMe(L.combineLatest([this._docEventManagerService.hoverParagraphRealTime$,this._docEventManagerService.hoverParagraphLeft$]).pipe(L.throttleTime(16)).subscribe(([n,o])=>{const a=n!=null?n:o;t(a)}));let e=0;this.disposeWithMe(this._context.scene.getViewport(ae.VIEW_MAIN).onScrollAfter$.subscribeEvent(n=>{e!==n.scrollY&&(e=n.scrollY,this.hideParagraphMenu(!0))})),this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(()=>{this.hideParagraphMenu(!0)}))}showParagraphMenu(t){var l,A,d;if(((l=this._paragrahMenu)==null?void 0:l.paragraph.startIndex)===t.startIndex)return;this.hideParagraphMenu(!0);const e=(d=(A=this._context.unit.getBody())==null?void 0:A.dataStream)!=null?d:"",n=t?e.slice(t.paragraphStart,t.paragraphEnd):"";if(n==="\b"||n==="")return;const c=this._docPopupManagerService.attachPopupToRect(t.firstLine,{componentKey:"doc.paragraph.menu",direction:"left-center",onClickOutside:()=>{this._docSelectionManagerService.textSelection$.pipe(L.first()).subscribe(()=>{this._isCursorInActiveParagraph()||this.hideParagraphMenu(!0)})},zIndex:101},this._context.unitId);this._paragrahMenu={paragraph:t,disposable:c,active:!1}}hideParagraphMenu(t=!1){this._paragrahMenu&&(this._paragrahMenu.disposable.canDispose()||t)&&(this._paragrahMenu.disposable.dispose(),this._paragrahMenu=null)}};An=cl([Dt(1,s.Inject(D.DocSelectionManagerService)),Dt(2,s.Inject(T.DocEventManagerService)),Dt(3,s.Inject(T.DocCanvasPopManagerService)),Dt(4,s.Inject(D.DocSkeletonManagerService)),Dt(5,s.Inject(dn))],An);const ll=({popup:i})=>{var v,O;const[t,e]=U.useState(!1),n=U.useRef(null),o=I.useDependency(s.ICommandService),a=I.useDependency(I.ILayoutService),r=U.useRef(null),c=U.useRef(!1),l=I.useDependency(_.IRenderManagerService),A=I.useDependency(s.IUniverInstanceService),d=l.getRenderById(i.unitId),u=A.getUnit(i.unitId,s.UniverInstanceType.UNIVER_DOC),m=d==null?void 0:d.with(An),h=d==null?void 0:d.with(T.DocEventManagerService),g=I.useObservable(h==null?void 0:h.hoverParagraph$),p=I.useObservable(h==null?void 0:h.hoverParagraphLeft$),f=(v=g!=null?g:p)==null?void 0:v.startIndex,S=U.useMemo(()=>{var M,y;return(y=(M=u==null?void 0:u.getBody())==null?void 0:M.paragraphs)==null?void 0:y.find(N=>N.startIndex===f)},[u,g]),E=(O=S==null?void 0:S.paragraphStyle)==null?void 0:O.namedStyleType,C=ks[E!=null?E:s.NamedStyleType.NORMAL_TEXT],b=U.useMemo(()=>new L.BehaviorSubject({left:0,right:0,top:0,bottom:0}),[]),R=()=>{e(!1),m==null||m.hideParagraphMenu(!0)};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{ref:r,className:J.clsx(`
214
+ dark:univer-border-gray-700 dark:univer-bg-gray-900
215
+ `,J.borderClassName),children:n.map(a=>a.item&&P.jsx("div",{className:"univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",children:P.jsx(v.ToolbarItem,{...a.item},a.key)},a.key))})}var il=Object.getOwnPropertyDescriptor,ol=(i,t,e,n)=>{for(var o=n>1?void 0:n?il(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},xt=(i,t)=>(e,n)=>t(e,n,i);const Xs="univer.doc.float-menu";function sl(i,t){if(i==null||t==null)return!1;const{glyph:e,...n}=i,{glyph:o,...a}=t;return s.deepCompare(n,a)}const al=[s.DataStreamTreeTokenType.CUSTOM_BLOCK,s.DataStreamTreeTokenType.PARAGRAPH];let dn=class extends s.Disposable{constructor(t,e,n,o,a,r){super();B(this,"_floatMenu",null);this._context=t,this._docSelectionManagerService=e,this._docCanvasPopManagerService=n,this._componentManager=o,this._univerInstanceService=a,this._docSelectionRenderService=r,!s.isInternalEditorID(this._context.unitId)&&(this._registerFloatMenu(),this._initSelectionChange(),this.disposeWithMe(()=>{this._hideFloatMenu()}))}get floatMenu(){return this._floatMenu}_registerFloatMenu(){this.disposeWithMe(this._componentManager.register(Xs,nl))}_initSelectionChange(){this.disposeWithMe(this._docSelectionRenderService.onSelectionStart$.subscribe(()=>{this._hideFloatMenu()})),this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(t=>{var a,r;const{unitId:e,textRanges:n}=t;if(e!==this._context.unitId)return;const o=n.length>0&&n.find(c=>!c.collapsed);if(o){if(o.startOffset===((a=this._floatMenu)==null?void 0:a.start)&&o.endOffset===((r=this._floatMenu)==null?void 0:r.end))return;this._hideFloatMenu(),this._showFloatMenu(e,o);return}this._hideFloatMenu()}))}_hideFloatMenu(){var t;(t=this._floatMenu)==null||t.disposable.dispose(),this._floatMenu=null}_showFloatMenu(t,e){var r,c,l;const n=this._univerInstanceService.getUnit(t,s.UniverInstanceType.UNIVER_DOC);if(!n||n.getDisabled())return;const o=(r=n.getBody())==null?void 0:r.dataStream[e.startOffset];if(e.endOffset-e.startOffset===1&&o&&al.includes(o))return;const a=(l=(c=n.getBody())==null?void 0:c.customRanges)==null?void 0:l.filter(A=>A.wholeEntity);if(!(a!=null&&a.some(A=>A.startIndex===e.startOffset&&A.endIndex===e.endOffset-1)))return this._floatMenu={disposable:this._docCanvasPopManagerService.attachPopupToRange(e,{componentKey:Xs,direction:e.direction==="backward"||sl(e.startNodePosition,e.endNodePosition)?"top-center":"bottom-center",offset:[0,4]},t),start:e.startOffset,end:e.endOffset},s.toDisposable(()=>this._hideFloatMenu())}};dn=ol([xt(1,s.Inject(D.DocSelectionManagerService)),xt(2,s.Inject(T.DocCanvasPopManagerService)),xt(3,s.Inject(v.ComponentManager)),xt(4,s.Inject(s.IUniverInstanceService)),xt(5,s.Inject(T.DocSelectionRenderService))],dn);var rl=Object.getOwnPropertyDescriptor,cl=(i,t,e,n)=>{for(var o=n>1?void 0:n?rl(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Dt=(i,t)=>(e,n)=>t(e,n,i);let An=class extends s.Disposable{constructor(t,e,n,o,a,r){super();B(this,"_paragrahMenu",null);this._context=t,this._docSelectionManagerService=e,this._docEventManagerService=n,this._docPopupManagerService=o,this._docSkeletonManagerService=a,this._floatMenuService=r,!s.isInternalEditorID(this._context.unitId)&&this._init()}get activeParagraph(){var t;return(t=this._paragrahMenu)==null?void 0:t.paragraph}_isCursorInActiveParagraph(){if(!this._paragrahMenu)return!1;const t=this._docSelectionManagerService.getActiveTextRange();return!(!(t!=null&&t.collapsed)||!(t!=null&&t.collapsed)||t.startOffset<this._paragrahMenu.paragraph.paragraphStart||t.startOffset>this._paragrahMenu.paragraph.paragraphEnd)}setParagraphMenuActive(t){this._paragrahMenu&&(this._paragrahMenu.active=t,this._isCursorInActiveParagraph()||this._docSelectionManagerService.replaceDocRanges([{startOffset:this._paragrahMenu.paragraph.paragraphStart,endOffset:this._paragrahMenu.paragraph.paragraphStart}]))}_init(){const t=n=>{var a;if(this._docSkeletonManagerService.getViewModel().getEditArea()===_.DocumentEditArea.BODY&&!this._floatMenuService.floatMenu&&!this._context.unit.getDisabled()){if((a=this._paragrahMenu)!=null&&a.active)return;if(n){this.showParagraphMenu(n);return}}this.hideParagraphMenu(!0)};this.disposeWithMe(L.combineLatest([this._docEventManagerService.hoverParagraphRealTime$,this._docEventManagerService.hoverParagraphLeft$]).pipe(L.throttleTime(16)).subscribe(([n,o])=>{const a=n!=null?n:o;t(a)}));let e=0;this.disposeWithMe(this._context.scene.getViewport(ae.VIEW_MAIN).onScrollAfter$.subscribeEvent(n=>{e!==n.scrollY&&(e=n.scrollY,this.hideParagraphMenu(!0))})),this.disposeWithMe(this._docEventManagerService.clickCustomRanges$.subscribe(()=>{this.hideParagraphMenu(!0)}))}showParagraphMenu(t){var l,A,d;if(((l=this._paragrahMenu)==null?void 0:l.paragraph.startIndex)===t.startIndex)return;this.hideParagraphMenu(!0);const e=(d=(A=this._context.unit.getBody())==null?void 0:A.dataStream)!=null?d:"",n=t?e.slice(t.paragraphStart,t.paragraphEnd):"";if(n==="\b"||n==="")return;const c=this._docPopupManagerService.attachPopupToRect(t.firstLine,{componentKey:"doc.paragraph.menu",direction:"left-center",onClickOutside:()=>{this._docSelectionManagerService.textSelection$.pipe(L.first()).subscribe(()=>{this._isCursorInActiveParagraph()||this.hideParagraphMenu(!0)})},zIndex:101},this._context.unitId);this._paragrahMenu={paragraph:t,disposable:c,active:!1}}hideParagraphMenu(t=!1){this._paragrahMenu&&(this._paragrahMenu.disposable.canDispose()||t)&&(this._paragrahMenu.disposable.dispose(),this._paragrahMenu=null)}};An=cl([Dt(1,s.Inject(D.DocSelectionManagerService)),Dt(2,s.Inject(T.DocEventManagerService)),Dt(3,s.Inject(T.DocCanvasPopManagerService)),Dt(4,s.Inject(D.DocSkeletonManagerService)),Dt(5,s.Inject(dn))],An);const ll=({popup:i})=>{var I,O;const[t,e]=U.useState(!1),n=U.useRef(null),o=v.useDependency(s.ICommandService),a=v.useDependency(v.ILayoutService),r=U.useRef(null),c=U.useRef(!1),l=v.useDependency(_.IRenderManagerService),A=v.useDependency(s.IUniverInstanceService),d=l.getRenderById(i.unitId),u=A.getUnit(i.unitId,s.UniverInstanceType.UNIVER_DOC),m=d==null?void 0:d.with(An),h=d==null?void 0:d.with(T.DocEventManagerService),g=v.useObservable(h==null?void 0:h.hoverParagraph$),p=v.useObservable(h==null?void 0:h.hoverParagraphLeft$),f=(I=g!=null?g:p)==null?void 0:I.startIndex,S=U.useMemo(()=>{var M,y;return(y=(M=u==null?void 0:u.getBody())==null?void 0:M.paragraphs)==null?void 0:y.find(N=>N.startIndex===f)},[u,g]),E=(O=S==null?void 0:S.paragraphStyle)==null?void 0:O.namedStyleType,C=ks[E!=null?E:s.NamedStyleType.NORMAL_TEXT],b=U.useMemo(()=>new L.BehaviorSubject({left:0,right:0,top:0,bottom:0}),[]),R=()=>{e(!1),m==null||m.hideParagraphMenu(!0)};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{ref:r,className:J.clsx(`
208
216
  univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1
209
217
  univer-rounded-full univer-px-2.5 univer-py-0
210
218
  hover:univer-bg-gray-100
211
- `,J.borderClassName,{"univer-bg-gray-100":t,"univer-bg-white":!t}),onMouseEnter:M=>{var N,x,w,H,V,F;(N=i.onPointerEnter)==null||N.call(i,M),c.current=!0;const y=(x=r.current)==null?void 0:x.getBoundingClientRect();b.next({left:((w=y==null?void 0:y.left)!=null?w:0)-4,right:(H=y==null?void 0:y.right)!=null?H:0,top:(V=y==null?void 0:y.top)!=null?V:0,bottom:(F=y==null?void 0:y.bottom)!=null?F:0})},onMouseLeave:()=>{c.current=!1},onClick:()=>{e(!0),m==null||m.setParagraphMenuActive(!0)},children:[P.jsx(C.component,{className:"univer-h-4 univer-w-4 univer-text-gray-900"}),P.jsx(_o,{className:"univer-h-3 univer-w-3 univer-text-gray-600"})]}),t&&P.jsx(I.RectPopup,{portal:!0,mask:!0,maskZIndex:100,anchorRect$:b,direction:"left",onMaskClick:R,children:P.jsx("section",{ref:n,onMouseEnter:M=>{var y;(y=i.onPointerEnter)==null||y.call(i,M),c.current=!0},onMouseLeave:()=>{c.current=!1},children:P.jsx(I.DesktopMenu,{style:{width:212},menuType:I.ContextMenuPosition.PARAGRAPH,onOptionSelect:M=>{const{label:y,commandId:N,value:x}=M;o&&o.executeCommand(N!=null?N:y,{value:x}),a.focus(),R()}})})})]})},je={id:"doc.command.tab",type:s.CommandType.COMMAND,async handler(i,t){const n=i.get(T.DocAutoFormatService).onAutoFormat(je.id,t);return(await s.sequenceExecuteAsync(n,i.get(s.ICommandService))).result}},Bt={id:"doc.command.after-space",type:s.CommandType.COMMAND,async handler(i){const e=i.get(T.DocAutoFormatService).onAutoFormat(Bt.id);return(await s.sequenceExecuteAsync(e,i.get(s.ICommandService))).result}},st={id:"doc.command.enter",type:s.CommandType.COMMAND,async handler(i){const e=i.get(T.DocAutoFormatService).onAutoFormat(st.id);return(await s.sequenceExecuteAsync(e,i.get(s.ICommandService))).result}};function ee(i){return i.getContextValue(s.FOCUSING_DOC)&&i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&!i.getContextValue(s.FOCUSING_COMMON_DRAWINGS)}function dl(i){return i.getContextValue(s.FOCUSING_DOC)&&i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&!i.getContextValue(s.FOCUSING_COMMON_DRAWINGS)}const Al={id:je.id,binding:I.KeyCode.TAB,preconditions:ee},ul={id:je.id,binding:I.KeyCode.TAB|I.MetaKeys.SHIFT,preconditions:ee,staticParameters:{shift:!0}},hl={id:De.id,binding:I.KeyCode.B|I.MetaKeys.CTRL_COMMAND,preconditions:ee},gl={id:Be.id,binding:I.KeyCode.I|I.MetaKeys.CTRL_COMMAND,preconditions:ee},ml={id:_e.id,binding:I.KeyCode.U|I.MetaKeys.CTRL_COMMAND,preconditions:ee},pl={id:Ne.id,binding:I.KeyCode.X|I.MetaKeys.SHIFT|I.MetaKeys.CTRL_COMMAND,preconditions:ee},fl={id:ye.id,binding:I.KeyCode.COMMA|I.MetaKeys.CTRL_COMMAND,preconditions:ee},Sl={id:Pe.id,binding:I.KeyCode.PERIOD|I.MetaKeys.CTRL_COMMAND,preconditions:ee},Il={id:Tt.id,binding:I.KeyCode.L|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},vl={id:bt.id,binding:I.KeyCode.R|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},El={id:yt.id,binding:I.KeyCode.E|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},Cl={id:Ot.id,binding:I.KeyCode.J|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},Tl={id:ot.id,binding:I.KeyCode.Digit7|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},yl={id:it.id,binding:I.KeyCode.Digit8|I.MetaKeys.CTRL_COMMAND|I.MetaKeys.SHIFT,preconditions:ee},un="docs-ui.config",Ks={layout:{docContainerConfig:ao,toolbarConfig:so}},bl=[50,80,100,130,150,170,200,400],Ol=[10,400];function Rl(){const i=I.useDependency(s.ICommandService),t=I.useDependency(s.IUniverInstanceService),e=U.useMemo(()=>t.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC),[]),n=I.useObservable(e),o=U.useCallback(()=>{var A,d;if(!n)return 100;const l=((d=(A=n.getSettings())==null?void 0:A.zoomRatio)!=null?d:1)*100;return Math.round(l)},[n]),[a,r]=U.useState(()=>o());U.useEffect(()=>(r(o()),i.onCommandExecuted(A=>{if(A.id===he.id){const d=o();r(d)}}).dispose),[i,o]);function c(l){if(r(l),n==null)return;const A=l/100;i.executeCommand(he.id,{unitId:n.getUnitId(),zoomRatio:A})}return P.jsx(I.Slider,{min:Ol[0],value:a,shortcuts:bl,onChange:c})}function Ml(i){return P.jsx("section",{className:"univer-flex univer-flex-shrink-0 univer-justify-end",children:P.jsx(Rl,{})})}function xl(){var o,a,r;const i=I.useDependency(s.IUniverInstanceService),t=I.useConfigValue(un),e=I.useObservable(()=>i.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),n=(r=(a=(o=t==null?void 0:t.layout)==null?void 0:o.docContainerConfig)==null?void 0:a.footer)!=null?r:!0;return e?null:n&&P.jsxs("div",{className:"univer-box-border univer-flex univer-items-center univer-justify-between univer-px-5",children:[P.jsx("div",{}),P.jsx(Ml,{})]})}const Dl="univer-overflow-hidden univer-font-[500] univer-truncate univer-h-[24px] univer-mb-2 univer-leading-[24px] univer-ellipsis univer-cursor-pointer",Bl="univer-text-base univer-font-semibold",_l="univer-text-sm univer-font-semibold",Nl="univer-text-sm",Pl=U.forwardRef((i,t)=>{const{menus:e,onClick:n,className:o,style:a,mode:r,maxHeight:c,activeId:l,open:A,onOpenChange:d,maxWidth:u,wrapperClass:m,wrapperStyle:h,iconClass:g,iconStyle:p}=i,f=r==="side-bar",S=U.useRef(null),E=U.useRef(e);E.current=e;const C=U.useMemo(()=>({scrollTo:b=>{var x;if(!E.current||E.current.findIndex(w=>w.id===b)===-1||!S.current)return;const v=document.getElementById(`univer-side-menu-${b}`);if(!v)return;const O=v.offsetTop,M=S.current.clientHeight,y=S.current.scrollHeight-M,N=Math.max(0,Math.min(O-M/2+v.clientHeight/2,y));(x=S.current)==null||x.scrollTo({behavior:"smooth",top:N})}}),[]);return U.useImperativeHandle(t,()=>C),U.useEffect(()=>{l&&C.scrollTo(l)},[l,C]),P.jsxs("div",{className:J.clsx("univer-relative",m),style:h,children:[P.jsx("div",{onClick:()=>d==null?void 0:d(!A),className:J.clsx(`
219
+ `,J.borderClassName,{"univer-bg-gray-100":t,"univer-bg-white":!t}),onMouseEnter:M=>{var N,x,w,H,V,F;(N=i.onPointerEnter)==null||N.call(i,M),c.current=!0;const y=(x=r.current)==null?void 0:x.getBoundingClientRect();b.next({left:((w=y==null?void 0:y.left)!=null?w:0)-4,right:(H=y==null?void 0:y.right)!=null?H:0,top:(V=y==null?void 0:y.top)!=null?V:0,bottom:(F=y==null?void 0:y.bottom)!=null?F:0})},onMouseLeave:()=>{c.current=!1},onClick:()=>{e(!0),m==null||m.setParagraphMenuActive(!0)},children:[P.jsx(C.component,{className:`
220
+ univer-size-4 univer-text-gray-900
221
+ dark:univer-text-white
222
+ `}),P.jsx(_o,{className:`
223
+ univer-size-3 univer-text-gray-600
224
+ dark:univer-text-gray-200
225
+ `})]}),t&&P.jsx(v.RectPopup,{portal:!0,mask:!0,maskZIndex:100,anchorRect$:b,direction:"left",onMaskClick:R,children:P.jsx("section",{ref:n,onMouseEnter:M=>{var y;(y=i.onPointerEnter)==null||y.call(i,M),c.current=!0},onMouseLeave:()=>{c.current=!1},children:P.jsx(v.DesktopMenu,{style:{width:212},menuType:v.ContextMenuPosition.PARAGRAPH,onOptionSelect:M=>{const{label:y,commandId:N,value:x}=M;o&&o.executeCommand(N!=null?N:y,{value:x}),a.focus(),R()}})})})]})},je={id:"doc.command.tab",type:s.CommandType.COMMAND,async handler(i,t){const n=i.get(T.DocAutoFormatService).onAutoFormat(je.id,t);return(await s.sequenceExecuteAsync(n,i.get(s.ICommandService))).result}},Bt={id:"doc.command.after-space",type:s.CommandType.COMMAND,async handler(i){const e=i.get(T.DocAutoFormatService).onAutoFormat(Bt.id);return(await s.sequenceExecuteAsync(e,i.get(s.ICommandService))).result}},st={id:"doc.command.enter",type:s.CommandType.COMMAND,async handler(i){const e=i.get(T.DocAutoFormatService).onAutoFormat(st.id);return(await s.sequenceExecuteAsync(e,i.get(s.ICommandService))).result}};function ee(i){return i.getContextValue(s.FOCUSING_DOC)&&i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&!i.getContextValue(s.FOCUSING_COMMON_DRAWINGS)}function dl(i){return i.getContextValue(s.FOCUSING_DOC)&&i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&!i.getContextValue(s.FOCUSING_COMMON_DRAWINGS)}const Al={id:je.id,binding:v.KeyCode.TAB,preconditions:ee},ul={id:je.id,binding:v.KeyCode.TAB|v.MetaKeys.SHIFT,preconditions:ee,staticParameters:{shift:!0}},hl={id:De.id,binding:v.KeyCode.B|v.MetaKeys.CTRL_COMMAND,preconditions:ee},gl={id:Be.id,binding:v.KeyCode.I|v.MetaKeys.CTRL_COMMAND,preconditions:ee},ml={id:_e.id,binding:v.KeyCode.U|v.MetaKeys.CTRL_COMMAND,preconditions:ee},pl={id:Ne.id,binding:v.KeyCode.X|v.MetaKeys.SHIFT|v.MetaKeys.CTRL_COMMAND,preconditions:ee},fl={id:ye.id,binding:v.KeyCode.COMMA|v.MetaKeys.CTRL_COMMAND,preconditions:ee},Sl={id:Pe.id,binding:v.KeyCode.PERIOD|v.MetaKeys.CTRL_COMMAND,preconditions:ee},vl={id:Tt.id,binding:v.KeyCode.L|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},Il={id:bt.id,binding:v.KeyCode.R|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},El={id:yt.id,binding:v.KeyCode.E|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},Cl={id:Ot.id,binding:v.KeyCode.J|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},Tl={id:ot.id,binding:v.KeyCode.Digit7|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},yl={id:it.id,binding:v.KeyCode.Digit8|v.MetaKeys.CTRL_COMMAND|v.MetaKeys.SHIFT,preconditions:ee},un="docs-ui.config",Ks={layout:{docContainerConfig:ao,toolbarConfig:so}},bl=[50,80,100,130,150,170,200,400],Ol=[10,400];function Rl(){const i=v.useDependency(s.ICommandService),t=v.useDependency(s.IUniverInstanceService),e=U.useMemo(()=>t.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC),[]),n=v.useObservable(e),o=U.useCallback(()=>{var A,d;if(!n)return 100;const l=((d=(A=n.getSettings())==null?void 0:A.zoomRatio)!=null?d:1)*100;return Math.round(l)},[n]),[a,r]=U.useState(()=>o());U.useEffect(()=>(r(o()),i.onCommandExecuted(A=>{if(A.id===he.id){const d=o();r(d)}}).dispose),[i,o]);function c(l){if(r(l),n==null)return;const A=l/100;i.executeCommand(he.id,{unitId:n.getUnitId(),zoomRatio:A})}return P.jsx(v.Slider,{min:Ol[0],value:a,shortcuts:bl,onChange:c})}function Ml(i){return P.jsx("section",{className:"univer-flex univer-flex-shrink-0 univer-justify-end",children:P.jsx(Rl,{})})}function xl(){var o,a,r;const i=v.useDependency(s.IUniverInstanceService),t=v.useConfigValue(un),e=v.useObservable(()=>i.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),n=(r=(a=(o=t==null?void 0:t.layout)==null?void 0:o.docContainerConfig)==null?void 0:a.footer)!=null?r:!0;return e?null:n&&P.jsxs("div",{className:"univer-box-border univer-flex univer-items-center univer-justify-between univer-px-5",children:[P.jsx("div",{}),P.jsx(Ml,{})]})}const Dl="univer-overflow-hidden univer-font-[500] univer-truncate univer-h-[24px] univer-mb-2 univer-leading-[24px] univer-ellipsis univer-cursor-pointer",Bl="univer-text-base univer-font-semibold",_l="univer-text-sm univer-font-semibold",Nl="univer-text-sm",Pl=U.forwardRef((i,t)=>{const{menus:e,onClick:n,className:o,style:a,mode:r,maxHeight:c,activeId:l,open:A,onOpenChange:d,maxWidth:u,wrapperClass:m,wrapperStyle:h,iconClass:g,iconStyle:p}=i,f=r==="side-bar",S=U.useRef(null),E=U.useRef(e);E.current=e;const C=U.useMemo(()=>({scrollTo:b=>{var x;if(!E.current||E.current.findIndex(w=>w.id===b)===-1||!S.current)return;const I=document.getElementById(`univer-side-menu-${b}`);if(!I)return;const O=I.offsetTop,M=S.current.clientHeight,y=S.current.scrollHeight-M,N=Math.max(0,Math.min(O-M/2+I.clientHeight/2,y));(x=S.current)==null||x.scrollTo({behavior:"smooth",top:N})}}),[]);return U.useImperativeHandle(t,()=>C),U.useEffect(()=>{l&&C.scrollTo(l)},[l,C]),P.jsxs("div",{className:J.clsx("univer-relative",m),style:h,children:[P.jsx("div",{onClick:()=>d==null?void 0:d(!A),className:J.clsx(`
212
226
  univer-absolute univer-left-5 univer-top-4 univer-z-[100] univer-flex univer-h-8 univer-w-8
213
227
  univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-bg-white
214
228
  univer-text-gray-800
@@ -219,15 +233,15 @@ ${s.DataStreamTreeTokenType.TABLE_CELL_END}`;break}}}_processBeforeLink(t,e){ret
219
233
  univer-duration-300
220
234
  `,f?"":["univer-bg-white","univer-rounded-r-2xl","univer-shadow-[0px_1px_6px_-2px_rgba(30,40,77,0.08),0px_2px_6px_-1px_rgba(30,40,77,0.10)]","univer-backdrop-blur-[10px]"]),style:{...a,transform:A?"translateX(0)":"translateX(-100%)",maxHeight:c,opacity:A?1:0,maxWidth:u!=null?u:r==="side-bar"?480:180,paddingRight:r==="float"?void 0:0},children:P.jsx("div",{ref:S,className:J.clsx(`
221
235
  univer-flex-1 univer-overflow-y-auto univer-overflow-x-hidden univer-scrollbar-none
222
- `),children:e==null?void 0:e.map(b=>P.jsx("div",{id:`univer-side-menu-${b.id}`,className:J.clsx(Dl,{[Bl]:b.isTitle,[_l]:b.level===1,[Nl]:b.level>1,"univer-text-gray-500":b.id!==l,"univer-text-gray-800":b.id===l}),style:{paddingLeft:(b.level-1)*12},onClick:()=>{n==null||n(b)},children:b.text},b.id))})})]})}),Ul=i=>{switch(i){case s.NamedStyleType.HEADING_1:return 1;case s.NamedStyleType.HEADING_2:return 2;case s.NamedStyleType.HEADING_3:return 3;case s.NamedStyleType.HEADING_4:return 4;case s.NamedStyleType.HEADING_5:return 5;case s.NamedStyleType.TITLE:return 1;default:return 1}};function wl(i,t,e,n){var c,l;if(!i)return;const o=Array.from(i.values()),a=o.findIndex(A=>A.paragraphStart!==A.paragraphEnd&&A.rect.top<n&&A.rect.bottom>e);if(a===-1)return;const r=o==null?void 0:o.findLastIndex(A=>A.paragraphStart!==A.paragraphEnd&&A.rect.top<n&&A.rect.bottom>e);for(let A=a;A<=r;A++){const d=o[A],u=t.get(d.startIndex);if((c=u==null?void 0:u.paragraphStyle)!=null&&c.headingId)return u.paragraphStyle.headingId}for(let A=a;A>=0;A--){const d=o[A],u=t.get(d.startIndex);if((l=u==null?void 0:u.paragraphStyle)!=null&&l.headingId)return u.paragraphStyle.headingId}}const Ys="__title";function Ll(){var t,e,n;const i=I.useConfigValue(un);return(n=(e=(t=i==null?void 0:i.layout)==null?void 0:t.docContainerConfig)==null?void 0:e.sideMenu)==null||n?P.jsx(Ql,{}):null}function Ql(){var N,x,w,H,V,F,Q,j,G;const i=I.useDependency(s.ICommandService),t=I.useDependency(s.IUniverInstanceService),e=I.useObservable(U.useMemo(()=>t.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC),[])),n=I.useDependency(_.IRenderManagerService),o=(x=(N=e==null?void 0:e.getBody())==null?void 0:N.dataStream)!=null?x:"",[a,r]=U.useState(0),[c,l]=U.useState(void 0),A=(w=e==null?void 0:e.getUnitId())!=null?w:"",d=n.getRenderById(A),u=e==null?void 0:e.getTitle(),m=d==null?void 0:d.with(T.DocEventManagerService),h=m==null?void 0:m.paragraphBounds,g=(V=(H=d==null?void 0:d.mainComponent)==null?void 0:H.left)!=null?V:0,p=(F=d==null?void 0:d.engine.height)!=null?F:0,f=(Q=d==null?void 0:d.scene.scaleY)!=null?Q:1,S=(G=(j=e==null?void 0:e.getBody())==null?void 0:j.paragraphs)!=null?G:[],E=U.useMemo(()=>{const k=new Map;return S.forEach(W=>{k.set(W.startIndex,W)}),k},[S]);I.useObservable(U.useMemo(()=>d!=null&&d.engine.onTransformChange$?s.fromEventSubject(d==null?void 0:d.engine.onTransformChange$).pipe(L.throttleTime(33)):L.of(null),[d==null?void 0:d.engine.onTransformChange$]));const C=g<180?"float":"side-bar",b=S==null?void 0:S.filter(k=>{var W;return((W=k.paragraphStyle)==null?void 0:W.namedStyleType)!==void 0&&k.paragraphStyle.namedStyleType!==s.NamedStyleType.SUBTITLE&&k.paragraphStyle.namedStyleType!==s.NamedStyleType.NORMAL_TEXT}).map(k=>{var q;const W=Ul(k.paragraphStyle.namedStyleType),z=h==null?void 0:h.get(k.startIndex);if(!z)return null;const{paragraphStart:X,paragraphEnd:Y}=z;return{id:k.paragraphStyle.headingId,text:s.getPlainText(o.slice(X,Y)),level:W,isTitle:((q=k.paragraphStyle)==null?void 0:q.namedStyleType)===s.NamedStyleType.TITLE}}).filter(k=>k==null?void 0:k.text),R=I.useEvent(k=>{const W=k.viewportScrollY,z=W+p/f,X=wl(h,E,W,z);X&&l(X)}),v=b!=null&&b.find(k=>k.isTitle)?b:[...u?[{id:Ys,text:u,level:1,isTitle:!0}]:[],...b!=null?b:[]].filter(Boolean),[O,M]=U.useState(!0);U.useEffect(()=>{const k=s.debounce(r,100),W=i.onCommandExecuted(z=>{z.id===D.RichTextEditingMutation.id&&z.params.unitId===(e==null?void 0:e.getUnitId())&&k(Y=>Y+1)});return()=>{W.dispose()}},[i,e]),U.useEffect(()=>{const k=d==null?void 0:d.scene.getViewport(ae.VIEW_MAIN);if(!k)return;const W=s.fromEventSubject(k.onScrollAfter$).pipe(L.throttleTime(33)).subscribe(R);return()=>{W.unsubscribe()}},[d]);const y=I.useEvent(k=>{const W=d==null?void 0:d.scene.getViewport(ae.VIEW_MAIN);if(!W)return;if(k.id===Ys){W.scrollToViewportPos({viewportScrollY:0});return}const z=S.find(Y=>{var q;return((q=Y.paragraphStyle)==null?void 0:q.headingId)===k.id});if(!z)return;const X=h==null?void 0:h.get(z.startIndex);X&&(W.scrollToViewportPos({viewportScrollY:X.rect.top}),l(k.id))});return!e||s.isInternalEditorID(A)||!(v!=null&&v.length)?null:P.jsx("div",{className:"univer-absolute univer-bottom-0 univer-left-0 univer-top-0 univer-z-[100] univer-w-[0px]",children:P.jsx(Pl,{menus:v,open:O,onOpenChange:M,mode:C,maxWidth:C==="float"?void 0:Math.floor(g),wrapperClass:"univer-mt-12",activeId:c,onClick:y,maxHeight:p-48})})}const hn={id:"doc.table.delete-rows",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=ns(r,u);if(p==null)return!1;const{offset:f,rowIndexes:S,len:E,tableId:C,cursor:b,selectWholeTable:R}=p;if(R)return n.executeCommand(at.id);const v=[],O=[{startOffset:b,endOffset:b,collapsed:!0}],M={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:O}};f>0&&h.push({t:s.TextXActionType.RETAIN,len:f}),h.push({t:s.TextXActionType.DELETE,len:E});const y=Z(l,c);v.push(g.editOp(h.serialize(),y));for(const x of S.reverse()){const w=g.removeOp(["tableSource",C,"tableRows",x]);v.push(w)}return M.params.actions=v.reduce((x,w)=>s.JSONX.compose(x,w),null),!!n.syncExecuteCommand(M.id,M.params)}},gn={id:"doc.table.delete-columns",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=Nr(r,u);if(p==null)return!1;const{offsets:f,columnIndexes:S,tableId:E,cursor:C,rowCount:b,selectWholeTable:R}=p;if(R)return n.executeCommand(at.id);const v=[],O=[{startOffset:C,endOffset:C,collapsed:!0}],M={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:O}};for(const x of f){const{retain:w,delete:H}=x;w>0&&h.push({t:s.TextXActionType.RETAIN,len:w}),h.push({t:s.TextXActionType.DELETE,len:H})}const y=Z(l,c);v.push(g.editOp(h.serialize(),y)),S.reverse();for(let x=0;x<b;x++)for(const w of S){const H=g.removeOp(["tableSource",E,"tableRows",x,"tableCells",w]);v.push(H)}for(const x of S){const w=g.removeOp(["tableSource",E,"tableColumns",x]);v.push(w)}return M.params.actions=v.reduce((x,w)=>s.JSONX.compose(x,w),null),!!n.syncExecuteCommand(M.id,M.params)}},at={id:"doc.table.delete-table",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=is(r,u);if(p==null)return!1;const{offset:f,len:S,tableId:E,cursor:C}=p,b=[],R=[{startOffset:C,endOffset:C,collapsed:!0}],v={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:R}};f>0&&h.push({t:s.TextXActionType.RETAIN,len:f}),h.push({t:s.TextXActionType.DELETE,len:S});const O=Z(l,c);b.push(g.editOp(h.serialize(),O));const M=g.removeOp(["tableSource",E]);return b.push(M),v.params.actions=b.reduce((N,x)=>s.JSONX.compose(N,x),null),!!n.syncExecuteCommand(v.id,v.params)}},Li="doc.command.table-insert-row",Qi="doc.command.table-insert-column",Fl="doc.command.table-insert-row-above",Hl="doc.command.table-insert-row-bellow",kl="doc.command.table-insert-column-left",Vl="doc.command.table-insert-column-right",mn={id:Fl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Li,{position:jt.ABOVE})},pn={id:Hl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Li,{position:jt.BELLOW})},fn={id:kl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Qi,{position:ti.LEFT})},Sn={id:Vl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Qi,{position:ti.RIGHT})},Fi={id:Li,type:s.CommandType.COMMAND,handler:async(i,t)=>{const{position:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=n.getRectRanges(),c=n.getActiveTextRange(),l=gt(c,r);if(l==null)return!1;const{segmentId:A}=l,d=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A).getBody();if(d==null||u==null)return!1;const m=re(i,d.getUnitId());if(m==null)return!1;const h=m.getViewModel(),g=d==null?void 0:d.getUnitId(),p=new s.TextX,f=s.JSONX.getInstance(),S=Dr(l,e,h);if(S==null)return!1;const{offset:E,colCount:C,tableId:b,insertRowIndex:R}=S,v=[],O=E+2,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:M}};E>0&&p.push({t:s.TextXActionType.RETAIN,len:E});const N=Mr(C);p.push({t:s.TextXActionType.INSERT,body:N,len:N.dataStream.length});const x=Z(d,A);v.push(f.editOp(p.serialize(),x));const w=Kt(C),H=f.insertOp(["tableSource",b,"tableRows",R],w);return v.push(H),y.params.actions=v.reduce((F,Q)=>s.JSONX.compose(F,Q),null),!!a.syncExecuteCommand(y.id,y.params)}},qs={id:Qi,type:s.CommandType.COMMAND,handler:async(i,t)=>{var X,Y,q;const{position:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=n.getRectRanges(),c=n.getActiveTextRange(),l=gt(c,r);if(l==null)return!1;const{segmentId:A}=l,d=o.getCurrentUniverDocInstance(),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A).getBody();if(d==null||u==null)return!1;const m=re(i,d.getUnitId());if(m==null)return!1;const h=m.getViewModel(),g=d==null?void 0:d.getUnitId(),p=new s.TextX,f=s.JSONX.getInstance(),S=Br(l,e,h);if(S==null)return!1;const{offsets:E,columnIndex:C,tableId:b,rowCount:R}=S,v=[],O=E[0]+1,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:M}};for(const K of E){p.push({t:s.TextXActionType.RETAIN,len:K});const $=xr();p.push({t:s.TextXActionType.INSERT,body:$,len:$.dataStream.length})}const N=Z(d,A);v.push(f.editOp(p.serialize(),N));for(let K=0;K<R;K++){const $=Xt(),ie=f.insertOp(["tableSource",b,"tableRows",K,"tableCells",C],$);v.push(ie)}const x=d.getSnapshot(),w=x.documentStyle,{marginLeft:H=0,marginRight:V=0}=w,F=((Y=(X=w.pageSize)==null?void 0:X.width)!=null?Y:800)-H-V,Q=(q=x==null?void 0:x.tableSource)==null?void 0:q[b].tableColumns,{newColWidth:j,widths:G}=_r(F,Q,C);for(let K=0;K<G.length;K++){const $=f.replaceOp(["tableSource",b,"tableColumns",K,"size","width","v"],Q[K].size.width.v,G[K]);v.push($)}const k=Yt(j),W=f.insertOp(["tableSource",b,"tableColumns",C],k);return v.push(W),y.params.actions=v.reduce((K,$)=>s.JSONX.compose(K,$),null),!!a.syncExecuteCommand(y.id,y.params)}},pe={id:"doc-paragraph-setting.command",type:s.CommandType.COMMAND,handler:async(i,t)=>{var C,b,R,v,O;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=e.getDocRanges();if(!a||r.length===0||!t)return!1;const c=r[0].segmentId,l=a.getUnitId(),A=a.getSelfOrHeaderFooterModel(c),d=(b=(C=A.getBody())==null?void 0:C.paragraphs)!=null?b:[],u=(v=(R=A.getBody())==null?void 0:R.dataStream)!=null?v:"",m=(O=s.BuildTextUtils.range.getParagraphsInRanges(r,d,u))!=null?O:[],h={id:D.RichTextEditingMutation.id,params:{unitId:l,actions:[],textRanges:r}},g=new s.MemoryCursor;g.reset();const p=new s.TextX,f=s.JSONX.getInstance();for(const M of m){const{startIndex:y}=M;p.push({t:s.TextXActionType.RETAIN,len:y-g.cursor});const N={...M.paragraphStyle,...t.paragraph};p.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...M,paragraphStyle:N,startIndex:0}]},coverType:s.UpdateDocsAttributeType.REPLACE}),g.moveCursorTo(y+1)}const S=Z(a,c);return h.params.actions=f.editOp(p.serialize(),S),!!o.syncExecuteCommand(h.id,h.params)}},Wl=()=>{const i=I.useDependency(D.DocSelectionManagerService),t=I.useDependency(rt),e=U.useMemo(()=>i.getDocRanges(),[]);return U.useEffect(()=>{e.length||t.closePanel()},[e]),e},zl=()=>{var l,A,d,u,m;const t=I.useDependency(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),e=Wl();if(!t||e.length===0)return[];const n=e[0].segmentId,o=t.getSelfOrHeaderFooterModel(n),a=(A=(l=o.getBody())==null?void 0:l.paragraphs)!=null?A:[],r=(u=(d=o.getBody())==null?void 0:d.dataStream)!=null?u:"";return(m=s.BuildTextUtils.range.getParagraphsInRanges(e,a,r))!=null?m:[]},Gl=(i,t)=>{const e=I.useDependency(s.ICommandService),[n,o]=U.useState(()=>{var c,l;const r=i[0];return r?String((l=(c=r.paragraphStyle)==null?void 0:c.horizontalAlign)!=null?l:t):t});return[n,r=>(o(r),e.executeCommand(pe.id,{paragraph:{horizontalAlign:Number(r)}}))]},jl=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentStart,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentStart:{v:a}}}))]},Xl=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentEnd,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentEnd:{v:a}}}))]},Kl=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentFirstLine,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentFirstLine:{v:a}}}))]},Yl=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.hanging,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{hanging:{v:a}}}))]},ql=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.spaceAbove,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{spaceAbove:{v:a}}}))]},Jl=i=>{const t=I.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.spaceBelow,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{spaceBelow:{v:a}}}))]},Zl=i=>{const t=I.useDependency(s.ICommandService),e=I.useDependency(_.IRenderManagerService),n=I.useDependency(s.IUniverInstanceService),o=U.useMemo(()=>{var g;const h=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(h)return(g=e.getRenderById(h==null?void 0:h.getUnitId()))==null?void 0:g.with(D.DocSkeletonManagerService).getSkeleton()},[]),a=U.useMemo(()=>new L.BehaviorSubject({}),[]),[r,c]=U.useState(()=>{var g,p;const h=i[0];return h&&(p=(g=h.paragraphStyle)==null?void 0:g.lineSpacing)!=null?p:1}),l=U.useRef(r),[A,d]=U.useState(()=>{var g,p;const h=i[0];return h&&(p=(g=h.paragraphStyle)==null?void 0:g.spacingRule)!=null?p:s.SpacingRule.AUTO}),u=async h=>{c(h),a.next({lineSpacing:h,spacingRule:A})},m=async h=>{if(h!==A){let g=l.current;if(h===s.SpacingRule.AT_LEAST){const p=o==null?void 0:o.findNodeByCharIndex(i[0].startIndex),f=p==null?void 0:p.parent,S=f==null?void 0:f.parent;(S==null?void 0:S.contentHeight)!==void 0&&(g=Math.max(S.contentHeight,g))}else g>5&&(g=2);l.current=r,u(g),d(h),a.next({spacingRule:h})}};return U.useEffect(()=>{const h=a.pipe(At.filter(g=>!!Object.keys(g).length),At.bufferTime(16),At.filter(g=>!!g.length),At.map(g=>g.reduce((p,f)=>(Object.keys(f).forEach(S=>{p[S]=f[S]}),p),{}))).subscribe(g=>t.executeCommand(pe.id,{paragraph:{...g}}));return()=>h.unsubscribe()},[]),{lineSpacing:[r,u],spacingRule:[A,m]}},Xe=i=>{const{value:t,onChange:e,className:n="",min:o=0,max:a=100,step:r=1}=i,c=U.useRef(null);return P.jsx(J.InputNumber,{step:r,ref:c,min:o,max:a,value:t,onChange:l=>{e(l!=null?l:0).finally(()=>{setTimeout(()=>{var A;(A=c.current)==null||A.focus()},30)})},className:n})};function $l(){const i=I.useDependency(s.LocaleService),t=U.useMemo(()=>[{label:i.t("toolbar.alignLeft"),value:String(s.HorizontalAlign.LEFT),icon:P.jsx(Fo,{})},{label:i.t("toolbar.alignCenter"),value:String(s.HorizontalAlign.CENTER),icon:P.jsx(Qo,{})},{label:i.t("toolbar.alignRight"),value:String(s.HorizontalAlign.RIGHT),icon:P.jsx(ko,{})},{label:i.t("toolbar.alignJustify"),value:String(s.HorizontalAlign.JUSTIFIED),icon:P.jsx(Ro,{})}],[]),e=zl(),[n,o]=Gl(e,t[0].value),[a,r]=jl(e),[c,l]=Xl(e),[A,d]=Kl(e),[u,m]=Yl(e),[h,g]=ql(e),[p,f]=Jl(e),{lineSpacing:[S,E],spacingRule:[C,b]}=Zl(e),R=U.useMemo(()=>C===s.SpacingRule.AUTO?{min:1,max:5,step:S<2?.5:1}:{min:1,max:100},[C,S]);return P.jsxs("div",{children:[P.jsx("div",{className:"univer-t-4 univer-text-sm univer-font-medium",children:i.t("doc.paragraphSetting.alignment")}),P.jsx("div",{className:J.clsx(`
236
+ `),children:e==null?void 0:e.map(b=>P.jsx("div",{id:`univer-side-menu-${b.id}`,className:J.clsx(Dl,{[Bl]:b.isTitle,[_l]:b.level===1,[Nl]:b.level>1,"univer-text-gray-500":b.id!==l,"univer-text-gray-800":b.id===l}),style:{paddingLeft:(b.level-1)*12},onClick:()=>{n==null||n(b)},children:b.text},b.id))})})]})}),Ul=i=>{switch(i){case s.NamedStyleType.HEADING_1:return 1;case s.NamedStyleType.HEADING_2:return 2;case s.NamedStyleType.HEADING_3:return 3;case s.NamedStyleType.HEADING_4:return 4;case s.NamedStyleType.HEADING_5:return 5;case s.NamedStyleType.TITLE:return 1;default:return 1}};function wl(i,t,e,n){var c,l;if(!i)return;const o=Array.from(i.values()),a=o.findIndex(A=>A.paragraphStart!==A.paragraphEnd&&A.rect.top<n&&A.rect.bottom>e);if(a===-1)return;const r=o==null?void 0:o.findLastIndex(A=>A.paragraphStart!==A.paragraphEnd&&A.rect.top<n&&A.rect.bottom>e);for(let A=a;A<=r;A++){const d=o[A],u=t.get(d.startIndex);if((c=u==null?void 0:u.paragraphStyle)!=null&&c.headingId)return u.paragraphStyle.headingId}for(let A=a;A>=0;A--){const d=o[A],u=t.get(d.startIndex);if((l=u==null?void 0:u.paragraphStyle)!=null&&l.headingId)return u.paragraphStyle.headingId}}const Ys="__title";function Ll(){var t,e,n;const i=v.useConfigValue(un);return(n=(e=(t=i==null?void 0:i.layout)==null?void 0:t.docContainerConfig)==null?void 0:e.sideMenu)==null||n?P.jsx(Ql,{}):null}function Ql(){var N,x,w,H,V,F,Q,j,G;const i=v.useDependency(s.ICommandService),t=v.useDependency(s.IUniverInstanceService),e=v.useObservable(U.useMemo(()=>t.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_DOC),[])),n=v.useDependency(_.IRenderManagerService),o=(x=(N=e==null?void 0:e.getBody())==null?void 0:N.dataStream)!=null?x:"",[a,r]=U.useState(0),[c,l]=U.useState(void 0),A=(w=e==null?void 0:e.getUnitId())!=null?w:"",d=n.getRenderById(A),u=e==null?void 0:e.getTitle(),m=d==null?void 0:d.with(T.DocEventManagerService),h=m==null?void 0:m.paragraphBounds,g=(V=(H=d==null?void 0:d.mainComponent)==null?void 0:H.left)!=null?V:0,p=(F=d==null?void 0:d.engine.height)!=null?F:0,f=(Q=d==null?void 0:d.scene.scaleY)!=null?Q:1,S=(G=(j=e==null?void 0:e.getBody())==null?void 0:j.paragraphs)!=null?G:[],E=U.useMemo(()=>{const k=new Map;return S.forEach(W=>{k.set(W.startIndex,W)}),k},[S]);v.useObservable(U.useMemo(()=>d!=null&&d.engine.onTransformChange$?s.fromEventSubject(d==null?void 0:d.engine.onTransformChange$).pipe(L.throttleTime(33)):L.of(null),[d==null?void 0:d.engine.onTransformChange$]));const C=g<180?"float":"side-bar",b=S==null?void 0:S.filter(k=>{var W;return((W=k.paragraphStyle)==null?void 0:W.namedStyleType)!==void 0&&k.paragraphStyle.namedStyleType!==s.NamedStyleType.SUBTITLE&&k.paragraphStyle.namedStyleType!==s.NamedStyleType.NORMAL_TEXT}).map(k=>{var q;const W=Ul(k.paragraphStyle.namedStyleType),z=h==null?void 0:h.get(k.startIndex);if(!z)return null;const{paragraphStart:X,paragraphEnd:Y}=z;return{id:k.paragraphStyle.headingId,text:s.getPlainText(o.slice(X,Y)),level:W,isTitle:((q=k.paragraphStyle)==null?void 0:q.namedStyleType)===s.NamedStyleType.TITLE}}).filter(k=>k==null?void 0:k.text),R=v.useEvent(k=>{const W=k.viewportScrollY,z=W+p/f,X=wl(h,E,W,z);X&&l(X)}),I=b!=null&&b.find(k=>k.isTitle)?b:[...u?[{id:Ys,text:u,level:1,isTitle:!0}]:[],...b!=null?b:[]].filter(Boolean),[O,M]=U.useState(!0);U.useEffect(()=>{const k=s.debounce(r,100),W=i.onCommandExecuted(z=>{z.id===D.RichTextEditingMutation.id&&z.params.unitId===(e==null?void 0:e.getUnitId())&&k(Y=>Y+1)});return()=>{W.dispose()}},[i,e]),U.useEffect(()=>{const k=d==null?void 0:d.scene.getViewport(ae.VIEW_MAIN);if(!k)return;const W=s.fromEventSubject(k.onScrollAfter$).pipe(L.throttleTime(33)).subscribe(R);return()=>{W.unsubscribe()}},[d]);const y=v.useEvent(k=>{const W=d==null?void 0:d.scene.getViewport(ae.VIEW_MAIN);if(!W)return;if(k.id===Ys){W.scrollToViewportPos({viewportScrollY:0});return}const z=S.find(Y=>{var q;return((q=Y.paragraphStyle)==null?void 0:q.headingId)===k.id});if(!z)return;const X=h==null?void 0:h.get(z.startIndex);X&&(W.scrollToViewportPos({viewportScrollY:X.rect.top}),l(k.id))});return!e||s.isInternalEditorID(A)||!(I!=null&&I.length)?null:P.jsx("div",{className:"univer-absolute univer-bottom-0 univer-left-0 univer-top-0 univer-z-[100] univer-w-[0px]",children:P.jsx(Pl,{menus:I,open:O,onOpenChange:M,mode:C,maxWidth:C==="float"?void 0:Math.floor(g),wrapperClass:"univer-mt-12",activeId:c,onClick:y,maxHeight:p-48})})}const hn={id:"doc.table.delete-rows",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=ns(r,u);if(p==null)return!1;const{offset:f,rowIndexes:S,len:E,tableId:C,cursor:b,selectWholeTable:R}=p;if(R)return n.executeCommand(at.id);const I=[],O=[{startOffset:b,endOffset:b,collapsed:!0}],M={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:O}};f>0&&h.push({t:s.TextXActionType.RETAIN,len:f}),h.push({t:s.TextXActionType.DELETE,len:E});const y=Z(l,c);I.push(g.editOp(h.serialize(),y));for(const x of S.reverse()){const w=g.removeOp(["tableSource",C,"tableRows",x]);I.push(w)}return M.params.actions=I.reduce((x,w)=>s.JSONX.compose(x,w),null),!!n.syncExecuteCommand(M.id,M.params)}},gn={id:"doc.table.delete-columns",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=Nr(r,u);if(p==null)return!1;const{offsets:f,columnIndexes:S,tableId:E,cursor:C,rowCount:b,selectWholeTable:R}=p;if(R)return n.executeCommand(at.id);const I=[],O=[{startOffset:C,endOffset:C,collapsed:!0}],M={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:O}};for(const x of f){const{retain:w,delete:H}=x;w>0&&h.push({t:s.TextXActionType.RETAIN,len:w}),h.push({t:s.TextXActionType.DELETE,len:H})}const y=Z(l,c);I.push(g.editOp(h.serialize(),y)),S.reverse();for(let x=0;x<b;x++)for(const w of S){const H=g.removeOp(["tableSource",E,"tableRows",x,"tableCells",w]);I.push(H)}for(const x of S){const w=g.removeOp(["tableSource",E,"tableColumns",x]);I.push(w)}return M.params.actions=I.reduce((x,w)=>s.JSONX.compose(x,w),null),!!n.syncExecuteCommand(M.id,M.params)}},at={id:"doc.table.delete-table",type:s.CommandType.COMMAND,handler:async i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService),n=i.get(s.ICommandService),o=t.getRectRanges(),a=t.getActiveTextRange(),r=gt(a,o);if(r==null)return!1;const{segmentId:c}=r,l=e.getCurrentUniverDocInstance(),A=l==null?void 0:l.getSelfOrHeaderFooterModel(c).getBody();if(l==null||A==null)return!1;const d=re(i,l.getUnitId());if(d==null)return!1;const u=d.getViewModel(),m=l==null?void 0:l.getUnitId(),h=new s.TextX,g=s.JSONX.getInstance(),p=is(r,u);if(p==null)return!1;const{offset:f,len:S,tableId:E,cursor:C}=p,b=[],R=[{startOffset:C,endOffset:C,collapsed:!0}],I={id:D.RichTextEditingMutation.id,params:{unitId:m,actions:[],textRanges:R}};f>0&&h.push({t:s.TextXActionType.RETAIN,len:f}),h.push({t:s.TextXActionType.DELETE,len:S});const O=Z(l,c);b.push(g.editOp(h.serialize(),O));const M=g.removeOp(["tableSource",E]);return b.push(M),I.params.actions=b.reduce((N,x)=>s.JSONX.compose(N,x),null),!!n.syncExecuteCommand(I.id,I.params)}},Li="doc.command.table-insert-row",Qi="doc.command.table-insert-column",Fl="doc.command.table-insert-row-above",Hl="doc.command.table-insert-row-bellow",kl="doc.command.table-insert-column-left",Vl="doc.command.table-insert-column-right",mn={id:Fl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Li,{position:jt.ABOVE})},pn={id:Hl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Li,{position:jt.BELLOW})},fn={id:kl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Qi,{position:ti.LEFT})},Sn={id:Vl,type:s.CommandType.COMMAND,handler:async i=>i.get(s.ICommandService).executeCommand(Qi,{position:ti.RIGHT})},Fi={id:Li,type:s.CommandType.COMMAND,handler:async(i,t)=>{const{position:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=n.getRectRanges(),c=n.getActiveTextRange(),l=gt(c,r);if(l==null)return!1;const{segmentId:A}=l,d=o.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A).getBody();if(d==null||u==null)return!1;const m=re(i,d.getUnitId());if(m==null)return!1;const h=m.getViewModel(),g=d==null?void 0:d.getUnitId(),p=new s.TextX,f=s.JSONX.getInstance(),S=Dr(l,e,h);if(S==null)return!1;const{offset:E,colCount:C,tableId:b,insertRowIndex:R}=S,I=[],O=E+2,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:M}};E>0&&p.push({t:s.TextXActionType.RETAIN,len:E});const N=Mr(C);p.push({t:s.TextXActionType.INSERT,body:N,len:N.dataStream.length});const x=Z(d,A);I.push(f.editOp(p.serialize(),x));const w=Kt(C),H=f.insertOp(["tableSource",b,"tableRows",R],w);return I.push(H),y.params.actions=I.reduce((F,Q)=>s.JSONX.compose(F,Q),null),!!a.syncExecuteCommand(y.id,y.params)}},qs={id:Qi,type:s.CommandType.COMMAND,handler:async(i,t)=>{var X,Y,q;const{position:e}=t,n=i.get(D.DocSelectionManagerService),o=i.get(s.IUniverInstanceService),a=i.get(s.ICommandService),r=n.getRectRanges(),c=n.getActiveTextRange(),l=gt(c,r);if(l==null)return!1;const{segmentId:A}=l,d=o.getCurrentUniverDocInstance(),u=d==null?void 0:d.getSelfOrHeaderFooterModel(A).getBody();if(d==null||u==null)return!1;const m=re(i,d.getUnitId());if(m==null)return!1;const h=m.getViewModel(),g=d==null?void 0:d.getUnitId(),p=new s.TextX,f=s.JSONX.getInstance(),S=Br(l,e,h);if(S==null)return!1;const{offsets:E,columnIndex:C,tableId:b,rowCount:R}=S,I=[],O=E[0]+1,M=[{startOffset:O,endOffset:O,collapsed:!0}],y={id:D.RichTextEditingMutation.id,params:{unitId:g,actions:[],textRanges:M}};for(const K of E){p.push({t:s.TextXActionType.RETAIN,len:K});const $=xr();p.push({t:s.TextXActionType.INSERT,body:$,len:$.dataStream.length})}const N=Z(d,A);I.push(f.editOp(p.serialize(),N));for(let K=0;K<R;K++){const $=Xt(),ie=f.insertOp(["tableSource",b,"tableRows",K,"tableCells",C],$);I.push(ie)}const x=d.getSnapshot(),w=x.documentStyle,{marginLeft:H=0,marginRight:V=0}=w,F=((Y=(X=w.pageSize)==null?void 0:X.width)!=null?Y:800)-H-V,Q=(q=x==null?void 0:x.tableSource)==null?void 0:q[b].tableColumns,{newColWidth:j,widths:G}=_r(F,Q,C);for(let K=0;K<G.length;K++){const $=f.replaceOp(["tableSource",b,"tableColumns",K,"size","width","v"],Q[K].size.width.v,G[K]);I.push($)}const k=Yt(j),W=f.insertOp(["tableSource",b,"tableColumns",C],k);return I.push(W),y.params.actions=I.reduce((K,$)=>s.JSONX.compose(K,$),null),!!a.syncExecuteCommand(y.id,y.params)}},pe={id:"doc-paragraph-setting.command",type:s.CommandType.COMMAND,handler:async(i,t)=>{var C,b,R,I,O;const e=i.get(D.DocSelectionManagerService),n=i.get(s.IUniverInstanceService),o=i.get(s.ICommandService),a=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),r=e.getDocRanges();if(!a||r.length===0||!t)return!1;const c=r[0].segmentId,l=a.getUnitId(),A=a.getSelfOrHeaderFooterModel(c),d=(b=(C=A.getBody())==null?void 0:C.paragraphs)!=null?b:[],u=(I=(R=A.getBody())==null?void 0:R.dataStream)!=null?I:"",m=(O=s.BuildTextUtils.range.getParagraphsInRanges(r,d,u))!=null?O:[],h={id:D.RichTextEditingMutation.id,params:{unitId:l,actions:[],textRanges:r}},g=new s.MemoryCursor;g.reset();const p=new s.TextX,f=s.JSONX.getInstance();for(const M of m){const{startIndex:y}=M;p.push({t:s.TextXActionType.RETAIN,len:y-g.cursor});const N={...M.paragraphStyle,...t.paragraph};p.push({t:s.TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...M,paragraphStyle:N,startIndex:0}]},coverType:s.UpdateDocsAttributeType.REPLACE}),g.moveCursorTo(y+1)}const S=Z(a,c);return h.params.actions=f.editOp(p.serialize(),S),!!o.syncExecuteCommand(h.id,h.params)}},Wl=()=>{const i=v.useDependency(D.DocSelectionManagerService),t=v.useDependency(rt),e=U.useMemo(()=>i.getDocRanges(),[]);return U.useEffect(()=>{e.length||t.closePanel()},[e]),e},zl=()=>{var l,A,d,u,m;const t=v.useDependency(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),e=Wl();if(!t||e.length===0)return[];const n=e[0].segmentId,o=t.getSelfOrHeaderFooterModel(n),a=(A=(l=o.getBody())==null?void 0:l.paragraphs)!=null?A:[],r=(u=(d=o.getBody())==null?void 0:d.dataStream)!=null?u:"";return(m=s.BuildTextUtils.range.getParagraphsInRanges(e,a,r))!=null?m:[]},Gl=(i,t)=>{const e=v.useDependency(s.ICommandService),[n,o]=U.useState(()=>{var c,l;const r=i[0];return r?String((l=(c=r.paragraphStyle)==null?void 0:c.horizontalAlign)!=null?l:t):t});return[n,r=>(o(r),e.executeCommand(pe.id,{paragraph:{horizontalAlign:Number(r)}}))]},jl=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentStart,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentStart:{v:a}}}))]},Xl=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentEnd,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentEnd:{v:a}}}))]},Kl=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.indentFirstLine,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{indentFirstLine:{v:a}}}))]},Yl=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.hanging,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{hanging:{v:a}}}))]},ql=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.spaceAbove,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{spaceAbove:{v:a}}}))]},Jl=i=>{const t=v.useDependency(s.ICommandService),[e,n]=U.useState(()=>{var r;const a=i[0];return a?_.getNumberUnitValue((r=a.paragraphStyle)==null?void 0:r.spaceBelow,0):0});return[e,a=>(n(a),t.executeCommand(pe.id,{paragraph:{spaceBelow:{v:a}}}))]},Zl=i=>{const t=v.useDependency(s.ICommandService),e=v.useDependency(_.IRenderManagerService),n=v.useDependency(s.IUniverInstanceService),o=U.useMemo(()=>{var g;const h=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(h)return(g=e.getRenderById(h==null?void 0:h.getUnitId()))==null?void 0:g.with(D.DocSkeletonManagerService).getSkeleton()},[]),a=U.useMemo(()=>new L.BehaviorSubject({}),[]),[r,c]=U.useState(()=>{var g,p;const h=i[0];return h&&(p=(g=h.paragraphStyle)==null?void 0:g.lineSpacing)!=null?p:1}),l=U.useRef(r),[A,d]=U.useState(()=>{var g,p;const h=i[0];return h&&(p=(g=h.paragraphStyle)==null?void 0:g.spacingRule)!=null?p:s.SpacingRule.AUTO}),u=async h=>{c(h),a.next({lineSpacing:h,spacingRule:A})},m=async h=>{if(h!==A){let g=l.current;if(h===s.SpacingRule.AT_LEAST){const p=o==null?void 0:o.findNodeByCharIndex(i[0].startIndex),f=p==null?void 0:p.parent,S=f==null?void 0:f.parent;(S==null?void 0:S.contentHeight)!==void 0&&(g=Math.max(S.contentHeight,g))}else g>5&&(g=2);l.current=r,u(g),d(h),a.next({spacingRule:h})}};return U.useEffect(()=>{const h=a.pipe(At.filter(g=>!!Object.keys(g).length),At.bufferTime(16),At.filter(g=>!!g.length),At.map(g=>g.reduce((p,f)=>(Object.keys(f).forEach(S=>{p[S]=f[S]}),p),{}))).subscribe(g=>t.executeCommand(pe.id,{paragraph:{...g}}));return()=>h.unsubscribe()},[]),{lineSpacing:[r,u],spacingRule:[A,m]}},Xe=i=>{const{value:t,onChange:e,className:n="",min:o=0,max:a=100,step:r=1}=i,c=U.useRef(null);return P.jsx(J.InputNumber,{step:r,ref:c,min:o,max:a,value:t,onChange:l=>{e(l!=null?l:0).finally(()=>{setTimeout(()=>{var A;(A=c.current)==null||A.focus()},30)})},className:n})};function $l(){const i=v.useDependency(s.LocaleService),t=U.useMemo(()=>[{label:i.t("toolbar.alignLeft"),value:String(s.HorizontalAlign.LEFT),icon:P.jsx(Fo,{})},{label:i.t("toolbar.alignCenter"),value:String(s.HorizontalAlign.CENTER),icon:P.jsx(Qo,{})},{label:i.t("toolbar.alignRight"),value:String(s.HorizontalAlign.RIGHT),icon:P.jsx(ko,{})},{label:i.t("toolbar.alignJustify"),value:String(s.HorizontalAlign.JUSTIFIED),icon:P.jsx(Ro,{})}],[]),e=zl(),[n,o]=Gl(e,t[0].value),[a,r]=jl(e),[c,l]=Xl(e),[A,d]=Kl(e),[u,m]=Yl(e),[h,g]=ql(e),[p,f]=Jl(e),{lineSpacing:[S,E],spacingRule:[C,b]}=Zl(e),R=U.useMemo(()=>C===s.SpacingRule.AUTO?{min:1,max:5,step:S<2?.5:1}:{min:1,max:100},[C,S]);return P.jsxs("div",{children:[P.jsx("div",{className:"univer-t-4 univer-text-sm univer-font-medium",children:i.t("doc.paragraphSetting.alignment")}),P.jsx("div",{className:J.clsx(`
223
237
  univer-mt-4 univer-box-border univer-flex univer-w-full univer-items-center univer-justify-between
224
238
  univer-gap-1 univer-rounded-md univer-p-1
225
- `,J.borderClassName),children:t.map(v=>P.jsx(J.Tooltip,{title:v.label,placement:"bottom",children:P.jsx("span",{className:J.clsx(`
239
+ `,J.borderClassName),children:t.map(I=>P.jsx(J.Tooltip,{title:I.label,placement:"bottom",children:P.jsx("span",{className:J.clsx(`
226
240
  univer-flex univer-cursor-pointer univer-items-center univer-justify-center
227
241
  univer-rounded univer-bg-none univer-px-3 univer-py-1
228
242
  hover:univer-bg-black/60
229
- `,{"univer-bg-blend-color-dodge/90":n===v.value}),onClick:()=>o(v.value),children:v.icon})},v.value))}),P.jsx("div",{className:"univer-t-4 univer-text-smver-font-medium",children:i.t("doc.paragraphSetting.indentation")}),P.jsxs("div",{children:[P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.left"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:a,onChange:v=>r(v!=null?v:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.right"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:c,onChange:v=>l(v!=null?v:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.firstLine"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:A,onChange:v=>d(v!=null?v:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.hanging"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:u,onChange:v=>m(v!=null?v:0)})]})]}),P.jsx("div",{className:"univer-t-4 univer-text-smver-font-medium",children:i.t("doc.paragraphSetting.spacing")}),P.jsxs("div",{children:[P.jsxs("div",{className:"univer-flex univer-justify-betweenuniver-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.before"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:h,onChange:v=>g(v!=null?v:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.after"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:p,onChange:v=>f(v!=null?v:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between item-center",children:[P.jsx("div",{className:"univer-mt-3 univer-text-xs",children:i.t("doc.paragraphSetting.lineSpace")}),P.jsxs("div",{className:"univer-mt-4 univer-flex univer-flex-col univer-gap-1.5",style:{width:162},children:[P.jsx(J.Select,{value:`${C}`,options:[{label:i.t("doc.paragraphSetting.multiSpace"),value:`${s.SpacingRule.AUTO}`},{label:i.t("doc.paragraphSetting.fixedValue"),value:`${s.SpacingRule.AT_LEAST}`}],onChange:v=>b(Number(v))}),P.jsx(Xe,{...R,value:S,onChange:v=>E(v!=null?v:0)})]})]})]})]})}const ed=(i,t)=>t.length===i.length&&i.some(e=>t.some(n=>n.startOffset===e.startOffset&&n.endOffset===e.endOffset));function td(){const i=I.useDependency(s.ICommandService),t=I.useDependency(s.LocaleService),e=I.useObservable(t.currentLocale$),[n,o]=U.useState(""),a=U.useMemo(()=>s.debounce(()=>o(s.generateRandomId(4)),300),[]),r=U.useRef([]);return U.useEffect(()=>{const c=i.onCommandExecuted(l=>{if(D.SetTextSelectionsOperation.id===l.id){const A=l.params.ranges;ed(A,r.current)||o(s.generateRandomId(4)),r.current=A}D.RichTextEditingMutation.id===l.id&&l.params.trigger!==pe.id&&a()});return()=>c.dispose()},[a]),U.useEffect(()=>{o(s.generateRandomId(4))},[e]),U.useEffect(()=>()=>a.cancel(),[a]),P.jsx($l,{},n)}var nd=Object.getOwnPropertyDescriptor,id=(i,t,e,n)=>{for(var o=n>1?void 0:n?nd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Hi=(i,t)=>(e,n)=>t(e,n,i);const Js="doc_ui_paragraph-setting-panel";let rt=class extends s.Disposable{constructor(t,e,n){super();B(this,"_id");this._commandService=t,this._componentManager=e,this._sidebarService=n,this._init()}_init(){this.disposeWithMe(this._componentManager.register(Js,td))}openPanel(){const t={header:{title:"doc.slider.paragraphSetting"},id:this._id,children:{label:Js},width:300};this._sidebarService.open(t)}closePanel(){this._sidebarService.close(this._id)}};rt=id([Hi(0,s.ICommandService),Hi(1,s.Inject(I.ComponentManager)),Hi(2,s.Inject(I.ISidebarService))],rt);const ki={id:"sidebar.operation.doc-paragraph-setting-panel",type:s.CommandType.OPERATION,handler:i=>(i.get(rt).openPanel(),!0)},Vi=i=>{const t=i.get(D.DocSelectionManagerService);return new L.Observable(e=>{const n=t.textSelection$.subscribe(()=>{t.getDocRanges().some(r=>r.collapsed===!1||r.rangeType===s.DOC_RANGE_TYPE.RECT)?e.next(!1):e.next(!0)});return()=>n.unsubscribe()})};function od(i){if(i.length<2)return!0;const t=i.map(e=>e.tableId);return t.every(e=>e===t[0])}function Zs(i,t,e){var a;const n=t.getRectRanges(),o=t.getActiveTextRange();if(n&&n.length&&od(n)&&o==null){i.next(!1);return}if(o&&(n==null||n.length===0)){const{segmentId:r,startOffset:c,endOffset:l}=o,A=e.getCurrentUniverDocInstance(),d=(a=A==null?void 0:A.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:a.tables;if(d&&d.length&&d.some(u=>{const{startIndex:m,endIndex:h}=u;return c>m&&c<h||l>m&&l<h})){i.next(!1);return}}i.next(!0)}const Oe=i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService);return new L.Observable(n=>{const o=t.textSelection$.subscribe(()=>{Zs(n,t,e)});return Zs(n,t,e),()=>o.unsubscribe()})},sd=i=>({id:St.name,commandId:St.id,type:I.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.copy",disabled$:Vi(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),ad=i=>({id:ki.id,type:I.MenuItemType.BUTTON,icon:"MenuSingle24",title:"doc.menu.paragraphSetting",hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),rd=i=>({id:en.id,type:I.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.cut",disabled$:Vi(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),cd=i=>({id:tn.id,type:I.MenuItemType.BUTTON,icon:"PasteSpecial",title:"rightClick.paste",hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),ld=i=>({id:pt.id,type:I.MenuItemType.BUTTON,icon:"PasteSpecial",title:"rightClick.delete",disabled$:Vi(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),$s="doc.menu.table-insert";function dd(i){return{id:$s,type:I.MenuItemType.SUBITEMS,title:"table.insert",icon:"Insert",hidden$:L.combineLatest(I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),Oe(i),(t,e)=>t||e)}}function Ad(i){return{id:mn.id,type:I.MenuItemType.BUTTON,title:"table.insertRowAbove",icon:"InsertRowAbove",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function ud(i){return{id:pn.id,type:I.MenuItemType.BUTTON,title:"table.insertRowBelow",icon:"InsertRowBelow",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function hd(i){return{id:fn.id,type:I.MenuItemType.BUTTON,title:"table.insertColumnLeft",icon:"LeftInsertColumn",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function gd(i){return{id:Sn.id,type:I.MenuItemType.BUTTON,title:"table.insertColumnRight",icon:"RightInsertColumn",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const ea="doc.menu.table-delete";function md(i){return{id:ea,type:I.MenuItemType.SUBITEMS,title:"table.delete",icon:"Reduce",hidden$:L.combineLatest(I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),Oe(i),(t,e)=>t||e)}}function pd(i){return{id:hn.id,type:I.MenuItemType.BUTTON,title:"table.deleteRows",icon:"DeleteRow",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function fd(i){return{id:gn.id,type:I.MenuItemType.BUTTON,title:"table.deleteColumns",icon:"DeleteColumn",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Sd(i){return{id:at.id,type:I.MenuItemType.BUTTON,title:"table.deleteTable",icon:"GridSingle",disabled$:Oe(i),hidden$:I.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const ta={[I.RibbonStartGroup.FORMAT]:{[De.id]:{order:0,menuItemFactory:lc},[Be.id]:{order:1,menuItemFactory:dc},[_e.id]:{order:2,menuItemFactory:Ac},[Ne.id]:{order:3,menuItemFactory:uc},[ye.id]:{order:4,menuItemFactory:hc},[Pe.id]:{order:5,menuItemFactory:gc},[de.id]:{order:5.5,menuItemFactory:fc},[ge.id]:{order:6,menuItemFactory:pc},[We.id]:{order:7,menuItemFactory:mc},[Ue.id]:{order:8,menuItemFactory:Sc},[we.id]:{order:9,menuItemFactory:Dc,[tt.id]:{order:0,menuItemFactory:xc}}},[I.RibbonStartGroup.LAYOUT]:{[Ls]:{order:1,menuItemFactory:Ec,[rn.id]:{order:0,menuItemFactory:Cc}},[Tt.id]:{order:2,menuItemFactory:Tc},[yt.id]:{order:3,menuItemFactory:yc},[bt.id]:{order:4,menuItemFactory:bc},[Ot.id]:{order:5,menuItemFactory:Oc},[It.id]:{order:6,menuItemFactory:Rc},[ot.id]:{order:7,menuItemFactory:Qs},[it.id]:{order:8,menuItemFactory:Fs},[Ct.id]:{order:9,menuItemFactory:Hs},[Zn.id]:{order:10,menuItemFactory:Ic},[Rt.id]:{order:11,menuItemFactory:Mc},[Ui.id]:{order:12,menuItemFactory:Bc}},[I.ContextMenuPosition.MAIN_AREA]:{[I.ContextMenuGroup.FORMAT]:{[St.name]:{order:0,menuItemFactory:sd},[en.id]:{order:1,menuItemFactory:rd},[tn.id]:{order:2,menuItemFactory:cd},[pt.id]:{order:3,menuItemFactory:ld}},[I.ContextMenuGroup.LAYOUT]:{[ki.id]:{order:0,menuItemFactory:ad},[$s]:{order:1,menuItemFactory:dd,[mn.id]:{order:1,menuItemFactory:Ad},[pn.id]:{order:2,menuItemFactory:ud},[fn.id]:{order:3,menuItemFactory:hd},[Sn.id]:{order:4,menuItemFactory:gd}},[ea]:{order:2,menuItemFactory:md,[hn.id]:{order:1,menuItemFactory:pd},[gn.id]:{order:2,menuItemFactory:fd},[at.id]:{order:3,menuItemFactory:Sd}}}},[I.ContextMenuPosition.PARAGRAPH]:{[I.ContextMenuGroup.QUICK]:{[Ri.id]:{order:0,menuItemFactory:Nc},[Mi.id]:{order:1,menuItemFactory:Pc},[xi.id]:{order:2,menuItemFactory:Uc},[Di.id]:{order:3,menuItemFactory:wc},[Bi.id]:{order:4,menuItemFactory:Lc},[an.id]:{order:5,menuItemFactory:Qc},[ot.id]:{order:6,menuItemFactory:Qs},[it.id]:{order:7,menuItemFactory:Fs},[Ct.id]:{order:8,menuItemFactory:Hs}},[I.ContextMenuGroup.FORMAT]:{[gi.id]:{order:0,menuItemFactory:Fc},[mi.id]:{order:1,menuItemFactory:Hc},[ci.id]:{order:2,menuItemFactory:kc}},[I.ContextMenuGroup.LAYOUT]:{[Vs]:{menuItemFactory:jc,[Ti.id]:{order:0,menuItemFactory:Vc},[yi.id]:{order:1,menuItemFactory:Wc},[bi.id]:{order:2,menuItemFactory:zc},[Si.id]:{order:3,menuItemFactory:Gc}}}}};var Id=Object.getOwnPropertyDescriptor,vd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Id(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Re=(i,t)=>(e,n)=>t(e,n,i);T.DocUIController=class extends s.Disposable{constructor(t,e,n,o,a,r,c,l,A){super(),this._injector=t,this._componentManager=e,this._commandService=n,this._layoutService=o,this._menuManagerService=a,this._uiPartsService=r,this._univerInstanceService=c,this._shortcutService=l,this._configService=A,this._init()}_initCustomComponents(){const t=this._componentManager;this.disposeWithMe(t.register(ei,J.ColorPicker)),this.disposeWithMe(t.register(qo,I.FontFamily)),this.disposeWithMe(t.register(Jo,I.FontFamilyItem)),this.disposeWithMe(t.register(Zo,I.FontSize)),this.disposeWithMe(t.register(ts,Or)),this.disposeWithMe(t.register(es,yr)),this.disposeWithMe(t.register("TodoList",Vo)),this.disposeWithMe(t.register("doc.paragraph.menu",ll)),this.disposeWithMe(t.register("CutSingle",xo)),this.disposeWithMe(t.register("DeleteSingle",Do)),this.disposeWithMe(t.register(Pi,sc)),this.disposeWithMe(t.register("DocumentSettingSingle",Bo))}_initUiParts(){this.disposeWithMe(this._uiPartsService.registerComponent(I.BuiltInUIPart.FOOTER,()=>I.connectInjector(xl,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(I.BuiltInUIPart.CONTENT,()=>I.connectInjector(Ll,this._injector)))}_initMenus(){this._menuManagerService.mergeMenu(ta)}_initShortCut(){[hl,gl,ml,pl,fl,Sl,El,Cl,vl,Il,Tl,yl,Al].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_init(){this._initCustomComponents(),this._initMenus(),this._initFocusHandler(),this._initCommands(),this._initUiParts(),this._initShortCut()}_initCommands(){[Yo,Zn,qn].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t)))}_initFocusHandler(){this.disposeWithMe(this._layoutService.registerFocusHandler(s.UniverInstanceType.UNIVER_DOC,t=>{this._injector.get(_.IRenderManagerService).getRenderById(t).with(T.DocSelectionRenderService).focus()}))}},T.DocUIController=vd([Re(0,s.Inject(s.Injector)),Re(1,s.Inject(I.ComponentManager)),Re(2,s.ICommandService),Re(3,I.ILayoutService),Re(4,I.IMenuManagerService),Re(5,I.IUIPartsService),Re(6,s.IUniverInstanceService),Re(7,I.IShortcutService),Re(8,s.IConfigService)],T.DocUIController);var Ed=Object.getOwnPropertyDescriptor,Cd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Ed(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Wi=(i,t)=>(e,n)=>t(e,n,i);const na=1.5;T.DocBackScrollRenderController=class extends s.RxDisposable{constructor(t,e,n,o){super(),this._context=t,this._textSelectionManagerService=e,this._editorService=n,this._docSkeletonManagerService=o,this._init()}_init(){this._textSelectionManagerService.textSelection$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{if(t==null)return;const{isEditing:e,unitId:n}=t;n!==this._context.unitId||!e||this._context.unitId!==s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._scrollToSelection()})}scrollToRange(t){const e=this._docSkeletonManagerService.getSkeleton();if(!e)return;const{startOffset:n}=t,o=e.findNodePositionByCharIndex(n);o&&this.scrollToNode(o)}scrollToNode(t){var N;const{unitId:e,scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton();if(o==null||a==null)return;const r=o.getOffsetConfig(),{docsLeft:c,docsTop:l}=r,A=new ve(r,a),{contentBoxPointGroup:d}=A.getRangePointData(t,t),{left:u,top:m,height:h}=ut(d),g=u+c,p=m+l,f=n.getViewport(ae.VIEW_MAIN),S=this._editorService.getEditor(e);if(f==null)return;const{left:E,top:C,right:b,bottom:R}=f.getBounding().viewBound;let v=0,O=0;const M=S?(N=S.params.backScrollOffset)!=null?N:0:100;p<C?v=p-C-M:p>R-h&&(v=p-R+h+M),g<E?O=g-E:g>b-na&&(O=g-b+na);const y=f.transViewportScroll2ScrollValue(O,v);f.scrollByBarDeltaValue(y)}_scrollToSelection(){const t=this._textSelectionManagerService.getActiveTextRange();if(t==null)return;const{collapsed:e,startNodePosition:n}=t;e&&this.scrollToNode(n)}},T.DocBackScrollRenderController=Cd([Wi(1,s.Inject(D.DocSelectionManagerService)),Wi(2,ce),Wi(3,s.Inject(D.DocSkeletonManagerService))],T.DocBackScrollRenderController);var Td=Object.getOwnPropertyDescriptor,yd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Td(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ct=(i,t)=>(e,n)=>t(e,n,i);T.DocRenderController=class extends s.RxDisposable{constructor(t,e,n,o,a,r,c){super(),this._context=t,this._commandService=e,this._docSelectionRenderService=n,this._docSkeletonManagerService=o,this._editorService=a,this._renderManagerService=r,this._univerInstanceService=c,this._addNewRender(),this._initRenderRefresh(),this._initCommandListener()}reRender(t){var r,c;const e=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.with(D.DocSkeletonManagerService),n=e==null?void 0:e.getSkeleton();if(!n||!!n.getViewModel().getDataModel().getSnapshot().disabled)return;n.calculate();const a=this._editorService.getEditor(t);if(this._editorService.isEditor(t)&&!(a!=null&&a.params.scrollBar)){(c=this._context.mainComponent)==null||c.makeDirty();return}this._recalculateSizeBySkeleton(n)}_addNewRender(){const{scene:t,engine:e}=this._context,n=new _.Viewport(ae.VIEW_MAIN,t,{left:0,top:0,bottom:0,right:0,isWheelPreventDefaultX:!0});t.attachControl(),t.onMouseWheel$.subscribeEvent((a,r)=>{const c=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if((c==null?void 0:c.getUnitId())!==this._context.unitId)return;const l=a;if(l.ctrlKey){const A=Math.abs(l.deltaX);let d=A<40?.2:A<80?.4:.2;d*=l.deltaY>0?-1:1,t.scaleX<1&&(d/=2),t.scaleX+d>4?t.scale(4,4):t.scaleX+d<.1?t.scale(.1,.1):l.preventDefault()}else n.onMouseWheel(l,r)}),new _.ScrollBar(n),t.addLayer(new _.Layer(t,[],Lt),new _.Layer(t,[],lo)),this._addComponent();const o=()=>t.render();this.disposeWithMe(this._context.activated$.subscribe(a=>{a?e.runRenderLoop(o):e.stopRenderLoop(o)})),this._docSelectionRenderService.__attachScrollEvent()}_addComponent(){const{scene:t,unit:e,components:n}=this._context,r={pageMarginLeft:20,pageMarginTop:20},c=new _.Documents(Ae.MAIN,void 0,r);c.zIndex=Bn;const l=new _.DocBackground(Ae.BACKGROUND,void 0,r);l.zIndex=Bn,this._context.mainComponent=c,n.set(Ae.MAIN,c),n.set(Ae.BACKGROUND,l),t.addObjects([c],Lt),t.addObjects([l],co),this._editorService.getEditor(e.getUnitId())==null&&t.enableLayerCache(Lt)}_initRenderRefresh(){this._docSkeletonManagerService.currentSkeletonBefore$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{this._create(t)})}_create(t){var l;if(!t)return;const{mainComponent:e,components:n}=this._context,o=e,a=n.get(Ae.BACKGROUND);o.changeSkeleton(t),a.changeSkeleton(t);const{unitId:r}=this._context,c=this._editorService.getEditor(r);if(this._editorService.isEditor(r)&&!(c!=null&&c.params.scrollBar)){(l=this._context.mainComponent)==null||l.makeDirty();return}this._recalculateSizeBySkeleton(t)}_initCommandListener(){const t=[D.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=e.params,{unitId:o}=n;this.reRender(o)}}))}_recalculateSizeBySkeleton(t){var g;const{mainComponent:e,scene:n,unitId:o,components:a}=this._context,r=e,c=a.get(Ae.BACKGROUND),l=(g=t.getSkeletonData())==null?void 0:g.pages;if(l==null)return;let A=0,d=0;const m=this._context.unit.getSnapshot().documentStyle.documentFlavor;for(let p=0,f=l.length;p<f;p++){const S=l[p];let{pageWidth:E,pageHeight:C}=S;if(m===s.DocumentFlavor.MODERN){const b=bd(S);E=b.pageWidth,C=b.pageHeight}r.pageLayoutType===_.PageLayoutType.VERTICAL?(d+=C,d+=r.pageMarginTop,p===f-1&&(d+=r.pageMarginTop),A=Math.max(A,E)):r.pageLayoutType===_.PageLayoutType.HORIZONTAL&&(A+=E,p!==f-1&&(A+=r.pageMarginLeft),d=Math.max(d,C))}r.resize(A,d),c.resize(A,d);const h=this._editorService.getEditor(o);(!this._editorService.isEditor(o)||h!=null&&h.params.scrollBar)&&n.resize(A,d)}},T.DocRenderController=yd([ct(1,s.ICommandService),ct(2,s.Inject(T.DocSelectionRenderService)),ct(3,s.Inject(D.DocSkeletonManagerService)),ct(4,ce),ct(5,_.IRenderManagerService),ct(6,s.IUniverInstanceService)],T.DocRenderController);function bd(i){let{pageWidth:t,pageHeight:e}=i;const{marginLeft:n,marginRight:o,marginTop:a,marginBottom:r,skeDrawings:c,skeTables:l}=i;t===Number.POSITIVE_INFINITY&&(t=i.width+n+o),e===Number.POSITIVE_INFINITY&&(e=i.height+a+r);for(const A of c.values())t=Math.max(t,A.aLeft+A.width+n+o),e=Math.max(e,A.aTop+A.height+a+r);for(const A of l.values())t=Math.max(t,A.left+A.width+n+o),e=Math.max(e,A.top+A.height+a+r);return{pageWidth:t,pageHeight:e}}const zi={id:"doc.command.select-all",type:s.CommandType.COMMAND,handler:async i=>{var h;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),o=e.getDocRanges(),a=(h=o.find(g=>g.isActive))!=null?h:o[0];if(n==null||a==null)return!1;const{segmentId:r}=a,c=n.getUnitId(),l=n.getSelfOrHeaderFooterModel(r).getSnapshot().body;if(l==null)return!1;const{tables:A=[],dataStream:d}=l;if(d===`\r
230
- `)return!0;const u=[];let m=0;for(const g of A){const{startIndex:p,endIndex:f}=g;m!==p&&u.push({startOffset:m,endOffset:p-1,rangeType:s.DOC_RANGE_TYPE.TEXT}),u.push({startOffset:p+3,endOffset:f-5,rangeType:s.DOC_RANGE_TYPE.RECT}),m=f}return m!==l.dataStream.length-2&&u.push({startOffset:m,endOffset:l.dataStream.length-2,rangeType:s.DOC_RANGE_TYPE.TEXT}),e.replaceDocRanges(u,{unitId:c,subUnitId:c},!1),!0}};class _t extends s.RxDisposable{constructor(e){super();B(this,"_previousActiveRange",null);B(this,"_undoMutationParamsCache",[]);B(this,"_redoMutationParamsCache",[]);this._context=e}clearUndoRedoMutationParamsCache(){this._undoMutationParamsCache=[],this._redoMutationParamsCache=[]}getUndoRedoMutationParamsCache(){return{undoCache:this._undoMutationParamsCache,redoCache:this._redoMutationParamsCache}}setUndoRedoMutationParamsCache({undoCache:e=[],redoCache:n=[]}){this._undoMutationParamsCache=e,this._redoMutationParamsCache=n}getActiveRange(){return this._previousActiveRange}setActiveRange(e){this._previousActiveRange=e}pushUndoRedoMutationParams(e,n){this._undoMutationParamsCache.push(e),this._redoMutationParamsCache.push(n)}fetchComposedUndoRedoMutationParams(){if(this._undoMutationParamsCache.length===0||this._previousActiveRange==null||this._redoMutationParamsCache.length===0)return null;const{unitId:e}=this._undoMutationParamsCache[0],n={unitId:e,actions:this._undoMutationParamsCache.reverse().reduce((a,r)=>s.JSONX.compose(a,r.actions),null),textRanges:[]};return{redoMutationParams:{unitId:e,actions:this._redoMutationParamsCache.reduce((a,r)=>s.JSONX.compose(a,r.actions),null),textRanges:[]},undoMutationParams:n,previousActiveRange:this._previousActiveRange}}dispose(){this._undoMutationParamsCache=[],this._redoMutationParamsCache=[],this._previousActiveRange=null}}const Gi={id:"doc.command.ime-input",type:s.CommandType.COMMAND,handler:async(i,t)=>{var Q,j,G;const{unitId:e,newText:n,oldTextLen:o,isCompositionEnd:a,isCompositionStart:r}=t,c=i.get(s.ICommandService),l=i.get(_.IRenderManagerService),A=i.get(s.IUniverInstanceService),d=i.get(Te),u=(Q=l.getRenderById(e))==null?void 0:Q.with(_t),m=A.getUnit(e,s.UniverInstanceType.UNIVER_DOC);if(m==null||u==null)return!1;const h=u.getActiveRange();if(h==null)return!1;const{style:g,segmentId:p}=h,f=m.getSelfOrHeaderFooterModel(p).getBody();if(f==null)return!1;Object.assign(h,h);const{startOffset:E,endOffset:C}=h,b=n.length,R=[{startOffset:E+b,endOffset:E+b,collapsed:!0,style:g}],v={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:R}},O=d.getDefaultStyle(),M=d.getStyleCache(),y=_n((j=f.customRanges)!=null?j:[],E+o,s.SHEET_EDITOR_UNITS.includes(e)),N=Qt(f,r?C:E+o,O,M,s.SHEET_EDITOR_UNITS.includes(e)),x=Nn((G=f.customDecorations)!=null?G:[],E+o),w=new s.TextX,H=s.JSONX.getInstance();if(!h.collapsed&&r){const k=s.BuildTextUtils.selection.delete([h],f,0,null,!1);w.push(...k),v.params.textRanges=[{startOffset:E+b,endOffset:E+b,collapsed:!0}]}else w.push({t:s.TextXActionType.RETAIN,len:E});o>0&&w.push({t:s.TextXActionType.DELETE,len:o}),w.push({t:s.TextXActionType.INSERT,body:{dataStream:n,textRuns:N?[{...N,st:0,ed:n.length}]:[],customRanges:y?[{...y,startIndex:0,endIndex:n.length-1}]:[],customDecorations:x.map(k=>({...k,startIndex:0,endIndex:n.length-1}))},len:n.length});const V=Z(m,p);v.params.actions=H.editOp(w.serialize(),V),v.params.noHistory=!a,v.params.isCompositionEnd=a;const F=c.syncExecuteCommand(v.id,v.params);return u.pushUndoRedoMutationParams(F,v.params),!!F}},ia={id:"doc.command.insert-custom-range",type:s.CommandType.COMMAND,handler:(i,t)=>{if(!t)return!1;const e=i.get(s.ICommandService),{unitId:n,rangeId:o=s.generateRandomId(),textRanges:a,properties:r,text:c,wholeEntity:l}=t,A={unitId:n,textRanges:a,body:{dataStream:c,customRanges:[{startIndex:0,endIndex:c.length-1,rangeId:o,rangeType:s.CustomRangeType.CUSTOM,properties:r,wholeEntity:l}]}};return e.syncExecuteCommand(Un.id,A)}},Nt={type:s.CommandType.COMMAND,id:"doc.command.set-zoom-ratio",handler:async(i,t)=>{var u,m,h;const e=i.get(s.ICommandService),n=i.get(s.IUndoRedoService),o=i.get(s.IUniverInstanceService);let a=(u=o.getCurrentUniverDocInstance())==null?void 0:u.getUnitId();if(!a)return!1;let r=1;if(t&&(a=(m=t.documentId)!=null?m:a,r=(h=t.zoomRatio)!=null?h:r),!o.getUniverDocInstance(a))return!1;const l={zoomRatio:r,unitId:a},A=Xc(i,l);return e.syncExecuteCommand(he.id,l)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:he.id,params:A}],redoMutations:[{id:he.id,params:l}]}),!0):!1}},ji={id:"doc.table.tab-in-table",type:s.CommandType.COMMAND,handler:async(i,t)=>{var g;const{shift:e}=t,n=i.get(D.DocSelectionManagerService),o=n.getDocRanges(),a=i.get(s.ICommandService),c=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(!c)return!1;const l=(g=o.find(p=>p.isActive))!=null?g:o[0],A=c.getUnitId(),d=re(i,A),u=d==null?void 0:d.getSkeleton(),m=u==null?void 0:u.getViewModel().getSelfOrHeaderFooterViewModel(l==null?void 0:l.segmentId);if(m==null||l==null)return!1;let h=null;if(e?h=os(m,l,ii.PREV):h=os(m,l,ii.NEXT),h){const{startOffset:p,endOffset:f}=h,S=[{startOffset:p,endOffset:f}];return n.replaceDocRanges(S),!0}return e===!1?await a.executeCommand(Fi.id,{position:jt.BELLOW}):!0}};var Od=Object.getOwnPropertyDescriptor,Rd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Od(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Xi=(i,t)=>(e,n)=>t(e,n,i);let Ki=class{constructor(i,t,e){B(this,"_docContainer");B(this,"getComponent",i=>{if(this._docContainer=i,!i.getContentRef().current)throw new Error("container is not ready")});B(this,"changeLocale",i=>{this._localeService.setLocale(i)});this._localeService=i,this._injector=t,this._configService=e}getUIConfig(){return{injector:this._injector,config:this._configService.getConfig(un),changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(i){if(this._docContainer)return i(this._docContainer)}getDocContainer(){return this._docContainer}};Ki=Rd([Xi(0,s.Inject(s.LocaleService)),Xi(1,s.Inject(s.Injector)),Xi(2,s.IConfigService)],Ki);var Md=Object.getOwnPropertyDescriptor,xd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Md(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Dd=(i,t)=>(e,n)=>t(e,n,i);let In=class extends s.RxDisposable{constructor(t){super();B(this,"_docContainerController");this._injector=t,this._docContainerController=this._injector.createInstance(Ki)}};In=xd([Dd(0,s.Inject(s.Injector))],In);var Bd=Object.getOwnPropertyDescriptor,_d=(i,t,e,n)=>{for(var o=n>1?void 0:n?Bd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},oa=(i,t)=>(e,n)=>t(e,n,i);let vn=class extends s.Disposable{constructor(i,t){super(),this._docAutoFormatService=i,this._renderManagerService=t,this._initListTabAutoFormat(),this._initSpaceAutoFormat(),this._initDefaultEnterFormat(),this._initExitListAutoFormat()}_initListTabAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:je.id,match:i=>{var o;const{selection:t,paragraphs:e,unit:n}=i;if(e.length===1&&t.startOffset===e[0].paragraphStart&&e[0].bullet){const a=(o=n.getBody())==null?void 0:o.paragraphs,r=a==null?void 0:a.filter(c=>{var l;return((l=c.bullet)==null?void 0:l.listId)===e[0].bullet.listId});return(r==null?void 0:r.findIndex(c=>c.startIndex===e[0].startIndex))!==0}else if(e.length>1&&e.some(a=>a.bullet))return!0;return!1},getMutations(i){const t=i.commandParams;return[{id:sn.id,params:{type:t!=null&&t.shift?Et.decrease:Et.increase}}]},priority:100})),this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:je.id,match:i=>{const{selection:t,unit:e}=i,{startNodePosition:n,endNodePosition:o}=t,a=this._renderManagerService.getRenderById(e.getUnitId()),r=a==null?void 0:a.with(D.DocSkeletonManagerService).getSkeleton();return r==null?!1:!!(n&&o&&vo(r,n,o)||n&&!o&&n.path.indexOf("cells")>-1)},getMutations(i){const t=i.commandParams;return[{id:ji.id,params:{shift:!!(t!=null&&t.shift)}}]},priority:99}))}_initSpaceAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:Bt.id,match:i=>{var a;const{selection:t,paragraphs:e,unit:n}=i;if(!t.collapsed||e.length!==1||!t.collapsed)return!1;const o=(a=n.getBody())==null?void 0:a.dataStream.slice(e[0].paragraphStart,t.startOffset-1);return!!(o&&(Object.keys(s.QuickListTypeMap).includes(o)||Object.keys(Oi).includes(o)))},getMutations(i){var a;const{paragraphs:t,unit:e,selection:n}=i,o=(a=e.getBody())==null?void 0:a.dataStream.slice(t[0].paragraphStart,n.startOffset-1);if(o&&Object.keys(s.QuickListTypeMap).includes(o)){const r=s.QuickListTypeMap[o];return[{id:Ei.id,params:{listType:r,paragraph:t[0]}}]}if(o&&Object.keys(Oi).includes(o)){const r=Oi[o];return[{id:_s.id,params:{value:r}}]}return[]}}))}_initExitListAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:st.id,match:i=>{const{paragraphs:t}=i;return!!(t.length===1&&t[0].bullet&&t[0].paragraphStart===t[0].paragraphEnd)},getMutations:i=>{const t=i.paragraphs[0].bullet;return t?t.nestingLevel>0?[{id:sn.id,params:{type:Et.decrease}}]:[{id:nt.id,params:{listType:i.paragraphs[0].bullet.listType}}]:[]}}))}_initDefaultEnterFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:st.id,match:()=>!0,getMutations(){return[{id:on.id}]},priority:-9999}))}};vn=_d([oa(0,s.Inject(T.DocAutoFormatService)),oa(1,_.IRenderManagerService)],vn);function Nd(i){return i.rows[0].cells[0].sections[0].columns[0].lines[0]}function Pd(i){const t=i.rows[i.rows.length-1],e=t.cells[t.cells.length-1];return _.getLastLine(e)}function Ud(i,t){const{ed:e}=i,{skeTables:n}=t;let o=null;for(const a of n.values())if(a.st===e+1){o=a;break}return o}function sa(i){const t=i==null?void 0:i.parent;let e=null,n=null;if(i==null||t==null)return{lineBeforeTable:e,lineAfterTable:n};const{st:o,ed:a}=i,r=t.type===_.DocumentSkeletonPageType.CELL?[t]:t.parent.pages;return _.lineIterator(r,c=>{c.st===a+1?n=c:c.ed===o-1&&(e=c)}),{lineBeforeTable:e,lineAfterTable:n}}function aa(i){return i.sections[0].columns[0].lines.length===0}function ra(i){var r,c;const t=i.parent,e=t==null?void 0:t.parent,n=e==null?void 0:e.tableId;if(t==null||e==null)return;const o=t.cells.indexOf(i);let a=e.rows[e.rows.indexOf(t)+1];if(a==null&&n.indexOf("#-#")){const[l,A]=n.split("#-#"),d=(c=(r=e.parent)==null?void 0:r.parent)==null?void 0:c.pages,u=`${l}#-#${Number.parseInt(A)+1}`;if(d)for(const m of d){const{skeTables:h}=m;if(h.has(u)){const g=h.get(u);if(g!=null&&g.rows.length){a=g.rows.find(p=>!p.isRepeatRow);break}}}}if(a!=null){const l=a.cells[o];return aa(l)?ra(l):l}}function ca(i){var a,r;const t=i.parent,e=t==null?void 0:t.parent;if(t==null||e==null)return;let n=e.rows[e.rows.indexOf(t)-1];const o=t.cells.indexOf(i);if((n==null||n.isRepeatRow)&&e.tableId.indexOf("#-#")){const[c,l]=e.tableId.split("#-#"),A=(r=(a=e.parent)==null?void 0:a.parent)==null?void 0:r.pages,d=`${c}#-#${Number.parseInt(l)-1}`;if(A)for(const u of A){const{skeTables:m}=u;if(m.has(d)){const h=m.get(d);if(h!=null&&h.rows.length){n=h.rows[h.rows.length-1];break}}}}if(n!=null){const c=n.cells[o];return aa(c)?ca(c):c}}function wd(i,t){const{st:e}=i,{skeTables:n}=t;let o=null;for(const a of n.values())if(a.ed===e-1){o=a;break}return o}function Ld(i){return i.sections[0].columns[0].lines[0]}function Qd(i){const t=_.getLastColumn(i);return t.lines[t.lines.length-1]}var Fd=Object.getOwnPropertyDescriptor,Hd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Fd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},En=(i,t)=>(e,n)=>t(e,n,i);let Cn=class extends s.Disposable{constructor(t,e,n,o){super();B(this,"_onInputSubscription");this._univerInstanceService=t,this._renderManagerService=e,this._textSelectionManagerService=n,this._commandService=o,this._commandExecutedListener()}dispose(){var t;super.dispose(),(t=this._onInputSubscription)==null||t.unsubscribe()}_commandExecutedListener(){const t=[Ee.id,Ce.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(!t.includes(e.id))return;const n=e.params;switch(e.id){case Ee.id:return this._handleMoveCursor(n.direction);case Ce.id:return this._handleShiftMoveSelection(n.direction);default:throw new Error("Unknown command")}}))}_handleShiftMoveSelection(t){var C,b,R;const e=this._textSelectionManagerService.getActiveTextRange(),n=this._textSelectionManagerService.getTextRanges(),o=this._univerInstanceService.getCurrentUniverDocInstance();if(o==null)return;const a=(C=this._renderManagerService.getRenderById(o.getUnitId()))==null?void 0:C.with(D.DocSkeletonManagerService).getSkeleton(),r=this._getDocObject();if(e==null||a==null||r==null)return;const{startOffset:c,endOffset:l,style:A,collapsed:d,direction:u,segmentId:m,startNodePosition:h,endNodePosition:g,segmentPage:p}=e;if(n.length>1){let v=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(const M of n)v=Math.min(v,M.startOffset),O=Math.max(O,M.endOffset);this._textSelectionManagerService.replaceTextRanges([{startOffset:t===s.Direction.LEFT||t===s.Direction.UP?O:v,endOffset:t===s.Direction.LEFT||t===s.Direction.UP?v:O,style:A}],!1);return}const f=d||u===s.RANGE_DIRECTION.FORWARD?c:l;let S=d||u===s.RANGE_DIRECTION.FORWARD?l:c;const E=(b=o.getSelfOrHeaderFooterModel(m).getBody().dataStream.length)!=null?b:Number.POSITIVE_INFINITY;if(t===s.Direction.LEFT||t===s.Direction.RIGHT){const v=a.findNodeByCharIndex(S-1,m,p),O=a.findNodeByCharIndex(S,m,p);S=t===s.Direction.RIGHT?S+O.count:S-((R=v==null?void 0:v.count)!=null?R:0),S=Math.min(E-2,Math.max(0,S)),this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:S,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),S)}else{const v=a.findNodeByCharIndex(S,m,p),O=r.document.getOffsetConfig(),M=d?h:u===s.RANGE_DIRECTION.FORWARD?g:h,y=this._getTopOrBottomPosition(a,v,M,t===s.Direction.DOWN,!0);if(y==null){const x=t===s.Direction.UP?0:E-2;if(x===S)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:x,style:A}],!1);return}const N=new ve(O,a).getRangePointData(y,y).cursorList[0];this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:N.endOffset,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),N.endOffset)}}_handleMoveCursor(t){var E,C,b,R;const e=this._textSelectionManagerService.getActiveTextRange(),n=this._textSelectionManagerService.getTextRanges(),o=this._univerInstanceService.getCurrentUniverDocInstance();if(o==null)return!1;const a=(E=this._renderManagerService.getRenderById(o.getUnitId()))==null?void 0:E.with(D.DocSkeletonManagerService).getSkeleton(),r=this._getDocObject();if(e==null||a==null||r==null||n==null)return;const{startOffset:c,endOffset:l,style:A,collapsed:d,segmentId:u,startNodePosition:m,endNodePosition:h,segmentPage:g}=e,p=o.getSelfOrHeaderFooterModel(u).getBody();if(p==null)return;const f=(C=p.dataStream.length)!=null?C:Number.POSITIVE_INFINITY,S=(b=o.getCustomRanges())!=null?b:[];if(t===s.Direction.LEFT||t===s.Direction.RIGHT){let v;if(!e.collapsed||n.length>1){let y=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY;for(const x of n)y=Math.min(y,x.startOffset),N=Math.max(N,x.endOffset);v=t===s.Direction.LEFT?y:N}else{const y=a.findNodeByCharIndex(c-1,u,g),N=a.findNodeByCharIndex(c,u,g),x=a.findNodeByCharIndex(c+1,u,g);t===s.Direction.LEFT?v=Math.max(0,c-((R=y==null?void 0:y.count)!=null?R:1)):v=Math.min(f-2,l+N.count+((x==null?void 0:x.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK?1:0))}const O=[s.DataStreamTreeTokenType.TABLE_START,s.DataStreamTreeTokenType.TABLE_END,s.DataStreamTreeTokenType.TABLE_ROW_START,s.DataStreamTreeTokenType.TABLE_ROW_END,s.DataStreamTreeTokenType.TABLE_CELL_START,s.DataStreamTreeTokenType.TABLE_CELL_END,s.DataStreamTreeTokenType.SECTION_BREAK];if(t===s.Direction.LEFT)for(;O.includes(p.dataStream[v]);)v--;else for(;O.includes(p.dataStream[v]);)v++;S.filter(y=>y.wholeEntity&&y.startIndex<v&&y.endIndex>=v).forEach(y=>{t===s.Direction.LEFT?v=Math.min(y.startIndex,v):v=Math.max(y.endIndex+1,v)}),this._textSelectionManagerService.replaceTextRanges([{startOffset:Math.max(0,v),endOffset:Math.max(0,v),style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),v)}else{const v=a.findNodeByCharIndex(c,u,g),O=a.findNodeByCharIndex(l,u,g),M=r.document.getOffsetConfig(),y=this._getTopOrBottomPosition(a,t===s.Direction.UP||d?v:O,t===s.Direction.UP||d?m:h,t===s.Direction.DOWN);if(y==null){let x;d?x=t===s.Direction.UP?0:f-2:x=t===s.Direction.UP?c:l,this._textSelectionManagerService.replaceTextRanges([{startOffset:Math.max(0,x),endOffset:Math.max(0,x),style:A}],!1);return}const N=new ve(M,a).getRangePointData(y,y).cursorList[0];this._textSelectionManagerService.replaceTextRanges([{...N,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),N.endOffset)}}_getTopOrBottomPosition(t,e,n,o,a=!1){if(e==null||n==null)return;const r=this._getGlyphLeftOffsetInLine(e),c=this._getNextOrPrevLine(e,o,a);if(c==null)return;const l=this._matchPositionByLeftOffset(t,c,r,n);if(l!=null)return{...l,isBack:!0}}_getGlyphLeftOffsetInLine(t){const e=t.parent;if(e==null)return Number.NEGATIVE_INFINITY;const n=e.left,{left:o}=t;return n+o}_matchPositionByLeftOffset(t,e,n,o){const a={distance:Number.POSITIVE_INFINITY};for(const c of e.divides){const l=c.left;for(const A of c.glyphGroup){if(A.streamType===s.DataStreamTreeTokenType.SECTION_BREAK)continue;const{left:d}=A,u=l+d,m=Math.abs(n-u);m<a.distance&&(a.glyph=A,a.distance=m)}}if(a.glyph==null)return;const{segmentPage:r}=o;return t.findPositionByGlyph(a.glyph,r)}_getNextOrPrevLine(t,e,n=!1){var p,f,S,E,C,b,R,v,O,M,y,N;const o=t.parent,a=o==null?void 0:o.parent,r=a==null?void 0:a.parent,c=r==null?void 0:r.parent,l=c==null?void 0:c.parent;if(o==null||a==null||r==null||c==null||l==null)return;const A=r.lines.indexOf(a);if(A===-1)return;let d;if(l.type===_.DocumentSkeletonPageType.CELL&&n){const x=la(l,e);if(x)return x}if(e===!0){d=r.lines[A+1];const x=Ud(a,l);if(x){const w=Nd(x);w&&(d=w)}}else{d=r.lines[A-1];const x=wd(a,l);if(x){const w=Pd(x);w&&(d=w)}}if(d!=null)return d;const u=c.columns.indexOf(r);if(u===-1)return;if(e===!0)d=(p=c.columns[u+1])==null?void 0:p.lines[0];else{const x=(S=(f=c.columns)==null?void 0:f[u-1])==null?void 0:S.lines;d=x==null?void 0:x[x.length-1]}if(d!=null)return d;const m=l.sections.indexOf(c);if(m===-1)return;if(e===!0)d=(C=(E=l.sections[m-1])==null?void 0:E.columns[0])==null?void 0:C.lines[0];else{const x=(R=(b=l.sections)==null?void 0:b[m-1])==null?void 0:R.columns,w=x==null?void 0:x[x.length-1],H=w==null?void 0:w.lines;d=H==null?void 0:H[H.length-1]}if(d!=null)return d;if(l.type===_.DocumentSkeletonPageType.CELL)return la(l,e);const h=l.parent;if(h==null)return;const g=h.pages.indexOf(l);if(g!==-1){if(e===!0)d=(M=(O=(v=h.pages[g+1])==null?void 0:v.sections[0])==null?void 0:O.columns[0])==null?void 0:M.lines[0];else{const x=(y=h.pages[g-1])==null?void 0:y.sections;if(x==null)return;const w=(N=x[x.length-1])==null?void 0:N.columns,H=w[w.length-1],V=H==null?void 0:H.lines;d=V[V.length-1]}if(d!=null)return d}}_scrollToFocusNodePosition(t,e){var o;const n=(o=this._renderManagerService.getRenderById(t))==null?void 0:o.with(T.DocBackScrollRenderController);n!=null&&n.scrollToRange({startOffset:e,endOffset:e,collapsed:!0})}_getDocObject(){return Ao(this._univerInstanceService,this._renderManagerService)}};Cn=Hd([En(0,s.IUniverInstanceService),En(1,_.IRenderManagerService),En(2,s.Inject(D.DocSelectionManagerService)),En(3,s.ICommandService)],Cn);function la(i,t){var n,o;let e=null;if(t===!0){const a=ra(i);if(a)e=Ld(a);else{const r=(n=i.parent)==null?void 0:n.parent,{lineAfterTable:c}=sa(r);c&&(e=c)}}else{const a=ca(i);if(a)e=Qd(a);else{const r=(o=i.parent)==null?void 0:o.parent,{lineBeforeTable:c}=sa(r);c&&(e=c)}}return e}const kd=({handleRowColChange:i,tableCreateParams:t})=>{const e=I.useDependency(s.LocaleService),[n,o]=U.useState(3),[a,r]=U.useState(5);function c(l,A){o(l),r(A),i(l,A)}return U.useEffect(()=>{o(t.rowCount),r(t.colCount)},[t]),P.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between",children:[P.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[P.jsx("span",{children:e.t("toolbar.table.rowCount")}),P.jsx(J.InputNumber,{className:"univer-w-28",min:1,max:20,precision:0,value:n,onChange:l=>{c(l,a)}})]}),P.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[P.jsx("span",{children:e.t("toolbar.table.colCount")}),P.jsx(J.InputNumber,{className:"univer-w-28",min:1,max:20,precision:0,value:a,onChange:l=>{c(n,l)}})]})]})};var Vd=Object.getOwnPropertyDescriptor,Wd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Vd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},da=(i,t)=>(e,n)=>t(e,n,i);let Tn=class extends s.Disposable{constructor(i,t){super(),this._commandService=i,this._componentManager=t,this._initialize()}_initialize(){this._init(),this._registerCommands(),this._initCustomComponents()}_registerCommands(){[rn].forEach(i=>this.disposeWithMe(this._commandService.registerCommand(i)))}_initCustomComponents(){const i=this._componentManager;this.disposeWithMe(i.register(Us,kd))}_init(){}};Tn=Wd([da(0,s.ICommandService),da(1,s.Inject(I.ComponentManager))],Tn);var zd=Object.getOwnPropertyDescriptor,Gd=(i,t,e,n)=>{for(var o=n>1?void 0:n?zd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},yn=(i,t)=>(e,n)=>t(e,n,i);let Yi=class extends s.Disposable{constructor(i,t,e,n,o){super(),this._context=i,this._docSkeletonManagerService=t,this._commandService=e,this._docEventManagerService=n,this._textSelectionManagerService=o,this._initPointerDownObserver(),this._initHoverCursor()}_initPointerDownObserver(){this._docEventManagerService.clickBullets$.subscribe(i=>{const t=this._textSelectionManagerService.getTextRanges();this._commandService.executeCommand(vi.id,{index:i.paragraph.startIndex,segmentId:i.segmentId,textRanges:t})})}_initHoverCursor(){this.disposeWithMe(this._docEventManagerService.hoverBullet$.subscribe(i=>{i?this._context.mainComponent.setCursor(_.CURSOR_TYPE.POINTER):this._context.mainComponent.setCursor(_.CURSOR_TYPE.TEXT)}))}_getTransformCoordForDocumentOffset(i,t,e,n){const{documentTransform:o}=i.getOffsetConfig(),a=t.transformVector2SceneCoord(_.Vector2.FromArray([e,n]));if(a)return o.clone().invert().applyPoint(a)}};Yi=Gd([yn(1,s.Inject(D.DocSkeletonManagerService)),yn(2,s.ICommandService),yn(3,s.Inject(T.DocEventManagerService)),yn(4,s.Inject(D.DocSelectionManagerService))],Yi);var jd=Object.getOwnPropertyDescriptor,Xd=(i,t,e,n)=>{for(var o=n>1?void 0:n?jd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Pt=(i,t)=>(e,n)=>t(e,n,i);let bn=class extends s.RxDisposable{constructor(i,t,e,n,o,a){super(),this._context=i,this._commandService=t,this._docClipboardService=e,this._docSelectionRenderService=n,this._contextService=o,this._editorService=a,this._init()}_init(){this._initLegacyPasteCommand()}_initLegacyPasteCommand(){var i;(i=this._docSelectionRenderService)==null||i.onPaste$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{var c,l,A;if(!$t(this._contextService))return;t.event.preventDefault();const e=t.event;let n=(c=e.clipboardData)==null?void 0:c.getData(I.HTML_CLIPBOARD_MIME_TYPE);const o=(l=e.clipboardData)==null?void 0:l.getData(I.PLAIN_TEXT_CLIPBOARD_MIME_TYPE),a=[...((A=e.clipboardData)==null?void 0:A.items)||[]].filter(d=>I.imageMimeTypeSet.has(d.type)).map(d=>d.getAsFile()).filter(d=>!!d);this._editorService.getEditor(this._context.unitId)&&(n!=null?n:"").indexOf("</table>")>-1&&(n=""),this._docClipboardService.legacyPaste({html:n,text:o,files:a})})}};bn=Xd([Pt(1,s.ICommandService),Pt(2,xe),Pt(3,s.Inject(T.DocSelectionRenderService)),Pt(4,s.IContextService),Pt(5,ce)],bn);var Kd=Object.getOwnPropertyDescriptor,Yd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Kd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Aa=(i,t)=>(e,n)=>t(e,n,i);const qd=[s.DEFAULT_EMPTY_DOCUMENT_VALUE,s.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY];let qi=class extends s.Disposable{constructor(i,t,e){super(),this._context=i,this._contextMenuService=t,this._commandService=e,qd.includes(this._context.unitId)||(this._initPointerDown(),this._initEditChange())}_initPointerDown(){var e,n;const t=((n=(e=this._context)==null?void 0:e.mainComponent)==null?void 0:n.onPointerDown$).subscribeEvent(o=>{o.button===2&&this._contextMenuService.triggerContextMenu(o,I.ContextMenuPosition.MAIN_AREA)});this.disposeWithMe(t)}_initEditChange(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{i.id===D.RichTextEditingMutation.id&&this._contextMenuService.visible&&this._contextMenuService.hideContextMenu()}))}};qi=Yd([Aa(1,I.IContextMenuService),Aa(2,s.ICommandService)],qi);var Jd=Object.getOwnPropertyDescriptor,Zd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Jd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},lt=(i,t)=>(e,n)=>t(e,n,i);let On=class extends s.Disposable{constructor(t,e,n,o,a,r,c){super();B(this,"_initialEditors",new Set);this._context=t,this._univerInstanceService=e,this._editorService=n,this._commandService=o,this._docSelectionRenderService=a,this._docSkeletonManagerService=r,this._renderManagerService=c,this._initialize()}_initialize(){this._editorService.getAllEditor().forEach(t=>{const e=t.getEditorId();e===this._context.unitId&&(this._initialEditors.has(e)||(this._initialEditors.add(e),this._resize(e)))}),this._commandExecutedListener(),this._initialBlur(),this._initialFocus()}_resize(t){if(t==null)return;const e=this._editorService.getEditor(t);if((e==null?void 0:e.cancelDefaultResizeListener)===!0)return;const n=this._univerInstanceService.getUniverDocInstance(t);if(!n)return;const o=this._docSkeletonManagerService.getSkeleton();if(e==null||e.render==null||o==null||n==null)return;o.calculate();const{marginTop:a=0,marginBottom:r=0,marginLeft:c=0,marginRight:l=0}=n.getSnapshot().documentStyle,{scene:A,mainComponent:d}=e.render;let{actualHeight:u,actualWidth:m}=o.getActualSize();u+=a+r,m+=c+l;const{width:h,height:g}=e.getBoundingClientRect(),p=Math.max(m,h),f=Math.max(u,g);A.transformByState({width:p,height:f}),d==null||d.resize(p,f)}_initialBlur(){this.disposeWithMe(this._editorService.blur$.subscribe(()=>{this._docSelectionRenderService.blur()})),this.disposeWithMe(this._docSelectionRenderService.onBlur$.subscribe(()=>{const{unitId:t}=this._context,e=this._editorService.getEditor(t),n=this._editorService.getFocusEditor();e==null||e.isSheetEditor()||n&&n.getEditorId()===t||t.includes("range_selector")||t.includes("embedding_formula_editor")||this._editorService.blur()}))}_initialFocus(){const t=["univer-formula-search","univer-formula-help","formula-help-decorator","univer-formula-help-param"];this.disposeWithMe(L.fromEvent(window,"mousedown").subscribe(n=>{const a=n.target.classList[0]||"";s.checkForSubstrings(a,t)&&n.stopPropagation()}));const e=new s.DisposableCollection;this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{if(e.dispose(),!n)return;const o=n.getUnitId(),a=this._renderManagerService.getRenderById(o),r=a==null?void 0:a.engine.getCanvas().getCanvasEle();if(r==null)return;const c=L.fromEvent(r,"mousedown").subscribe(l=>{l.stopPropagation()});e.add(c)})),this.disposeWithMe(()=>e.dispose())}_commandExecutedListener(){const t=[D.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=e.params,{unitId:o}=n;if(this._editorService.isSheetEditor(o)||o!==this._context.unitId)return;const a=this._editorService.getEditor(o);a&&!a.params.scrollBar&&this._resize(o)}}))}};On=Zd([lt(1,s.IUniverInstanceService),lt(2,ce),lt(3,s.ICommandService),lt(4,s.Inject(T.DocSelectionRenderService)),lt(5,s.Inject(D.DocSkeletonManagerService)),lt(6,_.IRenderManagerService)],On);var $d=Object.getOwnPropertyDescriptor,eA=(i,t,e,n)=>{for(var o=n>1?void 0:n?$d(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Rn=(i,t)=>(e,n)=>t(e,n,i);let Ji=class extends s.Disposable{constructor(t,e,n,o,a){super();B(this,"_previousIMEContent","");B(this,"_isCompositionStart",!0);B(this,"_onStartSubscription");B(this,"_onUpdateSubscription");B(this,"_onEndSubscription");this._context=t,this._docSelectionRenderService=e,this._docImeInputManagerService=n,this._docSkeletonManagerService=o,this._commandService=a,this._initialize()}dispose(){var t,e,n;(t=this._onStartSubscription)==null||t.unsubscribe(),(e=this._onUpdateSubscription)==null||e.unsubscribe(),(n=this._onEndSubscription)==null||n.unsubscribe()}_initialize(){this._initialOnCompositionstart(),this._initialOnCompositionUpdate(),this._initialOnCompositionend()}_initialOnCompositionstart(){this._onStartSubscription=this._docSelectionRenderService.onCompositionstart$.subscribe(t=>{if(t==null)return;this._resetIME();const{activeRange:e}=t;e!=null&&this._docImeInputManagerService.setActiveRange(s.Tools.deepClone(e))})}_initialOnCompositionUpdate(){this._onUpdateSubscription=this._docSelectionRenderService.onCompositionupdate$.subscribe(t=>{this._updateContent(t,!0)})}_initialOnCompositionend(){this._onEndSubscription=this._docSelectionRenderService.onCompositionend$.subscribe(t=>{this._updateContent(t,!1)})}async _updateContent(t,e){if(t==null)return;const n=this._context.unitId,o=this._docSkeletonManagerService.getSkeleton(),{event:a,activeRange:r}=t;if(o==null||r==null)return;const l=a.data;l===this._previousIMEContent&&e||(await this._commandService.executeCommand(Gi.id,{unitId:n,newText:l,oldTextLen:this._previousIMEContent.length,isCompositionStart:this._isCompositionStart,isCompositionEnd:!e}),e?(this._isCompositionStart&&(this._isCompositionStart=!1),this._previousIMEContent=l):this._resetIME())}_resetIME(){this._previousIMEContent="",this._isCompositionStart=!0,this._docImeInputManagerService.clearUndoRedoMutationParamsCache(),this._docImeInputManagerService.setActiveRange(null)}};Ji=eA([Rn(1,s.Inject(T.DocSelectionRenderService)),Rn(2,s.Inject(_t)),Rn(3,s.Inject(D.DocSkeletonManagerService)),Rn(4,s.ICommandService)],Ji);var tA=Object.getOwnPropertyDescriptor,nA=(i,t,e,n)=>{for(var o=n>1?void 0:n?tA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Mn=(i,t)=>(e,n)=>t(e,n,i);let Zi=class extends s.Disposable{constructor(t,e,n,o,a){super();B(this,"_onInputSubscription");this._context=t,this._docSelectionRenderService=e,this._docSkeletonManagerService=n,this._commandService=o,this._docMenuStyleService=a,this._init()}dispose(){var t;super.dispose(),(t=this._onInputSubscription)==null||t.unsubscribe()}_init(){this._initialNormalInput()}_initialNormalInput(){this._onInputSubscription=this._docSelectionRenderService.onInput$.subscribe(async t=>{var f,S;if(t==null)return;const{unitId:e}=this._context,{event:n,content:o="",activeRange:a}=t,r=n,c=this._docSkeletonManagerService.getSkeleton();if(r.data==null||c==null||a==null)return;const{segmentId:l}=a,d=this._context.unit.getSelfOrHeaderFooterModel(l).getBody(),u=this._docMenuStyleService.getDefaultStyle(),m=this._docMenuStyleService.getStyleCache(),h=_n((f=d==null?void 0:d.customRanges)!=null?f:[],a.endOffset,s.SHEET_EDITOR_UNITS.includes(e)),g=Qt(d,a.endOffset,u,m,s.SHEET_EDITOR_UNITS.includes(e)),p=Nn((S=d==null?void 0:d.customDecorations)!=null?S:[],a.endOffset);await this._commandService.executeCommand(si.id,{unitId:e,body:{dataStream:o,textRuns:g?[{...g,st:0,ed:o.length}]:[],customRanges:h?[{...h,startIndex:0,endIndex:o.length-1}]:[],customDecorations:p.map(E=>({...E,startIndex:0,endIndex:o.length-1}))},range:a,segmentId:l}),o===" "&&await this._commandService.executeCommand(Bt.id)})}};Zi=nA([Mn(1,s.Inject(T.DocSelectionRenderService)),Mn(2,s.Inject(D.DocSkeletonManagerService)),Mn(3,s.ICommandService),Mn(4,s.Inject(Te))],Zi);class $i extends s.Disposable{constructor(t){super(),this._context=t}calculatePagePosition(){var b,R;const t=Ie(this._context),n=(R=(b=this._context.unit.getSettings())==null?void 0:b.zoomRatio)!=null?R:1,{document:o,scene:a,docBackground:r}=t,c=a==null?void 0:a.getParent(),{width:l,height:A,pageMarginLeft:d,pageMarginTop:u}=o;if(c==null||l===Number.POSITIVE_INFINITY||A===Number.POSITIVE_INFINITY)return;const{width:m,height:h}=c;let g=0,p=u,f=0,S=0,E=Number.POSITIVE_INFINITY;m>(l+d*2)*n?(g=m/2-l*n/2,g/=n,f=(m-d*2)/n,E=0):(g=d,f=l+d*2,E=(f-m/n)/2),h>A?S=(h-u*2)/n:S=A+u*2,a.resize(f,S),m<=1&&(g=-1e4,p=-1e4),o.translate(g,p),r.translate(g,p);const C=a.getViewport(ae.VIEW_MAIN);return E!==Number.POSITIVE_INFINITY&&C!=null&&C.scrollToViewportPos({viewportScrollX:E}),this}}var iA=Object.getOwnPropertyDescriptor,oA=(i,t,e,n)=>{for(var o=n>1?void 0:n?iA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ua=(i,t)=>(e,n)=>t(e,n,i);let eo=class extends s.Disposable{constructor(i,t,e){super(),this._context=i,this._docPageLayoutService=t,this._textSelectionManagerService=e;const n=this._context.unitId;if(s.isInternalEditorID(n)&&n!==s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)return this;this._initResize()}_initResize(){this.disposeWithMe(s.fromEventSubject(this._context.engine.onTransformChange$).pipe(L.filter(i=>i.type===_.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize),L.throttleTime(0,L.animationFrameScheduler)).subscribe(()=>{this._docPageLayoutService.calculatePagePosition(),this._textSelectionManagerService.refreshSelection()}))}};eo=oA([ua(1,s.Inject($i)),ua(2,s.Inject(D.DocSelectionManagerService))],eo);var sA=Object.getOwnPropertyDescriptor,aA=(i,t,e,n)=>{for(var o=n>1?void 0:n?sA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},dt=(i,t)=>(e,n)=>t(e,n,i);let to=class extends s.Disposable{constructor(t,e,n,o,a,r,c){super();B(this,"_loadedMap",new WeakSet);this._context=t,this._commandService=e,this._editorService=n,this._instanceSrv=o,this._docSelectionRenderService=a,this._docSkeletonManagerService=r,this._docSelectionManagerService=c,this._initialize()}_initialize(){this._init(),this._skeletonListener(),this._commandExecutedListener(),this._refreshListener(),this._syncSelection()}_init(){const{unitId:t}=this._context,e=Ie(this._context);e==null||e.document==null||this._loadedMap.has(e.document)||(this._initialMain(t),this._loadedMap.add(e.document))}_refreshListener(){this.disposeWithMe(this._docSelectionManagerService.refreshSelection$.subscribe(t=>{if(t==null)return;const{unitId:e,docRanges:n,isEditing:o,options:a}=t;e===this._context.unitId&&(this._docSelectionRenderService.removeAllRanges(),this._docSelectionRenderService.addDocRanges(n,o,a))}))}_syncSelection(){this.disposeWithMe(this._docSelectionRenderService.textSelectionInner$.subscribe(t=>{t!=null&&this._docSelectionManagerService.__replaceTextRangesWithNoRefresh(t,{unitId:this._context.unitId,subUnitId:this._context.unitId})}))}_initialMain(t){const e=Ie(this._context),{document:n,scene:o}=e;this.disposeWithMe(n.onPointerEnter$.subscribeEvent(()=>{this._isEditorReadOnly(t)||(n.cursor=_.CURSOR_TYPE.TEXT)})),this.disposeWithMe(n.onPointerLeave$.subscribeEvent(()=>{n.cursor=_.CURSOR_TYPE.DEFAULT,o.resetCursor()})),this.disposeWithMe(n.onPointerDown$.subscribeEvent((a,r)=>{if(this._isEditorReadOnly(t))return;const c=this._instanceSrv.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);(c==null?void 0:c.getUnitId())!==t&&this._instanceSrv.setCurrentUnitForType(t);const l=this._docSkeletonManagerService.getSkeleton(),{offsetX:A,offsetY:d}=a,u=this._getTransformCoordForDocumentOffset(A,d);if(u!=null){const{pageLayoutType:m=_.PageLayoutType.VERTICAL,pageMarginLeft:h,pageMarginTop:g}=n.getOffsetConfig(),{editArea:p}=l.findEditAreaByCoord(u,m,h,g),f=this._docSkeletonManagerService.getViewModel(),S=f.getEditArea();S!==_.DocumentEditArea.BODY&&p!==_.DocumentEditArea.BODY&&p!==S&&f.setEditArea(p)}if(this._docSelectionRenderService.__onPointDown(a),this._editorService.getEditor(t)){this._setEditorFocus(t);const{offsetX:m,offsetY:h}=a;setTimeout(()=>{t===this._editorService.getFocusId()||this._docSelectionRenderService.isOnPointerEvent||(this._setEditorFocus(t),this._docSelectionRenderService.setCursorManually(m,h))},0)}a.button!==2&&r.stopPropagation()})),this.disposeWithMe(n.onDblclick$.subscribeEvent(a=>{this._isEditorReadOnly(t)||this._docSelectionRenderService.__handleDblClick(a)})),this.disposeWithMe(n.onTripleClick$.subscribeEvent(a=>{this._isEditorReadOnly(t)||this._docSelectionRenderService.__handleTripleClick(a)}))}_getTransformCoordForDocumentOffset(t,e){const n=Ie(this._context),{document:o,scene:a}=n,{documentTransform:r}=o.getOffsetConfig(),c=a.getViewports()[0];if(c==null)return;const l=c.transformVector2SceneCoord(_.Vector2.FromArray([t,e]));return r.clone().invert().applyPoint(l)}_isEditorReadOnly(t){const e=this._editorService.getEditor(t);return e?e.isReadOnly():!1}_setEditorFocus(t){this._editorService.focus(t)}_commandExecutedListener(){const t=[he.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var n;if(t.includes(e.id)){const o=e.params,{unitId:a}=o,r=(n=this._docSelectionManagerService.__getCurrentSelection())==null?void 0:n.unitId;if(a!==r)return;this._docSelectionManagerService.refreshSelection()}}))}_skeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(!t)return;const{unitId:e}=this._context;if(!s.isInternalEditorID(e)){this._docSelectionRenderService.focus();const a=this._context.unit.getSnapshot(),r=Wo(a);this._docSelectionManagerService.replaceDocRanges([{startOffset:r,endOffset:r}],{unitId:e,subUnitId:e},!1)}}))}};to=aA([dt(1,s.ICommandService),dt(2,ce),dt(3,s.IUniverInstanceService),dt(4,s.Inject(T.DocSelectionRenderService)),dt(5,s.Inject(D.DocSkeletonManagerService)),dt(6,s.Inject(D.DocSelectionManagerService))],to);var rA=Object.getOwnPropertyDescriptor,cA=(i,t,e,n)=>{for(var o=n>1?void 0:n?rA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Ke=(i,t)=>(e,n)=>t(e,n,i);let no=class extends s.Disposable{constructor(i,t,e,n,o,a,r,c){super(),this._context=i,this._contextService=t,this._docSkeletonManagerService=e,this._univerInstanceService=n,this._commandService=o,this._textSelectionManagerService=a,this._editorService=r,this._docPageLayoutService=c,this._initSkeletonListener(),this._initCommandExecutedListener(),this._initRenderRefresher(),setTimeout(()=>this.updateViewZoom(1,!0),20),s.isInternalEditorID(this._context.unitId)||this._initZoomEventListener()}_initRenderRefresher(){this._docSkeletonManagerService.currentSkeleton$.subscribe(i=>{if(i==null)return;const{unitId:t,scene:e}=this._context;this._editorService.isEditor(t)||this.disposeWithMe(e.onMouseWheel$.subscribeEvent(n=>{if(!n.ctrlKey||!this._contextService.getContextValue(s.FOCUSING_DOC))return;const o=this._univerInstanceService.getCurrentUniverDocInstance();if(!o)return;const{documentFlavor:a}=o.getSnapshot().documentStyle;if(a===s.DocumentFlavor.MODERN)return;const r=Math.abs(n.deltaX);let c=r<40?.2:r<80?.4:.2;c*=n.deltaY>0?-1:1,e.scaleX<1&&(c/=2);const l=o.zoomRatio;let A=+Number.parseFloat(`${l+c}`).toFixed(1);A=A>=4?4:A<=.1?.1:A,this._commandService.executeCommand(Nt.id,{zoomRatio:A,unitId:o.getUnitId()}),n.preventDefault()}))})}_initSkeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(i=>{if(i==null)return;const t=this._univerInstanceService.getCurrentUniverDocInstance();if(!t)return;const e=t.zoomRatio||1;this.updateViewZoom(e,!1)}))}_initCommandExecutedListener(){const i=[he.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)&&t.params.unitId===this._context.unitId){const n=this._context.unit.zoomRatio||1;this.updateViewZoom(n)}})),this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===Rt.id&&this._commandService.executeCommand(Nt.id,{zoomRatio:1,unitId:this._context.unitId})}))}updateViewZoom(i,t=!0){var n;const e=Ie(this._context);e.scene.scale(i,i),this._editorService.isEditor(this._context.unitId)||this._docPageLayoutService.calculatePagePosition(),t&&!this._editorService.isEditor(this._context.unitId)&&this._textSelectionManagerService.refreshSelection(),(n=e.scene.getTransformer())==null||n.clearSelectedObjects()}_initZoomEventListener(){const i=this._context.scene;this.disposeWithMe(i.onMouseWheel$.subscribeEvent(t=>{if(!t.ctrlKey)return;const e=Math.abs(t.deltaX);let n=e<40?.2:e<80?.4:.2;n*=t.deltaY>0?-1:1,i.scaleX<1&&(n/=2);const o=this._context.unit.zoomRatio;let a=+Number.parseFloat(`${o+n}`).toFixed(1);a=a>=4?4:a<=.1?.1:a,this._commandService.executeCommand(Nt.id,{zoomRatio:Math.round(a*10)/10,documentId:this._context.unitId}),t.preventDefault()}))}};no=cA([Ke(1,s.IContextService),Ke(2,s.Inject(D.DocSkeletonManagerService)),Ke(3,s.IUniverInstanceService),Ke(4,s.ICommandService),Ke(5,s.Inject(D.DocSelectionManagerService)),Ke(6,ce),Ke(7,s.Inject($i))],no);const lA=s.createInterceptorKey("PRINTING_COMPONENT_COLLECT"),dA=s.createInterceptorKey("PRINTING_DOM_COLLECT");class ha extends s.Disposable{constructor(){super();B(this,"_printComponentMap",new Map);B(this,"interceptor",new s.InterceptorManager({PRINTING_COMPONENT_COLLECT:lA,PRINTING_DOM_COLLECT:dA}));this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,{priority:-1,handler:e=>e})),this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_DOM_COLLECT,{priority:-1,handler:e=>e}))}registerPrintComponent(e,n){this._printComponentMap.set(e,n)}getPrintComponent(e){return this._printComponentMap.get(e)}}var AA=Object.getOwnPropertyDescriptor,uA=(i,t,e,n)=>{for(var o=n>1?void 0:n?AA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Ut=(i,t)=>(e,n)=>t(e,n,i);const ga=300;T.DocStateChangeManagerService=class extends s.RxDisposable{constructor(e,n,o,a,r){super();B(this,"_docStateChange$",new L.BehaviorSubject(null));B(this,"docStateChange$",this._docStateChange$.asObservable());B(this,"_historyStateCache",new Map);B(this,"_changeStateCache",new Map);B(this,"_historyTimer",null);B(this,"_changeStateCacheTimer",null);this._undoRedoService=e,this._commandService=n,this._univerInstanceService=o,this._docStateEmitService=a,this._renderManagerService=r,this._initialize(),this._listenDocStateChange()}getStateCache(e){var n,o;return{history:(n=this._historyStateCache.get(e))!=null?n:[],collaboration:(o=this._changeStateCache.get(e))!=null?o:[]}}setStateCache(e,n){this._historyStateCache.set(e,n.history),this._changeStateCache.set(e,n.collaboration)}_setChangeState(e){this._cacheChangeState(e,"history"),this._cacheChangeState(e,"collaboration")}_initialize(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===s.UndoCommandId||e.id===s.RedoCommandId){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(n==null)return;const o=n.getUnitId();this._pushHistory(o),this._emitChangeState(o)}}))}_listenDocStateChange(){this._docStateEmitService.docStateChangeParams$.pipe(L.takeUntil(this.dispose$)).subscribe(e=>{var l;if(e==null)return;const{isCompositionEnd:n,isSync:o,syncer:a,...r}=e,c=(l=this._renderManagerService.getRenderById(o?a:e.unitId))==null?void 0:l.with(_t);if(c!=null){if(n){const A=c.fetchComposedUndoRedoMutationParams();if(A==null)throw new Error("historyParams is null in RichTextEditingMutation");const{undoMutationParams:d,redoMutationParams:u,previousActiveRange:m}=A;r.redoState.actions=u.actions,r.undoState.actions=d.actions,r.undoState.textRanges=[m]}this._setChangeState(r)}})}_cacheChangeState(e,n="history"){const{trigger:o,unitId:a,noHistory:r,debounce:c=!1}=e;if(r||o==null||n==="history"&&(o===s.RedoCommandId||o===s.UndoCommandId))return;const l=n==="history"?this._historyStateCache:this._changeStateCache,A=n==="history"?this._pushHistory.bind(this):this._emitChangeState.bind(this);if(l.has(a)){const d=l.get(a);d==null||d.push(e)}else l.set(a,[e]);c?n==="history"?(this._historyTimer&&clearTimeout(this._historyTimer),this._historyTimer=setTimeout(()=>{A(a)},ga)):(this._changeStateCacheTimer&&clearTimeout(this._changeStateCacheTimer),this._changeStateCacheTimer=setTimeout(()=>{A(a)},ga)):A(a)}_pushHistory(e){const n=this._undoRedoService,o=this._historyStateCache.get(e);if(!Array.isArray(o)||o.length===0)return;const a=o.length,r=o[0].commandId,c=o[0],l=o[a-1],A={unitId:e,actions:o.reduce((u,m)=>s.JSONX.compose(u,m.redoState.actions),null),textRanges:l.redoState.textRanges},d={unitId:e,actions:o.reverse().reduce((u,m)=>s.JSONX.compose(u,m.undoState.actions),null),textRanges:c.undoState.textRanges};n.pushUndoRedo({unitID:e,undoMutations:[{id:r,params:d}],redoMutations:[{id:r,params:A}]}),o.length=0}_emitChangeState(e){const n=this._changeStateCache.get(e);if(!Array.isArray(n)||n.length===0)return;const o=n.length,{commandId:a,trigger:r,segmentId:c,noHistory:l,debounce:A}=n[0],d=n[0],u=n[o-1],m={unitId:e,actions:n.reduce((p,f)=>s.JSONX.compose(p,f.redoState.actions),null),textRanges:u.redoState.textRanges},h={unitId:e,actions:n.reverse().reduce((p,f)=>s.JSONX.compose(p,f.undoState.actions),null),textRanges:d.undoState.textRanges},g={commandId:a,unitId:e,trigger:r,redoState:m,undoState:h,segmentId:c,noHistory:l,debounce:A};n.length=0,this._docStateChange$.next(g)}},T.DocStateChangeManagerService=uA([Ut(0,s.Inject(s.IUndoRedoService)),Ut(1,s.ICommandService),Ut(2,s.IUniverInstanceService),Ut(3,s.Inject(D.DocStateEmitService)),Ut(4,_.IRenderManagerService)],T.DocStateChangeManagerService);var hA=Object.getOwnPropertyDescriptor,gA=(i,t,e,n)=>{for(var o=n>1?void 0:n?hA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ma=(i,t)=>(e,n)=>t(e,n,i);const pa="univer-doc-main-canvas";T.DocsRenderService=class extends s.RxDisposable{constructor(t,e){super(),this._instanceSrv=t,this._renderManagerService=e,this._init()}_init(){this._renderManagerService.createRender$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._createRenderWithId(t)),this._instanceSrv.getAllUnitsForType(s.UniverInstanceType.UNIVER_DOC).forEach(t=>this._createRenderer(t)),this._instanceSrv.getTypeOfUnitAdded$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._createRenderer(t)),this._instanceSrv.getTypeOfUnitDisposed$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._disposeRenderer(t))}_createRenderer(t){var o;const e=t.getUnitId(),n=(o=this._instanceSrv.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:o.getUnitId();this._renderManagerService.created$.subscribe(a=>{a.unitId===n&&(a.engine.getCanvas().setId(pa),a.engine.getCanvas().getContext().setId(pa))}),this._renderManagerService.has(e)||this._createRenderWithId(e)}_createRenderWithId(t){this._renderManagerService.createRender(t)}_disposeRenderer(t){const e=t.getUnitId();this._renderManagerService.removeRender(e)}},T.DocsRenderService=gA([ma(0,s.IUniverInstanceService),ma(1,_.IRenderManagerService)],T.DocsRenderService);const mA={id:st.id,preconditions:dl,binding:I.KeyCode.ENTER},pA={id:pt.id,preconditions:ee,binding:I.KeyCode.BACKSPACE},fA={id:ri.id,preconditions:ee,binding:I.KeyCode.DELETE},SA={id:Ee.id,binding:I.KeyCode.ARROW_UP,preconditions:ee,staticParameters:{direction:s.Direction.UP}},IA={id:Ee.id,binding:I.KeyCode.ARROW_DOWN,preconditions:ee,staticParameters:{direction:s.Direction.DOWN}},vA={id:Ee.id,binding:I.KeyCode.ARROW_LEFT,preconditions:ee,staticParameters:{direction:s.Direction.LEFT}},EA={id:Ee.id,binding:I.KeyCode.ARROW_RIGHT,preconditions:ee,staticParameters:{direction:s.Direction.RIGHT}},CA={id:Ce.id,binding:I.KeyCode.ARROW_UP|I.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.UP}},TA={id:Ce.id,binding:I.KeyCode.ARROW_DOWN|I.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.DOWN}},yA={id:Ce.id,binding:I.KeyCode.ARROW_LEFT|I.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.LEFT}},bA={id:Ce.id,binding:I.KeyCode.ARROW_RIGHT|I.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.RIGHT}},OA={id:zi.id,binding:I.KeyCode.A|I.MetaKeys.CTRL_COMMAND,preconditions:i=>i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&(i.getContextValue(s.FOCUSING_DOC)||i.getContextValue(s.EDITOR_ACTIVATED))};var RA=Object.defineProperty,MA=Object.getOwnPropertyDescriptor,xA=(i,t,e)=>t in i?RA(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,DA=(i,t,e,n)=>{for(var o=n>1?void 0:n?MA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},wt=(i,t)=>(e,n)=>t(e,n,i),BA=(i,t,e)=>xA(i,t+"",e);T.UniverDocsUIPlugin=class extends s.Plugin{constructor(t=Ks,e,n,o,a,r){super(),this._config=t,this._injector=e,this._renderManagerSrv=n,this._commandService=o,this._logService=a,this._configService=r;const{menu:c,...l}=s.merge({},Ks,this._config);c&&this._configService.setConfig("menu",c,{merge:!0}),this._configService.setConfig(un,l),this._initDependencies(e),this._initializeShortcut(),this._initCommand()}onReady(){this._initRenderBasics(),this._markDocAsFocused(),s.touchDependencies(this._injector,[[T.DocStateChangeManagerService],[T.DocsRenderService]])}onRendered(){this._initUI(),this._initRenderModules(),s.touchDependencies(this._injector,[[vn],[Cn],[rt],[Tn],[T.DocUIController]])}_initCommand(){[pt,ri,De,Be,_e,Ne,ye,Pe,ge,We,Ue,tt,we,be,on,si,Ze,qt,ai,Jt,cs,he,ot,it,nt,Tt,yt,bt,me,Ot,It,_i,Fi,mn,pn,qs,fn,Sn,hn,gn,at,$n,ji,je,Bt,st,sn,vt,Ct,vi,Ei,Gi,Rt,pe,oi,Ve,mo,Pn,po,Nt,zi,ki,Ee,Ce,So,Un,ia,de,_s,ci,gi,mi,Ri,Mi,xi,Di,Bi,an,Ns,Ps,Ti,yi,bi,Si,ws,Ui].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))}),[St,en,tn].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_initializeShortcut(){[SA,IA,EA,vA,CA,TA,yA,bA,OA,pA,fA,mA,ul].forEach(t=>{this._injector.get(I.IShortcutService).registerShortcut(t)})}_initDependencies(t){s.mergeOverrideWithDependencies([[ha],[bn],[On],[T.DocUIController],[vn],[Tn],[Cn],[In],[rt],[ce,{useClass:T.EditorService}],[xe,{useClass:ui}],[T.DocCanvasPopManagerService],[T.DocsRenderService],[T.DocStateChangeManagerService],[T.DocAutoFormatService],[Te]],this._config.override).forEach(n=>t.add(n))}_markDocAsFocused(){const t=this._injector.get(s.IUniverInstanceService),e=this._injector.get(ce);try{const n=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!n)return;const o=n.getUnitId();e.isEditor(o)||t.focusUnit(n.getUnitId())}catch(n){this._logService.warn(n)}}_initUI(){this._injector.get(In)}_initRenderBasics(){[[D.DocSkeletonManagerService],[T.DocSelectionRenderService],[D.DocInterceptorService],[$i],[_t],[T.DocRenderController],[no]].forEach(t=>{this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_DOC,t)})}_initRenderModules(){[[T.DocEventManagerService],[dn],[An],[T.DocBackScrollRenderController],[to],[Yn],[eo],[qi],[Yi],[bn],[Zi],[Ji],[On]].forEach(t=>{this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_DOC,t)})}},BA(T.UniverDocsUIPlugin,"pluginName",ro),T.UniverDocsUIPlugin=DA([s.DependentOn(_.UniverRenderEnginePlugin),wt(1,s.Inject(s.Injector)),wt(2,_.IRenderManagerService),wt(3,s.ICommandService),wt(4,s.ILogService),wt(5,s.IConfigService)],T.UniverDocsUIPlugin),T.AfterSpaceCommand=Bt,T.AlignCenterCommand=yt,T.AlignJustifyCommand=Ot,T.AlignLeftCommand=Tt,T.AlignOperationCommand=me,T.AlignRightCommand=bt,T.BreakLineCommand=on,T.BulletListCommand=it,T.ChangeListNestingLevelCommand=sn,T.ChangeListNestingLevelType=Et,T.ChangeListTypeCommand=vt,T.CheckListCommand=Ct,T.CoverContentCommand=po,T.CreateDocTableCommand=_i,T.CutContentCommand=Ve,T.DOCS_COMPONENT_BACKGROUND_LAYER_INDEX=co,T.DOCS_COMPONENT_DEFAULT_Z_INDEX=Bn,T.DOCS_COMPONENT_HEADER_LAYER_INDEX=lo,T.DOCS_COMPONENT_MAIN_LAYER_INDEX=Lt,T.DOCS_VIEW_KEY=Ae,T.DOC_UI_PLUGIN_NAME=ro,T.DOC_VERTICAL_PADDING=wi,T.DefaultDocContainerConfig=ao,T.DefaultToolbarConfig=so,T.DeleteCommand=Ze,T.DeleteCustomBlockCommand=qt,T.DeleteLeftCommand=pt,T.DeleteRightCommand=ri,T.DocCopyCommand=St,T.DocCreateTableOperation=rn,T.DocCutCommand=en,T.DocIMEInputManagerService=_t,T.DocPasteCommand=tn,T.DocPrintInterceptorService=ha,T.DocSelectAllCommand=zi,T.DocTableDeleteColumnsCommand=gn,T.DocTableDeleteRowsCommand=hn,T.DocTableDeleteTableCommand=at,T.DocTableInsertColumnCommand=qs,T.DocTableInsertColumnLeftCommand=fn,T.DocTableInsertColumnRightCommand=Sn,T.DocTableInsertRowAboveCommand=mn,T.DocTableInsertRowBellowCommand=pn,T.DocTableInsertRowCommand=Fi,T.DocTableTabCommand=ji,T.DocsUIMenuSchema=ta,T.Editor=bo,T.EditorInsertTextCommandId=rs,T.EnterCommand=st,T.HorizontalLineCommand=It,T.IDocClipboardService=xe,T.IEditorService=ce,T.IMEInputCommand=Gi,T.InnerPasteCommand=oi,T.InsertCommand=si,T.InsertCustomRangeCommand=ia,T.ListOperationCommand=nt,T.MergeTwoParagraphCommand=Jt,T.MoveCursorOperation=Ee,T.MoveSelectionOperation=Ce,T.NORMAL_TEXT_SELECTION_PLUGIN_NAME=Ea,T.NodePositionConvertToCursor=ve,T.NodePositionConvertToRectRange=Vn,T.OrderListCommand=ot,T.PastePluginLark=us,T.PastePluginUniver=gs,T.PastePluginWord=ms,T.QuickListCommand=Ei,T.RectRange=zn,T.ReplaceContentCommand=mo,T.ReplaceSelectionCommand=Un,T.ReplaceSnapshotCommand=Pn,T.ReplaceTextRunsCommand=So,T.ResetInlineFormatTextBackgroundColorCommand=tt,T.RichTextEditor=Xa,T.SetDocZoomRatioCommand=Nt,T.SetDocZoomRatioOperation=he,T.SetInlineFormatBoldCommand=De,T.SetInlineFormatCommand=be,T.SetInlineFormatFontFamilyCommand=We,T.SetInlineFormatFontSizeCommand=ge,T.SetInlineFormatItalicCommand=Be,T.SetInlineFormatStrikethroughCommand=Ne,T.SetInlineFormatSubscriptCommand=ye,T.SetInlineFormatSuperscriptCommand=Pe,T.SetInlineFormatTextBackgroundColorCommand=we,T.SetInlineFormatTextColorCommand=Ue,T.SetInlineFormatUnderlineCommand=_e,T.SetParagraphNamedStyleCommand=de,T.SwitchDocModeCommand=Rt,T.TEXT_RANGE_LAYER_INDEX=Ht,T.TabCommand=je,T.TextRange=He,T.ToggleCheckListCommand=vi,T.UpdateCommand=ai,T.VIEWPORT_KEY=ae,T.addCustomDecorationBySelectionFactory=Ta,T.addCustomDecorationFactory=uo,T.calcDocRangePositions=ln,T.convertBodyToHtml=fs,T.convertPositionsToRectRanges=Vt,T.deleteCustomDecorationFactory=ya,T.docDrawingPositionToTransform=Oa,T.genTableSource=ni,T.generateParagraphs=fi,T.getAnchorBounding=ut,T.getCanvasOffsetByEngine=To,T.getCommandSkeleton=re,T.getCursorWhenDelete=Zt,T.getCustomBlockIdsInSelections=ss,T.getCutActionsFromDocRanges=as,T.getDocObject=Ao,T.getDocObjectById=Ca,T.getEmptyTableCell=Xt,T.getEmptyTableRow=Kt,T.getLineBounding=kt,T.getOneTextSelectionRange=Qn,T.getRichTextEditPath=Z,T.getTableColumn=Yt,T.hasParagraphInTable=ba,T.isInSameTableCell=Hn,T.isValidRectRange=Io,T.neoGetDocObject=Ie,T.transformToDocDrawingPosition=Ra,T.useKeyboardEvent=ho,T.useResize=go,T.whenDocAndEditorFocused=ee,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
243
+ `,{"univer-bg-blend-color-dodge/90":n===I.value}),onClick:()=>o(I.value),children:I.icon})},I.value))}),P.jsx("div",{className:"univer-t-4 univer-text-smver-font-medium",children:i.t("doc.paragraphSetting.indentation")}),P.jsxs("div",{children:[P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.left"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:a,onChange:I=>r(I!=null?I:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.right"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:c,onChange:I=>l(I!=null?I:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.firstLine"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:A,onChange:I=>d(I!=null?I:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.hanging"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:u,onChange:I=>m(I!=null?I:0)})]})]}),P.jsx("div",{className:"univer-t-4 univer-text-smver-font-medium",children:i.t("doc.paragraphSetting.spacing")}),P.jsxs("div",{children:[P.jsxs("div",{className:"univer-flex univer-justify-betweenuniver-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.before"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:h,onChange:I=>g(I!=null?I:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between univer-item-center",children:[P.jsxs("div",{className:"univer-mt-3 univer-text-xs",children:[i.t("doc.paragraphSetting.after"),"(px)"]}),P.jsx(Xe,{className:"univer-mt-4",value:p,onChange:I=>f(I!=null?I:0)})]}),P.jsxs("div",{className:"univer-flex univer-justify-between item-center",children:[P.jsx("div",{className:"univer-mt-3 univer-text-xs",children:i.t("doc.paragraphSetting.lineSpace")}),P.jsxs("div",{className:"univer-mt-4 univer-flex univer-flex-col univer-gap-1.5",style:{width:162},children:[P.jsx(J.Select,{value:`${C}`,options:[{label:i.t("doc.paragraphSetting.multiSpace"),value:`${s.SpacingRule.AUTO}`},{label:i.t("doc.paragraphSetting.fixedValue"),value:`${s.SpacingRule.AT_LEAST}`}],onChange:I=>b(Number(I))}),P.jsx(Xe,{...R,value:S,onChange:I=>E(I!=null?I:0)})]})]})]})]})}const ed=(i,t)=>t.length===i.length&&i.some(e=>t.some(n=>n.startOffset===e.startOffset&&n.endOffset===e.endOffset));function td(){const i=v.useDependency(s.ICommandService),t=v.useDependency(s.LocaleService),e=v.useObservable(t.currentLocale$),[n,o]=U.useState(""),a=U.useMemo(()=>s.debounce(()=>o(s.generateRandomId(4)),300),[]),r=U.useRef([]);return U.useEffect(()=>{const c=i.onCommandExecuted(l=>{if(D.SetTextSelectionsOperation.id===l.id){const A=l.params.ranges;ed(A,r.current)||o(s.generateRandomId(4)),r.current=A}D.RichTextEditingMutation.id===l.id&&l.params.trigger!==pe.id&&a()});return()=>c.dispose()},[a]),U.useEffect(()=>{o(s.generateRandomId(4))},[e]),U.useEffect(()=>()=>a.cancel(),[a]),P.jsx($l,{},n)}var nd=Object.getOwnPropertyDescriptor,id=(i,t,e,n)=>{for(var o=n>1?void 0:n?nd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Hi=(i,t)=>(e,n)=>t(e,n,i);const Js="doc_ui_paragraph-setting-panel";let rt=class extends s.Disposable{constructor(t,e,n){super();B(this,"_id");this._commandService=t,this._componentManager=e,this._sidebarService=n,this._init()}_init(){this.disposeWithMe(this._componentManager.register(Js,td))}openPanel(){const t={header:{title:"doc.slider.paragraphSetting"},id:this._id,children:{label:Js},width:300};this._sidebarService.open(t)}closePanel(){this._sidebarService.close(this._id)}};rt=id([Hi(0,s.ICommandService),Hi(1,s.Inject(v.ComponentManager)),Hi(2,s.Inject(v.ISidebarService))],rt);const ki={id:"sidebar.operation.doc-paragraph-setting-panel",type:s.CommandType.OPERATION,handler:i=>(i.get(rt).openPanel(),!0)},Vi=i=>{const t=i.get(D.DocSelectionManagerService);return new L.Observable(e=>{const n=t.textSelection$.subscribe(()=>{t.getDocRanges().some(r=>r.collapsed===!1||r.rangeType===s.DOC_RANGE_TYPE.RECT)?e.next(!1):e.next(!0)});return()=>n.unsubscribe()})};function od(i){if(i.length<2)return!0;const t=i.map(e=>e.tableId);return t.every(e=>e===t[0])}function Zs(i,t,e){var a;const n=t.getRectRanges(),o=t.getActiveTextRange();if(n&&n.length&&od(n)&&o==null){i.next(!1);return}if(o&&(n==null||n.length===0)){const{segmentId:r,startOffset:c,endOffset:l}=o,A=e.getCurrentUniverDocInstance(),d=(a=A==null?void 0:A.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:a.tables;if(d&&d.length&&d.some(u=>{const{startIndex:m,endIndex:h}=u;return c>m&&c<h||l>m&&l<h})){i.next(!1);return}}i.next(!0)}const Oe=i=>{const t=i.get(D.DocSelectionManagerService),e=i.get(s.IUniverInstanceService);return new L.Observable(n=>{const o=t.textSelection$.subscribe(()=>{Zs(n,t,e)});return Zs(n,t,e),()=>o.unsubscribe()})},sd=i=>({id:St.name,commandId:St.id,type:v.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.copy",disabled$:Vi(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),ad=i=>({id:ki.id,type:v.MenuItemType.BUTTON,icon:"MenuSingle24",title:"doc.menu.paragraphSetting",hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),rd=i=>({id:en.id,type:v.MenuItemType.BUTTON,icon:"Copy",title:"rightClick.cut",disabled$:Vi(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),cd=i=>({id:tn.id,type:v.MenuItemType.BUTTON,icon:"PasteSpecial",title:"rightClick.paste",hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),ld=i=>({id:pt.id,type:v.MenuItemType.BUTTON,icon:"PasteSpecial",title:"rightClick.delete",disabled$:Vi(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}),$s="doc.menu.table-insert";function dd(i){return{id:$s,type:v.MenuItemType.SUBITEMS,title:"table.insert",icon:"Insert",hidden$:L.combineLatest(v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),Oe(i),(t,e)=>t||e)}}function Ad(i){return{id:mn.id,type:v.MenuItemType.BUTTON,title:"table.insertRowAbove",icon:"InsertRowAbove",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function ud(i){return{id:pn.id,type:v.MenuItemType.BUTTON,title:"table.insertRowBelow",icon:"InsertRowBelow",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function hd(i){return{id:fn.id,type:v.MenuItemType.BUTTON,title:"table.insertColumnLeft",icon:"LeftInsertColumn",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function gd(i){return{id:Sn.id,type:v.MenuItemType.BUTTON,title:"table.insertColumnRight",icon:"RightInsertColumn",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const ea="doc.menu.table-delete";function md(i){return{id:ea,type:v.MenuItemType.SUBITEMS,title:"table.delete",icon:"Reduce",hidden$:L.combineLatest(v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC),Oe(i),(t,e)=>t||e)}}function pd(i){return{id:hn.id,type:v.MenuItemType.BUTTON,title:"table.deleteRows",icon:"DeleteRow",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function fd(i){return{id:gn.id,type:v.MenuItemType.BUTTON,title:"table.deleteColumns",icon:"DeleteColumn",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}function Sd(i){return{id:at.id,type:v.MenuItemType.BUTTON,title:"table.deleteTable",icon:"GridSingle",disabled$:Oe(i),hidden$:v.getMenuHiddenObservable(i,s.UniverInstanceType.UNIVER_DOC)}}const ta={[v.RibbonStartGroup.FORMAT]:{[De.id]:{order:0,menuItemFactory:lc},[Be.id]:{order:1,menuItemFactory:dc},[_e.id]:{order:2,menuItemFactory:Ac},[Ne.id]:{order:3,menuItemFactory:uc},[ye.id]:{order:4,menuItemFactory:hc},[Pe.id]:{order:5,menuItemFactory:gc},[de.id]:{order:5.5,menuItemFactory:fc},[ge.id]:{order:6,menuItemFactory:pc},[We.id]:{order:7,menuItemFactory:mc},[Ue.id]:{order:8,menuItemFactory:Sc},[we.id]:{order:9,menuItemFactory:Dc,[tt.id]:{order:0,menuItemFactory:xc}}},[v.RibbonStartGroup.LAYOUT]:{[Ls]:{order:1,menuItemFactory:Ec,[rn.id]:{order:0,menuItemFactory:Cc}},[Tt.id]:{order:2,menuItemFactory:Tc},[yt.id]:{order:3,menuItemFactory:yc},[bt.id]:{order:4,menuItemFactory:bc},[Ot.id]:{order:5,menuItemFactory:Oc},[vt.id]:{order:6,menuItemFactory:Rc},[ot.id]:{order:7,menuItemFactory:Qs},[it.id]:{order:8,menuItemFactory:Fs},[Ct.id]:{order:9,menuItemFactory:Hs},[Zn.id]:{order:10,menuItemFactory:vc},[Rt.id]:{order:11,menuItemFactory:Mc},[Ui.id]:{order:12,menuItemFactory:Bc}},[v.ContextMenuPosition.MAIN_AREA]:{[v.ContextMenuGroup.FORMAT]:{[St.name]:{order:0,menuItemFactory:sd},[en.id]:{order:1,menuItemFactory:rd},[tn.id]:{order:2,menuItemFactory:cd},[pt.id]:{order:3,menuItemFactory:ld}},[v.ContextMenuGroup.LAYOUT]:{[ki.id]:{order:0,menuItemFactory:ad},[$s]:{order:1,menuItemFactory:dd,[mn.id]:{order:1,menuItemFactory:Ad},[pn.id]:{order:2,menuItemFactory:ud},[fn.id]:{order:3,menuItemFactory:hd},[Sn.id]:{order:4,menuItemFactory:gd}},[ea]:{order:2,menuItemFactory:md,[hn.id]:{order:1,menuItemFactory:pd},[gn.id]:{order:2,menuItemFactory:fd},[at.id]:{order:3,menuItemFactory:Sd}}}},[v.ContextMenuPosition.PARAGRAPH]:{[v.ContextMenuGroup.QUICK]:{[Ri.id]:{order:0,menuItemFactory:Nc},[Mi.id]:{order:1,menuItemFactory:Pc},[xi.id]:{order:2,menuItemFactory:Uc},[Di.id]:{order:3,menuItemFactory:wc},[Bi.id]:{order:4,menuItemFactory:Lc},[an.id]:{order:5,menuItemFactory:Qc},[ot.id]:{order:6,menuItemFactory:Qs},[it.id]:{order:7,menuItemFactory:Fs},[Ct.id]:{order:8,menuItemFactory:Hs}},[v.ContextMenuGroup.FORMAT]:{[gi.id]:{order:0,menuItemFactory:Fc},[mi.id]:{order:1,menuItemFactory:Hc},[ci.id]:{order:2,menuItemFactory:kc}},[v.ContextMenuGroup.LAYOUT]:{[Vs]:{menuItemFactory:jc,[Ti.id]:{order:0,menuItemFactory:Vc},[yi.id]:{order:1,menuItemFactory:Wc},[bi.id]:{order:2,menuItemFactory:zc},[Si.id]:{order:3,menuItemFactory:Gc}}}}};var vd=Object.getOwnPropertyDescriptor,Id=(i,t,e,n)=>{for(var o=n>1?void 0:n?vd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Re=(i,t)=>(e,n)=>t(e,n,i);T.DocUIController=class extends s.Disposable{constructor(t,e,n,o,a,r,c,l,A){super(),this._injector=t,this._componentManager=e,this._commandService=n,this._layoutService=o,this._menuManagerService=a,this._uiPartsService=r,this._univerInstanceService=c,this._shortcutService=l,this._configService=A,this._init()}_initCustomComponents(){const t=this._componentManager;this.disposeWithMe(t.register(ei,J.ColorPicker)),this.disposeWithMe(t.register(qo,v.FontFamily)),this.disposeWithMe(t.register(Jo,v.FontFamilyItem)),this.disposeWithMe(t.register(Zo,v.FontSize)),this.disposeWithMe(t.register(ts,Or)),this.disposeWithMe(t.register(es,yr)),this.disposeWithMe(t.register("TodoList",Vo)),this.disposeWithMe(t.register("doc.paragraph.menu",ll)),this.disposeWithMe(t.register("CutSingle",xo)),this.disposeWithMe(t.register("DeleteSingle",Do)),this.disposeWithMe(t.register(Pi,sc)),this.disposeWithMe(t.register("DocumentSettingSingle",Bo))}_initUiParts(){this.disposeWithMe(this._uiPartsService.registerComponent(v.BuiltInUIPart.FOOTER,()=>v.connectInjector(xl,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(v.BuiltInUIPart.CONTENT,()=>v.connectInjector(Ll,this._injector)))}_initMenus(){this._menuManagerService.mergeMenu(ta)}_initShortCut(){[hl,gl,ml,pl,fl,Sl,El,Cl,Il,vl,Tl,yl,Al].forEach(t=>{this.disposeWithMe(this._shortcutService.registerShortcut(t))})}_init(){this._initCustomComponents(),this._initMenus(),this._initFocusHandler(),this._initCommands(),this._initUiParts(),this._initShortCut()}_initCommands(){[Yo,Zn,qn].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t)))}_initFocusHandler(){this.disposeWithMe(this._layoutService.registerFocusHandler(s.UniverInstanceType.UNIVER_DOC,t=>{this._injector.get(_.IRenderManagerService).getRenderById(t).with(T.DocSelectionRenderService).focus()}))}},T.DocUIController=Id([Re(0,s.Inject(s.Injector)),Re(1,s.Inject(v.ComponentManager)),Re(2,s.ICommandService),Re(3,v.ILayoutService),Re(4,v.IMenuManagerService),Re(5,v.IUIPartsService),Re(6,s.IUniverInstanceService),Re(7,v.IShortcutService),Re(8,s.IConfigService)],T.DocUIController);var Ed=Object.getOwnPropertyDescriptor,Cd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Ed(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Wi=(i,t)=>(e,n)=>t(e,n,i);const na=1.5;T.DocBackScrollRenderController=class extends s.RxDisposable{constructor(t,e,n,o){super(),this._context=t,this._textSelectionManagerService=e,this._editorService=n,this._docSkeletonManagerService=o,this._init()}_init(){this._textSelectionManagerService.textSelection$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{if(t==null)return;const{isEditing:e,unitId:n}=t;n!==this._context.unitId||!e||this._context.unitId!==s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&this._scrollToSelection()})}scrollToRange(t){const e=this._docSkeletonManagerService.getSkeleton();if(!e)return;const{startOffset:n}=t,o=e.findNodePositionByCharIndex(n);o&&this.scrollToNode(o)}scrollToNode(t){var N;const{unitId:e,scene:n,mainComponent:o}=this._context,a=this._docSkeletonManagerService.getSkeleton();if(o==null||a==null)return;const r=o.getOffsetConfig(),{docsLeft:c,docsTop:l}=r,A=new Ie(r,a),{contentBoxPointGroup:d}=A.getRangePointData(t,t),{left:u,top:m,height:h}=ut(d),g=u+c,p=m+l,f=n.getViewport(ae.VIEW_MAIN),S=this._editorService.getEditor(e);if(f==null)return;const{left:E,top:C,right:b,bottom:R}=f.getBounding().viewBound;let I=0,O=0;const M=S?(N=S.params.backScrollOffset)!=null?N:0:100;p<C?I=p-C-M:p>R-h&&(I=p-R+h+M),g<E?O=g-E:g>b-na&&(O=g-b+na);const y=f.transViewportScroll2ScrollValue(O,I);f.scrollByBarDeltaValue(y)}_scrollToSelection(){const t=this._textSelectionManagerService.getActiveTextRange();if(t==null)return;const{collapsed:e,startNodePosition:n}=t;e&&this.scrollToNode(n)}},T.DocBackScrollRenderController=Cd([Wi(1,s.Inject(D.DocSelectionManagerService)),Wi(2,ce),Wi(3,s.Inject(D.DocSkeletonManagerService))],T.DocBackScrollRenderController);var Td=Object.getOwnPropertyDescriptor,yd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Td(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ct=(i,t)=>(e,n)=>t(e,n,i);T.DocRenderController=class extends s.RxDisposable{constructor(t,e,n,o,a,r,c){super(),this._context=t,this._commandService=e,this._docSelectionRenderService=n,this._docSkeletonManagerService=o,this._editorService=a,this._renderManagerService=r,this._univerInstanceService=c,this._addNewRender(),this._initRenderRefresh(),this._initCommandListener()}reRender(t){var r,c;const e=(r=this._renderManagerService.getRenderById(t))==null?void 0:r.with(D.DocSkeletonManagerService),n=e==null?void 0:e.getSkeleton();if(!n||!!n.getViewModel().getDataModel().getSnapshot().disabled)return;n.calculate();const a=this._editorService.getEditor(t);if(this._editorService.isEditor(t)&&!(a!=null&&a.params.scrollBar)){(c=this._context.mainComponent)==null||c.makeDirty();return}this._recalculateSizeBySkeleton(n)}_addNewRender(){const{scene:t,engine:e}=this._context,n=new _.Viewport(ae.VIEW_MAIN,t,{left:0,top:0,bottom:0,right:0,isWheelPreventDefaultX:!0});t.attachControl(),t.onMouseWheel$.subscribeEvent((a,r)=>{const c=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if((c==null?void 0:c.getUnitId())!==this._context.unitId)return;const l=a;if(l.ctrlKey){const A=Math.abs(l.deltaX);let d=A<40?.2:A<80?.4:.2;d*=l.deltaY>0?-1:1,t.scaleX<1&&(d/=2),t.scaleX+d>4?t.scale(4,4):t.scaleX+d<.1?t.scale(.1,.1):l.preventDefault()}else n.onMouseWheel(l,r)}),new _.ScrollBar(n),t.addLayer(new _.Layer(t,[],Lt),new _.Layer(t,[],lo)),this._addComponent();const o=()=>t.render();this.disposeWithMe(this._context.activated$.subscribe(a=>{a?e.runRenderLoop(o):e.stopRenderLoop(o)})),this._docSelectionRenderService.__attachScrollEvent()}_addComponent(){const{scene:t,unit:e,components:n}=this._context,r={pageMarginLeft:20,pageMarginTop:20},c=new _.Documents(Ae.MAIN,void 0,r);c.zIndex=Bn;const l=new _.DocBackground(Ae.BACKGROUND,void 0,r);l.zIndex=Bn,this._context.mainComponent=c,n.set(Ae.MAIN,c),n.set(Ae.BACKGROUND,l),t.addObjects([c],Lt),t.addObjects([l],co),this._editorService.getEditor(e.getUnitId())==null&&t.enableLayerCache(Lt)}_initRenderRefresh(){this._docSkeletonManagerService.currentSkeletonBefore$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{this._create(t)})}_create(t){var l;if(!t)return;const{mainComponent:e,components:n}=this._context,o=e,a=n.get(Ae.BACKGROUND);o.changeSkeleton(t),a.changeSkeleton(t);const{unitId:r}=this._context,c=this._editorService.getEditor(r);if(this._editorService.isEditor(r)&&!(c!=null&&c.params.scrollBar)){(l=this._context.mainComponent)==null||l.makeDirty();return}this._recalculateSizeBySkeleton(t)}_initCommandListener(){const t=[D.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=e.params,{unitId:o}=n;this.reRender(o)}}))}_recalculateSizeBySkeleton(t){var g;const{mainComponent:e,scene:n,unitId:o,components:a}=this._context,r=e,c=a.get(Ae.BACKGROUND),l=(g=t.getSkeletonData())==null?void 0:g.pages;if(l==null)return;let A=0,d=0;const m=this._context.unit.getSnapshot().documentStyle.documentFlavor;for(let p=0,f=l.length;p<f;p++){const S=l[p];let{pageWidth:E,pageHeight:C}=S;if(m===s.DocumentFlavor.MODERN){const b=bd(S);E=b.pageWidth,C=b.pageHeight}r.pageLayoutType===_.PageLayoutType.VERTICAL?(d+=C,d+=r.pageMarginTop,p===f-1&&(d+=r.pageMarginTop),A=Math.max(A,E)):r.pageLayoutType===_.PageLayoutType.HORIZONTAL&&(A+=E,p!==f-1&&(A+=r.pageMarginLeft),d=Math.max(d,C))}r.resize(A,d),c.resize(A,d);const h=this._editorService.getEditor(o);(!this._editorService.isEditor(o)||h!=null&&h.params.scrollBar)&&n.resize(A,d)}},T.DocRenderController=yd([ct(1,s.ICommandService),ct(2,s.Inject(T.DocSelectionRenderService)),ct(3,s.Inject(D.DocSkeletonManagerService)),ct(4,ce),ct(5,_.IRenderManagerService),ct(6,s.IUniverInstanceService)],T.DocRenderController);function bd(i){let{pageWidth:t,pageHeight:e}=i;const{marginLeft:n,marginRight:o,marginTop:a,marginBottom:r,skeDrawings:c,skeTables:l}=i;t===Number.POSITIVE_INFINITY&&(t=i.width+n+o),e===Number.POSITIVE_INFINITY&&(e=i.height+a+r);for(const A of c.values())t=Math.max(t,A.aLeft+A.width+n+o),e=Math.max(e,A.aTop+A.height+a+r);for(const A of l.values())t=Math.max(t,A.left+A.width+n+o),e=Math.max(e,A.top+A.height+a+r);return{pageWidth:t,pageHeight:e}}const zi={id:"doc.command.select-all",type:s.CommandType.COMMAND,handler:async i=>{var h;const t=i.get(s.IUniverInstanceService),e=i.get(D.DocSelectionManagerService),n=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC),o=e.getDocRanges(),a=(h=o.find(g=>g.isActive))!=null?h:o[0];if(n==null||a==null)return!1;const{segmentId:r}=a,c=n.getUnitId(),l=n.getSelfOrHeaderFooterModel(r).getSnapshot().body;if(l==null)return!1;const{tables:A=[],dataStream:d}=l;if(d===`\r
244
+ `)return!0;const u=[];let m=0;for(const g of A){const{startIndex:p,endIndex:f}=g;m!==p&&u.push({startOffset:m,endOffset:p-1,rangeType:s.DOC_RANGE_TYPE.TEXT}),u.push({startOffset:p+3,endOffset:f-5,rangeType:s.DOC_RANGE_TYPE.RECT}),m=f}return m!==l.dataStream.length-2&&u.push({startOffset:m,endOffset:l.dataStream.length-2,rangeType:s.DOC_RANGE_TYPE.TEXT}),e.replaceDocRanges(u,{unitId:c,subUnitId:c},!1),!0}};class _t extends s.RxDisposable{constructor(e){super();B(this,"_previousActiveRange",null);B(this,"_undoMutationParamsCache",[]);B(this,"_redoMutationParamsCache",[]);this._context=e}clearUndoRedoMutationParamsCache(){this._undoMutationParamsCache=[],this._redoMutationParamsCache=[]}getUndoRedoMutationParamsCache(){return{undoCache:this._undoMutationParamsCache,redoCache:this._redoMutationParamsCache}}setUndoRedoMutationParamsCache({undoCache:e=[],redoCache:n=[]}){this._undoMutationParamsCache=e,this._redoMutationParamsCache=n}getActiveRange(){return this._previousActiveRange}setActiveRange(e){this._previousActiveRange=e}pushUndoRedoMutationParams(e,n){this._undoMutationParamsCache.push(e),this._redoMutationParamsCache.push(n)}fetchComposedUndoRedoMutationParams(){if(this._undoMutationParamsCache.length===0||this._previousActiveRange==null||this._redoMutationParamsCache.length===0)return null;const{unitId:e}=this._undoMutationParamsCache[0],n={unitId:e,actions:this._undoMutationParamsCache.reverse().reduce((a,r)=>s.JSONX.compose(a,r.actions),null),textRanges:[]};return{redoMutationParams:{unitId:e,actions:this._redoMutationParamsCache.reduce((a,r)=>s.JSONX.compose(a,r.actions),null),textRanges:[]},undoMutationParams:n,previousActiveRange:this._previousActiveRange}}dispose(){this._undoMutationParamsCache=[],this._redoMutationParamsCache=[],this._previousActiveRange=null}}const Gi={id:"doc.command.ime-input",type:s.CommandType.COMMAND,handler:async(i,t)=>{var Q,j,G;const{unitId:e,newText:n,oldTextLen:o,isCompositionEnd:a,isCompositionStart:r}=t,c=i.get(s.ICommandService),l=i.get(_.IRenderManagerService),A=i.get(s.IUniverInstanceService),d=i.get(Te),u=(Q=l.getRenderById(e))==null?void 0:Q.with(_t),m=A.getUnit(e,s.UniverInstanceType.UNIVER_DOC);if(m==null||u==null)return!1;const h=u.getActiveRange();if(h==null)return!1;const{style:g,segmentId:p}=h,f=m.getSelfOrHeaderFooterModel(p).getBody();if(f==null)return!1;Object.assign(h,h);const{startOffset:E,endOffset:C}=h,b=n.length,R=[{startOffset:E+b,endOffset:E+b,collapsed:!0,style:g}],I={id:D.RichTextEditingMutation.id,params:{unitId:e,actions:[],textRanges:R}},O=d.getDefaultStyle(),M=d.getStyleCache(),y=_n((j=f.customRanges)!=null?j:[],E+o,s.SHEET_EDITOR_UNITS.includes(e)),N=Qt(f,r?C:E+o,O,M,s.SHEET_EDITOR_UNITS.includes(e)),x=Nn((G=f.customDecorations)!=null?G:[],E+o),w=new s.TextX,H=s.JSONX.getInstance();if(!h.collapsed&&r){const k=s.BuildTextUtils.selection.delete([h],f,0,null,!1);w.push(...k),I.params.textRanges=[{startOffset:E+b,endOffset:E+b,collapsed:!0}]}else w.push({t:s.TextXActionType.RETAIN,len:E});o>0&&w.push({t:s.TextXActionType.DELETE,len:o}),w.push({t:s.TextXActionType.INSERT,body:{dataStream:n,textRuns:N?[{...N,st:0,ed:n.length}]:[],customRanges:y?[{...y,startIndex:0,endIndex:n.length-1}]:[],customDecorations:x.map(k=>({...k,startIndex:0,endIndex:n.length-1}))},len:n.length});const V=Z(m,p);I.params.actions=H.editOp(w.serialize(),V),I.params.noHistory=!a,I.params.isCompositionEnd=a;const F=c.syncExecuteCommand(I.id,I.params);return u.pushUndoRedoMutationParams(F,I.params),!!F}},ia={id:"doc.command.insert-custom-range",type:s.CommandType.COMMAND,handler:(i,t)=>{if(!t)return!1;const e=i.get(s.ICommandService),{unitId:n,rangeId:o=s.generateRandomId(),textRanges:a,properties:r,text:c,wholeEntity:l}=t,A={unitId:n,textRanges:a,body:{dataStream:c,customRanges:[{startIndex:0,endIndex:c.length-1,rangeId:o,rangeType:s.CustomRangeType.CUSTOM,properties:r,wholeEntity:l}]}};return e.syncExecuteCommand(Un.id,A)}},Nt={type:s.CommandType.COMMAND,id:"doc.command.set-zoom-ratio",handler:async(i,t)=>{var u,m,h;const e=i.get(s.ICommandService),n=i.get(s.IUndoRedoService),o=i.get(s.IUniverInstanceService);let a=(u=o.getCurrentUniverDocInstance())==null?void 0:u.getUnitId();if(!a)return!1;let r=1;if(t&&(a=(m=t.documentId)!=null?m:a,r=(h=t.zoomRatio)!=null?h:r),!o.getUniverDocInstance(a))return!1;const l={zoomRatio:r,unitId:a},A=Xc(i,l);return e.syncExecuteCommand(he.id,l)?(n.pushUndoRedo({unitID:a,undoMutations:[{id:he.id,params:A}],redoMutations:[{id:he.id,params:l}]}),!0):!1}},ji={id:"doc.table.tab-in-table",type:s.CommandType.COMMAND,handler:async(i,t)=>{var g;const{shift:e}=t,n=i.get(D.DocSelectionManagerService),o=n.getDocRanges(),a=i.get(s.ICommandService),c=i.get(s.IUniverInstanceService).getCurrentUniverDocInstance();if(!c)return!1;const l=(g=o.find(p=>p.isActive))!=null?g:o[0],A=c.getUnitId(),d=re(i,A),u=d==null?void 0:d.getSkeleton(),m=u==null?void 0:u.getViewModel().getSelfOrHeaderFooterViewModel(l==null?void 0:l.segmentId);if(m==null||l==null)return!1;let h=null;if(e?h=os(m,l,ii.PREV):h=os(m,l,ii.NEXT),h){const{startOffset:p,endOffset:f}=h,S=[{startOffset:p,endOffset:f}];return n.replaceDocRanges(S),!0}return e===!1?await a.executeCommand(Fi.id,{position:jt.BELLOW}):!0}};var Od=Object.getOwnPropertyDescriptor,Rd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Od(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Xi=(i,t)=>(e,n)=>t(e,n,i);let Ki=class{constructor(i,t,e){B(this,"_docContainer");B(this,"getComponent",i=>{if(this._docContainer=i,!i.getContentRef().current)throw new Error("container is not ready")});B(this,"changeLocale",i=>{this._localeService.setLocale(i)});this._localeService=i,this._injector=t,this._configService=e}getUIConfig(){return{injector:this._injector,config:this._configService.getConfig(un),changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(i){if(this._docContainer)return i(this._docContainer)}getDocContainer(){return this._docContainer}};Ki=Rd([Xi(0,s.Inject(s.LocaleService)),Xi(1,s.Inject(s.Injector)),Xi(2,s.IConfigService)],Ki);var Md=Object.getOwnPropertyDescriptor,xd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Md(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Dd=(i,t)=>(e,n)=>t(e,n,i);let vn=class extends s.RxDisposable{constructor(t){super();B(this,"_docContainerController");this._injector=t,this._docContainerController=this._injector.createInstance(Ki)}};vn=xd([Dd(0,s.Inject(s.Injector))],vn);var Bd=Object.getOwnPropertyDescriptor,_d=(i,t,e,n)=>{for(var o=n>1?void 0:n?Bd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},oa=(i,t)=>(e,n)=>t(e,n,i);let In=class extends s.Disposable{constructor(i,t){super(),this._docAutoFormatService=i,this._renderManagerService=t,this._initListTabAutoFormat(),this._initSpaceAutoFormat(),this._initDefaultEnterFormat(),this._initExitListAutoFormat()}_initListTabAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:je.id,match:i=>{var o;const{selection:t,paragraphs:e,unit:n}=i;if(e.length===1&&t.startOffset===e[0].paragraphStart&&e[0].bullet){const a=(o=n.getBody())==null?void 0:o.paragraphs,r=a==null?void 0:a.filter(c=>{var l;return((l=c.bullet)==null?void 0:l.listId)===e[0].bullet.listId});return(r==null?void 0:r.findIndex(c=>c.startIndex===e[0].startIndex))!==0}else if(e.length>1&&e.some(a=>a.bullet))return!0;return!1},getMutations(i){const t=i.commandParams;return[{id:sn.id,params:{type:t!=null&&t.shift?Et.decrease:Et.increase}}]},priority:100})),this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:je.id,match:i=>{const{selection:t,unit:e}=i,{startNodePosition:n,endNodePosition:o}=t,a=this._renderManagerService.getRenderById(e.getUnitId()),r=a==null?void 0:a.with(D.DocSkeletonManagerService).getSkeleton();return r==null?!1:!!(n&&o&&Io(r,n,o)||n&&!o&&n.path.indexOf("cells")>-1)},getMutations(i){const t=i.commandParams;return[{id:ji.id,params:{shift:!!(t!=null&&t.shift)}}]},priority:99}))}_initSpaceAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:Bt.id,match:i=>{var a;const{selection:t,paragraphs:e,unit:n}=i;if(!t.collapsed||e.length!==1||!t.collapsed)return!1;const o=(a=n.getBody())==null?void 0:a.dataStream.slice(e[0].paragraphStart,t.startOffset-1);return!!(o&&(Object.keys(s.QuickListTypeMap).includes(o)||Object.keys(Oi).includes(o)))},getMutations(i){var a;const{paragraphs:t,unit:e,selection:n}=i,o=(a=e.getBody())==null?void 0:a.dataStream.slice(t[0].paragraphStart,n.startOffset-1);if(o&&Object.keys(s.QuickListTypeMap).includes(o)){const r=s.QuickListTypeMap[o];return[{id:Ei.id,params:{listType:r,paragraph:t[0]}}]}if(o&&Object.keys(Oi).includes(o)){const r=Oi[o];return[{id:_s.id,params:{value:r}}]}return[]}}))}_initExitListAutoFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:st.id,match:i=>{const{paragraphs:t}=i;return!!(t.length===1&&t[0].bullet&&t[0].paragraphStart===t[0].paragraphEnd)},getMutations:i=>{const t=i.paragraphs[0].bullet;return t?t.nestingLevel>0?[{id:sn.id,params:{type:Et.decrease}}]:[{id:nt.id,params:{listType:i.paragraphs[0].bullet.listType}}]:[]}}))}_initDefaultEnterFormat(){this.disposeWithMe(this._docAutoFormatService.registerAutoFormat({id:st.id,match:()=>!0,getMutations(){return[{id:on.id}]},priority:-9999}))}};In=_d([oa(0,s.Inject(T.DocAutoFormatService)),oa(1,_.IRenderManagerService)],In);function Nd(i){return i.rows[0].cells[0].sections[0].columns[0].lines[0]}function Pd(i){const t=i.rows[i.rows.length-1],e=t.cells[t.cells.length-1];return _.getLastLine(e)}function Ud(i,t){const{ed:e}=i,{skeTables:n}=t;let o=null;for(const a of n.values())if(a.st===e+1){o=a;break}return o}function sa(i){const t=i==null?void 0:i.parent;let e=null,n=null;if(i==null||t==null)return{lineBeforeTable:e,lineAfterTable:n};const{st:o,ed:a}=i,r=t.type===_.DocumentSkeletonPageType.CELL?[t]:t.parent.pages;return _.lineIterator(r,c=>{c.st===a+1?n=c:c.ed===o-1&&(e=c)}),{lineBeforeTable:e,lineAfterTable:n}}function aa(i){return i.sections[0].columns[0].lines.length===0}function ra(i){var r,c;const t=i.parent,e=t==null?void 0:t.parent,n=e==null?void 0:e.tableId;if(t==null||e==null)return;const o=t.cells.indexOf(i);let a=e.rows[e.rows.indexOf(t)+1];if(a==null&&n.indexOf("#-#")){const[l,A]=n.split("#-#"),d=(c=(r=e.parent)==null?void 0:r.parent)==null?void 0:c.pages,u=`${l}#-#${Number.parseInt(A)+1}`;if(d)for(const m of d){const{skeTables:h}=m;if(h.has(u)){const g=h.get(u);if(g!=null&&g.rows.length){a=g.rows.find(p=>!p.isRepeatRow);break}}}}if(a!=null){const l=a.cells[o];return aa(l)?ra(l):l}}function ca(i){var a,r;const t=i.parent,e=t==null?void 0:t.parent;if(t==null||e==null)return;let n=e.rows[e.rows.indexOf(t)-1];const o=t.cells.indexOf(i);if((n==null||n.isRepeatRow)&&e.tableId.indexOf("#-#")){const[c,l]=e.tableId.split("#-#"),A=(r=(a=e.parent)==null?void 0:a.parent)==null?void 0:r.pages,d=`${c}#-#${Number.parseInt(l)-1}`;if(A)for(const u of A){const{skeTables:m}=u;if(m.has(d)){const h=m.get(d);if(h!=null&&h.rows.length){n=h.rows[h.rows.length-1];break}}}}if(n!=null){const c=n.cells[o];return aa(c)?ca(c):c}}function wd(i,t){const{st:e}=i,{skeTables:n}=t;let o=null;for(const a of n.values())if(a.ed===e-1){o=a;break}return o}function Ld(i){return i.sections[0].columns[0].lines[0]}function Qd(i){const t=_.getLastColumn(i);return t.lines[t.lines.length-1]}var Fd=Object.getOwnPropertyDescriptor,Hd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Fd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},En=(i,t)=>(e,n)=>t(e,n,i);let Cn=class extends s.Disposable{constructor(t,e,n,o){super();B(this,"_onInputSubscription");this._univerInstanceService=t,this._renderManagerService=e,this._textSelectionManagerService=n,this._commandService=o,this._commandExecutedListener()}dispose(){var t;super.dispose(),(t=this._onInputSubscription)==null||t.unsubscribe()}_commandExecutedListener(){const t=[Ee.id,Ce.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(!t.includes(e.id))return;const n=e.params;switch(e.id){case Ee.id:return this._handleMoveCursor(n.direction);case Ce.id:return this._handleShiftMoveSelection(n.direction);default:throw new Error("Unknown command")}}))}_handleShiftMoveSelection(t){var C,b,R;const e=this._textSelectionManagerService.getActiveTextRange(),n=this._textSelectionManagerService.getTextRanges(),o=this._univerInstanceService.getCurrentUniverDocInstance();if(o==null)return;const a=(C=this._renderManagerService.getRenderById(o.getUnitId()))==null?void 0:C.with(D.DocSkeletonManagerService).getSkeleton(),r=this._getDocObject();if(e==null||a==null||r==null)return;const{startOffset:c,endOffset:l,style:A,collapsed:d,direction:u,segmentId:m,startNodePosition:h,endNodePosition:g,segmentPage:p}=e;if(n.length>1){let I=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(const M of n)I=Math.min(I,M.startOffset),O=Math.max(O,M.endOffset);this._textSelectionManagerService.replaceTextRanges([{startOffset:t===s.Direction.LEFT||t===s.Direction.UP?O:I,endOffset:t===s.Direction.LEFT||t===s.Direction.UP?I:O,style:A}],!1);return}const f=d||u===s.RANGE_DIRECTION.FORWARD?c:l;let S=d||u===s.RANGE_DIRECTION.FORWARD?l:c;const E=(b=o.getSelfOrHeaderFooterModel(m).getBody().dataStream.length)!=null?b:Number.POSITIVE_INFINITY;if(t===s.Direction.LEFT||t===s.Direction.RIGHT){const I=a.findNodeByCharIndex(S-1,m,p),O=a.findNodeByCharIndex(S,m,p);S=t===s.Direction.RIGHT?S+O.count:S-((R=I==null?void 0:I.count)!=null?R:0),S=Math.min(E-2,Math.max(0,S)),this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:S,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),S)}else{const I=a.findNodeByCharIndex(S,m,p),O=r.document.getOffsetConfig(),M=d?h:u===s.RANGE_DIRECTION.FORWARD?g:h,y=this._getTopOrBottomPosition(a,I,M,t===s.Direction.DOWN,!0);if(y==null){const x=t===s.Direction.UP?0:E-2;if(x===S)return;this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:x,style:A}],!1);return}const N=new Ie(O,a).getRangePointData(y,y).cursorList[0];this._textSelectionManagerService.replaceTextRanges([{startOffset:f,endOffset:N.endOffset,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),N.endOffset)}}_handleMoveCursor(t){var E,C,b,R;const e=this._textSelectionManagerService.getActiveTextRange(),n=this._textSelectionManagerService.getTextRanges(),o=this._univerInstanceService.getCurrentUniverDocInstance();if(o==null)return!1;const a=(E=this._renderManagerService.getRenderById(o.getUnitId()))==null?void 0:E.with(D.DocSkeletonManagerService).getSkeleton(),r=this._getDocObject();if(e==null||a==null||r==null||n==null)return;const{startOffset:c,endOffset:l,style:A,collapsed:d,segmentId:u,startNodePosition:m,endNodePosition:h,segmentPage:g}=e,p=o.getSelfOrHeaderFooterModel(u).getBody();if(p==null)return;const f=(C=p.dataStream.length)!=null?C:Number.POSITIVE_INFINITY,S=(b=o.getCustomRanges())!=null?b:[];if(t===s.Direction.LEFT||t===s.Direction.RIGHT){let I;if(!e.collapsed||n.length>1){let y=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY;for(const x of n)y=Math.min(y,x.startOffset),N=Math.max(N,x.endOffset);I=t===s.Direction.LEFT?y:N}else{const y=a.findNodeByCharIndex(c-1,u,g),N=a.findNodeByCharIndex(c,u,g),x=a.findNodeByCharIndex(c+1,u,g);t===s.Direction.LEFT?I=Math.max(0,c-((R=y==null?void 0:y.count)!=null?R:1)):I=Math.min(f-2,l+N.count+((x==null?void 0:x.streamType)===s.DataStreamTreeTokenType.SECTION_BREAK?1:0))}const O=[s.DataStreamTreeTokenType.TABLE_START,s.DataStreamTreeTokenType.TABLE_END,s.DataStreamTreeTokenType.TABLE_ROW_START,s.DataStreamTreeTokenType.TABLE_ROW_END,s.DataStreamTreeTokenType.TABLE_CELL_START,s.DataStreamTreeTokenType.TABLE_CELL_END,s.DataStreamTreeTokenType.SECTION_BREAK];if(t===s.Direction.LEFT)for(;O.includes(p.dataStream[I]);)I--;else for(;O.includes(p.dataStream[I]);)I++;S.filter(y=>y.wholeEntity&&y.startIndex<I&&y.endIndex>=I).forEach(y=>{t===s.Direction.LEFT?I=Math.min(y.startIndex,I):I=Math.max(y.endIndex+1,I)}),this._textSelectionManagerService.replaceTextRanges([{startOffset:Math.max(0,I),endOffset:Math.max(0,I),style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),I)}else{const I=a.findNodeByCharIndex(c,u,g),O=a.findNodeByCharIndex(l,u,g),M=r.document.getOffsetConfig(),y=this._getTopOrBottomPosition(a,t===s.Direction.UP||d?I:O,t===s.Direction.UP||d?m:h,t===s.Direction.DOWN);if(y==null){let x;d?x=t===s.Direction.UP?0:f-2:x=t===s.Direction.UP?c:l,this._textSelectionManagerService.replaceTextRanges([{startOffset:Math.max(0,x),endOffset:Math.max(0,x),style:A}],!1);return}const N=new Ie(M,a).getRangePointData(y,y).cursorList[0];this._textSelectionManagerService.replaceTextRanges([{...N,style:A}],!1),this._scrollToFocusNodePosition(o.getUnitId(),N.endOffset)}}_getTopOrBottomPosition(t,e,n,o,a=!1){if(e==null||n==null)return;const r=this._getGlyphLeftOffsetInLine(e),c=this._getNextOrPrevLine(e,o,a);if(c==null)return;const l=this._matchPositionByLeftOffset(t,c,r,n);if(l!=null)return{...l,isBack:!0}}_getGlyphLeftOffsetInLine(t){const e=t.parent;if(e==null)return Number.NEGATIVE_INFINITY;const n=e.left,{left:o}=t;return n+o}_matchPositionByLeftOffset(t,e,n,o){const a={distance:Number.POSITIVE_INFINITY};for(const c of e.divides){const l=c.left;for(const A of c.glyphGroup){if(A.streamType===s.DataStreamTreeTokenType.SECTION_BREAK)continue;const{left:d}=A,u=l+d,m=Math.abs(n-u);m<a.distance&&(a.glyph=A,a.distance=m)}}if(a.glyph==null)return;const{segmentPage:r}=o;return t.findPositionByGlyph(a.glyph,r)}_getNextOrPrevLine(t,e,n=!1){var p,f,S,E,C,b,R,I,O,M,y,N;const o=t.parent,a=o==null?void 0:o.parent,r=a==null?void 0:a.parent,c=r==null?void 0:r.parent,l=c==null?void 0:c.parent;if(o==null||a==null||r==null||c==null||l==null)return;const A=r.lines.indexOf(a);if(A===-1)return;let d;if(l.type===_.DocumentSkeletonPageType.CELL&&n){const x=la(l,e);if(x)return x}if(e===!0){d=r.lines[A+1];const x=Ud(a,l);if(x){const w=Nd(x);w&&(d=w)}}else{d=r.lines[A-1];const x=wd(a,l);if(x){const w=Pd(x);w&&(d=w)}}if(d!=null)return d;const u=c.columns.indexOf(r);if(u===-1)return;if(e===!0)d=(p=c.columns[u+1])==null?void 0:p.lines[0];else{const x=(S=(f=c.columns)==null?void 0:f[u-1])==null?void 0:S.lines;d=x==null?void 0:x[x.length-1]}if(d!=null)return d;const m=l.sections.indexOf(c);if(m===-1)return;if(e===!0)d=(C=(E=l.sections[m-1])==null?void 0:E.columns[0])==null?void 0:C.lines[0];else{const x=(R=(b=l.sections)==null?void 0:b[m-1])==null?void 0:R.columns,w=x==null?void 0:x[x.length-1],H=w==null?void 0:w.lines;d=H==null?void 0:H[H.length-1]}if(d!=null)return d;if(l.type===_.DocumentSkeletonPageType.CELL)return la(l,e);const h=l.parent;if(h==null)return;const g=h.pages.indexOf(l);if(g!==-1){if(e===!0)d=(M=(O=(I=h.pages[g+1])==null?void 0:I.sections[0])==null?void 0:O.columns[0])==null?void 0:M.lines[0];else{const x=(y=h.pages[g-1])==null?void 0:y.sections;if(x==null)return;const w=(N=x[x.length-1])==null?void 0:N.columns,H=w[w.length-1],V=H==null?void 0:H.lines;d=V[V.length-1]}if(d!=null)return d}}_scrollToFocusNodePosition(t,e){var o;const n=(o=this._renderManagerService.getRenderById(t))==null?void 0:o.with(T.DocBackScrollRenderController);n!=null&&n.scrollToRange({startOffset:e,endOffset:e,collapsed:!0})}_getDocObject(){return Ao(this._univerInstanceService,this._renderManagerService)}};Cn=Hd([En(0,s.IUniverInstanceService),En(1,_.IRenderManagerService),En(2,s.Inject(D.DocSelectionManagerService)),En(3,s.ICommandService)],Cn);function la(i,t){var n,o;let e=null;if(t===!0){const a=ra(i);if(a)e=Ld(a);else{const r=(n=i.parent)==null?void 0:n.parent,{lineAfterTable:c}=sa(r);c&&(e=c)}}else{const a=ca(i);if(a)e=Qd(a);else{const r=(o=i.parent)==null?void 0:o.parent,{lineBeforeTable:c}=sa(r);c&&(e=c)}}return e}const kd=({handleRowColChange:i,tableCreateParams:t})=>{const e=v.useDependency(s.LocaleService),[n,o]=U.useState(3),[a,r]=U.useState(5);function c(l,A){o(l),r(A),i(l,A)}return U.useEffect(()=>{o(t.rowCount),r(t.colCount)},[t]),P.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between",children:[P.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[P.jsx("span",{children:e.t("toolbar.table.rowCount")}),P.jsx(J.InputNumber,{className:"univer-w-28",min:1,max:20,precision:0,value:n,onChange:l=>{c(l,a)}})]}),P.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[P.jsx("span",{children:e.t("toolbar.table.colCount")}),P.jsx(J.InputNumber,{className:"univer-w-28",min:1,max:20,precision:0,value:a,onChange:l=>{c(n,l)}})]})]})};var Vd=Object.getOwnPropertyDescriptor,Wd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Vd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},da=(i,t)=>(e,n)=>t(e,n,i);let Tn=class extends s.Disposable{constructor(i,t){super(),this._commandService=i,this._componentManager=t,this._initialize()}_initialize(){this._init(),this._registerCommands(),this._initCustomComponents()}_registerCommands(){[rn].forEach(i=>this.disposeWithMe(this._commandService.registerCommand(i)))}_initCustomComponents(){const i=this._componentManager;this.disposeWithMe(i.register(Us,kd))}_init(){}};Tn=Wd([da(0,s.ICommandService),da(1,s.Inject(v.ComponentManager))],Tn);var zd=Object.getOwnPropertyDescriptor,Gd=(i,t,e,n)=>{for(var o=n>1?void 0:n?zd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},yn=(i,t)=>(e,n)=>t(e,n,i);let Yi=class extends s.Disposable{constructor(i,t,e,n,o){super(),this._context=i,this._docSkeletonManagerService=t,this._commandService=e,this._docEventManagerService=n,this._textSelectionManagerService=o,this._initPointerDownObserver(),this._initHoverCursor()}_initPointerDownObserver(){this._docEventManagerService.clickBullets$.subscribe(i=>{const t=this._textSelectionManagerService.getTextRanges();this._commandService.executeCommand(Ii.id,{index:i.paragraph.startIndex,segmentId:i.segmentId,textRanges:t})})}_initHoverCursor(){this.disposeWithMe(this._docEventManagerService.hoverBullet$.subscribe(i=>{i?this._context.mainComponent.setCursor(_.CURSOR_TYPE.POINTER):this._context.mainComponent.setCursor(_.CURSOR_TYPE.TEXT)}))}_getTransformCoordForDocumentOffset(i,t,e,n){const{documentTransform:o}=i.getOffsetConfig(),a=t.transformVector2SceneCoord(_.Vector2.FromArray([e,n]));if(a)return o.clone().invert().applyPoint(a)}};Yi=Gd([yn(1,s.Inject(D.DocSkeletonManagerService)),yn(2,s.ICommandService),yn(3,s.Inject(T.DocEventManagerService)),yn(4,s.Inject(D.DocSelectionManagerService))],Yi);var jd=Object.getOwnPropertyDescriptor,Xd=(i,t,e,n)=>{for(var o=n>1?void 0:n?jd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Pt=(i,t)=>(e,n)=>t(e,n,i);let bn=class extends s.RxDisposable{constructor(i,t,e,n,o,a){super(),this._context=i,this._commandService=t,this._docClipboardService=e,this._docSelectionRenderService=n,this._contextService=o,this._editorService=a,this._init()}_init(){this._initLegacyPasteCommand()}_initLegacyPasteCommand(){var i;(i=this._docSelectionRenderService)==null||i.onPaste$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>{var c,l,A;if(!$t(this._contextService))return;t.event.preventDefault();const e=t.event;let n=(c=e.clipboardData)==null?void 0:c.getData(v.HTML_CLIPBOARD_MIME_TYPE);const o=(l=e.clipboardData)==null?void 0:l.getData(v.PLAIN_TEXT_CLIPBOARD_MIME_TYPE),a=[...((A=e.clipboardData)==null?void 0:A.items)||[]].filter(d=>v.imageMimeTypeSet.has(d.type)).map(d=>d.getAsFile()).filter(d=>!!d);this._editorService.getEditor(this._context.unitId)&&(n!=null?n:"").indexOf("</table>")>-1&&(n=""),this._docClipboardService.legacyPaste({html:n,text:o,files:a})})}};bn=Xd([Pt(1,s.ICommandService),Pt(2,xe),Pt(3,s.Inject(T.DocSelectionRenderService)),Pt(4,s.IContextService),Pt(5,ce)],bn);var Kd=Object.getOwnPropertyDescriptor,Yd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Kd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Aa=(i,t)=>(e,n)=>t(e,n,i);const qd=[s.DEFAULT_EMPTY_DOCUMENT_VALUE,s.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,s.DOCS_NORMAL_EDITOR_UNIT_ID_KEY,s.DOCS_ZEN_EDITOR_UNIT_ID_KEY];let qi=class extends s.Disposable{constructor(i,t,e){super(),this._context=i,this._contextMenuService=t,this._commandService=e,qd.includes(this._context.unitId)||(this._initPointerDown(),this._initEditChange())}_initPointerDown(){var e,n;const t=((n=(e=this._context)==null?void 0:e.mainComponent)==null?void 0:n.onPointerDown$).subscribeEvent(o=>{o.button===2&&this._contextMenuService.triggerContextMenu(o,v.ContextMenuPosition.MAIN_AREA)});this.disposeWithMe(t)}_initEditChange(){this.disposeWithMe(this._commandService.onCommandExecuted(i=>{i.id===D.RichTextEditingMutation.id&&this._contextMenuService.visible&&this._contextMenuService.hideContextMenu()}))}};qi=Yd([Aa(1,v.IContextMenuService),Aa(2,s.ICommandService)],qi);var Jd=Object.getOwnPropertyDescriptor,Zd=(i,t,e,n)=>{for(var o=n>1?void 0:n?Jd(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},lt=(i,t)=>(e,n)=>t(e,n,i);let On=class extends s.Disposable{constructor(t,e,n,o,a,r,c){super();B(this,"_initialEditors",new Set);this._context=t,this._univerInstanceService=e,this._editorService=n,this._commandService=o,this._docSelectionRenderService=a,this._docSkeletonManagerService=r,this._renderManagerService=c,this._initialize()}_initialize(){this._editorService.getAllEditor().forEach(t=>{const e=t.getEditorId();e===this._context.unitId&&(this._initialEditors.has(e)||(this._initialEditors.add(e),this._resize(e)))}),this._commandExecutedListener(),this._initialBlur(),this._initialFocus()}_resize(t){if(t==null)return;const e=this._editorService.getEditor(t);if((e==null?void 0:e.cancelDefaultResizeListener)===!0)return;const n=this._univerInstanceService.getUniverDocInstance(t);if(!n)return;const o=this._docSkeletonManagerService.getSkeleton();if(e==null||e.render==null||o==null||n==null)return;o.calculate();const{marginTop:a=0,marginBottom:r=0,marginLeft:c=0,marginRight:l=0}=n.getSnapshot().documentStyle,{scene:A,mainComponent:d}=e.render;let{actualHeight:u,actualWidth:m}=o.getActualSize();u+=a+r,m+=c+l;const{width:h,height:g}=e.getBoundingClientRect(),p=Math.max(m,h),f=Math.max(u,g);A.transformByState({width:p,height:f}),d==null||d.resize(p,f)}_initialBlur(){this.disposeWithMe(this._editorService.blur$.subscribe(()=>{this._docSelectionRenderService.blur()})),this.disposeWithMe(this._docSelectionRenderService.onBlur$.subscribe(()=>{const{unitId:t}=this._context,e=this._editorService.getEditor(t),n=this._editorService.getFocusEditor();e==null||e.isSheetEditor()||n&&n.getEditorId()===t||t.includes("range_selector")||t.includes("embedding_formula_editor")||this._editorService.blur()}))}_initialFocus(){const t=["univer-formula-search","univer-formula-help","formula-help-decorator","univer-formula-help-param"];this.disposeWithMe(L.fromEvent(window,"mousedown").subscribe(n=>{const a=n.target.classList[0]||"";s.checkForSubstrings(a,t)&&n.stopPropagation()}));const e=new s.DisposableCollection;this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(n=>{if(e.dispose(),!n)return;const o=n.getUnitId(),a=this._renderManagerService.getRenderById(o),r=a==null?void 0:a.engine.getCanvas().getCanvasEle();if(r==null)return;const c=L.fromEvent(r,"mousedown").subscribe(l=>{l.stopPropagation()});e.add(c)})),this.disposeWithMe(()=>e.dispose())}_commandExecutedListener(){const t=[D.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=e.params,{unitId:o}=n;if(this._editorService.isSheetEditor(o)||o!==this._context.unitId)return;const a=this._editorService.getEditor(o);a&&!a.params.scrollBar&&this._resize(o)}}))}};On=Zd([lt(1,s.IUniverInstanceService),lt(2,ce),lt(3,s.ICommandService),lt(4,s.Inject(T.DocSelectionRenderService)),lt(5,s.Inject(D.DocSkeletonManagerService)),lt(6,_.IRenderManagerService)],On);var $d=Object.getOwnPropertyDescriptor,eA=(i,t,e,n)=>{for(var o=n>1?void 0:n?$d(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Rn=(i,t)=>(e,n)=>t(e,n,i);let Ji=class extends s.Disposable{constructor(t,e,n,o,a){super();B(this,"_previousIMEContent","");B(this,"_isCompositionStart",!0);B(this,"_onStartSubscription");B(this,"_onUpdateSubscription");B(this,"_onEndSubscription");this._context=t,this._docSelectionRenderService=e,this._docImeInputManagerService=n,this._docSkeletonManagerService=o,this._commandService=a,this._initialize()}dispose(){var t,e,n;(t=this._onStartSubscription)==null||t.unsubscribe(),(e=this._onUpdateSubscription)==null||e.unsubscribe(),(n=this._onEndSubscription)==null||n.unsubscribe()}_initialize(){this._initialOnCompositionstart(),this._initialOnCompositionUpdate(),this._initialOnCompositionend()}_initialOnCompositionstart(){this._onStartSubscription=this._docSelectionRenderService.onCompositionstart$.subscribe(t=>{if(t==null)return;this._resetIME();const{activeRange:e}=t;e!=null&&this._docImeInputManagerService.setActiveRange(s.Tools.deepClone(e))})}_initialOnCompositionUpdate(){this._onUpdateSubscription=this._docSelectionRenderService.onCompositionupdate$.subscribe(t=>{this._updateContent(t,!0)})}_initialOnCompositionend(){this._onEndSubscription=this._docSelectionRenderService.onCompositionend$.subscribe(t=>{this._updateContent(t,!1)})}async _updateContent(t,e){if(t==null)return;const n=this._context.unitId,o=this._docSkeletonManagerService.getSkeleton(),{event:a,activeRange:r}=t;if(o==null||r==null)return;const l=a.data;l===this._previousIMEContent&&e||(await this._commandService.executeCommand(Gi.id,{unitId:n,newText:l,oldTextLen:this._previousIMEContent.length,isCompositionStart:this._isCompositionStart,isCompositionEnd:!e}),e?(this._isCompositionStart&&(this._isCompositionStart=!1),this._previousIMEContent=l):this._resetIME())}_resetIME(){this._previousIMEContent="",this._isCompositionStart=!0,this._docImeInputManagerService.clearUndoRedoMutationParamsCache(),this._docImeInputManagerService.setActiveRange(null)}};Ji=eA([Rn(1,s.Inject(T.DocSelectionRenderService)),Rn(2,s.Inject(_t)),Rn(3,s.Inject(D.DocSkeletonManagerService)),Rn(4,s.ICommandService)],Ji);var tA=Object.getOwnPropertyDescriptor,nA=(i,t,e,n)=>{for(var o=n>1?void 0:n?tA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Mn=(i,t)=>(e,n)=>t(e,n,i);let Zi=class extends s.Disposable{constructor(t,e,n,o,a){super();B(this,"_onInputSubscription");this._context=t,this._docSelectionRenderService=e,this._docSkeletonManagerService=n,this._commandService=o,this._docMenuStyleService=a,this._init()}dispose(){var t;super.dispose(),(t=this._onInputSubscription)==null||t.unsubscribe()}_init(){this._initialNormalInput()}_initialNormalInput(){this._onInputSubscription=this._docSelectionRenderService.onInput$.subscribe(async t=>{var f,S;if(t==null)return;const{unitId:e}=this._context,{event:n,content:o="",activeRange:a}=t,r=n,c=this._docSkeletonManagerService.getSkeleton();if(r.data==null||c==null||a==null)return;const{segmentId:l}=a,d=this._context.unit.getSelfOrHeaderFooterModel(l).getBody(),u=this._docMenuStyleService.getDefaultStyle(),m=this._docMenuStyleService.getStyleCache(),h=_n((f=d==null?void 0:d.customRanges)!=null?f:[],a.endOffset,s.SHEET_EDITOR_UNITS.includes(e)),g=Qt(d,a.endOffset,u,m,s.SHEET_EDITOR_UNITS.includes(e)),p=Nn((S=d==null?void 0:d.customDecorations)!=null?S:[],a.endOffset);await this._commandService.executeCommand(si.id,{unitId:e,body:{dataStream:o,textRuns:g?[{...g,st:0,ed:o.length}]:[],customRanges:h?[{...h,startIndex:0,endIndex:o.length-1}]:[],customDecorations:p.map(E=>({...E,startIndex:0,endIndex:o.length-1}))},range:a,segmentId:l}),o===" "&&await this._commandService.executeCommand(Bt.id)})}};Zi=nA([Mn(1,s.Inject(T.DocSelectionRenderService)),Mn(2,s.Inject(D.DocSkeletonManagerService)),Mn(3,s.ICommandService),Mn(4,s.Inject(Te))],Zi);class $i extends s.Disposable{constructor(t){super(),this._context=t}calculatePagePosition(){var b,R;const t=ve(this._context),n=(R=(b=this._context.unit.getSettings())==null?void 0:b.zoomRatio)!=null?R:1,{document:o,scene:a,docBackground:r}=t,c=a==null?void 0:a.getParent(),{width:l,height:A,pageMarginLeft:d,pageMarginTop:u}=o;if(c==null||l===Number.POSITIVE_INFINITY||A===Number.POSITIVE_INFINITY)return;const{width:m,height:h}=c;let g=0,p=u,f=0,S=0,E=Number.POSITIVE_INFINITY;m>(l+d*2)*n?(g=m/2-l*n/2,g/=n,f=(m-d*2)/n,E=0):(g=d,f=l+d*2,E=(f-m/n)/2),h>A?S=(h-u*2)/n:S=A+u*2,a.resize(f,S),m<=1&&(g=-1e4,p=-1e4),o.translate(g,p),r.translate(g,p);const C=a.getViewport(ae.VIEW_MAIN);return E!==Number.POSITIVE_INFINITY&&C!=null&&C.scrollToViewportPos({viewportScrollX:E}),this}}var iA=Object.getOwnPropertyDescriptor,oA=(i,t,e,n)=>{for(var o=n>1?void 0:n?iA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ua=(i,t)=>(e,n)=>t(e,n,i);let eo=class extends s.Disposable{constructor(i,t,e){super(),this._context=i,this._docPageLayoutService=t,this._textSelectionManagerService=e;const n=this._context.unitId;if(s.isInternalEditorID(n)&&n!==s.DOCS_ZEN_EDITOR_UNIT_ID_KEY)return this;this._initResize()}_initResize(){this.disposeWithMe(s.fromEventSubject(this._context.engine.onTransformChange$).pipe(L.filter(i=>i.type===_.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize),L.throttleTime(0,L.animationFrameScheduler)).subscribe(()=>{this._docPageLayoutService.calculatePagePosition(),this._textSelectionManagerService.refreshSelection()}))}};eo=oA([ua(1,s.Inject($i)),ua(2,s.Inject(D.DocSelectionManagerService))],eo);var sA=Object.getOwnPropertyDescriptor,aA=(i,t,e,n)=>{for(var o=n>1?void 0:n?sA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},dt=(i,t)=>(e,n)=>t(e,n,i);let to=class extends s.Disposable{constructor(t,e,n,o,a,r,c){super();B(this,"_loadedMap",new WeakSet);this._context=t,this._commandService=e,this._editorService=n,this._instanceSrv=o,this._docSelectionRenderService=a,this._docSkeletonManagerService=r,this._docSelectionManagerService=c,this._initialize()}_initialize(){this._init(),this._skeletonListener(),this._commandExecutedListener(),this._refreshListener(),this._syncSelection()}_init(){const{unitId:t}=this._context,e=ve(this._context);e==null||e.document==null||this._loadedMap.has(e.document)||(this._initialMain(t),this._loadedMap.add(e.document))}_refreshListener(){this.disposeWithMe(this._docSelectionManagerService.refreshSelection$.subscribe(t=>{if(t==null)return;const{unitId:e,docRanges:n,isEditing:o,options:a}=t;e===this._context.unitId&&(this._docSelectionRenderService.removeAllRanges(),this._docSelectionRenderService.addDocRanges(n,o,a))}))}_syncSelection(){this.disposeWithMe(this._docSelectionRenderService.textSelectionInner$.subscribe(t=>{t!=null&&this._docSelectionManagerService.__replaceTextRangesWithNoRefresh(t,{unitId:this._context.unitId,subUnitId:this._context.unitId})}))}_initialMain(t){const e=ve(this._context),{document:n,scene:o}=e;this.disposeWithMe(n.onPointerEnter$.subscribeEvent(()=>{this._isEditorReadOnly(t)||(n.cursor=_.CURSOR_TYPE.TEXT)})),this.disposeWithMe(n.onPointerLeave$.subscribeEvent(()=>{n.cursor=_.CURSOR_TYPE.DEFAULT,o.resetCursor()})),this.disposeWithMe(n.onPointerDown$.subscribeEvent((a,r)=>{if(this._isEditorReadOnly(t))return;const c=this._instanceSrv.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);(c==null?void 0:c.getUnitId())!==t&&this._instanceSrv.setCurrentUnitForType(t);const l=this._docSkeletonManagerService.getSkeleton(),{offsetX:A,offsetY:d}=a,u=this._getTransformCoordForDocumentOffset(A,d);if(u!=null){const{pageLayoutType:m=_.PageLayoutType.VERTICAL,pageMarginLeft:h,pageMarginTop:g}=n.getOffsetConfig(),{editArea:p}=l.findEditAreaByCoord(u,m,h,g),f=this._docSkeletonManagerService.getViewModel(),S=f.getEditArea();S!==_.DocumentEditArea.BODY&&p!==_.DocumentEditArea.BODY&&p!==S&&f.setEditArea(p)}if(this._docSelectionRenderService.__onPointDown(a),this._editorService.getEditor(t)){this._setEditorFocus(t);const{offsetX:m,offsetY:h}=a;setTimeout(()=>{t===this._editorService.getFocusId()||this._docSelectionRenderService.isOnPointerEvent||(this._setEditorFocus(t),this._docSelectionRenderService.setCursorManually(m,h))},0)}a.button!==2&&r.stopPropagation()})),this.disposeWithMe(n.onDblclick$.subscribeEvent(a=>{this._isEditorReadOnly(t)||this._docSelectionRenderService.__handleDblClick(a)})),this.disposeWithMe(n.onTripleClick$.subscribeEvent(a=>{this._isEditorReadOnly(t)||this._docSelectionRenderService.__handleTripleClick(a)}))}_getTransformCoordForDocumentOffset(t,e){const n=ve(this._context),{document:o,scene:a}=n,{documentTransform:r}=o.getOffsetConfig(),c=a.getViewports()[0];if(c==null)return;const l=c.transformVector2SceneCoord(_.Vector2.FromArray([t,e]));return r.clone().invert().applyPoint(l)}_isEditorReadOnly(t){const e=this._editorService.getEditor(t);return e?e.isReadOnly():!1}_setEditorFocus(t){this._editorService.focus(t)}_commandExecutedListener(){const t=[he.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var n;if(t.includes(e.id)){const o=e.params,{unitId:a}=o,r=(n=this._docSelectionManagerService.__getCurrentSelection())==null?void 0:n.unitId;if(a!==r)return;this._docSelectionManagerService.refreshSelection()}}))}_skeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(!t)return;const{unitId:e}=this._context;if(!s.isInternalEditorID(e)){this._docSelectionRenderService.focus();const a=this._context.unit.getSnapshot(),r=Wo(a);this._docSelectionManagerService.replaceDocRanges([{startOffset:r,endOffset:r}],{unitId:e,subUnitId:e},!1)}}))}};to=aA([dt(1,s.ICommandService),dt(2,ce),dt(3,s.IUniverInstanceService),dt(4,s.Inject(T.DocSelectionRenderService)),dt(5,s.Inject(D.DocSkeletonManagerService)),dt(6,s.Inject(D.DocSelectionManagerService))],to);var rA=Object.getOwnPropertyDescriptor,cA=(i,t,e,n)=>{for(var o=n>1?void 0:n?rA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Ke=(i,t)=>(e,n)=>t(e,n,i);let no=class extends s.Disposable{constructor(i,t,e,n,o,a,r,c){super(),this._context=i,this._contextService=t,this._docSkeletonManagerService=e,this._univerInstanceService=n,this._commandService=o,this._textSelectionManagerService=a,this._editorService=r,this._docPageLayoutService=c,this._initSkeletonListener(),this._initCommandExecutedListener(),this._initRenderRefresher(),setTimeout(()=>this.updateViewZoom(1,!0),20),s.isInternalEditorID(this._context.unitId)||this._initZoomEventListener()}_initRenderRefresher(){this._docSkeletonManagerService.currentSkeleton$.subscribe(i=>{if(i==null)return;const{unitId:t,scene:e}=this._context;this._editorService.isEditor(t)||this.disposeWithMe(e.onMouseWheel$.subscribeEvent(n=>{if(!n.ctrlKey||!this._contextService.getContextValue(s.FOCUSING_DOC))return;const o=this._univerInstanceService.getCurrentUniverDocInstance();if(!o)return;const{documentFlavor:a}=o.getSnapshot().documentStyle;if(a===s.DocumentFlavor.MODERN)return;const r=Math.abs(n.deltaX);let c=r<40?.2:r<80?.4:.2;c*=n.deltaY>0?-1:1,e.scaleX<1&&(c/=2);const l=o.zoomRatio;let A=+Number.parseFloat(`${l+c}`).toFixed(1);A=A>=4?4:A<=.1?.1:A,this._commandService.executeCommand(Nt.id,{zoomRatio:A,unitId:o.getUnitId()}),n.preventDefault()}))})}_initSkeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(i=>{if(i==null)return;const t=this._univerInstanceService.getCurrentUniverDocInstance();if(!t)return;const e=t.zoomRatio||1;this.updateViewZoom(e,!1)}))}_initCommandExecutedListener(){const i=[he.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(i.includes(t.id)&&t.params.unitId===this._context.unitId){const n=this._context.unit.zoomRatio||1;this.updateViewZoom(n)}})),this.disposeWithMe(this._commandService.beforeCommandExecuted(t=>{t.id===Rt.id&&this._commandService.executeCommand(Nt.id,{zoomRatio:1,unitId:this._context.unitId})}))}updateViewZoom(i,t=!0){var n;const e=ve(this._context);e.scene.scale(i,i),this._editorService.isEditor(this._context.unitId)||this._docPageLayoutService.calculatePagePosition(),t&&!this._editorService.isEditor(this._context.unitId)&&this._textSelectionManagerService.refreshSelection(),(n=e.scene.getTransformer())==null||n.clearSelectedObjects()}_initZoomEventListener(){const i=this._context.scene;this.disposeWithMe(i.onMouseWheel$.subscribeEvent(t=>{if(!t.ctrlKey)return;const e=Math.abs(t.deltaX);let n=e<40?.2:e<80?.4:.2;n*=t.deltaY>0?-1:1,i.scaleX<1&&(n/=2);const o=this._context.unit.zoomRatio;let a=+Number.parseFloat(`${o+n}`).toFixed(1);a=a>=4?4:a<=.1?.1:a,this._commandService.executeCommand(Nt.id,{zoomRatio:Math.round(a*10)/10,documentId:this._context.unitId}),t.preventDefault()}))}};no=cA([Ke(1,s.IContextService),Ke(2,s.Inject(D.DocSkeletonManagerService)),Ke(3,s.IUniverInstanceService),Ke(4,s.ICommandService),Ke(5,s.Inject(D.DocSelectionManagerService)),Ke(6,ce),Ke(7,s.Inject($i))],no);const lA=s.createInterceptorKey("PRINTING_COMPONENT_COLLECT"),dA=s.createInterceptorKey("PRINTING_DOM_COLLECT");class ha extends s.Disposable{constructor(){super();B(this,"_printComponentMap",new Map);B(this,"interceptor",new s.InterceptorManager({PRINTING_COMPONENT_COLLECT:lA,PRINTING_DOM_COLLECT:dA}));this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,{priority:-1,handler:e=>e})),this.disposeWithMe(this.interceptor.intercept(this.interceptor.getInterceptPoints().PRINTING_DOM_COLLECT,{priority:-1,handler:e=>e}))}registerPrintComponent(e,n){this._printComponentMap.set(e,n)}getPrintComponent(e){return this._printComponentMap.get(e)}}var AA=Object.getOwnPropertyDescriptor,uA=(i,t,e,n)=>{for(var o=n>1?void 0:n?AA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},Ut=(i,t)=>(e,n)=>t(e,n,i);const ga=300;T.DocStateChangeManagerService=class extends s.RxDisposable{constructor(e,n,o,a,r){super();B(this,"_docStateChange$",new L.BehaviorSubject(null));B(this,"docStateChange$",this._docStateChange$.asObservable());B(this,"_historyStateCache",new Map);B(this,"_changeStateCache",new Map);B(this,"_historyTimer",null);B(this,"_changeStateCacheTimer",null);this._undoRedoService=e,this._commandService=n,this._univerInstanceService=o,this._docStateEmitService=a,this._renderManagerService=r,this._initialize(),this._listenDocStateChange()}getStateCache(e){var n,o;return{history:(n=this._historyStateCache.get(e))!=null?n:[],collaboration:(o=this._changeStateCache.get(e))!=null?o:[]}}setStateCache(e,n){this._historyStateCache.set(e,n.history),this._changeStateCache.set(e,n.collaboration)}_setChangeState(e){this._cacheChangeState(e,"history"),this._cacheChangeState(e,"collaboration")}_initialize(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===s.UndoCommandId||e.id===s.RedoCommandId){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(n==null)return;const o=n.getUnitId();this._pushHistory(o),this._emitChangeState(o)}}))}_listenDocStateChange(){this._docStateEmitService.docStateChangeParams$.pipe(L.takeUntil(this.dispose$)).subscribe(e=>{var l;if(e==null)return;const{isCompositionEnd:n,isSync:o,syncer:a,...r}=e,c=(l=this._renderManagerService.getRenderById(o?a:e.unitId))==null?void 0:l.with(_t);if(c!=null){if(n){const A=c.fetchComposedUndoRedoMutationParams();if(A==null)throw new Error("historyParams is null in RichTextEditingMutation");const{undoMutationParams:d,redoMutationParams:u,previousActiveRange:m}=A;r.redoState.actions=u.actions,r.undoState.actions=d.actions,r.undoState.textRanges=[m]}this._setChangeState(r)}})}_cacheChangeState(e,n="history"){const{trigger:o,unitId:a,noHistory:r,debounce:c=!1}=e;if(r||o==null||n==="history"&&(o===s.RedoCommandId||o===s.UndoCommandId))return;const l=n==="history"?this._historyStateCache:this._changeStateCache,A=n==="history"?this._pushHistory.bind(this):this._emitChangeState.bind(this);if(l.has(a)){const d=l.get(a);d==null||d.push(e)}else l.set(a,[e]);c?n==="history"?(this._historyTimer&&clearTimeout(this._historyTimer),this._historyTimer=setTimeout(()=>{A(a)},ga)):(this._changeStateCacheTimer&&clearTimeout(this._changeStateCacheTimer),this._changeStateCacheTimer=setTimeout(()=>{A(a)},ga)):A(a)}_pushHistory(e){const n=this._undoRedoService,o=this._historyStateCache.get(e);if(!Array.isArray(o)||o.length===0)return;const a=o.length,r=o[0].commandId,c=o[0],l=o[a-1],A={unitId:e,actions:o.reduce((u,m)=>s.JSONX.compose(u,m.redoState.actions),null),textRanges:l.redoState.textRanges},d={unitId:e,actions:o.reverse().reduce((u,m)=>s.JSONX.compose(u,m.undoState.actions),null),textRanges:c.undoState.textRanges};n.pushUndoRedo({unitID:e,undoMutations:[{id:r,params:d}],redoMutations:[{id:r,params:A}]}),o.length=0}_emitChangeState(e){const n=this._changeStateCache.get(e);if(!Array.isArray(n)||n.length===0)return;const o=n.length,{commandId:a,trigger:r,segmentId:c,noHistory:l,debounce:A}=n[0],d=n[0],u=n[o-1],m={unitId:e,actions:n.reduce((p,f)=>s.JSONX.compose(p,f.redoState.actions),null),textRanges:u.redoState.textRanges},h={unitId:e,actions:n.reverse().reduce((p,f)=>s.JSONX.compose(p,f.undoState.actions),null),textRanges:d.undoState.textRanges},g={commandId:a,unitId:e,trigger:r,redoState:m,undoState:h,segmentId:c,noHistory:l,debounce:A};n.length=0,this._docStateChange$.next(g)}},T.DocStateChangeManagerService=uA([Ut(0,s.Inject(s.IUndoRedoService)),Ut(1,s.ICommandService),Ut(2,s.IUniverInstanceService),Ut(3,s.Inject(D.DocStateEmitService)),Ut(4,_.IRenderManagerService)],T.DocStateChangeManagerService);var hA=Object.getOwnPropertyDescriptor,gA=(i,t,e,n)=>{for(var o=n>1?void 0:n?hA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},ma=(i,t)=>(e,n)=>t(e,n,i);const pa="univer-doc-main-canvas";T.DocsRenderService=class extends s.RxDisposable{constructor(t,e){super(),this._instanceSrv=t,this._renderManagerService=e,this._init()}_init(){this._renderManagerService.createRender$.pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._createRenderWithId(t)),this._instanceSrv.getAllUnitsForType(s.UniverInstanceType.UNIVER_DOC).forEach(t=>this._createRenderer(t)),this._instanceSrv.getTypeOfUnitAdded$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._createRenderer(t)),this._instanceSrv.getTypeOfUnitDisposed$(s.UniverInstanceType.UNIVER_DOC).pipe(L.takeUntil(this.dispose$)).subscribe(t=>this._disposeRenderer(t))}_createRenderer(t){var o;const e=t.getUnitId(),n=(o=this._instanceSrv.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:o.getUnitId();this._renderManagerService.created$.subscribe(a=>{a.unitId===n&&(a.engine.getCanvas().setId(pa),a.engine.getCanvas().getContext().setId(pa))}),this._renderManagerService.has(e)||this._createRenderWithId(e)}_createRenderWithId(t){this._renderManagerService.createRender(t)}_disposeRenderer(t){const e=t.getUnitId();this._renderManagerService.removeRender(e)}},T.DocsRenderService=gA([ma(0,s.IUniverInstanceService),ma(1,_.IRenderManagerService)],T.DocsRenderService);const mA={id:st.id,preconditions:dl,binding:v.KeyCode.ENTER},pA={id:pt.id,preconditions:ee,binding:v.KeyCode.BACKSPACE},fA={id:ri.id,preconditions:ee,binding:v.KeyCode.DELETE},SA={id:Ee.id,binding:v.KeyCode.ARROW_UP,preconditions:ee,staticParameters:{direction:s.Direction.UP}},vA={id:Ee.id,binding:v.KeyCode.ARROW_DOWN,preconditions:ee,staticParameters:{direction:s.Direction.DOWN}},IA={id:Ee.id,binding:v.KeyCode.ARROW_LEFT,preconditions:ee,staticParameters:{direction:s.Direction.LEFT}},EA={id:Ee.id,binding:v.KeyCode.ARROW_RIGHT,preconditions:ee,staticParameters:{direction:s.Direction.RIGHT}},CA={id:Ce.id,binding:v.KeyCode.ARROW_UP|v.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.UP}},TA={id:Ce.id,binding:v.KeyCode.ARROW_DOWN|v.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.DOWN}},yA={id:Ce.id,binding:v.KeyCode.ARROW_LEFT|v.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.LEFT}},bA={id:Ce.id,binding:v.KeyCode.ARROW_RIGHT|v.MetaKeys.SHIFT,preconditions:ee,staticParameters:{direction:s.Direction.RIGHT}},OA={id:zi.id,binding:v.KeyCode.A|v.MetaKeys.CTRL_COMMAND,preconditions:i=>i.getContextValue(s.FOCUSING_UNIVER_EDITOR)&&(i.getContextValue(s.FOCUSING_DOC)||i.getContextValue(s.EDITOR_ACTIVATED))};var RA=Object.defineProperty,MA=Object.getOwnPropertyDescriptor,xA=(i,t,e)=>t in i?RA(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,DA=(i,t,e,n)=>{for(var o=n>1?void 0:n?MA(t,e):t,a=i.length-1,r;a>=0;a--)(r=i[a])&&(o=r(o)||o);return o},wt=(i,t)=>(e,n)=>t(e,n,i),BA=(i,t,e)=>xA(i,t+"",e);T.UniverDocsUIPlugin=class extends s.Plugin{constructor(t=Ks,e,n,o,a,r){super(),this._config=t,this._injector=e,this._renderManagerSrv=n,this._commandService=o,this._logService=a,this._configService=r;const{menu:c,...l}=s.merge({},Ks,this._config);c&&this._configService.setConfig("menu",c,{merge:!0}),this._configService.setConfig(un,l),this._initDependencies(e),this._initializeShortcut(),this._initCommand()}onReady(){this._initRenderBasics(),this._markDocAsFocused(),s.touchDependencies(this._injector,[[T.DocStateChangeManagerService],[T.DocsRenderService]])}onRendered(){this._initUI(),this._initRenderModules(),s.touchDependencies(this._injector,[[In],[Cn],[rt],[Tn],[T.DocUIController]])}_initCommand(){[pt,ri,De,Be,_e,Ne,ye,Pe,ge,We,Ue,tt,we,be,on,si,Ze,qt,ai,Jt,cs,he,ot,it,nt,Tt,yt,bt,me,Ot,vt,_i,Fi,mn,pn,qs,fn,Sn,hn,gn,at,$n,ji,je,Bt,st,sn,It,Ct,Ii,Ei,Gi,Rt,pe,oi,Ve,mo,Pn,po,Nt,zi,ki,Ee,Ce,So,Un,ia,de,_s,ci,gi,mi,Ri,Mi,xi,Di,Bi,an,Ns,Ps,Ti,yi,bi,Si,ws,Ui].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))}),[St,en,tn].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_initializeShortcut(){[SA,vA,EA,IA,CA,TA,yA,bA,OA,pA,fA,mA,ul].forEach(t=>{this._injector.get(v.IShortcutService).registerShortcut(t)})}_initDependencies(t){s.mergeOverrideWithDependencies([[ha],[bn],[On],[T.DocUIController],[In],[Tn],[Cn],[vn],[rt],[ce,{useClass:T.EditorService}],[xe,{useClass:ui}],[T.DocCanvasPopManagerService],[T.DocsRenderService],[T.DocStateChangeManagerService],[T.DocAutoFormatService],[Te]],this._config.override).forEach(n=>t.add(n))}_markDocAsFocused(){const t=this._injector.get(s.IUniverInstanceService),e=this._injector.get(ce);try{const n=t.getCurrentUnitForType(s.UniverInstanceType.UNIVER_DOC);if(!n)return;const o=n.getUnitId();e.isEditor(o)||t.focusUnit(n.getUnitId())}catch(n){this._logService.warn(n)}}_initUI(){this._injector.get(vn)}_initRenderBasics(){[[D.DocSkeletonManagerService],[T.DocSelectionRenderService],[D.DocInterceptorService],[$i],[_t],[T.DocRenderController],[no]].forEach(t=>{this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_DOC,t)})}_initRenderModules(){[[T.DocEventManagerService],[dn],[An],[T.DocBackScrollRenderController],[to],[Yn],[eo],[qi],[Yi],[bn],[Zi],[Ji],[On]].forEach(t=>{this._renderManagerSrv.registerRenderModule(s.UniverInstanceType.UNIVER_DOC,t)})}},BA(T.UniverDocsUIPlugin,"pluginName",ro),T.UniverDocsUIPlugin=DA([s.DependentOn(_.UniverRenderEnginePlugin),wt(1,s.Inject(s.Injector)),wt(2,_.IRenderManagerService),wt(3,s.ICommandService),wt(4,s.ILogService),wt(5,s.IConfigService)],T.UniverDocsUIPlugin),T.AfterSpaceCommand=Bt,T.AlignCenterCommand=yt,T.AlignJustifyCommand=Ot,T.AlignLeftCommand=Tt,T.AlignOperationCommand=me,T.AlignRightCommand=bt,T.BreakLineCommand=on,T.BulletListCommand=it,T.ChangeListNestingLevelCommand=sn,T.ChangeListNestingLevelType=Et,T.ChangeListTypeCommand=It,T.CheckListCommand=Ct,T.CoverContentCommand=po,T.CreateDocTableCommand=_i,T.CutContentCommand=Ve,T.DOCS_COMPONENT_BACKGROUND_LAYER_INDEX=co,T.DOCS_COMPONENT_DEFAULT_Z_INDEX=Bn,T.DOCS_COMPONENT_HEADER_LAYER_INDEX=lo,T.DOCS_COMPONENT_MAIN_LAYER_INDEX=Lt,T.DOCS_VIEW_KEY=Ae,T.DOC_UI_PLUGIN_NAME=ro,T.DOC_VERTICAL_PADDING=wi,T.DefaultDocContainerConfig=ao,T.DefaultToolbarConfig=so,T.DeleteCommand=Ze,T.DeleteCustomBlockCommand=qt,T.DeleteLeftCommand=pt,T.DeleteRightCommand=ri,T.DocCopyCommand=St,T.DocCreateTableOperation=rn,T.DocCutCommand=en,T.DocIMEInputManagerService=_t,T.DocPasteCommand=tn,T.DocPrintInterceptorService=ha,T.DocSelectAllCommand=zi,T.DocTableDeleteColumnsCommand=gn,T.DocTableDeleteRowsCommand=hn,T.DocTableDeleteTableCommand=at,T.DocTableInsertColumnCommand=qs,T.DocTableInsertColumnLeftCommand=fn,T.DocTableInsertColumnRightCommand=Sn,T.DocTableInsertRowAboveCommand=mn,T.DocTableInsertRowBellowCommand=pn,T.DocTableInsertRowCommand=Fi,T.DocTableTabCommand=ji,T.DocsUIMenuSchema=ta,T.Editor=bo,T.EditorInsertTextCommandId=rs,T.EnterCommand=st,T.HorizontalLineCommand=vt,T.IDocClipboardService=xe,T.IEditorService=ce,T.IMEInputCommand=Gi,T.InnerPasteCommand=oi,T.InsertCommand=si,T.InsertCustomRangeCommand=ia,T.ListOperationCommand=nt,T.MergeTwoParagraphCommand=Jt,T.MoveCursorOperation=Ee,T.MoveSelectionOperation=Ce,T.NORMAL_TEXT_SELECTION_PLUGIN_NAME=Ea,T.NodePositionConvertToCursor=Ie,T.NodePositionConvertToRectRange=Vn,T.OrderListCommand=ot,T.PastePluginLark=us,T.PastePluginUniver=gs,T.PastePluginWord=ms,T.QuickListCommand=Ei,T.RectRange=zn,T.ReplaceContentCommand=mo,T.ReplaceSelectionCommand=Un,T.ReplaceSnapshotCommand=Pn,T.ReplaceTextRunsCommand=So,T.ResetInlineFormatTextBackgroundColorCommand=tt,T.RichTextEditor=Xa,T.SetDocZoomRatioCommand=Nt,T.SetDocZoomRatioOperation=he,T.SetInlineFormatBoldCommand=De,T.SetInlineFormatCommand=be,T.SetInlineFormatFontFamilyCommand=We,T.SetInlineFormatFontSizeCommand=ge,T.SetInlineFormatItalicCommand=Be,T.SetInlineFormatStrikethroughCommand=Ne,T.SetInlineFormatSubscriptCommand=ye,T.SetInlineFormatSuperscriptCommand=Pe,T.SetInlineFormatTextBackgroundColorCommand=we,T.SetInlineFormatTextColorCommand=Ue,T.SetInlineFormatUnderlineCommand=_e,T.SetParagraphNamedStyleCommand=de,T.SwitchDocModeCommand=Rt,T.TEXT_RANGE_LAYER_INDEX=Ht,T.TabCommand=je,T.TextRange=He,T.ToggleCheckListCommand=Ii,T.UpdateCommand=ai,T.VIEWPORT_KEY=ae,T.addCustomDecorationBySelectionFactory=Ta,T.addCustomDecorationFactory=uo,T.calcDocRangePositions=ln,T.convertBodyToHtml=fs,T.convertPositionsToRectRanges=Vt,T.deleteCustomDecorationFactory=ya,T.docDrawingPositionToTransform=Oa,T.genTableSource=ni,T.generateParagraphs=fi,T.getAnchorBounding=ut,T.getCanvasOffsetByEngine=To,T.getCommandSkeleton=re,T.getCursorWhenDelete=Zt,T.getCustomBlockIdsInSelections=ss,T.getCutActionsFromDocRanges=as,T.getDocObject=Ao,T.getDocObjectById=Ca,T.getEmptyTableCell=Xt,T.getEmptyTableRow=Kt,T.getLineBounding=kt,T.getOneTextSelectionRange=Qn,T.getRichTextEditPath=Z,T.getTableColumn=Yt,T.hasParagraphInTable=ba,T.isInSameTableCell=Hn,T.isValidRectRange=vo,T.neoGetDocObject=ve,T.transformToDocDrawingPosition=Ra,T.useKeyboardEvent=ho,T.useResize=go,T.whenDocAndEditorFocused=ee,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
231
245
 
232
246
 
233
247
  // @univerjs/docs-ui/facade