@univerjs/ui 0.1.8 → 0.1.9
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 +4 -4
- package/lib/es/index.js +950 -942
- package/lib/types/services/global-zone/desktop-global-zone.service.d.ts +2 -0
- package/lib/types/services/global-zone/global-zone.service.d.ts +1 -0
- package/lib/types/services/layout/layout.service.d.ts +1 -1
- package/lib/umd/index.js +4 -4
- package/package.json +12 -12
package/lib/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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 Co=s,So=Symbol.for("react.element"),bo=Symbol.for("react.fragment"),yo=Object.prototype.hasOwnProperty,_o=Co.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Lo={key:!0,ref:!0,__self:!0,__source:!0};function l6(e,t,n){var r,i={},a=null,o=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)yo.call(t,r)&&!Lo.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:So,type:e,key:a,ref:o,props:i,_owner:_o.current}}nt.Fragment=bo;nt.jsx=l6;nt.jsxs=l6;s6.exports=nt;var v=s6.exports;function Tn(e){return typeof e=="function"?e():e}function Eo(e,t){return e.length!==t.length?!0:e.some((n,r)=>n!==t[r])}function Ae(e,t,n,r){var S;if(typeof e=="function"&&!r)throw new Error("[useObservable]: expect deps when observable is a function! Otherwise it would cause an infinite loop.");const i=s.useRef(null),a=s.useRef(null),o=s.useRef(r!=null?r:void 0),u=s.useRef(!1),[d,h]=s.useState(0),g=s.useRef((()=>{let y;return e&&Tn(e).subscribe(A=>{u.current=!0,y=A}).unsubscribe(),y!=null?y:t})()),f=(()=>{if(typeof o.current<"u"){const y=r!=null?r:[];return Eo(o.current,y)?(o.current=y,!0):!1}return i.current!==e})();if((!a.current||f)&&e&&(i.current=Tn(e),(S=a.current)==null||S.unsubscribe(),a.current=i.current.subscribe(y=>{g.current=y,h(_=>_+1)})),s.useEffect(()=>()=>{var y;(y=a.current)==null||y.unsubscribe(),a.current=null},[]),n&&!u.current)throw new Error("[useObservable]: expect shouldHaveSyncValue but not getting a sync value!");return g.current}function $e(e){const{title:t,icon:n,label:r,value:i,value$:a}=e,o=le.useDependency(L.LocaleService),u=le.useDependency(e1),d=[];let h=0,g=i;a&&(g=Ae(a,void 0,!0));let f;ie.isObservable(n)?f=Ae(n,void 0,!0):f=n;let S=!1;if(g&&typeof g=="string"&&(S=new L.ColorKit(g).isValid),n){const y=u.get(f!=null?f:"");y&&d.push(v.jsx(y,{extend:{colorChannel1:S?g:"rgb(var(--primary-color))"}},h++))}if(r){const y=typeof r=="string",_=y?{...e}:{...r==null?void 0:r.props,...e},A=y?r:r==null?void 0:r.name,O=u.get(A);O?d.push(v.jsx(O,{..._,value:g},h++)):d.push(v.jsx("span",{children:o.t(A)},h++))}return t&&d.push(v.jsx("span",{children:typeof t=="string"?o.t(t):t},h++)),v.jsx(v.Fragment,{children:d})}const wo="univer-ui-plugin-sheets-font-family",Mo="univer-ui-plugin-sheets-font-family-item",c6={uiPluginSheetsFontFamily:wo,uiPluginSheetsFontFamilyItem:Mo},xo=e=>{const{value:t}=e,n=le.useDependency(L.LocaleService),r=s.useMemo(()=>{var a;let i=n.t(`fontFamily.${((a=`${t}`)!=null?a:"").replace(/\s/g,"")}`);return i.startsWith("fontFamily.")&&typeof t=="string"&&(i=t.split(",")[0]),i},[t]);return v.jsx("div",{className:c6.uiPluginSheetsFontFamily,style:{fontFamily:t},children:r})},Oo=e=>{var r;const{value:t}=e,n=le.useDependency(L.LocaleService);return v.jsx("span",{className:c6.uiPluginSheetsFontFamilyItem,style:{fontFamily:t},children:n.t(`fontFamily.${((r=`${t}`)!=null?r:"").replace(/\s/g,"")}`)})},Ro=[{value:"Arial"},{value:"Times New Roman"},{value:"Tahoma"},{value:"Verdana"},{value:"Microsoft YaHei"},{value:"SimSun"},{value:"SimHei"},{value:"Kaiti"},{value:"FangSong"},{value:"NSimSun"},{value:"STXinwei"},{value:"STXingkai"},{value:"STLiti"}],Io="univer-ui-plugin-sheets-font-size",Ho="univer-ui-plugin-sheets-font-size-input",Vn={uiPluginSheetsFontSize:Io,uiPluginSheetsFontSizeInput:Ho},Do=e=>{const{value:t,min:n,max:r,onChange:i,disabled$:a}=e,o=Ae(a),[u,d]=s.useState(Number(t!=null?t:0)),h=s.useMemo(()=>Number(t!=null?t:u),[t]);function g(S){S!==null&&d(S)}function f(S){S.stopPropagation(),S.code==="Enter"&&i(u.toString())}return v.jsx("div",{className:Vn.uiPluginSheetsFontSize,children:v.jsx(me.InputNumber,{className:Vn.uiPluginSheetsFontSizeInput,value:h,controls:!1,min:n,max:r,onKeyDown:f,onChange:g,disabled:o})})},To=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"22",value:22},{label:"24",value:24},{label:"26",value:26},{label:"28",value:28},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}];var Ze=(e=>(e.VOID="void",e.TOOLBAR_START="uiToolbar.start",e.TOOLBAR_INSERT="uiToolbar.insert",e.TOOLBAR_FORMULAS="uiToolbar.formulas",e.TOOLBAR_DATA="uiToolbar.data",e.TOOLBAR_VIEW="uiToolbar.view",e.TOOLBAR_OTHERS="uiToolbar.others",e.CONTEXT_MENU="contextMenu",e))(Ze||{}),i1=(e=>(e[e.TOOLBAR_HISTORY=0]="TOOLBAR_HISTORY",e[e.TOOLBAR_FORMAT=1]="TOOLBAR_FORMAT",e[e.TOOLBAR_LAYOUT=2]="TOOLBAR_LAYOUT",e[e.TOOLBAR_FORMULAS_INSERT=3]="TOOLBAR_FORMULAS_INSERT",e[e.TOOLBAR_FORMULAS_VIEW=4]="TOOLBAR_FORMULAS_VIEW",e[e.TOOLBAR_FILE=5]="TOOLBAR_FILE",e[e.TOOLBAR_OTHERS=6]="TOOLBAR_OTHERS",e[e.CONTEXT_MENU_FORMAT=7]="CONTEXT_MENU_FORMAT",e[e.CONTEXT_MENU_LAYOUT=8]="CONTEXT_MENU_LAYOUT",e[e.CONTEXT_MENU_DATA=9]="CONTEXT_MENU_DATA",e[e.CONTEXT_MENU_OTHERS=10]="CONTEXT_MENU_OTHERS",e))(i1||{}),Pe=(e=>(e[e.BUTTON=0]="BUTTON",e[e.SELECTOR=1]="SELECTOR",e[e.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",e[e.SUBITEMS=3]="SUBITEMS",e))(Pe||{});function Vo(e,t,n){return window.addEventListener(e,t,n),L.toDisposable(()=>window.removeEventListener(e,t,n))}var No=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Ao=(e,t,n,r)=>{for(var i=r>1?void 0:r?ko(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&No(t,n,i),i},_1=(e,t)=>(n,r)=>t(n,r,e);class jo{constructor(t){B(this,"_focus",!1);B(this,"_valueLegality",!0);B(this,"_openForSheetUnitId");B(this,"_openForSheetSubUnitId");this._param=t,this._openForSheetUnitId=this._param.openForSheetUnitId,this._openForSheetSubUnitId=this._param.openForSheetSubUnitId}get documentDataModel(){return this._param.documentDataModel}get editorUnitId(){return this._param.editorUnitId}get cancelDefaultResizeListener(){return this._param.cancelDefaultResizeListener}get render(){return this._param.render}isSingleChoice(){return this._param.isSingleChoice}setOpenForSheetUnitId(t){this._openForSheetUnitId=t}getOpenForSheetUnitId(){return this._openForSheetUnitId}setOpenForSheetSubUnitId(t){this._openForSheetSubUnitId=t}getOpenForSheetSubUnitId(){return this._openForSheetSubUnitId}isValueLegality(){return this._valueLegality===!0}setValueLegality(t=!0){this._valueLegality=t}isFocus(){return this._focus}setFocus(t=!1){this._focus=t}isSingle(){return this._param.isSingle===!0||this.onlyInputRange()}isReadOnly(){return this._param.isReadonly===!0}onlyInputContent(){return this._param.onlyInputContent===!0}onlyInputFormula(){return this._param.onlyInputFormula===!0}onlyInputRange(){return this._param.onlyInputRange===!0}getBoundingClientRect(){return this._param.editorDom.getBoundingClientRect()}isVisible(){return this._param.visible}isSheetEditor(){return this._param.isSheetEditor===!0}getValue(){var n;return(((n=this._param.documentDataModel.getBody())==null?void 0:n.dataStream)||"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,"")}getBody(){return this._param.documentDataModel.getBody()}update(t){this._param={...this._param,...t}}verticalAlign(){var o,u;const t=(o=this._param)==null?void 0:o.documentDataModel;if(t==null)return;const{width:n,height:r}=this._param.editorDom.getBoundingClientRect();if(!this.isSingle()){t.updateDocumentDataPageSize(n,void 0);return}let i=C1.UNIVER_GLOBAL_DEFAULT_FONT_SIZE;(u=this._param.canvasStyle)!=null&&u.fontSize&&(i=this._param.canvasStyle.fontSize);const a=(r-i*4/3)/2-2;t.updateDocumentDataMargin({t:a<0?0:a}),t.updateDocumentDataPageSize(void 0,void 0)}updateCanvasStyle(){var r;const t=this._param.documentDataModel;if(t==null)return;const n={};(r=this._param.canvasStyle)!=null&&r.fontSize&&(n.textStyle==null&&(n.textStyle={}),n.textStyle.fs=this._param.canvasStyle.fontSize),t.updateDocumentStyle(n)}}exports.EditorService=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_editors",new Map);B(this,"_focusEditorUnitId");B(this,"_state$",new ie.Subject);B(this,"state$",this._state$.asObservable());B(this,"_currentSheetUnitId");B(this,"_currentSheetSubUnitId");B(this,"_inputFormula$",new ie.Subject);B(this,"inputFormula$",this._inputFormula$.asObservable());B(this,"_resize$",new ie.Subject);B(this,"resize$",this._resize$.asObservable());B(this,"_closeRangePrompt$",new ie.Subject);B(this,"closeRangePrompt$",this._closeRangePrompt$.asObservable());B(this,"_blur$",new ie.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_focus$",new ie.Subject);B(this,"focus$",this._focus$.asObservable());B(this,"_setValue$",new ie.Subject);B(this,"setValue$",this._setValue$.asObservable());B(this,"_valueChange$",new ie.Subject);B(this,"valueChange$",this._valueChange$.asObservable());B(this,"_focusStyle$",new ie.Subject);B(this,"focusStyle$",this._focusStyle$.asObservable());B(this,"_singleSelection$",new ie.Subject);B(this,"singleSelection$",this._singleSelection$.asObservable());B(this,"_spreadsheetFocusState",!1);this._injector=n,this._univerInstanceService=r,this._renderManagerService=i,this._lexerTreeBuilder=a,this._contextService=o}setFocusId(n){this._focusEditorUnitId=n}getFocusId(){return this._focusEditorUnitId}getFocusEditor(){if(this._focusEditorUnitId)return this.getEditor(this._focusEditorUnitId)}isEditor(n){return this._editors.has(n)}isSheetEditor(n){const r=this._editors.get(n);return!!(r&&r.isSheetEditor())}closeRangePrompt(){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(!n)return;const r=n.getUnitId();this._contextService.setContextValue(L.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!1),!(!this.isEditor(r)||this.isSheetEditor(r))&&(this.changeSpreadsheetFocusState(!1),this.blur())}changeSpreadsheetFocusState(n){this._spreadsheetFocusState=n}getSpreadsheetFocusState(){return this._spreadsheetFocusState}focusStyle(n){const r=this.getEditor(n);if(!r)return!1;r.setFocus(!0),this._contextService.setContextValue(L.EDITOR_ACTIVATED,!0),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!0),this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE,r.isSingle()),this._spreadsheetFocusState||this.singleSelection(r.isSingleChoice()),this._focusStyle$.next(n),this.setFocusId(n)}singleSelection(n){this._singleSelection$.next(n)}selectionChangingState(){const n=this.getFocusId();if(n==null)return!0;const r=this.getEditor(n);return!r||r.isSheetEditor()?!0:r.onlyInputRange()!==!0&&r.onlyInputFormula()!==!0?(this.blur(),!0):r.onlyInputFormula()===!0&&this._contextService.getContextValue(L.FOCUSING_EDITOR_INPUT_FORMULA)!==!0?(this.blur(),!0):!this.getSpreadsheetFocusState()}blur(){this._spreadsheetFocusState||(this._closeRangePrompt$.next(null),this.singleSelection(!1),this.setFocusId(null),this._contextService.setContextValue(L.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!1)),this.getAllEditor().forEach(n=>{n.setFocus(!1)}),this._focusStyle$.next(),this._blur$.next(null)}focus(n){if(n==null){const a=this._univerInstanceService.getCurrentUniverDocInstance();if(!a)return;n=a.getUnitId()}const r=this.getEditor(n);if(r==null)return;this._univerInstanceService.setCurrentUnitForType(n);const i=r.getValue().length;this.focusStyle(n),this._focus$.next({startOffset:i-2,endOffset:i-2})}setFormula(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this._inputFormula$.next({formulaString:n,editorUnitId:r})}setValue(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this.setValueNoRefresh(n,r),this._refreshValueChange(r)}setValueNoRefresh(n,r){this._setValue$.next({body:{dataStream:n},editorUnitId:r}),this.resize(r)}getValue(n){const r=this.getEditor(n);if(r!=null)return r.getValue()}setRichValue(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this._setValue$.next({body:n,editorUnitId:r}),this._refreshValueChange(r)}getRichValue(n){const r=this.getEditor(n);if(r!=null)return r.getBody()}dispose(){this._state$.complete(),this._editors.clear(),super.dispose()}getEditor(n){return n==null&&(n=this._getCurrentEditorUnitId()),this._editors.get(n)}getAllEditor(){return this._editors}getFirstEditor(){return[...this.getAllEditor().values()][0]}resize(n){const r=this.getEditor(n);r!=null&&(r.verticalAlign(),this._resize$.next(n))}isVisible(n){var r;return(r=this.getEditor(n))==null?void 0:r.isVisible()}setOperationSheetUnitId(n){this._currentSheetUnitId=n}getOperationSheetUnitId(){return this._currentSheetUnitId}setOperationSheetSubUnitId(n){this._currentSheetSubUnitId=n}getOperationSheetSubUnitId(){return this._currentSheetSubUnitId}register(n,r){var g,f,S,y;const{initialSnapshot:i,editorUnitId:a,canvasStyle:o={}}=n,u=this._univerInstanceService.createUnit(L.UniverInstanceType.UNIVER_DOC,i||this._getBlank(a));let d=this._renderManagerService.getRenderById(a);d==null&&(this._renderManagerService.create(a),d=this._renderManagerService.getRenderById(a)),d.engine.setContainer(r);const h=new jo({...n,render:d,documentDataModel:u,editorDom:r,canvasStyle:o});return this._editors.set(a,h),(y=(S=(f=(g=d.mainComponent)==null?void 0:g.getScene())==null?void 0:f.getViewports())==null?void 0:S[0].getScrollBar())==null||y.dispose(),h.isSheetEditor()||(h.verticalAlign(),h.updateCanvasStyle()),L.toDisposable(()=>{this._unRegister(a)})}_unRegister(n){const r=this._editors.get(n);if(r==null)return;if(this._renderManagerService.removeRender(n),r.documentDataModel.dispose(),this._editors.delete(n),this._univerInstanceService.disposeUnit(n),this._univerInstanceService.getAllUnitsForType(L.UniverInstanceType.UNIVER_SHEET).length>0){const a=this._univerInstanceService.getCurrentUnitForType(L.UniverInstanceType.UNIVER_SHEET);this._univerInstanceService.focusUnit(a.getUnitId())}}refreshValueChange(n){this._refreshValueChange(n)}checkValueLegality(n){const r=this._editors.get(n);if(r==null)return!0;let i=r.getValue();if(r.setValueLegality(),i=i.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,""),i.length===0)return!0;if(r.onlyInputFormula()){if(i.substring(0,1)!==n1.operatorToken.EQUALS)return r.setValueLegality(!1),!1;const a=this._lexerTreeBuilder.checkIfAddBracket(i);r.setValueLegality(a===0)}else if(r.onlyInputRange()){const a=i.split(",");if(r.isSingleChoice()&&a.length>1)return r.setValueLegality(!1),!1;r.setValueLegality(n1.isReferenceStrings(i))}return r.isValueLegality()}_refreshValueChange(n){const r=this.getEditor(n);r!=null&&this._valueChange$.next(r)}_getCurrentEditorUnitId(){return this._univerInstanceService.getCurrentUniverDocInstance().getUnitId()}_refresh(n){this._state$.next(n)}_getBlank(n){return{id:n,body:{dataStream:`${L.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{renderConfig:{verticalAlign:L.VerticalAlign.TOP,horizontalAlign:L.HorizontalAlign.LEFT},marginLeft:6,marginTop:2,marginRight:6}}}};exports.EditorService=Ao([_1(0,oe.Inject(oe.Injector)),_1(1,L.IUniverInstanceService),_1(2,C1.IRenderManagerService),_1(3,oe.Inject(n1.LexerTreeBuilder)),_1(4,L.IContextService)],exports.EditorService);const x1=oe.createIdentifier("univer.editor.service");var Uo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,$o=(e,t,n,r)=>{for(var i=r>1?void 0:r?Po(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Uo(t,n,i),i},k1=(e,t)=>(n,r)=>t(n,r,e);const Bo="FOCUSING_UNIVER",zo=["univer-app-layout","univer-toolbar-btn","univer-menu-item","univer-button","univer-sheet-bar-btn"],O1=oe.createIdentifier("ui.layout-service");exports.DesktopLayoutService=class extends L.Disposable{constructor(n,r,i,a){super();B(this,"_rootContainerElement",null);B(this,"_isFocused",!1);B(this,"_focusHandlers",new Map);B(this,"_canvasContainers",[]);B(this,"_allContainers",[]);this._contextService=n,this._univerInstanceService=r,this._logService=i,this._editorService=a,this._initUniverFocusListener(),this._initEditorStatus()}get isFocused(){return this._isFocused}focus(){const n=this._univerInstanceService.getFocusedUnit();if(!n)return;let r;n instanceof L.Workbook?r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_SHEET):n instanceof L.DocumentDataModel?r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_DOC):n instanceof L.SlideDataModel&&(r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_SLIDE)),r&&r(n.getUnitId())}registerFocusHandler(n,r){if(this._focusHandlers.has(n))throw new Error(`[DesktopLayoutService]: handler of type ${n} bas been registered!`);return this._focusHandlers.set(n,r),L.toDisposable(()=>this._focusHandlers.delete(n))}registerCanvasElement(n){if(this._canvasContainers.indexOf(n)===-1)return this._canvasContainers.push(n),L.toDisposable(()=>L.remove(this._canvasContainers,n));throw new Error("[DesktopLayoutService]: canvas container already registered!")}registerRootContainerElement(n){if(this._rootContainerElement)throw new Error("[DesktopLayoutService]: root container already registered!");this._rootContainerElement=n;const r=this.registerContainerElement(n);return L.toDisposable(()=>{this._rootContainerElement=null,r.dispose()})}registerContainerElement(n){if(this._allContainers.indexOf(n)===-1)return this._allContainers.push(n),L.toDisposable(()=>L.remove(this._allContainers,n));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentContainers(n){return this._allContainers.some(r=>r.contains(n))}checkCanvasIsFocused(){return this._canvasContainers.some(n=>n===document.activeElement||n.contains(document.activeElement))}_initUniverFocusListener(){this.disposeWithMe(ie.fromEvent(window,"focusin").subscribe(n=>{const r=n.target;if(zo.some(i=>r.classList.contains(i))){this._editorBlurListener(),queueMicrotask(()=>this.focus());return}r&&this.checkElementInCurrentContainers(r)?this._isFocused=!0:this._isFocused=!1,this._contextService.setContextValue(Bo,this._isFocused),this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR,Nn())}))}_initEditorStatus(){this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR,Nn())}_editorBlurListener(){const n=this._editorService.getFocusEditor();n&&n.isSheetEditor()!==!0&&this._editorService.blur()}};exports.DesktopLayoutService=$o([L.OnLifecycle(L.LifecycleStages.Ready,O1),k1(0,L.IContextService),k1(1,L.IUniverInstanceService),k1(2,L.ILogService),k1(3,x1)],exports.DesktopLayoutService);function Nn(){var e;return!!((e=document.activeElement)!=null&&e.classList.contains("univer-editor"))}const Jt=oe.createIdentifier("univer.platform-service");class u6{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}}var a1=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.MINUS=189]="MINUS",e[e.EQUAL=187]="EQUAL",e[e.BACK_SLASH=220]="BACK_SLASH",e))(a1||{});const Fo={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",189:"-",187:"=",220:"\\"};var ke=(e=>(e[e.SHIFT=1024]="SHIFT",e[e.ALT=2048]="ALT",e[e.CTRL_COMMAND=4096]="CTRL_COMMAND",e[e.MAC_CTRL=8192]="MAC_CTRL",e))(ke||{}),Zo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Go=(e,t,n,r)=>{for(var i=r>1?void 0:r?Wo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Zo(t,n,i),i},A1=(e,t)=>(n,r)=>t(n,r,e);const S1=oe.createIdentifier("univer.shortcut");exports.DesktopShortcutService=class extends L.Disposable{constructor(n,r,i,a){super();B(this,"_shortCutMapping",new Map);B(this,"_commandIDMapping",new Map);B(this,"_shortcutChanged$",new ie.Subject);B(this,"shortcutChanged$",this._shortcutChanged$.asObservable());B(this,"_forceEscaped",!1);B(this,"_disable",!1);this._commandService=n,this._platformService=r,this._contextService=i,this._layoutService=a,this.disposeWithMe(Vo("keydown",o=>{this._resolveKeyboardEvent(o)},{capture:!0}))}setDisable(n){this._disable=n}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(n=>Array.from(n.values())).flat()}registerShortcut(n){const r=this._getBindingFromItem(n),i=this._shortCutMapping.get(r);i?i.add(n):this._shortCutMapping.set(r,new Set([n]));const a=n.id,o=this._commandIDMapping.get(a);return o?o.add(n):this._commandIDMapping.set(a,new Set([n])),this._emitShortcutChanged(),L.toDisposable(()=>{var u,d,h,g;(u=this._shortCutMapping.get(r))==null||u.delete(n),((d=this._shortCutMapping.get(r))==null?void 0:d.size)===0&&this._shortCutMapping.delete(r),(h=this._commandIDMapping.get(a))==null||h.delete(n),((g=this._commandIDMapping.get(a))==null?void 0:g.size)===0&&this._commandIDMapping.delete(a),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(n){const r=this._commandIDMapping.get(n);return r?this.getShortcutDisplay(r.values().next().value):null}getShortcutDisplay(n){var h;const r=this._getBindingFromItem(n),i=r&ke.CTRL_COMMAND,a=r&ke.SHIFT,o=r&ke.ALT,u=r&ke.MAC_CTRL,d=(h=Fo[r&255])!=null?h:"<->";return this._platformService.isMac?`${i?"⌘":""}${a?"⇧":""}${o?"⌥":""}${u?"⌃":""}${d}`:`${i?"Ctrl+":""}${a?"Shift+":""}${o?"Alt+":""}${d}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,L.toDisposable(()=>this._forceEscaped=!1)}_resolveKeyboardEvent(n){if(this._forceEscaped||this._disable||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(n.target))return;this._dispatch(n)&&n.preventDefault()}_dispatch(n){const r=this._deriveBindingFromEvent(n);if(r===null)return!1;const i=this._shortCutMapping.get(r);if(i===void 0)return!1;const a=Array.from(i).sort((o,u)=>{var d,h;return((d=u.priority)!=null?d:0)-((h=o.priority)!=null?h:0)}).find(o=>{var u,d;return(d=(u=o.preconditions)==null?void 0:u.call(o,this._contextService))!=null?d:!0});return a?(this._commandService.executeCommand(a.id,a.staticParameters),!0):!1}_getBindingFromItem(n){return this._platformService.isMac&&n.mac?n.mac:this._platformService.isWindows&&n.win?n.win:this._platformService.isLinux&&n.linux?n.linux:n.binding}_deriveBindingFromEvent(n){const{shiftKey:r,metaKey:i,altKey:a,keyCode:o}=n;let u=o;return r&&(u|=ke.SHIFT),a&&(u|=ke.ALT),(this._platformService.isMac?i:n.ctrlKey)&&(u|=ke.CTRL_COMMAND),this._platformService.isMac&&n.ctrlKey&&(u|=ke.MAC_CTRL),u}};exports.DesktopShortcutService=Go([A1(0,L.ICommandService),A1(1,Jt),A1(2,L.IContextService),A1(3,oe.Optional(O1))],exports.DesktopShortcutService);var Yo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Xo=(e,t,n,r)=>{for(var i=r>1?void 0:r?qo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Yo(t,n,i),i},Qo=(e,t)=>(n,r)=>t(n,r,e);const f1=oe.createIdentifier("univer.menu-service");exports.DesktopMenuService=class extends L.Disposable{constructor(n){super();B(this,"_menuItemMap",new Map);B(this,"_menuByPositions",new Map);B(this,"_menuChanged$",new ie.BehaviorSubject(void 0));B(this,"menuChanged$",this._menuChanged$.asObservable());this._shortcutService=n}dispose(){this._menuItemMap.clear(),this._menuChanged$.complete()}addMenuItem(n){if(this._menuItemMap.has(n.id))throw new Error(`Menu item with the same id ${n.id} has already been added!`);return this._menuItemMap.set(n.id,n),Array.isArray(n.positions)?n.positions.forEach(r=>this._appendMenuToPosition(n,r)):this._appendMenuToPosition(n,n.positions),this._menuChanged$.next(),L.toDisposable(()=>{if(this._menuItemMap.delete(n.id),Array.isArray(n.positions))n.positions.forEach(r=>{const i=this._menuByPositions.get(r);if(!i)return;const a=i.findIndex(o=>o[0]===n.id);a>-1&&i.splice(a,1)});else{const r=this._menuByPositions.get(n.positions);if(!r)return;const i=r.findIndex(a=>a[0]===n.id);i>-1&&r.splice(i,1)}this._menuChanged$.next()})}getMenuItems(n){if(this._menuByPositions.has(n)){const r=this._menuByPositions.get(n);if(r)return[...r.values()].map(i=>this._getDisplayMenuItems(i[1]))}return[]}getMenuItem(n){return this._menuItemMap.has(n)?this._menuItemMap.get(n):null}_getDisplayMenuItems(n){const r=this._shortcutService.getShortcutDisplayOfCommand(n.id);return r?{...n,shortcut:r}:n}_appendMenuToPosition(n,r){this._menuByPositions.has(r)||this._menuByPositions.set(r,[]);const i=this._menuByPositions.get(r);if(i.findIndex(a=>a[0]===n.id)>-1)throw new Error(`Menu item with the same id ${n.id} has already been added!`);i.push([n.id,n])}};exports.DesktopMenuService=Xo([Qo(0,S1)],exports.DesktopMenuService);const Jo="univer-menu-item-no-hover",Ko="univer-menu-item-activated",e9="univer-menu-item-content",t9="univer-menu-item-selectable",n9="univer-menu-item-selectable-icon",r9="univer-menu-item-more-icon",qe={menuItemNoHover:Jo,menuItemActivated:Ko,menuItemContent:e9,menuItemSelectable:t9,menuItemSelectableIcon:n9,menuItemMoreIcon:r9};function f6(e){const{menuType:t,onOptionSelect:n}=e,r=le.useDependency(f1);if(!t)return;if(Array.isArray(t)){const o=t.map(u=>r.getMenuItems(u)).map(u=>u.reduce((d,h)=>{var g,f;return h.group?(d[h.group]=(g=d[h.group])!=null?g:[],d[h.group].push(h)):(d[i1.CONTEXT_MENU_OTHERS]=(f=d[i1.CONTEXT_MENU_OTHERS])!=null?f:[],d[i1.CONTEXT_MENU_OTHERS].push(h)),d},{}));return v.jsx(v.Fragment,{children:o.map(u=>Object.keys(u).map(d=>v.jsx(me.MenuItemGroup,{eventKey:d,children:u[d].map(h=>v.jsx(kn,{menuItem:h,onClick:g=>{n==null||n({value:"",label:h.id,...g})}},h.id))},d)))})}return r.getMenuItems(t).map(a=>v.jsx(kn,{menuItem:a,onClick:o=>{n==null||n({value:"",label:a.id,...o})}},a.id))}function d6(e){var a;const{options:t,value:n,onOptionSelect:r,parentKey:i}=e;return(a=t==null?void 0:t.map((o,u)=>{var S,y,_;const d=`${i}-${(S=o.label)!=null?S:o.id}-${u}`,h=A=>{r==null||r({value:A,label:o==null?void 0:o.label})},g=()=>{typeof o.value>"u"||r==null||r({...o})},f=Te({[qe.menuItemNoHover]:typeof o.label!="string"&&!((y=o.label)!=null&&y.hoverable)});return v.jsx(me.MenuItem,{disabled:o.disabled,eventKey:d,className:f,onClick:g,children:v.jsxs("span",{className:Te(qe.menuItemContent,{[qe.menuItemSelectable]:!(typeof o.label!="string"&&!((_=o.label)!=null&&_.hoverable))}),children:[typeof n<"u"&&String(n)===String(o.value)&&v.jsx("span",{className:qe.menuItemSelectableIcon,children:v.jsx(Da,{style:{color:"rgb(var(--success-color))"}})}),v.jsx($e,{value$:o.value$,value:o.value,label:o.label,icon:o.icon,onChange:h})]})},d)}))!=null?a:v.jsx(v.Fragment,{})}const q1=e=>v.jsxs(me.Menu,{selectable:!1,children:[v.jsx(d6,{...e}),v.jsx(f6,{...e})]});function kn({menuItem:e,onClick:t}){const n=le.useDependency(f1),r=e.id?n.getMenuItems(e.id):[],i=Ae(e.disabled$,!1),a=Ae(e.activated$,!1),o=Ae(e.hidden$,!1),u=Ae(e.value$),[d,h]=s.useState(u),g=_=>{const A=L.isRealNum(_)&&typeof _=="string"?Number.parseInt(_):_;h(A)},f=()=>{const _=e,{title:A,label:O}=_;return v.jsx(me.MenuItem,{eventKey:_.id,disabled:i,className:Te({[qe.menuItemActivated]:a}),onClick:()=>{t({value:d,id:_.id})},children:v.jsx("span",{className:qe.menuItemContent,children:v.jsx($e,{value:u,title:A,label:O,icon:_.icon,onChange:g})})},_.id)},S=()=>{var N;const _=e,A=Ae(ie.isObservable(_.selections)?_.selections:void 0),O=(N=A!=null?A:_.selections)!=null?N:[];return O.length>0?v.jsx(me.SubMenu,{eventKey:_.id,popupOffset:[18,0],title:v.jsxs("span",{className:qe.menuItemContent,children:[v.jsx($e,{title:_.title,value:d,onChange:g,icon:_.icon,label:_.label}),_.shortcut&&` (${_.shortcut})`]}),expandIcon:v.jsx(Hn,{className:qe.menuItemMoreIcon}),children:O.length>0&&v.jsx(d6,{parentKey:_.id,menuType:_.id,options:O,onOptionSelect:V=>{t({value:V.value,id:_.id})}})},_.id):v.jsx(me.MenuItem,{eventKey:_.id,children:v.jsxs("span",{className:qe.menuItemContent,children:[v.jsx($e,{title:_.title,value:d,icon:_.icon,label:_.label,onChange:g}),_.shortcut&&` (${_.shortcut})`]})},_.id)},y=()=>{const _=e;return v.jsx(me.SubMenu,{eventKey:_.id,popupOffset:[18,0],title:v.jsx("span",{className:qe.menuItemContent,children:v.jsx($e,{title:_.title,icon:_.icon,label:_.label,onChange:g})}),expandIcon:v.jsx(Hn,{className:qe.menuItemMoreIcon}),children:r.length&&v.jsx(f6,{menuType:_.id,parentKey:_.id,onOptionSelect:t})},_.id)};return o?null:v.jsxs(v.Fragment,{children:[e.type===Pe.SELECTOR&&S(),e.type===Pe.SUBITEMS&&y(),e.type===Pe.BUTTON&&f()]})}function i9(e,t,...n){return e.t(t)}function a9(e){const t=s.useRef(e);return t.current=e,s.useCallback((...n)=>t.current(...n),[])}const An="univer.command.copy",Kt={id:An,name:An,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},jn="univer.command.cut",en={id:jn,name:jn,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},Un="univer.command.paste",tn={id:Un,name:Un,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},h6={id:"sheet.operation.set-editor-resize",type:L.CommandType.OPERATION,handler:(e,t)=>!0};function o9(e){const t=e.get(L.IUndoRedoService);return{id:L.UndoCommand.id,group:i1.TOOLBAR_HISTORY,type:Pe.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",positions:[Ze.TOOLBAR_START],disabled$:t.undoRedoStatus$.pipe(c3.map(n=>n.undos<=0))}}function s9(e){const t=e.get(L.IUndoRedoService);return{id:L.RedoCommand.id,group:i1.TOOLBAR_HISTORY,type:Pe.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",positions:[Ze.TOOLBAR_START],disabled$:t.undoRedoStatus$.pipe(c3.map(n=>n.redos<=0))}}var l9=Object.defineProperty,c9=Object.getOwnPropertyDescriptor,u9=(e,t,n,r)=>{for(var i=r>1?void 0:r?c9(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l9(t,n,i),i},j1=(e,t)=>(n,r)=>t(n,r,e);function rt(e){return e.getContextValue(L.FOCUSING_UNIVER_EDITOR)}const p6={id:Kt.id,description:"shortcut.copy",group:"1_common-edit",binding:a1.C|ke.CTRL_COMMAND,preconditions:rt},g6={id:en.id,description:"shortcut.cut",group:"1_common-edit",binding:a1.X|ke.CTRL_COMMAND,preconditions:rt},f9={id:tn.id,description:"shortcut.paste",group:"1_common-edit",binding:a1.V|ke.CTRL_COMMAND,preconditions:()=>!1},m6={id:L.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:a1.Z|ke.CTRL_COMMAND,preconditions:rt},v6={id:L.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:a1.Y|ke.CTRL_COMMAND,preconditions:rt};exports.SharedController=class extends L.Disposable{constructor(t,n,r,i){super(),this._injector=t,this._menuService=n,this._shortcutService=r,this._commandService=i,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts(),this._registerMenus()}_registerMenus(){[o9,s9].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t)))})}_registerCommands(){[en,Kt,tn,h6].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_registerShortcuts(){const t=[m6,v6];t.push(g6,p6,f9),t.forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}};exports.SharedController=u9([L.OnLifecycle(L.LifecycleStages.Ready,exports.SharedController),j1(0,oe.Inject(oe.Injector)),j1(1,f1),j1(2,S1),j1(3,L.ICommandService)],exports.SharedController);const X1=oe.createIdentifier("univer.ui-controller");var R1={},C6={exports:{}},S6={exports:{}};(function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(S6);var I1=S6.exports;(function(e){var t=I1.default;function n(i){if(typeof WeakMap!="function")return null;var a=new WeakMap,o=new WeakMap;return(n=function(d){return d?o:a})(i)}function r(i,a){if(!a&&i&&i.__esModule)return i;if(i===null||t(i)!="object"&&typeof i!="function")return{default:i};var o=n(a);if(o&&o.has(i))return o.get(i);var u={__proto__:null},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if(h!=="default"&&{}.hasOwnProperty.call(i,h)){var g=d?Object.getOwnPropertyDescriptor(i,h):null;g&&(g.get||g.set)?Object.defineProperty(u,h,g):u[h]=i[h]}return u.default=i,o&&o.set(i,u),u}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(C6);var d9=C6.exports,b6={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(b6);var h9=b6.exports,y6={exports:{}};(function(e){var t=I1.default;function n(){e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},a=Object.prototype,o=a.hasOwnProperty,u=Object.defineProperty||function(M,E,R){M[E]=R.value},d=typeof Symbol=="function"?Symbol:{},h=d.iterator||"@@iterator",g=d.asyncIterator||"@@asyncIterator",f=d.toStringTag||"@@toStringTag";function S(M,E,R){return Object.defineProperty(M,E,{value:R,enumerable:!0,configurable:!0,writable:!0}),M[E]}try{S({},"")}catch{S=function(R,G,Z){return R[G]=Z}}function y(M,E,R,G){var Z=E&&E.prototype instanceof W?E:W,q=Object.create(Z.prototype),ne=new pe(G||[]);return u(q,"_invoke",{value:J(M,R,ne)}),q}function _(M,E,R){try{return{type:"normal",arg:M.call(E,R)}}catch(G){return{type:"throw",arg:G}}}i.wrap=y;var A="suspendedStart",O="suspendedYield",N="executing",V="completed",z={};function W(){}function w(){}function D(){}var k={};S(k,h,function(){return this});var T=Object.getPrototypeOf,P=T&&T(T(Le([])));P&&P!==a&&o.call(P,h)&&(k=P);var Y=D.prototype=W.prototype=Object.create(k);function F(M){["next","throw","return"].forEach(function(E){S(M,E,function(R){return this._invoke(E,R)})})}function Q(M,E){function R(Z,q,ne,ae){var _e=_(M[Z],M,q);if(_e.type!=="throw"){var Ie=_e.arg,xe=Ie.value;return xe&&t(xe)=="object"&&o.call(xe,"__await")?E.resolve(xe.__await).then(function(Ee){R("next",Ee,ne,ae)},function(Ee){R("throw",Ee,ne,ae)}):E.resolve(xe).then(function(Ee){Ie.value=Ee,ne(Ie)},function(Ee){return R("throw",Ee,ne,ae)})}ae(_e.arg)}var G;u(this,"_invoke",{value:function(q,ne){function ae(){return new E(function(_e,Ie){R(q,ne,_e,Ie)})}return G=G?G.then(ae,ae):ae()}})}function J(M,E,R){var G=A;return function(Z,q){if(G===N)throw Error("Generator is already running");if(G===V){if(Z==="throw")throw q;return{value:r,done:!0}}for(R.method=Z,R.arg=q;;){var ne=R.delegate;if(ne){var ae=he(ne,R);if(ae){if(ae===z)continue;return ae}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(G===A)throw G=V,R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);G=N;var _e=_(M,E,R);if(_e.type==="normal"){if(G=R.done?V:O,_e.arg===z)continue;return{value:_e.arg,done:R.done}}_e.type==="throw"&&(G=V,R.method="throw",R.arg=_e.arg)}}}function he(M,E){var R=E.method,G=M.iterator[R];if(G===r)return E.delegate=null,R==="throw"&&M.iterator.return&&(E.method="return",E.arg=r,he(M,E),E.method==="throw")||R!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+R+"' method")),z;var Z=_(G,M.iterator,E.arg);if(Z.type==="throw")return E.method="throw",E.arg=Z.arg,E.delegate=null,z;var q=Z.arg;return q?q.done?(E[M.resultName]=q.value,E.next=M.nextLoc,E.method!=="return"&&(E.method="next",E.arg=r),E.delegate=null,z):q:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,z)}function ue(M){var E={tryLoc:M[0]};1 in M&&(E.catchLoc=M[1]),2 in M&&(E.finallyLoc=M[2],E.afterLoc=M[3]),this.tryEntries.push(E)}function re(M){var E=M.completion||{};E.type="normal",delete E.arg,M.completion=E}function pe(M){this.tryEntries=[{tryLoc:"root"}],M.forEach(ue,this),this.reset(!0)}function Le(M){if(M||M===""){var E=M[h];if(E)return E.call(M);if(typeof M.next=="function")return M;if(!isNaN(M.length)){var R=-1,G=function Z(){for(;++R<M.length;)if(o.call(M,R))return Z.value=M[R],Z.done=!1,Z;return Z.value=r,Z.done=!0,Z};return G.next=G}}throw new TypeError(t(M)+" is not iterable")}return w.prototype=D,u(Y,"constructor",{value:D,configurable:!0}),u(D,"constructor",{value:w,configurable:!0}),w.displayName=S(D,f,"GeneratorFunction"),i.isGeneratorFunction=function(M){var E=typeof M=="function"&&M.constructor;return!!E&&(E===w||(E.displayName||E.name)==="GeneratorFunction")},i.mark=function(M){return Object.setPrototypeOf?Object.setPrototypeOf(M,D):(M.__proto__=D,S(M,f,"GeneratorFunction")),M.prototype=Object.create(Y),M},i.awrap=function(M){return{__await:M}},F(Q.prototype),S(Q.prototype,g,function(){return this}),i.AsyncIterator=Q,i.async=function(M,E,R,G,Z){Z===void 0&&(Z=Promise);var q=new Q(y(M,E,R,G),Z);return i.isGeneratorFunction(E)?q:q.next().then(function(ne){return ne.done?ne.value:q.next()})},F(Y),S(Y,f,"Generator"),S(Y,h,function(){return this}),S(Y,"toString",function(){return"[object Generator]"}),i.keys=function(M){var E=Object(M),R=[];for(var G in E)R.push(G);return R.reverse(),function Z(){for(;R.length;){var q=R.pop();if(q in E)return Z.value=q,Z.done=!1,Z}return Z.done=!0,Z}},i.values=Le,pe.prototype={constructor:pe,reset:function(E){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(re),!E)for(var R in this)R.charAt(0)==="t"&&o.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=r)},stop:function(){this.done=!0;var E=this.tryEntries[0].completion;if(E.type==="throw")throw E.arg;return this.rval},dispatchException:function(E){if(this.done)throw E;var R=this;function G(Ie,xe){return ne.type="throw",ne.arg=E,R.next=Ie,xe&&(R.method="next",R.arg=r),!!xe}for(var Z=this.tryEntries.length-1;Z>=0;--Z){var q=this.tryEntries[Z],ne=q.completion;if(q.tryLoc==="root")return G("end");if(q.tryLoc<=this.prev){var ae=o.call(q,"catchLoc"),_e=o.call(q,"finallyLoc");if(ae&&_e){if(this.prev<q.catchLoc)return G(q.catchLoc,!0);if(this.prev<q.finallyLoc)return G(q.finallyLoc)}else if(ae){if(this.prev<q.catchLoc)return G(q.catchLoc,!0)}else{if(!_e)throw Error("try statement without catch or finally");if(this.prev<q.finallyLoc)return G(q.finallyLoc)}}}},abrupt:function(E,R){for(var G=this.tryEntries.length-1;G>=0;--G){var Z=this.tryEntries[G];if(Z.tryLoc<=this.prev&&o.call(Z,"finallyLoc")&&this.prev<Z.finallyLoc){var q=Z;break}}q&&(E==="break"||E==="continue")&&q.tryLoc<=R&&R<=q.finallyLoc&&(q=null);var ne=q?q.completion:{};return ne.type=E,ne.arg=R,q?(this.method="next",this.next=q.finallyLoc,z):this.complete(ne)},complete:function(E,R){if(E.type==="throw")throw E.arg;return E.type==="break"||E.type==="continue"?this.next=E.arg:E.type==="return"?(this.rval=this.arg=E.arg,this.method="return",this.next="end"):E.type==="normal"&&R&&(this.next=R),z},finish:function(E){for(var R=this.tryEntries.length-1;R>=0;--R){var G=this.tryEntries[R];if(G.finallyLoc===E)return this.complete(G.completion,G.afterLoc),re(G),z}},catch:function(E){for(var R=this.tryEntries.length-1;R>=0;--R){var G=this.tryEntries[R];if(G.tryLoc===E){var Z=G.completion;if(Z.type==="throw"){var q=Z.arg;re(G)}return q}}throw Error("illegal catch attempt")},delegateYield:function(E,R,G){return this.delegate={iterator:Le(E),resultName:R,nextLoc:G},this.method==="next"&&(this.arg=r),z}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(y6);var p9=y6.exports,_6={exports:{}};(function(e){function t(r,i,a,o,u,d,h){try{var g=r[d](h),f=g.value}catch(S){a(S);return}g.done?i(f):Promise.resolve(f).then(o,u)}function n(r){return function(){var i=this,a=arguments;return new Promise(function(o,u){var d=r.apply(i,a);function h(f){t(d,o,u,h,g,"next",f)}function g(f){t(d,o,u,h,g,"throw",f)}h(void 0)})}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(_6);var g9=_6.exports,L6={exports:{}},E6={exports:{}},w6={exports:{}},M6={exports:{}};(function(e){var t=I1.default;function n(r,i){if(t(r)!="object"||!r)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var o=a.call(r,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(M6);var m9=M6.exports;(function(e){var t=I1.default,n=m9;function r(i){var a=n(i,"string");return t(a)=="symbol"?a:a+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(w6);var v9=w6.exports;(function(e){var t=v9;function n(r,i,a){return i=t(i),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(E6);var C9=E6.exports;(function(e){var t=C9;function n(i,a){var o=Object.keys(i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(i);a&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable})),o.push.apply(o,u)}return o}function r(i){for(var a=1;a<arguments.length;a++){var o=arguments[a]!=null?arguments[a]:{};a%2?n(Object(o),!0).forEach(function(u){t(i,u,o[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(u){Object.defineProperty(i,u,Object.getOwnPropertyDescriptor(o,u))})}return i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(L6);var S9=L6.exports,b9=d9.default,it=h9.default;Object.defineProperty(R1,"__esModule",{value:!0});R1._r=D9;R1._u=k9;var y9=R1.render=T9,_9=R1.unmount=A9,Q1=it(p9),x6=it(g9),L9=it(I1),E9=it(S9),w9=b9(Xt),H1=(0,E9.default)({},w9),M9=H1.version,x9=H1.render,O9=H1.unmountComponentAtNode,at;try{var R9=Number((M9||"").split(".")[0]);R9>=18&&(at=H1.createRoot)}catch{}function Pn(e){var t=H1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&(0,L9.default)(t)==="object"&&(t.usingClientEntryPoint=e)}var J1="__rc_react_root__";function I9(e,t){Pn(!0);var n=t[J1]||at(t);Pn(!1),n.render(e),t[J1]=n}function H9(e,t){x9(e,t)}function D9(e,t){}function T9(e,t){if(at){I9(e,t);return}H9(e,t)}function V9(e){return Nt.apply(this,arguments)}function Nt(){return Nt=(0,x6.default)((0,Q1.default)().mark(function e(t){return(0,Q1.default)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.resolve().then(function(){var i;(i=t[J1])===null||i===void 0||i.unmount(),delete t[J1]}));case 1:case"end":return r.stop()}},e)})),Nt.apply(this,arguments)}function N9(e){O9(e)}function k9(e){}function A9(e){return kt.apply(this,arguments)}function kt(){return kt=(0,x6.default)((0,Q1.default)().mark(function e(t){return(0,Q1.default)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(at===void 0){r.next=2;break}return r.abrupt("return",V9(t));case 2:N9(t);case 3:case"end":return r.stop()}},e)})),kt.apply(this,arguments)}const ot=oe.createIdentifier("univer.message-service"),j9="univer-app-layout",U9="univer-app-container",P9="univer-app-container-header",$9="univer-app-container-wrapper",B9="univer-app-container-content",z9="univer-app-container-canvas",F9="univer-app-container-left-sidebar",Z9="univer-app-container-sidebar",t1={appLayout:j9,appContainer:U9,appContainerHeader:P9,appContainerWrapper:$9,appContainerContent:B9,appContainerCanvas:z9,appContainerLeftSidebar:F9,appContainerSidebar:Z9};function g1(e){const{components:t}=e;return t?Array.from(t.values()).map((n,r)=>s.createElement(n(),{key:`${r}`})):null}const W9="univer-toolbar-btn",G9="univer-toolbar-btn-active",$n={toolbarBtn:W9,toolbarBtnActive:G9};function O6(e){const{children:t,className:n,style:r,disabled:i=!1,active:a=!1,onClick:o,onDoubleClick:u,...d}=e,h=S=>{if(i){S.preventDefault();return}o&&o(S)},g=S=>{if(i){S.preventDefault();return}u&&u(S)},f=Te($n.toolbarBtn,{[`${$n.toolbarBtn}-active`]:a},n);return v.jsx("button",{className:f,style:r,disabled:i,onClick:h,onDoubleClick:g,...d,children:t})}const Y9="univer-headerbar",q9="univer-header-menu",X9="univer-menubar",Q9="univer-menubar-item",J9="univer-menubar-item-active",K9="univer-toolbar",e4="univer-toolbar-container",t4="univer-toolbar-more",n4="univer-toolbar-more-container",r4="univer-toolbar-group",i4="univer-toolbar-item-select-button",a4="univer-toolbar-item-select-button-disabled",o4="univer-toolbar-item-select-button-activated",s4="univer-toolbar-item-select-button-label",l4="univer-toolbar-item-select-button-arrow",c4="univer-toolbar-item-select",u4="univer-toolbar-item-select-disabled",f4="univer-toolbar-item-select-activated",d4="univer-toolbar-item-select-arrow",h4="univer-toolbar-item-select-arrow-disabled",p4="univer-toolbar-item-select-arrow-activated",fe={headerbar:Y9,headerMenu:q9,menubar:X9,menubarItem:Q9,menubarItemActive:J9,toolbar:K9,toolbarContainer:e4,toolbarMore:t4,toolbarMoreContainer:n4,toolbarGroup:r4,toolbarItemSelectButton:i4,toolbarItemSelectButtonDisabled:a4,toolbarItemSelectButtonActivated:o4,toolbarItemSelectButtonLabel:s4,toolbarItemSelectButtonArrow:l4,toolbarItemSelect:c4,toolbarItemSelectDisabled:u4,toolbarItemSelectActivated:f4,toolbarItemSelectArrow:d4,toolbarItemSelectArrowDisabled:h4,toolbarItemSelectArrowActivated:p4},Ot=s.forwardRef((e,t)=>{const n=le.useDependency(L.LocaleService),r=le.useDependency(L.ICommandService),i=le.useInjector(),[a,o]=s.useState(),[u,d]=s.useState(!1),[h,g]=s.useState(!1),[f,S]=s.useState(!1),[y,_]=s.useState(!1),[A,O]=s.useState(!1),N=(M,E)=>{r.executeCommand(M,E),i.get(C1.ITextSelectionRenderManager).focus()};function V(M){_(M)}function z(M){O(M),M||_(!1)}s.useEffect(()=>{const M=[];return e.disabled$&&M.push(e.disabled$.subscribe(E=>{d(E)})),e.hidden$&&M.push(e.hidden$.subscribe(E=>{S(E)})),e.activated$&&M.push(e.activated$.subscribe(E=>{g(E)})),e.value$&&M.push(e.value$.subscribe(E=>{o(E)})),()=>{M.forEach(E=>{E.unsubscribe()})}},[]);const{tooltip:W,shortcut:w,icon:D,title:k,label:T,id:P}=e,Y=n.t(W!=null?W:"")+(w?` (${w})`:""),{selections:F}=e,Q=s.useMemo(()=>ie.isObservable(F)?F:new ie.Observable(M=>{M.next(F)}),[F]),J=Ae(Q),he=s.useMemo(()=>ie.isObservable(D)?D:new ie.Observable(M=>{var R,G;const E=(G=(R=J==null?void 0:J.find(Z=>Z.value===a))==null?void 0:R.icon)!=null?G:D;M.next(E)}),[D,J,a]),ue=Ae(he,void 0,!0);function re(M){function E(Z){if(u)return;let q=P;const ne=Z;Z.id&&(q=Z.id),N(q,ne)}function R(Z){if(u)return;N(P,{value:Z})}function G(){u||M===Pe.BUTTON_SELECTOR&&N(P,{value:a})}return M===Pe.BUTTON_SELECTOR?v.jsxs("div",{className:Te(fe.toolbarItemSelectButton,{[fe.toolbarItemSelectButtonDisabled]:u,[fe.toolbarItemSelectButtonActivated]:h}),"data-disabled":u,children:[v.jsx("div",{className:fe.toolbarItemSelectButtonLabel,onClick:G,children:v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R})}),u?v.jsx("div",{className:Te(fe.toolbarItemSelectButtonArrow,{[fe.toolbarItemSelectButtonArrowDisabled]:u,[fe.toolbarItemSelectButtonArrowActivated]:h}),"data-disabled":u,children:v.jsx(V1,{})}):v.jsx(me.Dropdown,{overlay:v.jsx(q1,{menuType:P,options:J,onOptionSelect:E,value:a}),onVisibleChange:z,children:v.jsx("div",{className:Te(fe.toolbarItemSelectButtonArrow,{[fe.toolbarItemSelectButtonArrowDisabled]:u,[fe.toolbarItemSelectButtonArrowActivated]:h}),"data-disabled":u,children:v.jsx(V1,{})})})]}):u?v.jsxs("div",{className:Te(fe.toolbarItemSelect,{[fe.toolbarItemSelectDisabled]:u,[fe.toolbarItemSelectActivated]:h}),children:[v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R}),v.jsx("div",{className:Te(fe.toolbarItemSelectArrow,{[fe.toolbarItemSelectArrowDisabled]:u,[fe.toolbarItemSelectArrowActivated]:h}),children:v.jsx(V1,{})})]}):v.jsx(me.Dropdown,{overlay:v.jsx(q1,{menuType:P,options:J,onOptionSelect:E,value:a}),onVisibleChange:z,children:v.jsxs("div",{className:Te(fe.toolbarItemSelect,{[fe.toolbarItemSelectDisabled]:u,[fe.toolbarItemSelectActivated]:h}),children:[v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R}),v.jsx("div",{className:Te(fe.toolbarItemSelectArrow,{[fe.toolbarItemSelectArrowDisabled]:u}),children:v.jsx(V1,{})})]})})}function pe(){var R;const E=le.useDependency(e1).get(typeof T=="string"?T:(R=T==null?void 0:T.name)!=null?R:"");return v.jsx(O6,{className:fe.toolbarItemTextButton,active:h,disabled:u,onClick:()=>N(e.id),onDoubleClick:()=>e.subId&&N(e.subId),children:E?v.jsx($e,{title:k,value:a,label:T}):v.jsx($e,{icon:D})})}function Le(){switch(e.type){case Pe.BUTTON_SELECTOR:case Pe.SELECTOR:case Pe.SUBITEMS:return re(e.type);case Pe.BUTTON:default:return pe()}}return f?null:v.jsx(me.Tooltip,{ref:t,visible:A?!1:y,title:Y,placement:"bottom",onVisibleChange:V,children:Le()})}),g4=[Ze.TOOLBAR_START,Ze.TOOLBAR_INSERT,Ze.TOOLBAR_FORMULAS,Ze.TOOLBAR_DATA,Ze.TOOLBAR_VIEW,Ze.TOOLBAR_OTHERS];function m4(e){const{headerMenuComponents:t}=e,n=le.useDependency(L.LocaleService),r=le.useDependency(f1),[i,a]=s.useState(Ze.TOOLBAR_START),o=s.useRef(null),u=s.useRef({}),[d,h]=s.useState([]),[g,f]=s.useState([]),[S,y]=s.useState([]);s.useEffect(()=>{var z,W;const O=(W=(z=d.find(w=>w.name===i))==null?void 0:z.menuItems)!=null?W:[],V=ie.combineLatest(O.map(w=>{var D;return(D=w.hidden$)!=null?D:new ie.Observable(k=>k.next(!1))})).pipe(ie.map(w=>O.filter((D,k)=>!w[k]))).subscribe(w=>{y(w)});return()=>{V.unsubscribe()}},[d]),s.useEffect(()=>{const O=r.menuChanged$.subscribe(()=>{const N=[];for(const V of g4){const z=r.getMenuItems(V);z.length&&N.push({name:V,menuItems:z})}h(N)});return()=>{O.unsubscribe()}},[i]),s.useEffect(()=>{function O(){var k,T;const V=(T=(k=o.current)==null?void 0:k.clientWidth)!=null?T:0,z=8,W=Object.entries(u.current).filter(([P,Y])=>Y.el&&Y.key&&S.find(F=>F.id===Y.key)).map(([P,Y])=>{var F;return{key:Y.key,width:((F=Y.el)==null?void 0:F.clientWidth)+z}}),w=[];let D=182;for(const P of W)D+=P.width,D>V&&w.push(P.key);f(w)}O();const N=new ResizeObserver(()=>O());return N.observe(document.body),()=>{N.unobserve(document.body)}},[S,d,i]);const _=s.useMemo(()=>{var O,N;return(N=(O=d.find(V=>V.name===i))==null?void 0:O.menuItems.reduce((V,z)=>{var w;const W=(w=z.group)!=null?w:i1.TOOLBAR_OTHERS;return V[W]||(V[W]=[]),V[W].push(z),V},{}))!=null?N:{}},[d]),A=s.useMemo(()=>t&&t.size>0||d.length>1,[t,d]);return v.jsxs(v.Fragment,{children:[A?v.jsxs("header",{className:fe.headerbar,children:[v.jsx("div",{className:fe.menubar,children:d.length>1&&d.map((O,N)=>v.jsx("a",{className:Te(fe.menubarItem,{[fe.menubarItemActive]:O.name===i}),onClick:()=>{a(O.name)},children:n.t(O.name)},N))}),v.jsx("div",{className:fe.headerMenu,children:v.jsx(g1,{components:t})})]}):null,v.jsx("div",{ref:o,className:fe.toolbar,children:v.jsxs("div",{className:fe.toolbarContainer,children:[Object.entries(_).filter(([O,N])=>N.filter(z=>!g.includes(z.id)).length).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>!g.includes(V.id)&&v.jsx(Ot,{...V},V.id))},O)),g.length>0&&v.jsx(me.Tooltip,{title:n.t("more"),placement:"bottom",children:v.jsx(me.Dropdown,{forceRender:!0,className:fe.toolbarMore,overlay:v.jsx("div",{className:fe.toolbarMoreContainer,onClick:O=>O.stopPropagation(),children:Object.entries(_).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>g.includes(V.id)&&v.jsx(Ot,{...V},V.id))},O))}),children:v.jsx(O6,{className:fe.toolbarItemTextButton,children:v.jsx(D2,{})})})})]})}),v.jsx("div",{className:fe.toolbarContainer,style:{position:"absolute",top:-9999,left:-9999,opacity:0},children:Object.entries(_).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>v.jsx(Ot,{ref:z=>{u.current[V.id]={el:z==null?void 0:z.nativeElement,key:V.id}},...V},V.id))},O))})]})}const st=oe.createIdentifier("univer.sidebar-service"),v4="univer-sidebar",C4="univer-sidebar-open",S4="univer-sidebar-container",b4="univer-sidebar-header",y4="univer-sidebar-header-close",_4="univer-sidebar-body",L4="univer-sidebar-footer",s1={sidebar:v4,sidebarOpen:C4,sidebarContainer:S4,sidebarHeader:b4,sidebarHeaderClose:y4,sidebarBody:_4,sidebarFooter:L4};function E4(){const e=le.useDependency(st),[t,n]=s.useState({});s.useEffect(()=>{const u=e.sidebarOptions$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[]);const r=t;for(const u of["children","header","footer"]){const d=u;if(t[d]){const h=t[d];h&&(r[d]=v.jsx($e,{...h}))}}const i=Te(s1.sidebar,{[s1.sidebarOpen]:r.visible}),a=s.useMemo(()=>r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function o(){var d;const u={...t,visible:!1};n(u),e.sidebarOptions$.next(u),(d=u==null?void 0:u.onClose)==null||d.call(u)}return v.jsx("section",{className:i,style:{width:a},children:v.jsxs("section",{className:s1.sidebarContainer,children:[v.jsxs("header",{className:s1.sidebarHeader,children:[r==null?void 0:r.header,v.jsx("a",{className:s1.sidebarHeaderClose,onClick:o,children:v.jsx(Qt,{})})]}),v.jsx("section",{className:s1.sidebarBody,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&v.jsx("footer",{className:s1.sidebarFooter,children:r.footer})]})})}const nn=oe.createIdentifier("univer.zen-zone-service"),w4="univer-zen-zone",M4="univer-zen-zone-open",x4="univer-zen-zone-close",Rt={zenZone:w4,zenZoneOpen:M4,zenZoneClose:x4};function O4(){const e=le.useDependency(nn),[t,n]=s.useState(!1),[r,i]=s.useState(),a=le.useDependency(e1);s.useEffect(()=>{const d=[e.visible$.subscribe(h=>{n(h)}),e.componentKey$.subscribe(h=>{i(h)})];return()=>{d.forEach(h=>{h.unsubscribe()})}},[]);const o=Te(Rt.zenZone,t?Rt.zenZoneOpen:Rt.zenZoneClose),u=s.useMemo(()=>{const d=a.get(r!=null?r:"");if(d)return d},[r]);return v.jsx("section",{className:o,children:u&&v.jsx(u,{})})}function At(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R4(e){if(Array.isArray(e))return At(e)}function I4(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function R6(e,t){if(e){if(typeof e=="string")return At(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return At(e,t)}}function H4(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
9
|
+
*/var Co=s,So=Symbol.for("react.element"),bo=Symbol.for("react.fragment"),yo=Object.prototype.hasOwnProperty,_o=Co.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Lo={key:!0,ref:!0,__self:!0,__source:!0};function l6(e,t,n){var r,i={},a=null,o=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)yo.call(t,r)&&!Lo.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:So,type:e,key:a,ref:o,props:i,_owner:_o.current}}nt.Fragment=bo;nt.jsx=l6;nt.jsxs=l6;s6.exports=nt;var v=s6.exports;function Tn(e){return typeof e=="function"?e():e}function Eo(e,t){return e.length!==t.length?!0:e.some((n,r)=>n!==t[r])}function Ae(e,t,n,r){var S;if(typeof e=="function"&&!r)throw new Error("[useObservable]: expect deps when observable is a function! Otherwise it would cause an infinite loop.");const i=s.useRef(null),a=s.useRef(null),o=s.useRef(r!=null?r:void 0),u=s.useRef(!1),[d,h]=s.useState(0),g=s.useRef((()=>{let y;return e&&Tn(e).subscribe(A=>{u.current=!0,y=A}).unsubscribe(),y!=null?y:t})()),f=(()=>{if(typeof o.current<"u"){const y=r!=null?r:[];return Eo(o.current,y)?(o.current=y,!0):!1}return i.current!==e})();if((!a.current||f)&&e&&(i.current=Tn(e),(S=a.current)==null||S.unsubscribe(),a.current=i.current.subscribe(y=>{g.current=y,h(_=>_+1)})),s.useEffect(()=>()=>{var y;(y=a.current)==null||y.unsubscribe(),a.current=null},[]),n&&!u.current)throw new Error("[useObservable]: expect shouldHaveSyncValue but not getting a sync value!");return g.current}function $e(e){const{title:t,icon:n,label:r,value:i,value$:a}=e,o=le.useDependency(L.LocaleService),u=le.useDependency(e1),d=[];let h=0,g=i;a&&(g=Ae(a,void 0,!0));let f;ie.isObservable(n)?f=Ae(n,void 0,!0):f=n;let S=!1;if(g&&typeof g=="string"&&(S=new L.ColorKit(g).isValid),n){const y=u.get(f!=null?f:"");y&&d.push(v.jsx(y,{extend:{colorChannel1:S?g:"rgb(var(--primary-color))"}},h++))}if(r){const y=typeof r=="string",_=y?{...e}:{...r==null?void 0:r.props,...e},A=y?r:r==null?void 0:r.name,O=u.get(A);O?d.push(v.jsx(O,{..._,value:g},h++)):d.push(v.jsx("span",{children:o.t(A)},h++))}return t&&d.push(v.jsx("span",{children:typeof t=="string"?o.t(t):t},h++)),v.jsx(v.Fragment,{children:d})}const wo="univer-ui-plugin-sheets-font-family",Mo="univer-ui-plugin-sheets-font-family-item",c6={uiPluginSheetsFontFamily:wo,uiPluginSheetsFontFamilyItem:Mo},xo=e=>{const{value:t}=e,n=le.useDependency(L.LocaleService),r=s.useMemo(()=>{var a;let i=n.t(`fontFamily.${((a=`${t}`)!=null?a:"").replace(/\s/g,"")}`);return i.startsWith("fontFamily.")&&typeof t=="string"&&(i=t.split(",")[0]),i},[t]);return v.jsx("div",{className:c6.uiPluginSheetsFontFamily,style:{fontFamily:t},children:r})},Oo=e=>{var r;const{value:t}=e,n=le.useDependency(L.LocaleService);return v.jsx("span",{className:c6.uiPluginSheetsFontFamilyItem,style:{fontFamily:t},children:n.t(`fontFamily.${((r=`${t}`)!=null?r:"").replace(/\s/g,"")}`)})},Ro=[{value:"Arial"},{value:"Times New Roman"},{value:"Tahoma"},{value:"Verdana"},{value:"Microsoft YaHei"},{value:"SimSun"},{value:"SimHei"},{value:"Kaiti"},{value:"FangSong"},{value:"NSimSun"},{value:"STXinwei"},{value:"STXingkai"},{value:"STLiti"}],Io="univer-ui-plugin-sheets-font-size",Ho="univer-ui-plugin-sheets-font-size-input",Vn={uiPluginSheetsFontSize:Io,uiPluginSheetsFontSizeInput:Ho},Do=e=>{const{value:t,min:n,max:r,onChange:i,disabled$:a}=e,o=Ae(a),[u,d]=s.useState(Number(t!=null?t:0)),h=s.useMemo(()=>Number(t!=null?t:u),[t]);function g(S){S!==null&&d(S)}function f(S){S.stopPropagation(),S.code==="Enter"&&i(u.toString())}return v.jsx("div",{className:Vn.uiPluginSheetsFontSize,children:v.jsx(me.InputNumber,{className:Vn.uiPluginSheetsFontSizeInput,value:h,controls:!1,min:n,max:r,onKeyDown:f,onChange:g,disabled:o})})},To=[{label:"9",value:9},{label:"10",value:10},{label:"11",value:11},{label:"12",value:12},{label:"14",value:14},{label:"16",value:16},{label:"18",value:18},{label:"20",value:20},{label:"22",value:22},{label:"24",value:24},{label:"26",value:26},{label:"28",value:28},{label:"36",value:36},{label:"48",value:48},{label:"72",value:72}];var Ze=(e=>(e.VOID="void",e.TOOLBAR_START="uiToolbar.start",e.TOOLBAR_INSERT="uiToolbar.insert",e.TOOLBAR_FORMULAS="uiToolbar.formulas",e.TOOLBAR_DATA="uiToolbar.data",e.TOOLBAR_VIEW="uiToolbar.view",e.TOOLBAR_OTHERS="uiToolbar.others",e.CONTEXT_MENU="contextMenu",e))(Ze||{}),i1=(e=>(e[e.TOOLBAR_HISTORY=0]="TOOLBAR_HISTORY",e[e.TOOLBAR_FORMAT=1]="TOOLBAR_FORMAT",e[e.TOOLBAR_LAYOUT=2]="TOOLBAR_LAYOUT",e[e.TOOLBAR_FORMULAS_INSERT=3]="TOOLBAR_FORMULAS_INSERT",e[e.TOOLBAR_FORMULAS_VIEW=4]="TOOLBAR_FORMULAS_VIEW",e[e.TOOLBAR_FILE=5]="TOOLBAR_FILE",e[e.TOOLBAR_OTHERS=6]="TOOLBAR_OTHERS",e[e.CONTEXT_MENU_FORMAT=7]="CONTEXT_MENU_FORMAT",e[e.CONTEXT_MENU_LAYOUT=8]="CONTEXT_MENU_LAYOUT",e[e.CONTEXT_MENU_DATA=9]="CONTEXT_MENU_DATA",e[e.CONTEXT_MENU_OTHERS=10]="CONTEXT_MENU_OTHERS",e))(i1||{}),Pe=(e=>(e[e.BUTTON=0]="BUTTON",e[e.SELECTOR=1]="SELECTOR",e[e.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",e[e.SUBITEMS=3]="SUBITEMS",e))(Pe||{});function Vo(e,t,n){return window.addEventListener(e,t,n),L.toDisposable(()=>window.removeEventListener(e,t,n))}var No=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Ao=(e,t,n,r)=>{for(var i=r>1?void 0:r?ko(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&No(t,n,i),i},_1=(e,t)=>(n,r)=>t(n,r,e);class jo{constructor(t){B(this,"_focus",!1);B(this,"_valueLegality",!0);B(this,"_openForSheetUnitId");B(this,"_openForSheetSubUnitId");this._param=t,this._openForSheetUnitId=this._param.openForSheetUnitId,this._openForSheetSubUnitId=this._param.openForSheetSubUnitId}get documentDataModel(){return this._param.documentDataModel}get editorUnitId(){return this._param.editorUnitId}get cancelDefaultResizeListener(){return this._param.cancelDefaultResizeListener}get render(){return this._param.render}isSingleChoice(){return this._param.isSingleChoice}setOpenForSheetUnitId(t){this._openForSheetUnitId=t}getOpenForSheetUnitId(){return this._openForSheetUnitId}setOpenForSheetSubUnitId(t){this._openForSheetSubUnitId=t}getOpenForSheetSubUnitId(){return this._openForSheetSubUnitId}isValueLegality(){return this._valueLegality===!0}setValueLegality(t=!0){this._valueLegality=t}isFocus(){return this._focus}setFocus(t=!1){this._focus=t}isSingle(){return this._param.isSingle===!0||this.onlyInputRange()}isReadOnly(){return this._param.isReadonly===!0}onlyInputContent(){return this._param.onlyInputContent===!0}onlyInputFormula(){return this._param.onlyInputFormula===!0}onlyInputRange(){return this._param.onlyInputRange===!0}getBoundingClientRect(){return this._param.editorDom.getBoundingClientRect()}isVisible(){return this._param.visible}isSheetEditor(){return this._param.isSheetEditor===!0}getValue(){var n;return(((n=this._param.documentDataModel.getBody())==null?void 0:n.dataStream)||"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,"")}getBody(){return this._param.documentDataModel.getBody()}update(t){this._param={...this._param,...t}}verticalAlign(){var o,u;const t=(o=this._param)==null?void 0:o.documentDataModel;if(t==null)return;const{width:n,height:r}=this._param.editorDom.getBoundingClientRect();if(!this.isSingle()){t.updateDocumentDataPageSize(n,void 0);return}let i=C1.UNIVER_GLOBAL_DEFAULT_FONT_SIZE;(u=this._param.canvasStyle)!=null&&u.fontSize&&(i=this._param.canvasStyle.fontSize);const a=(r-i*4/3)/2-2;t.updateDocumentDataMargin({t:a<0?0:a}),t.updateDocumentDataPageSize(void 0,void 0)}updateCanvasStyle(){var r;const t=this._param.documentDataModel;if(t==null)return;const n={};(r=this._param.canvasStyle)!=null&&r.fontSize&&(n.textStyle==null&&(n.textStyle={}),n.textStyle.fs=this._param.canvasStyle.fontSize),t.updateDocumentStyle(n)}}exports.EditorService=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_editors",new Map);B(this,"_focusEditorUnitId");B(this,"_state$",new ie.Subject);B(this,"state$",this._state$.asObservable());B(this,"_currentSheetUnitId");B(this,"_currentSheetSubUnitId");B(this,"_inputFormula$",new ie.Subject);B(this,"inputFormula$",this._inputFormula$.asObservable());B(this,"_resize$",new ie.Subject);B(this,"resize$",this._resize$.asObservable());B(this,"_closeRangePrompt$",new ie.Subject);B(this,"closeRangePrompt$",this._closeRangePrompt$.asObservable());B(this,"_blur$",new ie.Subject);B(this,"blur$",this._blur$.asObservable());B(this,"_focus$",new ie.Subject);B(this,"focus$",this._focus$.asObservable());B(this,"_setValue$",new ie.Subject);B(this,"setValue$",this._setValue$.asObservable());B(this,"_valueChange$",new ie.Subject);B(this,"valueChange$",this._valueChange$.asObservable());B(this,"_focusStyle$",new ie.Subject);B(this,"focusStyle$",this._focusStyle$.asObservable());B(this,"_singleSelection$",new ie.Subject);B(this,"singleSelection$",this._singleSelection$.asObservable());B(this,"_spreadsheetFocusState",!1);this._injector=n,this._univerInstanceService=r,this._renderManagerService=i,this._lexerTreeBuilder=a,this._contextService=o}setFocusId(n){this._focusEditorUnitId=n}getFocusId(){return this._focusEditorUnitId}getFocusEditor(){if(this._focusEditorUnitId)return this.getEditor(this._focusEditorUnitId)}isEditor(n){return this._editors.has(n)}isSheetEditor(n){const r=this._editors.get(n);return!!(r&&r.isSheetEditor())}closeRangePrompt(){const n=this._univerInstanceService.getCurrentUniverDocInstance();if(!n)return;const r=n.getUnitId();this._contextService.setContextValue(L.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!1),!(!this.isEditor(r)||this.isSheetEditor(r))&&(this.changeSpreadsheetFocusState(!1),this.blur())}changeSpreadsheetFocusState(n){this._spreadsheetFocusState=n}getSpreadsheetFocusState(){return this._spreadsheetFocusState}focusStyle(n){const r=this.getEditor(n);if(!r)return!1;r.setFocus(!0),this._contextService.setContextValue(L.EDITOR_ACTIVATED,!0),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!0),this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE,r.isSingle()),this._spreadsheetFocusState||this.singleSelection(r.isSingleChoice()),this._focusStyle$.next(n),this.setFocusId(n)}singleSelection(n){this._singleSelection$.next(n)}selectionChangingState(){const n=this.getFocusId();if(n==null)return!0;const r=this.getEditor(n);return!r||r.isSheetEditor()?!0:r.onlyInputRange()!==!0&&r.onlyInputFormula()!==!0?(this.blur(),!0):r.onlyInputFormula()===!0&&this._contextService.getContextValue(L.FOCUSING_EDITOR_INPUT_FORMULA)!==!0?(this.blur(),!0):!this.getSpreadsheetFocusState()}blur(){this._spreadsheetFocusState||(this._closeRangePrompt$.next(null),this.singleSelection(!1),this.setFocusId(null),this._contextService.setContextValue(L.EDITOR_ACTIVATED,!1),this._contextService.setContextValue(L.FOCUSING_EDITOR_STANDALONE,!1)),this.getAllEditor().forEach(n=>{n.setFocus(!1)}),this._focusStyle$.next(),this._blur$.next(null)}focus(n){if(n==null){const a=this._univerInstanceService.getCurrentUniverDocInstance();if(!a)return;n=a.getUnitId()}const r=this.getEditor(n);if(r==null)return;this._univerInstanceService.setCurrentUnitForType(n);const i=r.getValue().length;this.focusStyle(n),this._focus$.next({startOffset:i-2,endOffset:i-2})}setFormula(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this._inputFormula$.next({formulaString:n,editorUnitId:r})}setValue(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this.setValueNoRefresh(n,r),this._refreshValueChange(r)}setValueNoRefresh(n,r){this._setValue$.next({body:{dataStream:n},editorUnitId:r}),this.resize(r)}getValue(n){const r=this.getEditor(n);if(r!=null)return r.getValue()}setRichValue(n,r){r==null&&(r=this._getCurrentEditorUnitId()),this._setValue$.next({body:n,editorUnitId:r}),this._refreshValueChange(r)}getRichValue(n){const r=this.getEditor(n);if(r!=null)return r.getBody()}dispose(){this._state$.complete(),this._editors.clear(),super.dispose()}getEditor(n){return n==null&&(n=this._getCurrentEditorUnitId()),this._editors.get(n)}getAllEditor(){return this._editors}getFirstEditor(){return[...this.getAllEditor().values()][0]}resize(n){const r=this.getEditor(n);r!=null&&(r.verticalAlign(),this._resize$.next(n))}isVisible(n){var r;return(r=this.getEditor(n))==null?void 0:r.isVisible()}setOperationSheetUnitId(n){this._currentSheetUnitId=n}getOperationSheetUnitId(){return this._currentSheetUnitId}setOperationSheetSubUnitId(n){this._currentSheetSubUnitId=n}getOperationSheetSubUnitId(){return this._currentSheetSubUnitId}register(n,r){var g,f,S,y;const{initialSnapshot:i,editorUnitId:a,canvasStyle:o={}}=n,u=this._univerInstanceService.createUnit(L.UniverInstanceType.UNIVER_DOC,i||this._getBlank(a));let d=this._renderManagerService.getRenderById(a);d==null&&(this._renderManagerService.create(a),d=this._renderManagerService.getRenderById(a)),d.engine.setContainer(r);const h=new jo({...n,render:d,documentDataModel:u,editorDom:r,canvasStyle:o});return this._editors.set(a,h),(y=(S=(f=(g=d.mainComponent)==null?void 0:g.getScene())==null?void 0:f.getViewports())==null?void 0:S[0].getScrollBar())==null||y.dispose(),h.isSheetEditor()||(h.verticalAlign(),h.updateCanvasStyle()),L.toDisposable(()=>{this._unRegister(a)})}_unRegister(n){const r=this._editors.get(n);if(r==null)return;if(this._renderManagerService.removeRender(n),r.documentDataModel.dispose(),this._editors.delete(n),this._univerInstanceService.disposeUnit(n),this._univerInstanceService.getAllUnitsForType(L.UniverInstanceType.UNIVER_SHEET).length>0){const a=this._univerInstanceService.getCurrentUnitForType(L.UniverInstanceType.UNIVER_SHEET);this._univerInstanceService.focusUnit(a.getUnitId())}}refreshValueChange(n){this._refreshValueChange(n)}checkValueLegality(n){const r=this._editors.get(n);if(r==null)return!0;let i=r.getValue();if(r.setValueLegality(),i=i.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\n/g,""),i.length===0)return!0;if(r.onlyInputFormula()){if(i.substring(0,1)!==n1.operatorToken.EQUALS)return r.setValueLegality(!1),!1;const a=this._lexerTreeBuilder.checkIfAddBracket(i);r.setValueLegality(a===0)}else if(r.onlyInputRange()){const a=i.split(",");if(r.isSingleChoice()&&a.length>1)return r.setValueLegality(!1),!1;r.setValueLegality(n1.isReferenceStrings(i))}return r.isValueLegality()}_refreshValueChange(n){const r=this.getEditor(n);r!=null&&this._valueChange$.next(r)}_getCurrentEditorUnitId(){return this._univerInstanceService.getCurrentUniverDocInstance().getUnitId()}_refresh(n){this._state$.next(n)}_getBlank(n){return{id:n,body:{dataStream:`${L.DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[],paragraphs:[{startIndex:0}]},documentStyle:{renderConfig:{verticalAlign:L.VerticalAlign.TOP,horizontalAlign:L.HorizontalAlign.LEFT},marginLeft:6,marginTop:2,marginRight:6}}}};exports.EditorService=Ao([_1(0,oe.Inject(oe.Injector)),_1(1,L.IUniverInstanceService),_1(2,C1.IRenderManagerService),_1(3,oe.Inject(n1.LexerTreeBuilder)),_1(4,L.IContextService)],exports.EditorService);const x1=oe.createIdentifier("univer.editor.service");var Uo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,$o=(e,t,n,r)=>{for(var i=r>1?void 0:r?Po(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Uo(t,n,i),i},k1=(e,t)=>(n,r)=>t(n,r,e);const Bo="FOCUSING_UNIVER",zo=["univer-app-layout","univer-toolbar-btn","univer-menu-item","univer-button","univer-sheet-bar-btn","univer-render-canvas"],O1=oe.createIdentifier("ui.layout-service");exports.DesktopLayoutService=class extends L.Disposable{constructor(n,r,i,a){super();B(this,"_rootContainerElement",null);B(this,"_isFocused",!1);B(this,"_focusHandlers",new Map);B(this,"_canvasContainers",[]);B(this,"_allContainers",[]);this._contextService=n,this._univerInstanceService=r,this._logService=i,this._editorService=a,this._initUniverFocusListener(),this._initEditorStatus()}get isFocused(){return this._isFocused}focus(){const n=this._univerInstanceService.getFocusedUnit();if(!n)return;let r;n instanceof L.Workbook?r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_SHEET):n instanceof L.DocumentDataModel?r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_DOC):n instanceof L.SlideDataModel&&(r=this._focusHandlers.get(L.UniverInstanceType.UNIVER_SLIDE)),r&&r(n.getUnitId())}registerFocusHandler(n,r){if(this._focusHandlers.has(n))throw new Error(`[DesktopLayoutService]: handler of type ${n} bas been registered!`);return this._focusHandlers.set(n,r),L.toDisposable(()=>this._focusHandlers.delete(n))}registerCanvasElement(n){if(this._canvasContainers.indexOf(n)===-1)return this._canvasContainers.push(n),L.toDisposable(()=>L.remove(this._canvasContainers,n));throw new Error("[DesktopLayoutService]: canvas container already registered!")}registerRootContainerElement(n){if(this._rootContainerElement)throw new Error("[DesktopLayoutService]: root container already registered!");this._rootContainerElement=n;const r=this.registerContainerElement(n);return L.toDisposable(()=>{this._rootContainerElement=null,r.dispose()})}registerContainerElement(n){if(this._allContainers.indexOf(n)===-1)return this._allContainers.push(n),L.toDisposable(()=>L.remove(this._allContainers,n));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentContainers(n){return this._allContainers.some(r=>r.contains(n))}checkCanvasIsFocused(){return this._canvasContainers.some(n=>n===document.activeElement||n.contains(document.activeElement))}_initUniverFocusListener(){this.disposeWithMe(ie.fromEvent(window,"focusin").subscribe(n=>{const r=n.target;if(zo.some(i=>r.classList.contains(i))){this._blurSheetEditor(),queueMicrotask(()=>this.focus());return}r&&this.checkElementInCurrentContainers(r)?this._isFocused=!0:this._isFocused=!1,this._contextService.setContextValue(Bo,this._isFocused),this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR,Nn())}))}_initEditorStatus(){this._contextService.setContextValue(L.FOCUSING_UNIVER_EDITOR,Nn())}_blurSheetEditor(){const n=this._editorService.getFocusEditor();n&&n.isSheetEditor()!==!0&&this._editorService.blur()}};exports.DesktopLayoutService=$o([L.OnLifecycle(L.LifecycleStages.Ready,O1),k1(0,L.IContextService),k1(1,L.IUniverInstanceService),k1(2,L.ILogService),k1(3,x1)],exports.DesktopLayoutService);function Nn(){var e;return!!((e=document.activeElement)!=null&&e.classList.contains("univer-editor"))}const Jt=oe.createIdentifier("univer.platform-service");class u6{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}}var a1=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.MINUS=189]="MINUS",e[e.EQUAL=187]="EQUAL",e[e.BACK_SLASH=220]="BACK_SLASH",e))(a1||{});const Fo={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",189:"-",187:"=",220:"\\"};var ke=(e=>(e[e.SHIFT=1024]="SHIFT",e[e.ALT=2048]="ALT",e[e.CTRL_COMMAND=4096]="CTRL_COMMAND",e[e.MAC_CTRL=8192]="MAC_CTRL",e))(ke||{}),Zo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Go=(e,t,n,r)=>{for(var i=r>1?void 0:r?Wo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Zo(t,n,i),i},A1=(e,t)=>(n,r)=>t(n,r,e);const S1=oe.createIdentifier("univer.shortcut");exports.DesktopShortcutService=class extends L.Disposable{constructor(n,r,i,a){super();B(this,"_shortCutMapping",new Map);B(this,"_commandIDMapping",new Map);B(this,"_shortcutChanged$",new ie.Subject);B(this,"shortcutChanged$",this._shortcutChanged$.asObservable());B(this,"_forceEscaped",!1);B(this,"_disable",!1);this._commandService=n,this._platformService=r,this._contextService=i,this._layoutService=a,this.disposeWithMe(Vo("keydown",o=>{this._resolveKeyboardEvent(o)},{capture:!0}))}setDisable(n){this._disable=n}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(n=>Array.from(n.values())).flat()}registerShortcut(n){const r=this._getBindingFromItem(n),i=this._shortCutMapping.get(r);i?i.add(n):this._shortCutMapping.set(r,new Set([n]));const a=n.id,o=this._commandIDMapping.get(a);return o?o.add(n):this._commandIDMapping.set(a,new Set([n])),this._emitShortcutChanged(),L.toDisposable(()=>{var u,d,h,g;(u=this._shortCutMapping.get(r))==null||u.delete(n),((d=this._shortCutMapping.get(r))==null?void 0:d.size)===0&&this._shortCutMapping.delete(r),(h=this._commandIDMapping.get(a))==null||h.delete(n),((g=this._commandIDMapping.get(a))==null?void 0:g.size)===0&&this._commandIDMapping.delete(a),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(n){const r=this._commandIDMapping.get(n);return r?this.getShortcutDisplay(r.values().next().value):null}getShortcutDisplay(n){var h;const r=this._getBindingFromItem(n),i=r&ke.CTRL_COMMAND,a=r&ke.SHIFT,o=r&ke.ALT,u=r&ke.MAC_CTRL,d=(h=Fo[r&255])!=null?h:"<->";return this._platformService.isMac?`${i?"⌘":""}${a?"⇧":""}${o?"⌥":""}${u?"⌃":""}${d}`:`${i?"Ctrl+":""}${a?"Shift+":""}${o?"Alt+":""}${d}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,L.toDisposable(()=>this._forceEscaped=!1)}_resolveKeyboardEvent(n){if(this._forceEscaped||this._disable||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(n.target))return;this._dispatch(n)&&n.preventDefault()}_dispatch(n){const r=this._deriveBindingFromEvent(n);if(r===null)return!1;const i=this._shortCutMapping.get(r);if(i===void 0)return!1;const a=Array.from(i).sort((o,u)=>{var d,h;return((d=u.priority)!=null?d:0)-((h=o.priority)!=null?h:0)}).find(o=>{var u,d;return(d=(u=o.preconditions)==null?void 0:u.call(o,this._contextService))!=null?d:!0});return a?(this._commandService.executeCommand(a.id,a.staticParameters),!0):!1}_getBindingFromItem(n){return this._platformService.isMac&&n.mac?n.mac:this._platformService.isWindows&&n.win?n.win:this._platformService.isLinux&&n.linux?n.linux:n.binding}_deriveBindingFromEvent(n){const{shiftKey:r,metaKey:i,altKey:a,keyCode:o}=n;let u=o;return r&&(u|=ke.SHIFT),a&&(u|=ke.ALT),(this._platformService.isMac?i:n.ctrlKey)&&(u|=ke.CTRL_COMMAND),this._platformService.isMac&&n.ctrlKey&&(u|=ke.MAC_CTRL),u}};exports.DesktopShortcutService=Go([A1(0,L.ICommandService),A1(1,Jt),A1(2,L.IContextService),A1(3,oe.Optional(O1))],exports.DesktopShortcutService);var Yo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Xo=(e,t,n,r)=>{for(var i=r>1?void 0:r?qo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Yo(t,n,i),i},Qo=(e,t)=>(n,r)=>t(n,r,e);const f1=oe.createIdentifier("univer.menu-service");exports.DesktopMenuService=class extends L.Disposable{constructor(n){super();B(this,"_menuItemMap",new Map);B(this,"_menuByPositions",new Map);B(this,"_menuChanged$",new ie.BehaviorSubject(void 0));B(this,"menuChanged$",this._menuChanged$.asObservable());this._shortcutService=n}dispose(){this._menuItemMap.clear(),this._menuChanged$.complete()}addMenuItem(n){if(this._menuItemMap.has(n.id))throw new Error(`Menu item with the same id ${n.id} has already been added!`);return this._menuItemMap.set(n.id,n),Array.isArray(n.positions)?n.positions.forEach(r=>this._appendMenuToPosition(n,r)):this._appendMenuToPosition(n,n.positions),this._menuChanged$.next(),L.toDisposable(()=>{if(this._menuItemMap.delete(n.id),Array.isArray(n.positions))n.positions.forEach(r=>{const i=this._menuByPositions.get(r);if(!i)return;const a=i.findIndex(o=>o[0]===n.id);a>-1&&i.splice(a,1)});else{const r=this._menuByPositions.get(n.positions);if(!r)return;const i=r.findIndex(a=>a[0]===n.id);i>-1&&r.splice(i,1)}this._menuChanged$.next()})}getMenuItems(n){if(this._menuByPositions.has(n)){const r=this._menuByPositions.get(n);if(r)return[...r.values()].map(i=>this._getDisplayMenuItems(i[1]))}return[]}getMenuItem(n){return this._menuItemMap.has(n)?this._menuItemMap.get(n):null}_getDisplayMenuItems(n){const r=this._shortcutService.getShortcutDisplayOfCommand(n.id);return r?{...n,shortcut:r}:n}_appendMenuToPosition(n,r){this._menuByPositions.has(r)||this._menuByPositions.set(r,[]);const i=this._menuByPositions.get(r);if(i.findIndex(a=>a[0]===n.id)>-1)throw new Error(`Menu item with the same id ${n.id} has already been added!`);i.push([n.id,n])}};exports.DesktopMenuService=Xo([Qo(0,S1)],exports.DesktopMenuService);const Jo="univer-menu-item-no-hover",Ko="univer-menu-item-activated",e9="univer-menu-item-content",t9="univer-menu-item-selectable",n9="univer-menu-item-selectable-icon",r9="univer-menu-item-more-icon",qe={menuItemNoHover:Jo,menuItemActivated:Ko,menuItemContent:e9,menuItemSelectable:t9,menuItemSelectableIcon:n9,menuItemMoreIcon:r9};function f6(e){const{menuType:t,onOptionSelect:n}=e,r=le.useDependency(f1);if(!t)return;if(Array.isArray(t)){const o=t.map(u=>r.getMenuItems(u)).map(u=>u.reduce((d,h)=>{var g,f;return h.group?(d[h.group]=(g=d[h.group])!=null?g:[],d[h.group].push(h)):(d[i1.CONTEXT_MENU_OTHERS]=(f=d[i1.CONTEXT_MENU_OTHERS])!=null?f:[],d[i1.CONTEXT_MENU_OTHERS].push(h)),d},{}));return v.jsx(v.Fragment,{children:o.map(u=>Object.keys(u).map(d=>v.jsx(me.MenuItemGroup,{eventKey:d,children:u[d].map(h=>v.jsx(kn,{menuItem:h,onClick:g=>{n==null||n({value:"",label:h.id,...g})}},h.id))},d)))})}return r.getMenuItems(t).map(a=>v.jsx(kn,{menuItem:a,onClick:o=>{n==null||n({value:"",label:a.id,...o})}},a.id))}function d6(e){var a;const{options:t,value:n,onOptionSelect:r,parentKey:i}=e;return(a=t==null?void 0:t.map((o,u)=>{var S,y,_;const d=`${i}-${(S=o.label)!=null?S:o.id}-${u}`,h=A=>{r==null||r({value:A,label:o==null?void 0:o.label})},g=()=>{typeof o.value>"u"||r==null||r({...o})},f=Te({[qe.menuItemNoHover]:typeof o.label!="string"&&!((y=o.label)!=null&&y.hoverable)});return v.jsx(me.MenuItem,{disabled:o.disabled,eventKey:d,className:f,onClick:g,children:v.jsxs("span",{className:Te(qe.menuItemContent,{[qe.menuItemSelectable]:!(typeof o.label!="string"&&!((_=o.label)!=null&&_.hoverable))}),children:[typeof n<"u"&&String(n)===String(o.value)&&v.jsx("span",{className:qe.menuItemSelectableIcon,children:v.jsx(Da,{style:{color:"rgb(var(--success-color))"}})}),v.jsx($e,{value$:o.value$,value:o.value,label:o.label,icon:o.icon,onChange:h})]})},d)}))!=null?a:v.jsx(v.Fragment,{})}const q1=e=>v.jsxs(me.Menu,{selectable:!1,children:[v.jsx(d6,{...e}),v.jsx(f6,{...e})]});function kn({menuItem:e,onClick:t}){const n=le.useDependency(f1),r=e.id?n.getMenuItems(e.id):[],i=Ae(e.disabled$,!1),a=Ae(e.activated$,!1),o=Ae(e.hidden$,!1),u=Ae(e.value$),[d,h]=s.useState(u),g=_=>{const A=L.isRealNum(_)&&typeof _=="string"?Number.parseInt(_):_;h(A)},f=()=>{const _=e,{title:A,label:O}=_;return v.jsx(me.MenuItem,{eventKey:_.id,disabled:i,className:Te({[qe.menuItemActivated]:a}),onClick:()=>{t({value:d,id:_.id})},children:v.jsx("span",{className:qe.menuItemContent,children:v.jsx($e,{value:u,title:A,label:O,icon:_.icon,onChange:g})})},_.id)},S=()=>{var N;const _=e,A=Ae(ie.isObservable(_.selections)?_.selections:void 0),O=(N=A!=null?A:_.selections)!=null?N:[];return O.length>0?v.jsx(me.SubMenu,{eventKey:_.id,popupOffset:[18,0],title:v.jsxs("span",{className:qe.menuItemContent,children:[v.jsx($e,{title:_.title,value:d,onChange:g,icon:_.icon,label:_.label}),_.shortcut&&` (${_.shortcut})`]}),expandIcon:v.jsx(Hn,{className:qe.menuItemMoreIcon}),children:O.length>0&&v.jsx(d6,{parentKey:_.id,menuType:_.id,options:O,onOptionSelect:V=>{t({value:V.value,id:_.id})}})},_.id):v.jsx(me.MenuItem,{eventKey:_.id,children:v.jsxs("span",{className:qe.menuItemContent,children:[v.jsx($e,{title:_.title,value:d,icon:_.icon,label:_.label,onChange:g}),_.shortcut&&` (${_.shortcut})`]})},_.id)},y=()=>{const _=e;return v.jsx(me.SubMenu,{eventKey:_.id,popupOffset:[18,0],title:v.jsx("span",{className:qe.menuItemContent,children:v.jsx($e,{title:_.title,icon:_.icon,label:_.label,onChange:g})}),expandIcon:v.jsx(Hn,{className:qe.menuItemMoreIcon}),children:r.length&&v.jsx(f6,{menuType:_.id,parentKey:_.id,onOptionSelect:t})},_.id)};return o?null:v.jsxs(v.Fragment,{children:[e.type===Pe.SELECTOR&&S(),e.type===Pe.SUBITEMS&&y(),e.type===Pe.BUTTON&&f()]})}function i9(e,t,...n){return e.t(t)}function a9(e){const t=s.useRef(e);return t.current=e,s.useCallback((...n)=>t.current(...n),[])}const An="univer.command.copy",Kt={id:An,name:An,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},jn="univer.command.cut",en={id:jn,name:jn,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},Un="univer.command.paste",tn={id:Un,name:Un,multi:!0,priority:0,type:L.CommandType.COMMAND,preconditions:()=>!1,handler:async()=>!0},h6={id:"sheet.operation.set-editor-resize",type:L.CommandType.OPERATION,handler:(e,t)=>!0};function o9(e){const t=e.get(L.IUndoRedoService);return{id:L.UndoCommand.id,group:i1.TOOLBAR_HISTORY,type:Pe.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",positions:[Ze.TOOLBAR_START],disabled$:t.undoRedoStatus$.pipe(c3.map(n=>n.undos<=0))}}function s9(e){const t=e.get(L.IUndoRedoService);return{id:L.RedoCommand.id,group:i1.TOOLBAR_HISTORY,type:Pe.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",positions:[Ze.TOOLBAR_START],disabled$:t.undoRedoStatus$.pipe(c3.map(n=>n.redos<=0))}}var l9=Object.defineProperty,c9=Object.getOwnPropertyDescriptor,u9=(e,t,n,r)=>{for(var i=r>1?void 0:r?c9(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l9(t,n,i),i},j1=(e,t)=>(n,r)=>t(n,r,e);function rt(e){return e.getContextValue(L.FOCUSING_UNIVER_EDITOR)}const p6={id:Kt.id,description:"shortcut.copy",group:"1_common-edit",binding:a1.C|ke.CTRL_COMMAND,preconditions:rt},g6={id:en.id,description:"shortcut.cut",group:"1_common-edit",binding:a1.X|ke.CTRL_COMMAND,preconditions:rt},f9={id:tn.id,description:"shortcut.paste",group:"1_common-edit",binding:a1.V|ke.CTRL_COMMAND,preconditions:()=>!1},m6={id:L.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:a1.Z|ke.CTRL_COMMAND,preconditions:rt},v6={id:L.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:a1.Y|ke.CTRL_COMMAND,preconditions:rt};exports.SharedController=class extends L.Disposable{constructor(t,n,r,i){super(),this._injector=t,this._menuService=n,this._shortcutService=r,this._commandService=i,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts(),this._registerMenus()}_registerMenus(){[o9,s9].forEach(t=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t)))})}_registerCommands(){[en,Kt,tn,h6].forEach(t=>this.disposeWithMe(this._commandService.registerMultipleCommand(t)))}_registerShortcuts(){const t=[m6,v6];t.push(g6,p6,f9),t.forEach(n=>this.disposeWithMe(this._shortcutService.registerShortcut(n)))}};exports.SharedController=u9([L.OnLifecycle(L.LifecycleStages.Ready,exports.SharedController),j1(0,oe.Inject(oe.Injector)),j1(1,f1),j1(2,S1),j1(3,L.ICommandService)],exports.SharedController);const X1=oe.createIdentifier("univer.ui-controller");var R1={},C6={exports:{}},S6={exports:{}};(function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(S6);var I1=S6.exports;(function(e){var t=I1.default;function n(i){if(typeof WeakMap!="function")return null;var a=new WeakMap,o=new WeakMap;return(n=function(d){return d?o:a})(i)}function r(i,a){if(!a&&i&&i.__esModule)return i;if(i===null||t(i)!="object"&&typeof i!="function")return{default:i};var o=n(a);if(o&&o.has(i))return o.get(i);var u={__proto__:null},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if(h!=="default"&&{}.hasOwnProperty.call(i,h)){var g=d?Object.getOwnPropertyDescriptor(i,h):null;g&&(g.get||g.set)?Object.defineProperty(u,h,g):u[h]=i[h]}return u.default=i,o&&o.set(i,u),u}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(C6);var d9=C6.exports,b6={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(b6);var h9=b6.exports,y6={exports:{}};(function(e){var t=I1.default;function n(){e.exports=n=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var r,i={},a=Object.prototype,o=a.hasOwnProperty,u=Object.defineProperty||function(M,E,R){M[E]=R.value},d=typeof Symbol=="function"?Symbol:{},h=d.iterator||"@@iterator",g=d.asyncIterator||"@@asyncIterator",f=d.toStringTag||"@@toStringTag";function S(M,E,R){return Object.defineProperty(M,E,{value:R,enumerable:!0,configurable:!0,writable:!0}),M[E]}try{S({},"")}catch{S=function(R,G,Z){return R[G]=Z}}function y(M,E,R,G){var Z=E&&E.prototype instanceof W?E:W,q=Object.create(Z.prototype),ne=new pe(G||[]);return u(q,"_invoke",{value:J(M,R,ne)}),q}function _(M,E,R){try{return{type:"normal",arg:M.call(E,R)}}catch(G){return{type:"throw",arg:G}}}i.wrap=y;var A="suspendedStart",O="suspendedYield",N="executing",V="completed",z={};function W(){}function w(){}function D(){}var k={};S(k,h,function(){return this});var T=Object.getPrototypeOf,P=T&&T(T(Le([])));P&&P!==a&&o.call(P,h)&&(k=P);var Y=D.prototype=W.prototype=Object.create(k);function F(M){["next","throw","return"].forEach(function(E){S(M,E,function(R){return this._invoke(E,R)})})}function Q(M,E){function R(Z,q,ne,ae){var _e=_(M[Z],M,q);if(_e.type!=="throw"){var Ie=_e.arg,xe=Ie.value;return xe&&t(xe)=="object"&&o.call(xe,"__await")?E.resolve(xe.__await).then(function(Ee){R("next",Ee,ne,ae)},function(Ee){R("throw",Ee,ne,ae)}):E.resolve(xe).then(function(Ee){Ie.value=Ee,ne(Ie)},function(Ee){return R("throw",Ee,ne,ae)})}ae(_e.arg)}var G;u(this,"_invoke",{value:function(q,ne){function ae(){return new E(function(_e,Ie){R(q,ne,_e,Ie)})}return G=G?G.then(ae,ae):ae()}})}function J(M,E,R){var G=A;return function(Z,q){if(G===N)throw Error("Generator is already running");if(G===V){if(Z==="throw")throw q;return{value:r,done:!0}}for(R.method=Z,R.arg=q;;){var ne=R.delegate;if(ne){var ae=he(ne,R);if(ae){if(ae===z)continue;return ae}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(G===A)throw G=V,R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);G=N;var _e=_(M,E,R);if(_e.type==="normal"){if(G=R.done?V:O,_e.arg===z)continue;return{value:_e.arg,done:R.done}}_e.type==="throw"&&(G=V,R.method="throw",R.arg=_e.arg)}}}function he(M,E){var R=E.method,G=M.iterator[R];if(G===r)return E.delegate=null,R==="throw"&&M.iterator.return&&(E.method="return",E.arg=r,he(M,E),E.method==="throw")||R!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+R+"' method")),z;var Z=_(G,M.iterator,E.arg);if(Z.type==="throw")return E.method="throw",E.arg=Z.arg,E.delegate=null,z;var q=Z.arg;return q?q.done?(E[M.resultName]=q.value,E.next=M.nextLoc,E.method!=="return"&&(E.method="next",E.arg=r),E.delegate=null,z):q:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,z)}function ue(M){var E={tryLoc:M[0]};1 in M&&(E.catchLoc=M[1]),2 in M&&(E.finallyLoc=M[2],E.afterLoc=M[3]),this.tryEntries.push(E)}function re(M){var E=M.completion||{};E.type="normal",delete E.arg,M.completion=E}function pe(M){this.tryEntries=[{tryLoc:"root"}],M.forEach(ue,this),this.reset(!0)}function Le(M){if(M||M===""){var E=M[h];if(E)return E.call(M);if(typeof M.next=="function")return M;if(!isNaN(M.length)){var R=-1,G=function Z(){for(;++R<M.length;)if(o.call(M,R))return Z.value=M[R],Z.done=!1,Z;return Z.value=r,Z.done=!0,Z};return G.next=G}}throw new TypeError(t(M)+" is not iterable")}return w.prototype=D,u(Y,"constructor",{value:D,configurable:!0}),u(D,"constructor",{value:w,configurable:!0}),w.displayName=S(D,f,"GeneratorFunction"),i.isGeneratorFunction=function(M){var E=typeof M=="function"&&M.constructor;return!!E&&(E===w||(E.displayName||E.name)==="GeneratorFunction")},i.mark=function(M){return Object.setPrototypeOf?Object.setPrototypeOf(M,D):(M.__proto__=D,S(M,f,"GeneratorFunction")),M.prototype=Object.create(Y),M},i.awrap=function(M){return{__await:M}},F(Q.prototype),S(Q.prototype,g,function(){return this}),i.AsyncIterator=Q,i.async=function(M,E,R,G,Z){Z===void 0&&(Z=Promise);var q=new Q(y(M,E,R,G),Z);return i.isGeneratorFunction(E)?q:q.next().then(function(ne){return ne.done?ne.value:q.next()})},F(Y),S(Y,f,"Generator"),S(Y,h,function(){return this}),S(Y,"toString",function(){return"[object Generator]"}),i.keys=function(M){var E=Object(M),R=[];for(var G in E)R.push(G);return R.reverse(),function Z(){for(;R.length;){var q=R.pop();if(q in E)return Z.value=q,Z.done=!1,Z}return Z.done=!0,Z}},i.values=Le,pe.prototype={constructor:pe,reset:function(E){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(re),!E)for(var R in this)R.charAt(0)==="t"&&o.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=r)},stop:function(){this.done=!0;var E=this.tryEntries[0].completion;if(E.type==="throw")throw E.arg;return this.rval},dispatchException:function(E){if(this.done)throw E;var R=this;function G(Ie,xe){return ne.type="throw",ne.arg=E,R.next=Ie,xe&&(R.method="next",R.arg=r),!!xe}for(var Z=this.tryEntries.length-1;Z>=0;--Z){var q=this.tryEntries[Z],ne=q.completion;if(q.tryLoc==="root")return G("end");if(q.tryLoc<=this.prev){var ae=o.call(q,"catchLoc"),_e=o.call(q,"finallyLoc");if(ae&&_e){if(this.prev<q.catchLoc)return G(q.catchLoc,!0);if(this.prev<q.finallyLoc)return G(q.finallyLoc)}else if(ae){if(this.prev<q.catchLoc)return G(q.catchLoc,!0)}else{if(!_e)throw Error("try statement without catch or finally");if(this.prev<q.finallyLoc)return G(q.finallyLoc)}}}},abrupt:function(E,R){for(var G=this.tryEntries.length-1;G>=0;--G){var Z=this.tryEntries[G];if(Z.tryLoc<=this.prev&&o.call(Z,"finallyLoc")&&this.prev<Z.finallyLoc){var q=Z;break}}q&&(E==="break"||E==="continue")&&q.tryLoc<=R&&R<=q.finallyLoc&&(q=null);var ne=q?q.completion:{};return ne.type=E,ne.arg=R,q?(this.method="next",this.next=q.finallyLoc,z):this.complete(ne)},complete:function(E,R){if(E.type==="throw")throw E.arg;return E.type==="break"||E.type==="continue"?this.next=E.arg:E.type==="return"?(this.rval=this.arg=E.arg,this.method="return",this.next="end"):E.type==="normal"&&R&&(this.next=R),z},finish:function(E){for(var R=this.tryEntries.length-1;R>=0;--R){var G=this.tryEntries[R];if(G.finallyLoc===E)return this.complete(G.completion,G.afterLoc),re(G),z}},catch:function(E){for(var R=this.tryEntries.length-1;R>=0;--R){var G=this.tryEntries[R];if(G.tryLoc===E){var Z=G.completion;if(Z.type==="throw"){var q=Z.arg;re(G)}return q}}throw Error("illegal catch attempt")},delegateYield:function(E,R,G){return this.delegate={iterator:Le(E),resultName:R,nextLoc:G},this.method==="next"&&(this.arg=r),z}},i}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(y6);var p9=y6.exports,_6={exports:{}};(function(e){function t(r,i,a,o,u,d,h){try{var g=r[d](h),f=g.value}catch(S){a(S);return}g.done?i(f):Promise.resolve(f).then(o,u)}function n(r){return function(){var i=this,a=arguments;return new Promise(function(o,u){var d=r.apply(i,a);function h(f){t(d,o,u,h,g,"next",f)}function g(f){t(d,o,u,h,g,"throw",f)}h(void 0)})}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(_6);var g9=_6.exports,L6={exports:{}},E6={exports:{}},w6={exports:{}},M6={exports:{}};(function(e){var t=I1.default;function n(r,i){if(t(r)!="object"||!r)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var o=a.call(r,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(M6);var m9=M6.exports;(function(e){var t=I1.default,n=m9;function r(i){var a=n(i,"string");return t(a)=="symbol"?a:a+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(w6);var v9=w6.exports;(function(e){var t=v9;function n(r,i,a){return i=t(i),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(E6);var C9=E6.exports;(function(e){var t=C9;function n(i,a){var o=Object.keys(i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(i);a&&(u=u.filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable})),o.push.apply(o,u)}return o}function r(i){for(var a=1;a<arguments.length;a++){var o=arguments[a]!=null?arguments[a]:{};a%2?n(Object(o),!0).forEach(function(u){t(i,u,o[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(u){Object.defineProperty(i,u,Object.getOwnPropertyDescriptor(o,u))})}return i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(L6);var S9=L6.exports,b9=d9.default,it=h9.default;Object.defineProperty(R1,"__esModule",{value:!0});R1._r=D9;R1._u=k9;var y9=R1.render=T9,_9=R1.unmount=A9,Q1=it(p9),x6=it(g9),L9=it(I1),E9=it(S9),w9=b9(Xt),H1=(0,E9.default)({},w9),M9=H1.version,x9=H1.render,O9=H1.unmountComponentAtNode,at;try{var R9=Number((M9||"").split(".")[0]);R9>=18&&(at=H1.createRoot)}catch{}function Pn(e){var t=H1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&(0,L9.default)(t)==="object"&&(t.usingClientEntryPoint=e)}var J1="__rc_react_root__";function I9(e,t){Pn(!0);var n=t[J1]||at(t);Pn(!1),n.render(e),t[J1]=n}function H9(e,t){x9(e,t)}function D9(e,t){}function T9(e,t){if(at){I9(e,t);return}H9(e,t)}function V9(e){return Nt.apply(this,arguments)}function Nt(){return Nt=(0,x6.default)((0,Q1.default)().mark(function e(t){return(0,Q1.default)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",Promise.resolve().then(function(){var i;(i=t[J1])===null||i===void 0||i.unmount(),delete t[J1]}));case 1:case"end":return r.stop()}},e)})),Nt.apply(this,arguments)}function N9(e){O9(e)}function k9(e){}function A9(e){return kt.apply(this,arguments)}function kt(){return kt=(0,x6.default)((0,Q1.default)().mark(function e(t){return(0,Q1.default)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(at===void 0){r.next=2;break}return r.abrupt("return",V9(t));case 2:N9(t);case 3:case"end":return r.stop()}},e)})),kt.apply(this,arguments)}const ot=oe.createIdentifier("univer.message-service"),j9="univer-app-layout",U9="univer-app-container",P9="univer-app-container-header",$9="univer-app-container-wrapper",B9="univer-app-container-content",z9="univer-app-container-canvas",F9="univer-app-container-left-sidebar",Z9="univer-app-container-sidebar",t1={appLayout:j9,appContainer:U9,appContainerHeader:P9,appContainerWrapper:$9,appContainerContent:B9,appContainerCanvas:z9,appContainerLeftSidebar:F9,appContainerSidebar:Z9};function g1(e){const{components:t}=e;return t?Array.from(t.values()).map((n,r)=>s.createElement(n(),{key:`${r}`})):null}const W9="univer-toolbar-btn",G9="univer-toolbar-btn-active",$n={toolbarBtn:W9,toolbarBtnActive:G9};function O6(e){const{children:t,className:n,style:r,disabled:i=!1,active:a=!1,onClick:o,onDoubleClick:u,...d}=e,h=S=>{if(i){S.preventDefault();return}o&&o(S)},g=S=>{if(i){S.preventDefault();return}u&&u(S)},f=Te($n.toolbarBtn,{[`${$n.toolbarBtn}-active`]:a},n);return v.jsx("button",{className:f,style:r,disabled:i,onClick:h,onDoubleClick:g,...d,children:t})}const Y9="univer-headerbar",q9="univer-header-menu",X9="univer-menubar",Q9="univer-menubar-item",J9="univer-menubar-item-active",K9="univer-toolbar",e4="univer-toolbar-container",t4="univer-toolbar-more",n4="univer-toolbar-more-container",r4="univer-toolbar-group",i4="univer-toolbar-item-select-button",a4="univer-toolbar-item-select-button-disabled",o4="univer-toolbar-item-select-button-activated",s4="univer-toolbar-item-select-button-label",l4="univer-toolbar-item-select-button-arrow",c4="univer-toolbar-item-select",u4="univer-toolbar-item-select-disabled",f4="univer-toolbar-item-select-activated",d4="univer-toolbar-item-select-arrow",h4="univer-toolbar-item-select-arrow-disabled",p4="univer-toolbar-item-select-arrow-activated",fe={headerbar:Y9,headerMenu:q9,menubar:X9,menubarItem:Q9,menubarItemActive:J9,toolbar:K9,toolbarContainer:e4,toolbarMore:t4,toolbarMoreContainer:n4,toolbarGroup:r4,toolbarItemSelectButton:i4,toolbarItemSelectButtonDisabled:a4,toolbarItemSelectButtonActivated:o4,toolbarItemSelectButtonLabel:s4,toolbarItemSelectButtonArrow:l4,toolbarItemSelect:c4,toolbarItemSelectDisabled:u4,toolbarItemSelectActivated:f4,toolbarItemSelectArrow:d4,toolbarItemSelectArrowDisabled:h4,toolbarItemSelectArrowActivated:p4},Ot=s.forwardRef((e,t)=>{const n=le.useDependency(L.LocaleService),r=le.useDependency(L.ICommandService),i=le.useInjector(),[a,o]=s.useState(),[u,d]=s.useState(!1),[h,g]=s.useState(!1),[f,S]=s.useState(!1),[y,_]=s.useState(!1),[A,O]=s.useState(!1),N=(M,E)=>{r.executeCommand(M,E),i.get(C1.ITextSelectionRenderManager).focus()};function V(M){_(M)}function z(M){O(M),M||_(!1)}s.useEffect(()=>{const M=[];return e.disabled$&&M.push(e.disabled$.subscribe(E=>{d(E)})),e.hidden$&&M.push(e.hidden$.subscribe(E=>{S(E)})),e.activated$&&M.push(e.activated$.subscribe(E=>{g(E)})),e.value$&&M.push(e.value$.subscribe(E=>{o(E)})),()=>{M.forEach(E=>{E.unsubscribe()})}},[]);const{tooltip:W,shortcut:w,icon:D,title:k,label:T,id:P}=e,Y=n.t(W!=null?W:"")+(w?` (${w})`:""),{selections:F}=e,Q=s.useMemo(()=>ie.isObservable(F)?F:new ie.Observable(M=>{M.next(F)}),[F]),J=Ae(Q),he=s.useMemo(()=>ie.isObservable(D)?D:new ie.Observable(M=>{var R,G;const E=(G=(R=J==null?void 0:J.find(Z=>Z.value===a))==null?void 0:R.icon)!=null?G:D;M.next(E)}),[D,J,a]),ue=Ae(he,void 0,!0);function re(M){function E(Z){if(u)return;let q=P;const ne=Z;Z.id&&(q=Z.id),N(q,ne)}function R(Z){if(u)return;N(P,{value:Z})}function G(){u||M===Pe.BUTTON_SELECTOR&&N(P,{value:a})}return M===Pe.BUTTON_SELECTOR?v.jsxs("div",{className:Te(fe.toolbarItemSelectButton,{[fe.toolbarItemSelectButtonDisabled]:u,[fe.toolbarItemSelectButtonActivated]:h}),"data-disabled":u,children:[v.jsx("div",{className:fe.toolbarItemSelectButtonLabel,onClick:G,children:v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R})}),u?v.jsx("div",{className:Te(fe.toolbarItemSelectButtonArrow,{[fe.toolbarItemSelectButtonArrowDisabled]:u,[fe.toolbarItemSelectButtonArrowActivated]:h}),"data-disabled":u,children:v.jsx(V1,{})}):v.jsx(me.Dropdown,{overlay:v.jsx(q1,{menuType:P,options:J,onOptionSelect:E,value:a}),onVisibleChange:z,children:v.jsx("div",{className:Te(fe.toolbarItemSelectButtonArrow,{[fe.toolbarItemSelectButtonArrowDisabled]:u,[fe.toolbarItemSelectButtonArrowActivated]:h}),"data-disabled":u,children:v.jsx(V1,{})})})]}):u?v.jsxs("div",{className:Te(fe.toolbarItemSelect,{[fe.toolbarItemSelectDisabled]:u,[fe.toolbarItemSelectActivated]:h}),children:[v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R}),v.jsx("div",{className:Te(fe.toolbarItemSelectArrow,{[fe.toolbarItemSelectArrowDisabled]:u,[fe.toolbarItemSelectArrowActivated]:h}),children:v.jsx(V1,{})})]}):v.jsx(me.Dropdown,{overlay:v.jsx(q1,{menuType:P,options:J,onOptionSelect:E,value:a}),onVisibleChange:z,children:v.jsxs("div",{className:Te(fe.toolbarItemSelect,{[fe.toolbarItemSelectDisabled]:u,[fe.toolbarItemSelectActivated]:h}),children:[v.jsx($e,{icon:ue,title:k,value:a,label:T,onChange:R}),v.jsx("div",{className:Te(fe.toolbarItemSelectArrow,{[fe.toolbarItemSelectArrowDisabled]:u}),children:v.jsx(V1,{})})]})})}function pe(){var R;const E=le.useDependency(e1).get(typeof T=="string"?T:(R=T==null?void 0:T.name)!=null?R:"");return v.jsx(O6,{className:fe.toolbarItemTextButton,active:h,disabled:u,onClick:()=>N(e.id),onDoubleClick:()=>e.subId&&N(e.subId),children:E?v.jsx($e,{title:k,value:a,label:T}):v.jsx($e,{icon:D})})}function Le(){switch(e.type){case Pe.BUTTON_SELECTOR:case Pe.SELECTOR:case Pe.SUBITEMS:return re(e.type);case Pe.BUTTON:default:return pe()}}return f?null:v.jsx(me.Tooltip,{ref:t,visible:A?!1:y,title:Y,placement:"bottom",onVisibleChange:V,children:Le()})}),g4=[Ze.TOOLBAR_START,Ze.TOOLBAR_INSERT,Ze.TOOLBAR_FORMULAS,Ze.TOOLBAR_DATA,Ze.TOOLBAR_VIEW,Ze.TOOLBAR_OTHERS];function m4(e){const{headerMenuComponents:t}=e,n=le.useDependency(L.LocaleService),r=le.useDependency(f1),[i,a]=s.useState(Ze.TOOLBAR_START),o=s.useRef(null),u=s.useRef({}),[d,h]=s.useState([]),[g,f]=s.useState([]),[S,y]=s.useState([]);s.useEffect(()=>{var z,W;const O=(W=(z=d.find(w=>w.name===i))==null?void 0:z.menuItems)!=null?W:[],V=ie.combineLatest(O.map(w=>{var D;return(D=w.hidden$)!=null?D:new ie.Observable(k=>k.next(!1))})).pipe(ie.map(w=>O.filter((D,k)=>!w[k]))).subscribe(w=>{y(w)});return()=>{V.unsubscribe()}},[d]),s.useEffect(()=>{const O=r.menuChanged$.subscribe(()=>{const N=[];for(const V of g4){const z=r.getMenuItems(V);z.length&&N.push({name:V,menuItems:z})}h(N)});return()=>{O.unsubscribe()}},[i]),s.useEffect(()=>{function O(){var k,T;const V=(T=(k=o.current)==null?void 0:k.clientWidth)!=null?T:0,z=8,W=Object.entries(u.current).filter(([P,Y])=>Y.el&&Y.key&&S.find(F=>F.id===Y.key)).map(([P,Y])=>{var F;return{key:Y.key,width:((F=Y.el)==null?void 0:F.clientWidth)+z}}),w=[];let D=182;for(const P of W)D+=P.width,D>V&&w.push(P.key);f(w)}O();const N=new ResizeObserver(()=>O());return N.observe(document.body),()=>{N.unobserve(document.body)}},[S,d,i]);const _=s.useMemo(()=>{var O,N;return(N=(O=d.find(V=>V.name===i))==null?void 0:O.menuItems.reduce((V,z)=>{var w;const W=(w=z.group)!=null?w:i1.TOOLBAR_OTHERS;return V[W]||(V[W]=[]),V[W].push(z),V},{}))!=null?N:{}},[d]),A=s.useMemo(()=>t&&t.size>0||d.length>1,[t,d]);return v.jsxs(v.Fragment,{children:[A?v.jsxs("header",{className:fe.headerbar,children:[v.jsx("div",{className:fe.menubar,children:d.length>1&&d.map((O,N)=>v.jsx("a",{className:Te(fe.menubarItem,{[fe.menubarItemActive]:O.name===i}),onClick:()=>{a(O.name)},children:n.t(O.name)},N))}),v.jsx("div",{className:fe.headerMenu,children:v.jsx(g1,{components:t})})]}):null,v.jsx("div",{ref:o,className:fe.toolbar,children:v.jsxs("div",{className:fe.toolbarContainer,children:[Object.entries(_).filter(([O,N])=>N.filter(z=>!g.includes(z.id)).length).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>!g.includes(V.id)&&v.jsx(Ot,{...V},V.id))},O)),g.length>0&&v.jsx(me.Tooltip,{title:n.t("more"),placement:"bottom",children:v.jsx(me.Dropdown,{forceRender:!0,className:fe.toolbarMore,overlay:v.jsx("div",{className:fe.toolbarMoreContainer,onClick:O=>O.stopPropagation(),children:Object.entries(_).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>g.includes(V.id)&&v.jsx(Ot,{...V},V.id))},O))}),children:v.jsx(O6,{className:fe.toolbarItemTextButton,children:v.jsx(D2,{})})})})]})}),v.jsx("div",{className:fe.toolbarContainer,style:{position:"absolute",top:-9999,left:-9999,opacity:0},children:Object.entries(_).map(([O,N])=>v.jsx("div",{className:fe.toolbarGroup,children:N.map(V=>v.jsx(Ot,{ref:z=>{u.current[V.id]={el:z==null?void 0:z.nativeElement,key:V.id}},...V},V.id))},O))})]})}const st=oe.createIdentifier("univer.sidebar-service"),v4="univer-sidebar",C4="univer-sidebar-open",S4="univer-sidebar-container",b4="univer-sidebar-header",y4="univer-sidebar-header-close",_4="univer-sidebar-body",L4="univer-sidebar-footer",s1={sidebar:v4,sidebarOpen:C4,sidebarContainer:S4,sidebarHeader:b4,sidebarHeaderClose:y4,sidebarBody:_4,sidebarFooter:L4};function E4(){const e=le.useDependency(st),[t,n]=s.useState({});s.useEffect(()=>{const u=e.sidebarOptions$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[]);const r=t;for(const u of["children","header","footer"]){const d=u;if(t[d]){const h=t[d];h&&(r[d]=v.jsx($e,{...h}))}}const i=Te(s1.sidebar,{[s1.sidebarOpen]:r.visible}),a=s.useMemo(()=>r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function o(){var d;const u={...t,visible:!1};n(u),e.sidebarOptions$.next(u),(d=u==null?void 0:u.onClose)==null||d.call(u)}return v.jsx("section",{className:i,style:{width:a},children:v.jsxs("section",{className:s1.sidebarContainer,children:[v.jsxs("header",{className:s1.sidebarHeader,children:[r==null?void 0:r.header,v.jsx("a",{className:s1.sidebarHeaderClose,onClick:o,children:v.jsx(Qt,{})})]}),v.jsx("section",{className:s1.sidebarBody,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&v.jsx("footer",{className:s1.sidebarFooter,children:r.footer})]})})}const nn=oe.createIdentifier("univer.zen-zone-service"),w4="univer-zen-zone",M4="univer-zen-zone-open",x4="univer-zen-zone-close",Rt={zenZone:w4,zenZoneOpen:M4,zenZoneClose:x4};function O4(){const e=le.useDependency(nn),[t,n]=s.useState(!1),[r,i]=s.useState(),a=le.useDependency(e1);s.useEffect(()=>{const d=[e.visible$.subscribe(h=>{n(h)}),e.componentKey$.subscribe(h=>{i(h)})];return()=>{d.forEach(h=>{h.unsubscribe()})}},[]);const o=Te(Rt.zenZone,t?Rt.zenZoneOpen:Rt.zenZoneClose),u=s.useMemo(()=>{const d=a.get(r!=null?r:"");if(d)return d},[r]);return v.jsx("section",{className:o,children:u&&v.jsx(u,{})})}function At(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R4(e){if(Array.isArray(e))return At(e)}function I4(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function R6(e,t){if(e){if(typeof e=="string")return At(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return At(e,t)}}function H4(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w1(e){return R4(e)||I4(e)||R6(e)||H4()}function D4(e){if(Array.isArray(e))return e}function T4(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,u=[],d=!0,h=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);d=!0);}catch(g){h=!0,i=g}finally{try{if(!d&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(h)throw i}}return u}}function V4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
11
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){return D4(e)||T4(e,t)||R6(e,t)||V4()}function N4(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function K1(e,t){if(e==null)return{};var n=N4(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function We(e){"@babel/helpers - typeof";return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(e)}function k4(e,t){if(We(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(We(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I6(e){var t=k4(e,"string");return We(t)=="symbol"?t:t+""}function He(e,t,n){return t=I6(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bn(Object(n),!0).forEach(function(r){He(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function u1(){return u1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u1.apply(this,arguments)}var H6={exports:{}};/*!
|
|
12
12
|
Copyright (c) 2018 Jed Watson.
|
|
@@ -37,13 +37,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
37
37
|
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
|
|
38
38
|
onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
|
|
39
39
|
onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
|
|
40
|
-
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,p5="".concat(d5," ").concat(h5).split(/[\s\n]+/),g5="aria-",m5="data-";function Xn(e,t){return e.indexOf(t)===0}function v5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||Xn(i,g5))||n.data&&Xn(i,m5)||n.attr&&p5.includes(i))&&(r[i]=e[i])}),r}var C5=te.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,g=e.closeIcon,f=g===void 0?"x":g,S=e.props,y=e.onClick,_=e.onNoticeClose,A=e.times,O=e.hovering,N=te.useState(!1),V=Ve(N,2),z=V[0],W=V[1],w=O||z,D=function(){_(u)},k=function(Q){(Q.key==="Enter"||Q.code==="Enter"||Q.keyCode===K.ENTER)&&D()};te.useEffect(function(){if(!w&&o>0){var F=setTimeout(function(){D()},o*1e3);return function(){clearTimeout(F)}}},[o,w,A]);var T=te.useMemo(function(){return We(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),P=v5(T,!0),Y="".concat(n,"-notice");return te.createElement("div",u1({},S,{ref:t,className:M1(Y,i,He({},"".concat(Y,"-closable"),h)),style:r,onMouseEnter:function(Q){var J;W(!0),S==null||(J=S.onMouseEnter)===null||J===void 0||J.call(S,Q)},onMouseLeave:function(Q){var J;W(!1),S==null||(J=S.onMouseLeave)===null||J===void 0||J.call(S,Q)},onClick:y}),te.createElement("div",{className:"".concat(Y,"-content")},d),h&&te.createElement("a",u1({tabIndex:0,className:"".concat(Y,"-close"),onKeyDown:k,"aria-label":"Close"},P,{onClick:function(Q){Q.preventDefault(),Q.stopPropagation(),D()}}),T.closeIcon))}),S5=s.createContext({}),Qn=8,Jn=3,Kn=16,b5=function(t){var n={offset:Qn,threshold:Jn,gap:Kn};if(t&&We(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:Qn,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:Jn,n.gap=(a=t.gap)!==null&&a!==void 0?a:Kn}return[!!t,n]},y5=["className","style","classNames","styles"],_5=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,g=t.stack,f=s.useContext(S5),S=f.classNames,y=s.useRef({}),_=s.useState(null),A=Ve(_,2),O=A[0],N=A[1],V=s.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=n.map(function(re){return{config:re,key:String(re.key)}}),k=b5(g),T=Ve(k,2),P=T[0],Y=T[1],F=Y.offset,Q=Y.threshold,J=Y.gap,he=P&&(W.length>0||D.length<=Q),ue=typeof u=="function"?u(r):u;return s.useEffect(function(){P&&W.length>1&&w(function(re){return re.filter(function(pe){return D.some(function(Le){var M=Le.key;return pe===M})})})},[W,D,P]),s.useEffect(function(){var re;if(P&&y.current[(re=D[D.length-1])===null||re===void 0?void 0:re.key]){var pe;N(y.current[(pe=D[D.length-1])===null||pe===void 0?void 0:pe.key])}},[D,P]),s.createElement(f5,u1({key:r,className:M1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,He(He({},"".concat(i,"-stack"),!!P),"".concat(i,"-stack-expanded"),he)),style:o,keys:D,motionAppear:!0},ue,{onAllRemoved:function(){d(r)}}),function(re,pe){var Le=re.config,M=re.className,E=re.style,R=re.index,G=Le,Z=G.key,q=G.times,ne=String(Z),ae=Le,_e=ae.className,Ie=ae.style,xe=ae.classNames,Ee=ae.styles,Ye=K1(ae,y5),Be=D.findIndex(function(o1){return o1.key===ne}),Ue={};if(P){var se=D.length-1-(Be>-1?Be:R-1),ee=r==="top"||r==="bottom"?"-50%":"0";if(se>0){var Se,Ne,Oe;Ue.height=he?(Se=y.current[ne])===null||Se===void 0?void 0:Se.offsetHeight:O==null?void 0:O.offsetHeight;for(var we=0,de=0;de<se;de++){var ge;we+=((ge=y.current[D[D.length-1-de].key])===null||ge===void 0?void 0:ge.offsetHeight)+J}var je=(he?we:se*F)*(r.startsWith("top")?1:-1),Je=!he&&O!==null&&O!==void 0&&O.offsetWidth&&(Ne=y.current[ne])!==null&&Ne!==void 0&&Ne.offsetWidth?((O==null?void 0:O.offsetWidth)-F*2*(se<3?se:3))/((Oe=y.current[ne])===null||Oe===void 0?void 0:Oe.offsetWidth):1;Ue.transform="translate3d(".concat(ee,", ").concat(je,"px, 0) scaleX(").concat(Je,")")}else Ue.transform="translate3d(".concat(ee,", 0, 0)")}return s.createElement("div",{ref:pe,className:M1("".concat(i,"-notice-wrapper"),M,xe==null?void 0:xe.wrapper),style:Ce(Ce(Ce({},E),Ue),Ee==null?void 0:Ee.wrapper),onMouseEnter:function(){return w(function(Ke){return Ke.includes(ne)?Ke:[].concat(w1(Ke),[ne])})},onMouseLeave:function(){return w(function(Ke){return Ke.filter(function(D1){return D1!==ne})})}},s.createElement(C5,u1({},Ye,{ref:function(Ke){Be>-1?y.current[ne]=Ke:delete y.current[ne]},prefixCls:i,classNames:xe,styles:Ee,className:M1(_e,S==null?void 0:S.notice),style:Ie,times:q,key:Z,eventKey:Z,onNoticeClose:h,hovering:P&&W.length>0})))})},L5=te.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,g=e.stack,f=e.renderNotifications,S=te.useState([]),y=Ve(S,2),_=y[0],A=y[1],O=function(P){var Y,F=_.find(function(Q){return Q.key===P});F==null||(Y=F.onClose)===null||Y===void 0||Y.call(F),A(function(Q){return Q.filter(function(J){return J.key!==P})})};te.useImperativeHandle(t,function(){return{open:function(P){A(function(Y){var F=w1(Y),Q=F.findIndex(function(ue){return ue.key===P.key}),J=Ce({},P);if(Q>=0){var he;J.times=(((he=Y[Q])===null||he===void 0?void 0:he.times)||0)+1,F[Q]=J}else J.times=0,F.push(J);return o>0&&F.length>o&&(F=F.slice(-o)),F})},close:function(P){O(P)},destroy:function(){A([])}}});var N=te.useState({}),V=Ve(N,2),z=V[0],W=V[1];te.useEffect(function(){var T={};_.forEach(function(P){var Y=P.placement,F=Y===void 0?"topRight":Y;F&&(T[F]=T[F]||[],T[F].push(P))}),Object.keys(z).forEach(function(P){T[P]=T[P]||[]}),W(T)},[_]);var w=function(P){W(function(Y){var F=Ce({},Y),Q=F[P]||[];return Q.length||delete F[P],F})},D=te.useRef(!1);if(te.useEffect(function(){Object.keys(z).length>0?D.current=!0:D.current&&(h==null||h(),D.current=!1)},[z]),!i)return null;var k=Object.keys(z);return Xt.createPortal(te.createElement(te.Fragment,null,k.map(function(T){var P=z[T],Y=te.createElement(_5,{key:T,configList:P,placement:T,prefixCls:r,className:u==null?void 0:u(T),style:d==null?void 0:d(T),motion:a,onNoticeClose:O,onAllNoticeRemoved:w,stack:g});return f?f(Y,{prefixCls:r,key:T}):Y})),i)}),E5=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],w5=function(){return document.body},e3=0;function M5(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function x5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?w5:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,g=e.renderNotifications,f=K1(e,E5),S=te.useState(),y=Ve(S,2),_=y[0],A=y[1],O=te.useRef(),N=te.createElement(L5,{container:_,ref:O,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:g}),V=te.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=te.useMemo(function(){return{open:function(T){var P=M5(f,T);(P.key===null||P.key===void 0)&&(P.key="rc-notification-".concat(e3),e3+=1),w(function(Y){return[].concat(w1(Y),[{type:"open",config:P}])})},close:function(T){w(function(P){return[].concat(w1(P),[{type:"close",key:T}])})},destroy:function(){w(function(T){return[].concat(w1(T),[{type:"destroy"}])})}}},[]);return te.useEffect(function(){A(n())}),te.useEffect(function(){O.current&&W.length&&(W.forEach(function(k){switch(k.type){case"open":O.current.open(k.config);break;case"close":O.current.close(k.key);break;case"destroy":O.current.destroy();break}}),w(function(k){return k.filter(function(T){return!W.includes(T)})}))},[W]),[D,N]}const O5="univer-notification",R5="univer-notification-notice",I5="univer-notification-notice-wrapper",H5="univer-notification-notice-content",D5="univer-notification-notice-close",T5="univer-notification-icon",V5="univer-notification-icon-success",N5="univer-notification-icon-info",k5="univer-notification-icon-warning",A5="univer-notification-icon-error",j5="univer-notification-content-container",U5="univer-notification-title",P5="univer-notification-content",$5="univer-notification-content-ellipsis",B5="univer-notification-top",z5="univer-notification-topLeft",F5="univer-notification-topRight",Z5="univer-notification-bottom",W5="univer-notification-bottomRight",G5="univer-notification-bottomLeft",Y5="univer-notification-fade",q5="univer-notification-fade-appear-prepare",X5="univer-notification-fade-appear-start",Q5="univer-notification-fade-appear-active",J5="univer-notification-fade-appear",K5="univer-notification-fade-enter",e0="univer-notification-fade-leave",t0="univer-notification-fade-enter-active",n0="univer-notification-fade-in",r0="univer-notification-fade-leave-active",i0="univer-notification-fade-out",Qe={notification:O5,notificationNotice:R5,notificationNoticeWrapper:I5,notificationNoticeContent:H5,notificationNoticeClose:D5,notificationIcon:T5,notificationIconSuccess:V5,notificationIconInfo:N5,notificationIconWarning:k5,notificationIconError:A5,notificationContentContainer:j5,notificationTitle:U5,notificationContent:P5,notificationContentEllipsis:$5,notificationTop:B5,notificationTopLeft:z5,notificationTopRight:F5,notificationBottom:Z5,notificationBottomRight:W5,notificationBottomLeft:G5,notificationFade:Y5,notificationFadeAppearPrepare:q5,notificationFadeAppearStart:X5,notificationFadeAppearActive:Q5,notificationFadeAppear:J5,notificationFadeEnter:K5,notificationFadeLeave:e0,notificationFadeEnterActive:t0,notificationFadeIn:n0,notificationFadeLeaveActive:r0,notificationFadeOut:i0},a0={success:v.jsx(ro,{className:Qe.notificationIconSuccess}),info:v.jsx(Dn,{className:Qe.notificationIconInfo}),warning:v.jsx(Dn,{className:Qe.notificationIconWarning}),error:v.jsx(Xa,{className:Qe.notificationIconError})},Q6=new ie.Subject,o0=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Te(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:a0[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function s0(){const{mountContainer:e}=s.useContext(me.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=x5({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(Qt,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(Q6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(o0,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const l0={show:e=>{Q6.next(e)}},cn=oe.createIdentifier("univer.confirm-service");function c0(){const e=le.useDependency(cn),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const g=h,f=i[g];f&&(d[g]=v.jsx($e,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(me.Confirm,{...i},a))}const un=oe.createIdentifier("univer.context-menu-service");class J6 extends L.Disposable{constructor(){super(...arguments);B(this,"_currentHandler",null);B(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,L.toDisposable(()=>{this._currentHandler=null})}}function u0(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(un),u=le.useDependency(L.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",g),document.addEventListener("wheel",g),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("wheel",g),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function g(){t(!1)}return v.jsx(me.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(q1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:y}=f;u&&u.executeCommand(S,{value:y}),d.get(C1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const fn=oe.createIdentifier("univer.ui.dialog-service");function f0(){const e=le.useDependency(fn),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.getObservableDialog().subscribe(o=>{n(o)});return()=>{a.unsubscribe()}},[e]);const r=t.map(i=>{const{children:a,title:o,closeIcon:u,footer:d,...h}=i,g=h;for(const f of["children","title","closeIcon","footer"]){const S=f,y=i[S];y&&(g[S]=v.jsx($e,{...y}))}return g});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(me.Dialog,{...i},i.id))})}const dn=oe.createIdentifier("univer.global-zone-service"),d0="univer-global-zone",h0="univer-global-zone-open",p0="univer-global-zone-close",t3={globalZone:d0,globalZoneOpen:h0,globalZoneClose:p0};function g0(){const e=le.useDependency(dn),[t,n]=s.useState(!1),r=Ae(e.componentKey$),i=le.useDependency(e1),a=Te(t3.globalZone,t3.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const m0=new Set([()=>f0,()=>c0,()=>s0,()=>u0,()=>g0]),hn=oe.createIdentifier("univer.popup.service");class K6{constructor(){B(this,"_popupMap",new Map);B(this,"_popups$",new ie.BehaviorSubject([]));B(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=L.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const v0=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(me.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function C0(){const e=le.useDependency(hn),t=Ae(e.popups$,void 0,!0),n=le.useDependency(e1);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(v0,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function S0(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,g=le.useDependency(L.LocaleService),f=le.useDependency(L.ThemeService),S=le.useDependency(ot),y=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(me.defaultTheme)},[]),s.useEffect(()=>{y.current&&(h==null||h(y.current))},[h]);const[_,A]=s.useState(g.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(O),S.setContainer(O);const N=[g.localeChanged$.subscribe(()=>{A(g.getLocales())}),f.currentTheme$.subscribe(V=>{me.themeInstance.setTheme(r,V),O&&me.themeInstance.setTheme(O,V)})];return()=>{N.forEach(V=>V.unsubscribe()),document.body.removeChild(O)}},[g,S,r,O,f.currentTheme$]),v.jsxs(me.ConfigProvider,{locale:_,mountContainer:O,children:[v.jsxs("div",{className:t1.appLayout,tabIndex:-1,onBlur:N=>N.stopPropagation(),children:[t&&v.jsx("header",{className:t1.appContainerHeader,children:v.jsx(m4,{headerMenuComponents:a})}),v.jsxs("section",{className:t1.appContainer,children:[v.jsxs("div",{className:t1.appContainerWrapper,children:[v.jsx("aside",{className:t1.appContainerLeftSidebar,children:v.jsx(g1,{components:d})}),v.jsxs("section",{className:t1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(g1,{components:i})}),v.jsx("section",{className:t1.appContainerCanvas,ref:y,"data-range-selector":!0,onContextMenu:N=>N.preventDefault(),children:v.jsx(g1,{components:o})})]}),v.jsx("aside",{className:t1.appContainerSidebar,children:v.jsx(E4,{})})]}),n&&v.jsx("footer",{className:t1.appFooter,children:v.jsx(g1,{components:u})}),v.jsx(O4,{})]}),v.jsx(C0,{})]}),v.jsx(g1,{components:m0})]})}var b0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,_0=(e,t,n,r)=>{for(var i=r>1?void 0:r?y0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b0(t,n,i),i},L1=(e,t)=>(n,r)=>t(n,r,e),ei=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(ei||{});const L0=3e3;exports.DesktopUIController=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_componentsByPart",new Map);B(this,"_componentRegistered$",new ie.Subject);B(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(E0(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==L.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ie.filter(a=>a===L.LifecycleStages.Ready),ie.delay(300),ie.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=L.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=L.LifecycleStages.Steady,L0)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),L.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}};exports.DesktopUIController=_0([L1(0,L.IUniverInstanceService),L1(1,C1.IRenderManagerService),L1(2,oe.Inject(oe.Injector)),L1(3,oe.Inject(L.LifecycleService)),L1(4,oe.Optional(O1))],exports.DesktopUIController);function E0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const g=document.getElementById(i);g?r=g:r=n3(i)}else i instanceof HTMLElement?r=i:r=n3("univer");const a=le.connectInjector(S0,e),o=e.get(X1),u=g=>n(g,r);function d(){const g=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),y=o.getComponents("header-menu"),_=o.getComponents("left-sidebar");y9(v.jsx(a,{...t,mountContainer:r,headerComponents:g,headerMenuComponents:y,leftSidebarComponents:_,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),L.toDisposable(()=>{_9(r),h.unsubscribe()})}function n3(e){const t=document.createElement("div");return t.id=e,t}const w0={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},M0=w0,x0={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},ti=x0,Ct=oe.createIdentifier("univer.notification-service");var O0=Object.defineProperty,R0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?R0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O0(t,n,i),i},H0=(e,t)=>(n,r)=>t(n,r,e);const ni=oe.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){B(this,"_beforeUnloadCallbacks",[]);B(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
|
|
41
|
-
`);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}};exports.DesktopBeforeCloseService=I0([H0(0,Ct)],exports.DesktopBeforeCloseService);function D0(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var T0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,N0=(e,t,n,r)=>{for(var i=r>1?void 0:r?V0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&T0(t,n,i),i},Dt=(e,t)=>(n,r)=>t(n,r,e);const Zt="text/plain",Wt="text/html",ri=oe.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends L.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return D0()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Zt]:new Blob([t],{type:Zt}),[Wt]:new Blob([n],{type:Wt})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=A0();document.body.appendChild(r),r.innerHTML=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=k0();document.body.appendChild(r),r.value=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}};exports.BrowserClipboardService=N0([Dt(0,oe.Inject(L.LocaleService)),Dt(1,L.ILogService),Dt(2,oe.Optional(Ct))],exports.BrowserClipboardService);function k0(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function A0(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function r3(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class ii{constructor(){B(this,"_confirmOptions",[]);B(this,"confirmOptions$",new ie.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),L.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class ai extends L.Disposable{constructor(){super(...arguments);B(this,"_dialogOptions",[]);B(this,"_dialogOptions$",new ie.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),L.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getObservableDialog(){return this._dialogOptions$}}class oi{constructor(){B(this,"portalContainer",document.body);B(this,"message")}setContainer(t){this.portalContainer=t,this.message=new me.Message(t)}show(t){const{type:n,...r}=t;return this.message&&this.message[n](r),L.toDisposable(()=>{})}}class si{show(t){return l0.show(t),L.toDisposable(()=>{})}}var j0=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,P0=(e,t,n,r)=>{for(var i=r>1?void 0:r?U0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&j0(t,n,i),i},$0=(e,t)=>(n,r)=>t(n,r,e);exports.DesktopGlobalZoneService=class{constructor(t){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);this._componentManager=t}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),L.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=P0([$0(0,oe.Inject(e1))],exports.DesktopGlobalZoneService);class li{constructor(){B(this,"_sidebarOptions",{});B(this,"sidebarOptions$",new ie.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),L.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,F0=(e,t,n,r)=>{for(var i=r>1?void 0:r?z0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&B0(t,n,i),i},i3=(e,t)=>(n,r)=>t(n,r,e);let Z1=class extends L.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(L.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:me.MessageType.Error})})))}};Z1=F0([L.OnLifecycle(L.LifecycleStages.Starting,Z1),i3(0,oe.Inject(L.ErrorService)),i3(1,ot)],Z1);class ci extends L.Disposable{constructor(){super(...arguments);B(this,"_open$",new ie.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(ie.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const ui="ShortcutPanel",pn={id:"base-ui.operation.toggle-shortcut-panel",type:L.CommandType.OPERATION,handler:e=>{const t=e.get(ci),n=e.get(st);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:ui}})),!0}},Z0="univer-shortcut-panel-group-title",W0="univer-shortcut-panel-item",G0="univer-shortcut-panel-item-title",Y0="univer-shortcut-panel-item-shortcut",h1={shortcutPanelGroupTitle:Z0,shortcutPanelItem:W0,shortcutPanelItemTitle:G0,shortcutPanelItemShortcut:Y0};function q0(){const e=le.useDependency(S1),t=le.useDependency(L.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const g=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(g))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${g}!`);a.has(g)||a.set(g,[]),a.get(g).push(f)}const u=Array.from(a.entries()).map(([h,g])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:g}}).sort((h,g)=>h.sequence-g.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:h1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:h1.shortcutPanelGroup,children:[v.jsx("div",{className:h1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:h1.shortcutPanelItem,children:[v.jsx("span",{className:h1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:h1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function X0(e){return{id:pn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:Pe.BUTTON,positions:[Ze.TOOLBAR_START],hidden$:a6(e,L.UniverInstanceType.UNIVER_SHEET)}}var Q0=Object.defineProperty,J0=Object.getOwnPropertyDescriptor,K0=(e,t,n,r)=>{for(var i=r>1?void 0:r?J0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q0(t,n,i),i},E1=(e,t)=>(n,r)=>t(n,r,e);const es={id:pn.id,binding:ke.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let W1=class extends L.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(X0))),this.disposeWithMe(t.register(ui,q0)),this.disposeWithMe(i.registerCommand(pn)),this.disposeWithMe(n.registerShortcut(es))}};W1=K0([L.OnLifecycle(L.LifecycleStages.Steady,W1),E1(0,oe.Inject(oe.Injector)),E1(1,oe.Inject(e1)),E1(2,S1),E1(3,f1),E1(4,L.ICommandService)],W1);function z1(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fi={exports:{}};/*!
|
|
40
|
+
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,p5="".concat(d5," ").concat(h5).split(/[\s\n]+/),g5="aria-",m5="data-";function Xn(e,t){return e.indexOf(t)===0}function v5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||Xn(i,g5))||n.data&&Xn(i,m5)||n.attr&&p5.includes(i))&&(r[i]=e[i])}),r}var C5=te.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,g=e.closeIcon,f=g===void 0?"x":g,S=e.props,y=e.onClick,_=e.onNoticeClose,A=e.times,O=e.hovering,N=te.useState(!1),V=Ve(N,2),z=V[0],W=V[1],w=O||z,D=function(){_(u)},k=function(Q){(Q.key==="Enter"||Q.code==="Enter"||Q.keyCode===K.ENTER)&&D()};te.useEffect(function(){if(!w&&o>0){var F=setTimeout(function(){D()},o*1e3);return function(){clearTimeout(F)}}},[o,w,A]);var T=te.useMemo(function(){return We(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),P=v5(T,!0),Y="".concat(n,"-notice");return te.createElement("div",u1({},S,{ref:t,className:M1(Y,i,He({},"".concat(Y,"-closable"),h)),style:r,onMouseEnter:function(Q){var J;W(!0),S==null||(J=S.onMouseEnter)===null||J===void 0||J.call(S,Q)},onMouseLeave:function(Q){var J;W(!1),S==null||(J=S.onMouseLeave)===null||J===void 0||J.call(S,Q)},onClick:y}),te.createElement("div",{className:"".concat(Y,"-content")},d),h&&te.createElement("a",u1({tabIndex:0,className:"".concat(Y,"-close"),onKeyDown:k,"aria-label":"Close"},P,{onClick:function(Q){Q.preventDefault(),Q.stopPropagation(),D()}}),T.closeIcon))}),S5=s.createContext({}),Qn=8,Jn=3,Kn=16,b5=function(t){var n={offset:Qn,threshold:Jn,gap:Kn};if(t&&We(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:Qn,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:Jn,n.gap=(a=t.gap)!==null&&a!==void 0?a:Kn}return[!!t,n]},y5=["className","style","classNames","styles"],_5=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,g=t.stack,f=s.useContext(S5),S=f.classNames,y=s.useRef({}),_=s.useState(null),A=Ve(_,2),O=A[0],N=A[1],V=s.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=n.map(function(re){return{config:re,key:String(re.key)}}),k=b5(g),T=Ve(k,2),P=T[0],Y=T[1],F=Y.offset,Q=Y.threshold,J=Y.gap,he=P&&(W.length>0||D.length<=Q),ue=typeof u=="function"?u(r):u;return s.useEffect(function(){P&&W.length>1&&w(function(re){return re.filter(function(pe){return D.some(function(Le){var M=Le.key;return pe===M})})})},[W,D,P]),s.useEffect(function(){var re;if(P&&y.current[(re=D[D.length-1])===null||re===void 0?void 0:re.key]){var pe;N(y.current[(pe=D[D.length-1])===null||pe===void 0?void 0:pe.key])}},[D,P]),s.createElement(f5,u1({key:r,className:M1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,He(He({},"".concat(i,"-stack"),!!P),"".concat(i,"-stack-expanded"),he)),style:o,keys:D,motionAppear:!0},ue,{onAllRemoved:function(){d(r)}}),function(re,pe){var Le=re.config,M=re.className,E=re.style,R=re.index,G=Le,Z=G.key,q=G.times,ne=String(Z),ae=Le,_e=ae.className,Ie=ae.style,xe=ae.classNames,Ee=ae.styles,Ye=K1(ae,y5),Be=D.findIndex(function(o1){return o1.key===ne}),Ue={};if(P){var se=D.length-1-(Be>-1?Be:R-1),ee=r==="top"||r==="bottom"?"-50%":"0";if(se>0){var Se,Ne,Oe;Ue.height=he?(Se=y.current[ne])===null||Se===void 0?void 0:Se.offsetHeight:O==null?void 0:O.offsetHeight;for(var we=0,de=0;de<se;de++){var ge;we+=((ge=y.current[D[D.length-1-de].key])===null||ge===void 0?void 0:ge.offsetHeight)+J}var je=(he?we:se*F)*(r.startsWith("top")?1:-1),Je=!he&&O!==null&&O!==void 0&&O.offsetWidth&&(Ne=y.current[ne])!==null&&Ne!==void 0&&Ne.offsetWidth?((O==null?void 0:O.offsetWidth)-F*2*(se<3?se:3))/((Oe=y.current[ne])===null||Oe===void 0?void 0:Oe.offsetWidth):1;Ue.transform="translate3d(".concat(ee,", ").concat(je,"px, 0) scaleX(").concat(Je,")")}else Ue.transform="translate3d(".concat(ee,", 0, 0)")}return s.createElement("div",{ref:pe,className:M1("".concat(i,"-notice-wrapper"),M,xe==null?void 0:xe.wrapper),style:Ce(Ce(Ce({},E),Ue),Ee==null?void 0:Ee.wrapper),onMouseEnter:function(){return w(function(Ke){return Ke.includes(ne)?Ke:[].concat(w1(Ke),[ne])})},onMouseLeave:function(){return w(function(Ke){return Ke.filter(function(D1){return D1!==ne})})}},s.createElement(C5,u1({},Ye,{ref:function(Ke){Be>-1?y.current[ne]=Ke:delete y.current[ne]},prefixCls:i,classNames:xe,styles:Ee,className:M1(_e,S==null?void 0:S.notice),style:Ie,times:q,key:Z,eventKey:Z,onNoticeClose:h,hovering:P&&W.length>0})))})},L5=te.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,g=e.stack,f=e.renderNotifications,S=te.useState([]),y=Ve(S,2),_=y[0],A=y[1],O=function(P){var Y,F=_.find(function(Q){return Q.key===P});F==null||(Y=F.onClose)===null||Y===void 0||Y.call(F),A(function(Q){return Q.filter(function(J){return J.key!==P})})};te.useImperativeHandle(t,function(){return{open:function(P){A(function(Y){var F=w1(Y),Q=F.findIndex(function(ue){return ue.key===P.key}),J=Ce({},P);if(Q>=0){var he;J.times=(((he=Y[Q])===null||he===void 0?void 0:he.times)||0)+1,F[Q]=J}else J.times=0,F.push(J);return o>0&&F.length>o&&(F=F.slice(-o)),F})},close:function(P){O(P)},destroy:function(){A([])}}});var N=te.useState({}),V=Ve(N,2),z=V[0],W=V[1];te.useEffect(function(){var T={};_.forEach(function(P){var Y=P.placement,F=Y===void 0?"topRight":Y;F&&(T[F]=T[F]||[],T[F].push(P))}),Object.keys(z).forEach(function(P){T[P]=T[P]||[]}),W(T)},[_]);var w=function(P){W(function(Y){var F=Ce({},Y),Q=F[P]||[];return Q.length||delete F[P],F})},D=te.useRef(!1);if(te.useEffect(function(){Object.keys(z).length>0?D.current=!0:D.current&&(h==null||h(),D.current=!1)},[z]),!i)return null;var k=Object.keys(z);return Xt.createPortal(te.createElement(te.Fragment,null,k.map(function(T){var P=z[T],Y=te.createElement(_5,{key:T,configList:P,placement:T,prefixCls:r,className:u==null?void 0:u(T),style:d==null?void 0:d(T),motion:a,onNoticeClose:O,onAllNoticeRemoved:w,stack:g});return f?f(Y,{prefixCls:r,key:T}):Y})),i)}),E5=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],w5=function(){return document.body},e3=0;function M5(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function x5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?w5:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,g=e.renderNotifications,f=K1(e,E5),S=te.useState(),y=Ve(S,2),_=y[0],A=y[1],O=te.useRef(),N=te.createElement(L5,{container:_,ref:O,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:g}),V=te.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=te.useMemo(function(){return{open:function(T){var P=M5(f,T);(P.key===null||P.key===void 0)&&(P.key="rc-notification-".concat(e3),e3+=1),w(function(Y){return[].concat(w1(Y),[{type:"open",config:P}])})},close:function(T){w(function(P){return[].concat(w1(P),[{type:"close",key:T}])})},destroy:function(){w(function(T){return[].concat(w1(T),[{type:"destroy"}])})}}},[]);return te.useEffect(function(){A(n())}),te.useEffect(function(){O.current&&W.length&&(W.forEach(function(k){switch(k.type){case"open":O.current.open(k.config);break;case"close":O.current.close(k.key);break;case"destroy":O.current.destroy();break}}),w(function(k){return k.filter(function(T){return!W.includes(T)})}))},[W]),[D,N]}const O5="univer-notification",R5="univer-notification-notice",I5="univer-notification-notice-wrapper",H5="univer-notification-notice-content",D5="univer-notification-notice-close",T5="univer-notification-icon",V5="univer-notification-icon-success",N5="univer-notification-icon-info",k5="univer-notification-icon-warning",A5="univer-notification-icon-error",j5="univer-notification-content-container",U5="univer-notification-title",P5="univer-notification-content",$5="univer-notification-content-ellipsis",B5="univer-notification-top",z5="univer-notification-topLeft",F5="univer-notification-topRight",Z5="univer-notification-bottom",W5="univer-notification-bottomRight",G5="univer-notification-bottomLeft",Y5="univer-notification-fade",q5="univer-notification-fade-appear-prepare",X5="univer-notification-fade-appear-start",Q5="univer-notification-fade-appear-active",J5="univer-notification-fade-appear",K5="univer-notification-fade-enter",e0="univer-notification-fade-leave",t0="univer-notification-fade-enter-active",n0="univer-notification-fade-in",r0="univer-notification-fade-leave-active",i0="univer-notification-fade-out",Qe={notification:O5,notificationNotice:R5,notificationNoticeWrapper:I5,notificationNoticeContent:H5,notificationNoticeClose:D5,notificationIcon:T5,notificationIconSuccess:V5,notificationIconInfo:N5,notificationIconWarning:k5,notificationIconError:A5,notificationContentContainer:j5,notificationTitle:U5,notificationContent:P5,notificationContentEllipsis:$5,notificationTop:B5,notificationTopLeft:z5,notificationTopRight:F5,notificationBottom:Z5,notificationBottomRight:W5,notificationBottomLeft:G5,notificationFade:Y5,notificationFadeAppearPrepare:q5,notificationFadeAppearStart:X5,notificationFadeAppearActive:Q5,notificationFadeAppear:J5,notificationFadeEnter:K5,notificationFadeLeave:e0,notificationFadeEnterActive:t0,notificationFadeIn:n0,notificationFadeLeaveActive:r0,notificationFadeOut:i0},a0={success:v.jsx(ro,{className:Qe.notificationIconSuccess}),info:v.jsx(Dn,{className:Qe.notificationIconInfo}),warning:v.jsx(Dn,{className:Qe.notificationIconWarning}),error:v.jsx(Xa,{className:Qe.notificationIconError})},Q6=new ie.Subject,o0=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Te(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:a0[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function s0(){const{mountContainer:e}=s.useContext(me.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=x5({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(Qt,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(Q6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(o0,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const l0={show:e=>{Q6.next(e)}},cn=oe.createIdentifier("univer.confirm-service");function c0(){const e=le.useDependency(cn),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const g=h,f=i[g];f&&(d[g]=v.jsx($e,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(me.Confirm,{...i},a))}const un=oe.createIdentifier("univer.context-menu-service");class J6 extends L.Disposable{constructor(){super(...arguments);B(this,"_currentHandler",null);B(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,L.toDisposable(()=>{this._currentHandler=null})}}function u0(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(un),u=le.useDependency(L.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",g),document.addEventListener("wheel",g),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("wheel",g),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function g(){t(!1)}return v.jsx(me.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(q1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:y}=f;u&&u.executeCommand(S,{value:y}),d.get(C1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const fn=oe.createIdentifier("univer.ui.dialog-service");function f0(){const e=le.useDependency(fn),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.getObservableDialog().subscribe(o=>{n(o)});return()=>{a.unsubscribe()}},[e]);const r=t.map(i=>{const{children:a,title:o,closeIcon:u,footer:d,...h}=i,g=h;for(const f of["children","title","closeIcon","footer"]){const S=f,y=i[S];y&&(g[S]=v.jsx($e,{...y}))}return g});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(me.Dialog,{...i},i.id))})}const dn=oe.createIdentifier("univer.global-zone-service"),d0="univer-global-zone",h0="univer-global-zone-open",p0="univer-global-zone-close",t3={globalZone:d0,globalZoneOpen:h0,globalZoneClose:p0};function g0(){const e=le.useDependency(dn),[t,n]=s.useState(!1),r=Ae(e.componentKey$,e.componentKey),i=le.useDependency(e1),a=Te(t3.globalZone,t3.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r,i]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const m0=new Set([()=>f0,()=>c0,()=>s0,()=>u0,()=>g0]),hn=oe.createIdentifier("univer.popup.service");class K6{constructor(){B(this,"_popupMap",new Map);B(this,"_popups$",new ie.BehaviorSubject([]));B(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=L.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const v0=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(me.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function C0(){const e=le.useDependency(hn),t=Ae(e.popups$,void 0,!0),n=le.useDependency(e1);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(v0,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function S0(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,g=le.useDependency(L.LocaleService),f=le.useDependency(L.ThemeService),S=le.useDependency(ot),y=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(me.defaultTheme)},[]),s.useEffect(()=>{y.current&&(h==null||h(y.current))},[h]);const[_,A]=s.useState(g.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(O),S.setContainer(O);const N=[g.localeChanged$.subscribe(()=>{A(g.getLocales())}),f.currentTheme$.subscribe(V=>{me.themeInstance.setTheme(r,V),O&&me.themeInstance.setTheme(O,V)})];return()=>{N.forEach(V=>V.unsubscribe()),document.body.removeChild(O)}},[g,S,r,O,f.currentTheme$]),v.jsxs(me.ConfigProvider,{locale:_,mountContainer:O,children:[v.jsxs("div",{className:t1.appLayout,tabIndex:-1,onBlur:N=>N.stopPropagation(),children:[t&&v.jsx("header",{className:t1.appContainerHeader,children:v.jsx(m4,{headerMenuComponents:a})}),v.jsxs("section",{className:t1.appContainer,children:[v.jsxs("div",{className:t1.appContainerWrapper,children:[v.jsx("aside",{className:t1.appContainerLeftSidebar,children:v.jsx(g1,{components:d})}),v.jsxs("section",{className:t1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(g1,{components:i})}),v.jsx("section",{className:t1.appContainerCanvas,ref:y,"data-range-selector":!0,onContextMenu:N=>N.preventDefault(),children:v.jsx(g1,{components:o})})]}),v.jsx("aside",{className:t1.appContainerSidebar,children:v.jsx(E4,{})})]}),n&&v.jsx("footer",{className:t1.appFooter,children:v.jsx(g1,{components:u})}),v.jsx(O4,{})]}),v.jsx(C0,{})]}),v.jsx(g1,{components:m0})]})}var b0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,_0=(e,t,n,r)=>{for(var i=r>1?void 0:r?y0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b0(t,n,i),i},L1=(e,t)=>(n,r)=>t(n,r,e),ei=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(ei||{});const L0=3e3;exports.DesktopUIController=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_componentsByPart",new Map);B(this,"_componentRegistered$",new ie.Subject);B(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(E0(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==L.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ie.filter(a=>a===L.LifecycleStages.Ready),ie.delay(300),ie.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=L.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=L.LifecycleStages.Steady,L0)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),L.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}};exports.DesktopUIController=_0([L1(0,L.IUniverInstanceService),L1(1,C1.IRenderManagerService),L1(2,oe.Inject(oe.Injector)),L1(3,oe.Inject(L.LifecycleService)),L1(4,oe.Optional(O1))],exports.DesktopUIController);function E0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const g=document.getElementById(i);g?r=g:r=n3(i)}else i instanceof HTMLElement?r=i:r=n3("univer");const a=le.connectInjector(S0,e),o=e.get(X1),u=g=>n(g,r);function d(){const g=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),y=o.getComponents("header-menu"),_=o.getComponents("left-sidebar");y9(v.jsx(a,{...t,mountContainer:r,headerComponents:g,headerMenuComponents:y,leftSidebarComponents:_,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),L.toDisposable(()=>{_9(r),h.unsubscribe()})}function n3(e){const t=document.createElement("div");return t.id=e,t}const w0={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},M0=w0,x0={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},ti=x0,Ct=oe.createIdentifier("univer.notification-service");var O0=Object.defineProperty,R0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?R0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O0(t,n,i),i},H0=(e,t)=>(n,r)=>t(n,r,e);const ni=oe.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){B(this,"_beforeUnloadCallbacks",[]);B(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
|
|
41
|
+
`);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}};exports.DesktopBeforeCloseService=I0([H0(0,Ct)],exports.DesktopBeforeCloseService);function D0(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var T0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,N0=(e,t,n,r)=>{for(var i=r>1?void 0:r?V0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&T0(t,n,i),i},Dt=(e,t)=>(n,r)=>t(n,r,e);const Zt="text/plain",Wt="text/html",ri=oe.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends L.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return D0()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Zt]:new Blob([t],{type:Zt}),[Wt]:new Blob([n],{type:Wt})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=A0();document.body.appendChild(r),r.innerHTML=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=k0();document.body.appendChild(r),r.value=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}};exports.BrowserClipboardService=N0([Dt(0,oe.Inject(L.LocaleService)),Dt(1,L.ILogService),Dt(2,oe.Optional(Ct))],exports.BrowserClipboardService);function k0(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function A0(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function r3(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class ii{constructor(){B(this,"_confirmOptions",[]);B(this,"confirmOptions$",new ie.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),L.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class ai extends L.Disposable{constructor(){super(...arguments);B(this,"_dialogOptions",[]);B(this,"_dialogOptions$",new ie.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),L.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getObservableDialog(){return this._dialogOptions$}}class oi{constructor(){B(this,"portalContainer",document.body);B(this,"message")}setContainer(t){this.portalContainer=t,this.message=new me.Message(t)}show(t){const{type:n,...r}=t;return this.message&&this.message[n](r),L.toDisposable(()=>{})}}class si{show(t){return l0.show(t),L.toDisposable(()=>{})}}var j0=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,P0=(e,t,n,r)=>{for(var i=r>1?void 0:r?U0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&j0(t,n,i),i},$0=(e,t)=>(n,r)=>t(n,r,e);exports.DesktopGlobalZoneService=class{constructor(t){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);B(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),this._componentKey=t,L.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=P0([$0(0,oe.Inject(e1))],exports.DesktopGlobalZoneService);class li{constructor(){B(this,"_sidebarOptions",{});B(this,"sidebarOptions$",new ie.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),L.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,F0=(e,t,n,r)=>{for(var i=r>1?void 0:r?z0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&B0(t,n,i),i},i3=(e,t)=>(n,r)=>t(n,r,e);let Z1=class extends L.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(L.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:me.MessageType.Error})})))}};Z1=F0([L.OnLifecycle(L.LifecycleStages.Starting,Z1),i3(0,oe.Inject(L.ErrorService)),i3(1,ot)],Z1);class ci extends L.Disposable{constructor(){super(...arguments);B(this,"_open$",new ie.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(ie.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const ui="ShortcutPanel",pn={id:"base-ui.operation.toggle-shortcut-panel",type:L.CommandType.OPERATION,handler:e=>{const t=e.get(ci),n=e.get(st);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:ui}})),!0}},Z0="univer-shortcut-panel-group-title",W0="univer-shortcut-panel-item",G0="univer-shortcut-panel-item-title",Y0="univer-shortcut-panel-item-shortcut",h1={shortcutPanelGroupTitle:Z0,shortcutPanelItem:W0,shortcutPanelItemTitle:G0,shortcutPanelItemShortcut:Y0};function q0(){const e=le.useDependency(S1),t=le.useDependency(L.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const g=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(g))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${g}!`);a.has(g)||a.set(g,[]),a.get(g).push(f)}const u=Array.from(a.entries()).map(([h,g])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:g}}).sort((h,g)=>h.sequence-g.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:h1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:h1.shortcutPanelGroup,children:[v.jsx("div",{className:h1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:h1.shortcutPanelItem,children:[v.jsx("span",{className:h1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:h1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function X0(e){return{id:pn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:Pe.BUTTON,positions:[Ze.TOOLBAR_START],hidden$:a6(e,L.UniverInstanceType.UNIVER_SHEET)}}var Q0=Object.defineProperty,J0=Object.getOwnPropertyDescriptor,K0=(e,t,n,r)=>{for(var i=r>1?void 0:r?J0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q0(t,n,i),i},E1=(e,t)=>(n,r)=>t(n,r,e);const es={id:pn.id,binding:ke.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let W1=class extends L.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(X0))),this.disposeWithMe(t.register(ui,q0)),this.disposeWithMe(i.registerCommand(pn)),this.disposeWithMe(n.registerShortcut(es))}};W1=K0([L.OnLifecycle(L.LifecycleStages.Steady,W1),E1(0,oe.Inject(oe.Injector)),E1(1,oe.Inject(e1)),E1(2,S1),E1(3,f1),E1(4,L.ICommandService)],W1);function z1(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fi={exports:{}};/*!
|
|
42
42
|
localForage -- Offline Storage, Improved
|
|
43
43
|
Version 1.10.0
|
|
44
44
|
https://localforage.github.io/localForage
|
|
45
45
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
46
|
-
*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,g){if(!i[h]){if(!r[h]){var f=typeof z1=="function"&&z1;if(!g&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var y=i[h]={exports:{}};r[h][0].call(y.exports,function(_){var A=r[h][1][_];return o(A||_)},y,y.exports,n,r,i,a)}return i[h].exports}for(var u=typeof z1=="function"&&z1,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(_),g=a.document.createTextNode("");h.observe(g,{characterData:!0}),u=function(){g.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=_,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var O=a.document.createElement("script");O.onreadystatechange=function(){_(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},a.document.documentElement.appendChild(O)}:u=function(){setTimeout(_,0)};var S,y=[];function _(){S=!0;for(var O,N,V=y.length;V;){for(N=y,y=[],O=-1;++O<V;)N[O]();V=y.length}S=!1}r.exports=A;function A(O){y.push(O)===1&&!S&&u()}}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],g=["PENDING"];r.exports=f;function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,w!==o&&A(this,w)}f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,D){if(typeof w!="function"&&this.state===h||typeof D!="function"&&this.state===d)return this;var k=new this.constructor(o);if(this.state!==g){var T=this.state===h?w:D;y(k,T,this.outcome)}else this.queue.push(new S(k,w,D));return k};function S(w,D,k){this.promise=w,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(w){u.resolve(this.promise,w)},S.prototype.otherCallFulfilled=function(w){y(this.promise,this.onFulfilled,w)},S.prototype.callRejected=function(w){u.reject(this.promise,w)},S.prototype.otherCallRejected=function(w){y(this.promise,this.onRejected,w)};function y(w,D,k){a(function(){var T;try{T=D(k)}catch(P){return u.reject(w,P)}T===w?u.reject(w,new TypeError("Cannot resolve promise with itself")):u.resolve(w,T)})}u.resolve=function(w,D){var k=O(_,D);if(k.status==="error")return u.reject(w,k.value);var T=k.value;if(T)A(w,T);else{w.state=h,w.outcome=D;for(var P=-1,Y=w.queue.length;++P<Y;)w.queue[P].callFulfilled(D)}return w},u.reject=function(w,D){w.state=d,w.outcome=D;for(var k=-1,T=w.queue.length;++k<T;)w.queue[k].callRejected(D);return w};function _(w){var D=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof D=="function")return function(){D.apply(w,arguments)}}function A(w,D){var k=!1;function T(Q){k||(k=!0,u.reject(w,Q))}function P(Q){k||(k=!0,u.resolve(w,Q))}function Y(){D(P,T)}var F=O(Y);F.status==="error"&&T(F.value)}function O(w,D){var k={};try{k.value=w(D),k.status="success"}catch(T){k.status="error",k.value=T}return k}f.resolve=N;function N(w){return w instanceof this?w:u.resolve(new this(o),w)}f.reject=V;function V(w){var D=new this(o);return u.reject(D,w)}f.all=z;function z(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=new Array(k),Y=0,F=-1,Q=new this(o);++F<k;)J(w[F],F);return Q;function J(he,ue){D.resolve(he).then(re,function(pe){T||(T=!0,u.reject(Q,pe))});function re(pe){P[ue]=pe,++Y===k&&!T&&(T=!0,u.resolve(Q,P))}}}f.race=W;function W(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=-1,Y=new this(o);++P<k;)F(w[P]);return Y;function F(Q){D.resolve(Q).then(function(J){T||(T=!0,u.resolve(Y,J))},function(J){T||(T=!0,u.reject(Y,J))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function g(l,p){l=l||[],p=p||{};try{return new Blob(l,p)}catch(m){if(m.name!=="TypeError")throw m;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(p.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,p){p&&l.then(function(c){p(null,c)},function(c){p(c)})}function y(l,p,c){typeof p=="function"&&l.then(p),typeof c=="function"&&l.catch(c)}function _(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",N=void 0,V={},z=Object.prototype.toString,W="readonly",w="readwrite";function D(l){for(var p=l.length,c=new ArrayBuffer(p),C=new Uint8Array(c),b=0;b<p;b++)C[b]=l.charCodeAt(b);return c}function k(l){return new f(function(p){var c=l.transaction(O,w),C=g([""]);c.objectStore(O).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),p(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),m=navigator.userAgent.match(/Edge\//);p(m||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function T(l){return typeof N=="boolean"?f.resolve(N):k(l).then(function(p){return N=p,N})}function P(l){var p=V[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),p.deferredOperations.push(c),p.dbReady?p.dbReady=p.dbReady.then(function(){return c.promise}):p.dbReady=c.promise}function Y(l){var p=V[l.name],c=p.deferredOperations.pop();if(c)return c.resolve(),c.promise}function F(l,p){var c=V[l.name],C=c.deferredOperations.pop();if(C)return C.reject(p),C.promise}function Q(l,p){return new f(function(c,C){if(V[l.name]=V[l.name]||G(),l.db)if(p)P(l),l.db.close();else return c(l.db);var b=[l.name];p&&b.push(l.version);var m=d.open.apply(d,b);p&&(m.onupgradeneeded=function(x){var H=m.result;try{H.createObjectStore(l.storeName),x.oldVersion<=1&&H.createObjectStore(O)}catch(j){if(j.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+x.oldVersion+" to version "+x.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw j}}),m.onerror=function(x){x.preventDefault(),C(m.error)},m.onsuccess=function(){var x=m.result;x.onversionchange=function(H){H.target.close()},c(x),Y(l)}})}function J(l){return Q(l,!1)}function he(l){return Q(l,!0)}function ue(l,p){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==p&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var m=l.db.version+1;m>l.version&&(l.version=m)}return!0}return!1}function re(l){return new f(function(p,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var m=btoa(b.target.result||"");p({__local_forage_encoded_blob:!0,data:m,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var p=D(atob(l.data));return g([p],{type:l.type})}function Le(l){return l&&l.__local_forage_encoded_blob}function M(l){var p=this,c=p._initReady().then(function(){var C=V[p._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return y(c,l,l),c}function E(l){P(l);for(var p=V[l.name],c=p.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,J(l).then(function(m){return l.db=m,ue(l)?he(l):m}).then(function(m){l.db=p.db=m;for(var x=0;x<c.length;x++)c[x]._dbInfo.db=m}).catch(function(m){throw F(l,m),m})}function R(l,p,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,p);c(null,b)}catch(m){if(C>0&&(!l.db||m.name==="InvalidStateError"||m.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||m.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),he(l)}).then(function(){return E(l).then(function(){R(l,p,c,C-1)})}).catch(c);c(m)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Z(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=V[c.name];b||(b=G(),V[c.name]=b),b.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=M);var m=[];function x(){return f.resolve()}for(var H=0;H<b.forages.length;H++){var j=b.forages[H];j!==p&&m.push(j._initReady().catch(x))}var U=b.forages.slice(0);return f.all(m).then(function(){return c.db=b.db,J(c)}).then(function($){return c.db=$,ue(c,p._defaultConfig.version)?he(c):$}).then(function($){c.db=b.db=$,p._dbInfo=c;for(var X=0;X<U.length;X++){var ce=U[X];ce!==p&&(ce._dbInfo.db=c.db,ce._dbInfo.version=c.version)}})}function q(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.get(l);U.onsuccess=function(){var $=U.result;$===void 0&&($=null),Le($)&&($=pe($)),b($)},U.onerror=function(){m(U.error)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function ne(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.openCursor(),$=1;U.onsuccess=function(){var X=U.result;if(X){var ce=X.value;Le(ce)&&(ce=pe(ce));var ve=l(ce,X.key,$++);ve!==void 0?b(ve):X.continue()}else b()},U.onerror=function(){m(U.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function ae(l,p,c){var C=this;l=_(l);var b=new f(function(m,x){var H;C.ready().then(function(){return H=C._dbInfo,z.call(p)==="[object Blob]"?T(H.db).then(function(j){return j?p:re(p)}):p}).then(function(j){R(C._dbInfo,w,function(U,$){if(U)return x(U);try{var X=$.objectStore(C._dbInfo.storeName);j===null&&(j=void 0);var ce=X.put(j,l);$.oncomplete=function(){j===void 0&&(j=null),m(j)},$.onabort=$.onerror=function(){var ve=ce.error?ce.error:ce.transaction.error;x(ve)}}catch(ve){x(ve)}})}).catch(x)});return S(b,c),b}function _e(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,w,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.delete(l);H.oncomplete=function(){b()},H.onerror=function(){m(U.error)},H.onabort=function(){var $=U.error?U.error:U.transaction.error;m($)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function Ie(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,w,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.clear();x.oncomplete=function(){C()},x.onabort=x.onerror=function(){var U=j.error?j.error:j.transaction.error;b(U)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function xe(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.count();j.onsuccess=function(){C(j.result)},j.onerror=function(){b(j.error)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function Ee(l,p){var c=this,C=new f(function(b,m){if(l<0){b(null);return}c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=!1,$=j.openKeyCursor();$.onsuccess=function(){var X=$.result;if(!X){b(null);return}l===0||U?b(X.key):(U=!0,X.advance(l))},$.onerror=function(){m($.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function Ye(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.openKeyCursor(),U=[];j.onsuccess=function(){var $=j.result;if(!$){C(U);return}U.push($.key),$.continue()},j.onerror=function(){b(j.error)}}catch($){b($)}})}).catch(b)});return S(c,l),c}function Be(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var m=l.name===c.name&&C._dbInfo.db,x=m?f.resolve(C._dbInfo.db):J(l).then(function(H){var j=V[l.name],U=j.forages;j.db=H;for(var $=0;$<U.length;$++)U[$]._dbInfo.db=H;return H});l.storeName?b=x.then(function(H){if(H.objectStoreNames.contains(l.storeName)){var j=H.version+1;P(l);var U=V[l.name],$=U.forages;H.close();for(var X=0;X<$.length;X++){var ce=$[X];ce._dbInfo.db=null,ce._dbInfo.version=j}var ve=new f(function(be,Re){var Me=d.open(l.name,j);Me.onerror=function(ze){var y1=Me.result;y1.close(),Re(ze)},Me.onupgradeneeded=function(){var ze=Me.result;ze.deleteObjectStore(l.storeName)},Me.onsuccess=function(){var ze=Me.result;ze.close(),be(ze)}});return ve.then(function(be){U.db=be;for(var Re=0;Re<$.length;Re++){var Me=$[Re];Me._dbInfo.db=be,Y(Me._dbInfo)}}).catch(function(be){throw(F(l,be)||f.resolve()).catch(function(){}),be})}}):b=x.then(function(H){P(l);var j=V[l.name],U=j.forages;H.close();for(var $=0;$<U.length;$++){var X=U[$];X._dbInfo.db=null}var ce=new f(function(ve,be){var Re=d.deleteDatabase(l.name);Re.onerror=function(){var Me=Re.result;Me&&Me.close(),be(Re.error)},Re.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},Re.onsuccess=function(){var Me=Re.result;Me&&Me.close(),ve(Me)}});return ce.then(function(ve){j.db=ve;for(var be=0;be<U.length;be++){var Re=U[be];Y(Re._dbInfo)}}).catch(function(ve){throw(F(l,ve)||f.resolve()).catch(function(){}),ve})})}return S(b,p),b}var Ue={_driver:"asyncStorage",_initStorage:Z,_support:h(),iterate:ne,getItem:q,setItem:ae,removeItem:_e,clear:Ie,length:xe,key:Ee,keys:Ye,dropInstance:Be};function se(){return typeof openDatabase=="function"}var ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se="~~local_forage_type~",Ne=/^~~local_forage_type~([^~]+)~/,Oe="__lfsc__:",we=Oe.length,de="arbf",ge="blob",je="si08",Je="ui08",o1="uic8",Ke="si16",D1="si32",Cn="ur16",Sn="ui32",bn="fl32",yn="fl64",_n=we+de.length,Ln=Object.prototype.toString;function En(l){var p=l.length*.75,c=l.length,C,b=0,m,x,H,j;l[l.length-1]==="="&&(p--,l[l.length-2]==="="&&p--);var U=new ArrayBuffer(p),$=new Uint8Array(U);for(C=0;C<c;C+=4)m=ee.indexOf(l[C]),x=ee.indexOf(l[C+1]),H=ee.indexOf(l[C+2]),j=ee.indexOf(l[C+3]),$[b++]=m<<2|x>>4,$[b++]=(x&15)<<4|H>>2,$[b++]=(H&3)<<6|j&63;return U}function bt(l){var p=new Uint8Array(l),c="",C;for(C=0;C<p.length;C+=3)c+=ee[p[C]>>2],c+=ee[(p[C]&3)<<4|p[C+1]>>4],c+=ee[(p[C+1]&15)<<2|p[C+2]>>6],c+=ee[p[C+2]&63];return p.length%3===2?c=c.substring(0,c.length-1)+"=":p.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function Si(l,p){var c="";if(l&&(c=Ln.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&Ln.call(l.buffer)==="[object ArrayBuffer]")){var C,b=Oe;l instanceof ArrayBuffer?(C=l,b+=de):(C=l.buffer,c==="[object Int8Array]"?b+=je:c==="[object Uint8Array]"?b+=Je:c==="[object Uint8ClampedArray]"?b+=o1:c==="[object Int16Array]"?b+=Ke:c==="[object Uint16Array]"?b+=Cn:c==="[object Int32Array]"?b+=D1:c==="[object Uint32Array]"?b+=Sn:c==="[object Float32Array]"?b+=bn:c==="[object Float64Array]"?b+=yn:p(new Error("Failed to get type for BinaryArray"))),p(b+bt(C))}else if(c==="[object Blob]"){var m=new FileReader;m.onload=function(){var x=Se+l.type+"~"+bt(this.result);p(Oe+ge+x)},m.readAsArrayBuffer(l)}else try{p(JSON.stringify(l))}catch(x){console.error("Couldn't convert value into a JSON string: ",l),p(null,x)}}function bi(l){if(l.substring(0,we)!==Oe)return JSON.parse(l);var p=l.substring(_n),c=l.substring(we,_n),C;if(c===ge&&Ne.test(p)){var b=p.match(Ne);C=b[1],p=p.substring(b[0].length)}var m=En(p);switch(c){case de:return m;case ge:return g([m],{type:C});case je:return new Int8Array(m);case Je:return new Uint8Array(m);case o1:return new Uint8ClampedArray(m);case Ke:return new Int16Array(m);case Cn:return new Uint16Array(m);case D1:return new Int32Array(m);case Sn:return new Uint32Array(m);case bn:return new Float32Array(m);case yn:return new Float64Array(m);default:throw new Error("Unkown type: "+c)}}var yt={serialize:Si,deserialize:bi,stringToBuffer:En,bufferToString:bt};function wn(l,p,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function yi(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(m,x){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(H){return x(H)}c.db.transaction(function(H){wn(H,c,function(){p._dbInfo=c,m()},function(j,U){x(U)})},x)});return c.serializer=yt,b}function r1(l,p,c,C,b,m){l.executeSql(c,C,b,function(x,H){H.code===H.SYNTAX_ERR?x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(j,U){U.rows.length?m(j,H):wn(j,p,function(){j.executeSql(c,C,b,m)},m)},m):m(x,H)},m)}function _i(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName+" WHERE key = ? LIMIT 1",[l],function(j,U){var $=U.rows.length?U.rows.item(0).value:null;$&&($=x.serializer.deserialize($)),b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Li(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName,[],function(j,U){for(var $=U.rows,X=$.length,ce=0;ce<X;ce++){var ve=$.item(ce),be=ve.value;if(be&&(be=x.serializer.deserialize(be)),be=l(be,ve.key,ce+1),be!==void 0){b(be);return}}b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mn(l,p,c,C){var b=this;l=_(l);var m=new f(function(x,H){b.ready().then(function(){p===void 0&&(p=null);var j=p,U=b._dbInfo;U.serializer.serialize(p,function($,X){X?H(X):U.db.transaction(function(ce){r1(ce,U,"INSERT OR REPLACE INTO "+U.storeName+" (key, value) VALUES (?, ?)",[l,$],function(){x(j)},function(ve,be){H(be)})},function(ce){if(ce.code===ce.QUOTA_ERR){if(C>0){x(Mn.apply(b,[l,j,c,C-1]));return}H(ce)}})})}).catch(H)});return S(m,c),m}function Ei(l,p,c){return Mn.apply(this,[l,p,c,1])}function wi(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"DELETE FROM "+x.storeName+" WHERE key = ?",[l],function(){b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"DELETE FROM "+m.storeName,[],function(){C()},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function xi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT COUNT(key) as c FROM "+m.storeName,[],function(H,j){var U=j.rows.item(0).c;C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Oi(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT key FROM "+x.storeName+" WHERE id = ? LIMIT 1",[l+1],function(j,U){var $=U.rows.length?U.rows.item(0).key:null;b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Ri(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT key FROM "+m.storeName,[],function(H,j){for(var U=[],$=0;$<j.rows.length;$++)U.push(j.rows.item($).key);C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Ii(l){return new f(function(p,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,m){for(var x=[],H=0;H<m.rows.length;H++)x.push(m.rows.item(H).name);p({db:l,storeNames:x})},function(b,m){c(m)})},function(C){c(C)})})}function Hi(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(m){var x;l.name===c.name?x=C._dbInfo.db:x=openDatabase(l.name,"","",0),l.storeName?m({db:x,storeNames:[l.storeName]}):m(Ii(x))}).then(function(m){return new f(function(x,H){m.db.transaction(function(j){function U(ve){return new f(function(be,Re){j.executeSql("DROP TABLE IF EXISTS "+ve,[],function(){be()},function(Me,ze){Re(ze)})})}for(var $=[],X=0,ce=m.storeNames.length;X<ce;X++)$.push(U(m.storeNames[X]));f.all($).then(function(){x()}).catch(function(ve){H(ve)})},function(j){H(j)})})}):b=f.reject("Invalid arguments"),S(b,p),b}var Di={_driver:"webSQLStorage",_initStorage:yi,_support:se(),iterate:Li,getItem:_i,setItem:Ei,removeItem:wi,clear:Mi,length:xi,key:Oi,keys:Ri,dropInstance:Hi};function Ti(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function xn(l,p){var c=l.name+"/";return l.storeName!==p.storeName&&(c+=l.storeName+"/"),c}function Vi(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function Ni(){return!Vi()||localStorage.length>0}function ki(l){var p=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=xn(l,p._defaultConfig),Ni()?(p._dbInfo=c,c.serializer=yt,f.resolve()):f.reject()}function Ai(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var m=localStorage.key(b);m.indexOf(C)===0&&localStorage.removeItem(m)}});return S(c,l),c}function ji(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo,m=localStorage.getItem(b.keyPrefix+l);return m&&(m=b.serializer.deserialize(m)),m});return S(C,p),C}function Ui(l,p){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,m=b.keyPrefix,x=m.length,H=localStorage.length,j=1,U=0;U<H;U++){var $=localStorage.key(U);if($.indexOf(m)===0){var X=localStorage.getItem($);if(X&&(X=b.serializer.deserialize(X)),X=l(X,$.substring(x),j++),X!==void 0)return X}}});return S(C,p),C}function Pi(l,p){var c=this,C=c.ready().then(function(){var b=c._dbInfo,m;try{m=localStorage.key(l)}catch{m=null}return m&&(m=m.substring(b.keyPrefix.length)),m});return S(C,p),C}function $i(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo,b=localStorage.length,m=[],x=0;x<b;x++){var H=localStorage.key(x);H.indexOf(C.keyPrefix)===0&&m.push(H.substring(C.keyPrefix.length))}return m});return S(c,l),c}function Bi(l){var p=this,c=p.keys().then(function(C){return C.length});return S(c,l),c}function zi(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,p),C}function Fi(l,p,c){var C=this;l=_(l);var b=C.ready().then(function(){p===void 0&&(p=null);var m=p;return new f(function(x,H){var j=C._dbInfo;j.serializer.serialize(p,function(U,$){if($)H($);else try{localStorage.setItem(j.keyPrefix+l,U),x(m)}catch(X){(X.name==="QuotaExceededError"||X.name==="NS_ERROR_DOM_QUOTA_REACHED")&&H(X),H(X)}})})});return S(b,c),b}function Zi(l,p){if(p=A.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(m){l.storeName?m(xn(l,C._defaultConfig)):m(l.name+"/")}).then(function(m){for(var x=localStorage.length-1;x>=0;x--){var H=localStorage.key(x);H.indexOf(m)===0&&localStorage.removeItem(H)}}):b=f.reject("Invalid arguments"),S(b,p),b}var Wi={_driver:"localStorageWrapper",_initStorage:ki,_support:Ti(),iterate:Ui,getItem:ji,setItem:Fi,removeItem:zi,clear:Ai,length:Bi,key:Pi,keys:$i,dropInstance:Zi},Gi=function(p,c){return p===c||typeof p=="number"&&typeof c=="number"&&isNaN(p)&&isNaN(c)},Yi=function(p,c){for(var C=p.length,b=0;b<C;){if(Gi(p[b],c))return!0;b++}return!1},On=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},b1={},Rn={},d1={INDEXEDDB:Ue,WEBSQL:Di,LOCALSTORAGE:Wi},qi=[d1.INDEXEDDB._driver,d1.WEBSQL._driver,d1.LOCALSTORAGE._driver],T1=["dropInstance"],_t=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(T1),Xi={description:"",driver:qi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qi(l,p){l[p]=function(){var c=arguments;return l.ready().then(function(){return l[p].apply(l,c)})}}function Lt(){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var c in p)p.hasOwnProperty(c)&&(On(p[c])?arguments[0][c]=p[c].slice():arguments[0][c]=p[c])}return arguments[0]}var Ji=function(){function l(p){o(this,l);for(var c in d1)if(d1.hasOwnProperty(c)){var C=d1[c],b=C._driver;this[c]=b,b1[b]||this.defineDriver(C)}this._defaultConfig=Lt({},Xi),this._config=Lt({},this._defaultConfig,p),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var m=new f(function(x,H){try{var j=c._driver,U=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){H(U);return}for(var $=_t.concat("_initStorage"),X=0,ce=$.length;X<ce;X++){var ve=$[X],be=!Yi(T1,ve);if((be||c[ve])&&typeof c[ve]!="function"){H(U);return}}var Re=function(){for(var y1=function(ta){return function(){var na=new Error("Method "+ta+" is not implemented by the current driver"),In=f.reject(na);return S(In,arguments[arguments.length-1]),In}},Et=0,ea=T1.length;Et<ea;Et++){var wt=T1[Et];c[wt]||(c[wt]=y1(wt))}};Re();var Me=function(y1){b1[j]&&console.info("Redefining LocalForage driver: "+j),b1[j]=c,Rn[j]=y1,x()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Me,H):Me(!!c._support):Me(!0)}catch(ze){H(ze)}});return y(m,C,b),m},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var m=b1[c]?f.resolve(b1[c]):f.reject(new Error("Driver not found."));return y(m,C,b),m},l.prototype.getSerializer=function(c){var C=f.resolve(yt);return y(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return y(b,c,c),b},l.prototype.setDriver=function(c,C,b){var m=this;On(c)||(c=[c]);var x=this._getSupportedDrivers(c);function H(){m._config.driver=m.driver()}function j(X){return m._extend(X),H(),m._ready=m._initStorage(m._config),m._ready}function U(X){return function(){var ce=0;function ve(){for(;ce<X.length;){var be=X[ce];return ce++,m._dbInfo=null,m._ready=null,m.getDriver(be).then(j).catch(ve)}H();var Re=new Error("No available storage method found.");return m._driverSet=f.reject(Re),m._driverSet}return ve()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=$.then(function(){var X=x[0];return m._dbInfo=null,m._ready=null,m.getDriver(X).then(function(ce){m._driver=ce._driver,H(),m._wrapLibraryMethodsWithReady(),m._initDriver=U(x)})}).catch(function(){H();var X=new Error("No available storage method found.");return m._driverSet=f.reject(X),m._driverSet}),y(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!Rn[c]},l.prototype._extend=function(c){Lt(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,m=c.length;b<m;b++){var x=c[b];this.supports(x)&&C.push(x)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=_t.length;c<C;c++)Qi(this,_t[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),Ki=new Ji;r.exports=Ki},{3:3}]},{},[4])(4)})})(fi);var ts=fi.exports;const l1=o6(ts);class di{getItem(t){return l1.getItem(t)}setItem(t,n){return l1.setItem(t,n)}removeItem(t){return l1.removeItem(t)}clear(){return l1.clear()}key(t){return l1.key(t)}keys(){return l1.keys()}iterate(t){return l1.iterate(t)}}var ns=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(e,t,n,r)=>{for(var i=r>1?void 0:r?rs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ns(t,n,i),i},as=(e,t)=>(n,r)=>t(n,r,e);let Gt=class{constructor(e){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),L.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};Gt=is([as(0,oe.Inject(e1))],Gt);class os extends L.Disposable{constructor(){super(...arguments);B(this,"_currentSelectorId");B(this,"_selectionChange$",new ie.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());B(this,"_openSelector$",new ie.Subject);B(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const gn=oe.createIdentifier("univer.range-selector.service");class ss extends L.Disposable{constructor(){super(...arguments);B(this,"_taskCount",0);B(this,"_progressChange$",new ie.Subject);B(this,"_progressVisible$",new ie.Subject);B(this,"progressChange$",this._progressChange$.asObservable());B(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const mn=oe.createIdentifier("univer.progress.service");var ls=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ls(t,n,i),i},Tt=(e,t)=>(n,r)=>t(n,r,e);const fs="ui",hi="DISABLE_AUTO_FOCUS";var Vt;exports.UniverUIPlugin=(Vt=class extends L.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:ti}),this._config.disableAutoFocus&&this._contextService.setContextValue(hi,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){[[e1],[Y1],[ci],[O1,{useClass:exports.DesktopLayoutService}],[S1,{useClass:exports.DesktopShortcutService}],[Jt,{useClass:u6}],[f1,{useClass:exports.DesktopMenuService}],[un,{useClass:J6}],[ri,{useClass:exports.BrowserClipboardService,lazy:!0}],[Ct,{useClass:si,lazy:!0}],[fn,{useClass:ai,lazy:!0}],[cn,{useClass:ii,lazy:!0}],[st,{useClass:li,lazy:!0}],[nn,{useClass:Gt,lazy:!0}],[dn,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[ot,{useClass:oi,lazy:!0}],[L.ILocalStorageService,{useClass:di,lazy:!0}],[ni,{useClass:exports.DesktopBeforeCloseService}],[x1,{useClass:exports.EditorService}],[gn,{useClass:os}],[hn,{useClass:K6}],[mn,{useClass:ss}],[X1,{useClass:exports.DesktopUIController}],[exports.SharedController],[Z1],[W1]].forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(X1).bootstrapWorkbench(this._config))}},B(Vt,"pluginName",fs),Vt);exports.UniverUIPlugin=us([Tt(1,L.IConfigService),Tt(2,oe.Inject(oe.Injector)),Tt(3,oe.Inject(L.LocaleService))],exports.UniverUIPlugin);function G1(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const ds=.75,a3=78,o3=9,pi="rgba(0,0,0,0)",gi="rgb(0,0,0)";function vn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
|
|
46
|
+
*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,g){if(!i[h]){if(!r[h]){var f=typeof z1=="function"&&z1;if(!g&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var y=i[h]={exports:{}};r[h][0].call(y.exports,function(_){var A=r[h][1][_];return o(A||_)},y,y.exports,n,r,i,a)}return i[h].exports}for(var u=typeof z1=="function"&&z1,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(_),g=a.document.createTextNode("");h.observe(g,{characterData:!0}),u=function(){g.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=_,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var O=a.document.createElement("script");O.onreadystatechange=function(){_(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},a.document.documentElement.appendChild(O)}:u=function(){setTimeout(_,0)};var S,y=[];function _(){S=!0;for(var O,N,V=y.length;V;){for(N=y,y=[],O=-1;++O<V;)N[O]();V=y.length}S=!1}r.exports=A;function A(O){y.push(O)===1&&!S&&u()}}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],g=["PENDING"];r.exports=f;function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,w!==o&&A(this,w)}f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,D){if(typeof w!="function"&&this.state===h||typeof D!="function"&&this.state===d)return this;var k=new this.constructor(o);if(this.state!==g){var T=this.state===h?w:D;y(k,T,this.outcome)}else this.queue.push(new S(k,w,D));return k};function S(w,D,k){this.promise=w,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(w){u.resolve(this.promise,w)},S.prototype.otherCallFulfilled=function(w){y(this.promise,this.onFulfilled,w)},S.prototype.callRejected=function(w){u.reject(this.promise,w)},S.prototype.otherCallRejected=function(w){y(this.promise,this.onRejected,w)};function y(w,D,k){a(function(){var T;try{T=D(k)}catch(P){return u.reject(w,P)}T===w?u.reject(w,new TypeError("Cannot resolve promise with itself")):u.resolve(w,T)})}u.resolve=function(w,D){var k=O(_,D);if(k.status==="error")return u.reject(w,k.value);var T=k.value;if(T)A(w,T);else{w.state=h,w.outcome=D;for(var P=-1,Y=w.queue.length;++P<Y;)w.queue[P].callFulfilled(D)}return w},u.reject=function(w,D){w.state=d,w.outcome=D;for(var k=-1,T=w.queue.length;++k<T;)w.queue[k].callRejected(D);return w};function _(w){var D=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof D=="function")return function(){D.apply(w,arguments)}}function A(w,D){var k=!1;function T(Q){k||(k=!0,u.reject(w,Q))}function P(Q){k||(k=!0,u.resolve(w,Q))}function Y(){D(P,T)}var F=O(Y);F.status==="error"&&T(F.value)}function O(w,D){var k={};try{k.value=w(D),k.status="success"}catch(T){k.status="error",k.value=T}return k}f.resolve=N;function N(w){return w instanceof this?w:u.resolve(new this(o),w)}f.reject=V;function V(w){var D=new this(o);return u.reject(D,w)}f.all=z;function z(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=new Array(k),Y=0,F=-1,Q=new this(o);++F<k;)J(w[F],F);return Q;function J(he,ue){D.resolve(he).then(re,function(pe){T||(T=!0,u.reject(Q,pe))});function re(pe){P[ue]=pe,++Y===k&&!T&&(T=!0,u.resolve(Q,P))}}}f.race=W;function W(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=-1,Y=new this(o);++P<k;)F(w[P]);return Y;function F(Q){D.resolve(Q).then(function(J){T||(T=!0,u.resolve(Y,J))},function(J){T||(T=!0,u.reject(Y,J))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function g(l,p){l=l||[],p=p||{};try{return new Blob(l,p)}catch(m){if(m.name!=="TypeError")throw m;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(p.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,p){p&&l.then(function(c){p(null,c)},function(c){p(c)})}function y(l,p,c){typeof p=="function"&&l.then(p),typeof c=="function"&&l.catch(c)}function _(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",N=void 0,V={},z=Object.prototype.toString,W="readonly",w="readwrite";function D(l){for(var p=l.length,c=new ArrayBuffer(p),C=new Uint8Array(c),b=0;b<p;b++)C[b]=l.charCodeAt(b);return c}function k(l){return new f(function(p){var c=l.transaction(O,w),C=g([""]);c.objectStore(O).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),p(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),m=navigator.userAgent.match(/Edge\//);p(m||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function T(l){return typeof N=="boolean"?f.resolve(N):k(l).then(function(p){return N=p,N})}function P(l){var p=V[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),p.deferredOperations.push(c),p.dbReady?p.dbReady=p.dbReady.then(function(){return c.promise}):p.dbReady=c.promise}function Y(l){var p=V[l.name],c=p.deferredOperations.pop();if(c)return c.resolve(),c.promise}function F(l,p){var c=V[l.name],C=c.deferredOperations.pop();if(C)return C.reject(p),C.promise}function Q(l,p){return new f(function(c,C){if(V[l.name]=V[l.name]||G(),l.db)if(p)P(l),l.db.close();else return c(l.db);var b=[l.name];p&&b.push(l.version);var m=d.open.apply(d,b);p&&(m.onupgradeneeded=function(x){var H=m.result;try{H.createObjectStore(l.storeName),x.oldVersion<=1&&H.createObjectStore(O)}catch(j){if(j.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+x.oldVersion+" to version "+x.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw j}}),m.onerror=function(x){x.preventDefault(),C(m.error)},m.onsuccess=function(){var x=m.result;x.onversionchange=function(H){H.target.close()},c(x),Y(l)}})}function J(l){return Q(l,!1)}function he(l){return Q(l,!0)}function ue(l,p){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==p&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var m=l.db.version+1;m>l.version&&(l.version=m)}return!0}return!1}function re(l){return new f(function(p,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var m=btoa(b.target.result||"");p({__local_forage_encoded_blob:!0,data:m,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var p=D(atob(l.data));return g([p],{type:l.type})}function Le(l){return l&&l.__local_forage_encoded_blob}function M(l){var p=this,c=p._initReady().then(function(){var C=V[p._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return y(c,l,l),c}function E(l){P(l);for(var p=V[l.name],c=p.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,J(l).then(function(m){return l.db=m,ue(l)?he(l):m}).then(function(m){l.db=p.db=m;for(var x=0;x<c.length;x++)c[x]._dbInfo.db=m}).catch(function(m){throw F(l,m),m})}function R(l,p,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,p);c(null,b)}catch(m){if(C>0&&(!l.db||m.name==="InvalidStateError"||m.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||m.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),he(l)}).then(function(){return E(l).then(function(){R(l,p,c,C-1)})}).catch(c);c(m)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Z(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=V[c.name];b||(b=G(),V[c.name]=b),b.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=M);var m=[];function x(){return f.resolve()}for(var H=0;H<b.forages.length;H++){var j=b.forages[H];j!==p&&m.push(j._initReady().catch(x))}var U=b.forages.slice(0);return f.all(m).then(function(){return c.db=b.db,J(c)}).then(function($){return c.db=$,ue(c,p._defaultConfig.version)?he(c):$}).then(function($){c.db=b.db=$,p._dbInfo=c;for(var X=0;X<U.length;X++){var ce=U[X];ce!==p&&(ce._dbInfo.db=c.db,ce._dbInfo.version=c.version)}})}function q(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.get(l);U.onsuccess=function(){var $=U.result;$===void 0&&($=null),Le($)&&($=pe($)),b($)},U.onerror=function(){m(U.error)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function ne(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.openCursor(),$=1;U.onsuccess=function(){var X=U.result;if(X){var ce=X.value;Le(ce)&&(ce=pe(ce));var ve=l(ce,X.key,$++);ve!==void 0?b(ve):X.continue()}else b()},U.onerror=function(){m(U.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function ae(l,p,c){var C=this;l=_(l);var b=new f(function(m,x){var H;C.ready().then(function(){return H=C._dbInfo,z.call(p)==="[object Blob]"?T(H.db).then(function(j){return j?p:re(p)}):p}).then(function(j){R(C._dbInfo,w,function(U,$){if(U)return x(U);try{var X=$.objectStore(C._dbInfo.storeName);j===null&&(j=void 0);var ce=X.put(j,l);$.oncomplete=function(){j===void 0&&(j=null),m(j)},$.onabort=$.onerror=function(){var ve=ce.error?ce.error:ce.transaction.error;x(ve)}}catch(ve){x(ve)}})}).catch(x)});return S(b,c),b}function _e(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,w,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.delete(l);H.oncomplete=function(){b()},H.onerror=function(){m(U.error)},H.onabort=function(){var $=U.error?U.error:U.transaction.error;m($)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function Ie(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,w,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.clear();x.oncomplete=function(){C()},x.onabort=x.onerror=function(){var U=j.error?j.error:j.transaction.error;b(U)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function xe(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.count();j.onsuccess=function(){C(j.result)},j.onerror=function(){b(j.error)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function Ee(l,p){var c=this,C=new f(function(b,m){if(l<0){b(null);return}c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=!1,$=j.openKeyCursor();$.onsuccess=function(){var X=$.result;if(!X){b(null);return}l===0||U?b(X.key):(U=!0,X.advance(l))},$.onerror=function(){m($.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function Ye(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.openKeyCursor(),U=[];j.onsuccess=function(){var $=j.result;if(!$){C(U);return}U.push($.key),$.continue()},j.onerror=function(){b(j.error)}}catch($){b($)}})}).catch(b)});return S(c,l),c}function Be(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var m=l.name===c.name&&C._dbInfo.db,x=m?f.resolve(C._dbInfo.db):J(l).then(function(H){var j=V[l.name],U=j.forages;j.db=H;for(var $=0;$<U.length;$++)U[$]._dbInfo.db=H;return H});l.storeName?b=x.then(function(H){if(H.objectStoreNames.contains(l.storeName)){var j=H.version+1;P(l);var U=V[l.name],$=U.forages;H.close();for(var X=0;X<$.length;X++){var ce=$[X];ce._dbInfo.db=null,ce._dbInfo.version=j}var ve=new f(function(be,Re){var Me=d.open(l.name,j);Me.onerror=function(ze){var y1=Me.result;y1.close(),Re(ze)},Me.onupgradeneeded=function(){var ze=Me.result;ze.deleteObjectStore(l.storeName)},Me.onsuccess=function(){var ze=Me.result;ze.close(),be(ze)}});return ve.then(function(be){U.db=be;for(var Re=0;Re<$.length;Re++){var Me=$[Re];Me._dbInfo.db=be,Y(Me._dbInfo)}}).catch(function(be){throw(F(l,be)||f.resolve()).catch(function(){}),be})}}):b=x.then(function(H){P(l);var j=V[l.name],U=j.forages;H.close();for(var $=0;$<U.length;$++){var X=U[$];X._dbInfo.db=null}var ce=new f(function(ve,be){var Re=d.deleteDatabase(l.name);Re.onerror=function(){var Me=Re.result;Me&&Me.close(),be(Re.error)},Re.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},Re.onsuccess=function(){var Me=Re.result;Me&&Me.close(),ve(Me)}});return ce.then(function(ve){j.db=ve;for(var be=0;be<U.length;be++){var Re=U[be];Y(Re._dbInfo)}}).catch(function(ve){throw(F(l,ve)||f.resolve()).catch(function(){}),ve})})}return S(b,p),b}var Ue={_driver:"asyncStorage",_initStorage:Z,_support:h(),iterate:ne,getItem:q,setItem:ae,removeItem:_e,clear:Ie,length:xe,key:Ee,keys:Ye,dropInstance:Be};function se(){return typeof openDatabase=="function"}var ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se="~~local_forage_type~",Ne=/^~~local_forage_type~([^~]+)~/,Oe="__lfsc__:",we=Oe.length,de="arbf",ge="blob",je="si08",Je="ui08",o1="uic8",Ke="si16",D1="si32",Cn="ur16",Sn="ui32",bn="fl32",yn="fl64",_n=we+de.length,Ln=Object.prototype.toString;function En(l){var p=l.length*.75,c=l.length,C,b=0,m,x,H,j;l[l.length-1]==="="&&(p--,l[l.length-2]==="="&&p--);var U=new ArrayBuffer(p),$=new Uint8Array(U);for(C=0;C<c;C+=4)m=ee.indexOf(l[C]),x=ee.indexOf(l[C+1]),H=ee.indexOf(l[C+2]),j=ee.indexOf(l[C+3]),$[b++]=m<<2|x>>4,$[b++]=(x&15)<<4|H>>2,$[b++]=(H&3)<<6|j&63;return U}function bt(l){var p=new Uint8Array(l),c="",C;for(C=0;C<p.length;C+=3)c+=ee[p[C]>>2],c+=ee[(p[C]&3)<<4|p[C+1]>>4],c+=ee[(p[C+1]&15)<<2|p[C+2]>>6],c+=ee[p[C+2]&63];return p.length%3===2?c=c.substring(0,c.length-1)+"=":p.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function Si(l,p){var c="";if(l&&(c=Ln.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&Ln.call(l.buffer)==="[object ArrayBuffer]")){var C,b=Oe;l instanceof ArrayBuffer?(C=l,b+=de):(C=l.buffer,c==="[object Int8Array]"?b+=je:c==="[object Uint8Array]"?b+=Je:c==="[object Uint8ClampedArray]"?b+=o1:c==="[object Int16Array]"?b+=Ke:c==="[object Uint16Array]"?b+=Cn:c==="[object Int32Array]"?b+=D1:c==="[object Uint32Array]"?b+=Sn:c==="[object Float32Array]"?b+=bn:c==="[object Float64Array]"?b+=yn:p(new Error("Failed to get type for BinaryArray"))),p(b+bt(C))}else if(c==="[object Blob]"){var m=new FileReader;m.onload=function(){var x=Se+l.type+"~"+bt(this.result);p(Oe+ge+x)},m.readAsArrayBuffer(l)}else try{p(JSON.stringify(l))}catch(x){console.error("Couldn't convert value into a JSON string: ",l),p(null,x)}}function bi(l){if(l.substring(0,we)!==Oe)return JSON.parse(l);var p=l.substring(_n),c=l.substring(we,_n),C;if(c===ge&&Ne.test(p)){var b=p.match(Ne);C=b[1],p=p.substring(b[0].length)}var m=En(p);switch(c){case de:return m;case ge:return g([m],{type:C});case je:return new Int8Array(m);case Je:return new Uint8Array(m);case o1:return new Uint8ClampedArray(m);case Ke:return new Int16Array(m);case Cn:return new Uint16Array(m);case D1:return new Int32Array(m);case Sn:return new Uint32Array(m);case bn:return new Float32Array(m);case yn:return new Float64Array(m);default:throw new Error("Unkown type: "+c)}}var yt={serialize:Si,deserialize:bi,stringToBuffer:En,bufferToString:bt};function wn(l,p,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function yi(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(m,x){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(H){return x(H)}c.db.transaction(function(H){wn(H,c,function(){p._dbInfo=c,m()},function(j,U){x(U)})},x)});return c.serializer=yt,b}function r1(l,p,c,C,b,m){l.executeSql(c,C,b,function(x,H){H.code===H.SYNTAX_ERR?x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(j,U){U.rows.length?m(j,H):wn(j,p,function(){j.executeSql(c,C,b,m)},m)},m):m(x,H)},m)}function _i(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName+" WHERE key = ? LIMIT 1",[l],function(j,U){var $=U.rows.length?U.rows.item(0).value:null;$&&($=x.serializer.deserialize($)),b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Li(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName,[],function(j,U){for(var $=U.rows,X=$.length,ce=0;ce<X;ce++){var ve=$.item(ce),be=ve.value;if(be&&(be=x.serializer.deserialize(be)),be=l(be,ve.key,ce+1),be!==void 0){b(be);return}}b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mn(l,p,c,C){var b=this;l=_(l);var m=new f(function(x,H){b.ready().then(function(){p===void 0&&(p=null);var j=p,U=b._dbInfo;U.serializer.serialize(p,function($,X){X?H(X):U.db.transaction(function(ce){r1(ce,U,"INSERT OR REPLACE INTO "+U.storeName+" (key, value) VALUES (?, ?)",[l,$],function(){x(j)},function(ve,be){H(be)})},function(ce){if(ce.code===ce.QUOTA_ERR){if(C>0){x(Mn.apply(b,[l,j,c,C-1]));return}H(ce)}})})}).catch(H)});return S(m,c),m}function Ei(l,p,c){return Mn.apply(this,[l,p,c,1])}function wi(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"DELETE FROM "+x.storeName+" WHERE key = ?",[l],function(){b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"DELETE FROM "+m.storeName,[],function(){C()},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function xi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT COUNT(key) as c FROM "+m.storeName,[],function(H,j){var U=j.rows.item(0).c;C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Oi(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT key FROM "+x.storeName+" WHERE id = ? LIMIT 1",[l+1],function(j,U){var $=U.rows.length?U.rows.item(0).key:null;b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Ri(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT key FROM "+m.storeName,[],function(H,j){for(var U=[],$=0;$<j.rows.length;$++)U.push(j.rows.item($).key);C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Ii(l){return new f(function(p,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,m){for(var x=[],H=0;H<m.rows.length;H++)x.push(m.rows.item(H).name);p({db:l,storeNames:x})},function(b,m){c(m)})},function(C){c(C)})})}function Hi(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(m){var x;l.name===c.name?x=C._dbInfo.db:x=openDatabase(l.name,"","",0),l.storeName?m({db:x,storeNames:[l.storeName]}):m(Ii(x))}).then(function(m){return new f(function(x,H){m.db.transaction(function(j){function U(ve){return new f(function(be,Re){j.executeSql("DROP TABLE IF EXISTS "+ve,[],function(){be()},function(Me,ze){Re(ze)})})}for(var $=[],X=0,ce=m.storeNames.length;X<ce;X++)$.push(U(m.storeNames[X]));f.all($).then(function(){x()}).catch(function(ve){H(ve)})},function(j){H(j)})})}):b=f.reject("Invalid arguments"),S(b,p),b}var Di={_driver:"webSQLStorage",_initStorage:yi,_support:se(),iterate:Li,getItem:_i,setItem:Ei,removeItem:wi,clear:Mi,length:xi,key:Oi,keys:Ri,dropInstance:Hi};function Ti(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function xn(l,p){var c=l.name+"/";return l.storeName!==p.storeName&&(c+=l.storeName+"/"),c}function Vi(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function Ni(){return!Vi()||localStorage.length>0}function ki(l){var p=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=xn(l,p._defaultConfig),Ni()?(p._dbInfo=c,c.serializer=yt,f.resolve()):f.reject()}function Ai(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var m=localStorage.key(b);m.indexOf(C)===0&&localStorage.removeItem(m)}});return S(c,l),c}function ji(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo,m=localStorage.getItem(b.keyPrefix+l);return m&&(m=b.serializer.deserialize(m)),m});return S(C,p),C}function Ui(l,p){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,m=b.keyPrefix,x=m.length,H=localStorage.length,j=1,U=0;U<H;U++){var $=localStorage.key(U);if($.indexOf(m)===0){var X=localStorage.getItem($);if(X&&(X=b.serializer.deserialize(X)),X=l(X,$.substring(x),j++),X!==void 0)return X}}});return S(C,p),C}function Pi(l,p){var c=this,C=c.ready().then(function(){var b=c._dbInfo,m;try{m=localStorage.key(l)}catch{m=null}return m&&(m=m.substring(b.keyPrefix.length)),m});return S(C,p),C}function $i(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo,b=localStorage.length,m=[],x=0;x<b;x++){var H=localStorage.key(x);H.indexOf(C.keyPrefix)===0&&m.push(H.substring(C.keyPrefix.length))}return m});return S(c,l),c}function Bi(l){var p=this,c=p.keys().then(function(C){return C.length});return S(c,l),c}function zi(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,p),C}function Fi(l,p,c){var C=this;l=_(l);var b=C.ready().then(function(){p===void 0&&(p=null);var m=p;return new f(function(x,H){var j=C._dbInfo;j.serializer.serialize(p,function(U,$){if($)H($);else try{localStorage.setItem(j.keyPrefix+l,U),x(m)}catch(X){(X.name==="QuotaExceededError"||X.name==="NS_ERROR_DOM_QUOTA_REACHED")&&H(X),H(X)}})})});return S(b,c),b}function Zi(l,p){if(p=A.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(m){l.storeName?m(xn(l,C._defaultConfig)):m(l.name+"/")}).then(function(m){for(var x=localStorage.length-1;x>=0;x--){var H=localStorage.key(x);H.indexOf(m)===0&&localStorage.removeItem(H)}}):b=f.reject("Invalid arguments"),S(b,p),b}var Wi={_driver:"localStorageWrapper",_initStorage:ki,_support:Ti(),iterate:Ui,getItem:ji,setItem:Fi,removeItem:zi,clear:Ai,length:Bi,key:Pi,keys:$i,dropInstance:Zi},Gi=function(p,c){return p===c||typeof p=="number"&&typeof c=="number"&&isNaN(p)&&isNaN(c)},Yi=function(p,c){for(var C=p.length,b=0;b<C;){if(Gi(p[b],c))return!0;b++}return!1},On=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},b1={},Rn={},d1={INDEXEDDB:Ue,WEBSQL:Di,LOCALSTORAGE:Wi},qi=[d1.INDEXEDDB._driver,d1.WEBSQL._driver,d1.LOCALSTORAGE._driver],T1=["dropInstance"],_t=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(T1),Xi={description:"",driver:qi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qi(l,p){l[p]=function(){var c=arguments;return l.ready().then(function(){return l[p].apply(l,c)})}}function Lt(){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var c in p)p.hasOwnProperty(c)&&(On(p[c])?arguments[0][c]=p[c].slice():arguments[0][c]=p[c])}return arguments[0]}var Ji=function(){function l(p){o(this,l);for(var c in d1)if(d1.hasOwnProperty(c)){var C=d1[c],b=C._driver;this[c]=b,b1[b]||this.defineDriver(C)}this._defaultConfig=Lt({},Xi),this._config=Lt({},this._defaultConfig,p),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var m=new f(function(x,H){try{var j=c._driver,U=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){H(U);return}for(var $=_t.concat("_initStorage"),X=0,ce=$.length;X<ce;X++){var ve=$[X],be=!Yi(T1,ve);if((be||c[ve])&&typeof c[ve]!="function"){H(U);return}}var Re=function(){for(var y1=function(ta){return function(){var na=new Error("Method "+ta+" is not implemented by the current driver"),In=f.reject(na);return S(In,arguments[arguments.length-1]),In}},Et=0,ea=T1.length;Et<ea;Et++){var wt=T1[Et];c[wt]||(c[wt]=y1(wt))}};Re();var Me=function(y1){b1[j]&&console.info("Redefining LocalForage driver: "+j),b1[j]=c,Rn[j]=y1,x()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Me,H):Me(!!c._support):Me(!0)}catch(ze){H(ze)}});return y(m,C,b),m},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var m=b1[c]?f.resolve(b1[c]):f.reject(new Error("Driver not found."));return y(m,C,b),m},l.prototype.getSerializer=function(c){var C=f.resolve(yt);return y(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return y(b,c,c),b},l.prototype.setDriver=function(c,C,b){var m=this;On(c)||(c=[c]);var x=this._getSupportedDrivers(c);function H(){m._config.driver=m.driver()}function j(X){return m._extend(X),H(),m._ready=m._initStorage(m._config),m._ready}function U(X){return function(){var ce=0;function ve(){for(;ce<X.length;){var be=X[ce];return ce++,m._dbInfo=null,m._ready=null,m.getDriver(be).then(j).catch(ve)}H();var Re=new Error("No available storage method found.");return m._driverSet=f.reject(Re),m._driverSet}return ve()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=$.then(function(){var X=x[0];return m._dbInfo=null,m._ready=null,m.getDriver(X).then(function(ce){m._driver=ce._driver,H(),m._wrapLibraryMethodsWithReady(),m._initDriver=U(x)})}).catch(function(){H();var X=new Error("No available storage method found.");return m._driverSet=f.reject(X),m._driverSet}),y(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!Rn[c]},l.prototype._extend=function(c){Lt(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,m=c.length;b<m;b++){var x=c[b];this.supports(x)&&C.push(x)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=_t.length;c<C;c++)Qi(this,_t[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),Ki=new Ji;r.exports=Ki},{3:3}]},{},[4])(4)})})(fi);var ts=fi.exports;const l1=o6(ts);class di{getItem(t){return l1.getItem(t)}setItem(t,n){return l1.setItem(t,n)}removeItem(t){return l1.removeItem(t)}clear(){return l1.clear()}key(t){return l1.key(t)}keys(){return l1.keys()}iterate(t){return l1.iterate(t)}}var ns=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(e,t,n,r)=>{for(var i=r>1?void 0:r?rs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ns(t,n,i),i},as=(e,t)=>(n,r)=>t(n,r,e);let Gt=class{constructor(e){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),L.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};Gt=is([as(0,oe.Inject(e1))],Gt);class os extends L.Disposable{constructor(){super(...arguments);B(this,"_currentSelectorId");B(this,"_selectionChange$",new ie.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());B(this,"_openSelector$",new ie.Subject);B(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const gn=oe.createIdentifier("univer.range-selector.service");class ss extends L.Disposable{constructor(){super(...arguments);B(this,"_taskCount",0);B(this,"_progressChange$",new ie.Subject);B(this,"_progressVisible$",new ie.Subject);B(this,"progressChange$",this._progressChange$.asObservable());B(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const mn=oe.createIdentifier("univer.progress.service");var ls=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ls(t,n,i),i},Tt=(e,t)=>(n,r)=>t(n,r,e);const fs="ui",hi="DISABLE_AUTO_FOCUS";var Vt;exports.UniverUIPlugin=(Vt=class extends L.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:ti}),this._config.disableAutoFocus&&this._contextService.setContextValue(hi,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){[[e1],[Y1],[ci],[O1,{useClass:exports.DesktopLayoutService}],[S1,{useClass:exports.DesktopShortcutService}],[Jt,{useClass:u6}],[f1,{useClass:exports.DesktopMenuService}],[un,{useClass:J6}],[ri,{useClass:exports.BrowserClipboardService,lazy:!0}],[Ct,{useClass:si,lazy:!0}],[fn,{useClass:ai,lazy:!0}],[cn,{useClass:ii,lazy:!0}],[st,{useClass:li,lazy:!0}],[nn,{useClass:Gt,lazy:!0}],[dn,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[ot,{useClass:oi,lazy:!0}],[L.ILocalStorageService,{useClass:di,lazy:!0}],[ni,{useClass:exports.DesktopBeforeCloseService}],[x1,{useClass:exports.EditorService}],[gn,{useClass:os}],[hn,{useClass:K6}],[mn,{useClass:ss}],[X1,{useClass:exports.DesktopUIController}],[exports.SharedController],[Z1],[W1]].forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(X1).bootstrapWorkbench(this._config))}},B(Vt,"pluginName",fs),Vt);exports.UniverUIPlugin=us([Tt(1,L.IContextService),Tt(2,oe.Inject(oe.Injector)),Tt(3,oe.Inject(L.LocaleService))],exports.UniverUIPlugin);function G1(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const ds=.75,a3=78,o3=9,pi="rgba(0,0,0,0)",gi="rgb(0,0,0)";function vn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
|
|
47
47
|
`;for(let d=0;d<t.length;d++){let h=t[`${d}`],g;h.nodeName==="#text"?(g=(u=h.textContent)!=null?u:"",h=h.parentElement):g=h.innerText;const f=St(h);mi(g).forEach(y=>{const _=y.length;i+=_,r=i-_;const A=L.Tools.generateRandomId(6);n.push({sId:A,st:r,ed:i-1,ts:f})})}return L.Tools.generateRandomId(6),{id:L.Tools.generateRandomId(6),body:{dataStream:a,textRuns:n},documentStyle:{}}}function St(e,t=""){var o,u;let n=(u=(o=e==null?void 0:e.style)==null?void 0:o.cssText)!=null?u:"";if(n+=t,n=n.replace(/[\r\n]+/g,""),n.length===0)return{};const r=n.split(";"),i={},a={t:"",r:"",b:"",l:""};return r.forEach(d=>{var S;const h=d;d=d.toLowerCase();const g=G1(d.substr(0,d.indexOf(":"))),f=G1(d.substr(d.indexOf(":")+1));if(g==="font-weight")f==="bold"||f==="700"?i.bl=1:i.bl=0;else if(g==="font-style")f==="italic"?i.it=1:i.it=0;else if(g==="font-family"){const y=G1(h.substr(h.indexOf(":")+1));i.ff=y}else if(g==="font-size"){let y=Number.parseInt(f);n.indexOf("vertical-align")>-1&&(n.indexOf("sub")>-1||n.indexOf("sup")>-1)&&(y*=2),f.indexOf("px")!==-1&&(y=bs(Number.parseInt(f,10))),i.fs=y}else if(g==="color")i.cl={rgb:f};else if(g==="background"||g==="background-color"){const y=new L.ColorKit(f);if(y){const _=y.toRgbString();_!==pi&&_!==gi&&(i.bg={rgb:y.toRgbString()})}}else if(g==="text-decoration-line")f==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):f==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):f==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1);else if(g==="text-decoration-color")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,cl:{rgb:f}}),i.ul.cl={rgb:f}),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,cl:{rgb:f}}),i.st.cl={rgb:f}),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,cl:{rgb:f}}),i.ol.cl={rgb:f});else if(g==="text-decoration-style")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,t:Number(f)}),i.ul.t=Number(f)),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,t:Number(f)}),i.st.t=Number(f)),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,t:Number(f)}),i.ol.t=Number(f));else if(g==="text-decoration"||g==="univer-strike"){const y=(S=f.split(" "))==null?void 0:S[0];y==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):y==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):y==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1)}if(g==="univer-underline"&&(i.ul={s:1}),g==="vertical-align"&&(f==="sub"?i.va=L.BaselineOffset.SUBSCRIPT:f==="super"?i.va=L.BaselineOffset.SUPERSCRIPT:f==="top"?i.vt=1:f==="middle"?i.vt=2:f==="bottom"?i.vt=3:i.va=L.BaselineOffset.NORMAL),g==="transform"){const y=f.split(")"),_=y.findIndex(A=>A.includes("rotate"));if(_>-1){const A=y[_].match(/\d+/g);let O=0,N=0;A!=null&&A.length&&(O=+A[0]),e!=null&&e.dataset.vertical&&(N=+e.dataset.vertical),i.tr={a:O,v:N}}}if(g==="text-align"&&(f==="left"?i.ht=1:f==="center"?i.ht=2:f==="right"?i.ht=3:f==="justify"?i.ht=4:i.ht=0),g==="overflow-wrap"||g==="word-wrap"?f==="break-word"&&(i.tb=3):g==="text-overflow"?f==="clip"&&(i.tb=2):g==="text-break"&&f==="overflow"&&(i.tb=1),g==="white-space"&&(f==="nowrap"?i.tb=1:f==="normal"?i.tb=3:f==="clip"&&(i.tb=2)),g==="border-color"){const y=s3(f,")");if(i.bd)for(const _ in y)i.bd[_].cl.rgb=y[_];else{i.bd={b:{cl:{rgb:"#000"},s:0},t:{cl:{rgb:"#000"},s:0},l:{cl:{rgb:"#000"},s:0},r:{cl:{rgb:"#000"},s:0}};for(const _ in y)i.bd[_].cl.rgb=y[_]}}if(g==="border-width"||g==="border-style"){const y=s3(f," ");for(const _ in y)a[_]+=` ${y[_]}`;i.bd?(i.bd.b.s=L.getBorderStyleType(a.b),i.bd.t.s=L.getBorderStyleType(a.t),i.bd.l.s=L.getBorderStyleType(a.l),i.bd.r.s=L.getBorderStyleType(a.r)):i.bd={b:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.b)},t:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.t)},l:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.l)},r:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.r)}}}if(g==="border-bottom"||g==="border-top"||g==="border-left"||g==="border-right"||g==="border"){i.bd||(i.bd={});const y=f.split(" "),_=`${y[0]} ${y[1]}`;y.splice(0,2);const A=y.join("");if(L.getBorderStyleType(_)!==L.BorderStyleTypes.NONE){const N={cl:{rgb:A},s:L.getBorderStyleType(_)};g==="border-bottom"?i.bd.b=f==="none"?null:N:g==="border-top"?i.bd.t=f==="none"?null:N:g==="border-left"?i.bd.l=f==="none"?null:N:g==="border-right"?i.bd.r=f==="none"?null:N:g==="border"&&(i.bd={r:f==="none"?null:N,t:f==="none"?null:N,b:f==="none"?null:N,l:f==="none"?null:N})}}else if(g==="data-rotate"){const y=/[+-]?\d+/,_=f.match(y);f==="(0deg ,1)"?i.tr={a:0,v:1}:_&&(i.tr={a:Number(_[0])})}}),Object.keys(i).forEach(d=>{typeof i[d]=="object"&&!Object.keys(i[d]).length&&delete i[d]}),i}function s3(e,t){let n;t===" "?n=e.trim().split(t):n=e.trim().split(t).slice(0,-1),n.forEach(i=>`${i.trim()})`);let r={};return n.length===1?r={t:n[0],r:n[0],b:n[0],l:n[0]}:n.length===2?r={t:n[0],r:n[1],b:n[0],l:n[1]}:n.length===3?r={t:n[0],r:n[1],b:n[2],l:n[1]}:n.length===4&&(r={t:n[0],r:n[1],b:n[2],l:n[3]}),r}function mi(e){if(e==="")return[e];const t=/(?:(\n+.+)|(.+))/g;return e.match(t).map(i=>i.replace(/\n/g,`\r
|
|
48
48
|
`))}function hs(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table col");if(!r.length)return[];for(let i=0;i<r.length;i++){const a=r[i],o=a.getAttribute("span");if(o&&+o>1)for(let u=0;u<+o;u++){const d=tt(a.getAttribute("width"),72);n.push(d)}else{const u=tt(a.getAttribute("width"),72);n.push(u)}}return n}function tt(e,t){if(!e)return t;let n;return e.includes("pt")?n=C1.ptToPx(Number.parseFloat(e)):e.includes("px")?n=Number.parseFloat(e):n=Number.parseFloat(e)*72/96,n}function ps(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table tr");if(!r.length)return[];for(let i=0;i<r.length;i++){const o=r[i].querySelectorAll("td");let u=tt(o[0].style.height,19);for(let d=0;d<o.length;d++){const h=o[d].getAttribute("rowSpan");if(!(h&&+h>1)){u=tt(o[d].style.height,19);break}}n.push(u)}return n}function gs(e){let t=[];const n=document.createElement("DIV");if(n.innerHTML=e,t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let r=0;const i=n.querySelectorAll("table tr");i[0].querySelectorAll("td").forEach(u=>{let d=0;const h=u.getAttribute("colSpan");h!==null?d=+h:d=1,r+=d});for(let u=0;u<t.length;u++)t[u]=new Array(r);let o=0;return i.forEach(u=>{let d=0;u.querySelectorAll("td").forEach(h=>{var y,_;const g={};if(h.querySelectorAll("span").length||h.querySelectorAll("font").length){const A=vn(h);typeof A!="string"&&(g.p=A)}const f=h.innerText;f.trim().length===0?g.v="":g.v=f;const S=St(h);for(L.Tools.isPlainObject(S)&&(g.s=S);d<r&&t[o][d]!=null;)d++;if(d!==r){if(t[o][d]==null){t[o][d]=g;const A=(y=Number(h.getAttribute("rowSpan")))!=null?y:1,O=(_=Number(h.getAttribute("colSpan")))!=null?_:1;if(A>1||O>1){const N={rs:+A-1,cs:+O-1,r:o,c:d};t[o][d].mc=N;for(let V=0;V<A;V++)for(let z=0;z<O;z++)V===0&&z===0||(t[o+V][d+z]={mc:null})}}d++}}),o++}),t}function ms(e){const t=[],n=document.createElement("DIV");n.innerHTML=e;const i=e.replace(/\r/g,"").split(`
|
|
49
49
|
`),a=i[0].split(" ").length;for(let o=0;o<i.length;o++)i[o].split(" ").length<a||t.push(i[o].split(" "));for(let o=0;o<t.length;o++)for(let u=0;u<t[o].length;u++)t[o][u].length?t[o][u]={v:t[o][u]||"",m:t[o][u]||""}:t[o][u]=null;return t}function vs(e,t){e.length,e[0].length;let n=0,r=0;t&&(n=t.startRow,r=t.startColumn);const i=[];for(let a=0;a<e.length;a++)for(let o=0;o<e[a].length;o++)if(e[a][o]&&typeof e[a][o]=="object"&&"mc"in e[a][o])if(e[a][o].mc){const u=e[a][o].mc,d=u.r+n,h=d+u.rs,g=u.c+r,f=g+u.cs;i.push({startRow:d,endRow:h,startColumn:g,endColumn:f}),delete e[a][o].mc}else e[a][o]=null;return{data:e,mergeData:i}}function Cs(e){var h;let t=[];const n=document.createElement("html");n.innerHTML=e;const r=(h=n.querySelector("style"))==null?void 0:h.innerText;if(!r)return;const i=Ss(r);if(t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let a=0;const o=n.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(g=>{let f=0;const S=g.getAttribute("colSpan");S!==null?f=+S:f=1,a+=f});for(let g=0;g<t.length;g++)t[g]=new Array(a);let d=0;return o.forEach(g=>{let f=0;g.querySelectorAll("td").forEach(S=>{var N,V;const y={};if(S.querySelectorAll("span").length||S.querySelectorAll("font").length){const z=vn(S);typeof z!="string"&&(y.p=z)}const _=S.innerText;_.trim().length===0?y.v="":y.v=_;let A="";for(const z in i)S.classList.contains(z)&&(A+=i[z]);const O=St(S,A);for(L.Tools.isPlainObject(O)&&(y.s=O);f<a&&t[d][f]!=null;)f++;if(f!==a){if(t[d][f]==null){t[d][f]=y;const z=(N=Number(S.getAttribute("rowSpan")))!=null?N:1,W=(V=Number(S.getAttribute("colSpan")))!=null?V:1;if(z>1||W>1){const w={rs:+z-1,cs:+W-1,r:d,c:f};t[d][f].mc=w;for(let D=0;D<z;D++)for(let k=0;k<W;k++)D===0&&k===0||(t[d+D][f+k]={mc:null})}}f++}}),d++}),t}function Ss(e){const t={},n=e.replaceAll("<!--","").replaceAll("-->","").trim(),r=n==null?void 0:n.replaceAll(" ","").replaceAll(`
|