@univerjs/ui 0.4.0-alpha.1 → 0.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
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 f$1=React,k$1=Symbol.for("react.element"),l$1=Symbol.for("react.fragment"),m$1=Object.prototype.hasOwnProperty,n$1=f$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$1={key:!0,ref:!0,__self:!0,__source:!0};function q$1(c2,a,g2){var b2,d2={},e2=null,h2=null;g2!==void 0&&(e2=""+g2),a.key!==void 0&&(e2=""+a.key),a.ref!==void 0&&(h2=a.ref);for(b2 in a)m$1.call(a,b2)&&!p$1.hasOwnProperty(b2)&&(d2[b2]=a[b2]);if(c2&&c2.defaultProps)for(b2 in a=c2.defaultProps,a)d2[b2]===void 0&&(d2[b2]=a[b2]);return{$$typeof:k$1,type:c2,key:e2,ref:h2,props:d2,_owner:n$1.current}}__name(q$1,"q$1");reactJsxRuntime_production_min.Fragment=l$1;reactJsxRuntime_production_min.jsx=q$1;reactJsxRuntime_production_min.jsxs=q$1;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports;function CustomLabel(props){const{title,icon,label,value,value$}=props,localeService=core.useDependency(core.LocaleService),componentManager=core.useDependency(ComponentManager),[subscribedValue,setSubscribedValue]=React.useState(value),[realIcon,setRealIcon]=React.useState(""),nodes=[];let index=0;React.useEffect(()=>{if(value$){const subscription=value$.subscribe(v2=>{setSubscribedValue(v2)});return()=>{subscription.unsubscribe()}}},[value$]);const realValue=React.useMemo(()=>value!=null?value:subscribedValue,[subscribedValue,value]);React.useEffect(()=>{let subscription=null;return rxjs.isObservable(icon)?subscription=icon.subscribe(v2=>{setRealIcon(v2)}):setRealIcon(icon!=null?icon:""),()=>{subscription==null||subscription.unsubscribe()}},[icon]);const isValid=React.useMemo(()=>realValue&&typeof realValue=="string"?new core.ColorKit(realValue).isValid:!1,[realValue]);if(icon){const Icon=componentManager.get(realIcon!=null?realIcon:"");Icon&&nodes.push(jsxRuntimeExports.jsx(Icon,{extend:{colorChannel1:isValid?realValue:"rgb(var(--primary-color))"}},index++))}if(label){const isStringLabel=typeof label=="string",customProps=isStringLabel?{...props}:{...label==null?void 0:label.props,...props},labelName=isStringLabel?label:label==null?void 0:label.name,CustomComponent=componentManager.get(labelName);CustomComponent?nodes.push(jsxRuntimeExports.jsx(CustomComponent,{...customProps,value:realValue},index++)):nodes.push(jsxRuntimeExports.jsx("span",{children:localeService.t(labelName)},index++))}return title&&nodes.push(jsxRuntimeExports.jsx("span",{children:typeof title=="string"?localeService.t(title):title},index++)),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:nodes})}__name(CustomLabel,"CustomLabel");const uiPluginSheetsFontFamily="univer-ui-plugin-sheets-font-family",uiPluginSheetsFontFamilyItem="univer-ui-plugin-sheets-font-family-item",styles$e={uiPluginSheetsFontFamily,uiPluginSheetsFontFamilyItem},FontFamily=__name(props=>{const{value}=props,localeService=core.useDependency(core.LocaleService),viewValue=React.useMemo(()=>{if(value==null)return"";let fontFamily=localeService.t(`fontFamily.${`${value!=null?value:""}`.replace(/\s/g,"")}`);return fontFamily.startsWith("fontFamily.")&&typeof value=="string"&&(fontFamily=value.split(",")[0]),fontFamily},[value]);return jsxRuntimeExports.jsx("div",{className:styles$e.uiPluginSheetsFontFamily,style:{fontFamily:value},children:viewValue})},"FontFamily"),FontFamilyItem=__name(props=>{const{value}=props,localeService=core.useDependency(core.LocaleService);return jsxRuntimeExports.jsx("span",{className:styles$e.uiPluginSheetsFontFamilyItem,style:{fontFamily:value},children:localeService.t(`fontFamily.${`${value!=null?value:""}`.replace(/\s/g,"")}`)})},"FontFamilyItem"),FONT_FAMILY_LIST=[{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"}];function unwrap(o){return typeof o=="function"?o():o}__name(unwrap,"unwrap");function useObservable(observable,defaultValue,shouldHaveSyncValue,deps){if(typeof observable=="function"&&!deps)throw new Error("[useObservable]: expect deps when observable is a function! Otherwise it would cause an infinite loop.");const observableRef=React.useRef(null),initializedRef=React.useRef(!1),destObservable=React.useMemo(()=>observable,[...typeof deps<"u"?deps:[observable]]),[_,setRenderCounter]=React.useState(0),valueRef=React.useRef((()=>{let innerDefaultValue;return destObservable&&unwrap(destObservable).subscribe(value=>{initializedRef.current=!0,innerDefaultValue=value}).unsubscribe(),innerDefaultValue!=null?innerDefaultValue:defaultValue})());if(React.useEffect(()=>{let subscription=null;return destObservable&&(observableRef.current=unwrap(destObservable),subscription=observableRef.current.subscribe(value=>{valueRef.current=value,setRenderCounter(prev=>prev+1)})),()=>subscription==null?void 0:subscription.unsubscribe()},[destObservable]),shouldHaveSyncValue&&!initializedRef.current)throw new Error("[useObservable]: expect shouldHaveSyncValue but not getting a sync value!");return valueRef.current}__name(useObservable,"useObservable");const uiPluginSheetsFontSize="univer-ui-plugin-sheets-font-size",uiPluginSheetsFontSizeInput="univer-ui-plugin-sheets-font-size-input",styles$d={uiPluginSheetsFontSize,uiPluginSheetsFontSizeInput},FontSize=__name(props=>{const{value,min,max,onChange,disabled$}=props,disabled=useObservable(disabled$),[realValue,setRealValue]=React.useState(Number(value!=null?value:0)),_value=React.useMemo(()=>Number(value!=null?value:realValue),[value]);function handleChange(value2){value2!==null&&setRealValue(value2)}__name(handleChange,"handleChange");function handleStopPropagation(e2){e2.stopPropagation(),e2.code==="Enter"&&onChange(realValue.toString())}return __name(handleStopPropagation,"handleStopPropagation"),jsxRuntimeExports.jsx("div",{className:styles$d.uiPluginSheetsFontSize,children:jsxRuntimeExports.jsx(design.InputNumber,{className:styles$d.uiPluginSheetsFontSizeInput,value:_value,controls:!1,min,max,onKeyDown:handleStopPropagation,onChange:handleChange,disabled})})},"FontSize"),FONT_SIZE_LIST=[{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 canUseDom$2={};Object.defineProperty(canUseDom$2,"__esModule",{value:!0});var _default=canUseDom$2.default=canUseDom$1;function canUseDom$1(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}__name(canUseDom$1,"canUseDom$1");function useEvent$1(func){const funcRef=React.useRef(func);return funcRef.current=func,React.useCallback((...params)=>{var _a19;return(_a19=funcRef.current)==null?void 0:_a19.call(funcRef,...params)},[])}__name(useEvent$1,"useEvent$1");function useScrollYOverContainer(element2,container){const updater=useEvent$1(()=>{if(!element2||!container)return;const elStyle=element2.style,elRect=element2.getBoundingClientRect(),{y}=elRect,containerRect=container.getBoundingClientRect(),scrolled=element2.scrollHeight>elRect.height,isOverViewport=y<0||y+elRect.height>containerRect.height;if(!isOverViewport&&!scrolled){elStyle.overflowY="",elStyle.maxHeight="";return}isOverViewport&&(elStyle.overflowY="scroll",elStyle.maxHeight=y<0?`${element2.scrollHeight+y}px`:`${containerRect.height-y}px`)});React.useEffect(()=>{if(!_default()||!element2||!container)return;updater();const resizeObserver=design.resizeObserverCtor(updater);return resizeObserver.observe(element2),()=>{resizeObserver.unobserve(element2)}},[element2,container])}__name(useScrollYOverContainer,"useScrollYOverContainer");function t$1(localeService,key,...args){return localeService.t(key)}__name(t$1,"t$1");const isNumber=__name(value=>typeof value=="number","isNumber");function useLatest(value){const ref=React.useRef(value);return ref.current=value,ref}__name(useLatest,"useLatest");const useVirtualList=__name((list,options)=>{const{containerTarget,itemHeight,overscan=5}=options,itemHeightRef=useLatest(itemHeight),[size,setSize]=React.useState(null),scrollTriggerByScrollToFunc=React.useRef(!1),[targetList,setTargetList]=React.useState([]),[wrapperStyle,setWrapperStyle]=React.useState({height:void 0,marginTop:void 0}),getVisibleCount=__name((containerHeight,fromIndex)=>{if(typeof itemHeightRef.current=="number")return Math.ceil(containerHeight/itemHeightRef.current);let sum=0,endIndex=0;for(let i=fromIndex;i<list.length;i++){const height=itemHeightRef.current(i,list[i]);if(sum+=height,endIndex=i,sum>=containerHeight)break}return endIndex-fromIndex},"getVisibleCount"),getOffset=__name(scrollTop=>{if(isNumber(itemHeightRef.current))return Math.floor(scrollTop/itemHeightRef.current);let sum=0,offset=0;for(let i=0;i<list.length;i++){const height=itemHeightRef.current(i,list[i]);if(sum+=height,sum>=scrollTop){offset=i;break}}return offset+1},"getOffset"),getDistanceTop=__name(index=>typeof itemHeightRef.current=="number"?index*itemHeightRef.current:list.slice(0,index).reduce((sum,_,i)=>sum+itemHeightRef.current(i,list[i]),0),"getDistanceTop"),totalHeight=React.useMemo(()=>isNumber(itemHeightRef.current)?list.length*itemHeightRef.current:list.reduce((sum,_,index)=>sum+itemHeightRef.current(index,list[index]),0),[list]),calculateRange=__name(()=>{const container=containerTarget.current;if(container){const{scrollTop,clientHeight}=container,offset=getOffset(scrollTop),visibleCount=getVisibleCount(clientHeight,offset),start=Math.max(0,offset-overscan),end=Math.min(list.length,offset+visibleCount+overscan),offsetTop=getDistanceTop(start);setWrapperStyle({height:`${totalHeight-offsetTop}px`,marginTop:`${offsetTop}px`}),setTargetList(list.slice(start,end).map((ele,index)=>({data:ele,index:index+start})))}},"calculateRange");return React.useEffect(()=>{if(containerTarget.current){const getSize=__name(()=>{const width=containerTarget.current.clientWidth,height=containerTarget.current.clientHeight;(width!==(size==null?void 0:size.width)||height!==(size==null?void 0:size.height))&&setSize({width,height})},"getSize");getSize();const ob=new ResizeObserver(getSize);return ob.observe(containerTarget.current),()=>{ob.disconnect()}}},[]),React.useEffect(()=>{!(size!=null&&size.width)||!(size!=null&&size.height)||calculateRange()},[size==null?void 0:size.width,size==null?void 0:size.height,list]),[targetList,{wrapperStyle,scrollTo:useEvent$1(__name(index=>{const container=containerTarget.current;container&&(scrollTriggerByScrollToFunc.current=!0,container.scrollTop=getDistanceTop(index),calculateRange())},"scrollTo")),containerProps:{onScroll:__name(e2=>{if(scrollTriggerByScrollToFunc.current){scrollTriggerByScrollToFunc.current=!1;return}e2.preventDefault(),calculateRange()},"onScroll")}}]},"useVirtualList");function r(e2){var t2,f2,n2="";if(typeof e2=="string"||typeof e2=="number")n2+=e2;else if(typeof e2=="object")if(Array.isArray(e2)){var o=e2.length;for(t2=0;t2<o;t2++)e2[t2]&&(f2=r(e2[t2]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e2)e2[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx$1(){for(var e2,t2,f2=0,n2="",o=arguments.length;f2<o;f2++)(e2=arguments[f2])&&(t2=r(e2))&&(n2&&(n2+=" "),n2+=t2);return n2}__name(clsx$1,"clsx$1");var __defProp$h=Object.defineProperty,__getOwnPropDesc$h=Object.getOwnPropertyDescriptor,__decorateClass$h=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$h(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$h(target,key,result),result},"__decorateClass$h"),__decorateParam$h=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$h");const FOCUSING_UNIVER="FOCUSING_UNIVER",givingBackFocusElements=["univer-app-layout","univer-toolbar-btn","univer-menu-item","univer-button","univer-sheet-bar-btn","univer-render-canvas","univer-workbench-layout"],ILayoutService=core.createIdentifier("ui.layout-service");var _a;exports.DesktopLayoutService=(_a=class extends core.Disposable{constructor(_contextService,_univerInstanceService){super();__publicField(this,"_rootContainerElement",null);__publicField(this,"_isFocused",!1);__publicField(this,"_focusHandlers",new Map);__publicField(this,"_contentElements",[]);__publicField(this,"_allContainers",[]);this._contextService=_contextService,this._univerInstanceService=_univerInstanceService,this._initUniverFocusListener(),this._initEditorStatus()}get isFocused(){return this._isFocused}get rootContainerElement(){return this._rootContainerElement}focus(){const currentFocused=this._univerInstanceService.getFocusedUnit();if(!currentFocused)return;let handler;currentFocused instanceof core.Workbook?handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_SHEET):currentFocused instanceof core.DocumentDataModel?handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_DOC):currentFocused instanceof core.SlideDataModel&&(handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_SLIDE)),handler&&handler(currentFocused.getUnitId())}registerFocusHandler(type,handler){if(this._focusHandlers.has(type))throw new Error(`[DesktopLayoutService]: handler of type ${type} bas been registered!`);return this._focusHandlers.set(type,handler),core.toDisposable(()=>this._focusHandlers.delete(type))}registerContentElement(container){if(this._contentElements.indexOf(container)===-1)return this._contentElements.push(container),core.toDisposable(()=>core.remove(this._contentElements,container));throw new Error("[DesktopLayoutService]: content container already registered!")}getContentElement(){return this._contentElements[0]}registerRootContainerElement(container){if(this._rootContainerElement)throw new Error("[DesktopLayoutService]: root container already registered!");this._rootContainerElement=container;const dis=this.registerContainerElement(container);return core.toDisposable(()=>{this._rootContainerElement=null,dis.dispose()})}registerContainerElement(container){if(this._allContainers.indexOf(container)===-1)return this._allContainers.push(container),core.toDisposable(()=>core.remove(this._allContainers,container));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentContainers(element2){return this._allContainers.some(container=>container.contains(element2))}checkContentIsFocused(){return this._contentElements.some(contentEl=>contentEl===document.activeElement||contentEl.contains(document.activeElement))}_initUniverFocusListener(){this.disposeWithMe(rxjs.fromEvent(window,"focusin").subscribe(event=>{const target=event.target;if(givingBackFocusElements.some(item=>target.classList.contains(item))){queueMicrotask(()=>this.focus());return}target&&this.checkElementInCurrentContainers(target)?this._isFocused=!0:this._isFocused=!1,this._contextService.setContextValue(FOCUSING_UNIVER,this._isFocused),this._contextService.setContextValue(core.FOCUSING_UNIVER_EDITOR,getFocusingUniverEditorStatus())}))}_initEditorStatus(){this._contextService.setContextValue(core.FOCUSING_UNIVER_EDITOR,getFocusingUniverEditorStatus())}},__name(_a,"DesktopLayoutService"),_a);exports.DesktopLayoutService=__decorateClass$h([__decorateParam$h(0,core.IContextService),__decorateParam$h(1,core.IUniverInstanceService)],exports.DesktopLayoutService);function getFocusingUniverEditorStatus(){var _a19;return!!((_a19=document.activeElement)!=null&&_a19.classList.contains("univer-editor"))}__name(getFocusingUniverEditorStatus,"getFocusingUniverEditorStatus");var MenuManagerPosition=(MenuManagerPosition2=>(MenuManagerPosition2.RIBBON="ribbon",MenuManagerPosition2.CONTEXT_MENU="contextMenu",MenuManagerPosition2))(MenuManagerPosition||{}),RibbonPosition=(RibbonPosition2=>(RibbonPosition2.START="ribbon.start",RibbonPosition2.INSERT="ribbon.insert",RibbonPosition2.FORMULAS="ribbon.formulas",RibbonPosition2.DATA="ribbon.data",RibbonPosition2.VIEW="ribbon.view",RibbonPosition2.OTHERS="ribbon.others",RibbonPosition2))(RibbonPosition||{}),RibbonStartGroup=(RibbonStartGroup2=>(RibbonStartGroup2.HISTORY="ribbon.start.history",RibbonStartGroup2.FORMAT="ribbon.start.format",RibbonStartGroup2.LAYOUT="ribbon.start.layout",RibbonStartGroup2.FORMULAS_INSERT="ribbon.start.insert",RibbonStartGroup2.FORMULAS_VIEW="ribbon.start.view",RibbonStartGroup2.FILE="ribbon.start.file",RibbonStartGroup2.OTHERS="ribbon.start.others",RibbonStartGroup2))(RibbonStartGroup||{}),RibbonInsertGroup=(RibbonInsertGroup2=>(RibbonInsertGroup2.OTHERS="ribbon.insert.others",RibbonInsertGroup2))(RibbonInsertGroup||{}),RibbonFormulasGroup=(RibbonFormulasGroup2=>(RibbonFormulasGroup2.OTHERS="ribbon.formulas.others",RibbonFormulasGroup2))(RibbonFormulasGroup||{}),RibbonDataGroup=(RibbonDataGroup2=>(RibbonDataGroup2.OTHERS="ribbon.data.others",RibbonDataGroup2))(RibbonDataGroup||{}),RibbonViewGroup=(RibbonViewGroup2=>(RibbonViewGroup2.OTHERS="ribbon.view.others",RibbonViewGroup2))(RibbonViewGroup||{}),RibbonOthersGroup=(RibbonOthersGroup2=>(RibbonOthersGroup2.OTHERS="ribbon.others.others",RibbonOthersGroup2))(RibbonOthersGroup||{}),ContextMenuPosition=(ContextMenuPosition2=>(ContextMenuPosition2.MAIN_AREA="contextMenu.mainArea",ContextMenuPosition2.COL_HEADER="contextMenu.colHeader",ContextMenuPosition2.ROW_HEADER="contextMenu.rowHeader",ContextMenuPosition2.FOOTER_TABS="contextMenu.footerTabs",ContextMenuPosition2.FOOTER_MENU="contextMenu.footerMenu",ContextMenuPosition2))(ContextMenuPosition||{}),ContextMenuGroup=(ContextMenuGroup2=>(ContextMenuGroup2.FORMAT="contextMenu.format",ContextMenuGroup2.LAYOUT="contextMenu.layout",ContextMenuGroup2.DATA="contextMenu.data",ContextMenuGroup2.OTHERS="contextMenu.others",ContextMenuGroup2))(ContextMenuGroup||{}),MenuPosition=(MenuPosition2=>(MenuPosition2.VOID="void",MenuPosition2[MenuPosition2.TOOLBAR_START=RibbonPosition.START]="TOOLBAR_START",MenuPosition2[MenuPosition2.TOOLBAR_INSERT=RibbonPosition.INSERT]="TOOLBAR_INSERT",MenuPosition2[MenuPosition2.TOOLBAR_FORMULAS=RibbonPosition.FORMULAS]="TOOLBAR_FORMULAS",MenuPosition2[MenuPosition2.TOOLBAR_DATA=RibbonPosition.DATA]="TOOLBAR_DATA",MenuPosition2[MenuPosition2.TOOLBAR_VIEW=RibbonPosition.VIEW]="TOOLBAR_VIEW",MenuPosition2[MenuPosition2.TOOLBAR_OTHERS=RibbonPosition.OTHERS]="TOOLBAR_OTHERS",MenuPosition2[MenuPosition2.CONTEXT_MENU=ContextMenuPosition.MAIN_AREA]="CONTEXT_MENU",MenuPosition2.FOOTER="footer",MenuPosition2))(MenuPosition||{}),MenuGroup=(MenuGroup2=>(MenuGroup2[MenuGroup2.TOOLBAR_HISTORY=0]="TOOLBAR_HISTORY",MenuGroup2[MenuGroup2.TOOLBAR_FORMAT=1]="TOOLBAR_FORMAT",MenuGroup2[MenuGroup2.TOOLBAR_LAYOUT=2]="TOOLBAR_LAYOUT",MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_INSERT=3]="TOOLBAR_FORMULAS_INSERT",MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_VIEW=4]="TOOLBAR_FORMULAS_VIEW",MenuGroup2[MenuGroup2.TOOLBAR_FILE=5]="TOOLBAR_FILE",MenuGroup2[MenuGroup2.TOOLBAR_OTHERS=6]="TOOLBAR_OTHERS",MenuGroup2[MenuGroup2.CONTEXT_MENU_FORMAT=7]="CONTEXT_MENU_FORMAT",MenuGroup2[MenuGroup2.CONTEXT_MENU_LAYOUT=8]="CONTEXT_MENU_LAYOUT",MenuGroup2[MenuGroup2.CONTEXT_MENU_DATA=9]="CONTEXT_MENU_DATA",MenuGroup2[MenuGroup2.CONTEXT_MENU_OTHERS=10]="CONTEXT_MENU_OTHERS",MenuGroup2))(MenuGroup||{}),MenuItemType=(MenuItemType2=>(MenuItemType2[MenuItemType2.BUTTON=0]="BUTTON",MenuItemType2[MenuItemType2.SELECTOR=1]="SELECTOR",MenuItemType2[MenuItemType2.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",MenuItemType2[MenuItemType2.SUBITEMS=3]="SUBITEMS",MenuItemType2))(MenuItemType||{}),__defProp$g=Object.defineProperty,__getOwnPropDesc$g=Object.getOwnPropertyDescriptor,__decorateClass$g=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$g(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$g(target,key,result),result},"__decorateClass$g"),__decorateParam$g=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$g");const IMenuManagerService=core.createIdentifier("univer.menu-manager-service");var _a2;exports.MenuManagerService=(_a2=class extends core.Disposable{constructor(_injector,_configService){super();__publicField(this,"menuChanged$",new rxjs.Subject);__publicField(this,"_menu",{[MenuManagerPosition.RIBBON]:{[RibbonPosition.START]:{order:0,[RibbonStartGroup.HISTORY]:{order:0},[RibbonStartGroup.FORMAT]:{order:1},[RibbonStartGroup.LAYOUT]:{order:2},[RibbonStartGroup.FORMULAS_INSERT]:{order:3},[RibbonStartGroup.FORMULAS_VIEW]:{order:4},[RibbonStartGroup.FILE]:{order:5},[RibbonStartGroup.OTHERS]:{order:6}},[RibbonPosition.INSERT]:{order:1,[RibbonInsertGroup.OTHERS]:{order:0}},[RibbonPosition.FORMULAS]:{order:2,[RibbonFormulasGroup.OTHERS]:{order:0}},[RibbonPosition.DATA]:{order:3,[RibbonDataGroup.OTHERS]:{order:0}},[RibbonPosition.VIEW]:{order:4,[RibbonViewGroup.OTHERS]:{order:0}},[RibbonPosition.OTHERS]:{order:5,[RibbonOthersGroup.OTHERS]:{order:0}}},[MenuManagerPosition.CONTEXT_MENU]:{[ContextMenuPosition.MAIN_AREA]:{order:0,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.COL_HEADER]:{order:1,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.ROW_HEADER]:{order:2,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.FOOTER_TABS]:{order:3,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.FOOTER_MENU]:{order:4,[ContextMenuGroup.OTHERS]:{order:3}}}});this._injector=_injector,this._configService=_configService}dispose(){this.menuChanged$.complete()}mergeMenu(source,target){const _target=target!=null?target:this._menu;for(const[key,value]of Object.entries(_target))if(key in source){const _key=key;core.Tools.deepMerge(_target[_key],source[_key]),this.menuChanged$.next()}else this.mergeMenu(source,value)}appendRootMenu(source){core.Tools.deepMerge(this._menu,source),this.menuChanged$.next()}_buildMenuSchema(data){const result=[];for(const[key,value]of Object.entries(data)){const menuItem={key,order:value.order};if(value.menuItemFactory){const item=this._injector.invoke(value.menuItemFactory);if(item){const menuItemConfig=this._configService.getConfig("menu");if(menuItemConfig&&item.id in menuItemConfig){const _key=item.id;menuItem.item=mergeMenuConfigs(item,menuItemConfig[_key])}else menuItem.item=item}}const children=this._buildMenuSchema(value);children.length>0&&(menuItem.children=children.sort((a,b2)=>a.order-b2.order)),(menuItem.item||menuItem.children)&&result.push(menuItem)}return result}getMenuByPositionKey(key){const findKey=__name(obj=>{if(key in obj)return this._buildMenuSchema(obj[key]);for(const k2 in obj){if(k2===key)return this._buildMenuSchema(obj[k2]);if(typeof obj[k2]=="object"){const result=findKey(obj[k2]);if(result)return result}}},"findKey");return findKey(this._menu)}},__name(_a2,"MenuManagerService"),_a2);exports.MenuManagerService=__decorateClass$g([__decorateParam$g(0,core.Inject(core.Injector)),__decorateParam$g(1,core.IConfigService)],exports.MenuManagerService);const menuItemNoHover="univer-menu-item-no-hover",menuItemActive="univer-menu-item-active",menuItemActivated="univer-menu-item-activated",menuItemContent="univer-menu-item-content",menuItemSelectable="univer-menu-item-selectable",menuItemSelectableIcon="univer-menu-item-selectable-icon",menuItemMoreIcon="univer-menu-item-more-icon",styles$c={menuItemNoHover,menuItemActive,menuItemActivated,menuItemContent,menuItemSelectable,menuItemSelectableIcon,menuItemMoreIcon};function MenuWrapper(props){const{menuType,onOptionSelect}=props,menuManagerService=core.useDependency(IMenuManagerService);if(!menuType)return null;const menuItems=menuManagerService.getMenuByPositionKey(menuType),filteredMenuItems=React.useMemo(()=>menuItems.filter(item=>{var _a19;if(!item.children)return item;let hasChildren=!1;const hiddenObservables=(_a19=item.children)==null?void 0:_a19.map(item2=>{var _a20,_b;return(_b=(_a20=item2.item)==null?void 0:_a20.hidden$)!=null?_b:new rxjs.Observable(n2=>n2.next(!1))});return rxjs.combineLatest(hiddenObservables).pipe(rxjs.map(hiddenValues=>hiddenValues.every(hidden=>hidden===!0))).subscribe(allHidden=>{allHidden||(hasChildren=!0)}).unsubscribe(),hasChildren}),[menuItems]);return filteredMenuItems&&filteredMenuItems.map(item=>{var _a19;return item.item?jsxRuntimeExports.jsx(MenuItem,{menuItem:item.item,onClick:__name(object=>{onOptionSelect==null||onOptionSelect({value:"",label:item.key,...object})},"onClick")},item.key):(_a19=item.children)!=null&&_a19.length?jsxRuntimeExports.jsx(design.MenuItemGroup,{eventKey:item.key,children:item.children.map(child=>child.item&&jsxRuntimeExports.jsx(MenuItem,{menuItem:child.item,onClick:__name(object=>{onOptionSelect==null||onOptionSelect({value:"",label:child.key,...object})},"onClick")},child.key))},item.key):null})}__name(MenuWrapper,"MenuWrapper");function MenuOptionsWrapper(props){var _a19;const{options,value,onOptionSelect,parentKey}=props;return(_a19=options==null?void 0:options.map((option,index)=>{var _a20,_b,_c;const key=`${parentKey}-${(_a20=option.label)!=null?_a20:option.id}-${index}`,onChange=__name(v2=>{onOptionSelect==null||onOptionSelect({value:v2,label:option==null?void 0:option.label,commandId:option==null?void 0:option.commandId})},"onChange"),handleClick=__name(()=>{typeof option.value>"u"||onOptionSelect==null||onOptionSelect({...option})},"handleClick"),_className=clsx$1({[styles$c.menuItemNoHover]:typeof option.label!="string"&&!((_b=option.label)!=null&&_b.hoverable)});return jsxRuntimeExports.jsx(design.MenuItem,{disabled:option.disabled,eventKey:key,className:_className,onClick:handleClick,children:jsxRuntimeExports.jsxs("span",{className:clsx$1(styles$c.menuItemContent,{[styles$c.menuItemSelectable]:!(typeof option.label!="string"&&!((_c=option.label)!=null&&_c.hoverable))}),children:[typeof value<"u"&&String(value)===String(option.value)&&jsxRuntimeExports.jsx("span",{className:styles$c.menuItemSelectableIcon,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{color:"rgb(var(--success-color))"}})}),jsxRuntimeExports.jsx(CustomLabel,{value$:option.value$,value:option.value,label:option.label,icon:option.icon,onChange})]})},key)}))!=null?_a19:null}__name(MenuOptionsWrapper,"MenuOptionsWrapper");const Menu=__name(props=>{const{overViewport,...restProps}=props,[menuEl,setMenuEl]=React.useState(),layoutService=core.useDependency(ILayoutService);return useScrollYOverContainer(overViewport==="scroll"?menuEl:null,layoutService.rootContainerElement),jsxRuntimeExports.jsxs(design.Menu,{ref:__name(ref=>(ref==null?void 0:ref.list)&&setMenuEl(ref.list),"ref"),selectable:!1,children:[jsxRuntimeExports.jsx(MenuOptionsWrapper,{...restProps}),jsxRuntimeExports.jsx(MenuWrapper,{...restProps})]})},"Menu");function MenuItem({menuItem,onClick}){const menuManagerService=core.useDependency(IMenuManagerService),disabled=useObservable(menuItem.disabled$,!1),activated=useObservable(menuItem.activated$,!1),hidden=useObservable(menuItem.hidden$,!1),value=useObservable(menuItem.value$),item=menuItem,selectionsFromObservable=useObservable(rxjs.isObservable(item.selections)?item.selections:void 0),[inputValue,setInputValue]=React.useState(value);if(hidden)return null;const onChange=__name(v2=>{const newValue=core.isRealNum(v2)&&typeof v2=="string"?Number.parseInt(v2):v2;setInputValue(newValue)},"onChange"),renderButtonType=__name(()=>{const item2=menuItem,{title,label}=item2;return jsxRuntimeExports.jsx(design.MenuItem,{eventKey:item2.id,disabled,className:clsx$1({[styles$c.menuItemActivated]:activated}),onClick:__name(()=>{onClick({commandId:item2.commandId,value:inputValue,id:item2.id})},"onClick"),children:jsxRuntimeExports.jsx("span",{className:styles$c.menuItemContent,children:jsxRuntimeExports.jsx(CustomLabel,{value,title,label,icon:item2.icon,onChange})})},item2.id)},"renderButtonType"),renderSelectorType=__name(()=>{var _a19;const selections=(_a19=selectionsFromObservable!=null?selectionsFromObservable:item.selections)!=null?_a19:[];return selections.length>0?jsxRuntimeExports.jsx(design.SubMenu,{eventKey:item.id,popupOffset:[18,0],title:jsxRuntimeExports.jsxs("span",{className:styles$c.menuItemContent,children:[jsxRuntimeExports.jsx(CustomLabel,{title:item.title,value:inputValue,onChange,icon:item.icon,label:item.label}),item.shortcut&&` (${item.shortcut})`]}),expandIcon:jsxRuntimeExports.jsx(MoreSingle,{className:styles$c.menuItemMoreIcon}),children:selections.length>0&&jsxRuntimeExports.jsx(MenuOptionsWrapper,{parentKey:item.id,menuType:item.id,options:selections,onOptionSelect:__name(v2=>{onClick({value:v2.value,id:item.id,commandId:v2.commandId})},"onOptionSelect")})},item.id):jsxRuntimeExports.jsx(design.MenuItem,{eventKey:item.id,children:jsxRuntimeExports.jsxs("span",{className:styles$c.menuItemContent,children:[jsxRuntimeExports.jsx(CustomLabel,{title:item.title,value:inputValue,icon:item.icon,label:item.label,onChange}),item.shortcut&&` (${item.shortcut})`]})},item.id)},"renderSelectorType"),subMenuItems=menuItem.id?menuManagerService.getMenuByPositionKey(menuItem.id):[],renderSubItemsType=__name(()=>{const item2=menuItem;return jsxRuntimeExports.jsx(design.SubMenu,{eventKey:item2.id,popupOffset:[18,0],title:jsxRuntimeExports.jsx("span",{className:styles$c.menuItemContent,children:jsxRuntimeExports.jsx(CustomLabel,{title:item2.title,icon:item2.icon,label:item2.label,onChange})}),expandIcon:jsxRuntimeExports.jsx(MoreSingle,{className:styles$c.menuItemMoreIcon}),children:subMenuItems.length&&jsxRuntimeExports.jsx(MenuWrapper,{menuType:item2.id,parentKey:item2.id,onOptionSelect:onClick})},item2.id)},"renderSubItemsType");return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[menuItem.type===MenuItemType.SELECTOR&&renderSelectorType(),menuItem.type===MenuItemType.SUBITEMS&&renderSubItemsType(),menuItem.type===MenuItemType.BUTTON&&renderButtonType()]})}__name(MenuItem,"MenuItem");const _ProgressService=class _ProgressService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_taskCount",0);__publicField(this,"_progressChange$",new rxjs.Subject);__publicField(this,"_progressVisible$",new rxjs.Subject);__publicField(this,"progressChange$",this._progressChange$.asObservable());__publicField(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(task){if(this._taskCount===0)return;const{count}=task;if(count<=0)return;const step=Math.min(1,count/this._taskCount);this._progressChange$.next({step}),this._taskCount-=count,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(count){count<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=count)}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))}getTaskCount(){return this._taskCount}_clear(){this._taskCount=0}};__name(_ProgressService,"ProgressService");let ProgressService=_ProgressService;const IProgressService=core.createIdentifier("univer.progress.service"),progressBar="univer-progress-bar",progressBarContainer="univer-progress-bar-container",progressBarInner="univer-progress-bar-inner",progressBarCloseButton="univer-progress-bar-close-button",styles$b={progressBar,progressBarContainer,progressBarInner,progressBarCloseButton};function ProgressBar(props){const{barColor}=props,progressService=core.useDependency(IProgressService),progressBarInnerRef=React.useRef(null),[visible,setVisible]=React.useState(!1);React.useEffect(()=>{const progressVisible=progressService.progressVisible$.subscribe(isVisible=>{isVisible?setVisible(isVisible):setTimeout(()=>{setVisible(isVisible),progressBarInnerRef.current&&(progressBarInnerRef.current.style.width="0%")},500)}),progressChange=progressService.progressChange$.subscribe(task=>{const{step}=task;if(progressBarInnerRef.current){const currentProgress=Number.parseFloat(progressBarInnerRef.current.style.width)||0,newProgress=currentProgress+(100-currentProgress)*step;progressBarInnerRef.current.style.width=`${newProgress}%`}});return()=>{progressVisible.unsubscribe(),progressChange.unsubscribe()}},[]);function handleClose(){progressService.stop()}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsxs("div",{className:styles$b.progressBarContainer,style:{display:visible?"flex":"none"},children:[jsxRuntimeExports.jsx("div",{className:styles$b.progressBar,children:jsxRuntimeExports.jsx("div",{ref:progressBarInnerRef,className:styles$b.progressBarInner,style:{backgroundColor:barColor}})}),jsxRuntimeExports.jsx("div",{className:styles$b.progressBarCloseButton,onClick:handleClose,children:jsxRuntimeExports.jsx(CloseSingle,{})})]})}__name(ProgressBar,"ProgressBar");const UNI_DISABLE_CHANGING_FOCUS_KEY="UNI_DISABLE_CHANGING_FOCUS",PLUGIN_CONFIG_KEY="ui.config",defaultPluginConfig={},IMessageService=core.createIdentifier("ui.message.service");var __defProp$f=Object.defineProperty,__getOwnPropDesc$f=Object.getOwnPropertyDescriptor,__decorateClass$f=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$f(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$f(target,key,result),result},"__decorateClass$f"),__decorateParam$f=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$f"),_a3;exports.ErrorController=(_a3=class extends core.Disposable{constructor(_errorService,_messageService){super(),this._errorService=_errorService,this._messageService=_messageService,this.disposeWithMe(this._errorService.error$.subscribe(error=>{this._messageService.show({content:error.errorKey,type:design.MessageType.Error})}))}},__name(_a3,"ErrorController"),_a3);exports.ErrorController=__decorateClass$f([__decorateParam$f(0,core.Inject(core.ErrorService)),__decorateParam$f(1,IMessageService)],exports.ErrorController);const _ShortcutPanelService=class _ShortcutPanelService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_open$",new rxjs.BehaviorSubject(!1));__publicField(this,"open$",this._open$.pipe(rxjs.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){super.dispose(),this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}};__name(_ShortcutPanelService,"ShortcutPanelService");let ShortcutPanelService=_ShortcutPanelService;const ILeftSidebarService=core.createIdentifier("ui.left-sidebar.service"),ISidebarService=core.createIdentifier("ui.sidebar.service"),ShortcutPanelComponentName="ShortcutPanel",ToggleShortcutPanelOperation={id:"base-ui.operation.toggle-shortcut-panel",type:core.CommandType.OPERATION,handler:__name(accessor=>{const shortcutPanelService=accessor.get(ShortcutPanelService),sidebarService=accessor.get(ISidebarService);return shortcutPanelService.isOpen?(shortcutPanelService.close(),sidebarService.close()):(shortcutPanelService.open(),sidebarService.open({header:{title:"shortcut-panel.title"},children:{label:ShortcutPanelComponentName}})),!0},"handler")};function ShortcutPanelMenuItemFactory(accessor){return{id:ToggleShortcutPanelOperation.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:MenuItemType.BUTTON,hidden$:getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET)}}__name(ShortcutPanelMenuItemFactory,"ShortcutPanelMenuItemFactory");function UndoMenuItemFactory(accessor){const undoRedoService=accessor.get(core.IUndoRedoService);return{id:core.UndoCommand.id,type:MenuItemType.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",disabled$:undoRedoService.undoRedoStatus$.pipe(operators.map(v2=>v2.undos<=0))}}__name(UndoMenuItemFactory,"UndoMenuItemFactory");function RedoMenuItemFactory(accessor){const undoRedoService=accessor.get(core.IUndoRedoService);return{id:core.RedoCommand.id,type:MenuItemType.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",disabled$:undoRedoService.undoRedoStatus$.pipe(operators.map(v2=>v2.redos<=0))}}__name(RedoMenuItemFactory,"RedoMenuItemFactory");const menuSchema={[RibbonStartGroup.HISTORY]:{[core.UndoCommand.id]:{order:0,menuItemFactory:UndoMenuItemFactory},[core.RedoCommand.id]:{order:1,menuItemFactory:RedoMenuItemFactory}},[RibbonStartGroup.OTHERS]:{[ToggleShortcutPanelOperation.id]:{order:99,menuItemFactory:ShortcutPanelMenuItemFactory}}},SetEditorResizeOperation={id:"sheet.operation.set-editor-resize",type:core.CommandType.OPERATION,handler:__name((accessor,params)=>!0,"handler")},CopyCommandName="univer.command.copy",CopyCommand={id:CopyCommandName,name:CopyCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")},CutCommandName="univer.command.cut",CutCommand={id:CutCommandName,name:CutCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")},PasteCommandName="univer.command.paste",PasteCommand={id:PasteCommandName,name:PasteCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")};var KeyCode$1=(KeyCode2=>(KeyCode2[KeyCode2.UNKNOWN=0]="UNKNOWN",KeyCode2[KeyCode2.BACKSPACE=8]="BACKSPACE",KeyCode2[KeyCode2.TAB=9]="TAB",KeyCode2[KeyCode2.ENTER=13]="ENTER",KeyCode2[KeyCode2.SHIFT=16]="SHIFT",KeyCode2[KeyCode2.CTRL=17]="CTRL",KeyCode2[KeyCode2.ESC=27]="ESC",KeyCode2[KeyCode2.SPACE=32]="SPACE",KeyCode2[KeyCode2.ARROW_LEFT=37]="ARROW_LEFT",KeyCode2[KeyCode2.ARROW_UP=38]="ARROW_UP",KeyCode2[KeyCode2.ARROW_RIGHT=39]="ARROW_RIGHT",KeyCode2[KeyCode2.ARROW_DOWN=40]="ARROW_DOWN",KeyCode2[KeyCode2.INSERT=45]="INSERT",KeyCode2[KeyCode2.DELETE=46]="DELETE",KeyCode2[KeyCode2.Digit0=48]="Digit0",KeyCode2[KeyCode2.Digit1=49]="Digit1",KeyCode2[KeyCode2.Digit2=50]="Digit2",KeyCode2[KeyCode2.Digit3=51]="Digit3",KeyCode2[KeyCode2.Digit4=52]="Digit4",KeyCode2[KeyCode2.Digit5=53]="Digit5",KeyCode2[KeyCode2.Digit6=54]="Digit6",KeyCode2[KeyCode2.Digit7=55]="Digit7",KeyCode2[KeyCode2.Digit8=56]="Digit8",KeyCode2[KeyCode2.Digit9=57]="Digit9",KeyCode2[KeyCode2.A=65]="A",KeyCode2[KeyCode2.B=66]="B",KeyCode2[KeyCode2.C=67]="C",KeyCode2[KeyCode2.D=68]="D",KeyCode2[KeyCode2.E=69]="E",KeyCode2[KeyCode2.F=70]="F",KeyCode2[KeyCode2.G=71]="G",KeyCode2[KeyCode2.H=72]="H",KeyCode2[KeyCode2.I=73]="I",KeyCode2[KeyCode2.J=74]="J",KeyCode2[KeyCode2.K=75]="K",KeyCode2[KeyCode2.L=76]="L",KeyCode2[KeyCode2.M=77]="M",KeyCode2[KeyCode2.N=78]="N",KeyCode2[KeyCode2.O=79]="O",KeyCode2[KeyCode2.P=80]="P",KeyCode2[KeyCode2.Q=81]="Q",KeyCode2[KeyCode2.R=82]="R",KeyCode2[KeyCode2.S=83]="S",KeyCode2[KeyCode2.T=84]="T",KeyCode2[KeyCode2.U=85]="U",KeyCode2[KeyCode2.V=86]="V",KeyCode2[KeyCode2.W=87]="W",KeyCode2[KeyCode2.X=88]="X",KeyCode2[KeyCode2.Y=89]="Y",KeyCode2[KeyCode2.Z=90]="Z",KeyCode2[KeyCode2.F1=112]="F1",KeyCode2[KeyCode2.F2=113]="F2",KeyCode2[KeyCode2.F3=114]="F3",KeyCode2[KeyCode2.F4=115]="F4",KeyCode2[KeyCode2.F5=116]="F5",KeyCode2[KeyCode2.F6=117]="F6",KeyCode2[KeyCode2.F7=118]="F7",KeyCode2[KeyCode2.F8=119]="F8",KeyCode2[KeyCode2.F9=120]="F9",KeyCode2[KeyCode2.F10=121]="F10",KeyCode2[KeyCode2.F11=122]="F11",KeyCode2[KeyCode2.F12=123]="F12",KeyCode2[KeyCode2.NUM_LOCK=144]="NUM_LOCK",KeyCode2[KeyCode2.SCROLL_LOCK=145]="SCROLL_LOCK",KeyCode2[KeyCode2.EQUAL=187]="EQUAL",KeyCode2[KeyCode2.COMMA=188]="COMMA",KeyCode2[KeyCode2.MINUS=189]="MINUS",KeyCode2[KeyCode2.PERIOD=190]="PERIOD",KeyCode2[KeyCode2.BACK_SLASH=220]="BACK_SLASH",KeyCode2))(KeyCode$1||{});const KeyCodeToChar={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",189:"-",187:"=",190:".",188:",",220:"\\"};var MetaKeys=(MetaKeys2=>(MetaKeys2[MetaKeys2.SHIFT=1024]="SHIFT",MetaKeys2[MetaKeys2.ALT=2048]="ALT",MetaKeys2[MetaKeys2.CTRL_COMMAND=4096]="CTRL_COMMAND",MetaKeys2[MetaKeys2.MAC_CTRL=8192]="MAC_CTRL",MetaKeys2))(MetaKeys||{});function fromGlobalEvent(type,listener,options){return window.addEventListener(type,listener,options),core.toDisposable(()=>window.removeEventListener(type,listener,options))}__name(fromGlobalEvent,"fromGlobalEvent");const IPlatformService=core.createIdentifier("ui.platform.service"),_PlatformService=class _PlatformService{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}};__name(_PlatformService,"PlatformService");let PlatformService=_PlatformService;var __defProp$e=Object.defineProperty,__getOwnPropDesc$e=Object.getOwnPropertyDescriptor,__decorateClass$e=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$e(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$e(target,key,result),result},"__decorateClass$e"),__decorateParam$e=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$e");const IShortcutService=core.createIdentifier("ui.shortcut.service");var _a4;exports.ShortcutService=(_a4=class extends core.Disposable{constructor(_commandService,_platformService,_contextService,_layoutService){super();__publicField(this,"_shortCutMapping",new Map);__publicField(this,"_commandIDMapping",new Map);__publicField(this,"_shortcutChanged$",new rxjs.Subject);__publicField(this,"shortcutChanged$",this._shortcutChanged$.asObservable());__publicField(this,"_forceEscaped",!1);this._commandService=_commandService,this._platformService=_platformService,this._contextService=_contextService,this._layoutService=_layoutService,this.disposeWithMe(fromGlobalEvent("keydown",e2=>{this._resolveKeyboardEvent(e2)},{capture:!0}))}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(v2=>Array.from(v2.values())).flat()}registerShortcut(shortcut){const binding=this._getBindingFromItem(shortcut),bindingSet=this._shortCutMapping.get(binding);bindingSet?bindingSet.add(shortcut):this._shortCutMapping.set(binding,new Set([shortcut]));const commandID=shortcut.id,commandIDSet=this._commandIDMapping.get(commandID);return commandIDSet?commandIDSet.add(shortcut):this._commandIDMapping.set(commandID,new Set([shortcut])),this._emitShortcutChanged(),core.toDisposable(()=>{var _a19,_b,_c,_d;(_a19=this._shortCutMapping.get(binding))==null||_a19.delete(shortcut),((_b=this._shortCutMapping.get(binding))==null?void 0:_b.size)===0&&this._shortCutMapping.delete(binding),(_c=this._commandIDMapping.get(commandID))==null||_c.delete(shortcut),((_d=this._commandIDMapping.get(commandID))==null?void 0:_d.size)===0&&this._commandIDMapping.delete(commandID),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(id){const set=this._commandIDMapping.get(id);if(!set)return null;const shortcut=set.values().next().value;return shortcut?this.getShortcutDisplay(shortcut):null}getShortcutDisplay(shortcut){var _a19;const binding=this._getBindingFromItem(shortcut),ctrlKey=binding&MetaKeys.CTRL_COMMAND,shiftKey=binding&MetaKeys.SHIFT,altKey=binding&MetaKeys.ALT,macCtrl=binding&MetaKeys.MAC_CTRL,body=(_a19=KeyCodeToChar[binding&255])!=null?_a19:"<->";return this._platformService.isMac?`${ctrlKey?"⌘":""}${shiftKey?"⇧":""}${altKey?"⌥":""}${macCtrl?"⌃":""}${body}`:`${ctrlKey?"Ctrl+":""}${shiftKey?"Shift+":""}${altKey?"Alt+":""}${body}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,core.toDisposable(()=>this._forceEscaped=!1)}_resolveKeyboardEvent(e2){if(this._forceEscaped||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(e2.target))return;this._dispatch(e2)&&e2.preventDefault()}_dispatch(e2){const binding=this._deriveBindingFromEvent(e2);if(binding===null)return!1;const shortcuts=this._shortCutMapping.get(binding);if(shortcuts===void 0)return!1;const shouldTrigger=Array.from(shortcuts).sort((s1,s2)=>{var _a19,_b;return((_a19=s2.priority)!=null?_a19:0)-((_b=s1.priority)!=null?_b:0)}).find(s=>{var _a19,_b;return(_b=(_a19=s.preconditions)==null?void 0:_a19.call(s,this._contextService))!=null?_b:!0});return shouldTrigger?(this._commandService.executeCommand(shouldTrigger.id,shouldTrigger.staticParameters),!0):!1}_getBindingFromItem(item){return this._platformService.isMac&&item.mac?item.mac:this._platformService.isWindows&&item.win?item.win:this._platformService.isLinux&&item.linux?item.linux:item.binding}_deriveBindingFromEvent(e2){const{shiftKey,metaKey,altKey,keyCode}=e2;let binding=keyCode;return shiftKey&&(binding|=MetaKeys.SHIFT),altKey&&(binding|=MetaKeys.ALT),(this._platformService.isMac?metaKey:e2.ctrlKey)&&(binding|=MetaKeys.CTRL_COMMAND),this._platformService.isMac&&e2.ctrlKey&&(binding|=MetaKeys.MAC_CTRL),binding}},__name(_a4,"ShortcutService"),_a4);exports.ShortcutService=__decorateClass$e([__decorateParam$e(0,core.ICommandService),__decorateParam$e(1,IPlatformService),__decorateParam$e(2,core.IContextService),__decorateParam$e(3,core.Optional(ILayoutService))],exports.ShortcutService);var __defProp$d=Object.defineProperty,__getOwnPropDesc$d=Object.getOwnPropertyDescriptor,__decorateClass$d=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$d(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$d(target,key,result),result},"__decorateClass$d"),__decorateParam$d=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$d");function whenEditorFocused(contextService){return contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)}__name(whenEditorFocused,"whenEditorFocused");const CopyShortcutItem={id:CopyCommand.id,description:"shortcut.copy",group:"1_common-edit",binding:KeyCode$1.C|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},CutShortcutItem={id:CutCommand.id,description:"shortcut.cut",group:"1_common-edit",binding:KeyCode$1.X|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},OnlyDisplayPasteShortcutItem={id:PasteCommand.id,description:"shortcut.paste",group:"1_common-edit",binding:KeyCode$1.V|MetaKeys.CTRL_COMMAND,preconditions:__name(()=>!1,"preconditions")},UndoShortcutItem={id:core.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:KeyCode$1.Z|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},RedoShortcutItem={id:core.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:KeyCode$1.Y|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused};var _a5;exports.SharedController=(_a5=class extends core.Disposable{constructor(_shortcutService,_commandService){super(),this._shortcutService=_shortcutService,this._commandService=_commandService,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts()}_registerCommands(){[CutCommand,CopyCommand,PasteCommand,SetEditorResizeOperation].forEach(command=>this.disposeWithMe(this._commandService.registerMultipleCommand(command)))}_registerShortcuts(){const shortcutItems=[UndoShortcutItem,RedoShortcutItem];shortcutItems.push(CutShortcutItem,CopyShortcutItem,OnlyDisplayPasteShortcutItem),shortcutItems.forEach(shortcut=>this.disposeWithMe(this._shortcutService.registerShortcut(shortcut)))}},__name(_a5,"SharedController"),_a5);exports.SharedController=__decorateClass$d([__decorateParam$d(0,IShortcutService),__decorateParam$d(1,core.ICommandService)],exports.SharedController);const shortcutPanelGroupTitle="univer-shortcut-panel-group-title",shortcutPanelItem="univer-shortcut-panel-item",shortcutPanelItemTitle="univer-shortcut-panel-item-title",shortcutPanelItemShortcut="univer-shortcut-panel-item-shortcut",styles$a={shortcutPanelGroupTitle,shortcutPanelItem,shortcutPanelItemTitle,shortcutPanelItemShortcut};function ShortcutPanel(){const shortcutService=core.useDependency(IShortcutService),localeService=core.useDependency(core.LocaleService),currentLocale=useObservable(localeService.currentLocale$),[shortcutItems,setShortcutItems]=React.useState([]),updateShortcuts=React.useCallback(()=>{var _a19;const shortcutGroups=new Map,shortcuts=shortcutService.getAllShortcuts().filter(item=>!!item.group);for(const shortcut of shortcuts){const group=shortcut.group,shortcutItem={title:localeService.t((_a19=shortcut.description)!=null?_a19:shortcut.id),shortcut:shortcutService.getShortcutDisplay(shortcut)};if(!/\d+_[a-zA-Z0-9]/.test(group))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${group}!`);shortcutGroups.has(group)||shortcutGroups.set(group,[]),shortcutGroups.get(group).push(shortcutItem)}const toRender=Array.from(shortcutGroups.entries()).map(([name,items])=>{const groupSequence=name.split("_")[0],groupName=name.slice(groupSequence.length+1);return{sequence:+groupSequence,name:localeService.t(groupName),items}}).sort((a,b2)=>a.sequence-b2.sequence);setShortcutItems(toRender)},[shortcutService,localeService,currentLocale]);return React.useEffect(()=>{updateShortcuts();const subscription=shortcutService.shortcutChanged$.subscribe(()=>updateShortcuts());return()=>subscription.unsubscribe()},[shortcutService,updateShortcuts]),jsxRuntimeExports.jsx("div",{className:styles$a.shortcutPanel,children:shortcutItems.map(group=>jsxRuntimeExports.jsxs("div",{className:styles$a.shortcutPanelGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$a.shortcutPanelGroupTitle,children:group.name}),group.items.map((item,index)=>jsxRuntimeExports.jsxs("div",{className:styles$a.shortcutPanelItem,children:[jsxRuntimeExports.jsx("span",{className:styles$a.shortcutPanelItemTitle,children:item.title}),jsxRuntimeExports.jsx("span",{className:styles$a.shortcutPanelItemShortcut,children:item.shortcut})]},`${item.title}-${item.shortcut}`))]},group.name))})}__name(ShortcutPanel,"ShortcutPanel");var __defProp$c=Object.defineProperty,__getOwnPropDesc$c=Object.getOwnPropertyDescriptor,__decorateClass$c=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$c(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$c(target,key,result),result},"__decorateClass$c"),__decorateParam$c=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$c");const ToggleShortcutPanelShortcut={id:ToggleShortcutPanelOperation.id,binding:MetaKeys.CTRL_COMMAND|KeyCode$1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};var _a6;exports.ShortcutPanelController=(_a6=class extends core.Disposable{constructor(injector,componentManager,shortcutService,_menuManagerService,commandService){super(),this._menuManagerService=_menuManagerService,this.disposeWithMe(componentManager.register(ShortcutPanelComponentName,ShortcutPanel)),this.disposeWithMe(commandService.registerCommand(ToggleShortcutPanelOperation)),this.disposeWithMe(shortcutService.registerShortcut(ToggleShortcutPanelShortcut))}},__name(_a6,"ShortcutPanelController"),_a6);exports.ShortcutPanelController=__decorateClass$c([__decorateParam$c(0,core.Inject(core.Injector)),__decorateParam$c(1,core.Inject(ComponentManager)),__decorateParam$c(2,IShortcutService),__decorateParam$c(3,IMenuManagerService),__decorateParam$c(4,core.ICommandService)],exports.ShortcutPanelController);const IUIController=core.createIdentifier("univer.ui.ui-controller");var render$1={},interopRequireWildcard={exports:{}},_typeof$2={exports:{}};(function(module2){function _typeof3(o){"@babel/helpers - typeof";return module2.exports=_typeof3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},module2.exports.__esModule=!0,module2.exports.default=module2.exports,_typeof3(o)}__name(_typeof3,"_typeof"),module2.exports=_typeof3,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(_typeof$2);var _typeofExports=_typeof$2.exports;(function(module2){var _typeof3=_typeofExports.default;function _getRequireWildcardCache(e2){if(typeof WeakMap!="function")return null;var r2=new WeakMap,t2=new WeakMap;return(_getRequireWildcardCache=__name(function(e3){return e3?t2:r2},"_getRequireWildcardCache"))(e2)}__name(_getRequireWildcardCache,"_getRequireWildcardCache");function _interopRequireWildcard2(e2,r2){if(!r2&&e2&&e2.__esModule)return e2;if(e2===null||_typeof3(e2)!="object"&&typeof e2!="function")return{default:e2};var t2=_getRequireWildcardCache(r2);if(t2&&t2.has(e2))return t2.get(e2);var n2={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u2 in e2)if(u2!=="default"&&{}.hasOwnProperty.call(e2,u2)){var i=a?Object.getOwnPropertyDescriptor(e2,u2):null;i&&(i.get||i.set)?Object.defineProperty(n2,u2,i):n2[u2]=e2[u2]}return n2.default=e2,t2&&t2.set(e2,n2),n2}__name(_interopRequireWildcard2,"_interopRequireWildcard"),module2.exports=_interopRequireWildcard2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(interopRequireWildcard);var interopRequireWildcardExports=interopRequireWildcard.exports,interopRequireDefault={exports:{}};(function(module2){function _interopRequireDefault2(e2){return e2&&e2.__esModule?e2:{default:e2}}__name(_interopRequireDefault2,"_interopRequireDefault"),module2.exports=_interopRequireDefault2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(interopRequireDefault);var interopRequireDefaultExports=interopRequireDefault.exports,regeneratorRuntime={exports:{}};(function(module2){var _typeof3=_typeofExports.default;function _regeneratorRuntime(){module2.exports=_regeneratorRuntime=__name(function(){return e2},"_regeneratorRuntime"),module2.exports.__esModule=!0,module2.exports.default=module2.exports;var t2,e2={},r2=Object.prototype,n2=r2.hasOwnProperty,o=Object.defineProperty||function(t3,e3,r3){t3[e3]=r3.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",c2=i.asyncIterator||"@@asyncIterator",u2=i.toStringTag||"@@toStringTag";function define(t3,e3,r3){return Object.defineProperty(t3,e3,{value:r3,enumerable:!0,configurable:!0,writable:!0}),t3[e3]}__name(define,"define");try{define({},"")}catch{define=__name(function(t4,e3,r3){return t4[e3]=r3},"define")}function wrap(t3,e3,r3,n3){var i2=e3&&e3.prototype instanceof Generator?e3:Generator,a2=Object.create(i2.prototype),c3=new Context2(n3||[]);return o(a2,"_invoke",{value:makeInvokeMethod(t3,r3,c3)}),a2}__name(wrap,"wrap");function tryCatch(t3,e3,r3){try{return{type:"normal",arg:t3.call(e3,r3)}}catch(t4){return{type:"throw",arg:t4}}}__name(tryCatch,"tryCatch"),e2.wrap=wrap;var h2="suspendedStart",l2="suspendedYield",f2="executing",s="completed",y={};function Generator(){}__name(Generator,"Generator");function GeneratorFunction(){}__name(GeneratorFunction,"GeneratorFunction");function GeneratorFunctionPrototype(){}__name(GeneratorFunctionPrototype,"GeneratorFunctionPrototype");var p2={};define(p2,a,function(){return this});var d2=Object.getPrototypeOf,v2=d2&&d2(d2(values([])));v2&&v2!==r2&&n2.call(v2,a)&&(p2=v2);var g2=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p2);function defineIteratorMethods(t3){["next","throw","return"].forEach(function(e3){define(t3,e3,function(t4){return this._invoke(e3,t4)})})}__name(defineIteratorMethods,"defineIteratorMethods");function AsyncIterator(t3,e3){function invoke(r4,o2,i2,a2){var c3=tryCatch(t3[r4],t3,o2);if(c3.type!=="throw"){var u3=c3.arg,h3=u3.value;return h3&&_typeof3(h3)=="object"&&n2.call(h3,"__await")?e3.resolve(h3.__await).then(function(t4){invoke("next",t4,i2,a2)},function(t4){invoke("throw",t4,i2,a2)}):e3.resolve(h3).then(function(t4){u3.value=t4,i2(u3)},function(t4){return invoke("throw",t4,i2,a2)})}a2(c3.arg)}__name(invoke,"invoke");var r3;o(this,"_invoke",{value:__name(function(t4,n3){function callInvokeWithMethodAndArg(){return new e3(function(e4,r4){invoke(t4,n3,e4,r4)})}return __name(callInvokeWithMethodAndArg,"callInvokeWithMethodAndArg"),r3=r3?r3.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()},"value")})}__name(AsyncIterator,"AsyncIterator");function makeInvokeMethod(e3,r3,n3){var o2=h2;return function(i2,a2){if(o2===f2)throw Error("Generator is already running");if(o2===s){if(i2==="throw")throw a2;return{value:t2,done:!0}}for(n3.method=i2,n3.arg=a2;;){var c3=n3.delegate;if(c3){var u3=maybeInvokeDelegate(c3,n3);if(u3){if(u3===y)continue;return u3}}if(n3.method==="next")n3.sent=n3._sent=n3.arg;else if(n3.method==="throw"){if(o2===h2)throw o2=s,n3.arg;n3.dispatchException(n3.arg)}else n3.method==="return"&&n3.abrupt("return",n3.arg);o2=f2;var p3=tryCatch(e3,r3,n3);if(p3.type==="normal"){if(o2=n3.done?s:l2,p3.arg===y)continue;return{value:p3.arg,done:n3.done}}p3.type==="throw"&&(o2=s,n3.method="throw",n3.arg=p3.arg)}}}__name(makeInvokeMethod,"makeInvokeMethod");function maybeInvokeDelegate(e3,r3){var n3=r3.method,o2=e3.iterator[n3];if(o2===t2)return r3.delegate=null,n3==="throw"&&e3.iterator.return&&(r3.method="return",r3.arg=t2,maybeInvokeDelegate(e3,r3),r3.method==="throw")||n3!=="return"&&(r3.method="throw",r3.arg=new TypeError("The iterator does not provide a '"+n3+"' method")),y;var i2=tryCatch(o2,e3.iterator,r3.arg);if(i2.type==="throw")return r3.method="throw",r3.arg=i2.arg,r3.delegate=null,y;var a2=i2.arg;return a2?a2.done?(r3[e3.resultName]=a2.value,r3.next=e3.nextLoc,r3.method!=="return"&&(r3.method="next",r3.arg=t2),r3.delegate=null,y):a2:(r3.method="throw",r3.arg=new TypeError("iterator result is not an object"),r3.delegate=null,y)}__name(maybeInvokeDelegate,"maybeInvokeDelegate");function pushTryEntry(t3){var e3={tryLoc:t3[0]};1 in t3&&(e3.catchLoc=t3[1]),2 in t3&&(e3.finallyLoc=t3[2],e3.afterLoc=t3[3]),this.tryEntries.push(e3)}__name(pushTryEntry,"pushTryEntry");function resetTryEntry(t3){var e3=t3.completion||{};e3.type="normal",delete e3.arg,t3.completion=e3}__name(resetTryEntry,"resetTryEntry");function Context2(t3){this.tryEntries=[{tryLoc:"root"}],t3.forEach(pushTryEntry,this),this.reset(!0)}__name(Context2,"Context");function values(e3){if(e3||e3===""){var r3=e3[a];if(r3)return r3.call(e3);if(typeof e3.next=="function")return e3;if(!isNaN(e3.length)){var o2=-1,i2=__name(function next(){for(;++o2<e3.length;)if(n2.call(e3,o2))return next.value=e3[o2],next.done=!1,next;return next.value=t2,next.done=!0,next},"next");return i2.next=i2}}throw new TypeError(_typeof3(e3)+" is not iterable")}return __name(values,"values"),GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g2,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u2,"GeneratorFunction"),e2.isGeneratorFunction=function(t3){var e3=typeof t3=="function"&&t3.constructor;return!!e3&&(e3===GeneratorFunction||(e3.displayName||e3.name)==="GeneratorFunction")},e2.mark=function(t3){return Object.setPrototypeOf?Object.setPrototypeOf(t3,GeneratorFunctionPrototype):(t3.__proto__=GeneratorFunctionPrototype,define(t3,u2,"GeneratorFunction")),t3.prototype=Object.create(g2),t3},e2.awrap=function(t3){return{__await:t3}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c2,function(){return this}),e2.AsyncIterator=AsyncIterator,e2.async=function(t3,r3,n3,o2,i2){i2===void 0&&(i2=Promise);var a2=new AsyncIterator(wrap(t3,r3,n3,o2),i2);return e2.isGeneratorFunction(r3)?a2:a2.next().then(function(t4){return t4.done?t4.value:a2.next()})},defineIteratorMethods(g2),define(g2,u2,"Generator"),define(g2,a,function(){return this}),define(g2,"toString",function(){return"[object Generator]"}),e2.keys=function(t3){var e3=Object(t3),r3=[];for(var n3 in e3)r3.push(n3);return r3.reverse(),__name(function next(){for(;r3.length;){var t4=r3.pop();if(t4 in e3)return next.value=t4,next.done=!1,next}return next.done=!0,next},"next")},e2.values=values,Context2.prototype={constructor:Context2,reset:__name(function(e3){if(this.prev=0,this.next=0,this.sent=this._sent=t2,this.done=!1,this.delegate=null,this.method="next",this.arg=t2,this.tryEntries.forEach(resetTryEntry),!e3)for(var r3 in this)r3.charAt(0)==="t"&&n2.call(this,r3)&&!isNaN(+r3.slice(1))&&(this[r3]=t2)},"reset"),stop:__name(function(){this.done=!0;var t3=this.tryEntries[0].completion;if(t3.type==="throw")throw t3.arg;return this.rval},"stop"),dispatchException:__name(function(e3){if(this.done)throw e3;var r3=this;function handle(n3,o3){return a2.type="throw",a2.arg=e3,r3.next=n3,o3&&(r3.method="next",r3.arg=t2),!!o3}__name(handle,"handle");for(var o2=this.tryEntries.length-1;o2>=0;--o2){var i2=this.tryEntries[o2],a2=i2.completion;if(i2.tryLoc==="root")return handle("end");if(i2.tryLoc<=this.prev){var c3=n2.call(i2,"catchLoc"),u3=n2.call(i2,"finallyLoc");if(c3&&u3){if(this.prev<i2.catchLoc)return handle(i2.catchLoc,!0);if(this.prev<i2.finallyLoc)return handle(i2.finallyLoc)}else if(c3){if(this.prev<i2.catchLoc)return handle(i2.catchLoc,!0)}else{if(!u3)throw Error("try statement without catch or finally");if(this.prev<i2.finallyLoc)return handle(i2.finallyLoc)}}}},"dispatchException"),abrupt:__name(function(t3,e3){for(var r3=this.tryEntries.length-1;r3>=0;--r3){var o2=this.tryEntries[r3];if(o2.tryLoc<=this.prev&&n2.call(o2,"finallyLoc")&&this.prev<o2.finallyLoc){var i2=o2;break}}i2&&(t3==="break"||t3==="continue")&&i2.tryLoc<=e3&&e3<=i2.finallyLoc&&(i2=null);var a2=i2?i2.completion:{};return a2.type=t3,a2.arg=e3,i2?(this.method="next",this.next=i2.finallyLoc,y):this.complete(a2)},"abrupt"),complete:__name(function(t3,e3){if(t3.type==="throw")throw t3.arg;return t3.type==="break"||t3.type==="continue"?this.next=t3.arg:t3.type==="return"?(this.rval=this.arg=t3.arg,this.method="return",this.next="end"):t3.type==="normal"&&e3&&(this.next=e3),y},"complete"),finish:__name(function(t3){for(var e3=this.tryEntries.length-1;e3>=0;--e3){var r3=this.tryEntries[e3];if(r3.finallyLoc===t3)return this.complete(r3.completion,r3.afterLoc),resetTryEntry(r3),y}},"finish"),catch:__name(function(t3){for(var e3=this.tryEntries.length-1;e3>=0;--e3){var r3=this.tryEntries[e3];if(r3.tryLoc===t3){var n3=r3.completion;if(n3.type==="throw"){var o2=n3.arg;resetTryEntry(r3)}return o2}}throw Error("illegal catch attempt")},"_catch"),delegateYield:__name(function(e3,r3,n3){return this.delegate={iterator:values(e3),resultName:r3,nextLoc:n3},this.method==="next"&&(this.arg=t2),y},"delegateYield")},e2}__name(_regeneratorRuntime,"_regeneratorRuntime"),module2.exports=_regeneratorRuntime,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(regeneratorRuntime);var regeneratorRuntimeExports=regeneratorRuntime.exports,asyncToGenerator={exports:{}};(function(module2){function asyncGeneratorStep(n2,t2,e2,r2,o,a,c2){try{var i=n2[a](c2),u2=i.value}catch(n3){return void e2(n3)}i.done?t2(u2):Promise.resolve(u2).then(r2,o)}__name(asyncGeneratorStep,"asyncGeneratorStep");function _asyncToGenerator(n2){return function(){var t2=this,e2=arguments;return new Promise(function(r2,o){var a=n2.apply(t2,e2);function _next(n3){asyncGeneratorStep(a,r2,o,_next,_throw,"next",n3)}__name(_next,"_next");function _throw(n3){asyncGeneratorStep(a,r2,o,_next,_throw,"throw",n3)}__name(_throw,"_throw"),_next(void 0)})}}__name(_asyncToGenerator,"_asyncToGenerator"),module2.exports=_asyncToGenerator,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(asyncToGenerator);var asyncToGeneratorExports=asyncToGenerator.exports,objectSpread2={exports:{}},defineProperty={exports:{}},toPropertyKey$2={exports:{}},toPrimitive$2={exports:{}};(function(module2){var _typeof3=_typeofExports.default;function toPrimitive2(t2,r2){if(_typeof3(t2)!="object"||!t2)return t2;var e2=t2[Symbol.toPrimitive];if(e2!==void 0){var i=e2.call(t2,r2||"default");if(_typeof3(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r2==="string"?String:Number)(t2)}__name(toPrimitive2,"toPrimitive"),module2.exports=toPrimitive2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(toPrimitive$2);var toPrimitiveExports=toPrimitive$2.exports;(function(module2){var _typeof3=_typeofExports.default,toPrimitive2=toPrimitiveExports;function toPropertyKey2(t2){var i=toPrimitive2(t2,"string");return _typeof3(i)=="symbol"?i:i+""}__name(toPropertyKey2,"toPropertyKey"),module2.exports=toPropertyKey2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(toPropertyKey$2);var toPropertyKeyExports=toPropertyKey$2.exports;(function(module2){var toPropertyKey2=toPropertyKeyExports;function _defineProperty2(e2,r2,t2){return(r2=toPropertyKey2(r2))in e2?Object.defineProperty(e2,r2,{value:t2,enumerable:!0,configurable:!0,writable:!0}):e2[r2]=t2,e2}__name(_defineProperty2,"_defineProperty"),module2.exports=_defineProperty2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(defineProperty);var definePropertyExports=defineProperty.exports;(function(module2){var defineProperty2=definePropertyExports;function ownKeys2(e2,r2){var t2=Object.keys(e2);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e2);r2&&(o=o.filter(function(r3){return Object.getOwnPropertyDescriptor(e2,r3).enumerable})),t2.push.apply(t2,o)}return t2}__name(ownKeys2,"ownKeys");function _objectSpread22(e2){for(var r2=1;r2<arguments.length;r2++){var t2=arguments[r2]!=null?arguments[r2]:{};r2%2?ownKeys2(Object(t2),!0).forEach(function(r3){defineProperty2(e2,r3,t2[r3])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e2,Object.getOwnPropertyDescriptors(t2)):ownKeys2(Object(t2)).forEach(function(r3){Object.defineProperty(e2,r3,Object.getOwnPropertyDescriptor(t2,r3))})}return e2}__name(_objectSpread22,"_objectSpread2"),module2.exports=_objectSpread22,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(objectSpread2);var objectSpread2Exports=objectSpread2.exports,_interopRequireWildcard=interopRequireWildcardExports.default,_interopRequireDefault=interopRequireDefaultExports.default;Object.defineProperty(render$1,"__esModule",{value:!0});render$1._r=_r;render$1._u=_u;var render_2=render$1.render=render,unmount_1=render$1.unmount=unmount,_regeneratorRuntime2=_interopRequireDefault(regeneratorRuntimeExports),_asyncToGenerator2=_interopRequireDefault(asyncToGeneratorExports),_typeof2=_interopRequireDefault(_typeofExports),_objectSpread2$2=_interopRequireDefault(objectSpread2Exports),ReactDOM=_interopRequireWildcard(ReactDOM$1),fullClone=(0,_objectSpread2$2.default)({},ReactDOM),version=fullClone.version,reactRender=fullClone.render,unmountComponentAtNode=fullClone.unmountComponentAtNode,createRoot;try{var mainVersion=Number((version||"").split(".")[0]);mainVersion>=18&&(createRoot=fullClone.createRoot)}catch{}function toggleWarning(skip){var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED&&(0,_typeof2.default)(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==="object"&&(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=skip)}__name(toggleWarning,"toggleWarning");var MARK="__rc_react_root__";function modernRender(node,container){toggleWarning(!0);var root=container[MARK]||createRoot(container);toggleWarning(!1),root.render(node),container[MARK]=root}__name(modernRender,"modernRender");function legacyRender(node,container){reactRender(node,container)}__name(legacyRender,"legacyRender");function _r(node,container){}__name(_r,"_r");function render(node,container){if(createRoot){modernRender(node,container);return}legacyRender(node,container)}__name(render,"render");function modernUnmount(_x){return _modernUnmount.apply(this,arguments)}__name(modernUnmount,"modernUnmount");function _modernUnmount(){return _modernUnmount=(0,_asyncToGenerator2.default)((0,_regeneratorRuntime2.default)().mark(__name(function _callee(container){return(0,_regeneratorRuntime2.default)().wrap(__name(function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",Promise.resolve().then(function(){var _container$MARK;(_container$MARK=container[MARK])===null||_container$MARK===void 0||_container$MARK.unmount(),delete container[MARK]}));case 1:case"end":return _context.stop()}},"_callee$"),_callee)},"_callee"))),_modernUnmount.apply(this,arguments)}__name(_modernUnmount,"_modernUnmount");function legacyUnmount(container){unmountComponentAtNode(container)}__name(legacyUnmount,"legacyUnmount");function _u(container){}__name(_u,"_u");function unmount(_x2){return _unmount.apply(this,arguments)}__name(unmount,"unmount");function _unmount(){return _unmount=(0,_asyncToGenerator2.default)((0,_regeneratorRuntime2.default)().mark(__name(function _callee2(container){return(0,_regeneratorRuntime2.default)().wrap(__name(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(createRoot===void 0){_context2.next=2;break}return _context2.abrupt("return",modernUnmount(container));case 2:legacyUnmount(container);case 3:case"end":return _context2.stop()}},"_callee2$"),_callee2)},"_callee2"))),_unmount.apply(this,arguments)}__name(_unmount,"_unmount");var BuiltInUIPart=(BuiltInUIPart2=>(BuiltInUIPart2.GLOBAL="global",BuiltInUIPart2.HEADER="header",BuiltInUIPart2.HEADER_MENU="header-menu",BuiltInUIPart2.CONTENT="content",BuiltInUIPart2.FOOTER="footer",BuiltInUIPart2.LEFT_SIDEBAR="left-sidebar",BuiltInUIPart2.FLOATING="floating",BuiltInUIPart2.UNIT="unit",BuiltInUIPart2))(BuiltInUIPart||{});const IUIPartsService=core.createIdentifier("ui.parts.service"),_UIPartsService=class _UIPartsService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_componentsByPart",new Map);__publicField(this,"_componentRegistered$",new rxjs.Subject);__publicField(this,"componentRegistered$",this._componentRegistered$.asObservable())}dispose(){super.dispose(),this._componentRegistered$.complete()}registerComponent(part,componentFactory){const componentType=componentFactory(),components=(this._componentsByPart.get(part)||this._componentsByPart.set(part,new Set).get(part)).add(componentType);return this._componentRegistered$.next(part),core.toDisposable(()=>{components.delete(componentType),components.size===0&&this._componentsByPart.delete(part),this._componentRegistered$.next(part)})}getComponents(part){return new Set([...this._componentsByPart.get(part)||new Set])}};__name(_UIPartsService,"UIPartsService");let UIPartsService=_UIPartsService;const _CanvasFloatDomService=class _CanvasFloatDomService{constructor(){__publicField(this,"_domLayerMap",new Map);__publicField(this,"_domLayers$",new rxjs.BehaviorSubject([]));__publicField(this,"domLayers$",this._domLayers$.asObservable())}get domLayers(){return Array.from(this._domLayerMap.entries())}_notice(){this._domLayers$.next(Array.from(this._domLayerMap.entries()))}addFloatDom(item){this._domLayerMap.set(item.id,item),this._notice()}removeFloatDom(id){this._domLayerMap.delete(id)&&this._notice()}removeAll(){this._domLayerMap.clear(),this._notice()}};__name(_CanvasFloatDomService,"CanvasFloatDomService");let CanvasFloatDomService=_CanvasFloatDomService;const floatDomWrapper="univer-float-dom-wrapper",floatDom="univer-float-dom",styles$9={floatDomWrapper,floatDom},FloatDomSingle=React.memo(props=>{const{layer,id}=props,componentManager=core.useDependency(ComponentManager),position=useObservable(layer.position$),Component=typeof layer.componentKey=="string"?componentManager.get(layer.componentKey):layer.componentKey,layerProps={data:layer.data,...layer.props};return position?jsxRuntimeExports.jsx("div",{className:styles$9.floatDomWrapper,style:{position:"absolute",top:position.startY,left:position.startX,width:Math.max(position.endX-position.startX-2,0),height:Math.max(position.endY-position.startY-2,0),transform:`rotate(${position.rotate}deg)`,overflow:"hidden"},onPointerMove:__name(e2=>{layer.onPointerMove(e2.nativeEvent)},"onPointerMove"),onPointerDown:__name(e2=>{layer.onPointerDown(e2.nativeEvent)},"onPointerDown"),onPointerUp:__name(e2=>{layer.onPointerUp(e2.nativeEvent)},"onPointerUp"),onWheel:__name(e2=>{layer.onWheel(e2.nativeEvent)},"onWheel"),children:jsxRuntimeExports.jsx("div",{id,className:styles$9.floatDom,style:{width:position.width,height:position.height,position:"absolute",...position.absolute.left?{left:0}:{right:0},...position.absolute.top?{top:0}:{bottom:0}},children:Component?jsxRuntimeExports.jsx(Component,{...layerProps}):null})}):null}),FloatDom=__name(({unitId})=>{var _a19,_b;const instanceService=core.useDependency(core.IUniverInstanceService),domLayerService=core.useDependency(CanvasFloatDomService),layers=useObservable(domLayerService.domLayers$),currentUnitId=unitId||((_a19=instanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET))==null?void 0:_a19.getUnitId());return(_b=layers==null?void 0:layers.filter(layer=>layer[1].unitId===currentUnitId))==null?void 0:_b.map(layer=>jsxRuntimeExports.jsx(FloatDomSingle,{id:layer[0],layer:layer[1]},layer[0]))},"FloatDom"),ICanvasPopupService=core.createIdentifier("ui.popup.service"),_CanvasPopupService=class _CanvasPopupService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_popupMap",new Map);__publicField(this,"_popups$",new rxjs.BehaviorSubject([]));__publicField(this,"popups$",this._popups$.asObservable());__publicField(this,"_activePopupId",null)}get popups(){return Array.from(this._popupMap.entries())}get activePopupId(){return this._activePopupId}_update(){this._popups$.next(Array.from(this._popupMap.entries()))}dispose(){super.dispose(),this._popups$.next([]),this._popups$.complete(),this._popupMap.clear()}addPopup(item){const id=core.Tools.generateRandomId();return this._popupMap.set(id,{...item,onPointerEnter:__name(()=>{this._activePopupId=id},"onPointerEnter"),onPointerLeave:__name(()=>{this._activePopupId===id&&(this._activePopupId=null)},"onPointerLeave")}),this._update(),id}removePopup(id){this._popupMap.delete(id)&&this._update()}removeAll(){this._popupMap.clear(),this._update()}};__name(_CanvasPopupService,"CanvasPopupService");let CanvasPopupService=_CanvasPopupService;const SingleCanvasPopup=__name(({popup,children})=>{const[hidden,setHidden]=React.useState(!1),anchorRect$=React.useMemo(()=>popup.anchorRect$.pipe(rxjs.throttleTime(0,rxjs.animationFrameScheduler)),[popup.anchorRect$]),excludeRects$=React.useMemo(()=>{var _a19;return(_a19=popup.excludeRects$)==null?void 0:_a19.pipe(rxjs.throttleTime(0,rxjs.animationFrameScheduler))},[popup.excludeRects$]),anchorRect=useObservable(anchorRect$,popup.anchorRect),excludeRects=useObservable(excludeRects$,popup.excludeRects),{offset,canvasElement,hideOnInvisible=!0,hiddenType="destroy"}=popup,rectWithOffset=React.useMemo(()=>{if(!anchorRect)return null;const{bottom,left,right,top}=anchorRect,[x=0,y=0]=offset!=null?offset:[];return{left:left-x,right:right+x,top:top-y,bottom:bottom+y}},[anchorRect,offset]);return React.useEffect(()=>{if(!hideOnInvisible||!rectWithOffset)return;const rect=canvasElement.getBoundingClientRect(),{top,left,bottom,right}=rect;rectWithOffset.bottom<top||rectWithOffset.top>bottom||rectWithOffset.right<left||rectWithOffset.left>right?setHidden(!0):setHidden(!1)},[rectWithOffset,canvasElement,hideOnInvisible]),hidden&&hiddenType==="destroy"||!rectWithOffset?null:jsxRuntimeExports.jsx(design.RectPopup,{hidden,anchorRect:rectWithOffset,direction:popup.direction,onClickOutside:popup.onClickOutside,excludeOutside:popup.excludeOutside,excludeRects,onPointerEnter:popup.onPointerEnter,onPointerLeave:popup.onPointerLeave,onClick:popup.onClick,onContextMenu:popup.onContextMenu,children})},"SingleCanvasPopup");function CanvasPopup(){const popupService=core.useDependency(ICanvasPopupService),componentManager=core.useDependency(ComponentManager);return useObservable(popupService.popups$,void 0,!0).map(item=>{const[key,popup]=item,Component=componentManager.get(popup.componentKey);return jsxRuntimeExports.jsx(SingleCanvasPopup,{popup,children:Component?jsxRuntimeExports.jsx(Component,{popup}):null},key)})}__name(CanvasPopup,"CanvasPopup");function ComponentContainer(props){const{components,fallback,sharedProps}=props;return!components||components.size===0?fallback!=null?fallback:null:Array.from(components.values()).map((component,index)=>{var _a19;return React.createElement(component,{key:`${(_a19=component.displayName)!=null?_a19:index}`,...sharedProps})})}__name(ComponentContainer,"ComponentContainer");function useComponentsOfPart(part,injector){var _a19;const uiPartsService=(_a19=injector==null?void 0:injector.get(IUIPartsService))!=null?_a19:core.useDependency(IUIPartsService),updateCounterRef=React.useRef(0),componentPartUpdateCount=useObservable(()=>uiPartsService.componentRegistered$.pipe(rxjs.filter(key=>key===part),rxjs.debounceTime(200),rxjs.map(()=>updateCounterRef.current+=1),rxjs.startWith(updateCounterRef.current+=1)),void 0,void 0,[uiPartsService,part]);return React.useMemo(()=>uiPartsService.getComponents(part),[componentPartUpdateCount])}__name(useComponentsOfPart,"useComponentsOfPart");const IContextMenuService=core.createIdentifier("ui.contextmenu.service"),_ContextMenuService=class _ContextMenuService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_currentHandler",null);__publicField(this,"disabled",!1)}get visible(){var _a19,_b;return(_b=(_a19=this._currentHandler)==null?void 0:_a19.visible)!=null?_b:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(event,menuType){var _a19;event.stopPropagation(),!this.disabled&&((_a19=this._currentHandler)==null||_a19.handleContextMenu(event,menuType))}hideContextMenu(){var _a19;(_a19=this._currentHandler)==null||_a19.hideContextMenu()}registerContextMenuHandler(handler){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=handler,core.toDisposable(()=>this._currentHandler=null)}};__name(_ContextMenuService,"ContextMenuService");let ContextMenuService=_ContextMenuService;function DesktopContextMenu(){const contentRef=React.useRef(null),[visible,setVisible]=React.useState(!1),[menuType,setMenuType]=React.useState(""),[offset,setOffset]=React.useState([0,0]),visibleRef=React.useRef(visible),contextMenuService=core.useDependency(IContextMenuService),commandService=core.useDependency(core.ICommandService),injector=core.useInjector();visibleRef.current=visible,React.useEffect(()=>{const disposables=contextMenuService.registerContextMenuHandler({handleContextMenu,hideContextMenu(){setVisible(!1)},get visible(){return visibleRef.current}});function handleClickOutside(event){contentRef.current&&!contentRef.current.contains(event.target)&&handleClose()}return __name(handleClickOutside,"handleClickOutside"),document.addEventListener("pointerdown",handleClickOutside),document.addEventListener("wheel",handleClose),()=>{document.removeEventListener("pointerdown",handleClickOutside),document.removeEventListener("wheel",handleClose),disposables.dispose()}},[contextMenuService]);function handleContextMenu(event,menuType2){setVisible(!1),requestAnimationFrame(()=>{setMenuType(menuType2),setOffset([event.clientX,event.clientY]),setVisible(!0)})}__name(handleContextMenu,"handleContextMenu");function handleClose(){setVisible(!1)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx(design.Popup,{visible,offset,children:jsxRuntimeExports.jsx("section",{ref:contentRef,children:menuType&&jsxRuntimeExports.jsx(Menu,{menuType,onOptionSelect:__name(params=>{const{label:id,commandId,value}=params;commandService&&commandService.executeCommand(commandId!=null?commandId:id,{value}),injector.get(ILayoutService).focus(),setVisible(!1)},"onOptionSelect")})})})}__name(DesktopContextMenu,"DesktopContextMenu");const toolbarBtn="univer-toolbar-btn",toolbarBtnActive="univer-toolbar-btn-active",styles$8={toolbarBtn,toolbarBtnActive};function ToolbarButton(props){const{children,className,style:style2,disabled=!1,active=!1,onClick,onDoubleClick,...restProps}=props,handleClick=__name(e2=>{if(disabled){e2.preventDefault();return}onClick&&onClick(e2)},"handleClick"),handleDoubleClick=__name(e2=>{if(disabled){e2.preventDefault();return}onDoubleClick&&onDoubleClick(e2)},"handleDoubleClick"),_className=clsx$1(styles$8.toolbarBtn,{[`${styles$8.toolbarBtn}-active`]:active},className);return jsxRuntimeExports.jsx("button",{className:_className,style:style2,disabled,onClick:handleClick,onDoubleClick:handleDoubleClick,...restProps,children})}__name(ToolbarButton,"ToolbarButton");const headerbar="univer-headerbar",headerMenu="univer-header-menu",menubar="univer-menubar",menubarItem="univer-menubar-item",menubarItemActive="univer-menubar-item-active",toolbar="univer-toolbar",toolbarContainer="univer-toolbar-container",toolbarMore="univer-toolbar-more",toolbarMoreContainer="univer-toolbar-more-container",toolbarGroup="univer-toolbar-group",toolbarItemSelectButton="univer-toolbar-item-select-button",toolbarItemSelectButtonDisabled="univer-toolbar-item-select-button-disabled",toolbarItemSelectButtonActivated="univer-toolbar-item-select-button-activated",toolbarItemSelectButtonLabel="univer-toolbar-item-select-button-label",toolbarItemSelectButtonArrow="univer-toolbar-item-select-button-arrow",toolbarItemSelect="univer-toolbar-item-select",toolbarItemSelectDisabled="univer-toolbar-item-select-disabled",toolbarItemSelectActivated="univer-toolbar-item-select-activated",toolbarItemSelectArrow="univer-toolbar-item-select-arrow",toolbarItemSelectArrowDisabled="univer-toolbar-item-select-arrow-disabled",toolbarItemSelectArrowActivated="univer-toolbar-item-select-arrow-activated",styles$7={headerbar,headerMenu,menubar,menubarItem,menubarItemActive,toolbar,toolbarContainer,toolbarMore,toolbarMoreContainer,toolbarGroup,toolbarItemSelectButton,toolbarItemSelectButtonDisabled,toolbarItemSelectButtonActivated,toolbarItemSelectButtonLabel,toolbarItemSelectButtonArrow,toolbarItemSelect,toolbarItemSelectDisabled,toolbarItemSelectActivated,toolbarItemSelectArrow,toolbarItemSelectArrowDisabled,toolbarItemSelectArrowActivated};var __defProp$b=Object.defineProperty,__getOwnPropDesc$b=Object.getOwnPropertyDescriptor,__decorateClass$b=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$b(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$b(target,key,result),result},"__decorateClass$b"),__decorateParam$b=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$b");const IMenuService=core.createIdentifier("univer.menu-service");var _a7;exports.MenuService=(_a7=class extends core.Disposable{constructor(_shortcutService,_menuManagerService,_logService){super();__publicField(this,"_menuItemMap",new Map);__publicField(this,"_menuByPositions",new Map);__publicField(this,"_menuConfigs",new Map);__publicField(this,"_menuChanged$",new rxjs.BehaviorSubject(void 0));__publicField(this,"menuChanged$",this._menuChanged$.asObservable());this._shortcutService=_shortcutService,this._menuManagerService=_menuManagerService,this._logService=_logService}dispose(){this._menuItemMap.clear(),this._menuChanged$.complete()}addMenuItem(item,config){if(this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.has(item.id))throw new Error(`Menu item with the same id ${item.id} has already been added!`);const menuItemConfig=config==null?void 0:config[item.id];return this._menuItemMap.set(item.id,mergeMenuConfigs(item,menuItemConfig)),Array.isArray(item.positions)?item.positions.forEach(menu=>this._appendMenuToPosition(item,menu)):item.positions&&this._appendMenuToPosition(item,item.positions),[MenuPosition.TOOLBAR_START,MenuPosition.TOOLBAR_INSERT,MenuPosition.TOOLBAR_FORMULAS,MenuPosition.TOOLBAR_DATA,MenuPosition.TOOLBAR_VIEW,MenuPosition.TOOLBAR_OTHERS,MenuPosition.CONTEXT_MENU].forEach(position=>{position!==MenuPosition.CONTEXT_MENU?this.getMenuItems(position).forEach(menu=>{var _a19;this._menuManagerService.mergeMenu({[position]:{[(_a19=menu.group)!=null?_a19:RibbonOthersGroup.OTHERS]:{[menu.id]:{menuItemFactory:__name(()=>menu,"menuItemFactory")}}}})}):this.getMenuItems(position).forEach(menu=>{var _a19;this._menuManagerService.mergeMenu({[position]:{[(_a19=menu.group)!=null?_a19:ContextMenuGroup.OTHERS]:{[menu.id]:{menuItemFactory:__name(()=>menu,"menuItemFactory")}}}})})}),this._menuChanged$.next(),core.toDisposable(()=>{if(this._menuItemMap.delete(item.id),Array.isArray(item.positions))item.positions.forEach(menu=>{const menus=this._menuByPositions.get(menu);if(!menus)return;const index=menus.findIndex(m2=>m2[0]===item.id);index>-1&&menus.splice(index,1)});else if(item.positions){const menus=this._menuByPositions.get(item.positions);if(!menus)return;const index=menus.findIndex(m2=>m2[0]===item.id);index>-1&&menus.splice(index,1)}this._menuChanged$.next()})}getMenuItems(positions){if(this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(positions)){const menuItems=this._menuByPositions.get(positions);if(menuItems)return[...menuItems.values()].map(menu=>this._getDisplayMenuItems(menu[1]))}return[]}setMenuItem(item){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.set(item.id,item),Array.isArray(item.positions)?item.positions.forEach(menu=>this._updateMenuItems(item,menu)):item.positions&&this._updateMenuItems(item,item.positions),this._menuChanged$.next()}getMenuItem(id){return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.has(id)?this._menuItemMap.get(id):null}setMenuConfigs(id,config){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuConfigs.set(id,config)}getMenuConfig(id){return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuConfigs.has(id)?this._menuConfigs.get(id):null}_getDisplayMenuItems(menuItem){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead.");const shortcut=this._shortcutService.getShortcutDisplayOfCommand(menuItem.id);return shortcut?{...menuItem,shortcut}:menuItem}_appendMenuToPosition(menu,position){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(position)||this._menuByPositions.set(position,[]);const menuList=this._menuByPositions.get(position);if(menuList.findIndex(m2=>m2[0]===menu.id)>-1)throw new Error(`Menu item with the same id ${menu.id} has already been added!`);menuList.push([menu.id,menu])}_updateMenuItems(menu,position){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(position)||this._menuByPositions.set(position,[]);const menuList=this._menuByPositions.get(position),index=menuList.findIndex(m2=>m2[0]===menu.id);index>-1?menuList[index]=[menu.id,menu]:menuList.push([menu.id,menu])}},__name(_a7,"MenuService"),_a7);exports.MenuService=__decorateClass$b([__decorateParam$b(0,IShortcutService),__decorateParam$b(1,IMenuManagerService),__decorateParam$b(2,core.ILogService)],exports.MenuService);function useSimpleToolbarGroups(category){const menuService=core.useDependency(IMenuService),[visibleItems,setVisibleItems]=React.useState([]);return React.useEffect(()=>{const s=menuService.menuChanged$.subscribe(()=>{const menuItems=menuService.getMenuItems(category);setVisibleItems(menuItems)});return()=>s.unsubscribe()},[menuService,category]),visibleItems}__name(useSimpleToolbarGroups,"useSimpleToolbarGroups");function useToolbarGroups(categories,initCategory){const menuService=core.useDependency(IMenuService),[category,setCategory]=React.useState(initCategory!=null?initCategory:MenuPosition.TOOLBAR_START),[groups,setGroups]=React.useState([]),[visibleItems,setVisibleItems]=React.useState([]);React.useEffect(()=>{var _a19,_b;const activeItems=(_b=(_a19=groups.find(g2=>g2.name===category))==null?void 0:_a19.menuItems)!=null?_b:[],s=rxjs.combineLatest(activeItems.map(item=>{var _a20;return(_a20=item.hidden$)!=null?_a20:new rxjs.Observable(observer=>observer.next(!1))})).pipe(rxjs.map(hiddenValues=>activeItems.filter((_,index)=>!hiddenValues[index]))).subscribe(items=>setVisibleItems(items));return()=>s.unsubscribe()},[groups,category]),React.useEffect(()=>{const s=menuService.menuChanged$.subscribe(()=>{const group=[];for(const position of categories){const menuItems=menuService.getMenuItems(position);menuItems.length&&group.push({name:position,menuItems})}setGroups(group)});return()=>s.unsubscribe()},[menuService,category,categories]);const groupsByKey=React.useMemo(()=>{var _a19,_b;return(_b=(_a19=groups.find(g2=>g2.name===category))==null?void 0:_a19.menuItems.reduce((acc,item)=>{var _a20;const key=(_a20=item.group)!=null?_a20:MenuGroup.TOOLBAR_OTHERS;return acc[key]||(acc[key]=[]),acc[key].push(item),acc},{}))!=null?_b:{}},[groups,category]);return{setCategory,category,visibleItems,groups,groupsByKey}}__name(useToolbarGroups,"useToolbarGroups");function useToolbarItemStatus(menuItem){const{disabled$,hidden$,activated$,value$}=menuItem,[value,setValue]=React.useState(),[disabled,setDisabled]=React.useState(!1),[activated,setActivated]=React.useState(!1),[hidden,setHidden]=React.useState(!1);return React.useEffect(()=>{const subscriptions=[];return disabled$&&subscriptions.push(disabled$.subscribe(disabled2=>setDisabled(disabled2))),hidden$&&subscriptions.push(hidden$.subscribe(hidden2=>setHidden(hidden2))),activated$&&subscriptions.push(activated$.subscribe(activated2=>setActivated(activated2))),value$&&subscriptions.push(value$.subscribe(value2=>setValue(value2))),()=>subscriptions.forEach(subscription=>subscription.unsubscribe())},[activated$,disabled$,hidden$,value$]),{disabled,value,activated,hidden}}__name(useToolbarItemStatus,"useToolbarItemStatus");const TooltipWrapperContext=React.createContext({dropdownVisible:!1,setDropdownVisible:__name(_visible=>{},"setDropdownVisible")}),TooltipWrapper=React.forwardRef((props,ref)=>{const{children,...tooltipProps}=props,[tooltipVisible,setTooltipVisible]=React.useState(!1),[dropdownVisible,setDropdownVisible]=React.useState(!1);function handleChangeTooltipVisible(visible){setTooltipVisible(dropdownVisible?!1:visible)}__name(handleChangeTooltipVisible,"handleChangeTooltipVisible");function handleChangeDropdownVisible(visible){setDropdownVisible(visible),setTooltipVisible(!1)}__name(handleChangeDropdownVisible,"handleChangeDropdownVisible");const contextValue=React.useMemo(()=>({dropdownVisible,setDropdownVisible:handleChangeDropdownVisible}),[dropdownVisible]);return jsxRuntimeExports.jsx(design.Tooltip,{ref,...tooltipProps,visible:tooltipVisible,onVisibleChange:handleChangeTooltipVisible,children:jsxRuntimeExports.jsx("span",{children:jsxRuntimeExports.jsx(TooltipWrapperContext.Provider,{value:contextValue,children})})})});function DropdownWrapper(props){const{children,...dropdownProps}=props,{setDropdownVisible}=React.useContext(TooltipWrapperContext);function handleVisibleChange(visible){setDropdownVisible(visible)}return __name(handleVisibleChange,"handleVisibleChange"),jsxRuntimeExports.jsx(design.Dropdown,{onVisibleChange:handleVisibleChange,...dropdownProps,children:jsxRuntimeExports.jsx("div",{onClick:__name(e2=>e2.stopPropagation(),"onClick"),children})})}__name(DropdownWrapper,"DropdownWrapper");const ToolbarItem=React.forwardRef((props,ref)=>{const{align}=props,localeService=core.useDependency(core.LocaleService),commandService=core.useDependency(core.ICommandService),layoutService=core.useDependency(ILayoutService),componentManager=core.useDependency(ComponentManager),{value,hidden,disabled,activated}=useToolbarItemStatus(props),executeCommand=__name((commandId2,params)=>{layoutService.focus(),commandService.executeCommand(commandId2,params)},"executeCommand"),{tooltip,shortcut,icon,title,label,id,commandId}=props,tooltipTitle=localeService.t(tooltip!=null?tooltip:"")+(shortcut?` (${shortcut})`:""),{selections}=props,selections$=React.useMemo(()=>rxjs.isObservable(selections)?selections:new rxjs.Observable(subscribe=>{subscribe.next(selections)}),[selections]),options=useObservable(selections$),icon$=React.useMemo(()=>rxjs.isObservable(icon)?icon:new rxjs.Observable(subscribe=>{var _a19,_b;const v2=(_b=(_a19=options==null?void 0:options.find(o=>o.value===value))==null?void 0:_a19.icon)!=null?_b:icon;subscribe.next(v2)}),[icon,options,value]),iconToDisplay=useObservable(icon$,void 0,!0);function renderSelectorType(menuType){var _a19;const selectionsCommandId=props.selectionsCommandId,bId=commandId!=null?commandId:id,sId=(_a19=selectionsCommandId!=null?selectionsCommandId:commandId)!=null?_a19:id;function handleSelect(option){if(disabled)return;let commandId2=sId;option.id&&(commandId2=option.id),executeCommand(commandId2,{value:option.value})}__name(handleSelect,"handleSelect");function handleSelectionsValueChange(value2){disabled||executeCommand(sId,{value:value2})}__name(handleSelectionsValueChange,"handleSelectionsValueChange");function handleClick(){disabled||menuType===MenuItemType.BUTTON_SELECTOR&&executeCommand(bId,{value})}return __name(handleClick,"handleClick"),menuType===MenuItemType.BUTTON_SELECTOR?jsxRuntimeExports.jsxs("div",{className:clsx$1(styles$7.toolbarItemSelectButton,{[styles$7.toolbarItemSelectButtonDisabled]:disabled,[styles$7.toolbarItemSelectButtonActivated]:activated}),"data-disabled":disabled,children:[jsxRuntimeExports.jsx("div",{className:styles$7.toolbarItemSelectButtonLabel,onClick:handleClick,children:jsxRuntimeExports.jsx(CustomLabel,{icon:iconToDisplay,title,value,label,onChange:handleSelectionsValueChange})}),jsxRuntimeExports.jsx(DropdownWrapper,{disabled,align:align!=null?align:{targetOffset:[32,-12]},overlay:jsxRuntimeExports.jsx(Menu,{overViewport:"scroll",menuType:id,options,onOptionSelect:handleSelect,value}),children:jsxRuntimeExports.jsx("div",{className:clsx$1(styles$7.toolbarItemSelectButtonArrow,{[styles$7.toolbarItemSelectButtonArrowDisabled]:disabled,[styles$7.toolbarItemSelectButtonArrowActivated]:activated}),"data-disabled":disabled,children:jsxRuntimeExports.jsx(MoreDownSingle,{style:{height:"100%"}})})})]}):jsxRuntimeExports.jsx(DropdownWrapper,{disabled,overlay:jsxRuntimeExports.jsx(Menu,{overViewport:"scroll",menuType:id,options,onOptionSelect:handleSelect,value}),children:jsxRuntimeExports.jsxs("div",{className:clsx$1(styles$7.toolbarItemSelect,{[styles$7.toolbarItemSelectDisabled]:disabled,[styles$7.toolbarItemSelectActivated]:activated}),children:[jsxRuntimeExports.jsx(CustomLabel,{icon:iconToDisplay,title,value,label,onChange:handleSelectionsValueChange}),jsxRuntimeExports.jsx("div",{className:clsx$1(styles$7.toolbarItemSelectArrow,{[styles$7.toolbarItemSelectArrowDisabled]:disabled}),children:jsxRuntimeExports.jsx(MoreDownSingle,{})})]})})}__name(renderSelectorType,"renderSelectorType");function renderButtonType(){var _a19;const isCustomComponent=componentManager.get(typeof label=="string"?label:(_a19=label==null?void 0:label.name)!=null?_a19:"");return jsxRuntimeExports.jsx("span",{children:jsxRuntimeExports.jsx(ToolbarButton,{className:styles$7.toolbarItemTextButton,active:activated,disabled,onClick:__name(()=>{var _a20;return executeCommand((_a20=props.commandId)!=null?_a20:props.id)},"onClick"),onDoubleClick:__name(()=>props.subId&&executeCommand(props.subId),"onDoubleClick"),children:isCustomComponent?jsxRuntimeExports.jsx(CustomLabel,{title,value,label}):jsxRuntimeExports.jsx(CustomLabel,{icon})})})}__name(renderButtonType,"renderButtonType");function renderItem(){switch(props.type){case MenuItemType.BUTTON_SELECTOR:case MenuItemType.SELECTOR:case MenuItemType.SUBITEMS:return renderSelectorType(props.type);case MenuItemType.BUTTON:default:return renderButtonType()}}return __name(renderItem,"renderItem"),!hidden&&jsxRuntimeExports.jsx(TooltipWrapper,{ref,title:tooltipTitle,placement:"bottom",children:renderItem()})});function Ribbon(props){const{headerMenuComponents}=props,menuManagerService=core.useDependency(IMenuManagerService),localeService=core.useDependency(core.LocaleService),toolbarRef=React.useRef(null),toolbarItemRefs=React.useRef({}),[ribbon,setRibbon]=React.useState([]),[category,setCategory]=React.useState(RibbonPosition.START),[collapsedIds,setCollapsedIds]=React.useState([]);React.useEffect(()=>{function getRibbon(){const ribbon2=menuManagerService.getMenuByPositionKey(MenuManagerPosition.RIBBON);setRibbon(ribbon2)}__name(getRibbon,"getRibbon"),getRibbon();const subscription=menuManagerService.menuChanged$.subscribe(getRibbon);return()=>{subscription.unsubscribe()}},[menuManagerService]),React.useEffect(()=>{const observer=new ResizeObserver(entries=>{const toolbarWidth=entries[0].target.clientWidth,toolbarItems=Object.values(toolbarItemRefs.current),collapsedIds2=[];let totalWidth=90;for(const{el,key}of toolbarItems)el&&(totalWidth+=el.clientWidth+8,totalWidth>toolbarWidth&&collapsedIds2.push(key));setCollapsedIds(collapsedIds2)});return toolbarRef.current&&observer.observe(toolbarRef.current),()=>{observer.disconnect()}},[ribbon]);const hasHeaderMenu=React.useMemo(()=>headerMenuComponents&&headerMenuComponents.size>0||ribbon.length>1,[headerMenuComponents,ribbon]),activeGroup=React.useMemo(()=>{var _a19,_b;const allGroups=(_b=(_a19=ribbon.find(group=>group.key===category))==null?void 0:_a19.children)!=null?_b:[],visibleGroups=[],hiddenGroups=[];for(const item of allGroups)if(item.children){const visibleChildren=item.children.filter(child=>!collapsedIds.includes(child.key));visibleGroups.push({...item,children:visibleChildren}),visibleChildren.length<item.children.length&&hiddenGroups.push({...item,children:item.children.filter(child=>collapsedIds.includes(child.key))})}return{allGroups,visibleGroups,hiddenGroups}},[ribbon,category,collapsedIds]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[hasHeaderMenu&&jsxRuntimeExports.jsxs("header",{className:styles$7.headerbar,children:[jsxRuntimeExports.jsx("div",{className:styles$7.menubar,children:ribbon.length>1&&ribbon.map(group=>jsxRuntimeExports.jsx("a",{className:clsx$1(styles$7.menubarItem,{[styles$7.menubarItemActive]:group.key===category}),onClick:__name(()=>{setCategory(group.key)},"onClick"),children:localeService.t(group.key)},group.key))}),jsxRuntimeExports.jsx("div",{className:styles$7.headerMenu,children:jsxRuntimeExports.jsx(ComponentContainer,{components:headerMenuComponents})})]}),jsxRuntimeExports.jsx("section",{role:"ribbon",className:styles$7.toolbar,children:jsxRuntimeExports.jsxs("div",{className:styles$7.toolbarContainer,children:[activeGroup.visibleGroups.map(groupItem=>{var _a19,_b;return(((_a19=groupItem.children)==null?void 0:_a19.length)||groupItem.item)&&jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:groupItem.children?(_b=groupItem.children)==null?void 0:_b.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{...child.item},child.key)):groupItem.item&&jsxRuntimeExports.jsx(ToolbarItem,{...groupItem.item},groupItem.key)},groupItem.key)}),collapsedIds.length>0&&jsxRuntimeExports.jsx(TooltipWrapper,{title:localeService.t("ribbon.more"),placement:"bottom",children:jsxRuntimeExports.jsx(DropdownWrapper,{forceRender:!0,overlay:jsxRuntimeExports.jsx("div",{className:styles$7.toolbarMoreContainer,children:activeGroup.hiddenGroups.map(groupItem=>{var _a19;return jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:groupItem.children?(_a19=groupItem.children)==null?void 0:_a19.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{...child.item},child.key)):groupItem.item&&jsxRuntimeExports.jsx(ToolbarItem,{...groupItem.item},groupItem.key)},groupItem.key)})}),children:jsxRuntimeExports.jsx(ToolbarButton,{className:styles$7.toolbarItemTextButton,children:jsxRuntimeExports.jsx(MoreFunctionSingle,{})})})})]})}),jsxRuntimeExports.jsx("div",{ref:toolbarRef,className:styles$7.toolbarContainer,style:{position:"absolute",top:-9999,left:-9999,opacity:0},children:activeGroup.allGroups.map(groupItem=>{var _a19;return jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:(_a19=groupItem.children)==null?void 0:_a19.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{ref:__name(ref=>{toolbarItemRefs.current[child.key]={el:ref==null?void 0:ref.nativeElement,key:child.key}},"ref"),...child.item},child.key))},groupItem.key)})})]})}__name(Ribbon,"Ribbon");const sidebar="univer-sidebar",sidebarOpen="univer-sidebar-open",sidebarContainer="univer-sidebar-container",sidebarHeader="univer-sidebar-header",sidebarHeaderClose="univer-sidebar-header-close",sidebarBody="univer-sidebar-body",sidebarFooter="univer-sidebar-footer",styles$6={sidebar,sidebarOpen,sidebarContainer,sidebarHeader,sidebarHeaderClose,sidebarBody,sidebarFooter};function Sidebar(){const sidebarService=core.useDependency(ISidebarService),sidebarOptions=useObservable(sidebarService.sidebarOptions$),scrollRef=React.useRef(null),options=React.useMemo(()=>{if(!sidebarOptions)return null;const copy={...sidebarOptions};for(const key of["children","header","footer"]){const k2=key;if(sidebarOptions[k2]){const props=sidebarOptions[k2];props&&(copy[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props}))}}return copy},[sidebarOptions]);React.useEffect(()=>{const handleScroll=__name(e2=>{sidebarService.scrollEvent$.next(e2)},"handleScroll"),scrollElement=scrollRef.current;return scrollElement&&scrollElement.addEventListener("scroll",handleScroll),()=>{scrollElement==null||scrollElement.removeEventListener("scroll",handleScroll)}},[sidebarService]);const _className=clsx$1(styles$6.sidebar,{[styles$6.sidebarOpen]:options==null?void 0:options.visible}),width=React.useMemo(()=>options!=null&&options.visible?typeof options.width=="number"?`${options.width}px`:options.width:0,[options]);function handleClose(){var _a19;const options2={...sidebarOptions,visible:!1};sidebarService.sidebarOptions$.next(options2),(_a19=options2==null?void 0:options2.onClose)==null||_a19.call(options2)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx("section",{className:_className,style:{width},children:jsxRuntimeExports.jsxs("section",{className:styles$6.sidebarContainer,ref:scrollRef,children:[jsxRuntimeExports.jsxs("header",{className:styles$6.sidebarHeader,children:[options==null?void 0:options.header,jsxRuntimeExports.jsx("a",{className:styles$6.sidebarHeaderClose,onClick:handleClose,children:jsxRuntimeExports.jsx(CloseSingle,{})})]}),jsxRuntimeExports.jsx("section",{className:styles$6.sidebarBody,style:options==null?void 0:options.bodyStyle,children:options==null?void 0:options.children}),(options==null?void 0:options.footer)&&jsxRuntimeExports.jsx("footer",{className:styles$6.sidebarFooter,children:options.footer})]})})}__name(Sidebar,"Sidebar");const IZenZoneService=core.createIdentifier("univer.zen-zone-service"),zenZone="univer-zen-zone",zenZoneOpen="univer-zen-zone-open",zenZoneClose="univer-zen-zone-close",styles$5={zenZone,zenZoneOpen,zenZoneClose};function ZenZone(){const zenZoneService=core.useDependency(IZenZoneService),[visible,setVisible]=React.useState(!1),[componentKey,setComponentKey]=React.useState(),hidden=core.useObservable(zenZoneService.temporaryHidden$),componentManager=core.useDependency(ComponentManager);React.useEffect(()=>{const subscriptions=[zenZoneService.visible$.subscribe(visible2=>{setVisible(visible2)}),zenZoneService.componentKey$.subscribe(componentKey2=>{setComponentKey(componentKey2)})];return()=>{subscriptions.forEach(subscription=>{subscription.unsubscribe()})}},[]);const _className=clsx$1(styles$5.zenZone,visible?styles$5.zenZoneOpen:styles$5.zenZoneClose),Component=React.useMemo(()=>{const Component2=componentManager.get(componentKey!=null?componentKey:"");if(Component2)return Component2},[componentKey]);return jsxRuntimeExports.jsx("section",{style:hidden?{display:"none"}:void 0,className:_className,children:Component&&jsxRuntimeExports.jsx(Component,{})})}__name(ZenZone,"ZenZone");const IGlobalZoneService=core.createIdentifier("univer.global-zone-service"),globalZone="univer-global-zone",globalZoneOpen="univer-global-zone-open",globalZoneClose="univer-global-zone-close",styles$4={globalZone,globalZoneOpen,globalZoneClose};function GlobalZone(){const globalZoneService=core.useDependency(IGlobalZoneService),[visible,setVisible]=React.useState(!1),componentKey=useObservable(globalZoneService.componentKey$,globalZoneService.componentKey),componentManager=core.useDependency(ComponentManager),_className=clsx$1(styles$4.globalZone,styles$4.globalZoneOpen),Component=React.useMemo(()=>{const Component2=componentManager.get(componentKey!=null?componentKey:"");if(Component2)return Component2},[componentKey,componentManager]);return React.useEffect(()=>{const subscription=globalZoneService.visible$.subscribe(val=>{setVisible(val)});return()=>{subscription.unsubscribe()}},[globalZoneService.visible$]),visible?jsxRuntimeExports.jsx("section",{className:_className,children:Component&&jsxRuntimeExports.jsx(Component,{})}):null}__name(GlobalZone,"GlobalZone");const builtInGlobalComponents=new Set([GlobalZone]),workbenchLayout="univer-workbench-layout",workbenchContainer="univer-workbench-container",workbenchContainerHeader="univer-workbench-container-header",workbenchContainerWrapper="univer-workbench-container-wrapper",workbenchContainerContent="univer-workbench-container-content",workbenchContainerDocContent="univer-workbench-container-doc-content",workbenchContainerCanvas="univer-workbench-container-canvas",workbenchContainerLeftSidebar="univer-workbench-container-left-sidebar",workbenchContainerSidebar="univer-workbench-container-sidebar",styles$3={workbenchLayout,workbenchContainer,workbenchContainerHeader,workbenchContainerWrapper,workbenchContainerContent,workbenchContainerDocContent,workbenchContainerCanvas,workbenchContainerLeftSidebar,workbenchContainerSidebar};function DesktopWorkbench(props){const{header=!0,toolbar:toolbar2=!0,footer=!0,contextMenu=!0,mountContainer,onRendered}=props,localeService=core.useDependency(core.LocaleService),themeService=core.useDependency(core.ThemeService),messageService=core.useDependency(IMessageService),instanceService=core.useDependency(core.IUniverInstanceService),contentRef=React.useRef(null),footerComponents=useComponentsOfPart(BuiltInUIPart.FOOTER),headerComponents=useComponentsOfPart(BuiltInUIPart.HEADER),headerMenuComponents=useComponentsOfPart(BuiltInUIPart.HEADER_MENU),contentComponents=useComponentsOfPart(BuiltInUIPart.CONTENT),leftSidebarComponents=useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR),globalComponents=useComponentsOfPart(BuiltInUIPart.GLOBAL),[focusUnitType,setFocusUnitType]=React.useState(core.UniverInstanceType.UNIVER_UNKNOWN);React.useEffect(()=>{const sub=instanceService.focused$.subscribe(id=>{if(id==null)return;const instanceType=instanceService.getUnitType(id);setFocusUnitType(instanceType)});return()=>{sub.unsubscribe()}},[]),React.useEffect(()=>{themeService.getCurrentTheme()||themeService.setTheme(design.defaultTheme)},[]),React.useEffect(()=>{contentRef.current&&(onRendered==null||onRendered(contentRef.current))},[onRendered]);const[locale,setLocale]=React.useState(localeService.getLocales()),portalContainer=React.useMemo(()=>document.createElement("div"),[]);return React.useEffect(()=>{document.body.appendChild(portalContainer),messageService.setContainer(portalContainer);const subscriptions=[localeService.localeChanged$.subscribe(()=>{setLocale(localeService.getLocales())}),themeService.currentTheme$.subscribe(theme=>{design.themeInstance.setTheme(mountContainer,theme),portalContainer&&design.themeInstance.setTheme(portalContainer,theme)})];return()=>{subscriptions.forEach(subscription=>subscription.unsubscribe()),document.body.removeChild(portalContainer)}},[localeService,messageService,mountContainer,portalContainer,themeService.currentTheme$]),jsxRuntimeExports.jsxs(design.ConfigProvider,{locale:locale==null?void 0:locale.design,mountContainer:portalContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.workbenchLayout,tabIndex:-1,onBlur:__name(e2=>e2.stopPropagation(),"onBlur"),children:[header&&toolbar2&&jsxRuntimeExports.jsx("header",{className:styles$3.workbenchContainerHeader,children:jsxRuntimeExports.jsx(Ribbon,{headerMenuComponents})}),jsxRuntimeExports.jsxs("section",{className:styles$3.workbenchContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.workbenchContainerWrapper,children:[jsxRuntimeExports.jsx("aside",{className:styles$3.workbenchContainerLeftSidebar,children:jsxRuntimeExports.jsx(ComponentContainer,{components:leftSidebarComponents},"left-sidebar")}),jsxRuntimeExports.jsxs("section",{className:clsx$1(styles$3.workbenchContainerContent,{[styles$3.workbenchContainerDocContent]:focusUnitType===core.UniverInstanceType.UNIVER_DOC}),children:[jsxRuntimeExports.jsx("header",{children:header&&jsxRuntimeExports.jsx(ComponentContainer,{components:headerComponents},"header")}),jsxRuntimeExports.jsx("section",{className:styles$3.workbenchContainerCanvas,ref:contentRef,"data-range-selector":!0,onContextMenu:__name(e2=>e2.preventDefault(),"onContextMenu"),children:jsxRuntimeExports.jsx(ComponentContainer,{components:contentComponents},"content")})]}),jsxRuntimeExports.jsx("aside",{className:styles$3.workbenchContainerSidebar,children:jsxRuntimeExports.jsx(Sidebar,{})})]}),footer&&jsxRuntimeExports.jsx("footer",{className:styles$3.workbenchFooter,children:jsxRuntimeExports.jsx(ComponentContainer,{components:footerComponents,sharedProps:{contextMenu}},"footer")}),jsxRuntimeExports.jsx(ZenZone,{})]})]}),jsxRuntimeExports.jsx(ComponentContainer,{components:globalComponents},"global"),jsxRuntimeExports.jsx(ComponentContainer,{components:builtInGlobalComponents},"built-in-global"),contextMenu&&jsxRuntimeExports.jsx(DesktopContextMenu,{}),jsxRuntimeExports.jsx(FloatingContainer,{})]})}__name(DesktopWorkbench,"DesktopWorkbench");function FloatingContainer(){const{mountContainer}=React.useContext(design.ConfigContext),floatingComponents=useComponentsOfPart(BuiltInUIPart.FLOATING);return ReactDOM$1.createPortal(jsxRuntimeExports.jsx(ComponentContainer,{components:floatingComponents},"floating"),mountContainer)}__name(FloatingContainer,"FloatingContainer");var __defProp$a=Object.defineProperty,__getOwnPropDesc$a=Object.getOwnPropertyDescriptor,__decorateClass$a=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$a(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$a(target,key,result),result},"__decorateClass$a"),__decorateParam$a=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$a");const STEADY_TIMEOUT$1=3e3;var _a8;exports.DesktopUIController=(_a8=class extends core.Disposable{constructor(_config,_renderManagerService,_instanceSrv,_injector,_lifecycleService,_uiPartsService,_menuManagerService,_layoutService){super();__publicField(this,"_steadyTimeout");__publicField(this,"_renderTimeout");this._config=_config,this._renderManagerService=_renderManagerService,this._instanceSrv=_instanceSrv,this._injector=_injector,this._lifecycleService=_lifecycleService,this._uiPartsService=_uiPartsService,this._menuManagerService=_menuManagerService,this._layoutService=_layoutService,this._initBuiltinComponents(),this._initMenus(),this._bootstrapWorkbench()}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_bootstrapWorkbench(){this.disposeWithMe(this._instanceSrv.unitDisposed$.subscribe(_unit=>{clearTimeout(this._steadyTimeout)})),this.disposeWithMe(bootstrap$1(this._injector,this._config,(contentElement,containerElement)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement)),this.disposeWithMe(this._layoutService.registerContentElement(contentElement))),this._renderManagerService.currentRender$.subscribe(renderId=>{if(renderId){const render2=this._renderManagerService.getRenderById(renderId);if(!render2.unitId||core.isInternalEditorID(render2.unitId))return;render2.engine.setContainer(contentElement)}}),this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(rxjs.filter(stage=>stage===core.LifecycleStages.Ready),rxjs.take(1)).subscribe(()=>{this._renderTimeout=setTimeout(()=>{const allRenders=this._renderManagerService.getRenderAll();for(const[key,render2]of allRenders)core.isInternalEditorID(key)||!render2.isRenderUnit||render2.engine.setContainer(contentElement);this._lifecycleService.stage=core.LifecycleStages.Rendered,this._steadyTimeout=setTimeout(()=>{this._lifecycleService.stage=core.LifecycleStages.Steady},STEADY_TIMEOUT$1)},300)}))}))}_initBuiltinComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.FLOATING,()=>core.connectInjector(CanvasPopup,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(FloatDom,this._injector)))}},__name(_a8,"DesktopUIController"),_a8);exports.DesktopUIController=__decorateClass$a([__decorateParam$a(1,engineRender.IRenderManagerService),__decorateParam$a(2,core.IUniverInstanceService),__decorateParam$a(3,core.Inject(core.Injector)),__decorateParam$a(4,core.Inject(core.LifecycleService)),__decorateParam$a(5,IUIPartsService),__decorateParam$a(6,IMenuManagerService),__decorateParam$a(7,core.Optional(ILayoutService))],exports.DesktopUIController);function bootstrap$1(injector,options,callback){let mountContainer;const container=options.container;if(typeof container=="string"){const containerElement=document.getElementById(container);containerElement?mountContainer=containerElement:mountContainer=createContainer$1(container)}else container instanceof HTMLElement?mountContainer=container:mountContainer=createContainer$1("univer");const ConnectedApp=core.connectInjector(DesktopWorkbench,injector),onRendered=__name(contentElement=>callback(contentElement,mountContainer),"onRendered");function render2(){render_2(jsxRuntimeExports.jsx(ConnectedApp,{...options,mountContainer,onRendered}),mountContainer)}return __name(render2,"render"),render2(),core.toDisposable(()=>{render_2(jsxRuntimeExports.jsx("div",{}),mountContainer),setTimeout(()=>render_2(jsxRuntimeExports.jsx("div",{}),mountContainer),200),setTimeout(()=>unmount_1(mountContainer),500)})}__name(bootstrap$1,"bootstrap$1");function createContainer$1(id){const element2=document.createElement("div");return element2.id=id,element2}__name(createContainer$1,"createContainer$1");const appLayout="univer-app-layout",appHeader="univer-app-header",appContainer="univer-app-container",appContainerHeader="univer-app-container-header",appContainerWrapper="univer-app-container-wrapper",appContainerContent="univer-app-container-content",appContainerCanvas="univer-app-container-canvas",appContainerLeftSidebar="univer-app-container-left-sidebar",appContainerSidebar="univer-app-container-sidebar",styles$2={appLayout,appHeader,appContainer,appContainerHeader,appContainerWrapper,appContainerContent,appContainerCanvas,appContainerLeftSidebar,appContainerSidebar},mobileMenuContainer="univer-mobile-menu-container",mobileMenuItem="univer-mobile-menu-item",styles$1={mobileMenuContainer,mobileMenuItem};function MobileMenu(props){const{menuType,onOptionSelect}=props,menuManagerService=core.useDependency(IMenuManagerService);if(!menuType)return null;const flattedMenuItems=React.useMemo(()=>{const menuItems=menuManagerService.getMenuByPositionKey(menuType);function flatMenuItems(items){return items.reduce((acc,item)=>item.children?[...acc,...flatMenuItems(item.children)]:[...acc,item],[])}return __name(flatMenuItems,"flatMenuItems"),flatMenuItems(menuItems)},[menuType]);return jsxRuntimeExports.jsx("div",{className:styles$1.mobileMenuContainer,style:{gridTemplateColumns:`repeat(${Math.min(2,flattedMenuItems.length)}, 48px)`},children:flattedMenuItems.map(item=>item.item&&jsxRuntimeExports.jsx(MobileMenuItem,{menuItem:item.item,onClick:__name(object=>onOptionSelect==null?void 0:onOptionSelect({value:"",label:item.key,...object}),"onClick")},item.key))})}__name(MobileMenu,"MobileMenu");function MobileMenuItem(props){const{menuItem,onClick}=props,{id,type,title,label,icon}=menuItem;if(type!==MenuItemType.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${id}".`);const disabled=core.useObservable(menuItem.disabled$,!1),activated=core.useObservable(menuItem.activated$,!1),hidden=core.useObservable(menuItem.hidden$,!1),value=core.useObservable(menuItem.value$),className=clsx$1(styles$1.mobileMenuItem,{[styles$1.mobileMenuItemActivated]:activated,[styles$1.mobileMenuItemHidden]:hidden});return jsxRuntimeExports.jsx("button",{type:"button",className,disabled,onClick:__name(()=>onClick({id}),"onClick"),children:jsxRuntimeExports.jsx(CustomLabel,{value,title,label,icon})},id)}__name(MobileMenuItem,"MobileMenuItem");function MobileContextMenu(){const[visible,setVisible]=React.useState(!1),[menuType,setMenuType]=React.useState(""),[offset,setOffset]=React.useState([0,0]),visibleRef=React.useRef(visible),contextMenuService=core.useDependency(IContextMenuService),commandService=core.useDependency(core.ICommandService);visibleRef.current=visible,React.useEffect(()=>{const disposables=contextMenuService.registerContextMenuHandler({handleContextMenu,hideContextMenu(){setVisible(!1)},get visible(){return visibleRef.current}});return document.addEventListener("pointerdown",handleClose),document.addEventListener("wheel",handleClose),()=>{document.removeEventListener("pointerdown",handleClose),document.removeEventListener("wheel",handleClose),disposables.dispose()}},[contextMenuService]);function handleContextMenu(event,menuType2){setMenuType(menuType2),setOffset([event.clientX,event.clientY]),setVisible(!0)}__name(handleContextMenu,"handleContextMenu");function handleClose(){setVisible(!1)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx(design.Popup,{visible,offset,children:jsxRuntimeExports.jsx("section",{onPointerDown:__name(e2=>e2.stopPropagation(),"onPointerDown"),children:menuType&&jsxRuntimeExports.jsx(MobileMenu,{menuType,onOptionSelect:__name(params=>{const{label:id,value,commandId}=params;commandService&&commandService.executeCommand(commandId!=null?commandId:id,{value}),setVisible(!1)},"onOptionSelect")})})})}__name(MobileContextMenu,"MobileContextMenu");function MobileApp(props){const{header=!0,footer=!0,contextMenu=!0,mountContainer,onRendered}=props,localeService=core.useDependency(core.LocaleService),themeService=core.useDependency(core.ThemeService),messageService=core.useDependency(IMessageService),contentRef=React.useRef(null),footerComponents=useComponentsOfPart(BuiltInUIPart.FOOTER),headerComponents=useComponentsOfPart(BuiltInUIPart.HEADER);useComponentsOfPart(BuiltInUIPart.HEADER_MENU);const contentComponents=useComponentsOfPart(BuiltInUIPart.CONTENT),leftSidebarComponents=useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR),globalComponents=useComponentsOfPart(BuiltInUIPart.GLOBAL);React.useEffect(()=>{themeService.getCurrentTheme()||themeService.setTheme(design.defaultTheme)},[]),React.useEffect(()=>{contentRef.current&&(onRendered==null||onRendered(contentRef.current))},[onRendered]);const[locale,setLocale]=React.useState(localeService.getLocales()),portalContainer=React.useMemo(()=>document.createElement("div"),[]);return React.useEffect(()=>{document.body.appendChild(portalContainer),messageService.setContainer(portalContainer);const subscriptions=[localeService.localeChanged$.subscribe(()=>{setLocale(localeService.getLocales())}),themeService.currentTheme$.subscribe(theme=>{design.themeInstance.setTheme(mountContainer,theme),portalContainer&&design.themeInstance.setTheme(portalContainer,theme)})];return()=>{subscriptions.forEach(subscription=>subscription.unsubscribe()),document.body.removeChild(portalContainer)}},[localeService,messageService,mountContainer,portalContainer,themeService.currentTheme$]),jsxRuntimeExports.jsxs(design.ConfigProvider,{locale:locale==null?void 0:locale.design,mountContainer:portalContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.appLayout,tabIndex:-1,onBlur:__name(e2=>e2.stopPropagation(),"onBlur"),children:[header&&jsxRuntimeExports.jsx("header",{className:styles$2.appContainerHeader}),jsxRuntimeExports.jsxs("section",{className:styles$2.appContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.appContainerWrapper,children:[jsxRuntimeExports.jsx("aside",{className:styles$2.appContainerLeftSidebar,children:jsxRuntimeExports.jsx(ComponentContainer,{components:leftSidebarComponents},"left-sidebar")}),jsxRuntimeExports.jsxs("section",{className:styles$2.appContainerContent,children:[jsxRuntimeExports.jsx("header",{className:styles$2.appHeader,children:header&&jsxRuntimeExports.jsx(ComponentContainer,{components:headerComponents},"header")}),jsxRuntimeExports.jsx("section",{className:styles$2.appContainerCanvas,ref:contentRef,"data-range-selector":!0,onContextMenu:__name(e2=>e2.preventDefault(),"onContextMenu"),children:jsxRuntimeExports.jsx(ComponentContainer,{components:contentComponents},"content")})]}),jsxRuntimeExports.jsx("aside",{className:styles$2.appContainerSidebar,children:jsxRuntimeExports.jsx(Sidebar,{})})]}),footer&&jsxRuntimeExports.jsx("footer",{className:styles$2.appFooter,children:jsxRuntimeExports.jsx(ComponentContainer,{components:footerComponents},"footer")}),jsxRuntimeExports.jsx(ZenZone,{})]})]}),jsxRuntimeExports.jsx(ComponentContainer,{components:globalComponents},"global"),jsxRuntimeExports.jsx(ComponentContainer,{components:builtInGlobalComponents},"built-in-global"),contextMenu&&jsxRuntimeExports.jsx(MobileContextMenu,{})]})}__name(MobileApp,"MobileApp");var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$9");const STEADY_TIMEOUT=3e3;var _a9;let MobileUIController=(_a9=class extends core.Disposable{constructor(_config,_instanceService,_renderManagerService,_injector,_lifecycleService,_uiPartsService,_menuManagerService,_layoutService){super(),this._config=_config,this._instanceService=_instanceService,this._renderManagerService=_renderManagerService,this._injector=_injector,this._lifecycleService=_lifecycleService,this._uiPartsService=_uiPartsService,this._menuManagerService=_menuManagerService,this._layoutService=_layoutService,this._initBuiltinComponents(),Promise.resolve().then(()=>this._bootstrapWorkbench())}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_bootstrapWorkbench(){this.disposeWithMe(bootstrap(this._injector,this._config,(canvasElement,containerElement)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement)),this.disposeWithMe(this._layoutService.registerContentElement(canvasElement))),this._renderManagerService.currentRender$.subscribe(renderId=>{if(renderId){const render2=this._renderManagerService.getRenderById(renderId);if(!render2.unitId||this._instanceService.getUnitType(render2.unitId)!==core.UniverInstanceType.UNIVER_SHEET)return;render2.engine.setContainer(canvasElement)}}),setTimeout(()=>{var _a19;const engine=(_a19=this._renderManagerService.getFirst())==null?void 0:_a19.engine;engine==null||engine.setContainer(canvasElement),this._lifecycleService.stage=core.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=core.LifecycleStages.Steady,STEADY_TIMEOUT)},300)}))}_initBuiltinComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(CanvasPopup,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(FloatDom,this._injector)))}},__name(_a9,"MobileUIController"),_a9);MobileUIController=__decorateClass$9([__decorateParam$9(1,core.IUniverInstanceService),__decorateParam$9(2,engineRender.IRenderManagerService),__decorateParam$9(3,core.Inject(core.Injector)),__decorateParam$9(4,core.Inject(core.LifecycleService)),__decorateParam$9(5,IUIPartsService),__decorateParam$9(6,IMenuManagerService),__decorateParam$9(7,core.Optional(ILayoutService))],MobileUIController);function bootstrap(injector,options,callback){let mountContainer;const container=options.container;if(typeof container=="string"){const containerElement=document.getElementById(container);containerElement?mountContainer=containerElement:mountContainer=createContainer(container)}else container instanceof HTMLElement?mountContainer=container:mountContainer=createContainer("univer");const ConnectedApp=core.connectInjector(MobileApp,injector),onRendered=__name(canvasElement=>callback(canvasElement,mountContainer),"onRendered");function render2(){render_2(jsxRuntimeExports.jsx(ConnectedApp,{...options,mountContainer,onRendered}),mountContainer)}return __name(render2,"render"),render2(),core.toDisposable(()=>{unmount_1(mountContainer)})}__name(bootstrap,"bootstrap");function createContainer(id){const element2=document.createElement("div");return element2.id=id,element2}__name(createContainer,"createContainer");const INotificationService=core.createIdentifier("ui.notification.service");var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$8");const IBeforeCloseService=core.createIdentifier("univer.ui.before-close-service");var _a10;exports.DesktopBeforeCloseService=(_a10=class{constructor(_notificationService){__publicField(this,"_beforeUnloadCallbacks",[]);__publicField(this,"_onCloseCallbacks",[]);this._notificationService=_notificationService,this._init()}registerBeforeClose(callback){return this._beforeUnloadCallbacks.push(callback),{dispose:__name(()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(cb=>cb!==callback)},"dispose")}}registerOnClose(callback){return this._onCloseCallbacks.push(callback),{dispose:__name(()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(cb=>cb!==callback)},"dispose")}}_init(){window.addEventListener("beforeunload",_event=>{let event=_event;const message=this._beforeUnloadCallbacks.map(callback=>callback()).filter(m2=>!!m2).join(`
|
|
10
|
-
`);if(message)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:message}),typeof event>"u"&&(event=window.event),event.returnValue=message,message}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(callback=>callback())})}},__name(_a10,"DesktopBeforeCloseService"),_a10);exports.DesktopBeforeCloseService=__decorateClass$8([__decorateParam$8(0,INotificationService)],exports.DesktopBeforeCloseService);function supportClipboardAPI(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}__name(supportClipboardAPI,"supportClipboardAPI");var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7");const PLAIN_TEXT_CLIPBOARD_MIME_TYPE="text/plain",HTML_CLIPBOARD_MIME_TYPE="text/html",IClipboardInterfaceService=core.createIdentifier("univer.clipboard-interface-service");var _a11;exports.BrowserClipboardService=(_a11=class extends core.Disposable{constructor(_localeService,_logService,_notificationService){super(),this._localeService=_localeService,this._logService=_logService,this._notificationService=_notificationService}get supportClipboard(){return supportClipboardAPI()}async write(text,html){if(!this.supportClipboard)return this._legacyCopyHtml(html);try{return await navigator.clipboard.write([new ClipboardItem({[PLAIN_TEXT_CLIPBOARD_MIME_TYPE]:new Blob([text],{type:PLAIN_TEXT_CLIPBOARD_MIME_TYPE}),[HTML_CLIPBOARD_MIME_TYPE]:new Blob([html],{type:HTML_CLIPBOARD_MIME_TYPE})})])}catch(error){this._logService.error("[BrowserClipboardService]",error),this._showClipboardAuthenticationNotification()}}async writeText(text){if(!this.supportClipboard)return this._legacyCopyText(text);try{return await navigator.clipboard.writeText(text)}catch(error){this._logService.error("[BrowserClipboardService]",error),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(e2){return this._logService.error("[BrowserClipboardService]",e2),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(e2){return this._logService.error("[BrowserClipboardService]",e2),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(html){const activeElement=document.activeElement,container=createCopyHtmlContainer();document.body.appendChild(container),container.innerHTML=html;try{select(container),document.execCommand("copy")}finally{activeElement instanceof HTMLElement&&activeElement.focus(),document.body.removeChild(container)}}_legacyCopyText(text){const activeElement=document.activeElement,container=createCopyTextContainer();document.body.appendChild(container),container.value=text;try{select(container),document.execCommand("copy")}finally{activeElement instanceof HTMLElement&&activeElement.focus(),document.body.removeChild(container)}}_showClipboardAuthenticationNotification(){var _a19;(_a19=this._notificationService)==null||_a19.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},__name(_a11,"BrowserClipboardService"),_a11);exports.BrowserClipboardService=__decorateClass$7([__decorateParam$7(0,core.Inject(core.LocaleService)),__decorateParam$7(1,core.ILogService),__decorateParam$7(2,core.Optional(INotificationService))],exports.BrowserClipboardService);function createCopyTextContainer(){const textArea=document.createElement("textarea");return textArea.style.position="absolute",textArea.style.height="1px",textArea.style.width="1px",textArea.style.opacity="0",textArea.readOnly=!0,textArea}__name(createCopyTextContainer,"createCopyTextContainer");function createCopyHtmlContainer(){const div=document.createElement("div");return div.contentEditable="true",div.style.position="absolute",div.style.opacity="0",div.style.height="1px",div.style.width="1px",div}__name(createCopyHtmlContainer,"createCopyHtmlContainer");function select(element2){if(element2 instanceof HTMLTextAreaElement){const isReadOnly=element2.hasAttribute("readonly");return isReadOnly||element2.setAttribute("readonly",""),element2.select(),element2.setSelectionRange(0,element2.value.length),isReadOnly||element2.removeAttribute("readonly"),element2.value}element2.hasAttribute("contenteditable")&&element2.focus();const range=document.createRange();range.selectNodeContents(element2);const selection=window.getSelection();if(!selection)throw new Error;return selection.removeAllRanges(),selection.addRange(range),selection.toString()}__name(select,"select");const IConfirmService=core.createIdentifier("univer.confirm-service");function ConfirmPart(){const confirmService=core.useDependency(IConfirmService),[confirmOptions,setConfirmOptions]=React.useState([]);React.useEffect(()=>{const subscription=confirmService.confirmOptions$.subscribe(options=>{setConfirmOptions(options)});return()=>{subscription.unsubscribe()}},[]);const props=confirmOptions.map(options=>{const{children,title,...restProps}=options,confirmProps=restProps;for(const key of["children","title"]){const k2=key,props2=options[k2];props2&&(confirmProps[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props2}))}return confirmProps});return props==null?void 0:props.map((options,index)=>jsxRuntimeExports.jsx(design.Confirm,{...options},index))}__name(ConfirmPart,"ConfirmPart");var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6"),_a12;exports.DesktopConfirmService=(_a12=class extends core.Disposable{constructor(_injector,_uiPartsService){super();__publicField(this,"_confirmOptions",[]);__publicField(this,"confirmOptions$",new rxjs.Subject);this._injector=_injector,this._uiPartsService=_uiPartsService,this._initUIPart()}open(option){return this._confirmOptions.find(item=>item.id===option.id)?this._confirmOptions=this._confirmOptions.map(item=>({...item.id===option.id?option:item,visible:item.id===option.id?!0:item.visible})):this._confirmOptions.push({...option,visible:!0}),this.confirmOptions$.next(this._confirmOptions),core.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(params){return new Promise(resolve=>{const disposeHandler=this.open({...params,onConfirm:__name(()=>{disposeHandler.dispose(),resolve(!0)},"onConfirm"),onClose:__name(()=>{disposeHandler.dispose(),resolve(!1)},"onClose")})})}close(id){this._confirmOptions=this._confirmOptions.map(item=>({...item,visible:item.id===id?!1:item.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL,()=>core.connectInjector(ConfirmPart,this._injector)))}},__name(_a12,"DesktopConfirmService"),_a12);exports.DesktopConfirmService=__decorateClass$6([__decorateParam$6(0,core.Inject(core.Injector)),__decorateParam$6(1,IUIPartsService)],exports.DesktopConfirmService);const IDialogService=core.createIdentifier("univer.ui.dialog-service");function DialogPart(){const dialogService=core.useDependency(IDialogService),[dialogOptions,setDialogOptions]=React.useState([]);React.useEffect(()=>{const subscription=dialogService.getDialogs$().subscribe(options=>{setDialogOptions(options)});return()=>subscription.unsubscribe()},[dialogService]);const attrs=dialogOptions.map(options=>{const{children,title,closeIcon,footer,...restProps}=options,dialogProps=restProps;for(const key of["children","title","closeIcon","footer"]){const k2=key,props=options[k2];props&&(dialogProps[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props}))}return dialogProps});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:attrs==null?void 0:attrs.map(options=>jsxRuntimeExports.jsx(design.Dialog,{...options},options.id))})}__name(DialogPart,"DialogPart");var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5"),_a13;exports.DesktopDialogService=(_a13=class extends core.Disposable{constructor(_injector,_uiPartsService){super();__publicField(this,"_dialogOptions",[]);__publicField(this,"_dialogOptions$",new rxjs.Subject);this._injector=_injector,this._uiPartsService=_uiPartsService,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions$.complete()}open(option){return this._dialogOptions.find(item=>item.id===option.id)?this._dialogOptions=this._dialogOptions.map(item=>({...item.id===option.id?option:item,visible:item.id===option.id?!0:item.visible})):this._dialogOptions.push({...option,visible:!0}),this._dialogOptions$.next(this._dialogOptions),core.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(id){this._dialogOptions=this._dialogOptions.map(item=>({...item,visible:item.id===id?!1:item.visible})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(expectIds){const expectIdSet=new Set(expectIds);this._dialogOptions=this._dialogOptions.map(item=>({...item,visible:expectIdSet.has(item.id)?item.visible:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL,()=>core.connectInjector(DialogPart,this._injector)))}},__name(_a13,"DesktopDialogService"),_a13);exports.DesktopDialogService=__decorateClass$5([__decorateParam$5(0,core.Inject(core.Injector)),__decorateParam$5(1,IUIPartsService)],exports.DesktopDialogService);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a14;exports.DesktopGlobalZoneService=(_a14=class{constructor(_componentManager){__publicField(this,"visible$",new rxjs.Subject);__publicField(this,"componentKey$",new rxjs.Subject);__publicField(this,"_componentKey","");this._componentManager=_componentManager}get componentKey(){return this._componentKey}set(key,component){return this._componentManager.register(key,component),this.componentKey$.next(key),this._componentKey=key,core.toDisposable(()=>{this._componentManager.delete(key),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},__name(_a14,"DesktopGlobalZoneService"),_a14);exports.DesktopGlobalZoneService=__decorateClass$4([__decorateParam$4(0,core.Inject(ComponentManager))],exports.DesktopGlobalZoneService);function commonjsRequire(path){throw new Error('Could not dynamically require "'+path+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}__name(commonjsRequire,"commonjsRequire");var localforage$1={exports:{}};/*!
|
|
9
|
+
*/var f$1=React,k$1=Symbol.for("react.element"),l$1=Symbol.for("react.fragment"),m$1=Object.prototype.hasOwnProperty,n$1=f$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$1={key:!0,ref:!0,__self:!0,__source:!0};function q$1(c2,a,g2){var b2,d2={},e2=null,h2=null;g2!==void 0&&(e2=""+g2),a.key!==void 0&&(e2=""+a.key),a.ref!==void 0&&(h2=a.ref);for(b2 in a)m$1.call(a,b2)&&!p$1.hasOwnProperty(b2)&&(d2[b2]=a[b2]);if(c2&&c2.defaultProps)for(b2 in a=c2.defaultProps,a)d2[b2]===void 0&&(d2[b2]=a[b2]);return{$$typeof:k$1,type:c2,key:e2,ref:h2,props:d2,_owner:n$1.current}}__name(q$1,"q$1");reactJsxRuntime_production_min.Fragment=l$1;reactJsxRuntime_production_min.jsx=q$1;reactJsxRuntime_production_min.jsxs=q$1;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports;function CustomLabel(props){const{title,icon,label,value,value$}=props,localeService=core.useDependency(core.LocaleService),componentManager=core.useDependency(ComponentManager),[subscribedValue,setSubscribedValue]=React.useState(value),[realIcon,setRealIcon]=React.useState(""),nodes=[];let index=0;React.useEffect(()=>{if(value$){const subscription=value$.subscribe(v2=>{setSubscribedValue(v2)});return()=>{subscription.unsubscribe()}}},[value$]);const realValue=React.useMemo(()=>value!=null?value:subscribedValue,[subscribedValue,value]);React.useEffect(()=>{let subscription=null;return rxjs.isObservable(icon)?subscription=icon.subscribe(v2=>{setRealIcon(v2)}):setRealIcon(icon!=null?icon:""),()=>{subscription==null||subscription.unsubscribe()}},[icon]);const isValid=React.useMemo(()=>realValue&&typeof realValue=="string"?new core.ColorKit(realValue).isValid:!1,[realValue]);if(icon){const Icon=componentManager.get(realIcon!=null?realIcon:"");Icon&&nodes.push(jsxRuntimeExports.jsx(Icon,{extend:{colorChannel1:isValid?realValue:"rgb(var(--primary-color))"}},index++))}if(label){const isStringLabel=typeof label=="string",customProps=isStringLabel?{...props}:{...label==null?void 0:label.props,...props},labelName=isStringLabel?label:label==null?void 0:label.name,CustomComponent=componentManager.get(labelName);CustomComponent?nodes.push(jsxRuntimeExports.jsx(CustomComponent,{...customProps,value:realValue},index++)):nodes.push(jsxRuntimeExports.jsx("span",{children:localeService.t(labelName)},index++))}return title&&nodes.push(jsxRuntimeExports.jsx("span",{children:typeof title=="string"?localeService.t(title):title},index++)),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:nodes})}__name(CustomLabel,"CustomLabel");const uiPluginSheetsFontFamily="univer-ui-plugin-sheets-font-family",uiPluginSheetsFontFamilyItem="univer-ui-plugin-sheets-font-family-item",styles$e={uiPluginSheetsFontFamily,uiPluginSheetsFontFamilyItem},FontFamily=__name(props=>{const{value}=props,localeService=core.useDependency(core.LocaleService),viewValue=React.useMemo(()=>{if(value==null)return"";let fontFamily=localeService.t(`fontFamily.${`${value!=null?value:""}`.replace(/\s/g,"")}`);return fontFamily.startsWith("fontFamily.")&&typeof value=="string"&&(fontFamily=value.split(",")[0]),fontFamily},[value]);return jsxRuntimeExports.jsx("div",{className:styles$e.uiPluginSheetsFontFamily,style:{fontFamily:value},children:viewValue})},"FontFamily"),FontFamilyItem=__name(props=>{const{value}=props,localeService=core.useDependency(core.LocaleService);return jsxRuntimeExports.jsx("span",{className:styles$e.uiPluginSheetsFontFamilyItem,style:{fontFamily:value},children:localeService.t(`fontFamily.${`${value!=null?value:""}`.replace(/\s/g,"")}`)})},"FontFamilyItem"),FONT_FAMILY_LIST=[{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"}];function unwrap(o){return typeof o=="function"?o():o}__name(unwrap,"unwrap");function useObservable(observable,defaultValue,shouldHaveSyncValue,deps){if(typeof observable=="function"&&!deps)throw new Error("[useObservable]: expect deps when observable is a function! Otherwise it would cause an infinite loop.");const observableRef=React.useRef(null),initializedRef=React.useRef(!1),destObservable=React.useMemo(()=>observable,[...typeof deps<"u"?deps:[observable]]),[_,setRenderCounter]=React.useState(0),valueRef=React.useRef((()=>{let innerDefaultValue;return destObservable&&unwrap(destObservable).subscribe(value=>{initializedRef.current=!0,innerDefaultValue=value}).unsubscribe(),innerDefaultValue!=null?innerDefaultValue:defaultValue})());if(React.useEffect(()=>{let subscription=null;return destObservable&&(observableRef.current=unwrap(destObservable),subscription=observableRef.current.subscribe(value=>{valueRef.current=value,setRenderCounter(prev=>prev+1)})),()=>subscription==null?void 0:subscription.unsubscribe()},[destObservable]),shouldHaveSyncValue&&!initializedRef.current)throw new Error("[useObservable]: expect shouldHaveSyncValue but not getting a sync value!");return valueRef.current}__name(useObservable,"useObservable");const uiPluginSheetsFontSize="univer-ui-plugin-sheets-font-size",uiPluginSheetsFontSizeInput="univer-ui-plugin-sheets-font-size-input",styles$d={uiPluginSheetsFontSize,uiPluginSheetsFontSizeInput},FontSize=__name(props=>{const{value,min,max,onChange,disabled$}=props,disabled=useObservable(disabled$),[realValue,setRealValue]=React.useState(Number(value!=null?value:0)),_value=React.useMemo(()=>Number(value!=null?value:realValue),[value]);function handleChange(value2){value2!==null&&setRealValue(value2)}__name(handleChange,"handleChange");function handleStopPropagation(e2){e2.stopPropagation(),e2.code==="Enter"&&onChange(realValue.toString())}return __name(handleStopPropagation,"handleStopPropagation"),jsxRuntimeExports.jsx("div",{className:styles$d.uiPluginSheetsFontSize,children:jsxRuntimeExports.jsx(design.InputNumber,{className:styles$d.uiPluginSheetsFontSizeInput,value:_value,controls:!1,min,max,onKeyDown:handleStopPropagation,onChange:handleChange,disabled})})},"FontSize"),FONT_SIZE_LIST=[{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 canUseDom$2={};Object.defineProperty(canUseDom$2,"__esModule",{value:!0});var _default=canUseDom$2.default=canUseDom$1;function canUseDom$1(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}__name(canUseDom$1,"canUseDom$1");function useEvent$1(func){const funcRef=React.useRef(func);return funcRef.current=func,React.useCallback((...params)=>{var _a19;return(_a19=funcRef.current)==null?void 0:_a19.call(funcRef,...params)},[])}__name(useEvent$1,"useEvent$1");function useScrollYOverContainer(element2,container){const updater=useEvent$1(()=>{if(!element2||!container)return;const elStyle=element2.style,elRect=element2.getBoundingClientRect(),{y}=elRect,containerRect=container.getBoundingClientRect(),scrolled=element2.scrollHeight>elRect.height,isOverViewport=y<0||y+elRect.height>containerRect.height;if(!isOverViewport&&!scrolled){elStyle.overflowY="",elStyle.maxHeight="";return}isOverViewport&&(elStyle.overflowY="scroll",elStyle.maxHeight=y<0?`${element2.scrollHeight+y}px`:`${containerRect.height-y}px`)});React.useEffect(()=>{if(!_default()||!element2||!container)return;updater();const resizeObserver=design.resizeObserverCtor(updater);return resizeObserver.observe(element2),()=>{resizeObserver.unobserve(element2)}},[element2,container])}__name(useScrollYOverContainer,"useScrollYOverContainer");function t$1(localeService,key,...args){return localeService.t(key)}__name(t$1,"t$1");const isNumber=__name(value=>typeof value=="number","isNumber");function useLatest(value){const ref=React.useRef(value);return ref.current=value,ref}__name(useLatest,"useLatest");const useVirtualList=__name((list,options)=>{const{containerTarget,itemHeight,overscan=5}=options,itemHeightRef=useLatest(itemHeight),[size,setSize]=React.useState(null),scrollTriggerByScrollToFunc=React.useRef(!1),[targetList,setTargetList]=React.useState([]),[wrapperStyle,setWrapperStyle]=React.useState({height:void 0,marginTop:void 0}),getVisibleCount=__name((containerHeight,fromIndex)=>{if(typeof itemHeightRef.current=="number")return Math.ceil(containerHeight/itemHeightRef.current);let sum=0,endIndex=0;for(let i=fromIndex;i<list.length;i++){const height=itemHeightRef.current(i,list[i]);if(sum+=height,endIndex=i,sum>=containerHeight)break}return endIndex-fromIndex},"getVisibleCount"),getOffset=__name(scrollTop=>{if(isNumber(itemHeightRef.current))return Math.floor(scrollTop/itemHeightRef.current);let sum=0,offset=0;for(let i=0;i<list.length;i++){const height=itemHeightRef.current(i,list[i]);if(sum+=height,sum>=scrollTop){offset=i;break}}return offset+1},"getOffset"),getDistanceTop=__name(index=>typeof itemHeightRef.current=="number"?index*itemHeightRef.current:list.slice(0,index).reduce((sum,_,i)=>sum+itemHeightRef.current(i,list[i]),0),"getDistanceTop"),totalHeight=React.useMemo(()=>isNumber(itemHeightRef.current)?list.length*itemHeightRef.current:list.reduce((sum,_,index)=>sum+itemHeightRef.current(index,list[index]),0),[list]),calculateRange=__name(()=>{const container=containerTarget.current;if(container){const{scrollTop,clientHeight}=container,offset=getOffset(scrollTop),visibleCount=getVisibleCount(clientHeight,offset),start=Math.max(0,offset-overscan),end=Math.min(list.length,offset+visibleCount+overscan),offsetTop=getDistanceTop(start);setWrapperStyle({height:`${totalHeight-offsetTop}px`,marginTop:`${offsetTop}px`}),setTargetList(list.slice(start,end).map((ele,index)=>({data:ele,index:index+start})))}},"calculateRange");return React.useEffect(()=>{if(containerTarget.current){const getSize=__name(()=>{const width=containerTarget.current.clientWidth,height=containerTarget.current.clientHeight;(width!==(size==null?void 0:size.width)||height!==(size==null?void 0:size.height))&&setSize({width,height})},"getSize");getSize();const ob=new ResizeObserver(getSize);return ob.observe(containerTarget.current),()=>{ob.disconnect()}}},[]),React.useEffect(()=>{!(size!=null&&size.width)||!(size!=null&&size.height)||calculateRange()},[size==null?void 0:size.width,size==null?void 0:size.height,list]),[targetList,{wrapperStyle,scrollTo:useEvent$1(__name(index=>{const container=containerTarget.current;container&&(scrollTriggerByScrollToFunc.current=!0,container.scrollTop=getDistanceTop(index),calculateRange())},"scrollTo")),containerProps:{onScroll:__name(e2=>{if(scrollTriggerByScrollToFunc.current){scrollTriggerByScrollToFunc.current=!1;return}e2.preventDefault(),calculateRange()},"onScroll")}}]},"useVirtualList");function r(e2){var t2,f2,n2="";if(typeof e2=="string"||typeof e2=="number")n2+=e2;else if(typeof e2=="object")if(Array.isArray(e2)){var o=e2.length;for(t2=0;t2<o;t2++)e2[t2]&&(f2=r(e2[t2]))&&(n2&&(n2+=" "),n2+=f2)}else for(f2 in e2)e2[f2]&&(n2&&(n2+=" "),n2+=f2);return n2}__name(r,"r");function clsx$1(){for(var e2,t2,f2=0,n2="",o=arguments.length;f2<o;f2++)(e2=arguments[f2])&&(t2=r(e2))&&(n2&&(n2+=" "),n2+=t2);return n2}__name(clsx$1,"clsx$1");var __defProp$h=Object.defineProperty,__getOwnPropDesc$h=Object.getOwnPropertyDescriptor,__decorateClass$h=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$h(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$h(target,key,result),result},"__decorateClass$h"),__decorateParam$h=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$h");const FOCUSING_UNIVER="FOCUSING_UNIVER",givingBackFocusElements=["univer-app-layout","univer-toolbar-btn","univer-menu-item","univer-button","univer-sheet-bar-btn","univer-render-canvas","univer-workbench-layout"],ILayoutService=core.createIdentifier("ui.layout-service");var _a;exports.DesktopLayoutService=(_a=class extends core.Disposable{constructor(_contextService,_univerInstanceService){super();__publicField(this,"_rootContainerElement",null);__publicField(this,"_isFocused",!1);__publicField(this,"_focusHandlers",new Map);__publicField(this,"_contentElements",[]);__publicField(this,"_allContainers",[]);this._contextService=_contextService,this._univerInstanceService=_univerInstanceService,this._initUniverFocusListener(),this._initEditorStatus()}get isFocused(){return this._isFocused}get rootContainerElement(){return this._rootContainerElement}focus(){const currentFocused=this._univerInstanceService.getFocusedUnit();if(!currentFocused)return;let handler;currentFocused instanceof core.Workbook?handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_SHEET):currentFocused instanceof core.DocumentDataModel?handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_DOC):currentFocused instanceof core.SlideDataModel&&(handler=this._focusHandlers.get(core.UniverInstanceType.UNIVER_SLIDE)),handler&&handler(currentFocused.getUnitId())}registerFocusHandler(type,handler){if(this._focusHandlers.has(type))throw new Error(`[DesktopLayoutService]: handler of type ${type} bas been registered!`);return this._focusHandlers.set(type,handler),core.toDisposable(()=>this._focusHandlers.delete(type))}registerContentElement(container){if(this._contentElements.indexOf(container)===-1)return this._contentElements.push(container),core.toDisposable(()=>core.remove(this._contentElements,container));throw new Error("[DesktopLayoutService]: content container already registered!")}getContentElement(){return this._contentElements[0]}registerRootContainerElement(container){if(this._rootContainerElement)throw new Error("[DesktopLayoutService]: root container already registered!");this._rootContainerElement=container;const dis=this.registerContainerElement(container);return core.toDisposable(()=>{this._rootContainerElement=null,dis.dispose()})}registerContainerElement(container){if(this._allContainers.indexOf(container)===-1)return this._allContainers.push(container),core.toDisposable(()=>core.remove(this._allContainers,container));throw new Error("[LayoutService]: container already registered!")}checkElementInCurrentContainers(element2){return this._allContainers.some(container=>container.contains(element2))}checkContentIsFocused(){return this._contentElements.some(contentEl=>contentEl===document.activeElement||contentEl.contains(document.activeElement))}_initUniverFocusListener(){this.disposeWithMe(rxjs.fromEvent(window,"focusin").subscribe(event=>{const target=event.target;if(givingBackFocusElements.some(item=>target.classList.contains(item))){queueMicrotask(()=>this.focus());return}target&&this.checkElementInCurrentContainers(target)?this._isFocused=!0:this._isFocused=!1,this._contextService.setContextValue(FOCUSING_UNIVER,this._isFocused),this._contextService.setContextValue(core.FOCUSING_UNIVER_EDITOR,getFocusingUniverEditorStatus())}))}_initEditorStatus(){this._contextService.setContextValue(core.FOCUSING_UNIVER_EDITOR,getFocusingUniverEditorStatus())}},__name(_a,"DesktopLayoutService"),_a);exports.DesktopLayoutService=__decorateClass$h([__decorateParam$h(0,core.IContextService),__decorateParam$h(1,core.IUniverInstanceService)],exports.DesktopLayoutService);function getFocusingUniverEditorStatus(){var _a19;return!!((_a19=document.activeElement)!=null&&_a19.classList.contains("univer-editor"))}__name(getFocusingUniverEditorStatus,"getFocusingUniverEditorStatus");var MenuManagerPosition=(MenuManagerPosition2=>(MenuManagerPosition2.RIBBON="ribbon",MenuManagerPosition2.CONTEXT_MENU="contextMenu",MenuManagerPosition2))(MenuManagerPosition||{}),RibbonPosition=(RibbonPosition2=>(RibbonPosition2.START="ribbon.start",RibbonPosition2.INSERT="ribbon.insert",RibbonPosition2.FORMULAS="ribbon.formulas",RibbonPosition2.DATA="ribbon.data",RibbonPosition2.VIEW="ribbon.view",RibbonPosition2.OTHERS="ribbon.others",RibbonPosition2))(RibbonPosition||{}),RibbonStartGroup=(RibbonStartGroup2=>(RibbonStartGroup2.HISTORY="ribbon.start.history",RibbonStartGroup2.FORMAT="ribbon.start.format",RibbonStartGroup2.LAYOUT="ribbon.start.layout",RibbonStartGroup2.FORMULAS_INSERT="ribbon.start.insert",RibbonStartGroup2.FORMULAS_VIEW="ribbon.start.view",RibbonStartGroup2.FILE="ribbon.start.file",RibbonStartGroup2.OTHERS="ribbon.start.others",RibbonStartGroup2))(RibbonStartGroup||{}),RibbonInsertGroup=(RibbonInsertGroup2=>(RibbonInsertGroup2.OTHERS="ribbon.insert.others",RibbonInsertGroup2))(RibbonInsertGroup||{}),RibbonFormulasGroup=(RibbonFormulasGroup2=>(RibbonFormulasGroup2.OTHERS="ribbon.formulas.others",RibbonFormulasGroup2))(RibbonFormulasGroup||{}),RibbonDataGroup=(RibbonDataGroup2=>(RibbonDataGroup2.OTHERS="ribbon.data.others",RibbonDataGroup2))(RibbonDataGroup||{}),RibbonViewGroup=(RibbonViewGroup2=>(RibbonViewGroup2.OTHERS="ribbon.view.others",RibbonViewGroup2))(RibbonViewGroup||{}),RibbonOthersGroup=(RibbonOthersGroup2=>(RibbonOthersGroup2.OTHERS="ribbon.others.others",RibbonOthersGroup2))(RibbonOthersGroup||{}),ContextMenuPosition=(ContextMenuPosition2=>(ContextMenuPosition2.MAIN_AREA="contextMenu.mainArea",ContextMenuPosition2.COL_HEADER="contextMenu.colHeader",ContextMenuPosition2.ROW_HEADER="contextMenu.rowHeader",ContextMenuPosition2.FOOTER_TABS="contextMenu.footerTabs",ContextMenuPosition2.FOOTER_MENU="contextMenu.footerMenu",ContextMenuPosition2))(ContextMenuPosition||{}),ContextMenuGroup=(ContextMenuGroup2=>(ContextMenuGroup2.FORMAT="contextMenu.format",ContextMenuGroup2.LAYOUT="contextMenu.layout",ContextMenuGroup2.DATA="contextMenu.data",ContextMenuGroup2.OTHERS="contextMenu.others",ContextMenuGroup2))(ContextMenuGroup||{}),MenuPosition=(MenuPosition2=>(MenuPosition2.VOID="void",MenuPosition2[MenuPosition2.TOOLBAR_START=RibbonPosition.START]="TOOLBAR_START",MenuPosition2[MenuPosition2.TOOLBAR_INSERT=RibbonPosition.INSERT]="TOOLBAR_INSERT",MenuPosition2[MenuPosition2.TOOLBAR_FORMULAS=RibbonPosition.FORMULAS]="TOOLBAR_FORMULAS",MenuPosition2[MenuPosition2.TOOLBAR_DATA=RibbonPosition.DATA]="TOOLBAR_DATA",MenuPosition2[MenuPosition2.TOOLBAR_VIEW=RibbonPosition.VIEW]="TOOLBAR_VIEW",MenuPosition2[MenuPosition2.TOOLBAR_OTHERS=RibbonPosition.OTHERS]="TOOLBAR_OTHERS",MenuPosition2[MenuPosition2.CONTEXT_MENU=ContextMenuPosition.MAIN_AREA]="CONTEXT_MENU",MenuPosition2.FOOTER="footer",MenuPosition2))(MenuPosition||{}),MenuGroup=(MenuGroup2=>(MenuGroup2[MenuGroup2.TOOLBAR_HISTORY=0]="TOOLBAR_HISTORY",MenuGroup2[MenuGroup2.TOOLBAR_FORMAT=1]="TOOLBAR_FORMAT",MenuGroup2[MenuGroup2.TOOLBAR_LAYOUT=2]="TOOLBAR_LAYOUT",MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_INSERT=3]="TOOLBAR_FORMULAS_INSERT",MenuGroup2[MenuGroup2.TOOLBAR_FORMULAS_VIEW=4]="TOOLBAR_FORMULAS_VIEW",MenuGroup2[MenuGroup2.TOOLBAR_FILE=5]="TOOLBAR_FILE",MenuGroup2[MenuGroup2.TOOLBAR_OTHERS=6]="TOOLBAR_OTHERS",MenuGroup2[MenuGroup2.CONTEXT_MENU_FORMAT=7]="CONTEXT_MENU_FORMAT",MenuGroup2[MenuGroup2.CONTEXT_MENU_LAYOUT=8]="CONTEXT_MENU_LAYOUT",MenuGroup2[MenuGroup2.CONTEXT_MENU_DATA=9]="CONTEXT_MENU_DATA",MenuGroup2[MenuGroup2.CONTEXT_MENU_OTHERS=10]="CONTEXT_MENU_OTHERS",MenuGroup2))(MenuGroup||{}),MenuItemType=(MenuItemType2=>(MenuItemType2[MenuItemType2.BUTTON=0]="BUTTON",MenuItemType2[MenuItemType2.SELECTOR=1]="SELECTOR",MenuItemType2[MenuItemType2.BUTTON_SELECTOR=2]="BUTTON_SELECTOR",MenuItemType2[MenuItemType2.SUBITEMS=3]="SUBITEMS",MenuItemType2))(MenuItemType||{}),__defProp$g=Object.defineProperty,__getOwnPropDesc$g=Object.getOwnPropertyDescriptor,__decorateClass$g=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$g(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$g(target,key,result),result},"__decorateClass$g"),__decorateParam$g=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$g");const IMenuManagerService=core.createIdentifier("univer.menu-manager-service");var _a2;exports.MenuManagerService=(_a2=class extends core.Disposable{constructor(_injector,_configService){super();__publicField(this,"menuChanged$",new rxjs.Subject);__publicField(this,"_menu",{[MenuManagerPosition.RIBBON]:{[RibbonPosition.START]:{order:0,[RibbonStartGroup.HISTORY]:{order:0},[RibbonStartGroup.FORMAT]:{order:1},[RibbonStartGroup.LAYOUT]:{order:2},[RibbonStartGroup.FORMULAS_INSERT]:{order:3},[RibbonStartGroup.FORMULAS_VIEW]:{order:4},[RibbonStartGroup.FILE]:{order:5},[RibbonStartGroup.OTHERS]:{order:6}},[RibbonPosition.INSERT]:{order:1,[RibbonInsertGroup.OTHERS]:{order:0}},[RibbonPosition.FORMULAS]:{order:2,[RibbonFormulasGroup.OTHERS]:{order:0}},[RibbonPosition.DATA]:{order:3,[RibbonDataGroup.OTHERS]:{order:0}},[RibbonPosition.VIEW]:{order:4,[RibbonViewGroup.OTHERS]:{order:0}},[RibbonPosition.OTHERS]:{order:5,[RibbonOthersGroup.OTHERS]:{order:0}}},[MenuManagerPosition.CONTEXT_MENU]:{[ContextMenuPosition.MAIN_AREA]:{order:0,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.COL_HEADER]:{order:1,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.ROW_HEADER]:{order:2,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.FOOTER_TABS]:{order:3,[ContextMenuGroup.FORMAT]:{order:0},[ContextMenuGroup.LAYOUT]:{order:1},[ContextMenuGroup.DATA]:{order:2},[ContextMenuGroup.OTHERS]:{order:3}},[ContextMenuPosition.FOOTER_MENU]:{order:4,[ContextMenuGroup.OTHERS]:{order:3}}}});this._injector=_injector,this._configService=_configService}dispose(){this.menuChanged$.complete()}mergeMenu(source,target){const _target=target!=null?target:this._menu;for(const[key,value]of Object.entries(_target))if(key in source){const _key=key;core.Tools.deepMerge(_target[_key],source[_key]),this.menuChanged$.next()}else this.mergeMenu(source,value)}appendRootMenu(source){core.Tools.deepMerge(this._menu,source),this.menuChanged$.next()}_buildMenuSchema(data){const result=[];for(const[key,value]of Object.entries(data)){const menuItem={key,order:value.order};if(value.menuItemFactory){const item=this._injector.invoke(value.menuItemFactory);if(item){const menuItemConfig=this._configService.getConfig("menu");if(menuItemConfig&&item.id in menuItemConfig){const _key=item.id;menuItem.item=mergeMenuConfigs(item,menuItemConfig[_key])}else menuItem.item=item}}const children=this._buildMenuSchema(value);children.length>0&&(menuItem.children=children.sort((a,b2)=>a.order-b2.order)),(menuItem.item||menuItem.children)&&result.push(menuItem)}return result}getMenuByPositionKey(key){const findKey=__name(obj=>{if(key in obj)return this._buildMenuSchema(obj[key]);for(const k2 in obj){if(k2===key)return this._buildMenuSchema(obj[k2]);if(typeof obj[k2]=="object"){const result=findKey(obj[k2]);if(result)return result}}},"findKey");return findKey(this._menu)}},__name(_a2,"MenuManagerService"),_a2);exports.MenuManagerService=__decorateClass$g([__decorateParam$g(0,core.Inject(core.Injector)),__decorateParam$g(1,core.IConfigService)],exports.MenuManagerService);const menuItemNoHover="univer-menu-item-no-hover",menuItemActive="univer-menu-item-active",menuItemActivated="univer-menu-item-activated",menuItemContent="univer-menu-item-content",menuItemSelectable="univer-menu-item-selectable",menuItemSelectableIcon="univer-menu-item-selectable-icon",menuItemMoreIcon="univer-menu-item-more-icon",styles$c={menuItemNoHover,menuItemActive,menuItemActivated,menuItemContent,menuItemSelectable,menuItemSelectableIcon,menuItemMoreIcon};function MenuWrapper(props){const{menuType,onOptionSelect}=props,menuManagerService=core.useDependency(IMenuManagerService);if(!menuType)return null;const menuItems=menuManagerService.getMenuByPositionKey(menuType),filteredMenuItems=React.useMemo(()=>menuItems.filter(item=>{var _a19;if(!item.children)return item;let hasChildren=!1;const hiddenObservables=(_a19=item.children)==null?void 0:_a19.map(subItem=>{var _a20,_b;return(_b=(_a20=subItem.item)==null?void 0:_a20.hidden$)!=null?_b:new rxjs.Observable(s=>(s.next(!1),s.unsubscribe()))});return rxjs.combineLatest(hiddenObservables).subscribe(hiddenValues=>{hasChildren=hiddenValues.every(hidden=>hidden===!0),hasChildren||(hasChildren=!0)}).unsubscribe(),hasChildren}),[menuItems]);return filteredMenuItems&&filteredMenuItems.map(item=>{var _a19;return item.item?jsxRuntimeExports.jsx(MenuItem,{menuItem:item.item,onClick:__name(object=>{onOptionSelect==null||onOptionSelect({value:"",label:item.key,...object})},"onClick")},item.key):(_a19=item.children)!=null&&_a19.length?jsxRuntimeExports.jsx(design.MenuItemGroup,{eventKey:item.key,children:item.children.map(child=>child.item&&jsxRuntimeExports.jsx(MenuItem,{menuItem:child.item,onClick:__name(object=>{onOptionSelect==null||onOptionSelect({value:"",label:child.key,...object})},"onClick")},child.key))},item.key):null})}__name(MenuWrapper,"MenuWrapper");function MenuOptionsWrapper(props){var _a19;const{options,value,onOptionSelect,parentKey}=props;return(_a19=options==null?void 0:options.map((option,index)=>{var _a20,_b,_c;const key=`${parentKey}-${(_a20=option.label)!=null?_a20:option.id}-${index}`,onChange=__name(v2=>{onOptionSelect==null||onOptionSelect({value:v2,label:option==null?void 0:option.label,commandId:option==null?void 0:option.commandId})},"onChange"),handleClick=__name(()=>{typeof option.value>"u"||onOptionSelect==null||onOptionSelect({...option})},"handleClick"),_className=clsx$1({[styles$c.menuItemNoHover]:typeof option.label!="string"&&!((_b=option.label)!=null&&_b.hoverable)});return jsxRuntimeExports.jsx(design.MenuItem,{disabled:option.disabled,eventKey:key,className:_className,onClick:handleClick,children:jsxRuntimeExports.jsxs("span",{className:clsx$1(styles$c.menuItemContent,{[styles$c.menuItemSelectable]:!(typeof option.label!="string"&&!((_c=option.label)!=null&&_c.hoverable))}),children:[typeof value<"u"&&String(value)===String(option.value)&&jsxRuntimeExports.jsx("span",{className:styles$c.menuItemSelectableIcon,children:jsxRuntimeExports.jsx(CheckMarkSingle,{style:{color:"rgb(var(--success-color))"}})}),jsxRuntimeExports.jsx(CustomLabel,{value$:option.value$,value:option.value,label:option.label,icon:option.icon,onChange})]})},key)}))!=null?_a19:null}__name(MenuOptionsWrapper,"MenuOptionsWrapper");const Menu=__name(props=>{const{overViewport,...restProps}=props,[menuEl,setMenuEl]=React.useState(),layoutService=core.useDependency(ILayoutService);return useScrollYOverContainer(overViewport==="scroll"?menuEl:null,layoutService.rootContainerElement),jsxRuntimeExports.jsxs(design.Menu,{ref:__name(ref=>(ref==null?void 0:ref.list)&&setMenuEl(ref.list),"ref"),selectable:!1,children:[jsxRuntimeExports.jsx(MenuOptionsWrapper,{...restProps}),jsxRuntimeExports.jsx(MenuWrapper,{...restProps})]})},"Menu");function MenuItem({menuItem,onClick}){const menuManagerService=core.useDependency(IMenuManagerService),disabled=useObservable(menuItem.disabled$,!1),activated=useObservable(menuItem.activated$,!1),hidden=useObservable(menuItem.hidden$,!1),value=useObservable(menuItem.value$),item=menuItem,selectionsFromObservable=useObservable(rxjs.isObservable(item.selections)?item.selections:void 0),[inputValue,setInputValue]=React.useState(value);if(hidden)return null;const onChange=__name(v2=>{const newValue=core.isRealNum(v2)&&typeof v2=="string"?Number.parseInt(v2):v2;setInputValue(newValue)},"onChange"),renderButtonType=__name(()=>{const item2=menuItem,{title,label}=item2;return jsxRuntimeExports.jsx(design.MenuItem,{eventKey:item2.id,disabled,className:clsx$1({[styles$c.menuItemActivated]:activated}),onClick:__name(()=>{onClick({commandId:item2.commandId,value:inputValue,id:item2.id})},"onClick"),children:jsxRuntimeExports.jsx("span",{className:styles$c.menuItemContent,children:jsxRuntimeExports.jsx(CustomLabel,{value,title,label,icon:item2.icon,onChange})})},item2.id)},"renderButtonType"),renderSelectorType=__name(()=>{var _a19;const selections=(_a19=selectionsFromObservable!=null?selectionsFromObservable:item.selections)!=null?_a19:[];return selections.length>0?jsxRuntimeExports.jsx(design.SubMenu,{eventKey:item.id,popupOffset:[18,0],title:jsxRuntimeExports.jsxs("span",{className:styles$c.menuItemContent,children:[jsxRuntimeExports.jsx(CustomLabel,{title:item.title,value:inputValue,onChange,icon:item.icon,label:item.label}),item.shortcut&&` (${item.shortcut})`]}),expandIcon:jsxRuntimeExports.jsx(MoreSingle,{className:styles$c.menuItemMoreIcon}),children:selections.length>0&&jsxRuntimeExports.jsx(MenuOptionsWrapper,{parentKey:item.id,menuType:item.id,options:selections,onOptionSelect:__name(v2=>{onClick({value:v2.value,id:item.id,commandId:v2.commandId})},"onOptionSelect")})},item.id):jsxRuntimeExports.jsx(design.MenuItem,{eventKey:item.id,children:jsxRuntimeExports.jsxs("span",{className:styles$c.menuItemContent,children:[jsxRuntimeExports.jsx(CustomLabel,{title:item.title,value:inputValue,icon:item.icon,label:item.label,onChange}),item.shortcut&&` (${item.shortcut})`]})},item.id)},"renderSelectorType"),subMenuItems=menuItem.id?menuManagerService.getMenuByPositionKey(menuItem.id):[],renderSubItemsType=__name(()=>{const item2=menuItem;return jsxRuntimeExports.jsx(design.SubMenu,{eventKey:item2.id,popupOffset:[18,0],title:jsxRuntimeExports.jsx("span",{className:styles$c.menuItemContent,children:jsxRuntimeExports.jsx(CustomLabel,{title:item2.title,icon:item2.icon,label:item2.label,onChange})}),expandIcon:jsxRuntimeExports.jsx(MoreSingle,{className:styles$c.menuItemMoreIcon}),children:subMenuItems.length&&jsxRuntimeExports.jsx(MenuWrapper,{menuType:item2.id,parentKey:item2.id,onOptionSelect:onClick})},item2.id)},"renderSubItemsType");return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[menuItem.type===MenuItemType.SELECTOR&&renderSelectorType(),menuItem.type===MenuItemType.SUBITEMS&&renderSubItemsType(),menuItem.type===MenuItemType.BUTTON&&renderButtonType()]})}__name(MenuItem,"MenuItem");const _ProgressService=class _ProgressService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_taskCount",0);__publicField(this,"_progressChange$",new rxjs.Subject);__publicField(this,"_progressVisible$",new rxjs.Subject);__publicField(this,"progressChange$",this._progressChange$.asObservable());__publicField(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(task){if(this._taskCount===0)return;const{count}=task;if(count<=0)return;const step=Math.min(1,count/this._taskCount);this._progressChange$.next({step}),this._taskCount-=count,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(count){count<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=count)}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))}getTaskCount(){return this._taskCount}_clear(){this._taskCount=0}};__name(_ProgressService,"ProgressService");let ProgressService=_ProgressService;const IProgressService=core.createIdentifier("univer.progress.service"),progressBar="univer-progress-bar",progressBarContainer="univer-progress-bar-container",progressBarInner="univer-progress-bar-inner",progressBarCloseButton="univer-progress-bar-close-button",styles$b={progressBar,progressBarContainer,progressBarInner,progressBarCloseButton};function ProgressBar(props){const{barColor}=props,progressService=core.useDependency(IProgressService),progressBarInnerRef=React.useRef(null),[visible,setVisible]=React.useState(!1);React.useEffect(()=>{const progressVisible=progressService.progressVisible$.subscribe(isVisible=>{isVisible?setVisible(isVisible):setTimeout(()=>{setVisible(isVisible),progressBarInnerRef.current&&(progressBarInnerRef.current.style.width="0%")},500)}),progressChange=progressService.progressChange$.subscribe(task=>{const{step}=task;if(progressBarInnerRef.current){const currentProgress=Number.parseFloat(progressBarInnerRef.current.style.width)||0,newProgress=currentProgress+(100-currentProgress)*step;progressBarInnerRef.current.style.width=`${newProgress}%`}});return()=>{progressVisible.unsubscribe(),progressChange.unsubscribe()}},[]);function handleClose(){progressService.stop()}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsxs("div",{className:styles$b.progressBarContainer,style:{display:visible?"flex":"none"},children:[jsxRuntimeExports.jsx("div",{className:styles$b.progressBar,children:jsxRuntimeExports.jsx("div",{ref:progressBarInnerRef,className:styles$b.progressBarInner,style:{backgroundColor:barColor}})}),jsxRuntimeExports.jsx("div",{className:styles$b.progressBarCloseButton,onClick:handleClose,children:jsxRuntimeExports.jsx(CloseSingle,{})})]})}__name(ProgressBar,"ProgressBar");const UNI_DISABLE_CHANGING_FOCUS_KEY="UNI_DISABLE_CHANGING_FOCUS",PLUGIN_CONFIG_KEY="ui.config",defaultPluginConfig={},IMessageService=core.createIdentifier("ui.message.service");var __defProp$f=Object.defineProperty,__getOwnPropDesc$f=Object.getOwnPropertyDescriptor,__decorateClass$f=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$f(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$f(target,key,result),result},"__decorateClass$f"),__decorateParam$f=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$f"),_a3;exports.ErrorController=(_a3=class extends core.Disposable{constructor(_errorService,_messageService){super(),this._errorService=_errorService,this._messageService=_messageService,this.disposeWithMe(this._errorService.error$.subscribe(error=>{this._messageService.show({content:error.errorKey,type:design.MessageType.Error})}))}},__name(_a3,"ErrorController"),_a3);exports.ErrorController=__decorateClass$f([__decorateParam$f(0,core.Inject(core.ErrorService)),__decorateParam$f(1,IMessageService)],exports.ErrorController);const _ShortcutPanelService=class _ShortcutPanelService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_open$",new rxjs.BehaviorSubject(!1));__publicField(this,"open$",this._open$.pipe(rxjs.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){super.dispose(),this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}};__name(_ShortcutPanelService,"ShortcutPanelService");let ShortcutPanelService=_ShortcutPanelService;const ILeftSidebarService=core.createIdentifier("ui.left-sidebar.service"),ISidebarService=core.createIdentifier("ui.sidebar.service"),ShortcutPanelComponentName="ShortcutPanel",ToggleShortcutPanelOperation={id:"base-ui.operation.toggle-shortcut-panel",type:core.CommandType.OPERATION,handler:__name(accessor=>{const shortcutPanelService=accessor.get(ShortcutPanelService),sidebarService=accessor.get(ISidebarService);return shortcutPanelService.isOpen?(shortcutPanelService.close(),sidebarService.close()):(shortcutPanelService.open(),sidebarService.open({header:{title:"shortcut-panel.title"},children:{label:ShortcutPanelComponentName}})),!0},"handler")};function ShortcutPanelMenuItemFactory(accessor){return{id:ToggleShortcutPanelOperation.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:MenuItemType.BUTTON,hidden$:getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET)}}__name(ShortcutPanelMenuItemFactory,"ShortcutPanelMenuItemFactory");function UndoMenuItemFactory(accessor){const undoRedoService=accessor.get(core.IUndoRedoService);return{id:core.UndoCommand.id,type:MenuItemType.BUTTON,icon:"UndoSingle",title:"Undo",tooltip:"toolbar.undo",disabled$:undoRedoService.undoRedoStatus$.pipe(operators.map(v2=>v2.undos<=0))}}__name(UndoMenuItemFactory,"UndoMenuItemFactory");function RedoMenuItemFactory(accessor){const undoRedoService=accessor.get(core.IUndoRedoService);return{id:core.RedoCommand.id,type:MenuItemType.BUTTON,icon:"RedoSingle",title:"Redo",tooltip:"toolbar.redo",disabled$:undoRedoService.undoRedoStatus$.pipe(operators.map(v2=>v2.redos<=0))}}__name(RedoMenuItemFactory,"RedoMenuItemFactory");const menuSchema={[RibbonStartGroup.HISTORY]:{[core.UndoCommand.id]:{order:0,menuItemFactory:UndoMenuItemFactory},[core.RedoCommand.id]:{order:1,menuItemFactory:RedoMenuItemFactory}},[RibbonStartGroup.OTHERS]:{[ToggleShortcutPanelOperation.id]:{order:99,menuItemFactory:ShortcutPanelMenuItemFactory}}},SetEditorResizeOperation={id:"sheet.operation.set-editor-resize",type:core.CommandType.OPERATION,handler:__name((accessor,params)=>!0,"handler")},CopyCommandName="univer.command.copy",CopyCommand={id:CopyCommandName,name:CopyCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")},CutCommandName="univer.command.cut",CutCommand={id:CutCommandName,name:CutCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")},PasteCommandName="univer.command.paste",PasteCommand={id:PasteCommandName,name:PasteCommandName,multi:!0,priority:0,type:core.CommandType.COMMAND,preconditions:__name(()=>!1,"preconditions"),handler:__name(async()=>!0,"handler")};var KeyCode$1=(KeyCode2=>(KeyCode2[KeyCode2.UNKNOWN=0]="UNKNOWN",KeyCode2[KeyCode2.BACKSPACE=8]="BACKSPACE",KeyCode2[KeyCode2.TAB=9]="TAB",KeyCode2[KeyCode2.ENTER=13]="ENTER",KeyCode2[KeyCode2.SHIFT=16]="SHIFT",KeyCode2[KeyCode2.CTRL=17]="CTRL",KeyCode2[KeyCode2.ESC=27]="ESC",KeyCode2[KeyCode2.SPACE=32]="SPACE",KeyCode2[KeyCode2.ARROW_LEFT=37]="ARROW_LEFT",KeyCode2[KeyCode2.ARROW_UP=38]="ARROW_UP",KeyCode2[KeyCode2.ARROW_RIGHT=39]="ARROW_RIGHT",KeyCode2[KeyCode2.ARROW_DOWN=40]="ARROW_DOWN",KeyCode2[KeyCode2.INSERT=45]="INSERT",KeyCode2[KeyCode2.DELETE=46]="DELETE",KeyCode2[KeyCode2.Digit0=48]="Digit0",KeyCode2[KeyCode2.Digit1=49]="Digit1",KeyCode2[KeyCode2.Digit2=50]="Digit2",KeyCode2[KeyCode2.Digit3=51]="Digit3",KeyCode2[KeyCode2.Digit4=52]="Digit4",KeyCode2[KeyCode2.Digit5=53]="Digit5",KeyCode2[KeyCode2.Digit6=54]="Digit6",KeyCode2[KeyCode2.Digit7=55]="Digit7",KeyCode2[KeyCode2.Digit8=56]="Digit8",KeyCode2[KeyCode2.Digit9=57]="Digit9",KeyCode2[KeyCode2.A=65]="A",KeyCode2[KeyCode2.B=66]="B",KeyCode2[KeyCode2.C=67]="C",KeyCode2[KeyCode2.D=68]="D",KeyCode2[KeyCode2.E=69]="E",KeyCode2[KeyCode2.F=70]="F",KeyCode2[KeyCode2.G=71]="G",KeyCode2[KeyCode2.H=72]="H",KeyCode2[KeyCode2.I=73]="I",KeyCode2[KeyCode2.J=74]="J",KeyCode2[KeyCode2.K=75]="K",KeyCode2[KeyCode2.L=76]="L",KeyCode2[KeyCode2.M=77]="M",KeyCode2[KeyCode2.N=78]="N",KeyCode2[KeyCode2.O=79]="O",KeyCode2[KeyCode2.P=80]="P",KeyCode2[KeyCode2.Q=81]="Q",KeyCode2[KeyCode2.R=82]="R",KeyCode2[KeyCode2.S=83]="S",KeyCode2[KeyCode2.T=84]="T",KeyCode2[KeyCode2.U=85]="U",KeyCode2[KeyCode2.V=86]="V",KeyCode2[KeyCode2.W=87]="W",KeyCode2[KeyCode2.X=88]="X",KeyCode2[KeyCode2.Y=89]="Y",KeyCode2[KeyCode2.Z=90]="Z",KeyCode2[KeyCode2.F1=112]="F1",KeyCode2[KeyCode2.F2=113]="F2",KeyCode2[KeyCode2.F3=114]="F3",KeyCode2[KeyCode2.F4=115]="F4",KeyCode2[KeyCode2.F5=116]="F5",KeyCode2[KeyCode2.F6=117]="F6",KeyCode2[KeyCode2.F7=118]="F7",KeyCode2[KeyCode2.F8=119]="F8",KeyCode2[KeyCode2.F9=120]="F9",KeyCode2[KeyCode2.F10=121]="F10",KeyCode2[KeyCode2.F11=122]="F11",KeyCode2[KeyCode2.F12=123]="F12",KeyCode2[KeyCode2.NUM_LOCK=144]="NUM_LOCK",KeyCode2[KeyCode2.SCROLL_LOCK=145]="SCROLL_LOCK",KeyCode2[KeyCode2.EQUAL=187]="EQUAL",KeyCode2[KeyCode2.COMMA=188]="COMMA",KeyCode2[KeyCode2.MINUS=189]="MINUS",KeyCode2[KeyCode2.PERIOD=190]="PERIOD",KeyCode2[KeyCode2.BACK_SLASH=220]="BACK_SLASH",KeyCode2))(KeyCode$1||{});const KeyCodeToChar={8:"Backspace",9:"Tab",13:"Enter",46:"Del",27:"Esc",32:"Space",37:"←",39:"→",38:"↑",40:"↓",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",189:"-",187:"=",190:".",188:",",220:"\\"};var MetaKeys=(MetaKeys2=>(MetaKeys2[MetaKeys2.SHIFT=1024]="SHIFT",MetaKeys2[MetaKeys2.ALT=2048]="ALT",MetaKeys2[MetaKeys2.CTRL_COMMAND=4096]="CTRL_COMMAND",MetaKeys2[MetaKeys2.MAC_CTRL=8192]="MAC_CTRL",MetaKeys2))(MetaKeys||{});function fromGlobalEvent(type,listener,options){return window.addEventListener(type,listener,options),core.toDisposable(()=>window.removeEventListener(type,listener,options))}__name(fromGlobalEvent,"fromGlobalEvent");const IPlatformService=core.createIdentifier("ui.platform.service"),_PlatformService=class _PlatformService{get isMac(){return/Mac/.test(navigator.appVersion)}get isWindows(){return/Windows/.test(navigator.appVersion)}get isLinux(){return/Linux/.test(navigator.appVersion)}};__name(_PlatformService,"PlatformService");let PlatformService=_PlatformService;var __defProp$e=Object.defineProperty,__getOwnPropDesc$e=Object.getOwnPropertyDescriptor,__decorateClass$e=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$e(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$e(target,key,result),result},"__decorateClass$e"),__decorateParam$e=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$e");const IShortcutService=core.createIdentifier("ui.shortcut.service");var _a4;exports.ShortcutService=(_a4=class extends core.Disposable{constructor(_commandService,_platformService,_contextService,_layoutService){super();__publicField(this,"_shortCutMapping",new Map);__publicField(this,"_commandIDMapping",new Map);__publicField(this,"_shortcutChanged$",new rxjs.Subject);__publicField(this,"shortcutChanged$",this._shortcutChanged$.asObservable());__publicField(this,"_forceEscaped",!1);this._commandService=_commandService,this._platformService=_platformService,this._contextService=_contextService,this._layoutService=_layoutService,this.disposeWithMe(fromGlobalEvent("keydown",e2=>{this._resolveKeyboardEvent(e2)},{capture:!0}))}getAllShortcuts(){return Array.from(this._shortCutMapping.values()).map(v2=>Array.from(v2.values())).flat()}registerShortcut(shortcut){const binding=this._getBindingFromItem(shortcut),bindingSet=this._shortCutMapping.get(binding);bindingSet?bindingSet.add(shortcut):this._shortCutMapping.set(binding,new Set([shortcut]));const commandID=shortcut.id,commandIDSet=this._commandIDMapping.get(commandID);return commandIDSet?commandIDSet.add(shortcut):this._commandIDMapping.set(commandID,new Set([shortcut])),this._emitShortcutChanged(),core.toDisposable(()=>{var _a19,_b,_c,_d;(_a19=this._shortCutMapping.get(binding))==null||_a19.delete(shortcut),((_b=this._shortCutMapping.get(binding))==null?void 0:_b.size)===0&&this._shortCutMapping.delete(binding),(_c=this._commandIDMapping.get(commandID))==null||_c.delete(shortcut),((_d=this._commandIDMapping.get(commandID))==null?void 0:_d.size)===0&&this._commandIDMapping.delete(commandID),this._emitShortcutChanged()})}getShortcutDisplayOfCommand(id){const set=this._commandIDMapping.get(id);if(!set)return null;const shortcut=set.values().next().value;return shortcut?this.getShortcutDisplay(shortcut):null}getShortcutDisplay(shortcut){var _a19;const binding=this._getBindingFromItem(shortcut),ctrlKey=binding&MetaKeys.CTRL_COMMAND,shiftKey=binding&MetaKeys.SHIFT,altKey=binding&MetaKeys.ALT,macCtrl=binding&MetaKeys.MAC_CTRL,body=(_a19=KeyCodeToChar[binding&255])!=null?_a19:"<->";return this._platformService.isMac?`${ctrlKey?"⌘":""}${shiftKey?"⇧":""}${altKey?"⌥":""}${macCtrl?"⌃":""}${body}`:`${ctrlKey?"Ctrl+":""}${shiftKey?"Shift+":""}${altKey?"Alt+":""}${body}`}_emitShortcutChanged(){this._shortcutChanged$.next()}forceEscape(){return this._forceEscaped=!0,core.toDisposable(()=>this._forceEscaped=!1)}_resolveKeyboardEvent(e2){if(this._forceEscaped||this._layoutService&&!this._layoutService.checkElementInCurrentContainers(e2.target))return;this._dispatch(e2)&&e2.preventDefault()}_dispatch(e2){const binding=this._deriveBindingFromEvent(e2);if(binding===null)return!1;const shortcuts=this._shortCutMapping.get(binding);if(shortcuts===void 0)return!1;const shouldTrigger=Array.from(shortcuts).sort((s1,s2)=>{var _a19,_b;return((_a19=s2.priority)!=null?_a19:0)-((_b=s1.priority)!=null?_b:0)}).find(s=>{var _a19,_b;return(_b=(_a19=s.preconditions)==null?void 0:_a19.call(s,this._contextService))!=null?_b:!0});return shouldTrigger?(this._commandService.executeCommand(shouldTrigger.id,shouldTrigger.staticParameters),!0):!1}_getBindingFromItem(item){return this._platformService.isMac&&item.mac?item.mac:this._platformService.isWindows&&item.win?item.win:this._platformService.isLinux&&item.linux?item.linux:item.binding}_deriveBindingFromEvent(e2){const{shiftKey,metaKey,altKey,keyCode}=e2;let binding=keyCode;return shiftKey&&(binding|=MetaKeys.SHIFT),altKey&&(binding|=MetaKeys.ALT),(this._platformService.isMac?metaKey:e2.ctrlKey)&&(binding|=MetaKeys.CTRL_COMMAND),this._platformService.isMac&&e2.ctrlKey&&(binding|=MetaKeys.MAC_CTRL),binding}},__name(_a4,"ShortcutService"),_a4);exports.ShortcutService=__decorateClass$e([__decorateParam$e(0,core.ICommandService),__decorateParam$e(1,IPlatformService),__decorateParam$e(2,core.IContextService),__decorateParam$e(3,core.Optional(ILayoutService))],exports.ShortcutService);var __defProp$d=Object.defineProperty,__getOwnPropDesc$d=Object.getOwnPropertyDescriptor,__decorateClass$d=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$d(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$d(target,key,result),result},"__decorateClass$d"),__decorateParam$d=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$d");function whenEditorFocused(contextService){return contextService.getContextValue(core.FOCUSING_UNIVER_EDITOR)}__name(whenEditorFocused,"whenEditorFocused");const CopyShortcutItem={id:CopyCommand.id,description:"shortcut.copy",group:"1_common-edit",binding:KeyCode$1.C|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},CutShortcutItem={id:CutCommand.id,description:"shortcut.cut",group:"1_common-edit",binding:KeyCode$1.X|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},OnlyDisplayPasteShortcutItem={id:PasteCommand.id,description:"shortcut.paste",group:"1_common-edit",binding:KeyCode$1.V|MetaKeys.CTRL_COMMAND,preconditions:__name(()=>!1,"preconditions")},UndoShortcutItem={id:core.UndoCommand.id,description:"shortcut.undo",group:"1_common-edit",binding:KeyCode$1.Z|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused},RedoShortcutItem={id:core.RedoCommand.id,description:"shortcut.redo",group:"1_common-edit",binding:KeyCode$1.Y|MetaKeys.CTRL_COMMAND,preconditions:whenEditorFocused};var _a5;exports.SharedController=(_a5=class extends core.Disposable{constructor(_shortcutService,_commandService){super(),this._shortcutService=_shortcutService,this._commandService=_commandService,this.initialize()}initialize(){this._registerCommands(),this._registerShortcuts()}_registerCommands(){[CutCommand,CopyCommand,PasteCommand,SetEditorResizeOperation].forEach(command=>this.disposeWithMe(this._commandService.registerMultipleCommand(command)))}_registerShortcuts(){const shortcutItems=[UndoShortcutItem,RedoShortcutItem];shortcutItems.push(CutShortcutItem,CopyShortcutItem,OnlyDisplayPasteShortcutItem),shortcutItems.forEach(shortcut=>this.disposeWithMe(this._shortcutService.registerShortcut(shortcut)))}},__name(_a5,"SharedController"),_a5);exports.SharedController=__decorateClass$d([__decorateParam$d(0,IShortcutService),__decorateParam$d(1,core.ICommandService)],exports.SharedController);const shortcutPanelGroupTitle="univer-shortcut-panel-group-title",shortcutPanelItem="univer-shortcut-panel-item",shortcutPanelItemTitle="univer-shortcut-panel-item-title",shortcutPanelItemShortcut="univer-shortcut-panel-item-shortcut",styles$a={shortcutPanelGroupTitle,shortcutPanelItem,shortcutPanelItemTitle,shortcutPanelItemShortcut};function ShortcutPanel(){const shortcutService=core.useDependency(IShortcutService),localeService=core.useDependency(core.LocaleService),currentLocale=useObservable(localeService.currentLocale$),[shortcutItems,setShortcutItems]=React.useState([]),updateShortcuts=React.useCallback(()=>{var _a19;const shortcutGroups=new Map,shortcuts=shortcutService.getAllShortcuts().filter(item=>!!item.group);for(const shortcut of shortcuts){const group=shortcut.group,shortcutItem={title:localeService.t((_a19=shortcut.description)!=null?_a19:shortcut.id),shortcut:shortcutService.getShortcutDisplay(shortcut)};if(!/\d+_[a-zA-Z0-9]/.test(group))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${group}!`);shortcutGroups.has(group)||shortcutGroups.set(group,[]),shortcutGroups.get(group).push(shortcutItem)}const toRender=Array.from(shortcutGroups.entries()).map(([name,items])=>{const groupSequence=name.split("_")[0],groupName=name.slice(groupSequence.length+1);return{sequence:+groupSequence,name:localeService.t(groupName),items}}).sort((a,b2)=>a.sequence-b2.sequence);setShortcutItems(toRender)},[shortcutService,localeService,currentLocale]);return React.useEffect(()=>{updateShortcuts();const subscription=shortcutService.shortcutChanged$.subscribe(()=>updateShortcuts());return()=>subscription.unsubscribe()},[shortcutService,updateShortcuts]),jsxRuntimeExports.jsx("div",{className:styles$a.shortcutPanel,children:shortcutItems.map(group=>jsxRuntimeExports.jsxs("div",{className:styles$a.shortcutPanelGroup,children:[jsxRuntimeExports.jsx("div",{className:styles$a.shortcutPanelGroupTitle,children:group.name}),group.items.map((item,index)=>jsxRuntimeExports.jsxs("div",{className:styles$a.shortcutPanelItem,children:[jsxRuntimeExports.jsx("span",{className:styles$a.shortcutPanelItemTitle,children:item.title}),jsxRuntimeExports.jsx("span",{className:styles$a.shortcutPanelItemShortcut,children:item.shortcut})]},`${item.title}-${item.shortcut}`))]},group.name))})}__name(ShortcutPanel,"ShortcutPanel");var __defProp$c=Object.defineProperty,__getOwnPropDesc$c=Object.getOwnPropertyDescriptor,__decorateClass$c=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$c(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$c(target,key,result),result},"__decorateClass$c"),__decorateParam$c=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$c");const ToggleShortcutPanelShortcut={id:ToggleShortcutPanelOperation.id,binding:MetaKeys.CTRL_COMMAND|KeyCode$1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};var _a6;exports.ShortcutPanelController=(_a6=class extends core.Disposable{constructor(injector,componentManager,shortcutService,_menuManagerService,commandService){super(),this._menuManagerService=_menuManagerService,this.disposeWithMe(componentManager.register(ShortcutPanelComponentName,ShortcutPanel)),this.disposeWithMe(commandService.registerCommand(ToggleShortcutPanelOperation)),this.disposeWithMe(shortcutService.registerShortcut(ToggleShortcutPanelShortcut))}},__name(_a6,"ShortcutPanelController"),_a6);exports.ShortcutPanelController=__decorateClass$c([__decorateParam$c(0,core.Inject(core.Injector)),__decorateParam$c(1,core.Inject(ComponentManager)),__decorateParam$c(2,IShortcutService),__decorateParam$c(3,IMenuManagerService),__decorateParam$c(4,core.ICommandService)],exports.ShortcutPanelController);const IUIController=core.createIdentifier("univer.ui.ui-controller");var render$1={},interopRequireWildcard={exports:{}},_typeof$2={exports:{}};(function(module2){function _typeof3(o){"@babel/helpers - typeof";return module2.exports=_typeof3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},module2.exports.__esModule=!0,module2.exports.default=module2.exports,_typeof3(o)}__name(_typeof3,"_typeof"),module2.exports=_typeof3,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(_typeof$2);var _typeofExports=_typeof$2.exports;(function(module2){var _typeof3=_typeofExports.default;function _getRequireWildcardCache(e2){if(typeof WeakMap!="function")return null;var r2=new WeakMap,t2=new WeakMap;return(_getRequireWildcardCache=__name(function(e3){return e3?t2:r2},"_getRequireWildcardCache"))(e2)}__name(_getRequireWildcardCache,"_getRequireWildcardCache");function _interopRequireWildcard2(e2,r2){if(!r2&&e2&&e2.__esModule)return e2;if(e2===null||_typeof3(e2)!="object"&&typeof e2!="function")return{default:e2};var t2=_getRequireWildcardCache(r2);if(t2&&t2.has(e2))return t2.get(e2);var n2={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u2 in e2)if(u2!=="default"&&{}.hasOwnProperty.call(e2,u2)){var i=a?Object.getOwnPropertyDescriptor(e2,u2):null;i&&(i.get||i.set)?Object.defineProperty(n2,u2,i):n2[u2]=e2[u2]}return n2.default=e2,t2&&t2.set(e2,n2),n2}__name(_interopRequireWildcard2,"_interopRequireWildcard"),module2.exports=_interopRequireWildcard2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(interopRequireWildcard);var interopRequireWildcardExports=interopRequireWildcard.exports,interopRequireDefault={exports:{}};(function(module2){function _interopRequireDefault2(e2){return e2&&e2.__esModule?e2:{default:e2}}__name(_interopRequireDefault2,"_interopRequireDefault"),module2.exports=_interopRequireDefault2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(interopRequireDefault);var interopRequireDefaultExports=interopRequireDefault.exports,regeneratorRuntime={exports:{}};(function(module2){var _typeof3=_typeofExports.default;function _regeneratorRuntime(){module2.exports=_regeneratorRuntime=__name(function(){return e2},"_regeneratorRuntime"),module2.exports.__esModule=!0,module2.exports.default=module2.exports;var t2,e2={},r2=Object.prototype,n2=r2.hasOwnProperty,o=Object.defineProperty||function(t3,e3,r3){t3[e3]=r3.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",c2=i.asyncIterator||"@@asyncIterator",u2=i.toStringTag||"@@toStringTag";function define(t3,e3,r3){return Object.defineProperty(t3,e3,{value:r3,enumerable:!0,configurable:!0,writable:!0}),t3[e3]}__name(define,"define");try{define({},"")}catch{define=__name(function(t4,e3,r3){return t4[e3]=r3},"define")}function wrap(t3,e3,r3,n3){var i2=e3&&e3.prototype instanceof Generator?e3:Generator,a2=Object.create(i2.prototype),c3=new Context2(n3||[]);return o(a2,"_invoke",{value:makeInvokeMethod(t3,r3,c3)}),a2}__name(wrap,"wrap");function tryCatch(t3,e3,r3){try{return{type:"normal",arg:t3.call(e3,r3)}}catch(t4){return{type:"throw",arg:t4}}}__name(tryCatch,"tryCatch"),e2.wrap=wrap;var h2="suspendedStart",l2="suspendedYield",f2="executing",s="completed",y={};function Generator(){}__name(Generator,"Generator");function GeneratorFunction(){}__name(GeneratorFunction,"GeneratorFunction");function GeneratorFunctionPrototype(){}__name(GeneratorFunctionPrototype,"GeneratorFunctionPrototype");var p2={};define(p2,a,function(){return this});var d2=Object.getPrototypeOf,v2=d2&&d2(d2(values([])));v2&&v2!==r2&&n2.call(v2,a)&&(p2=v2);var g2=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p2);function defineIteratorMethods(t3){["next","throw","return"].forEach(function(e3){define(t3,e3,function(t4){return this._invoke(e3,t4)})})}__name(defineIteratorMethods,"defineIteratorMethods");function AsyncIterator(t3,e3){function invoke(r4,o2,i2,a2){var c3=tryCatch(t3[r4],t3,o2);if(c3.type!=="throw"){var u3=c3.arg,h3=u3.value;return h3&&_typeof3(h3)=="object"&&n2.call(h3,"__await")?e3.resolve(h3.__await).then(function(t4){invoke("next",t4,i2,a2)},function(t4){invoke("throw",t4,i2,a2)}):e3.resolve(h3).then(function(t4){u3.value=t4,i2(u3)},function(t4){return invoke("throw",t4,i2,a2)})}a2(c3.arg)}__name(invoke,"invoke");var r3;o(this,"_invoke",{value:__name(function(t4,n3){function callInvokeWithMethodAndArg(){return new e3(function(e4,r4){invoke(t4,n3,e4,r4)})}return __name(callInvokeWithMethodAndArg,"callInvokeWithMethodAndArg"),r3=r3?r3.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()},"value")})}__name(AsyncIterator,"AsyncIterator");function makeInvokeMethod(e3,r3,n3){var o2=h2;return function(i2,a2){if(o2===f2)throw Error("Generator is already running");if(o2===s){if(i2==="throw")throw a2;return{value:t2,done:!0}}for(n3.method=i2,n3.arg=a2;;){var c3=n3.delegate;if(c3){var u3=maybeInvokeDelegate(c3,n3);if(u3){if(u3===y)continue;return u3}}if(n3.method==="next")n3.sent=n3._sent=n3.arg;else if(n3.method==="throw"){if(o2===h2)throw o2=s,n3.arg;n3.dispatchException(n3.arg)}else n3.method==="return"&&n3.abrupt("return",n3.arg);o2=f2;var p3=tryCatch(e3,r3,n3);if(p3.type==="normal"){if(o2=n3.done?s:l2,p3.arg===y)continue;return{value:p3.arg,done:n3.done}}p3.type==="throw"&&(o2=s,n3.method="throw",n3.arg=p3.arg)}}}__name(makeInvokeMethod,"makeInvokeMethod");function maybeInvokeDelegate(e3,r3){var n3=r3.method,o2=e3.iterator[n3];if(o2===t2)return r3.delegate=null,n3==="throw"&&e3.iterator.return&&(r3.method="return",r3.arg=t2,maybeInvokeDelegate(e3,r3),r3.method==="throw")||n3!=="return"&&(r3.method="throw",r3.arg=new TypeError("The iterator does not provide a '"+n3+"' method")),y;var i2=tryCatch(o2,e3.iterator,r3.arg);if(i2.type==="throw")return r3.method="throw",r3.arg=i2.arg,r3.delegate=null,y;var a2=i2.arg;return a2?a2.done?(r3[e3.resultName]=a2.value,r3.next=e3.nextLoc,r3.method!=="return"&&(r3.method="next",r3.arg=t2),r3.delegate=null,y):a2:(r3.method="throw",r3.arg=new TypeError("iterator result is not an object"),r3.delegate=null,y)}__name(maybeInvokeDelegate,"maybeInvokeDelegate");function pushTryEntry(t3){var e3={tryLoc:t3[0]};1 in t3&&(e3.catchLoc=t3[1]),2 in t3&&(e3.finallyLoc=t3[2],e3.afterLoc=t3[3]),this.tryEntries.push(e3)}__name(pushTryEntry,"pushTryEntry");function resetTryEntry(t3){var e3=t3.completion||{};e3.type="normal",delete e3.arg,t3.completion=e3}__name(resetTryEntry,"resetTryEntry");function Context2(t3){this.tryEntries=[{tryLoc:"root"}],t3.forEach(pushTryEntry,this),this.reset(!0)}__name(Context2,"Context");function values(e3){if(e3||e3===""){var r3=e3[a];if(r3)return r3.call(e3);if(typeof e3.next=="function")return e3;if(!isNaN(e3.length)){var o2=-1,i2=__name(function next(){for(;++o2<e3.length;)if(n2.call(e3,o2))return next.value=e3[o2],next.done=!1,next;return next.value=t2,next.done=!0,next},"next");return i2.next=i2}}throw new TypeError(_typeof3(e3)+" is not iterable")}return __name(values,"values"),GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g2,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u2,"GeneratorFunction"),e2.isGeneratorFunction=function(t3){var e3=typeof t3=="function"&&t3.constructor;return!!e3&&(e3===GeneratorFunction||(e3.displayName||e3.name)==="GeneratorFunction")},e2.mark=function(t3){return Object.setPrototypeOf?Object.setPrototypeOf(t3,GeneratorFunctionPrototype):(t3.__proto__=GeneratorFunctionPrototype,define(t3,u2,"GeneratorFunction")),t3.prototype=Object.create(g2),t3},e2.awrap=function(t3){return{__await:t3}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c2,function(){return this}),e2.AsyncIterator=AsyncIterator,e2.async=function(t3,r3,n3,o2,i2){i2===void 0&&(i2=Promise);var a2=new AsyncIterator(wrap(t3,r3,n3,o2),i2);return e2.isGeneratorFunction(r3)?a2:a2.next().then(function(t4){return t4.done?t4.value:a2.next()})},defineIteratorMethods(g2),define(g2,u2,"Generator"),define(g2,a,function(){return this}),define(g2,"toString",function(){return"[object Generator]"}),e2.keys=function(t3){var e3=Object(t3),r3=[];for(var n3 in e3)r3.push(n3);return r3.reverse(),__name(function next(){for(;r3.length;){var t4=r3.pop();if(t4 in e3)return next.value=t4,next.done=!1,next}return next.done=!0,next},"next")},e2.values=values,Context2.prototype={constructor:Context2,reset:__name(function(e3){if(this.prev=0,this.next=0,this.sent=this._sent=t2,this.done=!1,this.delegate=null,this.method="next",this.arg=t2,this.tryEntries.forEach(resetTryEntry),!e3)for(var r3 in this)r3.charAt(0)==="t"&&n2.call(this,r3)&&!isNaN(+r3.slice(1))&&(this[r3]=t2)},"reset"),stop:__name(function(){this.done=!0;var t3=this.tryEntries[0].completion;if(t3.type==="throw")throw t3.arg;return this.rval},"stop"),dispatchException:__name(function(e3){if(this.done)throw e3;var r3=this;function handle(n3,o3){return a2.type="throw",a2.arg=e3,r3.next=n3,o3&&(r3.method="next",r3.arg=t2),!!o3}__name(handle,"handle");for(var o2=this.tryEntries.length-1;o2>=0;--o2){var i2=this.tryEntries[o2],a2=i2.completion;if(i2.tryLoc==="root")return handle("end");if(i2.tryLoc<=this.prev){var c3=n2.call(i2,"catchLoc"),u3=n2.call(i2,"finallyLoc");if(c3&&u3){if(this.prev<i2.catchLoc)return handle(i2.catchLoc,!0);if(this.prev<i2.finallyLoc)return handle(i2.finallyLoc)}else if(c3){if(this.prev<i2.catchLoc)return handle(i2.catchLoc,!0)}else{if(!u3)throw Error("try statement without catch or finally");if(this.prev<i2.finallyLoc)return handle(i2.finallyLoc)}}}},"dispatchException"),abrupt:__name(function(t3,e3){for(var r3=this.tryEntries.length-1;r3>=0;--r3){var o2=this.tryEntries[r3];if(o2.tryLoc<=this.prev&&n2.call(o2,"finallyLoc")&&this.prev<o2.finallyLoc){var i2=o2;break}}i2&&(t3==="break"||t3==="continue")&&i2.tryLoc<=e3&&e3<=i2.finallyLoc&&(i2=null);var a2=i2?i2.completion:{};return a2.type=t3,a2.arg=e3,i2?(this.method="next",this.next=i2.finallyLoc,y):this.complete(a2)},"abrupt"),complete:__name(function(t3,e3){if(t3.type==="throw")throw t3.arg;return t3.type==="break"||t3.type==="continue"?this.next=t3.arg:t3.type==="return"?(this.rval=this.arg=t3.arg,this.method="return",this.next="end"):t3.type==="normal"&&e3&&(this.next=e3),y},"complete"),finish:__name(function(t3){for(var e3=this.tryEntries.length-1;e3>=0;--e3){var r3=this.tryEntries[e3];if(r3.finallyLoc===t3)return this.complete(r3.completion,r3.afterLoc),resetTryEntry(r3),y}},"finish"),catch:__name(function(t3){for(var e3=this.tryEntries.length-1;e3>=0;--e3){var r3=this.tryEntries[e3];if(r3.tryLoc===t3){var n3=r3.completion;if(n3.type==="throw"){var o2=n3.arg;resetTryEntry(r3)}return o2}}throw Error("illegal catch attempt")},"_catch"),delegateYield:__name(function(e3,r3,n3){return this.delegate={iterator:values(e3),resultName:r3,nextLoc:n3},this.method==="next"&&(this.arg=t2),y},"delegateYield")},e2}__name(_regeneratorRuntime,"_regeneratorRuntime"),module2.exports=_regeneratorRuntime,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(regeneratorRuntime);var regeneratorRuntimeExports=regeneratorRuntime.exports,asyncToGenerator={exports:{}};(function(module2){function asyncGeneratorStep(n2,t2,e2,r2,o,a,c2){try{var i=n2[a](c2),u2=i.value}catch(n3){return void e2(n3)}i.done?t2(u2):Promise.resolve(u2).then(r2,o)}__name(asyncGeneratorStep,"asyncGeneratorStep");function _asyncToGenerator(n2){return function(){var t2=this,e2=arguments;return new Promise(function(r2,o){var a=n2.apply(t2,e2);function _next(n3){asyncGeneratorStep(a,r2,o,_next,_throw,"next",n3)}__name(_next,"_next");function _throw(n3){asyncGeneratorStep(a,r2,o,_next,_throw,"throw",n3)}__name(_throw,"_throw"),_next(void 0)})}}__name(_asyncToGenerator,"_asyncToGenerator"),module2.exports=_asyncToGenerator,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(asyncToGenerator);var asyncToGeneratorExports=asyncToGenerator.exports,objectSpread2={exports:{}},defineProperty={exports:{}},toPropertyKey$2={exports:{}},toPrimitive$2={exports:{}};(function(module2){var _typeof3=_typeofExports.default;function toPrimitive2(t2,r2){if(_typeof3(t2)!="object"||!t2)return t2;var e2=t2[Symbol.toPrimitive];if(e2!==void 0){var i=e2.call(t2,r2||"default");if(_typeof3(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r2==="string"?String:Number)(t2)}__name(toPrimitive2,"toPrimitive"),module2.exports=toPrimitive2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(toPrimitive$2);var toPrimitiveExports=toPrimitive$2.exports;(function(module2){var _typeof3=_typeofExports.default,toPrimitive2=toPrimitiveExports;function toPropertyKey2(t2){var i=toPrimitive2(t2,"string");return _typeof3(i)=="symbol"?i:i+""}__name(toPropertyKey2,"toPropertyKey"),module2.exports=toPropertyKey2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(toPropertyKey$2);var toPropertyKeyExports=toPropertyKey$2.exports;(function(module2){var toPropertyKey2=toPropertyKeyExports;function _defineProperty2(e2,r2,t2){return(r2=toPropertyKey2(r2))in e2?Object.defineProperty(e2,r2,{value:t2,enumerable:!0,configurable:!0,writable:!0}):e2[r2]=t2,e2}__name(_defineProperty2,"_defineProperty"),module2.exports=_defineProperty2,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(defineProperty);var definePropertyExports=defineProperty.exports;(function(module2){var defineProperty2=definePropertyExports;function ownKeys2(e2,r2){var t2=Object.keys(e2);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e2);r2&&(o=o.filter(function(r3){return Object.getOwnPropertyDescriptor(e2,r3).enumerable})),t2.push.apply(t2,o)}return t2}__name(ownKeys2,"ownKeys");function _objectSpread22(e2){for(var r2=1;r2<arguments.length;r2++){var t2=arguments[r2]!=null?arguments[r2]:{};r2%2?ownKeys2(Object(t2),!0).forEach(function(r3){defineProperty2(e2,r3,t2[r3])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e2,Object.getOwnPropertyDescriptors(t2)):ownKeys2(Object(t2)).forEach(function(r3){Object.defineProperty(e2,r3,Object.getOwnPropertyDescriptor(t2,r3))})}return e2}__name(_objectSpread22,"_objectSpread2"),module2.exports=_objectSpread22,module2.exports.__esModule=!0,module2.exports.default=module2.exports})(objectSpread2);var objectSpread2Exports=objectSpread2.exports,_interopRequireWildcard=interopRequireWildcardExports.default,_interopRequireDefault=interopRequireDefaultExports.default;Object.defineProperty(render$1,"__esModule",{value:!0});render$1._r=_r;render$1._u=_u;var render_2=render$1.render=render,unmount_1=render$1.unmount=unmount,_regeneratorRuntime2=_interopRequireDefault(regeneratorRuntimeExports),_asyncToGenerator2=_interopRequireDefault(asyncToGeneratorExports),_typeof2=_interopRequireDefault(_typeofExports),_objectSpread2$2=_interopRequireDefault(objectSpread2Exports),ReactDOM=_interopRequireWildcard(ReactDOM$1),fullClone=(0,_objectSpread2$2.default)({},ReactDOM),version=fullClone.version,reactRender=fullClone.render,unmountComponentAtNode=fullClone.unmountComponentAtNode,createRoot;try{var mainVersion=Number((version||"").split(".")[0]);mainVersion>=18&&(createRoot=fullClone.createRoot)}catch{}function toggleWarning(skip){var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED&&(0,_typeof2.default)(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==="object"&&(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=skip)}__name(toggleWarning,"toggleWarning");var MARK="__rc_react_root__";function modernRender(node,container){toggleWarning(!0);var root=container[MARK]||createRoot(container);toggleWarning(!1),root.render(node),container[MARK]=root}__name(modernRender,"modernRender");function legacyRender(node,container){reactRender(node,container)}__name(legacyRender,"legacyRender");function _r(node,container){}__name(_r,"_r");function render(node,container){if(createRoot){modernRender(node,container);return}legacyRender(node,container)}__name(render,"render");function modernUnmount(_x){return _modernUnmount.apply(this,arguments)}__name(modernUnmount,"modernUnmount");function _modernUnmount(){return _modernUnmount=(0,_asyncToGenerator2.default)((0,_regeneratorRuntime2.default)().mark(__name(function _callee(container){return(0,_regeneratorRuntime2.default)().wrap(__name(function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",Promise.resolve().then(function(){var _container$MARK;(_container$MARK=container[MARK])===null||_container$MARK===void 0||_container$MARK.unmount(),delete container[MARK]}));case 1:case"end":return _context.stop()}},"_callee$"),_callee)},"_callee"))),_modernUnmount.apply(this,arguments)}__name(_modernUnmount,"_modernUnmount");function legacyUnmount(container){unmountComponentAtNode(container)}__name(legacyUnmount,"legacyUnmount");function _u(container){}__name(_u,"_u");function unmount(_x2){return _unmount.apply(this,arguments)}__name(unmount,"unmount");function _unmount(){return _unmount=(0,_asyncToGenerator2.default)((0,_regeneratorRuntime2.default)().mark(__name(function _callee2(container){return(0,_regeneratorRuntime2.default)().wrap(__name(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(createRoot===void 0){_context2.next=2;break}return _context2.abrupt("return",modernUnmount(container));case 2:legacyUnmount(container);case 3:case"end":return _context2.stop()}},"_callee2$"),_callee2)},"_callee2"))),_unmount.apply(this,arguments)}__name(_unmount,"_unmount");var BuiltInUIPart=(BuiltInUIPart2=>(BuiltInUIPart2.GLOBAL="global",BuiltInUIPart2.HEADER="header",BuiltInUIPart2.HEADER_MENU="header-menu",BuiltInUIPart2.CONTENT="content",BuiltInUIPart2.FOOTER="footer",BuiltInUIPart2.LEFT_SIDEBAR="left-sidebar",BuiltInUIPart2.FLOATING="floating",BuiltInUIPart2.UNIT="unit",BuiltInUIPart2))(BuiltInUIPart||{});const IUIPartsService=core.createIdentifier("ui.parts.service"),_UIPartsService=class _UIPartsService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_componentsByPart",new Map);__publicField(this,"_componentRegistered$",new rxjs.Subject);__publicField(this,"componentRegistered$",this._componentRegistered$.asObservable())}dispose(){super.dispose(),this._componentRegistered$.complete()}registerComponent(part,componentFactory){const componentType=componentFactory(),components=(this._componentsByPart.get(part)||this._componentsByPart.set(part,new Set).get(part)).add(componentType);return this._componentRegistered$.next(part),core.toDisposable(()=>{components.delete(componentType),components.size===0&&this._componentsByPart.delete(part),this._componentRegistered$.next(part)})}getComponents(part){return new Set([...this._componentsByPart.get(part)||new Set])}};__name(_UIPartsService,"UIPartsService");let UIPartsService=_UIPartsService;const _CanvasFloatDomService=class _CanvasFloatDomService{constructor(){__publicField(this,"_domLayerMap",new Map);__publicField(this,"_domLayers$",new rxjs.BehaviorSubject([]));__publicField(this,"domLayers$",this._domLayers$.asObservable())}get domLayers(){return Array.from(this._domLayerMap.entries())}_notice(){this._domLayers$.next(Array.from(this._domLayerMap.entries()))}addFloatDom(item){this._domLayerMap.set(item.id,item),this._notice()}removeFloatDom(id){this._domLayerMap.delete(id)&&this._notice()}removeAll(){this._domLayerMap.clear(),this._notice()}};__name(_CanvasFloatDomService,"CanvasFloatDomService");let CanvasFloatDomService=_CanvasFloatDomService;const floatDomWrapper="univer-float-dom-wrapper",floatDom="univer-float-dom",styles$9={floatDomWrapper,floatDom},FloatDomSingle=React.memo(props=>{const{layer,id}=props,componentManager=core.useDependency(ComponentManager),position=useObservable(layer.position$),Component=typeof layer.componentKey=="string"?componentManager.get(layer.componentKey):layer.componentKey,layerProps={data:layer.data,...layer.props};return position?jsxRuntimeExports.jsx("div",{className:styles$9.floatDomWrapper,style:{position:"absolute",top:position.startY,left:position.startX,width:Math.max(position.endX-position.startX-2,0),height:Math.max(position.endY-position.startY-2,0),transform:`rotate(${position.rotate}deg)`,overflow:"hidden"},onPointerMove:__name(e2=>{layer.onPointerMove(e2.nativeEvent)},"onPointerMove"),onPointerDown:__name(e2=>{layer.onPointerDown(e2.nativeEvent)},"onPointerDown"),onPointerUp:__name(e2=>{layer.onPointerUp(e2.nativeEvent)},"onPointerUp"),onWheel:__name(e2=>{layer.onWheel(e2.nativeEvent)},"onWheel"),children:jsxRuntimeExports.jsx("div",{id,className:styles$9.floatDom,style:{width:position.width,height:position.height,position:"absolute",...position.absolute.left?{left:0}:{right:0},...position.absolute.top?{top:0}:{bottom:0}},children:Component?jsxRuntimeExports.jsx(Component,{...layerProps}):null})}):null}),FloatDom=__name(({unitId})=>{var _a19,_b;const instanceService=core.useDependency(core.IUniverInstanceService),domLayerService=core.useDependency(CanvasFloatDomService),layers=useObservable(domLayerService.domLayers$),currentUnitId=unitId||((_a19=instanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET))==null?void 0:_a19.getUnitId());return(_b=layers==null?void 0:layers.filter(layer=>layer[1].unitId===currentUnitId))==null?void 0:_b.map(layer=>jsxRuntimeExports.jsx(FloatDomSingle,{id:layer[0],layer:layer[1]},layer[0]))},"FloatDom"),ICanvasPopupService=core.createIdentifier("ui.popup.service"),_CanvasPopupService=class _CanvasPopupService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_popupMap",new Map);__publicField(this,"_popups$",new rxjs.BehaviorSubject([]));__publicField(this,"popups$",this._popups$.asObservable());__publicField(this,"_activePopupId",null)}get popups(){return Array.from(this._popupMap.entries())}get activePopupId(){return this._activePopupId}_update(){this._popups$.next(Array.from(this._popupMap.entries()))}dispose(){super.dispose(),this._popups$.next([]),this._popups$.complete(),this._popupMap.clear()}addPopup(item){const id=core.Tools.generateRandomId();return this._popupMap.set(id,{...item,onPointerEnter:__name(()=>{this._activePopupId=id},"onPointerEnter"),onPointerLeave:__name(()=>{this._activePopupId===id&&(this._activePopupId=null)},"onPointerLeave")}),this._update(),id}removePopup(id){this._popupMap.delete(id)&&this._update()}removeAll(){this._popupMap.clear(),this._update()}};__name(_CanvasPopupService,"CanvasPopupService");let CanvasPopupService=_CanvasPopupService;const SingleCanvasPopup=__name(({popup,children})=>{const[hidden,setHidden]=React.useState(!1),anchorRect$=React.useMemo(()=>popup.anchorRect$.pipe(rxjs.throttleTime(0,rxjs.animationFrameScheduler)),[popup.anchorRect$]),excludeRects$=React.useMemo(()=>{var _a19;return(_a19=popup.excludeRects$)==null?void 0:_a19.pipe(rxjs.throttleTime(0,rxjs.animationFrameScheduler))},[popup.excludeRects$]),anchorRect=useObservable(anchorRect$,popup.anchorRect),excludeRects=useObservable(excludeRects$,popup.excludeRects),{offset,canvasElement,hideOnInvisible=!0,hiddenType="destroy"}=popup,rectWithOffset=React.useMemo(()=>{if(!anchorRect)return null;const{bottom,left,right,top}=anchorRect,[x=0,y=0]=offset!=null?offset:[];return{left:left-x,right:right+x,top:top-y,bottom:bottom+y}},[anchorRect,offset]);return React.useEffect(()=>{if(!hideOnInvisible||!rectWithOffset)return;const rect=canvasElement.getBoundingClientRect(),{top,left,bottom,right}=rect;rectWithOffset.bottom<top||rectWithOffset.top>bottom||rectWithOffset.right<left||rectWithOffset.left>right?setHidden(!0):setHidden(!1)},[rectWithOffset,canvasElement,hideOnInvisible]),hidden&&hiddenType==="destroy"||!rectWithOffset?null:jsxRuntimeExports.jsx(design.RectPopup,{hidden,anchorRect:rectWithOffset,direction:popup.direction,onClickOutside:popup.onClickOutside,excludeOutside:popup.excludeOutside,excludeRects,onPointerEnter:popup.onPointerEnter,onPointerLeave:popup.onPointerLeave,onClick:popup.onClick,onContextMenu:popup.onContextMenu,children})},"SingleCanvasPopup");function CanvasPopup(){const popupService=core.useDependency(ICanvasPopupService),componentManager=core.useDependency(ComponentManager);return useObservable(popupService.popups$,void 0,!0).map(item=>{const[key,popup]=item,Component=componentManager.get(popup.componentKey);return jsxRuntimeExports.jsx(SingleCanvasPopup,{popup,children:Component?jsxRuntimeExports.jsx(Component,{popup}):null},key)})}__name(CanvasPopup,"CanvasPopup");function ComponentContainer(props){const{components,fallback,sharedProps}=props;return!components||components.size===0?fallback!=null?fallback:null:Array.from(components.values()).map((component,index)=>{var _a19;return React.createElement(component,{key:`${(_a19=component.displayName)!=null?_a19:index}`,...sharedProps})})}__name(ComponentContainer,"ComponentContainer");function useComponentsOfPart(part,injector){var _a19;const uiPartsService=(_a19=injector==null?void 0:injector.get(IUIPartsService))!=null?_a19:core.useDependency(IUIPartsService),updateCounterRef=React.useRef(0),componentPartUpdateCount=useObservable(()=>uiPartsService.componentRegistered$.pipe(rxjs.filter(key=>key===part),rxjs.debounceTime(200),rxjs.map(()=>updateCounterRef.current+=1),rxjs.startWith(updateCounterRef.current+=1)),void 0,void 0,[uiPartsService,part]);return React.useMemo(()=>uiPartsService.getComponents(part),[componentPartUpdateCount])}__name(useComponentsOfPart,"useComponentsOfPart");const IContextMenuService=core.createIdentifier("ui.contextmenu.service"),_ContextMenuService=class _ContextMenuService extends core.Disposable{constructor(){super(...arguments);__publicField(this,"_currentHandler",null);__publicField(this,"disabled",!1)}get visible(){var _a19,_b;return(_b=(_a19=this._currentHandler)==null?void 0:_a19.visible)!=null?_b:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(event,menuType){var _a19;event.stopPropagation(),!this.disabled&&((_a19=this._currentHandler)==null||_a19.handleContextMenu(event,menuType))}hideContextMenu(){var _a19;(_a19=this._currentHandler)==null||_a19.hideContextMenu()}registerContextMenuHandler(handler){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=handler,core.toDisposable(()=>this._currentHandler=null)}};__name(_ContextMenuService,"ContextMenuService");let ContextMenuService=_ContextMenuService;function DesktopContextMenu(){const contentRef=React.useRef(null),[visible,setVisible]=React.useState(!1),[menuType,setMenuType]=React.useState(""),[offset,setOffset]=React.useState([0,0]),visibleRef=React.useRef(visible),contextMenuService=core.useDependency(IContextMenuService),commandService=core.useDependency(core.ICommandService),injector=core.useInjector();visibleRef.current=visible,React.useEffect(()=>{const disposables=contextMenuService.registerContextMenuHandler({handleContextMenu,hideContextMenu(){setVisible(!1)},get visible(){return visibleRef.current}});function handleClickOutside(event){contentRef.current&&!contentRef.current.contains(event.target)&&handleClose()}return __name(handleClickOutside,"handleClickOutside"),document.addEventListener("pointerdown",handleClickOutside),document.addEventListener("wheel",handleClose),()=>{document.removeEventListener("pointerdown",handleClickOutside),document.removeEventListener("wheel",handleClose),disposables.dispose()}},[contextMenuService]);function handleContextMenu(event,menuType2){setVisible(!1),requestAnimationFrame(()=>{setMenuType(menuType2),setOffset([event.clientX,event.clientY]),setVisible(!0)})}__name(handleContextMenu,"handleContextMenu");function handleClose(){setVisible(!1)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx(design.Popup,{visible,offset,children:jsxRuntimeExports.jsx("section",{ref:contentRef,children:menuType&&jsxRuntimeExports.jsx(Menu,{menuType,onOptionSelect:__name(params=>{const{label:id,commandId,value}=params;commandService&&commandService.executeCommand(commandId!=null?commandId:id,{value}),injector.get(ILayoutService).focus(),setVisible(!1)},"onOptionSelect")})})})}__name(DesktopContextMenu,"DesktopContextMenu");const toolbarBtn="univer-toolbar-btn",toolbarBtnActive="univer-toolbar-btn-active",styles$8={toolbarBtn,toolbarBtnActive};function ToolbarButton(props){const{children,className,style:style2,disabled=!1,active=!1,onClick,onDoubleClick,...restProps}=props,handleClick=__name(e2=>{if(disabled){e2.preventDefault();return}onClick&&onClick(e2)},"handleClick"),handleDoubleClick=__name(e2=>{if(disabled){e2.preventDefault();return}onDoubleClick&&onDoubleClick(e2)},"handleDoubleClick"),_className=clsx$1(styles$8.toolbarBtn,{[`${styles$8.toolbarBtn}-active`]:active},className);return jsxRuntimeExports.jsx("button",{className:_className,style:style2,disabled,onClick:handleClick,onDoubleClick:handleDoubleClick,...restProps,children})}__name(ToolbarButton,"ToolbarButton");const headerbar="univer-headerbar",headerMenu="univer-header-menu",menubar="univer-menubar",menubarItem="univer-menubar-item",menubarItemActive="univer-menubar-item-active",toolbar="univer-toolbar",toolbarContainer="univer-toolbar-container",toolbarMore="univer-toolbar-more",toolbarMoreContainer="univer-toolbar-more-container",toolbarGroup="univer-toolbar-group",toolbarItemSelectButton="univer-toolbar-item-select-button",toolbarItemSelectButtonDisabled="univer-toolbar-item-select-button-disabled",toolbarItemSelectButtonActivated="univer-toolbar-item-select-button-activated",toolbarItemSelectButtonLabel="univer-toolbar-item-select-button-label",toolbarItemSelectButtonArrow="univer-toolbar-item-select-button-arrow",toolbarItemSelect="univer-toolbar-item-select",toolbarItemSelectDisabled="univer-toolbar-item-select-disabled",toolbarItemSelectActivated="univer-toolbar-item-select-activated",toolbarItemSelectArrow="univer-toolbar-item-select-arrow",toolbarItemSelectArrowDisabled="univer-toolbar-item-select-arrow-disabled",toolbarItemSelectArrowActivated="univer-toolbar-item-select-arrow-activated",styles$7={headerbar,headerMenu,menubar,menubarItem,menubarItemActive,toolbar,toolbarContainer,toolbarMore,toolbarMoreContainer,toolbarGroup,toolbarItemSelectButton,toolbarItemSelectButtonDisabled,toolbarItemSelectButtonActivated,toolbarItemSelectButtonLabel,toolbarItemSelectButtonArrow,toolbarItemSelect,toolbarItemSelectDisabled,toolbarItemSelectActivated,toolbarItemSelectArrow,toolbarItemSelectArrowDisabled,toolbarItemSelectArrowActivated};var __defProp$b=Object.defineProperty,__getOwnPropDesc$b=Object.getOwnPropertyDescriptor,__decorateClass$b=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$b(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$b(target,key,result),result},"__decorateClass$b"),__decorateParam$b=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$b");const IMenuService=core.createIdentifier("univer.menu-service");var _a7;exports.MenuService=(_a7=class extends core.Disposable{constructor(_shortcutService,_menuManagerService,_logService){super();__publicField(this,"_menuItemMap",new Map);__publicField(this,"_menuByPositions",new Map);__publicField(this,"_menuConfigs",new Map);__publicField(this,"_menuChanged$",new rxjs.BehaviorSubject(void 0));__publicField(this,"menuChanged$",this._menuChanged$.asObservable());this._shortcutService=_shortcutService,this._menuManagerService=_menuManagerService,this._logService=_logService}dispose(){this._menuItemMap.clear(),this._menuChanged$.complete()}addMenuItem(item,config){if(this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.has(item.id))throw new Error(`Menu item with the same id ${item.id} has already been added!`);const menuItemConfig=config==null?void 0:config[item.id];return this._menuItemMap.set(item.id,mergeMenuConfigs(item,menuItemConfig)),Array.isArray(item.positions)?item.positions.forEach(menu=>this._appendMenuToPosition(item,menu)):item.positions&&this._appendMenuToPosition(item,item.positions),[MenuPosition.TOOLBAR_START,MenuPosition.TOOLBAR_INSERT,MenuPosition.TOOLBAR_FORMULAS,MenuPosition.TOOLBAR_DATA,MenuPosition.TOOLBAR_VIEW,MenuPosition.TOOLBAR_OTHERS,MenuPosition.CONTEXT_MENU].forEach(position=>{position!==MenuPosition.CONTEXT_MENU?this.getMenuItems(position).forEach(menu=>{var _a19;this._menuManagerService.mergeMenu({[position]:{[(_a19=menu.group)!=null?_a19:RibbonOthersGroup.OTHERS]:{[menu.id]:{menuItemFactory:__name(()=>menu,"menuItemFactory")}}}})}):this.getMenuItems(position).forEach(menu=>{var _a19;this._menuManagerService.mergeMenu({[position]:{[(_a19=menu.group)!=null?_a19:ContextMenuGroup.OTHERS]:{[menu.id]:{menuItemFactory:__name(()=>menu,"menuItemFactory")}}}})})}),this._menuChanged$.next(),core.toDisposable(()=>{if(this._menuItemMap.delete(item.id),Array.isArray(item.positions))item.positions.forEach(menu=>{const menus=this._menuByPositions.get(menu);if(!menus)return;const index=menus.findIndex(m2=>m2[0]===item.id);index>-1&&menus.splice(index,1)});else if(item.positions){const menus=this._menuByPositions.get(item.positions);if(!menus)return;const index=menus.findIndex(m2=>m2[0]===item.id);index>-1&&menus.splice(index,1)}this._menuChanged$.next()})}getMenuItems(positions){if(this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(positions)){const menuItems=this._menuByPositions.get(positions);if(menuItems)return[...menuItems.values()].map(menu=>this._getDisplayMenuItems(menu[1]))}return[]}setMenuItem(item){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.set(item.id,item),Array.isArray(item.positions)?item.positions.forEach(menu=>this._updateMenuItems(item,menu)):item.positions&&this._updateMenuItems(item,item.positions),this._menuChanged$.next()}getMenuItem(id){return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuItemMap.has(id)?this._menuItemMap.get(id):null}setMenuConfigs(id,config){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuConfigs.set(id,config)}getMenuConfig(id){return this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuConfigs.has(id)?this._menuConfigs.get(id):null}_getDisplayMenuItems(menuItem){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead.");const shortcut=this._shortcutService.getShortcutDisplayOfCommand(menuItem.id);return shortcut?{...menuItem,shortcut}:menuItem}_appendMenuToPosition(menu,position){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(position)||this._menuByPositions.set(position,[]);const menuList=this._menuByPositions.get(position);if(menuList.findIndex(m2=>m2[0]===menu.id)>-1)throw new Error(`Menu item with the same id ${menu.id} has already been added!`);menuList.push([menu.id,menu])}_updateMenuItems(menu,position){this._logService.warn("[MenuService]: MenuService is deprecated, please use MenuManagerService instead."),this._menuByPositions.has(position)||this._menuByPositions.set(position,[]);const menuList=this._menuByPositions.get(position),index=menuList.findIndex(m2=>m2[0]===menu.id);index>-1?menuList[index]=[menu.id,menu]:menuList.push([menu.id,menu])}},__name(_a7,"MenuService"),_a7);exports.MenuService=__decorateClass$b([__decorateParam$b(0,IShortcutService),__decorateParam$b(1,IMenuManagerService),__decorateParam$b(2,core.ILogService)],exports.MenuService);function useSimpleToolbarGroups(category){const menuService=core.useDependency(IMenuService),[visibleItems,setVisibleItems]=React.useState([]);return React.useEffect(()=>{const s=menuService.menuChanged$.subscribe(()=>{const menuItems=menuService.getMenuItems(category);setVisibleItems(menuItems)});return()=>s.unsubscribe()},[menuService,category]),visibleItems}__name(useSimpleToolbarGroups,"useSimpleToolbarGroups");function useToolbarGroups(categories,initCategory){const menuService=core.useDependency(IMenuService),[category,setCategory]=React.useState(initCategory!=null?initCategory:MenuPosition.TOOLBAR_START),[groups,setGroups]=React.useState([]),[visibleItems,setVisibleItems]=React.useState([]);React.useEffect(()=>{var _a19,_b;const activeItems=(_b=(_a19=groups.find(g2=>g2.name===category))==null?void 0:_a19.menuItems)!=null?_b:[],s=rxjs.combineLatest(activeItems.map(item=>{var _a20;return(_a20=item.hidden$)!=null?_a20:new rxjs.Observable(observer=>observer.next(!1))})).pipe(rxjs.map(hiddenValues=>activeItems.filter((_,index)=>!hiddenValues[index]))).subscribe(items=>setVisibleItems(items));return()=>s.unsubscribe()},[groups,category]),React.useEffect(()=>{const s=menuService.menuChanged$.subscribe(()=>{const group=[];for(const position of categories){const menuItems=menuService.getMenuItems(position);menuItems.length&&group.push({name:position,menuItems})}setGroups(group)});return()=>s.unsubscribe()},[menuService,category,categories]);const groupsByKey=React.useMemo(()=>{var _a19,_b;return(_b=(_a19=groups.find(g2=>g2.name===category))==null?void 0:_a19.menuItems.reduce((acc,item)=>{var _a20;const key=(_a20=item.group)!=null?_a20:MenuGroup.TOOLBAR_OTHERS;return acc[key]||(acc[key]=[]),acc[key].push(item),acc},{}))!=null?_b:{}},[groups,category]);return{setCategory,category,visibleItems,groups,groupsByKey}}__name(useToolbarGroups,"useToolbarGroups");function useToolbarItemStatus(menuItem){const{disabled$,hidden$,activated$,value$}=menuItem,[value,setValue]=React.useState(),[disabled,setDisabled]=React.useState(!1),[activated,setActivated]=React.useState(!1),[hidden,setHidden]=React.useState(!1);return React.useEffect(()=>{const subscriptions=[];return disabled$&&subscriptions.push(disabled$.subscribe(disabled2=>setDisabled(disabled2))),hidden$&&subscriptions.push(hidden$.subscribe(hidden2=>setHidden(hidden2))),activated$&&subscriptions.push(activated$.subscribe(activated2=>setActivated(activated2))),value$&&subscriptions.push(value$.subscribe(value2=>setValue(value2))),()=>subscriptions.forEach(subscription=>subscription.unsubscribe())},[activated$,disabled$,hidden$,value$]),{disabled,value,activated,hidden}}__name(useToolbarItemStatus,"useToolbarItemStatus");const TooltipWrapperContext=React.createContext({dropdownVisible:!1,setDropdownVisible:__name(_visible=>{},"setDropdownVisible")}),TooltipWrapper=React.forwardRef((props,ref)=>{const{children,...tooltipProps}=props,[tooltipVisible,setTooltipVisible]=React.useState(!1),[dropdownVisible,setDropdownVisible]=React.useState(!1);function handleChangeTooltipVisible(visible){setTooltipVisible(dropdownVisible?!1:visible)}__name(handleChangeTooltipVisible,"handleChangeTooltipVisible");function handleChangeDropdownVisible(visible){setDropdownVisible(visible),setTooltipVisible(!1)}__name(handleChangeDropdownVisible,"handleChangeDropdownVisible");const contextValue=React.useMemo(()=>({dropdownVisible,setDropdownVisible:handleChangeDropdownVisible}),[dropdownVisible]);return jsxRuntimeExports.jsx(design.Tooltip,{ref,...tooltipProps,visible:tooltipVisible,onVisibleChange:handleChangeTooltipVisible,children:jsxRuntimeExports.jsx("span",{children:jsxRuntimeExports.jsx(TooltipWrapperContext.Provider,{value:contextValue,children})})})});function DropdownWrapper(props){const{children,...dropdownProps}=props,{setDropdownVisible}=React.useContext(TooltipWrapperContext);function handleVisibleChange(visible){setDropdownVisible(visible)}return __name(handleVisibleChange,"handleVisibleChange"),jsxRuntimeExports.jsx(design.Dropdown,{onVisibleChange:handleVisibleChange,...dropdownProps,children:jsxRuntimeExports.jsx("div",{onClick:__name(e2=>e2.stopPropagation(),"onClick"),children})})}__name(DropdownWrapper,"DropdownWrapper");const ToolbarItem=React.forwardRef((props,ref)=>{const{align}=props,localeService=core.useDependency(core.LocaleService),commandService=core.useDependency(core.ICommandService),layoutService=core.useDependency(ILayoutService),componentManager=core.useDependency(ComponentManager),{value,hidden,disabled,activated}=useToolbarItemStatus(props),executeCommand=__name((commandId2,params)=>{layoutService.focus(),commandService.executeCommand(commandId2,params)},"executeCommand"),{tooltip,shortcut,icon,title,label,id,commandId}=props,tooltipTitle=localeService.t(tooltip!=null?tooltip:"")+(shortcut?` (${shortcut})`:""),{selections}=props,selections$=React.useMemo(()=>rxjs.isObservable(selections)?selections:new rxjs.Observable(subscribe=>{subscribe.next(selections)}),[selections]),options=useObservable(selections$),icon$=React.useMemo(()=>rxjs.isObservable(icon)?icon:new rxjs.Observable(subscribe=>{var _a19,_b;const v2=(_b=(_a19=options==null?void 0:options.find(o=>o.value===value))==null?void 0:_a19.icon)!=null?_b:icon;subscribe.next(v2)}),[icon,options,value]),iconToDisplay=useObservable(icon$,void 0,!0);function renderSelectorType(menuType){var _a19;const selectionsCommandId=props.selectionsCommandId,bId=commandId!=null?commandId:id,sId=(_a19=selectionsCommandId!=null?selectionsCommandId:commandId)!=null?_a19:id;function handleSelect(option){if(disabled)return;let commandId2=sId;option.id&&(commandId2=option.id),executeCommand(commandId2,{value:option.value})}__name(handleSelect,"handleSelect");function handleSelectionsValueChange(value2){disabled||executeCommand(sId,{value:value2})}__name(handleSelectionsValueChange,"handleSelectionsValueChange");function handleClick(){disabled||menuType===MenuItemType.BUTTON_SELECTOR&&executeCommand(bId,{value})}return __name(handleClick,"handleClick"),menuType===MenuItemType.BUTTON_SELECTOR?jsxRuntimeExports.jsxs("div",{className:clsx$1(styles$7.toolbarItemSelectButton,{[styles$7.toolbarItemSelectButtonDisabled]:disabled,[styles$7.toolbarItemSelectButtonActivated]:activated}),"data-disabled":disabled,children:[jsxRuntimeExports.jsx("div",{className:styles$7.toolbarItemSelectButtonLabel,onClick:handleClick,children:jsxRuntimeExports.jsx(CustomLabel,{icon:iconToDisplay,title,value,label,onChange:handleSelectionsValueChange})}),jsxRuntimeExports.jsx(DropdownWrapper,{disabled,align:align!=null?align:{targetOffset:[32,-12]},overlay:jsxRuntimeExports.jsx(Menu,{overViewport:"scroll",menuType:id,options,onOptionSelect:handleSelect,value}),children:jsxRuntimeExports.jsx("div",{className:clsx$1(styles$7.toolbarItemSelectButtonArrow,{[styles$7.toolbarItemSelectButtonArrowDisabled]:disabled,[styles$7.toolbarItemSelectButtonArrowActivated]:activated}),"data-disabled":disabled,children:jsxRuntimeExports.jsx(MoreDownSingle,{style:{height:"100%"}})})})]}):jsxRuntimeExports.jsx(DropdownWrapper,{disabled,overlay:jsxRuntimeExports.jsx(Menu,{overViewport:"scroll",menuType:id,options,onOptionSelect:handleSelect,value}),children:jsxRuntimeExports.jsxs("div",{className:clsx$1(styles$7.toolbarItemSelect,{[styles$7.toolbarItemSelectDisabled]:disabled,[styles$7.toolbarItemSelectActivated]:activated}),children:[jsxRuntimeExports.jsx(CustomLabel,{icon:iconToDisplay,title,value,label,onChange:handleSelectionsValueChange}),jsxRuntimeExports.jsx("div",{className:clsx$1(styles$7.toolbarItemSelectArrow,{[styles$7.toolbarItemSelectArrowDisabled]:disabled}),children:jsxRuntimeExports.jsx(MoreDownSingle,{})})]})})}__name(renderSelectorType,"renderSelectorType");function renderButtonType(){var _a19;const isCustomComponent=componentManager.get(typeof label=="string"?label:(_a19=label==null?void 0:label.name)!=null?_a19:"");return jsxRuntimeExports.jsx("span",{children:jsxRuntimeExports.jsx(ToolbarButton,{className:styles$7.toolbarItemTextButton,active:activated,disabled,onClick:__name(()=>{var _a20;return executeCommand((_a20=props.commandId)!=null?_a20:props.id)},"onClick"),onDoubleClick:__name(()=>props.subId&&executeCommand(props.subId),"onDoubleClick"),children:isCustomComponent?jsxRuntimeExports.jsx(CustomLabel,{title,value,label}):jsxRuntimeExports.jsx(CustomLabel,{icon})})})}__name(renderButtonType,"renderButtonType");function renderItem(){switch(props.type){case MenuItemType.BUTTON_SELECTOR:case MenuItemType.SELECTOR:case MenuItemType.SUBITEMS:return renderSelectorType(props.type);case MenuItemType.BUTTON:default:return renderButtonType()}}return __name(renderItem,"renderItem"),!hidden&&jsxRuntimeExports.jsx(TooltipWrapper,{ref,title:tooltipTitle,placement:"bottom",children:renderItem()})});function Ribbon(props){const{headerMenuComponents}=props,menuManagerService=core.useDependency(IMenuManagerService),localeService=core.useDependency(core.LocaleService),toolbarRef=React.useRef(null),toolbarItemRefs=React.useRef({}),[ribbon,setRibbon]=React.useState([]),[category,setCategory]=React.useState(RibbonPosition.START),[collapsedIds,setCollapsedIds]=React.useState([]);React.useEffect(()=>{function getRibbon(){const ribbon2=menuManagerService.getMenuByPositionKey(MenuManagerPosition.RIBBON);setRibbon(ribbon2)}__name(getRibbon,"getRibbon"),getRibbon();const subscription=menuManagerService.menuChanged$.subscribe(getRibbon);return()=>{subscription.unsubscribe()}},[menuManagerService]),React.useEffect(()=>{const observer=new ResizeObserver(entries=>{const toolbarWidth=entries[0].target.clientWidth,toolbarItems=Object.values(toolbarItemRefs.current),collapsedIds2=[];let totalWidth=90;for(const{el,key}of toolbarItems)el&&(totalWidth+=el.clientWidth+8,totalWidth>toolbarWidth&&collapsedIds2.push(key));setCollapsedIds(collapsedIds2)});return toolbarRef.current&&observer.observe(toolbarRef.current),()=>{observer.disconnect()}},[ribbon]);const hasHeaderMenu=React.useMemo(()=>headerMenuComponents&&headerMenuComponents.size>0||ribbon.length>1,[headerMenuComponents,ribbon]),activeGroup=React.useMemo(()=>{var _a19,_b;const allGroups=(_b=(_a19=ribbon.find(group=>group.key===category))==null?void 0:_a19.children)!=null?_b:[],visibleGroups=[],hiddenGroups=[];for(const item of allGroups)if(item.children){const visibleChildren=item.children.filter(child=>!collapsedIds.includes(child.key));visibleGroups.push({...item,children:visibleChildren}),visibleChildren.length<item.children.length&&hiddenGroups.push({...item,children:item.children.filter(child=>collapsedIds.includes(child.key))})}return{allGroups,visibleGroups,hiddenGroups}},[ribbon,category,collapsedIds]),fakeToolbarContent=React.useMemo(()=>activeGroup.allGroups.map(groupItem=>{var _a19;return jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:(_a19=groupItem.children)==null?void 0:_a19.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{ref:__name(ref=>{toolbarItemRefs.current[child.key]={el:ref==null?void 0:ref.nativeElement,key:child.key}},"ref"),...child.item},child.key))},groupItem.key)}),[activeGroup.allGroups]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[hasHeaderMenu&&jsxRuntimeExports.jsxs("header",{className:styles$7.headerbar,children:[jsxRuntimeExports.jsx("div",{className:styles$7.menubar,children:ribbon.length>1&&ribbon.map(group=>jsxRuntimeExports.jsx("a",{className:clsx$1(styles$7.menubarItem,{[styles$7.menubarItemActive]:group.key===category}),onClick:__name(()=>{setCategory(group.key)},"onClick"),children:localeService.t(group.key)},group.key))}),jsxRuntimeExports.jsx("div",{className:styles$7.headerMenu,children:jsxRuntimeExports.jsx(ComponentContainer,{components:headerMenuComponents})})]}),jsxRuntimeExports.jsx("section",{role:"ribbon",className:styles$7.toolbar,children:jsxRuntimeExports.jsxs("div",{className:styles$7.toolbarContainer,children:[activeGroup.visibleGroups.map(groupItem=>{var _a19,_b;return(((_a19=groupItem.children)==null?void 0:_a19.length)||groupItem.item)&&jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:groupItem.children?(_b=groupItem.children)==null?void 0:_b.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{...child.item},child.key)):groupItem.item&&jsxRuntimeExports.jsx(ToolbarItem,{...groupItem.item},groupItem.key)},groupItem.key)}),collapsedIds.length>0&&jsxRuntimeExports.jsx(TooltipWrapper,{title:localeService.t("ribbon.more"),placement:"bottom",children:jsxRuntimeExports.jsx(DropdownWrapper,{forceRender:!0,overlay:jsxRuntimeExports.jsx("div",{className:styles$7.toolbarMoreContainer,children:activeGroup.hiddenGroups.map(groupItem=>{var _a19;return jsxRuntimeExports.jsx("div",{className:styles$7.toolbarGroup,children:groupItem.children?(_a19=groupItem.children)==null?void 0:_a19.map(child=>child.item&&jsxRuntimeExports.jsx(ToolbarItem,{...child.item},child.key)):groupItem.item&&jsxRuntimeExports.jsx(ToolbarItem,{...groupItem.item},groupItem.key)},groupItem.key)})}),children:jsxRuntimeExports.jsx(ToolbarButton,{className:styles$7.toolbarItemTextButton,children:jsxRuntimeExports.jsx(MoreFunctionSingle,{})})})})]})}),jsxRuntimeExports.jsx("div",{ref:toolbarRef,className:styles$7.toolbarContainer,style:{position:"absolute",top:-9999,left:-9999,opacity:0},children:fakeToolbarContent})]})}__name(Ribbon,"Ribbon");const sidebar="univer-sidebar",sidebarOpen="univer-sidebar-open",sidebarContainer="univer-sidebar-container",sidebarHeader="univer-sidebar-header",sidebarHeaderClose="univer-sidebar-header-close",sidebarBody="univer-sidebar-body",sidebarFooter="univer-sidebar-footer",styles$6={sidebar,sidebarOpen,sidebarContainer,sidebarHeader,sidebarHeaderClose,sidebarBody,sidebarFooter};function Sidebar(){const sidebarService=core.useDependency(ISidebarService),sidebarOptions=useObservable(sidebarService.sidebarOptions$),scrollRef=React.useRef(null),options=React.useMemo(()=>{if(!sidebarOptions)return null;const copy={...sidebarOptions};for(const key of["children","header","footer"]){const k2=key;if(sidebarOptions[k2]){const props=sidebarOptions[k2];props&&(copy[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props}))}}return copy},[sidebarOptions]);React.useEffect(()=>{const handleScroll=__name(e2=>{sidebarService.scrollEvent$.next(e2)},"handleScroll"),scrollElement=scrollRef.current;return scrollElement&&scrollElement.addEventListener("scroll",handleScroll),()=>{scrollElement==null||scrollElement.removeEventListener("scroll",handleScroll)}},[sidebarService]);const _className=clsx$1(styles$6.sidebar,{[styles$6.sidebarOpen]:options==null?void 0:options.visible}),width=React.useMemo(()=>options!=null&&options.visible?typeof options.width=="number"?`${options.width}px`:options.width:0,[options]);function handleClose(){var _a19;const options2={...sidebarOptions,visible:!1};sidebarService.sidebarOptions$.next(options2),(_a19=options2==null?void 0:options2.onClose)==null||_a19.call(options2)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx("section",{className:_className,style:{width},children:jsxRuntimeExports.jsxs("section",{className:styles$6.sidebarContainer,ref:scrollRef,children:[jsxRuntimeExports.jsxs("header",{className:styles$6.sidebarHeader,children:[options==null?void 0:options.header,jsxRuntimeExports.jsx("a",{className:styles$6.sidebarHeaderClose,onClick:handleClose,children:jsxRuntimeExports.jsx(CloseSingle,{})})]}),jsxRuntimeExports.jsx("section",{className:styles$6.sidebarBody,style:options==null?void 0:options.bodyStyle,children:options==null?void 0:options.children}),(options==null?void 0:options.footer)&&jsxRuntimeExports.jsx("footer",{className:styles$6.sidebarFooter,children:options.footer})]})})}__name(Sidebar,"Sidebar");const IZenZoneService=core.createIdentifier("univer.zen-zone-service"),zenZone="univer-zen-zone",zenZoneOpen="univer-zen-zone-open",zenZoneClose="univer-zen-zone-close",styles$5={zenZone,zenZoneOpen,zenZoneClose};function ZenZone(){const zenZoneService=core.useDependency(IZenZoneService),[visible,setVisible]=React.useState(!1),[componentKey,setComponentKey]=React.useState(),hidden=core.useObservable(zenZoneService.temporaryHidden$),componentManager=core.useDependency(ComponentManager);React.useEffect(()=>{const subscriptions=[zenZoneService.visible$.subscribe(visible2=>{setVisible(visible2)}),zenZoneService.componentKey$.subscribe(componentKey2=>{setComponentKey(componentKey2)})];return()=>{subscriptions.forEach(subscription=>{subscription.unsubscribe()})}},[]);const _className=clsx$1(styles$5.zenZone,visible?styles$5.zenZoneOpen:styles$5.zenZoneClose),Component=React.useMemo(()=>{const Component2=componentManager.get(componentKey!=null?componentKey:"");if(Component2)return Component2},[componentKey]);return jsxRuntimeExports.jsx("section",{style:hidden?{display:"none"}:void 0,className:_className,children:Component&&jsxRuntimeExports.jsx(Component,{})})}__name(ZenZone,"ZenZone");const IGlobalZoneService=core.createIdentifier("univer.global-zone-service"),globalZone="univer-global-zone",globalZoneOpen="univer-global-zone-open",globalZoneClose="univer-global-zone-close",styles$4={globalZone,globalZoneOpen,globalZoneClose};function GlobalZone(){const globalZoneService=core.useDependency(IGlobalZoneService),[visible,setVisible]=React.useState(!1),componentKey=useObservable(globalZoneService.componentKey$,globalZoneService.componentKey),componentManager=core.useDependency(ComponentManager),_className=clsx$1(styles$4.globalZone,styles$4.globalZoneOpen),Component=React.useMemo(()=>{const Component2=componentManager.get(componentKey!=null?componentKey:"");if(Component2)return Component2},[componentKey,componentManager]);return React.useEffect(()=>{const subscription=globalZoneService.visible$.subscribe(val=>{setVisible(val)});return()=>{subscription.unsubscribe()}},[globalZoneService.visible$]),visible?jsxRuntimeExports.jsx("section",{className:_className,children:Component&&jsxRuntimeExports.jsx(Component,{})}):null}__name(GlobalZone,"GlobalZone");const builtInGlobalComponents=new Set([GlobalZone]),workbenchLayout="univer-workbench-layout",workbenchContainer="univer-workbench-container",workbenchContainerHeader="univer-workbench-container-header",workbenchContainerWrapper="univer-workbench-container-wrapper",workbenchContainerContent="univer-workbench-container-content",workbenchContainerDocContent="univer-workbench-container-doc-content",workbenchContainerCanvas="univer-workbench-container-canvas",workbenchContainerLeftSidebar="univer-workbench-container-left-sidebar",workbenchContainerSidebar="univer-workbench-container-sidebar",styles$3={workbenchLayout,workbenchContainer,workbenchContainerHeader,workbenchContainerWrapper,workbenchContainerContent,workbenchContainerDocContent,workbenchContainerCanvas,workbenchContainerLeftSidebar,workbenchContainerSidebar};function DesktopWorkbench(props){const{header=!0,toolbar:toolbar2=!0,footer=!0,contextMenu=!0,mountContainer,onRendered}=props,localeService=core.useDependency(core.LocaleService),themeService=core.useDependency(core.ThemeService),messageService=core.useDependency(IMessageService),instanceService=core.useDependency(core.IUniverInstanceService),contentRef=React.useRef(null),footerComponents=useComponentsOfPart(BuiltInUIPart.FOOTER),headerComponents=useComponentsOfPart(BuiltInUIPart.HEADER),headerMenuComponents=useComponentsOfPart(BuiltInUIPart.HEADER_MENU),contentComponents=useComponentsOfPart(BuiltInUIPart.CONTENT),leftSidebarComponents=useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR),globalComponents=useComponentsOfPart(BuiltInUIPart.GLOBAL),[focusUnitType,setFocusUnitType]=React.useState(core.UniverInstanceType.UNIVER_UNKNOWN);React.useEffect(()=>{const sub=instanceService.focused$.subscribe(id=>{if(id==null)return;const instanceType=instanceService.getUnitType(id);setFocusUnitType(instanceType)});return()=>{sub.unsubscribe()}},[]),React.useEffect(()=>{themeService.getCurrentTheme()||themeService.setTheme(design.defaultTheme)},[]),React.useEffect(()=>{contentRef.current&&(onRendered==null||onRendered(contentRef.current))},[onRendered]);const[locale,setLocale]=React.useState(localeService.getLocales()),portalContainer=React.useMemo(()=>document.createElement("div"),[]);return React.useEffect(()=>{document.body.appendChild(portalContainer),messageService.setContainer(portalContainer);const subscriptions=[localeService.localeChanged$.subscribe(()=>{setLocale(localeService.getLocales())}),themeService.currentTheme$.subscribe(theme=>{design.themeInstance.setTheme(mountContainer,theme),portalContainer&&design.themeInstance.setTheme(portalContainer,theme)})];return()=>{subscriptions.forEach(subscription=>subscription.unsubscribe()),document.body.removeChild(portalContainer)}},[localeService,messageService,mountContainer,portalContainer,themeService.currentTheme$]),jsxRuntimeExports.jsxs(design.ConfigProvider,{locale:locale==null?void 0:locale.design,mountContainer:portalContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.workbenchLayout,tabIndex:-1,onBlur:__name(e2=>e2.stopPropagation(),"onBlur"),children:[header&&toolbar2&&jsxRuntimeExports.jsx("header",{className:styles$3.workbenchContainerHeader,children:jsxRuntimeExports.jsx(Ribbon,{headerMenuComponents})}),jsxRuntimeExports.jsxs("section",{className:styles$3.workbenchContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$3.workbenchContainerWrapper,children:[jsxRuntimeExports.jsx("aside",{className:styles$3.workbenchContainerLeftSidebar,children:jsxRuntimeExports.jsx(ComponentContainer,{components:leftSidebarComponents},"left-sidebar")}),jsxRuntimeExports.jsxs("section",{className:clsx$1(styles$3.workbenchContainerContent,{[styles$3.workbenchContainerDocContent]:focusUnitType===core.UniverInstanceType.UNIVER_DOC}),children:[jsxRuntimeExports.jsx("header",{children:header&&jsxRuntimeExports.jsx(ComponentContainer,{components:headerComponents},"header")}),jsxRuntimeExports.jsx("section",{className:styles$3.workbenchContainerCanvas,ref:contentRef,"data-range-selector":!0,onContextMenu:__name(e2=>e2.preventDefault(),"onContextMenu"),children:jsxRuntimeExports.jsx(ComponentContainer,{components:contentComponents},"content")})]}),jsxRuntimeExports.jsx("aside",{className:styles$3.workbenchContainerSidebar,children:jsxRuntimeExports.jsx(Sidebar,{})})]}),footer&&jsxRuntimeExports.jsx("footer",{className:styles$3.workbenchFooter,children:jsxRuntimeExports.jsx(ComponentContainer,{components:footerComponents,sharedProps:{contextMenu}},"footer")}),jsxRuntimeExports.jsx(ZenZone,{})]})]}),jsxRuntimeExports.jsx(ComponentContainer,{components:globalComponents},"global"),jsxRuntimeExports.jsx(ComponentContainer,{components:builtInGlobalComponents},"built-in-global"),contextMenu&&jsxRuntimeExports.jsx(DesktopContextMenu,{}),jsxRuntimeExports.jsx(FloatingContainer,{})]})}__name(DesktopWorkbench,"DesktopWorkbench");function FloatingContainer(){const{mountContainer}=React.useContext(design.ConfigContext),floatingComponents=useComponentsOfPart(BuiltInUIPart.FLOATING);return ReactDOM$1.createPortal(jsxRuntimeExports.jsx(ComponentContainer,{components:floatingComponents},"floating"),mountContainer)}__name(FloatingContainer,"FloatingContainer");var __defProp$a=Object.defineProperty,__getOwnPropDesc$a=Object.getOwnPropertyDescriptor,__decorateClass$a=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$a(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$a(target,key,result),result},"__decorateClass$a"),__decorateParam$a=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$a");const STEADY_TIMEOUT$1=3e3;var _a8;exports.DesktopUIController=(_a8=class extends core.Disposable{constructor(_config,_renderManagerService,_instanceSrv,_injector,_lifecycleService,_uiPartsService,_menuManagerService,_layoutService){super();__publicField(this,"_steadyTimeout");__publicField(this,"_renderTimeout");this._config=_config,this._renderManagerService=_renderManagerService,this._instanceSrv=_instanceSrv,this._injector=_injector,this._lifecycleService=_lifecycleService,this._uiPartsService=_uiPartsService,this._menuManagerService=_menuManagerService,this._layoutService=_layoutService,this._initBuiltinComponents(),this._initMenus(),this._bootstrapWorkbench()}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_bootstrapWorkbench(){this.disposeWithMe(this._instanceSrv.unitDisposed$.subscribe(_unit=>{clearTimeout(this._steadyTimeout)})),this.disposeWithMe(bootstrap$1(this._injector,this._config,(contentElement,containerElement)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement)),this.disposeWithMe(this._layoutService.registerContentElement(contentElement))),this._renderManagerService.currentRender$.subscribe(renderId=>{if(renderId){const render2=this._renderManagerService.getRenderById(renderId);if(!render2.unitId||core.isInternalEditorID(render2.unitId))return;render2.engine.setContainer(contentElement)}}),this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(rxjs.filter(stage=>stage===core.LifecycleStages.Ready),rxjs.take(1)).subscribe(()=>{this._renderTimeout=setTimeout(()=>{const allRenders=this._renderManagerService.getRenderAll();for(const[key,render2]of allRenders)core.isInternalEditorID(key)||!render2.isRenderUnit||render2.engine.setContainer(contentElement);this._lifecycleService.stage=core.LifecycleStages.Rendered,this._steadyTimeout=setTimeout(()=>{this._lifecycleService.stage=core.LifecycleStages.Steady},STEADY_TIMEOUT$1)},300)}))}))}_initBuiltinComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.FLOATING,()=>core.connectInjector(CanvasPopup,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(FloatDom,this._injector)))}},__name(_a8,"DesktopUIController"),_a8);exports.DesktopUIController=__decorateClass$a([__decorateParam$a(1,engineRender.IRenderManagerService),__decorateParam$a(2,core.IUniverInstanceService),__decorateParam$a(3,core.Inject(core.Injector)),__decorateParam$a(4,core.Inject(core.LifecycleService)),__decorateParam$a(5,IUIPartsService),__decorateParam$a(6,IMenuManagerService),__decorateParam$a(7,core.Optional(ILayoutService))],exports.DesktopUIController);function bootstrap$1(injector,options,callback){let mountContainer;const container=options.container;if(typeof container=="string"){const containerElement=document.getElementById(container);containerElement?mountContainer=containerElement:mountContainer=createContainer$1(container)}else container instanceof HTMLElement?mountContainer=container:mountContainer=createContainer$1("univer");const ConnectedApp=core.connectInjector(DesktopWorkbench,injector),onRendered=__name(contentElement=>callback(contentElement,mountContainer),"onRendered");function render2(){render_2(jsxRuntimeExports.jsx(ConnectedApp,{...options,mountContainer,onRendered}),mountContainer)}return __name(render2,"render"),render2(),core.toDisposable(()=>{render_2(jsxRuntimeExports.jsx("div",{}),mountContainer),setTimeout(()=>render_2(jsxRuntimeExports.jsx("div",{}),mountContainer),200),setTimeout(()=>unmount_1(mountContainer),500)})}__name(bootstrap$1,"bootstrap$1");function createContainer$1(id){const element2=document.createElement("div");return element2.id=id,element2}__name(createContainer$1,"createContainer$1");const appLayout="univer-app-layout",appHeader="univer-app-header",appContainer="univer-app-container",appContainerHeader="univer-app-container-header",appContainerWrapper="univer-app-container-wrapper",appContainerContent="univer-app-container-content",appContainerCanvas="univer-app-container-canvas",appContainerLeftSidebar="univer-app-container-left-sidebar",appContainerSidebar="univer-app-container-sidebar",styles$2={appLayout,appHeader,appContainer,appContainerHeader,appContainerWrapper,appContainerContent,appContainerCanvas,appContainerLeftSidebar,appContainerSidebar},mobileMenuContainer="univer-mobile-menu-container",mobileMenuItem="univer-mobile-menu-item",styles$1={mobileMenuContainer,mobileMenuItem};function MobileMenu(props){const{menuType,onOptionSelect}=props,menuManagerService=core.useDependency(IMenuManagerService);if(!menuType)return null;const flattedMenuItems=React.useMemo(()=>{const menuItems=menuManagerService.getMenuByPositionKey(menuType);function flatMenuItems(items){return items.reduce((acc,item)=>item.children?[...acc,...flatMenuItems(item.children)]:[...acc,item],[])}return __name(flatMenuItems,"flatMenuItems"),flatMenuItems(menuItems)},[menuType]);return jsxRuntimeExports.jsx("div",{className:styles$1.mobileMenuContainer,style:{gridTemplateColumns:`repeat(${Math.min(2,flattedMenuItems.length)}, 48px)`},children:flattedMenuItems.map(item=>item.item&&jsxRuntimeExports.jsx(MobileMenuItem,{menuItem:item.item,onClick:__name(object=>onOptionSelect==null?void 0:onOptionSelect({value:"",label:item.key,...object}),"onClick")},item.key))})}__name(MobileMenu,"MobileMenu");function MobileMenuItem(props){const{menuItem,onClick}=props,{id,type,title,label,icon}=menuItem;if(type!==MenuItemType.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${id}".`);const disabled=core.useObservable(menuItem.disabled$,!1),activated=core.useObservable(menuItem.activated$,!1),hidden=core.useObservable(menuItem.hidden$,!1),value=core.useObservable(menuItem.value$),className=clsx$1(styles$1.mobileMenuItem,{[styles$1.mobileMenuItemActivated]:activated,[styles$1.mobileMenuItemHidden]:hidden});return jsxRuntimeExports.jsx("button",{type:"button",className,disabled,onClick:__name(()=>onClick({id}),"onClick"),children:jsxRuntimeExports.jsx(CustomLabel,{value,title,label,icon})},id)}__name(MobileMenuItem,"MobileMenuItem");function MobileContextMenu(){const[visible,setVisible]=React.useState(!1),[menuType,setMenuType]=React.useState(""),[offset,setOffset]=React.useState([0,0]),visibleRef=React.useRef(visible),contextMenuService=core.useDependency(IContextMenuService),commandService=core.useDependency(core.ICommandService);visibleRef.current=visible,React.useEffect(()=>{const disposables=contextMenuService.registerContextMenuHandler({handleContextMenu,hideContextMenu(){setVisible(!1)},get visible(){return visibleRef.current}});return document.addEventListener("pointerdown",handleClose),document.addEventListener("wheel",handleClose),()=>{document.removeEventListener("pointerdown",handleClose),document.removeEventListener("wheel",handleClose),disposables.dispose()}},[contextMenuService]);function handleContextMenu(event,menuType2){setMenuType(menuType2),setOffset([event.clientX,event.clientY]),setVisible(!0)}__name(handleContextMenu,"handleContextMenu");function handleClose(){setVisible(!1)}return __name(handleClose,"handleClose"),jsxRuntimeExports.jsx(design.Popup,{visible,offset,children:jsxRuntimeExports.jsx("section",{onPointerDown:__name(e2=>e2.stopPropagation(),"onPointerDown"),children:menuType&&jsxRuntimeExports.jsx(MobileMenu,{menuType,onOptionSelect:__name(params=>{const{label:id,value,commandId}=params;commandService&&commandService.executeCommand(commandId!=null?commandId:id,{value}),setVisible(!1)},"onOptionSelect")})})})}__name(MobileContextMenu,"MobileContextMenu");function MobileApp(props){const{header=!0,footer=!0,contextMenu=!0,mountContainer,onRendered}=props,localeService=core.useDependency(core.LocaleService),themeService=core.useDependency(core.ThemeService),messageService=core.useDependency(IMessageService),contentRef=React.useRef(null),footerComponents=useComponentsOfPart(BuiltInUIPart.FOOTER),headerComponents=useComponentsOfPart(BuiltInUIPart.HEADER);useComponentsOfPart(BuiltInUIPart.HEADER_MENU);const contentComponents=useComponentsOfPart(BuiltInUIPart.CONTENT),leftSidebarComponents=useComponentsOfPart(BuiltInUIPart.LEFT_SIDEBAR),globalComponents=useComponentsOfPart(BuiltInUIPart.GLOBAL);React.useEffect(()=>{themeService.getCurrentTheme()||themeService.setTheme(design.defaultTheme)},[]),React.useEffect(()=>{contentRef.current&&(onRendered==null||onRendered(contentRef.current))},[onRendered]);const[locale,setLocale]=React.useState(localeService.getLocales()),portalContainer=React.useMemo(()=>document.createElement("div"),[]);return React.useEffect(()=>{document.body.appendChild(portalContainer),messageService.setContainer(portalContainer);const subscriptions=[localeService.localeChanged$.subscribe(()=>{setLocale(localeService.getLocales())}),themeService.currentTheme$.subscribe(theme=>{design.themeInstance.setTheme(mountContainer,theme),portalContainer&&design.themeInstance.setTheme(portalContainer,theme)})];return()=>{subscriptions.forEach(subscription=>subscription.unsubscribe()),document.body.removeChild(portalContainer)}},[localeService,messageService,mountContainer,portalContainer,themeService.currentTheme$]),jsxRuntimeExports.jsxs(design.ConfigProvider,{locale:locale==null?void 0:locale.design,mountContainer:portalContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.appLayout,tabIndex:-1,onBlur:__name(e2=>e2.stopPropagation(),"onBlur"),children:[header&&jsxRuntimeExports.jsx("header",{className:styles$2.appContainerHeader}),jsxRuntimeExports.jsxs("section",{className:styles$2.appContainer,children:[jsxRuntimeExports.jsxs("div",{className:styles$2.appContainerWrapper,children:[jsxRuntimeExports.jsx("aside",{className:styles$2.appContainerLeftSidebar,children:jsxRuntimeExports.jsx(ComponentContainer,{components:leftSidebarComponents},"left-sidebar")}),jsxRuntimeExports.jsxs("section",{className:styles$2.appContainerContent,children:[jsxRuntimeExports.jsx("header",{className:styles$2.appHeader,children:header&&jsxRuntimeExports.jsx(ComponentContainer,{components:headerComponents},"header")}),jsxRuntimeExports.jsx("section",{className:styles$2.appContainerCanvas,ref:contentRef,"data-range-selector":!0,onContextMenu:__name(e2=>e2.preventDefault(),"onContextMenu"),children:jsxRuntimeExports.jsx(ComponentContainer,{components:contentComponents},"content")})]}),jsxRuntimeExports.jsx("aside",{className:styles$2.appContainerSidebar,children:jsxRuntimeExports.jsx(Sidebar,{})})]}),footer&&jsxRuntimeExports.jsx("footer",{className:styles$2.appFooter,children:jsxRuntimeExports.jsx(ComponentContainer,{components:footerComponents},"footer")}),jsxRuntimeExports.jsx(ZenZone,{})]})]}),jsxRuntimeExports.jsx(ComponentContainer,{components:globalComponents},"global"),jsxRuntimeExports.jsx(ComponentContainer,{components:builtInGlobalComponents},"built-in-global"),contextMenu&&jsxRuntimeExports.jsx(MobileContextMenu,{})]})}__name(MobileApp,"MobileApp");var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$9");const STEADY_TIMEOUT=3e3;var _a9;let MobileUIController=(_a9=class extends core.Disposable{constructor(_config,_instanceService,_renderManagerService,_injector,_lifecycleService,_uiPartsService,_menuManagerService,_layoutService){super(),this._config=_config,this._instanceService=_instanceService,this._renderManagerService=_renderManagerService,this._injector=_injector,this._lifecycleService=_lifecycleService,this._uiPartsService=_uiPartsService,this._menuManagerService=_menuManagerService,this._layoutService=_layoutService,this._initBuiltinComponents(),Promise.resolve().then(()=>this._bootstrapWorkbench())}_initMenus(){this._menuManagerService.mergeMenu(menuSchema)}_bootstrapWorkbench(){this.disposeWithMe(bootstrap(this._injector,this._config,(canvasElement,containerElement)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(containerElement)),this.disposeWithMe(this._layoutService.registerContentElement(canvasElement))),this._renderManagerService.currentRender$.subscribe(renderId=>{if(renderId){const render2=this._renderManagerService.getRenderById(renderId);if(!render2.unitId||this._instanceService.getUnitType(render2.unitId)!==core.UniverInstanceType.UNIVER_SHEET)return;render2.engine.setContainer(canvasElement)}}),setTimeout(()=>{var _a19;const engine=(_a19=this._renderManagerService.getFirst())==null?void 0:_a19.engine;engine==null||engine.setContainer(canvasElement),this._lifecycleService.stage=core.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=core.LifecycleStages.Steady,STEADY_TIMEOUT)},300)}))}_initBuiltinComponents(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(CanvasPopup,this._injector))),this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT,()=>core.connectInjector(FloatDom,this._injector)))}},__name(_a9,"MobileUIController"),_a9);MobileUIController=__decorateClass$9([__decorateParam$9(1,core.IUniverInstanceService),__decorateParam$9(2,engineRender.IRenderManagerService),__decorateParam$9(3,core.Inject(core.Injector)),__decorateParam$9(4,core.Inject(core.LifecycleService)),__decorateParam$9(5,IUIPartsService),__decorateParam$9(6,IMenuManagerService),__decorateParam$9(7,core.Optional(ILayoutService))],MobileUIController);function bootstrap(injector,options,callback){let mountContainer;const container=options.container;if(typeof container=="string"){const containerElement=document.getElementById(container);containerElement?mountContainer=containerElement:mountContainer=createContainer(container)}else container instanceof HTMLElement?mountContainer=container:mountContainer=createContainer("univer");const ConnectedApp=core.connectInjector(MobileApp,injector),onRendered=__name(canvasElement=>callback(canvasElement,mountContainer),"onRendered");function render2(){render_2(jsxRuntimeExports.jsx(ConnectedApp,{...options,mountContainer,onRendered}),mountContainer)}return __name(render2,"render"),render2(),core.toDisposable(()=>{unmount_1(mountContainer)})}__name(bootstrap,"bootstrap");function createContainer(id){const element2=document.createElement("div");return element2.id=id,element2}__name(createContainer,"createContainer");const INotificationService=core.createIdentifier("ui.notification.service");var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$8");const IBeforeCloseService=core.createIdentifier("univer.ui.before-close-service");var _a10;exports.DesktopBeforeCloseService=(_a10=class{constructor(_notificationService){__publicField(this,"_beforeUnloadCallbacks",[]);__publicField(this,"_onCloseCallbacks",[]);this._notificationService=_notificationService,this._init()}registerBeforeClose(callback){return this._beforeUnloadCallbacks.push(callback),{dispose:__name(()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(cb=>cb!==callback)},"dispose")}}registerOnClose(callback){return this._onCloseCallbacks.push(callback),{dispose:__name(()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(cb=>cb!==callback)},"dispose")}}_init(){window.addEventListener("beforeunload",_event=>{let event=_event;const message=this._beforeUnloadCallbacks.map(callback=>callback()).filter(m2=>!!m2).join(`
|
|
10
|
+
`);if(message)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:message}),typeof event>"u"&&(event=window.event),event.returnValue=message,message}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(callback=>callback())})}},__name(_a10,"DesktopBeforeCloseService"),_a10);exports.DesktopBeforeCloseService=__decorateClass$8([__decorateParam$8(0,INotificationService)],exports.DesktopBeforeCloseService);function supportClipboardAPI(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}__name(supportClipboardAPI,"supportClipboardAPI");var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$7");const PLAIN_TEXT_CLIPBOARD_MIME_TYPE="text/plain",HTML_CLIPBOARD_MIME_TYPE="text/html",IClipboardInterfaceService=core.createIdentifier("univer.clipboard-interface-service");var _a11;exports.BrowserClipboardService=(_a11=class extends core.Disposable{constructor(_localeService,_logService,_notificationService){super(),this._localeService=_localeService,this._logService=_logService,this._notificationService=_notificationService}get supportClipboard(){return supportClipboardAPI()}async write(text,html){if(!this.supportClipboard)return this._legacyCopyHtml(html);try{return await navigator.clipboard.write([new ClipboardItem({[PLAIN_TEXT_CLIPBOARD_MIME_TYPE]:new Blob([text],{type:PLAIN_TEXT_CLIPBOARD_MIME_TYPE}),[HTML_CLIPBOARD_MIME_TYPE]:new Blob([html],{type:HTML_CLIPBOARD_MIME_TYPE})})])}catch(error){this._logService.error("[BrowserClipboardService]",error),this._showClipboardAuthenticationNotification()}}async writeText(text){if(!this.supportClipboard)return this._legacyCopyText(text);try{return await navigator.clipboard.writeText(text)}catch(error){this._logService.error("[BrowserClipboardService]",error),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(e2){return this._logService.error("[BrowserClipboardService]",e2),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(e2){return this._logService.error("[BrowserClipboardService]",e2),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(html){const activeElement=document.activeElement,container=createCopyHtmlContainer();document.body.appendChild(container),container.innerHTML=html;try{select(container),document.execCommand("copy")}finally{activeElement instanceof HTMLElement&&activeElement.focus(),document.body.removeChild(container)}}_legacyCopyText(text){const activeElement=document.activeElement,container=createCopyTextContainer();document.body.appendChild(container),container.value=text;try{select(container),document.execCommand("copy")}finally{activeElement instanceof HTMLElement&&activeElement.focus(),document.body.removeChild(container)}}_showClipboardAuthenticationNotification(){var _a19;(_a19=this._notificationService)==null||_a19.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},__name(_a11,"BrowserClipboardService"),_a11);exports.BrowserClipboardService=__decorateClass$7([__decorateParam$7(0,core.Inject(core.LocaleService)),__decorateParam$7(1,core.ILogService),__decorateParam$7(2,core.Optional(INotificationService))],exports.BrowserClipboardService);function createCopyTextContainer(){const textArea=document.createElement("textarea");return textArea.style.position="absolute",textArea.style.height="1px",textArea.style.width="1px",textArea.style.opacity="0",textArea.readOnly=!0,textArea}__name(createCopyTextContainer,"createCopyTextContainer");function createCopyHtmlContainer(){const div=document.createElement("div");return div.contentEditable="true",div.style.position="absolute",div.style.opacity="0",div.style.height="1px",div.style.width="1px",div}__name(createCopyHtmlContainer,"createCopyHtmlContainer");function select(element2){if(element2 instanceof HTMLTextAreaElement){const isReadOnly=element2.hasAttribute("readonly");return isReadOnly||element2.setAttribute("readonly",""),element2.select(),element2.setSelectionRange(0,element2.value.length),isReadOnly||element2.removeAttribute("readonly"),element2.value}element2.hasAttribute("contenteditable")&&element2.focus();const range=document.createRange();range.selectNodeContents(element2);const selection=window.getSelection();if(!selection)throw new Error;return selection.removeAllRanges(),selection.addRange(range),selection.toString()}__name(select,"select");const IConfirmService=core.createIdentifier("univer.confirm-service");function ConfirmPart(){const confirmService=core.useDependency(IConfirmService),[confirmOptions,setConfirmOptions]=React.useState([]);React.useEffect(()=>{const subscription=confirmService.confirmOptions$.subscribe(options=>{setConfirmOptions(options)});return()=>{subscription.unsubscribe()}},[]);const props=confirmOptions.map(options=>{const{children,title,...restProps}=options,confirmProps=restProps;for(const key of["children","title"]){const k2=key,props2=options[k2];props2&&(confirmProps[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props2}))}return confirmProps});return props==null?void 0:props.map((options,index)=>jsxRuntimeExports.jsx(design.Confirm,{...options},index))}__name(ConfirmPart,"ConfirmPart");var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$6"),_a12;exports.DesktopConfirmService=(_a12=class extends core.Disposable{constructor(_injector,_uiPartsService){super();__publicField(this,"_confirmOptions",[]);__publicField(this,"confirmOptions$",new rxjs.BehaviorSubject([]));this._injector=_injector,this._uiPartsService=_uiPartsService,this._initUIPart()}open(option){return this._confirmOptions.find(item=>item.id===option.id)?this._confirmOptions=this._confirmOptions.map(item=>({...item.id===option.id?option:item,visible:item.id===option.id?!0:item.visible})):this._confirmOptions.push({...option,visible:!0}),this.confirmOptions$.next(this._confirmOptions),core.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(params){return new Promise(resolve=>{const disposeHandler=this.open({...params,onConfirm:__name(()=>{disposeHandler.dispose(),resolve(!0)},"onConfirm"),onClose:__name(()=>{disposeHandler.dispose(),resolve(!1)},"onClose")})})}close(id){this._confirmOptions=this._confirmOptions.map(item=>({...item,visible:item.id===id?!1:item.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL,()=>core.connectInjector(ConfirmPart,this._injector)))}},__name(_a12,"DesktopConfirmService"),_a12);exports.DesktopConfirmService=__decorateClass$6([__decorateParam$6(0,core.Inject(core.Injector)),__decorateParam$6(1,IUIPartsService)],exports.DesktopConfirmService);const IDialogService=core.createIdentifier("univer.ui.dialog-service");function DialogPart(){const dialogService=core.useDependency(IDialogService),[dialogOptions,setDialogOptions]=React.useState([]);React.useEffect(()=>{const subscription=dialogService.getDialogs$().subscribe(options=>{setDialogOptions(options)});return()=>subscription.unsubscribe()},[dialogService]);const attrs=dialogOptions.map(options=>{const{children,title,closeIcon,footer,...restProps}=options,dialogProps=restProps;for(const key of["children","title","closeIcon","footer"]){const k2=key,props=options[k2];props&&(dialogProps[k2]=jsxRuntimeExports.jsx(CustomLabel,{...props}))}return dialogProps});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:attrs==null?void 0:attrs.map(options=>jsxRuntimeExports.jsx(design.Dialog,{...options},options.id))})}__name(DialogPart,"DialogPart");var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$5"),_a13;exports.DesktopDialogService=(_a13=class extends core.Disposable{constructor(_injector,_uiPartsService){super();__publicField(this,"_dialogOptions",[]);__publicField(this,"_dialogOptions$",new rxjs.Subject);this._injector=_injector,this._uiPartsService=_uiPartsService,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions$.complete()}open(option){return this._dialogOptions.find(item=>item.id===option.id)?this._dialogOptions=this._dialogOptions.map(item=>({...item.id===option.id?option:item,visible:item.id===option.id?!0:item.visible})):this._dialogOptions.push({...option,visible:!0}),this._dialogOptions$.next(this._dialogOptions),core.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(id){this._dialogOptions=this._dialogOptions.map(item=>({...item,visible:item.id===id?!1:item.visible})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(expectIds){const expectIdSet=new Set(expectIds);this._dialogOptions=this._dialogOptions.map(item=>({...item,visible:expectIdSet.has(item.id)?item.visible:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.GLOBAL,()=>core.connectInjector(DialogPart,this._injector)))}},__name(_a13,"DesktopDialogService"),_a13);exports.DesktopDialogService=__decorateClass$5([__decorateParam$5(0,core.Inject(core.Injector)),__decorateParam$5(1,IUIPartsService)],exports.DesktopDialogService);var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$4"),_a14;exports.DesktopGlobalZoneService=(_a14=class{constructor(_componentManager){__publicField(this,"visible$",new rxjs.Subject);__publicField(this,"componentKey$",new rxjs.Subject);__publicField(this,"_componentKey","");this._componentManager=_componentManager}get componentKey(){return this._componentKey}set(key,component){return this._componentManager.register(key,component),this.componentKey$.next(key),this._componentKey=key,core.toDisposable(()=>{this._componentManager.delete(key),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},__name(_a14,"DesktopGlobalZoneService"),_a14);exports.DesktopGlobalZoneService=__decorateClass$4([__decorateParam$4(0,core.Inject(ComponentManager))],exports.DesktopGlobalZoneService);function commonjsRequire(path){throw new Error('Could not dynamically require "'+path+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}__name(commonjsRequire,"commonjsRequire");var localforage$1={exports:{}};/*!
|
|
11
11
|
localForage -- Offline Storage, Improved
|
|
12
12
|
Version 1.10.0
|
|
13
13
|
https://localforage.github.io/localForage
|
|
@@ -27,7 +27,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
27
27
|
* This source code is licensed under the MIT license found in the
|
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
|
29
29
|
*/var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");function v(a){if(typeof a=="object"&&a!==null){var r2=a.$$typeof;switch(r2){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r2}}case c:return r2}}}__name(v,"v");reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return!1};reactIs_production_min.isConcurrentMode=function(){return!1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};reactIs_production_min.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===d||a===f||a===e||a===m||a===n||a===t||typeof a=="object"&&a!==null&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||a.getModuleId!==void 0)};reactIs_production_min.typeOf=v;reactIs.exports=reactIs_production_min;var reactIsExports=reactIs.exports,fillRef=__name(function(ref,node){typeof ref=="function"?ref(node):_typeof(ref)==="object"&&ref&&"current"in ref&&(ref.current=node)},"fillRef"),supportRef=__name(function(nodeOrComponent){var _type$prototype,_nodeOrComponent$prot,type=reactIsExports.isMemo(nodeOrComponent)?nodeOrComponent.type.type:nodeOrComponent.type;return!(typeof type=="function"&&!((_type$prototype=type.prototype)!==null&&_type$prototype!==void 0&&_type$prototype.render)&&type.$$typeof!==reactIsExports.ForwardRef||typeof nodeOrComponent=="function"&&!((_nodeOrComponent$prot=nodeOrComponent.prototype)!==null&&_nodeOrComponent$prot!==void 0&&_nodeOrComponent$prot.render)&&nodeOrComponent.$$typeof!==reactIsExports.ForwardRef)},"supportRef");function isReactElement(node){return React.isValidElement(node)&&!reactIsExports.isFragment(node)}__name(isReactElement,"isReactElement");Number(React.version.split(".")[0])>=19;var Context=React__namespace.createContext({});function _classCallCheck(a,n2){if(!(a instanceof n2))throw new TypeError("Cannot call a class as a function")}__name(_classCallCheck,"_classCallCheck");function _defineProperties(e2,r2){for(var t2=0;t2<r2.length;t2++){var o=r2[t2];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e2,toPropertyKey$1(o.key),o)}}__name(_defineProperties,"_defineProperties");function _createClass(e2,r2,t2){return r2&&_defineProperties(e2.prototype,r2),t2&&_defineProperties(e2,t2),Object.defineProperty(e2,"prototype",{writable:!1}),e2}__name(_createClass,"_createClass");function _setPrototypeOf(t2,e2){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t3,e3){return t3.__proto__=e3,t3},_setPrototypeOf(t2,e2)}__name(_setPrototypeOf,"_setPrototypeOf");function _inherits(t2,e2){if(typeof e2!="function"&&e2!==null)throw new TypeError("Super expression must either be null or a function");t2.prototype=Object.create(e2&&e2.prototype,{constructor:{value:t2,writable:!0,configurable:!0}}),Object.defineProperty(t2,"prototype",{writable:!1}),e2&&_setPrototypeOf(t2,e2)}__name(_inherits,"_inherits");function _getPrototypeOf(t2){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t3){return t3.__proto__||Object.getPrototypeOf(t3)},_getPrototypeOf(t2)}__name(_getPrototypeOf,"_getPrototypeOf");function _isNativeReflectConstruct(){try{var t2=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_isNativeReflectConstruct=__name(function(){return!!t2},"_isNativeReflectConstruct"))()}__name(_isNativeReflectConstruct,"_isNativeReflectConstruct");function _assertThisInitialized(e2){if(e2===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e2}__name(_assertThisInitialized,"_assertThisInitialized");function _possibleConstructorReturn(t2,e2){if(e2&&(_typeof$1(e2)=="object"||typeof e2=="function"))return e2;if(e2!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t2)}__name(_possibleConstructorReturn,"_possibleConstructorReturn");function _createSuper(t2){var r2=_isNativeReflectConstruct();return function(){var e2,o=_getPrototypeOf(t2);if(r2){var s=_getPrototypeOf(this).constructor;e2=Reflect.construct(o,arguments,s)}else e2=o.apply(this,arguments);return _possibleConstructorReturn(this,e2)}}__name(_createSuper,"_createSuper");var DomWrapper=function(_React$Component){_inherits(DomWrapper2,_React$Component);var _super=_createSuper(DomWrapper2);function DomWrapper2(){return _classCallCheck(this,DomWrapper2),_super.apply(this,arguments)}return __name(DomWrapper2,"DomWrapper"),_createClass(DomWrapper2,[{key:"render",value:__name(function(){return this.props.children},"render")}]),DomWrapper2}(React__namespace.Component);function useEvent(callback){var fnRef=React__namespace.useRef();fnRef.current=callback;var memoFn=React__namespace.useCallback(function(){for(var _fnRef$current,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_fnRef$current=fnRef.current)===null||_fnRef$current===void 0?void 0:_fnRef$current.call.apply(_fnRef$current,[fnRef].concat(args))},[]);return memoFn}__name(useEvent,"useEvent");function _arrayWithHoles(r2){if(Array.isArray(r2))return r2}__name(_arrayWithHoles,"_arrayWithHoles");function _iterableToArrayLimit(r2,l2){var t2=r2==null?null:typeof Symbol<"u"&&r2[Symbol.iterator]||r2["@@iterator"];if(t2!=null){var e2,n2,i,u2,a=[],f2=!0,o=!1;try{if(i=(t2=t2.call(r2)).next,l2!==0)for(;!(f2=(e2=i.call(t2)).done)&&(a.push(e2.value),a.length!==l2);f2=!0);}catch(r3){o=!0,n2=r3}finally{try{if(!f2&&t2.return!=null&&(u2=t2.return(),Object(u2)!==u2))return}finally{if(o)throw n2}}return a}}__name(_iterableToArrayLimit,"_iterableToArrayLimit");function _arrayLikeToArray(r2,a){(a==null||a>r2.length)&&(a=r2.length);for(var e2=0,n2=Array(a);e2<a;e2++)n2[e2]=r2[e2];return n2}__name(_arrayLikeToArray,"_arrayLikeToArray");function _unsupportedIterableToArray(r2,a){if(r2){if(typeof r2=="string")return _arrayLikeToArray(r2,a);var t2={}.toString.call(r2).slice(8,-1);return t2==="Object"&&r2.constructor&&(t2=r2.constructor.name),t2==="Map"||t2==="Set"?Array.from(r2):t2==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2)?_arrayLikeToArray(r2,a):void 0}}__name(_unsupportedIterableToArray,"_unsupportedIterableToArray");function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
30
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}__name(_nonIterableRest,"_nonIterableRest");function _slicedToArray(r2,e2){return _arrayWithHoles(r2)||_iterableToArrayLimit(r2,e2)||_unsupportedIterableToArray(r2,e2)||_nonIterableRest()}__name(_slicedToArray,"_slicedToArray");function canUseDom(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}__name(canUseDom,"canUseDom");function useSafeState(defaultValue){var destroyRef=React__namespace.useRef(!1),_React$useState=React__namespace.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];React__namespace.useEffect(function(){return destroyRef.current=!1,function(){destroyRef.current=!0}},[]);function safeSetState(updater,ignoreDestroy){ignoreDestroy&&destroyRef.current||setValue(updater)}return __name(safeSetState,"safeSetState"),[value,safeSetState]}__name(useSafeState,"useSafeState");function toPrimitive(t2,r2){if(_typeof(t2)!="object"||!t2)return t2;var e2=t2[Symbol.toPrimitive];if(e2!==void 0){var i=e2.call(t2,r2||"default");if(_typeof(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r2==="string"?String:Number)(t2)}__name(toPrimitive,"toPrimitive");function toPropertyKey(t2){var i=toPrimitive(t2,"string");return _typeof(i)=="symbol"?i:i+""}__name(toPropertyKey,"toPropertyKey");function _defineProperty(e2,r2,t2){return(r2=toPropertyKey(r2))in e2?Object.defineProperty(e2,r2,{value:t2,enumerable:!0,configurable:!0,writable:!0}):e2[r2]=t2,e2}__name(_defineProperty,"_defineProperty");function ownKeys(e2,r2){var t2=Object.keys(e2);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e2);r2&&(o=o.filter(function(r3){return Object.getOwnPropertyDescriptor(e2,r3).enumerable})),t2.push.apply(t2,o)}return t2}__name(ownKeys,"ownKeys");function _objectSpread2(e2){for(var r2=1;r2<arguments.length;r2++){var t2=arguments[r2]!=null?arguments[r2]:{};r2%2?ownKeys(Object(t2),!0).forEach(function(r3){_defineProperty(e2,r3,t2[r3])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e2,Object.getOwnPropertyDescriptors(t2)):ownKeys(Object(t2)).forEach(function(r3){Object.defineProperty(e2,r3,Object.getOwnPropertyDescriptor(t2,r3))})}return e2}__name(_objectSpread2,"_objectSpread2");function useSyncState(defaultValue){var _React$useReducer=React__namespace.useReducer(function(x){return x+1},0),_React$useReducer2=_slicedToArray(_React$useReducer,2),forceUpdate=_React$useReducer2[1],currentValueRef=React__namespace.useRef(defaultValue),getValue=useEvent(function(){return currentValueRef.current}),setValue=useEvent(function(updater){currentValueRef.current=typeof updater=="function"?updater(currentValueRef.current):updater,forceUpdate()});return[getValue,setValue]}__name(useSyncState,"useSyncState");var STATUS_NONE="none",STATUS_APPEAR="appear",STATUS_ENTER="enter",STATUS_LEAVE="leave",STEP_NONE="none",STEP_PREPARE="prepare",STEP_START="start",STEP_ACTIVE="active",STEP_ACTIVATED="end",STEP_PREPARED="prepared";function makePrefixMap(styleProp,eventName){var prefixes={};return prefixes[styleProp.toLowerCase()]=eventName.toLowerCase(),prefixes["Webkit".concat(styleProp)]="webkit".concat(eventName),prefixes["Moz".concat(styleProp)]="moz".concat(eventName),prefixes["ms".concat(styleProp)]="MS".concat(eventName),prefixes["O".concat(styleProp)]="o".concat(eventName.toLowerCase()),prefixes}__name(makePrefixMap,"makePrefixMap");function getVendorPrefixes(domSupport,win){var prefixes={animationend:makePrefixMap("Animation","AnimationEnd"),transitionend:makePrefixMap("Transition","TransitionEnd")};return domSupport&&("AnimationEvent"in win||delete prefixes.animationend.animation,"TransitionEvent"in win||delete prefixes.transitionend.transition),prefixes}__name(getVendorPrefixes,"getVendorPrefixes");var vendorPrefixes=getVendorPrefixes(canUseDom(),typeof window<"u"?window:{}),style={};if(canUseDom()){var _document$createEleme=document.createElement("div");style=_document$createEleme.style}var prefixedEventNames={};function getVendorPrefixedEventName(eventName){if(prefixedEventNames[eventName])return prefixedEventNames[eventName];var prefixMap=vendorPrefixes[eventName];if(prefixMap)for(var stylePropList=Object.keys(prefixMap),len=stylePropList.length,i=0;i<len;i+=1){var styleProp=stylePropList[i];if(Object.prototype.hasOwnProperty.call(prefixMap,styleProp)&&styleProp in style)return prefixedEventNames[eventName]=prefixMap[styleProp],prefixedEventNames[eventName]}return""}__name(getVendorPrefixedEventName,"getVendorPrefixedEventName");var internalAnimationEndName=getVendorPrefixedEventName("animationend"),internalTransitionEndName=getVendorPrefixedEventName("transitionend"),supportTransition=!!(internalAnimationEndName&&internalTransitionEndName),animationEndName=internalAnimationEndName||"animationend",transitionEndName=internalTransitionEndName||"transitionend";function getTransitionName(transitionName,transitionType){if(!transitionName)return null;if(_typeof$1(transitionName)==="object"){var type=transitionType.replace(/-\w/g,function(match2){return match2[1].toUpperCase()});return transitionName[type]}return"".concat(transitionName,"-").concat(transitionType)}__name(getTransitionName,"getTransitionName");const useDomMotionEvents=__name(function(onInternalMotionEnd){var cacheElementRef=React.useRef();function removeMotionEvents(element2){element2&&(element2.removeEventListener(transitionEndName,onInternalMotionEnd),element2.removeEventListener(animationEndName,onInternalMotionEnd))}__name(removeMotionEvents,"removeMotionEvents");function patchMotionEvents(element2){cacheElementRef.current&&cacheElementRef.current!==element2&&removeMotionEvents(cacheElementRef.current),element2&&element2!==cacheElementRef.current&&(element2.addEventListener(transitionEndName,onInternalMotionEnd),element2.addEventListener(animationEndName,onInternalMotionEnd),cacheElementRef.current=element2)}return __name(patchMotionEvents,"patchMotionEvents"),React__namespace.useEffect(function(){return function(){removeMotionEvents(cacheElementRef.current)}},[]),[patchMotionEvents,removeMotionEvents]},"useDomMotionEvents");var useIsomorphicLayoutEffect=canUseDom()?React.useLayoutEffect:React.useEffect,raf=__name(function(callback){return+setTimeout(callback,16)},"raf2"),caf=__name(function(num){return clearTimeout(num)},"caf2");typeof window<"u"&&"requestAnimationFrame"in window&&(raf=__name(function(callback){return window.requestAnimationFrame(callback)},"raf3"),caf=__name(function(handle){return window.cancelAnimationFrame(handle)},"caf3"));var rafUUID=0,rafIds=new Map;function cleanup(id){rafIds.delete(id)}__name(cleanup,"cleanup");var wrapperRaf=__name(function(callback){var times=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;rafUUID+=1;var id=rafUUID;function callRef(leftTimes){if(leftTimes===0)cleanup(id),callback();else{var realId=raf(function(){callRef(leftTimes-1)});rafIds.set(id,realId)}}return __name(callRef,"callRef"),callRef(times),id},"wrapperRaf2");wrapperRaf.cancel=function(id){var realId=rafIds.get(id);return cleanup(id),caf(realId)};const useNextFrame=__name(function(){var nextFrameRef=React__namespace.useRef(null);function cancelNextFrame(){wrapperRaf.cancel(nextFrameRef.current)}__name(cancelNextFrame,"cancelNextFrame");function nextFrame(callback){var delay=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;cancelNextFrame();var nextFrameId=wrapperRaf(function(){delay<=1?callback({isCanceled:__name(function(){return nextFrameId!==nextFrameRef.current},"isCanceled")}):nextFrame(callback,delay-1)});nextFrameRef.current=nextFrameId}return __name(nextFrame,"nextFrame"),React__namespace.useEffect(function(){return function(){cancelNextFrame()}},[]),[nextFrame,cancelNextFrame]},"useNextFrame");var FULL_STEP_QUEUE=[STEP_PREPARE,STEP_START,STEP_ACTIVE,STEP_ACTIVATED],SIMPLE_STEP_QUEUE=[STEP_PREPARE,STEP_PREPARED],SkipStep=!1,DoStep=!0;function isActive(step){return step===STEP_ACTIVE||step===STEP_ACTIVATED}__name(isActive,"isActive");const useStepQueue=__name(function(status,prepareOnly,callback){var _useState=useSafeState(STEP_NONE),_useState2=_slicedToArray$1(_useState,2),step=_useState2[0],setStep=_useState2[1],_useNextFrame=useNextFrame(),_useNextFrame2=_slicedToArray$1(_useNextFrame,2),nextFrame=_useNextFrame2[0],cancelNextFrame=_useNextFrame2[1];function startQueue(){setStep(STEP_PREPARE,!0)}__name(startQueue,"startQueue");var STEP_QUEUE=prepareOnly?SIMPLE_STEP_QUEUE:FULL_STEP_QUEUE;return useIsomorphicLayoutEffect(function(){if(step!==STEP_NONE&&step!==STEP_ACTIVATED){var index=STEP_QUEUE.indexOf(step),nextStep=STEP_QUEUE[index+1],result=callback(step);result===SkipStep?setStep(nextStep,!0):nextStep&&nextFrame(function(info){function doNext(){info.isCanceled()||setStep(nextStep,!0)}__name(doNext,"doNext"),result===!0?doNext():Promise.resolve(result).then(doNext)})}},[status,step]),React__namespace.useEffect(function(){return function(){cancelNextFrame()}},[]),[startQueue,step]},"useStepQueue");function useStatus(supportMotion,visible,getElement,_ref){var _ref$motionEnter=_ref.motionEnter,motionEnter=_ref$motionEnter===void 0?!0:_ref$motionEnter,_ref$motionAppear=_ref.motionAppear,motionAppear=_ref$motionAppear===void 0?!0:_ref$motionAppear,_ref$motionLeave=_ref.motionLeave,motionLeave=_ref$motionLeave===void 0?!0:_ref$motionLeave,motionDeadline=_ref.motionDeadline,motionLeaveImmediately=_ref.motionLeaveImmediately,onAppearPrepare=_ref.onAppearPrepare,onEnterPrepare=_ref.onEnterPrepare,onLeavePrepare=_ref.onLeavePrepare,onAppearStart=_ref.onAppearStart,onEnterStart=_ref.onEnterStart,onLeaveStart=_ref.onLeaveStart,onAppearActive=_ref.onAppearActive,onEnterActive=_ref.onEnterActive,onLeaveActive=_ref.onLeaveActive,onAppearEnd=_ref.onAppearEnd,onEnterEnd=_ref.onEnterEnd,onLeaveEnd=_ref.onLeaveEnd,onVisibleChanged=_ref.onVisibleChanged,_useState=useSafeState(),_useState2=_slicedToArray$1(_useState,2),asyncVisible=_useState2[0],setAsyncVisible=_useState2[1],_useSyncState=useSyncState(STATUS_NONE),_useSyncState2=_slicedToArray$1(_useSyncState,2),getStatus=_useSyncState2[0],setStatus=_useSyncState2[1],_useState3=useSafeState(null),_useState4=_slicedToArray$1(_useState3,2),style2=_useState4[0],setStyle=_useState4[1],currentStatus=getStatus(),mountedRef=React.useRef(!1),deadlineRef=React.useRef(null);function getDomElement(){return getElement()}__name(getDomElement,"getDomElement");var activeRef=React.useRef(!1);function updateMotionEndStatus(){setStatus(STATUS_NONE),setStyle(null,!0)}__name(updateMotionEndStatus,"updateMotionEndStatus");var onInternalMotionEnd=useEvent(function(event){var status=getStatus();if(status!==STATUS_NONE){var element2=getDomElement();if(!(event&&!event.deadline&&event.target!==element2)){var currentActive=activeRef.current,canEnd;status===STATUS_APPEAR&¤tActive?canEnd=onAppearEnd==null?void 0:onAppearEnd(element2,event):status===STATUS_ENTER&¤tActive?canEnd=onEnterEnd==null?void 0:onEnterEnd(element2,event):status===STATUS_LEAVE&¤tActive&&(canEnd=onLeaveEnd==null?void 0:onLeaveEnd(element2,event)),currentActive&&canEnd!==!1&&updateMotionEndStatus()}}}),_useDomMotionEvents=useDomMotionEvents(onInternalMotionEnd),_useDomMotionEvents2=_slicedToArray$1(_useDomMotionEvents,1),patchMotionEvents=_useDomMotionEvents2[0],getEventHandlers=__name(function(targetStatus){switch(targetStatus){case STATUS_APPEAR:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onAppearPrepare),STEP_START,onAppearStart),STEP_ACTIVE,onAppearActive);case STATUS_ENTER:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onEnterPrepare),STEP_START,onEnterStart),STEP_ACTIVE,onEnterActive);case STATUS_LEAVE:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onLeavePrepare),STEP_START,onLeaveStart),STEP_ACTIVE,onLeaveActive);default:return{}}},"getEventHandlers"),eventHandlers=React__namespace.useMemo(function(){return getEventHandlers(currentStatus)},[currentStatus]),_useStepQueue=useStepQueue(currentStatus,!supportMotion,function(newStep){if(newStep===STEP_PREPARE){var onPrepare=eventHandlers[STEP_PREPARE];return onPrepare?onPrepare(getDomElement()):SkipStep}if(step in eventHandlers){var _eventHandlers$step;setStyle(((_eventHandlers$step=eventHandlers[step])===null||_eventHandlers$step===void 0?void 0:_eventHandlers$step.call(eventHandlers,getDomElement(),null))||null)}return step===STEP_ACTIVE&¤tStatus!==STATUS_NONE&&(patchMotionEvents(getDomElement()),motionDeadline>0&&(clearTimeout(deadlineRef.current),deadlineRef.current=setTimeout(function(){onInternalMotionEnd({deadline:!0})},motionDeadline))),step===STEP_PREPARED&&updateMotionEndStatus(),DoStep}),_useStepQueue2=_slicedToArray$1(_useStepQueue,2),startStep=_useStepQueue2[0],step=_useStepQueue2[1],active=isActive(step);activeRef.current=active,useIsomorphicLayoutEffect(function(){setAsyncVisible(visible);var isMounted=mountedRef.current;mountedRef.current=!0;var nextStatus;!isMounted&&visible&&motionAppear&&(nextStatus=STATUS_APPEAR),isMounted&&visible&&motionEnter&&(nextStatus=STATUS_ENTER),(isMounted&&!visible&&motionLeave||!isMounted&&motionLeaveImmediately&&!visible&&motionLeave)&&(nextStatus=STATUS_LEAVE);var nextEventHandlers=getEventHandlers(nextStatus);nextStatus&&(supportMotion||nextEventHandlers[STEP_PREPARE])?(setStatus(nextStatus),startStep()):setStatus(STATUS_NONE)},[visible]),React.useEffect(function(){(currentStatus===STATUS_APPEAR&&!motionAppear||currentStatus===STATUS_ENTER&&!motionEnter||currentStatus===STATUS_LEAVE&&!motionLeave)&&setStatus(STATUS_NONE)},[motionAppear,motionEnter,motionLeave]),React.useEffect(function(){return function(){mountedRef.current=!1,clearTimeout(deadlineRef.current)}},[]);var firstMountChangeRef=React__namespace.useRef(!1);React.useEffect(function(){asyncVisible&&(firstMountChangeRef.current=!0),asyncVisible!==void 0&¤tStatus===STATUS_NONE&&((firstMountChangeRef.current||asyncVisible)&&(onVisibleChanged==null||onVisibleChanged(asyncVisible)),firstMountChangeRef.current=!0)},[asyncVisible,currentStatus]);var mergedStyle=style2;return eventHandlers[STEP_PREPARE]&&step===STEP_START&&(mergedStyle=_objectSpread2$1({transition:"none"},mergedStyle)),[currentStatus,step,mergedStyle,asyncVisible!=null?asyncVisible:visible]}__name(useStatus,"useStatus");function genCSSMotion(config){var transitionSupport=config;_typeof$1(config)==="object"&&(transitionSupport=config.transitionSupport);function isSupportTransition(props,contextMotion){return!!(props.motionName&&transitionSupport&&contextMotion!==!1)}__name(isSupportTransition,"isSupportTransition");var CSSMotion2=React__namespace.forwardRef(function(props,ref){var _props$visible=props.visible,visible=_props$visible===void 0?!0:_props$visible,_props$removeOnLeave=props.removeOnLeave,removeOnLeave=_props$removeOnLeave===void 0?!0:_props$removeOnLeave,forceRender=props.forceRender,children=props.children,motionName=props.motionName,leavedClassName=props.leavedClassName,eventProps=props.eventProps,_React$useContext=React__namespace.useContext(Context),contextMotion=_React$useContext.motion,supportMotion=isSupportTransition(props,contextMotion),nodeRef=React.useRef(),wrapperNodeRef=React.useRef();function getDomElement(){try{return nodeRef.current instanceof HTMLElement?nodeRef.current:findDOMNode(wrapperNodeRef.current)}catch{return null}}__name(getDomElement,"getDomElement");var _useStatus=useStatus(supportMotion,visible,getDomElement,props),_useStatus2=_slicedToArray$1(_useStatus,4),status=_useStatus2[0],statusStep=_useStatus2[1],statusStyle=_useStatus2[2],mergedVisible=_useStatus2[3],renderedRef=React__namespace.useRef(mergedVisible);mergedVisible&&(renderedRef.current=!0);var setNodeRef=React__namespace.useCallback(function(node){nodeRef.current=node,fillRef(ref,node)},[ref]),motionChildren,mergedProps=_objectSpread2$1(_objectSpread2$1({},eventProps),{},{visible});if(!children)motionChildren=null;else if(status===STATUS_NONE)mergedVisible?motionChildren=children(_objectSpread2$1({},mergedProps),setNodeRef):!removeOnLeave&&renderedRef.current&&leavedClassName?motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{className:leavedClassName}),setNodeRef):forceRender||!removeOnLeave&&!leavedClassName?motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{style:{display:"none"}}),setNodeRef):motionChildren=null;else{var statusSuffix;statusStep===STEP_PREPARE?statusSuffix="prepare":isActive(statusStep)?statusSuffix="active":statusStep===STEP_START&&(statusSuffix="start");var motionCls=getTransitionName(motionName,"".concat(status,"-").concat(statusSuffix));motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{className:clsx(getTransitionName(motionName,status),_defineProperty$1(_defineProperty$1({},motionCls,motionCls&&statusSuffix),motionName,typeof motionName=="string")),style:statusStyle}),setNodeRef)}if(React__namespace.isValidElement(motionChildren)&&supportRef(motionChildren)){var _ref=motionChildren,originNodeRef=_ref.ref;originNodeRef||(motionChildren=React__namespace.cloneElement(motionChildren,{ref:setNodeRef}))}return React__namespace.createElement(DomWrapper,{ref:wrapperNodeRef},motionChildren)});return CSSMotion2.displayName="CSSMotion",CSSMotion2}__name(genCSSMotion,"genCSSMotion");const CSSMotion=genCSSMotion(supportTransition);var STATUS_ADD="add",STATUS_KEEP="keep",STATUS_REMOVE="remove",STATUS_REMOVED="removed";function wrapKeyToObject(key){var keyObj;return key&&_typeof$1(key)==="object"&&"key"in key?keyObj=key:keyObj={key},_objectSpread2$1(_objectSpread2$1({},keyObj),{},{key:String(keyObj.key)})}__name(wrapKeyToObject,"wrapKeyToObject");function parseKeys(){var keys=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return keys.map(wrapKeyToObject)}__name(parseKeys,"parseKeys");function diffKeys(){var prevKeys=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],currentKeys=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],list=[],currentIndex=0,currentLen=currentKeys.length,prevKeyObjects=parseKeys(prevKeys),currentKeyObjects=parseKeys(currentKeys);prevKeyObjects.forEach(function(keyObj){for(var hit=!1,i=currentIndex;i<currentLen;i+=1){var currentKeyObj=currentKeyObjects[i];if(currentKeyObj.key===keyObj.key){currentIndex<i&&(list=list.concat(currentKeyObjects.slice(currentIndex,i).map(function(obj){return _objectSpread2$1(_objectSpread2$1({},obj),{},{status:STATUS_ADD})})),currentIndex=i),list.push(_objectSpread2$1(_objectSpread2$1({},currentKeyObj),{},{status:STATUS_KEEP})),currentIndex+=1,hit=!0;break}}hit||list.push(_objectSpread2$1(_objectSpread2$1({},keyObj),{},{status:STATUS_REMOVE}))}),currentIndex<currentLen&&(list=list.concat(currentKeyObjects.slice(currentIndex).map(function(obj){return _objectSpread2$1(_objectSpread2$1({},obj),{},{status:STATUS_ADD})})));var keys={};list.forEach(function(_ref){var key=_ref.key;keys[key]=(keys[key]||0)+1});var duplicatedKeys=Object.keys(keys).filter(function(key){return keys[key]>1});return duplicatedKeys.forEach(function(matchKey){list=list.filter(function(_ref2){var key=_ref2.key,status=_ref2.status;return key!==matchKey||status!==STATUS_REMOVE}),list.forEach(function(node){node.key===matchKey&&(node.status=STATUS_KEEP)})}),list}__name(diffKeys,"diffKeys");var _excluded$2=["component","children","onVisibleChanged","onAllRemoved"],_excluded2=["status"],MOTION_PROP_NAMES=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function genCSSMotionList(transitionSupport){var CSSMotion$1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:CSSMotion,CSSMotionList2=function(_React$Component){_inherits(CSSMotionList3,_React$Component);var _super=_createSuper(CSSMotionList3);function CSSMotionList3(){var _this;_classCallCheck(this,CSSMotionList3);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=_super.call.apply(_super,[this].concat(args)),_defineProperty$1(_assertThisInitialized(_this),"state",{keyEntities:[]}),_defineProperty$1(_assertThisInitialized(_this),"removeKey",function(removeKey){_this.setState(function(prevState){var nextKeyEntities=prevState.keyEntities.map(function(entity){return entity.key!==removeKey?entity:_objectSpread2$1(_objectSpread2$1({},entity),{},{status:STATUS_REMOVED})});return{keyEntities:nextKeyEntities}},function(){var keyEntities=_this.state.keyEntities,restKeysCount=keyEntities.filter(function(_ref){var status=_ref.status;return status!==STATUS_REMOVED}).length;restKeysCount===0&&_this.props.onAllRemoved&&_this.props.onAllRemoved()})}),_this}return __name(CSSMotionList3,"CSSMotionList"),_createClass(CSSMotionList3,[{key:"render",value:__name(function(){var _this2=this,keyEntities=this.state.keyEntities,_this$props=this.props,component=_this$props.component,children=_this$props.children,_onVisibleChanged=_this$props.onVisibleChanged;_this$props.onAllRemoved;var restProps=_objectWithoutProperties(_this$props,_excluded$2),Component=component||React__namespace.Fragment,motionProps={};return MOTION_PROP_NAMES.forEach(function(prop){motionProps[prop]=restProps[prop],delete restProps[prop]}),delete restProps.keys,React__namespace.createElement(Component,restProps,keyEntities.map(function(_ref2,index){var status=_ref2.status,eventProps=_objectWithoutProperties(_ref2,_excluded2),visible=status===STATUS_ADD||status===STATUS_KEEP;return React__namespace.createElement(CSSMotion$1,_extends({},motionProps,{key:eventProps.key,visible,eventProps,onVisibleChanged:__name(function(changedVisible){_onVisibleChanged==null||_onVisibleChanged(changedVisible,{key:eventProps.key}),changedVisible||_this2.removeKey(eventProps.key)},"onVisibleChanged")}),function(props,ref){return children(_objectSpread2$1(_objectSpread2$1({},props),{},{index}),ref)})}))},"render")}],[{key:"getDerivedStateFromProps",value:__name(function(_ref3,_ref4){var keys=_ref3.keys,keyEntities=_ref4.keyEntities,parsedKeyObjects=parseKeys(keys),mixedKeyEntities=diffKeys(keyEntities,parsedKeyObjects);return{keyEntities:mixedKeyEntities.filter(function(entity){var prevEntity=keyEntities.find(function(_ref5){var key=_ref5.key;return entity.key===key});return!(prevEntity&&prevEntity.status===STATUS_REMOVED&&entity.status===STATUS_REMOVE)})}},"getDerivedStateFromProps")}]),CSSMotionList3}(React__namespace.Component);return _defineProperty$1(CSSMotionList2,"defaultProps",{component:"div"}),CSSMotionList2}__name(genCSSMotionList,"genCSSMotionList");const CSSMotionList=genCSSMotionList(supportTransition);var KeyCode={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:__name(function(e2){var keyCode=e2.keyCode;if(e2.altKey&&!e2.ctrlKey||e2.metaKey||keyCode>=KeyCode.F1&&keyCode<=KeyCode.F12)return!1;switch(keyCode){case KeyCode.ALT:case KeyCode.CAPS_LOCK:case KeyCode.CONTEXT_MENU:case KeyCode.CTRL:case KeyCode.DOWN:case KeyCode.END:case KeyCode.ESC:case KeyCode.HOME:case KeyCode.INSERT:case KeyCode.LEFT:case KeyCode.MAC_FF_META:case KeyCode.META:case KeyCode.NUMLOCK:case KeyCode.NUM_CENTER:case KeyCode.PAGE_DOWN:case KeyCode.PAGE_UP:case KeyCode.PAUSE:case KeyCode.PRINT_SCREEN:case KeyCode.RIGHT:case KeyCode.SHIFT:case KeyCode.UP:case KeyCode.WIN_KEY:case KeyCode.WIN_KEY_RIGHT:return!1;default:return!0}},"isTextModifyingKeyEvent"),isCharacterKey:__name(function(keyCode){if(keyCode>=KeyCode.ZERO&&keyCode<=KeyCode.NINE||keyCode>=KeyCode.NUM_ZERO&&keyCode<=KeyCode.NUM_MULTIPLY||keyCode>=KeyCode.A&&keyCode<=KeyCode.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&keyCode===0)return!0;switch(keyCode){case KeyCode.SPACE:case KeyCode.QUESTION_MARK:case KeyCode.NUM_PLUS:case KeyCode.NUM_MINUS:case KeyCode.NUM_PERIOD:case KeyCode.NUM_DIVISION:case KeyCode.SEMICOLON:case KeyCode.DASH:case KeyCode.EQUALS:case KeyCode.COMMA:case KeyCode.PERIOD:case KeyCode.SLASH:case KeyCode.APOSTROPHE:case KeyCode.SINGLE_QUOTE:case KeyCode.OPEN_SQUARE_BRACKET:case KeyCode.BACKSLASH:case KeyCode.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},"isCharacterKey")},attributes=`accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
30
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}__name(_nonIterableRest,"_nonIterableRest");function _slicedToArray(r2,e2){return _arrayWithHoles(r2)||_iterableToArrayLimit(r2,e2)||_unsupportedIterableToArray(r2,e2)||_nonIterableRest()}__name(_slicedToArray,"_slicedToArray");function canUseDom(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}__name(canUseDom,"canUseDom");function useSafeState(defaultValue){var destroyRef=React__namespace.useRef(!1),_React$useState=React__namespace.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];React__namespace.useEffect(function(){return destroyRef.current=!1,function(){destroyRef.current=!0}},[]);function safeSetState(updater,ignoreDestroy){ignoreDestroy&&destroyRef.current||setValue(updater)}return __name(safeSetState,"safeSetState"),[value,safeSetState]}__name(useSafeState,"useSafeState");function toPrimitive(t2,r2){if(_typeof(t2)!="object"||!t2)return t2;var e2=t2[Symbol.toPrimitive];if(e2!==void 0){var i=e2.call(t2,r2||"default");if(_typeof(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r2==="string"?String:Number)(t2)}__name(toPrimitive,"toPrimitive");function toPropertyKey(t2){var i=toPrimitive(t2,"string");return _typeof(i)=="symbol"?i:i+""}__name(toPropertyKey,"toPropertyKey");function _defineProperty(e2,r2,t2){return(r2=toPropertyKey(r2))in e2?Object.defineProperty(e2,r2,{value:t2,enumerable:!0,configurable:!0,writable:!0}):e2[r2]=t2,e2}__name(_defineProperty,"_defineProperty");function ownKeys(e2,r2){var t2=Object.keys(e2);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e2);r2&&(o=o.filter(function(r3){return Object.getOwnPropertyDescriptor(e2,r3).enumerable})),t2.push.apply(t2,o)}return t2}__name(ownKeys,"ownKeys");function _objectSpread2(e2){for(var r2=1;r2<arguments.length;r2++){var t2=arguments[r2]!=null?arguments[r2]:{};r2%2?ownKeys(Object(t2),!0).forEach(function(r3){_defineProperty(e2,r3,t2[r3])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e2,Object.getOwnPropertyDescriptors(t2)):ownKeys(Object(t2)).forEach(function(r3){Object.defineProperty(e2,r3,Object.getOwnPropertyDescriptor(t2,r3))})}return e2}__name(_objectSpread2,"_objectSpread2");function useSyncState(defaultValue){var _React$useReducer=React__namespace.useReducer(function(x){return x+1},0),_React$useReducer2=_slicedToArray(_React$useReducer,2),forceUpdate=_React$useReducer2[1],currentValueRef=React__namespace.useRef(defaultValue),getValue=useEvent(function(){return currentValueRef.current}),setValue=useEvent(function(updater){currentValueRef.current=typeof updater=="function"?updater(currentValueRef.current):updater,forceUpdate()});return[getValue,setValue]}__name(useSyncState,"useSyncState");var STATUS_NONE="none",STATUS_APPEAR="appear",STATUS_ENTER="enter",STATUS_LEAVE="leave",STEP_NONE="none",STEP_PREPARE="prepare",STEP_START="start",STEP_ACTIVE="active",STEP_ACTIVATED="end",STEP_PREPARED="prepared";function makePrefixMap(styleProp,eventName){var prefixes={};return prefixes[styleProp.toLowerCase()]=eventName.toLowerCase(),prefixes["Webkit".concat(styleProp)]="webkit".concat(eventName),prefixes["Moz".concat(styleProp)]="moz".concat(eventName),prefixes["ms".concat(styleProp)]="MS".concat(eventName),prefixes["O".concat(styleProp)]="o".concat(eventName.toLowerCase()),prefixes}__name(makePrefixMap,"makePrefixMap");function getVendorPrefixes(domSupport,win){var prefixes={animationend:makePrefixMap("Animation","AnimationEnd"),transitionend:makePrefixMap("Transition","TransitionEnd")};return domSupport&&("AnimationEvent"in win||delete prefixes.animationend.animation,"TransitionEvent"in win||delete prefixes.transitionend.transition),prefixes}__name(getVendorPrefixes,"getVendorPrefixes");var vendorPrefixes=getVendorPrefixes(canUseDom(),typeof window<"u"?window:{}),style={};if(canUseDom()){var _document$createEleme=document.createElement("div");style=_document$createEleme.style}var prefixedEventNames={};function getVendorPrefixedEventName(eventName){if(prefixedEventNames[eventName])return prefixedEventNames[eventName];var prefixMap=vendorPrefixes[eventName];if(prefixMap)for(var stylePropList=Object.keys(prefixMap),len=stylePropList.length,i=0;i<len;i+=1){var styleProp=stylePropList[i];if(Object.prototype.hasOwnProperty.call(prefixMap,styleProp)&&styleProp in style)return prefixedEventNames[eventName]=prefixMap[styleProp],prefixedEventNames[eventName]}return""}__name(getVendorPrefixedEventName,"getVendorPrefixedEventName");var internalAnimationEndName=getVendorPrefixedEventName("animationend"),internalTransitionEndName=getVendorPrefixedEventName("transitionend"),supportTransition=!!(internalAnimationEndName&&internalTransitionEndName),animationEndName=internalAnimationEndName||"animationend",transitionEndName=internalTransitionEndName||"transitionend";function getTransitionName(transitionName,transitionType){if(!transitionName)return null;if(_typeof$1(transitionName)==="object"){var type=transitionType.replace(/-\w/g,function(match2){return match2[1].toUpperCase()});return transitionName[type]}return"".concat(transitionName,"-").concat(transitionType)}__name(getTransitionName,"getTransitionName");const useDomMotionEvents=__name(function(onInternalMotionEnd){var cacheElementRef=React.useRef();function removeMotionEvents(element2){element2&&(element2.removeEventListener(transitionEndName,onInternalMotionEnd),element2.removeEventListener(animationEndName,onInternalMotionEnd))}__name(removeMotionEvents,"removeMotionEvents");function patchMotionEvents(element2){cacheElementRef.current&&cacheElementRef.current!==element2&&removeMotionEvents(cacheElementRef.current),element2&&element2!==cacheElementRef.current&&(element2.addEventListener(transitionEndName,onInternalMotionEnd),element2.addEventListener(animationEndName,onInternalMotionEnd),cacheElementRef.current=element2)}return __name(patchMotionEvents,"patchMotionEvents"),React__namespace.useEffect(function(){return function(){removeMotionEvents(cacheElementRef.current)}},[]),[patchMotionEvents,removeMotionEvents]},"useDomMotionEvents");var useIsomorphicLayoutEffect=canUseDom()?React.useLayoutEffect:React.useEffect,raf=__name(function(callback){return+setTimeout(callback,16)},"raf2"),caf=__name(function(num){return clearTimeout(num)},"caf2");typeof window<"u"&&"requestAnimationFrame"in window&&(raf=__name(function(callback){return window.requestAnimationFrame(callback)},"raf3"),caf=__name(function(handle){return window.cancelAnimationFrame(handle)},"caf3"));var rafUUID=0,rafIds=new Map;function cleanup(id){rafIds.delete(id)}__name(cleanup,"cleanup");var wrapperRaf=__name(function(callback){var times=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;rafUUID+=1;var id=rafUUID;function callRef(leftTimes){if(leftTimes===0)cleanup(id),callback();else{var realId=raf(function(){callRef(leftTimes-1)});rafIds.set(id,realId)}}return __name(callRef,"callRef"),callRef(times),id},"wrapperRaf2");wrapperRaf.cancel=function(id){var realId=rafIds.get(id);return cleanup(id),caf(realId)};const useNextFrame=__name(function(){var nextFrameRef=React__namespace.useRef(null);function cancelNextFrame(){wrapperRaf.cancel(nextFrameRef.current)}__name(cancelNextFrame,"cancelNextFrame");function nextFrame(callback){var delay=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;cancelNextFrame();var nextFrameId=wrapperRaf(function(){delay<=1?callback({isCanceled:__name(function(){return nextFrameId!==nextFrameRef.current},"isCanceled")}):nextFrame(callback,delay-1)});nextFrameRef.current=nextFrameId}return __name(nextFrame,"nextFrame"),React__namespace.useEffect(function(){return function(){cancelNextFrame()}},[]),[nextFrame,cancelNextFrame]},"useNextFrame");var FULL_STEP_QUEUE=[STEP_PREPARE,STEP_START,STEP_ACTIVE,STEP_ACTIVATED],SIMPLE_STEP_QUEUE=[STEP_PREPARE,STEP_PREPARED],SkipStep=!1,DoStep=!0;function isActive(step){return step===STEP_ACTIVE||step===STEP_ACTIVATED}__name(isActive,"isActive");const useStepQueue=__name(function(status,prepareOnly,callback){var _useState=useSafeState(STEP_NONE),_useState2=_slicedToArray$1(_useState,2),step=_useState2[0],setStep=_useState2[1],_useNextFrame=useNextFrame(),_useNextFrame2=_slicedToArray$1(_useNextFrame,2),nextFrame=_useNextFrame2[0],cancelNextFrame=_useNextFrame2[1];function startQueue(){setStep(STEP_PREPARE,!0)}__name(startQueue,"startQueue");var STEP_QUEUE=prepareOnly?SIMPLE_STEP_QUEUE:FULL_STEP_QUEUE;return useIsomorphicLayoutEffect(function(){if(step!==STEP_NONE&&step!==STEP_ACTIVATED){var index=STEP_QUEUE.indexOf(step),nextStep=STEP_QUEUE[index+1],result=callback(step);result===SkipStep?setStep(nextStep,!0):nextStep&&nextFrame(function(info){function doNext(){info.isCanceled()||setStep(nextStep,!0)}__name(doNext,"doNext"),result===!0?doNext():Promise.resolve(result).then(doNext)})}},[status,step]),React__namespace.useEffect(function(){return function(){cancelNextFrame()}},[]),[startQueue,step]},"useStepQueue");function useStatus(supportMotion,visible,getElement,_ref){var _ref$motionEnter=_ref.motionEnter,motionEnter=_ref$motionEnter===void 0?!0:_ref$motionEnter,_ref$motionAppear=_ref.motionAppear,motionAppear=_ref$motionAppear===void 0?!0:_ref$motionAppear,_ref$motionLeave=_ref.motionLeave,motionLeave=_ref$motionLeave===void 0?!0:_ref$motionLeave,motionDeadline=_ref.motionDeadline,motionLeaveImmediately=_ref.motionLeaveImmediately,onAppearPrepare=_ref.onAppearPrepare,onEnterPrepare=_ref.onEnterPrepare,onLeavePrepare=_ref.onLeavePrepare,onAppearStart=_ref.onAppearStart,onEnterStart=_ref.onEnterStart,onLeaveStart=_ref.onLeaveStart,onAppearActive=_ref.onAppearActive,onEnterActive=_ref.onEnterActive,onLeaveActive=_ref.onLeaveActive,onAppearEnd=_ref.onAppearEnd,onEnterEnd=_ref.onEnterEnd,onLeaveEnd=_ref.onLeaveEnd,onVisibleChanged=_ref.onVisibleChanged,_useState=useSafeState(),_useState2=_slicedToArray$1(_useState,2),asyncVisible=_useState2[0],setAsyncVisible=_useState2[1],_useSyncState=useSyncState(STATUS_NONE),_useSyncState2=_slicedToArray$1(_useSyncState,2),getStatus=_useSyncState2[0],setStatus=_useSyncState2[1],_useState3=useSafeState(null),_useState4=_slicedToArray$1(_useState3,2),style2=_useState4[0],setStyle=_useState4[1],currentStatus=getStatus(),mountedRef=React.useRef(!1),deadlineRef=React.useRef(null);function getDomElement(){return getElement()}__name(getDomElement,"getDomElement");var activeRef=React.useRef(!1);function updateMotionEndStatus(){setStatus(STATUS_NONE),setStyle(null,!0)}__name(updateMotionEndStatus,"updateMotionEndStatus");var onInternalMotionEnd=useEvent(function(event){var status=getStatus();if(status!==STATUS_NONE){var element2=getDomElement();if(!(event&&!event.deadline&&event.target!==element2)){var currentActive=activeRef.current,canEnd;status===STATUS_APPEAR&¤tActive?canEnd=onAppearEnd==null?void 0:onAppearEnd(element2,event):status===STATUS_ENTER&¤tActive?canEnd=onEnterEnd==null?void 0:onEnterEnd(element2,event):status===STATUS_LEAVE&¤tActive&&(canEnd=onLeaveEnd==null?void 0:onLeaveEnd(element2,event)),currentActive&&canEnd!==!1&&updateMotionEndStatus()}}}),_useDomMotionEvents=useDomMotionEvents(onInternalMotionEnd),_useDomMotionEvents2=_slicedToArray$1(_useDomMotionEvents,1),patchMotionEvents=_useDomMotionEvents2[0],getEventHandlers=__name(function(targetStatus){switch(targetStatus){case STATUS_APPEAR:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onAppearPrepare),STEP_START,onAppearStart),STEP_ACTIVE,onAppearActive);case STATUS_ENTER:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onEnterPrepare),STEP_START,onEnterStart),STEP_ACTIVE,onEnterActive);case STATUS_LEAVE:return _defineProperty$1(_defineProperty$1(_defineProperty$1({},STEP_PREPARE,onLeavePrepare),STEP_START,onLeaveStart),STEP_ACTIVE,onLeaveActive);default:return{}}},"getEventHandlers"),eventHandlers=React__namespace.useMemo(function(){return getEventHandlers(currentStatus)},[currentStatus]),_useStepQueue=useStepQueue(currentStatus,!supportMotion,function(newStep){if(newStep===STEP_PREPARE){var onPrepare=eventHandlers[STEP_PREPARE];return onPrepare?onPrepare(getDomElement()):SkipStep}if(step in eventHandlers){var _eventHandlers$step;setStyle(((_eventHandlers$step=eventHandlers[step])===null||_eventHandlers$step===void 0?void 0:_eventHandlers$step.call(eventHandlers,getDomElement(),null))||null)}return step===STEP_ACTIVE&¤tStatus!==STATUS_NONE&&(patchMotionEvents(getDomElement()),motionDeadline>0&&(clearTimeout(deadlineRef.current),deadlineRef.current=setTimeout(function(){onInternalMotionEnd({deadline:!0})},motionDeadline))),step===STEP_PREPARED&&updateMotionEndStatus(),DoStep}),_useStepQueue2=_slicedToArray$1(_useStepQueue,2),startStep=_useStepQueue2[0],step=_useStepQueue2[1],active=isActive(step);activeRef.current=active,useIsomorphicLayoutEffect(function(){setAsyncVisible(visible);var isMounted=mountedRef.current;mountedRef.current=!0;var nextStatus;!isMounted&&visible&&motionAppear&&(nextStatus=STATUS_APPEAR),isMounted&&visible&&motionEnter&&(nextStatus=STATUS_ENTER),(isMounted&&!visible&&motionLeave||!isMounted&&motionLeaveImmediately&&!visible&&motionLeave)&&(nextStatus=STATUS_LEAVE);var nextEventHandlers=getEventHandlers(nextStatus);nextStatus&&(supportMotion||nextEventHandlers[STEP_PREPARE])?(setStatus(nextStatus),startStep()):setStatus(STATUS_NONE)},[visible]),React.useEffect(function(){(currentStatus===STATUS_APPEAR&&!motionAppear||currentStatus===STATUS_ENTER&&!motionEnter||currentStatus===STATUS_LEAVE&&!motionLeave)&&setStatus(STATUS_NONE)},[motionAppear,motionEnter,motionLeave]),React.useEffect(function(){return function(){mountedRef.current=!1,clearTimeout(deadlineRef.current)}},[]);var firstMountChangeRef=React__namespace.useRef(!1);React.useEffect(function(){asyncVisible&&(firstMountChangeRef.current=!0),asyncVisible!==void 0&¤tStatus===STATUS_NONE&&((firstMountChangeRef.current||asyncVisible)&&(onVisibleChanged==null||onVisibleChanged(asyncVisible)),firstMountChangeRef.current=!0)},[asyncVisible,currentStatus]);var mergedStyle=style2;return eventHandlers[STEP_PREPARE]&&step===STEP_START&&(mergedStyle=_objectSpread2$1({transition:"none"},mergedStyle)),[currentStatus,step,mergedStyle,asyncVisible!=null?asyncVisible:visible]}__name(useStatus,"useStatus");function genCSSMotion(config){var transitionSupport=config;_typeof$1(config)==="object"&&(transitionSupport=config.transitionSupport);function isSupportTransition(props,contextMotion){return!!(props.motionName&&transitionSupport&&contextMotion!==!1)}__name(isSupportTransition,"isSupportTransition");var CSSMotion2=React__namespace.forwardRef(function(props,ref){var _props$visible=props.visible,visible=_props$visible===void 0?!0:_props$visible,_props$removeOnLeave=props.removeOnLeave,removeOnLeave=_props$removeOnLeave===void 0?!0:_props$removeOnLeave,forceRender=props.forceRender,children=props.children,motionName=props.motionName,leavedClassName=props.leavedClassName,eventProps=props.eventProps,_React$useContext=React__namespace.useContext(Context),contextMotion=_React$useContext.motion,supportMotion=isSupportTransition(props,contextMotion),nodeRef=React.useRef(),wrapperNodeRef=React.useRef();function getDomElement(){try{return nodeRef.current instanceof HTMLElement?nodeRef.current:findDOMNode(wrapperNodeRef.current)}catch{return null}}__name(getDomElement,"getDomElement");var _useStatus=useStatus(supportMotion,visible,getDomElement,props),_useStatus2=_slicedToArray$1(_useStatus,4),status=_useStatus2[0],statusStep=_useStatus2[1],statusStyle=_useStatus2[2],mergedVisible=_useStatus2[3],renderedRef=React__namespace.useRef(mergedVisible);mergedVisible&&(renderedRef.current=!0);var setNodeRef=React__namespace.useCallback(function(node){nodeRef.current=node,fillRef(ref,node)},[ref]),motionChildren,mergedProps=_objectSpread2$1(_objectSpread2$1({},eventProps),{},{visible});if(!children)motionChildren=null;else if(status===STATUS_NONE)mergedVisible?motionChildren=children(_objectSpread2$1({},mergedProps),setNodeRef):!removeOnLeave&&renderedRef.current&&leavedClassName?motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{className:leavedClassName}),setNodeRef):forceRender||!removeOnLeave&&!leavedClassName?motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{style:{display:"none"}}),setNodeRef):motionChildren=null;else{var statusSuffix;statusStep===STEP_PREPARE?statusSuffix="prepare":isActive(statusStep)?statusSuffix="active":statusStep===STEP_START&&(statusSuffix="start");var motionCls=getTransitionName(motionName,"".concat(status,"-").concat(statusSuffix));motionChildren=children(_objectSpread2$1(_objectSpread2$1({},mergedProps),{},{className:clsx(getTransitionName(motionName,status),_defineProperty$1(_defineProperty$1({},motionCls,motionCls&&statusSuffix),motionName,typeof motionName=="string")),style:statusStyle}),setNodeRef)}if(React__namespace.isValidElement(motionChildren)&&supportRef(motionChildren)){var _ref=motionChildren,originNodeRef=_ref.ref;originNodeRef||(motionChildren=React__namespace.cloneElement(motionChildren,{ref:setNodeRef}))}return React__namespace.createElement(DomWrapper,{ref:wrapperNodeRef},motionChildren)});return CSSMotion2.displayName="CSSMotion",CSSMotion2}__name(genCSSMotion,"genCSSMotion");const CSSMotion=genCSSMotion(supportTransition);var STATUS_ADD="add",STATUS_KEEP="keep",STATUS_REMOVE="remove",STATUS_REMOVED="removed";function wrapKeyToObject(key){var keyObj;return key&&_typeof$1(key)==="object"&&"key"in key?keyObj=key:keyObj={key},_objectSpread2$1(_objectSpread2$1({},keyObj),{},{key:String(keyObj.key)})}__name(wrapKeyToObject,"wrapKeyToObject");function parseKeys(){var keys=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return keys.map(wrapKeyToObject)}__name(parseKeys,"parseKeys");function diffKeys(){var prevKeys=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],currentKeys=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],list=[],currentIndex=0,currentLen=currentKeys.length,prevKeyObjects=parseKeys(prevKeys),currentKeyObjects=parseKeys(currentKeys);prevKeyObjects.forEach(function(keyObj){for(var hit=!1,i=currentIndex;i<currentLen;i+=1){var currentKeyObj=currentKeyObjects[i];if(currentKeyObj.key===keyObj.key){currentIndex<i&&(list=list.concat(currentKeyObjects.slice(currentIndex,i).map(function(obj){return _objectSpread2$1(_objectSpread2$1({},obj),{},{status:STATUS_ADD})})),currentIndex=i),list.push(_objectSpread2$1(_objectSpread2$1({},currentKeyObj),{},{status:STATUS_KEEP})),currentIndex+=1,hit=!0;break}}hit||list.push(_objectSpread2$1(_objectSpread2$1({},keyObj),{},{status:STATUS_REMOVE}))}),currentIndex<currentLen&&(list=list.concat(currentKeyObjects.slice(currentIndex).map(function(obj){return _objectSpread2$1(_objectSpread2$1({},obj),{},{status:STATUS_ADD})})));var keys={};list.forEach(function(_ref){var key=_ref.key;keys[key]=(keys[key]||0)+1});var duplicatedKeys=Object.keys(keys).filter(function(key){return keys[key]>1});return duplicatedKeys.forEach(function(matchKey){list=list.filter(function(_ref2){var key=_ref2.key,status=_ref2.status;return key!==matchKey||status!==STATUS_REMOVE}),list.forEach(function(node){node.key===matchKey&&(node.status=STATUS_KEEP)})}),list}__name(diffKeys,"diffKeys");var _excluded$2=["component","children","onVisibleChanged","onAllRemoved"],_excluded2=["status"],MOTION_PROP_NAMES=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function genCSSMotionList(transitionSupport){var CSSMotion$1=arguments.length>1&&arguments[1]!==void 0?arguments[1]:CSSMotion,CSSMotionList2=function(_React$Component){_inherits(CSSMotionList3,_React$Component);var _super=_createSuper(CSSMotionList3);function CSSMotionList3(){var _this;_classCallCheck(this,CSSMotionList3);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=_super.call.apply(_super,[this].concat(args)),_defineProperty$1(_assertThisInitialized(_this),"state",{keyEntities:[]}),_defineProperty$1(_assertThisInitialized(_this),"removeKey",function(removeKey){var keyEntities=_this.state.keyEntities,nextKeyEntities=keyEntities.map(function(entity){return entity.key!==removeKey?entity:_objectSpread2$1(_objectSpread2$1({},entity),{},{status:STATUS_REMOVED})});return _this.setState({keyEntities:nextKeyEntities}),nextKeyEntities.filter(function(_ref){var status=_ref.status;return status!==STATUS_REMOVED}).length}),_this}return __name(CSSMotionList3,"CSSMotionList"),_createClass(CSSMotionList3,[{key:"render",value:__name(function(){var _this2=this,keyEntities=this.state.keyEntities,_this$props=this.props,component=_this$props.component,children=_this$props.children,_onVisibleChanged=_this$props.onVisibleChanged,onAllRemoved=_this$props.onAllRemoved,restProps=_objectWithoutProperties(_this$props,_excluded$2),Component=component||React__namespace.Fragment,motionProps={};return MOTION_PROP_NAMES.forEach(function(prop){motionProps[prop]=restProps[prop],delete restProps[prop]}),delete restProps.keys,React__namespace.createElement(Component,restProps,keyEntities.map(function(_ref2,index){var status=_ref2.status,eventProps=_objectWithoutProperties(_ref2,_excluded2),visible=status===STATUS_ADD||status===STATUS_KEEP;return React__namespace.createElement(CSSMotion$1,_extends({},motionProps,{key:eventProps.key,visible,eventProps,onVisibleChanged:__name(function(changedVisible){if(_onVisibleChanged==null||_onVisibleChanged(changedVisible,{key:eventProps.key}),!changedVisible){var restKeysCount=_this2.removeKey(eventProps.key);restKeysCount===0&&onAllRemoved&&onAllRemoved()}},"onVisibleChanged")}),function(props,ref){return children(_objectSpread2$1(_objectSpread2$1({},props),{},{index}),ref)})}))},"render")}],[{key:"getDerivedStateFromProps",value:__name(function(_ref3,_ref4){var keys=_ref3.keys,keyEntities=_ref4.keyEntities,parsedKeyObjects=parseKeys(keys),mixedKeyEntities=diffKeys(keyEntities,parsedKeyObjects);return{keyEntities:mixedKeyEntities.filter(function(entity){var prevEntity=keyEntities.find(function(_ref5){var key=_ref5.key;return entity.key===key});return!(prevEntity&&prevEntity.status===STATUS_REMOVED&&entity.status===STATUS_REMOVE)})}},"getDerivedStateFromProps")}]),CSSMotionList3}(React__namespace.Component);return _defineProperty$1(CSSMotionList2,"defaultProps",{component:"div"}),CSSMotionList2}__name(genCSSMotionList,"genCSSMotionList");const CSSMotionList=genCSSMotionList(supportTransition);var KeyCode={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:__name(function(e2){var keyCode=e2.keyCode;if(e2.altKey&&!e2.ctrlKey||e2.metaKey||keyCode>=KeyCode.F1&&keyCode<=KeyCode.F12)return!1;switch(keyCode){case KeyCode.ALT:case KeyCode.CAPS_LOCK:case KeyCode.CONTEXT_MENU:case KeyCode.CTRL:case KeyCode.DOWN:case KeyCode.END:case KeyCode.ESC:case KeyCode.HOME:case KeyCode.INSERT:case KeyCode.LEFT:case KeyCode.MAC_FF_META:case KeyCode.META:case KeyCode.NUMLOCK:case KeyCode.NUM_CENTER:case KeyCode.PAGE_DOWN:case KeyCode.PAGE_UP:case KeyCode.PAUSE:case KeyCode.PRINT_SCREEN:case KeyCode.RIGHT:case KeyCode.SHIFT:case KeyCode.UP:case KeyCode.WIN_KEY:case KeyCode.WIN_KEY_RIGHT:return!1;default:return!0}},"isTextModifyingKeyEvent"),isCharacterKey:__name(function(keyCode){if(keyCode>=KeyCode.ZERO&&keyCode<=KeyCode.NINE||keyCode>=KeyCode.NUM_ZERO&&keyCode<=KeyCode.NUM_MULTIPLY||keyCode>=KeyCode.A&&keyCode<=KeyCode.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&keyCode===0)return!0;switch(keyCode){case KeyCode.SPACE:case KeyCode.QUESTION_MARK:case KeyCode.NUM_PLUS:case KeyCode.NUM_MINUS:case KeyCode.NUM_PERIOD:case KeyCode.NUM_DIVISION:case KeyCode.SEMICOLON:case KeyCode.DASH:case KeyCode.EQUALS:case KeyCode.COMMA:case KeyCode.PERIOD:case KeyCode.SLASH:case KeyCode.APOSTROPHE:case KeyCode.SINGLE_QUOTE:case KeyCode.OPEN_SQUARE_BRACKET:case KeyCode.BACKSLASH:case KeyCode.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},"isCharacterKey")},attributes=`accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
31
31
|
alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
|
|
32
32
|
charSet checked classID className colSpan cols content contentEditable contextMenu
|
|
33
33
|
controls coords crossOrigin data dateTime default defer dir disabled download draggable
|