@univerjs/ui 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ export { IConfirmService } from './services/confirm/confirm.service';
30
30
  export { DesktopConfirmService } from './services/confirm/desktop-confirm.service';
31
31
  export { DesktopContextMenuService, type IContextMenuHandler, IContextMenuService, } from './services/contextmenu/contextmenu.service';
32
32
  export { DesktopDialogService } from './services/dialog/desktop-dialog.service';
33
+ export { type IDialogPartMethodOptions } from './views/components/dialog-part/interface';
33
34
  export { IDialogService } from './services/dialog/dialog.service';
34
35
  export { ILayoutService, DesktopLayoutService } from './services/layout/layout.service';
35
36
  export { type ICustomComponentProps, type IDisplayMenuItem, type IMenuButtonItem, type IMenuItem, type IMenuItemFactory, type IMenuSelectorItem, type IValueOption, MenuGroup, MenuItemType, MenuPosition, } from './services/menu/menu';
@@ -10,5 +10,5 @@ export declare class DesktopDialogService extends Disposable implements IDialogS
10
10
  dispose(): void;
11
11
  open(option: IDialogPartMethodOptions): IDisposable;
12
12
  close(id: string): void;
13
- getObservableDialog(): Subject<IDialogPartMethodOptions[]>;
13
+ getDialogs$(): Subject<IDialogPartMethodOptions[]>;
14
14
  }
@@ -1,10 +1,10 @@
1
1
  import { IDialogPartMethodOptions } from '../../views/components/dialog-part/interface';
2
- import { Subject } from 'rxjs';
2
+ import { Observable } from 'rxjs';
3
3
  import { IDisposable } from '@wendellhu/redi';
4
4
 
5
5
  export declare const IDialogService: import('@wendellhu/redi').IdentifierDecorator<IDialogService>;
6
6
  export interface IDialogService {
7
7
  open(params: IDialogPartMethodOptions): IDisposable;
8
8
  close(id: string): void;
9
- getObservableDialog(): Subject<IDialogPartMethodOptions[]>;
9
+ getDialogs$(): Observable<IDialogPartMethodOptions[]>;
10
10
  }
@@ -1,10 +1,11 @@
1
1
  import { IWorkbenchOptions } from './controllers/ui/ui.controller';
2
2
  import { Injector } from '@wendellhu/redi';
3
- import { IContextService, LocaleService, Plugin } from '@univerjs/core';
3
+ import { DependencyOverride, IContextService, LocaleService, Plugin } from '@univerjs/core';
4
4
 
5
5
  export interface IUniverUIConfig extends IWorkbenchOptions {
6
6
  /** Disable auto focus when Univer bootstraps. */
7
7
  disableAutoFocus?: true;
8
+ override?: DependencyOverride;
8
9
  }
9
10
  export declare const DISABLE_AUTO_FOCUS_KEY = "DISABLE_AUTO_FOCUS";
