@univerjs/ui 0.16.1-insiders.20260311-074e8ca → 0.17.0
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +8 -8
- package/lib/es/index.js +2 -2
- package/lib/facade.js +8 -8
- package/lib/index.js +2 -2
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
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
|
package/lib/cjs/index.js
CHANGED
|
@@ -67,7 +67,7 @@ ${o}
|
|
|
67
67
|
univer-text-primary-600
|
|
68
68
|
`}),h.jsx("span",{className:N.clsx(C3,ie&&`
|
|
69
69
|
univer-pl-4
|
|
70
|
-
`),children:h.jsx(fe,{value$:z.value$,value:z.value,label:z.label,icon:z.icon,onChange:me=>{o==null||o({...z,value:me,id:e.id,label:n,commandId:z.commandId})}})})]},de)})}),X&&h.jsx(w6,{menuSchemas:q,submenuPortalContainer:r,onOptionSelect:o,maxMenuHeight:i})]})}),r):null)]})}function Zi(t){const[n,e]=a.useState({});return a.useEffect(()=>{const r=t.map(o=>{var s;if(!((s=o.children)!=null&&s.length))return null;const i=o.children.map(l=>{var u,v;return(v=(u=l.item)==null?void 0:u.hidden$)!=null?v:k.of(!1)});return k.combineLatest(i).subscribe(l=>{const u=l.every(v=>v===!0);e(v=>({...v,[o.key]:u}))})});return()=>{r.forEach(o=>o==null?void 0:o.unsubscribe()),e({})}},[t]),n}function L6(t){const{hostId:n,visible:e,anchorRect:r,menuType:o,anchorVertical:i="bottom",menuOffset:s=0,onRequestClose:l,onOptionSelect:u}=t,v=a.useRef(null),p=H.useDependency(r1),d=a.useRef(l),m=a.useRef(0),I=a.useRef(e),S=a.useRef(o);a.useEffect(()=>{d.current=l},[l]),e&&(!I.current||o!==S.current)&&(m.current+=1),I.current=e,S.current=o,a.useEffect(()=>{const x=p.registerMenu(n,()=>{d.current()});return()=>{x.dispose(),p.deactivateMenu(n)}},[p,n]),a.useLayoutEffect(()=>{if(e){p.activateMenu(n);return}p.deactivateMenu(n)},[p,n,e]),a.useEffect(()=>{if(!e)return;const x=R=>R instanceof Element&&R.closest(`[${b6}]`),L=R=>{x(R.target)||v.current&&!v.current.contains(R.target)&&d.current()},_=R=>{R.key==="Escape"&&d.current()},E=R=>{var M;if(x(R.target)){R.stopPropagation();return}if((M=v.current)!=null&&M.contains(R.target)){R.stopPropagation();return}R.preventDefault(),R.stopPropagation()};return document.addEventListener("pointerdown",L),document.addEventListener("keydown",_),document.addEventListener("wheel",E,{capture:!0,passive:!1}),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("keydown",_),document.removeEventListener("wheel",E,!0)}},[e]);const V=a.useMemo(()=>{if(!r)return[0,0];const x=i==="top"?r.top:r.bottom,L=i==="top"?x-s:x+s;return[r.left,L]},[r,i,s]);return h.jsx(N.Popup,{visible:e&&!!r,offset:V,overflowVisible:!0,placementY:i==="top"?"above":"below",children:h.jsx("section",{ref:v,children:o&&h.jsx(ji,{menuType:o,menuSessionVersion:m.current,onOptionSelect:u})})})}const Ai="desktop-context-menu";function y6(){const[t,n]=a.useState(!1),[e,r]=a.useState(""),[o,i]=a.useState(null),s=a.useRef(t),l=H.useDependency(n1),u=H.useDependency(C.ICommandService),v=H.useInjector();s.current=t,a.useEffect(()=>{const m=l.registerContextMenuHandler({handleContextMenu:p,hideContextMenu(){d()},get visible(){return s.current}});return()=>{m.dispose()}},[l]);function p(m,I){n(!1),requestAnimationFrame(()=>{r(I),i({left:m.clientX,top:m.clientY,bottom:m.clientY}),n(!0)})}function d(){n(!1)}return h.jsx(L6,{hostId:Ai,visible:t,anchorRect:o,menuType:e,onRequestClose:d,onOptionSelect:m=>{const{label:I,commandId:S,value:V}=m;u&&u.executeCommand(S!=null?S:I,{value:V}),v.get(xe).focus(),d()}})}const D1=C.createIdentifier("univer.global-zone-service");function xt(){const t=H.useDependency(D1),[n,e]=a.useState(!1),r=H.useObservable(t.componentKey$,t.componentKey),o=H.useDependency(Ce),i=a.useMemo(()=>{const s=o.get(r!=null?r:"");if(s)return s},[r,o]);return a.useEffect(()=>{const s=t.visible$.subscribe(l=>{e(l)});return()=>{s.unsubscribe()}},[t.visible$]),n?h.jsx("section",{className:N.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!n,"univer-inset-0 univer-z-[100] univer-block univer-size-full":n}),children:i&&h.jsx(i,{})}):null}function Mt(){const t=H.useDependency(Ae),n=H.useObservable(t.sidebarOptions$),e=a.useRef(null),r=a.useMemo(()=>{if(!n)return null;const s={...n};for(const l of["children","header","footer"]){const u=l;if(n[u]){const{key:v,...p}=n[u];p&&(s[u]=h.jsx(fe,{...p},v))}}return s},[n]);a.useEffect(()=>(e.current&&t.setContainer(e.current),()=>{t.setContainer(void 0)}),[t]),a.useEffect(()=>{const s=u=>{t.scrollEvent$.next(u)},l=e.current;return l&&l.addEventListener("scroll",s),()=>{l==null||l.removeEventListener("scroll",s)}},[t]);const o=a.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function i(){var l;const s={...n,visible:!1};t.options.visible=!1,t.sidebarOptions$.next(s),(l=s==null?void 0:s.onClose)==null||l.call(s)}return h.jsx("section",{"data-u-comp":"sidebar",className:N.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:o},children:h.jsxs("section",{ref:e,className:N.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",N.borderLeftBottomClassName,N.scrollbarClassName),children:[h.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-cursor-default 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,h.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:i,children:h.jsx(st,{})})]}),h.jsx("section",{className:"univer-box-border univer-cursor-default univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&h.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 O1=C.createIdentifier("univer.zen-zone-service");function It(){const t=H.useDependency(O1),[n,e]=a.useState(!1),[r,o]=a.useState(),i=H.useObservable(t.temporaryHidden$),s=H.useDependency(Ce);a.useEffect(()=>{const u=[t.visible$.subscribe(v=>{e(v)}),t.componentKey$.subscribe(v=>{o(v)})];return()=>{u.forEach(v=>{v.unsubscribe()})}},[]);const l=a.useMemo(()=>{const u=s.get(r!=null?r:"");if(u)return u},[r]);return h.jsx("section",{className:N.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":n,"univer-hidden":i}),children:h.jsx("div",{className:"univer-relative univer-flex-1",children:l&&h.jsx(l,{})})})}function Bi(t){const n=z9(Ne);return h.jsx(Pi,{...t,...n})}function Pi(t){var J;const{header:n=!0,toolbar:e=!0,footer:r=!0,headerMenu:o=!0,contextMenu:i=!0,ribbonType:s="classic",mountContainer:l,onRendered:u}=t,v=H.useDependency(C.LocaleService),p=H.useDependency(C.ThemeService),d=H.useDependency(t1),m=a.useRef(null),S=H.useDependency(C.IConfigService).getConfig(Ne),V=ge(oe.CUSTOM_HEADER),x=ge(oe.FOOTER),L=ge(oe.HEADER),_=ge(oe.HEADER_MENU),E=ge(oe.CONTENT),R=ge(oe.LEFT_SIDEBAR),M=ge(oe.GLOBAL),T=ge(oe.TOOLBAR),j=(J=S==null?void 0:S.popupRootId)!=null?J:"univer-popup-portal";a.useLayoutEffect(()=>{const Q=p.currentTheme$.subscribe(G=>{d.injectThemeToHead(G)});return()=>{Q.unsubscribe()}},[]);const[U,W]=a.useState(!1);a.useLayoutEffect(()=>{const Q=p.darkMode$.subscribe(G=>{W(G),G?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{Q.unsubscribe()}},[]),a.useEffect(()=>{m.current&&(u==null||u(m.current))},[u]);const[q,K]=a.useState(v.getLocales()),X=a.useMemo(()=>document.createElement("div"),[]);return a.useEffect(()=>{document.body.appendChild(X);const Q=[v.localeChanged$.subscribe(()=>{K(v.getLocales())})];return()=>{Q.forEach(G=>G.unsubscribe()),document.body.removeChild(X)}},[v,l,X]),h.jsxs(N.ConfigProvider,{locale:q==null?void 0:q.design,mountContainer:X,children:[h.jsxs("div",{"data-u-comp":"workbench-layout",className:N.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":U}),tabIndex:-1,onBlur:Q=>Q.stopPropagation(),onContextMenu:Q=>Q.preventDefault(),children:[h.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:h.jsx(pe,{components:V},"custom-header")}),n&&e&&h.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:h.jsx(pe,{components:T,sharedProps:{ribbonType:s,headerMenuComponents:_,headerMenu:o}},"toolbar")}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:h.jsx(pe,{components:R},"left-sidebar")}),h.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[h.jsx("header",{children:n&&h.jsx(pe,{components:L},"header")}),h.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:m,"data-range-selector":!0,onContextMenu:Q=>Q.preventDefault(),children:h.jsx(pe,{components:E},"content")})]}),h.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-z-[100] univer-h-full",children:h.jsx(Mt,{})})]}),r&&h.jsx("footer",{children:h.jsx(pe,{components:x,sharedProps:{contextMenu:i}},"footer")}),h.jsx(It,{})]})]}),h.jsx(pe,{components:M},"global"),h.jsx(xt,{}),i&&h.jsx(y6,{}),h.jsx(ki,{}),h.jsx("div",{id:j})]})}function ki(){const{mountContainer:t}=a.useContext(N.ConfigContext),n=ge(oe.FLOATING);return it.createPortal(h.jsx(pe,{components:n},"floating"),t)}const Fi=3e3;class _t extends C.Disposable{constructor(e,r,o,i,s){super();P(this,"_steadyTimeout");P(this,"_renderTimeout");P(this,"_currentRenderId",null);this._injector=e,this._instanceService=r,this._layoutService=o,this._lifecycleService=i,this._renderManagerService=s}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(e,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(e)));try{await this._lifecycleService.onStage(C.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const o=this._renderManagerService.getRenderAll();for(const[i]of o)if(this._changeRenderUnit(i,e))break;this.disposeWithMe(this._instanceService.focused$.subscribe(i=>{i&&this._changeRenderUnit(i,e)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(i=>{var s;i.unitId===((s=this._instanceService.getFocusedUnit())==null?void 0:s.getUnitId())&&this._changeRenderUnit(i.unitId,e)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(i=>{this._currentRenderId===i&&(this._currentRenderId=null)})),this._lifecycleService.stage=C.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=C.LifecycleStages.Steady},Fi)},300)}catch(o){if(clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),o instanceof C.LifecycleUnreachableError)return;throw o}}))}_changeRenderUnit(e,r){if(this._currentRenderId===e)return!1;const o=this._renderManagerService.getRenderById(e);if(!o||!o.unitId||C.isInternalEditorID(o.unitId))return!1;const i=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return i==null||i.deactivate(),i==null||i.engine.unmount(),o.engine.mount(r),o.activate(),this._currentRenderId=e,!0}}var Ui=Object.getOwnPropertyDescriptor,zi=(t,n,e,r)=>{for(var o=r>1?void 0:r?Ui(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},_e=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopUIController=class extends _t{constructor(n,e,r,o,i,s,l,u,v){super(e,s,i,r,o),this._config=n,this._componentManager=v,l.mergeMenu(u6),this._initBuiltinComponents(u),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[k9,P9],[U9,F9],[X9,G9],[q9,Y9],[Q9,J9],[W9,N.ColorPicker]].forEach(([n,e])=>{this.disposeWithMe(this._componentManager.register(n,e))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(n){return Wi(this._injector,this._config,n)}_initBuiltinComponents(n){this.disposeWithMe(n.registerComponent(oe.FLOATING,()=>H.connectInjector(mt,this._injector))),this.disposeWithMe(n.registerComponent(oe.CONTENT,()=>H.connectInjector(gt,this._injector))),this.disposeWithMe(n.registerComponent(oe.TOOLBAR,()=>H.connectInjector(m6,this._injector)))}};exports.DesktopUIController=zi([_e(1,C.Inject(C.Injector)),_e(2,C.Inject(C.LifecycleService)),_e(3,Ke.IRenderManagerService),_e(4,xe),_e(5,C.IUniverInstanceService),_e(6,ye),_e(7,Le),_e(8,C.Inject(Ce))],exports.DesktopUIController);function Wi(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=m3(o)}else o instanceof HTMLElement?r=o:r=m3("univer");const i=H.connectInjector(Bi,t),s=u=>e(u,r);function l(){N.render(h.jsx(i,{...n,mountContainer:r,onRendered:s}),r)}return l(),C.toDisposable(()=>{N.unmount(r)})}function m3(t){const n=document.createElement("div");return n.id=t,n}const Qe=C.createIdentifier("univer.ui.ui-controller"),Gi="@univerjs/ui",Yi="0.16.1-insiders.20260311-074e8ca",V1={name:Gi,version:Yi};function Xi(t){const{menuType:n,onOptionSelect:e}=t,r=H.useDependency(ye);if(!n)return null;const o=a.useMemo(()=>{const i=r.getMenuByPositionKey(n);function s(l){return l.reduce((u,v)=>v.children?[...u,...s(v.children)]:[...u,v],[])}return s(i)},[n]);return h.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,o.length)}, 72px)`},children:o.map(i=>i.item&&h.jsx(qi,{menuItem:i.item,onClick:s=>e==null?void 0:e({value:"",label:i.key,...s})},i.key))})}function qi(t){const{menuItem:n,onClick:e}=t,{id:r,type:o,title:i,label:s,icon:l}=n;if(o!==ue.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const u=H.useObservable(n.disabled$,!1),v=H.useObservable(n.value$);return h.jsx("button",{type:"button",className:N.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:u,onClick:()=>e({id:r}),children:h.jsx(fe,{value:v,title:i,label:s,icon:l})},r)}const v1="mobile-context-menu";function x6(){const[t,n]=a.useState(!1),[e,r]=a.useState(""),[o,i]=a.useState([0,0]),s=a.useRef(t),l=H.useDependency(r1),u=H.useDependency(n1),v=H.useDependency(C.ICommandService);s.current=t,a.useEffect(()=>{const m=l.registerMenu(v1,()=>{n(!1)}),I=u.registerContextMenuHandler({handleContextMenu:p,hideContextMenu(){d()},get visible(){return s.current}});return document.addEventListener("pointerdown",d),document.addEventListener("wheel",d),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("wheel",d),I.dispose(),m.dispose(),l.deactivateMenu(v1)}},[l,u]);function p(m,I){l.activateMenu(v1),r(I),i([m.clientX,m.clientY]),n(!0)}function d(){n(!1),l.deactivateMenu(v1)}return h.jsx(N.Popup,{visible:t,offset:o,children:h.jsx("section",{onPointerDown:m=>m.stopPropagation(),children:e&&h.jsx(Xi,{menuType:e,onOptionSelect:m=>{const{label:I,value:S,commandId:V}=m;v&&v.executeCommand(V!=null?V:I,{value:S}),n(!1)}})})})}function Ji(t){const{header:n=!0,footer:e=!0,contextMenu:r=!0,mountContainer:o,onRendered:i}=t,s=H.useDependency(C.LocaleService),l=H.useDependency(C.ThemeService),u=H.useDependency(t1),v=a.useRef(null),p=ge(oe.FOOTER),d=ge(oe.HEADER),m=ge(oe.CONTENT),I=ge(oe.LEFT_SIDEBAR),S=ge(oe.GLOBAL),[V,x]=a.useState(!1);a.useEffect(()=>{const R=l.darkMode$.subscribe(M=>{x(M)});return()=>{R.unsubscribe()}},[]),a.useEffect(()=>{v.current&&(i==null||i(v.current))},[i]);const[L,_]=a.useState(s.getLocales()),E=a.useMemo(()=>document.createElement("div"),[]);return a.useLayoutEffect(()=>{const R=l.currentTheme$.subscribe(M=>{u.injectThemeToHead(M)});return()=>{R.unsubscribe()}},[]),a.useEffect(()=>{document.body.appendChild(E);const R=[s.localeChanged$.subscribe(()=>{_(s.getLocales())})];return()=>{R.forEach(M=>M.unsubscribe()),document.body.removeChild(E)}},[s,o,E]),h.jsxs(N.ConfigProvider,{locale:L==null?void 0:L.design,mountContainer:E,children:[h.jsxs("div",{"data-u-comp":"app-layout",className:N.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":V}),tabIndex:-1,onBlur:R=>R.stopPropagation(),children:[n&&h.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{className:"univer-h-full",children:h.jsx(pe,{components:I},"left-sidebar")}),h.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[h.jsx("header",{className:"univer-w-screen",children:n&&h.jsx(pe,{components:d},"header")}),h.jsx("section",{ref:v,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:R=>R.preventDefault(),children:h.jsx(pe,{components:m},"content")})]}),h.jsx("aside",{className:"univer-h-full",children:h.jsx(Mt,{})})]}),e&&h.jsx("footer",{children:h.jsx(pe,{components:p},"footer")}),h.jsx(xt,{}),h.jsx(It,{})]})]}),h.jsx(pe,{components:S},"global"),r&&h.jsx(x6,{})]})}var Qi=Object.getOwnPropertyDescriptor,Ki=(t,n,e,r)=>{for(var o=r>1?void 0:r?Qi(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},je=(t,n)=>(e,r)=>n(e,r,t);let et=class extends _t{constructor(t,n,e,r,o,i,s){super(n,i,o,e,r),this._config=t,this._initBuiltinComponents(s),this._bootstrapWorkbench()}bootstrap(t){return e4(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(oe.CONTENT,()=>H.connectInjector(mt,this._injector))),this.disposeWithMe(t.registerComponent(oe.CONTENT,()=>H.connectInjector(gt,this._injector)))}};et=Ki([je(1,C.Inject(C.Injector)),je(2,C.Inject(C.LifecycleService)),je(3,Ke.IRenderManagerService),je(4,xe),je(5,C.IUniverInstanceService),je(6,Le)],et);function e4(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=b3(o)}else o instanceof HTMLElement?r=o:r=b3("univer");const i=H.connectInjector(Ji,t),s=u=>e(u,r);function l(){N.render(h.jsx(i,{...n,mountContainer:r,onRendered:s}),r)}return l(),C.toDisposable(()=>{N.unmount(r)})}function b3(t){const n=document.createElement("div");return n.id=t,n}const o1=C.createIdentifier("ui.notification.service");var t4=Object.getOwnPropertyDescriptor,n4=(t,n,e,r)=>{for(var o=r>1?void 0:r?t4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},r4=(t,n)=>(e,r)=>n(e,r,t);const St=C.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(n){P(this,"_beforeUnloadCallbacks",[]);P(this,"_onCloseCallbacks",[]);this._notificationService=n,this._init()}registerBeforeClose(n){return this._beforeUnloadCallbacks.push(n),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(e=>e!==n)}}}registerOnClose(n){return this._onCloseCallbacks.push(n),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(e=>e!==n)}}}_init(){window.addEventListener("beforeunload",n=>{let e=n;const r=this._beforeUnloadCallbacks.map(o=>o()).filter(o=>!!o).join(`
|
|
70
|
+
`),children:h.jsx(fe,{value$:z.value$,value:z.value,label:z.label,icon:z.icon,onChange:me=>{o==null||o({...z,value:me,id:e.id,label:n,commandId:z.commandId})}})})]},de)})}),X&&h.jsx(w6,{menuSchemas:q,submenuPortalContainer:r,onOptionSelect:o,maxMenuHeight:i})]})}),r):null)]})}function Zi(t){const[n,e]=a.useState({});return a.useEffect(()=>{const r=t.map(o=>{var s;if(!((s=o.children)!=null&&s.length))return null;const i=o.children.map(l=>{var u,v;return(v=(u=l.item)==null?void 0:u.hidden$)!=null?v:k.of(!1)});return k.combineLatest(i).subscribe(l=>{const u=l.every(v=>v===!0);e(v=>({...v,[o.key]:u}))})});return()=>{r.forEach(o=>o==null?void 0:o.unsubscribe()),e({})}},[t]),n}function L6(t){const{hostId:n,visible:e,anchorRect:r,menuType:o,anchorVertical:i="bottom",menuOffset:s=0,onRequestClose:l,onOptionSelect:u}=t,v=a.useRef(null),p=H.useDependency(r1),d=a.useRef(l),m=a.useRef(0),I=a.useRef(e),S=a.useRef(o);a.useEffect(()=>{d.current=l},[l]),e&&(!I.current||o!==S.current)&&(m.current+=1),I.current=e,S.current=o,a.useEffect(()=>{const x=p.registerMenu(n,()=>{d.current()});return()=>{x.dispose(),p.deactivateMenu(n)}},[p,n]),a.useLayoutEffect(()=>{if(e){p.activateMenu(n);return}p.deactivateMenu(n)},[p,n,e]),a.useEffect(()=>{if(!e)return;const x=R=>R instanceof Element&&R.closest(`[${b6}]`),L=R=>{x(R.target)||v.current&&!v.current.contains(R.target)&&d.current()},_=R=>{R.key==="Escape"&&d.current()},E=R=>{var M;if(x(R.target)){R.stopPropagation();return}if((M=v.current)!=null&&M.contains(R.target)){R.stopPropagation();return}R.preventDefault(),R.stopPropagation()};return document.addEventListener("pointerdown",L),document.addEventListener("keydown",_),document.addEventListener("wheel",E,{capture:!0,passive:!1}),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("keydown",_),document.removeEventListener("wheel",E,!0)}},[e]);const V=a.useMemo(()=>{if(!r)return[0,0];const x=i==="top"?r.top:r.bottom,L=i==="top"?x-s:x+s;return[r.left,L]},[r,i,s]);return h.jsx(N.Popup,{visible:e&&!!r,offset:V,overflowVisible:!0,placementY:i==="top"?"above":"below",children:h.jsx("section",{ref:v,children:o&&h.jsx(ji,{menuType:o,menuSessionVersion:m.current,onOptionSelect:u})})})}const Ai="desktop-context-menu";function y6(){const[t,n]=a.useState(!1),[e,r]=a.useState(""),[o,i]=a.useState(null),s=a.useRef(t),l=H.useDependency(n1),u=H.useDependency(C.ICommandService),v=H.useInjector();s.current=t,a.useEffect(()=>{const m=l.registerContextMenuHandler({handleContextMenu:p,hideContextMenu(){d()},get visible(){return s.current}});return()=>{m.dispose()}},[l]);function p(m,I){n(!1),requestAnimationFrame(()=>{r(I),i({left:m.clientX,top:m.clientY,bottom:m.clientY}),n(!0)})}function d(){n(!1)}return h.jsx(L6,{hostId:Ai,visible:t,anchorRect:o,menuType:e,onRequestClose:d,onOptionSelect:m=>{const{label:I,commandId:S,value:V}=m;u&&u.executeCommand(S!=null?S:I,{value:V}),v.get(xe).focus(),d()}})}const D1=C.createIdentifier("univer.global-zone-service");function xt(){const t=H.useDependency(D1),[n,e]=a.useState(!1),r=H.useObservable(t.componentKey$,t.componentKey),o=H.useDependency(Ce),i=a.useMemo(()=>{const s=o.get(r!=null?r:"");if(s)return s},[r,o]);return a.useEffect(()=>{const s=t.visible$.subscribe(l=>{e(l)});return()=>{s.unsubscribe()}},[t.visible$]),n?h.jsx("section",{className:N.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!n,"univer-inset-0 univer-z-[100] univer-block univer-size-full":n}),children:i&&h.jsx(i,{})}):null}function Mt(){const t=H.useDependency(Ae),n=H.useObservable(t.sidebarOptions$),e=a.useRef(null),r=a.useMemo(()=>{if(!n)return null;const s={...n};for(const l of["children","header","footer"]){const u=l;if(n[u]){const{key:v,...p}=n[u];p&&(s[u]=h.jsx(fe,{...p},v))}}return s},[n]);a.useEffect(()=>(e.current&&t.setContainer(e.current),()=>{t.setContainer(void 0)}),[t]),a.useEffect(()=>{const s=u=>{t.scrollEvent$.next(u)},l=e.current;return l&&l.addEventListener("scroll",s),()=>{l==null||l.removeEventListener("scroll",s)}},[t]);const o=a.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function i(){var l;const s={...n,visible:!1};t.options.visible=!1,t.sidebarOptions$.next(s),(l=s==null?void 0:s.onClose)==null||l.call(s)}return h.jsx("section",{"data-u-comp":"sidebar",className:N.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:o},children:h.jsxs("section",{ref:e,className:N.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",N.borderLeftBottomClassName,N.scrollbarClassName),children:[h.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-cursor-default 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,h.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:i,children:h.jsx(st,{})})]}),h.jsx("section",{className:"univer-box-border univer-cursor-default univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.footer)&&h.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 O1=C.createIdentifier("univer.zen-zone-service");function It(){const t=H.useDependency(O1),[n,e]=a.useState(!1),[r,o]=a.useState(),i=H.useObservable(t.temporaryHidden$),s=H.useDependency(Ce);a.useEffect(()=>{const u=[t.visible$.subscribe(v=>{e(v)}),t.componentKey$.subscribe(v=>{o(v)})];return()=>{u.forEach(v=>{v.unsubscribe()})}},[]);const l=a.useMemo(()=>{const u=s.get(r!=null?r:"");if(u)return u},[r]);return h.jsx("section",{className:N.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":n,"univer-hidden":i}),children:h.jsx("div",{className:"univer-relative univer-flex-1",children:l&&h.jsx(l,{})})})}function Bi(t){const n=z9(Ne);return h.jsx(Pi,{...t,...n})}function Pi(t){var J;const{header:n=!0,toolbar:e=!0,footer:r=!0,headerMenu:o=!0,contextMenu:i=!0,ribbonType:s="classic",mountContainer:l,onRendered:u}=t,v=H.useDependency(C.LocaleService),p=H.useDependency(C.ThemeService),d=H.useDependency(t1),m=a.useRef(null),S=H.useDependency(C.IConfigService).getConfig(Ne),V=ge(oe.CUSTOM_HEADER),x=ge(oe.FOOTER),L=ge(oe.HEADER),_=ge(oe.HEADER_MENU),E=ge(oe.CONTENT),R=ge(oe.LEFT_SIDEBAR),M=ge(oe.GLOBAL),T=ge(oe.TOOLBAR),j=(J=S==null?void 0:S.popupRootId)!=null?J:"univer-popup-portal";a.useLayoutEffect(()=>{const Q=p.currentTheme$.subscribe(G=>{d.injectThemeToHead(G)});return()=>{Q.unsubscribe()}},[]);const[U,W]=a.useState(!1);a.useLayoutEffect(()=>{const Q=p.darkMode$.subscribe(G=>{W(G),G?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{Q.unsubscribe()}},[]),a.useEffect(()=>{m.current&&(u==null||u(m.current))},[u]);const[q,K]=a.useState(v.getLocales()),X=a.useMemo(()=>document.createElement("div"),[]);return a.useEffect(()=>{document.body.appendChild(X);const Q=[v.localeChanged$.subscribe(()=>{K(v.getLocales())})];return()=>{Q.forEach(G=>G.unsubscribe()),document.body.removeChild(X)}},[v,l,X]),h.jsxs(N.ConfigProvider,{locale:q==null?void 0:q.design,mountContainer:X,children:[h.jsxs("div",{"data-u-comp":"workbench-layout",className:N.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":U}),tabIndex:-1,onBlur:Q=>Q.stopPropagation(),onContextMenu:Q=>Q.preventDefault(),children:[h.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:h.jsx(pe,{components:V},"custom-header")}),n&&e&&h.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:h.jsx(pe,{components:T,sharedProps:{ribbonType:s,headerMenuComponents:_,headerMenu:o}},"toolbar")}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:h.jsx(pe,{components:R},"left-sidebar")}),h.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[h.jsx("header",{children:n&&h.jsx(pe,{components:L},"header")}),h.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:m,"data-range-selector":!0,onContextMenu:Q=>Q.preventDefault(),children:h.jsx(pe,{components:E},"content")})]}),h.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-z-[100] univer-h-full",children:h.jsx(Mt,{})})]}),r&&h.jsx("footer",{children:h.jsx(pe,{components:x,sharedProps:{contextMenu:i}},"footer")}),h.jsx(It,{})]})]}),h.jsx(pe,{components:M},"global"),h.jsx(xt,{}),i&&h.jsx(y6,{}),h.jsx(ki,{}),h.jsx("div",{id:j})]})}function ki(){const{mountContainer:t}=a.useContext(N.ConfigContext),n=ge(oe.FLOATING);return it.createPortal(h.jsx(pe,{components:n},"floating"),t)}const Fi=3e3;class _t extends C.Disposable{constructor(e,r,o,i,s){super();P(this,"_steadyTimeout");P(this,"_renderTimeout");P(this,"_currentRenderId",null);this._injector=e,this._instanceService=r,this._layoutService=o,this._lifecycleService=i,this._renderManagerService=s}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(e,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(e)));try{await this._lifecycleService.onStage(C.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const o=this._renderManagerService.getRenderAll();for(const[i]of o)if(this._changeRenderUnit(i,e))break;this.disposeWithMe(this._instanceService.focused$.subscribe(i=>{i&&this._changeRenderUnit(i,e)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(i=>{var s;i.unitId===((s=this._instanceService.getFocusedUnit())==null?void 0:s.getUnitId())&&this._changeRenderUnit(i.unitId,e)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(i=>{this._currentRenderId===i&&(this._currentRenderId=null)})),this._lifecycleService.stage=C.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=C.LifecycleStages.Steady},Fi)},300)}catch(o){if(clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),o instanceof C.LifecycleUnreachableError)return;throw o}}))}_changeRenderUnit(e,r){if(this._currentRenderId===e)return!1;const o=this._renderManagerService.getRenderById(e);if(!o||!o.unitId||C.isInternalEditorID(o.unitId))return!1;const i=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return i==null||i.deactivate(),i==null||i.engine.unmount(),o.engine.mount(r),o.activate(),this._currentRenderId=e,!0}}var Ui=Object.getOwnPropertyDescriptor,zi=(t,n,e,r)=>{for(var o=r>1?void 0:r?Ui(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},_e=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopUIController=class extends _t{constructor(n,e,r,o,i,s,l,u,v){super(e,s,i,r,o),this._config=n,this._componentManager=v,l.mergeMenu(u6),this._initBuiltinComponents(u),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[k9,P9],[U9,F9],[X9,G9],[q9,Y9],[Q9,J9],[W9,N.ColorPicker]].forEach(([n,e])=>{this.disposeWithMe(this._componentManager.register(n,e))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(n){return Wi(this._injector,this._config,n)}_initBuiltinComponents(n){this.disposeWithMe(n.registerComponent(oe.FLOATING,()=>H.connectInjector(mt,this._injector))),this.disposeWithMe(n.registerComponent(oe.CONTENT,()=>H.connectInjector(gt,this._injector))),this.disposeWithMe(n.registerComponent(oe.TOOLBAR,()=>H.connectInjector(m6,this._injector)))}};exports.DesktopUIController=zi([_e(1,C.Inject(C.Injector)),_e(2,C.Inject(C.LifecycleService)),_e(3,Ke.IRenderManagerService),_e(4,xe),_e(5,C.IUniverInstanceService),_e(6,ye),_e(7,Le),_e(8,C.Inject(Ce))],exports.DesktopUIController);function Wi(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=m3(o)}else o instanceof HTMLElement?r=o:r=m3("univer");const i=H.connectInjector(Bi,t),s=u=>e(u,r);function l(){N.render(h.jsx(i,{...n,mountContainer:r,onRendered:s}),r)}return l(),C.toDisposable(()=>{N.unmount(r)})}function m3(t){const n=document.createElement("div");return n.id=t,n}const Qe=C.createIdentifier("univer.ui.ui-controller"),Gi="@univerjs/ui",Yi="0.17.0",V1={name:Gi,version:Yi};function Xi(t){const{menuType:n,onOptionSelect:e}=t,r=H.useDependency(ye);if(!n)return null;const o=a.useMemo(()=>{const i=r.getMenuByPositionKey(n);function s(l){return l.reduce((u,v)=>v.children?[...u,...s(v.children)]:[...u,v],[])}return s(i)},[n]);return h.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,o.length)}, 72px)`},children:o.map(i=>i.item&&h.jsx(qi,{menuItem:i.item,onClick:s=>e==null?void 0:e({value:"",label:i.key,...s})},i.key))})}function qi(t){const{menuItem:n,onClick:e}=t,{id:r,type:o,title:i,label:s,icon:l}=n;if(o!==ue.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const u=H.useObservable(n.disabled$,!1),v=H.useObservable(n.value$);return h.jsx("button",{type:"button",className:N.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:u,onClick:()=>e({id:r}),children:h.jsx(fe,{value:v,title:i,label:s,icon:l})},r)}const v1="mobile-context-menu";function x6(){const[t,n]=a.useState(!1),[e,r]=a.useState(""),[o,i]=a.useState([0,0]),s=a.useRef(t),l=H.useDependency(r1),u=H.useDependency(n1),v=H.useDependency(C.ICommandService);s.current=t,a.useEffect(()=>{const m=l.registerMenu(v1,()=>{n(!1)}),I=u.registerContextMenuHandler({handleContextMenu:p,hideContextMenu(){d()},get visible(){return s.current}});return document.addEventListener("pointerdown",d),document.addEventListener("wheel",d),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("wheel",d),I.dispose(),m.dispose(),l.deactivateMenu(v1)}},[l,u]);function p(m,I){l.activateMenu(v1),r(I),i([m.clientX,m.clientY]),n(!0)}function d(){n(!1),l.deactivateMenu(v1)}return h.jsx(N.Popup,{visible:t,offset:o,children:h.jsx("section",{onPointerDown:m=>m.stopPropagation(),children:e&&h.jsx(Xi,{menuType:e,onOptionSelect:m=>{const{label:I,value:S,commandId:V}=m;v&&v.executeCommand(V!=null?V:I,{value:S}),n(!1)}})})})}function Ji(t){const{header:n=!0,footer:e=!0,contextMenu:r=!0,mountContainer:o,onRendered:i}=t,s=H.useDependency(C.LocaleService),l=H.useDependency(C.ThemeService),u=H.useDependency(t1),v=a.useRef(null),p=ge(oe.FOOTER),d=ge(oe.HEADER),m=ge(oe.CONTENT),I=ge(oe.LEFT_SIDEBAR),S=ge(oe.GLOBAL),[V,x]=a.useState(!1);a.useEffect(()=>{const R=l.darkMode$.subscribe(M=>{x(M)});return()=>{R.unsubscribe()}},[]),a.useEffect(()=>{v.current&&(i==null||i(v.current))},[i]);const[L,_]=a.useState(s.getLocales()),E=a.useMemo(()=>document.createElement("div"),[]);return a.useLayoutEffect(()=>{const R=l.currentTheme$.subscribe(M=>{u.injectThemeToHead(M)});return()=>{R.unsubscribe()}},[]),a.useEffect(()=>{document.body.appendChild(E);const R=[s.localeChanged$.subscribe(()=>{_(s.getLocales())})];return()=>{R.forEach(M=>M.unsubscribe()),document.body.removeChild(E)}},[s,o,E]),h.jsxs(N.ConfigProvider,{locale:L==null?void 0:L.design,mountContainer:E,children:[h.jsxs("div",{"data-u-comp":"app-layout",className:N.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":V}),tabIndex:-1,onBlur:R=>R.stopPropagation(),children:[n&&h.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{className:"univer-h-full",children:h.jsx(pe,{components:I},"left-sidebar")}),h.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[h.jsx("header",{className:"univer-w-screen",children:n&&h.jsx(pe,{components:d},"header")}),h.jsx("section",{ref:v,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:R=>R.preventDefault(),children:h.jsx(pe,{components:m},"content")})]}),h.jsx("aside",{className:"univer-h-full",children:h.jsx(Mt,{})})]}),e&&h.jsx("footer",{children:h.jsx(pe,{components:p},"footer")}),h.jsx(xt,{}),h.jsx(It,{})]})]}),h.jsx(pe,{components:S},"global"),r&&h.jsx(x6,{})]})}var Qi=Object.getOwnPropertyDescriptor,Ki=(t,n,e,r)=>{for(var o=r>1?void 0:r?Qi(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},je=(t,n)=>(e,r)=>n(e,r,t);let et=class extends _t{constructor(t,n,e,r,o,i,s){super(n,i,o,e,r),this._config=t,this._initBuiltinComponents(s),this._bootstrapWorkbench()}bootstrap(t){return e4(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(oe.CONTENT,()=>H.connectInjector(mt,this._injector))),this.disposeWithMe(t.registerComponent(oe.CONTENT,()=>H.connectInjector(gt,this._injector)))}};et=Ki([je(1,C.Inject(C.Injector)),je(2,C.Inject(C.LifecycleService)),je(3,Ke.IRenderManagerService),je(4,xe),je(5,C.IUniverInstanceService),je(6,Le)],et);function e4(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=b3(o)}else o instanceof HTMLElement?r=o:r=b3("univer");const i=H.connectInjector(Ji,t),s=u=>e(u,r);function l(){N.render(h.jsx(i,{...n,mountContainer:r,onRendered:s}),r)}return l(),C.toDisposable(()=>{N.unmount(r)})}function b3(t){const n=document.createElement("div");return n.id=t,n}const o1=C.createIdentifier("ui.notification.service");var t4=Object.getOwnPropertyDescriptor,n4=(t,n,e,r)=>{for(var o=r>1?void 0:r?t4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},r4=(t,n)=>(e,r)=>n(e,r,t);const St=C.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(n){P(this,"_beforeUnloadCallbacks",[]);P(this,"_onCloseCallbacks",[]);this._notificationService=n,this._init()}registerBeforeClose(n){return this._beforeUnloadCallbacks.push(n),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(e=>e!==n)}}}registerOnClose(n){return this._onCloseCallbacks.push(n),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(e=>e!==n)}}}_init(){window.addEventListener("beforeunload",n=>{let e=n;const r=this._beforeUnloadCallbacks.map(o=>o()).filter(o=>!!o).join(`
|
|
71
71
|
`);if(r)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:r}),typeof e>"u"&&(e=window.event),e.returnValue=r,r}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(n=>n())})}};exports.DesktopBeforeCloseService=n4([r4(0,o1)],exports.DesktopBeforeCloseService);function M6(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var o4=Object.getOwnPropertyDescriptor,i4=(t,n,e,r)=>{for(var o=r>1?void 0:r?o4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},X1=(t,n)=>(e,r)=>n(e,r,t);const tt="text/plain",nt="text/html",I6="image/png",_6="image/jpeg",S6="image/bmp",R6="image/webp",s4="image/svg+xml",a4=new Set([S6,_6,R6,I6]),Rt=C.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends C.Disposable{constructor(n,e,r){super(),this._localeService=n,this._logService=e,this._notificationService=r}get supportClipboard(){return M6()}async write(n,e){if(!this.supportClipboard)return this._legacyCopyHtml(e);try{return await navigator.clipboard.write([new ClipboardItem({[tt]:new Blob([n],{type:tt}),[nt]:new Blob([e],{type:nt})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(n){if(!this.supportClipboard)return this._legacyCopyText(n);try{return await navigator.clipboard.writeText(n)}catch(e){this._logService.error("[BrowserClipboardService]",e),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(n){return this._logService.error("[BrowserClipboardService]",n),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(n){return this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(n){const e=document.activeElement,r=c4();document.body.appendChild(r),r.innerHTML=n;try{w3(r),document.execCommand("copy")}finally{e instanceof HTMLElement&&e.focus(),document.body.removeChild(r)}}_legacyCopyText(n){const e=document.activeElement,r=l4();document.body.appendChild(r),r.value=n;try{w3(r),document.execCommand("copy")}finally{e instanceof HTMLElement&&e.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var n;(n=this._notificationService)==null||n.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}};exports.BrowserClipboardService=i4([X1(0,C.Inject(C.LocaleService)),X1(1,C.ILogService),X1(2,C.Optional(o1))],exports.BrowserClipboardService);function l4(){const t=document.createElement("textarea");return t.style.position="absolute",t.style.height="1px",t.style.width="1px",t.style.opacity="0",t.readOnly=!0,t}function c4(){const t=document.createElement("div");return t.contentEditable="true",t.style.position="absolute",t.style.opacity="0",t.style.height="1px",t.style.width="1px",t}function w3(t){if(t instanceof HTMLTextAreaElement){const r=t.hasAttribute("readonly");return r||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),r||t.removeAttribute("readonly"),t.value}t.hasAttribute("contenteditable")&&t.focus();const n=document.createRange();n.selectNodeContents(t);const e=window.getSelection();if(!e)throw new Error;return e.removeAllRanges(),e.addRange(n),e.toString()}const u4=t=>{const{children:n,onClose:e,onConfirm:r}=t,[o]=a.useState({}),i=n?a.cloneElement(n,{hooks:o}):null;return h.jsx(N.Confirm,{...t,children:i,onClose:()=>{const s=o.beforeClose;if(s){const l=s();if(l.cancel)return;e==null||e(l);return}e==null||e()},onConfirm:()=>{const s=o.beforeConfirm;if(s){const l=s();if(l.cancel)return;r==null||r(l);return}r==null||r()}})};function d4(){const t=H.useDependency(C.IConfirmService),[n,e]=a.useState([]);a.useEffect(()=>{const o=t.confirmOptions$.subscribe(i=>{e(i)});return()=>{o.unsubscribe()}},[]);const r=n.map(o=>{const{children:i,title:s,...l}=o,u=l;for(const v of["children","title"]){const p=v,d=o[p];d&&(u[p]=h.jsx(fe,{...d}))}return u});return r==null?void 0:r.map((o,i)=>h.jsx(u4,{...o,children:o.children},i))}var f4=Object.getOwnPropertyDescriptor,h4=(t,n,e,r)=>{for(var o=r>1?void 0:r?f4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},L3=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopConfirmService=class extends C.Disposable{constructor(e,r){super();P(this,"_confirmOptions",[]);P(this,"confirmOptions$",new k.BehaviorSubject([]));this._injector=e,this._uiPartsService=r,this._initUIPart()}open(e){return this._confirmOptions.find(r=>r.id===e.id)?this._confirmOptions=this._confirmOptions.map(r=>({...r.id===e.id?e:r,visible:r.id===e.id?!0:r.visible})):this._confirmOptions.push({...e,visible:!0}),this.confirmOptions$.next(this._confirmOptions),C.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(e){return new Promise(r=>{const o=this.open({...e,onConfirm:()=>{o.dispose(),r(!0)},onClose:()=>{o.dispose(),r(!1)}})})}close(e){this._confirmOptions=this._confirmOptions.map(r=>({...r,visible:r.id===e?!1:r.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(oe.GLOBAL,()=>H.connectInjector(d4,this._injector)))}};exports.DesktopConfirmService=h4([L3(0,C.Inject(C.Injector)),L3(1,Le)],exports.DesktopConfirmService);const N1=C.createIdentifier("univer.ui.dialog-service");function C4(){const t=H.useDependency(N1),[n,e]=a.useState([]);a.useEffect(()=>{const i=t.getDialogs$().subscribe(s=>{e(s)});return()=>i.unsubscribe()},[]);const r=a.useMemo(()=>n.map(o=>{const{children:i,title:s,footer:l,...u}=o,v=u;for(const p of["children","title","footer"]){const d=p,m=o[d];m&&(v[d]=h.jsx(fe,{...m}))}return v}),[n]);return r==null?void 0:r.map(o=>h.jsx(N.Dialog,{...o},o.id))}var v4=Object.getOwnPropertyDescriptor,g4=(t,n,e,r)=>{for(var o=r>1?void 0:r?v4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},y3=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopDialogService=class extends C.Disposable{constructor(e,r){super();P(this,"_dialogOptions",[]);P(this,"_dialogOptions$",new k.Subject);this._injector=e,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions=[],this._dialogOptions$.complete()}open(e){return this._dialogOptions.find(r=>r.id===e.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===e.id?e:r,open:r.id===e.id?!0:r.open})):this._dialogOptions.push({...e,open:!0}),this._dialogOptions$.next(this._dialogOptions),C.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(e){this._dialogOptions=this._dialogOptions.map(r=>({...r,open:r.id===e?!1:r.open})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(e){const r=new Set(e);this._dialogOptions=this._dialogOptions.map(o=>({...o,open:r.has(o.id)?o.open:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(oe.GLOBAL,()=>H.connectInjector(C4,this._injector)))}};exports.DesktopDialogService=g4([y3(0,C.Inject(C.Injector)),y3(1,Le)],exports.DesktopDialogService);const T1=C.createIdentifier("univer.ui.gallery-service");function p4(){const t=H.useDependency(T1),n=H.useObservable(t.gallery$);return n?h.jsx(N.Gallery,{...n}):null}var m4=Object.getOwnPropertyDescriptor,b4=(t,n,e,r)=>{for(var o=r>1?void 0:r?m4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},x3=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopGalleryService=class extends C.Disposable{constructor(e,r){super();P(this,"gallery$",new k.Subject);this._injector=e,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose()}open(e){return this.gallery$.next({open:!0,...e}),C.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(oe.GLOBAL,()=>H.connectInjector(p4,this._injector)))}};exports.DesktopGalleryService=b4([x3(0,C.Inject(C.Injector)),x3(1,Le)],exports.DesktopGalleryService);var w4=Object.getOwnPropertyDescriptor,L4=(t,n,e,r)=>{for(var o=r>1?void 0:r?w4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},y4=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopGlobalZoneService=class{constructor(n){P(this,"visible$",new k.Subject);P(this,"componentKey$",new k.Subject);P(this,"_componentKey","");this._componentManager=n}get componentKey(){return this._componentKey}set(n,e){return this._componentManager.register(n,e),this.componentKey$.next(n),this._componentKey=n,C.toDisposable(()=>{this._componentManager.delete(n),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=L4([y4(0,C.Inject(Ce))],exports.DesktopGlobalZoneService);class Et extends C.Disposable{openFile(n){return new Promise(e=>{var o,i;const r=document.createElement("input");r.type="file",r.accept=(o=n==null?void 0:n.accept)!=null?o:"",r.multiple=(i=n==null?void 0:n.multiple)!=null?i:!1,r.onchange=s=>{const l=s.target.files;l&&e(Array.from(l))},r.click()})}downloadFile(n,e){const r=document.createElement("a");r.download=e,r.href=window.URL.createObjectURL(n),r.click()}}const Ht=C.createIdentifier("univer-ui.local-file.service");var g1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x4(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function p1(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var q1={exports:{}};var M3;function M4(){return M3||(M3=1,(function(t,n){(function(e){t.exports=e()})(function(){return(function e(r,o,i){function s(v,p){if(!o[v]){if(!r[v]){var d=typeof p1=="function"&&p1;if(!p&&d)return d(v,!0);if(l)return l(v,!0);var m=new Error("Cannot find module '"+v+"'");throw m.code="MODULE_NOT_FOUND",m}var I=o[v]={exports:{}};r[v][0].call(I.exports,function(S){var V=r[v][1][S];return s(V||S)},I,I.exports,e,r,o,i)}return o[v].exports}for(var l=typeof p1=="function"&&p1,u=0;u<i.length;u++)s(i[u]);return s})({1:[function(e,r,o){(function(i){var s=i.MutationObserver||i.WebKitMutationObserver,l;if(s){var u=0,v=new s(S),p=i.document.createTextNode("");v.observe(p,{characterData:!0}),l=function(){p.data=u=++u%2}}else if(!i.setImmediate&&typeof i.MessageChannel<"u"){var d=new i.MessageChannel;d.port1.onmessage=S,l=function(){d.port2.postMessage(0)}}else"document"in i&&"onreadystatechange"in i.document.createElement("script")?l=function(){var x=i.document.createElement("script");x.onreadystatechange=function(){S(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},i.document.documentElement.appendChild(x)}:l=function(){setTimeout(S,0)};var m,I=[];function S(){m=!0;for(var x,L,_=I.length;_;){for(L=I,I=[],x=-1;++x<_;)L[x]();_=I.length}m=!1}r.exports=V;function V(x){I.push(x)===1&&!m&&l()}}).call(this,typeof g1<"u"?g1:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,r,o){var i=e(1);function s(){}var l={},u=["REJECTED"],v=["FULFILLED"],p=["PENDING"];r.exports=d;function d(M){if(typeof M!="function")throw new TypeError("resolver must be a function");this.state=p,this.queue=[],this.outcome=void 0,M!==s&&V(this,M)}d.prototype.catch=function(M){return this.then(null,M)},d.prototype.then=function(M,T){if(typeof M!="function"&&this.state===v||typeof T!="function"&&this.state===u)return this;var j=new this.constructor(s);if(this.state!==p){var U=this.state===v?M:T;I(j,U,this.outcome)}else this.queue.push(new m(j,M,T));return j};function m(M,T,j){this.promise=M,typeof T=="function"&&(this.onFulfilled=T,this.callFulfilled=this.otherCallFulfilled),typeof j=="function"&&(this.onRejected=j,this.callRejected=this.otherCallRejected)}m.prototype.callFulfilled=function(M){l.resolve(this.promise,M)},m.prototype.otherCallFulfilled=function(M){I(this.promise,this.onFulfilled,M)},m.prototype.callRejected=function(M){l.reject(this.promise,M)},m.prototype.otherCallRejected=function(M){I(this.promise,this.onRejected,M)};function I(M,T,j){i(function(){var U;try{U=T(j)}catch(W){return l.reject(M,W)}U===M?l.reject(M,new TypeError("Cannot resolve promise with itself")):l.resolve(M,U)})}l.resolve=function(M,T){var j=x(S,T);if(j.status==="error")return l.reject(M,j.value);var U=j.value;if(U)V(M,U);else{M.state=v,M.outcome=T;for(var W=-1,q=M.queue.length;++W<q;)M.queue[W].callFulfilled(T)}return M},l.reject=function(M,T){M.state=u,M.outcome=T;for(var j=-1,U=M.queue.length;++j<U;)M.queue[j].callRejected(T);return M};function S(M){var T=M&&M.then;if(M&&(typeof M=="object"||typeof M=="function")&&typeof T=="function")return function(){T.apply(M,arguments)}}function V(M,T){var j=!1;function U(X){j||(j=!0,l.reject(M,X))}function W(X){j||(j=!0,l.resolve(M,X))}function q(){T(W,U)}var K=x(q);K.status==="error"&&U(K.value)}function x(M,T){var j={};try{j.value=M(T),j.status="success"}catch(U){j.status="error",j.value=U}return j}d.resolve=L;function L(M){return M instanceof this?M:l.resolve(new this(s),M)}d.reject=_;function _(M){var T=new this(s);return l.reject(T,M)}d.all=E;function E(M){var T=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var j=M.length,U=!1;if(!j)return this.resolve([]);for(var W=new Array(j),q=0,K=-1,X=new this(s);++K<j;)J(M[K],K);return X;function J(Q,G){T.resolve(Q).then(te,function(ae){U||(U=!0,l.reject(X,ae))});function te(ae){W[G]=ae,++q===j&&!U&&(U=!0,l.resolve(X,W))}}}d.race=R;function R(M){var T=this;if(Object.prototype.toString.call(M)!=="[object Array]")return this.reject(new TypeError("must be an array"));var j=M.length,U=!1;if(!j)return this.resolve([]);for(var W=-1,q=new this(s);++W<j;)K(M[W]);return q;function K(X){T.resolve(X).then(function(J){U||(U=!0,l.resolve(q,J))},function(J){U||(U=!0,l.reject(q,J))})}}},{1:1}],3:[function(e,r,o){(function(i){typeof i.Promise!="function"&&(i.Promise=e(2))}).call(this,typeof g1<"u"?g1:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,r,o){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function s(c,g){if(!(c instanceof g))throw new TypeError("Cannot call a class as a function")}function l(){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 u=l();function v(){try{if(!u||!u.open)return!1;var c=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(!c||g)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function p(c,g){c=c||[],g=g||{};try{return new Blob(c,g)}catch(b){if(b.name!=="TypeError")throw b;for(var f=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,w=new f,y=0;y<c.length;y+=1)w.append(c[y]);return w.getBlob(g.type)}}typeof Promise>"u"&&e(3);var d=Promise;function m(c,g){g&&c.then(function(f){g(null,f)},function(f){g(f)})}function I(c,g,f){typeof g=="function"&&c.then(g),typeof f=="function"&&c.catch(f)}function S(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function V(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var x="local-forage-detect-blob-support",L=void 0,_={},E=Object.prototype.toString,R="readonly",M="readwrite";function T(c){for(var g=c.length,f=new ArrayBuffer(g),w=new Uint8Array(f),y=0;y<g;y++)w[y]=c.charCodeAt(y);return f}function j(c){return new d(function(g){var f=c.transaction(x,M),w=p([""]);f.objectStore(x).put(w,"key"),f.onabort=function(y){y.preventDefault(),y.stopPropagation(),g(!1)},f.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),b=navigator.userAgent.match(/Edge\//);g(b||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function U(c){return typeof L=="boolean"?d.resolve(L):j(c).then(function(g){return L=g,L})}function W(c){var g=_[c.name],f={};f.promise=new d(function(w,y){f.resolve=w,f.reject=y}),g.deferredOperations.push(f),g.dbReady?g.dbReady=g.dbReady.then(function(){return f.promise}):g.dbReady=f.promise}function q(c){var g=_[c.name],f=g.deferredOperations.pop();if(f)return f.resolve(),f.promise}function K(c,g){var f=_[c.name],w=f.deferredOperations.pop();if(w)return w.reject(g),w.promise}function X(c,g){return new d(function(f,w){if(_[c.name]=_[c.name]||be(),c.db)if(g)W(c),c.db.close();else return f(c.db);var y=[c.name];g&&y.push(c.version);var b=u.open.apply(u,y);g&&(b.onupgradeneeded=function(O){var $=b.result;try{$.createObjectStore(c.storeName),O.oldVersion<=1&&$.createObjectStore(x)}catch(Z){if(Z.name==="ConstraintError")console.warn('The database "'+c.name+'" has been upgraded from version '+O.oldVersion+" to version "+O.newVersion+', but the storage "'+c.storeName+'" already exists.');else throw Z}}),b.onerror=function(O){O.preventDefault(),w(b.error)},b.onsuccess=function(){var O=b.result;O.onversionchange=function($){$.target.close()},f(O),q(c)}})}function J(c){return X(c,!1)}function Q(c){return X(c,!0)}function G(c,g){if(!c.db)return!0;var f=!c.db.objectStoreNames.contains(c.storeName),w=c.version<c.db.version,y=c.version>c.db.version;if(w&&(c.version!==g&&console.warn('The database "'+c.name+`" can't be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),y||f){if(f){var b=c.db.version+1;b>c.version&&(c.version=b)}return!0}return!1}function te(c){return new d(function(g,f){var w=new FileReader;w.onerror=f,w.onloadend=function(y){var b=btoa(y.target.result||"");g({__local_forage_encoded_blob:!0,data:b,type:c.type})},w.readAsBinaryString(c)})}function ae(c){var g=T(atob(c.data));return p([g],{type:c.type})}function z(c){return c&&c.__local_forage_encoded_blob}function se(c){var g=this,f=g._initReady().then(function(){var w=_[g._dbInfo.name];if(w&&w.dbReady)return w.dbReady});return I(f,c,c),f}function de(c){W(c);for(var g=_[c.name],f=g.forages,w=0;w<f.length;w++){var y=f[w];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return c.db=null,J(c).then(function(b){return c.db=b,G(c)?Q(c):b}).then(function(b){c.db=g.db=b;for(var O=0;O<f.length;O++)f[O]._dbInfo.db=b}).catch(function(b){throw K(c,b),b})}function ie(c,g,f,w){w===void 0&&(w=1);try{var y=c.db.transaction(c.storeName,g);f(null,y)}catch(b){if(w>0&&(!c.db||b.name==="InvalidStateError"||b.name==="NotFoundError"))return d.resolve().then(function(){if(!c.db||b.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),Q(c)}).then(function(){return de(c).then(function(){ie(c,g,f,w-1)})}).catch(f);f(b)}}function be(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function me(c){var g=this,f={db:null};if(c)for(var w in c)f[w]=c[w];var y=_[f.name];y||(y=be(),_[f.name]=y),y.forages.push(g),g._initReady||(g._initReady=g.ready,g.ready=se);var b=[];function O(){return d.resolve()}for(var $=0;$<y.forages.length;$++){var Z=y.forages[$];Z!==g&&b.push(Z._initReady().catch(O))}var A=y.forages.slice(0);return d.all(b).then(function(){return f.db=y.db,J(f)}).then(function(B){return f.db=B,G(f,g._defaultConfig.version)?Q(f):B}).then(function(B){f.db=y.db=B,g._dbInfo=f;for(var F=0;F<A.length;F++){var Y=A[F];Y!==g&&(Y._dbInfo.db=f.db,Y._dbInfo.version=f.version)}})}function De(c,g){var f=this;c=S(c);var w=new d(function(y,b){f.ready().then(function(){ie(f._dbInfo,R,function(O,$){if(O)return b(O);try{var Z=$.objectStore(f._dbInfo.storeName),A=Z.get(c);A.onsuccess=function(){var B=A.result;B===void 0&&(B=null),z(B)&&(B=ae(B)),y(B)},A.onerror=function(){b(A.error)}}catch(B){b(B)}})}).catch(b)});return m(w,g),w}function i1(c,g){var f=this,w=new d(function(y,b){f.ready().then(function(){ie(f._dbInfo,R,function(O,$){if(O)return b(O);try{var Z=$.objectStore(f._dbInfo.storeName),A=Z.openCursor(),B=1;A.onsuccess=function(){var F=A.result;if(F){var Y=F.value;z(Y)&&(Y=ae(Y));var ee=c(Y,F.key,B++);ee!==void 0?y(ee):F.continue()}else y()},A.onerror=function(){b(A.error)}}catch(F){b(F)}})}).catch(b)});return m(w,g),w}function s1(c,g,f){var w=this;c=S(c);var y=new d(function(b,O){var $;w.ready().then(function(){return $=w._dbInfo,E.call(g)==="[object Blob]"?U($.db).then(function(Z){return Z?g:te(g)}):g}).then(function(Z){ie(w._dbInfo,M,function(A,B){if(A)return O(A);try{var F=B.objectStore(w._dbInfo.storeName);Z===null&&(Z=void 0);var Y=F.put(Z,c);B.oncomplete=function(){Z===void 0&&(Z=null),b(Z)},B.onabort=B.onerror=function(){var ee=Y.error?Y.error:Y.transaction.error;O(ee)}}catch(ee){O(ee)}})}).catch(O)});return m(y,f),y}function j1(c,g){var f=this;c=S(c);var w=new d(function(y,b){f.ready().then(function(){ie(f._dbInfo,M,function(O,$){if(O)return b(O);try{var Z=$.objectStore(f._dbInfo.storeName),A=Z.delete(c);$.oncomplete=function(){y()},$.onerror=function(){b(A.error)},$.onabort=function(){var B=A.error?A.error:A.transaction.error;b(B)}}catch(B){b(B)}})}).catch(b)});return m(w,g),w}function a1(c){var g=this,f=new d(function(w,y){g.ready().then(function(){ie(g._dbInfo,M,function(b,O){if(b)return y(b);try{var $=O.objectStore(g._dbInfo.storeName),Z=$.clear();O.oncomplete=function(){w()},O.onabort=O.onerror=function(){var A=Z.error?Z.error:Z.transaction.error;y(A)}}catch(A){y(A)}})}).catch(y)});return m(f,c),f}function Z1(c){var g=this,f=new d(function(w,y){g.ready().then(function(){ie(g._dbInfo,R,function(b,O){if(b)return y(b);try{var $=O.objectStore(g._dbInfo.storeName),Z=$.count();Z.onsuccess=function(){w(Z.result)},Z.onerror=function(){y(Z.error)}}catch(A){y(A)}})}).catch(y)});return m(f,c),f}function D6(c,g){var f=this,w=new d(function(y,b){if(c<0){y(null);return}f.ready().then(function(){ie(f._dbInfo,R,function(O,$){if(O)return b(O);try{var Z=$.objectStore(f._dbInfo.storeName),A=!1,B=Z.openKeyCursor();B.onsuccess=function(){var F=B.result;if(!F){y(null);return}c===0||A?y(F.key):(A=!0,F.advance(c))},B.onerror=function(){b(B.error)}}catch(F){b(F)}})}).catch(b)});return m(w,g),w}function O6(c){var g=this,f=new d(function(w,y){g.ready().then(function(){ie(g._dbInfo,R,function(b,O){if(b)return y(b);try{var $=O.objectStore(g._dbInfo.storeName),Z=$.openKeyCursor(),A=[];Z.onsuccess=function(){var B=Z.result;if(!B){w(A);return}A.push(B.key),B.continue()},Z.onerror=function(){y(Z.error)}}catch(B){y(B)}})}).catch(y)});return m(f,c),f}function V6(c,g){g=V.apply(this,arguments);var f=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||f.name,c.storeName=c.storeName||f.storeName);var w=this,y;if(!c.name)y=d.reject("Invalid arguments");else{var b=c.name===f.name&&w._dbInfo.db,O=b?d.resolve(w._dbInfo.db):J(c).then(function($){var Z=_[c.name],A=Z.forages;Z.db=$;for(var B=0;B<A.length;B++)A[B]._dbInfo.db=$;return $});c.storeName?y=O.then(function($){if($.objectStoreNames.contains(c.storeName)){var Z=$.version+1;W(c);var A=_[c.name],B=A.forages;$.close();for(var F=0;F<B.length;F++){var Y=B[F];Y._dbInfo.db=null,Y._dbInfo.version=Z}var ee=new d(function(ne,ce){var le=u.open(c.name,Z);le.onerror=function(we){var ke=le.result;ke.close(),ce(we)},le.onupgradeneeded=function(){var we=le.result;we.deleteObjectStore(c.storeName)},le.onsuccess=function(){var we=le.result;we.close(),ne(we)}});return ee.then(function(ne){A.db=ne;for(var ce=0;ce<B.length;ce++){var le=B[ce];le._dbInfo.db=ne,q(le._dbInfo)}}).catch(function(ne){throw(K(c,ne)||d.resolve()).catch(function(){}),ne})}}):y=O.then(function($){W(c);var Z=_[c.name],A=Z.forages;$.close();for(var B=0;B<A.length;B++){var F=A[B];F._dbInfo.db=null}var Y=new d(function(ee,ne){var ce=u.deleteDatabase(c.name);ce.onerror=function(){var le=ce.result;le&&le.close(),ne(ce.error)},ce.onblocked=function(){console.warn('dropInstance blocked for database "'+c.name+'" until all open connections are closed')},ce.onsuccess=function(){var le=ce.result;le&&le.close(),ee(le)}});return Y.then(function(ee){Z.db=ee;for(var ne=0;ne<A.length;ne++){var ce=A[ne];q(ce._dbInfo)}}).catch(function(ee){throw(K(c,ee)||d.resolve()).catch(function(){}),ee})})}return m(y,g),y}var N6={_driver:"asyncStorage",_initStorage:me,_support:v(),iterate:i1,getItem:De,setItem:s1,removeItem:j1,clear:a1,length:Z1,key:D6,keys:O6,dropInstance:V6};function T6(){return typeof openDatabase=="function"}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$6="~~local_forage_type~",$t=/^~~local_forage_type~([^~]+)~/,l1="__lfsc__:",A1=l1.length,B1="arbf",P1="blob",jt="si08",Zt="ui08",At="uic8",Bt="si16",Pt="si32",kt="ur16",Ft="ui32",Ut="fl32",zt="fl64",Wt=A1+B1.length,Gt=Object.prototype.toString;function Yt(c){var g=c.length*.75,f=c.length,w,y=0,b,O,$,Z;c[c.length-1]==="="&&(g--,c[c.length-2]==="="&&g--);var A=new ArrayBuffer(g),B=new Uint8Array(A);for(w=0;w<f;w+=4)b=Me.indexOf(c[w]),O=Me.indexOf(c[w+1]),$=Me.indexOf(c[w+2]),Z=Me.indexOf(c[w+3]),B[y++]=b<<2|O>>4,B[y++]=(O&15)<<4|$>>2,B[y++]=($&3)<<6|Z&63;return A}function k1(c){var g=new Uint8Array(c),f="",w;for(w=0;w<g.length;w+=3)f+=Me[g[w]>>2],f+=Me[(g[w]&3)<<4|g[w+1]>>4],f+=Me[(g[w+1]&15)<<2|g[w+2]>>6],f+=Me[g[w+2]&63];return g.length%3===2?f=f.substring(0,f.length-1)+"=":g.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function j6(c,g){var f="";if(c&&(f=Gt.call(c)),c&&(f==="[object ArrayBuffer]"||c.buffer&&Gt.call(c.buffer)==="[object ArrayBuffer]")){var w,y=l1;c instanceof ArrayBuffer?(w=c,y+=B1):(w=c.buffer,f==="[object Int8Array]"?y+=jt:f==="[object Uint8Array]"?y+=Zt:f==="[object Uint8ClampedArray]"?y+=At:f==="[object Int16Array]"?y+=Bt:f==="[object Uint16Array]"?y+=kt:f==="[object Int32Array]"?y+=Pt:f==="[object Uint32Array]"?y+=Ft:f==="[object Float32Array]"?y+=Ut:f==="[object Float64Array]"?y+=zt:g(new Error("Failed to get type for BinaryArray"))),g(y+k1(w))}else if(f==="[object Blob]"){var b=new FileReader;b.onload=function(){var O=$6+c.type+"~"+k1(this.result);g(l1+P1+O)},b.readAsArrayBuffer(c)}else try{g(JSON.stringify(c))}catch(O){console.error("Couldn't convert value into a JSON string: ",c),g(null,O)}}function Z6(c){if(c.substring(0,A1)!==l1)return JSON.parse(c);var g=c.substring(Wt),f=c.substring(A1,Wt),w;if(f===P1&&$t.test(g)){var y=g.match($t);w=y[1],g=g.substring(y[0].length)}var b=Yt(g);switch(f){case B1:return b;case P1:return p([b],{type:w});case jt:return new Int8Array(b);case Zt:return new Uint8Array(b);case At:return new Uint8ClampedArray(b);case Bt:return new Int16Array(b);case kt:return new Uint16Array(b);case Pt:return new Int32Array(b);case Ft:return new Uint32Array(b);case Ut:return new Float32Array(b);case zt:return new Float64Array(b);default:throw new Error("Unkown type: "+f)}}var F1={serialize:j6,deserialize:Z6,stringToBuffer:Yt,bufferToString:k1};function Xt(c,g,f,w){c.executeSql("CREATE TABLE IF NOT EXISTS "+g.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,w)}function A6(c){var g=this,f={db:null};if(c)for(var w in c)f[w]=typeof c[w]!="string"?c[w].toString():c[w];var y=new d(function(b,O){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch($){return O($)}f.db.transaction(function($){Xt($,f,function(){g._dbInfo=f,b()},function(Z,A){O(A)})},O)});return f.serializer=F1,y}function Ie(c,g,f,w,y,b){c.executeSql(f,w,y,function(O,$){$.code===$.SYNTAX_ERR?O.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[g.storeName],function(Z,A){A.rows.length?b(Z,$):Xt(Z,g,function(){Z.executeSql(f,w,y,b)},b)},b):b(O,$)},b)}function B6(c,g){var f=this;c=S(c);var w=new d(function(y,b){f.ready().then(function(){var O=f._dbInfo;O.db.transaction(function($){Ie($,O,"SELECT * FROM "+O.storeName+" WHERE key = ? LIMIT 1",[c],function(Z,A){var B=A.rows.length?A.rows.item(0).value:null;B&&(B=O.serializer.deserialize(B)),y(B)},function(Z,A){b(A)})})}).catch(b)});return m(w,g),w}function P6(c,g){var f=this,w=new d(function(y,b){f.ready().then(function(){var O=f._dbInfo;O.db.transaction(function($){Ie($,O,"SELECT * FROM "+O.storeName,[],function(Z,A){for(var B=A.rows,F=B.length,Y=0;Y<F;Y++){var ee=B.item(Y),ne=ee.value;if(ne&&(ne=O.serializer.deserialize(ne)),ne=c(ne,ee.key,Y+1),ne!==void 0){y(ne);return}}y()},function(Z,A){b(A)})})}).catch(b)});return m(w,g),w}function qt(c,g,f,w){var y=this;c=S(c);var b=new d(function(O,$){y.ready().then(function(){g===void 0&&(g=null);var Z=g,A=y._dbInfo;A.serializer.serialize(g,function(B,F){F?$(F):A.db.transaction(function(Y){Ie(Y,A,"INSERT OR REPLACE INTO "+A.storeName+" (key, value) VALUES (?, ?)",[c,B],function(){O(Z)},function(ee,ne){$(ne)})},function(Y){if(Y.code===Y.QUOTA_ERR){if(w>0){O(qt.apply(y,[c,Z,f,w-1]));return}$(Y)}})})}).catch($)});return m(b,f),b}function k6(c,g,f){return qt.apply(this,[c,g,f,1])}function F6(c,g){var f=this;c=S(c);var w=new d(function(y,b){f.ready().then(function(){var O=f._dbInfo;O.db.transaction(function($){Ie($,O,"DELETE FROM "+O.storeName+" WHERE key = ?",[c],function(){y()},function(Z,A){b(A)})})}).catch(b)});return m(w,g),w}function U6(c){var g=this,f=new d(function(w,y){g.ready().then(function(){var b=g._dbInfo;b.db.transaction(function(O){Ie(O,b,"DELETE FROM "+b.storeName,[],function(){w()},function($,Z){y(Z)})})}).catch(y)});return m(f,c),f}function z6(c){var g=this,f=new d(function(w,y){g.ready().then(function(){var b=g._dbInfo;b.db.transaction(function(O){Ie(O,b,"SELECT COUNT(key) as c FROM "+b.storeName,[],function($,Z){var A=Z.rows.item(0).c;w(A)},function($,Z){y(Z)})})}).catch(y)});return m(f,c),f}function W6(c,g){var f=this,w=new d(function(y,b){f.ready().then(function(){var O=f._dbInfo;O.db.transaction(function($){Ie($,O,"SELECT key FROM "+O.storeName+" WHERE id = ? LIMIT 1",[c+1],function(Z,A){var B=A.rows.length?A.rows.item(0).key:null;y(B)},function(Z,A){b(A)})})}).catch(b)});return m(w,g),w}function G6(c){var g=this,f=new d(function(w,y){g.ready().then(function(){var b=g._dbInfo;b.db.transaction(function(O){Ie(O,b,"SELECT key FROM "+b.storeName,[],function($,Z){for(var A=[],B=0;B<Z.rows.length;B++)A.push(Z.rows.item(B).key);w(A)},function($,Z){y(Z)})})}).catch(y)});return m(f,c),f}function Y6(c){return new d(function(g,f){c.transaction(function(w){w.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,b){for(var O=[],$=0;$<b.rows.length;$++)O.push(b.rows.item($).name);g({db:c,storeNames:O})},function(y,b){f(b)})},function(w){f(w)})})}function X6(c,g){g=V.apply(this,arguments);var f=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||f.name,c.storeName=c.storeName||f.storeName);var w=this,y;return c.name?y=new d(function(b){var O;c.name===f.name?O=w._dbInfo.db:O=openDatabase(c.name,"","",0),c.storeName?b({db:O,storeNames:[c.storeName]}):b(Y6(O))}).then(function(b){return new d(function(O,$){b.db.transaction(function(Z){function A(ee){return new d(function(ne,ce){Z.executeSql("DROP TABLE IF EXISTS "+ee,[],function(){ne()},function(le,we){ce(we)})})}for(var B=[],F=0,Y=b.storeNames.length;F<Y;F++)B.push(A(b.storeNames[F]));d.all(B).then(function(){O()}).catch(function(ee){$(ee)})},function(Z){$(Z)})})}):y=d.reject("Invalid arguments"),m(y,g),y}var q6={_driver:"webSQLStorage",_initStorage:A6,_support:T6(),iterate:P6,getItem:B6,setItem:k6,removeItem:F6,clear:U6,length:z6,key:W6,keys:G6,dropInstance:X6};function J6(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Jt(c,g){var f=c.name+"/";return c.storeName!==g.storeName&&(f+=c.storeName+"/"),f}function Q6(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch{return!0}}function K6(){return!Q6()||localStorage.length>0}function er(c){var g=this,f={};if(c)for(var w in c)f[w]=c[w];return f.keyPrefix=Jt(c,g._defaultConfig),K6()?(g._dbInfo=f,f.serializer=F1,d.resolve()):d.reject()}function tr(c){var g=this,f=g.ready().then(function(){for(var w=g._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var b=localStorage.key(y);b.indexOf(w)===0&&localStorage.removeItem(b)}});return m(f,c),f}function nr(c,g){var f=this;c=S(c);var w=f.ready().then(function(){var y=f._dbInfo,b=localStorage.getItem(y.keyPrefix+c);return b&&(b=y.serializer.deserialize(b)),b});return m(w,g),w}function rr(c,g){var f=this,w=f.ready().then(function(){for(var y=f._dbInfo,b=y.keyPrefix,O=b.length,$=localStorage.length,Z=1,A=0;A<$;A++){var B=localStorage.key(A);if(B.indexOf(b)===0){var F=localStorage.getItem(B);if(F&&(F=y.serializer.deserialize(F)),F=c(F,B.substring(O),Z++),F!==void 0)return F}}});return m(w,g),w}function or(c,g){var f=this,w=f.ready().then(function(){var y=f._dbInfo,b;try{b=localStorage.key(c)}catch{b=null}return b&&(b=b.substring(y.keyPrefix.length)),b});return m(w,g),w}function ir(c){var g=this,f=g.ready().then(function(){for(var w=g._dbInfo,y=localStorage.length,b=[],O=0;O<y;O++){var $=localStorage.key(O);$.indexOf(w.keyPrefix)===0&&b.push($.substring(w.keyPrefix.length))}return b});return m(f,c),f}function sr(c){var g=this,f=g.keys().then(function(w){return w.length});return m(f,c),f}function ar(c,g){var f=this;c=S(c);var w=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+c)});return m(w,g),w}function lr(c,g,f){var w=this;c=S(c);var y=w.ready().then(function(){g===void 0&&(g=null);var b=g;return new d(function(O,$){var Z=w._dbInfo;Z.serializer.serialize(g,function(A,B){if(B)$(B);else try{localStorage.setItem(Z.keyPrefix+c,A),O(b)}catch(F){(F.name==="QuotaExceededError"||F.name==="NS_ERROR_DOM_QUOTA_REACHED")&&$(F),$(F)}})})});return m(y,f),y}function cr(c,g){if(g=V.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var f=this.config();c.name=c.name||f.name,c.storeName=c.storeName||f.storeName}var w=this,y;return c.name?y=new d(function(b){c.storeName?b(Jt(c,w._defaultConfig)):b(c.name+"/")}).then(function(b){for(var O=localStorage.length-1;O>=0;O--){var $=localStorage.key(O);$.indexOf(b)===0&&localStorage.removeItem($)}}):y=d.reject("Invalid arguments"),m(y,g),y}var ur={_driver:"localStorageWrapper",_initStorage:er,_support:J6(),iterate:rr,getItem:nr,setItem:lr,removeItem:ar,clear:tr,length:sr,key:or,keys:ir,dropInstance:cr},dr=function(g,f){return g===f||typeof g=="number"&&typeof f=="number"&&isNaN(g)&&isNaN(f)},fr=function(g,f){for(var w=g.length,y=0;y<w;){if(dr(g[y],f))return!0;y++}return!1},Qt=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},Pe={},Kt={},Te={INDEXEDDB:N6,WEBSQL:q6,LOCALSTORAGE:ur},hr=[Te.INDEXEDDB._driver,Te.WEBSQL._driver,Te.LOCALSTORAGE._driver],c1=["dropInstance"],U1=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(c1),Cr={description:"",driver:hr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function vr(c,g){c[g]=function(){var f=arguments;return c.ready().then(function(){return c[g].apply(c,f)})}}function z1(){for(var c=1;c<arguments.length;c++){var g=arguments[c];if(g)for(var f in g)g.hasOwnProperty(f)&&(Qt(g[f])?arguments[0][f]=g[f].slice():arguments[0][f]=g[f])}return arguments[0]}var gr=(function(){function c(g){s(this,c);for(var f in Te)if(Te.hasOwnProperty(f)){var w=Te[f],y=w._driver;this[f]=y,Pe[y]||this.defineDriver(w)}this._defaultConfig=z1({},Cr),this._config=z1({},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 c.prototype.config=function(f){if((typeof f>"u"?"undefined":i(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var w in f){if(w==="storeName"&&(f[w]=f[w].replace(/\W/g,"_")),w==="version"&&typeof f[w]!="number")return new Error("Database version must be a number.");this._config[w]=f[w]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},c.prototype.defineDriver=function(f,w,y){var b=new d(function(O,$){try{var Z=f._driver,A=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){$(A);return}for(var B=U1.concat("_initStorage"),F=0,Y=B.length;F<Y;F++){var ee=B[F],ne=!fr(c1,ee);if((ne||f[ee])&&typeof f[ee]!="function"){$(A);return}}var ce=function(){for(var ke=function(br){return function(){var wr=new Error("Method "+br+" is not implemented by the current driver"),e3=d.reject(wr);return m(e3,arguments[arguments.length-1]),e3}},W1=0,mr=c1.length;W1<mr;W1++){var G1=c1[W1];f[G1]||(f[G1]=ke(G1))}};ce();var le=function(ke){Pe[Z]&&console.info("Redefining LocalForage driver: "+Z),Pe[Z]=f,Kt[Z]=ke,O()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(le,$):le(!!f._support):le(!0)}catch(we){$(we)}});return I(b,w,y),b},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(f,w,y){var b=Pe[f]?d.resolve(Pe[f]):d.reject(new Error("Driver not found."));return I(b,w,y),b},c.prototype.getSerializer=function(f){var w=d.resolve(F1);return I(w,f),w},c.prototype.ready=function(f){var w=this,y=w._driverSet.then(function(){return w._ready===null&&(w._ready=w._initDriver()),w._ready});return I(y,f,f),y},c.prototype.setDriver=function(f,w,y){var b=this;Qt(f)||(f=[f]);var O=this._getSupportedDrivers(f);function $(){b._config.driver=b.driver()}function Z(F){return b._extend(F),$(),b._ready=b._initStorage(b._config),b._ready}function A(F){return function(){var Y=0;function ee(){for(;Y<F.length;){var ne=F[Y];return Y++,b._dbInfo=null,b._ready=null,b.getDriver(ne).then(Z).catch(ee)}$();var ce=new Error("No available storage method found.");return b._driverSet=d.reject(ce),b._driverSet}return ee()}}var B=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=B.then(function(){var F=O[0];return b._dbInfo=null,b._ready=null,b.getDriver(F).then(function(Y){b._driver=Y._driver,$(),b._wrapLibraryMethodsWithReady(),b._initDriver=A(O)})}).catch(function(){$();var F=new Error("No available storage method found.");return b._driverSet=d.reject(F),b._driverSet}),I(this._driverSet,w,y),this._driverSet},c.prototype.supports=function(f){return!!Kt[f]},c.prototype._extend=function(f){z1(this,f)},c.prototype._getSupportedDrivers=function(f){for(var w=[],y=0,b=f.length;y<b;y++){var O=f[y];this.supports(O)&&w.push(O)}return w},c.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,w=U1.length;f<w;f++)vr(this,U1[f])},c.prototype.createInstance=function(f){return new c(f)},c})(),pr=new gr;r.exports=pr},{3:3}]},{},[4])(4)})})(q1)),q1.exports}var I4=M4();const Oe=x4(I4);class Dt{getItem(n){return Oe.getItem(n)}setItem(n,e){return Oe.setItem(n,e)}removeItem(n){return Oe.removeItem(n)}clear(){return Oe.clear()}key(n){return Oe.key(n)}keys(){return Oe.keys()}iterate(n){return Oe.iterate(n)}}function _4(){const t=H.useDependency(C.ThemeService),n=H.useObservable(t.darkMode$);return h.jsx(N.Messager,{theme:n?"dark":"light"})}var S4=Object.getOwnPropertyDescriptor,R4=(t,n,e,r)=>{for(var o=r>1?void 0:r?S4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},I3=(t,n)=>(e,r)=>n(e,r,t);let _3=0;exports.DesktopMessageService=class extends C.Disposable{constructor(n,e){super(),this._injector=n,this._uiPartsService=e,this._initUIPart()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(oe.GLOBAL,()=>H.connectInjector(_4,this._injector)))}dispose(){super.dispose(),N.removeMessage()}show(n){var o;const e=(o=n.id)!=null?o:`message-${Date.now()}-${_3}`;_3+=1;const r=Object.assign({},n,{id:e});return N.message(r),C.toDisposable(()=>N.removeMessage(e))}remove(n){N.removeMessage(n)}removeAll(){N.removeMessage()}};exports.DesktopMessageService=R4([I3(0,C.Inject(C.Injector)),I3(1,Le)],exports.DesktopMessageService);function E4(){const t=H.useDependency(C.ThemeService),n=H.useObservable(t.darkMode$);return h.jsx(N.Toaster,{theme:n?"dark":"light"})}const H4={show:t=>{const{type:n="message",title:e,content:r,duration:o,closable:i=!0,position:s="top-right"}=t;N.toast[n](e,{position:s,description:r,duration:o,closeButton:i})}};var D4=Object.getOwnPropertyDescriptor,O4=(t,n,e,r)=>{for(var o=r>1?void 0:r?D4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},S3=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopNotificationService=class extends C.Disposable{constructor(n,e){super(),this._injector=n,this._uiPartsService=e,this._initUIPart()}show(n){return H4.show(n),C.toDisposable(()=>{})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(oe.GLOBAL,()=>H.connectInjector(E4,this._injector)))}};exports.DesktopNotificationService=O4([S3(0,C.Inject(C.Injector)),S3(1,Le)],exports.DesktopNotificationService);class Ot{constructor(){P(this,"_sidebarOptions",{});P(this,"sidebarOptions$",new k.Subject);P(this,"scrollEvent$",new k.Subject);P(this,"_container")}get visible(){return this._sidebarOptions.visible||!1}get options(){return this._sidebarOptions}open(n){return this._sidebarOptions={...n,id:n.id,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),C.toDisposable(()=>{this.close()})}close(n){n&&this._sidebarOptions.id!==n||(this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose())}getContainer(){return this._container}setContainer(n){this._container=n}}var V4=Object.getOwnPropertyDescriptor,N4=(t,n,e,r)=>{for(var o=r>1?void 0:r?V4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},T4=(t,n)=>(e,r)=>n(e,r,t);exports.DesktopZenZoneService=class{constructor(n){P(this,"visible$",new k.BehaviorSubject(!1));P(this,"componentKey$",new k.ReplaySubject);P(this,"_temporaryHidden$",new k.BehaviorSubject(!1));P(this,"temporaryHidden$",this._temporaryHidden$.asObservable());P(this,"_visible",!1);this._componentManager=n}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(n,e){return this._componentManager.register(n,e),this.componentKey$.next(n),C.toDisposable(()=>{this._componentManager.delete(n),this.visible$.complete(),this.componentKey$.complete()})}open(){this._visible=!0,this.visible$.next(!0)}close(){this._visible=!1,this.visible$.next(!1)}};exports.DesktopZenZoneService=N4([T4(0,C.Inject(Ce))],exports.DesktopZenZoneService);var $4=Object.defineProperty,j4=Object.getOwnPropertyDescriptor,Z4=(t,n,e)=>n in t?$4(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,A4=(t,n,e,r)=>{for(var o=r>1?void 0:r?j4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},J1=(t,n)=>(e,r)=>n(e,r,t),Vt=(t,n,e)=>Z4(t,typeof n!="symbol"?n+"":n,e);const B4="DISABLE_AUTO_FOCUS";exports.UniverMobileUIPlugin=class extends C.Plugin{constructor(n=w1,e,r,o){super(),this._config=n,this._contextService=e,this._injector=r,this._configService=o;const{menu:i,...s}=C.merge({popupRootId:`univer-popup-portal-${C.generateRandomId(6)}`},w1,this._config);s.disableAutoFocus&&this._contextService.setContextValue(B4,!0),i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Ne,s)}onStarting(){C.registerDependencies(this._injector,C.mergeOverrideWithDependencies([[Ce],[t1],[qe],[x1],[Le,{useClass:vt}],[xe,{useClass:exports.DesktopLayoutService}],[Be,{useClass:exports.ShortcutService}],[S1,{useClass:Ct}],[ye,{useClass:exports.MenuManagerService}],[r1,{useClass:yt}],[n1,{useClass:Lt}],[Rt,{useClass:exports.BrowserClipboardService,lazy:!0}],[o1,{useClass:exports.DesktopNotificationService,lazy:!0}],[T1,{useClass:exports.DesktopGalleryService,lazy:!0}],[N1,{useClass:exports.DesktopDialogService,lazy:!0}],[C.IConfirmService,{useClass:exports.DesktopConfirmService,lazy:!0}],[Ae,{useClass:Ot,lazy:!0}],[O1,{useClass:exports.DesktopZenZoneService,lazy:!0}],[D1,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[_1,{useClass:exports.DesktopMessageService,lazy:!0}],[C.ILocalStorageService,{useClass:Dt,lazy:!0}],[St,{useClass:exports.DesktopBeforeCloseService}],[Ht,{useClass:Et}],[E1,{useClass:pt}],[R1],[Qe,{useFactory:n=>n.createInstance(et,this._config),deps:[C.Injector]}],[exports.SharedController],[exports.ErrorController],[exports.ShortcutPanelController]],this._config.override)),C.touchDependencies(this._injector,[[Qe],[exports.ErrorController]])}onReady(){C.touchDependencies(this._injector,[[exports.SharedController]])}onSteady(){C.touchDependencies(this._injector,[[exports.ShortcutPanelController]])}};Vt(exports.UniverMobileUIPlugin,"pluginName","UNIVER_MOBILE_UI_PLUGIN");Vt(exports.UniverMobileUIPlugin,"packageName",V1.name);Vt(exports.UniverMobileUIPlugin,"version",V1.version);exports.UniverMobileUIPlugin=A4([C.DependentOn(Ke.UniverRenderEnginePlugin),J1(1,C.IContextService),J1(2,C.Inject(C.Injector)),J1(3,C.IConfigService)],exports.UniverMobileUIPlugin);var P4=Object.defineProperty,k4=Object.getOwnPropertyDescriptor,F4=(t,n,e)=>n in t?P4(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,U4=(t,n,e,r)=>{for(var o=r>1?void 0:r?k4(n,e):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=s(o)||o);return o},Q1=(t,n)=>(e,r)=>n(e,r,t),Nt=(t,n,e)=>F4(t,typeof n!="symbol"?n+"":n,e);const E6="DISABLE_AUTO_FOCUS";exports.UniverUIPlugin=class extends C.Plugin{constructor(n=w1,e,r,o){super(),this._config=n,this._contextService=e,this._injector=r,this._configService=o;const{menu:i,...s}=C.merge({popupRootId:`univer-popup-portal-${C.generateRandomId(6)}`},w1,this._config);s.disableAutoFocus&&this._contextService.setContextValue(E6,!0),i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(Ne,s)}onStarting(){C.registerDependencies(this._injector,C.mergeOverrideWithDependencies([[Ce],[t1],[qe],[x1],[Le,{useClass:vt}],[xe,{useClass:exports.DesktopLayoutService}],[bt,{useClass:exports.DesktopRibbonService}],[Be,{useClass:exports.ShortcutService}],[S1,{useClass:Ct}],[ye,{useClass:exports.MenuManagerService}],[r1,{useClass:yt}],[n1,{useClass:Lt}],[Rt,{useClass:exports.BrowserClipboardService,lazy:!0}],[o1,{useClass:exports.DesktopNotificationService,lazy:!0}],[T1,{useClass:exports.DesktopGalleryService,lazy:!0}],[N1,{useClass:exports.DesktopDialogService,lazy:!0}],[C.IConfirmService,{useClass:exports.DesktopConfirmService,lazy:!0}],[Ae,{useClass:Ot,lazy:!0}],[O1,{useClass:exports.DesktopZenZoneService,lazy:!0}],[D1,{useClass:exports.DesktopGlobalZoneService,lazy:!0}],[_1,{useClass:exports.DesktopMessageService,lazy:!0}],[C.ILocalStorageService,{useClass:Dt,lazy:!0}],[St,{useClass:exports.DesktopBeforeCloseService}],[Ht,{useClass:Et}],[E1,{useClass:pt}],[I1,{useClass:K1}],[R1],[Qe,{useFactory:n=>n.createInstance(exports.DesktopUIController,this._config),deps:[C.Injector]}],[exports.SharedController],[exports.ErrorController],[exports.ShortcutPanelController]],this._config.override)),C.touchDependencies(this._injector,[[Qe],[exports.ErrorController]])}onReady(){C.touchDependencies(this._injector,[[exports.SharedController]])}onSteady(){C.touchDependencies(this._injector,[[exports.ShortcutPanelController]])}};Nt(exports.UniverUIPlugin,"pluginName","UNIVER_UI_PLUGIN");Nt(exports.UniverUIPlugin,"packageName",V1.name);Nt(exports.UniverUIPlugin,"version",V1.version);exports.UniverUIPlugin=U4([C.DependentOn(Ke.UniverRenderEnginePlugin),Q1(1,C.IContextService),Q1(2,C.Inject(C.Injector)),Q1(3,C.IConfigService)],exports.UniverUIPlugin);class z4{show(n){return C.toDisposable(()=>{})}remove(n){}removeAll(){}setContainer(){}getContainer(){}}const W4=t=>{const e=H.useDependency(Ae).getContainer();a.useEffect(()=>{if(e)return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[t,e])};function m1(t){return t.length===0?t:t.replace(/^\s+|\s+$/gm,"")}const G4=.75,R3=78,E3=9;function Tt(t){var l;let n=t.childNodes;if(n.length===0)return t.textContent;if(n[0].nodeName==="DIV"&&(n=n[0].childNodes),n.length===1&&n[0].nodeName==="#text")return n[0].textContent;const e=[];let r=0,o=0,i=t.textContent||"";i+=`\r
|
|
72
72
|
`;for(let u=0;u<n.length;u++){let v=n[`${u}`],p;v.nodeName==="#text"?(p=(l=v.textContent)!=null?l:"",v=v.parentElement):p=v.innerText;const d=$1(v);H6(p).forEach(I=>{const S=I.length;o+=S,r=o-S;const V=C.generateRandomId(6);e.push({sId:V,st:r,ed:o-1,ts:d})})}return{id:C.generateRandomId(6),body:{dataStream:i,textRuns:e},documentStyle:{}}}function $1(t,n=""){var s,l;let e=(l=(s=t==null?void 0:t.style)==null?void 0:s.cssText)!=null?l:"";if(e+=n,e=e.replace(/[\r\n]+/g,""),e.length===0)return{};const r=e.split(";"),o={},i={t:"",r:"",b:"",l:""};return r.forEach(u=>{var m;const v=u.toLowerCase(),p=m1(v.substr(0,v.indexOf(":"))),d=m1(v.substr(v.indexOf(":")+1));if(p==="font-weight")d==="bold"||d==="700"?o.bl=1:o.bl=0;else if(p==="font-style")d==="italic"?o.it=1:o.it=0;else if(p==="font-family"){const I=m1(u),S=n0(I);o.ff=S}else if(p==="font-size"){let I=Number.parseInt(d);e.indexOf("vertical-align")>-1&&(e.indexOf("sub")>-1||e.indexOf("sup")>-1)&&(I*=2),d.indexOf("px")!==-1&&(I=t0(Number.parseInt(d,10))),o.fs=I}else if(p==="color"){const I=new C.ColorKit(d);o.cl={rgb:I.isValid?I.toRgbString():"rgb(0,0,0)"}}else if(p==="background"||p==="background-color"){const I=new C.ColorKit(d);I.isValid&&(o.bg={rgb:I.toRgbString()})}else if(p==="text-decoration-line")d==="underline"?(o.ul||(o.ul={s:1}),o.ul.s=1):d==="line-through"?(o.st||(o.st={s:1}),o.st.s=1):d==="overline"&&(o.ol||(o.ol={s:1}),o.ol.s=1);else if(p==="text-decoration-color")o.hasOwnProperty("ul")&&(o.ul||(o.ul={s:1,cl:{rgb:d}}),o.ul.cl={rgb:d}),o.hasOwnProperty("st")&&(o.st||(o.st={s:1,cl:{rgb:d}}),o.st.cl={rgb:d}),o.hasOwnProperty("ol")&&(o.ol||(o.ol={s:1,cl:{rgb:d}}),o.ol.cl={rgb:d});else if(p==="text-decoration-style")o.hasOwnProperty("ul")&&(o.ul||(o.ul={s:1,t:Number(d)}),o.ul.t=Number(d)),o.hasOwnProperty("st")&&(o.st||(o.st={s:1,t:Number(d)}),o.st.t=Number(d)),o.hasOwnProperty("ol")&&(o.ol||(o.ol={s:1,t:Number(d)}),o.ol.t=Number(d));else if(p==="text-decoration"||p==="univer-strike"){const I=(m=d.split(" "))==null?void 0:m[0];I==="underline"?(o.ul||(o.ul={s:1}),o.ul.s=1):I==="line-through"?(o.st||(o.st={s:1}),o.st.s=1):I==="overline"&&(o.ol||(o.ol={s:1}),o.ol.s=1)}if(p==="univer-underline"&&(o.ul={s:1}),p==="vertical-align"&&(d==="sub"?o.va=C.BaselineOffset.SUBSCRIPT:d==="super"?o.va=C.BaselineOffset.SUPERSCRIPT:d==="top"?o.vt=1:d==="middle"?o.vt=2:d==="bottom"?o.vt=3:o.va=C.BaselineOffset.NORMAL),p==="transform"){const I=d.split(")"),S=I.findIndex(V=>V.includes("rotate"));if(S>-1){const V=I[S].match(/\d+/g);let x=0,L=0;V!=null&&V.length&&(x=+V[0]),t!=null&&t.dataset.vertical&&(L=+t.dataset.vertical),o.tr={a:x,v:L}}}if(p==="text-align"&&(d==="left"?o.ht=1:d==="center"?o.ht=2:d==="right"?o.ht=3:d==="justify"?o.ht=4:o.ht=0),o.tb!==1&&(p==="overflow-wrap"||p==="word-wrap"?d==="break-word"&&(o.tb=3):p==="text-overflow"?d==="clip"&&(o.tb=2):p==="text-break"&&d==="overflow"&&(o.tb=1)),p==="white-space"&&(d==="nowrap"?o.tb=1:d==="normal"?o.tb=3:d==="clip"&&(o.tb=2)),p==="border-color"){const I=H3(d,")");if(o.bd)for(const S in I)o.bd[S].cl.rgb=I[S];else{o.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 I)o.bd[S].cl.rgb=I[S]}}if(p==="border-width"||p==="border-style"){const I=H3(d," ");for(const S in I)i[S]+=` ${I[S]}`;o.bd?(o.bd.b.s=C.getBorderStyleType(i.b),o.bd.t.s=C.getBorderStyleType(i.t),o.bd.l.s=C.getBorderStyleType(i.l),o.bd.r.s=C.getBorderStyleType(i.r)):o.bd={b:{cl:{rgb:"#000"},s:C.getBorderStyleType(i.b)},t:{cl:{rgb:"#000"},s:C.getBorderStyleType(i.t)},l:{cl:{rgb:"#000"},s:C.getBorderStyleType(i.l)},r:{cl:{rgb:"#000"},s:C.getBorderStyleType(i.r)}}}if(p==="border-bottom"||p==="border-top"||p==="border-left"||p==="border-right"||p==="border"){o.bd||(o.bd={});const I=d.split(" "),S=`${I[0]} ${I[1]}`;I.splice(0,2);const V=I.join("");if(C.getBorderStyleType(S)!==C.BorderStyleTypes.NONE&&V){const L={cl:{rgb:V},s:C.getBorderStyleType(S)};p==="border-bottom"?o.bd.b=d==="none"?null:L:p==="border-top"?o.bd.t=d==="none"?null:L:p==="border-left"?o.bd.l=d==="none"?null:L:p==="border-right"?o.bd.r=d==="none"?null:L:p==="border"&&(o.bd={r:d==="none"?null:L,t:d==="none"?null:L,b:d==="none"?null:L,l:d==="none"?null:L})}}else if(p==="--data-rotate"){const I=/[+-]?\d+/,S=d.match(I);d==="(0deg ,1)"?o.tr={a:0,v:1}:S&&(o.tr={a:Number(S[0])})}}),Object.keys(o).forEach(u=>{typeof o[u]=="object"&&!Object.keys(o[u]).length&&delete o[u]}),o}function H3(t,n){let e;n===" "?e=t.trim().split(n):e=t.trim().split(n).slice(0,-1),e.forEach(o=>`${o.trim()})`);let r={};return e.length===1?r={t:e[0],r:e[0],b:e[0],l:e[0]}:e.length===2?r={t:e[0],r:e[1],b:e[0],l:e[1]}:e.length===3?r={t:e[0],r:e[1],b:e[2],l:e[1]}:e.length===4&&(r={t:e[0],r:e[1],b:e[2],l:e[3]}),r}function H6(t){if(t==="")return[t];const n=/(?:(\n+.+)|(.+))/g;return t.match(n).map(o=>o.replace(/\n/g,`\r
|
|
73
73
|
`))}function Y4(t){const n=document.createElement("DIV"),e=[];n.innerHTML=t;const r=n.querySelectorAll("table col");if(!r.length)return[];for(let o=0;o<r.length;o++){const i=r[o],s=i.getAttribute("span");if(s&&+s>1)for(let l=0;l<+s;l++){const u=y1(i.getAttribute("width"),72);e.push(u)}else{const l=y1(i.getAttribute("width"),72);e.push(l)}}return e}function y1(t,n){if(!t)return n;let e;return t.includes("pt")?e=Ke.ptToPx(Number.parseFloat(t)):t.includes("px")?e=Number.parseFloat(t):e=Number.parseFloat(t)*72/96,e}function X4(t){const n=document.createElement("DIV"),e=[];n.innerHTML=t;const r=n.querySelectorAll("table tr");if(!r.length)return[];for(let o=0;o<r.length;o++){const s=r[o].querySelectorAll("td");let l=y1(s[0].style.height,19);for(let u=0;u<s.length;u++){const v=s[u].getAttribute("rowSpan");if(!(v&&+v>1)){l=y1(s[u].style.height,19);break}}e.push(l)}return e}function q4(t){let n=[];const e=document.createElement("DIV");if(e.innerHTML=t,n=new Array(e.querySelectorAll("table tr").length),!n.length)return[];let r=0;const o=e.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(l=>{let u=0;const v=l.getAttribute("colSpan");v!==null?u=+v:u=1,r+=u});for(let l=0;l<n.length;l++)n[l]=new Array(r);let s=0;return o.forEach(l=>{let u=0;l.querySelectorAll("td").forEach(v=>{var I,S;const p={};if(v.querySelectorAll("span").length||v.querySelectorAll("font").length){const V=Tt(v);typeof V!="string"&&(p.p=V)}const d=v.innerText;d.trim().length===0?p.v="":p.v=d;const m=$1(v);for(C.Tools.isPlainObject(m)&&(p.s=m);u<r&&n[s][u]!=null;)u++;if(u!==r){if(n[s][u]==null){n[s][u]=p;const V=(I=Number(v.getAttribute("rowSpan")))!=null?I:1,x=(S=Number(v.getAttribute("colSpan")))!=null?S:1;if(V>1||x>1){const L={rs:+V-1,cs:+x-1,r:s,c:u};n[s][u].mc=L;for(let _=0;_<V;_++)for(let E=0;E<x;E++)_===0&&E===0||(n[s+_][u+E]={mc:null})}}u++}}),s++}),n}function J4(t){const n=[],e=document.createElement("DIV");e.innerHTML=t;const o=t.replace(/\r/g,"").split(`
|
package/lib/es/facade.js
CHANGED
|
@@ -3,8 +3,8 @@ var R = (n, e, t) => e in n ? B(n, e, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var o = (n, e, t) => R(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { FBase as C, FUniver as M, FHooks as j, FEnum as y } from "@univerjs/core/facade";
|
|
5
5
|
import { IRenderManagerService as U } from "@univerjs/engine-render";
|
|
6
|
-
import {
|
|
7
|
-
import { Inject as m, Injector as f,
|
|
6
|
+
import { IMenuManagerService as P, MenuItemType as E, RibbonStartGroup as w, RibbonPosition as T, MenuManagerPosition as O, IShortcutService as G, CopyCommand as v, PasteCommand as _, ISidebarService as V, IDialogService as $, ComponentManager as I, IMessageService as N, IUIPartsService as g, connectInjector as H, IFontService as K, SheetPasteShortKeyCommandName as k, BuiltInUIPart as L, KeyCode as A } from "@univerjs/ui";
|
|
7
|
+
import { Inject as m, Injector as f, ICommandService as d, generateRandomId as W, CommandType as q, IUniverInstanceService as z, UniverInstanceType as J } from "@univerjs/core";
|
|
8
8
|
var Q = Object.getOwnPropertyDescriptor, x = (n, e, t, r) => {
|
|
9
9
|
for (var i = r > 1 ? void 0 : r ? Q(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
10
10
|
(c = n[s]) && (i = c(i) || i);
|
|
@@ -59,7 +59,7 @@ let p = (a = class extends D {
|
|
|
59
59
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
60
60
|
menuItemFactory: () => ({
|
|
61
61
|
id: e.id,
|
|
62
|
-
type:
|
|
62
|
+
type: E.BUTTON,
|
|
63
63
|
// we only support button for now
|
|
64
64
|
icon: e.icon,
|
|
65
65
|
title: e.title,
|
|
@@ -84,7 +84,7 @@ let p = (a = class extends D {
|
|
|
84
84
|
p = x([
|
|
85
85
|
u(1, m(f)),
|
|
86
86
|
u(2, d),
|
|
87
|
-
u(3,
|
|
87
|
+
u(3, P)
|
|
88
88
|
], p);
|
|
89
89
|
let l = class extends D {
|
|
90
90
|
constructor(e, t, r) {
|
|
@@ -96,7 +96,7 @@ let l = class extends D {
|
|
|
96
96
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
97
97
|
menuItemFactory: () => ({
|
|
98
98
|
id: e.id,
|
|
99
|
-
type:
|
|
99
|
+
type: E.SUBITEMS,
|
|
100
100
|
icon: e.icon,
|
|
101
101
|
title: e.title,
|
|
102
102
|
tooltip: e.tooltip
|
|
@@ -188,7 +188,7 @@ let l = class extends D {
|
|
|
188
188
|
};
|
|
189
189
|
l = x([
|
|
190
190
|
u(1, m(f)),
|
|
191
|
-
u(2,
|
|
191
|
+
u(2, P)
|
|
192
192
|
], l);
|
|
193
193
|
var X = Object.getOwnPropertyDescriptor, Y = (n, e, t, r) => {
|
|
194
194
|
for (var i = r > 1 ? void 0 : r ? X(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
@@ -259,7 +259,7 @@ let b = class extends C {
|
|
|
259
259
|
* ```
|
|
260
260
|
*/
|
|
261
261
|
triggerShortcut(e) {
|
|
262
|
-
const t = this._univerInstanceService.getCurrentUnitForType(
|
|
262
|
+
const t = this._univerInstanceService.getCurrentUnitForType(J.UNIVER_SHEET);
|
|
263
263
|
if (!t)
|
|
264
264
|
return;
|
|
265
265
|
const r = this._renderManagerService.getRenderById(t.getUnitId());
|
|
@@ -288,7 +288,7 @@ let b = class extends C {
|
|
|
288
288
|
b = Y([
|
|
289
289
|
h(0, m(f)),
|
|
290
290
|
h(1, m(U)),
|
|
291
|
-
h(2,
|
|
291
|
+
h(2, z),
|
|
292
292
|
h(3, G)
|
|
293
293
|
], b);
|
|
294
294
|
class Z extends M {
|
package/lib/es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var N2 = (e) => {
|
|
|
5
5
|
var T2 = (e, t, n) => t in e ? E2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
6
|
var P = (e, t, n) => T2(e, typeof t != "symbol" ? t + "" : t, n);
|
|
7
7
|
var O3 = (e, t, n) => t.has(e) ? N2("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
8
|
-
import { Disposable as h1, createIdentifier as C1, CommandType as c3, toDisposable as u1, IUniverInstanceService as A1, DocumentFlavor as Ut, LocaleService as w1, ColorKit as U3, NAMED_STYLE_MAP as D2, IConfigService as Q1, ICommandService as W1, NamedStyleType as F1, Workbook as Z2, UniverInstanceType as $3, DocumentDataModel as R9, SlideDataModel as A2, remove as zt, FOCUSING_UNIVER_EDITOR as Fe, IContextService as we, Inject as b1, Injector as R1, merge as je, convertObservableToBehaviorSubject as B2, isRealNum as V9, ErrorService as P2, Optional as O9, UndoCommand as tt, RedoCommand as nt, EDITOR_ACTIVATED as $9, FOCUSING_FX_BAR_EDITOR as E9, dedupeBy as k2, IUndoRedoService as F2, generateRandomId as ve, throttle as j2, ThemeService as u3, LifecycleStages as E3, LifecycleUnreachableError as U2, isInternalEditorID as z2, LifecycleService as N9, ILogService as W2, IConfirmService as rt, DependentOn as T9, Plugin as D9, registerDependencies as Z9, mergeOverrideWithDependencies as A9, ILocalStorageService as B9, touchDependencies as ne,
|
|
8
|
+
import { Disposable as h1, createIdentifier as C1, CommandType as c3, toDisposable as u1, IUniverInstanceService as A1, DocumentFlavor as Ut, LocaleService as w1, ColorKit as U3, NAMED_STYLE_MAP as D2, IConfigService as Q1, ICommandService as W1, NamedStyleType as F1, Workbook as Z2, UniverInstanceType as $3, DocumentDataModel as R9, SlideDataModel as A2, remove as zt, FOCUSING_UNIVER_EDITOR as Fe, IContextService as we, Inject as b1, Injector as R1, merge as je, convertObservableToBehaviorSubject as B2, isRealNum as V9, ErrorService as P2, Optional as O9, UndoCommand as tt, RedoCommand as nt, EDITOR_ACTIVATED as $9, FOCUSING_FX_BAR_EDITOR as E9, dedupeBy as k2, IUndoRedoService as F2, generateRandomId as ve, throttle as j2, ThemeService as u3, LifecycleStages as E3, LifecycleUnreachableError as U2, isInternalEditorID as z2, LifecycleService as N9, ILogService as W2, IConfirmService as rt, DependentOn as T9, Plugin as D9, registerDependencies as Z9, mergeOverrideWithDependencies as A9, ILocalStorageService as B9, touchDependencies as ne, BaselineOffset as N3, getBorderStyleType as D1, BorderStyleTypes as Y2, Tools as P9 } from "@univerjs/core";
|
|
9
9
|
import { BehaviorSubject as $1, distinctUntilChanged as k9, Observable as ge, switchMap as G2, isObservable as pe, fromEvent as X2, Subject as Z1, of as ae, combineLatest as z1, merge as q2, first as Q2, throttleTime as T3, animationFrameScheduler as D3, map as F9, filter as Wt, debounceTime as J2, startWith as j9, scan as K2, ReplaySubject as e4 } from "rxjs";
|
|
10
10
|
import { useRef as q, createElement as S, forwardRef as R, useEffect as z, useMemo as G, useState as U, useCallback as d3, memo as U9, createContext as z9, useContext as f3, useImperativeHandle as t4, Fragment as Yt, useLayoutEffect as Ue, cloneElement as n4 } from "react";
|
|
11
11
|
import { jsx as h, Fragment as ye, jsxs as X } from "react/jsx-runtime";
|
|
@@ -9141,7 +9141,7 @@ function C9(e) {
|
|
|
9141
9141
|
const t = document.createElement("div");
|
|
9142
9142
|
return t.id = e, t;
|
|
9143
9143
|
}
|
|
9144
|
-
const Je = C1("univer.ui.ui-controller"), io = "@univerjs/ui", oo = "0.
|
|
9144
|
+
const Je = C1("univer.ui.ui-controller"), io = "@univerjs/ui", oo = "0.17.0", m3 = {
|
|
9145
9145
|
name: io,
|
|
9146
9146
|
version: oo
|
|
9147
9147
|
};
|
package/lib/facade.js
CHANGED
|
@@ -3,8 +3,8 @@ var R = (n, e, t) => e in n ? B(n, e, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var o = (n, e, t) => R(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { FBase as C, FUniver as M, FHooks as j, FEnum as y } from "@univerjs/core/facade";
|
|
5
5
|
import { IRenderManagerService as U } from "@univerjs/engine-render";
|
|
6
|
-
import {
|
|
7
|
-
import { Inject as m, Injector as f,
|
|
6
|
+
import { IMenuManagerService as P, MenuItemType as E, RibbonStartGroup as w, RibbonPosition as T, MenuManagerPosition as O, IShortcutService as G, CopyCommand as v, PasteCommand as _, ISidebarService as V, IDialogService as $, ComponentManager as I, IMessageService as N, IUIPartsService as g, connectInjector as H, IFontService as K, SheetPasteShortKeyCommandName as k, BuiltInUIPart as L, KeyCode as A } from "@univerjs/ui";
|
|
7
|
+
import { Inject as m, Injector as f, ICommandService as d, generateRandomId as W, CommandType as q, IUniverInstanceService as z, UniverInstanceType as J } from "@univerjs/core";
|
|
8
8
|
var Q = Object.getOwnPropertyDescriptor, x = (n, e, t, r) => {
|
|
9
9
|
for (var i = r > 1 ? void 0 : r ? Q(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
10
10
|
(c = n[s]) && (i = c(i) || i);
|
|
@@ -59,7 +59,7 @@ let p = (a = class extends D {
|
|
|
59
59
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
60
60
|
menuItemFactory: () => ({
|
|
61
61
|
id: e.id,
|
|
62
|
-
type:
|
|
62
|
+
type: E.BUTTON,
|
|
63
63
|
// we only support button for now
|
|
64
64
|
icon: e.icon,
|
|
65
65
|
title: e.title,
|
|
@@ -84,7 +84,7 @@ let p = (a = class extends D {
|
|
|
84
84
|
p = x([
|
|
85
85
|
u(1, m(f)),
|
|
86
86
|
u(2, d),
|
|
87
|
-
u(3,
|
|
87
|
+
u(3, P)
|
|
88
88
|
], p);
|
|
89
89
|
let l = class extends D {
|
|
90
90
|
constructor(e, t, r) {
|
|
@@ -96,7 +96,7 @@ let l = class extends D {
|
|
|
96
96
|
// eslint-disable-next-line ts/explicit-function-return-type
|
|
97
97
|
menuItemFactory: () => ({
|
|
98
98
|
id: e.id,
|
|
99
|
-
type:
|
|
99
|
+
type: E.SUBITEMS,
|
|
100
100
|
icon: e.icon,
|
|
101
101
|
title: e.title,
|
|
102
102
|
tooltip: e.tooltip
|
|
@@ -188,7 +188,7 @@ let l = class extends D {
|
|
|
188
188
|
};
|
|
189
189
|
l = x([
|
|
190
190
|
u(1, m(f)),
|
|
191
|
-
u(2,
|
|
191
|
+
u(2, P)
|
|
192
192
|
], l);
|
|
193
193
|
var X = Object.getOwnPropertyDescriptor, Y = (n, e, t, r) => {
|
|
194
194
|
for (var i = r > 1 ? void 0 : r ? X(e, t) : e, s = n.length - 1, c; s >= 0; s--)
|
|
@@ -259,7 +259,7 @@ let b = class extends C {
|
|
|
259
259
|
* ```
|
|
260
260
|
*/
|
|
261
261
|
triggerShortcut(e) {
|
|
262
|
-
const t = this._univerInstanceService.getCurrentUnitForType(
|
|
262
|
+
const t = this._univerInstanceService.getCurrentUnitForType(J.UNIVER_SHEET);
|
|
263
263
|
if (!t)
|
|
264
264
|
return;
|
|
265
265
|
const r = this._renderManagerService.getRenderById(t.getUnitId());
|
|
@@ -288,7 +288,7 @@ let b = class extends C {
|
|
|
288
288
|
b = Y([
|
|
289
289
|
h(0, m(f)),
|
|
290
290
|
h(1, m(U)),
|
|
291
|
-
h(2,
|
|
291
|
+
h(2, z),
|
|
292
292
|
h(3, G)
|
|
293
293
|
], b);
|
|
294
294
|
class Z extends M {
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var N2 = (e) => {
|
|
|
5
5
|
var T2 = (e, t, n) => t in e ? E2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6
6
|
var P = (e, t, n) => T2(e, typeof t != "symbol" ? t + "" : t, n);
|
|
7
7
|
var O3 = (e, t, n) => t.has(e) ? N2("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
8
|
-
import { Disposable as h1, createIdentifier as C1, CommandType as c3, toDisposable as u1, IUniverInstanceService as A1, DocumentFlavor as Ut, LocaleService as w1, ColorKit as U3, NAMED_STYLE_MAP as D2, IConfigService as Q1, ICommandService as W1, NamedStyleType as F1, Workbook as Z2, UniverInstanceType as $3, DocumentDataModel as R9, SlideDataModel as A2, remove as zt, FOCUSING_UNIVER_EDITOR as Fe, IContextService as we, Inject as b1, Injector as R1, merge as je, convertObservableToBehaviorSubject as B2, isRealNum as V9, ErrorService as P2, Optional as O9, UndoCommand as tt, RedoCommand as nt, EDITOR_ACTIVATED as $9, FOCUSING_FX_BAR_EDITOR as E9, dedupeBy as k2, IUndoRedoService as F2, generateRandomId as ve, throttle as j2, ThemeService as u3, LifecycleStages as E3, LifecycleUnreachableError as U2, isInternalEditorID as z2, LifecycleService as N9, ILogService as W2, IConfirmService as rt, DependentOn as T9, Plugin as D9, registerDependencies as Z9, mergeOverrideWithDependencies as A9, ILocalStorageService as B9, touchDependencies as ne,
|
|
8
|
+
import { Disposable as h1, createIdentifier as C1, CommandType as c3, toDisposable as u1, IUniverInstanceService as A1, DocumentFlavor as Ut, LocaleService as w1, ColorKit as U3, NAMED_STYLE_MAP as D2, IConfigService as Q1, ICommandService as W1, NamedStyleType as F1, Workbook as Z2, UniverInstanceType as $3, DocumentDataModel as R9, SlideDataModel as A2, remove as zt, FOCUSING_UNIVER_EDITOR as Fe, IContextService as we, Inject as b1, Injector as R1, merge as je, convertObservableToBehaviorSubject as B2, isRealNum as V9, ErrorService as P2, Optional as O9, UndoCommand as tt, RedoCommand as nt, EDITOR_ACTIVATED as $9, FOCUSING_FX_BAR_EDITOR as E9, dedupeBy as k2, IUndoRedoService as F2, generateRandomId as ve, throttle as j2, ThemeService as u3, LifecycleStages as E3, LifecycleUnreachableError as U2, isInternalEditorID as z2, LifecycleService as N9, ILogService as W2, IConfirmService as rt, DependentOn as T9, Plugin as D9, registerDependencies as Z9, mergeOverrideWithDependencies as A9, ILocalStorageService as B9, touchDependencies as ne, BaselineOffset as N3, getBorderStyleType as D1, BorderStyleTypes as Y2, Tools as P9 } from "@univerjs/core";
|
|
9
9
|
import { BehaviorSubject as $1, distinctUntilChanged as k9, Observable as ge, switchMap as G2, isObservable as pe, fromEvent as X2, Subject as Z1, of as ae, combineLatest as z1, merge as q2, first as Q2, throttleTime as T3, animationFrameScheduler as D3, map as F9, filter as Wt, debounceTime as J2, startWith as j9, scan as K2, ReplaySubject as e4 } from "rxjs";
|
|
10
10
|
import { useRef as q, createElement as S, forwardRef as R, useEffect as z, useMemo as G, useState as U, useCallback as d3, memo as U9, createContext as z9, useContext as f3, useImperativeHandle as t4, Fragment as Yt, useLayoutEffect as Ue, cloneElement as n4 } from "react";
|
|
11
11
|
import { jsx as h, Fragment as ye, jsxs as X } from "react/jsx-runtime";
|
|
@@ -9141,7 +9141,7 @@ function C9(e) {
|
|
|
9141
9141
|
const t = document.createElement("div");
|
|
9142
9142
|
return t.id = e, t;
|
|
9143
9143
|
}
|
|
9144
|
-
const Je = C1("univer.ui.ui-controller"), io = "@univerjs/ui", oo = "0.
|
|
9144
|
+
const Je = C1("univer.ui.ui-controller"), io = "@univerjs/ui", oo = "0.17.0", m3 = {
|
|
9145
9145
|
name: io,
|
|
9146
9146
|
version: oo
|
|
9147
9147
|
};
|
package/lib/umd/index.js
CHANGED
|
@@ -67,7 +67,7 @@ ${o}
|
|
|
67
67
|
univer-text-primary-600
|
|
68
68
|
`}),C.jsx("span",{className:N.clsx(A9,l1&&`
|
|
69
69
|
univer-pl-4
|
|
70
|
-
`),children:C.jsx(f1,{value$:W.value$,value:W.value,label:W.label,icon:W.icon,onChange:b1=>{o==null||o({...W,value:b1,id:e.id,label:n,commandId:W.commandId})}})})]},h1)})}),q&&C.jsx(B9,{menuSchemas:J,submenuPortalContainer:r,onOptionSelect:o,maxMenuHeight:i})]})}),r):null)]})}function z4(t){const[n,e]=s.useState({});return s.useEffect(()=>{const r=t.map(o=>{var l;if(!((l=o.children)!=null&&l.length))return null;const i=o.children.map(a=>{var u,g;return(g=(u=a.item)==null?void 0:u.hidden$)!=null?g:B.of(!1)});return B.combineLatest(i).subscribe(a=>{const u=a.every(g=>g===!0);e(g=>({...g,[o.key]:u}))})});return()=>{r.forEach(o=>o==null?void 0:o.unsubscribe()),e({})}},[t]),n}function j9(t){const{hostId:n,visible:e,anchorRect:r,menuType:o,anchorVertical:i="bottom",menuOffset:l=0,onRequestClose:a,onOptionSelect:u}=t,g=s.useRef(null),m=x.useDependency(te),d=s.useRef(a),b=s.useRef(0),S=s.useRef(e),H=s.useRef(o);s.useEffect(()=>{d.current=a},[a]),e&&(!S.current||o!==H.current)&&(b.current+=1),S.current=e,H.current=o,s.useEffect(()=>{const I=m.registerMenu(n,()=>{d.current()});return()=>{I.dispose(),m.deactivateMenu(n)}},[m,n]),s.useLayoutEffect(()=>{if(e){m.activateMenu(n);return}m.deactivateMenu(n)},[m,n,e]),s.useEffect(()=>{if(!e)return;const I=D=>D instanceof Element&&D.closest(`[${F9}]`),y=D=>{I(D.target)||g.current&&!g.current.contains(D.target)&&d.current()},E=D=>{D.key==="Escape"&&d.current()},O=D=>{var _;if(I(D.target)){D.stopPropagation();return}if((_=g.current)!=null&&_.contains(D.target)){D.stopPropagation();return}D.preventDefault(),D.stopPropagation()};return document.addEventListener("pointerdown",y),document.addEventListener("keydown",E),document.addEventListener("wheel",O,{capture:!0,passive:!1}),()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",E),document.removeEventListener("wheel",O,!0)}},[e]);const T=s.useMemo(()=>{if(!r)return[0,0];const I=i==="top"?r.top:r.bottom,y=i==="top"?I-l:I+l;return[r.left,y]},[r,i,l]);return C.jsx(N.Popup,{visible:e&&!!r,offset:T,overflowVisible:!0,placementY:i==="top"?"above":"below",children:C.jsx("section",{ref:g,children:o&&C.jsx(j4,{menuType:o,menuSessionVersion:b.current,onOptionSelect:u})})})}const W4="desktop-context-menu";function z9(){const[t,n]=s.useState(!1),[e,r]=s.useState(""),[o,i]=s.useState(null),l=s.useRef(t),a=x.useDependency(ee),u=x.useDependency(h.ICommandService),g=x.useInjector();l.current=t,s.useEffect(()=>{const b=a.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){d()},get visible(){return l.current}});return()=>{b.dispose()}},[a]);function m(b,S){n(!1),requestAnimationFrame(()=>{r(S),i({left:b.clientX,top:b.clientY,bottom:b.clientY}),n(!0)})}function d(){n(!1)}return C.jsx(j9,{hostId:W4,visible:t,anchorRect:o,menuType:e,onRequestClose:d,onOptionSelect:b=>{const{label:S,commandId:H,value:T}=b;u&&u.executeCommand(H!=null?H:S,{value:T}),g.get(I1).focus(),d()}})}const ye=h.createIdentifier("univer.global-zone-service");function r3(){const t=x.useDependency(ye),[n,e]=s.useState(!1),r=x.useObservable(t.componentKey$,t.componentKey),o=x.useDependency(C1),i=s.useMemo(()=>{const l=o.get(r!=null?r:"");if(l)return l},[r,o]);return s.useEffect(()=>{const l=t.visible$.subscribe(a=>{e(a)});return()=>{l.unsubscribe()}},[t.visible$]),n?C.jsx("section",{className:N.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!n,"univer-inset-0 univer-z-[100] univer-block univer-size-full":n}),children:i&&C.jsx(i,{})}):null}function o3(){const t=x.useDependency($1),n=x.useObservable(t.sidebarOptions$),e=s.useRef(null),r=s.useMemo(()=>{if(!n)return null;const l={...n};for(const a of["children","header","footer"]){const u=a;if(n[u]){const{key:g,...m}=n[u];m&&(l[u]=C.jsx(f1,{...m},g))}}return l},[n]);s.useEffect(()=>(e.current&&t.setContainer(e.current),()=>{t.setContainer(void 0)}),[t]),s.useEffect(()=>{const l=u=>{t.scrollEvent$.next(u)},a=e.current;return a&&a.addEventListener("scroll",l),()=>{a==null||a.removeEventListener("scroll",l)}},[t]);const o=s.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function i(){var a;const l={...n,visible:!1};t.options.visible=!1,t.sidebarOptions$.next(l),(a=l==null?void 0:l.onClose)==null||a.call(l)}return C.jsx("section",{"data-u-comp":"sidebar",className:N.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:o},children:C.jsxs("section",{ref:e,className:N.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",N.borderLeftBottomClassName,N.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-cursor-default 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:i,children:C.jsx(Pe,{})})]}),C.jsx("section",{className:"univer-box-border univer-cursor-default 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 Me=h.createIdentifier("univer.zen-zone-service");function i3(){const t=x.useDependency(Me),[n,e]=s.useState(!1),[r,o]=s.useState(),i=x.useObservable(t.temporaryHidden$),l=x.useDependency(C1);s.useEffect(()=>{const u=[t.visible$.subscribe(g=>{e(g)}),t.componentKey$.subscribe(g=>{o(g)})];return()=>{u.forEach(g=>{g.unsubscribe()})}},[]);const a=s.useMemo(()=>{const u=l.get(r!=null?r:"");if(u)return u},[r]);return C.jsx("section",{className:N.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":n,"univer-hidden":i}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:a&&C.jsx(a,{})})})}function G4(t){const n=Jn(R1);return C.jsx(Y4,{...t,...n})}function Y4(t){var Q;const{header:n=!0,toolbar:e=!0,footer:r=!0,headerMenu:o=!0,contextMenu:i=!0,ribbonType:l="classic",mountContainer:a,onRendered:u}=t,g=x.useDependency(h.LocaleService),m=x.useDependency(h.ThemeService),d=x.useDependency(K1),b=s.useRef(null),H=x.useDependency(h.IConfigService).getConfig(R1),T=m1(i1.CUSTOM_HEADER),I=m1(i1.FOOTER),y=m1(i1.HEADER),E=m1(i1.HEADER_MENU),O=m1(i1.CONTENT),D=m1(i1.LEFT_SIDEBAR),_=m1(i1.GLOBAL),$=m1(i1.TOOLBAR),A=(Q=H==null?void 0:H.popupRootId)!=null?Q:"univer-popup-portal";s.useLayoutEffect(()=>{const K=m.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{K.unsubscribe()}},[]);const[z,G]=s.useState(!1);s.useLayoutEffect(()=>{const K=m.darkMode$.subscribe(Y=>{G(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{K.unsubscribe()}},[]),s.useEffect(()=>{b.current&&(u==null||u(b.current))},[u]);const[J,e1]=s.useState(g.getLocales()),q=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(q);const K=[g.localeChanged$.subscribe(()=>{e1(g.getLocales())})];return()=>{K.forEach(Y=>Y.unsubscribe()),document.body.removeChild(q)}},[g,a,q]),C.jsxs(N.ConfigProvider,{locale:J==null?void 0:J.design,mountContainer:q,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:N.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":z}),tabIndex:-1,onBlur:K=>K.stopPropagation(),onContextMenu:K=>K.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:C.jsx(p1,{components:T},"custom-header")}),n&&e&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:C.jsx(p1,{components:$,sharedProps:{ribbonType:l,headerMenuComponents:E,headerMenu:o}},"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(p1,{components:D},"left-sidebar")}),C.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[C.jsx("header",{children:n&&C.jsx(p1,{components:y},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:b,"data-range-selector":!0,onContextMenu:K=>K.preventDefault(),children:C.jsx(p1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-z-[100] univer-h-full",children:C.jsx(o3,{})})]}),r&&C.jsx("footer",{children:C.jsx(p1,{components:I,sharedProps:{contextMenu:i}},"footer")}),C.jsx(i3,{})]})]}),C.jsx(p1,{components:_},"global"),C.jsx(r3,{}),i&&C.jsx(z9,{}),C.jsx(X4,{}),C.jsx("div",{id:A})]})}function X4(){const{mountContainer:t}=s.useContext(N.ConfigContext),n=m1(i1.FLOATING);return Ae.createPortal(C.jsx(p1,{components:n},"floating"),t)}const q4=3e3;class l3 extends h.Disposable{constructor(e,r,o,i,l){super();U(this,"_steadyTimeout");U(this,"_renderTimeout");U(this,"_currentRenderId",null);this._injector=e,this._instanceService=r,this._layoutService=o,this._lifecycleService=i,this._renderManagerService=l}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(e,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(e)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const o=this._renderManagerService.getRenderAll();for(const[i]of o)if(this._changeRenderUnit(i,e))break;this.disposeWithMe(this._instanceService.focused$.subscribe(i=>{i&&this._changeRenderUnit(i,e)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(i=>{var l;i.unitId===((l=this._instanceService.getFocusedUnit())==null?void 0:l.getUnitId())&&this._changeRenderUnit(i.unitId,e)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(i=>{this._currentRenderId===i&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},q4)},300)}catch(o){if(clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),o instanceof h.LifecycleUnreachableError)return;throw o}}))}_changeRenderUnit(e,r){if(this._currentRenderId===e)return!1;const o=this._renderManagerService.getRenderById(e);if(!o||!o.unitId||h.isInternalEditorID(o.unitId))return!1;const i=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return i==null||i.deactivate(),i==null||i.engine.unmount(),o.engine.mount(r),o.activate(),this._currentRenderId=e,!0}}var J4=Object.getOwnPropertyDescriptor,Q4=(t,n,e,r)=>{for(var o=r>1?void 0:r?J4(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},D1=(t,n)=>(e,r)=>n(e,r,t);v.DesktopUIController=class extends l3{constructor(n,e,r,o,i,l,a,u,g){super(e,l,i,r,o),this._config=n,this._componentManager=g,a.mergeMenu(E9),this._initBuiltinComponents(u),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[Yn,Gn],[qn,Xn],[t9,Kn],[n9,e9],[o9,r9],[Qn,N.ColorPicker]].forEach(([n,e])=>{this.disposeWithMe(this._componentManager.register(n,e))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(n){return K4(this._injector,this._config,n)}_initBuiltinComponents(n){this.disposeWithMe(n.registerComponent(i1.FLOATING,()=>x.connectInjector(Qe,this._injector))),this.disposeWithMe(n.registerComponent(i1.CONTENT,()=>x.connectInjector(qe,this._injector))),this.disposeWithMe(n.registerComponent(i1.TOOLBAR,()=>x.connectInjector(Z9,this._injector)))}},v.DesktopUIController=Q4([D1(1,h.Inject(h.Injector)),D1(2,h.Inject(h.LifecycleService)),D1(3,B1.IRenderManagerService),D1(4,I1),D1(5,h.IUniverInstanceService),D1(6,w1),D1(7,L1),D1(8,h.Inject(C1))],v.DesktopUIController);function K4(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=W9(o)}else o instanceof HTMLElement?r=o:r=W9("univer");const i=x.connectInjector(G4,t),l=u=>e(u,r);function a(){N.render(C.jsx(i,{...n,mountContainer:r,onRendered:l}),r)}return a(),h.toDisposable(()=>{N.unmount(r)})}function W9(t){const n=document.createElement("div");return n.id=t,n}const ne=h.createIdentifier("univer.ui.ui-controller"),Ie={name:"@univerjs/ui",version:"0.16.1-insiders.20260311-074e8ca"};function e0(t){const{menuType:n,onOptionSelect:e}=t,r=x.useDependency(w1);if(!n)return null;const o=s.useMemo(()=>{const i=r.getMenuByPositionKey(n);function l(a){return a.reduce((u,g)=>g.children?[...u,...l(g.children)]:[...u,g],[])}return l(i)},[n]);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,o.length)}, 72px)`},children:o.map(i=>i.item&&C.jsx(t0,{menuItem:i.item,onClick:l=>e==null?void 0:e({value:"",label:i.key,...l})},i.key))})}function t0(t){const{menuItem:n,onClick:e}=t,{id:r,type:o,title:i,label:l,icon:a}=n;if(o!==u1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const u=x.useObservable(n.disabled$,!1),g=x.useObservable(n.value$);return C.jsx("button",{type:"button",className:N.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:u,onClick:()=>e({id:r}),children:C.jsx(f1,{value:g,title:i,label:l,icon:a})},r)}const _e="mobile-context-menu";function G9(){const[t,n]=s.useState(!1),[e,r]=s.useState(""),[o,i]=s.useState([0,0]),l=s.useRef(t),a=x.useDependency(te),u=x.useDependency(ee),g=x.useDependency(h.ICommandService);l.current=t,s.useEffect(()=>{const b=a.registerMenu(_e,()=>{n(!1)}),S=u.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){d()},get visible(){return l.current}});return document.addEventListener("pointerdown",d),document.addEventListener("wheel",d),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("wheel",d),S.dispose(),b.dispose(),a.deactivateMenu(_e)}},[a,u]);function m(b,S){a.activateMenu(_e),r(S),i([b.clientX,b.clientY]),n(!0)}function d(){n(!1),a.deactivateMenu(_e)}return C.jsx(N.Popup,{visible:t,offset:o,children:C.jsx("section",{onPointerDown:b=>b.stopPropagation(),children:e&&C.jsx(e0,{menuType:e,onOptionSelect:b=>{const{label:S,value:H,commandId:T}=b;g&&g.executeCommand(T!=null?T:S,{value:H}),n(!1)}})})})}function n0(t){const{header:n=!0,footer:e=!0,contextMenu:r=!0,mountContainer:o,onRendered:i}=t,l=x.useDependency(h.LocaleService),a=x.useDependency(h.ThemeService),u=x.useDependency(K1),g=s.useRef(null),m=m1(i1.FOOTER),d=m1(i1.HEADER),b=m1(i1.CONTENT),S=m1(i1.LEFT_SIDEBAR),H=m1(i1.GLOBAL),[T,I]=s.useState(!1);s.useEffect(()=>{const D=a.darkMode$.subscribe(_=>{I(_)});return()=>{D.unsubscribe()}},[]),s.useEffect(()=>{g.current&&(i==null||i(g.current))},[i]);const[y,E]=s.useState(l.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useLayoutEffect(()=>{const D=a.currentTheme$.subscribe(_=>{u.injectThemeToHead(_)});return()=>{D.unsubscribe()}},[]),s.useEffect(()=>{document.body.appendChild(O);const D=[l.localeChanged$.subscribe(()=>{E(l.getLocales())})];return()=>{D.forEach(_=>_.unsubscribe()),document.body.removeChild(O)}},[l,o,O]),C.jsxs(N.ConfigProvider,{locale:y==null?void 0:y.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:N.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:D=>D.stopPropagation(),children:[n&&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(p1,{components:S},"left-sidebar")}),C.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:n&&C.jsx(p1,{components:d},"header")}),C.jsx("section",{ref:g,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:D=>D.preventDefault(),children:C.jsx(p1,{components:b},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(o3,{})})]}),e&&C.jsx("footer",{children:C.jsx(p1,{components:m},"footer")}),C.jsx(r3,{}),C.jsx(i3,{})]})]}),C.jsx(p1,{components:H},"global"),r&&C.jsx(G9,{})]})}var r0=Object.getOwnPropertyDescriptor,o0=(t,n,e,r)=>{for(var o=r>1?void 0:r?r0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},k1=(t,n)=>(e,r)=>n(e,r,t);let s3=class extends l3{constructor(t,n,e,r,o,i,l){super(n,i,o,e,r),this._config=t,this._initBuiltinComponents(l),this._bootstrapWorkbench()}bootstrap(t){return i0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(Qe,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(qe,this._injector)))}};s3=o0([k1(1,h.Inject(h.Injector)),k1(2,h.Inject(h.LifecycleService)),k1(3,B1.IRenderManagerService),k1(4,I1),k1(5,h.IUniverInstanceService),k1(6,L1)],s3);function i0(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=Y9(o)}else o instanceof HTMLElement?r=o:r=Y9("univer");const i=x.connectInjector(n0,t),l=u=>e(u,r);function a(){N.render(C.jsx(i,{...n,mountContainer:r,onRendered:l}),r)}return a(),h.toDisposable(()=>{N.unmount(r)})}function Y9(t){const n=document.createElement("div");return n.id=t,n}const re=h.createIdentifier("ui.notification.service");var l0=Object.getOwnPropertyDescriptor,s0=(t,n,e,r)=>{for(var o=r>1?void 0:r?l0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},a0=(t,n)=>(e,r)=>n(e,r,t);const a3=h.createIdentifier("univer.ui.before-close-service");v.DesktopBeforeCloseService=class{constructor(n){U(this,"_beforeUnloadCallbacks",[]);U(this,"_onCloseCallbacks",[]);this._notificationService=n,this._init()}registerBeforeClose(n){return this._beforeUnloadCallbacks.push(n),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(e=>e!==n)}}}registerOnClose(n){return this._onCloseCallbacks.push(n),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(e=>e!==n)}}}_init(){window.addEventListener("beforeunload",n=>{let e=n;const r=this._beforeUnloadCallbacks.map(o=>o()).filter(o=>!!o).join(`
|
|
70
|
+
`),children:C.jsx(f1,{value$:W.value$,value:W.value,label:W.label,icon:W.icon,onChange:b1=>{o==null||o({...W,value:b1,id:e.id,label:n,commandId:W.commandId})}})})]},h1)})}),q&&C.jsx(B9,{menuSchemas:J,submenuPortalContainer:r,onOptionSelect:o,maxMenuHeight:i})]})}),r):null)]})}function z4(t){const[n,e]=s.useState({});return s.useEffect(()=>{const r=t.map(o=>{var l;if(!((l=o.children)!=null&&l.length))return null;const i=o.children.map(a=>{var u,g;return(g=(u=a.item)==null?void 0:u.hidden$)!=null?g:B.of(!1)});return B.combineLatest(i).subscribe(a=>{const u=a.every(g=>g===!0);e(g=>({...g,[o.key]:u}))})});return()=>{r.forEach(o=>o==null?void 0:o.unsubscribe()),e({})}},[t]),n}function j9(t){const{hostId:n,visible:e,anchorRect:r,menuType:o,anchorVertical:i="bottom",menuOffset:l=0,onRequestClose:a,onOptionSelect:u}=t,g=s.useRef(null),m=x.useDependency(te),d=s.useRef(a),b=s.useRef(0),S=s.useRef(e),H=s.useRef(o);s.useEffect(()=>{d.current=a},[a]),e&&(!S.current||o!==H.current)&&(b.current+=1),S.current=e,H.current=o,s.useEffect(()=>{const I=m.registerMenu(n,()=>{d.current()});return()=>{I.dispose(),m.deactivateMenu(n)}},[m,n]),s.useLayoutEffect(()=>{if(e){m.activateMenu(n);return}m.deactivateMenu(n)},[m,n,e]),s.useEffect(()=>{if(!e)return;const I=D=>D instanceof Element&&D.closest(`[${F9}]`),y=D=>{I(D.target)||g.current&&!g.current.contains(D.target)&&d.current()},E=D=>{D.key==="Escape"&&d.current()},O=D=>{var _;if(I(D.target)){D.stopPropagation();return}if((_=g.current)!=null&&_.contains(D.target)){D.stopPropagation();return}D.preventDefault(),D.stopPropagation()};return document.addEventListener("pointerdown",y),document.addEventListener("keydown",E),document.addEventListener("wheel",O,{capture:!0,passive:!1}),()=>{document.removeEventListener("pointerdown",y),document.removeEventListener("keydown",E),document.removeEventListener("wheel",O,!0)}},[e]);const T=s.useMemo(()=>{if(!r)return[0,0];const I=i==="top"?r.top:r.bottom,y=i==="top"?I-l:I+l;return[r.left,y]},[r,i,l]);return C.jsx(N.Popup,{visible:e&&!!r,offset:T,overflowVisible:!0,placementY:i==="top"?"above":"below",children:C.jsx("section",{ref:g,children:o&&C.jsx(j4,{menuType:o,menuSessionVersion:b.current,onOptionSelect:u})})})}const W4="desktop-context-menu";function z9(){const[t,n]=s.useState(!1),[e,r]=s.useState(""),[o,i]=s.useState(null),l=s.useRef(t),a=x.useDependency(ee),u=x.useDependency(h.ICommandService),g=x.useInjector();l.current=t,s.useEffect(()=>{const b=a.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){d()},get visible(){return l.current}});return()=>{b.dispose()}},[a]);function m(b,S){n(!1),requestAnimationFrame(()=>{r(S),i({left:b.clientX,top:b.clientY,bottom:b.clientY}),n(!0)})}function d(){n(!1)}return C.jsx(j9,{hostId:W4,visible:t,anchorRect:o,menuType:e,onRequestClose:d,onOptionSelect:b=>{const{label:S,commandId:H,value:T}=b;u&&u.executeCommand(H!=null?H:S,{value:T}),g.get(I1).focus(),d()}})}const ye=h.createIdentifier("univer.global-zone-service");function r3(){const t=x.useDependency(ye),[n,e]=s.useState(!1),r=x.useObservable(t.componentKey$,t.componentKey),o=x.useDependency(C1),i=s.useMemo(()=>{const l=o.get(r!=null?r:"");if(l)return l},[r,o]);return s.useEffect(()=>{const l=t.visible$.subscribe(a=>{e(a)});return()=>{l.unsubscribe()}},[t.visible$]),n?C.jsx("section",{className:N.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!n,"univer-inset-0 univer-z-[100] univer-block univer-size-full":n}),children:i&&C.jsx(i,{})}):null}function o3(){const t=x.useDependency($1),n=x.useObservable(t.sidebarOptions$),e=s.useRef(null),r=s.useMemo(()=>{if(!n)return null;const l={...n};for(const a of["children","header","footer"]){const u=a;if(n[u]){const{key:g,...m}=n[u];m&&(l[u]=C.jsx(f1,{...m},g))}}return l},[n]);s.useEffect(()=>(e.current&&t.setContainer(e.current),()=>{t.setContainer(void 0)}),[t]),s.useEffect(()=>{const l=u=>{t.scrollEvent$.next(u)},a=e.current;return a&&a.addEventListener("scroll",l),()=>{a==null||a.removeEventListener("scroll",l)}},[t]);const o=s.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);function i(){var a;const l={...n,visible:!1};t.options.visible=!1,t.sidebarOptions$.next(l),(a=l==null?void 0:l.onClose)==null||a.call(l)}return C.jsx("section",{"data-u-comp":"sidebar",className:N.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:o},children:C.jsxs("section",{ref:e,className:N.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",N.borderLeftBottomClassName,N.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-cursor-default 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:i,children:C.jsx(Pe,{})})]}),C.jsx("section",{className:"univer-box-border univer-cursor-default 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 Me=h.createIdentifier("univer.zen-zone-service");function i3(){const t=x.useDependency(Me),[n,e]=s.useState(!1),[r,o]=s.useState(),i=x.useObservable(t.temporaryHidden$),l=x.useDependency(C1);s.useEffect(()=>{const u=[t.visible$.subscribe(g=>{e(g)}),t.componentKey$.subscribe(g=>{o(g)})];return()=>{u.forEach(g=>{g.unsubscribe()})}},[]);const a=s.useMemo(()=>{const u=l.get(r!=null?r:"");if(u)return u},[r]);return C.jsx("section",{className:N.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":n,"univer-hidden":i}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:a&&C.jsx(a,{})})})}function G4(t){const n=Jn(R1);return C.jsx(Y4,{...t,...n})}function Y4(t){var Q;const{header:n=!0,toolbar:e=!0,footer:r=!0,headerMenu:o=!0,contextMenu:i=!0,ribbonType:l="classic",mountContainer:a,onRendered:u}=t,g=x.useDependency(h.LocaleService),m=x.useDependency(h.ThemeService),d=x.useDependency(K1),b=s.useRef(null),H=x.useDependency(h.IConfigService).getConfig(R1),T=m1(i1.CUSTOM_HEADER),I=m1(i1.FOOTER),y=m1(i1.HEADER),E=m1(i1.HEADER_MENU),O=m1(i1.CONTENT),D=m1(i1.LEFT_SIDEBAR),_=m1(i1.GLOBAL),$=m1(i1.TOOLBAR),A=(Q=H==null?void 0:H.popupRootId)!=null?Q:"univer-popup-portal";s.useLayoutEffect(()=>{const K=m.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{K.unsubscribe()}},[]);const[z,G]=s.useState(!1);s.useLayoutEffect(()=>{const K=m.darkMode$.subscribe(Y=>{G(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{K.unsubscribe()}},[]),s.useEffect(()=>{b.current&&(u==null||u(b.current))},[u]);const[J,e1]=s.useState(g.getLocales()),q=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(q);const K=[g.localeChanged$.subscribe(()=>{e1(g.getLocales())})];return()=>{K.forEach(Y=>Y.unsubscribe()),document.body.removeChild(q)}},[g,a,q]),C.jsxs(N.ConfigProvider,{locale:J==null?void 0:J.design,mountContainer:q,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:N.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":z}),tabIndex:-1,onBlur:K=>K.stopPropagation(),onContextMenu:K=>K.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:C.jsx(p1,{components:T},"custom-header")}),n&&e&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:C.jsx(p1,{components:$,sharedProps:{ribbonType:l,headerMenuComponents:E,headerMenu:o}},"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(p1,{components:D},"left-sidebar")}),C.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[C.jsx("header",{children:n&&C.jsx(p1,{components:y},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:b,"data-range-selector":!0,onContextMenu:K=>K.preventDefault(),children:C.jsx(p1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-z-[100] univer-h-full",children:C.jsx(o3,{})})]}),r&&C.jsx("footer",{children:C.jsx(p1,{components:I,sharedProps:{contextMenu:i}},"footer")}),C.jsx(i3,{})]})]}),C.jsx(p1,{components:_},"global"),C.jsx(r3,{}),i&&C.jsx(z9,{}),C.jsx(X4,{}),C.jsx("div",{id:A})]})}function X4(){const{mountContainer:t}=s.useContext(N.ConfigContext),n=m1(i1.FLOATING);return Ae.createPortal(C.jsx(p1,{components:n},"floating"),t)}const q4=3e3;class l3 extends h.Disposable{constructor(e,r,o,i,l){super();U(this,"_steadyTimeout");U(this,"_renderTimeout");U(this,"_currentRenderId",null);this._injector=e,this._instanceService=r,this._layoutService=o,this._lifecycleService=i,this._renderManagerService=l}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(e,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(e)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const o=this._renderManagerService.getRenderAll();for(const[i]of o)if(this._changeRenderUnit(i,e))break;this.disposeWithMe(this._instanceService.focused$.subscribe(i=>{i&&this._changeRenderUnit(i,e)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(i=>{var l;i.unitId===((l=this._instanceService.getFocusedUnit())==null?void 0:l.getUnitId())&&this._changeRenderUnit(i.unitId,e)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(i=>{this._currentRenderId===i&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},q4)},300)}catch(o){if(clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),o instanceof h.LifecycleUnreachableError)return;throw o}}))}_changeRenderUnit(e,r){if(this._currentRenderId===e)return!1;const o=this._renderManagerService.getRenderById(e);if(!o||!o.unitId||h.isInternalEditorID(o.unitId))return!1;const i=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return i==null||i.deactivate(),i==null||i.engine.unmount(),o.engine.mount(r),o.activate(),this._currentRenderId=e,!0}}var J4=Object.getOwnPropertyDescriptor,Q4=(t,n,e,r)=>{for(var o=r>1?void 0:r?J4(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},D1=(t,n)=>(e,r)=>n(e,r,t);v.DesktopUIController=class extends l3{constructor(n,e,r,o,i,l,a,u,g){super(e,l,i,r,o),this._config=n,this._componentManager=g,a.mergeMenu(E9),this._initBuiltinComponents(u),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[Yn,Gn],[qn,Xn],[t9,Kn],[n9,e9],[o9,r9],[Qn,N.ColorPicker]].forEach(([n,e])=>{this.disposeWithMe(this._componentManager.register(n,e))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(n){return K4(this._injector,this._config,n)}_initBuiltinComponents(n){this.disposeWithMe(n.registerComponent(i1.FLOATING,()=>x.connectInjector(Qe,this._injector))),this.disposeWithMe(n.registerComponent(i1.CONTENT,()=>x.connectInjector(qe,this._injector))),this.disposeWithMe(n.registerComponent(i1.TOOLBAR,()=>x.connectInjector(Z9,this._injector)))}},v.DesktopUIController=Q4([D1(1,h.Inject(h.Injector)),D1(2,h.Inject(h.LifecycleService)),D1(3,B1.IRenderManagerService),D1(4,I1),D1(5,h.IUniverInstanceService),D1(6,w1),D1(7,L1),D1(8,h.Inject(C1))],v.DesktopUIController);function K4(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=W9(o)}else o instanceof HTMLElement?r=o:r=W9("univer");const i=x.connectInjector(G4,t),l=u=>e(u,r);function a(){N.render(C.jsx(i,{...n,mountContainer:r,onRendered:l}),r)}return a(),h.toDisposable(()=>{N.unmount(r)})}function W9(t){const n=document.createElement("div");return n.id=t,n}const ne=h.createIdentifier("univer.ui.ui-controller"),Ie={name:"@univerjs/ui",version:"0.17.0"};function e0(t){const{menuType:n,onOptionSelect:e}=t,r=x.useDependency(w1);if(!n)return null;const o=s.useMemo(()=>{const i=r.getMenuByPositionKey(n);function l(a){return a.reduce((u,g)=>g.children?[...u,...l(g.children)]:[...u,g],[])}return l(i)},[n]);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,o.length)}, 72px)`},children:o.map(i=>i.item&&C.jsx(t0,{menuItem:i.item,onClick:l=>e==null?void 0:e({value:"",label:i.key,...l})},i.key))})}function t0(t){const{menuItem:n,onClick:e}=t,{id:r,type:o,title:i,label:l,icon:a}=n;if(o!==u1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const u=x.useObservable(n.disabled$,!1),g=x.useObservable(n.value$);return C.jsx("button",{type:"button",className:N.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:u,onClick:()=>e({id:r}),children:C.jsx(f1,{value:g,title:i,label:l,icon:a})},r)}const _e="mobile-context-menu";function G9(){const[t,n]=s.useState(!1),[e,r]=s.useState(""),[o,i]=s.useState([0,0]),l=s.useRef(t),a=x.useDependency(te),u=x.useDependency(ee),g=x.useDependency(h.ICommandService);l.current=t,s.useEffect(()=>{const b=a.registerMenu(_e,()=>{n(!1)}),S=u.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){d()},get visible(){return l.current}});return document.addEventListener("pointerdown",d),document.addEventListener("wheel",d),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("wheel",d),S.dispose(),b.dispose(),a.deactivateMenu(_e)}},[a,u]);function m(b,S){a.activateMenu(_e),r(S),i([b.clientX,b.clientY]),n(!0)}function d(){n(!1),a.deactivateMenu(_e)}return C.jsx(N.Popup,{visible:t,offset:o,children:C.jsx("section",{onPointerDown:b=>b.stopPropagation(),children:e&&C.jsx(e0,{menuType:e,onOptionSelect:b=>{const{label:S,value:H,commandId:T}=b;g&&g.executeCommand(T!=null?T:S,{value:H}),n(!1)}})})})}function n0(t){const{header:n=!0,footer:e=!0,contextMenu:r=!0,mountContainer:o,onRendered:i}=t,l=x.useDependency(h.LocaleService),a=x.useDependency(h.ThemeService),u=x.useDependency(K1),g=s.useRef(null),m=m1(i1.FOOTER),d=m1(i1.HEADER),b=m1(i1.CONTENT),S=m1(i1.LEFT_SIDEBAR),H=m1(i1.GLOBAL),[T,I]=s.useState(!1);s.useEffect(()=>{const D=a.darkMode$.subscribe(_=>{I(_)});return()=>{D.unsubscribe()}},[]),s.useEffect(()=>{g.current&&(i==null||i(g.current))},[i]);const[y,E]=s.useState(l.getLocales()),O=s.useMemo(()=>document.createElement("div"),[]);return s.useLayoutEffect(()=>{const D=a.currentTheme$.subscribe(_=>{u.injectThemeToHead(_)});return()=>{D.unsubscribe()}},[]),s.useEffect(()=>{document.body.appendChild(O);const D=[l.localeChanged$.subscribe(()=>{E(l.getLocales())})];return()=>{D.forEach(_=>_.unsubscribe()),document.body.removeChild(O)}},[l,o,O]),C.jsxs(N.ConfigProvider,{locale:y==null?void 0:y.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:N.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:D=>D.stopPropagation(),children:[n&&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(p1,{components:S},"left-sidebar")}),C.jsxs("section",{className:N.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",N.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:n&&C.jsx(p1,{components:d},"header")}),C.jsx("section",{ref:g,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:D=>D.preventDefault(),children:C.jsx(p1,{components:b},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(o3,{})})]}),e&&C.jsx("footer",{children:C.jsx(p1,{components:m},"footer")}),C.jsx(r3,{}),C.jsx(i3,{})]})]}),C.jsx(p1,{components:H},"global"),r&&C.jsx(G9,{})]})}var r0=Object.getOwnPropertyDescriptor,o0=(t,n,e,r)=>{for(var o=r>1?void 0:r?r0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},k1=(t,n)=>(e,r)=>n(e,r,t);let s3=class extends l3{constructor(t,n,e,r,o,i,l){super(n,i,o,e,r),this._config=t,this._initBuiltinComponents(l),this._bootstrapWorkbench()}bootstrap(t){return i0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(Qe,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(qe,this._injector)))}};s3=o0([k1(1,h.Inject(h.Injector)),k1(2,h.Inject(h.LifecycleService)),k1(3,B1.IRenderManagerService),k1(4,I1),k1(5,h.IUniverInstanceService),k1(6,L1)],s3);function i0(t,n,e){let r;const o=n.container;if(typeof o=="string"){const u=document.getElementById(o);u?r=u:r=Y9(o)}else o instanceof HTMLElement?r=o:r=Y9("univer");const i=x.connectInjector(n0,t),l=u=>e(u,r);function a(){N.render(C.jsx(i,{...n,mountContainer:r,onRendered:l}),r)}return a(),h.toDisposable(()=>{N.unmount(r)})}function Y9(t){const n=document.createElement("div");return n.id=t,n}const re=h.createIdentifier("ui.notification.service");var l0=Object.getOwnPropertyDescriptor,s0=(t,n,e,r)=>{for(var o=r>1?void 0:r?l0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},a0=(t,n)=>(e,r)=>n(e,r,t);const a3=h.createIdentifier("univer.ui.before-close-service");v.DesktopBeforeCloseService=class{constructor(n){U(this,"_beforeUnloadCallbacks",[]);U(this,"_onCloseCallbacks",[]);this._notificationService=n,this._init()}registerBeforeClose(n){return this._beforeUnloadCallbacks.push(n),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(e=>e!==n)}}}registerOnClose(n){return this._onCloseCallbacks.push(n),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(e=>e!==n)}}}_init(){window.addEventListener("beforeunload",n=>{let e=n;const r=this._beforeUnloadCallbacks.map(o=>o()).filter(o=>!!o).join(`
|
|
71
71
|
`);if(r)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:r}),typeof e>"u"&&(e=window.event),e.returnValue=r,r}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(n=>n())})}},v.DesktopBeforeCloseService=s0([a0(0,re)],v.DesktopBeforeCloseService);function X9(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var c0=Object.getOwnPropertyDescriptor,u0=(t,n,e,r)=>{for(var o=r>1?void 0:r?c0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},c3=(t,n)=>(e,r)=>n(e,r,t);const u3="text/plain",d3="text/html",q9="image/png",J9="image/jpeg",Q9="image/bmp",K9="image/webp",d0="image/svg+xml",f0=new Set([Q9,J9,K9,q9]),f3=h.createIdentifier("univer.clipboard-interface-service");v.BrowserClipboardService=class extends h.Disposable{constructor(n,e,r){super(),this._localeService=n,this._logService=e,this._notificationService=r}get supportClipboard(){return X9()}async write(n,e){if(!this.supportClipboard)return this._legacyCopyHtml(e);try{return await navigator.clipboard.write([new ClipboardItem({[u3]:new Blob([n],{type:u3}),[d3]:new Blob([e],{type:d3})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(n){if(!this.supportClipboard)return this._legacyCopyText(n);try{return await navigator.clipboard.writeText(n)}catch(e){this._logService.error("[BrowserClipboardService]",e),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(n){return this._logService.error("[BrowserClipboardService]",n),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(n){return this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(n){const e=document.activeElement,r=C0();document.body.appendChild(r),r.innerHTML=n;try{e6(r),document.execCommand("copy")}finally{e instanceof HTMLElement&&e.focus(),document.body.removeChild(r)}}_legacyCopyText(n){const e=document.activeElement,r=h0();document.body.appendChild(r),r.value=n;try{e6(r),document.execCommand("copy")}finally{e instanceof HTMLElement&&e.focus(),document.body.removeChild(r)}}_showClipboardAuthenticationNotification(){var n;(n=this._notificationService)==null||n.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},v.BrowserClipboardService=u0([c3(0,h.Inject(h.LocaleService)),c3(1,h.ILogService),c3(2,h.Optional(re))],v.BrowserClipboardService);function h0(){const t=document.createElement("textarea");return t.style.position="absolute",t.style.height="1px",t.style.width="1px",t.style.opacity="0",t.readOnly=!0,t}function C0(){const t=document.createElement("div");return t.contentEditable="true",t.style.position="absolute",t.style.opacity="0",t.style.height="1px",t.style.width="1px",t}function e6(t){if(t instanceof HTMLTextAreaElement){const r=t.hasAttribute("readonly");return r||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),r||t.removeAttribute("readonly"),t.value}t.hasAttribute("contenteditable")&&t.focus();const n=document.createRange();n.selectNodeContents(t);const e=window.getSelection();if(!e)throw new Error;return e.removeAllRanges(),e.addRange(n),e.toString()}const v0=t=>{const{children:n,onClose:e,onConfirm:r}=t,[o]=s.useState({}),i=n?s.cloneElement(n,{hooks:o}):null;return C.jsx(N.Confirm,{...t,children:i,onClose:()=>{const l=o.beforeClose;if(l){const a=l();if(a.cancel)return;e==null||e(a);return}e==null||e()},onConfirm:()=>{const l=o.beforeConfirm;if(l){const a=l();if(a.cancel)return;r==null||r(a);return}r==null||r()}})};function g0(){const t=x.useDependency(h.IConfirmService),[n,e]=s.useState([]);s.useEffect(()=>{const o=t.confirmOptions$.subscribe(i=>{e(i)});return()=>{o.unsubscribe()}},[]);const r=n.map(o=>{const{children:i,title:l,...a}=o,u=a;for(const g of["children","title"]){const m=g,d=o[m];d&&(u[m]=C.jsx(f1,{...d}))}return u});return r==null?void 0:r.map((o,i)=>C.jsx(v0,{...o,children:o.children},i))}var p0=Object.getOwnPropertyDescriptor,m0=(t,n,e,r)=>{for(var o=r>1?void 0:r?p0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},t6=(t,n)=>(e,r)=>n(e,r,t);v.DesktopConfirmService=class extends h.Disposable{constructor(e,r){super();U(this,"_confirmOptions",[]);U(this,"confirmOptions$",new B.BehaviorSubject([]));this._injector=e,this._uiPartsService=r,this._initUIPart()}open(e){return this._confirmOptions.find(r=>r.id===e.id)?this._confirmOptions=this._confirmOptions.map(r=>({...r.id===e.id?e:r,visible:r.id===e.id?!0:r.visible})):this._confirmOptions.push({...e,visible:!0}),this.confirmOptions$.next(this._confirmOptions),h.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(e){return new Promise(r=>{const o=this.open({...e,onConfirm:()=>{o.dispose(),r(!0)},onClose:()=>{o.dispose(),r(!1)}})})}close(e){this._confirmOptions=this._confirmOptions.map(r=>({...r,visible:r.id===e?!1:r.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(g0,this._injector)))}},v.DesktopConfirmService=m0([t6(0,h.Inject(h.Injector)),t6(1,L1)],v.DesktopConfirmService);const Se=h.createIdentifier("univer.ui.dialog-service");function b0(){const t=x.useDependency(Se),[n,e]=s.useState([]);s.useEffect(()=>{const i=t.getDialogs$().subscribe(l=>{e(l)});return()=>i.unsubscribe()},[]);const r=s.useMemo(()=>n.map(o=>{const{children:i,title:l,footer:a,...u}=o,g=u;for(const m of["children","title","footer"]){const d=m,b=o[d];b&&(g[d]=C.jsx(f1,{...b}))}return g}),[n]);return r==null?void 0:r.map(o=>C.jsx(N.Dialog,{...o},o.id))}var w0=Object.getOwnPropertyDescriptor,L0=(t,n,e,r)=>{for(var o=r>1?void 0:r?w0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},n6=(t,n)=>(e,r)=>n(e,r,t);v.DesktopDialogService=class extends h.Disposable{constructor(e,r){super();U(this,"_dialogOptions",[]);U(this,"_dialogOptions$",new B.Subject);this._injector=e,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions=[],this._dialogOptions$.complete()}open(e){return this._dialogOptions.find(r=>r.id===e.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===e.id?e:r,open:r.id===e.id?!0:r.open})):this._dialogOptions.push({...e,open:!0}),this._dialogOptions$.next(this._dialogOptions),h.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(e){this._dialogOptions=this._dialogOptions.map(r=>({...r,open:r.id===e?!1:r.open})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(e){const r=new Set(e);this._dialogOptions=this._dialogOptions.map(o=>({...o,open:r.has(o.id)?o.open:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(b0,this._injector)))}},v.DesktopDialogService=L0([n6(0,h.Inject(h.Injector)),n6(1,L1)],v.DesktopDialogService);const Ee=h.createIdentifier("univer.ui.gallery-service");function y0(){const t=x.useDependency(Ee),n=x.useObservable(t.gallery$);return n?C.jsx(N.Gallery,{...n}):null}var M0=Object.getOwnPropertyDescriptor,I0=(t,n,e,r)=>{for(var o=r>1?void 0:r?M0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},r6=(t,n)=>(e,r)=>n(e,r,t);v.DesktopGalleryService=class extends h.Disposable{constructor(e,r){super();U(this,"gallery$",new B.Subject);this._injector=e,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose()}open(e){return this.gallery$.next({open:!0,...e}),h.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(y0,this._injector)))}},v.DesktopGalleryService=I0([r6(0,h.Inject(h.Injector)),r6(1,L1)],v.DesktopGalleryService);var _0=Object.getOwnPropertyDescriptor,S0=(t,n,e,r)=>{for(var o=r>1?void 0:r?_0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},E0=(t,n)=>(e,r)=>n(e,r,t);v.DesktopGlobalZoneService=class{constructor(n){U(this,"visible$",new B.Subject);U(this,"componentKey$",new B.Subject);U(this,"_componentKey","");this._componentManager=n}get componentKey(){return this._componentKey}set(n,e){return this._componentManager.register(n,e),this.componentKey$.next(n),this._componentKey=n,h.toDisposable(()=>{this._componentManager.delete(n),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},v.DesktopGlobalZoneService=S0([E0(0,h.Inject(C1))],v.DesktopGlobalZoneService);class h3 extends h.Disposable{openFile(n){return new Promise(e=>{var o,i;const r=document.createElement("input");r.type="file",r.accept=(o=n==null?void 0:n.accept)!=null?o:"",r.multiple=(i=n==null?void 0:n.multiple)!=null?i:!1,r.onchange=l=>{const a=l.target.files;a&&e(Array.from(a))},r.click()})}downloadFile(n,e){const r=document.createElement("a");r.download=e,r.href=window.URL.createObjectURL(n),r.click()}}const C3=h.createIdentifier("univer-ui.local-file.service");var He=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function H0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function De(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var v3={exports:{}};var o6;function D0(){return o6||(o6=1,(function(t,n){(function(e){t.exports=e()})(function(){return(function e(r,o,i){function l(g,m){if(!o[g]){if(!r[g]){var d=typeof De=="function"&&De;if(!m&&d)return d(g,!0);if(a)return a(g,!0);var b=new Error("Cannot find module '"+g+"'");throw b.code="MODULE_NOT_FOUND",b}var S=o[g]={exports:{}};r[g][0].call(S.exports,function(H){var T=r[g][1][H];return l(T||H)},S,S.exports,e,r,o,i)}return o[g].exports}for(var a=typeof De=="function"&&De,u=0;u<i.length;u++)l(i[u]);return l})({1:[function(e,r,o){(function(i){var l=i.MutationObserver||i.WebKitMutationObserver,a;if(l){var u=0,g=new l(H),m=i.document.createTextNode("");g.observe(m,{characterData:!0}),a=function(){m.data=u=++u%2}}else if(!i.setImmediate&&typeof i.MessageChannel<"u"){var d=new i.MessageChannel;d.port1.onmessage=H,a=function(){d.port2.postMessage(0)}}else"document"in i&&"onreadystatechange"in i.document.createElement("script")?a=function(){var I=i.document.createElement("script");I.onreadystatechange=function(){H(),I.onreadystatechange=null,I.parentNode.removeChild(I),I=null},i.document.documentElement.appendChild(I)}:a=function(){setTimeout(H,0)};var b,S=[];function H(){b=!0;for(var I,y,E=S.length;E;){for(y=S,S=[],I=-1;++I<E;)y[I]();E=S.length}b=!1}r.exports=T;function T(I){S.push(I)===1&&!b&&a()}}).call(this,typeof He<"u"?He:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,r,o){var i=e(1);function l(){}var a={},u=["REJECTED"],g=["FULFILLED"],m=["PENDING"];r.exports=d;function d(_){if(typeof _!="function")throw new TypeError("resolver must be a function");this.state=m,this.queue=[],this.outcome=void 0,_!==l&&T(this,_)}d.prototype.catch=function(_){return this.then(null,_)},d.prototype.then=function(_,$){if(typeof _!="function"&&this.state===g||typeof $!="function"&&this.state===u)return this;var A=new this.constructor(l);if(this.state!==m){var z=this.state===g?_:$;S(A,z,this.outcome)}else this.queue.push(new b(A,_,$));return A};function b(_,$,A){this.promise=_,typeof $=="function"&&(this.onFulfilled=$,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(_){a.resolve(this.promise,_)},b.prototype.otherCallFulfilled=function(_){S(this.promise,this.onFulfilled,_)},b.prototype.callRejected=function(_){a.reject(this.promise,_)},b.prototype.otherCallRejected=function(_){S(this.promise,this.onRejected,_)};function S(_,$,A){i(function(){var z;try{z=$(A)}catch(G){return a.reject(_,G)}z===_?a.reject(_,new TypeError("Cannot resolve promise with itself")):a.resolve(_,z)})}a.resolve=function(_,$){var A=I(H,$);if(A.status==="error")return a.reject(_,A.value);var z=A.value;if(z)T(_,z);else{_.state=g,_.outcome=$;for(var G=-1,J=_.queue.length;++G<J;)_.queue[G].callFulfilled($)}return _},a.reject=function(_,$){_.state=u,_.outcome=$;for(var A=-1,z=_.queue.length;++A<z;)_.queue[A].callRejected($);return _};function H(_){var $=_&&_.then;if(_&&(typeof _=="object"||typeof _=="function")&&typeof $=="function")return function(){$.apply(_,arguments)}}function T(_,$){var A=!1;function z(q){A||(A=!0,a.reject(_,q))}function G(q){A||(A=!0,a.resolve(_,q))}function J(){$(G,z)}var e1=I(J);e1.status==="error"&&z(e1.value)}function I(_,$){var A={};try{A.value=_($),A.status="success"}catch(z){A.status="error",A.value=z}return A}d.resolve=y;function y(_){return _ instanceof this?_:a.resolve(new this(l),_)}d.reject=E;function E(_){var $=new this(l);return a.reject($,_)}d.all=O;function O(_){var $=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=_.length,z=!1;if(!A)return this.resolve([]);for(var G=new Array(A),J=0,e1=-1,q=new this(l);++e1<A;)Q(_[e1],e1);return q;function Q(K,Y){$.resolve(K).then(n1,function(a1){z||(z=!0,a.reject(q,a1))});function n1(a1){G[Y]=a1,++J===A&&!z&&(z=!0,a.resolve(q,G))}}}d.race=D;function D(_){var $=this;if(Object.prototype.toString.call(_)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=_.length,z=!1;if(!A)return this.resolve([]);for(var G=-1,J=new this(l);++G<A;)e1(_[G]);return J;function e1(q){$.resolve(q).then(function(Q){z||(z=!0,a.resolve(J,Q))},function(Q){z||(z=!0,a.reject(J,Q))})}}},{1:1}],3:[function(e,r,o){(function(i){typeof i.Promise!="function"&&(i.Promise=e(2))}).call(this,typeof He<"u"?He:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,r,o){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function l(c,p){if(!(c instanceof p))throw new TypeError("Cannot call a class as a function")}function a(){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 u=a();function g(){try{if(!u||!u.open)return!1;var c=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),p=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||p)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function m(c,p){c=c||[],p=p||{};try{return new Blob(c,p)}catch(w){if(w.name!=="TypeError")throw w;for(var f=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new f,M=0;M<c.length;M+=1)L.append(c[M]);return L.getBlob(p.type)}}typeof Promise>"u"&&e(3);var d=Promise;function b(c,p){p&&c.then(function(f){p(null,f)},function(f){p(f)})}function S(c,p,f){typeof p=="function"&&c.then(p),typeof f=="function"&&c.catch(f)}function H(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function T(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var I="local-forage-detect-blob-support",y=void 0,E={},O=Object.prototype.toString,D="readonly",_="readwrite";function $(c){for(var p=c.length,f=new ArrayBuffer(p),L=new Uint8Array(f),M=0;M<p;M++)L[M]=c.charCodeAt(M);return f}function A(c){return new d(function(p){var f=c.transaction(I,_),L=m([""]);f.objectStore(I).put(L,"key"),f.onabort=function(M){M.preventDefault(),M.stopPropagation(),p(!1)},f.oncomplete=function(){var M=navigator.userAgent.match(/Chrome\/(\d+)/),w=navigator.userAgent.match(/Edge\//);p(w||!M||parseInt(M[1],10)>=43)}}).catch(function(){return!1})}function z(c){return typeof y=="boolean"?d.resolve(y):A(c).then(function(p){return y=p,y})}function G(c){var p=E[c.name],f={};f.promise=new d(function(L,M){f.resolve=L,f.reject=M}),p.deferredOperations.push(f),p.dbReady?p.dbReady=p.dbReady.then(function(){return f.promise}):p.dbReady=f.promise}function J(c){var p=E[c.name],f=p.deferredOperations.pop();if(f)return f.resolve(),f.promise}function e1(c,p){var f=E[c.name],L=f.deferredOperations.pop();if(L)return L.reject(p),L.promise}function q(c,p){return new d(function(f,L){if(E[c.name]=E[c.name]||y1(),c.db)if(p)G(c),c.db.close();else return f(c.db);var M=[c.name];p&&M.push(c.version);var w=u.open.apply(u,M);p&&(w.onupgradeneeded=function(R){var Z=w.result;try{Z.createObjectStore(c.storeName),R.oldVersion<=1&&Z.createObjectStore(I)}catch(P){if(P.name==="ConstraintError")console.warn('The database "'+c.name+'" has been upgraded from version '+R.oldVersion+" to version "+R.newVersion+', but the storage "'+c.storeName+'" already exists.');else throw P}}),w.onerror=function(R){R.preventDefault(),L(w.error)},w.onsuccess=function(){var R=w.result;R.onversionchange=function(Z){Z.target.close()},f(R),J(c)}})}function Q(c){return q(c,!1)}function K(c){return q(c,!0)}function Y(c,p){if(!c.db)return!0;var f=!c.db.objectStoreNames.contains(c.storeName),L=c.version<c.db.version,M=c.version>c.db.version;if(L&&(c.version!==p&&console.warn('The database "'+c.name+`" can't be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),M||f){if(f){var w=c.db.version+1;w>c.version&&(c.version=w)}return!0}return!1}function n1(c){return new d(function(p,f){var L=new FileReader;L.onerror=f,L.onloadend=function(M){var w=btoa(M.target.result||"");p({__local_forage_encoded_blob:!0,data:w,type:c.type})},L.readAsBinaryString(c)})}function a1(c){var p=$(atob(c.data));return m([p],{type:c.type})}function W(c){return c&&c.__local_forage_encoded_blob}function s1(c){var p=this,f=p._initReady().then(function(){var L=E[p._dbInfo.name];if(L&&L.dbReady)return L.dbReady});return S(f,c,c),f}function h1(c){G(c);for(var p=E[c.name],f=p.forages,L=0;L<f.length;L++){var M=f[L];M._dbInfo.db&&(M._dbInfo.db.close(),M._dbInfo.db=null)}return c.db=null,Q(c).then(function(w){return c.db=w,Y(c)?K(c):w}).then(function(w){c.db=p.db=w;for(var R=0;R<f.length;R++)f[R]._dbInfo.db=w}).catch(function(w){throw e1(c,w),w})}function l1(c,p,f,L){L===void 0&&(L=1);try{var M=c.db.transaction(c.storeName,p);f(null,M)}catch(w){if(L>0&&(!c.db||w.name==="InvalidStateError"||w.name==="NotFoundError"))return d.resolve().then(function(){if(!c.db||w.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),K(c)}).then(function(){return h1(c).then(function(){l1(c,p,f,L-1)})}).catch(f);f(w)}}function y1(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function b1(c){var p=this,f={db:null};if(c)for(var L in c)f[L]=c[L];var M=E[f.name];M||(M=y1(),E[f.name]=M),M.forages.push(p),p._initReady||(p._initReady=p.ready,p.ready=s1);var w=[];function R(){return d.resolve()}for(var Z=0;Z<M.forages.length;Z++){var P=M.forages[Z];P!==p&&w.push(P._initReady().catch(R))}var k=M.forages.slice(0);return d.all(w).then(function(){return f.db=M.db,Q(f)}).then(function(F){return f.db=F,Y(f,p._defaultConfig.version)?K(f):F}).then(function(F){f.db=M.db=F,p._dbInfo=f;for(var j=0;j<k.length;j++){var X=k[j];X!==p&&(X._dbInfo.db=f.db,X._dbInfo.version=f.version)}})}function N1(c,p){var f=this;c=H(c);var L=new d(function(M,w){f.ready().then(function(){l1(f._dbInfo,D,function(R,Z){if(R)return w(R);try{var P=Z.objectStore(f._dbInfo.storeName),k=P.get(c);k.onsuccess=function(){var F=k.result;F===void 0&&(F=null),W(F)&&(F=a1(F)),M(F)},k.onerror=function(){w(k.error)}}catch(F){w(F)}})}).catch(w)});return b(L,p),L}function Re(c,p){var f=this,L=new d(function(M,w){f.ready().then(function(){l1(f._dbInfo,D,function(R,Z){if(R)return w(R);try{var P=Z.objectStore(f._dbInfo.storeName),k=P.openCursor(),F=1;k.onsuccess=function(){var j=k.result;if(j){var X=j.value;W(X)&&(X=a1(X));var t1=c(X,j.key,F++);t1!==void 0?M(t1):j.continue()}else M()},k.onerror=function(){w(k.error)}}catch(j){w(j)}})}).catch(w)});return b(L,p),L}function Te(c,p,f){var L=this;c=H(c);var M=new d(function(w,R){var Z;L.ready().then(function(){return Z=L._dbInfo,O.call(p)==="[object Blob]"?z(Z.db).then(function(P){return P?p:n1(p)}):p}).then(function(P){l1(L._dbInfo,_,function(k,F){if(k)return R(k);try{var j=F.objectStore(L._dbInfo.storeName);P===null&&(P=void 0);var X=j.put(P,c);F.oncomplete=function(){P===void 0&&(P=null),w(P)},F.onabort=F.onerror=function(){var t1=X.error?X.error:X.transaction.error;R(t1)}}catch(t1){R(t1)}})}).catch(R)});return b(M,f),M}function _3(c,p){var f=this;c=H(c);var L=new d(function(M,w){f.ready().then(function(){l1(f._dbInfo,_,function(R,Z){if(R)return w(R);try{var P=Z.objectStore(f._dbInfo.storeName),k=P.delete(c);Z.oncomplete=function(){M()},Z.onerror=function(){w(k.error)},Z.onabort=function(){var F=k.error?k.error:k.transaction.error;w(F)}}catch(F){w(F)}})}).catch(w)});return b(L,p),L}function Ne(c){var p=this,f=new d(function(L,M){p.ready().then(function(){l1(p._dbInfo,_,function(w,R){if(w)return M(w);try{var Z=R.objectStore(p._dbInfo.storeName),P=Z.clear();R.oncomplete=function(){L()},R.onabort=R.onerror=function(){var k=P.error?P.error:P.transaction.error;M(k)}}catch(k){M(k)}})}).catch(M)});return b(f,c),f}function S3(c){var p=this,f=new d(function(L,M){p.ready().then(function(){l1(p._dbInfo,D,function(w,R){if(w)return M(w);try{var Z=R.objectStore(p._dbInfo.storeName),P=Z.count();P.onsuccess=function(){L(P.result)},P.onerror=function(){M(P.error)}}catch(k){M(k)}})}).catch(M)});return b(f,c),f}function co(c,p){var f=this,L=new d(function(M,w){if(c<0){M(null);return}f.ready().then(function(){l1(f._dbInfo,D,function(R,Z){if(R)return w(R);try{var P=Z.objectStore(f._dbInfo.storeName),k=!1,F=P.openKeyCursor();F.onsuccess=function(){var j=F.result;if(!j){M(null);return}c===0||k?M(j.key):(k=!0,j.advance(c))},F.onerror=function(){w(F.error)}}catch(j){w(j)}})}).catch(w)});return b(L,p),L}function uo(c){var p=this,f=new d(function(L,M){p.ready().then(function(){l1(p._dbInfo,D,function(w,R){if(w)return M(w);try{var Z=R.objectStore(p._dbInfo.storeName),P=Z.openKeyCursor(),k=[];P.onsuccess=function(){var F=P.result;if(!F){L(k);return}k.push(F.key),F.continue()},P.onerror=function(){M(P.error)}}catch(F){M(F)}})}).catch(M)});return b(f,c),f}function fo(c,p){p=T.apply(this,arguments);var f=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||f.name,c.storeName=c.storeName||f.storeName);var L=this,M;if(!c.name)M=d.reject("Invalid arguments");else{var w=c.name===f.name&&L._dbInfo.db,R=w?d.resolve(L._dbInfo.db):Q(c).then(function(Z){var P=E[c.name],k=P.forages;P.db=Z;for(var F=0;F<k.length;F++)k[F]._dbInfo.db=Z;return Z});c.storeName?M=R.then(function(Z){if(Z.objectStoreNames.contains(c.storeName)){var P=Z.version+1;G(c);var k=E[c.name],F=k.forages;Z.close();for(var j=0;j<F.length;j++){var X=F[j];X._dbInfo.db=null,X._dbInfo.version=P}var t1=new d(function(r1,d1){var c1=u.open(c.name,P);c1.onerror=function(M1){var ie=c1.result;ie.close(),d1(M1)},c1.onupgradeneeded=function(){var M1=c1.result;M1.deleteObjectStore(c.storeName)},c1.onsuccess=function(){var M1=c1.result;M1.close(),r1(M1)}});return t1.then(function(r1){k.db=r1;for(var d1=0;d1<F.length;d1++){var c1=F[d1];c1._dbInfo.db=r1,J(c1._dbInfo)}}).catch(function(r1){throw(e1(c,r1)||d.resolve()).catch(function(){}),r1})}}):M=R.then(function(Z){G(c);var P=E[c.name],k=P.forages;Z.close();for(var F=0;F<k.length;F++){var j=k[F];j._dbInfo.db=null}var X=new d(function(t1,r1){var d1=u.deleteDatabase(c.name);d1.onerror=function(){var c1=d1.result;c1&&c1.close(),r1(d1.error)},d1.onblocked=function(){console.warn('dropInstance blocked for database "'+c.name+'" until all open connections are closed')},d1.onsuccess=function(){var c1=d1.result;c1&&c1.close(),t1(c1)}});return X.then(function(t1){P.db=t1;for(var r1=0;r1<k.length;r1++){var d1=k[r1];J(d1._dbInfo)}}).catch(function(t1){throw(e1(c,t1)||d.resolve()).catch(function(){}),t1})})}return b(M,p),M}var ho={_driver:"asyncStorage",_initStorage:b1,_support:g(),iterate:Re,getItem:N1,setItem:Te,removeItem:_3,clear:Ne,length:S3,key:co,keys:uo,dropInstance:fo};function Co(){return typeof openDatabase=="function"}var O1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vo="~~local_forage_type~",h6=/^~~local_forage_type~([^~]+)~/,$e="__lfsc__:",E3=$e.length,H3="arbf",D3="blob",C6="si08",v6="ui08",g6="uic8",p6="si16",m6="si32",b6="ur16",w6="ui32",L6="fl32",y6="fl64",M6=E3+H3.length,I6=Object.prototype.toString;function _6(c){var p=c.length*.75,f=c.length,L,M=0,w,R,Z,P;c[c.length-1]==="="&&(p--,c[c.length-2]==="="&&p--);var k=new ArrayBuffer(p),F=new Uint8Array(k);for(L=0;L<f;L+=4)w=O1.indexOf(c[L]),R=O1.indexOf(c[L+1]),Z=O1.indexOf(c[L+2]),P=O1.indexOf(c[L+3]),F[M++]=w<<2|R>>4,F[M++]=(R&15)<<4|Z>>2,F[M++]=(Z&3)<<6|P&63;return k}function O3(c){var p=new Uint8Array(c),f="",L;for(L=0;L<p.length;L+=3)f+=O1[p[L]>>2],f+=O1[(p[L]&3)<<4|p[L+1]>>4],f+=O1[(p[L+1]&15)<<2|p[L+2]>>6],f+=O1[p[L+2]&63];return p.length%3===2?f=f.substring(0,f.length-1)+"=":p.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function go(c,p){var f="";if(c&&(f=I6.call(c)),c&&(f==="[object ArrayBuffer]"||c.buffer&&I6.call(c.buffer)==="[object ArrayBuffer]")){var L,M=$e;c instanceof ArrayBuffer?(L=c,M+=H3):(L=c.buffer,f==="[object Int8Array]"?M+=C6:f==="[object Uint8Array]"?M+=v6:f==="[object Uint8ClampedArray]"?M+=g6:f==="[object Int16Array]"?M+=p6:f==="[object Uint16Array]"?M+=b6:f==="[object Int32Array]"?M+=m6:f==="[object Uint32Array]"?M+=w6:f==="[object Float32Array]"?M+=L6:f==="[object Float64Array]"?M+=y6:p(new Error("Failed to get type for BinaryArray"))),p(M+O3(L))}else if(f==="[object Blob]"){var w=new FileReader;w.onload=function(){var R=vo+c.type+"~"+O3(this.result);p($e+D3+R)},w.readAsArrayBuffer(c)}else try{p(JSON.stringify(c))}catch(R){console.error("Couldn't convert value into a JSON string: ",c),p(null,R)}}function po(c){if(c.substring(0,E3)!==$e)return JSON.parse(c);var p=c.substring(M6),f=c.substring(E3,M6),L;if(f===D3&&h6.test(p)){var M=p.match(h6);L=M[1],p=p.substring(M[0].length)}var w=_6(p);switch(f){case H3:return w;case D3:return m([w],{type:L});case C6:return new Int8Array(w);case v6:return new Uint8Array(w);case g6:return new Uint8ClampedArray(w);case p6:return new Int16Array(w);case b6:return new Uint16Array(w);case m6:return new Int32Array(w);case w6:return new Uint32Array(w);case L6:return new Float32Array(w);case y6:return new Float64Array(w);default:throw new Error("Unkown type: "+f)}}var x3={serialize:go,deserialize:po,stringToBuffer:_6,bufferToString:O3};function S6(c,p,f,L){c.executeSql("CREATE TABLE IF NOT EXISTS "+p.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,L)}function mo(c){var p=this,f={db:null};if(c)for(var L in c)f[L]=typeof c[L]!="string"?c[L].toString():c[L];var M=new d(function(w,R){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(Z){return R(Z)}f.db.transaction(function(Z){S6(Z,f,function(){p._dbInfo=f,w()},function(P,k){R(k)})},R)});return f.serializer=x3,M}function x1(c,p,f,L,M,w){c.executeSql(f,L,M,function(R,Z){Z.code===Z.SYNTAX_ERR?R.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[p.storeName],function(P,k){k.rows.length?w(P,Z):S6(P,p,function(){P.executeSql(f,L,M,w)},w)},w):w(R,Z)},w)}function bo(c,p){var f=this;c=H(c);var L=new d(function(M,w){f.ready().then(function(){var R=f._dbInfo;R.db.transaction(function(Z){x1(Z,R,"SELECT * FROM "+R.storeName+" WHERE key = ? LIMIT 1",[c],function(P,k){var F=k.rows.length?k.rows.item(0).value:null;F&&(F=R.serializer.deserialize(F)),M(F)},function(P,k){w(k)})})}).catch(w)});return b(L,p),L}function wo(c,p){var f=this,L=new d(function(M,w){f.ready().then(function(){var R=f._dbInfo;R.db.transaction(function(Z){x1(Z,R,"SELECT * FROM "+R.storeName,[],function(P,k){for(var F=k.rows,j=F.length,X=0;X<j;X++){var t1=F.item(X),r1=t1.value;if(r1&&(r1=R.serializer.deserialize(r1)),r1=c(r1,t1.key,X+1),r1!==void 0){M(r1);return}}M()},function(P,k){w(k)})})}).catch(w)});return b(L,p),L}function E6(c,p,f,L){var M=this;c=H(c);var w=new d(function(R,Z){M.ready().then(function(){p===void 0&&(p=null);var P=p,k=M._dbInfo;k.serializer.serialize(p,function(F,j){j?Z(j):k.db.transaction(function(X){x1(X,k,"INSERT OR REPLACE INTO "+k.storeName+" (key, value) VALUES (?, ?)",[c,F],function(){R(P)},function(t1,r1){Z(r1)})},function(X){if(X.code===X.QUOTA_ERR){if(L>0){R(E6.apply(M,[c,P,f,L-1]));return}Z(X)}})})}).catch(Z)});return b(w,f),w}function Lo(c,p,f){return E6.apply(this,[c,p,f,1])}function yo(c,p){var f=this;c=H(c);var L=new d(function(M,w){f.ready().then(function(){var R=f._dbInfo;R.db.transaction(function(Z){x1(Z,R,"DELETE FROM "+R.storeName+" WHERE key = ?",[c],function(){M()},function(P,k){w(k)})})}).catch(w)});return b(L,p),L}function Mo(c){var p=this,f=new d(function(L,M){p.ready().then(function(){var w=p._dbInfo;w.db.transaction(function(R){x1(R,w,"DELETE FROM "+w.storeName,[],function(){L()},function(Z,P){M(P)})})}).catch(M)});return b(f,c),f}function Io(c){var p=this,f=new d(function(L,M){p.ready().then(function(){var w=p._dbInfo;w.db.transaction(function(R){x1(R,w,"SELECT COUNT(key) as c FROM "+w.storeName,[],function(Z,P){var k=P.rows.item(0).c;L(k)},function(Z,P){M(P)})})}).catch(M)});return b(f,c),f}function _o(c,p){var f=this,L=new d(function(M,w){f.ready().then(function(){var R=f._dbInfo;R.db.transaction(function(Z){x1(Z,R,"SELECT key FROM "+R.storeName+" WHERE id = ? LIMIT 1",[c+1],function(P,k){var F=k.rows.length?k.rows.item(0).key:null;M(F)},function(P,k){w(k)})})}).catch(w)});return b(L,p),L}function So(c){var p=this,f=new d(function(L,M){p.ready().then(function(){var w=p._dbInfo;w.db.transaction(function(R){x1(R,w,"SELECT key FROM "+w.storeName,[],function(Z,P){for(var k=[],F=0;F<P.rows.length;F++)k.push(P.rows.item(F).key);L(k)},function(Z,P){M(P)})})}).catch(M)});return b(f,c),f}function Eo(c){return new d(function(p,f){c.transaction(function(L){L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(M,w){for(var R=[],Z=0;Z<w.rows.length;Z++)R.push(w.rows.item(Z).name);p({db:c,storeNames:R})},function(M,w){f(w)})},function(L){f(L)})})}function Ho(c,p){p=T.apply(this,arguments);var f=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||f.name,c.storeName=c.storeName||f.storeName);var L=this,M;return c.name?M=new d(function(w){var R;c.name===f.name?R=L._dbInfo.db:R=openDatabase(c.name,"","",0),c.storeName?w({db:R,storeNames:[c.storeName]}):w(Eo(R))}).then(function(w){return new d(function(R,Z){w.db.transaction(function(P){function k(t1){return new d(function(r1,d1){P.executeSql("DROP TABLE IF EXISTS "+t1,[],function(){r1()},function(c1,M1){d1(M1)})})}for(var F=[],j=0,X=w.storeNames.length;j<X;j++)F.push(k(w.storeNames[j]));d.all(F).then(function(){R()}).catch(function(t1){Z(t1)})},function(P){Z(P)})})}):M=d.reject("Invalid arguments"),b(M,p),M}var Do={_driver:"webSQLStorage",_initStorage:mo,_support:Co(),iterate:wo,getItem:bo,setItem:Lo,removeItem:yo,clear:Mo,length:Io,key:_o,keys:So,dropInstance:Ho};function Oo(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function H6(c,p){var f=c.name+"/";return c.storeName!==p.storeName&&(f+=c.storeName+"/"),f}function xo(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch{return!0}}function Vo(){return!xo()||localStorage.length>0}function Ro(c){var p=this,f={};if(c)for(var L in c)f[L]=c[L];return f.keyPrefix=H6(c,p._defaultConfig),Vo()?(p._dbInfo=f,f.serializer=x3,d.resolve()):d.reject()}function To(c){var p=this,f=p.ready().then(function(){for(var L=p._dbInfo.keyPrefix,M=localStorage.length-1;M>=0;M--){var w=localStorage.key(M);w.indexOf(L)===0&&localStorage.removeItem(w)}});return b(f,c),f}function No(c,p){var f=this;c=H(c);var L=f.ready().then(function(){var M=f._dbInfo,w=localStorage.getItem(M.keyPrefix+c);return w&&(w=M.serializer.deserialize(w)),w});return b(L,p),L}function $o(c,p){var f=this,L=f.ready().then(function(){for(var M=f._dbInfo,w=M.keyPrefix,R=w.length,Z=localStorage.length,P=1,k=0;k<Z;k++){var F=localStorage.key(k);if(F.indexOf(w)===0){var j=localStorage.getItem(F);if(j&&(j=M.serializer.deserialize(j)),j=c(j,F.substring(R),P++),j!==void 0)return j}}});return b(L,p),L}function Zo(c,p){var f=this,L=f.ready().then(function(){var M=f._dbInfo,w;try{w=localStorage.key(c)}catch{w=null}return w&&(w=w.substring(M.keyPrefix.length)),w});return b(L,p),L}function Ao(c){var p=this,f=p.ready().then(function(){for(var L=p._dbInfo,M=localStorage.length,w=[],R=0;R<M;R++){var Z=localStorage.key(R);Z.indexOf(L.keyPrefix)===0&&w.push(Z.substring(L.keyPrefix.length))}return w});return b(f,c),f}function Po(c){var p=this,f=p.keys().then(function(L){return L.length});return b(f,c),f}function ko(c,p){var f=this;c=H(c);var L=f.ready().then(function(){var M=f._dbInfo;localStorage.removeItem(M.keyPrefix+c)});return b(L,p),L}function Fo(c,p,f){var L=this;c=H(c);var M=L.ready().then(function(){p===void 0&&(p=null);var w=p;return new d(function(R,Z){var P=L._dbInfo;P.serializer.serialize(p,function(k,F){if(F)Z(F);else try{localStorage.setItem(P.keyPrefix+c,k),R(w)}catch(j){(j.name==="QuotaExceededError"||j.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Z(j),Z(j)}})})});return b(M,f),M}function Bo(c,p){if(p=T.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var f=this.config();c.name=c.name||f.name,c.storeName=c.storeName||f.storeName}var L=this,M;return c.name?M=new d(function(w){c.storeName?w(H6(c,L._defaultConfig)):w(c.name+"/")}).then(function(w){for(var R=localStorage.length-1;R>=0;R--){var Z=localStorage.key(R);Z.indexOf(w)===0&&localStorage.removeItem(Z)}}):M=d.reject("Invalid arguments"),b(M,p),M}var Uo={_driver:"localStorageWrapper",_initStorage:Ro,_support:Oo(),iterate:$o,getItem:No,setItem:Fo,removeItem:ko,clear:To,length:Po,key:Zo,keys:Ao,dropInstance:Bo},jo=function(p,f){return p===f||typeof p=="number"&&typeof f=="number"&&isNaN(p)&&isNaN(f)},zo=function(p,f){for(var L=p.length,M=0;M<L;){if(jo(p[M],f))return!0;M++}return!1},D6=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},oe={},O6={},F1={INDEXEDDB:ho,WEBSQL:Do,LOCALSTORAGE:Uo},Wo=[F1.INDEXEDDB._driver,F1.WEBSQL._driver,F1.LOCALSTORAGE._driver],Ze=["dropInstance"],V3=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ze),Go={description:"",driver:Wo.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Yo(c,p){c[p]=function(){var f=arguments;return c.ready().then(function(){return c[p].apply(c,f)})}}function R3(){for(var c=1;c<arguments.length;c++){var p=arguments[c];if(p)for(var f in p)p.hasOwnProperty(f)&&(D6(p[f])?arguments[0][f]=p[f].slice():arguments[0][f]=p[f])}return arguments[0]}var Xo=(function(){function c(p){l(this,c);for(var f in F1)if(F1.hasOwnProperty(f)){var L=F1[f],M=L._driver;this[f]=M,oe[M]||this.defineDriver(L)}this._defaultConfig=R3({},Go),this._config=R3({},this._defaultConfig,p),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(f){if((typeof f>"u"?"undefined":i(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var L in f){if(L==="storeName"&&(f[L]=f[L].replace(/\W/g,"_")),L==="version"&&typeof f[L]!="number")return new Error("Database version must be a number.");this._config[L]=f[L]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},c.prototype.defineDriver=function(f,L,M){var w=new d(function(R,Z){try{var P=f._driver,k=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){Z(k);return}for(var F=V3.concat("_initStorage"),j=0,X=F.length;j<X;j++){var t1=F[j],r1=!zo(Ze,t1);if((r1||f[t1])&&typeof f[t1]!="function"){Z(k);return}}var d1=function(){for(var ie=function(Qo){return function(){var Ko=new Error("Method "+Qo+" is not implemented by the current driver"),x6=d.reject(Ko);return b(x6,arguments[arguments.length-1]),x6}},T3=0,Jo=Ze.length;T3<Jo;T3++){var N3=Ze[T3];f[N3]||(f[N3]=ie(N3))}};d1();var c1=function(ie){oe[P]&&console.info("Redefining LocalForage driver: "+P),oe[P]=f,O6[P]=ie,R()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(c1,Z):c1(!!f._support):c1(!0)}catch(M1){Z(M1)}});return S(w,L,M),w},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(f,L,M){var w=oe[f]?d.resolve(oe[f]):d.reject(new Error("Driver not found."));return S(w,L,M),w},c.prototype.getSerializer=function(f){var L=d.resolve(x3);return S(L,f),L},c.prototype.ready=function(f){var L=this,M=L._driverSet.then(function(){return L._ready===null&&(L._ready=L._initDriver()),L._ready});return S(M,f,f),M},c.prototype.setDriver=function(f,L,M){var w=this;D6(f)||(f=[f]);var R=this._getSupportedDrivers(f);function Z(){w._config.driver=w.driver()}function P(j){return w._extend(j),Z(),w._ready=w._initStorage(w._config),w._ready}function k(j){return function(){var X=0;function t1(){for(;X<j.length;){var r1=j[X];return X++,w._dbInfo=null,w._ready=null,w.getDriver(r1).then(P).catch(t1)}Z();var d1=new Error("No available storage method found.");return w._driverSet=d.reject(d1),w._driverSet}return t1()}}var F=this._driverSet!==null?this._driverSet.catch(function(){return d.resolve()}):d.resolve();return this._driverSet=F.then(function(){var j=R[0];return w._dbInfo=null,w._ready=null,w.getDriver(j).then(function(X){w._driver=X._driver,Z(),w._wrapLibraryMethodsWithReady(),w._initDriver=k(R)})}).catch(function(){Z();var j=new Error("No available storage method found.");return w._driverSet=d.reject(j),w._driverSet}),S(this._driverSet,L,M),this._driverSet},c.prototype.supports=function(f){return!!O6[f]},c.prototype._extend=function(f){R3(this,f)},c.prototype._getSupportedDrivers=function(f){for(var L=[],M=0,w=f.length;M<w;M++){var R=f[M];this.supports(R)&&L.push(R)}return L},c.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,L=V3.length;f<L;f++)Yo(this,V3[f])},c.prototype.createInstance=function(f){return new c(f)},c})(),qo=new Xo;r.exports=qo},{3:3}]},{},[4])(4)})})(v3)),v3.exports}var O0=D0();const T1=H0(O0);class g3{getItem(n){return T1.getItem(n)}setItem(n,e){return T1.setItem(n,e)}removeItem(n){return T1.removeItem(n)}clear(){return T1.clear()}key(n){return T1.key(n)}keys(){return T1.keys()}iterate(n){return T1.iterate(n)}}function x0(){const t=x.useDependency(h.ThemeService),n=x.useObservable(t.darkMode$);return C.jsx(N.Messager,{theme:n?"dark":"light"})}var V0=Object.getOwnPropertyDescriptor,R0=(t,n,e,r)=>{for(var o=r>1?void 0:r?V0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},i6=(t,n)=>(e,r)=>n(e,r,t);let l6=0;v.DesktopMessageService=class extends h.Disposable{constructor(n,e){super(),this._injector=n,this._uiPartsService=e,this._initUIPart()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(x0,this._injector)))}dispose(){super.dispose(),N.removeMessage()}show(n){var o;const e=(o=n.id)!=null?o:`message-${Date.now()}-${l6}`;l6+=1;const r=Object.assign({},n,{id:e});return N.message(r),h.toDisposable(()=>N.removeMessage(e))}remove(n){N.removeMessage(n)}removeAll(){N.removeMessage()}},v.DesktopMessageService=R0([i6(0,h.Inject(h.Injector)),i6(1,L1)],v.DesktopMessageService);function T0(){const t=x.useDependency(h.ThemeService),n=x.useObservable(t.darkMode$);return C.jsx(N.Toaster,{theme:n?"dark":"light"})}const N0={show:t=>{const{type:n="message",title:e,content:r,duration:o,closable:i=!0,position:l="top-right"}=t;N.toast[n](e,{position:l,description:r,duration:o,closeButton:i})}};var $0=Object.getOwnPropertyDescriptor,Z0=(t,n,e,r)=>{for(var o=r>1?void 0:r?$0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},s6=(t,n)=>(e,r)=>n(e,r,t);v.DesktopNotificationService=class extends h.Disposable{constructor(n,e){super(),this._injector=n,this._uiPartsService=e,this._initUIPart()}show(n){return N0.show(n),h.toDisposable(()=>{})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(T0,this._injector)))}},v.DesktopNotificationService=Z0([s6(0,h.Inject(h.Injector)),s6(1,L1)],v.DesktopNotificationService);class p3{constructor(){U(this,"_sidebarOptions",{});U(this,"sidebarOptions$",new B.Subject);U(this,"scrollEvent$",new B.Subject);U(this,"_container")}get visible(){return this._sidebarOptions.visible||!1}get options(){return this._sidebarOptions}open(n){return this._sidebarOptions={...n,id:n.id,visible:!0},this.sidebarOptions$.next(this._sidebarOptions),h.toDisposable(()=>{this.close()})}close(n){n&&this._sidebarOptions.id!==n||(this._sidebarOptions={...this._sidebarOptions,visible:!1},this.sidebarOptions$.next(this._sidebarOptions),this._sidebarOptions.onClose&&this._sidebarOptions.onClose())}getContainer(){return this._container}setContainer(n){this._container=n}}var A0=Object.getOwnPropertyDescriptor,P0=(t,n,e,r)=>{for(var o=r>1?void 0:r?A0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},k0=(t,n)=>(e,r)=>n(e,r,t);v.DesktopZenZoneService=class{constructor(n){U(this,"visible$",new B.BehaviorSubject(!1));U(this,"componentKey$",new B.ReplaySubject);U(this,"_temporaryHidden$",new B.BehaviorSubject(!1));U(this,"temporaryHidden$",this._temporaryHidden$.asObservable());U(this,"_visible",!1);this._componentManager=n}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(n,e){return this._componentManager.register(n,e),this.componentKey$.next(n),h.toDisposable(()=>{this._componentManager.delete(n),this.visible$.complete(),this.componentKey$.complete()})}open(){this._visible=!0,this.visible$.next(!0)}close(){this._visible=!1,this.visible$.next(!1)}},v.DesktopZenZoneService=P0([k0(0,h.Inject(C1))],v.DesktopZenZoneService);var F0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,U0=(t,n,e)=>n in t?F0(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,j0=(t,n,e,r)=>{for(var o=r>1?void 0:r?B0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},m3=(t,n)=>(e,r)=>n(e,r,t),b3=(t,n,e)=>U0(t,typeof n!="symbol"?n+"":n,e);const z0="DISABLE_AUTO_FOCUS";v.UniverMobileUIPlugin=class extends h.Plugin{constructor(n=de,e,r,o){super(),this._config=n,this._contextService=e,this._injector=r,this._configService=o;const{menu:i,...l}=h.merge({popupRootId:`univer-popup-portal-${h.generateRandomId(6)}`},de,this._config);l.disableAutoFocus&&this._contextService.setContextValue(z0,!0),i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(R1,l)}onStarting(){h.registerDependencies(this._injector,h.mergeOverrideWithDependencies([[C1],[K1],[W1],[le],[L1,{useClass:Xe}],[I1,{useClass:v.DesktopLayoutService}],[A1,{useClass:v.ShortcutService}],[ge,{useClass:Ye}],[w1,{useClass:v.MenuManagerService}],[te,{useClass:n3}],[ee,{useClass:t3}],[f3,{useClass:v.BrowserClipboardService,lazy:!0}],[re,{useClass:v.DesktopNotificationService,lazy:!0}],[Ee,{useClass:v.DesktopGalleryService,lazy:!0}],[Se,{useClass:v.DesktopDialogService,lazy:!0}],[h.IConfirmService,{useClass:v.DesktopConfirmService,lazy:!0}],[$1,{useClass:p3,lazy:!0}],[Me,{useClass:v.DesktopZenZoneService,lazy:!0}],[ye,{useClass:v.DesktopGlobalZoneService,lazy:!0}],[ve,{useClass:v.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:g3,lazy:!0}],[a3,{useClass:v.DesktopBeforeCloseService}],[C3,{useClass:h3}],[be,{useClass:Je}],[me],[ne,{useFactory:n=>n.createInstance(s3,this._config),deps:[h.Injector]}],[v.SharedController],[v.ErrorController],[v.ShortcutPanelController]],this._config.override)),h.touchDependencies(this._injector,[[ne],[v.ErrorController]])}onReady(){h.touchDependencies(this._injector,[[v.SharedController]])}onSteady(){h.touchDependencies(this._injector,[[v.ShortcutPanelController]])}},b3(v.UniverMobileUIPlugin,"pluginName","UNIVER_MOBILE_UI_PLUGIN"),b3(v.UniverMobileUIPlugin,"packageName",Ie.name),b3(v.UniverMobileUIPlugin,"version",Ie.version),v.UniverMobileUIPlugin=j0([h.DependentOn(B1.UniverRenderEnginePlugin),m3(1,h.IContextService),m3(2,h.Inject(h.Injector)),m3(3,h.IConfigService)],v.UniverMobileUIPlugin);var W0=Object.defineProperty,G0=Object.getOwnPropertyDescriptor,Y0=(t,n,e)=>n in t?W0(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,X0=(t,n,e,r)=>{for(var o=r>1?void 0:r?G0(n,e):n,i=t.length-1,l;i>=0;i--)(l=t[i])&&(o=l(o)||o);return o},w3=(t,n)=>(e,r)=>n(e,r,t),L3=(t,n,e)=>Y0(t,typeof n!="symbol"?n+"":n,e);const a6="DISABLE_AUTO_FOCUS";v.UniverUIPlugin=class extends h.Plugin{constructor(n=de,e,r,o){super(),this._config=n,this._contextService=e,this._injector=r,this._configService=o;const{menu:i,...l}=h.merge({popupRootId:`univer-popup-portal-${h.generateRandomId(6)}`},de,this._config);l.disableAutoFocus&&this._contextService.setContextValue(a6,!0),i&&this._configService.setConfig("menu",i,{merge:!0}),this._configService.setConfig(R1,l)}onStarting(){h.registerDependencies(this._injector,h.mergeOverrideWithDependencies([[C1],[K1],[W1],[le],[L1,{useClass:Xe}],[I1,{useClass:v.DesktopLayoutService}],[Ke,{useClass:v.DesktopRibbonService}],[A1,{useClass:v.ShortcutService}],[ge,{useClass:Ye}],[w1,{useClass:v.MenuManagerService}],[te,{useClass:n3}],[ee,{useClass:t3}],[f3,{useClass:v.BrowserClipboardService,lazy:!0}],[re,{useClass:v.DesktopNotificationService,lazy:!0}],[Ee,{useClass:v.DesktopGalleryService,lazy:!0}],[Se,{useClass:v.DesktopDialogService,lazy:!0}],[h.IConfirmService,{useClass:v.DesktopConfirmService,lazy:!0}],[$1,{useClass:p3,lazy:!0}],[Me,{useClass:v.DesktopZenZoneService,lazy:!0}],[ye,{useClass:v.DesktopGlobalZoneService,lazy:!0}],[ve,{useClass:v.DesktopMessageService,lazy:!0}],[h.ILocalStorageService,{useClass:g3,lazy:!0}],[a3,{useClass:v.DesktopBeforeCloseService}],[C3,{useClass:h3}],[be,{useClass:Je}],[fe,{useClass:Ue}],[me],[ne,{useFactory:n=>n.createInstance(v.DesktopUIController,this._config),deps:[h.Injector]}],[v.SharedController],[v.ErrorController],[v.ShortcutPanelController]],this._config.override)),h.touchDependencies(this._injector,[[ne],[v.ErrorController]])}onReady(){h.touchDependencies(this._injector,[[v.SharedController]])}onSteady(){h.touchDependencies(this._injector,[[v.ShortcutPanelController]])}},L3(v.UniverUIPlugin,"pluginName","UNIVER_UI_PLUGIN"),L3(v.UniverUIPlugin,"packageName",Ie.name),L3(v.UniverUIPlugin,"version",Ie.version),v.UniverUIPlugin=X0([h.DependentOn(B1.UniverRenderEnginePlugin),w3(1,h.IContextService),w3(2,h.Inject(h.Injector)),w3(3,h.IConfigService)],v.UniverUIPlugin);class q0{show(n){return h.toDisposable(()=>{})}remove(n){}removeAll(){}setContainer(){}getContainer(){}}const J0=t=>{const e=x.useDependency($1).getContainer();s.useEffect(()=>{if(e)return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[t,e])};function Oe(t){return t.length===0?t:t.replace(/^\s+|\s+$/gm,"")}const Q0=.75,c6=78,u6=9;function y3(t){var a;let n=t.childNodes;if(n.length===0)return t.textContent;if(n[0].nodeName==="DIV"&&(n=n[0].childNodes),n.length===1&&n[0].nodeName==="#text")return n[0].textContent;const e=[];let r=0,o=0,i=t.textContent||"";i+=`\r
|
|
72
72
|
`;for(let u=0;u<n.length;u++){let g=n[`${u}`],m;g.nodeName==="#text"?(m=(a=g.textContent)!=null?a:"",g=g.parentElement):m=g.innerText;const d=xe(g);f6(m).forEach(S=>{const H=S.length;o+=H,r=o-H;const T=h.generateRandomId(6);e.push({sId:T,st:r,ed:o-1,ts:d})})}return{id:h.generateRandomId(6),body:{dataStream:i,textRuns:e},documentStyle:{}}}function xe(t,n=""){var l,a;let e=(a=(l=t==null?void 0:t.style)==null?void 0:l.cssText)!=null?a:"";if(e+=n,e=e.replace(/[\r\n]+/g,""),e.length===0)return{};const r=e.split(";"),o={},i={t:"",r:"",b:"",l:""};return r.forEach(u=>{var b;const g=u.toLowerCase(),m=Oe(g.substr(0,g.indexOf(":"))),d=Oe(g.substr(g.indexOf(":")+1));if(m==="font-weight")d==="bold"||d==="700"?o.bl=1:o.bl=0;else if(m==="font-style")d==="italic"?o.it=1:o.it=0;else if(m==="font-family"){const S=Oe(u),H=so(S);o.ff=H}else if(m==="font-size"){let S=Number.parseInt(d);e.indexOf("vertical-align")>-1&&(e.indexOf("sub")>-1||e.indexOf("sup")>-1)&&(S*=2),d.indexOf("px")!==-1&&(S=lo(Number.parseInt(d,10))),o.fs=S}else if(m==="color"){const S=new h.ColorKit(d);o.cl={rgb:S.isValid?S.toRgbString():"rgb(0,0,0)"}}else if(m==="background"||m==="background-color"){const S=new h.ColorKit(d);S.isValid&&(o.bg={rgb:S.toRgbString()})}else if(m==="text-decoration-line")d==="underline"?(o.ul||(o.ul={s:1}),o.ul.s=1):d==="line-through"?(o.st||(o.st={s:1}),o.st.s=1):d==="overline"&&(o.ol||(o.ol={s:1}),o.ol.s=1);else if(m==="text-decoration-color")o.hasOwnProperty("ul")&&(o.ul||(o.ul={s:1,cl:{rgb:d}}),o.ul.cl={rgb:d}),o.hasOwnProperty("st")&&(o.st||(o.st={s:1,cl:{rgb:d}}),o.st.cl={rgb:d}),o.hasOwnProperty("ol")&&(o.ol||(o.ol={s:1,cl:{rgb:d}}),o.ol.cl={rgb:d});else if(m==="text-decoration-style")o.hasOwnProperty("ul")&&(o.ul||(o.ul={s:1,t:Number(d)}),o.ul.t=Number(d)),o.hasOwnProperty("st")&&(o.st||(o.st={s:1,t:Number(d)}),o.st.t=Number(d)),o.hasOwnProperty("ol")&&(o.ol||(o.ol={s:1,t:Number(d)}),o.ol.t=Number(d));else if(m==="text-decoration"||m==="univer-strike"){const S=(b=d.split(" "))==null?void 0:b[0];S==="underline"?(o.ul||(o.ul={s:1}),o.ul.s=1):S==="line-through"?(o.st||(o.st={s:1}),o.st.s=1):S==="overline"&&(o.ol||(o.ol={s:1}),o.ol.s=1)}if(m==="univer-underline"&&(o.ul={s:1}),m==="vertical-align"&&(d==="sub"?o.va=h.BaselineOffset.SUBSCRIPT:d==="super"?o.va=h.BaselineOffset.SUPERSCRIPT:d==="top"?o.vt=1:d==="middle"?o.vt=2:d==="bottom"?o.vt=3:o.va=h.BaselineOffset.NORMAL),m==="transform"){const S=d.split(")"),H=S.findIndex(T=>T.includes("rotate"));if(H>-1){const T=S[H].match(/\d+/g);let I=0,y=0;T!=null&&T.length&&(I=+T[0]),t!=null&&t.dataset.vertical&&(y=+t.dataset.vertical),o.tr={a:I,v:y}}}if(m==="text-align"&&(d==="left"?o.ht=1:d==="center"?o.ht=2:d==="right"?o.ht=3:d==="justify"?o.ht=4:o.ht=0),o.tb!==1&&(m==="overflow-wrap"||m==="word-wrap"?d==="break-word"&&(o.tb=3):m==="text-overflow"?d==="clip"&&(o.tb=2):m==="text-break"&&d==="overflow"&&(o.tb=1)),m==="white-space"&&(d==="nowrap"?o.tb=1:d==="normal"?o.tb=3:d==="clip"&&(o.tb=2)),m==="border-color"){const S=d6(d,")");if(o.bd)for(const H in S)o.bd[H].cl.rgb=S[H];else{o.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 H in S)o.bd[H].cl.rgb=S[H]}}if(m==="border-width"||m==="border-style"){const S=d6(d," ");for(const H in S)i[H]+=` ${S[H]}`;o.bd?(o.bd.b.s=h.getBorderStyleType(i.b),o.bd.t.s=h.getBorderStyleType(i.t),o.bd.l.s=h.getBorderStyleType(i.l),o.bd.r.s=h.getBorderStyleType(i.r)):o.bd={b:{cl:{rgb:"#000"},s:h.getBorderStyleType(i.b)},t:{cl:{rgb:"#000"},s:h.getBorderStyleType(i.t)},l:{cl:{rgb:"#000"},s:h.getBorderStyleType(i.l)},r:{cl:{rgb:"#000"},s:h.getBorderStyleType(i.r)}}}if(m==="border-bottom"||m==="border-top"||m==="border-left"||m==="border-right"||m==="border"){o.bd||(o.bd={});const S=d.split(" "),H=`${S[0]} ${S[1]}`;S.splice(0,2);const T=S.join("");if(h.getBorderStyleType(H)!==h.BorderStyleTypes.NONE&&T){const y={cl:{rgb:T},s:h.getBorderStyleType(H)};m==="border-bottom"?o.bd.b=d==="none"?null:y:m==="border-top"?o.bd.t=d==="none"?null:y:m==="border-left"?o.bd.l=d==="none"?null:y:m==="border-right"?o.bd.r=d==="none"?null:y:m==="border"&&(o.bd={r:d==="none"?null:y,t:d==="none"?null:y,b:d==="none"?null:y,l:d==="none"?null:y})}}else if(m==="--data-rotate"){const S=/[+-]?\d+/,H=d.match(S);d==="(0deg ,1)"?o.tr={a:0,v:1}:H&&(o.tr={a:Number(H[0])})}}),Object.keys(o).forEach(u=>{typeof o[u]=="object"&&!Object.keys(o[u]).length&&delete o[u]}),o}function d6(t,n){let e;n===" "?e=t.trim().split(n):e=t.trim().split(n).slice(0,-1),e.forEach(o=>`${o.trim()})`);let r={};return e.length===1?r={t:e[0],r:e[0],b:e[0],l:e[0]}:e.length===2?r={t:e[0],r:e[1],b:e[0],l:e[1]}:e.length===3?r={t:e[0],r:e[1],b:e[2],l:e[1]}:e.length===4&&(r={t:e[0],r:e[1],b:e[2],l:e[3]}),r}function f6(t){if(t==="")return[t];const n=/(?:(\n+.+)|(.+))/g;return t.match(n).map(o=>o.replace(/\n/g,`\r
|
|
73
73
|
`))}function K0(t){const n=document.createElement("DIV"),e=[];n.innerHTML=t;const r=n.querySelectorAll("table col");if(!r.length)return[];for(let o=0;o<r.length;o++){const i=r[o],l=i.getAttribute("span");if(l&&+l>1)for(let a=0;a<+l;a++){const u=Ve(i.getAttribute("width"),72);e.push(u)}else{const a=Ve(i.getAttribute("width"),72);e.push(a)}}return e}function Ve(t,n){if(!t)return n;let e;return t.includes("pt")?e=B1.ptToPx(Number.parseFloat(t)):t.includes("px")?e=Number.parseFloat(t):e=Number.parseFloat(t)*72/96,e}function eo(t){const n=document.createElement("DIV"),e=[];n.innerHTML=t;const r=n.querySelectorAll("table tr");if(!r.length)return[];for(let o=0;o<r.length;o++){const l=r[o].querySelectorAll("td");let a=Ve(l[0].style.height,19);for(let u=0;u<l.length;u++){const g=l[u].getAttribute("rowSpan");if(!(g&&+g>1)){a=Ve(l[u].style.height,19);break}}e.push(a)}return e}function to(t){let n=[];const e=document.createElement("DIV");if(e.innerHTML=t,n=new Array(e.querySelectorAll("table tr").length),!n.length)return[];let r=0;const o=e.querySelectorAll("table tr");o[0].querySelectorAll("td").forEach(a=>{let u=0;const g=a.getAttribute("colSpan");g!==null?u=+g:u=1,r+=u});for(let a=0;a<n.length;a++)n[a]=new Array(r);let l=0;return o.forEach(a=>{let u=0;a.querySelectorAll("td").forEach(g=>{var S,H;const m={};if(g.querySelectorAll("span").length||g.querySelectorAll("font").length){const T=y3(g);typeof T!="string"&&(m.p=T)}const d=g.innerText;d.trim().length===0?m.v="":m.v=d;const b=xe(g);for(h.Tools.isPlainObject(b)&&(m.s=b);u<r&&n[l][u]!=null;)u++;if(u!==r){if(n[l][u]==null){n[l][u]=m;const T=(S=Number(g.getAttribute("rowSpan")))!=null?S:1,I=(H=Number(g.getAttribute("colSpan")))!=null?H:1;if(T>1||I>1){const y={rs:+T-1,cs:+I-1,r:l,c:u};n[l][u].mc=y;for(let E=0;E<T;E++)for(let O=0;O<I;O++)E===0&&O===0||(n[l+E][u+O]={mc:null})}}u++}}),l++}),n}function no(t){const n=[],e=document.createElement("DIV");e.innerHTML=t;const o=t.replace(/\r/g,"").split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UniverSheet normal plugin UI manager",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"@univerjs/icons": "^1.1.1",
|
|
69
69
|
"@wendellhu/redi": "1.1.1",
|
|
70
70
|
"localforage": "^1.10.0",
|
|
71
|
-
"@univerjs/core": "0.
|
|
72
|
-
"@univerjs/
|
|
73
|
-
"@univerjs/
|
|
71
|
+
"@univerjs/core": "0.17.0",
|
|
72
|
+
"@univerjs/design": "0.17.0",
|
|
73
|
+
"@univerjs/engine-render": "0.17.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@testing-library/react": "^16.3.2",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.9.3",
|
|
84
84
|
"vite": "^7.3.1",
|
|
85
85
|
"vitest": "^4.0.18",
|
|
86
|
-
"@univerjs-infra/shared": "0.
|
|
87
|
-
"@univerjs/themes": "0.
|
|
86
|
+
"@univerjs-infra/shared": "0.17.0",
|
|
87
|
+
"@univerjs/themes": "0.17.0"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"test": "vitest run",
|