@univerjs/ui 0.8.1 → 0.8.2-nightly.202506201607

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/umd/index.js CHANGED
@@ -8,13 +8,13 @@ hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
8
8
  `;function g6(e){const{children:t,className:n,style:r,disabled:i=!1,active:l=!1,noIcon:o,onClick:c,onDoubleClick:v,...m}=e,b=w=>{if(i){w.preventDefault();return}c&&c(w)},d=w=>{if(i){w.preventDefault();return}v&&v(w)};return C.jsx("button",{type:"button",className:Z.clsx(v6,{"univer-px-2":o,"!univer-bg-gray-200 dark:!univer-bg-gray-500":l}),style:r,disabled:i,onClick:b,onDoubleClick:d,...m,children:t})}function m6(e){const{disabled$:t,hidden$:n,activated$:r,value$:i}=e,[l,o]=a.useState(),[c,v]=a.useState(!1),[m,b]=a.useState(!1),[d,w]=a.useState(!1);return a.useEffect(()=>{const y=[];return t&&y.push(t.subscribe(S=>v(S))),n&&y.push(n.subscribe(S=>w(S))),r&&y.push(r.subscribe(S=>b(S))),i&&y.push(i.subscribe(S=>o(S))),()=>y.forEach(S=>S.unsubscribe())},[r,t,n,i]),{disabled:c,value:l,activated:m,hidden:d}}const We=a.createContext({dropdownVisible:!1,setDropdownVisible:e=>{}}),f0=a.forwardRef((e,t)=>{const{children:n,...r}=e,i=a.useRef(null),[l,o]=a.useState(!1),[c,v]=a.useState(!1);function m(w){o(c?!1:w)}function b(w){v(w),o(!1)}const d=a.useMemo(()=>({dropdownVisible:c,setDropdownVisible:b}),[c]);return a.useImperativeHandle(t,()=>({el:i.current})),r.title?C.jsx(Z.Tooltip,{visible:l,onVisibleChange:m,...r,children:C.jsx("span",{ref:i,children:C.jsx(We.Provider,{value:d,children:n})})}):C.jsx("span",{ref:i,children:n})});function h0(e){const{children:t,overlay:n,disabled:r,align:i="start"}=e,{dropdownVisible:l,setDropdownVisible:o}=a.useContext(We);function c(v){o(v)}return C.jsx(Z.Dropdown,{align:i,overlay:C.jsx("div",{className:"univer-grid univer-gap-2",children:n}),disabled:r,open:l,onOpenChange:c,children:C.jsx("div",{className:"univer-h-full",onClick:v=>v.stopPropagation(),children:t})})}function pe({icon:e,value:t,option:n,onOptionSelect:r}){var o;const i=c=>{r==null||r({value:c,label:n==null?void 0:n.label,commandId:n==null?void 0:n.commandId})},l=typeof n.label=="string"||typeof n.label=="object"&&((o=n.label)==null?void 0:o.selectable)!==!1;return C.jsxs("div",{className:Z.clsx("univer-relative univer-flex univer-items-center univer-gap-2",{"univer-pl-6":l}),children:[l&&String(t)===String(n.value)&&C.jsx(Ve,{className:"univer-absolute univer-left-1 univer-top-0.5 univer-text-primary-600"}),C.jsx(d1,{className:"univer-text-sm",icon:e,value$:n.value$,value:n.value,label:n.label,onChange:i})]})}function p6({menuId:e,slot:t,value:n,options:r,children:i,disabled:l,onOptionSelect:o}){var T;const{dropdownVisible:c,setDropdownVisible:v}=a.useContext(We),m=R.useDependency(S1),[b,d]=a.useState({}),w=a.useMemo(()=>e?m.getMenuByPositionKey(e):[],[e]),y=a.useMemo(()=>w.filter(D=>{var V;if(!D.children)return!b[D.key];const I=((V=D.key)==null?void 0:V.toString())||"";return!b[I]}),[w,b]);function S(D){v(D)}if(a.useEffect(()=>{const D=[];return w.forEach(I=>{var V;if(I.children){const O=I.children.map(M=>{var x,$;return($=(x=M.item)==null?void 0:x.hidden$)!=null?$:z.of(!1)}),U=z.combineLatest(O).subscribe(M=>{const x=M.every($=>$===!0);d($=>({...$,[I.key]:x}))});D.push(U)}else if((V=I.item)!=null&&V.hidden$){const O=I.item.hidden$.subscribe(U=>{d(M=>({...M,[I.key]:U}))});D.push(O)}}),()=>{D.forEach(I=>I==null?void 0:I.unsubscribe()),d({})}},[w]),t)return C.jsx(h0,{disabled:l,overlay:r.map((D,I)=>C.jsx(pe,{value:n,option:D,onOptionSelect:o},I)),children:i});if(r!=null&&r.length){const D=r.map(I=>{var V;return{type:"item",className:Z.clsx({"focus:univer-bg-white":typeof I.label!="string"&&((V=I.label)==null?void 0:V.hoverable)===!1}),children:C.jsx(pe,{icon:I.icon,value:n,option:I,onOptionSelect:o}),disabled:I.disabled,onSelect:()=>{typeof I.value>"u"||o==null||o({...I})}}});for(const I of y){if(!I.item)continue;const{title:V,id:O,commandId:U,icon:M}=I.item;if(!V)throw new Error("Menu item title is required");D.push({type:"item",children:C.jsx(pe,{icon:M,value:n,option:{label:{name:V,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:U,id:O})}})}return C.jsx(Z.DropdownMenu,{align:"start",items:D,disabled:l,open:c,onOpenChange:S,children:i})}else{const D=[];for(const I of y)if(I.item){const{title:V,id:O,commandId:U,icon:M}=I.item;if(!V)throw new Error("Menu item title is required");D.push({type:"item",children:C.jsx(pe,{icon:M,value:n,option:{label:{name:V,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:U,id:O})}})}else(T=I.children)!=null&&T.length;return C.jsx(Z.DropdownMenu,{align:"start",items:D,disabled:l,open:c,onOpenChange:S,children:i})}}const ne=a.forwardRef((e,t)=>{const n=R.useDependency(h.LocaleService),r=R.useDependency(h.ICommandService),i=R.useDependency(H1),l=R.useDependency(v1),{value:o,hidden:c,disabled:v,activated:m}=m6(e),b=(W,Y)=>{i.focus(),r.executeCommand(W,Y)},{tooltip:d,shortcut:w,icon:y,title:S,label:T,id:D,commandId:I,type:V,slot:O,params:U}=e,M=n.t(d!=null?d:"")+(w?` (${w})`:""),{selections:x}=e,$=a.useMemo(()=>z.isObservable(x)?x:new z.Observable(W=>{W.next(x)}),[x]),X=R.useObservable($),B=a.useMemo(()=>z.isObservable(y)?y:new z.Observable(W=>{var e1,l1;const Y=(l1=(e1=X==null?void 0:X.find(C1=>C1.value===o))==null?void 0:e1.icon)!=null?l1:y;W.next(Y)}),[y,X,o]),G=R.useObservable(B,void 0,!0);function q(W){var a1;const Y=e.selectionsCommandId,e1=I!=null?I:D,l1=(a1=Y!=null?Y:I)!=null?a1:D;function C1(r1){if(v)return;let u1=l1;r1.id&&(u1=r1.id),b(u1,{value:r1.value})}function b1(r1){v||b(l1,{value:r1})}function y1(){v||W===g1.BUTTON_SELECTOR&&b(e1,{value:o})}return W===g1.BUTTON_SELECTOR?C.jsxs("div",{"data-u-command":D,"data-disabled":v,className:Z.clsx("univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v}),children:[C.jsx("div",{className:Z.clsx("univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-bg-gray-200 dark:!univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),onClick:y1,children:C.jsx(d1,{icon:G,title:S,value:o,label:T,onChange:b1})}),C.jsx(p6,{menuId:D,slot:O,value:o,options:X,disabled:v,onOptionSelect:C1,children:C.jsx("div",{className:Z.clsx("univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v,"univer-bg-gray-200 dark:!univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),"data-disabled":v,children:C.jsx(G1,{})})})]}):C.jsx(p6,{menuId:D,slot:O,value:o,options:X,disabled:v,onOptionSelect:C1,children:C.jsxs("div",{"data-u-command":D,className:Z.clsx("univer-animate-in univer-fade-in univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-gap-2 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v,"univer-bg-gray-200":m,"univer-bg-gray-100":m&&v}),children:[C.jsx(d1,{icon:G,title:S,value:o,label:T,onChange:b1}),C.jsx("div",{className:Z.clsx("univer-flex univer-h-full univer-items-center",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v}),children:C.jsx(G1,{})})]})})}function J(){var Y;const W=l.get(typeof T=="string"?T:(Y=T==null?void 0:T.name)!=null?Y:"");return C.jsx(g6,{"data-u-command":D,className:"univer-text-sm",noIcon:!y,active:m,disabled:v,onClick:()=>{var e1;return b((e1=e.commandId)!=null?e1:e.id,o!=null?o:U)},onDoubleClick:()=>e.subId&&b(e.subId),children:W?C.jsx(d1,{title:S,value:o,label:T}):y?C.jsx(d1,{icon:y}):C.jsx(d1,{title:S})})}function K(){switch(V){case g1.BUTTON_SELECTOR:case g1.SELECTOR:case g1.SUBITEMS:return q(V);case g1.BUTTON:default:return J()}}return!c&&C.jsx(f0,{ref:t,title:M,placement:"bottom",children:K()})}),C0={[f1.START]:bt,[f1.INSERT]:Et,[f1.FORMULAS]:Re,[f1.DATA]:X3,[f1.VIEW]:lt,[f1.OTHERS]:Te};function b6(e){const{ribbonType:t,headerMenuComponents:n,headerMenu:r=!0}=e,i=R.useDependency(S1),l=R.useDependency(h.IUniverInstanceService),o=R.useDependency(h.LocaleService),[c,v]=a.useState(0),m=R.useObservable(l.focused$);a.useEffect(()=>{const B=i.menuChanged$.subscribe(()=>{v(G=>G+1)});return()=>{B.unsubscribe()}},[]);const b=a.useRef(null),d=a.useRef({}),[w,y]=a.useState([]),[S,T]=a.useState(f1.START),[D,I]=a.useState(!1),[V,O]=a.useState([]),[U,M]=a.useState(!1),x=a.useCallback(B=>{d.current={},T(B.key),I(!1)},[]);a.useEffect(()=>{var J;const B=i.getMenuByPositionKey(X1.RIBBON),G=[],q=[];for(const K of B)if(K.children){for(const W of K.children)if(W.children)for(const Y of W.children)(J=Y.item)!=null&&J.hidden$&&(G.push(Y.item.hidden$),q.push(`${K.key}/${W.key}/${Y.key}`))}z.combineLatest(G).subscribe(K=>{var e1,l1,C1,b1,y1,a1;const W=[],Y=K.map((r1,u1)=>r1?q[u1]:null).filter(r1=>!!r1);for(const r1 of B){const u1={...r1,children:[]};if((e1=r1.children)!=null&&e1.length)for(const L1 of r1.children){const I1={...L1,children:[]};let Z1=!0;if((l1=L1.children)!=null&&l1.length){for(const B1 of L1.children){const F1=`${r1.key}/${L1.key}/${B1.key}`;Y.includes(F1)||(C1=I1.children)==null||C1.push(B1)}(b1=I1.children)!=null&&b1.every(B1=>{var F1;return((F1=B1.children)==null?void 0:F1.length)===0})&&(Z1=!1)}Z1&&((y1=u1.children)==null||y1.push(I1))}(a1=u1.children)!=null&&a1.length&&u1.children.every(L1=>{var I1;return(I1=L1.children)==null?void 0:I1.length})&&W.push(u1)}if(t==="simple"){const r1=[{key:f1.START,children:[],order:0}];W.forEach(u1=>{var L1;(L1=u1.children)==null||L1.forEach(I1=>{var Z1;(Z1=r1[0].children)==null||Z1.push(I1)})}),y(r1)}else y(W)}).unsubscribe()},[c,m]);const $=a.useMemo(()=>{var J,K;const B=(K=(J=w.find(W=>W.key===S))==null?void 0:J.children)!=null?K:[],G=[],q=[];for(const W of B)if(W.children){const Y=W.children.filter(e1=>!V.includes(e1.key));Y.length>0&&G.push({...W,children:Y}),Y.length<W.children.length&&q.push({...W,children:W.children.filter(e1=>V.includes(e1.key))})}return{allGroups:B,visibleGroups:G,hiddenGroups:q}},[V,w,S]);a.useEffect(()=>{let B=null;const G=new ResizeObserver(h.throttle(q=>{for(const J of q)M(!0),B=requestAnimationFrame(()=>{var y1,a1;const{width:K}=J.contentRect,Y=Object.values(d.current).sort((r1,u1)=>r1.order-u1.order||r1.groupOrder-u1.groupOrder||r1.itemOrder-u1.itemOrder),e1=[];let l1=32;const b1=(((a1=(y1=w.find(r1=>r1.key===S))==null?void 0:y1.children)!=null?a1:[]).length-1)*8;l1+=b1;for(const{el:r1,key:u1}of Y){const{width:L1}=r1.getBoundingClientRect();l1+=L1+8,l1>K&&e1.push(u1)}O(e1),M(!1)})},100));return G.observe(b.current),()=>{B&&cancelAnimationFrame(B),G.disconnect()}},[w,S]);const X=a.useMemo(()=>C.jsx("div",{"aria-hidden":"true",className:Z.clsx("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0",{"univer-hidden":!U},Z.divideXClassName,Z.borderBottomClassName),children:$.allGroups.map((B,G)=>{var q,J;return(((q=B.children)==null?void 0:q.length)||B.item)&&C.jsx(a.Fragment,{children:C.jsx("div",{className:"univer-grid univer-grid-flow-col univer-gap-2 univer-px-2",children:B.children&&((J=B.children)==null?void 0:J.map(K=>K.item&&C.jsx(ne,{...K.item,ref:W=>{W!=null&&W.el&&(d.current[K.key]={el:W.el,key:K.key,order:G,groupOrder:B.order,itemOrder:K.order})}},K.key)))})},B.key)})}),[$.allGroups,U]);return C.jsxs(C.Fragment,{children:[r&&n&&n.size>0&&C.jsx("header",{className:Z.clsx("univer-relative univer-h-11 univer-select-none",Z.borderBottomClassName),children:C.jsx("div",{className:"univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-items-center univer-gap-2 [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",children:C.jsx(m1,{components:n})})}),C.jsxs("div",{className:Z.clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3",{"univer-grid-cols-[auto,1fr]":w.length>1,"univer-grid-cols-none":w.length===1},Z.borderBottomClassName),children:[w.length>1&&C.jsx(Z.HoverCard,{className:"univer-max-w-96 !univer-rounded-xl",align:"start",open:D,overlay:C.jsx("div",{className:"univer-grid univer-gap-1 univer-px-2 univer-py-1",children:w.map(B=>{const G=C0[B.key];return C.jsxs("a",{"data-u-comp":"ribbon-group-btn",className:"univer-box-border univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-lg univer-px-2 univer-py-1.5 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",onClick:()=>x(B),children:[C.jsx("span",{className:Z.clsx("univer-box-border univer-flex univer-size-9 univer-flex-shrink-0 univer-items-center univer-justify-center univer-rounded-lg",Z.borderClassName),children:C.jsx(G,{className:"univer-text-gray-500 dark:!univer-text-gray-300"})}),C.jsxs("span",{className:"univer-flex univer-flex-col",children:[C.jsx("strong",{className:"univer-text-sm univer-font-semibold univer-text-gray-800 dark:!univer-text-gray-200",children:o.t(B.key)}),C.jsx("span",{className:"univer-text-xs univer-text-gray-400",children:o.t(`${B.key}Desc`)})]})]},B.key)})}),onOpenChange:I,children:C.jsxs("a",{className:"univer-mr-2 univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1.5 univer-whitespace-nowrap !univer-rounded-full univer-bg-gray-700 univer-pl-3 univer-pr-2 univer-text-sm univer-text-white dark:!univer-bg-gray-200 dark:!univer-text-gray-800",onClick:()=>I(!0),children:[o.t(S),C.jsx(G1,{className:"univer-text-gray-200 dark:!univer-text-gray-500"})]})}),C.jsxs("div",{"data-u-comp":"ribbon-toolbar",ref:b,className:Z.clsx("univer-flex univer-overflow-hidden",Z.divideXClassName),children:[$.visibleGroups.map(B=>{var G,q;return(((G=B.children)==null?void 0:G.length)||B.item)&&C.jsx(a.Fragment,{children:C.jsx("div",{className:"univer-grid univer-grid-flow-col univer-gap-2 univer-px-2",children:B.children&&((q=B.children)==null?void 0:q.map(J=>J.item&&C.jsx(ne,{...J.item},J.key)))})},B.key)}),V.length>0&&C.jsx("div",{"data-u-comp":"ribbon-toolbar-more",className:"univer-pl-2 rtl:univer-pr-2",children:C.jsx(Z.Dropdown,{collisionPadding:{right:12,left:12},overlay:C.jsx("div",{className:"univer-box-border univer-grid univer-max-w-[var(--radix-popper-available-width)] univer-gap-2 univer-p-2",children:$.hiddenGroups.map(B=>{var G;return C.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:C.jsx("div",{className:"univer-flex univer-flex-wrap univer-gap-2",children:B.children?(G=B.children)==null?void 0:G.map(q=>q.item&&C.jsx(ne,{...q.item},q.key)):B.item&&C.jsx(ne,{...B.item},B.key)})},B.key)})}),children:C.jsx("a",{className:v6,type:"button",children:C.jsx(Te,{})})})})]})]}),X]})}class re extends h.Disposable{constructor(){super(...arguments);j(this,"_styleSheetId","univer-theme-css-variables")}injectThemeToHead(n){function r(c,v="--univer"){const m=[];function b(d,w=""){for(const y in d){const S=d[y],T=w?`${w}-${y}`:y;typeof S=="object"&&S!==null?b(S,T):m.push(`${v}-${T}: ${S};`)}}return b(c),m.join(`
