@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.
package/lib/cjs/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`,p5="".concat(d5," ").concat(h5).split(/[\s\n]+/),g5="aria-",m5="data-";function Xn(e,t){return e.indexOf(t)===0}function v5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||Xn(i,g5))||n.data&&Xn(i,m5)||n.attr&&p5.includes(i))&&(r[i]=e[i])}),r}var C5=te.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,g=e.closeIcon,f=g===void 0?"x":g,S=e.props,y=e.onClick,_=e.onNoticeClose,A=e.times,O=e.hovering,N=te.useState(!1),V=Ve(N,2),z=V[0],W=V[1],w=O||z,D=function(){_(u)},k=function(Q){(Q.key==="Enter"||Q.code==="Enter"||Q.keyCode===K.ENTER)&&D()};te.useEffect(function(){if(!w&&o>0){var F=setTimeout(function(){D()},o*1e3);return function(){clearTimeout(F)}}},[o,w,A]);var T=te.useMemo(function(){return We(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),P=v5(T,!0),Y="".concat(n,"-notice");return te.createElement("div",u1({},S,{ref:t,className:M1(Y,i,He({},"".concat(Y,"-closable"),h)),style:r,onMouseEnter:function(Q){var J;W(!0),S==null||(J=S.onMouseEnter)===null||J===void 0||J.call(S,Q)},onMouseLeave:function(Q){var J;W(!1),S==null||(J=S.onMouseLeave)===null||J===void 0||J.call(S,Q)},onClick:y}),te.createElement("div",{className:"".concat(Y,"-content")},d),h&&te.createElement("a",u1({tabIndex:0,className:"".concat(Y,"-close"),onKeyDown:k,"aria-label":"Close"},P,{onClick:function(Q){Q.preventDefault(),Q.stopPropagation(),D()}}),T.closeIcon))}),S5=s.createContext({}),Qn=8,Jn=3,Kn=16,b5=function(t){var n={offset:Qn,threshold:Jn,gap:Kn};if(t&&We(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:Qn,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:Jn,n.gap=(a=t.gap)!==null&&a!==void 0?a:Kn}return[!!t,n]},y5=["className","style","classNames","styles"],_5=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,g=t.stack,f=s.useContext(S5),S=f.classNames,y=s.useRef({}),_=s.useState(null),A=Ve(_,2),O=A[0],N=A[1],V=s.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=n.map(function(re){return{config:re,key:String(re.key)}}),k=b5(g),T=Ve(k,2),P=T[0],Y=T[1],F=Y.offset,Q=Y.threshold,J=Y.gap,he=P&&(W.length>0||D.length<=Q),ue=typeof u=="function"?u(r):u;return s.useEffect(function(){P&&W.length>1&&w(function(re){return re.filter(function(pe){return D.some(function(Le){var M=Le.key;return pe===M})})})},[W,D,P]),s.useEffect(function(){var re;if(P&&y.current[(re=D[D.length-1])===null||re===void 0?void 0:re.key]){var pe;N(y.current[(pe=D[D.length-1])===null||pe===void 0?void 0:pe.key])}},[D,P]),s.createElement(f5,u1({key:r,className:M1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,He(He({},"".concat(i,"-stack"),!!P),"".concat(i,"-stack-expanded"),he)),style:o,keys:D,motionAppear:!0},ue,{onAllRemoved:function(){d(r)}}),function(re,pe){var Le=re.config,M=re.className,E=re.style,R=re.index,G=Le,Z=G.key,q=G.times,ne=String(Z),ae=Le,_e=ae.className,Ie=ae.style,xe=ae.classNames,Ee=ae.styles,Ye=K1(ae,y5),Be=D.findIndex(function(o1){return o1.key===ne}),Ue={};if(P){var se=D.length-1-(Be>-1?Be:R-1),ee=r==="top"||r==="bottom"?"-50%":"0";if(se>0){var Se,Ne,Oe;Ue.height=he?(Se=y.current[ne])===null||Se===void 0?void 0:Se.offsetHeight:O==null?void 0:O.offsetHeight;for(var we=0,de=0;de<se;de++){var ge;we+=((ge=y.current[D[D.length-1-de].key])===null||ge===void 0?void 0:ge.offsetHeight)+J}var je=(he?we:se*F)*(r.startsWith("top")?1:-1),Je=!he&&O!==null&&O!==void 0&&O.offsetWidth&&(Ne=y.current[ne])!==null&&Ne!==void 0&&Ne.offsetWidth?((O==null?void 0:O.offsetWidth)-F*2*(se<3?se:3))/((Oe=y.current[ne])===null||Oe===void 0?void 0:Oe.offsetWidth):1;Ue.transform="translate3d(".concat(ee,", ").concat(je,"px, 0) scaleX(").concat(Je,")")}else Ue.transform="translate3d(".concat(ee,", 0, 0)")}return s.createElement("div",{ref:pe,className:M1("".concat(i,"-notice-wrapper"),M,xe==null?void 0:xe.wrapper),style:Ce(Ce(Ce({},E),Ue),Ee==null?void 0:Ee.wrapper),onMouseEnter:function(){return w(function(Ke){return Ke.includes(ne)?Ke:[].concat(w1(Ke),[ne])})},onMouseLeave:function(){return w(function(Ke){return Ke.filter(function(D1){return D1!==ne})})}},s.createElement(C5,u1({},Ye,{ref:function(Ke){Be>-1?y.current[ne]=Ke:delete y.current[ne]},prefixCls:i,classNames:xe,styles:Ee,className:M1(_e,S==null?void 0:S.notice),style:Ie,times:q,key:Z,eventKey:Z,onNoticeClose:h,hovering:P&&W.length>0})))})},L5=te.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,g=e.stack,f=e.renderNotifications,S=te.useState([]),y=Ve(S,2),_=y[0],A=y[1],O=function(P){var Y,F=_.find(function(Q){return Q.key===P});F==null||(Y=F.onClose)===null||Y===void 0||Y.call(F),A(function(Q){return Q.filter(function(J){return J.key!==P})})};te.useImperativeHandle(t,function(){return{open:function(P){A(function(Y){var F=w1(Y),Q=F.findIndex(function(ue){return ue.key===P.key}),J=Ce({},P);if(Q>=0){var he;J.times=(((he=Y[Q])===null||he===void 0?void 0:he.times)||0)+1,F[Q]=J}else J.times=0,F.push(J);return o>0&&F.length>o&&(F=F.slice(-o)),F})},close:function(P){O(P)},destroy:function(){A([])}}});var N=te.useState({}),V=Ve(N,2),z=V[0],W=V[1];te.useEffect(function(){var T={};_.forEach(function(P){var Y=P.placement,F=Y===void 0?"topRight":Y;F&&(T[F]=T[F]||[],T[F].push(P))}),Object.keys(z).forEach(function(P){T[P]=T[P]||[]}),W(T)},[_]);var w=function(P){W(function(Y){var F=Ce({},Y),Q=F[P]||[];return Q.length||delete F[P],F})},D=te.useRef(!1);if(te.useEffect(function(){Object.keys(z).length>0?D.current=!0:D.current&&(h==null||h(),D.current=!1)},[z]),!i)return null;var k=Object.keys(z);return Xt.createPortal(te.createElement(te.Fragment,null,k.map(function(T){var P=z[T],Y=te.createElement(_5,{key:T,configList:P,placement:T,prefixCls:r,className:u==null?void 0:u(T),style:d==null?void 0:d(T),motion:a,onNoticeClose:O,onAllNoticeRemoved:w,stack:g});return f?f(Y,{prefixCls:r,key:T}):Y})),i)}),E5=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],w5=function(){return document.body},e3=0;function M5(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function x5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?w5:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,g=e.renderNotifications,f=K1(e,E5),S=te.useState(),y=Ve(S,2),_=y[0],A=y[1],O=te.useRef(),N=te.createElement(L5,{container:_,ref:O,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:g}),V=te.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=te.useMemo(function(){return{open:function(T){var P=M5(f,T);(P.key===null||P.key===void 0)&&(P.key="rc-notification-".concat(e3),e3+=1),w(function(Y){return[].concat(w1(Y),[{type:"open",config:P}])})},close:function(T){w(function(P){return[].concat(w1(P),[{type:"close",key:T}])})},destroy:function(){w(function(T){return[].concat(w1(T),[{type:"destroy"}])})}}},[]);return te.useEffect(function(){A(n())}),te.useEffect(function(){O.current&&W.length&&(W.forEach(function(k){switch(k.type){case"open":O.current.open(k.config);break;case"close":O.current.close(k.key);break;case"destroy":O.current.destroy();break}}),w(function(k){return k.filter(function(T){return!W.includes(T)})}))},[W]),[D,N]}const O5="univer-notification",R5="univer-notification-notice",I5="univer-notification-notice-wrapper",H5="univer-notification-notice-content",D5="univer-notification-notice-close",T5="univer-notification-icon",V5="univer-notification-icon-success",N5="univer-notification-icon-info",k5="univer-notification-icon-warning",A5="univer-notification-icon-error",j5="univer-notification-content-container",U5="univer-notification-title",P5="univer-notification-content",$5="univer-notification-content-ellipsis",B5="univer-notification-top",z5="univer-notification-topLeft",F5="univer-notification-topRight",Z5="univer-notification-bottom",W5="univer-notification-bottomRight",G5="univer-notification-bottomLeft",Y5="univer-notification-fade",q5="univer-notification-fade-appear-prepare",X5="univer-notification-fade-appear-start",Q5="univer-notification-fade-appear-active",J5="univer-notification-fade-appear",K5="univer-notification-fade-enter",e0="univer-notification-fade-leave",t0="univer-notification-fade-enter-active",n0="univer-notification-fade-in",r0="univer-notification-fade-leave-active",i0="univer-notification-fade-out",Qe={notification:O5,notificationNotice:R5,notificationNoticeWrapper:I5,notificationNoticeContent:H5,notificationNoticeClose:D5,notificationIcon:T5,notificationIconSuccess:V5,notificationIconInfo:N5,notificationIconWarning:k5,notificationIconError:A5,notificationContentContainer:j5,notificationTitle:U5,notificationContent:P5,notificationContentEllipsis:$5,notificationTop:B5,notificationTopLeft:z5,notificationTopRight:F5,notificationBottom:Z5,notificationBottomRight:W5,notificationBottomLeft:G5,notificationFade:Y5,notificationFadeAppearPrepare:q5,notificationFadeAppearStart:X5,notificationFadeAppearActive:Q5,notificationFadeAppear:J5,notificationFadeEnter:K5,notificationFadeLeave:e0,notificationFadeEnterActive:t0,notificationFadeIn:n0,notificationFadeLeaveActive:r0,notificationFadeOut:i0},a0={success:v.jsx(ro,{className:Qe.notificationIconSuccess}),info:v.jsx(Dn,{className:Qe.notificationIconInfo}),warning:v.jsx(Dn,{className:Qe.notificationIconWarning}),error:v.jsx(Xa,{className:Qe.notificationIconError})},Q6=new ie.Subject,o0=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Te(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:a0[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function s0(){const{mountContainer:e}=s.useContext(me.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=x5({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(Qt,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(Q6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(o0,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const l0={show:e=>{Q6.next(e)}},cn=oe.createIdentifier("univer.confirm-service");function c0(){const e=le.useDependency(cn),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const g=h,f=i[g];f&&(d[g]=v.jsx($e,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(me.Confirm,{...i},a))}const un=oe.createIdentifier("univer.context-menu-service");class J6 extends L.Disposable{constructor(){super(...arguments);B(this,"_currentHandler",null);B(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,L.toDisposable(()=>{this._currentHandler=null})}}function u0(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(un),u=le.useDependency(L.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",g),document.addEventListener("wheel",g),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("wheel",g),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function g(){t(!1)}return v.jsx(me.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(q1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:y}=f;u&&u.executeCommand(S,{value:y}),d.get(C1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const fn=oe.createIdentifier("univer.ui.dialog-service");function f0(){const e=le.useDependency(fn),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.getObservableDialog().subscribe(o=>{n(o)});return()=>{a.unsubscribe()}},[e]);const r=t.map(i=>{const{children:a,title:o,closeIcon:u,footer:d,...h}=i,g=h;for(const f of["children","title","closeIcon","footer"]){const S=f,y=i[S];y&&(g[S]=v.jsx($e,{...y}))}return g});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(me.Dialog,{...i},i.id))})}const dn=oe.createIdentifier("univer.global-zone-service"),d0="univer-global-zone",h0="univer-global-zone-open",p0="univer-global-zone-close",t3={globalZone:d0,globalZoneOpen:h0,globalZoneClose:p0};function g0(){const e=le.useDependency(dn),[t,n]=s.useState(!1),r=Ae(e.componentKey$,e.componentKey),i=le.useDependency(e1),a=Te(t3.globalZone,t3.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r,i]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const m0=new Set([()=>f0,()=>c0,()=>s0,()=>u0,()=>g0]),hn=oe.createIdentifier("univer.popup.service");class K6{constructor(){B(this,"_popupMap",new Map);B(this,"_popups$",new ie.BehaviorSubject([]));B(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=L.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const v0=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(me.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function C0(){const e=le.useDependency(hn),t=Ae(e.popups$,void 0,!0),n=le.useDependency(e1);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(v0,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function S0(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,g=le.useDependency(L.LocaleService),f=le.useDependency(L.ThemeService),S=le.useDependency(ot),y=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(me.defaultTheme)},[]),s.useEffect(()=>{y.current&&(h==null||h(y.current))},[h]);const[_,A]=s.useState(g.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(O),S.setContainer(O);const N=[g.localeChanged$.subscribe(()=>{A(g.getLocales())}),f.currentTheme$.subscribe(V=>{me.themeInstance.setTheme(r,V),O&&me.themeInstance.setTheme(O,V)})];return()=>{N.forEach(V=>V.unsubscribe()),document.body.removeChild(O)}},[g,S,r,O,f.currentTheme$]),v.jsxs(me.ConfigProvider,{locale:_,mountContainer:O,children:[v.jsxs("div",{className:t1.appLayout,tabIndex:-1,onBlur:N=>N.stopPropagation(),children:[t&&v.jsx("header",{className:t1.appContainerHeader,children:v.jsx(m4,{headerMenuComponents:a})}),v.jsxs("section",{className:t1.appContainer,children:[v.jsxs("div",{className:t1.appContainerWrapper,children:[v.jsx("aside",{className:t1.appContainerLeftSidebar,children:v.jsx(g1,{components:d})}),v.jsxs("section",{className:t1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(g1,{components:i})}),v.jsx("section",{className:t1.appContainerCanvas,ref:y,"data-range-selector":!0,onContextMenu:N=>N.preventDefault(),children:v.jsx(g1,{components:o})})]}),v.jsx("aside",{className:t1.appContainerSidebar,children:v.jsx(E4,{})})]}),n&&v.jsx("footer",{className:t1.appFooter,children:v.jsx(g1,{components:u})}),v.jsx(O4,{})]}),v.jsx(C0,{})]}),v.jsx(g1,{components:m0})]})}var b0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,_0=(e,t,n,r)=>{for(var i=r>1?void 0:r?y0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b0(t,n,i),i},L1=(e,t)=>(n,r)=>t(n,r,e),ei=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(ei||{});const L0=3e3;exports.DesktopUIController=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_componentsByPart",new Map);B(this,"_componentRegistered$",new ie.Subject);B(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(E0(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==L.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ie.filter(a=>a===L.LifecycleStages.Ready),ie.delay(300),ie.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=L.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=L.LifecycleStages.Steady,L0)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),L.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}};exports.DesktopUIController=_0([L1(0,L.IUniverInstanceService),L1(1,C1.IRenderManagerService),L1(2,oe.Inject(oe.Injector)),L1(3,oe.Inject(L.LifecycleService)),L1(4,oe.Optional(O1))],exports.DesktopUIController);function E0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const g=document.getElementById(i);g?r=g:r=n3(i)}else i instanceof HTMLElement?r=i:r=n3("univer");const a=le.connectInjector(S0,e),o=e.get(X1),u=g=>n(g,r);function d(){const g=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),y=o.getComponents("header-menu"),_=o.getComponents("left-sidebar");y9(v.jsx(a,{...t,mountContainer:r,headerComponents:g,headerMenuComponents:y,leftSidebarComponents:_,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),L.toDisposable(()=>{_9(r),h.unsubscribe()})}function n3(e){const t=document.createElement("div");return t.id=e,t}const w0={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},M0=w0,x0={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},ti=x0,Ct=oe.createIdentifier("univer.notification-service");var O0=Object.defineProperty,R0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?R0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O0(t,n,i),i},H0=(e,t)=>(n,r)=>t(n,r,e);const ni=oe.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){B(this,"_beforeUnloadCallbacks",[]);B(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
41
- `);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}};exports.DesktopBeforeCloseService=I0([H0(0,Ct)],exports.DesktopBeforeCloseService);function D0(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var T0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,N0=(e,t,n,r)=>{for(var i=r>1?void 0:r?V0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&T0(t,n,i),i},Dt=(e,t)=>(n,r)=>t(n,r,e);const Zt="text/plain",Wt="text/html",ri=oe.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends L.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return D0()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Zt]:new Blob([t],{type:Zt}),[Wt]:new Blob([n],{type:Wt})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=A0();document.body.appendChild(r),r.innerHTML=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=k0();document.body.appendChild(r),r.value=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}};exports.BrowserClipboardService=N0([Dt(0,oe.Inject(L.LocaleService)),Dt(1,L.ILogService),Dt(2,oe.Optional(Ct))],exports.BrowserClipboardService);function k0(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function A0(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function r3(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class ii{constructor(){B(this,"_confirmOptions",[]);B(this,"confirmOptions$",new ie.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),L.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class ai extends L.Disposable{constructor(){super(...arguments);B(this,"_dialogOptions",[]);B(this,"_dialogOptions$",new ie.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),L.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getObservableDialog(){return this._dialogOptions$}}class oi{constructor(){B(this,"portalContainer",document.body);B(this,"message")}setContainer(t){this.portalContainer=t,this.message=new me.Message(t)}show(t){const{type:n,...r}=t;return this.message&&this.message[n](r),L.toDisposable(()=>{})}}class si{show(t){return l0.show(t),L.toDisposable(()=>{})}}var j0=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,P0=(e,t,n,r)=>{for(var i=r>1?void 0:r?U0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&j0(t,n,i),i},$0=(e,t)=>(n,r)=>t(n,r,e);exports.DesktopGlobalZoneService=class{constructor(t){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);B(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),this._componentKey=t,L.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=P0([$0(0,oe.Inject(e1))],exports.DesktopGlobalZoneService);class li{constructor(){B(this,"_sidebarOptions",{});B(this,"sidebarOptions$",new ie.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),L.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,F0=(e,t,n,r)=>{for(var i=r>1?void 0:r?z0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&B0(t,n,i),i},i3=(e,t)=>(n,r)=>t(n,r,e);let Z1=class extends L.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(L.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:me.MessageType.Error})})))}};Z1=F0([L.OnLifecycle(L.LifecycleStages.Starting,Z1),i3(0,oe.Inject(L.ErrorService)),i3(1,ot)],Z1);class ci extends L.Disposable{constructor(){super(...arguments);B(this,"_open$",new ie.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(ie.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const ui="ShortcutPanel",pn={id:"base-ui.operation.toggle-shortcut-panel",type:L.CommandType.OPERATION,handler:e=>{const t=e.get(ci),n=e.get(st);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:ui}})),!0}},Z0="univer-shortcut-panel-group-title",W0="univer-shortcut-panel-item",G0="univer-shortcut-panel-item-title",Y0="univer-shortcut-panel-item-shortcut",h1={shortcutPanelGroupTitle:Z0,shortcutPanelItem:W0,shortcutPanelItemTitle:G0,shortcutPanelItemShortcut:Y0};function q0(){const e=le.useDependency(S1),t=le.useDependency(L.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const g=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(g))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${g}!`);a.has(g)||a.set(g,[]),a.get(g).push(f)}const u=Array.from(a.entries()).map(([h,g])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:g}}).sort((h,g)=>h.sequence-g.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:h1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:h1.shortcutPanelGroup,children:[v.jsx("div",{className:h1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:h1.shortcutPanelItem,children:[v.jsx("span",{className:h1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:h1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function X0(e){return{id:pn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:Pe.BUTTON,positions:[Ze.TOOLBAR_START],hidden$:a6(e,L.UniverInstanceType.UNIVER_SHEET)}}var Q0=Object.defineProperty,J0=Object.getOwnPropertyDescriptor,K0=(e,t,n,r)=>{for(var i=r>1?void 0:r?J0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q0(t,n,i),i},E1=(e,t)=>(n,r)=>t(n,r,e);const es={id:pn.id,binding:ke.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let W1=class extends L.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(X0))),this.disposeWithMe(t.register(ui,q0)),this.disposeWithMe(i.registerCommand(pn)),this.disposeWithMe(n.registerShortcut(es))}};W1=K0([L.OnLifecycle(L.LifecycleStages.Steady,W1),E1(0,oe.Inject(oe.Injector)),E1(1,oe.Inject(e1)),E1(2,S1),E1(3,f1),E1(4,L.ICommandService)],W1);function z1(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fi={exports:{}};/*!
40
+ onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,p5="".concat(d5," ").concat(h5).split(/[\s\n]+/),g5="aria-",m5="data-";function Xn(e,t){return e.indexOf(t)===0}function v5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;t===!1?n={aria:!0,data:!0,attr:!0}:t===!0?n={aria:!0}:n=Ce({},t);var r={};return Object.keys(e).forEach(function(i){(n.aria&&(i==="role"||Xn(i,g5))||n.data&&Xn(i,m5)||n.attr&&p5.includes(i))&&(r[i]=e[i])}),r}var C5=te.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,i=e.className,a=e.duration,o=a===void 0?4.5:a,u=e.eventKey,d=e.content,h=e.closable,g=e.closeIcon,f=g===void 0?"x":g,S=e.props,y=e.onClick,_=e.onNoticeClose,A=e.times,O=e.hovering,N=te.useState(!1),V=Ve(N,2),z=V[0],W=V[1],w=O||z,D=function(){_(u)},k=function(Q){(Q.key==="Enter"||Q.code==="Enter"||Q.keyCode===K.ENTER)&&D()};te.useEffect(function(){if(!w&&o>0){var F=setTimeout(function(){D()},o*1e3);return function(){clearTimeout(F)}}},[o,w,A]);var T=te.useMemo(function(){return We(h)==="object"&&h!==null?h:h?{closeIcon:f}:{}},[h,f]),P=v5(T,!0),Y="".concat(n,"-notice");return te.createElement("div",u1({},S,{ref:t,className:M1(Y,i,He({},"".concat(Y,"-closable"),h)),style:r,onMouseEnter:function(Q){var J;W(!0),S==null||(J=S.onMouseEnter)===null||J===void 0||J.call(S,Q)},onMouseLeave:function(Q){var J;W(!1),S==null||(J=S.onMouseLeave)===null||J===void 0||J.call(S,Q)},onClick:y}),te.createElement("div",{className:"".concat(Y,"-content")},d),h&&te.createElement("a",u1({tabIndex:0,className:"".concat(Y,"-close"),onKeyDown:k,"aria-label":"Close"},P,{onClick:function(Q){Q.preventDefault(),Q.stopPropagation(),D()}}),T.closeIcon))}),S5=s.createContext({}),Qn=8,Jn=3,Kn=16,b5=function(t){var n={offset:Qn,threshold:Jn,gap:Kn};if(t&&We(t)==="object"){var r,i,a;n.offset=(r=t.offset)!==null&&r!==void 0?r:Qn,n.threshold=(i=t.threshold)!==null&&i!==void 0?i:Jn,n.gap=(a=t.gap)!==null&&a!==void 0?a:Kn}return[!!t,n]},y5=["className","style","classNames","styles"],_5=function(t){var n=t.configList,r=t.placement,i=t.prefixCls,a=t.className,o=t.style,u=t.motion,d=t.onAllNoticeRemoved,h=t.onNoticeClose,g=t.stack,f=s.useContext(S5),S=f.classNames,y=s.useRef({}),_=s.useState(null),A=Ve(_,2),O=A[0],N=A[1],V=s.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=n.map(function(re){return{config:re,key:String(re.key)}}),k=b5(g),T=Ve(k,2),P=T[0],Y=T[1],F=Y.offset,Q=Y.threshold,J=Y.gap,he=P&&(W.length>0||D.length<=Q),ue=typeof u=="function"?u(r):u;return s.useEffect(function(){P&&W.length>1&&w(function(re){return re.filter(function(pe){return D.some(function(Le){var M=Le.key;return pe===M})})})},[W,D,P]),s.useEffect(function(){var re;if(P&&y.current[(re=D[D.length-1])===null||re===void 0?void 0:re.key]){var pe;N(y.current[(pe=D[D.length-1])===null||pe===void 0?void 0:pe.key])}},[D,P]),s.createElement(f5,u1({key:r,className:M1(i,"".concat(i,"-").concat(r),S==null?void 0:S.list,a,He(He({},"".concat(i,"-stack"),!!P),"".concat(i,"-stack-expanded"),he)),style:o,keys:D,motionAppear:!0},ue,{onAllRemoved:function(){d(r)}}),function(re,pe){var Le=re.config,M=re.className,E=re.style,R=re.index,G=Le,Z=G.key,q=G.times,ne=String(Z),ae=Le,_e=ae.className,Ie=ae.style,xe=ae.classNames,Ee=ae.styles,Ye=K1(ae,y5),Be=D.findIndex(function(o1){return o1.key===ne}),Ue={};if(P){var se=D.length-1-(Be>-1?Be:R-1),ee=r==="top"||r==="bottom"?"-50%":"0";if(se>0){var Se,Ne,Oe;Ue.height=he?(Se=y.current[ne])===null||Se===void 0?void 0:Se.offsetHeight:O==null?void 0:O.offsetHeight;for(var we=0,de=0;de<se;de++){var ge;we+=((ge=y.current[D[D.length-1-de].key])===null||ge===void 0?void 0:ge.offsetHeight)+J}var je=(he?we:se*F)*(r.startsWith("top")?1:-1),Je=!he&&O!==null&&O!==void 0&&O.offsetWidth&&(Ne=y.current[ne])!==null&&Ne!==void 0&&Ne.offsetWidth?((O==null?void 0:O.offsetWidth)-F*2*(se<3?se:3))/((Oe=y.current[ne])===null||Oe===void 0?void 0:Oe.offsetWidth):1;Ue.transform="translate3d(".concat(ee,", ").concat(je,"px, 0) scaleX(").concat(Je,")")}else Ue.transform="translate3d(".concat(ee,", 0, 0)")}return s.createElement("div",{ref:pe,className:M1("".concat(i,"-notice-wrapper"),M,xe==null?void 0:xe.wrapper),style:Ce(Ce(Ce({},E),Ue),Ee==null?void 0:Ee.wrapper),onMouseEnter:function(){return w(function(Ke){return Ke.includes(ne)?Ke:[].concat(w1(Ke),[ne])})},onMouseLeave:function(){return w(function(Ke){return Ke.filter(function(D1){return D1!==ne})})}},s.createElement(C5,u1({},Ye,{ref:function(Ke){Be>-1?y.current[ne]=Ke:delete y.current[ne]},prefixCls:i,classNames:xe,styles:Ee,className:M1(_e,S==null?void 0:S.notice),style:Ie,times:q,key:Z,eventKey:Z,onNoticeClose:h,hovering:P&&W.length>0})))})},L5=te.forwardRef(function(e,t){var n=e.prefixCls,r=n===void 0?"rc-notification":n,i=e.container,a=e.motion,o=e.maxCount,u=e.className,d=e.style,h=e.onAllRemoved,g=e.stack,f=e.renderNotifications,S=te.useState([]),y=Ve(S,2),_=y[0],A=y[1],O=function(P){var Y,F=_.find(function(Q){return Q.key===P});F==null||(Y=F.onClose)===null||Y===void 0||Y.call(F),A(function(Q){return Q.filter(function(J){return J.key!==P})})};te.useImperativeHandle(t,function(){return{open:function(P){A(function(Y){var F=w1(Y),Q=F.findIndex(function(ue){return ue.key===P.key}),J=Ce({},P);if(Q>=0){var he;J.times=(((he=Y[Q])===null||he===void 0?void 0:he.times)||0)+1,F[Q]=J}else J.times=0,F.push(J);return o>0&&F.length>o&&(F=F.slice(-o)),F})},close:function(P){O(P)},destroy:function(){A([])}}});var N=te.useState({}),V=Ve(N,2),z=V[0],W=V[1];te.useEffect(function(){var T={};_.forEach(function(P){var Y=P.placement,F=Y===void 0?"topRight":Y;F&&(T[F]=T[F]||[],T[F].push(P))}),Object.keys(z).forEach(function(P){T[P]=T[P]||[]}),W(T)},[_]);var w=function(P){W(function(Y){var F=Ce({},Y),Q=F[P]||[];return Q.length||delete F[P],F})},D=te.useRef(!1);if(te.useEffect(function(){Object.keys(z).length>0?D.current=!0:D.current&&(h==null||h(),D.current=!1)},[z]),!i)return null;var k=Object.keys(z);return Xt.createPortal(te.createElement(te.Fragment,null,k.map(function(T){var P=z[T],Y=te.createElement(_5,{key:T,configList:P,placement:T,prefixCls:r,className:u==null?void 0:u(T),style:d==null?void 0:d(T),motion:a,onNoticeClose:O,onAllNoticeRemoved:w,stack:g});return f?f(Y,{prefixCls:r,key:T}):Y})),i)}),E5=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],w5=function(){return document.body},e3=0;function M5(){for(var e={},t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(i){i&&Object.keys(i).forEach(function(a){var o=i[a];o!==void 0&&(e[a]=o)})}),e}function x5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getContainer,n=t===void 0?w5:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.className,u=e.style,d=e.onAllRemoved,h=e.stack,g=e.renderNotifications,f=K1(e,E5),S=te.useState(),y=Ve(S,2),_=y[0],A=y[1],O=te.useRef(),N=te.createElement(L5,{container:_,ref:O,prefixCls:i,motion:r,maxCount:a,className:o,style:u,onAllRemoved:d,stack:h,renderNotifications:g}),V=te.useState([]),z=Ve(V,2),W=z[0],w=z[1],D=te.useMemo(function(){return{open:function(T){var P=M5(f,T);(P.key===null||P.key===void 0)&&(P.key="rc-notification-".concat(e3),e3+=1),w(function(Y){return[].concat(w1(Y),[{type:"open",config:P}])})},close:function(T){w(function(P){return[].concat(w1(P),[{type:"close",key:T}])})},destroy:function(){w(function(T){return[].concat(w1(T),[{type:"destroy"}])})}}},[]);return te.useEffect(function(){A(n())}),te.useEffect(function(){O.current&&W.length&&(W.forEach(function(k){switch(k.type){case"open":O.current.open(k.config);break;case"close":O.current.close(k.key);break;case"destroy":O.current.destroy();break}}),w(function(k){return k.filter(function(T){return!W.includes(T)})}))},[W]),[D,N]}const O5="univer-notification",R5="univer-notification-notice",I5="univer-notification-notice-wrapper",H5="univer-notification-notice-content",D5="univer-notification-notice-close",T5="univer-notification-icon",V5="univer-notification-icon-success",N5="univer-notification-icon-info",k5="univer-notification-icon-warning",A5="univer-notification-icon-error",j5="univer-notification-content-container",U5="univer-notification-title",P5="univer-notification-content",$5="univer-notification-content-ellipsis",B5="univer-notification-top",z5="univer-notification-topLeft",F5="univer-notification-topRight",Z5="univer-notification-bottom",W5="univer-notification-bottomRight",G5="univer-notification-bottomLeft",Y5="univer-notification-fade",q5="univer-notification-fade-appear-prepare",X5="univer-notification-fade-appear-start",Q5="univer-notification-fade-appear-active",J5="univer-notification-fade-appear",K5="univer-notification-fade-enter",e0="univer-notification-fade-leave",t0="univer-notification-fade-enter-active",n0="univer-notification-fade-in",r0="univer-notification-fade-leave-active",i0="univer-notification-fade-out",Qe={notification:O5,notificationNotice:R5,notificationNoticeWrapper:I5,notificationNoticeContent:H5,notificationNoticeClose:D5,notificationIcon:T5,notificationIconSuccess:V5,notificationIconInfo:N5,notificationIconWarning:k5,notificationIconError:A5,notificationContentContainer:j5,notificationTitle:U5,notificationContent:P5,notificationContentEllipsis:$5,notificationTop:B5,notificationTopLeft:z5,notificationTopRight:F5,notificationBottom:Z5,notificationBottomRight:W5,notificationBottomLeft:G5,notificationFade:Y5,notificationFadeAppearPrepare:q5,notificationFadeAppearStart:X5,notificationFadeAppearActive:Q5,notificationFadeAppear:J5,notificationFadeEnter:K5,notificationFadeLeave:e0,notificationFadeEnterActive:t0,notificationFadeIn:n0,notificationFadeLeaveActive:r0,notificationFadeOut:i0},a0={success:v.jsx(ro,{className:Qe.notificationIconSuccess}),info:v.jsx(Dn,{className:Qe.notificationIconInfo}),warning:v.jsx(Dn,{className:Qe.notificationIconWarning}),error:v.jsx(Xa,{className:Qe.notificationIconError})},Q6=new ie.Subject,o0=e=>{const{type:t,content:n,title:r,lines:i=0}=e,a=Te(Qe.notificationContent,{[Qe.notificationContentEllipsis]:i!==0});return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:Qe.notificationIcon,children:a0[t]}),v.jsxs("div",{className:Qe.notificationContentContainer,children:[v.jsx("span",{className:Qe.notificationTitle,children:r}),v.jsx("span",{className:a,style:{WebkitLineClamp:i},children:n})]})]})};function s0(){const{mountContainer:e}=s.useContext(me.ConfigContext);if(!e)return v.jsx(v.Fragment,{});const[t,n]=x5({prefixCls:Qe.notification,maxCount:3,closeIcon:v.jsx(Qt,{}),getContainer:()=>e,motion:{motionName:Qe.notificationFade,motionAppear:!0,motionEnter:!0,motionLeave:!0}}),r=s.useRef(Q6);return s.useEffect(()=>{const i=r.current.subscribe(a=>{var o,u,d;t.open({content:v.jsx(o0,{content:a.content,type:a.type,title:a.title,lines:a.lines}),placement:(o=a.placement)!=null?o:"topRight",duration:(u=a.duration)!=null?u:4.5,closable:(d=a.closable)!=null?d:!0})});return()=>{i.unsubscribe()}},[]),v.jsx(v.Fragment,{children:n})}const l0={show:e=>{Q6.next(e)}},cn=oe.createIdentifier("univer.confirm-service");function c0(){const e=le.useDependency(cn),[t,n]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...u}=i,d=u;for(const h of["children","title"]){const g=h,f=i[g];f&&(d[g]=v.jsx($e,{...f}))}return d});return r==null?void 0:r.map((i,a)=>v.jsx(me.Confirm,{...i},a))}const un=oe.createIdentifier("univer.context-menu-service");class J6 extends L.Disposable{constructor(){super(...arguments);B(this,"_currentHandler",null);B(this,"disabled",!1)}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,L.toDisposable(()=>{this._currentHandler=null})}}function u0(){const[e,t]=s.useState(!1),[n,r]=s.useState(""),[i,a]=s.useState([0,0]),o=le.useDependency(un),u=le.useDependency(L.ICommandService),d=le.useInjector();s.useEffect(()=>{const f=o.registerContextMenuHandler({handleContextMenu:h});return document.addEventListener("pointerdown",g),document.addEventListener("wheel",g),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("wheel",g),f.dispose()}},[]);function h(f,S){r(S),a([f.clientX,f.clientY]),t(!0)}function g(){t(!1)}return v.jsx(me.Popup,{visible:e,offset:i,children:v.jsx("section",{onPointerDown:f=>f.stopPropagation(),children:n&&v.jsx(q1,{menuType:[n],onOptionSelect:f=>{const{label:S,value:y}=f;u&&u.executeCommand(S,{value:y}),d.get(C1.ITextSelectionRenderManager).focus(),t(!1)}})})})}const fn=oe.createIdentifier("univer.ui.dialog-service");function f0(){const e=le.useDependency(fn),[t,n]=s.useState([]);s.useEffect(()=>{const a=e.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,g=h;for(const f of["children","title","closeIcon","footer"]){const S=f,y=i[S];y&&(g[S]=v.jsx($e,{...y}))}return g});return v.jsx(v.Fragment,{children:r==null?void 0:r.map(i=>v.jsx(me.Dialog,{...i},i.id))})}const dn=oe.createIdentifier("univer.global-zone-service"),d0="univer-global-zone",h0="univer-global-zone-open",p0="univer-global-zone-close",t3={globalZone:d0,globalZoneOpen:h0,globalZoneClose:p0};function g0(){const e=le.useDependency(dn),[t,n]=s.useState(!1),r=Ae(e.componentKey$,e.componentKey),i=le.useDependency(e1),a=Te(t3.globalZone,t3.globalZoneOpen),o=s.useMemo(()=>{const u=i.get(r!=null?r:"");if(u)return u},[r,i]);return s.useEffect(()=>{const u=e.visible$.subscribe(d=>{n(d)});return()=>{u.unsubscribe()}},[e.visible$]),t?v.jsx("section",{className:a,children:o&&v.jsx(o,{})}):null}const m0=new Set([()=>f0,()=>c0,()=>s0,()=>u0,()=>g0]),hn=oe.createIdentifier("univer.popup.service");class K6{constructor(){B(this,"_popupMap",new Map);B(this,"_popups$",new ie.BehaviorSubject([]));B(this,"popups$",this._popups$.asObservable())}get popups(){return Array.from(this._popupMap.entries())}_notice(){this._popups$.next(Array.from(this._popupMap.entries()))}addPopup(t){const n=L.Tools.generateRandomId();return this._popupMap.set(n,t),this._notice(),n}removePopup(t){this._popupMap.delete(t)&&this._notice()}removeAll(){this._popupMap.clear(),this._notice()}}const v0=({popup:e,children:t})=>{const n=Ae(e.anchorRect$,e.anchorRect),r=s.useMemo(()=>{var o;const[i=0,a=0]=(o=e.offset)!=null?o:[];return{left:n.left-i,right:n.right+i,top:n.top-a,bottom:n.bottom+a}},[n.bottom,n.left,n.right,n.top,e.offset]);return v.jsx(me.RectPopup,{anchorRect:r,direction:e.direction,onClickOutside:e.onClickOutside,excludeOutside:e.excludeOutside,closeOnSelfTarget:e.closeOnSelfTarget,children:t})};function C0(){const e=le.useDependency(hn),t=Ae(e.popups$,void 0,!0),n=le.useDependency(e1);return t.map(r=>{const[i,a]=r,o=n.get(a.componentKey);return v.jsx(v0,{popup:a,children:o?v.jsx(o,{popup:a}):null},i)})}function S0(e){const{header:t,footer:n,mountContainer:r,headerComponents:i,headerMenuComponents:a,contentComponents:o,footerComponents:u,leftSidebarComponents:d,onRendered:h}=e,g=le.useDependency(L.LocaleService),f=le.useDependency(L.ThemeService),S=le.useDependency(ot),y=s.useRef(null);s.useEffect(()=>{f.getCurrentTheme()||f.setTheme(me.defaultTheme)},[]),s.useEffect(()=>{y.current&&(h==null||h(y.current))},[h]);const[_,A]=s.useState(g.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(O),S.setContainer(O);const N=[g.localeChanged$.subscribe(()=>{A(g.getLocales())}),f.currentTheme$.subscribe(V=>{me.themeInstance.setTheme(r,V),O&&me.themeInstance.setTheme(O,V)})];return()=>{N.forEach(V=>V.unsubscribe()),document.body.removeChild(O)}},[g,S,r,O,f.currentTheme$]),v.jsxs(me.ConfigProvider,{locale:_,mountContainer:O,children:[v.jsxs("div",{className:t1.appLayout,tabIndex:-1,onBlur:N=>N.stopPropagation(),children:[t&&v.jsx("header",{className:t1.appContainerHeader,children:v.jsx(m4,{headerMenuComponents:a})}),v.jsxs("section",{className:t1.appContainer,children:[v.jsxs("div",{className:t1.appContainerWrapper,children:[v.jsx("aside",{className:t1.appContainerLeftSidebar,children:v.jsx(g1,{components:d})}),v.jsxs("section",{className:t1.appContainerContent,children:[v.jsx("header",{children:t&&v.jsx(g1,{components:i})}),v.jsx("section",{className:t1.appContainerCanvas,ref:y,"data-range-selector":!0,onContextMenu:N=>N.preventDefault(),children:v.jsx(g1,{components:o})})]}),v.jsx("aside",{className:t1.appContainerSidebar,children:v.jsx(E4,{})})]}),n&&v.jsx("footer",{className:t1.appFooter,children:v.jsx(g1,{components:u})}),v.jsx(O4,{})]}),v.jsx(C0,{})]}),v.jsx(g1,{components:m0})]})}var b0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,_0=(e,t,n,r)=>{for(var i=r>1?void 0:r?y0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b0(t,n,i),i},L1=(e,t)=>(n,r)=>t(n,r,e),ei=(e=>(e.HEADER="header",e.HEADER_MENU="header-menu",e.CONTENT="content",e.FOOTER="footer",e.LEFT_SIDEBAR="left-sidebar",e))(ei||{});const L0=3e3;exports.DesktopUIController=class extends L.Disposable{constructor(n,r,i,a,o){super();B(this,"_componentsByPart",new Map);B(this,"_componentRegistered$",new ie.Subject);B(this,"componentRegistered$",this._componentRegistered$.asObservable());this._instanceService=n,this._renderManagerService=r,this._injector=i,this._lifecycleService=a,this._layoutService=o}bootstrapWorkbench(n){this.disposeWithMe(E0(this._injector,n,(r,i)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(i)),this.disposeWithMe(this._layoutService.registerCanvasElement(r))),this._renderManagerService.currentRender$.subscribe(a=>{if(a){const o=this._renderManagerService.getRenderById(a);if(!o.unitId||this._instanceService.getUnitType(o.unitId)!==L.UniverInstanceType.UNIVER_SHEET)return;o.engine.setContainer(r)}}),this._lifecycleService.lifecycle$.pipe(ie.filter(a=>a===L.LifecycleStages.Ready),ie.delay(300),ie.take(1)).subscribe(()=>{var o;const a=(o=this._renderManagerService.getFirst())==null?void 0:o.engine;a==null||a.setContainer(r),this._lifecycleService.stage=L.LifecycleStages.Rendered,setTimeout(()=>this._lifecycleService.stage=L.LifecycleStages.Steady,L0)})}))}registerComponent(n,r){const i=(this._componentsByPart.get(n)||this._componentsByPart.set(n,new Set).get(n)).add(r);return this._componentRegistered$.next(),L.toDisposable(()=>{i.delete(r),i.size===0&&this._componentsByPart.delete(n)})}getComponents(n){return new Set([...this._componentsByPart.get(n)||new Set])}};exports.DesktopUIController=_0([L1(0,L.IUniverInstanceService),L1(1,C1.IRenderManagerService),L1(2,oe.Inject(oe.Injector)),L1(3,oe.Inject(L.LifecycleService)),L1(4,oe.Optional(O1))],exports.DesktopUIController);function E0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const g=document.getElementById(i);g?r=g:r=n3(i)}else i instanceof HTMLElement?r=i:r=n3("univer");const a=le.connectInjector(S0,e),o=e.get(X1),u=g=>n(g,r);function d(){const g=o.getComponents("header"),f=o.getComponents("content"),S=o.getComponents("footer"),y=o.getComponents("header-menu"),_=o.getComponents("left-sidebar");y9(v.jsx(a,{...t,mountContainer:r,headerComponents:g,headerMenuComponents:y,leftSidebarComponents:_,contentComponents:f,onRendered:u,footerComponents:S}),r)}const h=o.componentRegistered$.subscribe(d);return d(),L.toDisposable(()=>{_9(r),h.unsubscribe()})}function n3(e){const t=document.createElement("div");return t.id=e,t}const w0={uiToolbar:{start:"Start",insert:"Insert",formulas:"Formulas",data:"Data",view:"View",others:"Others"},more:"More",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"Microsoft YaHei",SimSun:"SimSun",SimHei:"SimHei",Kaiti:"Kaiti",FangSong:"FangSong",NSimSun:"NSimSun",STXinwei:"STXinwei",STXingkai:"STXingkai",STLiti:"STLiti",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"Shortcuts"},shortcut:{undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste","shortcut-panel":"Toggle Shortcut Panel"},"common-edit":"Common Editing Shortcuts","toggle-shortcut-panel":"Toggle Shortcut Panel",clipboard:{authentication:{title:"Permission Denied",content:"Please allow Univer to access your clipboard."}},textEditor:{formulaError:"Please enter a valid formula, such as =SUM(A1)",rangeError:"Please enter a valid range, such as A1:B10"},rangeSelector:{title:"Select a data range",addAnotherRange:"Add range",buttonTooltip:"Select data range",placeHolder:"Select range or enter.",confirm:"Confirm",cancel:"Cancel"},"global-shortcut":"Global Shortcut"},M0=w0,x0={uiToolbar:{start:"开始",insert:"插入",formulas:"公式",data:"数据",view:"视图",others:"其他"},more:"更多",fontFamily:{TimesNewRoman:"Times New Roman",Arial:"Arial",Tahoma:"Tahoma",Verdana:"Verdana",MicrosoftYaHei:"微软雅黑",SimSun:"宋体",SimHei:"黑体",Kaiti:"楷体",FangSong:"仿宋",NSimSun:"新宋体",STXinwei:"华文新魏",STXingkai:"华文行楷",STLiti:"华文隶书",HanaleiFill:"HanaleiFill",Anton:"Anton",Pacifico:"Pacifico"},"shortcut-panel":{title:"快捷键面板"},shortcut:{undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴","shortcut-panel":"打开收起快捷键面板"},"common-edit":"常用编辑","toggle-shortcut-panel":"打开收起快捷键面板",clipboard:{authentication:{title:"无法访问剪贴板",content:"请允许 Univer 访问您的剪贴板。"}},textEditor:{formulaError:"请输入合法的公式,例如=SUM(A1)",rangeError:"请输入合法的范围,例如 A1:B10"},rangeSelector:{title:"选择一个数据范围",addAnotherRange:"添加范围",buttonTooltip:"选择数据范围",placeHolder:"框选范围或输入",confirm:"确认",cancel:"取消"},"global-shortcut":"全局快捷键"},ti=x0,Ct=oe.createIdentifier("univer.notification-service");var O0=Object.defineProperty,R0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?R0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&O0(t,n,i),i},H0=(e,t)=>(n,r)=>t(n,r,e);const ni=oe.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){B(this,"_beforeUnloadCallbacks",[]);B(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{const n=this._beforeUnloadCallbacks.map(r=>r()).filter(r=>!!r).join(`
41
+ `);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof t>"u"&&(t=window.event),t.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}};exports.DesktopBeforeCloseService=I0([H0(0,Ct)],exports.DesktopBeforeCloseService);function D0(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var T0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,N0=(e,t,n,r)=>{for(var i=r>1?void 0:r?V0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&T0(t,n,i),i},Dt=(e,t)=>(n,r)=>t(n,r,e);const Zt="text/plain",Wt="text/html",ri=oe.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends L.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return D0()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[Zt]:new Blob([t],{type:Zt}),[Wt]:new Blob([n],{type:Wt})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const n=document.activeElement,r=A0();document.body.appendChild(r),r.innerHTML=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=k0();document.body.appendChild(r),r.value=t;try{r3(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}};exports.BrowserClipboardService=N0([Dt(0,oe.Inject(L.LocaleService)),Dt(1,L.ILogService),Dt(2,oe.Optional(Ct))],exports.BrowserClipboardService);function k0(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function A0(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function r3(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}class ii{constructor(){B(this,"_confirmOptions",[]);B(this,"confirmOptions$",new ie.Subject)}open(t){return this._confirmOptions.find(n=>n.id===t.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===t.id?t:n,visible:n.id===t.id?!0:n.visible})):this._confirmOptions.push({...t,visible:!0}),this.confirmOptions$.next(this._confirmOptions),L.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(t){return new Promise(n=>{const r=this.open({...t,onConfirm:()=>{r.dispose(),n(!0)},onClose:()=>{r.dispose(),n(!1)}})})}close(t){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===t?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}}class ai extends L.Disposable{constructor(){super(...arguments);B(this,"_dialogOptions",[]);B(this,"_dialogOptions$",new ie.Subject)}dispose(){super.dispose(),this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,visible:!0})):this._dialogOptions.push({...n,visible:!0}),this._dialogOptions$.next(this._dialogOptions),L.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$}}class oi{constructor(){B(this,"portalContainer",document.body);B(this,"message")}setContainer(t){this.portalContainer=t,this.message=new me.Message(t)}show(t){if(!this.message)throw new Error("[DesktopMessageService]: no message implementation!");const{type:n,...r}=t;return this.message[n](r)}}class si{show(t){return l0.show(t),L.toDisposable(()=>{})}}var j0=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,P0=(e,t,n,r)=>{for(var i=r>1?void 0:r?U0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&j0(t,n,i),i},$0=(e,t)=>(n,r)=>t(n,r,e);exports.DesktopGlobalZoneService=class{constructor(t){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);B(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),this._componentKey=t,L.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=P0([$0(0,oe.Inject(e1))],exports.DesktopGlobalZoneService);class li{constructor(){B(this,"_sidebarOptions",{});B(this,"sidebarOptions$",new ie.Subject)}open(t){return this._sidebarOptions={...t,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),L.toDisposable(()=>{this.sidebarOptions$.complete()})}set(t){this._sidebarOptions={...t},this.sidebarOptions$.next(this._sidebarOptions)}close(){this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose()}}var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,F0=(e,t,n,r)=>{for(var i=r>1?void 0:r?z0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&B0(t,n,i),i},i3=(e,t)=>(n,r)=>t(n,r,e);let Z1=class extends L.Disposable{constructor(e,t){super(),this._errorService=e,this._messageService=t,this.disposeWithMe(L.toDisposable(this._errorService.error$.subscribe(n=>{this._messageService.show({content:n.errorKey,type:me.MessageType.Error})})))}};Z1=F0([L.OnLifecycle(L.LifecycleStages.Starting,Z1),i3(0,oe.Inject(L.ErrorService)),i3(1,ot)],Z1);class ci extends L.Disposable{constructor(){super(...arguments);B(this,"_open$",new ie.BehaviorSubject(!1));B(this,"open$",this._open$.pipe(ie.distinctUntilChanged()))}get isOpen(){return this._open$.getValue()}dispose(){this._open$.next(!1),this._open$.complete()}open(){this._open$.next(!0)}close(){this._open$.next(!1)}}const ui="ShortcutPanel",pn={id:"base-ui.operation.toggle-shortcut-panel",type:L.CommandType.OPERATION,handler:e=>{const t=e.get(ci),n=e.get(st);return t.isOpen?(t.close(),n.close()):(t.open(),n.open({header:{title:"shortcut-panel.title"},children:{label:ui}})),!0}},Z0="univer-shortcut-panel-group-title",W0="univer-shortcut-panel-item",G0="univer-shortcut-panel-item-title",Y0="univer-shortcut-panel-item-shortcut",h1={shortcutPanelGroupTitle:Z0,shortcutPanelItem:W0,shortcutPanelItemTitle:G0,shortcutPanelItemShortcut:Y0};function q0(){const e=le.useDependency(S1),t=le.useDependency(L.LocaleService),[n,r]=s.useState([]),i=s.useCallback(()=>{var d;const a=new Map,o=e.getAllShortcuts().filter(h=>!!h.group);for(const h of o){const g=h.group,f={title:t.t((d=h.description)!=null?d:h.id),shortcut:e.getShortcutDisplay(h)};if(!/\d+_[a-zA-Z0-9]/.test(g))throw new Error(`[ShortcutPanel]: Invalid shortcut group: ${g}!`);a.has(g)||a.set(g,[]),a.get(g).push(f)}const u=Array.from(a.entries()).map(([h,g])=>{const f=h.split("_")[0],S=h.slice(f.length+1);return{sequence:+f,name:t.t(S),items:g}}).sort((h,g)=>h.sequence-g.sequence);r(u)},[e,t]);return s.useEffect(()=>{i();const a=e.shortcutChanged$.subscribe(()=>i());return()=>a.unsubscribe()},[e]),v.jsx("div",{className:h1.shortcutPanel,children:n.map(a=>v.jsxs("div",{className:h1.shortcutPanelGroup,children:[v.jsx("div",{className:h1.shortcutPanelGroupTitle,children:a.name}),a.items.map((o,u)=>v.jsxs("div",{className:h1.shortcutPanelItem,children:[v.jsx("span",{className:h1.shortcutPanelItemTitle,children:o.title}),v.jsx("span",{className:h1.shortcutPanelItemShortcut,children:o.shortcut})]},u))]},a.name))})}function X0(e){return{id:pn.id,title:"toggle-shortcut-panel",tooltip:"toggle-shortcut-panel",icon:"KeyboardSingle",type:Pe.BUTTON,positions:[Ze.TOOLBAR_START],hidden$:a6(e,L.UniverInstanceType.UNIVER_SHEET)}}var Q0=Object.defineProperty,J0=Object.getOwnPropertyDescriptor,K0=(e,t,n,r)=>{for(var i=r>1?void 0:r?J0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Q0(t,n,i),i},E1=(e,t)=>(n,r)=>t(n,r,e);const es={id:pn.id,binding:ke.CTRL_COMMAND|a1.BACK_SLASH,description:"shortcut.shortcut-panel",group:"10_global-shortcut"};let W1=class extends L.Disposable{constructor(e,t,n,r,i){super(),this.disposeWithMe(r.addMenuItem(e.invoke(X0))),this.disposeWithMe(t.register(ui,q0)),this.disposeWithMe(i.registerCommand(pn)),this.disposeWithMe(n.registerShortcut(es))}};W1=K0([L.OnLifecycle(L.LifecycleStages.Steady,W1),E1(0,oe.Inject(oe.Injector)),E1(1,oe.Inject(e1)),E1(2,S1),E1(3,f1),E1(4,L.ICommandService)],W1);function z1(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fi={exports:{}};/*!
42
42
  localForage -- Offline Storage, Improved
43
43
  Version 1.10.0
44
44
  https://localforage.github.io/localForage
45
45
  (c) 2013-2017 Mozilla, Apache License 2.0
46
- */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,g){if(!i[h]){if(!r[h]){var f=typeof z1=="function"&&z1;if(!g&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var y=i[h]={exports:{}};r[h][0].call(y.exports,function(_){var A=r[h][1][_];return o(A||_)},y,y.exports,n,r,i,a)}return i[h].exports}for(var u=typeof z1=="function"&&z1,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(_),g=a.document.createTextNode("");h.observe(g,{characterData:!0}),u=function(){g.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=_,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var O=a.document.createElement("script");O.onreadystatechange=function(){_(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},a.document.documentElement.appendChild(O)}:u=function(){setTimeout(_,0)};var S,y=[];function _(){S=!0;for(var O,N,V=y.length;V;){for(N=y,y=[],O=-1;++O<V;)N[O]();V=y.length}S=!1}r.exports=A;function A(O){y.push(O)===1&&!S&&u()}}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],g=["PENDING"];r.exports=f;function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,w!==o&&A(this,w)}f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,D){if(typeof w!="function"&&this.state===h||typeof D!="function"&&this.state===d)return this;var k=new this.constructor(o);if(this.state!==g){var T=this.state===h?w:D;y(k,T,this.outcome)}else this.queue.push(new S(k,w,D));return k};function S(w,D,k){this.promise=w,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(w){u.resolve(this.promise,w)},S.prototype.otherCallFulfilled=function(w){y(this.promise,this.onFulfilled,w)},S.prototype.callRejected=function(w){u.reject(this.promise,w)},S.prototype.otherCallRejected=function(w){y(this.promise,this.onRejected,w)};function y(w,D,k){a(function(){var T;try{T=D(k)}catch(P){return u.reject(w,P)}T===w?u.reject(w,new TypeError("Cannot resolve promise with itself")):u.resolve(w,T)})}u.resolve=function(w,D){var k=O(_,D);if(k.status==="error")return u.reject(w,k.value);var T=k.value;if(T)A(w,T);else{w.state=h,w.outcome=D;for(var P=-1,Y=w.queue.length;++P<Y;)w.queue[P].callFulfilled(D)}return w},u.reject=function(w,D){w.state=d,w.outcome=D;for(var k=-1,T=w.queue.length;++k<T;)w.queue[k].callRejected(D);return w};function _(w){var D=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof D=="function")return function(){D.apply(w,arguments)}}function A(w,D){var k=!1;function T(Q){k||(k=!0,u.reject(w,Q))}function P(Q){k||(k=!0,u.resolve(w,Q))}function Y(){D(P,T)}var F=O(Y);F.status==="error"&&T(F.value)}function O(w,D){var k={};try{k.value=w(D),k.status="success"}catch(T){k.status="error",k.value=T}return k}f.resolve=N;function N(w){return w instanceof this?w:u.resolve(new this(o),w)}f.reject=V;function V(w){var D=new this(o);return u.reject(D,w)}f.all=z;function z(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=new Array(k),Y=0,F=-1,Q=new this(o);++F<k;)J(w[F],F);return Q;function J(he,ue){D.resolve(he).then(re,function(pe){T||(T=!0,u.reject(Q,pe))});function re(pe){P[ue]=pe,++Y===k&&!T&&(T=!0,u.resolve(Q,P))}}}f.race=W;function W(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=-1,Y=new this(o);++P<k;)F(w[P]);return Y;function F(Q){D.resolve(Q).then(function(J){T||(T=!0,u.resolve(Y,J))},function(J){T||(T=!0,u.reject(Y,J))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function g(l,p){l=l||[],p=p||{};try{return new Blob(l,p)}catch(m){if(m.name!=="TypeError")throw m;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(p.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,p){p&&l.then(function(c){p(null,c)},function(c){p(c)})}function y(l,p,c){typeof p=="function"&&l.then(p),typeof c=="function"&&l.catch(c)}function _(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",N=void 0,V={},z=Object.prototype.toString,W="readonly",w="readwrite";function D(l){for(var p=l.length,c=new ArrayBuffer(p),C=new Uint8Array(c),b=0;b<p;b++)C[b]=l.charCodeAt(b);return c}function k(l){return new f(function(p){var c=l.transaction(O,w),C=g([""]);c.objectStore(O).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),p(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),m=navigator.userAgent.match(/Edge\//);p(m||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function T(l){return typeof N=="boolean"?f.resolve(N):k(l).then(function(p){return N=p,N})}function P(l){var p=V[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),p.deferredOperations.push(c),p.dbReady?p.dbReady=p.dbReady.then(function(){return c.promise}):p.dbReady=c.promise}function Y(l){var p=V[l.name],c=p.deferredOperations.pop();if(c)return c.resolve(),c.promise}function F(l,p){var c=V[l.name],C=c.deferredOperations.pop();if(C)return C.reject(p),C.promise}function Q(l,p){return new f(function(c,C){if(V[l.name]=V[l.name]||G(),l.db)if(p)P(l),l.db.close();else return c(l.db);var b=[l.name];p&&b.push(l.version);var m=d.open.apply(d,b);p&&(m.onupgradeneeded=function(x){var H=m.result;try{H.createObjectStore(l.storeName),x.oldVersion<=1&&H.createObjectStore(O)}catch(j){if(j.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+x.oldVersion+" to version "+x.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw j}}),m.onerror=function(x){x.preventDefault(),C(m.error)},m.onsuccess=function(){var x=m.result;x.onversionchange=function(H){H.target.close()},c(x),Y(l)}})}function J(l){return Q(l,!1)}function he(l){return Q(l,!0)}function ue(l,p){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==p&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var m=l.db.version+1;m>l.version&&(l.version=m)}return!0}return!1}function re(l){return new f(function(p,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var m=btoa(b.target.result||"");p({__local_forage_encoded_blob:!0,data:m,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var p=D(atob(l.data));return g([p],{type:l.type})}function Le(l){return l&&l.__local_forage_encoded_blob}function M(l){var p=this,c=p._initReady().then(function(){var C=V[p._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return y(c,l,l),c}function E(l){P(l);for(var p=V[l.name],c=p.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,J(l).then(function(m){return l.db=m,ue(l)?he(l):m}).then(function(m){l.db=p.db=m;for(var x=0;x<c.length;x++)c[x]._dbInfo.db=m}).catch(function(m){throw F(l,m),m})}function R(l,p,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,p);c(null,b)}catch(m){if(C>0&&(!l.db||m.name==="InvalidStateError"||m.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||m.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),he(l)}).then(function(){return E(l).then(function(){R(l,p,c,C-1)})}).catch(c);c(m)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Z(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=V[c.name];b||(b=G(),V[c.name]=b),b.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=M);var m=[];function x(){return f.resolve()}for(var H=0;H<b.forages.length;H++){var j=b.forages[H];j!==p&&m.push(j._initReady().catch(x))}var U=b.forages.slice(0);return f.all(m).then(function(){return c.db=b.db,J(c)}).then(function($){return c.db=$,ue(c,p._defaultConfig.version)?he(c):$}).then(function($){c.db=b.db=$,p._dbInfo=c;for(var X=0;X<U.length;X++){var ce=U[X];ce!==p&&(ce._dbInfo.db=c.db,ce._dbInfo.version=c.version)}})}function q(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.get(l);U.onsuccess=function(){var $=U.result;$===void 0&&($=null),Le($)&&($=pe($)),b($)},U.onerror=function(){m(U.error)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function ne(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.openCursor(),$=1;U.onsuccess=function(){var X=U.result;if(X){var ce=X.value;Le(ce)&&(ce=pe(ce));var ve=l(ce,X.key,$++);ve!==void 0?b(ve):X.continue()}else b()},U.onerror=function(){m(U.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function ae(l,p,c){var C=this;l=_(l);var b=new f(function(m,x){var H;C.ready().then(function(){return H=C._dbInfo,z.call(p)==="[object Blob]"?T(H.db).then(function(j){return j?p:re(p)}):p}).then(function(j){R(C._dbInfo,w,function(U,$){if(U)return x(U);try{var X=$.objectStore(C._dbInfo.storeName);j===null&&(j=void 0);var ce=X.put(j,l);$.oncomplete=function(){j===void 0&&(j=null),m(j)},$.onabort=$.onerror=function(){var ve=ce.error?ce.error:ce.transaction.error;x(ve)}}catch(ve){x(ve)}})}).catch(x)});return S(b,c),b}function _e(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,w,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.delete(l);H.oncomplete=function(){b()},H.onerror=function(){m(U.error)},H.onabort=function(){var $=U.error?U.error:U.transaction.error;m($)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function Ie(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,w,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.clear();x.oncomplete=function(){C()},x.onabort=x.onerror=function(){var U=j.error?j.error:j.transaction.error;b(U)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function xe(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.count();j.onsuccess=function(){C(j.result)},j.onerror=function(){b(j.error)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function Ee(l,p){var c=this,C=new f(function(b,m){if(l<0){b(null);return}c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=!1,$=j.openKeyCursor();$.onsuccess=function(){var X=$.result;if(!X){b(null);return}l===0||U?b(X.key):(U=!0,X.advance(l))},$.onerror=function(){m($.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function Ye(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.openKeyCursor(),U=[];j.onsuccess=function(){var $=j.result;if(!$){C(U);return}U.push($.key),$.continue()},j.onerror=function(){b(j.error)}}catch($){b($)}})}).catch(b)});return S(c,l),c}function Be(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var m=l.name===c.name&&C._dbInfo.db,x=m?f.resolve(C._dbInfo.db):J(l).then(function(H){var j=V[l.name],U=j.forages;j.db=H;for(var $=0;$<U.length;$++)U[$]._dbInfo.db=H;return H});l.storeName?b=x.then(function(H){if(H.objectStoreNames.contains(l.storeName)){var j=H.version+1;P(l);var U=V[l.name],$=U.forages;H.close();for(var X=0;X<$.length;X++){var ce=$[X];ce._dbInfo.db=null,ce._dbInfo.version=j}var ve=new f(function(be,Re){var Me=d.open(l.name,j);Me.onerror=function(ze){var y1=Me.result;y1.close(),Re(ze)},Me.onupgradeneeded=function(){var ze=Me.result;ze.deleteObjectStore(l.storeName)},Me.onsuccess=function(){var ze=Me.result;ze.close(),be(ze)}});return ve.then(function(be){U.db=be;for(var Re=0;Re<$.length;Re++){var Me=$[Re];Me._dbInfo.db=be,Y(Me._dbInfo)}}).catch(function(be){throw(F(l,be)||f.resolve()).catch(function(){}),be})}}):b=x.then(function(H){P(l);var j=V[l.name],U=j.forages;H.close();for(var $=0;$<U.length;$++){var X=U[$];X._dbInfo.db=null}var ce=new f(function(ve,be){var Re=d.deleteDatabase(l.name);Re.onerror=function(){var Me=Re.result;Me&&Me.close(),be(Re.error)},Re.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},Re.onsuccess=function(){var Me=Re.result;Me&&Me.close(),ve(Me)}});return ce.then(function(ve){j.db=ve;for(var be=0;be<U.length;be++){var Re=U[be];Y(Re._dbInfo)}}).catch(function(ve){throw(F(l,ve)||f.resolve()).catch(function(){}),ve})})}return S(b,p),b}var Ue={_driver:"asyncStorage",_initStorage:Z,_support:h(),iterate:ne,getItem:q,setItem:ae,removeItem:_e,clear:Ie,length:xe,key:Ee,keys:Ye,dropInstance:Be};function se(){return typeof openDatabase=="function"}var ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se="~~local_forage_type~",Ne=/^~~local_forage_type~([^~]+)~/,Oe="__lfsc__:",we=Oe.length,de="arbf",ge="blob",je="si08",Je="ui08",o1="uic8",Ke="si16",D1="si32",Cn="ur16",Sn="ui32",bn="fl32",yn="fl64",_n=we+de.length,Ln=Object.prototype.toString;function En(l){var p=l.length*.75,c=l.length,C,b=0,m,x,H,j;l[l.length-1]==="="&&(p--,l[l.length-2]==="="&&p--);var U=new ArrayBuffer(p),$=new Uint8Array(U);for(C=0;C<c;C+=4)m=ee.indexOf(l[C]),x=ee.indexOf(l[C+1]),H=ee.indexOf(l[C+2]),j=ee.indexOf(l[C+3]),$[b++]=m<<2|x>>4,$[b++]=(x&15)<<4|H>>2,$[b++]=(H&3)<<6|j&63;return U}function bt(l){var p=new Uint8Array(l),c="",C;for(C=0;C<p.length;C+=3)c+=ee[p[C]>>2],c+=ee[(p[C]&3)<<4|p[C+1]>>4],c+=ee[(p[C+1]&15)<<2|p[C+2]>>6],c+=ee[p[C+2]&63];return p.length%3===2?c=c.substring(0,c.length-1)+"=":p.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function Si(l,p){var c="";if(l&&(c=Ln.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&Ln.call(l.buffer)==="[object ArrayBuffer]")){var C,b=Oe;l instanceof ArrayBuffer?(C=l,b+=de):(C=l.buffer,c==="[object Int8Array]"?b+=je:c==="[object Uint8Array]"?b+=Je:c==="[object Uint8ClampedArray]"?b+=o1:c==="[object Int16Array]"?b+=Ke:c==="[object Uint16Array]"?b+=Cn:c==="[object Int32Array]"?b+=D1:c==="[object Uint32Array]"?b+=Sn:c==="[object Float32Array]"?b+=bn:c==="[object Float64Array]"?b+=yn:p(new Error("Failed to get type for BinaryArray"))),p(b+bt(C))}else if(c==="[object Blob]"){var m=new FileReader;m.onload=function(){var x=Se+l.type+"~"+bt(this.result);p(Oe+ge+x)},m.readAsArrayBuffer(l)}else try{p(JSON.stringify(l))}catch(x){console.error("Couldn't convert value into a JSON string: ",l),p(null,x)}}function bi(l){if(l.substring(0,we)!==Oe)return JSON.parse(l);var p=l.substring(_n),c=l.substring(we,_n),C;if(c===ge&&Ne.test(p)){var b=p.match(Ne);C=b[1],p=p.substring(b[0].length)}var m=En(p);switch(c){case de:return m;case ge:return g([m],{type:C});case je:return new Int8Array(m);case Je:return new Uint8Array(m);case o1:return new Uint8ClampedArray(m);case Ke:return new Int16Array(m);case Cn:return new Uint16Array(m);case D1:return new Int32Array(m);case Sn:return new Uint32Array(m);case bn:return new Float32Array(m);case yn:return new Float64Array(m);default:throw new Error("Unkown type: "+c)}}var yt={serialize:Si,deserialize:bi,stringToBuffer:En,bufferToString:bt};function wn(l,p,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function yi(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(m,x){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(H){return x(H)}c.db.transaction(function(H){wn(H,c,function(){p._dbInfo=c,m()},function(j,U){x(U)})},x)});return c.serializer=yt,b}function r1(l,p,c,C,b,m){l.executeSql(c,C,b,function(x,H){H.code===H.SYNTAX_ERR?x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(j,U){U.rows.length?m(j,H):wn(j,p,function(){j.executeSql(c,C,b,m)},m)},m):m(x,H)},m)}function _i(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName+" WHERE key = ? LIMIT 1",[l],function(j,U){var $=U.rows.length?U.rows.item(0).value:null;$&&($=x.serializer.deserialize($)),b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Li(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName,[],function(j,U){for(var $=U.rows,X=$.length,ce=0;ce<X;ce++){var ve=$.item(ce),be=ve.value;if(be&&(be=x.serializer.deserialize(be)),be=l(be,ve.key,ce+1),be!==void 0){b(be);return}}b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mn(l,p,c,C){var b=this;l=_(l);var m=new f(function(x,H){b.ready().then(function(){p===void 0&&(p=null);var j=p,U=b._dbInfo;U.serializer.serialize(p,function($,X){X?H(X):U.db.transaction(function(ce){r1(ce,U,"INSERT OR REPLACE INTO "+U.storeName+" (key, value) VALUES (?, ?)",[l,$],function(){x(j)},function(ve,be){H(be)})},function(ce){if(ce.code===ce.QUOTA_ERR){if(C>0){x(Mn.apply(b,[l,j,c,C-1]));return}H(ce)}})})}).catch(H)});return S(m,c),m}function Ei(l,p,c){return Mn.apply(this,[l,p,c,1])}function wi(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"DELETE FROM "+x.storeName+" WHERE key = ?",[l],function(){b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"DELETE FROM "+m.storeName,[],function(){C()},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function xi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT COUNT(key) as c FROM "+m.storeName,[],function(H,j){var U=j.rows.item(0).c;C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Oi(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT key FROM "+x.storeName+" WHERE id = ? LIMIT 1",[l+1],function(j,U){var $=U.rows.length?U.rows.item(0).key:null;b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Ri(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT key FROM "+m.storeName,[],function(H,j){for(var U=[],$=0;$<j.rows.length;$++)U.push(j.rows.item($).key);C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Ii(l){return new f(function(p,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,m){for(var x=[],H=0;H<m.rows.length;H++)x.push(m.rows.item(H).name);p({db:l,storeNames:x})},function(b,m){c(m)})},function(C){c(C)})})}function Hi(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(m){var x;l.name===c.name?x=C._dbInfo.db:x=openDatabase(l.name,"","",0),l.storeName?m({db:x,storeNames:[l.storeName]}):m(Ii(x))}).then(function(m){return new f(function(x,H){m.db.transaction(function(j){function U(ve){return new f(function(be,Re){j.executeSql("DROP TABLE IF EXISTS "+ve,[],function(){be()},function(Me,ze){Re(ze)})})}for(var $=[],X=0,ce=m.storeNames.length;X<ce;X++)$.push(U(m.storeNames[X]));f.all($).then(function(){x()}).catch(function(ve){H(ve)})},function(j){H(j)})})}):b=f.reject("Invalid arguments"),S(b,p),b}var Di={_driver:"webSQLStorage",_initStorage:yi,_support:se(),iterate:Li,getItem:_i,setItem:Ei,removeItem:wi,clear:Mi,length:xi,key:Oi,keys:Ri,dropInstance:Hi};function Ti(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function xn(l,p){var c=l.name+"/";return l.storeName!==p.storeName&&(c+=l.storeName+"/"),c}function Vi(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function Ni(){return!Vi()||localStorage.length>0}function ki(l){var p=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=xn(l,p._defaultConfig),Ni()?(p._dbInfo=c,c.serializer=yt,f.resolve()):f.reject()}function Ai(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var m=localStorage.key(b);m.indexOf(C)===0&&localStorage.removeItem(m)}});return S(c,l),c}function ji(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo,m=localStorage.getItem(b.keyPrefix+l);return m&&(m=b.serializer.deserialize(m)),m});return S(C,p),C}function Ui(l,p){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,m=b.keyPrefix,x=m.length,H=localStorage.length,j=1,U=0;U<H;U++){var $=localStorage.key(U);if($.indexOf(m)===0){var X=localStorage.getItem($);if(X&&(X=b.serializer.deserialize(X)),X=l(X,$.substring(x),j++),X!==void 0)return X}}});return S(C,p),C}function Pi(l,p){var c=this,C=c.ready().then(function(){var b=c._dbInfo,m;try{m=localStorage.key(l)}catch{m=null}return m&&(m=m.substring(b.keyPrefix.length)),m});return S(C,p),C}function $i(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo,b=localStorage.length,m=[],x=0;x<b;x++){var H=localStorage.key(x);H.indexOf(C.keyPrefix)===0&&m.push(H.substring(C.keyPrefix.length))}return m});return S(c,l),c}function Bi(l){var p=this,c=p.keys().then(function(C){return C.length});return S(c,l),c}function zi(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,p),C}function Fi(l,p,c){var C=this;l=_(l);var b=C.ready().then(function(){p===void 0&&(p=null);var m=p;return new f(function(x,H){var j=C._dbInfo;j.serializer.serialize(p,function(U,$){if($)H($);else try{localStorage.setItem(j.keyPrefix+l,U),x(m)}catch(X){(X.name==="QuotaExceededError"||X.name==="NS_ERROR_DOM_QUOTA_REACHED")&&H(X),H(X)}})})});return S(b,c),b}function Zi(l,p){if(p=A.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(m){l.storeName?m(xn(l,C._defaultConfig)):m(l.name+"/")}).then(function(m){for(var x=localStorage.length-1;x>=0;x--){var H=localStorage.key(x);H.indexOf(m)===0&&localStorage.removeItem(H)}}):b=f.reject("Invalid arguments"),S(b,p),b}var Wi={_driver:"localStorageWrapper",_initStorage:ki,_support:Ti(),iterate:Ui,getItem:ji,setItem:Fi,removeItem:zi,clear:Ai,length:Bi,key:Pi,keys:$i,dropInstance:Zi},Gi=function(p,c){return p===c||typeof p=="number"&&typeof c=="number"&&isNaN(p)&&isNaN(c)},Yi=function(p,c){for(var C=p.length,b=0;b<C;){if(Gi(p[b],c))return!0;b++}return!1},On=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},b1={},Rn={},d1={INDEXEDDB:Ue,WEBSQL:Di,LOCALSTORAGE:Wi},qi=[d1.INDEXEDDB._driver,d1.WEBSQL._driver,d1.LOCALSTORAGE._driver],T1=["dropInstance"],_t=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(T1),Xi={description:"",driver:qi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qi(l,p){l[p]=function(){var c=arguments;return l.ready().then(function(){return l[p].apply(l,c)})}}function Lt(){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var c in p)p.hasOwnProperty(c)&&(On(p[c])?arguments[0][c]=p[c].slice():arguments[0][c]=p[c])}return arguments[0]}var Ji=function(){function l(p){o(this,l);for(var c in d1)if(d1.hasOwnProperty(c)){var C=d1[c],b=C._driver;this[c]=b,b1[b]||this.defineDriver(C)}this._defaultConfig=Lt({},Xi),this._config=Lt({},this._defaultConfig,p),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var m=new f(function(x,H){try{var j=c._driver,U=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){H(U);return}for(var $=_t.concat("_initStorage"),X=0,ce=$.length;X<ce;X++){var ve=$[X],be=!Yi(T1,ve);if((be||c[ve])&&typeof c[ve]!="function"){H(U);return}}var Re=function(){for(var y1=function(ta){return function(){var na=new Error("Method "+ta+" is not implemented by the current driver"),In=f.reject(na);return S(In,arguments[arguments.length-1]),In}},Et=0,ea=T1.length;Et<ea;Et++){var wt=T1[Et];c[wt]||(c[wt]=y1(wt))}};Re();var Me=function(y1){b1[j]&&console.info("Redefining LocalForage driver: "+j),b1[j]=c,Rn[j]=y1,x()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Me,H):Me(!!c._support):Me(!0)}catch(ze){H(ze)}});return y(m,C,b),m},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var m=b1[c]?f.resolve(b1[c]):f.reject(new Error("Driver not found."));return y(m,C,b),m},l.prototype.getSerializer=function(c){var C=f.resolve(yt);return y(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return y(b,c,c),b},l.prototype.setDriver=function(c,C,b){var m=this;On(c)||(c=[c]);var x=this._getSupportedDrivers(c);function H(){m._config.driver=m.driver()}function j(X){return m._extend(X),H(),m._ready=m._initStorage(m._config),m._ready}function U(X){return function(){var ce=0;function ve(){for(;ce<X.length;){var be=X[ce];return ce++,m._dbInfo=null,m._ready=null,m.getDriver(be).then(j).catch(ve)}H();var Re=new Error("No available storage method found.");return m._driverSet=f.reject(Re),m._driverSet}return ve()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=$.then(function(){var X=x[0];return m._dbInfo=null,m._ready=null,m.getDriver(X).then(function(ce){m._driver=ce._driver,H(),m._wrapLibraryMethodsWithReady(),m._initDriver=U(x)})}).catch(function(){H();var X=new Error("No available storage method found.");return m._driverSet=f.reject(X),m._driverSet}),y(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!Rn[c]},l.prototype._extend=function(c){Lt(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,m=c.length;b<m;b++){var x=c[b];this.supports(x)&&C.push(x)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=_t.length;c<C;c++)Qi(this,_t[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),Ki=new Ji;r.exports=Ki},{3:3}]},{},[4])(4)})})(fi);var ts=fi.exports;const l1=o6(ts);class di{getItem(t){return l1.getItem(t)}setItem(t,n){return l1.setItem(t,n)}removeItem(t){return l1.removeItem(t)}clear(){return l1.clear()}key(t){return l1.key(t)}keys(){return l1.keys()}iterate(t){return l1.iterate(t)}}var ns=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(e,t,n,r)=>{for(var i=r>1?void 0:r?rs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ns(t,n,i),i},as=(e,t)=>(n,r)=>t(n,r,e);let Gt=class{constructor(e){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),L.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};Gt=is([as(0,oe.Inject(e1))],Gt);class os extends L.Disposable{constructor(){super(...arguments);B(this,"_currentSelectorId");B(this,"_selectionChange$",new ie.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());B(this,"_openSelector$",new ie.Subject);B(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const gn=oe.createIdentifier("univer.range-selector.service");class ss extends L.Disposable{constructor(){super(...arguments);B(this,"_taskCount",0);B(this,"_progressChange$",new ie.Subject);B(this,"_progressVisible$",new ie.Subject);B(this,"progressChange$",this._progressChange$.asObservable());B(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const mn=oe.createIdentifier("univer.progress.service");var ls=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ls(t,n,i),i},Tt=(e,t)=>(n,r)=>t(n,r,e);const fs="ui",hi="DISABLE_AUTO_FOCUS";var Vt;exports.UniverUIPlugin=(Vt=class extends L.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:ti}),this._config.disableAutoFocus&&this._contextService.setContextValue(hi,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){[[e1],[Y1],[ci],[O1,{useClass:exports.DesktopLayoutService}],[S1,{useClass:exports.DesktopShortcutService}],[Jt,{useClass:u6}],[f1,{useClass:exports.DesktopMenuService}],[un,{useClass:J6}],[ri,{useClass:exports.BrowserClipboardService,lazy:!0}],[Ct,{useClass:si,lazy:!0}],[fn,{useClass:ai,lazy:!0}],[cn,{useClass:ii,lazy:!0}],[st,{useClass:li,lazy:!0}],[nn,{useClass:Gt,lazy:!0}],[dn,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[ot,{useClass:oi,lazy:!0}],[L.ILocalStorageService,{useClass:di,lazy:!0}],[ni,{useClass:exports.DesktopBeforeCloseService}],[x1,{useClass:exports.EditorService}],[gn,{useClass:os}],[hn,{useClass:K6}],[mn,{useClass:ss}],[X1,{useClass:exports.DesktopUIController}],[exports.SharedController],[Z1],[W1]].forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(X1).bootstrapWorkbench(this._config))}},B(Vt,"pluginName",fs),Vt);exports.UniverUIPlugin=us([Tt(1,L.IContextService),Tt(2,oe.Inject(oe.Injector)),Tt(3,oe.Inject(L.LocaleService))],exports.UniverUIPlugin);function G1(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const ds=.75,a3=78,o3=9,pi="rgba(0,0,0,0)",gi="rgb(0,0,0)";function vn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
46
+ */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,a){function o(h,g){if(!i[h]){if(!r[h]){var f=typeof z1=="function"&&z1;if(!g&&f)return f(h,!0);if(u)return u(h,!0);var S=new Error("Cannot find module '"+h+"'");throw S.code="MODULE_NOT_FOUND",S}var y=i[h]={exports:{}};r[h][0].call(y.exports,function(_){var A=r[h][1][_];return o(A||_)},y,y.exports,n,r,i,a)}return i[h].exports}for(var u=typeof z1=="function"&&z1,d=0;d<a.length;d++)o(a[d]);return o}({1:[function(n,r,i){(function(a){var o=a.MutationObserver||a.WebKitMutationObserver,u;if(o){var d=0,h=new o(_),g=a.document.createTextNode("");h.observe(g,{characterData:!0}),u=function(){g.data=d=++d%2}}else if(!a.setImmediate&&typeof a.MessageChannel<"u"){var f=new a.MessageChannel;f.port1.onmessage=_,u=function(){f.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?u=function(){var O=a.document.createElement("script");O.onreadystatechange=function(){_(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},a.document.documentElement.appendChild(O)}:u=function(){setTimeout(_,0)};var S,y=[];function _(){S=!0;for(var O,N,V=y.length;V;){for(N=y,y=[],O=-1;++O<V;)N[O]();V=y.length}S=!1}r.exports=A;function A(O){y.push(O)===1&&!S&&u()}}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var a=n(1);function o(){}var u={},d=["REJECTED"],h=["FULFILLED"],g=["PENDING"];r.exports=f;function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=g,this.queue=[],this.outcome=void 0,w!==o&&A(this,w)}f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,D){if(typeof w!="function"&&this.state===h||typeof D!="function"&&this.state===d)return this;var k=new this.constructor(o);if(this.state!==g){var T=this.state===h?w:D;y(k,T,this.outcome)}else this.queue.push(new S(k,w,D));return k};function S(w,D,k){this.promise=w,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}S.prototype.callFulfilled=function(w){u.resolve(this.promise,w)},S.prototype.otherCallFulfilled=function(w){y(this.promise,this.onFulfilled,w)},S.prototype.callRejected=function(w){u.reject(this.promise,w)},S.prototype.otherCallRejected=function(w){y(this.promise,this.onRejected,w)};function y(w,D,k){a(function(){var T;try{T=D(k)}catch(P){return u.reject(w,P)}T===w?u.reject(w,new TypeError("Cannot resolve promise with itself")):u.resolve(w,T)})}u.resolve=function(w,D){var k=O(_,D);if(k.status==="error")return u.reject(w,k.value);var T=k.value;if(T)A(w,T);else{w.state=h,w.outcome=D;for(var P=-1,Y=w.queue.length;++P<Y;)w.queue[P].callFulfilled(D)}return w},u.reject=function(w,D){w.state=d,w.outcome=D;for(var k=-1,T=w.queue.length;++k<T;)w.queue[k].callRejected(D);return w};function _(w){var D=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof D=="function")return function(){D.apply(w,arguments)}}function A(w,D){var k=!1;function T(Q){k||(k=!0,u.reject(w,Q))}function P(Q){k||(k=!0,u.resolve(w,Q))}function Y(){D(P,T)}var F=O(Y);F.status==="error"&&T(F.value)}function O(w,D){var k={};try{k.value=w(D),k.status="success"}catch(T){k.status="error",k.value=T}return k}f.resolve=N;function N(w){return w instanceof this?w:u.resolve(new this(o),w)}f.reject=V;function V(w){var D=new this(o);return u.reject(D,w)}f.all=z;function z(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=new Array(k),Y=0,F=-1,Q=new this(o);++F<k;)J(w[F],F);return Q;function J(he,ue){D.resolve(he).then(re,function(pe){T||(T=!0,u.reject(Q,pe))});function re(pe){P[ue]=pe,++Y===k&&!T&&(T=!0,u.resolve(Q,P))}}}f.race=W;function W(w){var D=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,T=!1;if(!k)return this.resolve([]);for(var P=-1,Y=new this(o);++P<k;)F(w[P]);return Y;function F(Q){D.resolve(Q).then(function(J){T||(T=!0,u.resolve(Y,J))},function(J){T||(T=!0,u.reject(Y,J))})}}},{1:1}],3:[function(n,r,i){(function(a){typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof N1<"u"?N1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function o(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var d=u();function h(){try{if(!d||!d.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function g(l,p){l=l||[],p=p||{};try{return new Blob(l,p)}catch(m){if(m.name!=="TypeError")throw m;for(var c=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new c,b=0;b<l.length;b+=1)C.append(l[b]);return C.getBlob(p.type)}}typeof Promise>"u"&&n(3);var f=Promise;function S(l,p){p&&l.then(function(c){p(null,c)},function(c){p(c)})}function y(l,p,c){typeof p=="function"&&l.then(p),typeof c=="function"&&l.catch(c)}function _(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",N=void 0,V={},z=Object.prototype.toString,W="readonly",w="readwrite";function D(l){for(var p=l.length,c=new ArrayBuffer(p),C=new Uint8Array(c),b=0;b<p;b++)C[b]=l.charCodeAt(b);return c}function k(l){return new f(function(p){var c=l.transaction(O,w),C=g([""]);c.objectStore(O).put(C,"key"),c.onabort=function(b){b.preventDefault(),b.stopPropagation(),p(!1)},c.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),m=navigator.userAgent.match(/Edge\//);p(m||!b||parseInt(b[1],10)>=43)}}).catch(function(){return!1})}function T(l){return typeof N=="boolean"?f.resolve(N):k(l).then(function(p){return N=p,N})}function P(l){var p=V[l.name],c={};c.promise=new f(function(C,b){c.resolve=C,c.reject=b}),p.deferredOperations.push(c),p.dbReady?p.dbReady=p.dbReady.then(function(){return c.promise}):p.dbReady=c.promise}function Y(l){var p=V[l.name],c=p.deferredOperations.pop();if(c)return c.resolve(),c.promise}function F(l,p){var c=V[l.name],C=c.deferredOperations.pop();if(C)return C.reject(p),C.promise}function Q(l,p){return new f(function(c,C){if(V[l.name]=V[l.name]||G(),l.db)if(p)P(l),l.db.close();else return c(l.db);var b=[l.name];p&&b.push(l.version);var m=d.open.apply(d,b);p&&(m.onupgradeneeded=function(x){var H=m.result;try{H.createObjectStore(l.storeName),x.oldVersion<=1&&H.createObjectStore(O)}catch(j){if(j.name==="ConstraintError")console.warn('The database "'+l.name+'" has been upgraded from version '+x.oldVersion+" to version "+x.newVersion+', but the storage "'+l.storeName+'" already exists.');else throw j}}),m.onerror=function(x){x.preventDefault(),C(m.error)},m.onsuccess=function(){var x=m.result;x.onversionchange=function(H){H.target.close()},c(x),Y(l)}})}function J(l){return Q(l,!1)}function he(l){return Q(l,!0)}function ue(l,p){if(!l.db)return!0;var c=!l.db.objectStoreNames.contains(l.storeName),C=l.version<l.db.version,b=l.version>l.db.version;if(C&&(l.version!==p&&console.warn('The database "'+l.name+`" can't be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),b||c){if(c){var m=l.db.version+1;m>l.version&&(l.version=m)}return!0}return!1}function re(l){return new f(function(p,c){var C=new FileReader;C.onerror=c,C.onloadend=function(b){var m=btoa(b.target.result||"");p({__local_forage_encoded_blob:!0,data:m,type:l.type})},C.readAsBinaryString(l)})}function pe(l){var p=D(atob(l.data));return g([p],{type:l.type})}function Le(l){return l&&l.__local_forage_encoded_blob}function M(l){var p=this,c=p._initReady().then(function(){var C=V[p._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return y(c,l,l),c}function E(l){P(l);for(var p=V[l.name],c=p.forages,C=0;C<c.length;C++){var b=c[C];b._dbInfo.db&&(b._dbInfo.db.close(),b._dbInfo.db=null)}return l.db=null,J(l).then(function(m){return l.db=m,ue(l)?he(l):m}).then(function(m){l.db=p.db=m;for(var x=0;x<c.length;x++)c[x]._dbInfo.db=m}).catch(function(m){throw F(l,m),m})}function R(l,p,c,C){C===void 0&&(C=1);try{var b=l.db.transaction(l.storeName,p);c(null,b)}catch(m){if(C>0&&(!l.db||m.name==="InvalidStateError"||m.name==="NotFoundError"))return f.resolve().then(function(){if(!l.db||m.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),he(l)}).then(function(){return E(l).then(function(){R(l,p,c,C-1)})}).catch(c);c(m)}}function G(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Z(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=l[C];var b=V[c.name];b||(b=G(),V[c.name]=b),b.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=M);var m=[];function x(){return f.resolve()}for(var H=0;H<b.forages.length;H++){var j=b.forages[H];j!==p&&m.push(j._initReady().catch(x))}var U=b.forages.slice(0);return f.all(m).then(function(){return c.db=b.db,J(c)}).then(function($){return c.db=$,ue(c,p._defaultConfig.version)?he(c):$}).then(function($){c.db=b.db=$,p._dbInfo=c;for(var X=0;X<U.length;X++){var ce=U[X];ce!==p&&(ce._dbInfo.db=c.db,ce._dbInfo.version=c.version)}})}function q(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.get(l);U.onsuccess=function(){var $=U.result;$===void 0&&($=null),Le($)&&($=pe($)),b($)},U.onerror=function(){m(U.error)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function ne(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.openCursor(),$=1;U.onsuccess=function(){var X=U.result;if(X){var ce=X.value;Le(ce)&&(ce=pe(ce));var ve=l(ce,X.key,$++);ve!==void 0?b(ve):X.continue()}else b()},U.onerror=function(){m(U.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function ae(l,p,c){var C=this;l=_(l);var b=new f(function(m,x){var H;C.ready().then(function(){return H=C._dbInfo,z.call(p)==="[object Blob]"?T(H.db).then(function(j){return j?p:re(p)}):p}).then(function(j){R(C._dbInfo,w,function(U,$){if(U)return x(U);try{var X=$.objectStore(C._dbInfo.storeName);j===null&&(j=void 0);var ce=X.put(j,l);$.oncomplete=function(){j===void 0&&(j=null),m(j)},$.onabort=$.onerror=function(){var ve=ce.error?ce.error:ce.transaction.error;x(ve)}}catch(ve){x(ve)}})}).catch(x)});return S(b,c),b}function _e(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){R(c._dbInfo,w,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=j.delete(l);H.oncomplete=function(){b()},H.onerror=function(){m(U.error)},H.onabort=function(){var $=U.error?U.error:U.transaction.error;m($)}}catch($){m($)}})}).catch(m)});return S(C,p),C}function Ie(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,w,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.clear();x.oncomplete=function(){C()},x.onabort=x.onerror=function(){var U=j.error?j.error:j.transaction.error;b(U)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function xe(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.count();j.onsuccess=function(){C(j.result)},j.onerror=function(){b(j.error)}}catch(U){b(U)}})}).catch(b)});return S(c,l),c}function Ee(l,p){var c=this,C=new f(function(b,m){if(l<0){b(null);return}c.ready().then(function(){R(c._dbInfo,W,function(x,H){if(x)return m(x);try{var j=H.objectStore(c._dbInfo.storeName),U=!1,$=j.openKeyCursor();$.onsuccess=function(){var X=$.result;if(!X){b(null);return}l===0||U?b(X.key):(U=!0,X.advance(l))},$.onerror=function(){m($.error)}}catch(X){m(X)}})}).catch(m)});return S(C,p),C}function Ye(l){var p=this,c=new f(function(C,b){p.ready().then(function(){R(p._dbInfo,W,function(m,x){if(m)return b(m);try{var H=x.objectStore(p._dbInfo.storeName),j=H.openKeyCursor(),U=[];j.onsuccess=function(){var $=j.result;if(!$){C(U);return}U.push($.key),$.continue()},j.onerror=function(){b(j.error)}}catch($){b($)}})}).catch(b)});return S(c,l),c}function Be(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;if(!l.name)b=f.reject("Invalid arguments");else{var m=l.name===c.name&&C._dbInfo.db,x=m?f.resolve(C._dbInfo.db):J(l).then(function(H){var j=V[l.name],U=j.forages;j.db=H;for(var $=0;$<U.length;$++)U[$]._dbInfo.db=H;return H});l.storeName?b=x.then(function(H){if(H.objectStoreNames.contains(l.storeName)){var j=H.version+1;P(l);var U=V[l.name],$=U.forages;H.close();for(var X=0;X<$.length;X++){var ce=$[X];ce._dbInfo.db=null,ce._dbInfo.version=j}var ve=new f(function(be,Re){var Me=d.open(l.name,j);Me.onerror=function(ze){var y1=Me.result;y1.close(),Re(ze)},Me.onupgradeneeded=function(){var ze=Me.result;ze.deleteObjectStore(l.storeName)},Me.onsuccess=function(){var ze=Me.result;ze.close(),be(ze)}});return ve.then(function(be){U.db=be;for(var Re=0;Re<$.length;Re++){var Me=$[Re];Me._dbInfo.db=be,Y(Me._dbInfo)}}).catch(function(be){throw(F(l,be)||f.resolve()).catch(function(){}),be})}}):b=x.then(function(H){P(l);var j=V[l.name],U=j.forages;H.close();for(var $=0;$<U.length;$++){var X=U[$];X._dbInfo.db=null}var ce=new f(function(ve,be){var Re=d.deleteDatabase(l.name);Re.onerror=function(){var Me=Re.result;Me&&Me.close(),be(Re.error)},Re.onblocked=function(){console.warn('dropInstance blocked for database "'+l.name+'" until all open connections are closed')},Re.onsuccess=function(){var Me=Re.result;Me&&Me.close(),ve(Me)}});return ce.then(function(ve){j.db=ve;for(var be=0;be<U.length;be++){var Re=U[be];Y(Re._dbInfo)}}).catch(function(ve){throw(F(l,ve)||f.resolve()).catch(function(){}),ve})})}return S(b,p),b}var Ue={_driver:"asyncStorage",_initStorage:Z,_support:h(),iterate:ne,getItem:q,setItem:ae,removeItem:_e,clear:Ie,length:xe,key:Ee,keys:Ye,dropInstance:Be};function se(){return typeof openDatabase=="function"}var ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Se="~~local_forage_type~",Ne=/^~~local_forage_type~([^~]+)~/,Oe="__lfsc__:",we=Oe.length,de="arbf",ge="blob",je="si08",Je="ui08",o1="uic8",Ke="si16",D1="si32",Cn="ur16",Sn="ui32",bn="fl32",yn="fl64",_n=we+de.length,Ln=Object.prototype.toString;function En(l){var p=l.length*.75,c=l.length,C,b=0,m,x,H,j;l[l.length-1]==="="&&(p--,l[l.length-2]==="="&&p--);var U=new ArrayBuffer(p),$=new Uint8Array(U);for(C=0;C<c;C+=4)m=ee.indexOf(l[C]),x=ee.indexOf(l[C+1]),H=ee.indexOf(l[C+2]),j=ee.indexOf(l[C+3]),$[b++]=m<<2|x>>4,$[b++]=(x&15)<<4|H>>2,$[b++]=(H&3)<<6|j&63;return U}function bt(l){var p=new Uint8Array(l),c="",C;for(C=0;C<p.length;C+=3)c+=ee[p[C]>>2],c+=ee[(p[C]&3)<<4|p[C+1]>>4],c+=ee[(p[C+1]&15)<<2|p[C+2]>>6],c+=ee[p[C+2]&63];return p.length%3===2?c=c.substring(0,c.length-1)+"=":p.length%3===1&&(c=c.substring(0,c.length-2)+"=="),c}function Si(l,p){var c="";if(l&&(c=Ln.call(l)),l&&(c==="[object ArrayBuffer]"||l.buffer&&Ln.call(l.buffer)==="[object ArrayBuffer]")){var C,b=Oe;l instanceof ArrayBuffer?(C=l,b+=de):(C=l.buffer,c==="[object Int8Array]"?b+=je:c==="[object Uint8Array]"?b+=Je:c==="[object Uint8ClampedArray]"?b+=o1:c==="[object Int16Array]"?b+=Ke:c==="[object Uint16Array]"?b+=Cn:c==="[object Int32Array]"?b+=D1:c==="[object Uint32Array]"?b+=Sn:c==="[object Float32Array]"?b+=bn:c==="[object Float64Array]"?b+=yn:p(new Error("Failed to get type for BinaryArray"))),p(b+bt(C))}else if(c==="[object Blob]"){var m=new FileReader;m.onload=function(){var x=Se+l.type+"~"+bt(this.result);p(Oe+ge+x)},m.readAsArrayBuffer(l)}else try{p(JSON.stringify(l))}catch(x){console.error("Couldn't convert value into a JSON string: ",l),p(null,x)}}function bi(l){if(l.substring(0,we)!==Oe)return JSON.parse(l);var p=l.substring(_n),c=l.substring(we,_n),C;if(c===ge&&Ne.test(p)){var b=p.match(Ne);C=b[1],p=p.substring(b[0].length)}var m=En(p);switch(c){case de:return m;case ge:return g([m],{type:C});case je:return new Int8Array(m);case Je:return new Uint8Array(m);case o1:return new Uint8ClampedArray(m);case Ke:return new Int16Array(m);case Cn:return new Uint16Array(m);case D1:return new Int32Array(m);case Sn:return new Uint32Array(m);case bn:return new Float32Array(m);case yn:return new Float64Array(m);default:throw new Error("Unkown type: "+c)}}var yt={serialize:Si,deserialize:bi,stringToBuffer:En,bufferToString:bt};function wn(l,p,c,C){l.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,C)}function yi(l){var p=this,c={db:null};if(l)for(var C in l)c[C]=typeof l[C]!="string"?l[C].toString():l[C];var b=new f(function(m,x){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(H){return x(H)}c.db.transaction(function(H){wn(H,c,function(){p._dbInfo=c,m()},function(j,U){x(U)})},x)});return c.serializer=yt,b}function r1(l,p,c,C,b,m){l.executeSql(c,C,b,function(x,H){H.code===H.SYNTAX_ERR?x.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(j,U){U.rows.length?m(j,H):wn(j,p,function(){j.executeSql(c,C,b,m)},m)},m):m(x,H)},m)}function _i(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName+" WHERE key = ? LIMIT 1",[l],function(j,U){var $=U.rows.length?U.rows.item(0).value:null;$&&($=x.serializer.deserialize($)),b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Li(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT * FROM "+x.storeName,[],function(j,U){for(var $=U.rows,X=$.length,ce=0;ce<X;ce++){var ve=$.item(ce),be=ve.value;if(be&&(be=x.serializer.deserialize(be)),be=l(be,ve.key,ce+1),be!==void 0){b(be);return}}b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mn(l,p,c,C){var b=this;l=_(l);var m=new f(function(x,H){b.ready().then(function(){p===void 0&&(p=null);var j=p,U=b._dbInfo;U.serializer.serialize(p,function($,X){X?H(X):U.db.transaction(function(ce){r1(ce,U,"INSERT OR REPLACE INTO "+U.storeName+" (key, value) VALUES (?, ?)",[l,$],function(){x(j)},function(ve,be){H(be)})},function(ce){if(ce.code===ce.QUOTA_ERR){if(C>0){x(Mn.apply(b,[l,j,c,C-1]));return}H(ce)}})})}).catch(H)});return S(m,c),m}function Ei(l,p,c){return Mn.apply(this,[l,p,c,1])}function wi(l,p){var c=this;l=_(l);var C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"DELETE FROM "+x.storeName+" WHERE key = ?",[l],function(){b()},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Mi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"DELETE FROM "+m.storeName,[],function(){C()},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function xi(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT COUNT(key) as c FROM "+m.storeName,[],function(H,j){var U=j.rows.item(0).c;C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Oi(l,p){var c=this,C=new f(function(b,m){c.ready().then(function(){var x=c._dbInfo;x.db.transaction(function(H){r1(H,x,"SELECT key FROM "+x.storeName+" WHERE id = ? LIMIT 1",[l+1],function(j,U){var $=U.rows.length?U.rows.item(0).key:null;b($)},function(j,U){m(U)})})}).catch(m)});return S(C,p),C}function Ri(l){var p=this,c=new f(function(C,b){p.ready().then(function(){var m=p._dbInfo;m.db.transaction(function(x){r1(x,m,"SELECT key FROM "+m.storeName,[],function(H,j){for(var U=[],$=0;$<j.rows.length;$++)U.push(j.rows.item($).key);C(U)},function(H,j){b(j)})})}).catch(b)});return S(c,l),c}function Ii(l){return new f(function(p,c){l.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,m){for(var x=[],H=0;H<m.rows.length;H++)x.push(m.rows.item(H).name);p({db:l,storeNames:x})},function(b,m){c(m)})},function(C){c(C)})})}function Hi(l,p){p=A.apply(this,arguments);var c=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||c.name,l.storeName=l.storeName||c.storeName);var C=this,b;return l.name?b=new f(function(m){var x;l.name===c.name?x=C._dbInfo.db:x=openDatabase(l.name,"","",0),l.storeName?m({db:x,storeNames:[l.storeName]}):m(Ii(x))}).then(function(m){return new f(function(x,H){m.db.transaction(function(j){function U(ve){return new f(function(be,Re){j.executeSql("DROP TABLE IF EXISTS "+ve,[],function(){be()},function(Me,ze){Re(ze)})})}for(var $=[],X=0,ce=m.storeNames.length;X<ce;X++)$.push(U(m.storeNames[X]));f.all($).then(function(){x()}).catch(function(ve){H(ve)})},function(j){H(j)})})}):b=f.reject("Invalid arguments"),S(b,p),b}var Di={_driver:"webSQLStorage",_initStorage:yi,_support:se(),iterate:Li,getItem:_i,setItem:Ei,removeItem:wi,clear:Mi,length:xi,key:Oi,keys:Ri,dropInstance:Hi};function Ti(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function xn(l,p){var c=l.name+"/";return l.storeName!==p.storeName&&(c+=l.storeName+"/"),c}function Vi(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function Ni(){return!Vi()||localStorage.length>0}function ki(l){var p=this,c={};if(l)for(var C in l)c[C]=l[C];return c.keyPrefix=xn(l,p._defaultConfig),Ni()?(p._dbInfo=c,c.serializer=yt,f.resolve()):f.reject()}function Ai(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo.keyPrefix,b=localStorage.length-1;b>=0;b--){var m=localStorage.key(b);m.indexOf(C)===0&&localStorage.removeItem(m)}});return S(c,l),c}function ji(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo,m=localStorage.getItem(b.keyPrefix+l);return m&&(m=b.serializer.deserialize(m)),m});return S(C,p),C}function Ui(l,p){var c=this,C=c.ready().then(function(){for(var b=c._dbInfo,m=b.keyPrefix,x=m.length,H=localStorage.length,j=1,U=0;U<H;U++){var $=localStorage.key(U);if($.indexOf(m)===0){var X=localStorage.getItem($);if(X&&(X=b.serializer.deserialize(X)),X=l(X,$.substring(x),j++),X!==void 0)return X}}});return S(C,p),C}function Pi(l,p){var c=this,C=c.ready().then(function(){var b=c._dbInfo,m;try{m=localStorage.key(l)}catch{m=null}return m&&(m=m.substring(b.keyPrefix.length)),m});return S(C,p),C}function $i(l){var p=this,c=p.ready().then(function(){for(var C=p._dbInfo,b=localStorage.length,m=[],x=0;x<b;x++){var H=localStorage.key(x);H.indexOf(C.keyPrefix)===0&&m.push(H.substring(C.keyPrefix.length))}return m});return S(c,l),c}function Bi(l){var p=this,c=p.keys().then(function(C){return C.length});return S(c,l),c}function zi(l,p){var c=this;l=_(l);var C=c.ready().then(function(){var b=c._dbInfo;localStorage.removeItem(b.keyPrefix+l)});return S(C,p),C}function Fi(l,p,c){var C=this;l=_(l);var b=C.ready().then(function(){p===void 0&&(p=null);var m=p;return new f(function(x,H){var j=C._dbInfo;j.serializer.serialize(p,function(U,$){if($)H($);else try{localStorage.setItem(j.keyPrefix+l,U),x(m)}catch(X){(X.name==="QuotaExceededError"||X.name==="NS_ERROR_DOM_QUOTA_REACHED")&&H(X),H(X)}})})});return S(b,c),b}function Zi(l,p){if(p=A.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var c=this.config();l.name=l.name||c.name,l.storeName=l.storeName||c.storeName}var C=this,b;return l.name?b=new f(function(m){l.storeName?m(xn(l,C._defaultConfig)):m(l.name+"/")}).then(function(m){for(var x=localStorage.length-1;x>=0;x--){var H=localStorage.key(x);H.indexOf(m)===0&&localStorage.removeItem(H)}}):b=f.reject("Invalid arguments"),S(b,p),b}var Wi={_driver:"localStorageWrapper",_initStorage:ki,_support:Ti(),iterate:Ui,getItem:ji,setItem:Fi,removeItem:zi,clear:Ai,length:Bi,key:Pi,keys:$i,dropInstance:Zi},Gi=function(p,c){return p===c||typeof p=="number"&&typeof c=="number"&&isNaN(p)&&isNaN(c)},Yi=function(p,c){for(var C=p.length,b=0;b<C;){if(Gi(p[b],c))return!0;b++}return!1},On=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},b1={},Rn={},d1={INDEXEDDB:Ue,WEBSQL:Di,LOCALSTORAGE:Wi},qi=[d1.INDEXEDDB._driver,d1.WEBSQL._driver,d1.LOCALSTORAGE._driver],T1=["dropInstance"],_t=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(T1),Xi={description:"",driver:qi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qi(l,p){l[p]=function(){var c=arguments;return l.ready().then(function(){return l[p].apply(l,c)})}}function Lt(){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var c in p)p.hasOwnProperty(c)&&(On(p[c])?arguments[0][c]=p[c].slice():arguments[0][c]=p[c])}return arguments[0]}var Ji=function(){function l(p){o(this,l);for(var c in d1)if(d1.hasOwnProperty(c)){var C=d1[c],b=C._driver;this[c]=b,b1[b]||this.defineDriver(C)}this._defaultConfig=Lt({},Xi),this._config=Lt({},this._defaultConfig,p),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(c){if((typeof c>"u"?"undefined":a(c))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in c){if(C==="storeName"&&(c[C]=c[C].replace(/\W/g,"_")),C==="version"&&typeof c[C]!="number")return new Error("Database version must be a number.");this._config[C]=c[C]}return"driver"in c&&c.driver?this.setDriver(this._config.driver):!0}else return typeof c=="string"?this._config[c]:this._config},l.prototype.defineDriver=function(c,C,b){var m=new f(function(x,H){try{var j=c._driver,U=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!c._driver){H(U);return}for(var $=_t.concat("_initStorage"),X=0,ce=$.length;X<ce;X++){var ve=$[X],be=!Yi(T1,ve);if((be||c[ve])&&typeof c[ve]!="function"){H(U);return}}var Re=function(){for(var y1=function(ta){return function(){var na=new Error("Method "+ta+" is not implemented by the current driver"),In=f.reject(na);return S(In,arguments[arguments.length-1]),In}},Et=0,ea=T1.length;Et<ea;Et++){var wt=T1[Et];c[wt]||(c[wt]=y1(wt))}};Re();var Me=function(y1){b1[j]&&console.info("Redefining LocalForage driver: "+j),b1[j]=c,Rn[j]=y1,x()};"_support"in c?c._support&&typeof c._support=="function"?c._support().then(Me,H):Me(!!c._support):Me(!0)}catch(ze){H(ze)}});return y(m,C,b),m},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(c,C,b){var m=b1[c]?f.resolve(b1[c]):f.reject(new Error("Driver not found."));return y(m,C,b),m},l.prototype.getSerializer=function(c){var C=f.resolve(yt);return y(C,c),C},l.prototype.ready=function(c){var C=this,b=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return y(b,c,c),b},l.prototype.setDriver=function(c,C,b){var m=this;On(c)||(c=[c]);var x=this._getSupportedDrivers(c);function H(){m._config.driver=m.driver()}function j(X){return m._extend(X),H(),m._ready=m._initStorage(m._config),m._ready}function U(X){return function(){var ce=0;function ve(){for(;ce<X.length;){var be=X[ce];return ce++,m._dbInfo=null,m._ready=null,m.getDriver(be).then(j).catch(ve)}H();var Re=new Error("No available storage method found.");return m._driverSet=f.reject(Re),m._driverSet}return ve()}}var $=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=$.then(function(){var X=x[0];return m._dbInfo=null,m._ready=null,m.getDriver(X).then(function(ce){m._driver=ce._driver,H(),m._wrapLibraryMethodsWithReady(),m._initDriver=U(x)})}).catch(function(){H();var X=new Error("No available storage method found.");return m._driverSet=f.reject(X),m._driverSet}),y(this._driverSet,C,b),this._driverSet},l.prototype.supports=function(c){return!!Rn[c]},l.prototype._extend=function(c){Lt(this,c)},l.prototype._getSupportedDrivers=function(c){for(var C=[],b=0,m=c.length;b<m;b++){var x=c[b];this.supports(x)&&C.push(x)}return C},l.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,C=_t.length;c<C;c++)Qi(this,_t[c])},l.prototype.createInstance=function(c){return new l(c)},l}(),Ki=new Ji;r.exports=Ki},{3:3}]},{},[4])(4)})})(fi);var ts=fi.exports;const l1=o6(ts);class di{getItem(t){return l1.getItem(t)}setItem(t,n){return l1.setItem(t,n)}removeItem(t){return l1.removeItem(t)}clear(){return l1.clear()}key(t){return l1.key(t)}keys(){return l1.keys()}iterate(t){return l1.iterate(t)}}var ns=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(e,t,n,r)=>{for(var i=r>1?void 0:r?rs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ns(t,n,i),i},as=(e,t)=>(n,r)=>t(n,r,e);let Gt=class{constructor(e){B(this,"visible$",new ie.Subject);B(this,"componentKey$",new ie.Subject);this._componentManager=e}set(e,t){return this._componentManager.register(e,t),this.componentKey$.next(e),L.toDisposable(()=>{this._componentManager.delete(e),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};Gt=is([as(0,oe.Inject(e1))],Gt);class os extends L.Disposable{constructor(){super(...arguments);B(this,"_currentSelectorId");B(this,"_selectionChange$",new ie.Subject);B(this,"selectionChange$",this._selectionChange$.asObservable());B(this,"_openSelector$",new ie.Subject);B(this,"openSelector$",this._openSelector$.asObservable())}setCurrentSelectorId(n){this._currentSelectorId=n}getCurrentSelectorId(){return this._currentSelectorId}selectionChange(n){this._currentSelectorId&&this._selectionChange$.next(n)}openSelector(){this._openSelector$.next(null)}}const gn=oe.createIdentifier("univer.range-selector.service");class ss extends L.Disposable{constructor(){super(...arguments);B(this,"_taskCount",0);B(this,"_progressChange$",new ie.Subject);B(this,"_progressVisible$",new ie.Subject);B(this,"progressChange$",this._progressChange$.asObservable());B(this,"progressVisible$",this._progressVisible$.asObservable())}dispose(){super.dispose(),this._clear(),this._progressChange$.complete(),this._progressVisible$.complete()}pushTask(n){if(this._taskCount===0)return;const{count:r}=n;if(r<=0)return;const i=Math.min(1,r/this._taskCount);this._progressChange$.next({step:i}),this._taskCount-=r,this._taskCount<0&&(this._taskCount=0),this._taskCount===0&&this._progressVisible$.next(!1)}insertTaskCount(n){n<=0||(this._taskCount===0&&this._progressVisible$.next(!0),this._taskCount+=n)}complete(){this._taskCount!==0&&(this._progressChange$.next({step:1}),this._clear(),this._progressVisible$.next(!1))}stop(){this._taskCount!==0&&(this._clear(),this._progressVisible$.next(!1))}_clear(){this._taskCount=0}}const mn=oe.createIdentifier("univer.progress.service");var ls=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,us=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ls(t,n,i),i},Tt=(e,t)=>(n,r)=>t(n,r,e);const fs="ui",hi="DISABLE_AUTO_FOCUS";var Vt;exports.UniverUIPlugin=(Vt=class extends L.Plugin{constructor(t={},n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._localeService=i,this._localeService.load({zhCN:ti}),this._config.disableAutoFocus&&this._contextService.setContextValue(hi,!0)}onStarting(t){this._initDependencies(t),this._initUI()}_initDependencies(t){L.mergeOverrideWithDependencies([[e1],[Y1],[ci],[O1,{useClass:exports.DesktopLayoutService}],[S1,{useClass:exports.DesktopShortcutService}],[Jt,{useClass:u6}],[f1,{useClass:exports.DesktopMenuService}],[un,{useClass:J6}],[ri,{useClass:exports.BrowserClipboardService,lazy:!0}],[Ct,{useClass:si,lazy:!0}],[fn,{useClass:ai,lazy:!0}],[cn,{useClass:ii,lazy:!0}],[st,{useClass:li,lazy:!0}],[nn,{useClass:Gt,lazy:!0}],[dn,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[ot,{useClass:oi,lazy:!0}],[L.ILocalStorageService,{useClass:di,lazy:!0}],[ni,{useClass:exports.DesktopBeforeCloseService}],[x1,{useClass:exports.EditorService}],[gn,{useClass:os}],[hn,{useClass:K6}],[mn,{useClass:ss}],[X1,{useClass:exports.DesktopUIController}],[exports.SharedController],[Z1],[W1]],this._config.override).forEach(r=>t.add(r))}_initUI(){Promise.resolve().then(()=>this._injector.get(X1).bootstrapWorkbench(this._config))}},B(Vt,"pluginName",fs),Vt);exports.UniverUIPlugin=us([Tt(1,L.IContextService),Tt(2,oe.Inject(oe.Injector)),Tt(3,oe.Inject(L.LocaleService))],exports.UniverUIPlugin);function G1(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const ds=.75,a3=78,o3=9,pi="rgba(0,0,0,0)",gi="rgb(0,0,0)";function vn(e){var u;let t=e.childNodes;if(t.length===0)return e.textContent;if(t[0].nodeName==="DIV"&&(t=t[0].childNodes),t.length===1&&t[0].nodeName==="#text")return t[0].textContent;const n=[];let r=0,i=0,a=e.textContent||"";a+=`\r
47
47
  `;for(let d=0;d<t.length;d++){let h=t[`${d}`],g;h.nodeName==="#text"?(g=(u=h.textContent)!=null?u:"",h=h.parentElement):g=h.innerText;const f=St(h);mi(g).forEach(y=>{const _=y.length;i+=_,r=i-_;const A=L.Tools.generateRandomId(6);n.push({sId:A,st:r,ed:i-1,ts:f})})}return L.Tools.generateRandomId(6),{id:L.Tools.generateRandomId(6),body:{dataStream:a,textRuns:n},documentStyle:{}}}function St(e,t=""){var o,u;let n=(u=(o=e==null?void 0:e.style)==null?void 0:o.cssText)!=null?u:"";if(n+=t,n=n.replace(/[\r\n]+/g,""),n.length===0)return{};const r=n.split(";"),i={},a={t:"",r:"",b:"",l:""};return r.forEach(d=>{var S;const h=d;d=d.toLowerCase();const g=G1(d.substr(0,d.indexOf(":"))),f=G1(d.substr(d.indexOf(":")+1));if(g==="font-weight")f==="bold"||f==="700"?i.bl=1:i.bl=0;else if(g==="font-style")f==="italic"?i.it=1:i.it=0;else if(g==="font-family"){const y=G1(h.substr(h.indexOf(":")+1));i.ff=y}else if(g==="font-size"){let y=Number.parseInt(f);n.indexOf("vertical-align")>-1&&(n.indexOf("sub")>-1||n.indexOf("sup")>-1)&&(y*=2),f.indexOf("px")!==-1&&(y=bs(Number.parseInt(f,10))),i.fs=y}else if(g==="color")i.cl={rgb:f};else if(g==="background"||g==="background-color"){const y=new L.ColorKit(f);if(y){const _=y.toRgbString();_!==pi&&_!==gi&&(i.bg={rgb:y.toRgbString()})}}else if(g==="text-decoration-line")f==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):f==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):f==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1);else if(g==="text-decoration-color")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,cl:{rgb:f}}),i.ul.cl={rgb:f}),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,cl:{rgb:f}}),i.st.cl={rgb:f}),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,cl:{rgb:f}}),i.ol.cl={rgb:f});else if(g==="text-decoration-style")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,t:Number(f)}),i.ul.t=Number(f)),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,t:Number(f)}),i.st.t=Number(f)),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,t:Number(f)}),i.ol.t=Number(f));else if(g==="text-decoration"||g==="univer-strike"){const y=(S=f.split(" "))==null?void 0:S[0];y==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):y==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):y==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1)}if(g==="univer-underline"&&(i.ul={s:1}),g==="vertical-align"&&(f==="sub"?i.va=L.BaselineOffset.SUBSCRIPT:f==="super"?i.va=L.BaselineOffset.SUPERSCRIPT:f==="top"?i.vt=1:f==="middle"?i.vt=2:f==="bottom"?i.vt=3:i.va=L.BaselineOffset.NORMAL),g==="transform"){const y=f.split(")"),_=y.findIndex(A=>A.includes("rotate"));if(_>-1){const A=y[_].match(/\d+/g);let O=0,N=0;A!=null&&A.length&&(O=+A[0]),e!=null&&e.dataset.vertical&&(N=+e.dataset.vertical),i.tr={a:O,v:N}}}if(g==="text-align"&&(f==="left"?i.ht=1:f==="center"?i.ht=2:f==="right"?i.ht=3:f==="justify"?i.ht=4:i.ht=0),g==="overflow-wrap"||g==="word-wrap"?f==="break-word"&&(i.tb=3):g==="text-overflow"?f==="clip"&&(i.tb=2):g==="text-break"&&f==="overflow"&&(i.tb=1),g==="white-space"&&(f==="nowrap"?i.tb=1:f==="normal"?i.tb=3:f==="clip"&&(i.tb=2)),g==="border-color"){const y=s3(f,")");if(i.bd)for(const _ in y)i.bd[_].cl.rgb=y[_];else{i.bd={b:{cl:{rgb:"#000"},s:0},t:{cl:{rgb:"#000"},s:0},l:{cl:{rgb:"#000"},s:0},r:{cl:{rgb:"#000"},s:0}};for(const _ in y)i.bd[_].cl.rgb=y[_]}}if(g==="border-width"||g==="border-style"){const y=s3(f," ");for(const _ in y)a[_]+=` ${y[_]}`;i.bd?(i.bd.b.s=L.getBorderStyleType(a.b),i.bd.t.s=L.getBorderStyleType(a.t),i.bd.l.s=L.getBorderStyleType(a.l),i.bd.r.s=L.getBorderStyleType(a.r)):i.bd={b:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.b)},t:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.t)},l:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.l)},r:{cl:{rgb:"#000"},s:L.getBorderStyleType(a.r)}}}if(g==="border-bottom"||g==="border-top"||g==="border-left"||g==="border-right"||g==="border"){i.bd||(i.bd={});const y=f.split(" "),_=`${y[0]} ${y[1]}`;y.splice(0,2);const A=y.join("");if(L.getBorderStyleType(_)!==L.BorderStyleTypes.NONE){const N={cl:{rgb:A},s:L.getBorderStyleType(_)};g==="border-bottom"?i.bd.b=f==="none"?null:N:g==="border-top"?i.bd.t=f==="none"?null:N:g==="border-left"?i.bd.l=f==="none"?null:N:g==="border-right"?i.bd.r=f==="none"?null:N:g==="border"&&(i.bd={r:f==="none"?null:N,t:f==="none"?null:N,b:f==="none"?null:N,l:f==="none"?null:N})}}else if(g==="data-rotate"){const y=/[+-]?\d+/,_=f.match(y);f==="(0deg ,1)"?i.tr={a:0,v:1}:_&&(i.tr={a:Number(_[0])})}}),Object.keys(i).forEach(d=>{typeof i[d]=="object"&&!Object.keys(i[d]).length&&delete i[d]}),i}function s3(e,t){let n;t===" "?n=e.trim().split(t):n=e.trim().split(t).slice(0,-1),n.forEach(i=>`${i.trim()})`);let r={};return n.length===1?r={t:n[0],r:n[0],b:n[0],l:n[0]}:n.length===2?r={t:n[0],r:n[1],b:n[0],l:n[1]}:n.length===3?r={t:n[0],r:n[1],b:n[2],l:n[1]}:n.length===4&&(r={t:n[0],r:n[1],b:n[2],l:n[3]}),r}function mi(e){if(e==="")return[e];const t=/(?:(\n+.+)|(.+))/g;return e.match(t).map(i=>i.replace(/\n/g,`\r
48
48
  `))}function hs(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table col");if(!r.length)return[];for(let i=0;i<r.length;i++){const a=r[i],o=a.getAttribute("span");if(o&&+o>1)for(let u=0;u<+o;u++){const d=tt(a.getAttribute("width"),72);n.push(d)}else{const u=tt(a.getAttribute("width"),72);n.push(u)}}return n}function tt(e,t){if(!e)return t;let n;return e.includes("pt")?n=C1.ptToPx(Number.parseFloat(e)):e.includes("px")?n=Number.parseFloat(e):n=Number.parseFloat(e)*72/96,n}function ps(e){const t=document.createElement("DIV"),n=[];t.innerHTML=e;const r=t.querySelectorAll("table tr");if(!r.length)return[];for(let i=0;i<r.length;i++){const o=r[i].querySelectorAll("td");let u=tt(o[0].style.height,19);for(let d=0;d<o.length;d++){const h=o[d].getAttribute("rowSpan");if(!(h&&+h>1)){u=tt(o[d].style.height,19);break}}n.push(u)}return n}function gs(e){let t=[];const n=document.createElement("DIV");if(n.innerHTML=e,t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let r=0;const i=n.querySelectorAll("table tr");i[0].querySelectorAll("td").forEach(u=>{let d=0;const h=u.getAttribute("colSpan");h!==null?d=+h:d=1,r+=d});for(let u=0;u<t.length;u++)t[u]=new Array(r);let o=0;return i.forEach(u=>{let d=0;u.querySelectorAll("td").forEach(h=>{var y,_;const g={};if(h.querySelectorAll("span").length||h.querySelectorAll("font").length){const A=vn(h);typeof A!="string"&&(g.p=A)}const f=h.innerText;f.trim().length===0?g.v="":g.v=f;const S=St(h);for(L.Tools.isPlainObject(S)&&(g.s=S);d<r&&t[o][d]!=null;)d++;if(d!==r){if(t[o][d]==null){t[o][d]=g;const A=(y=Number(h.getAttribute("rowSpan")))!=null?y:1,O=(_=Number(h.getAttribute("colSpan")))!=null?_:1;if(A>1||O>1){const N={rs:+A-1,cs:+O-1,r:o,c:d};t[o][d].mc=N;for(let V=0;V<A;V++)for(let z=0;z<O;z++)V===0&&z===0||(t[o+V][d+z]={mc:null})}}d++}}),o++}),t}function ms(e){const t=[],n=document.createElement("DIV");n.innerHTML=e;const i=e.replace(/\r/g,"").split(`
49
49
  `),a=i[0].split(" ").length;for(let o=0;o<i.length;o++)i[o].split(" ").length<a||t.push(i[o].split(" "));for(let o=0;o<t.length;o++)for(let u=0;u<t[o].length;u++)t[o][u].length?t[o][u]={v:t[o][u]||"",m:t[o][u]||""}:t[o][u]=null;return t}function vs(e,t){e.length,e[0].length;let n=0,r=0;t&&(n=t.startRow,r=t.startColumn);const i=[];for(let a=0;a<e.length;a++)for(let o=0;o<e[a].length;o++)if(e[a][o]&&typeof e[a][o]=="object"&&"mc"in e[a][o])if(e[a][o].mc){const u=e[a][o].mc,d=u.r+n,h=d+u.rs,g=u.c+r,f=g+u.cs;i.push({startRow:d,endRow:h,startColumn:g,endColumn:f}),delete e[a][o].mc}else e[a][o]=null;return{data:e,mergeData:i}}function Cs(e){var h;let t=[];const n=document.createElement("html");n.innerHTML=e;const r=(h=n.querySelector("style"))==null?void 0:h.innerText;if(!r)return;const i=Ss(r);if(t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let a=0;const o=n.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(g=>{let f=0;const S=g.getAttribute("colSpan");S!==null?f=+S:f=1,a+=f});for(let g=0;g<t.length;g++)t[g]=new Array(a);let d=0;return o.forEach(g=>{let f=0;g.querySelectorAll("td").forEach(S=>{var N,V;const y={};if(S.querySelectorAll("span").length||S.querySelectorAll("font").length){const z=vn(S);typeof z!="string"&&(y.p=z)}const _=S.innerText;_.trim().length===0?y.v="":y.v=_;let A="";for(const z in i)S.classList.contains(z)&&(A+=i[z]);const O=St(S,A);for(L.Tools.isPlainObject(O)&&(y.s=O);f<a&&t[d][f]!=null;)f++;if(f!==a){if(t[d][f]==null){t[d][f]=y;const z=(N=Number(S.getAttribute("rowSpan")))!=null?N:1,W=(V=Number(S.getAttribute("colSpan")))!=null?V:1;if(z>1||W>1){const w={rs:+z-1,cs:+W-1,r:d,c:f};t[d][f].mc=w;for(let D=0;D<z;D++)for(let k=0;k<W;k++)D===0&&k===0||(t[d+D][f+k]={mc:null})}}f++}}),d++}),t}function Ss(e){const t={},n=e.replaceAll("<!--","").replaceAll("-->","").trim(),r=n==null?void 0:n.replaceAll(" ","").replaceAll(`