@univerjs/docs-ui 0.1.9 → 0.1.10

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.
@@ -3,7 +3,7 @@ import { IRenderManagerService } from '@univerjs/engine-render';
3
3
  import { DocSkeletonManagerService } from '@univerjs/docs';
4
4
  import { Disposable, ICommandService, IFloatingObjectManagerService, IUniverInstanceService } from '@univerjs/core';
5
5
 
6
- export declare class FloatingObjectController extends Disposable {
6
+ export declare class DocFloatingObjectController extends Disposable {
7
7
  private readonly _docSkeletonManagerService;
8
8
  private readonly _univerInstanceService;
9
9
  private readonly _renderManagerService;
package/lib/umd/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(_,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("@univerjs/docs"),require("@wendellhu/redi/react-bindings"),require("@univerjs/engine-render"),require("react"),require("rxjs"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","@univerjs/docs","@wendellhu/redi/react-bindings","@univerjs/engine-render","react","rxjs","@univerjs/design"],a):(_=typeof globalThis<"u"?globalThis:_||self,a(_.UniverDocsUi={},_.UniverCore,_["@wendellhu/redi"],_.UniverUi,_.UniverDocs,_["@wendellhu/redi/react-bindings"],_.UniverEngineRender,_.React,_.rxjs,_.UniverDesign))})(this,function(_,a,I,l,d,je,m,Ve,b,We){"use strict";var Nn=Object.defineProperty;var Ln=(_,a,I)=>a in _?Nn(_,a,{enumerable:!0,configurable:!0,writable:!0,value:I}):_[a]=I;var T=(_,a,I)=>(Ln(_,typeof a!="symbol"?a+"":a,I),I);var le;const Ie={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},Ce={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},Oe={layout:{docContainerConfig:Ce,toolbarConfig:Ie}},Te="DocUI";function D(r){return r.getContextValue(a.FOCUSING_DOC)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)}function He(r){return r.getContextValue(a.FOCUSING_DOC)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&!r.getContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE)}const ke={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_UP,preconditions:D,staticParameters:{direction:a.Direction.UP}},ze={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_DOWN,preconditions:D,staticParameters:{direction:a.Direction.DOWN}},Ye={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_LEFT,preconditions:D,staticParameters:{direction:a.Direction.LEFT}},Ge={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_RIGHT,preconditions:D,staticParameters:{direction:a.Direction.RIGHT}},Ke={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_UP|l.MetaKeys.SHIFT,preconditions:D,staticParameters:{direction:a.Direction.UP}},Xe={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_DOWN|l.MetaKeys.SHIFT,preconditions:D,staticParameters:{direction:a.Direction.DOWN}},qe={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_LEFT|l.MetaKeys.SHIFT,preconditions:D,staticParameters:{direction:a.Direction.LEFT}},Ze={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_RIGHT|l.MetaKeys.SHIFT,preconditions:D,staticParameters:{direction:a.Direction.RIGHT}},Je={id:d.SelectAllOperation.id,binding:l.KeyCode.A|l.MetaKeys.CTRL_COMMAND,preconditions:r=>r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&(r.getContextValue(a.FOCUSING_DOC)||r.getContextValue(a.EDITOR_ACTIVATED))};var Qe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(r,e,t,n)=>{for(var i=n>1?void 0:n?et(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Qe(e,t,i),i},be=(r,e)=>(t,n)=>e(t,n,r);let he=class{constructor(r,e,t){T(this,"_docContainer");T(this,"getComponent",r=>{if(this._docContainer=r,!r.getContentRef().current)throw new Error("container is not ready")});T(this,"changeLocale",r=>{this._localeService.setLocale(r)});this._config=r,this._localeService=e,this._injector=t}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(r){if(this._docContainer)return r(this._docContainer)}getDocContainer(){return this._docContainer}};he=tt([be(1,I.Inject(a.LocaleService)),be(2,I.Inject(I.Injector))],he);var nt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?it(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&nt(e,t,i),i},Y=(r,e)=>(t,n)=>e(t,n,r);let V=class extends a.RxDisposable{constructor(e,t,n,i,o){super();T(this,"_docContainerController");T(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=t,this._injector=n,this._textSelectionRenderManager=i,this._layoutService=o,this._docContainerController=this._injector.createInstance(he,e),this._registerContainer()}_registerContainer(){this._layoutService&&this.disposeWithMe(this._layoutService.registerContainerElement(this._textSelectionRenderManager.__getEditorContainer()))}getDocContainerController(){return this._docContainerController}};V=rt([Y(1,I.Inject(a.LocaleService)),Y(2,I.Inject(I.Injector)),Y(3,m.ITextSelectionRenderManager),Y(4,I.Optional(l.ILayoutService))],V);const G="UI_PLUGIN_DOCS",pe=`${G}_COLOR_PICKER_COMPONENT`,Me=`${G}_FONT_FAMILY_COMPONENT`,Re=`${G}_FONT_FAMILY_ITEM_COMPONENT`,ye=`${G}_FONT_SIZE_COMPONENT`;var Ee={exports:{}},K={};/**
1
+ (function(S,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@wendellhu/redi"),require("@univerjs/ui"),require("@univerjs/docs"),require("@wendellhu/redi/react-bindings"),require("@univerjs/engine-render"),require("react"),require("rxjs"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@wendellhu/redi","@univerjs/ui","@univerjs/docs","@wendellhu/redi/react-bindings","@univerjs/engine-render","react","rxjs","@univerjs/design"],a):(S=typeof globalThis<"u"?globalThis:S||self,a(S.UniverDocsUi={},S.UniverCore,S["@wendellhu/redi"],S.UniverUi,S.UniverDocs,S["@wendellhu/redi/react-bindings"],S.UniverEngineRender,S.React,S.rxjs,S.UniverDesign))})(this,function(S,a,I,l,d,je,v,Ve,b,We){"use strict";var yn=Object.defineProperty;var Rn=(S,a,I)=>a in S?yn(S,a,{enumerable:!0,configurable:!0,writable:!0,value:I}):S[a]=I;var O=(S,a,I)=>(Rn(S,typeof a!="symbol"?a+"":a,I),I);var ce;const Ie={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},Ce={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},Oe={layout:{docContainerConfig:Ce,toolbarConfig:Ie}},Te="DocUI";function E(r){return r.getContextValue(a.FOCUSING_DOC)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)}function ke(r){return r.getContextValue(a.FOCUSING_DOC)&&r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&!r.getContextValue(a.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE)}const He={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_UP,preconditions:E,staticParameters:{direction:a.Direction.UP}},ze={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_DOWN,preconditions:E,staticParameters:{direction:a.Direction.DOWN}},Ye={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_LEFT,preconditions:E,staticParameters:{direction:a.Direction.LEFT}},Ge={id:d.MoveCursorOperation.id,binding:l.KeyCode.ARROW_RIGHT,preconditions:E,staticParameters:{direction:a.Direction.RIGHT}},Ke={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_UP|l.MetaKeys.SHIFT,preconditions:E,staticParameters:{direction:a.Direction.UP}},Xe={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_DOWN|l.MetaKeys.SHIFT,preconditions:E,staticParameters:{direction:a.Direction.DOWN}},qe={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_LEFT|l.MetaKeys.SHIFT,preconditions:E,staticParameters:{direction:a.Direction.LEFT}},Ze={id:d.MoveSelectionOperation.id,binding:l.KeyCode.ARROW_RIGHT|l.MetaKeys.SHIFT,preconditions:E,staticParameters:{direction:a.Direction.RIGHT}},Je={id:d.SelectAllOperation.id,binding:l.KeyCode.A|l.MetaKeys.CTRL_COMMAND,preconditions:r=>r.getContextValue(a.FOCUSING_UNIVER_EDITOR)&&(r.getContextValue(a.FOCUSING_DOC)||r.getContextValue(a.EDITOR_ACTIVATED))};var Qe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(r,t,e,n)=>{for(var i=n>1?void 0:n?et(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Qe(t,e,i),i},be=(r,t)=>(e,n)=>t(e,n,r);let he=class{constructor(r,t,e){O(this,"_docContainer");O(this,"getComponent",r=>{if(this._docContainer=r,!r.getContentRef().current)throw new Error("container is not ready")});O(this,"changeLocale",r=>{this._localeService.setLocale(r)});this._config=r,this._localeService=t,this._injector=e}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(r){if(this._docContainer)return r(this._docContainer)}getDocContainer(){return this._docContainer}};he=tt([be(1,I.Inject(a.LocaleService)),be(2,I.Inject(I.Injector))],he);var nt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,rt=(r,t,e,n)=>{for(var i=n>1?void 0:n?it(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&nt(t,e,i),i},Y=(r,t)=>(e,n)=>t(e,n,r);let V=class extends a.RxDisposable{constructor(t,e,n,i,o){super();O(this,"_docContainerController");O(this,"changeLocale",t=>{this._localeService.setLocale(t)});this._localeService=e,this._injector=n,this._textSelectionRenderManager=i,this._layoutService=o,this._docContainerController=this._injector.createInstance(he,t),this._registerContainer()}_registerContainer(){this._layoutService&&this.disposeWithMe(this._layoutService.registerContainerElement(this._textSelectionRenderManager.__getEditorContainer()))}getDocContainerController(){return this._docContainerController}};V=rt([Y(1,I.Inject(a.LocaleService)),Y(2,I.Inject(I.Injector)),Y(3,v.ITextSelectionRenderManager),Y(4,I.Optional(l.ILayoutService))],V);const G="UI_PLUGIN_DOCS",pe=`${G}_COLOR_PICKER_COMPONENT`,Me=`${G}_FONT_FAMILY_COMPONENT`,ye=`${G}_FONT_FAMILY_ITEM_COMPONENT`,Re=`${G}_FONT_SIZE_COMPONENT`;var Ee={exports:{}},K={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ot=Ve,st=Symbol.for("react.element"),at=Symbol.for("react.fragment"),ct=Object.prototype.hasOwnProperty,lt=ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,dt={key:!0,ref:!0,__self:!0,__source:!0};function De(r,e,t){var n,i={},o=null,s=null;t!==void 0&&(o=""+t),e.key!==void 0&&(o=""+e.key),e.ref!==void 0&&(s=e.ref);for(n in e)ct.call(e,n)&&!dt.hasOwnProperty(n)&&(i[n]=e[n]);if(r&&r.defaultProps)for(n in e=r.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:st,type:r,key:o,ref:s,props:i,_owner:lt.current}}K.Fragment=at,K.jsx=De,K.jsxs=De,Ee.exports=K;var ut=Ee.exports;const ht={docsUiCanvasBackground:"univer-docs-ui-canvas-background"},pt=()=>ut.jsx("div",{className:ht.docsUiCanvasBackground});function gt(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatBoldCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.bl;t.next(u===a.BooleanNumber.TRUE)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function _t(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatItalicCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.it;t.next(u===a.BooleanNumber.TRUE)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function St(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatUnderlineCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.ul;t.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function ft(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatStrikethroughCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.st;t.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function mt(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatSubscriptCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.va;t.next(u===a.BaselineOffset.SUBSCRIPT)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function vt(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatSuperscriptCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.va;t.next(u===a.BaselineOffset.SUPERSCRIPT)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function It(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.SELECTOR,label:Me,positions:[l.MenuPosition.TOOLBAR_START],selections:l.FONT_FAMILY_LIST.map(t=>({label:{name:Re,hoverable:!0},value:t.value})),value$:new b.Observable(t=>{const n=l.FONT_FAMILY_LIST[0].value,i=e.onCommandExecuted(o=>{var c;const s=o.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontFamilyCommand.id){const u=U(r);if(u==null)return;const h=(c=u.ts)==null?void 0:c.ff;t.next(h!=null?h:n)}});return t.next(n),i.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Ct(r){const e=r.get(a.ICommandService);return{id:d.SetInlineFormatFontSizeCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:ye,props:{min:1,max:400}},positions:[l.MenuPosition.TOOLBAR_START],selections:l.FONT_SIZE_LIST,value$:new b.Observable(t=>{const i=e.onCommandExecuted(o=>{var c;const s=o.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontSizeCommand.id){const u=U(r);if(u==null)return;const h=(c=u.ts)==null?void 0:c.fs;t.next(h!=null?h:14)}});return t.next(14),i.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Ot(r){const e=r.get(a.ICommandService),t=r.get(a.ThemeService);return{id:d.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON_SELECTOR,positions:[l.MenuPosition.TOOLBAR_START],selections:[{label:{name:pe,hoverable:!1}}],value$:new b.Observable(n=>{const i=t.getCurrentTheme().textColor,o=e.onCommandExecuted(s=>{if(s.id===d.SetInlineFormatTextColorCommand.id){const c=s.params.value;n.next(c!=null?c:i)}});return n.next(i),o.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Tt(r){const e=r.get(a.ICommandService);return{id:d.AlignLeftCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"LeftJustifyingSingle",tooltip:"toolbar.alignLeft",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;t.next(u===a.HorizontalAlign.LEFT)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function bt(r){const e=r.get(a.ICommandService);return{id:d.AlignCenterCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"HorizontallySingle",tooltip:"toolbar.alignCenter",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;t.next(u===a.HorizontalAlign.CENTER)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Mt(r){const e=r.get(a.ICommandService);return{id:d.AlignRightCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"RightJustifyingSingle",tooltip:"toolbar.alignRight",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;t.next(u===a.HorizontalAlign.RIGHT)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Rt(r){const e=r.get(a.ICommandService);return{id:d.AlignJustifyCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"AlignTextBothSingle",tooltip:"toolbar.alignJustify",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(t=>{const n=e.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;t.next(u===a.HorizontalAlign.JUSTIFIED)}});return t.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function yt(r){return{id:d.OrderListCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[l.MenuPosition.TOOLBAR_START],hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Et(r){return{id:d.BulletListCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[l.MenuPosition.TOOLBAR_START],hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Dt(r){return{id:d.ResetInlineFormatTextBackgroundColorCommand.id,type:l.MenuItemType.BUTTON,title:"toolbar.resetColor",icon:"NoColor",positions:d.SetInlineFormatTextBackgroundColorCommand.id}}function Ut(r){const e=r.get(a.ICommandService),t=r.get(a.ThemeService);return{id:d.SetInlineFormatTextBackgroundColorCommand.id,tooltip:"toolbar.fillColor.main",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON_SELECTOR,positions:[l.MenuPosition.TOOLBAR_START],icon:"PaintBucket",selections:[{label:{name:pe,hoverable:!1}}],value$:new b.Observable(n=>{const i=t.getCurrentTheme().primaryColor,o=e.onCommandExecuted(s=>{if(s.id===d.SetInlineFormatTextBackgroundColorCommand.id){const c=s.params.value;n.next(c!=null?c:i)}});return n.next(i),o.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function U(r){var u;const e=r.get(a.IUniverInstanceService),t=r.get(d.TextSelectionManagerService),n=e.getCurrentUniverDocInstance(),i=t.getActiveRange();if(n==null||i==null)return;const o=(u=n.getBody())==null?void 0:u.textRuns;if(o==null)return;const{startOffset:s}=i;return o.find(({st:h,ed:g})=>s>=h&&s<g)}function X(r){var u;const e=r.get(a.IUniverInstanceService),t=r.get(d.TextSelectionManagerService),n=e.getCurrentUniverDocInstance(),i=t.getActiveRange();if(n==null||i==null)return;const o=(u=n.getBody())==null?void 0:u.paragraphs;if(o==null)return;const{startOffset:s}=i;let c=-1;for(const h of o){const{startIndex:g}=h;if(s>c&&s<=g)return h;c=g}return null}var Pt=Object.defineProperty,xt=Object.getOwnPropertyDescriptor,Nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?xt(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Pt(e,t,i),i},N=(r,e)=>(t,n)=>e(t,n,r);let q=class extends a.Disposable{constructor(r,e,t,n,i,o,s){super(),this._injector=r,this._componentManager=e,this._layoutService=t,this._editorService=n,this._menuService=i,this._uiController=o,this._univerInstanceService=s,this._init()}_initCustomComponents(){const r=this._componentManager;this.disposeWithMe(r.register(pe,We.ColorPicker)),this.disposeWithMe(r.register(Me,l.FontFamily)),this.disposeWithMe(r.register(Re,l.FontFamilyItem)),this.disposeWithMe(r.register(ye,l.FontSize))}_initMenus(){[gt,_t,St,ft,mt,vt,Ct,It,Ot,Tt,bt,Mt,Rt,yt,Et,Dt,Ut].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r)))})}_init(){this._initCustomComponents(),this._initMenus(),this._initDocBackground(),this._initFocusHandler()}_initDocBackground(){const r=this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_DOC)[0].getUnitId();if(r==null)return;this._editorService.isEditor(r)||this.disposeWithMe(this._uiController.registerComponent(l.DesktopUIPart.CONTENT,()=>je.connectInjector(pt,this._injector)))}_initFocusHandler(){this.disposeWithMe(this._layoutService.registerFocusHandler(a.UniverInstanceType.UNIVER_DOC,()=>{this._injector.get(m.ITextSelectionRenderManager).focus()}))}};q=Nt([a.OnLifecycle(a.LifecycleStages.Rendered,q),N(0,I.Inject(I.Injector)),N(1,I.Inject(l.ComponentManager)),N(2,l.ILayoutService),N(3,l.IEditorService),N(4,l.IMenuService),N(5,l.IUIController),N(6,a.IUniverInstanceService)],q);const Lt={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",underline:"Underline",textColor:{main:"Text color",right:"Choose color"},fillColor:{main:"Text Background color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Justify"}},Ue={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},fillColor:{main:"文本背景色",right:"背景色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表",alignLeft:"左对齐",alignCenter:"居中对齐",alignRight:"右对齐",alignJustify:"两端对齐"}},At={id:d.BreakLineCommand.id,preconditions:He,binding:l.KeyCode.ENTER},Bt={id:d.DeleteLeftCommand.id,preconditions:D,binding:l.KeyCode.BACKSPACE},Ft={id:d.DeleteRightCommand.id,preconditions:D,binding:l.KeyCode.DELETE},$t=10,wt=6;function jt(){return a.Tools.generateRandomId(wt)}function Vt(r){const e=r.match(/data-copy-id="([^\s]+)"/);return e&&e[1]?e[1]:null}class Wt{constructor(){T(this,"_cache",new a.LRUMap($t))}set(e,t){this._cache.set(e,t)}get(e){return this._cache.get(e)}clear(){this._cache.clear()}}const Pe=new Wt;function ge(r){const e=r.style,t={},n=r.tagName.toLowerCase();switch(n){case"b":case"em":case"strong":{t.bl=a.BooleanNumber.TRUE;break}case"s":{t.st={s:a.BooleanNumber.TRUE};break}case"u":{t.ul={s:a.BooleanNumber.TRUE};break}case"i":{t.it=a.BooleanNumber.TRUE;break}case"sub":case"sup":{t.va=n==="sup"?a.BaselineOffset.SUPERSCRIPT:a.BaselineOffset.SUBSCRIPT;break}}for(let i=0;i<e.length;i++){const o=e[i],s=e.getPropertyValue(o);switch(o){case"font-family":{t.ff=s;break}case"font-size":{const c=Number.parseInt(s);Number.isNaN(c)||(s.endsWith("pt")?t.fs=c:s.endsWith("px")&&(t.fs=m.pixelToPt(c)));break}case"font-style":{s==="italic"&&(t.it=a.BooleanNumber.TRUE);break}case"font-weight":{Number(s)>400&&(t.bl=a.BooleanNumber.TRUE);break}case"text-decoration":{/underline/.test(s)?t.ul={s:a.BooleanNumber.TRUE}:/overline/.test(s)?t.ol={s:a.BooleanNumber.TRUE}:/line-through/.test(s)&&(t.st={s:a.BooleanNumber.TRUE});break}case"color":{const c=new a.ColorKit(s);c.isValid&&(t.cl={rgb:c.toRgbString()});break}case"background-color":{const c=new a.ColorKit(s);c.isValid&&(t.bg={rgb:c.toRgbString()});break}}}return t}function Ht(r){const e=new DOMParser,t=`<x-univer id="univer-root">${r}</x-univer>`;return e.parseFromString(t,"text/html").querySelector("#univer-root")}function xe(r,e){const t=r.tagName.toLowerCase();return typeof e=="string"?t===e:Array.isArray(e)?e.some(n=>n===t):e(r)}const ce=class ce{constructor(){T(this,"_styleCache",new Map);T(this,"_styleRules",[]);T(this,"_afterProcessRules",[])}static use(e){if(this._pluginList.includes(e))throw new Error(`Univer paste plugin ${e.name} already added`);this._pluginList.push(e)}convert(e){const t=ce._pluginList.find(o=>o.checkPasteType(e)),n=Ht(e),i={dataStream:"",textRuns:[]};return t&&(this._styleRules=[...t.stylesRules],this._afterProcessRules=[...t.afterProcessRules]),this._styleCache.clear(),this._process(null,n==null?void 0:n.childNodes,i),this._styleCache.clear(),this._styleRules=[],this._afterProcessRules=[],i}_process(e,t,n){var i;for(const o of t)if(o.nodeType===Node.TEXT_NODE){const s=(i=o.nodeValue)==null?void 0:i.replace(/[\r\n]/g,"");let c;e&&this._styleCache.has(e)&&(c=this._styleCache.get(e)),n.dataStream+=s,c&&Object.getOwnPropertyNames(c).length&&n.textRuns.push({st:n.dataStream.length-s.length,ed:n.dataStream.length,ts:c})}else if(o.nodeType===Node.ELEMENT_NODE){const s=e?this._styleCache.get(e):{},c=this._styleRules.find(({filter:S})=>xe(o,S)),u=c?c.getStyle(o):ge(o);this._styleCache.set(o,{...s,...u});const{childNodes:h}=o;this._process(o,h,n);const g=this._afterProcessRules.find(({filter:S})=>xe(o,S));g&&g.handler(n,o)}}};T(ce,"_pluginList",[]);let A=ce;const Ne={name:"univer-doc-paste-plugin-lark",checkPasteType(r){return/lark-record-clipboard/i.test(r)},stylesRules:[{filter:["s"],getStyle(r){const e=ge(r);return{st:{s:a.BooleanNumber.TRUE},...e}}}],afterProcessRules:[{filter(r){return r.tagName==="DIV"&&/ace-line/i.test(r.className)},handler(r){r.paragraphs==null&&(r.paragraphs=[]),r.paragraphs.push({startIndex:r.dataStream.length}),r.dataStream+="\r"}}]};function Le(r){const e=r.style,t={};for(let n=0;n<e.length;n++){const i=e[n],o=e.getPropertyValue(i);switch(i){case"margin-top":{const s=Number.parseInt(o);t.spaceAbove=/pt/.test(o)?m.ptToPixel(s):s;break}case"margin-bottom":{const s=Number.parseInt(o);t.spaceBelow=/pt/.test(o)?m.ptToPixel(s):s;break}case"line-height":{const s=Number.parseFloat(o);t.lineSpacing=s;break}}}return Object.getOwnPropertyNames(t).length?t:null}const Ae={name:"univer-doc-paste-plugin-word",checkPasteType(r){return/word|mso/i.test(r)},stylesRules:[{filter:["b"],getStyle(r){const e=ge(r);return{bl:a.BooleanNumber.TRUE,...e}}}],afterProcessRules:[{filter(r){return r.tagName==="P"&&/mso/i.test(r.className)},handler(r,e){r.paragraphs==null&&(r.paragraphs=[]);const t={startIndex:r.dataStream.length},n=Le(e);n&&(t.paragraphStyle=n),r.paragraphs.push(t),r.dataStream+="\r"}}]},Be={name:"univer-doc-paste-plugin-univer",checkPasteType(r){return/UniverNormal/i.test(r)},stylesRules:[],afterProcessRules:[{filter(r){return r.tagName==="P"&&/UniverNormal/i.test(r.className)},handler(r,e){r.paragraphs==null&&(r.paragraphs=[]);const t={startIndex:r.dataStream.length},n=Le(e);n&&(t.paragraphStyle=n),r.paragraphs.push(t),r.dataStream+="\r"}}]};function Fe(r,e){const{st:t,ed:n,ts:i={}}=e,{ff:o,fs:s,it:c,bl:u,ul:h,st:g,ol:S,bg:O,cl:v,va:C}=i;let p=r.slice(t,n);const f=[];return c===a.BooleanNumber.TRUE&&(p=`<i>${p}</i>`),C===a.BaselineOffset.SUPERSCRIPT?p=`<sup>${p}</sup>`:C===a.BaselineOffset.SUBSCRIPT&&(p=`<sub>${p}</sub>`),(h==null?void 0:h.s)===a.BooleanNumber.TRUE&&(p=`<u>${p}</u>`),(g==null?void 0:g.s)===a.BooleanNumber.TRUE&&(p=`<s>${p}</s>`),u===a.BooleanNumber.TRUE&&(p=`<strong>${p}</strong>`),o&&f.push(`font-family: ${o}`),v&&f.push(`color: ${v.rgb}`),s&&f.push(`font-size: ${s}pt`),S&&f.push("text-decoration: overline"),O&&f.push(`background: ${O.rgb}`),f.length?`<span style="${f.join("; ")};">${p}</span>`:p}function _e(r,e,t){const{dataStream:n,textRuns:i=[]}=r;let o=e;const s=[];for(const c of i){const{st:u,ed:h}=c;a.Tools.hasIntersectionBetweenTwoRanges(e,t,u,h)&&(u>o?(s.push(n.slice(o,u)),s.push(Fe(n,{...c,ed:Math.min(h,t)}))):s.push(Fe(n,{...c,st:o,ed:Math.min(h,t)}))),o=Math.max(e,Math.min(h,t))}return o!==t&&s.push(n.slice(o,t)),s.join("")}function $e(r,e=!0){var t;if(e&&((t=r.paragraphs)!=null&&t.length)){const{dataStream:n,paragraphs:i=[]}=r;let o="",s=-1;for(const c of i){const{startIndex:u,paragraphStyle:h={}}=c,{spaceAbove:g,spaceBelow:S,lineSpacing:O}=h,v=[];g!=null&&(typeof g=="number"?v.push(`margin-top: ${g}px`):v.push(`margin-top: ${g.v}px`)),S!=null&&(typeof S=="number"?v.push(`margin-bottom: ${S}px`):v.push(`margin-bottom: ${S.v}px`)),O!=null&&v.push(`line-height: ${O}`),u>s+1?o+=`<p class="UniverNormal" ${v.length?`style="${v.join("; ")};"`:""}>${_e(r,s+1,u)}</p>`:o+=`<p class="UniverNormal" ${v.length?`style="${v.join("; ")};"`:""}></p>`,s=u}return s!==n.length&&(o+=_e(r,s,n.length)),o}else return _e(r,0,r.dataStream.length)}class kt{convert(e){if(e.length===0)throw new Error("The bodyList length at least to be 1");if(e.length===1)return $e(e[0]);let t="";for(const n of e)t+='<p className="UniverNormal">',t+=$e(n,!1),t+="</p>";return t}}var zt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Gt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Yt(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&zt(e,t,i),i},W=(r,e)=>(t,n)=>e(t,n,r);A.use(Ae),A.use(Ne),A.use(Be);function Kt(r){const e=r.replace(/\n/g,"\r"),t=[];for(let n=0;n<e.length;n++)e[n]==="\r"&&t.push({startIndex:n});return{dataStream:e,paragraphs:t}}const H=I.createIdentifier("doc.clipboard-service");let Se=class extends a.Disposable{constructor(e,t,n,i,o){super();T(this,"_clipboardHooks",[]);T(this,"_htmlToUDM",new A);T(this,"_umdToHtml",new kt);this._univerInstanceService=e,this._logService=t,this._commandService=n,this._clipboardInterfaceService=i,this._textSelectionManagerService=o}async copy(){const e=this._getDocumentBodyInRanges();if(e.length===0)return!1;try{this._setClipboardData(e)}catch(t){return this._logService.error("[DocClipboardService] copy failed",t),!1}return!0}async cut(){return this._cut()}async paste(e){const t=await this._generateBodyFromClipboardItems(e);return this._paste(t)}async legacyPaste(e,t){const n=this._generateBodyFromHtmlAndText(e,t);return this._paste(n)}async _cut(){var o;const{segmentId:e,endOffset:t,style:n}=(o=this._textSelectionManagerService.getActiveRange())!=null?o:{},i=this._textSelectionManagerService.getSelections();if(e==null&&this._logService.error("[DocClipboardController] segmentId is not existed"),t==null||i==null)return!1;this.copy();try{let s=t;for(const u of i){const{startOffset:h,endOffset:g}=u;h==null||g==null||g<=t&&(s-=g-h)}const c=[{startOffset:s,endOffset:s,style:n}];return this._commandService.executeCommand(d.CutContentCommand.id,{segmentId:e,textRanges:c})}catch{return this._logService.error("[DocClipboardController] cut content failed"),!1}}async _paste(e){var s;const{segmentId:t,endOffset:n,style:i}=(s=this._textSelectionManagerService.getActiveRange())!=null?s:{},o=this._textSelectionManagerService.getSelections();if(t==null&&this._logService.error("[DocClipboardController] segmentId does not exist!"),n==null||o==null)return!1;try{let c=n;for(const h of o){const{startOffset:g,endOffset:S}=h;g==null||S==null||S<=n&&(c+=e.dataStream.length-(S-g))}const u=[{startOffset:c,endOffset:c,style:i}];return this._commandService.executeCommand(d.InnerPasteCommand.id,{body:e,segmentId:t,textRanges:u})}catch{return this._logService.error("[DocClipboardController]","clipboard is empty."),!1}}async _setClipboardData(e){const t=jt(),n=e.length>1?e.map(o=>o.dataStream).join(`
10
- `):e[0].dataStream;let i=this._umdToHtml.convert(e);return e.length===1&&(i=i.replace(/(<[a-z]+)/,(o,s)=>`${s} data-copy-id="${t}"`),Pe.set(t,e[0])),this._clipboardInterfaceService.write(n,i)}addClipboardHook(e){return this._clipboardHooks.push(e),a.toDisposable(()=>{const t=this._clipboardHooks.indexOf(e);t>-1&&this._clipboardHooks.splice(t,1)})}_getDocumentBodyInRanges(){const e=this._textSelectionManagerService.getSelections(),t=this._univerInstanceService.getCurrentUniverDocInstance(),n=[];if(e==null||!t)return n;for(const i of e){const{startOffset:o,endOffset:s,collapsed:c}=i;if(c||o==null||s==null)continue;const u=t.sliceBody(o,s);u!=null&&n.push(u)}return n}async _generateBodyFromClipboardItems(e){try{let t="",n="";for(const i of e)for(const o of i.types)o===l.PLAIN_TEXT_CLIPBOARD_MIME_TYPE?n=await i.getType(o).then(s=>s&&s.text()):o===l.HTML_CLIPBOARD_MIME_TYPE&&(t=await i.getType(o).then(s=>s&&s.text()));return this._generateBodyFromHtmlAndText(t,n)}catch(t){return Promise.reject(t)}}_generateBodyFromHtmlAndText(e,t){if(!e){if(t)return Kt(t);throw new Error("[DocClipboardService] html and text cannot be both empty!")}const n=Vt(e);if(n){const i=Pe.get(n);if(i)return i}return this._htmlToUDM.convert(e)}};Se=Gt([W(0,a.IUniverInstanceService),W(1,a.ILogService),W(2,a.ICommandService),W(3,l.IClipboardInterfaceService),W(4,I.Inject(d.TextSelectionManagerService))],Se);function Z(r){return r.getContextValue(a.FOCUSING_DOC)||r.getContextValue(a.EDITOR_ACTIVATED)}const fe=999,Xt={id:l.CopyCommand.id,name:"doc.command.copy",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>r.get(H).copy()},qt={id:l.CutCommand.id,name:"doc.command.cut",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>r.get(H).cut()},Zt={id:l.PasteCommand.id,name:"doc.command.paste",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>{const e=r.get(H),n=await r.get(l.IClipboardInterfaceService).read();return n.length===0?!1:e.paste(n)}};var Jt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,en=(r,e,t,n)=>{for(var i=n>1?void 0:n?Qt(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Jt(e,t,i),i},k=(r,e)=>(t,n)=>e(t,n,r);let J=class extends a.RxDisposable{constructor(r,e,t,n,i){super(),this._commandService=r,this._clipboardInterfaceService=e,this._docClipboardService=t,this._textSelectionRenderManager=n,this._contextService=i,this._init()}_init(){[Xt,qt,Zt].forEach(r=>this.disposeWithMe(this._commandService.registerMultipleCommand(r))),[d.InnerPasteCommand,d.CutContentCommand].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._initLegacyPasteCommand()}_initLegacyPasteCommand(){var r;(r=this._textSelectionRenderManager)==null||r.onPaste$.pipe(b.takeUntil(this.dispose$)).subscribe(e=>{var o,s;if(!Z(this._contextService))return;e.event.preventDefault();const t=e.event,n=(o=t.clipboardData)==null?void 0:o.getData("text/html"),i=(s=t.clipboardData)==null?void 0:s.getData("text/plain");this._docClipboardService.legacyPaste(n,i)})}};J=en([a.OnLifecycle(a.LifecycleStages.Rendered,J),k(0,a.ICommandService),k(1,l.IClipboardInterfaceService),k(2,H),k(3,m.ITextSelectionRenderManager),k(4,a.IContextService)],J);var tn=Object.defineProperty,nn=Object.getOwnPropertyDescriptor,rn=(r,e,t,n)=>{for(var i=n>1?void 0:n?nn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&tn(e,t,i),i},B=(r,e)=>(t,n)=>e(t,n,r);let Q=class extends a.Disposable{constructor(e,t,n,i,o,s){super();T(this,"_initialEditors",new Set);this._univerInstanceService=e,this._docSkeletonManagerService=t,this._editorService=n,this._commandService=i,this._textSelectionRenderManager=o,this._renderManagerService=s,this._initialize()}_initialize(){this.disposeWithMe(this._editorService.resize$.subscribe(e=>{this._resize(e)})),this._editorService.getAllEditor().forEach(e=>{const t=e.editorUnitId;this._initialEditors.has(t)||(this._initialEditors.add(t),this._resize(t))}),this._commandExecutedListener(),this._initialSetValue(),this._initialBlur(),this._initialFocus(),this._initialValueChange()}_resize(e){var E,P,x;if(e==null)return;const t=this._editorService.getEditor(e);if((t==null?void 0:t.cancelDefaultResizeListener)===!0)return;const n=(E=this._docSkeletonManagerService.getSkeletonByUnitId(e))==null?void 0:E.skeleton,i=this._univerInstanceService.getUniverDocInstance(e);if(t==null||t.render==null||n==null||i==null)return;n.calculate();const{marginTop:o=0,marginBottom:s=0,marginLeft:c=0,marginRight:u=0}=i.getSnapshot().documentStyle,{scene:h,mainComponent:g}=t.render;let{actualHeight:S,actualWidth:O}=n.getActualSize();S+=o+s,O+=c+u;const{width:v,height:C}=t.getBoundingClientRect(),p=h.getViewport(d.VIEWPORT_KEY.VIEW_MAIN);let f=p==null?void 0:p.getScrollBar();const M=Math.max(O,v),R=Math.max(S,C);h.transformByState({width:M,height:R}),g==null||g.resize(M,R),t.isSingle()?O>v?f==null?p&&new m.ScrollBar(p,{barSize:8,enableVertical:!1}):p==null||p.resetSizeAndScrollBar():(f=null,p==null||p.scrollTo({x:0,y:0}),(x=p==null?void 0:p.getScrollBar())==null||x.dispose()):S>C?f==null?p&&new m.ScrollBar(p,{enableHorizontal:!1,barSize:8}):p==null||p.resetSizeAndScrollBar():(f=null,p==null||p.scrollTo({x:0,y:0}),(P=p==null?void 0:p.getScrollBar())==null||P.dispose())}_initialSetValue(){this.disposeWithMe(this._editorService.setValue$.subscribe(e=>{this._commandService.executeCommand(d.CoverContentCommand.id,{unitId:e.editorUnitId,body:e.body,segmentId:null})}))}_initialBlur(){this.disposeWithMe(this._editorService.blur$.subscribe(()=>{this._textSelectionRenderManager.removeAllTextRanges(),this._textSelectionRenderManager.blur()})),this.disposeWithMe(this._textSelectionRenderManager.onBlur$.subscribe(()=>{var i;const e=(i=this._univerInstanceService.getCurrentUniverDocInstance())==null?void 0:i.getUnitId();if(e==null)return;const t=this._editorService.getEditor(e),n=this._editorService.getFocusEditor();t==null||t.isSheetEditor()||n&&n.editorUnitId===e||this._editorService.blur()}))}_initialFocus(){this.disposeWithMe(this._editorService.focus$.subscribe(n=>{this._textSelectionRenderManager.removeAllTextRanges(),this._textSelectionRenderManager.addTextRanges([n])}));const e=["univer-formula-search","univer-formula-help","formula-help-decorator","univer-formula-help-param"];this.disposeWithMe(b.fromEvent(window,"mousedown").subscribe(n=>{const o=n.target.classList[0]||"";if(a.checkForSubstrings(o,e)){this._editorService.changeSpreadsheetFocusState(!0),n.stopPropagation();return}this._editorService.changeSpreadsheetFocusState(!1)})),this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SHEET).forEach(n=>{const i=n.getUnitId(),o=this._renderManagerService.getRenderById(i),s=o==null?void 0:o.engine.getCanvas().getCanvasEle();s!=null&&b.fromEvent(s,"mousedown").subscribe(c=>{this._editorService.changeSpreadsheetFocusState(!0),c.stopPropagation()})})}_initialValueChange(){this.disposeWithMe(this._textSelectionRenderManager.onCompositionupdate$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onInput$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onKeydown$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onPaste$.subscribe(this._valueChange.bind(this)))}_valueChange(){var n;const e=(n=this._univerInstanceService.getCurrentUniverDocInstance())==null?void 0:n.getUnitId();if(e==null)return;const t=this._editorService.getEditor(e);t==null||t.isSheetEditor()||this._editorService.refreshValueChange(e)}_commandExecutedListener(){const e=[d.RichTextEditingMutation.id,l.SetEditorResizeOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(e.includes(t.id)){const n=t.params,{unitId:i}=n;if(this._editorService.isSheetEditor(i))return;this._resize(i),this._valueChange()}}))}};Q=rn([a.OnLifecycle(a.LifecycleStages.Rendered,Q),B(0,a.IUniverInstanceService),B(1,I.Inject(d.DocSkeletonManagerService)),B(2,l.IEditorService),B(3,a.ICommandService),B(4,m.ITextSelectionRenderManager),B(5,m.IRenderManagerService)],Q);var on=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,an=(r,e,t,n)=>{for(var i=n>1?void 0:n?sn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&on(e,t,i),i},ee=(r,e)=>(t,n)=>e(t,n,r);let te=class extends a.RxDisposable{constructor(e,t,n,i){super();T(this,"_docRenderMap",new Set);this._docSkeletonManagerService=e,this._renderManagerService=t,this._commandService=n,this._editorService=i,this._initialRenderRefresh(),this._commandExecutedListener()}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeletonBefore$.pipe(b.takeUntil(this.dispose$)).subscribe(e=>{this._create(e)})}_create(e){if(e==null)return;const{skeleton:t,unitId:n}=e;let i=this._renderManagerService.getRenderById(n);i==null&&(this._renderManagerService.create(n),i=this._renderManagerService.getRenderById(n));const{mainComponent:o}=i;o.changeSkeleton(t),this._recalculateSizeBySkeleton(i,t)}_recalculateSizeBySkeleton(e,t){var g;const{mainComponent:n,scene:i,unitId:o}=e,s=n,c=(g=t.getSkeletonData())==null?void 0:g.pages;if(c==null)return;let u=0,h=0;for(let S=0,O=c.length;S<O;S++){const v=c[S],{pageWidth:C,pageHeight:p}=v;s.pageLayoutType===m.PageLayoutType.VERTICAL?(h+=p,h+=s.pageMarginTop,S===O-1&&(h+=s.pageMarginTop),u=Math.max(u,C)):s.pageLayoutType===m.PageLayoutType.HORIZONTAL&&(u+=C,S!==O-1&&(u+=s.pageMarginLeft),h=Math.max(h,p))}s.resize(u,h),this._editorService.isEditor(o)||i.resize(u,h)}_commandExecutedListener(){const e=[d.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var n;if(e.includes(t.id)){const i=t.params,{unitId:o}=i,s=this._docSkeletonManagerService.getSkeletonByUnitId(o);if(s==null)return;const{skeleton:c}=s,u=this._renderManagerService.getRenderById(o);if(u==null||!!c.getViewModel().getDataModel().getSnapshot().disabled)return;if(c.calculate(),this._editorService.isEditor(o)){(n=u.mainComponent)==null||n.makeDirty();return}this._recalculateSizeBySkeleton(u,c)}}))}};te=an([a.OnLifecycle(a.LifecycleStages.Rendered,te),ee(0,I.Inject(d.DocSkeletonManagerService)),ee(1,m.IRenderManagerService),ee(2,a.ICommandService),ee(3,l.IEditorService)],te);var cn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,dn=(r,e,t,n)=>{for(var i=n>1?void 0:n?ln(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&cn(e,t,i),i},ne=(r,e)=>(t,n)=>e(t,n,r);_.DocCanvasView=class extends a.RxDisposable{constructor(t,n,i,o){super();T(this,"_scene");T(this,"_currentDocumentModel");T(this,"_fps$",new b.BehaviorSubject(""));T(this,"fps$",this._fps$.asObservable());this._renderManagerService=t,this._configService=n,this._univerInstanceService=i,this._editorService=o,this._initialize()}_initialize(){this._renderManagerService.createRender$.pipe(b.takeUntil(this.dispose$)).subscribe(t=>{this._create(t)}),this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_DOC).pipe(b.takeUntil(this.dispose$)).subscribe(t=>{this._create(t==null?void 0:t.getUnitId())}),this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_DOC).forEach(t=>{this._create(t.getUnitId())})}dispose(){this._fps$.complete()}_create(t){if(t==null)return;const n=this._univerInstanceService.getUniverDocInstance(t);n!=null&&(this._currentDocumentModel=n,this._renderManagerService.has(t)||this._addNewRender())}_addNewRender(){const t=this._currentDocumentModel,n=t.getUnitId(),i=t.getContainer(),o=t.getParentRenderUnitId();if(i!=null&&o!=null)throw new Error("container or parentRenderUnitId can only exist one");i==null&&o!=null?this._renderManagerService.createRenderWithParent(n,o):this._renderManagerService.createRender(n);const s=this._renderManagerService.getRenderById(n);if(s==null)return;const{scene:c,engine:u}=s;c.openTransformer(),this._scene=c;const h=new m.Viewport(d.VIEWPORT_KEY.VIEW_MAIN,c,{left:0,top:0,bottom:0,right:0,isWheelPreventDefaultX:!0});c.attachControl(),c.on(m.EVENT_TYPE.wheel,(O,v)=>{const C=O;if(C.ctrlKey){const p=Math.abs(C.deltaX);let f=p<40?.2:p<80?.4:.2;f*=C.deltaY>0?-1:1,c.scaleX<1&&(f/=2),c.scaleX+f>4?c.scale(4,4):c.scaleX+f<.1?c.scale(.1,.1):C.preventDefault()}else h.onMouseWheel(C,v)}),this._configService.getConfig("hasScroll")!==!1&&new m.ScrollBar(h),c.addLayer(new m.Layer(c,[],d.DOCS_COMPONENT_MAIN_LAYER_INDEX),new m.Layer(c,[],d.DOCS_COMPONENT_HEADER_LAYER_INDEX)),this._addComponent(s),this._currentDocumentModel.getShouldRenderLoopImmediately()&&u.runRenderLoop(()=>{c.render(),this._fps$.next(Math.round(u.getFps()).toString())}),this._renderManagerService.setCurrent(n)}_addComponent(t){const n=this._scene,i=this._currentDocumentModel,o=new m.Documents(d.DOCS_VIEW_KEY.MAIN,void 0,{pageMarginLeft:i.documentStyle.marginLeft||0,pageMarginTop:i.documentStyle.marginTop||0});o.zIndex=d.DOCS_COMPONENT_DEFAULT_Z_INDEX,t.mainComponent=o,t.components.set(d.DOCS_VIEW_KEY.MAIN,o),n.addObjects([o],d.DOCS_COMPONENT_MAIN_LAYER_INDEX),this._editorService.getEditor(i.getUnitId())==null&&n.enableLayerCache(d.DOCS_COMPONENT_MAIN_LAYER_INDEX)}},_.DocCanvasView=dn([a.OnLifecycle(a.LifecycleStages.Starting,_.DocCanvasView),ne(0,m.IRenderManagerService),ne(1,a.IConfigService),ne(2,a.IUniverInstanceService),ne(3,l.IEditorService)],_.DocCanvasView);var un=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,pn=(r,e,t,n)=>{for(var i=n>1?void 0:n?hn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&un(e,t,i),i},F=(r,e)=>(t,n)=>e(t,n,r);let ie=class extends a.Disposable{constructor(e,t,n,i,o,s){super();T(this,"_liquid",new m.Liquid);T(this,"_pageMarginCache",new Map);this._docSkeletonManagerService=e,this._univerInstanceService=t,this._renderManagerService=n,this._commandService=i,this._floatingObjectManagerService=o,this._editorService=s,this._initialize(),this._commandExecutedListener()}_initialize(){this._initialRenderRefresh(),this._updateOnPluginChange()}_updateOnPluginChange(){this._floatingObjectManagerService.pluginUpdate$.subscribe(e=>{const t=this._docSkeletonManagerService.getCurrent();if(t==null)return;const{unitId:n,skeleton:i}=t,o=this._renderManagerService.getRenderById(n);if(o==null)return;const{mainComponent:s,components:c,scene:u}=o,h=s,{left:g,top:S}=h;e.forEach(O=>{const{unitId:v,subUnitId:C,floatingObjectId:p,floatingObject:f}=O,{left:M=0,top:R=0,width:E=0,height:P=0,angle:x,flipX:w,flipY:j,skewX:de,skewY:ue}=f,y=this._pageMarginCache.get(p),Pn=(y==null?void 0:y.marginLeft)||0,xn=(y==null?void 0:y.marginTop)||0;i==null||i.getViewModel().getDataModel().updateDrawing(p,{left:M-g-Pn,top:R-S-xn,height:P,width:E})}),i==null||i.calculate(),s==null||s.makeDirty()})}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeleton$.subscribe(e=>{if(e==null)return;const{skeleton:t,unitId:n}=e,i=this._renderManagerService.getRenderById(n);if(i==null)return;const{mainComponent:o}=i;o.changeSkeleton(t),this._refreshFloatingObject(n,t,i)})}_commandExecutedListener(){const e=[d.RichTextEditingMutation.id,d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var n;if(e.includes(t.id)){const i=t.params,{unitId:o}=i,s=this._docSkeletonManagerService.getCurrent();if(s==null)return;const{unitId:c,skeleton:u}=s;if(o!==c)return;const h=this._renderManagerService.getRenderById(c);if(h==null)return;if(this._editorService.isEditor(c)){(n=h.mainComponent)==null||n.makeDirty();return}this._refreshFloatingObject(c,u,h)}}))}_refreshFloatingObject(e,t,n){const i=t==null?void 0:t.getSkeletonData(),{mainComponent:o,scene:s}=n,c=o;if(!i)return;const{left:u,top:h,pageLayoutType:g,pageMarginLeft:S,pageMarginTop:O}=c,{pages:v}=i,C=[];s.getAncestorScale(),this._liquid.reset(),this._pageMarginCache.clear();for(let p=0,f=v.length;p<f;p++){const M=v[p],{skeDrawings:R,marginLeft:E,marginTop:P}=M;this._liquid.translatePagePadding(M),R.forEach(x=>{const{aLeft:w,aTop:j,height:de,width:ue,objectId:y}=x;C.push({unitId:e,subUnitId:a.DEFAULT_DOCUMENT_SUB_COMPONENT_ID,floatingObjectId:y,floatingObject:{left:w+u+this._liquid.x,top:j+h+this._liquid.y,width:ue,height:de}}),this._pageMarginCache.set(y,{marginLeft:this._liquid.x,marginTop:this._liquid.y})}),this._liquid.translatePage(M,g,S,O)}this._floatingObjectManagerService.BatchAddOrUpdate(C)}};ie=pn([a.OnLifecycle(a.LifecycleStages.Steady,ie),F(0,I.Inject(d.DocSkeletonManagerService)),F(1,a.IUniverInstanceService),F(2,m.IRenderManagerService),F(3,a.ICommandService),F(4,a.IFloatingObjectManagerService),F(5,l.IEditorService)],ie);var gn=Object.defineProperty,_n=Object.getOwnPropertyDescriptor,Sn=(r,e,t,n)=>{for(var i=n>1?void 0:n?_n(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&gn(e,t,i),i},me=(r,e)=>(t,n)=>e(t,n,r);const fn="rgba(198, 198, 198, 1)",mn="rgba(255, 255, 255, 1)";let re=class extends a.Disposable{constructor(r,e,t){super(),this._renderManagerService=r,this._editorService=e,this._univerInstanceService=t,this._initialize(),this._commandExecutedListener()}_initialize(){this._initialRenderRefresh()}_initialRenderRefresh(){this._renderManagerService.currentRender$.subscribe(r=>{var o;if(r==null)return;const e=this._renderManagerService.getRenderById(r);if(this._editorService.isEditor(r)||this._univerInstanceService.getUniverDocInstance(r)==null||e==null)return;const{mainComponent:t}=e,n=t,i=(o=n.getSkeleton())==null?void 0:o.getPageSize();this.disposeWithMe(a.toDisposable(n.onPageRenderObservable.add(s=>{var f,M,R,E;if(this._editorService.isEditor(r))return;const{page:c,pageLeft:u,pageTop:h,ctx:g}=s,{width:S,pageWidth:O,height:v,pageHeight:C}=c;g.save(),g.translate(u-.5,h-.5);const p={width:(M=(f=i==null?void 0:i.width)!=null?f:O)!=null?M:S,height:(E=(R=i==null?void 0:i.height)!=null?R:C)!=null?E:v,strokeWidth:1,stroke:fn,fill:mn,zIndex:3};m.Rect.drawWith(g,p),g.restore()})))})}_commandExecutedListener(){}};re=Sn([a.OnLifecycle(a.LifecycleStages.Rendered,re),me(0,m.IRenderManagerService),me(1,l.IEditorService),me(2,a.IUniverInstanceService)],re);var vn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,Cn=(r,e,t,n)=>{for(var i=n>1?void 0:n?In(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&vn(e,t,i),i},$=(r,e)=>(t,n)=>e(t,n,r);let oe=class extends a.Disposable{constructor(e,t,n,i,o,s){super();T(this,"_initializedRender",new Set);this._docSkeletonManagerService=e,this._univerInstanceService=t,this._commandService=n,this._renderManagerService=i,this._textSelectionManagerService=o,this._editorService=s,this._initialize()}dispose(){super.dispose()}_initialize(){this._skeletonListener(),this._commandExecutedListener(),this._initialRenderRefresh()}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeleton$.subscribe(e=>{if(e==null)return;const{unitId:t}=e,n=this._renderManagerService.getRenderById(t);if(n==null||this._initializedRender.has(t)||this._editorService.isEditor(t))return;this._initializedRender.add(t);const{scene:i}=n;this.disposeWithMe(a.toDisposable(i.onMouseWheelObserver.add(o=>{if(!o.ctrlKey)return;const s=this._univerInstanceService.getCurrentUniverDocInstance();if(!s)return;const c=Math.abs(o.deltaX);let u=c<40?.2:c<80?.4:.2;u*=o.deltaY>0?-1:1,i.scaleX<1&&(u/=2);const h=s.zoomRatio;let g=+Number.parseFloat(`${h+u}`).toFixed(1);g=g>=4?4:g<=.1?.1:g,this._commandService.executeCommand(d.SetDocZoomRatioCommand.id,{zoomRatio:g,unitId:s.getUnitId()}),o.preventDefault()})))})}_skeletonListener(){this.disposeWithMe(a.toDisposable(this._docSkeletonManagerService.currentSkeleton$.subscribe(e=>{if(e==null)return;const t=this._univerInstanceService.getCurrentUniverDocInstance();if(!t)return;const n=t.zoomRatio||1;this._updateViewZoom(n,!1)})))}_commandExecutedListener(){const e=[d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{if(e.includes(t.id)){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(!n)return;const i=t.params,{unitId:o}=i;if(o!==n.getUnitId())return;const s=n.zoomRatio||1;this._updateViewZoom(s)}}))}_updateViewZoom(e,t=!0){var i;const n=this._getDocObject();n!=null&&(n.scene.scale(e,e),this._calculatePagePosition(n,e),t&&this._textSelectionManagerService.refreshSelection(),(i=n.scene.getTransformer())==null||i.hideControl())}_calculatePagePosition(e,t){const{document:n,scene:i}=e,o=i==null?void 0:i.getParent(),{width:s,height:c,pageMarginLeft:u,pageMarginTop:h}=n;if(o==null||s===Number.POSITIVE_INFINITY||c===Number.POSITIVE_INFINITY)return;const{width:g,height:S}=o;let O=0,v=0,C=0,p=0,f=Number.POSITIVE_INFINITY;g>(s+u*2)*t?(O=g/2-s*t/2,O/=t,C=(g-u*2)/t,f=0):(O=u,C=s+u*2,f=(C-g/t)/2),S>c?(v=S/2-c/2,p=(S-h*2)/t):(v=h,p=c+h*2),i.resize(C,p+200),n.translate(O,v);const M=i.getViewport(d.VIEWPORT_KEY.VIEW_MAIN);if(f!==Number.POSITIVE_INFINITY&&M!=null){const R=M.getBarScroll(f,0).x;M.scrollTo({x:R})}return this}_getDocObject(){return d.getDocObject(this._univerInstanceService,this._renderManagerService)}};oe=Cn([a.OnLifecycle(a.LifecycleStages.Rendered,oe),$(0,I.Inject(d.DocSkeletonManagerService)),$(1,a.IUniverInstanceService),$(2,a.ICommandService),$(3,m.IRenderManagerService),$(4,I.Inject(d.TextSelectionManagerService)),$(5,l.IEditorService)],oe);var On=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,bn=(r,e,t,n)=>{for(var i=n>1?void 0:n?Tn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&On(e,t,i),i},L=(r,e)=>(t,n)=>e(t,n,r);let se=class extends a.Disposable{constructor(e,t,n,i,o,s,c){super();T(this,"_loadedMap",new WeakSet);this._docSkeletonManagerService=e,this._univerInstanceService=t,this._commandService=n,this._renderManagerService=i,this._textSelectionRenderManager=o,this._textSelectionManagerService=s,this._editorService=c,this._initialize()}_initialize(){this._init(),this._skeletonListener(),this._commandExecutedListener()}_init(){this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(e=>{this._create(e)})),this._renderManagerService.getRenderAll().forEach((e,t)=>{this._create(t)})}_create(e){if(e==null||this._univerInstanceService.getUniverDocInstance(e)==null)return;const t=this._getDocObjectById(e);t==null||t.document==null||this._loadedMap.has(t.document)||(this._initialMain(e),this._loadedMap.add(t.document))}_initialMain(e){const t=this._getDocObjectById(e);if(t==null)return;const{document:n,scene:i}=t;this.disposeWithMe(a.toDisposable(n.onPointerEnterObserver.add(()=>{this._isEditorReadOnly(e)||(n.cursor=m.CURSOR_TYPE.TEXT)}))),this.disposeWithMe(a.toDisposable(n.onPointerLeaveObserver.add(()=>{n.cursor=m.CURSOR_TYPE.DEFAULT,i.resetCursor()}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onPointerDownObserver.add((o,s)=>{if(this._isEditorReadOnly(e))return;const c=this._univerInstanceService.getCurrentUniverDocInstance();(c==null?void 0:c.getUnitId())!==e&&this._univerInstanceService.setCurrentUnitForType(e),this._textSelectionRenderManager.eventTrigger(o);const{offsetX:u,offsetY:h}=o;this._editorService.getEditor(e)&&setTimeout(()=>{this._setEditorFocus(e),this._textSelectionRenderManager.setCursorManually(u,h)},0),o.button!==2&&s.stopPropagation()}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onDblclickObserver.add(o=>{this._isEditorReadOnly(e)||this._textSelectionRenderManager.handleDblClick(o)}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onTripleClickObserver.add(o=>{this._isEditorReadOnly(e)||this._textSelectionRenderManager.handleTripleClick(o)})))}_isEditorReadOnly(e){const t=this._editorService.getEditor(e);return t?t.isReadOnly():!1}_setEditorFocus(e){if(this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SHEET).length>0){const n=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);this._editorService.setOperationSheetUnitId(n.getUnitId())}this._editorService.focusStyle(e)}_commandExecutedListener(){const e=[d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var n;if(e.includes(t.id)){const i=t.params,{unitId:o}=i,s=(n=this._textSelectionManagerService.getCurrentSelection())==null?void 0:n.unitId;if(o!==s)return;this._textSelectionManagerService.refreshSelection()}}))}_skeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(e=>{if(e==null)return;const{unitId:t,skeleton:n}=e,i=this._renderManagerService.getRenderById(t);if(i==null)return;const{scene:o,mainComponent:s}=i;this._textSelectionRenderManager.changeRuntime(n,o,s),this._textSelectionManagerService.setCurrentSelectionNotRefresh({unitId:t,subUnitId:""})}))}_getDocObjectById(e){return this._univerInstanceService.getUnitType(e)!==a.UniverInstanceType.UNIVER_DOC?null:d.getDocObjectById(e,this._renderManagerService)}};se=bn([a.OnLifecycle(a.LifecycleStages.Rendered,se),L(0,I.Inject(d.DocSkeletonManagerService)),L(1,a.IUniverInstanceService),L(2,a.ICommandService),L(3,m.IRenderManagerService),L(4,m.ITextSelectionRenderManager),L(5,I.Inject(d.TextSelectionManagerService)),L(6,l.IEditorService)],se);var Mn=Object.defineProperty,Rn=Object.getOwnPropertyDescriptor,yn=(r,e,t,n)=>{for(var i=n>1?void 0:n?Rn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Mn(e,t,i),i},z=(r,e)=>(t,n)=>e(t,n,r);const we=1.5;let ae=class extends a.RxDisposable{constructor(r,e,t,n,i){super(),this._docSkeletonManagerService=r,this._textSelectionManagerService=e,this._editorService=t,this._univerInstanceService=n,this._renderManagerService=i,this._init()}_init(){this._textSelectionManagerService.textSelection$.pipe(b.takeUntil(this.dispose$)).subscribe(r=>{if(r==null)return;const{isEditing:e,unitId:t}=r;e&&this._scrollToSelection(t)})}_scrollToSelection(r){var y;const e=this._textSelectionManagerService.getActiveRange(),t=this._getDocObject(),n=(y=this._docSkeletonManagerService.getCurrent())==null?void 0:y.skeleton;if(e==null||t==null||n==null)return;const{collapsed:i,startNodePosition:o}=e;if(!i)return;const s=t.document.getOffsetConfig(),{docsLeft:c,docsTop:u}=s,h=new m.NodePositionConvertToCursor(s,n),{contentBoxPointGroup:g}=h.getRangePointData(o,o),{left:S,top:O,height:v}=m.getAnchorBounding(g),C=S+c,p=O+u,f=t.scene.getViewport(d.VIEWPORT_KEY.VIEW_MAIN),M=!!this._editorService.getEditor(r);if(f==null)return;const{left:R,top:E,right:P,bottom:x}=f.getBounding().viewBound;let w=0,j=0;const de=M?0:100;p<E?w=p-E:p>x-v&&(w=p-x+v+de),C<R?j=C-R:C>P-we&&(j=C-P+we);const ue=f.getBarScroll(j,w);f.scrollBy(ue)}_getDocObject(){return d.getDocObject(this._univerInstanceService,this._renderManagerService)}};ae=yn([a.OnLifecycle(a.LifecycleStages.Rendered,ae),z(0,I.Inject(d.DocSkeletonManagerService)),z(1,I.Inject(d.TextSelectionManagerService)),z(2,l.IEditorService),z(3,a.IUniverInstanceService),z(4,m.IRenderManagerService)],ae);var En=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,Un=(r,e,t,n)=>{for(var i=n>1?void 0:n?Dn(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&En(e,t,i),i},ve=(r,e)=>(t,n)=>e(t,n,r);_.UniverDocsUIPlugin=(le=class extends a.Plugin{constructor(e,t,n,i){super(),this._config=e,this._injector=t,this._localeService=n,this._logService=i,this._localeService.load({zhCN:Ue}),this._config=a.Tools.deepMerge({},Oe,this._config),this._initDependencies(t),this._initializeCommands()}onRendered(){this._initModules(),this._markDocAsFocused()}_initializeCommands(){[ke,ze,Ge,Ye,Ke,Xe,qe,Ze,Je,Bt,Ft,At].forEach(e=>{this._injector.get(l.IShortcutService).registerShortcut(e)})}_initDependencies(e){[[q],[J],[Q],[te],[ie],[re],[oe],[se],[ae],[V,{useFactory:()=>this._injector.createInstance(V,this._config)}],[H,{useClass:Se}],[_.DocCanvasView]].forEach(n=>{e.add(n)})}_markDocAsFocused(){const e=this._injector.get(a.IUniverInstanceService),t=this._injector.get(l.IEditorService);try{const n=e.getCurrentUniverDocInstance();if(!n)return;const i=n.getUnitId();t.isEditor(i)||e.focusUnit(n.getUnitId())}catch(n){this._logService.warn(n)}}_initModules(){this._injector.get(V)}},T(le,"pluginName",Te),T(le,"type",a.UniverInstanceType.UNIVER_DOC),le),_.UniverDocsUIPlugin=Un([ve(1,I.Inject(I.Injector)),ve(2,I.Inject(a.LocaleService)),ve(3,a.ILogService)],_.UniverDocsUIPlugin),_.DOC_UI_PLUGIN_NAME=Te,_.DefaultDocContainerConfig=Ce,_.DefaultDocUiConfig=Oe,_.DefaultToolbarConfig=Ie,_.PastePluginLark=Ne,_.PastePluginUniver=Be,_.PastePluginWord=Ae,_.enUS=Lt,_.zhCN=Ue,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
9
+ */var ot=Ve,st=Symbol.for("react.element"),at=Symbol.for("react.fragment"),ct=Object.prototype.hasOwnProperty,lt=ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,dt={key:!0,ref:!0,__self:!0,__source:!0};function De(r,t,e){var n,i={},o=null,s=null;e!==void 0&&(o=""+e),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(n in t)ct.call(t,n)&&!dt.hasOwnProperty(n)&&(i[n]=t[n]);if(r&&r.defaultProps)for(n in t=r.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:st,type:r,key:o,ref:s,props:i,_owner:lt.current}}K.Fragment=at,K.jsx=De,K.jsxs=De,Ee.exports=K;var ut=Ee.exports;const ht={docsUiCanvasBackground:"univer-docs-ui-canvas-background"},pt=()=>ut.jsx("div",{className:ht.docsUiCanvasBackground});function gt(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatBoldCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.bl;e.next(u===a.BooleanNumber.TRUE)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function _t(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatItalicCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.it;e.next(u===a.BooleanNumber.TRUE)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function St(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatUnderlineCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.ul;e.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function ft(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatStrikethroughCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.st;e.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function mt(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatSubscriptCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.va;e.next(u===a.BaselineOffset.SUBSCRIPT)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function vt(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatSuperscriptCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.SetInlineFormatCommand.id){const c=U(r);if(c==null)return;const u=(s=c.ts)==null?void 0:s.va;e.next(u===a.BaselineOffset.SUPERSCRIPT)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function It(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.SELECTOR,label:Me,positions:[l.MenuPosition.TOOLBAR_START],selections:l.FONT_FAMILY_LIST.map(e=>({label:{name:ye,hoverable:!0},value:e.value})),value$:new b.Observable(e=>{const n=l.FONT_FAMILY_LIST[0].value,i=t.onCommandExecuted(o=>{var c;const s=o.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontFamilyCommand.id){const u=U(r);if(u==null)return;const p=(c=u.ts)==null?void 0:c.ff;e.next(p!=null?p:n)}});return e.next(n),i.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Ct(r){const t=r.get(a.ICommandService);return{id:d.SetInlineFormatFontSizeCommand.id,group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:Re,props:{min:1,max:400}},positions:[l.MenuPosition.TOOLBAR_START],selections:l.FONT_SIZE_LIST,value$:new b.Observable(e=>{const i=t.onCommandExecuted(o=>{var c;const s=o.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontSizeCommand.id){const u=U(r);if(u==null)return;const p=(c=u.ts)==null?void 0:c.fs;e.next(p!=null?p:14)}});return e.next(14),i.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Ot(r){const t=r.get(a.ICommandService),e=r.get(a.ThemeService);return{id:d.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON_SELECTOR,positions:[l.MenuPosition.TOOLBAR_START],selections:[{label:{name:pe,hoverable:!1}}],value$:new b.Observable(n=>{const i=e.getCurrentTheme().textColor,o=t.onCommandExecuted(s=>{if(s.id===d.SetInlineFormatTextColorCommand.id){const c=s.params.value;n.next(c!=null?c:i)}});return n.next(i),o.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Tt(r){const t=r.get(a.ICommandService);return{id:d.AlignLeftCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"LeftJustifyingSingle",tooltip:"toolbar.alignLeft",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;e.next(u===a.HorizontalAlign.LEFT)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function bt(r){const t=r.get(a.ICommandService);return{id:d.AlignCenterCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"HorizontallySingle",tooltip:"toolbar.alignCenter",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;e.next(u===a.HorizontalAlign.CENTER)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Mt(r){const t=r.get(a.ICommandService);return{id:d.AlignRightCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"RightJustifyingSingle",tooltip:"toolbar.alignRight",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;e.next(u===a.HorizontalAlign.RIGHT)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function yt(r){const t=r.get(a.ICommandService);return{id:d.AlignJustifyCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"AlignTextBothSingle",tooltip:"toolbar.alignJustify",positions:[l.MenuPosition.TOOLBAR_START],activated$:new b.Observable(e=>{const n=t.onCommandExecuted(i=>{var s;const o=i.id;if(o===d.SetTextSelectionsOperation.id||o===d.AlignOperationCommand.id){const c=X(r);if(c==null)return;const u=(s=c.paragraphStyle)==null?void 0:s.horizontalAlign;e.next(u===a.HorizontalAlign.JUSTIFIED)}});return e.next(!1),n.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Rt(r){return{id:d.OrderListCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[l.MenuPosition.TOOLBAR_START],hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Et(r){return{id:d.BulletListCommand.id,group:l.MenuGroup.TOOLBAR_LAYOUT,type:l.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[l.MenuPosition.TOOLBAR_START],hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function Dt(r){return{id:d.ResetInlineFormatTextBackgroundColorCommand.id,type:l.MenuItemType.BUTTON,title:"toolbar.resetColor",icon:"NoColor",positions:d.SetInlineFormatTextBackgroundColorCommand.id}}function Ut(r){const t=r.get(a.ICommandService),e=r.get(a.ThemeService);return{id:d.SetInlineFormatTextBackgroundColorCommand.id,tooltip:"toolbar.fillColor.main",group:l.MenuGroup.TOOLBAR_FORMAT,type:l.MenuItemType.BUTTON_SELECTOR,positions:[l.MenuPosition.TOOLBAR_START],icon:"PaintBucket",selections:[{label:{name:pe,hoverable:!1}}],value$:new b.Observable(n=>{const i=e.getCurrentTheme().primaryColor,o=t.onCommandExecuted(s=>{if(s.id===d.SetInlineFormatTextBackgroundColorCommand.id){const c=s.params.value;n.next(c!=null?c:i)}});return n.next(i),o.dispose}),hidden$:l.getMenuHiddenObservable(r,a.UniverInstanceType.UNIVER_DOC)}}function U(r){var u;const t=r.get(a.IUniverInstanceService),e=r.get(d.TextSelectionManagerService),n=t.getCurrentUniverDocInstance(),i=e.getActiveRange();if(n==null||i==null)return;const o=(u=n.getBody())==null?void 0:u.textRuns;if(o==null)return;const{startOffset:s}=i;return o.find(({st:p,ed:g})=>s>=p&&s<g)}function X(r){var u;const t=r.get(a.IUniverInstanceService),e=r.get(d.TextSelectionManagerService),n=t.getCurrentUniverDocInstance(),i=e.getActiveRange();if(n==null||i==null)return;const o=(u=n.getBody())==null?void 0:u.paragraphs;if(o==null)return;const{startOffset:s}=i;let c=-1;for(const p of o){const{startIndex:g}=p;if(s>c&&s<=g)return p;c=g}return null}var Pt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,xt=(r,t,e,n)=>{for(var i=n>1?void 0:n?Nt(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Pt(t,e,i),i},x=(r,t)=>(e,n)=>t(e,n,r);let q=class extends a.Disposable{constructor(r,t,e,n,i,o,s){super(),this._injector=r,this._componentManager=t,this._layoutService=e,this._editorService=n,this._menuService=i,this._uiController=o,this._univerInstanceService=s,this._init()}_initCustomComponents(){const r=this._componentManager;this.disposeWithMe(r.register(pe,We.ColorPicker)),this.disposeWithMe(r.register(Me,l.FontFamily)),this.disposeWithMe(r.register(ye,l.FontFamilyItem)),this.disposeWithMe(r.register(Re,l.FontSize))}_initMenus(){[gt,_t,St,ft,mt,vt,Ct,It,Ot,Tt,bt,Mt,yt,Rt,Et,Dt,Ut].forEach(r=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r)))})}_init(){this._initCustomComponents(),this._initMenus(),this._initDocBackground(),this._initFocusHandler()}_initDocBackground(){const r=this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_DOC)[0].getUnitId();if(r==null)return;this._editorService.isEditor(r)||this.disposeWithMe(this._uiController.registerComponent(l.DesktopUIPart.CONTENT,()=>je.connectInjector(pt,this._injector)))}_initFocusHandler(){this.disposeWithMe(this._layoutService.registerFocusHandler(a.UniverInstanceType.UNIVER_DOC,()=>{this._injector.get(v.ITextSelectionRenderManager).focus()}))}};q=xt([a.OnLifecycle(a.LifecycleStages.Rendered,q),x(0,I.Inject(I.Injector)),x(1,I.Inject(l.ComponentManager)),x(2,l.ILayoutService),x(3,l.IEditorService),x(4,l.IMenuService),x(5,l.IUIController),x(6,a.IUniverInstanceService)],q);const Lt={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",underline:"Underline",textColor:{main:"Text color",right:"Choose color"},fillColor:{main:"Text Background color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Justify"}},Ue={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},fillColor:{main:"文本背景色",right:"背景色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表",alignLeft:"左对齐",alignCenter:"居中对齐",alignRight:"右对齐",alignJustify:"两端对齐"}},At={id:d.BreakLineCommand.id,preconditions:ke,binding:l.KeyCode.ENTER},Bt={id:d.DeleteLeftCommand.id,preconditions:E,binding:l.KeyCode.BACKSPACE},Ft={id:d.DeleteRightCommand.id,preconditions:E,binding:l.KeyCode.DELETE},$t=10,wt=6;function jt(){return a.Tools.generateRandomId(wt)}function Vt(r){const t=r.match(/data-copy-id="([^\s]+)"/);return t&&t[1]?t[1]:null}class Wt{constructor(){O(this,"_cache",new a.LRUMap($t))}set(t,e){this._cache.set(t,e)}get(t){return this._cache.get(t)}clear(){this._cache.clear()}}const Pe=new Wt;function ge(r){const t=r.style,e={},n=r.tagName.toLowerCase();switch(n){case"b":case"em":case"strong":{e.bl=a.BooleanNumber.TRUE;break}case"s":{e.st={s:a.BooleanNumber.TRUE};break}case"u":{e.ul={s:a.BooleanNumber.TRUE};break}case"i":{e.it=a.BooleanNumber.TRUE;break}case"sub":case"sup":{e.va=n==="sup"?a.BaselineOffset.SUPERSCRIPT:a.BaselineOffset.SUBSCRIPT;break}}for(let i=0;i<t.length;i++){const o=t[i],s=t.getPropertyValue(o);switch(o){case"font-family":{e.ff=s;break}case"font-size":{const c=Number.parseInt(s);Number.isNaN(c)||(s.endsWith("pt")?e.fs=c:s.endsWith("px")&&(e.fs=v.pixelToPt(c)));break}case"font-style":{s==="italic"&&(e.it=a.BooleanNumber.TRUE);break}case"font-weight":{Number(s)>400&&(e.bl=a.BooleanNumber.TRUE);break}case"text-decoration":{/underline/.test(s)?e.ul={s:a.BooleanNumber.TRUE}:/overline/.test(s)?e.ol={s:a.BooleanNumber.TRUE}:/line-through/.test(s)&&(e.st={s:a.BooleanNumber.TRUE});break}case"color":{const c=new a.ColorKit(s);c.isValid&&(e.cl={rgb:c.toRgbString()});break}case"background-color":{const c=new a.ColorKit(s);c.isValid&&(e.bg={rgb:c.toRgbString()});break}}}return e}function kt(r){const t=new DOMParser,e=`<x-univer id="univer-root">${r}</x-univer>`;return t.parseFromString(e,"text/html").querySelector("#univer-root")}function Ne(r,t){const e=r.tagName.toLowerCase();return typeof t=="string"?e===t:Array.isArray(t)?t.some(n=>n===e):t(r)}const ae=class ae{constructor(){O(this,"_styleCache",new Map);O(this,"_styleRules",[]);O(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){const e=ae._pluginList.find(o=>o.checkPasteType(t)),n=kt(t),i={dataStream:"",textRuns:[]};return e&&(this._styleRules=[...e.stylesRules],this._afterProcessRules=[...e.afterProcessRules]),this._styleCache.clear(),this._process(null,n==null?void 0:n.childNodes,i),this._styleCache.clear(),this._styleRules=[],this._afterProcessRules=[],i}_process(t,e,n){var i;for(const o of e)if(o.nodeType===Node.TEXT_NODE){const s=(i=o.nodeValue)==null?void 0:i.replace(/[\r\n]/g,"");let c;t&&this._styleCache.has(t)&&(c=this._styleCache.get(t)),n.dataStream+=s,c&&Object.getOwnPropertyNames(c).length&&n.textRuns.push({st:n.dataStream.length-s.length,ed:n.dataStream.length,ts:c})}else if(o.nodeType===Node.ELEMENT_NODE){const s=t?this._styleCache.get(t):{},c=this._styleRules.find(({filter:_})=>Ne(o,_)),u=c?c.getStyle(o):ge(o);this._styleCache.set(o,{...s,...u});const{childNodes:p}=o;this._process(o,p,n);const g=this._afterProcessRules.find(({filter:_})=>Ne(o,_));g&&g.handler(n,o)}}};O(ae,"_pluginList",[]);let A=ae;const xe={name:"univer-doc-paste-plugin-lark",checkPasteType(r){return/lark-record-clipboard/i.test(r)},stylesRules:[{filter:["s"],getStyle(r){const t=ge(r);return{st:{s:a.BooleanNumber.TRUE},...t}}}],afterProcessRules:[{filter(r){return r.tagName==="DIV"&&/ace-line/i.test(r.className)},handler(r){r.paragraphs==null&&(r.paragraphs=[]),r.paragraphs.push({startIndex:r.dataStream.length}),r.dataStream+="\r"}}]};function Le(r){const t=r.style,e={};for(let n=0;n<t.length;n++){const i=t[n],o=t.getPropertyValue(i);switch(i){case"margin-top":{const s=Number.parseInt(o);e.spaceAbove=/pt/.test(o)?v.ptToPixel(s):s;break}case"margin-bottom":{const s=Number.parseInt(o);e.spaceBelow=/pt/.test(o)?v.ptToPixel(s):s;break}case"line-height":{const s=Number.parseFloat(o);e.lineSpacing=s;break}}}return Object.getOwnPropertyNames(e).length?e:null}const Ae={name:"univer-doc-paste-plugin-word",checkPasteType(r){return/word|mso/i.test(r)},stylesRules:[{filter:["b"],getStyle(r){const t=ge(r);return{bl:a.BooleanNumber.TRUE,...t}}}],afterProcessRules:[{filter(r){return r.tagName==="P"&&/mso/i.test(r.className)},handler(r,t){r.paragraphs==null&&(r.paragraphs=[]);const e={startIndex:r.dataStream.length},n=Le(t);n&&(e.paragraphStyle=n),r.paragraphs.push(e),r.dataStream+="\r"}}]},Be={name:"univer-doc-paste-plugin-univer",checkPasteType(r){return/UniverNormal/i.test(r)},stylesRules:[],afterProcessRules:[{filter(r){return r.tagName==="P"&&/UniverNormal/i.test(r.className)},handler(r,t){r.paragraphs==null&&(r.paragraphs=[]);const e={startIndex:r.dataStream.length},n=Le(t);n&&(e.paragraphStyle=n),r.paragraphs.push(e),r.dataStream+="\r"}}]};function Fe(r,t){const{st:e,ed:n,ts:i={}}=t,{ff:o,fs:s,it:c,bl:u,ul:p,st:g,ol:_,bg:T,cl:f,va:C}=i;let h=r.slice(e,n);const m=[];return c===a.BooleanNumber.TRUE&&(h=`<i>${h}</i>`),C===a.BaselineOffset.SUPERSCRIPT?h=`<sup>${h}</sup>`:C===a.BaselineOffset.SUBSCRIPT&&(h=`<sub>${h}</sub>`),(p==null?void 0:p.s)===a.BooleanNumber.TRUE&&(h=`<u>${h}</u>`),(g==null?void 0:g.s)===a.BooleanNumber.TRUE&&(h=`<s>${h}</s>`),u===a.BooleanNumber.TRUE&&(h=`<strong>${h}</strong>`),o&&m.push(`font-family: ${o}`),f&&m.push(`color: ${f.rgb}`),s&&m.push(`font-size: ${s}pt`),_&&m.push("text-decoration: overline"),T&&m.push(`background: ${T.rgb}`),m.length?`<span style="${m.join("; ")};">${h}</span>`:h}function _e(r,t,e){const{dataStream:n,textRuns:i=[]}=r;let o=t;const s=[];for(const c of i){const{st:u,ed:p}=c;a.Tools.hasIntersectionBetweenTwoRanges(t,e,u,p)&&(u>o?(s.push(n.slice(o,u)),s.push(Fe(n,{...c,ed:Math.min(p,e)}))):s.push(Fe(n,{...c,st:o,ed:Math.min(p,e)}))),o=Math.max(t,Math.min(p,e))}return o!==e&&s.push(n.slice(o,e)),s.join("")}function $e(r,t=!0){var e;if(t&&((e=r.paragraphs)!=null&&e.length)){const{dataStream:n,paragraphs:i=[]}=r;let o="",s=-1;for(const c of i){const{startIndex:u,paragraphStyle:p={}}=c,{spaceAbove:g,spaceBelow:_,lineSpacing:T}=p,f=[];g!=null&&(typeof g=="number"?f.push(`margin-top: ${g}px`):f.push(`margin-top: ${g.v}px`)),_!=null&&(typeof _=="number"?f.push(`margin-bottom: ${_}px`):f.push(`margin-bottom: ${_.v}px`)),T!=null&&f.push(`line-height: ${T}`),u>s+1?o+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${_e(r,s+1,u)}</p>`:o+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,s=u}return s!==n.length&&(o+=_e(r,s,n.length)),o}else return _e(r,0,r.dataStream.length)}class Ht{convert(t){if(t.length===0)throw new Error("The bodyList length at least to be 1");if(t.length===1)return $e(t[0]);let e="";for(const n of t)e+='<p className="UniverNormal">',e+=$e(n,!1),e+="</p>";return e}}var zt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Gt=(r,t,e,n)=>{for(var i=n>1?void 0:n?Yt(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&zt(t,e,i),i},W=(r,t)=>(e,n)=>t(e,n,r);A.use(Ae),A.use(xe),A.use(Be);function Kt(r){const t=r.replace(/\n/g,"\r"),e=[];for(let n=0;n<t.length;n++)t[n]==="\r"&&e.push({startIndex:n});return{dataStream:t,paragraphs:e}}const k=I.createIdentifier("doc.clipboard-service");let Se=class extends a.Disposable{constructor(t,e,n,i,o){super();O(this,"_clipboardHooks",[]);O(this,"_htmlToUDM",new A);O(this,"_umdToHtml",new Ht);this._univerInstanceService=t,this._logService=e,this._commandService=n,this._clipboardInterfaceService=i,this._textSelectionManagerService=o}async copy(){const t=this._getDocumentBodyInRanges();if(t.length===0)return!1;try{this._setClipboardData(t)}catch(e){return this._logService.error("[DocClipboardService] copy failed",e),!1}return!0}async cut(){return this._cut()}async paste(t){const e=await this._generateBodyFromClipboardItems(t);return this._paste(e)}async legacyPaste(t,e){const n=this._generateBodyFromHtmlAndText(t,e);return this._paste(n)}async _cut(){var o;const{segmentId:t,endOffset:e,style:n}=(o=this._textSelectionManagerService.getActiveRange())!=null?o:{},i=this._textSelectionManagerService.getSelections();if(t==null&&this._logService.error("[DocClipboardController] segmentId is not existed"),e==null||i==null)return!1;this.copy();try{let s=e;for(const u of i){const{startOffset:p,endOffset:g}=u;p==null||g==null||g<=e&&(s-=g-p)}const c=[{startOffset:s,endOffset:s,style:n}];return this._commandService.executeCommand(d.CutContentCommand.id,{segmentId:t,textRanges:c})}catch{return this._logService.error("[DocClipboardController] cut content failed"),!1}}async _paste(t){var s;const{segmentId:e,endOffset:n,style:i}=(s=this._textSelectionManagerService.getActiveRange())!=null?s:{},o=this._textSelectionManagerService.getSelections();if(e==null&&this._logService.error("[DocClipboardController] segmentId does not exist!"),n==null||o==null)return!1;try{let c=n;for(const p of o){const{startOffset:g,endOffset:_}=p;g==null||_==null||_<=n&&(c+=t.dataStream.length-(_-g))}const u=[{startOffset:c,endOffset:c,style:i}];return this._commandService.executeCommand(d.InnerPasteCommand.id,{body:t,segmentId:e,textRanges:u})}catch{return this._logService.error("[DocClipboardController]","clipboard is empty."),!1}}async _setClipboardData(t){const e=jt(),n=t.length>1?t.map(o=>o.dataStream).join(`
10
+ `):t[0].dataStream;let i=this._umdToHtml.convert(t);return t.length===1&&(i=i.replace(/(<[a-z]+)/,(o,s)=>`${s} data-copy-id="${e}"`),Pe.set(e,t[0])),this._clipboardInterfaceService.write(n,i)}addClipboardHook(t){return this._clipboardHooks.push(t),a.toDisposable(()=>{const e=this._clipboardHooks.indexOf(t);e>-1&&this._clipboardHooks.splice(e,1)})}_getDocumentBodyInRanges(){const t=this._textSelectionManagerService.getSelections(),e=this._univerInstanceService.getCurrentUniverDocInstance(),n=[];if(t==null||!e)return n;for(const i of t){const{startOffset:o,endOffset:s,collapsed:c}=i;if(c||o==null||s==null)continue;const u=e.sliceBody(o,s);u!=null&&n.push(u)}return n}async _generateBodyFromClipboardItems(t){try{let e="",n="";for(const i of t)for(const o of i.types)o===l.PLAIN_TEXT_CLIPBOARD_MIME_TYPE?n=await i.getType(o).then(s=>s&&s.text()):o===l.HTML_CLIPBOARD_MIME_TYPE&&(e=await i.getType(o).then(s=>s&&s.text()));return this._generateBodyFromHtmlAndText(e,n)}catch(e){return Promise.reject(e)}}_generateBodyFromHtmlAndText(t,e){if(!t){if(e)return Kt(e);throw new Error("[DocClipboardService] html and text cannot be both empty!")}const n=Vt(t);if(n){const i=Pe.get(n);if(i)return i}return this._htmlToUDM.convert(t)}};Se=Gt([W(0,a.IUniverInstanceService),W(1,a.ILogService),W(2,a.ICommandService),W(3,l.IClipboardInterfaceService),W(4,I.Inject(d.TextSelectionManagerService))],Se);function Z(r){return r.getContextValue(a.FOCUSING_DOC)||r.getContextValue(a.EDITOR_ACTIVATED)}const fe=999,Xt={id:l.CopyCommand.id,name:"doc.command.copy",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>r.get(k).copy()},qt={id:l.CutCommand.id,name:"doc.command.cut",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>r.get(k).cut()},Zt={id:l.PasteCommand.id,name:"doc.command.paste",type:a.CommandType.COMMAND,multi:!0,priority:fe,preconditions:Z,handler:async r=>{const t=r.get(k),n=await r.get(l.IClipboardInterfaceService).read();return n.length===0?!1:t.paste(n)}};var Jt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,en=(r,t,e,n)=>{for(var i=n>1?void 0:n?Qt(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Jt(t,e,i),i},H=(r,t)=>(e,n)=>t(e,n,r);let J=class extends a.RxDisposable{constructor(r,t,e,n,i){super(),this._commandService=r,this._clipboardInterfaceService=t,this._docClipboardService=e,this._textSelectionRenderManager=n,this._contextService=i,this._init()}_init(){[Xt,qt,Zt].forEach(r=>this.disposeWithMe(this._commandService.registerMultipleCommand(r))),[d.InnerPasteCommand,d.CutContentCommand].forEach(r=>this.disposeWithMe(this._commandService.registerCommand(r))),this._initLegacyPasteCommand()}_initLegacyPasteCommand(){var r;(r=this._textSelectionRenderManager)==null||r.onPaste$.pipe(b.takeUntil(this.dispose$)).subscribe(t=>{var o,s;if(!Z(this._contextService))return;t.event.preventDefault();const e=t.event,n=(o=e.clipboardData)==null?void 0:o.getData("text/html"),i=(s=e.clipboardData)==null?void 0:s.getData("text/plain");this._docClipboardService.legacyPaste(n,i)})}};J=en([a.OnLifecycle(a.LifecycleStages.Rendered,J),H(0,a.ICommandService),H(1,l.IClipboardInterfaceService),H(2,k),H(3,v.ITextSelectionRenderManager),H(4,a.IContextService)],J);var tn=Object.defineProperty,nn=Object.getOwnPropertyDescriptor,rn=(r,t,e,n)=>{for(var i=n>1?void 0:n?nn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&tn(t,e,i),i},B=(r,t)=>(e,n)=>t(e,n,r);let Q=class extends a.Disposable{constructor(t,e,n,i,o,s){super();O(this,"_initialEditors",new Set);this._univerInstanceService=t,this._docSkeletonManagerService=e,this._editorService=n,this._commandService=i,this._textSelectionRenderManager=o,this._renderManagerService=s,this._initialize()}_initialize(){this.disposeWithMe(this._editorService.resize$.subscribe(t=>{this._resize(t)})),this._editorService.getAllEditor().forEach(t=>{const e=t.editorUnitId;this._initialEditors.has(e)||(this._initialEditors.add(e),this._resize(e))}),this._commandExecutedListener(),this._initialSetValue(),this._initialBlur(),this._initialFocus(),this._initialValueChange()}_resize(t){var D,P,N;if(t==null)return;const e=this._editorService.getEditor(t);if((e==null?void 0:e.cancelDefaultResizeListener)===!0)return;const n=(D=this._docSkeletonManagerService.getSkeletonByUnitId(t))==null?void 0:D.skeleton,i=this._univerInstanceService.getUniverDocInstance(t);if(e==null||e.render==null||n==null||i==null)return;n.calculate();const{marginTop:o=0,marginBottom:s=0,marginLeft:c=0,marginRight:u=0}=i.getSnapshot().documentStyle,{scene:p,mainComponent:g}=e.render;let{actualHeight:_,actualWidth:T}=n.getActualSize();_+=o+s,T+=c+u;const{width:f,height:C}=e.getBoundingClientRect(),h=p.getViewport(d.VIEWPORT_KEY.VIEW_MAIN);let m=h==null?void 0:h.getScrollBar();const M=Math.max(T,f),y=Math.max(_,C);p.transformByState({width:M,height:y}),g==null||g.resize(M,y),e.isSingle()?T>f?m==null?h&&new v.ScrollBar(h,{barSize:8,enableVertical:!1}):h==null||h.resetSizeAndScrollBar():(m=null,h==null||h.scrollTo({x:0,y:0}),(N=h==null?void 0:h.getScrollBar())==null||N.dispose()):_>C?m==null?h&&new v.ScrollBar(h,{enableHorizontal:!1,barSize:8}):h==null||h.resetSizeAndScrollBar():(m=null,h==null||h.scrollTo({x:0,y:0}),(P=h==null?void 0:h.getScrollBar())==null||P.dispose())}_initialSetValue(){this.disposeWithMe(this._editorService.setValue$.subscribe(t=>{this._commandService.executeCommand(d.CoverContentCommand.id,{unitId:t.editorUnitId,body:t.body,segmentId:null})}))}_initialBlur(){this.disposeWithMe(this._editorService.blur$.subscribe(()=>{this._textSelectionRenderManager.removeAllTextRanges(),this._textSelectionRenderManager.blur()})),this.disposeWithMe(this._textSelectionRenderManager.onBlur$.subscribe(()=>{var i;const t=(i=this._univerInstanceService.getCurrentUniverDocInstance())==null?void 0:i.getUnitId();if(t==null)return;const e=this._editorService.getEditor(t),n=this._editorService.getFocusEditor();e==null||e.isSheetEditor()||n&&n.editorUnitId===t||this._editorService.blur()}))}_initialFocus(){this.disposeWithMe(this._editorService.focus$.subscribe(n=>{this._textSelectionRenderManager.removeAllTextRanges(),this._textSelectionRenderManager.addTextRanges([n])}));const t=["univer-formula-search","univer-formula-help","formula-help-decorator","univer-formula-help-param"];this.disposeWithMe(b.fromEvent(window,"mousedown").subscribe(n=>{const o=n.target.classList[0]||"";if(a.checkForSubstrings(o,t)){this._editorService.changeSpreadsheetFocusState(!0),n.stopPropagation();return}this._editorService.changeSpreadsheetFocusState(!1)})),this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SHEET).forEach(n=>{const i=n.getUnitId(),o=this._renderManagerService.getRenderById(i),s=o==null?void 0:o.engine.getCanvas().getCanvasEle();s!=null&&b.fromEvent(s,"mousedown").subscribe(c=>{this._editorService.changeSpreadsheetFocusState(!0),c.stopPropagation()})})}_initialValueChange(){this.disposeWithMe(this._textSelectionRenderManager.onCompositionupdate$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onInput$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onKeydown$.subscribe(this._valueChange.bind(this))),this.disposeWithMe(this._textSelectionRenderManager.onPaste$.subscribe(this._valueChange.bind(this)))}_valueChange(){var n;const t=(n=this._univerInstanceService.getCurrentUniverDocInstance())==null?void 0:n.getUnitId();if(t==null)return;const e=this._editorService.getEditor(t);e==null||e.isSheetEditor()||this._editorService.refreshValueChange(t)}_commandExecutedListener(){const t=[d.RichTextEditingMutation.id,l.SetEditorResizeOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=e.params,{unitId:i}=n;if(this._editorService.isSheetEditor(i))return;this._resize(i),this._valueChange()}}))}};Q=rn([a.OnLifecycle(a.LifecycleStages.Rendered,Q),B(0,a.IUniverInstanceService),B(1,I.Inject(d.DocSkeletonManagerService)),B(2,l.IEditorService),B(3,a.ICommandService),B(4,v.ITextSelectionRenderManager),B(5,v.IRenderManagerService)],Q);var on=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,an=(r,t,e,n)=>{for(var i=n>1?void 0:n?sn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&on(t,e,i),i},ee=(r,t)=>(e,n)=>t(e,n,r);let te=class extends a.RxDisposable{constructor(t,e,n,i){super();O(this,"_docRenderMap",new Set);this._docSkeletonManagerService=t,this._renderManagerService=e,this._commandService=n,this._editorService=i,this._initialRenderRefresh(),this._commandExecutedListener()}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeletonBefore$.pipe(b.takeUntil(this.dispose$)).subscribe(t=>{this._create(t)})}_create(t){if(t==null)return;const{skeleton:e,unitId:n}=t;let i=this._renderManagerService.getRenderById(n);i==null&&(this._renderManagerService.create(n),i=this._renderManagerService.getRenderById(n));const{mainComponent:o,components:s}=i,c=o,u=s.get(d.DOCS_VIEW_KEY.BACKGROUND);c.changeSkeleton(e),u.changeSkeleton(e),this._recalculateSizeBySkeleton(i,e)}_recalculateSizeBySkeleton(t,e){var T;const{mainComponent:n,scene:i,unitId:o,components:s}=t,c=n,u=s.get(d.DOCS_VIEW_KEY.BACKGROUND),p=(T=e.getSkeletonData())==null?void 0:T.pages;if(p==null)return;let g=0,_=0;for(let f=0,C=p.length;f<C;f++){const h=p[f],{pageWidth:m,pageHeight:M}=h;c.pageLayoutType===v.PageLayoutType.VERTICAL?(_+=M,_+=c.pageMarginTop,f===C-1&&(_+=c.pageMarginTop),g=Math.max(g,m)):c.pageLayoutType===v.PageLayoutType.HORIZONTAL&&(g+=m,f!==C-1&&(g+=c.pageMarginLeft),_=Math.max(_,M))}c.resize(g,_),u.resize(g,_),this._editorService.isEditor(o)||i.resize(g,_)}_commandExecutedListener(){const t=[d.RichTextEditingMutation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var n;if(t.includes(e.id)){const i=e.params,{unitId:o}=i,s=this._docSkeletonManagerService.getSkeletonByUnitId(o);if(s==null)return;const{skeleton:c}=s,u=this._renderManagerService.getRenderById(o);if(u==null||!!c.getViewModel().getDataModel().getSnapshot().disabled)return;if(c.calculate(),this._editorService.isEditor(o)){(n=u.mainComponent)==null||n.makeDirty();return}this._recalculateSizeBySkeleton(u,c)}}))}};te=an([a.OnLifecycle(a.LifecycleStages.Rendered,te),ee(0,I.Inject(d.DocSkeletonManagerService)),ee(1,v.IRenderManagerService),ee(2,a.ICommandService),ee(3,l.IEditorService)],te);var cn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,dn=(r,t,e,n)=>{for(var i=n>1?void 0:n?ln(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&cn(t,e,i),i},ne=(r,t)=>(e,n)=>t(e,n,r);S.DocCanvasView=class extends a.RxDisposable{constructor(e,n,i,o){super();O(this,"_scene");O(this,"_currentDocumentModel");O(this,"_fps$",new b.BehaviorSubject(""));O(this,"fps$",this._fps$.asObservable());this._renderManagerService=e,this._configService=n,this._univerInstanceService=i,this._editorService=o,this._initialize()}_initialize(){this._renderManagerService.createRender$.pipe(b.takeUntil(this.dispose$)).subscribe(e=>{this._create(e)}),this._univerInstanceService.getCurrentTypeOfUnit$(a.UniverInstanceType.UNIVER_DOC).pipe(b.takeUntil(this.dispose$)).subscribe(e=>{this._create(e==null?void 0:e.getUnitId())}),this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_DOC).forEach(e=>{this._create(e.getUnitId())})}dispose(){this._fps$.complete()}_create(e){if(e==null)return;const n=this._univerInstanceService.getUniverDocInstance(e);n!=null&&(this._currentDocumentModel=n,this._renderManagerService.has(e)||this._addNewRender())}_addNewRender(){const e=this._currentDocumentModel,n=e.getUnitId(),i=e.getContainer(),o=e.getParentRenderUnitId();if(i!=null&&o!=null)throw new Error("container or parentRenderUnitId can only exist one");i==null&&o!=null?this._renderManagerService.createRenderWithParent(n,o):this._renderManagerService.createRender(n);const s=this._renderManagerService.getRenderById(n);if(s==null)return;const{scene:c,engine:u}=s;c.openTransformer(),this._scene=c;const p=new v.Viewport(d.VIEWPORT_KEY.VIEW_MAIN,c,{left:0,top:0,bottom:0,right:0,isWheelPreventDefaultX:!0});c.attachControl(),c.on(v.EVENT_TYPE.wheel,(T,f)=>{const C=T;if(C.ctrlKey){const h=Math.abs(C.deltaX);let m=h<40?.2:h<80?.4:.2;m*=C.deltaY>0?-1:1,c.scaleX<1&&(m/=2),c.scaleX+m>4?c.scale(4,4):c.scaleX+m<.1?c.scale(.1,.1):C.preventDefault()}else p.onMouseWheel(C,f)}),this._configService.getConfig("hasScroll")!==!1&&new v.ScrollBar(p),c.addLayer(new v.Layer(c,[],d.DOCS_COMPONENT_MAIN_LAYER_INDEX),new v.Layer(c,[],d.DOCS_COMPONENT_HEADER_LAYER_INDEX)),this._addComponent(s),this._currentDocumentModel.getShouldRenderLoopImmediately()&&u.runRenderLoop(()=>{c.render(),this._fps$.next(Math.round(u.getFps()).toString())}),this._renderManagerService.setCurrent(n)}_addComponent(e){const n=this._scene,i=this._currentDocumentModel,o={pageMarginLeft:i.documentStyle.marginLeft||0,pageMarginTop:i.documentStyle.marginTop||0},s=new v.Documents(d.DOCS_VIEW_KEY.MAIN,void 0,o),c=new v.DocBackground(d.DOCS_VIEW_KEY.BACKGROUND,void 0,o);s.zIndex=d.DOCS_COMPONENT_DEFAULT_Z_INDEX,c.zIndex=d.DOCS_COMPONENT_DEFAULT_Z_INDEX,e.mainComponent=s,e.components.set(d.DOCS_VIEW_KEY.MAIN,s),e.components.set(d.DOCS_VIEW_KEY.BACKGROUND,c),n.addObjects([s],d.DOCS_COMPONENT_MAIN_LAYER_INDEX),n.addObjects([c],d.DOCS_COMPONENT_BACKGROUND_LAYER_INDEX),this._editorService.getEditor(i.getUnitId())==null&&n.enableLayerCache(d.DOCS_COMPONENT_MAIN_LAYER_INDEX)}},S.DocCanvasView=dn([a.OnLifecycle(a.LifecycleStages.Starting,S.DocCanvasView),ne(0,v.IRenderManagerService),ne(1,a.IConfigService),ne(2,a.IUniverInstanceService),ne(3,l.IEditorService)],S.DocCanvasView);var un=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,pn=(r,t,e,n)=>{for(var i=n>1?void 0:n?hn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&un(t,e,i),i},F=(r,t)=>(e,n)=>t(e,n,r);let ie=class extends a.Disposable{constructor(t,e,n,i,o,s){super();O(this,"_liquid",new v.Liquid);O(this,"_pageMarginCache",new Map);this._docSkeletonManagerService=t,this._univerInstanceService=e,this._renderManagerService=n,this._commandService=i,this._floatingObjectManagerService=o,this._editorService=s,this._initialize(),this._commandExecutedListener()}_initialize(){this._initialRenderRefresh(),this._updateOnPluginChange()}_updateOnPluginChange(){this._floatingObjectManagerService.pluginUpdate$.subscribe(t=>{const e=this._docSkeletonManagerService.getCurrent();if(e==null)return;const{unitId:n,skeleton:i}=e,o=this._renderManagerService.getRenderById(n);if(o==null)return;const{mainComponent:s,components:c,scene:u}=o,p=s,{left:g,top:_}=p;t.forEach(T=>{const{unitId:f,subUnitId:C,floatingObjectId:h,floatingObject:m}=T,{left:M=0,top:y=0,width:D=0,height:P=0,angle:N,flipX:w,flipY:j,skewX:le,skewY:de}=m,R=this._pageMarginCache.get(h),ue=(R==null?void 0:R.marginLeft)||0,ve=(R==null?void 0:R.marginTop)||0;i==null||i.getViewModel().getDataModel().updateDrawing(h,{left:M-g-ue,top:y-_-ve,height:P,width:D})}),i==null||i.calculate(),s==null||s.makeDirty()})}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(t==null)return;const{skeleton:e,unitId:n}=t,i=this._renderManagerService.getRenderById(n);if(i==null)return;const{mainComponent:o}=i;o.changeSkeleton(e),this._refreshFloatingObject(n,e,i)})}_commandExecutedListener(){const t=[d.RichTextEditingMutation.id,d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var n;if(t.includes(e.id)){const i=e.params,{unitId:o}=i,s=this._docSkeletonManagerService.getCurrent();if(s==null)return;const{unitId:c,skeleton:u}=s;if(o!==c)return;const p=this._renderManagerService.getRenderById(c);if(p==null)return;if(this._editorService.isEditor(c)){(n=p.mainComponent)==null||n.makeDirty();return}this._refreshFloatingObject(c,u,p)}}))}_refreshFloatingObject(t,e,n){const i=e==null?void 0:e.getSkeletonData(),{mainComponent:o,scene:s}=n,c=o;if(!i)return;const{left:u,top:p,pageLayoutType:g,pageMarginLeft:_,pageMarginTop:T}=c,{pages:f}=i,C=[];s.getAncestorScale(),this._liquid.reset(),this._pageMarginCache.clear();for(let h=0,m=f.length;h<m;h++){const M=f[h],{skeDrawings:y,marginLeft:D,marginTop:P}=M;this._liquid.translatePagePadding(M),y.forEach(N=>{const{aLeft:w,aTop:j,height:le,width:de,objectId:R,drawingOrigin:ue}=N,ve=ue.layoutType===a.PositionedObjectLayoutType.WRAP_NONE&&ue.behindDoc===a.BooleanNumber.TRUE;C.push({unitId:t,subUnitId:a.DEFAULT_DOCUMENT_SUB_COMPONENT_ID,floatingObjectId:R,behindText:ve,floatingObject:{left:w+u+this._liquid.x,top:j+p+this._liquid.y,width:de,height:le}}),this._pageMarginCache.set(R,{marginLeft:this._liquid.x,marginTop:this._liquid.y})}),this._liquid.restorePagePadding(M),this._liquid.translatePage(M,g,_,T)}this._floatingObjectManagerService.batchAddOrUpdate(C)}};ie=pn([a.OnLifecycle(a.LifecycleStages.Steady,ie),F(0,I.Inject(d.DocSkeletonManagerService)),F(1,a.IUniverInstanceService),F(2,v.IRenderManagerService),F(3,a.ICommandService),F(4,a.IFloatingObjectManagerService),F(5,l.IEditorService)],ie);var gn=Object.defineProperty,_n=Object.getOwnPropertyDescriptor,Sn=(r,t,e,n)=>{for(var i=n>1?void 0:n?_n(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&gn(t,e,i),i},$=(r,t)=>(e,n)=>t(e,n,r);let re=class extends a.Disposable{constructor(t,e,n,i,o,s){super();O(this,"_initializedRender",new Set);this._docSkeletonManagerService=t,this._univerInstanceService=e,this._commandService=n,this._renderManagerService=i,this._textSelectionManagerService=o,this._editorService=s,this._initialize()}dispose(){super.dispose()}_initialize(){this._skeletonListener(),this._commandExecutedListener(),this._initialRenderRefresh()}_initialRenderRefresh(){this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(t==null)return;const{unitId:e}=t,n=this._renderManagerService.getRenderById(e);if(n==null||this._initializedRender.has(e)||this._editorService.isEditor(e))return;this._initializedRender.add(e);const{scene:i}=n;this.disposeWithMe(a.toDisposable(i.onMouseWheelObserver.add(o=>{if(!o.ctrlKey)return;const s=this._univerInstanceService.getCurrentUniverDocInstance();if(!s)return;const c=Math.abs(o.deltaX);let u=c<40?.2:c<80?.4:.2;u*=o.deltaY>0?-1:1,i.scaleX<1&&(u/=2);const p=s.zoomRatio;let g=+Number.parseFloat(`${p+u}`).toFixed(1);g=g>=4?4:g<=.1?.1:g,this._commandService.executeCommand(d.SetDocZoomRatioCommand.id,{zoomRatio:g,unitId:s.getUnitId()}),o.preventDefault()})))})}_skeletonListener(){this.disposeWithMe(a.toDisposable(this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(t==null)return;const e=this._univerInstanceService.getCurrentUniverDocInstance();if(!e)return;const n=e.zoomRatio||1;this._updateViewZoom(n,!1)})))}_commandExecutedListener(){const t=[d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(t.includes(e.id)){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(!n)return;const i=e.params,{unitId:o}=i;if(o!==n.getUnitId())return;const s=n.zoomRatio||1;this._updateViewZoom(s)}}))}_updateViewZoom(t,e=!0){var i;const n=this._getDocObject();n!=null&&(n.scene.scale(t,t),this._calculatePagePosition(n,t),e&&this._textSelectionManagerService.refreshSelection(),(i=n.scene.getTransformer())==null||i.hideControl())}_calculatePagePosition(t,e){const{document:n,scene:i,docBackground:o}=t,s=i==null?void 0:i.getParent(),{width:c,height:u,pageMarginLeft:p,pageMarginTop:g}=n;if(s==null||c===Number.POSITIVE_INFINITY||u===Number.POSITIVE_INFINITY)return;const{width:_,height:T}=s;let f=0,C=0,h=0,m=0,M=Number.POSITIVE_INFINITY;_>(c+p*2)*e?(f=_/2-c*e/2,f/=e,h=(_-p*2)/e,M=0):(f=p,h=c+p*2,M=(h-_/e)/2),T>u?(C=T/2-u/2,m=(T-g*2)/e):(C=g,m=u+g*2),i.resize(h,m+200),n.translate(f,C),o.translate(f,C);const y=i.getViewport(d.VIEWPORT_KEY.VIEW_MAIN);if(M!==Number.POSITIVE_INFINITY&&y!=null){const D=y.getBarScroll(M,0).x;y.scrollTo({x:D})}return this}_getDocObject(){return d.getDocObject(this._univerInstanceService,this._renderManagerService)}};re=Sn([a.OnLifecycle(a.LifecycleStages.Rendered,re),$(0,I.Inject(d.DocSkeletonManagerService)),$(1,a.IUniverInstanceService),$(2,a.ICommandService),$(3,v.IRenderManagerService),$(4,I.Inject(d.TextSelectionManagerService)),$(5,l.IEditorService)],re);var fn=Object.defineProperty,mn=Object.getOwnPropertyDescriptor,vn=(r,t,e,n)=>{for(var i=n>1?void 0:n?mn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&fn(t,e,i),i},L=(r,t)=>(e,n)=>t(e,n,r);let oe=class extends a.Disposable{constructor(t,e,n,i,o,s,c){super();O(this,"_loadedMap",new WeakSet);this._docSkeletonManagerService=t,this._univerInstanceService=e,this._commandService=n,this._renderManagerService=i,this._textSelectionRenderManager=o,this._textSelectionManagerService=s,this._editorService=c,this._initialize()}_initialize(){this._init(),this._skeletonListener(),this._commandExecutedListener()}_init(){this.disposeWithMe(this._renderManagerService.currentRender$.subscribe(t=>{this._create(t)})),this._renderManagerService.getRenderAll().forEach((t,e)=>{this._create(e)})}_create(t){if(t==null||this._univerInstanceService.getUniverDocInstance(t)==null)return;const e=this._getDocObjectById(t);e==null||e.document==null||this._loadedMap.has(e.document)||(this._initialMain(t),this._loadedMap.add(e.document))}_initialMain(t){const e=this._getDocObjectById(t);if(e==null)return;const{document:n,scene:i}=e;this.disposeWithMe(a.toDisposable(n.onPointerEnterObserver.add(()=>{this._isEditorReadOnly(t)||(n.cursor=v.CURSOR_TYPE.TEXT)}))),this.disposeWithMe(a.toDisposable(n.onPointerLeaveObserver.add(()=>{n.cursor=v.CURSOR_TYPE.DEFAULT,i.resetCursor()}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onPointerDownObserver.add((o,s)=>{if(this._isEditorReadOnly(t))return;const c=this._univerInstanceService.getCurrentUniverDocInstance();(c==null?void 0:c.getUnitId())!==t&&this._univerInstanceService.setCurrentUnitForType(t),this._textSelectionRenderManager.eventTrigger(o);const{offsetX:u,offsetY:p}=o;this._editorService.getEditor(t)&&setTimeout(()=>{this._setEditorFocus(t),this._textSelectionRenderManager.setCursorManually(u,p)},0),o.button!==2&&s.stopPropagation()}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onDblclickObserver.add(o=>{this._isEditorReadOnly(t)||this._textSelectionRenderManager.handleDblClick(o)}))),this.disposeWithMe(a.toDisposable(n==null?void 0:n.onTripleClickObserver.add(o=>{this._isEditorReadOnly(t)||this._textSelectionRenderManager.handleTripleClick(o)})))}_isEditorReadOnly(t){const e=this._editorService.getEditor(t);return e?e.isReadOnly():!1}_setEditorFocus(t){if(this._univerInstanceService.getAllUnitsForType(a.UniverInstanceType.UNIVER_SHEET).length>0){const n=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET);this._editorService.setOperationSheetUnitId(n.getUnitId())}this._editorService.focusStyle(t)}_commandExecutedListener(){const t=[d.SetDocZoomRatioOperation.id];this.disposeWithMe(this._commandService.onCommandExecuted(e=>{var n;if(t.includes(e.id)){const i=e.params,{unitId:o}=i,s=(n=this._textSelectionManagerService.getCurrentSelection())==null?void 0:n.unitId;if(o!==s)return;this._textSelectionManagerService.refreshSelection()}}))}_skeletonListener(){this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe(t=>{if(t==null)return;const{unitId:e,skeleton:n}=t,i=this._renderManagerService.getRenderById(e);if(i==null)return;const{scene:o,mainComponent:s}=i;this._textSelectionRenderManager.changeRuntime(n,o,s),this._textSelectionManagerService.setCurrentSelectionNotRefresh({unitId:e,subUnitId:""})}))}_getDocObjectById(t){return this._univerInstanceService.getUnitType(t)!==a.UniverInstanceType.UNIVER_DOC?null:d.getDocObjectById(t,this._renderManagerService)}};oe=vn([a.OnLifecycle(a.LifecycleStages.Rendered,oe),L(0,I.Inject(d.DocSkeletonManagerService)),L(1,a.IUniverInstanceService),L(2,a.ICommandService),L(3,v.IRenderManagerService),L(4,v.ITextSelectionRenderManager),L(5,I.Inject(d.TextSelectionManagerService)),L(6,l.IEditorService)],oe);var In=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,On=(r,t,e,n)=>{for(var i=n>1?void 0:n?Cn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&In(t,e,i),i},z=(r,t)=>(e,n)=>t(e,n,r);const we=1.5;let se=class extends a.RxDisposable{constructor(r,t,e,n,i){super(),this._docSkeletonManagerService=r,this._textSelectionManagerService=t,this._editorService=e,this._univerInstanceService=n,this._renderManagerService=i,this._init()}_init(){this._textSelectionManagerService.textSelection$.pipe(b.takeUntil(this.dispose$)).subscribe(r=>{if(r==null)return;const{isEditing:t,unitId:e}=r;t&&this._scrollToSelection(e)})}_scrollToSelection(r){var R;const t=this._textSelectionManagerService.getActiveRange(),e=this._getDocObject(),n=(R=this._docSkeletonManagerService.getCurrent())==null?void 0:R.skeleton;if(t==null||e==null||n==null)return;const{collapsed:i,startNodePosition:o}=t;if(!i)return;const s=e.document.getOffsetConfig(),{docsLeft:c,docsTop:u}=s,p=new v.NodePositionConvertToCursor(s,n),{contentBoxPointGroup:g}=p.getRangePointData(o,o),{left:_,top:T,height:f}=v.getAnchorBounding(g),C=_+c,h=T+u,m=e.scene.getViewport(d.VIEWPORT_KEY.VIEW_MAIN),M=!!this._editorService.getEditor(r);if(m==null)return;const{left:y,top:D,right:P,bottom:N}=m.getBounding().viewBound;let w=0,j=0;const le=M?0:100;h<D?w=h-D:h>N-f&&(w=h-N+f+le),C<y?j=C-y:C>P-we&&(j=C-P+we);const de=m.getBarScroll(j,w);m.scrollBy(de)}_getDocObject(){return d.getDocObject(this._univerInstanceService,this._renderManagerService)}};se=On([a.OnLifecycle(a.LifecycleStages.Rendered,se),z(0,I.Inject(d.DocSkeletonManagerService)),z(1,I.Inject(d.TextSelectionManagerService)),z(2,l.IEditorService),z(3,a.IUniverInstanceService),z(4,v.IRenderManagerService)],se);var Tn=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,Mn=(r,t,e,n)=>{for(var i=n>1?void 0:n?bn(t,e):t,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(t,e,i):s(i))||i);return n&&i&&Tn(t,e,i),i},me=(r,t)=>(e,n)=>t(e,n,r);S.UniverDocsUIPlugin=(ce=class extends a.Plugin{constructor(t,e,n,i){super(),this._config=t,this._injector=e,this._localeService=n,this._logService=i,this._localeService.load({zhCN:Ue}),this._config=a.Tools.deepMerge({},Oe,this._config),this._initDependencies(e),this._initializeCommands()}onRendered(){this._initModules(),this._markDocAsFocused()}_initializeCommands(){[He,ze,Ge,Ye,Ke,Xe,qe,Ze,Je,Bt,Ft,At].forEach(t=>{this._injector.get(l.IShortcutService).registerShortcut(t)})}_initDependencies(t){[[q],[J],[Q],[te],[ie],[re],[oe],[se],[V,{useFactory:()=>this._injector.createInstance(V,this._config)}],[k,{useClass:Se}],[S.DocCanvasView]].forEach(n=>{t.add(n)})}_markDocAsFocused(){const t=this._injector.get(a.IUniverInstanceService),e=this._injector.get(l.IEditorService);try{const n=t.getCurrentUniverDocInstance();if(!n)return;const i=n.getUnitId();e.isEditor(i)||t.focusUnit(n.getUnitId())}catch(n){this._logService.warn(n)}}_initModules(){this._injector.get(V)}},O(ce,"pluginName",Te),O(ce,"type",a.UniverInstanceType.UNIVER_DOC),ce),S.UniverDocsUIPlugin=Mn([me(1,I.Inject(I.Injector)),me(2,I.Inject(a.LocaleService)),me(3,a.ILogService)],S.UniverDocsUIPlugin),S.DOC_UI_PLUGIN_NAME=Te,S.DefaultDocContainerConfig=Ce,S.DefaultDocUiConfig=Oe,S.DefaultToolbarConfig=Ie,S.PastePluginLark=xe,S.PastePluginUniver=Be,S.PastePluginWord=Ae,S.enUS=Lt,S.zhCN=Ue,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "description": "Univer normal ui-plugin-docs",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -56,11 +56,11 @@
56
56
  "@wendellhu/redi": "^0.13.3",
57
57
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
58
58
  "rxjs": ">=7.0.0",
59
- "@univerjs/core": "0.1.9",
60
- "@univerjs/design": "0.1.9",
61
- "@univerjs/docs": "0.1.9",
62
- "@univerjs/engine-render": "0.1.9",
63
- "@univerjs/ui": "0.1.9"
59
+ "@univerjs/core": "0.1.10",
60
+ "@univerjs/design": "0.1.10",
61
+ "@univerjs/docs": "0.1.10",
62
+ "@univerjs/ui": "0.1.10",
63
+ "@univerjs/engine-render": "0.1.10"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/react": "^18.2.79",
@@ -71,12 +71,12 @@
71
71
  "typescript": "^5.4.5",
72
72
  "vite": "^5.2.10",
73
73
  "vitest": "^1.5.0",
74
- "@univerjs/core": "0.1.9",
75
- "@univerjs/design": "0.1.9",
76
- "@univerjs/docs": "0.1.9",
77
- "@univerjs/engine-render": "0.1.9",
78
- "@univerjs/shared": "0.1.9",
79
- "@univerjs/ui": "0.1.9"
74
+ "@univerjs/core": "0.1.10",
75
+ "@univerjs/docs": "0.1.10",
76
+ "@univerjs/design": "0.1.10",
77
+ "@univerjs/engine-render": "0.1.10",
78
+ "@univerjs/ui": "0.1.10",
79
+ "@univerjs/shared": "0.1.10"
80
80
  },
81
81
  "scripts": {
82
82
  "test": "vitest run",
@@ -1,13 +0,0 @@
1
- import { IEditorService } from '@univerjs/ui';
2
- import { IRenderManagerService } from '@univerjs/engine-render';
3
- import { Disposable, IUniverInstanceService } from '@univerjs/core';
4
-
5
- export declare class PageRenderController extends Disposable {
6
- private readonly _renderManagerService;
7
- private readonly _editorService;
8
- private readonly _univerInstanceService;
9
- constructor(_renderManagerService: IRenderManagerService, _editorService: IEditorService, _univerInstanceService: IUniverInstanceService);
10
- private _initialize;
11
- private _initialRenderRefresh;
12
- private _commandExecutedListener;
13
- }