10
11
  /**
package/lib/umd/index.js CHANGED
@@ -37,13 +37,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
37
37
  onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
38
38
  onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
39
39
  onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
40
- onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,w9="".concat(L9," ").concat(E9).split(/[\s\n]+/),M9="aria-",O9="data-";function w6(e,t){return e.indexOf(t)===0}function I9(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||w6(i,M9))||n.data&&w6(i,O9)||n.attr&&w9.includes(i))&&(r[i]=e[i])}),r}var H9=ne.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,p=e.closeIcon,f=p===void 0?"x":p,S=e.props,_=e.onClick,L=e.onNoticeClose,U=e.times,H=e.hovering,A=ne.useState(!1),k=Ne(A,2),F=k[0],G=k[1],M=H||F,V=function(){L(u)},R=function(J){(J.key==="Enter"||J.code==="Enter"||J.keyCode===te.ENTER)&&V()};ne.useEffect(function(){if(!M&&o>0){var Z=setTimeout(function(){V()},o*1e3);return function(){clearTimeout(Z)}}},[o,M,U]);var N=ne.useMemo(function(){return Ze(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),$=I9(N,!0),q="".concat(n,"-notice");return ne.createElement("div",c1({},S,{ref:t,className:I1(q,i,Te({},"".concat(q,"-closable"),h)),style:r,onMouseEnter:function(J){var K;G(!0),S==null||(K=S.onMouseEnter)===null||K===void 0||K.call(S,J)},onMouseLeave:function(J){var K;G(!1),S==null||(K=S.onMouseLeave)===null||K===void 0||K.call(S,J)},onClick:_}),ne.createElement("div",{className:"".concat(q,"-content")},d),h&&ne.createElement("a",c1({tabIndex:0,className:"".concat(q,"-close"),onKeyDown:R,"aria-label":"Close"},$,{onClick:function(J){J.preventDefault(),J.stopPropagation(),V()}}),N.closeIcon))}),D9=s.createContext({}),M6=8,O6=3,I6=16,T9=function(t){var n={offset:M6,threshold:O6,gap:I6};if(t&&Ze(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:M6,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:O6,n.gap=(a=t.gap)!==null&&a!==void 0?a:I6}return[!!t,n]},x9=["className","style","classNames","styles"],V9=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,p=t.stack,f=s.useContext(D9),S=f.classNames,_=s.useRef({}),L=s.useState(null),U=Ne(L,2),H=U[0],A=U[1],k=s.useState([]),F=Ne(k,2),G=F[0],M=F[1],V=n.map(function(ae){return{config:ae,key:String(ae.key)}}),R=T9(p),N=Ne(R,2),$=N[0],q=N[1],Z=q.offset,J=q.threshold,K=q.gap,me=$&&(G.length>0||V.length<=J),fe=typeof u=="function"?u(r):u;return s.useEffect(function(){$&&G.length>1&&M(function(ae){return ae.filter(function(pe){return V.some(function(Ee){var O=Ee.key;return pe===O})})})},[G,V,$]),s.useEffect(function(){var ae;if($&&_.current[(ae=V[V.length-1])===null||ae===void 0?void 0:ae.key]){var pe;A(_.current[(pe=V[V.length-1])===null||pe===void 0?void 0:pe.key])}},[V,$]),s.createElement(_9,c1({key:r,className:I1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,Te(Te({},"".concat(i,"-stack"),!!$),"".concat(i,"-stack-expanded"),me)),style:o,keys:V,motionAppear:!0},fe,{onAllRemoved:function(){d(r)}}),function(ae,pe){var Ee=ae.config,O=ae.className,w=ae.style,D=ae.index,Y=Ee,W=Y.key,X=Y.times,ie=String(W),oe=Ee,Le=oe.className,xe=oe.style,Ie=oe.classNames,we=oe.styles,Je=q1(oe,x9),Ge=V.findIndex(function(d1){return d1.key===ie}),Be={};if($){var ce=V.length-1-(Ge>-1?Ge:D-1),re=r==="top"||r==="bottom"?"-50%":"0";if(ce>0){var ye,Ue,He;Be.height=me?(ye=_.current[ie])===null||ye===void 0?void 0:ye.offsetHeight:H==null?void 0:H.offsetHeight;for(var Me=0,he=0;he<ce;he++){var ve;Me+=((ve=_.current[V[V.length-1-he].key])===null||ve===void 0?void 0:ve.offsetHeight)+K}var Pe=(me?Me:ce*Z)*(r.startsWith("top")?1:-1),e1=!me&&H!==null&&H!==void 0&&H.offsetWidth&&(Ue=_.current[ie])!==null&&Ue!==void 0&&Ue.offsetWidth?((H==null?void 0:H.offsetWidth)-Z*2*(ce<3?ce:3))/((He=_.current[ie])===null||He===void 0?void 0:He.offsetWidth):1;Be.transform="translate3d(".concat(re,", ").concat(Pe,"px, 0) scaleX(").concat(e1,")")}else Be.transform="translate3d(".concat(re,", 0, 0)")}return s.createElement("div",{ref:pe,className:I1("".concat(i,"-notice-wrapper"),O,Ie==null?void 0:Ie.wrapper),style:Ce(Ce(Ce({},w),Be),we==null?void 0:we.wrapper),onMouseEnter:function(){return M(function(t1){return t1.includes(ie)?t1:[].concat(O1(t1),[ie])})},onMouseLeave:function(){return M(function(t1){return t1.filter(function(St){return St!==ie})})}},s.createElement(H9,c1({},Je,{ref:function(t1){Ge>-1?_.current[ie]=t1:delete _.current[ie]},prefixCls:i,classNames:Ie,styles:we,className:I1(Le,S==null?void 0:S.notice),style:xe,times:X,key:W,eventKey:W,onNoticeClose:h,hovering:$&&G.length>0})))})},N9=ne.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,p=e.stack,f=e.renderNotifications,S=ne.useState([]),_=Ne(S,2),L=_[0],U=_[1],H=function($){var q,Z=L.find(function(J){return J.key===$});Z==null||(q=Z.onClose)===null||q===void 0||q.call(Z),U(function(J){return J.filter(function(K){return K.key!==$})})};ne.useImperativeHandle(t,function(){return{open:function($){U(function(q){var Z=O1(q),J=Z.findIndex(function(fe){return fe.key===$.key}),K=Ce({},$);if(J>=0){var me;K.times=(((me=q[J])===null||me===void 0?void 0:me.times)||0)+1,Z[J]=K}else K.times=0,Z.push(K);return o>0&&Z.length>o&&(Z=Z.slice(-o)),Z})},close:function($){H($)},destroy:function(){U([])}}});var A=ne.useState({}),k=Ne(A,2),F=k[0],G=k[1];ne.useEffect(function(){var N={};L.forEach(function($){var q=$.placement,Z=q===void 0?"topRight":q;Z&&(N[Z]=N[Z]||[],N[Z].push($))}),Object.keys(F).forEach(function($){N[$]=N[$]||[]}),G(N)},[L]);var M=function($){G(function(q){var Z=Ce({},q),J=Z[$]||[];return J.length||delete Z[$],Z})},V=ne.useRef(!1);if(ne.useEffect(function(){Object.keys(F).length>0?V.current=!0:V.current&&(h==null||h(),V.current=!1)},[F]),!i)return null;var R=Object.keys(F);return yt.createPortal(ne.createElement(ne.Fragment,null,R.map(function(N){var $=F[N],q=ne.createElement(V9,{key:N,configList:$,placement:N,prefixCls:r,className:u==null?void 0:u(N),style:d==null?void 0:d(N),motion:a,onNoticeClose:H,onAllNoticeRemoved:M,stack:p});return f?f(q,{prefixCls:r,key:N}):q})),i)}),k9=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],A9=function(){return document.body},H6=0;function R9(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function U9(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?A9:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,p=e.renderNotifications,f=q1(e,k9),S=ne.useState(),_=Ne(S,2),L=_[0],U=_[1],H=ne.useRef(),A=ne.createElement(N9,{container:L,ref:H,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:p}),k=ne.useState([]),F=Ne(k,2),G=F[0],M=F[1],V=ne.useMemo(function(){return{open:function(N){var $=R9(f,N);($.key===null||$.key===void 0)&&($.key="rc-notification-".concat(H6),H6+=1),M(function(q){return[].concat(O1(q),[{type:"open",config:$}])})},close:function(N){M(function($){return[].concat(O1($),[{type:"close",key:N}])})},destroy:function(){M(function(N){return[].concat(O1(N),[{type:"destroy"}])})}}},[]);return ne.useEffect(function(){U(n())}),ne.useEffect(function(){H.current&&G.length&&(G.forEach(function(R){switch(R.type){case"open":H.current.open(R.config);break;case"close":H.current.close(R.key);break;case"destroy":H.current.destroy();break}}),M(function(R){return R.filter(function(N){return!G.includes(N)})}))},[G]),[V,A]}const Qe={notification:"univer-notification",notificationNotice:"univer-notification-notice",notificationNoticeWrapper:"univer-notification-notice-wrapper",notificationNoticeContent:"univer-notification-notice-content",notificationNoticeClose:"univer-notification-notice-close",notificationIcon:"univer-notification-icon",notificationIconSuccess:"univer-notification-icon-success",notificationIconInfo:"univer-notification-icon-info",notificationIconWarning:"univer-notification-icon-warning",notificationIconError:"univer-notification-icon-error",notificationContentContainer:"univer-notification-content-container",notificationTitle:"univer-notification-title",notificationContent:"univer-notification-content",notificationContentEllipsis:"univer-notification-content-ellipsis",notificationTop:"univer-notification-top",notificationTopLeft:"univer-notification-topLeft",notificationTopRight:"univer-notification-topRight",notificationBottom:"univer-notification-bottom",notificationBottomRight:"univer-notification-bottomRight",notificationBottomLeft:"univer-notification-bottomLeft",notificationFade:"univer-notification-fade",notificationFadeAppearPrepare:"univer-notification-fade-appear-prepare",notificationFadeAppearStart:"univer-notification-fade-appear-start",notificationFadeAppearActive:"univer-notification-fade-appear-active",notificationFadeAppear:"univer-notification-fade-appear",notificationFadeEnter:"univer-notification-fade-enter",notificationFadeLeave:"univer-notification-fade-leave",notificationFadeEnterActive:"univer-notification-fade-enter-active",notificationFadeIn:"univer-notification-fade-in",notificationFadeLeaveActive:"univer-notification-fade-leave-active",notificationFadeOut:"univer-notification-fade-out"},P9={success:v.jsx(fa,{className:Qe.notificationIconSuccess}),info:v.jsx(mr,{className:Qe.notificationIconInfo}),warning:v.jsx(mr,{className:Qe.notificationIconWarning}),error:v.jsx(i2,{className:Qe.notificationIconError})},D6=new ee.Subject,j9=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Ve(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:P9[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function $9(){const{mountContainer:e}=s.useContext(ge.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=U9({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(_t,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(D6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(j9,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const B9={show:e=>{D6.next(e)}},Gt=se.createIdentifier("univer.confirm-service");function z9(){const e=le.useDependency(Gt),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const p=h,f=i[p];f&&(d[p]=v.jsx(je,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(ge.Confirm,{...i},a))}const Yt=se.createIdentifier("univer.context-menu-service");class T6 extends y.Disposable{constructor(){super(...arguments);z(this,"_currentHandler",null);z(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,y.toDisposable(()=>{this._currentHandler=null})}}function F9(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(Yt),u=le.useDependency(y.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",p),document.addEventListener("wheel",p),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("wheel",p),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function p(){t(!1)}return v.jsx(ge.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(P1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:_}=f;u&&u.executeCommand(S,{value:_}),d.get(h1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const qt=se.createIdentifier("univer.ui.dialog-service");function Z9(){const e=le.useDependency(qt),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.getObservableDialog().subscribe(o=>{n(o)});return()=>{a.unsubscribe()}},[e]);const r=t.map(i=>{const{children:a,title:o,closeIcon:u,footer:d,...h}=i,p=h;for(const f of["children","title","closeIcon","footer"]){const S=f,_=i[S];_&&(p[S]=v.jsx(je,{..._}))}return p});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(ge.Dialog,{...i},i.id))})}const Xt=se.createIdentifier("univer.global-zone-service"),x6={globalZone:"univer-global-zone",globalZoneOpen:"univer-global-zone-open",globalZoneClose:"univer-global-zone-close"};function W9(){const e=le.useDependency(Xt),[t,n]=s.useState(!1),r=Ae(e.componentKey$,e.componentKey),i=le.useDependency(Ke),a=Ve(x6.globalZone,x6.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r,i]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const G9=new Set([()=>Z9,()=>z9,()=>$9,()=>F9,()=>W9]),Qt=se.createIdentifier("univer.popup.service");class V6{constructor(){z(this,"_popupMap",new Map);z(this,"_popups$",new ee.BehaviorSubject([]));z(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=y.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const Y9=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(ge.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function q9(){const e=le.useDependency(Qt),t=Ae(e.popups$,void 0,!0),n=le.useDependency(Ke);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(Y9,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function X9(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,p=le.useDependency(y.LocaleService),f=le.useDependency(y.ThemeService),S=le.useDependency(G1),_=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(ge.defaultTheme)},[]),s.useEffect(()=>{_.current&&(h==null||h(_.current))},[h]);const[L,U]=s.useState(p.getLocales()),H=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(H),S.setContainer(H);const A=[p.localeChanged$.subscribe(()=>{U(p.getLocales())}),f.currentTheme$.subscribe(k=>{ge.themeInstance.setTheme(r,k),H&&ge.themeInstance.setTheme(H,k)})];return()=>{A.forEach(k=>k.unsubscribe()),document.body.removeChild(H)}},[p,S,r,H,f.currentTheme$]),v.jsxs(ge.ConfigProvider,{locale:L,mountContainer:H,children:[v.jsxs("div",{className:r1.appLayout,tabIndex:-1,onBlur:A=>A.stopPropagation(),children:[t&&v.jsx("header",{className:r1.appContainerHeader,children:v.jsx(Ro,{headerMenuComponents:a})}),v.jsxs("section",{className:r1.appContainer,children:[v.jsxs("div",{className:r1.appContainerWrapper,children:[v.jsx("aside",{className:r1.appContainerLeftSidebar,children:v.jsx(p1,{components:d})}),v.jsxs("section",{className:r1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(p1,{components:i})}),v.jsx("section",{className:r1.appContainerCanvas,ref:_,"data-range-selector":!0,onContextMenu:A=>A.preventDefault(),children:v.jsx(p1,{components:o})})]}),v.jsx("aside",{className:r1.appContainerSidebar,children:v.jsx(Uo,{})})]}),n&&v.jsx("footer",{className:r1.appFooter,children:v.jsx(p1,{components:u})}),v.jsx(Po,{})]}),v.jsx(q9,{})]}),v.jsx(p1,{components:G9})]})}var Q9=Object.defineProperty,J9=Object.getOwnPropertyDescriptor,K9=(e,t,n,r)=>{for(var i=r>1?void 0:r?J9(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q9(t,n,i),i},H1=(e,t)=>(n,r)=>t(n,r,e),N6=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(N6||{});const e4=3e3;E.DesktopUIController=class extends y.Disposable{constructor(n,r,i,a,o){super();z(this,"_componentsByPart",new Map);z(this,"_componentRegistered$",new ee.Subject);z(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(t4(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==y.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ee.filter(a=>a===y.LifecycleStages.Ready),ee.delay(300),ee.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=y.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=y.LifecycleStages.Steady,e4)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),y.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}},E.DesktopUIController=K9([H1(0,y.IUniverInstanceService),H1(1,h1.IRenderManagerService),H1(2,se.Inject(se.Injector)),H1(3,se.Inject(y.LifecycleService)),H1(4,se.Optional(L1))],E.DesktopUIController);function t4(e,t,n){let r;const i=t.container;if(typeof i=="string"){const p=document.getElementById(i);p?r=p:r=k6(i)}else i instanceof HTMLElement?r=i:r=k6("univer");const a=le.connectInjector(X9,e),o=e.get(B1),u=p=>n(p,r);function d(){const p=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),_=o.getComponents("header-menu"),L=o.getComponents("left-sidebar");So(v.jsx(a,{...t,mountContainer:r,headerComponents:p,headerMenuComponents:_,leftSidebarComponents:L,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),y.toDisposable(()=>{bo(r),h.unsubscribe()})}function k6(e){const t=document.createElement("div");return t.id=e,t}const n4={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},A6={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},dt=se.createIdentifier("univer.notification-service");var r4=Object.defineProperty,i4=Object.getOwnPropertyDescriptor,a4=(e,t,n,r)=>{for(var i=r>1?void 0:r?i4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&r4(t,n,i),i},o4=(e,t)=>(n,r)=>t(n,r,e);const R6=se.createIdentifier("univer.ui.before-close-service");E.DesktopBeforeCloseService=class{constructor(t){z(this,"_beforeUnloadCallbacks",[]);z(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
41
- `);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}},E.DesktopBeforeCloseService=a4([o4(0,dt)],E.DesktopBeforeCloseService);function s4(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var l4=Object.defineProperty,c4=Object.getOwnPropertyDescriptor,u4=(e,t,n,r)=>{for(var i=r>1?void 0:r?c4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l4(t,n,i),i},Jt=(e,t)=>(n,r)=>t(n,r,e);const Kt="text/plain",en="text/html",U6=se.createIdentifier("univer.clipboard-interface-service");E.BrowserClipboardService=class extends y.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return s4()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Kt]:new Blob([t],{type:Kt}),[en]:new Blob([n],{type:en})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=d4();document.body.appendChild(r),r.innerHTML=t;try{P6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=f4();document.body.appendChild(r),r.value=t;try{P6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},E.BrowserClipboardService=u4([Jt(0,se.Inject(y.LocaleService)),Jt(1,y.ILogService),Jt(2,se.Optional(dt))],E.BrowserClipboardService);function f4(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function d4(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function P6(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class j6{constructor(){z(this,"_confirmOptions",[]);z(this,"confirmOptions$",new ee.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),y.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class $6 extends y.Disposable{constructor(){super(...arguments);z(this,"_dialogOptions",[]);z(this,"_dialogOptions$",new ee.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),y.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getObservableDialog(){return this._dialogOptions$}}class B6{constructor(){z(this,"portalContainer",document.body);z(this,"message")}setContainer(t){this.portalContainer=t,this.message=new ge.Message(t)}show(t){const{type:n,...r}=t;return this.message&&this.message[n](r),y.toDisposable(()=>{})}}class z6{show(t){return B9.show(t),y.toDisposable(()=>{})}}var h4=Object.defineProperty,m4=Object.getOwnPropertyDescriptor,p4=(e,t,n,r)=>{for(var i=r>1?void 0:r?m4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&h4(t,n,i),i},g4=(e,t)=>(n,r)=>t(n,r,e);E.DesktopGlobalZoneService=class{constructor(t){z(this,"visible$",new ee.Subject);z(this,"componentKey$",new ee.Subject);z(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),this._componentKey=t,y.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},E.DesktopGlobalZoneService=p4([g4(0,se.Inject(Ke))],E.DesktopGlobalZoneService);class F6{constructor(){z(this,"_sidebarOptions",{});z(this,"sidebarOptions$",new ee.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),y.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var v4=Object.defineProperty,C4=Object.getOwnPropertyDescriptor,S4=(e,t,n,r)=>{for(var i=r>1?void 0:r?C4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&v4(t,n,i),i},Z6=(e,t)=>(n,r)=>t(n,r,e);let ht=class extends y.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(y.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:ge.MessageType.Error})})))}};ht=S4([y.OnLifecycle(y.LifecycleStages.Starting,ht),Z6(0,se.Inject(y.ErrorService)),Z6(1,G1)],ht);class W6 extends y.Disposable{constructor(){super(...arguments);z(this,"_open$",new ee.BehaviorSubject(!1));z(this,"open$",this._open$.pipe(ee.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const G6="ShortcutPanel",tn={id:"base-ui.operation.toggle-shortcut-panel",type:y.CommandType.OPERATION,handler:e=>{const t=e.get(W6),n=e.get(Y1);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:G6}})),!0}},C1={shortcutPanelGroupTitle:"univer-shortcut-panel-group-title",shortcutPanelItem:"univer-shortcut-panel-item",shortcutPanelItemTitle:"univer-shortcut-panel-item-title",shortcutPanelItemShortcut:"univer-shortcut-panel-item-shortcut"};function b4(){const e=le.useDependency(m1),t=le.useDependency(y.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const p=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(p))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${p}!`);a.has(p)||a.set(p,[]),a.get(p).push(f)}const u=Array.from(a.entries()).map(([h,p])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:p}}).sort((h,p)=>h.sequence-p.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:C1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:C1.shortcutPanelGroup,children:[v.jsx("div",{className:C1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:C1.shortcutPanelItem,children:[v.jsx("span",{className:C1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:C1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function y4(e){return{id:tn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:$e.BUTTON,positions:[Fe.TOOLBAR_START],hidden$:gr(e,y.UniverInstanceType.UNIVER_SHEET)}}var _4=Object.defineProperty,L4=Object.getOwnPropertyDescriptor,E4=(e,t,n,r)=>{for(var i=r>1?void 0:r?L4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_4(t,n,i),i},D1=(e,t)=>(n,r)=>t(n,r,e);const w4={id:tn.id,binding:Re.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let mt=class extends y.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(y4))),this.disposeWithMe(t.register(G6,b4)),this.disposeWithMe(i.registerCommand(tn)),this.disposeWithMe(n.registerShortcut(w4))}};mt=E4([y.OnLifecycle(y.LifecycleStages.Steady,mt),D1(0,se.Inject(se.Injector)),D1(1,se.Inject(Ke)),D1(2,m1),D1(3,s1),D1(4,y.ICommandService)],mt);function pt(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Y6={exports:{}};/*!
40
+ onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,w9="".concat(L9," ").concat(E9).split(/[\s\n]+/),M9="aria-",O9="data-";function w6(e,t){return e.indexOf(t)===0}function I9(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||w6(i,M9))||n.data&&w6(i,O9)||n.attr&&w9.includes(i))&&(r[i]=e[i])}),r}var H9=ne.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,p=e.closeIcon,f=p===void 0?"x":p,S=e.props,_=e.onClick,L=e.onNoticeClose,U=e.times,H=e.hovering,A=ne.useState(!1),k=Ne(A,2),F=k[0],G=k[1],M=H||F,V=function(){L(u)},R=function(J){(J.key==="Enter"||J.code==="Enter"||J.keyCode===te.ENTER)&&V()};ne.useEffect(function(){if(!M&&o>0){var Z=setTimeout(function(){V()},o*1e3);return function(){clearTimeout(Z)}}},[o,M,U]);var N=ne.useMemo(function(){return Ze(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),$=I9(N,!0),q="".concat(n,"-notice");return ne.createElement("div",c1({},S,{ref:t,className:I1(q,i,Te({},"".concat(q,"-closable"),h)),style:r,onMouseEnter:function(J){var K;G(!0),S==null||(K=S.onMouseEnter)===null||K===void 0||K.call(S,J)},onMouseLeave:function(J){var K;G(!1),S==null||(K=S.onMouseLeave)===null||K===void 0||K.call(S,J)},onClick:_}),ne.createElement("div",{className:"".concat(q,"-content")},d),h&&ne.createElement("a",c1({tabIndex:0,className:"".concat(q,"-close"),onKeyDown:R,"aria-label":"Close"},$,{onClick:function(J){J.preventDefault(),J.stopPropagation(),V()}}),N.closeIcon))}),D9=s.createContext({}),M6=8,O6=3,I6=16,T9=function(t){var n={offset:M6,threshold:O6,gap:I6};if(t&&Ze(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:M6,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:O6,n.gap=(a=t.gap)!==null&&a!==void 0?a:I6}return[!!t,n]},x9=["className","style","classNames","styles"],V9=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,p=t.stack,f=s.useContext(D9),S=f.classNames,_=s.useRef({}),L=s.useState(null),U=Ne(L,2),H=U[0],A=U[1],k=s.useState([]),F=Ne(k,2),G=F[0],M=F[1],V=n.map(function(ae){return{config:ae,key:String(ae.key)}}),R=T9(p),N=Ne(R,2),$=N[0],q=N[1],Z=q.offset,J=q.threshold,K=q.gap,me=$&&(G.length>0||V.length<=J),fe=typeof u=="function"?u(r):u;return s.useEffect(function(){$&&G.length>1&&M(function(ae){return ae.filter(function(pe){return V.some(function(Ee){var O=Ee.key;return pe===O})})})},[G,V,$]),s.useEffect(function(){var ae;if($&&_.current[(ae=V[V.length-1])===null||ae===void 0?void 0:ae.key]){var pe;A(_.current[(pe=V[V.length-1])===null||pe===void 0?void 0:pe.key])}},[V,$]),s.createElement(_9,c1({key:r,className:I1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,Te(Te({},"".concat(i,"-stack"),!!$),"".concat(i,"-stack-expanded"),me)),style:o,keys:V,motionAppear:!0},fe,{onAllRemoved:function(){d(r)}}),function(ae,pe){var Ee=ae.config,O=ae.className,w=ae.style,D=ae.index,Y=Ee,W=Y.key,X=Y.times,ie=String(W),oe=Ee,Le=oe.className,xe=oe.style,Ie=oe.classNames,we=oe.styles,Je=q1(oe,x9),Ge=V.findIndex(function(d1){return d1.key===ie}),Be={};if($){var ce=V.length-1-(Ge>-1?Ge:D-1),re=r==="top"||r==="bottom"?"-50%":"0";if(ce>0){var ye,Ue,He;Be.height=me?(ye=_.current[ie])===null||ye===void 0?void 0:ye.offsetHeight:H==null?void 0:H.offsetHeight;for(var Me=0,he=0;he<ce;he++){var ve;Me+=((ve=_.current[V[V.length-1-he].key])===null||ve===void 0?void 0:ve.offsetHeight)+K}var Pe=(me?Me:ce*Z)*(r.startsWith("top")?1:-1),e1=!me&&H!==null&&H!==void 0&&H.offsetWidth&&(Ue=_.current[ie])!==null&&Ue!==void 0&&Ue.offsetWidth?((H==null?void 0:H.offsetWidth)-Z*2*(ce<3?ce:3))/((He=_.current[ie])===null||He===void 0?void 0:He.offsetWidth):1;Be.transform="translate3d(".concat(re,", ").concat(Pe,"px, 0) scaleX(").concat(e1,")")}else Be.transform="translate3d(".concat(re,", 0, 0)")}return s.createElement("div",{ref:pe,className:I1("".concat(i,"-notice-wrapper"),O,Ie==null?void 0:Ie.wrapper),style:Ce(Ce(Ce({},w),Be),we==null?void 0:we.wrapper),onMouseEnter:function(){return M(function(t1){return t1.includes(ie)?t1:[].concat(O1(t1),[ie])})},onMouseLeave:function(){return M(function(t1){return t1.filter(function(St){return St!==ie})})}},s.createElement(H9,c1({},Je,{ref:function(t1){Ge>-1?_.current[ie]=t1:delete _.current[ie]},prefixCls:i,classNames:Ie,styles:we,className:I1(Le,S==null?void 0:S.notice),style:xe,times:X,key:W,eventKey:W,onNoticeClose:h,hovering:$&&G.length>0})))})},N9=ne.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,p=e.stack,f=e.renderNotifications,S=ne.useState([]),_=Ne(S,2),L=_[0],U=_[1],H=function($){var q,Z=L.find(function(J){return J.key===$});Z==null||(q=Z.onClose)===null||q===void 0||q.call(Z),U(function(J){return J.filter(function(K){return K.key!==$})})};ne.useImperativeHandle(t,function(){return{open:function($){U(function(q){var Z=O1(q),J=Z.findIndex(function(fe){return fe.key===$.key}),K=Ce({},$);if(J>=0){var me;K.times=(((me=q[J])===null||me===void 0?void 0:me.times)||0)+1,Z[J]=K}else K.times=0,Z.push(K);return o>0&&Z.length>o&&(Z=Z.slice(-o)),Z})},close:function($){H($)},destroy:function(){U([])}}});var A=ne.useState({}),k=Ne(A,2),F=k[0],G=k[1];ne.useEffect(function(){var N={};L.forEach(function($){var q=$.placement,Z=q===void 0?"topRight":q;Z&&(N[Z]=N[Z]||[],N[Z].push($))}),Object.keys(F).forEach(function($){N[$]=N[$]||[]}),G(N)},[L]);var M=function($){G(function(q){var Z=Ce({},q),J=Z[$]||[];return J.length||delete Z[$],Z})},V=ne.useRef(!1);if(ne.useEffect(function(){Object.keys(F).length>0?V.current=!0:V.current&&(h==null||h(),V.current=!1)},[F]),!i)return null;var R=Object.keys(F);return yt.createPortal(ne.createElement(ne.Fragment,null,R.map(function(N){var $=F[N],q=ne.createElement(V9,{key:N,configList:$,placement:N,prefixCls:r,className:u==null?void 0:u(N),style:d==null?void 0:d(N),motion:a,onNoticeClose:H,onAllNoticeRemoved:M,stack:p});return f?f(q,{prefixCls:r,key:N}):q})),i)}),k9=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],A9=function(){return document.body},H6=0;function R9(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function U9(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?A9:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,p=e.renderNotifications,f=q1(e,k9),S=ne.useState(),_=Ne(S,2),L=_[0],U=_[1],H=ne.useRef(),A=ne.createElement(N9,{container:L,ref:H,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:p}),k=ne.useState([]),F=Ne(k,2),G=F[0],M=F[1],V=ne.useMemo(function(){return{open:function(N){var $=R9(f,N);($.key===null||$.key===void 0)&&($.key="rc-notification-".concat(H6),H6+=1),M(function(q){return[].concat(O1(q),[{type:"open",config:$}])})},close:function(N){M(function($){return[].concat(O1($),[{type:"close",key:N}])})},destroy:function(){M(function(N){return[].concat(O1(N),[{type:"destroy"}])})}}},[]);return ne.useEffect(function(){U(n())}),ne.useEffect(function(){H.current&&G.length&&(G.forEach(function(R){switch(R.type){case"open":H.current.open(R.config);break;case"close":H.current.close(R.key);break;case"destroy":H.current.destroy();break}}),M(function(R){return R.filter(function(N){return!G.includes(N)})}))},[G]),[V,A]}const Qe={notification:"univer-notification",notificationNotice:"univer-notification-notice",notificationNoticeWrapper:"univer-notification-notice-wrapper",notificationNoticeContent:"univer-notification-notice-content",notificationNoticeClose:"univer-notification-notice-close",notificationIcon:"univer-notification-icon",notificationIconSuccess:"univer-notification-icon-success",notificationIconInfo:"univer-notification-icon-info",notificationIconWarning:"univer-notification-icon-warning",notificationIconError:"univer-notification-icon-error",notificationContentContainer:"univer-notification-content-container",notificationTitle:"univer-notification-title",notificationContent:"univer-notification-content",notificationContentEllipsis:"univer-notification-content-ellipsis",notificationTop:"univer-notification-top",notificationTopLeft:"univer-notification-topLeft",notificationTopRight:"univer-notification-topRight",notificationBottom:"univer-notification-bottom",notificationBottomRight:"univer-notification-bottomRight",notificationBottomLeft:"univer-notification-bottomLeft",notificationFade:"univer-notification-fade",notificationFadeAppearPrepare:"univer-notification-fade-appear-prepare",notificationFadeAppearStart:"univer-notification-fade-appear-start",notificationFadeAppearActive:"univer-notification-fade-appear-active",notificationFadeAppear:"univer-notification-fade-appear",notificationFadeEnter:"univer-notification-fade-enter",notificationFadeLeave:"univer-notification-fade-leave",notificationFadeEnterActive:"univer-notification-fade-enter-active",notificationFadeIn:"univer-notification-fade-in",notificationFadeLeaveActive:"univer-notification-fade-leave-active",notificationFadeOut:"univer-notification-fade-out"},P9={success:v.jsx(fa,{className:Qe.notificationIconSuccess}),info:v.jsx(mr,{className:Qe.notificationIconInfo}),warning:v.jsx(mr,{className:Qe.notificationIconWarning}),error:v.jsx(i2,{className:Qe.notificationIconError})},D6=new ee.Subject,j9=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Ve(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:P9[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function $9(){const{mountContainer:e}=s.useContext(ge.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=U9({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(_t,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(D6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(j9,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const B9={show:e=>{D6.next(e)}},Gt=se.createIdentifier("univer.confirm-service");function z9(){const e=le.useDependency(Gt),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const p=h,f=i[p];f&&(d[p]=v.jsx(je,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(ge.Confirm,{...i},a))}const Yt=se.createIdentifier("univer.context-menu-service");class T6 extends y.Disposable{constructor(){super(...arguments);z(this,"_currentHandler",null);z(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,y.toDisposable(()=>{this._currentHandler=null})}}function F9(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(Yt),u=le.useDependency(y.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",p),document.addEventListener("wheel",p),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("wheel",p),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function p(){t(!1)}return v.jsx(ge.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(P1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:_}=f;u&&u.executeCommand(S,{value:_}),d.get(h1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const qt=se.createIdentifier("univer.ui.dialog-service");function Z9(){const e=le.useDependency(qt),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.getDialogs$().subscribe(o=>{n(o)});return()=>a.unsubscribe()},[e]);const r=t.map(i=>{const{children:a,title:o,closeIcon:u,footer:d,...h}=i,p=h;for(const f of["children","title","closeIcon","footer"]){const S=f,_=i[S];_&&(p[S]=v.jsx(je,{..._}))}return p});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(ge.Dialog,{...i},i.id))})}const Xt=se.createIdentifier("univer.global-zone-service"),x6={globalZone:"univer-global-zone",globalZoneOpen:"univer-global-zone-open",globalZoneClose:"univer-global-zone-close"};function W9(){const e=le.useDependency(Xt),[t,n]=s.useState(!1),r=Ae(e.componentKey$,e.componentKey),i=le.useDependency(Ke),a=Ve(x6.globalZone,x6.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r,i]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const G9=new Set([()=>Z9,()=>z9,()=>$9,()=>F9,()=>W9]),Qt=se.createIdentifier("univer.popup.service");class V6{constructor(){z(this,"_popupMap",new Map);z(this,"_popups$",new ee.BehaviorSubject([]));z(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=y.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const Y9=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(ge.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function q9(){const e=le.useDependency(Qt),t=Ae(e.popups$,void 0,!0),n=le.useDependency(Ke);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(Y9,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function X9(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,p=le.useDependency(y.LocaleService),f=le.useDependency(y.ThemeService),S=le.useDependency(G1),_=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(ge.defaultTheme)},[]),s.useEffect(()=>{_.current&&(h==null||h(_.current))},[h]);const[L,U]=s.useState(p.getLocales()),H=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(H),S.setContainer(H);const A=[p.localeChanged$.subscribe(()=>{U(p.getLocales())}),f.currentTheme$.subscribe(k=>{ge.themeInstance.setTheme(r,k),H&&ge.themeInstance.setTheme(H,k)})];return()=>{A.forEach(k=>k.unsubscribe()),document.body.removeChild(H)}},[p,S,r,H,f.currentTheme$]),v.jsxs(ge.ConfigProvider,{locale:L,mountContainer:H,children:[v.jsxs("div",{className:r1.appLayout,tabIndex:-1,onBlur:A=>A.stopPropagation(),children:[t&&v.jsx("header",{className:r1.appContainerHeader,children:v.jsx(Ro,{headerMenuComponents:a})}),v.jsxs("section",{className:r1.appContainer,children:[v.jsxs("div",{className:r1.appContainerWrapper,children:[v.jsx("aside",{className:r1.appContainerLeftSidebar,children:v.jsx(p1,{components:d})}),v.jsxs("section",{className:r1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(p1,{components:i})}),v.jsx("section",{className:r1.appContainerCanvas,ref:_,"data-range-selector":!0,onContextMenu:A=>A.preventDefault(),children:v.jsx(p1,{components:o})})]}),v.jsx("aside",{className:r1.appContainerSidebar,children:v.jsx(Uo,{})})]}),n&&v.jsx("footer",{className:r1.appFooter,children:v.jsx(p1,{components:u})}),v.jsx(Po,{})]}),v.jsx(q9,{})]}),v.jsx(p1,{components:G9})]})}var Q9=Object.defineProperty,J9=Object.getOwnPropertyDescriptor,K9=(e,t,n,r)=>{for(var i=r>1?void 0:r?J9(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q9(t,n,i),i},H1=(e,t)=>(n,r)=>t(n,r,e),N6=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(N6||{});const e4=3e3;E.DesktopUIController=class extends y.Disposable{constructor(n,r,i,a,o){super();z(this,"_componentsByPart",new Map);z(this,"_componentRegistered$",new ee.Subject);z(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(t4(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==y.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ee.filter(a=>a===y.LifecycleStages.Ready),ee.delay(300),ee.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=y.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=y.LifecycleStages.Steady,e4)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),y.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}},E.DesktopUIController=K9([H1(0,y.IUniverInstanceService),H1(1,h1.IRenderManagerService),H1(2,se.Inject(se.Injector)),H1(3,se.Inject(y.LifecycleService)),H1(4,se.Optional(L1))],E.DesktopUIController);function t4(e,t,n){let r;const i=t.container;if(typeof i=="string"){const p=document.getElementById(i);p?r=p:r=k6(i)}else i instanceof HTMLElement?r=i:r=k6("univer");const a=le.connectInjector(X9,e),o=e.get(B1),u=p=>n(p,r);function d(){const p=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),_=o.getComponents("header-menu"),L=o.getComponents("left-sidebar");So(v.jsx(a,{...t,mountContainer:r,headerComponents:p,headerMenuComponents:_,leftSidebarComponents:L,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),y.toDisposable(()=>{bo(r),h.unsubscribe()})}function k6(e){const t=document.createElement("div");return t.id=e,t}const n4={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},A6={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},dt=se.createIdentifier("univer.notification-service");var r4=Object.defineProperty,i4=Object.getOwnPropertyDescriptor,a4=(e,t,n,r)=>{for(var i=r>1?void 0:r?i4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&r4(t,n,i),i},o4=(e,t)=>(n,r)=>t(n,r,e);const R6=se.createIdentifier("univer.ui.before-close-service");E.DesktopBeforeCloseService=class{constructor(t){z(this,"_beforeUnloadCallbacks",[]);z(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
41
+ `);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}},E.DesktopBeforeCloseService=a4([o4(0,dt)],E.DesktopBeforeCloseService);function s4(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var l4=Object.defineProperty,c4=Object.getOwnPropertyDescriptor,u4=(e,t,n,r)=>{for(var i=r>1?void 0:r?c4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l4(t,n,i),i},Jt=(e,t)=>(n,r)=>t(n,r,e);const Kt="text/plain",en="text/html",U6=se.createIdentifier("univer.clipboard-interface-service");E.BrowserClipboardService=class extends y.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return s4()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Kt]:new Blob([t],{type:Kt}),[en]:new Blob([n],{type:en})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=d4();document.body.appendChild(r),r.innerHTML=t;try{P6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=f4();document.body.appendChild(r),r.value=t;try{P6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},E.BrowserClipboardService=u4([Jt(0,se.Inject(y.LocaleService)),Jt(1,y.ILogService),Jt(2,se.Optional(dt))],E.BrowserClipboardService);function f4(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function d4(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function P6(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class j6{constructor(){z(this,"_confirmOptions",[]);z(this,"confirmOptions$",new ee.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),y.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class $6 extends y.Disposable{constructor(){super(...arguments);z(this,"_dialogOptions",[]);z(this,"_dialogOptions$",new ee.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),y.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$}}class B6{constructor(){z(this,"portalContainer",document.body);z(this,"message")}setContainer(t){this.portalContainer=t,this.message=new ge.Message(t)}show(t){if(!this.message)throw new Error("[DesktopMessageService]: no message implementation!");const{type:n,...r}=t;return this.message[n](r)}}class z6{show(t){return B9.show(t),y.toDisposable(()=>{})}}var h4=Object.defineProperty,m4=Object.getOwnPropertyDescriptor,p4=(e,t,n,r)=>{for(var i=r>1?void 0:r?m4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&h4(t,n,i),i},g4=(e,t)=>(n,r)=>t(n,r,e);E.DesktopGlobalZoneService=class{constructor(t){z(this,"visible$",new ee.Subject);z(this,"componentKey$",new ee.Subject);z(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),this._componentKey=t,y.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},E.DesktopGlobalZoneService=p4([g4(0,se.Inject(Ke))],E.DesktopGlobalZoneService);class F6{constructor(){z(this,"_sidebarOptions",{});z(this,"sidebarOptions$",new ee.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),y.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var v4=Object.defineProperty,C4=Object.getOwnPropertyDescriptor,S4=(e,t,n,r)=>{for(var i=r>1?void 0:r?C4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&v4(t,n,i),i},Z6=(e,t)=>(n,r)=>t(n,r,e);let ht=class extends y.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(y.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:ge.MessageType.Error})})))}};ht=S4([y.OnLifecycle(y.LifecycleStages.Starting,ht),Z6(0,se.Inject(y.ErrorService)),Z6(1,G1)],ht);class W6 extends y.Disposable{constructor(){super(...arguments);z(this,"_open$",new ee.BehaviorSubject(!1));z(this,"open$",this._open$.pipe(ee.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const G6="ShortcutPanel",tn={id:"base-ui.operation.toggle-shortcut-panel",type:y.CommandType.OPERATION,handler:e=>{const t=e.get(W6),n=e.get(Y1);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:G6}})),!0}},C1={shortcutPanelGroupTitle:"univer-shortcut-panel-group-title",shortcutPanelItem:"univer-shortcut-panel-item",shortcutPanelItemTitle:"univer-shortcut-panel-item-title",shortcutPanelItemShortcut:"univer-shortcut-panel-item-shortcut"};function b4(){const e=le.useDependency(m1),t=le.useDependency(y.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const p=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(p))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${p}!`);a.has(p)||a.set(p,[]),a.get(p).push(f)}const u=Array.from(a.entries()).map(([h,p])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:p}}).sort((h,p)=>h.sequence-p.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:C1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:C1.shortcutPanelGroup,children:[v.jsx("div",{className:C1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:C1.shortcutPanelItem,children:[v.jsx("span",{className:C1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:C1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function y4(e){return{id:tn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:$e.BUTTON,positions:[Fe.TOOLBAR_START],hidden$:gr(e,y.UniverInstanceType.UNIVER_SHEET)}}var _4=Object.defineProperty,L4=Object.getOwnPropertyDescriptor,E4=(e,t,n,r)=>{for(var i=r>1?void 0:r?L4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_4(t,n,i),i},D1=(e,t)=>(n,r)=>t(n,r,e);const w4={id:tn.id,binding:Re.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let mt=class extends y.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(y4))),this.disposeWithMe(t.register(G6,b4)),this.disposeWithMe(i.registerCommand(tn)),this.disposeWithMe(n.registerShortcut(w4))}};mt=E4([y.OnLifecycle(y.LifecycleStages.Steady,mt),D1(0,se.Inject(se.Injector)),D1(1,se.Inject(Ke)),D1(2,m1),D1(3,s1),D1(4,y.ICommandService)],mt);function pt(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Y6={exports:{}};/*!
42
42
  localForage -- Offline Storage, Improved
43
43
  Version 1.10.0
44
44
  https://localforage.github.io/localForage
45
45
  (c) 2013-2017 Mozilla, Apache License 2.0
46
- */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,p){if(!i[h]){if(!r[h]){var f=typeof pt=="function"&&pt;if(!p&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var _=i[h]={exports:{}};r[h][0].call(_.exports,function(L){var U=r[h][1][L];return o(U||L)},_,_.exports,n,r,i,a)}return i[h].exports}for(var u=typeof pt=="function"&&pt,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(L),p=a.document.createTextNode("");h.observe(p,{characterData:!0}),u=function(){p.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=L,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var H=a.document.createElement("script");H.onreadystatechange=function(){L(),H.onreadystatechange=null,H.parentNode.removeChild(H),H=null},a.document.documentElement.appendChild(H)}:u=function(){setTimeout(L,0)};var S,_=[];function L(){S=!0;for(var H,A,k=_.length;k;){for(A=_,_=[],H=-1;++H<k;)A[H]();k=_.length}S=!1}r.exports=U;function U(H){_.push(H)===1&&!S&&u()}}).call(this,typeof k1<"u"?k1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],p=["PENDING"];r.exports=f;function f(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=p,this.queue=[],this.outcome=void 0,M!==o&&U(this,M)}f.prototype.catch=function(M){return this.then(null,M)},f.prototype.then=function(M,V){if(typeof M!="function"&&this.state===h||typeof V!="function"&&this.state===d)return this;var R=new this.constructor(o);if(this.state!==p){var N=this.state===h?M:V;_(R,N,this.outcome)}else this.queue.push(new S(R,M,V));return R};function S(M,V,R){this.promise=M,typeof V=="function"&&(this.onFulfilled=V,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(M){u.resolve(this.promise,M)},S.prototype.otherCallFulfilled=function(M){_(this.promise,this.onFulfilled,M)},S.prototype.callRejected=function(M){u.reject(this.promise,M)},S.prototype.otherCallRejected=function(M){_(this.promise,this.onRejected,M)};function _(M,V,R){a(function(){var N;try{N=V(R)}catch($){return u.reject(M,$)}N===M?u.reject(M,new TypeError("Cannot resolve promise with itself")):u.resolve(M,N)})}u.resolve=function(M,V){var R=H(L,V);if(R.status==="error")return u.reject(M,R.value);var N=R.value;if(N)U(M,N);else{M.state=h,M.outcome=V;for(var $=-1,q=M.queue.length;++$<q;)M.queue[$].callFulfilled(V)}return M},u.reject=function(M,V){M.state=d,M.outcome=V;for(var R=-1,N=M.queue.length;++R<N;)M.queue[R].callRejected(V);return M};function L(M){var V=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof V=="function")return function(){V.apply(M,arguments)}}function U(M,V){var R=!1;function N(J){R||(R=!0,u.reject(M,J))}function $(J){R||(R=!0,u.resolve(M,J))}function q(){V($,N)}var Z=H(q);Z.status==="error"&&N(Z.value)}function H(M,V){var R={};try{R.value=M(V),R.status="success"}catch(N){R.status="error",R.value=N}return R}f.resolve=A;function A(M){return M instanceof this?M:u.resolve(new this(o),M)}f.reject=k;function k(M){var V=new this(o);return u.reject(V,M)}f.all=F;function F(M){var V=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=M.length,N=!1;if(!R)return this.resolve([]);for(var $=new Array(R),q=0,Z=-1,J=new this(o);++Z<R;)K(M[Z],Z);return J;function K(me,fe){V.resolve(me).then(ae,function(pe){N||(N=!0,u.reject(J,pe))});function ae(pe){$[fe]=pe,++q===R&&!N&&(N=!0,u.resolve(J,$))}}}f.race=G;function G(M){var V=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=M.length,N=!1;if(!R)return this.resolve([]);for(var $=-1,q=new this(o);++$<R;)Z(M[$]);return q;function Z(J){V.resolve(J).then(function(K){N||(N=!0,u.resolve(q,K))},function(K){N||(N=!0,u.reject(q,K))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof k1<"u"?k1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,m){if(!(l instanceof m))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function p(l,m){l=l||[],m=m||{};try{return new Blob(l,m)}catch(g){if(g.name!=="TypeError")throw g;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(m.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,m){m&&l.then(function(c){m(null,c)},function(c){m(c)})}function _(l,m,c){typeof m=="function"&&l.then(m),typeof c=="function"&&l.catch(c)}function L(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function U(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var H="local-forage-detect-blob-support",A=void 0,k={},F=Object.prototype.toString,G="readonly",M="readwrite";function V(l){for(var m=l.length,c=new ArrayBuffer(m),C=new Uint8Array(c),b=0;b<m;b++)C[b]=l.charCodeAt(b);return c}function R(l){return new f(function(m){var c=l.transaction(H,M),C=p([""]);c.objectStore(H).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),m(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);m(g||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function N(l){return typeof A=="boolean"?f.resolve(A):R(l).then(function(m){return A=m,A})}function $(l){var m=k[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),m.deferredOperations.push(c),m.dbReady?m.dbReady=m.dbReady.then(function(){return c.promise}):m.dbReady=c.promise}function q(l){var m=k[l.name],c=m.deferredOperations.pop();if(c)return c.resolve(),c.promise}function Z(l,m){var c=k[l.name],C=c.deferredOperations.pop();if(C)return C.reject(m),C.promise}function J(l,m){return new f(function(c,C){if(k[l.name]=k[l.name]||Y(),l.db)if(m)$(l),l.db.close();else return c(l.db);var b=[l.name];m&&b.push(l.version);var g=d.open.apply(d,b);m&&(g.onupgradeneeded=function(I){var x=g.result;try{x.createObjectStore(l.storeName),I.oldVersion<=1&&x.createObjectStore(H)}catch(P){if(P.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+I.oldVersion+" to version "+I.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw P}}),g.onerror=function(I){I.preventDefault(),C(g.error)},g.onsuccess=function(){var I=g.result;I.onversionchange=function(x){x.target.close()},c(I),q(l)}})}function K(l){return J(l,!1)}function me(l){return J(l,!0)}function fe(l,m){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==m&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var g=l.db.version+1;g>l.version&&(l.version=g)}return!0}return!1}function ae(l){return new f(function(m,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var g=btoa(b.target.result||"");m({__local_forage_encoded_blob:!0,data:g,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var m=V(atob(l.data));return p([m],{type:l.type})}function Ee(l){return l&&l.__local_forage_encoded_blob}function O(l){var m=this,c=m._initReady().then(function(){var C=k[m._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return _(c,l,l),c}function w(l){$(l);for(var m=k[l.name],c=m.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,K(l).then(function(g){return l.db=g,fe(l)?me(l):g}).then(function(g){l.db=m.db=g;for(var I=0;I<c.length;I++)c[I]._dbInfo.db=g}).catch(function(g){throw Z(l,g),g})}function D(l,m,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,m);c(null,b)}catch(g){if(C>0&&(!l.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||g.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),me(l)}).then(function(){return w(l).then(function(){D(l,m,c,C-1)})}).catch(c);c(g)}}function Y(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function W(l){var m=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=k[c.name];b||(b=Y(),k[c.name]=b),b.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=O);var g=[];function I(){return f.resolve()}for(var x=0;x<b.forages.length;x++){var P=b.forages[x];P!==m&&g.push(P._initReady().catch(I))}var j=b.forages.slice(0);return f.all(g).then(function(){return c.db=b.db,K(c)}).then(function(B){return c.db=B,fe(c,m._defaultConfig.version)?me(c):B}).then(function(B){c.db=b.db=B,m._dbInfo=c;for(var Q=0;Q<j.length;Q++){var ue=j[Q];ue!==m&&(ue._dbInfo.db=c.db,ue._dbInfo.version=c.version)}})}function X(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.get(l);j.onsuccess=function(){var B=j.result;B===void 0&&(B=null),Ee(B)&&(B=pe(B)),b(B)},j.onerror=function(){g(j.error)}}catch(B){g(B)}})}).catch(g)});return S(C,m),C}function ie(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.openCursor(),B=1;j.onsuccess=function(){var Q=j.result;if(Q){var ue=Q.value;Ee(ue)&&(ue=pe(ue));var Se=l(ue,Q.key,B++);Se!==void 0?b(Se):Q.continue()}else b()},j.onerror=function(){g(j.error)}}catch(Q){g(Q)}})}).catch(g)});return S(C,m),C}function oe(l,m,c){var C=this;l=L(l);var b=new f(function(g,I){var x;C.ready().then(function(){return x=C._dbInfo,F.call(m)==="[object Blob]"?N(x.db).then(function(P){return P?m:ae(m)}):m}).then(function(P){D(C._dbInfo,M,function(j,B){if(j)return I(j);try{var Q=B.objectStore(C._dbInfo.storeName);P===null&&(P=void 0);var ue=Q.put(P,l);B.oncomplete=function(){P===void 0&&(P=null),g(P)},B.onabort=B.onerror=function(){var Se=ue.error?ue.error:ue.transaction.error;I(Se)}}catch(Se){I(Se)}})}).catch(I)});return S(b,c),b}function Le(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,M,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.delete(l);x.oncomplete=function(){b()},x.onerror=function(){g(j.error)},x.onabort=function(){var B=j.error?j.error:j.transaction.error;g(B)}}catch(B){g(B)}})}).catch(g)});return S(C,m),C}function xe(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,M,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.clear();I.oncomplete=function(){C()},I.onabort=I.onerror=function(){var j=P.error?P.error:P.transaction.error;b(j)}}catch(j){b(j)}})}).catch(b)});return S(c,l),c}function Ie(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,G,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.count();P.onsuccess=function(){C(P.result)},P.onerror=function(){b(P.error)}}catch(j){b(j)}})}).catch(b)});return S(c,l),c}function we(l,m){var c=this,C=new f(function(b,g){if(l<0){b(null);return}c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=!1,B=P.openKeyCursor();B.onsuccess=function(){var Q=B.result;if(!Q){b(null);return}l===0||j?b(Q.key):(j=!0,Q.advance(l))},B.onerror=function(){g(B.error)}}catch(Q){g(Q)}})}).catch(g)});return S(C,m),C}function Je(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,G,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.openKeyCursor(),j=[];P.onsuccess=function(){var B=P.result;if(!B){C(j);return}j.push(B.key),B.continue()},P.onerror=function(){b(P.error)}}catch(B){b(B)}})}).catch(b)});return S(c,l),c}function Ge(l,m){m=U.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var g=l.name===c.name&&C._dbInfo.db,I=g?f.resolve(C._dbInfo.db):K(l).then(function(x){var P=k[l.name],j=P.forages;P.db=x;for(var B=0;B<j.length;B++)j[B]._dbInfo.db=x;return x});l.storeName?b=I.then(function(x){if(x.objectStoreNames.contains(l.storeName)){var P=x.version+1;$(l);var j=k[l.name],B=j.forages;x.close();for(var Q=0;Q<B.length;Q++){var ue=B[Q];ue._dbInfo.db=null,ue._dbInfo.version=P}var Se=new f(function(_e,De){var Oe=d.open(l.name,P);Oe.onerror=function(Ye){var x1=Oe.result;x1.close(),De(Ye)},Oe.onupgradeneeded=function(){var Ye=Oe.result;Ye.deleteObjectStore(l.storeName)},Oe.onsuccess=function(){var Ye=Oe.result;Ye.close(),_e(Ye)}});return Se.then(function(_e){j.db=_e;for(var De=0;De<B.length;De++){var Oe=B[De];Oe._dbInfo.db=_e,q(Oe._dbInfo)}}).catch(function(_e){throw(Z(l,_e)||f.resolve()).catch(function(){}),_e})}}):b=I.then(function(x){$(l);var P=k[l.name],j=P.forages;x.close();for(var B=0;B<j.length;B++){var Q=j[B];Q._dbInfo.db=null}var ue=new f(function(Se,_e){var De=d.deleteDatabase(l.name);De.onerror=function(){var Oe=De.result;Oe&&Oe.close(),_e(De.error)},De.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},De.onsuccess=function(){var Oe=De.result;Oe&&Oe.close(),Se(Oe)}});return ue.then(function(Se){P.db=Se;for(var _e=0;_e<j.length;_e++){var De=j[_e];q(De._dbInfo)}}).catch(function(Se){throw(Z(l,Se)||f.resolve()).catch(function(){}),Se})})}return S(b,m),b}var Be={_driver:"asyncStorage",_initStorage:W,_support:h(),iterate:ie,getItem:X,setItem:oe,removeItem:Le,clear:xe,length:Ie,key:we,keys:Je,dropInstance:Ge};function ce(){return typeof openDatabase=="function"}var re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye="~~local_forage_type~",Ue=/^~~local_forage_type~([^~]+)~/,He="__lfsc__:",Me=He.length,he="arbf",ve="blob",Pe="si08",e1="ui08",d1="uic8",t1="si16",St="si32",oi="ur16",si="ui32",li="fl32",ci="fl64",ui=Me+he.length,fi=Object.prototype.toString;function di(l){var m=l.length*.75,c=l.length,C,b=0,g,I,x,P;l[l.length-1]==="="&&(m--,l[l.length-2]==="="&&m--);var j=new ArrayBuffer(m),B=new Uint8Array(j);for(C=0;C<c;C+=4)g=re.indexOf(l[C]),I=re.indexOf(l[C+1]),x=re.indexOf(l[C+2]),P=re.indexOf(l[C+3]),B[b++]=g<<2|I>>4,B[b++]=(I&15)<<4|x>>2,B[b++]=(x&3)<<6|P&63;return j}function fn(l){var m=new Uint8Array(l),c="",C;for(C=0;C<m.length;C+=3)c+=re[m[C]>>2],c+=re[(m[C]&3)<<4|m[C+1]>>4],c+=re[(m[C+1]&15)<<2|m[C+2]>>6],c+=re[m[C+2]&63];return m.length%3===2?c=c.substring(0,c.length-1)+"=":m.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function X4(l,m){var c="";if(l&&(c=fi.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&fi.call(l.buffer)==="[object ArrayBuffer]")){var C,b=He;l instanceof ArrayBuffer?(C=l,b+=he):(C=l.buffer,c==="[object Int8Array]"?b+=Pe:c==="[object Uint8Array]"?b+=e1:c==="[object Uint8ClampedArray]"?b+=d1:c==="[object Int16Array]"?b+=t1:c==="[object Uint16Array]"?b+=oi:c==="[object Int32Array]"?b+=St:c==="[object Uint32Array]"?b+=si:c==="[object Float32Array]"?b+=li:c==="[object Float64Array]"?b+=ci:m(new Error("Failed to get type for BinaryArray"))),m(b+fn(C))}else if(c==="[object Blob]"){var g=new FileReader;g.onload=function(){var I=ye+l.type+"~"+fn(this.result);m(He+ve+I)},g.readAsArrayBuffer(l)}else try{m(JSON.stringify(l))}catch(I){console.error("Couldn't convert value into a JSON string: ",l),m(null,I)}}function Q4(l){if(l.substring(0,Me)!==He)return JSON.parse(l);var m=l.substring(ui),c=l.substring(Me,ui),C;if(c===ve&&Ue.test(m)){var b=m.match(Ue);C=b[1],m=m.substring(b[0].length)}var g=di(m);switch(c){case he:return g;case ve:return p([g],{type:C});case Pe:return new Int8Array(g);case e1:return new Uint8Array(g);case d1:return new Uint8ClampedArray(g);case t1:return new Int16Array(g);case oi:return new Uint16Array(g);case St:return new Int32Array(g);case si:return new Uint32Array(g);case li:return new Float32Array(g);case ci:return new Float64Array(g);default:throw new Error("Unkown type: "+c)}}var dn={serialize:X4,deserialize:Q4,stringToBuffer:di,bufferToString:fn};function hi(l,m,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function J4(l){var m=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(g,I){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(x){return I(x)}c.db.transaction(function(x){hi(x,c,function(){m._dbInfo=c,g()},function(P,j){I(j)})},I)});return c.serializer=dn,b}function o1(l,m,c,C,b,g){l.executeSql(c,C,b,function(I,x){x.code===x.SYNTAX_ERR?I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(P,j){j.rows.length?g(P,x):hi(P,m,function(){P.executeSql(c,C,b,g)},g)},g):g(I,x)},g)}function K4(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT * FROM "+I.storeName+" WHERE key = ? LIMIT 1",[l],function(P,j){var B=j.rows.length?j.rows.item(0).value:null;B&&(B=I.serializer.deserialize(B)),b(B)},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function e5(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT * FROM "+I.storeName,[],function(P,j){for(var B=j.rows,Q=B.length,ue=0;ue<Q;ue++){var Se=B.item(ue),_e=Se.value;if(_e&&(_e=I.serializer.deserialize(_e)),_e=l(_e,Se.key,ue+1),_e!==void 0){b(_e);return}}b()},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function mi(l,m,c,C){var b=this;l=L(l);var g=new f(function(I,x){b.ready().then(function(){m===void 0&&(m=null);var P=m,j=b._dbInfo;j.serializer.serialize(m,function(B,Q){Q?x(Q):j.db.transaction(function(ue){o1(ue,j,"INSERT OR REPLACE INTO "+j.storeName+" (key, value) VALUES (?, ?)",[l,B],function(){I(P)},function(Se,_e){x(_e)})},function(ue){if(ue.code===ue.QUOTA_ERR){if(C>0){I(mi.apply(b,[l,P,c,C-1]));return}x(ue)}})})}).catch(x)});return S(g,c),g}function t5(l,m,c){return mi.apply(this,[l,m,c,1])}function n5(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"DELETE FROM "+I.storeName+" WHERE key = ?",[l],function(){b()},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function r5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"DELETE FROM "+g.storeName,[],function(){C()},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function i5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(x,P){var j=P.rows.item(0).c;C(j)},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function a5(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT key FROM "+I.storeName+" WHERE id = ? LIMIT 1",[l+1],function(P,j){var B=j.rows.length?j.rows.item(0).key:null;b(B)},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function o5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"SELECT key FROM "+g.storeName,[],function(x,P){for(var j=[],B=0;B<P.rows.length;B++)j.push(P.rows.item(B).key);C(j)},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function s5(l){return new f(function(m,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,g){for(var I=[],x=0;x<g.rows.length;x++)I.push(g.rows.item(x).name);m({db:l,storeNames:I})},function(b,g){c(g)})},function(C){c(C)})})}function l5(l,m){m=U.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(g){var I;l.name===c.name?I=C._dbInfo.db:I=openDatabase(l.name,"","",0),l.storeName?g({db:I,storeNames:[l.storeName]}):g(s5(I))}).then(function(g){return new f(function(I,x){g.db.transaction(function(P){function j(Se){return new f(function(_e,De){P.executeSql("DROP TABLE IF EXISTS "+Se,[],function(){_e()},function(Oe,Ye){De(Ye)})})}for(var B=[],Q=0,ue=g.storeNames.length;Q<ue;Q++)B.push(j(g.storeNames[Q]));f.all(B).then(function(){I()}).catch(function(Se){x(Se)})},function(P){x(P)})})}):b=f.reject("Invalid arguments"),S(b,m),b}var c5={_driver:"webSQLStorage",_initStorage:J4,_support:ce(),iterate:e5,getItem:K4,setItem:t5,removeItem:n5,clear:r5,length:i5,key:a5,keys:o5,dropInstance:l5};function u5(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function pi(l,m){var c=l.name+"/";return l.storeName!==m.storeName&&(c+=l.storeName+"/"),c}function f5(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function d5(){return!f5()||localStorage.length>0}function h5(l){var m=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=pi(l,m._defaultConfig),d5()?(m._dbInfo=c,c.serializer=dn,f.resolve()):f.reject()}function m5(l){var m=this,c=m.ready().then(function(){for(var C=m._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var g=localStorage.key(b);g.indexOf(C)===0&&localStorage.removeItem(g)}});return S(c,l),c}function p5(l,m){var c=this;l=L(l);var C=c.ready().then(function(){var b=c._dbInfo,g=localStorage.getItem(b.keyPrefix+l);return g&&(g=b.serializer.deserialize(g)),g});return S(C,m),C}function g5(l,m){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,g=b.keyPrefix,I=g.length,x=localStorage.length,P=1,j=0;j<x;j++){var B=localStorage.key(j);if(B.indexOf(g)===0){var Q=localStorage.getItem(B);if(Q&&(Q=b.serializer.deserialize(Q)),Q=l(Q,B.substring(I),P++),Q!==void 0)return Q}}});return S(C,m),C}function v5(l,m){var c=this,C=c.ready().then(function(){var b=c._dbInfo,g;try{g=localStorage.key(l)}catch{g=null}return g&&(g=g.substring(b.keyPrefix.length)),g});return S(C,m),C}function C5(l){var m=this,c=m.ready().then(function(){for(var C=m._dbInfo,b=localStorage.length,g=[],I=0;I<b;I++){var x=localStorage.key(I);x.indexOf(C.keyPrefix)===0&&g.push(x.substring(C.keyPrefix.length))}return g});return S(c,l),c}function S5(l){var m=this,c=m.keys().then(function(C){return C.length});return S(c,l),c}function b5(l,m){var c=this;l=L(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,m),C}function y5(l,m,c){var C=this;l=L(l);var b=C.ready().then(function(){m===void 0&&(m=null);var g=m;return new f(function(I,x){var P=C._dbInfo;P.serializer.serialize(m,function(j,B){if(B)x(B);else try{localStorage.setItem(P.keyPrefix+l,j),I(g)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&x(Q),x(Q)}})})});return S(b,c),b}function _5(l,m){if(m=U.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(g){l.storeName?g(pi(l,C._defaultConfig)):g(l.name+"/")}).then(function(g){for(var I=localStorage.length-1;I>=0;I--){var x=localStorage.key(I);x.indexOf(g)===0&&localStorage.removeItem(x)}}):b=f.reject("Invalid arguments"),S(b,m),b}var L5={_driver:"localStorageWrapper",_initStorage:h5,_support:u5(),iterate:g5,getItem:p5,setItem:y5,removeItem:b5,clear:m5,length:S5,key:v5,keys:C5,dropInstance:_5},E5=function(m,c){return m===c||typeof m=="number"&&typeof c=="number"&&isNaN(m)&&isNaN(c)},w5=function(m,c){for(var C=m.length,b=0;b<C;){if(E5(m[b],c))return!0;b++}return!1},gi=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},T1={},vi={},b1={INDEXEDDB:Be,WEBSQL:c5,LOCALSTORAGE:L5},M5=[b1.INDEXEDDB._driver,b1.WEBSQL._driver,b1.LOCALSTORAGE._driver],bt=["dropInstance"],hn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(bt),O5={description:"",driver:M5.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function I5(l,m){l[m]=function(){var c=arguments;return l.ready().then(function(){return l[m].apply(l,c)})}}function mn(){for(var l=1;l<arguments.length;l++){var m=arguments[l];if(m)for(var c in m)m.hasOwnProperty(c)&&(gi(m[c])?arguments[0][c]=m[c].slice():arguments[0][c]=m[c])}return arguments[0]}var H5=function(){function l(m){o(this,l);for(var c in b1)if(b1.hasOwnProperty(c)){var C=b1[c],b=C._driver;this[c]=b,T1[b]||this.defineDriver(C)}this._defaultConfig=mn({},O5),this._config=mn({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var g=new f(function(I,x){try{var P=c._driver,j=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){x(j);return}for(var B=hn.concat("_initStorage"),Q=0,ue=B.length;Q<ue;Q++){var Se=B[Q],_e=!w5(bt,Se);if((_e||c[Se])&&typeof c[Se]!="function"){x(j);return}}var De=function(){for(var x1=function(x5){return function(){var V5=new Error("Method "+x5+" is not implemented by the current driver"),Ci=f.reject(V5);return S(Ci,arguments[arguments.length-1]),Ci}},pn=0,T5=bt.length;pn<T5;pn++){var gn=bt[pn];c[gn]||(c[gn]=x1(gn))}};De();var Oe=function(x1){T1[P]&&console.info("Redefining LocalForage driver: "+P),T1[P]=c,vi[P]=x1,I()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Oe,x):Oe(!!c._support):Oe(!0)}catch(Ye){x(Ye)}});return _(g,C,b),g},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var g=T1[c]?f.resolve(T1[c]):f.reject(new Error("Driver not found."));return _(g,C,b),g},l.prototype.getSerializer=function(c){var C=f.resolve(dn);return _(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return _(b,c,c),b},l.prototype.setDriver=function(c,C,b){var g=this;gi(c)||(c=[c]);var I=this._getSupportedDrivers(c);function x(){g._config.driver=g.driver()}function P(Q){return g._extend(Q),x(),g._ready=g._initStorage(g._config),g._ready}function j(Q){return function(){var ue=0;function Se(){for(;ue<Q.length;){var _e=Q[ue];return ue++,g._dbInfo=null,g._ready=null,g.getDriver(_e).then(P).catch(Se)}x();var De=new Error("No available storage method found.");return g._driverSet=f.reject(De),g._driverSet}return Se()}}var B=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=B.then(function(){var Q=I[0];return g._dbInfo=null,g._ready=null,g.getDriver(Q).then(function(ue){g._driver=ue._driver,x(),g._wrapLibraryMethodsWithReady(),g._initDriver=j(I)})}).catch(function(){x();var Q=new Error("No available storage method found.");return g._driverSet=f.reject(Q),g._driverSet}),_(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!vi[c]},l.prototype._extend=function(c){mn(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,g=c.length;b<g;b++){var I=c[b];this.supports(I)&&C.push(I)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=hn.length;c<C;c++)I5(this,hn[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),D5=new H5;r.exports=D5},{3:3}]},{},[4])(4)})})(Y6);var M4=Y6.exports;const f1=vr(M4);class q6{getItem(t){return f1.getItem(t)}setItem(t,n){return f1.setItem(t,n)}removeItem(t){return f1.removeItem(t)}clear(){return f1.clear()}key(t){return f1.key(t)}keys(){return f1.keys()}iterate(t){return f1.iterate(t)}}var O4=Object.defineProperty,I4=Object.getOwnPropertyDescriptor,H4=(e,t,n,r)=>{for(var i=r>1?void 0:r?I4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O4(t,n,i),i},D4=(e,t)=>(n,r)=>t(n,r,e);let nn=class{constructor(e){z(this,"visible$",new ee.Subject);z(this,"componentKey$",new ee.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),y.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};nn=H4([D4(0,se.Inject(Ke))],nn);class T4 extends y.Disposable{constructor(){super(...arguments);z(this,"_currentSelectorId");z(this,"_selectionChange$",new ee.Subject);z(this,"selectionChange$",this._selectionChange$.asObservable());z(this,"_openSelector$",new ee.Subject);z(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const rn=se.createIdentifier("univer.range-selector.service");class x4 extends y.Disposable{constructor(){super(...arguments);z(this,"_taskCount",0);z(this,"_progressChange$",new ee.Subject);z(this,"_progressVisible$",new ee.Subject);z(this,"progressChange$",this._progressChange$.asObservable());z(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const an=se.createIdentifier("univer.progress.service");var V4=Object.defineProperty,N4=Object.getOwnPropertyDescriptor,k4=(e,t,n,r)=>{for(var i=r>1?void 0:r?N4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&V4(t,n,i),i},on=(e,t)=>(n,r)=>t(n,r,e);const A4="ui",X6="DISABLE_AUTO_FOCUS";E.UniverUIPlugin=(un=class extends y.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:A6}),this._config.disableAutoFocus&&this._contextService.setContextValue(X6,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){[[Ke],[N1],[W6],[L1,{useClass:E.DesktopLayoutService}],[m1,{useClass:E.DesktopShortcutService}],[Lt,{useClass:Er}],[s1,{useClass:E.DesktopMenuService}],[Yt,{useClass:T6}],[U6,{useClass:E.BrowserClipboardService,lazy:!0}],[dt,{useClass:z6,lazy:!0}],[qt,{useClass:$6,lazy:!0}],[Gt,{useClass:j6,lazy:!0}],[Y1,{useClass:F6,lazy:!0}],[Dt,{useClass:nn,lazy:!0}],[Xt,{useClass:E.DesktopGlobalZoneService,lazy:!0}],[G1,{useClass:B6,lazy:!0}],[y.ILocalStorageService,{useClass:q6,lazy:!0}],[R6,{useClass:E.DesktopBeforeCloseService}],[_1,{useClass:E.EditorService}],[rn,{useClass:T4}],[Qt,{useClass:V6}],[an,{useClass:x4}],[B1,{useClass:E.DesktopUIController}],[E.SharedController],[ht],[mt]].forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(B1).bootstrapWorkbench(this._config))}},z(un,"pluginName",A4),un),E.UniverUIPlugin=k4([on(1,y.IContextService),on(2,se.Inject(se.Injector)),on(3,se.Inject(y.LocaleService))],E.UniverUIPlugin);function gt(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const R4=.75,Q6=78,J6=9,K6="rgba(0,0,0,0)",ei="rgb(0,0,0)";function sn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
46
+ */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,p){if(!i[h]){if(!r[h]){var f=typeof pt=="function"&&pt;if(!p&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var _=i[h]={exports:{}};r[h][0].call(_.exports,function(L){var U=r[h][1][L];return o(U||L)},_,_.exports,n,r,i,a)}return i[h].exports}for(var u=typeof pt=="function"&&pt,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(L),p=a.document.createTextNode("");h.observe(p,{characterData:!0}),u=function(){p.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=L,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var H=a.document.createElement("script");H.onreadystatechange=function(){L(),H.onreadystatechange=null,H.parentNode.removeChild(H),H=null},a.document.documentElement.appendChild(H)}:u=function(){setTimeout(L,0)};var S,_=[];function L(){S=!0;for(var H,A,k=_.length;k;){for(A=_,_=[],H=-1;++H<k;)A[H]();k=_.length}S=!1}r.exports=U;function U(H){_.push(H)===1&&!S&&u()}}).call(this,typeof k1<"u"?k1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],p=["PENDING"];r.exports=f;function f(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=p,this.queue=[],this.outcome=void 0,M!==o&&U(this,M)}f.prototype.catch=function(M){return this.then(null,M)},f.prototype.then=function(M,V){if(typeof M!="function"&&this.state===h||typeof V!="function"&&this.state===d)return this;var R=new this.constructor(o);if(this.state!==p){var N=this.state===h?M:V;_(R,N,this.outcome)}else this.queue.push(new S(R,M,V));return R};function S(M,V,R){this.promise=M,typeof V=="function"&&(this.onFulfilled=V,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(M){u.resolve(this.promise,M)},S.prototype.otherCallFulfilled=function(M){_(this.promise,this.onFulfilled,M)},S.prototype.callRejected=function(M){u.reject(this.promise,M)},S.prototype.otherCallRejected=function(M){_(this.promise,this.onRejected,M)};function _(M,V,R){a(function(){var N;try{N=V(R)}catch($){return u.reject(M,$)}N===M?u.reject(M,new TypeError("Cannot resolve promise with itself")):u.resolve(M,N)})}u.resolve=function(M,V){var R=H(L,V);if(R.status==="error")return u.reject(M,R.value);var N=R.value;if(N)U(M,N);else{M.state=h,M.outcome=V;for(var $=-1,q=M.queue.length;++$<q;)M.queue[$].callFulfilled(V)}return M},u.reject=function(M,V){M.state=d,M.outcome=V;for(var R=-1,N=M.queue.length;++R<N;)M.queue[R].callRejected(V);return M};function L(M){var V=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof V=="function")return function(){V.apply(M,arguments)}}function U(M,V){var R=!1;function N(J){R||(R=!0,u.reject(M,J))}function $(J){R||(R=!0,u.resolve(M,J))}function q(){V($,N)}var Z=H(q);Z.status==="error"&&N(Z.value)}function H(M,V){var R={};try{R.value=M(V),R.status="success"}catch(N){R.status="error",R.value=N}return R}f.resolve=A;function A(M){return M instanceof this?M:u.resolve(new this(o),M)}f.reject=k;function k(M){var V=new this(o);return u.reject(V,M)}f.all=F;function F(M){var V=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=M.length,N=!1;if(!R)return this.resolve([]);for(var $=new Array(R),q=0,Z=-1,J=new this(o);++Z<R;)K(M[Z],Z);return J;function K(me,fe){V.resolve(me).then(ae,function(pe){N||(N=!0,u.reject(J,pe))});function ae(pe){$[fe]=pe,++q===R&&!N&&(N=!0,u.resolve(J,$))}}}f.race=G;function G(M){var V=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=M.length,N=!1;if(!R)return this.resolve([]);for(var $=-1,q=new this(o);++$<R;)Z(M[$]);return q;function Z(J){V.resolve(J).then(function(K){N||(N=!0,u.resolve(q,K))},function(K){N||(N=!0,u.reject(q,K))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof k1<"u"?k1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,m){if(!(l instanceof m))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),m=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||m)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function p(l,m){l=l||[],m=m||{};try{return new Blob(l,m)}catch(g){if(g.name!=="TypeError")throw g;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(m.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,m){m&&l.then(function(c){m(null,c)},function(c){m(c)})}function _(l,m,c){typeof m=="function"&&l.then(m),typeof c=="function"&&l.catch(c)}function L(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function U(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var H="local-forage-detect-blob-support",A=void 0,k={},F=Object.prototype.toString,G="readonly",M="readwrite";function V(l){for(var m=l.length,c=new ArrayBuffer(m),C=new Uint8Array(c),b=0;b<m;b++)C[b]=l.charCodeAt(b);return c}function R(l){return new f(function(m){var c=l.transaction(H,M),C=p([""]);c.objectStore(H).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),m(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);m(g||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function N(l){return typeof A=="boolean"?f.resolve(A):R(l).then(function(m){return A=m,A})}function $(l){var m=k[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),m.deferredOperations.push(c),m.dbReady?m.dbReady=m.dbReady.then(function(){return c.promise}):m.dbReady=c.promise}function q(l){var m=k[l.name],c=m.deferredOperations.pop();if(c)return c.resolve(),c.promise}function Z(l,m){var c=k[l.name],C=c.deferredOperations.pop();if(C)return C.reject(m),C.promise}function J(l,m){return new f(function(c,C){if(k[l.name]=k[l.name]||Y(),l.db)if(m)$(l),l.db.close();else return c(l.db);var b=[l.name];m&&b.push(l.version);var g=d.open.apply(d,b);m&&(g.onupgradeneeded=function(I){var x=g.result;try{x.createObjectStore(l.storeName),I.oldVersion<=1&&x.createObjectStore(H)}catch(P){if(P.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+I.oldVersion+" to version "+I.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw P}}),g.onerror=function(I){I.preventDefault(),C(g.error)},g.onsuccess=function(){var I=g.result;I.onversionchange=function(x){x.target.close()},c(I),q(l)}})}function K(l){return J(l,!1)}function me(l){return J(l,!0)}function fe(l,m){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==m&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var g=l.db.version+1;g>l.version&&(l.version=g)}return!0}return!1}function ae(l){return new f(function(m,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var g=btoa(b.target.result||"");m({__local_forage_encoded_blob:!0,data:g,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var m=V(atob(l.data));return p([m],{type:l.type})}function Ee(l){return l&&l.__local_forage_encoded_blob}function O(l){var m=this,c=m._initReady().then(function(){var C=k[m._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return _(c,l,l),c}function w(l){$(l);for(var m=k[l.name],c=m.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,K(l).then(function(g){return l.db=g,fe(l)?me(l):g}).then(function(g){l.db=m.db=g;for(var I=0;I<c.length;I++)c[I]._dbInfo.db=g}).catch(function(g){throw Z(l,g),g})}function D(l,m,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,m);c(null,b)}catch(g){if(C>0&&(!l.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||g.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),me(l)}).then(function(){return w(l).then(function(){D(l,m,c,C-1)})}).catch(c);c(g)}}function Y(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function W(l){var m=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=k[c.name];b||(b=Y(),k[c.name]=b),b.forages.push(m),m._initReady||(m._initReady=m.ready,m.ready=O);var g=[];function I(){return f.resolve()}for(var x=0;x<b.forages.length;x++){var P=b.forages[x];P!==m&&g.push(P._initReady().catch(I))}var j=b.forages.slice(0);return f.all(g).then(function(){return c.db=b.db,K(c)}).then(function(B){return c.db=B,fe(c,m._defaultConfig.version)?me(c):B}).then(function(B){c.db=b.db=B,m._dbInfo=c;for(var Q=0;Q<j.length;Q++){var ue=j[Q];ue!==m&&(ue._dbInfo.db=c.db,ue._dbInfo.version=c.version)}})}function X(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.get(l);j.onsuccess=function(){var B=j.result;B===void 0&&(B=null),Ee(B)&&(B=pe(B)),b(B)},j.onerror=function(){g(j.error)}}catch(B){g(B)}})}).catch(g)});return S(C,m),C}function ie(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.openCursor(),B=1;j.onsuccess=function(){var Q=j.result;if(Q){var ue=Q.value;Ee(ue)&&(ue=pe(ue));var Se=l(ue,Q.key,B++);Se!==void 0?b(Se):Q.continue()}else b()},j.onerror=function(){g(j.error)}}catch(Q){g(Q)}})}).catch(g)});return S(C,m),C}function oe(l,m,c){var C=this;l=L(l);var b=new f(function(g,I){var x;C.ready().then(function(){return x=C._dbInfo,F.call(m)==="[object Blob]"?N(x.db).then(function(P){return P?m:ae(m)}):m}).then(function(P){D(C._dbInfo,M,function(j,B){if(j)return I(j);try{var Q=B.objectStore(C._dbInfo.storeName);P===null&&(P=void 0);var ue=Q.put(P,l);B.oncomplete=function(){P===void 0&&(P=null),g(P)},B.onabort=B.onerror=function(){var Se=ue.error?ue.error:ue.transaction.error;I(Se)}}catch(Se){I(Se)}})}).catch(I)});return S(b,c),b}function Le(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){D(c._dbInfo,M,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=P.delete(l);x.oncomplete=function(){b()},x.onerror=function(){g(j.error)},x.onabort=function(){var B=j.error?j.error:j.transaction.error;g(B)}}catch(B){g(B)}})}).catch(g)});return S(C,m),C}function xe(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,M,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.clear();I.oncomplete=function(){C()},I.onabort=I.onerror=function(){var j=P.error?P.error:P.transaction.error;b(j)}}catch(j){b(j)}})}).catch(b)});return S(c,l),c}function Ie(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,G,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.count();P.onsuccess=function(){C(P.result)},P.onerror=function(){b(P.error)}}catch(j){b(j)}})}).catch(b)});return S(c,l),c}function we(l,m){var c=this,C=new f(function(b,g){if(l<0){b(null);return}c.ready().then(function(){D(c._dbInfo,G,function(I,x){if(I)return g(I);try{var P=x.objectStore(c._dbInfo.storeName),j=!1,B=P.openKeyCursor();B.onsuccess=function(){var Q=B.result;if(!Q){b(null);return}l===0||j?b(Q.key):(j=!0,Q.advance(l))},B.onerror=function(){g(B.error)}}catch(Q){g(Q)}})}).catch(g)});return S(C,m),C}function Je(l){var m=this,c=new f(function(C,b){m.ready().then(function(){D(m._dbInfo,G,function(g,I){if(g)return b(g);try{var x=I.objectStore(m._dbInfo.storeName),P=x.openKeyCursor(),j=[];P.onsuccess=function(){var B=P.result;if(!B){C(j);return}j.push(B.key),B.continue()},P.onerror=function(){b(P.error)}}catch(B){b(B)}})}).catch(b)});return S(c,l),c}function Ge(l,m){m=U.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var g=l.name===c.name&&C._dbInfo.db,I=g?f.resolve(C._dbInfo.db):K(l).then(function(x){var P=k[l.name],j=P.forages;P.db=x;for(var B=0;B<j.length;B++)j[B]._dbInfo.db=x;return x});l.storeName?b=I.then(function(x){if(x.objectStoreNames.contains(l.storeName)){var P=x.version+1;$(l);var j=k[l.name],B=j.forages;x.close();for(var Q=0;Q<B.length;Q++){var ue=B[Q];ue._dbInfo.db=null,ue._dbInfo.version=P}var Se=new f(function(_e,De){var Oe=d.open(l.name,P);Oe.onerror=function(Ye){var x1=Oe.result;x1.close(),De(Ye)},Oe.onupgradeneeded=function(){var Ye=Oe.result;Ye.deleteObjectStore(l.storeName)},Oe.onsuccess=function(){var Ye=Oe.result;Ye.close(),_e(Ye)}});return Se.then(function(_e){j.db=_e;for(var De=0;De<B.length;De++){var Oe=B[De];Oe._dbInfo.db=_e,q(Oe._dbInfo)}}).catch(function(_e){throw(Z(l,_e)||f.resolve()).catch(function(){}),_e})}}):b=I.then(function(x){$(l);var P=k[l.name],j=P.forages;x.close();for(var B=0;B<j.length;B++){var Q=j[B];Q._dbInfo.db=null}var ue=new f(function(Se,_e){var De=d.deleteDatabase(l.name);De.onerror=function(){var Oe=De.result;Oe&&Oe.close(),_e(De.error)},De.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},De.onsuccess=function(){var Oe=De.result;Oe&&Oe.close(),Se(Oe)}});return ue.then(function(Se){P.db=Se;for(var _e=0;_e<j.length;_e++){var De=j[_e];q(De._dbInfo)}}).catch(function(Se){throw(Z(l,Se)||f.resolve()).catch(function(){}),Se})})}return S(b,m),b}var Be={_driver:"asyncStorage",_initStorage:W,_support:h(),iterate:ie,getItem:X,setItem:oe,removeItem:Le,clear:xe,length:Ie,key:we,keys:Je,dropInstance:Ge};function ce(){return typeof openDatabase=="function"}var re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye="~~local_forage_type~",Ue=/^~~local_forage_type~([^~]+)~/,He="__lfsc__:",Me=He.length,he="arbf",ve="blob",Pe="si08",e1="ui08",d1="uic8",t1="si16",St="si32",oi="ur16",si="ui32",li="fl32",ci="fl64",ui=Me+he.length,fi=Object.prototype.toString;function di(l){var m=l.length*.75,c=l.length,C,b=0,g,I,x,P;l[l.length-1]==="="&&(m--,l[l.length-2]==="="&&m--);var j=new ArrayBuffer(m),B=new Uint8Array(j);for(C=0;C<c;C+=4)g=re.indexOf(l[C]),I=re.indexOf(l[C+1]),x=re.indexOf(l[C+2]),P=re.indexOf(l[C+3]),B[b++]=g<<2|I>>4,B[b++]=(I&15)<<4|x>>2,B[b++]=(x&3)<<6|P&63;return j}function fn(l){var m=new Uint8Array(l),c="",C;for(C=0;C<m.length;C+=3)c+=re[m[C]>>2],c+=re[(m[C]&3)<<4|m[C+1]>>4],c+=re[(m[C+1]&15)<<2|m[C+2]>>6],c+=re[m[C+2]&63];return m.length%3===2?c=c.substring(0,c.length-1)+"=":m.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function X4(l,m){var c="";if(l&&(c=fi.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&fi.call(l.buffer)==="[object ArrayBuffer]")){var C,b=He;l instanceof ArrayBuffer?(C=l,b+=he):(C=l.buffer,c==="[object Int8Array]"?b+=Pe:c==="[object Uint8Array]"?b+=e1:c==="[object Uint8ClampedArray]"?b+=d1:c==="[object Int16Array]"?b+=t1:c==="[object Uint16Array]"?b+=oi:c==="[object Int32Array]"?b+=St:c==="[object Uint32Array]"?b+=si:c==="[object Float32Array]"?b+=li:c==="[object Float64Array]"?b+=ci:m(new Error("Failed to get type for BinaryArray"))),m(b+fn(C))}else if(c==="[object Blob]"){var g=new FileReader;g.onload=function(){var I=ye+l.type+"~"+fn(this.result);m(He+ve+I)},g.readAsArrayBuffer(l)}else try{m(JSON.stringify(l))}catch(I){console.error("Couldn't convert value into a JSON string: ",l),m(null,I)}}function Q4(l){if(l.substring(0,Me)!==He)return JSON.parse(l);var m=l.substring(ui),c=l.substring(Me,ui),C;if(c===ve&&Ue.test(m)){var b=m.match(Ue);C=b[1],m=m.substring(b[0].length)}var g=di(m);switch(c){case he:return g;case ve:return p([g],{type:C});case Pe:return new Int8Array(g);case e1:return new Uint8Array(g);case d1:return new Uint8ClampedArray(g);case t1:return new Int16Array(g);case oi:return new Uint16Array(g);case St:return new Int32Array(g);case si:return new Uint32Array(g);case li:return new Float32Array(g);case ci:return new Float64Array(g);default:throw new Error("Unkown type: "+c)}}var dn={serialize:X4,deserialize:Q4,stringToBuffer:di,bufferToString:fn};function hi(l,m,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+m.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function J4(l){var m=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(g,I){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(x){return I(x)}c.db.transaction(function(x){hi(x,c,function(){m._dbInfo=c,g()},function(P,j){I(j)})},I)});return c.serializer=dn,b}function o1(l,m,c,C,b,g){l.executeSql(c,C,b,function(I,x){x.code===x.SYNTAX_ERR?I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[m.storeName],function(P,j){j.rows.length?g(P,x):hi(P,m,function(){P.executeSql(c,C,b,g)},g)},g):g(I,x)},g)}function K4(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT * FROM "+I.storeName+" WHERE key = ? LIMIT 1",[l],function(P,j){var B=j.rows.length?j.rows.item(0).value:null;B&&(B=I.serializer.deserialize(B)),b(B)},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function e5(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT * FROM "+I.storeName,[],function(P,j){for(var B=j.rows,Q=B.length,ue=0;ue<Q;ue++){var Se=B.item(ue),_e=Se.value;if(_e&&(_e=I.serializer.deserialize(_e)),_e=l(_e,Se.key,ue+1),_e!==void 0){b(_e);return}}b()},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function mi(l,m,c,C){var b=this;l=L(l);var g=new f(function(I,x){b.ready().then(function(){m===void 0&&(m=null);var P=m,j=b._dbInfo;j.serializer.serialize(m,function(B,Q){Q?x(Q):j.db.transaction(function(ue){o1(ue,j,"INSERT OR REPLACE INTO "+j.storeName+" (key, value) VALUES (?, ?)",[l,B],function(){I(P)},function(Se,_e){x(_e)})},function(ue){if(ue.code===ue.QUOTA_ERR){if(C>0){I(mi.apply(b,[l,P,c,C-1]));return}x(ue)}})})}).catch(x)});return S(g,c),g}function t5(l,m,c){return mi.apply(this,[l,m,c,1])}function n5(l,m){var c=this;l=L(l);var C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"DELETE FROM "+I.storeName+" WHERE key = ?",[l],function(){b()},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function r5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"DELETE FROM "+g.storeName,[],function(){C()},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function i5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(x,P){var j=P.rows.item(0).c;C(j)},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function a5(l,m){var c=this,C=new f(function(b,g){c.ready().then(function(){var I=c._dbInfo;I.db.transaction(function(x){o1(x,I,"SELECT key FROM "+I.storeName+" WHERE id = ? LIMIT 1",[l+1],function(P,j){var B=j.rows.length?j.rows.item(0).key:null;b(B)},function(P,j){g(j)})})}).catch(g)});return S(C,m),C}function o5(l){var m=this,c=new f(function(C,b){m.ready().then(function(){var g=m._dbInfo;g.db.transaction(function(I){o1(I,g,"SELECT key FROM "+g.storeName,[],function(x,P){for(var j=[],B=0;B<P.rows.length;B++)j.push(P.rows.item(B).key);C(j)},function(x,P){b(P)})})}).catch(b)});return S(c,l),c}function s5(l){return new f(function(m,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,g){for(var I=[],x=0;x<g.rows.length;x++)I.push(g.rows.item(x).name);m({db:l,storeNames:I})},function(b,g){c(g)})},function(C){c(C)})})}function l5(l,m){m=U.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(g){var I;l.name===c.name?I=C._dbInfo.db:I=openDatabase(l.name,"","",0),l.storeName?g({db:I,storeNames:[l.storeName]}):g(s5(I))}).then(function(g){return new f(function(I,x){g.db.transaction(function(P){function j(Se){return new f(function(_e,De){P.executeSql("DROP TABLE IF EXISTS "+Se,[],function(){_e()},function(Oe,Ye){De(Ye)})})}for(var B=[],Q=0,ue=g.storeNames.length;Q<ue;Q++)B.push(j(g.storeNames[Q]));f.all(B).then(function(){I()}).catch(function(Se){x(Se)})},function(P){x(P)})})}):b=f.reject("Invalid arguments"),S(b,m),b}var c5={_driver:"webSQLStorage",_initStorage:J4,_support:ce(),iterate:e5,getItem:K4,setItem:t5,removeItem:n5,clear:r5,length:i5,key:a5,keys:o5,dropInstance:l5};function u5(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function pi(l,m){var c=l.name+"/";return l.storeName!==m.storeName&&(c+=l.storeName+"/"),c}function f5(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function d5(){return!f5()||localStorage.length>0}function h5(l){var m=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=pi(l,m._defaultConfig),d5()?(m._dbInfo=c,c.serializer=dn,f.resolve()):f.reject()}function m5(l){var m=this,c=m.ready().then(function(){for(var C=m._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var g=localStorage.key(b);g.indexOf(C)===0&&localStorage.removeItem(g)}});return S(c,l),c}function p5(l,m){var c=this;l=L(l);var C=c.ready().then(function(){var b=c._dbInfo,g=localStorage.getItem(b.keyPrefix+l);return g&&(g=b.serializer.deserialize(g)),g});return S(C,m),C}function g5(l,m){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,g=b.keyPrefix,I=g.length,x=localStorage.length,P=1,j=0;j<x;j++){var B=localStorage.key(j);if(B.indexOf(g)===0){var Q=localStorage.getItem(B);if(Q&&(Q=b.serializer.deserialize(Q)),Q=l(Q,B.substring(I),P++),Q!==void 0)return Q}}});return S(C,m),C}function v5(l,m){var c=this,C=c.ready().then(function(){var b=c._dbInfo,g;try{g=localStorage.key(l)}catch{g=null}return g&&(g=g.substring(b.keyPrefix.length)),g});return S(C,m),C}function C5(l){var m=this,c=m.ready().then(function(){for(var C=m._dbInfo,b=localStorage.length,g=[],I=0;I<b;I++){var x=localStorage.key(I);x.indexOf(C.keyPrefix)===0&&g.push(x.substring(C.keyPrefix.length))}return g});return S(c,l),c}function S5(l){var m=this,c=m.keys().then(function(C){return C.length});return S(c,l),c}function b5(l,m){var c=this;l=L(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,m),C}function y5(l,m,c){var C=this;l=L(l);var b=C.ready().then(function(){m===void 0&&(m=null);var g=m;return new f(function(I,x){var P=C._dbInfo;P.serializer.serialize(m,function(j,B){if(B)x(B);else try{localStorage.setItem(P.keyPrefix+l,j),I(g)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&x(Q),x(Q)}})})});return S(b,c),b}function _5(l,m){if(m=U.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(g){l.storeName?g(pi(l,C._defaultConfig)):g(l.name+"/")}).then(function(g){for(var I=localStorage.length-1;I>=0;I--){var x=localStorage.key(I);x.indexOf(g)===0&&localStorage.removeItem(x)}}):b=f.reject("Invalid arguments"),S(b,m),b}var L5={_driver:"localStorageWrapper",_initStorage:h5,_support:u5(),iterate:g5,getItem:p5,setItem:y5,removeItem:b5,clear:m5,length:S5,key:v5,keys:C5,dropInstance:_5},E5=function(m,c){return m===c||typeof m=="number"&&typeof c=="number"&&isNaN(m)&&isNaN(c)},w5=function(m,c){for(var C=m.length,b=0;b<C;){if(E5(m[b],c))return!0;b++}return!1},gi=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},T1={},vi={},b1={INDEXEDDB:Be,WEBSQL:c5,LOCALSTORAGE:L5},M5=[b1.INDEXEDDB._driver,b1.WEBSQL._driver,b1.LOCALSTORAGE._driver],bt=["dropInstance"],hn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(bt),O5={description:"",driver:M5.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function I5(l,m){l[m]=function(){var c=arguments;return l.ready().then(function(){return l[m].apply(l,c)})}}function mn(){for(var l=1;l<arguments.length;l++){var m=arguments[l];if(m)for(var c in m)m.hasOwnProperty(c)&&(gi(m[c])?arguments[0][c]=m[c].slice():arguments[0][c]=m[c])}return arguments[0]}var H5=function(){function l(m){o(this,l);for(var c in b1)if(b1.hasOwnProperty(c)){var C=b1[c],b=C._driver;this[c]=b,T1[b]||this.defineDriver(C)}this._defaultConfig=mn({},O5),this._config=mn({},this._defaultConfig,m),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var g=new f(function(I,x){try{var P=c._driver,j=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){x(j);return}for(var B=hn.concat("_initStorage"),Q=0,ue=B.length;Q<ue;Q++){var Se=B[Q],_e=!w5(bt,Se);if((_e||c[Se])&&typeof c[Se]!="function"){x(j);return}}var De=function(){for(var x1=function(x5){return function(){var V5=new Error("Method "+x5+" is not implemented by the current driver"),Ci=f.reject(V5);return S(Ci,arguments[arguments.length-1]),Ci}},pn=0,T5=bt.length;pn<T5;pn++){var gn=bt[pn];c[gn]||(c[gn]=x1(gn))}};De();var Oe=function(x1){T1[P]&&console.info("Redefining LocalForage driver: "+P),T1[P]=c,vi[P]=x1,I()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Oe,x):Oe(!!c._support):Oe(!0)}catch(Ye){x(Ye)}});return _(g,C,b),g},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var g=T1[c]?f.resolve(T1[c]):f.reject(new Error("Driver not found."));return _(g,C,b),g},l.prototype.getSerializer=function(c){var C=f.resolve(dn);return _(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return _(b,c,c),b},l.prototype.setDriver=function(c,C,b){var g=this;gi(c)||(c=[c]);var I=this._getSupportedDrivers(c);function x(){g._config.driver=g.driver()}function P(Q){return g._extend(Q),x(),g._ready=g._initStorage(g._config),g._ready}function j(Q){return function(){var ue=0;function Se(){for(;ue<Q.length;){var _e=Q[ue];return ue++,g._dbInfo=null,g._ready=null,g.getDriver(_e).then(P).catch(Se)}x();var De=new Error("No available storage method found.");return g._driverSet=f.reject(De),g._driverSet}return Se()}}var B=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=B.then(function(){var Q=I[0];return g._dbInfo=null,g._ready=null,g.getDriver(Q).then(function(ue){g._driver=ue._driver,x(),g._wrapLibraryMethodsWithReady(),g._initDriver=j(I)})}).catch(function(){x();var Q=new Error("No available storage method found.");return g._driverSet=f.reject(Q),g._driverSet}),_(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!vi[c]},l.prototype._extend=function(c){mn(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,g=c.length;b<g;b++){var I=c[b];this.supports(I)&&C.push(I)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=hn.length;c<C;c++)I5(this,hn[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),D5=new H5;r.exports=D5},{3:3}]},{},[4])(4)})})(Y6);var M4=Y6.exports;const f1=vr(M4);class q6{getItem(t){return f1.getItem(t)}setItem(t,n){return f1.setItem(t,n)}removeItem(t){return f1.removeItem(t)}clear(){return f1.clear()}key(t){return f1.key(t)}keys(){return f1.keys()}iterate(t){return f1.iterate(t)}}var O4=Object.defineProperty,I4=Object.getOwnPropertyDescriptor,H4=(e,t,n,r)=>{for(var i=r>1?void 0:r?I4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O4(t,n,i),i},D4=(e,t)=>(n,r)=>t(n,r,e);let nn=class{constructor(e){z(this,"visible$",new ee.Subject);z(this,"componentKey$",new ee.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),y.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};nn=H4([D4(0,se.Inject(Ke))],nn);class T4 extends y.Disposable{constructor(){super(...arguments);z(this,"_currentSelectorId");z(this,"_selectionChange$",new ee.Subject);z(this,"selectionChange$",this._selectionChange$.asObservable());z(this,"_openSelector$",new ee.Subject);z(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const rn=se.createIdentifier("univer.range-selector.service");class x4 extends y.Disposable{constructor(){super(...arguments);z(this,"_taskCount",0);z(this,"_progressChange$",new ee.Subject);z(this,"_progressVisible$",new ee.Subject);z(this,"progressChange$",this._progressChange$.asObservable());z(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const an=se.createIdentifier("univer.progress.service");var V4=Object.defineProperty,N4=Object.getOwnPropertyDescriptor,k4=(e,t,n,r)=>{for(var i=r>1?void 0:r?N4(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&V4(t,n,i),i},on=(e,t)=>(n,r)=>t(n,r,e);const A4="ui",X6="DISABLE_AUTO_FOCUS";E.UniverUIPlugin=(un=class extends y.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:A6}),this._config.disableAutoFocus&&this._contextService.setContextValue(X6,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){y.mergeOverrideWithDependencies([[Ke],[N1],[W6],[L1,{useClass:E.DesktopLayoutService}],[m1,{useClass:E.DesktopShortcutService}],[Lt,{useClass:Er}],[s1,{useClass:E.DesktopMenuService}],[Yt,{useClass:T6}],[U6,{useClass:E.BrowserClipboardService,lazy:!0}],[dt,{useClass:z6,lazy:!0}],[qt,{useClass:$6,lazy:!0}],[Gt,{useClass:j6,lazy:!0}],[Y1,{useClass:F6,lazy:!0}],[Dt,{useClass:nn,lazy:!0}],[Xt,{useClass:E.DesktopGlobalZoneService,lazy:!0}],[G1,{useClass:B6,lazy:!0}],[y.ILocalStorageService,{useClass:q6,lazy:!0}],[R6,{useClass:E.DesktopBeforeCloseService}],[_1,{useClass:E.EditorService}],[rn,{useClass:T4}],[Qt,{useClass:V6}],[an,{useClass:x4}],[B1,{useClass:E.DesktopUIController}],[E.SharedController],[ht],[mt]],this._config.override).forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(B1).bootstrapWorkbench(this._config))}},z(un,"pluginName",A4),un),E.UniverUIPlugin=k4([on(1,y.IContextService),on(2,se.Inject(se.Injector)),on(3,se.Inject(y.LocaleService))],E.UniverUIPlugin);function gt(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const R4=.75,Q6=78,J6=9,K6="rgba(0,0,0,0)",ei="rgb(0,0,0)";function sn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
47
47
  `;for(let d=0;d<t.length;d++){let h=t[`${d}`],p;h.nodeName==="#text"?(p=(u=h.textContent)!=null?u:"",h=h.parentElement):p=h.innerText;const f=vt(h);ni(p).forEach(_=>{const L=_.length;i+=L,r=i-L;const U=y.Tools.generateRandomId(6);n.push({sId:U,st:r,ed:i-1,ts:f})})}return y.Tools.generateRandomId(6),{id:y.Tools.generateRandomId(6),body:{dataStream:a,textRuns:n},documentStyle:{}}}function vt(e,t=""){var o,u;let n=(u=(o=e==null?void 0:e.style)==null?void 0:o.cssText)!=null?u:"";if(n+=t,n=n.replace(/[\r\n]+/g,""),n.length===0)return{};const r=n.split(";"),i={},a={t:"",r:"",b:"",l:""};return r.forEach(d=>{var S;const h=d;d=d.toLowerCase();const p=gt(d.substr(0,d.indexOf(":"))),f=gt(d.substr(d.indexOf(":")+1));if(p==="font-weight")f==="bold"||f==="700"?i.bl=1:i.bl=0;else if(p==="font-style")f==="italic"?i.it=1:i.it=0;else if(p==="font-family"){const _=gt(h.substr(h.indexOf(":")+1));i.ff=_}else if(p==="font-size"){let _=Number.parseInt(f);n.indexOf("vertical-align")>-1&&(n.indexOf("sub")>-1||n.indexOf("sup")>-1)&&(_*=2),f.indexOf("px")!==-1&&(_=Z4(Number.parseInt(f,10))),i.fs=_}else if(p==="color")i.cl={rgb:f};else if(p==="background"||p==="background-color"){const _=new y.ColorKit(f);if(_){const L=_.toRgbString();L!==K6&&L!==ei&&(i.bg={rgb:_.toRgbString()})}}else if(p==="text-decoration-line")f==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):f==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):f==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1);else if(p==="text-decoration-color")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,cl:{rgb:f}}),i.ul.cl={rgb:f}),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,cl:{rgb:f}}),i.st.cl={rgb:f}),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,cl:{rgb:f}}),i.ol.cl={rgb:f});else if(p==="text-decoration-style")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,t:Number(f)}),i.ul.t=Number(f)),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,t:Number(f)}),i.st.t=Number(f)),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,t:Number(f)}),i.ol.t=Number(f));else if(p==="text-decoration"||p==="univer-strike"){const _=(S=f.split(" "))==null?void 0:S[0];_==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):_==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):_==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1)}if(p==="univer-underline"&&(i.ul={s:1}),p==="vertical-align"&&(f==="sub"?i.va=y.BaselineOffset.SUBSCRIPT:f==="super"?i.va=y.BaselineOffset.SUPERSCRIPT:f==="top"?i.vt=1:f==="middle"?i.vt=2:f==="bottom"?i.vt=3:i.va=y.BaselineOffset.NORMAL),p==="transform"){const _=f.split(")"),L=_.findIndex(U=>U.includes("rotate"));if(L>-1){const U=_[L].match(/\d+/g);let H=0,A=0;U!=null&&U.length&&(H=+U[0]),e!=null&&e.dataset.vertical&&(A=+e.dataset.vertical),i.tr={a:H,v:A}}}if(p==="text-align"&&(f==="left"?i.ht=1:f==="center"?i.ht=2:f==="right"?i.ht=3:f==="justify"?i.ht=4:i.ht=0),p==="overflow-wrap"||p==="word-wrap"?f==="break-word"&&(i.tb=3):p==="text-overflow"?f==="clip"&&(i.tb=2):p==="text-break"&&f==="overflow"&&(i.tb=1),p==="white-space"&&(f==="nowrap"?i.tb=1:f==="normal"?i.tb=3:f==="clip"&&(i.tb=2)),p==="border-color"){const _=ti(f,")");if(i.bd)for(const L in _)i.bd[L].cl.rgb=_[L];else{i.bd={b:{cl:{rgb:"#000"},s:0},t:{cl:{rgb:"#000"},s:0},l:{cl:{rgb:"#000"},s:0},r:{cl:{rgb:"#000"},s:0}};for(const L in _)i.bd[L].cl.rgb=_[L]}}if(p==="border-width"||p==="border-style"){const _=ti(f," ");for(const L in _)a[L]+=` ${_[L]}`;i.bd?(i.bd.b.s=y.getBorderStyleType(a.b),i.bd.t.s=y.getBorderStyleType(a.t),i.bd.l.s=y.getBorderStyleType(a.l),i.bd.r.s=y.getBorderStyleType(a.r)):i.bd={b:{cl:{rgb:"#000"},s:y.getBorderStyleType(a.b)},t:{cl:{rgb:"#000"},s:y.getBorderStyleType(a.t)},l:{cl:{rgb:"#000"},s:y.getBorderStyleType(a.l)},r:{cl:{rgb:"#000"},s:y.getBorderStyleType(a.r)}}}if(p==="border-bottom"||p==="border-top"||p==="border-left"||p==="border-right"||p==="border"){i.bd||(i.bd={});const _=f.split(" "),L=`${_[0]} ${_[1]}`;_.splice(0,2);const U=_.join("");if(y.getBorderStyleType(L)!==y.BorderStyleTypes.NONE){const A={cl:{rgb:U},s:y.getBorderStyleType(L)};p==="border-bottom"?i.bd.b=f==="none"?null:A:p==="border-top"?i.bd.t=f==="none"?null:A:p==="border-left"?i.bd.l=f==="none"?null:A:p==="border-right"?i.bd.r=f==="none"?null:A:p==="border"&&(i.bd={r:f==="none"?null:A,t:f==="none"?null:A,b:f==="none"?null:A,l:f==="none"?null:A})}}else if(p==="data-rotate"){const _=/[+-]?\d+/,L=f.match(_);f==="(0deg ,1)"?i.tr={a:0,v:1}:L&&(i.tr={a:Number(L[0])})}}),Object.keys(i).forEach(d=>{typeof i[d]=="object"&&!Object.keys(i[d]).length&&delete i[d]}),i}function ti(e,t){let n;t===" "?n=e.trim().split(t):n=e.trim().split(t).slice(0,-1),n.forEach(i=>`${i.trim()})`);let r={};return n.length===1?r={t:n[0],r:n[0],b:n[0],l:n[0]}:n.length===2?r={t:n[0],r:n[1],b:n[0],l:n[1]}:n.length===3?r={t:n[0],r:n[1],b:n[2],l:n[1]}:n.length===4&&(r={t:n[0],r:n[1],b:n[2],l:n[3]}),r}function ni(e){if(e==="")return[e];const t=/(?:(\n+.+)|(.+))/g;return e.match(t).map(i=>i.replace(/\n/g,`\r
48
48
  `))}function U4(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table col");if(!r.length)return[];for(let i=0;i<r.length;i++){const a=r[i],o=a.getAttribute("span");if(o&&+o>1)for(let u=0;u<+o;u++){const d=Ct(a.getAttribute("width"),72);n.push(d)}else{const u=Ct(a.getAttribute("width"),72);n.push(u)}}return n}function Ct(e,t){if(!e)return t;let n;return e.includes("pt")?n=h1.ptToPx(Number.parseFloat(e)):e.includes("px")?n=Number.parseFloat(e):n=Number.parseFloat(e)*72/96,n}function P4(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table tr");if(!r.length)return[];for(let i=0;i<r.length;i++){const o=r[i].querySelectorAll("td");let u=Ct(o[0].style.height,19);for(let d=0;d<o.length;d++){const h=o[d].getAttribute("rowSpan");if(!(h&&+h>1)){u=Ct(o[d].style.height,19);break}}n.push(u)}return n}function j4(e){let t=[];const n=document.createElement("DIV");if(n.innerHTML=e,t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let r=0;const i=n.querySelectorAll("table tr");i[0].querySelectorAll("td").forEach(u=>{let d=0;const h=u.getAttribute("colSpan");h!==null?d=+h:d=1,r+=d});for(let u=0;u<t.length;u++)t[u]=new Array(r);let o=0;return i.forEach(u=>{let d=0;u.querySelectorAll("td").forEach(h=>{var _,L;const p={};if(h.querySelectorAll("span").length||h.querySelectorAll("font").length){const U=sn(h);typeof U!="string"&&(p.p=U)}const f=h.innerText;f.trim().length===0?p.v="":p.v=f;const S=vt(h);for(y.Tools.isPlainObject(S)&&(p.s=S);d<r&&t[o][d]!=null;)d++;if(d!==r){if(t[o][d]==null){t[o][d]=p;const U=(_=Number(h.getAttribute("rowSpan")))!=null?_:1,H=(L=Number(h.getAttribute("colSpan")))!=null?L:1;if(U>1||H>1){const A={rs:+U-1,cs:+H-1,r:o,c:d};t[o][d].mc=A;for(let k=0;k<U;k++)for(let F=0;F<H;F++)k===0&&F===0||(t[o+k][d+F]={mc:null})}}d++}}),o++}),t}function $4(e){const t=[],n=document.createElement("DIV");n.innerHTML=e;const i=e.replace(/\r/g,"").split(`
49
49
  `),a=i[0].split(" ").length;for(let o=0;o<i.length;o++)i[o].split(" ").length<a||t.push(i[o].split(" "));for(let o=0;o<t.length;o++)for(let u=0;u<t[o].length;u++)t[o][u].length?t[o][u]={v:t[o][u]||"",m:t[o][u]||""}:t[o][u]=null;return t}function B4(e,t){e.length,e[0].length;let n=0,r=0;t&&(n=t.startRow,r=t.startColumn);const i=[];for(let a=0;a<e.length;a++)for(let o=0;o<e[a].length;o++)if(e[a][o]&&typeof e[a][o]=="object"&&"mc"in e[a][o])if(e[a][o].mc){const u=e[a][o].mc,d=u.r+n,h=d+u.rs,p=u.c+r,f=p+u.cs;i.push({startRow:d,endRow:h,startColumn:p,endColumn:f}),delete e[a][o].mc}else e[a][o]=null;return{data:e,mergeData:i}}function z4(e){var h;let t=[];const n=document.createElement("html");n.innerHTML=e;const r=(h=n.querySelector("style"))==null?void 0:h.innerText;if(!r)return;const i=F4(r);if(t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let a=0;const o=n.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(p=>{let f=0;const S=p.getAttribute("colSpan");S!==null?f=+S:f=1,a+=f});for(let p=0;p<t.length;p++)t[p]=new Array(a);let d=0;return o.forEach(p=>{let f=0;p.querySelectorAll("td").forEach(S=>{var A,k;const _={};if(S.querySelectorAll("span").length||S.querySelectorAll("font").length){const F=sn(S);typeof F!="string"&&(_.p=F)}const L=S.innerText;L.trim().length===0?_.v="":_.v=L;let U="";for(const F in i)S.classList.contains(F)&&(U+=i[F]);const H=vt(S,U);for(y.Tools.isPlainObject(H)&&(_.s=H);f<a&&t[d][f]!=null;)f++;if(f!==a){if(t[d][f]==null){t[d][f]=_;const F=(A=Number(S.getAttribute("rowSpan")))!=null?A:1,G=(k=Number(S.getAttribute("colSpan")))!=null?k:1;if(F>1||G>1){const M={rs:+F-1,cs:+G-1,r:d,c:f};t[d][f].mc=M;for(let V=0;V<F;V++)for(let R=0;R<G;R++)V===0&&R===0||(t[d+V][f+R]={mc:null})}}f++}}),d++}),t}function F4(e){const t={},n=e.replaceAll("<!--","").replaceAll("-->","").trim(),r=n==null?void 0:n.replaceAll(" ","").replaceAll(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "description": "UniverSheet normal plugin UI manager",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -58,10 +58,10 @@
58
58
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
59
59
  "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
60
60
  "rxjs": ">=7.0.0",
61
- "@univerjs/core": "0.1.9",
62
- "@univerjs/design": "0.1.9",
63
- "@univerjs/engine-formula": "0.1.9",
64
- "@univerjs/engine-render": "0.1.9"
61
+ "@univerjs/core": "0.1.10",
62
+ "@univerjs/design": "0.1.10",
63
+ "@univerjs/engine-formula": "0.1.10",
64
+ "@univerjs/engine-render": "0.1.10"
65
65
  },
66
66
  "dependencies": {
67
67
  "@univerjs/icons": "^0.1.44",
@@ -88,11 +88,11 @@
88
88
  "vite": "^5.2.10",
89
89
  "vitest": "^1.5.0",
90
90
  "vue": "^3.4.24",
91
- "@univerjs/core": "0.1.9",
92
- "@univerjs/engine-formula": "0.1.9",
93
- "@univerjs/engine-render": "0.1.9",
94
- "@univerjs/design": "0.1.9",
95
- "@univerjs/shared": "0.1.9"
91
+ "@univerjs/core": "0.1.10",
92
+ "@univerjs/design": "0.1.10",
93
+ "@univerjs/engine-formula": "0.1.10",
94
+ "@univerjs/engine-render": "0.1.10",
95
+ "@univerjs/shared": "0.1.10"
96
96
  },
97
97
  "scripts": {
98
98
  "test": "vitest run",