9
9
  `)}const i=r(n),l=document.getElementById(this._styleSheetId);l&&l.remove();const o=document.createElement("style");o.setAttribute("id",this._styleSheetId),o.innerHTML=`:root {
10
10
  ${i}
11
- }`,document.head.appendChild(o)}dispose(){super.dispose()}}const ie=h.createIdentifier("ui.contextmenu.service");class Ye extends h.Disposable{constructor(){super(...arguments);j(this,"_currentHandler",null);j(this,"disabled",!1)}get visible(){var n,r;return(r=(n=this._currentHandler)==null?void 0:n.visible)!=null?r:!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))}hideContextMenu(){var n;(n=this._currentHandler)==null||n.hideContextMenu()}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,h.toDisposable(()=>this._currentHandler=null)}}function L6(){const e=a.useRef(null),[t,n]=a.useState(!1),[r,i]=a.useState(""),[l,o]=a.useState([0,0]),c=a.useRef(t),v=R.useDependency(ie),m=R.useDependency(h.ICommandService),b=R.useInjector();c.current=t,a.useEffect(()=>{const y=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){n(!1)},get visible(){return c.current}});function S(T){e.current&&!e.current.contains(T.target)&&w()}return document.addEventListener("pointerdown",S),document.addEventListener("wheel",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("wheel",w),y.dispose()}},[v]);function d(y,S){n(!1),requestAnimationFrame(()=>{i(S),o([y.clientX,y.clientY]),n(!0)})}function w(){n(!1)}return C.jsx(Z.Popup,{visible:t,offset:l,children:C.jsx("section",{ref:e,children:r&&C.jsx(Ae,{menuType:r,onOptionSelect:y=>{const{label:S,commandId:T,value:D}=y;m&&m.executeCommand(T!=null?T:S,{value:D}),b.get(H1).focus(),n(!1)}})})})}const be=h.createIdentifier("univer.global-zone-service");function Xe(){const e=R.useDependency(be),[t,n]=a.useState(!1),r=R.useObservable(e.componentKey$,e.componentKey),i=R.useDependency(v1),l=a.useMemo(()=>{const o=i.get(r!=null?r:"");if(o)return o},[r,i]);return a.useEffect(()=>{const o=e.visible$.subscribe(c=>{n(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:Z.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:l&&C.jsx(l,{})}):null}function qe(){const e=R.useDependency($1),t=R.useObservable(e.sidebarOptions$),n=a.useRef(null),r=a.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...b}=t[v];b&&(o[v]=C.jsx(d1,{...b},m))}}return o},[t]);a.useEffect(()=>(n.current&&e.setContainer(n.current),()=>{e.setContainer(void 0)}),[e]),a.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=n.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=a.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function l(){var c;const o={...t,visible:!1};e.options.visible=!1,e.sidebarOptions$.next(o),(c=o==null?void 0:o.onClose)==null||c.call(o)}return C.jsx("section",{"data-u-comp":"sidebar",className:Z.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"univer-w-96 univer-translate-x-0":r==null?void 0:r.visible,"univer-w-0 univer-translate-x-full":!(r!=null&&r.visible)}),style:{width:i},children:C.jsxs("section",{ref:n,className:Z.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",Z.borderLeftBottomClassName,Z.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-items-center univer-justify-between univer-bg-white univer-p-4 univer-pb-2 univer-text-base univer-font-medium univer-text-gray-800 dark:!univer-bg-gray-900 dark:!univer-text-white",children:[r==null?void 0:r.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:l,children:C.jsx(Ne,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&C.jsx("footer",{className:"univer-sticky univer-bottom-0 univer-box-border univer-bg-white univer-p-4 dark:!univer-bg-gray-900",children:r.footer})]})})}const Le=h.createIdentifier("univer.zen-zone-service");function Je(){const e=R.useDependency(Le),[t,n]=a.useState(!1),[r,i]=a.useState(),l=R.useObservable(e.temporaryHidden$),o=R.useDependency(v1);a.useEffect(()=>{const v=[e.visible$.subscribe(m=>{n(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=a.useMemo(()=>{const v=o.get(r!=null?r:"");if(v)return v},[r]);return C.jsx("section",{className:Z.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":l}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function v0(e){const t=T9(Y1);return C.jsx(g0,{...e,...t})}function g0(e){var K;const{header:t=!0,toolbar:n=!0,footer:r=!0,headerMenu:i=!0,contextMenu:l=!0,ribbonType:o="default",mountContainer:c,onRendered:v}=e,m=R.useDependency(h.LocaleService),b=R.useDependency(h.ThemeService),d=R.useDependency(re),w=a.useRef(null),S=R.useDependency(h.IConfigService).getConfig(Y1),T=p1(o1.CUSTOM_HEADER),D=p1(o1.FOOTER),I=p1(o1.HEADER),V=p1(o1.HEADER_MENU),O=p1(o1.CONTENT),U=p1(o1.LEFT_SIDEBAR),M=p1(o1.GLOBAL),x=p1(o1.TOOLBAR),$=(K=S==null?void 0:S.popupRootId)!=null?K:"univer-popup-portal";a.useLayoutEffect(()=>{const W=b.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{W.unsubscribe()}},[]);const[X,B]=a.useState(!1);a.useLayoutEffect(()=>{const W=b.darkMode$.subscribe(Y=>{B(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{W.unsubscribe()}},[]),a.useEffect(()=>{w.current&&(v==null||v(w.current))},[v]);const[G,q]=a.useState(m.getLocales()),J=a.useMemo(()=>document.createElement("div"),[]);return a.useEffect(()=>{document.body.appendChild(J);const W=[m.localeChanged$.subscribe(()=>{q(m.getLocales())})];return()=>{W.forEach(Y=>Y.unsubscribe()),document.body.removeChild(J)}},[m,c,J]),C.jsxs(Z.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:J,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:Z.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":X}),tabIndex:-1,onBlur:W=>W.stopPropagation(),onContextMenu:W=>W.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white",children:C.jsx(m1,{components:T},"custom-header")}),t&&n&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full",children:C.jsx(m1,{components:x,sharedProps:{ribbonType:o,headerMenuComponents:V,headerMenu:i}},"toolbar")}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:C.jsx(m1,{components:U},"left-sidebar")}),C.jsxs("section",{className:Z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",Z.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(m1,{components:I},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:w,"data-range-selector":!0,onContextMenu:W=>W.preventDefault(),children:C.jsx(m1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(qe,{})})]}),r&&C.jsx("footer",{children:C.jsx(m1,{components:D,sharedProps:{contextMenu:l}},"footer")}),C.jsx(Je,{})]})]}),C.jsx(m1,{components:M},"global"),C.jsx(Xe,{}),l&&C.jsx(L6,{}),C.jsx(m0,{}),C.jsx("div",{id:$})]})}function m0(){const{mountContainer:e}=a.useContext(Z.ConfigContext),t=p1(o1.FLOATING);return _3.createPortal(C.jsx(m1,{components:t},"floating"),e)}const p0=3e3;class Qe extends h.Disposable{constructor(n,r,i,l,o){super();j(this,"_steadyTimeout");j(this,"_renderTimeout");j(this,"_currentRenderId",null);this._injector=n,this._instanceService=r,this._layoutService=i,this._lifecycleService=l,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout)}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(n,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(n)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[l]of i)if(this._changeRenderUnit(l,n))break;this.disposeWithMe(this._instanceService.focused$.subscribe(l=>{l&&this._changeRenderUnit(l,n)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(l=>{var o;l.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(l.unitId,n)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(l=>{this._currentRenderId===l&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},p0)},300)}catch(i){if(i instanceof h.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(n,r){if(this._currentRenderId===n)return!1;const i=this._renderManagerService.getRenderById(n);if(!i||!i.unitId||h.isInternalEditorID(i.unitId))return!1;const l=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return l==null||l.deactivate(),l==null||l.engine.unmount(),i.engine.mount(r),i.activate(),this._currentRenderId=n,!0}}var b0=Object.getOwnPropertyDescriptor,L0=(e,t,n,r)=>{for(var i=r>1?void 0:r?b0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},V1=(e,t)=>(n,r)=>t(n,r,e);f.DesktopUIController=class extends Qe{constructor(t,n,r,i,l,o,c,v,m){super(n,o,l,r,i),this._config=t,this._componentManager=m,c.mergeMenu(n6),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[O9,D9],[N9,V9],[P9,k9],[U9,A9],[$9,Z9],[x9,Z.ColorPicker]].forEach(([t,n])=>{this.disposeWithMe(this._componentManager.register(t,n))})}bootstrap(t){return w0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(o1.FLOATING,()=>R.connectInjector(Ge,this._injector))),this.disposeWithMe(t.registerComponent(o1.CONTENT,()=>R.connectInjector(je,this._injector))),this.disposeWithMe(t.registerComponent(o1.TOOLBAR,()=>R.connectInjector(b6,this._injector)))}},f.DesktopUIController=L0([V1(1,h.Inject(h.Injector)),V1(2,h.Inject(h.LifecycleService)),V1(3,z1.IRenderManagerService),V1(4,H1),V1(5,h.IUniverInstanceService),V1(6,S1),V1(7,_1),V1(8,h.Inject(v1))],f.DesktopUIController);function w0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=w6(i)}else i instanceof HTMLElement?r=i:r=w6("univer");const l=R.connectInjector(v0,e),o=v=>n(v,r);function c(){Z.render(C.jsx(l,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{Z.render(C.jsx("div",{}),r),setTimeout(()=>Z.render(C.jsx("div",{}),r),200),setTimeout(()=>Z.unmount(r),500)})}function w6(e){const t=document.createElement("div");return t.id=e,t}function _0(e){const{menuType:t,onOptionSelect:n}=e,r=R.useDependency(S1);if(!t)return null;const i=a.useMemo(()=>{const l=r.getMenuByPositionKey(t);function o(c){return c.reduce((v,m)=>m.children?[...v,...o(m.children)]:[...v,m],[])}return o(l)},[t]);return C.jsx("div",{className:"univer-box-border univer-grid univer-min-w-8 univer-max-w-52 univer-gap-1 univer-rounded univer-bg-gray-900 univer-px-2 univer-py-1",style:{gridTemplateColumns:`repeat(${Math.min(2,i.length)}, 72px)`},children:i.map(l=>l.item&&C.jsx(y0,{menuItem:l.item,onClick:o=>n==null?void 0:n({value:"",label:l.key,...o})},l.key))})}function y0(e){const{menuItem:t,onClick:n}=e,{id:r,type:i,title:l,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const v=R.useObservable(t.disabled$,!1),m=R.useObservable(t.value$);return C.jsx("button",{type:"button",className:Z.clsx("univer-w-18 univer-flex univer-flex-col univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-text-white [&>span]:univer-mt-0.5 [&>span]:univer-w-full [&>span]:univer-truncate [&>span]:univer-text-sm [&>svg]:univer-size-[18px] [&>svg]:univer-text-lg"),disabled:v,onClick:()=>n({id:r}),children:C.jsx(d1,{value:m,title:l,label:o,icon:c})},r)}function _6(){const[e,t]=a.useState(!1),[n,r]=a.useState(""),[i,l]=a.useState([0,0]),o=a.useRef(e),c=R.useDependency(ie),v=R.useDependency(h.ICommandService);o.current=e,a.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",b),document.addEventListener("wheel",b),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("wheel",b),d.dispose()}},[c]);function m(d,w){r(w),l([d.clientX,d.clientY]),t(!0)}function b(){t(!1)}return C.jsx(Z.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:n&&C.jsx(_0,{menuType:n,onOptionSelect:d=>{const{label:w,value:y,commandId:S}=d;v&&v.executeCommand(S!=null?S:w,{value:y}),t(!1)}})})})}function M0(e){const{header:t=!0,footer:n=!0,contextMenu:r=!0,mountContainer:i,onRendered:l}=e,o=R.useDependency(h.LocaleService),c=R.useDependency(h.ThemeService),v=R.useDependency(re),m=a.useRef(null),b=p1(o1.FOOTER),d=p1(o1.HEADER),w=p1(o1.CONTENT),y=p1(o1.LEFT_SIDEBAR),S=p1(o1.GLOBAL),[T,D]=a.useState(!1);a.useEffect(()=>{const U=c.darkMode$.subscribe(M=>{D(M)});return()=>{U.unsubscribe()}},[]),a.useEffect(()=>{m.current&&(l==null||l(m.current))},[l]);const[I,V]=a.useState(o.getLocales()),O=a.useMemo(()=>document.createElement("div"),[]);return a.useLayoutEffect(()=>{const U=c.currentTheme$.subscribe(M=>{v.injectThemeToHead(M)});return()=>{U.unsubscribe()}},[]),a.useEffect(()=>{document.body.appendChild(O);const U=[o.localeChanged$.subscribe(()=>{V(o.getLocales())})];return()=>{U.forEach(M=>M.unsubscribe()),document.body.removeChild(O)}},[o,i,O]),C.jsxs(Z.ConfigProvider,{locale:I==null?void 0:I.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:Z.clsx("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":T}),tabIndex:-1,onBlur:U=>U.stopPropagation(),children:[t&&C.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{className:"univer-h-full",children:C.jsx(m1,{components:y},"left-sidebar")}),C.jsxs("section",{className:Z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",Z.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(m1,{components:d},"header")}),C.jsx("section",{ref:m,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:U=>U.preventDefault(),children:C.jsx(m1,{components:w},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(qe,{})})]}),n&&C.jsx("footer",{children:C.jsx(m1,{components:b},"footer")}),C.jsx(Xe,{}),C.jsx(Je,{})]})]}),C.jsx(m1,{components:S},"global"),r&&C.jsx(_6,{})]})}var S0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?S0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},U1=(e,t)=>(n,r)=>t(n,r,e);let Ke=class extends Qe{constructor(e,t,n,r,i,l,o){super(t,l,i,n,r),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return H0(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>R.connectInjector(Ge,this._injector))),this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>R.connectInjector(je,this._injector)))}};Ke=I0([U1(1,h.Inject(h.Injector)),U1(2,h.Inject(h.LifecycleService)),U1(3,z1.IRenderManagerService),U1(4,H1),U1(5,h.IUniverInstanceService),U1(6,_1)],Ke);function H0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=y6(i)}else i instanceof HTMLElement?r=i:r=y6("univer");const l=R.connectInjector(M0,e),o=v=>n(v,r);function c(){Z.render(C.jsx(l,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{Z.unmount(r)})}function y6(e){const t=document.createElement("div");return t.id=e,t}const oe=h.createIdentifier("ui.notification.service");var E0=Object.getOwnPropertyDescriptor,D0=(e,t,n,r)=>{for(var i=r>1?void 0:r?E0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},O0=(e,t)=>(n,r)=>t(n,r,e);const e3=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){j(this,"_beforeUnloadCallbacks",[]);j(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=>{let n=t;const r=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
11
+ }`,document.head.appendChild(o)}dispose(){super.dispose()}}const ie=h.createIdentifier("ui.contextmenu.service");class Ye extends h.Disposable{constructor(){super(...arguments);j(this,"_currentHandler",null);j(this,"disabled",!1)}get visible(){var n,r;return(r=(n=this._currentHandler)==null?void 0:n.visible)!=null?r:!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))}hideContextMenu(){var n;(n=this._currentHandler)==null||n.hideContextMenu()}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,h.toDisposable(()=>this._currentHandler=null)}}function L6(){const e=a.useRef(null),[t,n]=a.useState(!1),[r,i]=a.useState(""),[l,o]=a.useState([0,0]),c=a.useRef(t),v=R.useDependency(ie),m=R.useDependency(h.ICommandService),b=R.useInjector();c.current=t,a.useEffect(()=>{const y=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){n(!1)},get visible(){return c.current}});function S(T){e.current&&!e.current.contains(T.target)&&w()}return document.addEventListener("pointerdown",S),document.addEventListener("wheel",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("wheel",w),y.dispose()}},[v]);function d(y,S){n(!1),requestAnimationFrame(()=>{i(S),o([y.clientX,y.clientY]),n(!0)})}function w(){n(!1)}return C.jsx(Z.Popup,{visible:t,offset:l,children:C.jsx("section",{ref:e,children:r&&C.jsx(Ae,{menuType:r,onOptionSelect:y=>{const{label:S,commandId:T,value:D}=y;m&&m.executeCommand(T!=null?T:S,{value:D}),b.get(H1).focus(),n(!1)}})})})}const be=h.createIdentifier("univer.global-zone-service");function Xe(){const e=R.useDependency(be),[t,n]=a.useState(!1),r=R.useObservable(e.componentKey$,e.componentKey),i=R.useDependency(v1),l=a.useMemo(()=>{const o=i.get(r!=null?r:"");if(o)return o},[r,i]);return a.useEffect(()=>{const o=e.visible$.subscribe(c=>{n(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:Z.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:l&&C.jsx(l,{})}):null}function qe(){const e=R.useDependency($1),t=R.useObservable(e.sidebarOptions$),n=a.useRef(null),r=a.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...b}=t[v];b&&(o[v]=C.jsx(d1,{...b},m))}}return o},[t]);a.useEffect(()=>(n.current&&e.setContainer(n.current),()=>{e.setContainer(void 0)}),[e]),a.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=n.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=a.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function l(){var c;const o={...t,visible:!1};e.options.visible=!1,e.sidebarOptions$.next(o),(c=o==null?void 0:o.onClose)==null||c.call(o)}return C.jsx("section",{"data-u-comp":"sidebar",className:Z.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"univer-w-96 univer-translate-x-0":r==null?void 0:r.visible,"univer-w-0 univer-translate-x-full":!(r!=null&&r.visible)}),style:{width:i},children:C.jsxs("section",{ref:n,className:Z.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",Z.borderLeftBottomClassName,Z.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-items-center univer-justify-between univer-bg-white univer-p-4 univer-pb-2 univer-text-base univer-font-medium univer-text-gray-800 dark:!univer-bg-gray-900 dark:!univer-text-white",children:[r==null?void 0:r.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:l,children:C.jsx(Ne,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&C.jsx("footer",{className:"univer-sticky univer-bottom-0 univer-box-border univer-bg-white univer-p-4 dark:!univer-bg-gray-900",children:r.footer})]})})}const Le=h.createIdentifier("univer.zen-zone-service");function Je(){const e=R.useDependency(Le),[t,n]=a.useState(!1),[r,i]=a.useState(),l=R.useObservable(e.temporaryHidden$),o=R.useDependency(v1);a.useEffect(()=>{const v=[e.visible$.subscribe(m=>{n(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=a.useMemo(()=>{const v=o.get(r!=null?r:"");if(v)return v},[r]);return C.jsx("section",{className:Z.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":l}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function v0(e){const t=T9(Y1);return C.jsx(g0,{...e,...t})}function g0(e){var K;const{header:t=!0,toolbar:n=!0,footer:r=!0,headerMenu:i=!0,contextMenu:l=!0,ribbonType:o="default",mountContainer:c,onRendered:v}=e,m=R.useDependency(h.LocaleService),b=R.useDependency(h.ThemeService),d=R.useDependency(re),w=a.useRef(null),S=R.useDependency(h.IConfigService).getConfig(Y1),T=p1(o1.CUSTOM_HEADER),D=p1(o1.FOOTER),I=p1(o1.HEADER),V=p1(o1.HEADER_MENU),O=p1(o1.CONTENT),U=p1(o1.LEFT_SIDEBAR),M=p1(o1.GLOBAL),x=p1(o1.TOOLBAR),$=(K=S==null?void 0:S.popupRootId)!=null?K:"univer-popup-portal";a.useLayoutEffect(()=>{const W=b.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{W.unsubscribe()}},[]);const[X,B]=a.useState(!1);a.useLayoutEffect(()=>{const W=b.darkMode$.subscribe(Y=>{B(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{W.unsubscribe()}},[]),a.useEffect(()=>{w.current&&(v==null||v(w.current))},[v]);const[G,q]=a.useState(m.getLocales()),J=a.useMemo(()=>document.createElement("div"),[]);return a.useEffect(()=>{document.body.appendChild(J);const W=[m.localeChanged$.subscribe(()=>{q(m.getLocales())})];return()=>{W.forEach(Y=>Y.unsubscribe()),document.body.removeChild(J)}},[m,c,J]),C.jsxs(Z.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:J,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:Z.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":X}),tabIndex:-1,onBlur:W=>W.stopPropagation(),onContextMenu:W=>W.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white",children:C.jsx(m1,{components:T},"custom-header")}),t&&n&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:C.jsx(m1,{components:x,sharedProps:{ribbonType:o,headerMenuComponents:V,headerMenu:i}},"toolbar")}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:C.jsx(m1,{components:U},"left-sidebar")}),C.jsxs("section",{className:Z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",Z.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(m1,{components:I},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:w,"data-range-selector":!0,onContextMenu:W=>W.preventDefault(),children:C.jsx(m1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(qe,{})})]}),r&&C.jsx("footer",{children:C.jsx(m1,{components:D,sharedProps:{contextMenu:l}},"footer")}),C.jsx(Je,{})]})]}),C.jsx(m1,{components:M},"global"),C.jsx(Xe,{}),l&&C.jsx(L6,{}),C.jsx(m0,{}),C.jsx("div",{id:$})]})}function m0(){const{mountContainer:e}=a.useContext(Z.ConfigContext),t=p1(o1.FLOATING);return _3.createPortal(C.jsx(m1,{components:t},"floating"),e)}const p0=3e3;class Qe extends h.Disposable{constructor(n,r,i,l,o){super();j(this,"_steadyTimeout");j(this,"_renderTimeout");j(this,"_currentRenderId",null);this._injector=n,this._instanceService=r,this._layoutService=i,this._lifecycleService=l,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout)}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(n,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(n)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[l]of i)if(this._changeRenderUnit(l,n))break;this.disposeWithMe(this._instanceService.focused$.subscribe(l=>{l&&this._changeRenderUnit(l,n)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(l=>{var o;l.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(l.unitId,n)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(l=>{this._currentRenderId===l&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},p0)},300)}catch(i){if(i instanceof h.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(n,r){if(this._currentRenderId===n)return!1;const i=this._renderManagerService.getRenderById(n);if(!i||!i.unitId||h.isInternalEditorID(i.unitId))return!1;const l=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return l==null||l.deactivate(),l==null||l.engine.unmount(),i.engine.mount(r),i.activate(),this._currentRenderId=n,!0}}var b0=Object.getOwnPropertyDescriptor,L0=(e,t,n,r)=>{for(var i=r>1?void 0:r?b0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},V1=(e,t)=>(n,r)=>t(n,r,e);f.DesktopUIController=class extends Qe{constructor(t,n,r,i,l,o,c,v,m){super(n,o,l,r,i),this._config=t,this._componentManager=m,c.mergeMenu(n6),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[O9,D9],[N9,V9],[P9,k9],[U9,A9],[$9,Z9],[x9,Z.ColorPicker]].forEach(([t,n])=>{this.disposeWithMe(this._componentManager.register(t,n))})}bootstrap(t){return w0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(o1.FLOATING,()=>R.connectInjector(Ge,this._injector))),this.disposeWithMe(t.registerComponent(o1.CONTENT,()=>R.connectInjector(je,this._injector))),this.disposeWithMe(t.registerComponent(o1.TOOLBAR,()=>R.connectInjector(b6,this._injector)))}},f.DesktopUIController=L0([V1(1,h.Inject(h.Injector)),V1(2,h.Inject(h.LifecycleService)),V1(3,z1.IRenderManagerService),V1(4,H1),V1(5,h.IUniverInstanceService),V1(6,S1),V1(7,_1),V1(8,h.Inject(v1))],f.DesktopUIController);function w0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=w6(i)}else i instanceof HTMLElement?r=i:r=w6("univer");const l=R.connectInjector(v0,e),o=v=>n(v,r);function c(){Z.render(C.jsx(l,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{Z.render(C.jsx("div",{}),r),setTimeout(()=>Z.render(C.jsx("div",{}),r),200),setTimeout(()=>Z.unmount(r),500)})}function w6(e){const t=document.createElement("div");return t.id=e,t}function _0(e){const{menuType:t,onOptionSelect:n}=e,r=R.useDependency(S1);if(!t)return null;const i=a.useMemo(()=>{const l=r.getMenuByPositionKey(t);function o(c){return c.reduce((v,m)=>m.children?[...v,...o(m.children)]:[...v,m],[])}return o(l)},[t]);return C.jsx("div",{className:"univer-box-border univer-grid univer-min-w-8 univer-max-w-52 univer-gap-1 univer-rounded univer-bg-gray-900 univer-px-2 univer-py-1",style:{gridTemplateColumns:`repeat(${Math.min(2,i.length)}, 72px)`},children:i.map(l=>l.item&&C.jsx(y0,{menuItem:l.item,onClick:o=>n==null?void 0:n({value:"",label:l.key,...o})},l.key))})}function y0(e){const{menuItem:t,onClick:n}=e,{id:r,type:i,title:l,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const v=R.useObservable(t.disabled$,!1),m=R.useObservable(t.value$);return C.jsx("button",{type:"button",className:Z.clsx("univer-w-18 univer-flex univer-flex-col univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-text-white [&>span]:univer-mt-0.5 [&>span]:univer-w-full [&>span]:univer-truncate [&>span]:univer-text-sm [&>svg]:univer-size-[18px] [&>svg]:univer-text-lg"),disabled:v,onClick:()=>n({id:r}),children:C.jsx(d1,{value:m,title:l,label:o,icon:c})},r)}function _6(){const[e,t]=a.useState(!1),[n,r]=a.useState(""),[i,l]=a.useState([0,0]),o=a.useRef(e),c=R.useDependency(ie),v=R.useDependency(h.ICommandService);o.current=e,a.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",b),document.addEventListener("wheel",b),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("wheel",b),d.dispose()}},[c]);function m(d,w){r(w),l([d.clientX,d.clientY]),t(!0)}function b(){t(!1)}return C.jsx(Z.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:n&&C.jsx(_0,{menuType:n,onOptionSelect:d=>{const{label:w,value:y,commandId:S}=d;v&&v.executeCommand(S!=null?S:w,{value:y}),t(!1)}})})})}function M0(e){const{header:t=!0,footer:n=!0,contextMenu:r=!0,mountContainer:i,onRendered:l}=e,o=R.useDependency(h.LocaleService),c=R.useDependency(h.ThemeService),v=R.useDependency(re),m=a.useRef(null),b=p1(o1.FOOTER),d=p1(o1.HEADER),w=p1(o1.CONTENT),y=p1(o1.LEFT_SIDEBAR),S=p1(o1.GLOBAL),[T,D]=a.useState(!1);a.useEffect(()=>{const U=c.darkMode$.subscribe(M=>{D(M)});return()=>{U.unsubscribe()}},[]),a.useEffect(()=>{m.current&&(l==null||l(m.current))},[l]);const[I,V]=a.useState(o.getLocales()),O=a.useMemo(()=>document.createElement("div"),[]);return a.useLayoutEffect(()=>{const U=c.currentTheme$.subscribe(M=>{v.injectThemeToHead(M)});return()=>{U.unsubscribe()}},[]),a.useEffect(()=>{document.body.appendChild(O);const U=[o.localeChanged$.subscribe(()=>{V(o.getLocales())})];return()=>{U.forEach(M=>M.unsubscribe()),document.body.removeChild(O)}},[o,i,O]),C.jsxs(Z.ConfigProvider,{locale:I==null?void 0:I.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:Z.clsx("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":T}),tabIndex:-1,onBlur:U=>U.stopPropagation(),children:[t&&C.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{className:"univer-h-full",children:C.jsx(m1,{components:y},"left-sidebar")}),C.jsxs("section",{className:Z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",Z.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(m1,{components:d},"header")}),C.jsx("section",{ref:m,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:U=>U.preventDefault(),children:C.jsx(m1,{components:w},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(qe,{})})]}),n&&C.jsx("footer",{children:C.jsx(m1,{components:b},"footer")}),C.jsx(Xe,{}),C.jsx(Je,{})]})]}),C.jsx(m1,{components:S},"global"),r&&C.jsx(_6,{})]})}var S0=Object.getOwnPropertyDescriptor,I0=(e,t,n,r)=>{for(var i=r>1?void 0:r?S0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},U1=(e,t)=>(n,r)=>t(n,r,e);let Ke=class extends Qe{constructor(e,t,n,r,i,l,o){super(t,l,i,n,r),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return H0(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>R.connectInjector(Ge,this._injector))),this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>R.connectInjector(je,this._injector)))}};Ke=I0([U1(1,h.Inject(h.Injector)),U1(2,h.Inject(h.LifecycleService)),U1(3,z1.IRenderManagerService),U1(4,H1),U1(5,h.IUniverInstanceService),U1(6,_1)],Ke);function H0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=y6(i)}else i instanceof HTMLElement?r=i:r=y6("univer");const l=R.connectInjector(M0,e),o=v=>n(v,r);function c(){Z.render(C.jsx(l,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{Z.unmount(r)})}function y6(e){const t=document.createElement("div");return t.id=e,t}const oe=h.createIdentifier("ui.notification.service");var E0=Object.getOwnPropertyDescriptor,D0=(e,t,n,r)=>{for(var i=r>1?void 0:r?E0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},O0=(e,t)=>(n,r)=>t(n,r,e);const e3=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){j(this,"_beforeUnloadCallbacks",[]);j(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=>{let n=t;const r=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
12
12
  `);if(r)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:r}),typeof n>"u"&&(n=window.event),n.returnValue=r,r}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}},f.DesktopBeforeCloseService=D0([O0(0,oe)],f.DesktopBeforeCloseService);function M6(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var V0=Object.getOwnPropertyDescriptor,N0=(e,t,n,r)=>{for(var i=r>1?void 0:r?V0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},t3=(e,t)=>(n,r)=>t(n,r,e);const n3="text/plain",r3="text/html",S6="image/png",I6="image/jpeg",H6="image/bmp",E6="image/webp",R0="image/svg+xml",T0=new Set([H6,I6,E6,S6]),i3=h.createIdentifier("univer.clipboard-interface-service");f.BrowserClipboardService=class extends h.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return M6()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[n3]:new Blob([t],{type:n3}),[r3]:new Blob([n],{type:r3})})])}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=Z0();document.body.appendChild(r),r.innerHTML=t;try{D6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=x0();document.body.appendChild(r),r.value=t;try{D6(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")})}},f.BrowserClipboardService=N0([t3(0,h.Inject(h.LocaleService)),t3(1,h.ILogService),t3(2,h.Optional(oe))],f.BrowserClipboardService);function x0(){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 Z0(){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 D6(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()}const we=h.createIdentifier("univer.confirm-service");class k0{constructor(){j(this,"confirmOptions$",new z.Subject)}dispose(){this.confirmOptions$.complete()}open(t){throw new Error("This is not implemented in the test service!")}confirm(t){return Promise.resolve(!0)}close(t){throw new Error("This is not implemented in the test service!")}}const A0=e=>{const{children:t,onClose:n,onConfirm:r}=e,[i]=a.useState({}),l=t?a.cloneElement(t,{hooks:i}):null;return C.jsx(Z.Confirm,{...e,children:l,onClose:()=>{const o=i.beforeClose;if(o){const c=o();if(c.cancel)return;n==null||n(c);return}n==null||n()},onConfirm:()=>{const o=i.beforeConfirm;if(o){const c=o();if(c.cancel)return;r==null||r(c);return}r==null||r()}})};function $0(){const e=R.useDependency(we),[t,n]=a.useState([]);a.useEffect(()=>{const i=e.confirmOptions$.subscribe(l=>{n(l)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:l,title:o,...c}=i,v=c;for(const m of["children","title"]){const b=m,d=i[b];d&&(v[b]=C.jsx(d1,{...d}))}return v});return r==null?void 0:r.map((i,l)=>C.jsx(A0,{...i,children:i.children},l))}var P0=Object.getOwnPropertyDescriptor,U0=(e,t,n,r)=>{for(var i=r>1?void 0:r?P0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},O6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopConfirmService=class extends h.Disposable{constructor(n,r){super();j(this,"_confirmOptions",[]);j(this,"confirmOptions$",new z.BehaviorSubject([]));this._injector=n,this._uiPartsService=r,this._initUIPart()}open(n){return this._confirmOptions.find(r=>r.id===n.id)?this._confirmOptions=this._confirmOptions.map(r=>({...r.id===n.id?n:r,visible:r.id===n.id?!0:r.visible})):this._confirmOptions.push({...n,visible:!0}),this.confirmOptions$.next(this._confirmOptions),h.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(n){return new Promise(r=>{const i=this.open({...n,onConfirm:()=>{i.dispose(),r(!0)},onClose:()=>{i.dispose(),r(!1)}})})}close(n){this._confirmOptions=this._confirmOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector($0,this._injector)))}},f.DesktopConfirmService=U0([O6(0,h.Inject(h.Injector)),O6(1,_1)],f.DesktopConfirmService);const _e=h.createIdentifier("univer.ui.dialog-service");function B0(){const e=R.useDependency(_e),[t,n]=a.useState([]);a.useEffect(()=>{const l=e.getDialogs$().subscribe(o=>{n(o)});return()=>l.unsubscribe()},[]);const r=a.useMemo(()=>t.map(i=>{const{children:l,title:o,footer:c,...v}=i,m=v;for(const b of["children","title","footer"]){const d=b,w=i[d];w&&(m[d]=C.jsx(d1,{...w}))}return m}),[t]);return r==null?void 0:r.map(i=>C.jsx(Z.Dialog,{...i},i.id))}var F0=Object.getOwnPropertyDescriptor,j0=(e,t,n,r)=>{for(var i=r>1?void 0:r?F0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},V6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopDialogService=class extends h.Disposable{constructor(n,r){super();j(this,"_dialogOptions",[]);j(this,"_dialogOptions$",new z.Subject);this._injector=n,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions=[],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,open:r.id===n.id?!0:r.open})):this._dialogOptions.push({...n,open:!0}),this._dialogOptions$.next(this._dialogOptions),h.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,open:r.id===n?!1:r.open})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(n){const r=new Set(n);this._dialogOptions=this._dialogOptions.map(i=>({...i,open:r.has(i.id)?i.open:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(B0,this._injector)))}},f.DesktopDialogService=j0([V6(0,h.Inject(h.Injector)),V6(1,_1)],f.DesktopDialogService);const ye=h.createIdentifier("univer.ui.gallery-service");function z0(){const e=R.useDependency(ye),t=R.useObservable(e.gallery$);return t?C.jsx(Z.Gallery,{...t}):null}var G0=Object.getOwnPropertyDescriptor,W0=(e,t,n,r)=>{for(var i=r>1?void 0:r?G0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},N6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopGalleryService=class extends h.Disposable{constructor(n,r){super();j(this,"gallery$",new z.Subject);this._injector=n,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose()}open(n){return this.gallery$.next({open:!0,...n}),h.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(z0,this._injector)))}},f.DesktopGalleryService=W0([N6(0,h.Inject(h.Injector)),N6(1,_1)],f.DesktopGalleryService);var Y0=Object.getOwnPropertyDescriptor,X0=(e,t,n,r)=>{for(var i=r>1?void 0:r?Y0(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},q0=(e,t)=>(n,r)=>t(n,r,e);f.DesktopGlobalZoneService=class{constructor(t){j(this,"visible$",new z.Subject);j(this,"componentKey$",new z.Subject);j(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,h.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},f.DesktopGlobalZoneService=X0([q0(0,h.Inject(v1))],f.DesktopGlobalZoneService);var Me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Se(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 o3={exports:{}};/*!
13
13
  localForage -- Offline Storage, Improved
14
14
  Version 1.10.0
15
15
  https://localforage.github.io/localForage
16
16
  (c) 2013-2017 Mozilla, Apache License 2.0
17
- */var R6;function Q0(){return R6||(R6=1,function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,l){function o(m,b){if(!i[m]){if(!r[m]){var d=typeof Se=="function"&&Se;if(!b&&d)return d(m,!0);if(c)return c(m,!0);var w=new Error("Cannot find module '"+m+"'");throw w.code="MODULE_NOT_FOUND",w}var y=i[m]={exports:{}};r[m][0].call(y.exports,function(S){var T=r[m][1][S];return o(T||S)},y,y.exports,n,r,i,l)}return i[m].exports}for(var c=typeof Se=="function"&&Se,v=0;v<l.length;v++)o(l[v]);return o}({1:[function(n,r,i){(function(l){var o=l.MutationObserver||l.WebKitMutationObserver,c;if(o){var v=0,m=new o(S),b=l.document.createTextNode("");m.observe(b,{characterData:!0}),c=function(){b.data=v=++v%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var d=new l.MessageChannel;d.port1.onmessage=S,c=function(){d.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?c=function(){var D=l.document.createElement("script");D.onreadystatechange=function(){S(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},l.document.documentElement.appendChild(D)}:c=function(){setTimeout(S,0)};var w,y=[];function S(){w=!0;for(var D,I,V=y.length;V;){for(I=y,y=[],D=-1;++D<V;)I[D]();V=y.length}w=!1}r.exports=T;function T(D){y.push(D)===1&&!w&&c()}}).call(this,typeof Me<"u"?Me:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var l=n(1);function o(){}var c={},v=["REJECTED"],m=["FULFILLED"],b=["PENDING"];r.exports=d;function d(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,M!==o&&T(this,M)}d.prototype.catch=function(M){return this.then(null,M)},d.prototype.then=function(M,x){if(typeof M!="function"&&this.state===m||typeof x!="function"&&this.state===v)return this;var $=new this.constructor(o);if(this.state!==b){var X=this.state===m?M:x;y($,X,this.outcome)}else this.queue.push(new w($,M,x));return $};function w(M,x,$){this.promise=M,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof $=="function"&&(this.onRejected=$,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(M){c.resolve(this.promise,M)},w.prototype.otherCallFulfilled=function(M){y(this.promise,this.onFulfilled,M)},w.prototype.callRejected=function(M){c.reject(this.promise,M)},w.prototype.otherCallRejected=function(M){y(this.promise,this.onRejected,M)};function y(M,x,$){l(function(){var X;try{X=x($)}catch(B){return c.reject(M,B)}X===M?c.reject(M,new TypeError("Cannot resolve promise with itself")):c.resolve(M,X)})}c.resolve=function(M,x){var $=D(S,x);if($.status==="error")return c.reject(M,$.value);var X=$.value;if(X)T(M,X);else{M.state=m,M.outcome=x;for(var B=-1,G=M.queue.length;++B<G;)M.queue[B].callFulfilled(x)}return M},c.reject=function(M,x){M.state=v,M.outcome=x;for(var $=-1,X=M.queue.length;++$<X;)M.queue[$].callRejected(x);return M};function S(M){var x=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof x=="function")return function(){x.apply(M,arguments)}}function T(M,x){var $=!1;function X(J){$||($=!0,c.reject(M,J))}function B(J){$||($=!0,c.resolve(M,J))}function G(){x(B,X)}var q=D(G);q.status==="error"&&X(q.value)}function D(M,x){var $={};try{$.value=M(x),$.status="success"}catch(X){$.status="error",$.value=X}return $}d.resolve=I;function I(M){return M instanceof this?M:c.resolve(new this(o),M)}d.reject=V;function V(M){var x=new this(o);return c.reject(x,M)}d.all=O;function O(M){var x=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=M.length,X=!1;if(!$)return this.resolve([]);for(var B=new Array($),G=0,q=-1,J=new this(o);++q<$;)K(M[q],q);return J;function K(W,Y){x.resolve(W).then(e1,function(l1){X||(X=!0,c.reject(J,l1))});function e1(l1){B[Y]=l1,++G===$&&!X&&(X=!0,c.resolve(J,B))}}}d.race=U;function U(M){var x=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=M.length,X=!1;if(!$)return this.resolve([]);for(var B=-1,G=new this(o);++B<$;)q(M[B]);return G;function q(J){x.resolve(J).then(function(K){X||(X=!0,c.resolve(G,K))},function(K){X||(X=!0,c.reject(G,K))})}}},{1:1}],3:[function(n,r,i){(function(l){typeof l.Promise!="function"&&(l.Promise=n(2))}).call(this,typeof Me<"u"?Me:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function o(s,g){if(!(s instanceof g))throw new TypeError("Cannot call a class as a function")}function c(){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 v=c();function m(){try{if(!v||!v.open)return!1;var s=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),g=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!s||g)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function b(s,g){s=s||[],g=g||{};try{return new Blob(s,g)}catch(p){if(p.name!=="TypeError")throw p;for(var u=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new u,_=0;_<s.length;_+=1)L.append(s[_]);return L.getBlob(g.type)}}typeof Promise>"u"&&n(3);var d=Promise;function w(s,g){g&&s.then(function(u){g(null,u)},function(u){g(u)})}function y(s,g,u){typeof g=="function"&&s.then(g),typeof u=="function"&&s.catch(u)}function S(s){return typeof s!="string"&&(console.warn(s+" used as a key, but it is not a string."),s=String(s)),s}function T(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",I=void 0,V={},O=Object.prototype.toString,U="readonly",M="readwrite";function x(s){for(var g=s.length,u=new ArrayBuffer(g),L=new Uint8Array(u),_=0;_<g;_++)L[_]=s.charCodeAt(_);return u}function $(s){return new d(function(g){var u=s.transaction(D,M),L=b([""]);u.objectStore(D).put(L,"key"),u.onabort=function(_){_.preventDefault(),_.stopPropagation(),g(!1)},u.oncomplete=function(){var _=navigator.userAgent.match(/Chrome\/(\d+)/),p=navigator.userAgent.match(/Edge\//);g(p||!_||parseInt(_[1],10)>=43)}}).catch(function(){return!1})}function X(s){return typeof I=="boolean"?d.resolve(I):$(s).then(function(g){return I=g,I})}function B(s){var g=V[s.name],u={};u.promise=new d(function(L,_){u.resolve=L,u.reject=_}),g.deferredOperations.push(u),g.dbReady?g.dbReady=g.dbReady.then(function(){return u.promise}):g.dbReady=u.promise}function G(s){var g=V[s.name],u=g.deferredOperations.pop();if(u)return u.resolve(),u.promise}function q(s,g){var u=V[s.name],L=u.deferredOperations.pop();if(L)return L.reject(g),L.promise}function J(s,g){return new d(function(u,L){if(V[s.name]=V[s.name]||r1(),s.db)if(g)B(s),s.db.close();else return u(s.db);var _=[s.name];g&&_.push(s.version);var p=v.open.apply(v,_);g&&(p.onupgradeneeded=function(E){var N=p.result;try{N.createObjectStore(s.storeName),E.oldVersion<=1&&N.createObjectStore(D)}catch(k){if(k.name==="ConstraintError")console.warn('The database "'+s.name+'" has been upgraded from version '+E.oldVersion+" to version "+E.newVersion+', but the storage "'+s.storeName+'" already exists.');else throw k}}),p.onerror=function(E){E.preventDefault(),L(p.error)},p.onsuccess=function(){var E=p.result;E.onversionchange=function(N){N.target.close()},u(E),G(s)}})}function K(s){return J(s,!1)}function W(s){return J(s,!0)}function Y(s,g){if(!s.db)return!0;var u=!s.db.objectStoreNames.contains(s.storeName),L=s.version<s.db.version,_=s.version>s.db.version;if(L&&(s.version!==g&&console.warn('The database "'+s.name+`" can't be downgraded from version `+s.db.version+" to version "+s.version+"."),s.version=s.db.version),_||u){if(u){var p=s.db.version+1;p>s.version&&(s.version=p)}return!0}return!1}function e1(s){return new d(function(g,u){var L=new FileReader;L.onerror=u,L.onloadend=function(_){var p=btoa(_.target.result||"");g({__local_forage_encoded_blob:!0,data:p,type:s.type})},L.readAsBinaryString(s)})}function l1(s){var g=x(atob(s.data));return b([g],{type:s.type})}function C1(s){return s&&s.__local_forage_encoded_blob}function b1(s){var g=this,u=g._initReady().then(function(){var L=V[g._dbInfo.name];if(L&&L.dbReady)return L.dbReady});return y(u,s,s),u}function y1(s){B(s);for(var g=V[s.name],u=g.forages,L=0;L<u.length;L++){var _=u[L];_._dbInfo.db&&(_._dbInfo.db.close(),_._dbInfo.db=null)}return s.db=null,K(s).then(function(p){return s.db=p,Y(s)?W(s):p}).then(function(p){s.db=g.db=p;for(var E=0;E<u.length;E++)u[E]._dbInfo.db=p}).catch(function(p){throw q(s,p),p})}function a1(s,g,u,L){L===void 0&&(L=1);try{var _=s.db.transaction(s.storeName,g);u(null,_)}catch(p){if(L>0&&(!s.db||p.name==="InvalidStateError"||p.name==="NotFoundError"))return d.resolve().then(function(){if(!s.db||p.name==="NotFoundError"&&!s.db.objectStoreNames.contains(s.storeName)&&s.version<=s.db.version)return s.db&&(s.version=s.db.version+1),W(s)}).then(function(){return y1(s).then(function(){a1(s,g,u,L-1)})}).catch(u);u(p)}}function r1(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function u1(s){var g=this,u={db:null};if(s)for(var L in s)u[L]=s[L];var _=V[u.name];_||(_=r1(),V[u.name]=_),_.forages.push(g),g._initReady||(g._initReady=g.ready,g.ready=b1);var p=[];function E(){return d.resolve()}for(var N=0;N<_.forages.length;N++){var k=_.forages[N];k!==g&&p.push(k._initReady().catch(E))}var A=_.forages.slice(0);return d.all(p).then(function(){return u.db=_.db,K(u)}).then(function(P){return u.db=P,Y(u,g._defaultConfig.version)?W(u):P}).then(function(P){u.db=_.db=P,g._dbInfo=u;for(var F=0;F<A.length;F++){var Q=A[F];Q!==g&&(Q._dbInfo.db=u.db,Q._dbInfo.version=u.version)}})}function L1(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.get(s);A.onsuccess=function(){var P=A.result;P===void 0&&(P=null),C1(P)&&(P=l1(P)),_(P)},A.onerror=function(){p(A.error)}}catch(P){p(P)}})}).catch(p)});return w(L,g),L}function I1(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.openCursor(),P=1;A.onsuccess=function(){var F=A.result;if(F){var Q=F.value;C1(Q)&&(Q=l1(Q));var t1=s(Q,F.key,P++);t1!==void 0?_(t1):F.continue()}else _()},A.onerror=function(){p(A.error)}}catch(F){p(F)}})}).catch(p)});return w(L,g),L}function Z1(s,g,u){var L=this;s=S(s);var _=new d(function(p,E){var N;L.ready().then(function(){return N=L._dbInfo,O.call(g)==="[object Blob]"?X(N.db).then(function(k){return k?g:e1(g)}):g}).then(function(k){a1(L._dbInfo,M,function(A,P){if(A)return E(A);try{var F=P.objectStore(L._dbInfo.storeName);k===null&&(k=void 0);var Q=F.put(k,s);P.oncomplete=function(){k===void 0&&(k=null),p(k)},P.onabort=P.onerror=function(){var t1=Q.error?Q.error:Q.transaction.error;E(t1)}}catch(t1){E(t1)}})}).catch(E)});return w(_,u),_}function B1(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,M,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.delete(s);N.oncomplete=function(){_()},N.onerror=function(){p(A.error)},N.onabort=function(){var P=A.error?A.error:A.transaction.error;p(P)}}catch(P){p(P)}})}).catch(p)});return w(L,g),L}function F1(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,M,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.clear();E.oncomplete=function(){L()},E.onabort=E.onerror=function(){var A=k.error?k.error:k.transaction.error;_(A)}}catch(A){_(A)}})}).catch(_)});return w(u,s),u}function T4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,U,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.count();k.onsuccess=function(){L(k.result)},k.onerror=function(){_(k.error)}}catch(A){_(A)}})}).catch(_)});return w(u,s),u}function x4(s,g){var u=this,L=new d(function(_,p){if(s<0){_(null);return}u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=!1,P=k.openKeyCursor();P.onsuccess=function(){var F=P.result;if(!F){_(null);return}s===0||A?_(F.key):(A=!0,F.advance(s))},P.onerror=function(){p(P.error)}}catch(F){p(F)}})}).catch(p)});return w(L,g),L}function Z4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,U,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.openKeyCursor(),A=[];k.onsuccess=function(){var P=k.result;if(!P){L(A);return}A.push(P.key),P.continue()},k.onerror=function(){_(k.error)}}catch(P){_(P)}})}).catch(_)});return w(u,s),u}function k4(s,g){g=T.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var L=this,_;if(!s.name)_=d.reject("Invalid arguments");else{var p=s.name===u.name&&L._dbInfo.db,E=p?d.resolve(L._dbInfo.db):K(s).then(function(N){var k=V[s.name],A=k.forages;k.db=N;for(var P=0;P<A.length;P++)A[P]._dbInfo.db=N;return N});s.storeName?_=E.then(function(N){if(N.objectStoreNames.contains(s.storeName)){var k=N.version+1;B(s);var A=V[s.name],P=A.forages;N.close();for(var F=0;F<P.length;F++){var Q=P[F];Q._dbInfo.db=null,Q._dbInfo.version=k}var t1=new d(function(n1,c1){var s1=v.open(s.name,k);s1.onerror=function(M1){var le=s1.result;le.close(),c1(M1)},s1.onupgradeneeded=function(){var M1=s1.result;M1.deleteObjectStore(s.storeName)},s1.onsuccess=function(){var M1=s1.result;M1.close(),n1(M1)}});return t1.then(function(n1){A.db=n1;for(var c1=0;c1<P.length;c1++){var s1=P[c1];s1._dbInfo.db=n1,G(s1._dbInfo)}}).catch(function(n1){throw(q(s,n1)||d.resolve()).catch(function(){}),n1})}}):_=E.then(function(N){B(s);var k=V[s.name],A=k.forages;N.close();for(var P=0;P<A.length;P++){var F=A[P];F._dbInfo.db=null}var Q=new d(function(t1,n1){var c1=v.deleteDatabase(s.name);c1.onerror=function(){var s1=c1.result;s1&&s1.close(),n1(c1.error)},c1.onblocked=function(){console.warn('dropInstance blocked for database "'+s.name+'" until all open connections are closed')},c1.onsuccess=function(){var s1=c1.result;s1&&s1.close(),t1(s1)}});return Q.then(function(t1){k.db=t1;for(var n1=0;n1<A.length;n1++){var c1=A[n1];G(c1._dbInfo)}}).catch(function(t1){throw(q(s,t1)||d.resolve()).catch(function(){}),t1})})}return w(_,g),_}var A4={_driver:"asyncStorage",_initStorage:u1,_support:m(),iterate:I1,getItem:L1,setItem:Z1,removeItem:B1,clear:F1,length:T4,key:x4,keys:Z4,dropInstance:k4};function $4(){return typeof openDatabase=="function"}var N1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P4="~~local_forage_type~",G6=/^~~local_forage_type~([^~]+)~/,De="__lfsc__:",f3=De.length,h3="arbf",C3="blob",W6="si08",Y6="ui08",X6="uic8",q6="si16",J6="si32",Q6="ur16",K6="ui32",en="fl32",tn="fl64",nn=f3+h3.length,rn=Object.prototype.toString;function on(s){var g=s.length*.75,u=s.length,L,_=0,p,E,N,k;s[s.length-1]==="="&&(g--,s[s.length-2]==="="&&g--);var A=new ArrayBuffer(g),P=new Uint8Array(A);for(L=0;L<u;L+=4)p=N1.indexOf(s[L]),E=N1.indexOf(s[L+1]),N=N1.indexOf(s[L+2]),k=N1.indexOf(s[L+3]),P[_++]=p<<2|E>>4,P[_++]=(E&15)<<4|N>>2,P[_++]=(N&3)<<6|k&63;return A}function v3(s){var g=new Uint8Array(s),u="",L;for(L=0;L<g.length;L+=3)u+=N1[g[L]>>2],u+=N1[(g[L]&3)<<4|g[L+1]>>4],u+=N1[(g[L+1]&15)<<2|g[L+2]>>6],u+=N1[g[L+2]&63];return g.length%3===2?u=u.substring(0,u.length-1)+"=":g.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function U4(s,g){var u="";if(s&&(u=rn.call(s)),s&&(u==="[object ArrayBuffer]"||s.buffer&&rn.call(s.buffer)==="[object ArrayBuffer]")){var L,_=De;s instanceof ArrayBuffer?(L=s,_+=h3):(L=s.buffer,u==="[object Int8Array]"?_+=W6:u==="[object Uint8Array]"?_+=Y6:u==="[object Uint8ClampedArray]"?_+=X6:u==="[object Int16Array]"?_+=q6:u==="[object Uint16Array]"?_+=Q6:u==="[object Int32Array]"?_+=J6:u==="[object Uint32Array]"?_+=K6:u==="[object Float32Array]"?_+=en:u==="[object Float64Array]"?_+=tn:g(new Error("Failed to get type for BinaryArray"))),g(_+v3(L))}else if(u==="[object Blob]"){var p=new FileReader;p.onload=function(){var E=P4+s.type+"~"+v3(this.result);g(De+C3+E)},p.readAsArrayBuffer(s)}else try{g(JSON.stringify(s))}catch(E){console.error("Couldn't convert value into a JSON string: ",s),g(null,E)}}function B4(s){if(s.substring(0,f3)!==De)return JSON.parse(s);var g=s.substring(nn),u=s.substring(f3,nn),L;if(u===C3&&G6.test(g)){var _=g.match(G6);L=_[1],g=g.substring(_[0].length)}var p=on(g);switch(u){case h3:return p;case C3:return b([p],{type:L});case W6:return new Int8Array(p);case Y6:return new Uint8Array(p);case X6:return new Uint8ClampedArray(p);case q6:return new Int16Array(p);case Q6:return new Uint16Array(p);case J6:return new Int32Array(p);case K6:return new Uint32Array(p);case en:return new Float32Array(p);case tn:return new Float64Array(p);default:throw new Error("Unkown type: "+u)}}var g3={serialize:U4,deserialize:B4,stringToBuffer:on,bufferToString:v3};function an(s,g,u,L){s.executeSql("CREATE TABLE IF NOT EXISTS "+g.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,L)}function F4(s){var g=this,u={db:null};if(s)for(var L in s)u[L]=typeof s[L]!="string"?s[L].toString():s[L];var _=new d(function(p,E){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(N){return E(N)}u.db.transaction(function(N){an(N,u,function(){g._dbInfo=u,p()},function(k,A){E(A)})},E)});return u.serializer=g3,_}function R1(s,g,u,L,_,p){s.executeSql(u,L,_,function(E,N){N.code===N.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[g.storeName],function(k,A){A.rows.length?p(k,N):an(k,g,function(){k.executeSql(u,L,_,p)},p)},p):p(E,N)},p)}function j4(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[s],function(k,A){var P=A.rows.length?A.rows.item(0).value:null;P&&(P=E.serializer.deserialize(P)),_(P)},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function z4(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT * FROM "+E.storeName,[],function(k,A){for(var P=A.rows,F=P.length,Q=0;Q<F;Q++){var t1=P.item(Q),n1=t1.value;if(n1&&(n1=E.serializer.deserialize(n1)),n1=s(n1,t1.key,Q+1),n1!==void 0){_(n1);return}}_()},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function ln(s,g,u,L){var _=this;s=S(s);var p=new d(function(E,N){_.ready().then(function(){g===void 0&&(g=null);var k=g,A=_._dbInfo;A.serializer.serialize(g,function(P,F){F?N(F):A.db.transaction(function(Q){R1(Q,A,"INSERT OR REPLACE INTO "+A.storeName+" (key, value) VALUES (?, ?)",[s,P],function(){E(k)},function(t1,n1){N(n1)})},function(Q){if(Q.code===Q.QUOTA_ERR){if(L>0){E(ln.apply(_,[s,k,u,L-1]));return}N(Q)}})})}).catch(N)});return w(p,u),p}function G4(s,g,u){return ln.apply(this,[s,g,u,1])}function W4(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[s],function(){_()},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function Y4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"DELETE FROM "+p.storeName,[],function(){L()},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function X4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"SELECT COUNT(key) as c FROM "+p.storeName,[],function(N,k){var A=k.rows.item(0).c;L(A)},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function q4(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[s+1],function(k,A){var P=A.rows.length?A.rows.item(0).key:null;_(P)},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function J4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"SELECT key FROM "+p.storeName,[],function(N,k){for(var A=[],P=0;P<k.rows.length;P++)A.push(k.rows.item(P).key);L(A)},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function Q4(s){return new d(function(g,u){s.transaction(function(L){L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(_,p){for(var E=[],N=0;N<p.rows.length;N++)E.push(p.rows.item(N).name);g({db:s,storeNames:E})},function(_,p){u(p)})},function(L){u(L)})})}function K4(s,g){g=T.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var L=this,_;return s.name?_=new d(function(p){var E;s.name===u.name?E=L._dbInfo.db:E=openDatabase(s.name,"","",0),s.storeName?p({db:E,storeNames:[s.storeName]}):p(Q4(E))}).then(function(p){return new d(function(E,N){p.db.transaction(function(k){function A(t1){return new d(function(n1,c1){k.executeSql("DROP TABLE IF EXISTS "+t1,[],function(){n1()},function(s1,M1){c1(M1)})})}for(var P=[],F=0,Q=p.storeNames.length;F<Q;F++)P.push(A(p.storeNames[F]));d.all(P).then(function(){E()}).catch(function(t1){N(t1)})},function(k){N(k)})})}):_=d.reject("Invalid arguments"),w(_,g),_}var e5={_driver:"webSQLStorage",_initStorage:F4,_support:$4(),iterate:z4,getItem:j4,setItem:G4,removeItem:W4,clear:Y4,length:X4,key:q4,keys:J4,dropInstance:K4};function t5(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function sn(s,g){var u=s.name+"/";return s.storeName!==g.storeName&&(u+=s.storeName+"/"),u}function n5(){var s="_localforage_support_test";try{return localStorage.setItem(s,!0),localStorage.removeItem(s),!1}catch{return!0}}function r5(){return!n5()||localStorage.length>0}function i5(s){var g=this,u={};if(s)for(var L in s)u[L]=s[L];return u.keyPrefix=sn(s,g._defaultConfig),r5()?(g._dbInfo=u,u.serializer=g3,d.resolve()):d.reject()}function o5(s){var g=this,u=g.ready().then(function(){for(var L=g._dbInfo.keyPrefix,_=localStorage.length-1;_>=0;_--){var p=localStorage.key(_);p.indexOf(L)===0&&localStorage.removeItem(p)}});return w(u,s),u}function a5(s,g){var u=this;s=S(s);var L=u.ready().then(function(){var _=u._dbInfo,p=localStorage.getItem(_.keyPrefix+s);return p&&(p=_.serializer.deserialize(p)),p});return w(L,g),L}function l5(s,g){var u=this,L=u.ready().then(function(){for(var _=u._dbInfo,p=_.keyPrefix,E=p.length,N=localStorage.length,k=1,A=0;A<N;A++){var P=localStorage.key(A);if(P.indexOf(p)===0){var F=localStorage.getItem(P);if(F&&(F=_.serializer.deserialize(F)),F=s(F,P.substring(E),k++),F!==void 0)return F}}});return w(L,g),L}function s5(s,g){var u=this,L=u.ready().then(function(){var _=u._dbInfo,p;try{p=localStorage.key(s)}catch{p=null}return p&&(p=p.substring(_.keyPrefix.length)),p});return w(L,g),L}function c5(s){var g=this,u=g.ready().then(function(){for(var L=g._dbInfo,_=localStorage.length,p=[],E=0;E<_;E++){var N=localStorage.key(E);N.indexOf(L.keyPrefix)===0&&p.push(N.substring(L.keyPrefix.length))}return p});return w(u,s),u}function u5(s){var g=this,u=g.keys().then(function(L){return L.length});return w(u,s),u}function d5(s,g){var u=this;s=S(s);var L=u.ready().then(function(){var _=u._dbInfo;localStorage.removeItem(_.keyPrefix+s)});return w(L,g),L}function f5(s,g,u){var L=this;s=S(s);var _=L.ready().then(function(){g===void 0&&(g=null);var p=g;return new d(function(E,N){var k=L._dbInfo;k.serializer.serialize(g,function(A,P){if(P)N(P);else try{localStorage.setItem(k.keyPrefix+s,A),E(p)}catch(F){(F.name==="QuotaExceededError"||F.name==="NS_ERROR_DOM_QUOTA_REACHED")&&N(F),N(F)}})})});return w(_,u),_}function h5(s,g){if(g=T.apply(this,arguments),s=typeof s!="function"&&s||{},!s.name){var u=this.config();s.name=s.name||u.name,s.storeName=s.storeName||u.storeName}var L=this,_;return s.name?_=new d(function(p){s.storeName?p(sn(s,L._defaultConfig)):p(s.name+"/")}).then(function(p){for(var E=localStorage.length-1;E>=0;E--){var N=localStorage.key(E);N.indexOf(p)===0&&localStorage.removeItem(N)}}):_=d.reject("Invalid arguments"),w(_,g),_}var C5={_driver:"localStorageWrapper",_initStorage:i5,_support:t5(),iterate:l5,getItem:a5,setItem:f5,removeItem:d5,clear:o5,length:u5,key:s5,keys:c5,dropInstance:h5},v5=function(g,u){return g===u||typeof g=="number"&&typeof u=="number"&&isNaN(g)&&isNaN(u)},g5=function(g,u){for(var L=g.length,_=0;_<L;){if(v5(g[_],u))return!0;_++}return!1},cn=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},ae={},un={},j1={INDEXEDDB:A4,WEBSQL:e5,LOCALSTORAGE:C5},m5=[j1.INDEXEDDB._driver,j1.WEBSQL._driver,j1.LOCALSTORAGE._driver],Oe=["dropInstance"],m3=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Oe),p5={description:"",driver:m5.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function b5(s,g){s[g]=function(){var u=arguments;return s.ready().then(function(){return s[g].apply(s,u)})}}function p3(){for(var s=1;s<arguments.length;s++){var g=arguments[s];if(g)for(var u in g)g.hasOwnProperty(u)&&(cn(g[u])?arguments[0][u]=g[u].slice():arguments[0][u]=g[u])}return arguments[0]}var L5=function(){function s(g){o(this,s);for(var u in j1)if(j1.hasOwnProperty(u)){var L=j1[u],_=L._driver;this[u]=_,ae[_]||this.defineDriver(L)}this._defaultConfig=p3({},p5),this._config=p3({},this._defaultConfig,g),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return s.prototype.config=function(u){if((typeof u>"u"?"undefined":l(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var L in u){if(L==="storeName"&&(u[L]=u[L].replace(/\W/g,"_")),L==="version"&&typeof u[L]!="number")return new Error("Database version must be a number.");this._config[L]=u[L]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},s.prototype.defineDriver=function(u,L,_){var p=new d(function(E,N){try{var k=u._driver,A=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){N(A);return}for(var P=m3.concat("_initStorage"),F=0,Q=P.length;F<Q;F++){var t1=P[F],n1=!g5(Oe,t1);if((n1||u[t1])&&typeof u[t1]!="function"){N(A);return}}var c1=function(){for(var le=function(y5){return function(){var M5=new Error("Method "+y5+" is not implemented by the current driver"),dn=d.reject(M5);return w(dn,arguments[arguments.length-1]),dn}},b3=0,_5=Oe.length;b3<_5;b3++){var L3=Oe[b3];u[L3]||(u[L3]=le(L3))}};c1();var s1=function(le){ae[k]&&console.info("Redefining LocalForage driver: "+k),ae[k]=u,un[k]=le,E()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(s1,N):s1(!!u._support):s1(!0)}catch(M1){N(M1)}});return y(p,L,_),p},s.prototype.driver=function(){return this._driver||null},s.prototype.getDriver=function(u,L,_){var p=ae[u]?d.resolve(ae[u]):d.reject(new Error("Driver not found."));return y(p,L,_),p},s.prototype.getSerializer=function(u){var L=d.resolve(g3);return y(L,u),L},s.prototype.ready=function(u){var L=this,_=L._driverSet.then(function(){return L._ready===null&&(L._ready=L._initDriver()),L._ready});return y(_,u,u),_},s.prototype.setDriver=function(u,L,_){var p=this;cn(u)||(u=[u]);var E=this._getSupportedDrivers(u);function N(){p._config.driver=p.driver()}function k(F){return p._extend(F),N(),p._ready=p._initStorage(p._config),p._ready}function A(F){return function(){var Q=0;function t1(){for(;Q<F.length;){var n1=F[Q];return Q++,p._dbInfo=null,p._ready=null,p.getDriver(n1).then(k).catch(t1)}N();var c1=new Error("No available storage method found.");return p._driverSet=d.reject(c1),p._driverSet}return t1()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=P.then(function(){var F=E[0];return p._dbInfo=null,p._ready=null,p.getDriver(F).then(function(Q){p._driver=Q._driver,N(),p._wrapLibraryMethodsWithReady(),p._initDriver=A(E)})}).catch(function(){N();var F=new Error("No available storage method found.");return p._driverSet=d.reject(F),p._driverSet}),y(this._driverSet,L,_),this._driverSet},s.prototype.supports=function(u){return!!un[u]},s.prototype._extend=function(u){p3(this,u)},s.prototype._getSupportedDrivers=function(u){for(var L=[],_=0,p=u.length;_<p;_++){var E=u[_];this.supports(E)&&L.push(E)}return L},s.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,L=m3.length;u<L;u++)b5(this,m3[u])},s.prototype.createInstance=function(u){return new s(u)},s}(),w5=new L5;r.exports=w5},{3:3}]},{},[4])(4)})}(o3)),o3.exports}var K0=Q0();const x1=J0(K0);class a3{getItem(t){return x1.getItem(t)}setItem(t,n){return x1.setItem(t,n)}removeItem(t){return x1.removeItem(t)}clear(){return x1.clear()}key(t){return x1.key(t)}keys(){return x1.keys()}iterate(t){return x1.iterate(t)}}var e4=Object.getOwnPropertyDescriptor,t4=(e,t,n,r)=>{for(var i=r>1?void 0:r?e4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},T6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopMessageService=class extends h.Disposable{constructor(t,n){super(),this._injector=t,this._uiPartsService=n,this._initUIPart()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(Z.Messager,this._injector)))}dispose(){Z.removeMessage()}show(t){let n=t;return typeof t.id>"u"&&(n=Object.assign({},t,{id:`message-${Date.now()}`})),Z.message(n),h.toDisposable(()=>Z.removeMessage(n.id))}remove(t){Z.removeMessage(t)}removeAll(){Z.removeMessage()}},f.DesktopMessageService=t4([T6(0,h.Inject(h.Injector)),T6(1,_1)],f.DesktopMessageService);function n4(){const e=R.useDependency(h.ThemeService),t=R.useObservable(e.darkMode$);return C.jsx(Z.Toaster,{theme:t?"dark":"light"})}const r4={show:e=>{const{type:t="message",title:n,content:r,duration:i,closable:l=!0,position:o="top-right"}=e;Z.toast[t](n,{position:o,description:r,duration:i,closeButton:l})}};var i4=Object.getOwnPropertyDescriptor,o4=(e,t,n,r)=>{for(var i=r>1?void 0:r?i4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},x6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopNotificationService=class extends h.Disposable{constructor(t,n){super(),this._injector=t,this._uiPartsService=n,this._initUIPart()}show(t){return r4.show(t),h.toDisposable(()=>{})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(n4,this._injector)))}},f.DesktopNotificationService=o4([x6(0,h.Inject(h.Injector)),x6(1,_1)],f.DesktopNotificationService);class l3{constructor(){j(this,"_sidebarOptions",{});j(this,"sidebarOptions$",new z.Subject);j(this,"scrollEvent$",new z.Subject);j(this,"_container")}get visible(){return this._sidebarOptions.visible||!1}get options(){return this._sidebarOptions}open(t){return this._sidebarOptions={...t,id:t.id,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),h.toDisposable(()=>{this.close()})}close(t){t&&this._sidebarOptions.id!==t||(this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose())}getContainer(){return this._container}setContainer(t){this._container=t}}var a4=Object.getOwnPropertyDescriptor,l4=(e,t,n,r)=>{for(var i=r>1?void 0:r?a4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},s4=(e,t)=>(n,r)=>t(n,r,e);f.DesktopZenZoneService=class{constructor(t){j(this,"visible$",new z.BehaviorSubject(!1));j(this,"componentKey$",new z.ReplaySubject);j(this,"_temporaryHidden$",new z.BehaviorSubject(!1));j(this,"temporaryHidden$",this._temporaryHidden$.asObservable());j(this,"_visible",!1);this._componentManager=t}get visible(){return this._visible}get temporaryHidden(){return this._temporaryHidden$.getValue()}dispose(){this.visible$.next(!1),this.visible$.complete(),this.componentKey$.complete()}hide(){this._temporaryHidden$.next(!0)}show(){this._temporaryHidden$.next(!1)}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),h.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this._visible=!0,this.visible$.next(!0)}close(){this._visible=!1,this.visible$.next(!1)}},f.DesktopZenZoneService=l4([s4(0,h.Inject(v1))],f.DesktopZenZoneService);var c4=Object.defineProperty,u4=Object.getOwnPropertyDescriptor,d4=(e,t,n)=>t in e?c4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f4=(e,t,n,r)=>{for(var i=r>1?void 0:r?u4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},h4=(e,t)=>(n,r)=>t(n,r,e),C4=(e,t,n)=>d4(e,t+"",n);const v4="UNIVER_MOBILE_UI_PLUGIN";f.UniverMobileUIPlugin=class extends h.Plugin{constructor(t,n){super(),this._config=t,this._injector=n}onStarting(){h.mergeOverrideWithDependencies([[v1],[W1],[he],[_1,{useClass:Fe}],[H1,{useClass:f.DesktopLayoutService}],[re],[P1,{useClass:f.ShortcutService}],[Ce,{useClass:Be}],[S1,{useClass:f.MenuManagerService}],[ie,{useClass:Ye}],[i3,{useClass:f.BrowserClipboardService,lazy:!0}],[oe,{useClass:f.DesktopNotificationService,lazy:!0}],[ye,{useClass:f.DesktopGalleryService,lazy:!0}],[_e,{useClass:f.DesktopDialogService,lazy:!0}],[we,{useClass:f.DesktopConfirmService,lazy:!0}],[$1,{useClass:l3,lazy:!0}],[Le,{useClass:f.DesktopZenZoneService,lazy:!0}],[be,{useClass:f.DesktopGlobalZoneService,lazy:!0}],[fe,{useClass:f.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:a3,lazy:!0}],[e3,{useClass:f.DesktopBeforeCloseService}],[me,{useClass:ze}],[ge],[te,{useFactory:n=>n.createInstance(Ke,this._config),deps:[h.Injector]}],[f.SharedController],[f.ErrorController]],this._config.override).forEach(n=>this._injector.add(n)),this._injector.get(te),this._injector.get(f.ErrorController)}},C4(f.UniverMobileUIPlugin,"pluginName",v4),f.UniverMobileUIPlugin=f4([h.DependentOn(z1.UniverRenderEnginePlugin),h4(1,h.Inject(h.Injector))],f.UniverMobileUIPlugin);class Z6 extends h.Disposable{openFile(t){return new Promise(n=>{var i,l;const r=document.createElement("input");r.type="file",r.accept=(i=t==null?void 0:t.accept)!=null?i:"",r.multiple=(l=t==null?void 0:t.multiple)!=null?l:!1,r.onchange=o=>{const c=o.target.files;c&&n(Array.from(c))},r.click()})}downloadFile(t,n){const r=document.createElement("a");r.download=n,r.href=window.URL.createObjectURL(t),r.click()}}const k6=h.createIdentifier("univer-ui.local-file.service"),g4=e=>{const n=R.useDependency($1).getContainer();a.useEffect(()=>{if(n)return n.addEventListener("mousedown",e),()=>{n.removeEventListener("mousedown",e)}},[e,n])},m4=a.memo(e=>{var T,D;const{layer:t,id:n,position:r}=e,i=R.useDependency(h.IUniverInstanceService),l=a.useRef(null),o=a.useRef(null),c=a.useRef(`transform: rotate(${r==null?void 0:r.rotate}deg) translate(${r==null?void 0:r.startX}px, ${r==null?void 0:r.startY}px)`),v=a.useRef((T=r==null?void 0:r.startY)!=null?T:0),m=a.useRef((D=r==null?void 0:r.startX)!=null?D:0),b=typeof t.componentKey=="string"?R.useDependency(v1).get(t.componentKey):t.componentKey,d=a.useMemo(()=>({data:t.data,...t.props}),[t.data,t.props]),w={width:`${r.width-4}px`,height:`${r.height-4}px`,left:`${r.absolute.left?0:"auto"}`,top:`${r.absolute.top?0:"auto"}`,right:`${r.absolute.left?"auto":0}`,bottom:`${r.absolute.top?"auto":0}`};c.current=`rotate(${r.rotate}deg)`,v.current=r.startY,m.current=r.startX;const y=i.getUnit(t.unitId),S=a.useMemo(()=>b?C.jsx(b,{...d,unitId:t.unitId,unit:y,floatDomId:t.id,context:{root:o}}):null,[b,d]);return r?C.jsx("div",{ref:l,className:"univer-absolute univer-z-10 univer-origin-center univer-overflow-hidden",style:{top:v.current,left:m.current,width:Math.max(r.endX-r.startX-2,0),height:Math.max(r.endY-r.startY-2,0),transform:c.current},onPointerMove:I=>{t.onPointerMove(I.nativeEvent)},onPointerDown:I=>{t.onPointerDown(I.nativeEvent)},onPointerUp:I=>{t.onPointerUp(I.nativeEvent)},onWheel:I=>{t.onWheel(I.nativeEvent)},children:C.jsx("div",{ref:o,id:n,className:"univer-absolute univer-overflow-hidden",style:{...w},children:S})}):null});var p4=Object.defineProperty,b4=Object.getOwnPropertyDescriptor,L4=(e,t,n)=>t in e?p4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t,n,r)=>{for(var i=r>1?void 0:r?b4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},s3=(e,t)=>(n,r)=>t(n,r,e),_4=(e,t,n)=>L4(e,t+"",n);const A6="UNIVER_UI_PLUGIN",$6="DISABLE_AUTO_FOCUS";f.UniverUIPlugin=class extends h.Plugin{constructor(t=F9,n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._configService=i;const{menu:l,...o}=h.merge({popupRootId:`univer-popup-portal-${h.generateRandomId(6)}`},F9,this._config);o.disableAutoFocus&&this._contextService.setContextValue($6,!0),l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(Y1,o)}onStarting(){h.mergeOverrideWithDependencies([[v1],[re],[W1],[he],[_1,{useClass:Fe}],[H1,{useClass:f.DesktopLayoutService}],[P1,{useClass:f.ShortcutService}],[Ce,{useClass:Be}],[S1,{useClass:f.MenuManagerService}],[ie,{useClass:Ye}],[i3,{useClass:f.BrowserClipboardService,lazy:!0}],[oe,{useClass:f.DesktopNotificationService,lazy:!0}],[ye,{useClass:f.DesktopGalleryService,lazy:!0}],[_e,{useClass:f.DesktopDialogService,lazy:!0}],[we,{useClass:f.DesktopConfirmService,lazy:!0}],[$1,{useClass:l3,lazy:!0}],[Le,{useClass:f.DesktopZenZoneService,lazy:!0}],[be,{useClass:f.DesktopGlobalZoneService,lazy:!0}],[fe,{useClass:f.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:a3,lazy:!0}],[e3,{useClass:f.DesktopBeforeCloseService}],[k6,{useClass:Z6}],[me,{useClass:ze}],[ge],[te,{useFactory:n=>n.createInstance(f.DesktopUIController,this._config),deps:[h.Injector]}],[f.SharedController],[f.ErrorController],[f.ShortcutPanelController]],this._config.override).forEach(n=>this._injector.add(n)),this._injector.get(te),this._injector.get(f.ErrorController)}onReady(){this._injector.get(f.SharedController)}onSteady(){this._injector.get(f.ShortcutPanelController)}},_4(f.UniverUIPlugin,"pluginName",A6),f.UniverUIPlugin=w4([h.DependentOn(z1.UniverRenderEnginePlugin),s3(1,h.IContextService),s3(2,h.Inject(h.Injector)),s3(3,h.IConfigService)],f.UniverUIPlugin);function Ie(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const y4=.75,P6=78,U6=9,B6="rgba(0,0,0,0)",F6="rgb(0,0,0)";function c3(e){var c;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,l=e.textContent||"";l+=`\r
17
+ */var R6;function Q0(){return R6||(R6=1,function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,l){function o(m,b){if(!i[m]){if(!r[m]){var d=typeof Se=="function"&&Se;if(!b&&d)return d(m,!0);if(c)return c(m,!0);var w=new Error("Cannot find module '"+m+"'");throw w.code="MODULE_NOT_FOUND",w}var y=i[m]={exports:{}};r[m][0].call(y.exports,function(S){var T=r[m][1][S];return o(T||S)},y,y.exports,n,r,i,l)}return i[m].exports}for(var c=typeof Se=="function"&&Se,v=0;v<l.length;v++)o(l[v]);return o}({1:[function(n,r,i){(function(l){var o=l.MutationObserver||l.WebKitMutationObserver,c;if(o){var v=0,m=new o(S),b=l.document.createTextNode("");m.observe(b,{characterData:!0}),c=function(){b.data=v=++v%2}}else if(!l.setImmediate&&typeof l.MessageChannel<"u"){var d=new l.MessageChannel;d.port1.onmessage=S,c=function(){d.port2.postMessage(0)}}else"document"in l&&"onreadystatechange"in l.document.createElement("script")?c=function(){var D=l.document.createElement("script");D.onreadystatechange=function(){S(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},l.document.documentElement.appendChild(D)}:c=function(){setTimeout(S,0)};var w,y=[];function S(){w=!0;for(var D,I,V=y.length;V;){for(I=y,y=[],D=-1;++D<V;)I[D]();V=y.length}w=!1}r.exports=T;function T(D){y.push(D)===1&&!w&&c()}}).call(this,typeof Me<"u"?Me:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var l=n(1);function o(){}var c={},v=["REJECTED"],m=["FULFILLED"],b=["PENDING"];r.exports=d;function d(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,M!==o&&T(this,M)}d.prototype.catch=function(M){return this.then(null,M)},d.prototype.then=function(M,x){if(typeof M!="function"&&this.state===m||typeof x!="function"&&this.state===v)return this;var $=new this.constructor(o);if(this.state!==b){var X=this.state===m?M:x;y($,X,this.outcome)}else this.queue.push(new w($,M,x));return $};function w(M,x,$){this.promise=M,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof $=="function"&&(this.onRejected=$,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(M){c.resolve(this.promise,M)},w.prototype.otherCallFulfilled=function(M){y(this.promise,this.onFulfilled,M)},w.prototype.callRejected=function(M){c.reject(this.promise,M)},w.prototype.otherCallRejected=function(M){y(this.promise,this.onRejected,M)};function y(M,x,$){l(function(){var X;try{X=x($)}catch(B){return c.reject(M,B)}X===M?c.reject(M,new TypeError("Cannot resolve promise with itself")):c.resolve(M,X)})}c.resolve=function(M,x){var $=D(S,x);if($.status==="error")return c.reject(M,$.value);var X=$.value;if(X)T(M,X);else{M.state=m,M.outcome=x;for(var B=-1,G=M.queue.length;++B<G;)M.queue[B].callFulfilled(x)}return M},c.reject=function(M,x){M.state=v,M.outcome=x;for(var $=-1,X=M.queue.length;++$<X;)M.queue[$].callRejected(x);return M};function S(M){var x=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof x=="function")return function(){x.apply(M,arguments)}}function T(M,x){var $=!1;function X(J){$||($=!0,c.reject(M,J))}function B(J){$||($=!0,c.resolve(M,J))}function G(){x(B,X)}var q=D(G);q.status==="error"&&X(q.value)}function D(M,x){var $={};try{$.value=M(x),$.status="success"}catch(X){$.status="error",$.value=X}return $}d.resolve=I;function I(M){return M instanceof this?M:c.resolve(new this(o),M)}d.reject=V;function V(M){var x=new this(o);return c.reject(x,M)}d.all=O;function O(M){var x=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=M.length,X=!1;if(!$)return this.resolve([]);for(var B=new Array($),G=0,q=-1,J=new this(o);++q<$;)K(M[q],q);return J;function K(W,Y){x.resolve(W).then(e1,function(l1){X||(X=!0,c.reject(J,l1))});function e1(l1){B[Y]=l1,++G===$&&!X&&(X=!0,c.resolve(J,B))}}}d.race=U;function U(M){var x=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var $=M.length,X=!1;if(!$)return this.resolve([]);for(var B=-1,G=new this(o);++B<$;)q(M[B]);return G;function q(J){x.resolve(J).then(function(K){X||(X=!0,c.resolve(G,K))},function(K){X||(X=!0,c.reject(G,K))})}}},{1:1}],3:[function(n,r,i){(function(l){typeof l.Promise!="function"&&(l.Promise=n(2))}).call(this,typeof Me<"u"?Me:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function o(s,g){if(!(s instanceof g))throw new TypeError("Cannot call a class as a function")}function c(){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 v=c();function m(){try{if(!v||!v.open)return!1;var s=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),g=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!s||g)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function b(s,g){s=s||[],g=g||{};try{return new Blob(s,g)}catch(p){if(p.name!=="TypeError")throw p;for(var u=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new u,_=0;_<s.length;_+=1)L.append(s[_]);return L.getBlob(g.type)}}typeof Promise>"u"&&n(3);var d=Promise;function w(s,g){g&&s.then(function(u){g(null,u)},function(u){g(u)})}function y(s,g,u){typeof g=="function"&&s.then(g),typeof u=="function"&&s.catch(u)}function S(s){return typeof s!="string"&&(console.warn(s+" used as a key, but it is not a string."),s=String(s)),s}function T(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",I=void 0,V={},O=Object.prototype.toString,U="readonly",M="readwrite";function x(s){for(var g=s.length,u=new ArrayBuffer(g),L=new Uint8Array(u),_=0;_<g;_++)L[_]=s.charCodeAt(_);return u}function $(s){return new d(function(g){var u=s.transaction(D,M),L=b([""]);u.objectStore(D).put(L,"key"),u.onabort=function(_){_.preventDefault(),_.stopPropagation(),g(!1)},u.oncomplete=function(){var _=navigator.userAgent.match(/Chrome\/(\d+)/),p=navigator.userAgent.match(/Edge\//);g(p||!_||parseInt(_[1],10)>=43)}}).catch(function(){return!1})}function X(s){return typeof I=="boolean"?d.resolve(I):$(s).then(function(g){return I=g,I})}function B(s){var g=V[s.name],u={};u.promise=new d(function(L,_){u.resolve=L,u.reject=_}),g.deferredOperations.push(u),g.dbReady?g.dbReady=g.dbReady.then(function(){return u.promise}):g.dbReady=u.promise}function G(s){var g=V[s.name],u=g.deferredOperations.pop();if(u)return u.resolve(),u.promise}function q(s,g){var u=V[s.name],L=u.deferredOperations.pop();if(L)return L.reject(g),L.promise}function J(s,g){return new d(function(u,L){if(V[s.name]=V[s.name]||r1(),s.db)if(g)B(s),s.db.close();else return u(s.db);var _=[s.name];g&&_.push(s.version);var p=v.open.apply(v,_);g&&(p.onupgradeneeded=function(E){var N=p.result;try{N.createObjectStore(s.storeName),E.oldVersion<=1&&N.createObjectStore(D)}catch(k){if(k.name==="ConstraintError")console.warn('The database "'+s.name+'" has been upgraded from version '+E.oldVersion+" to version "+E.newVersion+', but the storage "'+s.storeName+'" already exists.');else throw k}}),p.onerror=function(E){E.preventDefault(),L(p.error)},p.onsuccess=function(){var E=p.result;E.onversionchange=function(N){N.target.close()},u(E),G(s)}})}function K(s){return J(s,!1)}function W(s){return J(s,!0)}function Y(s,g){if(!s.db)return!0;var u=!s.db.objectStoreNames.contains(s.storeName),L=s.version<s.db.version,_=s.version>s.db.version;if(L&&(s.version!==g&&console.warn('The database "'+s.name+`" can't be downgraded from version `+s.db.version+" to version "+s.version+"."),s.version=s.db.version),_||u){if(u){var p=s.db.version+1;p>s.version&&(s.version=p)}return!0}return!1}function e1(s){return new d(function(g,u){var L=new FileReader;L.onerror=u,L.onloadend=function(_){var p=btoa(_.target.result||"");g({__local_forage_encoded_blob:!0,data:p,type:s.type})},L.readAsBinaryString(s)})}function l1(s){var g=x(atob(s.data));return b([g],{type:s.type})}function C1(s){return s&&s.__local_forage_encoded_blob}function b1(s){var g=this,u=g._initReady().then(function(){var L=V[g._dbInfo.name];if(L&&L.dbReady)return L.dbReady});return y(u,s,s),u}function y1(s){B(s);for(var g=V[s.name],u=g.forages,L=0;L<u.length;L++){var _=u[L];_._dbInfo.db&&(_._dbInfo.db.close(),_._dbInfo.db=null)}return s.db=null,K(s).then(function(p){return s.db=p,Y(s)?W(s):p}).then(function(p){s.db=g.db=p;for(var E=0;E<u.length;E++)u[E]._dbInfo.db=p}).catch(function(p){throw q(s,p),p})}function a1(s,g,u,L){L===void 0&&(L=1);try{var _=s.db.transaction(s.storeName,g);u(null,_)}catch(p){if(L>0&&(!s.db||p.name==="InvalidStateError"||p.name==="NotFoundError"))return d.resolve().then(function(){if(!s.db||p.name==="NotFoundError"&&!s.db.objectStoreNames.contains(s.storeName)&&s.version<=s.db.version)return s.db&&(s.version=s.db.version+1),W(s)}).then(function(){return y1(s).then(function(){a1(s,g,u,L-1)})}).catch(u);u(p)}}function r1(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function u1(s){var g=this,u={db:null};if(s)for(var L in s)u[L]=s[L];var _=V[u.name];_||(_=r1(),V[u.name]=_),_.forages.push(g),g._initReady||(g._initReady=g.ready,g.ready=b1);var p=[];function E(){return d.resolve()}for(var N=0;N<_.forages.length;N++){var k=_.forages[N];k!==g&&p.push(k._initReady().catch(E))}var A=_.forages.slice(0);return d.all(p).then(function(){return u.db=_.db,K(u)}).then(function(P){return u.db=P,Y(u,g._defaultConfig.version)?W(u):P}).then(function(P){u.db=_.db=P,g._dbInfo=u;for(var F=0;F<A.length;F++){var Q=A[F];Q!==g&&(Q._dbInfo.db=u.db,Q._dbInfo.version=u.version)}})}function L1(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.get(s);A.onsuccess=function(){var P=A.result;P===void 0&&(P=null),C1(P)&&(P=l1(P)),_(P)},A.onerror=function(){p(A.error)}}catch(P){p(P)}})}).catch(p)});return w(L,g),L}function I1(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.openCursor(),P=1;A.onsuccess=function(){var F=A.result;if(F){var Q=F.value;C1(Q)&&(Q=l1(Q));var t1=s(Q,F.key,P++);t1!==void 0?_(t1):F.continue()}else _()},A.onerror=function(){p(A.error)}}catch(F){p(F)}})}).catch(p)});return w(L,g),L}function Z1(s,g,u){var L=this;s=S(s);var _=new d(function(p,E){var N;L.ready().then(function(){return N=L._dbInfo,O.call(g)==="[object Blob]"?X(N.db).then(function(k){return k?g:e1(g)}):g}).then(function(k){a1(L._dbInfo,M,function(A,P){if(A)return E(A);try{var F=P.objectStore(L._dbInfo.storeName);k===null&&(k=void 0);var Q=F.put(k,s);P.oncomplete=function(){k===void 0&&(k=null),p(k)},P.onabort=P.onerror=function(){var t1=Q.error?Q.error:Q.transaction.error;E(t1)}}catch(t1){E(t1)}})}).catch(E)});return w(_,u),_}function B1(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){a1(u._dbInfo,M,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=k.delete(s);N.oncomplete=function(){_()},N.onerror=function(){p(A.error)},N.onabort=function(){var P=A.error?A.error:A.transaction.error;p(P)}}catch(P){p(P)}})}).catch(p)});return w(L,g),L}function F1(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,M,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.clear();E.oncomplete=function(){L()},E.onabort=E.onerror=function(){var A=k.error?k.error:k.transaction.error;_(A)}}catch(A){_(A)}})}).catch(_)});return w(u,s),u}function T4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,U,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.count();k.onsuccess=function(){L(k.result)},k.onerror=function(){_(k.error)}}catch(A){_(A)}})}).catch(_)});return w(u,s),u}function x4(s,g){var u=this,L=new d(function(_,p){if(s<0){_(null);return}u.ready().then(function(){a1(u._dbInfo,U,function(E,N){if(E)return p(E);try{var k=N.objectStore(u._dbInfo.storeName),A=!1,P=k.openKeyCursor();P.onsuccess=function(){var F=P.result;if(!F){_(null);return}s===0||A?_(F.key):(A=!0,F.advance(s))},P.onerror=function(){p(P.error)}}catch(F){p(F)}})}).catch(p)});return w(L,g),L}function Z4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){a1(g._dbInfo,U,function(p,E){if(p)return _(p);try{var N=E.objectStore(g._dbInfo.storeName),k=N.openKeyCursor(),A=[];k.onsuccess=function(){var P=k.result;if(!P){L(A);return}A.push(P.key),P.continue()},k.onerror=function(){_(k.error)}}catch(P){_(P)}})}).catch(_)});return w(u,s),u}function k4(s,g){g=T.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var L=this,_;if(!s.name)_=d.reject("Invalid arguments");else{var p=s.name===u.name&&L._dbInfo.db,E=p?d.resolve(L._dbInfo.db):K(s).then(function(N){var k=V[s.name],A=k.forages;k.db=N;for(var P=0;P<A.length;P++)A[P]._dbInfo.db=N;return N});s.storeName?_=E.then(function(N){if(N.objectStoreNames.contains(s.storeName)){var k=N.version+1;B(s);var A=V[s.name],P=A.forages;N.close();for(var F=0;F<P.length;F++){var Q=P[F];Q._dbInfo.db=null,Q._dbInfo.version=k}var t1=new d(function(n1,c1){var s1=v.open(s.name,k);s1.onerror=function(M1){var le=s1.result;le.close(),c1(M1)},s1.onupgradeneeded=function(){var M1=s1.result;M1.deleteObjectStore(s.storeName)},s1.onsuccess=function(){var M1=s1.result;M1.close(),n1(M1)}});return t1.then(function(n1){A.db=n1;for(var c1=0;c1<P.length;c1++){var s1=P[c1];s1._dbInfo.db=n1,G(s1._dbInfo)}}).catch(function(n1){throw(q(s,n1)||d.resolve()).catch(function(){}),n1})}}):_=E.then(function(N){B(s);var k=V[s.name],A=k.forages;N.close();for(var P=0;P<A.length;P++){var F=A[P];F._dbInfo.db=null}var Q=new d(function(t1,n1){var c1=v.deleteDatabase(s.name);c1.onerror=function(){var s1=c1.result;s1&&s1.close(),n1(c1.error)},c1.onblocked=function(){console.warn('dropInstance blocked for database "'+s.name+'" until all open connections are closed')},c1.onsuccess=function(){var s1=c1.result;s1&&s1.close(),t1(s1)}});return Q.then(function(t1){k.db=t1;for(var n1=0;n1<A.length;n1++){var c1=A[n1];G(c1._dbInfo)}}).catch(function(t1){throw(q(s,t1)||d.resolve()).catch(function(){}),t1})})}return w(_,g),_}var A4={_driver:"asyncStorage",_initStorage:u1,_support:m(),iterate:I1,getItem:L1,setItem:Z1,removeItem:B1,clear:F1,length:T4,key:x4,keys:Z4,dropInstance:k4};function $4(){return typeof openDatabase=="function"}var N1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P4="~~local_forage_type~",G6=/^~~local_forage_type~([^~]+)~/,De="__lfsc__:",f3=De.length,h3="arbf",C3="blob",W6="si08",Y6="ui08",X6="uic8",q6="si16",J6="si32",Q6="ur16",K6="ui32",en="fl32",tn="fl64",nn=f3+h3.length,rn=Object.prototype.toString;function on(s){var g=s.length*.75,u=s.length,L,_=0,p,E,N,k;s[s.length-1]==="="&&(g--,s[s.length-2]==="="&&g--);var A=new ArrayBuffer(g),P=new Uint8Array(A);for(L=0;L<u;L+=4)p=N1.indexOf(s[L]),E=N1.indexOf(s[L+1]),N=N1.indexOf(s[L+2]),k=N1.indexOf(s[L+3]),P[_++]=p<<2|E>>4,P[_++]=(E&15)<<4|N>>2,P[_++]=(N&3)<<6|k&63;return A}function v3(s){var g=new Uint8Array(s),u="",L;for(L=0;L<g.length;L+=3)u+=N1[g[L]>>2],u+=N1[(g[L]&3)<<4|g[L+1]>>4],u+=N1[(g[L+1]&15)<<2|g[L+2]>>6],u+=N1[g[L+2]&63];return g.length%3===2?u=u.substring(0,u.length-1)+"=":g.length%3===1&&(u=u.substring(0,u.length-2)+"=="),u}function U4(s,g){var u="";if(s&&(u=rn.call(s)),s&&(u==="[object ArrayBuffer]"||s.buffer&&rn.call(s.buffer)==="[object ArrayBuffer]")){var L,_=De;s instanceof ArrayBuffer?(L=s,_+=h3):(L=s.buffer,u==="[object Int8Array]"?_+=W6:u==="[object Uint8Array]"?_+=Y6:u==="[object Uint8ClampedArray]"?_+=X6:u==="[object Int16Array]"?_+=q6:u==="[object Uint16Array]"?_+=Q6:u==="[object Int32Array]"?_+=J6:u==="[object Uint32Array]"?_+=K6:u==="[object Float32Array]"?_+=en:u==="[object Float64Array]"?_+=tn:g(new Error("Failed to get type for BinaryArray"))),g(_+v3(L))}else if(u==="[object Blob]"){var p=new FileReader;p.onload=function(){var E=P4+s.type+"~"+v3(this.result);g(De+C3+E)},p.readAsArrayBuffer(s)}else try{g(JSON.stringify(s))}catch(E){console.error("Couldn't convert value into a JSON string: ",s),g(null,E)}}function B4(s){if(s.substring(0,f3)!==De)return JSON.parse(s);var g=s.substring(nn),u=s.substring(f3,nn),L;if(u===C3&&G6.test(g)){var _=g.match(G6);L=_[1],g=g.substring(_[0].length)}var p=on(g);switch(u){case h3:return p;case C3:return b([p],{type:L});case W6:return new Int8Array(p);case Y6:return new Uint8Array(p);case X6:return new Uint8ClampedArray(p);case q6:return new Int16Array(p);case Q6:return new Uint16Array(p);case J6:return new Int32Array(p);case K6:return new Uint32Array(p);case en:return new Float32Array(p);case tn:return new Float64Array(p);default:throw new Error("Unkown type: "+u)}}var g3={serialize:U4,deserialize:B4,stringToBuffer:on,bufferToString:v3};function an(s,g,u,L){s.executeSql("CREATE TABLE IF NOT EXISTS "+g.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],u,L)}function F4(s){var g=this,u={db:null};if(s)for(var L in s)u[L]=typeof s[L]!="string"?s[L].toString():s[L];var _=new d(function(p,E){try{u.db=openDatabase(u.name,String(u.version),u.description,u.size)}catch(N){return E(N)}u.db.transaction(function(N){an(N,u,function(){g._dbInfo=u,p()},function(k,A){E(A)})},E)});return u.serializer=g3,_}function R1(s,g,u,L,_,p){s.executeSql(u,L,_,function(E,N){N.code===N.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[g.storeName],function(k,A){A.rows.length?p(k,N):an(k,g,function(){k.executeSql(u,L,_,p)},p)},p):p(E,N)},p)}function j4(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[s],function(k,A){var P=A.rows.length?A.rows.item(0).value:null;P&&(P=E.serializer.deserialize(P)),_(P)},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function z4(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT * FROM "+E.storeName,[],function(k,A){for(var P=A.rows,F=P.length,Q=0;Q<F;Q++){var t1=P.item(Q),n1=t1.value;if(n1&&(n1=E.serializer.deserialize(n1)),n1=s(n1,t1.key,Q+1),n1!==void 0){_(n1);return}}_()},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function ln(s,g,u,L){var _=this;s=S(s);var p=new d(function(E,N){_.ready().then(function(){g===void 0&&(g=null);var k=g,A=_._dbInfo;A.serializer.serialize(g,function(P,F){F?N(F):A.db.transaction(function(Q){R1(Q,A,"INSERT OR REPLACE INTO "+A.storeName+" (key, value) VALUES (?, ?)",[s,P],function(){E(k)},function(t1,n1){N(n1)})},function(Q){if(Q.code===Q.QUOTA_ERR){if(L>0){E(ln.apply(_,[s,k,u,L-1]));return}N(Q)}})})}).catch(N)});return w(p,u),p}function G4(s,g,u){return ln.apply(this,[s,g,u,1])}function W4(s,g){var u=this;s=S(s);var L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[s],function(){_()},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function Y4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"DELETE FROM "+p.storeName,[],function(){L()},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function X4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"SELECT COUNT(key) as c FROM "+p.storeName,[],function(N,k){var A=k.rows.item(0).c;L(A)},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function q4(s,g){var u=this,L=new d(function(_,p){u.ready().then(function(){var E=u._dbInfo;E.db.transaction(function(N){R1(N,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[s+1],function(k,A){var P=A.rows.length?A.rows.item(0).key:null;_(P)},function(k,A){p(A)})})}).catch(p)});return w(L,g),L}function J4(s){var g=this,u=new d(function(L,_){g.ready().then(function(){var p=g._dbInfo;p.db.transaction(function(E){R1(E,p,"SELECT key FROM "+p.storeName,[],function(N,k){for(var A=[],P=0;P<k.rows.length;P++)A.push(k.rows.item(P).key);L(A)},function(N,k){_(k)})})}).catch(_)});return w(u,s),u}function Q4(s){return new d(function(g,u){s.transaction(function(L){L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(_,p){for(var E=[],N=0;N<p.rows.length;N++)E.push(p.rows.item(N).name);g({db:s,storeNames:E})},function(_,p){u(p)})},function(L){u(L)})})}function K4(s,g){g=T.apply(this,arguments);var u=this.config();s=typeof s!="function"&&s||{},s.name||(s.name=s.name||u.name,s.storeName=s.storeName||u.storeName);var L=this,_;return s.name?_=new d(function(p){var E;s.name===u.name?E=L._dbInfo.db:E=openDatabase(s.name,"","",0),s.storeName?p({db:E,storeNames:[s.storeName]}):p(Q4(E))}).then(function(p){return new d(function(E,N){p.db.transaction(function(k){function A(t1){return new d(function(n1,c1){k.executeSql("DROP TABLE IF EXISTS "+t1,[],function(){n1()},function(s1,M1){c1(M1)})})}for(var P=[],F=0,Q=p.storeNames.length;F<Q;F++)P.push(A(p.storeNames[F]));d.all(P).then(function(){E()}).catch(function(t1){N(t1)})},function(k){N(k)})})}):_=d.reject("Invalid arguments"),w(_,g),_}var e5={_driver:"webSQLStorage",_initStorage:F4,_support:$4(),iterate:z4,getItem:j4,setItem:G4,removeItem:W4,clear:Y4,length:X4,key:q4,keys:J4,dropInstance:K4};function t5(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function sn(s,g){var u=s.name+"/";return s.storeName!==g.storeName&&(u+=s.storeName+"/"),u}function n5(){var s="_localforage_support_test";try{return localStorage.setItem(s,!0),localStorage.removeItem(s),!1}catch{return!0}}function r5(){return!n5()||localStorage.length>0}function i5(s){var g=this,u={};if(s)for(var L in s)u[L]=s[L];return u.keyPrefix=sn(s,g._defaultConfig),r5()?(g._dbInfo=u,u.serializer=g3,d.resolve()):d.reject()}function o5(s){var g=this,u=g.ready().then(function(){for(var L=g._dbInfo.keyPrefix,_=localStorage.length-1;_>=0;_--){var p=localStorage.key(_);p.indexOf(L)===0&&localStorage.removeItem(p)}});return w(u,s),u}function a5(s,g){var u=this;s=S(s);var L=u.ready().then(function(){var _=u._dbInfo,p=localStorage.getItem(_.keyPrefix+s);return p&&(p=_.serializer.deserialize(p)),p});return w(L,g),L}function l5(s,g){var u=this,L=u.ready().then(function(){for(var _=u._dbInfo,p=_.keyPrefix,E=p.length,N=localStorage.length,k=1,A=0;A<N;A++){var P=localStorage.key(A);if(P.indexOf(p)===0){var F=localStorage.getItem(P);if(F&&(F=_.serializer.deserialize(F)),F=s(F,P.substring(E),k++),F!==void 0)return F}}});return w(L,g),L}function s5(s,g){var u=this,L=u.ready().then(function(){var _=u._dbInfo,p;try{p=localStorage.key(s)}catch{p=null}return p&&(p=p.substring(_.keyPrefix.length)),p});return w(L,g),L}function c5(s){var g=this,u=g.ready().then(function(){for(var L=g._dbInfo,_=localStorage.length,p=[],E=0;E<_;E++){var N=localStorage.key(E);N.indexOf(L.keyPrefix)===0&&p.push(N.substring(L.keyPrefix.length))}return p});return w(u,s),u}function u5(s){var g=this,u=g.keys().then(function(L){return L.length});return w(u,s),u}function d5(s,g){var u=this;s=S(s);var L=u.ready().then(function(){var _=u._dbInfo;localStorage.removeItem(_.keyPrefix+s)});return w(L,g),L}function f5(s,g,u){var L=this;s=S(s);var _=L.ready().then(function(){g===void 0&&(g=null);var p=g;return new d(function(E,N){var k=L._dbInfo;k.serializer.serialize(g,function(A,P){if(P)N(P);else try{localStorage.setItem(k.keyPrefix+s,A),E(p)}catch(F){(F.name==="QuotaExceededError"||F.name==="NS_ERROR_DOM_QUOTA_REACHED")&&N(F),N(F)}})})});return w(_,u),_}function h5(s,g){if(g=T.apply(this,arguments),s=typeof s!="function"&&s||{},!s.name){var u=this.config();s.name=s.name||u.name,s.storeName=s.storeName||u.storeName}var L=this,_;return s.name?_=new d(function(p){s.storeName?p(sn(s,L._defaultConfig)):p(s.name+"/")}).then(function(p){for(var E=localStorage.length-1;E>=0;E--){var N=localStorage.key(E);N.indexOf(p)===0&&localStorage.removeItem(N)}}):_=d.reject("Invalid arguments"),w(_,g),_}var C5={_driver:"localStorageWrapper",_initStorage:i5,_support:t5(),iterate:l5,getItem:a5,setItem:f5,removeItem:d5,clear:o5,length:u5,key:s5,keys:c5,dropInstance:h5},v5=function(g,u){return g===u||typeof g=="number"&&typeof u=="number"&&isNaN(g)&&isNaN(u)},g5=function(g,u){for(var L=g.length,_=0;_<L;){if(v5(g[_],u))return!0;_++}return!1},cn=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},ae={},un={},j1={INDEXEDDB:A4,WEBSQL:e5,LOCALSTORAGE:C5},m5=[j1.INDEXEDDB._driver,j1.WEBSQL._driver,j1.LOCALSTORAGE._driver],Oe=["dropInstance"],m3=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Oe),p5={description:"",driver:m5.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function b5(s,g){s[g]=function(){var u=arguments;return s.ready().then(function(){return s[g].apply(s,u)})}}function p3(){for(var s=1;s<arguments.length;s++){var g=arguments[s];if(g)for(var u in g)g.hasOwnProperty(u)&&(cn(g[u])?arguments[0][u]=g[u].slice():arguments[0][u]=g[u])}return arguments[0]}var L5=function(){function s(g){o(this,s);for(var u in j1)if(j1.hasOwnProperty(u)){var L=j1[u],_=L._driver;this[u]=_,ae[_]||this.defineDriver(L)}this._defaultConfig=p3({},p5),this._config=p3({},this._defaultConfig,g),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return s.prototype.config=function(u){if((typeof u>"u"?"undefined":l(u))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var L in u){if(L==="storeName"&&(u[L]=u[L].replace(/\W/g,"_")),L==="version"&&typeof u[L]!="number")return new Error("Database version must be a number.");this._config[L]=u[L]}return"driver"in u&&u.driver?this.setDriver(this._config.driver):!0}else return typeof u=="string"?this._config[u]:this._config},s.prototype.defineDriver=function(u,L,_){var p=new d(function(E,N){try{var k=u._driver,A=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver){N(A);return}for(var P=m3.concat("_initStorage"),F=0,Q=P.length;F<Q;F++){var t1=P[F],n1=!g5(Oe,t1);if((n1||u[t1])&&typeof u[t1]!="function"){N(A);return}}var c1=function(){for(var le=function(y5){return function(){var M5=new Error("Method "+y5+" is not implemented by the current driver"),dn=d.reject(M5);return w(dn,arguments[arguments.length-1]),dn}},b3=0,_5=Oe.length;b3<_5;b3++){var L3=Oe[b3];u[L3]||(u[L3]=le(L3))}};c1();var s1=function(le){ae[k]&&console.info("Redefining LocalForage driver: "+k),ae[k]=u,un[k]=le,E()};"_support"in u?u._support&&typeof u._support=="function"?u._support().then(s1,N):s1(!!u._support):s1(!0)}catch(M1){N(M1)}});return y(p,L,_),p},s.prototype.driver=function(){return this._driver||null},s.prototype.getDriver=function(u,L,_){var p=ae[u]?d.resolve(ae[u]):d.reject(new Error("Driver not found."));return y(p,L,_),p},s.prototype.getSerializer=function(u){var L=d.resolve(g3);return y(L,u),L},s.prototype.ready=function(u){var L=this,_=L._driverSet.then(function(){return L._ready===null&&(L._ready=L._initDriver()),L._ready});return y(_,u,u),_},s.prototype.setDriver=function(u,L,_){var p=this;cn(u)||(u=[u]);var E=this._getSupportedDrivers(u);function N(){p._config.driver=p.driver()}function k(F){return p._extend(F),N(),p._ready=p._initStorage(p._config),p._ready}function A(F){return function(){var Q=0;function t1(){for(;Q<F.length;){var n1=F[Q];return Q++,p._dbInfo=null,p._ready=null,p.getDriver(n1).then(k).catch(t1)}N();var c1=new Error("No available storage method found.");return p._driverSet=d.reject(c1),p._driverSet}return t1()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=P.then(function(){var F=E[0];return p._dbInfo=null,p._ready=null,p.getDriver(F).then(function(Q){p._driver=Q._driver,N(),p._wrapLibraryMethodsWithReady(),p._initDriver=A(E)})}).catch(function(){N();var F=new Error("No available storage method found.");return p._driverSet=d.reject(F),p._driverSet}),y(this._driverSet,L,_),this._driverSet},s.prototype.supports=function(u){return!!un[u]},s.prototype._extend=function(u){p3(this,u)},s.prototype._getSupportedDrivers=function(u){for(var L=[],_=0,p=u.length;_<p;_++){var E=u[_];this.supports(E)&&L.push(E)}return L},s.prototype._wrapLibraryMethodsWithReady=function(){for(var u=0,L=m3.length;u<L;u++)b5(this,m3[u])},s.prototype.createInstance=function(u){return new s(u)},s}(),w5=new L5;r.exports=w5},{3:3}]},{},[4])(4)})}(o3)),o3.exports}var K0=Q0();const x1=J0(K0);class a3{getItem(t){return x1.getItem(t)}setItem(t,n){return x1.setItem(t,n)}removeItem(t){return x1.removeItem(t)}clear(){return x1.clear()}key(t){return x1.key(t)}keys(){return x1.keys()}iterate(t){return x1.iterate(t)}}var e4=Object.getOwnPropertyDescriptor,t4=(e,t,n,r)=>{for(var i=r>1?void 0:r?e4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},T6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopMessageService=class extends h.Disposable{constructor(t,n){super(),this._injector=t,this._uiPartsService=n,this._initUIPart()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(Z.Messager,this._injector)))}dispose(){Z.removeMessage()}show(t){let n=t;return typeof t.id>"u"&&(n=Object.assign({},t,{id:`message-${Date.now()}`})),Z.message(n),h.toDisposable(()=>Z.removeMessage(n.id))}remove(t){Z.removeMessage(t)}removeAll(){Z.removeMessage()}},f.DesktopMessageService=t4([T6(0,h.Inject(h.Injector)),T6(1,_1)],f.DesktopMessageService);function n4(){const e=R.useDependency(h.ThemeService),t=R.useObservable(e.darkMode$);return C.jsx(Z.Toaster,{theme:t?"dark":"light"})}const r4={show:e=>{const{type:t="message",title:n,content:r,duration:i,closable:l=!0,position:o="top-right"}=e;Z.toast[t](n,{position:o,description:r,duration:i,closeButton:l})}};var i4=Object.getOwnPropertyDescriptor,o4=(e,t,n,r)=>{for(var i=r>1?void 0:r?i4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},x6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopNotificationService=class extends h.Disposable{constructor(t,n){super(),this._injector=t,this._uiPartsService=n,this._initUIPart()}show(t){return r4.show(t),h.toDisposable(()=>{})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>R.connectInjector(n4,this._injector)))}},f.DesktopNotificationService=o4([x6(0,h.Inject(h.Injector)),x6(1,_1)],f.DesktopNotificationService);class l3{constructor(){j(this,"_sidebarOptions",{});j(this,"sidebarOptions$",new z.Subject);j(this,"scrollEvent$",new z.Subject);j(this,"_container")}get visible(){return this._sidebarOptions.visible||!1}get options(){return this._sidebarOptions}open(t){return this._sidebarOptions={...t,id:t.id,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),h.toDisposable(()=>{this.close()})}close(t){t&&this._sidebarOptions.id!==t||(this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose())}getContainer(){return this._container}setContainer(t){this._container=t}}var a4=Object.getOwnPropertyDescriptor,l4=(e,t,n,r)=>{for(var i=r>1?void 0:r?a4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},s4=(e,t)=>(n,r)=>t(n,r,e);f.DesktopZenZoneService=class{constructor(t){j(this,"visible$",new z.BehaviorSubject(!1));j(this,"componentKey$",new z.ReplaySubject);j(this,"_temporaryHidden$",new z.BehaviorSubject(!1));j(this,"temporaryHidden$",this._temporaryHidden$.asObservable());j(this,"_visible",!1);this._componentManager=t}get visible(){return this._visible}get temporaryHidden(){return this._temporaryHidden$.getValue()}dispose(){this.visible$.next(!1),this.visible$.complete(),this.componentKey$.complete()}hide(){this._temporaryHidden$.next(!0)}show(){this._temporaryHidden$.next(!1)}set(t,n){return this._componentManager.register(t,n),this.componentKey$.next(t),h.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this._visible=!0,this.visible$.next(!0)}close(){this._visible=!1,this.visible$.next(!1)}},f.DesktopZenZoneService=l4([s4(0,h.Inject(v1))],f.DesktopZenZoneService);var c4=Object.defineProperty,u4=Object.getOwnPropertyDescriptor,d4=(e,t,n)=>t in e?c4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f4=(e,t,n,r)=>{for(var i=r>1?void 0:r?u4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},h4=(e,t)=>(n,r)=>t(n,r,e),C4=(e,t,n)=>d4(e,t+"",n);const v4="UNIVER_MOBILE_UI_PLUGIN";f.UniverMobileUIPlugin=class extends h.Plugin{constructor(t,n){super(),this._config=t,this._injector=n}onStarting(){h.mergeOverrideWithDependencies([[v1],[W1],[he],[_1,{useClass:Fe}],[H1,{useClass:f.DesktopLayoutService}],[re],[P1,{useClass:f.ShortcutService}],[Ce,{useClass:Be}],[S1,{useClass:f.MenuManagerService}],[ie,{useClass:Ye}],[i3,{useClass:f.BrowserClipboardService,lazy:!0}],[oe,{useClass:f.DesktopNotificationService,lazy:!0}],[ye,{useClass:f.DesktopGalleryService,lazy:!0}],[_e,{useClass:f.DesktopDialogService,lazy:!0}],[we,{useClass:f.DesktopConfirmService,lazy:!0}],[$1,{useClass:l3,lazy:!0}],[Le,{useClass:f.DesktopZenZoneService,lazy:!0}],[be,{useClass:f.DesktopGlobalZoneService,lazy:!0}],[fe,{useClass:f.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:a3,lazy:!0}],[e3,{useClass:f.DesktopBeforeCloseService}],[me,{useClass:ze}],[ge],[te,{useFactory:n=>n.createInstance(Ke,this._config),deps:[h.Injector]}],[f.SharedController],[f.ErrorController]],this._config.override).forEach(n=>this._injector.add(n)),this._injector.get(te),this._injector.get(f.ErrorController)}},C4(f.UniverMobileUIPlugin,"pluginName",v4),f.UniverMobileUIPlugin=f4([h.DependentOn(z1.UniverRenderEnginePlugin),h4(1,h.Inject(h.Injector))],f.UniverMobileUIPlugin);class Z6 extends h.Disposable{openFile(t){return new Promise(n=>{var i,l;const r=document.createElement("input");r.type="file",r.accept=(i=t==null?void 0:t.accept)!=null?i:"",r.multiple=(l=t==null?void 0:t.multiple)!=null?l:!1,r.onchange=o=>{const c=o.target.files;c&&n(Array.from(c))},r.click()})}downloadFile(t,n){const r=document.createElement("a");r.download=n,r.href=window.URL.createObjectURL(t),r.click()}}const k6=h.createIdentifier("univer-ui.local-file.service"),g4=e=>{const n=R.useDependency($1).getContainer();a.useEffect(()=>{if(n)return n.addEventListener("mousedown",e),()=>{n.removeEventListener("mousedown",e)}},[e,n])},m4=a.memo(e=>{var T,D;const{layer:t,id:n,position:r}=e,i=R.useDependency(h.IUniverInstanceService),l=a.useRef(null),o=a.useRef(null),c=a.useRef(`transform: rotate(${r==null?void 0:r.rotate}deg) translate(${r==null?void 0:r.startX}px, ${r==null?void 0:r.startY}px)`),v=a.useRef((T=r==null?void 0:r.startY)!=null?T:0),m=a.useRef((D=r==null?void 0:r.startX)!=null?D:0),b=typeof t.componentKey=="string"?R.useDependency(v1).get(t.componentKey):t.componentKey,d=a.useMemo(()=>({data:t.data,...t.props}),[t.data,t.props]),w={width:`${r.width-4}px`,height:`${r.height-4}px`,left:`${r.absolute.left?0:"auto"}`,top:`${r.absolute.top?0:"auto"}`,right:`${r.absolute.left?"auto":0}`,bottom:`${r.absolute.top?"auto":0}`};c.current=`rotate(${r.rotate}deg)`,v.current=r.startY,m.current=r.startX;const y=i.getUnit(t.unitId),S=a.useMemo(()=>b?C.jsx(b,{...d,unitId:t.unitId,unit:y,floatDomId:t.id,context:{root:o}}):null,[b,d]);return r?C.jsx("div",{ref:l,className:"univer-absolute univer-z-10 univer-origin-center univer-overflow-hidden",style:{top:v.current,left:m.current,width:Math.max(r.endX-r.startX-2,0),height:Math.max(r.endY-r.startY-2,0),transform:c.current},onPointerMove:I=>{t.onPointerMove(I.nativeEvent)},onPointerDown:I=>{t.onPointerDown(I.nativeEvent)},onPointerUp:I=>{t.onPointerUp(I.nativeEvent)},onWheel:I=>{t.onWheel(I.nativeEvent)},children:C.jsx("div",{ref:o,id:n,className:"univer-absolute univer-overflow-hidden",style:{...w},children:S})}):null});var p4=Object.defineProperty,b4=Object.getOwnPropertyDescriptor,L4=(e,t,n)=>t in e?p4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w4=(e,t,n,r)=>{for(var i=r>1?void 0:r?b4(t,n):t,l=e.length-1,o;l>=0;l--)(o=e[l])&&(i=o(i)||i);return i},s3=(e,t)=>(n,r)=>t(n,r,e),_4=(e,t,n)=>L4(e,t+"",n);const A6="UNIVER_UI_PLUGIN",$6="DISABLE_AUTO_FOCUS";f.UniverUIPlugin=class extends h.Plugin{constructor(t=F9,n,r,i){super(),this._config=t,this._contextService=n,this._injector=r,this._configService=i;const{menu:l,...o}=h.merge({popupRootId:`univer-popup-portal-${h.generateRandomId(6)}`},F9,this._config);o.disableAutoFocus&&this._contextService.setContextValue($6,!0),l&&this._configService.setConfig("menu",l,{merge:!0}),this._configService.setConfig(Y1,o)}onStarting(){h.registerDependencies(this._injector,h.mergeOverrideWithDependencies([[v1],[re],[W1],[he],[_1,{useClass:Fe}],[H1,{useClass:f.DesktopLayoutService}],[P1,{useClass:f.ShortcutService}],[Ce,{useClass:Be}],[S1,{useClass:f.MenuManagerService}],[ie,{useClass:Ye}],[i3,{useClass:f.BrowserClipboardService,lazy:!0}],[oe,{useClass:f.DesktopNotificationService,lazy:!0}],[ye,{useClass:f.DesktopGalleryService,lazy:!0}],[_e,{useClass:f.DesktopDialogService,lazy:!0}],[we,{useClass:f.DesktopConfirmService,lazy:!0}],[$1,{useClass:l3,lazy:!0}],[Le,{useClass:f.DesktopZenZoneService,lazy:!0}],[be,{useClass:f.DesktopGlobalZoneService,lazy:!0}],[fe,{useClass:f.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:a3,lazy:!0}],[e3,{useClass:f.DesktopBeforeCloseService}],[k6,{useClass:Z6}],[me,{useClass:ze}],[ge],[te,{useFactory:t=>t.createInstance(f.DesktopUIController,this._config),deps:[h.Injector]}],[f.SharedController],[f.ErrorController],[f.ShortcutPanelController]])),h.touchDependencies(this._injector,[[te],[f.ErrorController]])}onReady(){h.touchDependencies(this._injector,[[f.SharedController]])}onSteady(){h.touchDependencies(this._injector,[[f.ShortcutPanelController]])}},_4(f.UniverUIPlugin,"pluginName",A6),f.UniverUIPlugin=w4([h.DependentOn(z1.UniverRenderEnginePlugin),s3(1,h.IContextService),s3(2,h.Inject(h.Injector)),s3(3,h.IConfigService)],f.UniverUIPlugin);function Ie(e){return e.length===0?e:e.replace(/^\s+|\s+$/gm,"")}const y4=.75,P6=78,U6=9,B6="rgba(0,0,0,0)",F6="rgb(0,0,0)";function c3(e){var c;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,l=e.textContent||"";l+=`\r
18
18
  `;for(let v=0;v<t.length;v++){let m=t[`${v}`],b;m.nodeName==="#text"?(b=(c=m.textContent)!=null?c:"",m=m.parentElement):b=m.innerText;const d=He(m);z6(b).forEach(y=>{const S=y.length;i+=S,r=i-S;const T=h.Tools.generateRandomId(6);n.push({sId:T,st:r,ed:i-1,ts:d})})}return h.Tools.generateRandomId(6),{id:h.Tools.generateRandomId(6),body:{dataStream:l,textRuns:n},documentStyle:{}}}function He(e,t=""){var o,c;let n=(c=(o=e==null?void 0:e.style)==null?void 0:o.cssText)!=null?c:"";if(n+=t,n=n.replace(/[\r\n]+/g,""),n.length===0)return{};const r=n.split(";"),i={},l={t:"",r:"",b:"",l:""};return r.forEach(v=>{var w;const m=v.toLowerCase(),b=Ie(m.substr(0,m.indexOf(":"))),d=Ie(m.substr(m.indexOf(":")+1));if(b==="font-weight")d==="bold"||d==="700"?i.bl=1:i.bl=0;else if(b==="font-style")d==="italic"?i.it=1:i.it=0;else if(b==="font-family"){const y=Ie(v),S=N4(y);i.ff=S}else if(b==="font-size"){let y=Number.parseInt(d);n.indexOf("vertical-align")>-1&&(n.indexOf("sub")>-1||n.indexOf("sup")>-1)&&(y*=2),d.indexOf("px")!==-1&&(y=V4(Number.parseInt(d,10))),i.fs=y}else if(b==="color"){const y=new h.ColorKit(d);i.cl={rgb:y.isValid?y.toRgbString():"rgb(0,0,0)"}}else if(b==="background"||b==="background-color"){const y=new h.ColorKit(d);if(y){const S=y.toRgbString();S!==B6&&S!==F6&&(i.bg={rgb:y.toRgbString()})}}else if(b==="text-decoration-line")d==="underline"?(i.ul||(i.ul={s:1}),i.ul.s=1):d==="line-through"?(i.st||(i.st={s:1}),i.st.s=1):d==="overline"&&(i.ol||(i.ol={s:1}),i.ol.s=1);else if(b==="text-decoration-color")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,cl:{rgb:d}}),i.ul.cl={rgb:d}),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,cl:{rgb:d}}),i.st.cl={rgb:d}),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,cl:{rgb:d}}),i.ol.cl={rgb:d});else if(b==="text-decoration-style")i.hasOwnProperty("ul")&&(i.ul||(i.ul={s:1,t:Number(d)}),i.ul.t=Number(d)),i.hasOwnProperty("st")&&(i.st||(i.st={s:1,t:Number(d)}),i.st.t=Number(d)),i.hasOwnProperty("ol")&&(i.ol||(i.ol={s:1,t:Number(d)}),i.ol.t=Number(d));else if(b==="text-decoration"||b==="univer-strike"){const y=(w=d.split(" "))==null?void 0:w[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(b==="univer-underline"&&(i.ul={s:1}),b==="vertical-align"&&(d==="sub"?i.va=h.BaselineOffset.SUBSCRIPT:d==="super"?i.va=h.BaselineOffset.SUPERSCRIPT:d==="top"?i.vt=1:d==="middle"?i.vt=2:d==="bottom"?i.vt=3:i.va=h.BaselineOffset.NORMAL),b==="transform"){const y=d.split(")"),S=y.findIndex(T=>T.includes("rotate"));if(S>-1){const T=y[S].match(/\d+/g);let D=0,I=0;T!=null&&T.length&&(D=+T[0]),e!=null&&e.dataset.vertical&&(I=+e.dataset.vertical),i.tr={a:D,v:I}}}if(b==="text-align"&&(d==="left"?i.ht=1:d==="center"?i.ht=2:d==="right"?i.ht=3:d==="justify"?i.ht=4:i.ht=0),i.tb!==1&&(b==="overflow-wrap"||b==="word-wrap"?d==="break-word"&&(i.tb=3):b==="text-overflow"?d==="clip"&&(i.tb=2):b==="text-break"&&d==="overflow"&&(i.tb=1)),b==="white-space"&&(d==="nowrap"?i.tb=1:d==="normal"?i.tb=3:d==="clip"&&(i.tb=2)),b==="border-color"){const y=j6(d,")");if(i.bd)for(const S in y)i.bd[S].cl.rgb=y[S];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 S in y)i.bd[S].cl.rgb=y[S]}}if(b==="border-width"||b==="border-style"){const y=j6(d," ");for(const S in y)l[S]+=` ${y[S]}`;i.bd?(i.bd.b.s=h.getBorderStyleType(l.b),i.bd.t.s=h.getBorderStyleType(l.t),i.bd.l.s=h.getBorderStyleType(l.l),i.bd.r.s=h.getBorderStyleType(l.r)):i.bd={b:{cl:{rgb:"#000"},s:h.getBorderStyleType(l.b)},t:{cl:{rgb:"#000"},s:h.getBorderStyleType(l.t)},l:{cl:{rgb:"#000"},s:h.getBorderStyleType(l.l)},r:{cl:{rgb:"#000"},s:h.getBorderStyleType(l.r)}}}if(b==="border-bottom"||b==="border-top"||b==="border-left"||b==="border-right"||b==="border"){i.bd||(i.bd={});const y=d.split(" "),S=`${y[0]} ${y[1]}`;y.splice(0,2);const T=y.join("");if(h.getBorderStyleType(S)!==h.BorderStyleTypes.NONE&&T){const I={cl:{rgb:T},s:h.getBorderStyleType(S)};b==="border-bottom"?i.bd.b=d==="none"?null:I:b==="border-top"?i.bd.t=d==="none"?null:I:b==="border-left"?i.bd.l=d==="none"?null:I:b==="border-right"?i.bd.r=d==="none"?null:I:b==="border"&&(i.bd={r:d==="none"?null:I,t:d==="none"?null:I,b:d==="none"?null:I,l:d==="none"?null:I})}}else if(b==="--data-rotate"){const y=/[+-]?\d+/,S=d.match(y);d==="(0deg ,1)"?i.tr={a:0,v:1}:S&&(i.tr={a:Number(S[0])})}}),Object.keys(i).forEach(v=>{typeof i[v]=="object"&&!Object.keys(i[v]).length&&delete i[v]}),i}function j6(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 z6(e){if(e==="")return[e];const t=/(?:(\n+.+)|(.+))/g;return e.match(t).map(i=>i.replace(/\n/g,`\r
19
19
  `))}function M4(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 l=r[i],o=l.getAttribute("span");if(o&&+o>1)for(let c=0;c<+o;c++){const v=Ee(l.getAttribute("width"),72);n.push(v)}else{const c=Ee(l.getAttribute("width"),72);n.push(c)}}return n}function Ee(e,t){if(!e)return t;let n;return e.includes("pt")?n=z1.ptToPx(Number.parseFloat(e)):e.includes("px")?n=Number.parseFloat(e):n=Number.parseFloat(e)*72/96,n}function S4(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 c=Ee(o[0].style.height,19);for(let v=0;v<o.length;v++){const m=o[v].getAttribute("rowSpan");if(!(m&&+m>1)){c=Ee(o[v].style.height,19);break}}n.push(c)}return n}function I4(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(c=>{let v=0;const m=c.getAttribute("colSpan");m!==null?v=+m:v=1,r+=v});for(let c=0;c<t.length;c++)t[c]=new Array(r);let o=0;return i.forEach(c=>{let v=0;c.querySelectorAll("td").forEach(m=>{var y,S;const b={};if(m.querySelectorAll("span").length||m.querySelectorAll("font").length){const T=c3(m);typeof T!="string"&&(b.p=T)}const d=m.innerText;d.trim().length===0?b.v="":b.v=d;const w=He(m);for(h.Tools.isPlainObject(w)&&(b.s=w);v<r&&t[o][v]!=null;)v++;if(v!==r){if(t[o][v]==null){t[o][v]=b;const T=(y=Number(m.getAttribute("rowSpan")))!=null?y:1,D=(S=Number(m.getAttribute("colSpan")))!=null?S:1;if(T>1||D>1){const I={rs:+T-1,cs:+D-1,r:o,c:v};t[o][v].mc=I;for(let V=0;V<T;V++)for(let O=0;O<D;O++)V===0&&O===0||(t[o+V][v+O]={mc:null})}}v++}}),o++}),t}function H4(e){const t=[],n=document.createElement("DIV");n.innerHTML=e;const i=e.replace(/\r/g,"").split(`
20
20
  `),l=i[0].split(" ").length;for(let o=0;o<i.length;o++)i[o].split(" ").length<l||t.push(i[o].split(" "));for(let o=0;o<t.length;o++)for(let c=0;c<t[o].length;c++)t[o][c].length?t[o][c]={v:t[o][c]||"",m:t[o][c]||""}:t[o][c]=null;return t}function E4(e,t){e.length,e[0].length;let n=0,r=0;t&&(n=t.startRow,r=t.startColumn);const i=[];for(let l=0;l<e.length;l++)for(let o=0;o<e[l].length;o++)if(e[l][o]&&typeof e[l][o]=="object"&&"mc"in e[l][o])if(e[l][o].mc){const c=e[l][o].mc,v=c.r+n,m=v+c.rs,b=c.c+r,d=b+c.cs;i.push({startRow:v,endRow:m,startColumn:b,endColumn:d}),delete e[l][o].mc}else e[l][o]=null;return{data:e,mergeData:i}}function D4(e){var m;let t=[];const n=document.createElement("html");n.innerHTML=e;const r=(m=n.querySelector("style"))==null?void 0:m.innerText;if(!r)return;const i=O4(r);if(t=new Array(n.querySelectorAll("table tr").length),!t.length)return[];let l=0;const o=n.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(b=>{let d=0;const w=b.getAttribute("colSpan");w!==null?d=+w:d=1,l+=d});for(let b=0;b<t.length;b++)t[b]=new Array(l);let v=0;return o.forEach(b=>{let d=0;b.querySelectorAll("td").forEach(w=>{var I,V;const y={};if(w.querySelectorAll("span").length||w.querySelectorAll("font").length){const O=c3(w);typeof O!="string"&&(y.p=O)}const S=w.innerText;S.trim().length===0?y.v="":y.v=S;let T="";for(const O in i)w.classList.contains(O)&&(T+=i[O]);const D=He(w,T);for(h.Tools.isPlainObject(D)&&(y.s=D);d<l&&t[v][d]!=null;)d++;if(d!==l){if(t[v][d]==null){t[v][d]=y;const O=(I=Number(w.getAttribute("rowSpan")))!=null?I:1,U=(V=Number(w.getAttribute("colSpan")))!=null?V:1;if(O>1||U>1){const M={rs:+O-1,cs:+U-1,r:v,c:d};t[v][d].mc=M;for(let x=0;x<O;x++)for(let $=0;$<U;$++)x===0&&$===0||(t[v+x][d+$]={mc:null})}}d++}}),v++}),t}function O4(e){const t={},n=e.replaceAll("<!--","").replaceAll("-->","").trim(),r=n==null?void 0:n.replaceAll(" ","").replaceAll(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/ui",
3
- "version": "0.8.1",
3
+ "version": "0.8.2-nightly.202506201607",
4
4
  "private": false,
5
5
  "description": "UniverSheet normal plugin UI manager",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -68,16 +68,16 @@
68
68
  "@univerjs/icons": "^0.4.4",
69
69
  "@wendellhu/redi": "0.18.3",
70
70
  "localforage": "^1.10.0",
71
- "@univerjs/core": "0.8.1",
72
- "@univerjs/engine-render": "0.8.1",
73
- "@univerjs/design": "0.8.1"
71
+ "@univerjs/core": "0.8.2-nightly.202506201607",
72
+ "@univerjs/engine-render": "0.8.2-nightly.202506201607",
73
+ "@univerjs/design": "0.8.2-nightly.202506201607"
74
74
  },
75
75
  "optionalDependencies": {
76
76
  "vue": ">=3.0.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@testing-library/react": "^16.3.0",
80
- "postcss": "^8.5.4",
80
+ "postcss": "^8.5.6",
81
81
  "react": "18.3.1",
82
82
  "react-dom": "18.3.1",
83
83
  "rxjs": "^7.8.2",
@@ -87,8 +87,8 @@
87
87
  "vite": "^6.3.5",
88
88
  "vitest": "^3.1.4",
89
89
  "vue": "^3.5.13",
90
- "@univerjs-infra/shared": "0.8.1",
91
- "@univerjs/themes": "0.8.1"
90
+ "@univerjs-infra/shared": "0.8.2",
91
+ "@univerjs/themes": "0.8.2-nightly.202506201607"
92
92
  },
93
93
  "scripts": {
94
94
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS