@univerjs/docs-ui 0.1.0-beta.4 → 0.1.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1,2 @@
1
- "use strict";var N=Object.defineProperty;var B=(e,n,t)=>n in e?N(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n,t)=>(B(e,typeof n!="symbol"?n+"":n,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),m=require("@wendellhu/redi"),r=require("@univerjs/ui"),l=require("@univerjs/docs"),O=require("rxjs"),$=require("@univerjs/design"),b={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},F={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},U={layout:{docContainerConfig:F,toolbarConfig:b}},L="DocUI";var j=Object.defineProperty,w=Object.getOwnPropertyDescriptor,z=(e,n,t,o)=>{for(var i=o>1?void 0:o?w(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&j(n,t,i),i},M=(e,n)=>(t,o)=>n(t,o,e);let h=class{constructor(e,n,t){_(this,"_docContainer");_(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=n,this._injector=t}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};h=z([M(1,m.Inject(a.LocaleService)),M(2,m.Inject(m.Injector))],h);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,Y=(e,n,t,o)=>{for(var i=o>1?void 0:o?H(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&G(n,t,i),i},R=(e,n)=>(t,o)=>n(t,o,e);let C=class{constructor(e,n,t){_(this,"_docContainerController");_(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._localeService=n,this._injector=t,this._docContainerController=this._injector.createInstance(h,e)}getDocContainerController(){return this._docContainerController}};C=Y([R(1,m.Inject(a.LocaleService)),R(2,m.Inject(m.Injector))],C);const v="UI_PLUGIN_DOCS",x=`${v}_COLOR_PICKER_COMPONENT`,A=`${v}_FONT_FAMILY_COMPONENT`,y=`${v}_FONT_FAMILY_ITEM_COMPONENT`,D=`${v}_FONT_SIZE_COMPONENT`;function q(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatBoldCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.bl;t.next(d===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function W(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatItalicCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.it;t.next(d===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Z(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatUnderlineCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.ul;t.next((d==null?void 0:d.s)===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function K(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatStrikethroughCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.st;t.next((d==null?void 0:d.s)===a.BooleanNumber.TRUE)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function V(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatSubscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.va;t.next(d===a.BaselineOffset.SUBSCRIPT)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function X(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatSuperscriptCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[r.MenuPosition.TOOLBAR_START],activated$:new O.Observable(t=>{const o=n.onCommandExecuted(i=>{var s;const c=i.id;if(c===l.SetTextSelectionsOperation.id||c===l.SetInlineFormatCommand.id){const u=T(e);if(u==null)return;const d=(s=u.ts)==null?void 0:s.va;t.next(d===a.BaselineOffset.SUPERSCRIPT)}});return t.next(!1),o.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function J(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.SELECTOR,label:A,positions:[r.MenuPosition.TOOLBAR_START],selections:r.FONT_FAMILY_LIST.map(t=>({label:{name:y,hoverable:!0},value:t.value})),value$:new O.Observable(t=>{const o=r.FONT_FAMILY_LIST[0].value,i=n.onCommandExecuted(c=>{var u;const s=c.id;if(s===l.SetTextSelectionsOperation.id||s===l.SetInlineFormatFontFamilyCommand.id){const d=T(e);if(d==null)return;const p=(u=d.ts)==null?void 0:u.ff;t.next(p!=null?p:o)}});return t.next(o),i.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Q(e){const n=e.get(a.ICommandService);return{id:l.SetInlineFormatFontSizeCommand.id,group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:D,props:{min:1,max:400}},positions:[r.MenuPosition.TOOLBAR_START],selections:r.FONT_SIZE_LIST,value$:new O.Observable(t=>{const i=n.onCommandExecuted(c=>{var u;const s=c.id;if(s===l.SetTextSelectionsOperation.id||s===l.SetInlineFormatFontSizeCommand.id){const d=T(e);if(d==null)return;const p=(u=d.ts)==null?void 0:u.fs;t.next(p!=null?p:14)}});return t.next(14),i.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function k(e){const n=e.get(a.ICommandService),t=e.get(a.ThemeService);return{id:l.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:r.MenuGroup.TOOLBAR_FORMAT,type:r.MenuItemType.BUTTON_SELECTOR,positions:[r.MenuPosition.TOOLBAR_START],selections:[{label:{name:x,hoverable:!1}}],value$:new O.Observable(o=>{const i=t.getCurrentTheme().textColor,c=n.onCommandExecuted(s=>{if(s.id===l.SetInlineFormatTextColorCommand.id){const u=s.params.value;o.next(u!=null?u:i)}});return o.next(i),c.dispose}),hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function ee(e){return{id:l.OrderListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function te(e){return{id:l.BulletListCommand.id,group:r.MenuGroup.TOOLBAR_LAYOUT,type:r.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[r.MenuPosition.TOOLBAR_START],hidden$:r.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function T(e){var d;const n=e.get(a.IUniverInstanceService),t=e.get(l.TextSelectionManagerService),o=n.getCurrentUniverDocInstance(),i=t.getActiveRange();if(o==null||i==null)return;const c=(d=o.getBody())==null?void 0:d.textRuns;if(c==null)return;const{startOffset:s}=i;return c.find(({st:p,ed:E})=>s>=p&&s<E)}var ne=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,ie=(e,n,t,o)=>{for(var i=o>1?void 0:o?oe(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&ne(n,t,i),i},S=(e,n)=>(t,o)=>n(t,o,e);let I=class extends a.Disposable{constructor(e,n,t,o,i,c){super(),this._injector=e,this._componentManager=n,this._commandService=t,this._shortcutService=o,this._menuService=i,this._uiController=c,this._init()}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register(x,$.ColorPicker)),this.disposeWithMe(e.register(A,r.FontFamily)),this.disposeWithMe(e.register(y,r.FontFamilyItem)),this.disposeWithMe(e.register(D,r.FontSize))}_initMenus(){[q,W,Z,K,V,X,Q,J,k,ee,te].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}_init(){this._initCustomComponents(),this._initMenus()}};I=ie([a.OnLifecycle(a.LifecycleStages.Rendered,I),S(0,m.Inject(m.Injector)),S(1,m.Inject(r.ComponentManager)),S(2,a.ICommandService),S(3,r.IShortcutService),S(4,r.IMenuService),S(5,r.IUIController)],I);const re={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",textColor:{main:"Text color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list"}},P={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表"}};var se=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,ae=(e,n,t,o)=>{for(var i=o>1?void 0:o?ce(n,t):n,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(o?s(n,t,i):s(i))||i);return o&&i&&se(n,t,i),i},f=(e,n)=>(t,o)=>n(t,o,e),g;exports.UniverDocsUIPlugin=(g=class extends a.Plugin{constructor(n,t,o,i){super(L),this._config=n,this._injector=t,this._localeService=o,this._logService=i,this._localeService.load({zhCN:P}),this._config=a.Tools.deepMerge({},U,this._config),this._initDependencies(t)}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initDependencies(n){[[I],[C,{useFactory:()=>this._injector.createInstance(C,this._config)}]].forEach(o=>{n.add(o)})}_markDocAsFocused(){const n=this._injector.get(a.IUniverInstanceService);try{const t=n.getCurrentUniverDocInstance(),o=t.getUnitId();o!==a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&o!==a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&n.focusUniverInstance(t.getUnitId())}catch(t){this._logService.warn(t)}}_initModules(){this._injector.get(C)}},_(g,"type",a.PluginType.Doc),g);exports.UniverDocsUIPlugin=ae([f(1,m.Inject(m.Injector)),f(2,m.Inject(a.LocaleService)),f(3,a.ILogService)],exports.UniverDocsUIPlugin);exports.DOC_UI_PLUGIN_NAME=L;exports.DefaultDocContainerConfig=F;exports.DefaultDocUiConfig=U;exports.DefaultToolbarConfig=b;exports.enUS=re;exports.zhCN=P;
1
+ "use strict";var oe=Object.defineProperty;var re=(e,t,n)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>(re(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),g=require("@wendellhu/redi"),c=require("@univerjs/ui"),d=require("@univerjs/docs"),Y=require("@univerjs/engine-render"),ie=require("@univerjs/design"),S=require("rxjs"),k={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},q={outerLeft:!1,outerRight:!1,header:!0,footer:!0,innerLeft:!1,innerRight:!1,frozenHeaderLT:!1,frozenHeaderRT:!1,frozenHeaderLM:!1,frozenContent:!1,infoBar:!0,toolbar:!0},Z={layout:{docContainerConfig:q,toolbarConfig:k}},X="DocUI",se={id:d.MoveCursorOperation.id,binding:c.KeyCode.ARROW_UP,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.UP}},ae={id:d.MoveCursorOperation.id,binding:c.KeyCode.ARROW_DOWN,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.DOWN}},ce={id:d.MoveCursorOperation.id,binding:c.KeyCode.ARROW_LEFT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.LEFT}},le={id:d.MoveCursorOperation.id,binding:c.KeyCode.ARROW_RIGHT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.RIGHT}},de={id:d.MoveSelectionOperation.id,binding:c.KeyCode.ARROW_UP|c.MetaKeys.SHIFT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.UP}},ue={id:d.MoveSelectionOperation.id,binding:c.KeyCode.ARROW_DOWN|c.MetaKeys.SHIFT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.DOWN}},pe={id:d.MoveSelectionOperation.id,binding:c.KeyCode.ARROW_LEFT|c.MetaKeys.SHIFT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.LEFT}},me={id:d.MoveSelectionOperation.id,binding:c.KeyCode.ARROW_RIGHT|c.MetaKeys.SHIFT,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),staticParameters:{direction:a.Direction.RIGHT}},fe={id:d.SelectAllOperation.id,binding:c.KeyCode.A|c.MetaKeys.CTRL_COMMAND,preconditions:e=>e.getContextValue(a.FOCUSING_DOC)||e.getContextValue(a.EDITOR_ACTIVATED)};var he=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Ce=(e,t,n,o)=>{for(var r=o>1?void 0:o?ge(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&he(t,n,r),r},G=(e,t)=>(n,o)=>t(n,o,e);let $=class{constructor(e,t,n){h(this,"_docContainer");h(this,"getComponent",e=>{if(this._docContainer=e,!e.getContentRef().current)throw new Error("container is not ready")});h(this,"changeLocale",e=>{this._localeService.setLocale(e)});this._config=e,this._localeService=t,this._injector=n}getUIConfig(){return{injector:this._injector,config:this._config,changeLocale:this.changeLocale,getComponent:this.getComponent}}getContentRef(){return this._docContainer.getContentRef()}UIDidMount(e){if(this._docContainer)return e(this._docContainer)}getDocContainer(){return this._docContainer}};$=Ce([G(1,g.Inject(a.LocaleService)),G(2,g.Inject(g.Injector))],$);var _e=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Oe=(e,t,n,o)=>{for(var r=o>1?void 0:o?Se(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&_e(t,n,r),r},P=(e,t)=>(n,o)=>t(n,o,e);let R=class extends a.RxDisposable{constructor(t,n,o,r,i){super();h(this,"_docContainerController");h(this,"changeLocale",t=>{this._localeService.setLocale(t)});this._localeService=n,this._injector=o,this._textSelectionRenderManager=r,this._layoutService=i,this._docContainerController=this._injector.createInstance($,t),this._registerContainer()}_registerContainer(){this._layoutService&&this.disposeWithMe(this._layoutService.registerContainer(this._textSelectionRenderManager.__getEditorContainer()))}getDocContainerController(){return this._docContainerController}};R=Oe([P(1,g.Inject(a.LocaleService)),P(2,g.Inject(g.Injector)),P(3,Y.ITextSelectionRenderManager),P(4,g.Optional(c.LayoutService))],R);const F="UI_PLUGIN_DOCS",J=`${F}_COLOR_PICKER_COMPONENT`,Q=`${F}_FONT_FAMILY_COMPONENT`,ee=`${F}_FONT_FAMILY_ITEM_COMPONENT`,te=`${F}_FONT_SIZE_COMPONENT`;function ve(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatBoldCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"BoldSingle",title:"Set bold",tooltip:"toolbar.bold",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.bl;n.next(u===a.BooleanNumber.TRUE)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Te(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatItalicCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"ItalicSingle",title:"Set italic",tooltip:"toolbar.italic",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.it;n.next(u===a.BooleanNumber.TRUE)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Ie(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatUnderlineCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"UnderlineSingle",title:"Set underline",tooltip:"toolbar.underline",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.ul;n.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function be(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatStrikethroughCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"StrikethroughSingle",title:"Set strike through",tooltip:"toolbar.strikethrough",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.st;n.next((u==null?void 0:u.s)===a.BooleanNumber.TRUE)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function ye(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatSubscriptCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"SubscriptSingle",tooltip:"toolbar.subscript",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.va;n.next(u===a.BaselineOffset.SUBSCRIPT)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Re(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatSuperscriptCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON,icon:"SuperscriptSingle",tooltip:"toolbar.superscript",positions:[c.MenuPosition.TOOLBAR_START],activated$:new S.Observable(n=>{const o=t.onCommandExecuted(r=>{var s;const i=r.id;if(i===d.SetTextSelectionsOperation.id||i===d.SetInlineFormatCommand.id){const l=O(e);if(l==null)return;const u=(s=l.ts)==null?void 0:s.va;n.next(u===a.BaselineOffset.SUPERSCRIPT)}});return n.next(!1),o.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Me(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatFontFamilyCommand.id,tooltip:"toolbar.font",group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.SELECTOR,label:Q,positions:[c.MenuPosition.TOOLBAR_START],selections:c.FONT_FAMILY_LIST.map(n=>({label:{name:ee,hoverable:!0},value:n.value})),value$:new S.Observable(n=>{const o=c.FONT_FAMILY_LIST[0].value,r=t.onCommandExecuted(i=>{var l;const s=i.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontFamilyCommand.id){const u=O(e);if(u==null)return;const p=(l=u.ts)==null?void 0:l.ff;n.next(p!=null?p:o)}});return n.next(o),r.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function De(e){const t=e.get(a.ICommandService);return{id:d.SetInlineFormatFontSizeCommand.id,group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.SELECTOR,tooltip:"toolbar.fontSize",label:{name:te,props:{min:1,max:400}},positions:[c.MenuPosition.TOOLBAR_START],selections:c.FONT_SIZE_LIST,value$:new S.Observable(n=>{const r=t.onCommandExecuted(i=>{var l;const s=i.id;if(s===d.SetTextSelectionsOperation.id||s===d.SetInlineFormatFontSizeCommand.id){const u=O(e);if(u==null)return;const p=(l=u.ts)==null?void 0:l.fs;n.next(p!=null?p:14)}});return n.next(14),r.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function xe(e){const t=e.get(a.ICommandService),n=e.get(a.ThemeService);return{id:d.SetInlineFormatTextColorCommand.id,icon:"FontColor",tooltip:"toolbar.textColor.main",group:c.MenuGroup.TOOLBAR_FORMAT,type:c.MenuItemType.BUTTON_SELECTOR,positions:[c.MenuPosition.TOOLBAR_START],selections:[{label:{name:J,hoverable:!1}}],value$:new S.Observable(o=>{const r=n.getCurrentTheme().textColor,i=t.onCommandExecuted(s=>{if(s.id===d.SetInlineFormatTextColorCommand.id){const l=s.params.value;o.next(l!=null?l:r)}});return o.next(r),i.dispose}),hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Pe(e){return{id:d.OrderListCommand.id,group:c.MenuGroup.TOOLBAR_LAYOUT,type:c.MenuItemType.BUTTON,icon:"OrderSingle",tooltip:"toolbar.order",positions:[c.MenuPosition.TOOLBAR_START],hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function Ne(e){return{id:d.BulletListCommand.id,group:c.MenuGroup.TOOLBAR_LAYOUT,type:c.MenuItemType.BUTTON,icon:"UnorderSingle",tooltip:"toolbar.unorder",positions:[c.MenuPosition.TOOLBAR_START],hidden$:c.getMenuHiddenObservable(e,a.UniverInstanceType.DOC)}}function O(e){var u;const t=e.get(a.IUniverInstanceService),n=e.get(d.TextSelectionManagerService),o=t.getCurrentUniverDocInstance(),r=n.getActiveRange();if(o==null||r==null)return;const i=(u=o.getBody())==null?void 0:u.textRuns;if(i==null)return;const{startOffset:s}=r;return i.find(({st:p,ed:f})=>s>=p&&s<f)}var Ue=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,Fe=(e,t,n,o)=>{for(var r=o>1?void 0:o?Ee(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&Ue(t,n,r),r},T=(e,t)=>(n,o)=>t(n,o,e);let N=class extends a.Disposable{constructor(e,t,n,o,r,i){super(),this._injector=e,this._componentManager=t,this._commandService=n,this._shortcutService=o,this._menuService=r,this._uiController=i,this._init()}_initCustomComponents(){const e=this._componentManager;this.disposeWithMe(e.register(J,ie.ColorPicker)),this.disposeWithMe(e.register(Q,c.FontFamily)),this.disposeWithMe(e.register(ee,c.FontFamilyItem)),this.disposeWithMe(e.register(te,c.FontSize))}_initMenus(){[ve,Te,Ie,be,ye,Re,De,Me,xe,Pe,Ne].forEach(e=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e)))})}_init(){this._initCustomComponents(),this._initMenus()}};N=Fe([a.OnLifecycle(a.LifecycleStages.Rendered,N),T(0,g.Inject(g.Injector)),T(1,g.Inject(c.ComponentManager)),T(2,a.ICommandService),T(3,c.IShortcutService),T(4,c.IMenuService),T(5,c.IUIController)],N);const Ae={toolbar:{undo:"Undo",redo:"Redo",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",textColor:{main:"Text color",right:"Choose color"},resetColor:"Reset",order:"Ordered list",unorder:"Unordered list"}},ne={toolbar:{undo:"撤销",redo:"重做",font:"字体",fontSize:"字号",bold:"粗体",italic:"斜体",strikethrough:"删除线",subscript:"下标",superscript:"上标",underline:"下划线",textColor:{main:"文本颜色",right:"颜色选择"},resetColor:"重置颜色",order:"有序列表",unorder:"无序列表"}},Le={id:d.BreakLineCommand.id,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),binding:c.KeyCode.ENTER},Be={id:d.DeleteLeftCommand.id,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),binding:c.KeyCode.BACKSPACE},$e={id:d.DeleteRightCommand.id,preconditions:e=>e.getContextValue(a.FOCUSING_DOC),binding:c.KeyCode.DELETE},we=10,je=6;function He(){return a.Tools.generateRandomId(je)}function Ge(e){const t=e.match(/data-copy-id="([^\s]+)"/);return t&&t[1]?t[1]:null}class Ve{constructor(){h(this,"_cache",new a.LRUMap(we))}set(t,n){this._cache.set(t,n)}get(t){return this._cache.get(t)}clear(){this._cache.clear()}}const V=new Ve;function j(e){const t=e.style,n={},o=e.tagName.toLowerCase();switch(o){case"b":case"em":case"strong":{n.bl=a.BooleanNumber.TRUE;break}case"s":{n.st={s:a.BooleanNumber.TRUE};break}case"u":{n.ul={s:a.BooleanNumber.TRUE};break}case"i":{n.it=a.BooleanNumber.TRUE;break}case"sub":case"sup":{n.va=o==="sup"?a.BaselineOffset.SUPERSCRIPT:a.BaselineOffset.SUBSCRIPT;break}}for(let r=0;r<t.length;r++){const i=t[r],s=t.getPropertyValue(i);switch(i){case"font-family":{n.ff=s;break}case"font-size":{const l=Number.parseInt(s);Number.isNaN(l)||s.endsWith("pt")&&(n.fs=l);break}case"font-style":{s==="italic"&&(n.it=a.BooleanNumber.TRUE);break}case"font-weight":{Number(s)>400&&(n.bl=a.BooleanNumber.TRUE);break}case"text-decoration":{/underline/.test(s)?n.ul={s:a.BooleanNumber.TRUE}:/overline/.test(s)?n.ol={s:a.BooleanNumber.TRUE}:/line-through/.test(s)&&(n.st={s:a.BooleanNumber.TRUE});break}case"color":{const l=new a.ColorKit(s);l.isValid&&(n.cl={rgb:l.toRgbString()});break}case"background-color":{const l=new a.ColorKit(s);l.isValid&&(n.bg={rgb:l.toRgbString()});break}}}return n}function Ke(e){const t=new DOMParser,n=`<x-univer id="univer-root">${e}</x-univer>`;return t.parseFromString(n,"text/html").querySelector("#univer-root")}function K(e,t){const n=e.tagName.toLowerCase();return typeof t=="string"?n===t:Array.isArray(t)?t.some(o=>o===n):t(e)}const E=class E{constructor(){h(this,"_styleCache",new Map);h(this,"_styleRules",[]);h(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 n=E._pluginList.find(i=>i.checkPasteType(t)),o=Ke(t),r={dataStream:"",textRuns:[]};return n&&(this._styleRules=[...n.stylesRules],this._afterProcessRules=[...n.afterProcessRules]),this._styleCache.clear(),this._process(null,o==null?void 0:o.childNodes,r),this._styleCache.clear(),this._styleRules=[],this._afterProcessRules=[],r}_process(t,n,o){var r;for(const i of n)if(i.nodeType===Node.TEXT_NODE){const s=(r=i.nodeValue)==null?void 0:r.replace(/[\r\n]/g,"");let l;t&&this._styleCache.has(t)&&(l=this._styleCache.get(t)),o.dataStream+=s,l&&Object.getOwnPropertyNames(l).length&&o.textRuns.push({st:o.dataStream.length-s.length,ed:o.dataStream.length,ts:l})}else if(i.nodeType===Node.ELEMENT_NODE){const s=t?this._styleCache.get(t):{},l=this._styleRules.find(({filter:_})=>K(i,_)),u=l?l.getStyle(i):j(i);this._styleCache.set(i,{...s,...u});const{childNodes:p}=i;this._process(i,p,o);const f=this._afterProcessRules.find(({filter:_})=>K(i,_));f&&f.handler(o,i)}}};h(E,"_pluginList",[]);let M=E;const We={name:"univer-doc-paste-plugin-lark",checkPasteType(e){return/lark-record-clipboard/i.test(e)},stylesRules:[{filter:["s"],getStyle(e){const t=j(e);return{st:{s:a.BooleanNumber.TRUE},...t}}}],afterProcessRules:[{filter(e){return e.tagName==="DIV"&&/ace-line/i.test(e.className)},handler(e){e.paragraphs==null&&(e.paragraphs=[]),e.paragraphs.push({startIndex:e.dataStream.length}),e.dataStream+="\r"}}]};function ze(e){const t=e.style,n={};for(let o=0;o<t.length;o++){const r=t[o],i=t.getPropertyValue(r);switch(r){case"margin-top":{const s=Number.parseInt(i);n.spaceAbove=/pt/.test(i)?W(s):s;break}case"margin-bottom":{const s=Number.parseInt(i);n.spaceBelow=/pt/.test(i)?W(s):s;break}}}return Object.getOwnPropertyNames(n).length?n:null}function W(e){return e/.75}const Ye={name:"univer-doc-paste-plugin-word",checkPasteType(e){return/word|mso/i.test(e)},stylesRules:[{filter:["b"],getStyle(e){const t=j(e);return{bl:a.BooleanNumber.TRUE,...t}}}],afterProcessRules:[{filter(e){return e.tagName==="P"&&/mso/i.test(e.className)},handler(e,t){e.paragraphs==null&&(e.paragraphs=[]);const n={startIndex:e.dataStream.length},o=ze(t);o&&(n.paragraphStyle=o),e.paragraphs.push(n),e.dataStream+="\r"}}]};function ke(e,t){const{st:n,ed:o,ts:r={}}=t,{ff:i,fs:s,it:l,bl:u,ul:p,st:f,ol:_,bg:I,cl:x,va:v}=r;let m=e.slice(n,o);const C=[];return l===a.BooleanNumber.TRUE&&(m=`<i>${m}</i>`),v===a.BaselineOffset.SUPERSCRIPT?m=`<sup>${m}</sup>`:v===a.BaselineOffset.SUBSCRIPT&&(m=`<sub>${m}</sub>`),(p==null?void 0:p.s)===a.BooleanNumber.TRUE&&(m=`<u>${m}</u>`),(f==null?void 0:f.s)===a.BooleanNumber.TRUE&&(m=`<s>${m}</s>`),u===a.BooleanNumber.TRUE&&(m=`<strong>${m}</strong>`),i&&C.push(`font-family: ${i}`),x&&C.push(`color: ${x.rgb}`),s&&C.push(`font-size: ${s}px`),_&&C.push("text-decoration: overline"),I&&C.push(`background: ${I.rgb}`),C.length?`<span style="${C.join(";")}">${m}</span>`:m}function z(e,t=!0){const{dataStream:n,textRuns:o=[],paragraphs:r=[]}=e;let i=0;const s=[],l=[];for(const u of o){const{st:p,ed:f}=u;if(p!==i&&s.push(n.slice(i,p)),s.push(ke(n,u)),i=f,t)for(const _ of r){const{startIndex:I,paragraphStyle:x={}}=_;if(I>=p&&I<=f){const{spaceAbove:v,spaceBelow:m}=x,C=[];v!=null&&(typeof v=="number"?C.push(`margin-top: ${v}px`):C.push(`margin-top: ${v.v}px`)),m!=null&&(typeof m=="number"?C.push(`margin-bottom: ${m}px`):C.push(`margin-bottom: ${m.v}px`)),l.push(`<p className="UniverNormal" ${C.length?`style="${C.join(";")}"`:""}>${s.join("")}</p>`),s.length=0}}}return i<n.length&&s.push(n.slice(i,n.length)),l.join("")+s.join("")}class qe{convert(t){if(t.length===0)throw new Error("The bodyList length at least to be 1");if(t.length===1)return z(t[0]);let n="";for(const o of t)n+='<p className="UniverNormal">',n+=z(o,!1),n+="</p>";return n}}var Ze=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Je=(e,t,n,o)=>{for(var r=o>1?void 0:o?Xe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&Ze(t,n,r),r},b=(e,t)=>(n,o)=>t(n,o,e);M.use(Ye);M.use(We);function Qe(e){const t=e.replace(/\n/g,"\r"),n=[];for(let o=0;o<t.length;o++)t[o]==="\r"&&n.push({startIndex:o});return{dataStream:t,paragraphs:n}}const D=g.createIdentifier("doc.clipboard-service");let w=class extends a.Disposable{constructor(t,n,o,r,i){super();h(this,"_clipboardHooks",[]);h(this,"_htmlToUDM",new M);h(this,"_umdToHtml",new qe);this._currentUniverService=t,this._logService=n,this._commandService=o,this._clipboardInterfaceService=r,this._textSelectionManagerService=i}async copy(){const t=this._getDocumentBodyInRanges();try{this._setClipboardData(t)}catch(n){return this._logService.error("[DocClipboardService] copy failed",n),!1}return!0}async cut(){return this._cut()}async paste(t){const n=await this._generateBodyFromClipboardItems(t);return this._paste(n)}async legacyPaste(t,n){const o=this._generateBodyFromHtmlAndText(t,n);return this._paste(o)}async _cut(){var i;const{segmentId:t,endOffset:n,style:o}=(i=this._textSelectionManagerService.getActiveRange())!=null?i:{},r=this._textSelectionManagerService.getSelections();if(t==null&&this._logService.error("[DocClipboardController] segmentId is not existed"),n==null||r==null)return!1;this.copy();try{let s=n;for(const u of r){const{startOffset:p,endOffset:f}=u;p==null||f==null||f<=n&&(s-=f-p)}const l=[{startOffset:s,endOffset:s,style:o}];return this._commandService.executeCommand(d.CutContentCommand.id,{segmentId:t,textRanges:l})}catch{return this._logService.error("[DocClipboardController] cut content failed"),!1}}async _paste(t){var s;const{segmentId:n,endOffset:o,style:r}=(s=this._textSelectionManagerService.getActiveRange())!=null?s:{},i=this._textSelectionManagerService.getSelections();if(n==null&&this._logService.error("[DocClipboardController] segmentId does not exist!"),o==null||i==null)return!1;try{let l=o;for(const p of i){const{startOffset:f,endOffset:_}=p;f==null||_==null||_<=o&&(l+=t.dataStream.length-(_-f))}const u=[{startOffset:l,endOffset:l,style:r}];return this._commandService.executeCommand(d.InnerPasteCommand.id,{body:t,segmentId:n,textRanges:u})}catch{return this._logService.error("[DocClipboardController]","clipboard is empty."),!1}}async _setClipboardData(t){const n=He(),o=t.length>1?t.map(i=>i.dataStream).join(`
2
+ `):t[0].dataStream;let r=this._umdToHtml.convert(t);return t.length===1&&(r=r.replace(/(<[a-z]+)/,(i,s)=>`${s} data-copy-id="${n}"`),V.set(n,t[0])),this._clipboardInterfaceService.write(o,r)}addClipboardHook(t){return this._clipboardHooks.push(t),a.toDisposable(()=>{const n=this._clipboardHooks.indexOf(t);n>-1&&this._clipboardHooks.splice(n,1)})}_getDocumentBodyInRanges(){const t=this._textSelectionManagerService.getSelections(),n=this._currentUniverService.getCurrentUniverDocInstance(),o=[];if(t==null)return o;for(const r of t){const{startOffset:i,endOffset:s,collapsed:l}=r;if(l||i==null||s==null)continue;const u=n.sliceBody(i,s);u!=null&&o.push(u)}return o}async _generateBodyFromClipboardItems(t){try{let n="",o="";for(const r of t)for(const i of r.types)i===c.PLAIN_TEXT_CLIPBOARD_MIME_TYPE?o=await r.getType(i).then(s=>s&&s.text()):i===c.HTML_CLIPBOARD_MIME_TYPE&&(n=await r.getType(i).then(s=>s&&s.text()));return this._generateBodyFromHtmlAndText(n,o)}catch(n){return Promise.reject(n)}}_generateBodyFromHtmlAndText(t,n){if(!t){if(n)return Qe(n);throw new Error("[DocClipboardService] html and text cannot be both empty!")}const o=Ge(t);if(o){const r=V.get(o);if(r)return r}return this._htmlToUDM.convert(t)}};w=Je([b(0,a.IUniverInstanceService),b(1,a.ILogService),b(2,a.ICommandService),b(3,c.IClipboardInterfaceService),b(4,g.Inject(d.TextSelectionManagerService))],w);function A(e){return e.getContextValue(a.FOCUSING_DOC)||e.getContextValue(a.EDITOR_ACTIVATED)}const H=999,et={id:c.CopyCommand.id,name:"doc.command.copy",type:a.CommandType.COMMAND,multi:!0,priority:H,preconditions:A,handler:async e=>e.get(D).copy()},tt={id:c.CutCommand.id,name:"doc.command.cut",type:a.CommandType.COMMAND,multi:!0,priority:H,preconditions:A,handler:async e=>e.get(D).cut()},nt={id:c.PasteCommand.id,name:"doc.command.paste",type:a.CommandType.COMMAND,multi:!0,priority:H,preconditions:A,handler:async e=>{const t=e.get(D),o=await e.get(c.IClipboardInterfaceService).read();return o.length===0?!1:t.paste(o)}};var ot=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,it=(e,t,n,o)=>{for(var r=o>1?void 0:o?rt(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&ot(t,n,r),r},y=(e,t)=>(n,o)=>t(n,o,e);let U=class extends a.RxDisposable{constructor(e,t,n,o,r){super(),this._commandService=e,this._clipboardInterfaceService=t,this._docClipboardService=n,this._textSelectionRenderManager=o,this._contextService=r,this._init()}_init(){[et,tt,nt].forEach(e=>this.disposeWithMe(this._commandService.registerMultipleCommand(e))),[d.InnerPasteCommand,d.CutContentCommand].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this._initLegacyPasteCommand()}_initLegacyPasteCommand(){var e;this._clipboardInterfaceService.supportClipboard||(e=this._textSelectionRenderManager)==null||e.onPaste$.pipe(S.takeUntil(this.dispose$)).subscribe(t=>{var i,s;if(!A(this._contextService))return;t.event.preventDefault();const n=t.event,o=(i=n.clipboardData)==null?void 0:i.getData("text/html"),r=(s=n.clipboardData)==null?void 0:s.getData("text/plain");this._docClipboardService.legacyPaste(o,r)})}};U=it([a.OnLifecycle(a.LifecycleStages.Steady,U),y(0,a.ICommandService),y(1,c.IClipboardInterfaceService),y(2,D),y(3,Y.ITextSelectionRenderManager),y(4,a.IContextService)],U);var st=Object.defineProperty,at=Object.getOwnPropertyDescriptor,ct=(e,t,n,o)=>{for(var r=o>1?void 0:o?at(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(r=(o?s(t,n,r):s(r))||r);return o&&r&&st(t,n,r),r},L=(e,t)=>(n,o)=>t(n,o,e),B;exports.UniverDocsUIPlugin=(B=class extends a.Plugin{constructor(t,n,o,r){super(X),this._config=t,this._injector=n,this._localeService=o,this._logService=r,this._localeService.load({zhCN:ne}),this._config=a.Tools.deepMerge({},Z,this._config),this._initDependencies(n),this._initializeCommands()}onRendered(){this._initModules(),this._markDocAsFocused()}onDestroy(){}_initializeCommands(){[se,ae,le,ce,de,ue,pe,me,fe,Be,$e,Le].forEach(t=>{this._injector.get(c.IShortcutService).registerShortcut(t)})}_initDependencies(t){[[N],[U],[R,{useFactory:()=>this._injector.createInstance(R,this._config)}],[D,{useClass:w}]].forEach(o=>{t.add(o)})}_markDocAsFocused(){const t=this._injector.get(a.IUniverInstanceService);try{const n=t.getCurrentUniverDocInstance(),o=n.getUnitId();o!==a.DOCS_NORMAL_EDITOR_UNIT_ID_KEY&&o!==a.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY&&t.focusUniverInstance(n.getUnitId())}catch(n){this._logService.warn(n)}}_initModules(){this._injector.get(R)}},h(B,"type",a.PluginType.Doc),B);exports.UniverDocsUIPlugin=ct([L(1,g.Inject(g.Injector)),L(2,g.Inject(a.LocaleService)),L(3,a.ILogService)],exports.UniverDocsUIPlugin);exports.DOC_UI_PLUGIN_NAME=X;exports.DefaultDocContainerConfig=q;exports.DefaultDocUiConfig=Z;exports.DefaultToolbarConfig=k;exports.enUS=Ae;exports.zhCN=ne;