@univerjs/sheets-hyper-link-ui 0.6.7 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js ADDED
@@ -0,0 +1,1839 @@
1
+ var Jn = Object.defineProperty;
2
+ var Qn = (t, e, n) => e in t ? Jn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var $ = (t, e, n) => Qn(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Tools as Ce, IUniverInstanceService as Y, ICommandService as re, Inject as y, LocaleService as lt, IConfigService as yn, UniverInstanceType as w, isValidRange as En, RANGE_TYPE as an, Rectangle as ye, Injector as ut, Disposable as z, Range as Rn, ObjectMatrix as er, IContextService as tr, ThemeService as nr, DataStreamTreeTokenType as cn, CustomRangeType as Ke, BuildTextUtils as _e, ColorKit as rr, DOCS_ZEN_EDITOR_UNIT_ID_KEY as N, DisposableCollection as ir, FOCUSING_SHEET as Ct, generateRandomId as or, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ie, DataValidationType as It, CommandType as dt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as sr, IPermissionService as ar, InterceptorEffectEnum as cr, DependentOn as lr, Plugin as ur, merge as dr } from "@univerjs/core";
5
+ import { SetSelectionsOperation as Ln, SetWorksheetActiveOperation as Pn, rangeToDiscreteRange as pr, SheetsSelectionsService as wt, getSheetCommandTarget as Tt, RangeProtectionPermissionEditPoint as Ot, WorksheetEditPermission as Nt, WorksheetSetCellValuePermission as kn, WorksheetInsertHyperlinkPermission as Mt, WorkbookEditablePermission as Ut, SheetPermissionCheckController as bn, RangeProtectionPermissionViewPoint as hr, WorksheetViewPermission as gr, WorkbookViewPermission as mr, WorkbookCopyPermission as vr, WorksheetCopyPermission as fr, ClearSelectionContentCommand as _r, ClearSelectionAllCommand as Sr, ClearSelectionFormatCommand as Cr, SheetInterceptorService as Ir, INTERCEPTOR_POINT as yr } from "@univerjs/sheets";
6
+ import { SheetHyperLinkType as C, ERROR_RANGE as Er, HyperLinkModel as pt, RemoveHyperLinkMutation as Me, AddHyperLinkMutation as Ue, SheetsHyperLinkParserService as Ht, UpdateRichHyperLinkCommand as Rr, UpdateHyperLinkCommand as Lr, AddRichHyperLinkCommand as Pr, AddHyperLinkCommand as kr, CancelRichHyperLinkCommand as br, CancelHyperLinkCommand as wr, UniverSheetsHyperLinkPlugin as Tr } from "@univerjs/sheets-hyper-link";
7
+ import { ScrollToRangeOperation as wn, ISheetClipboardService as Or, virtualizeDiscreteRanges as Lt, COPY_TYPE as Nr, PREDEFINED_HOOK_NAME as Be, getRepeatRange as Mr, IEditorBridgeService as ne, IMarkSelectionService as Ur, SheetCanvasPopManagerService as Hr, getEditingCustomRangePosition as xr, getCustomRangePosition as Dr, whenSheetEditorFocused as Vr, getCurrentRangeDisable$ as Ar, IAutoFillService as $r, APPLY_TYPE as we, getAutoFillRepeatRange as Br, HoverManagerService as Fr, HoverRenderController as Wr, SheetSkeletonManagerService as ln } from "@univerjs/sheets-ui";
8
+ import { MessageType as Oe, FormLayout as ve, Input as un, Select as yt, Button as dn, clsx as pn, Tooltip as Fe } from "@univerjs/design";
9
+ import { IDefinedNamesService as Tn, deserializeRangeWithSheet as je, serializeRangeWithSheet as jr, serializeRangeToRefString as Zr, serializeRange as Gr } from "@univerjs/engine-formula";
10
+ import { IMessageService as On, useDependency as I, useObservable as Kr, IZenZoneService as ht, useEvent as Yr, KeyCode as Pt, MenuItemType as Nn, MetaKeys as zr, getMenuHiddenObservable as gt, ContextMenuPosition as Xr, ContextMenuGroup as qr, RibbonStartGroup as Jr, ComponentManager as Qr, IMenuManagerService as ei, IShortcutService as ti } from "@univerjs/ui";
11
+ import { DocSelectionRenderService as Mn, DocBackScrollRenderController as ni, DocCanvasPopManagerService as ri, calcDocRangePositions as ii, DocEventManagerService as hn, UniverDocsUIPlugin as oi } from "@univerjs/docs-ui";
12
+ import { IRenderManagerService as De } from "@univerjs/engine-render";
13
+ import { Subject as si, BehaviorSubject as ai, of as ae, map as xt, switchMap as He, combineLatest as ci, debounceTime as Ze, Observable as li } from "rxjs";
14
+ import { DocSelectionManagerService as xe } from "@univerjs/docs";
15
+ import { jsxs as Se, jsx as v, Fragment as ui } from "react/jsx-runtime";
16
+ import { RangeSelector as di } from "@univerjs/sheets-formula-ui";
17
+ import { useState as G, useMemo as Et, useRef as Un, useCallback as pi, useEffect as te, forwardRef as ue, createElement as de } from "react";
18
+ import { SheetDataValidationModel as gn } from "@univerjs/sheets-data-validation";
19
+ function Ye(t) {
20
+ return Ce.isLegalUrl(t);
21
+ }
22
+ function hi(t) {
23
+ return /^[a-zA-Z]+:\/\//.test(t);
24
+ }
25
+ function gi(t) {
26
+ return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
27
+ }
28
+ function mi(t) {
29
+ if (Ye(t)) {
30
+ const e = hi(t) ? t : gi(t) ? `mailto://${t}` : `http://${t}`;
31
+ let n;
32
+ try {
33
+ n = new URL(e);
34
+ } catch {
35
+ return t;
36
+ }
37
+ return n.hostname === location.hostname && n.port === location.port && n.protocol === location.protocol && n.pathname === location.pathname && n.hash && !n.search ? n.hash : e;
38
+ }
39
+ return t;
40
+ }
41
+ const Hn = "sheets-hyper-link-ui.config", mn = {};
42
+ var vi = Object.getOwnPropertyDescriptor, fi = (t, e, n, i) => {
43
+ for (var r = i > 1 ? void 0 : i ? vi(e, n) : e, o = t.length - 1, s; o >= 0; o--)
44
+ (s = t[o]) && (r = s(r) || r);
45
+ return r;
46
+ }, fe = (t, e) => (n, i) => e(n, i, t);
47
+ function _i(t, e) {
48
+ const n = e.getMergeData(), i = e.getMaxColumns() - 1, r = e.getMaxRows() - 1;
49
+ if (i < t.endColumn && (t.endColumn = i), r < t.endRow && (t.endRow = r), t.rangeType === an.COLUMN || an.ROW)
50
+ return t;
51
+ const o = [];
52
+ return n.forEach((s) => {
53
+ ye.intersects(t, s) && o.push(s);
54
+ }), ye.realUnion(t, ...o);
55
+ }
56
+ let le = class {
57
+ constructor(t, e, n, i, r, o) {
58
+ this._univerInstanceService = t, this._commandService = e, this._definedNamesService = n, this._messageService = i, this._localeService = r, this._configService = o;
59
+ }
60
+ navigate(t) {
61
+ switch (t.type) {
62
+ case C.URL:
63
+ this.navigateToOtherWebsite(t.url);
64
+ break;
65
+ default:
66
+ this._navigateToUniver(t.searchObj);
67
+ }
68
+ }
69
+ _navigateToUniver(t) {
70
+ const { gid: e, range: n, rangeid: i } = t, r = this._univerInstanceService.getCurrentUnitForType(w.UNIVER_SHEET);
71
+ if (!r)
72
+ return;
73
+ const o = r.getUnitId();
74
+ if (i) {
75
+ const s = this._definedNamesService.getValueById(o, i);
76
+ if (!s)
77
+ return;
78
+ const { formulaOrRefString: c } = s, u = this._definedNamesService.getWorksheetByRef(o, c);
79
+ if (!u) {
80
+ this._messageService.show({
81
+ content: this._localeService.t("hyperLink.message.refError"),
82
+ type: Oe.Error
83
+ });
84
+ return;
85
+ }
86
+ if (u.isSheetHidden()) {
87
+ this._messageService.show({
88
+ content: this._localeService.t("hyperLink.message.hiddenSheet"),
89
+ type: Oe.Error
90
+ });
91
+ return;
92
+ }
93
+ this.navigateToDefineName(o, i);
94
+ }
95
+ if (e) {
96
+ if (n) {
97
+ const s = je(n);
98
+ En(s.range) && n !== Er && this.navigateToRange(o, e, s.range);
99
+ return;
100
+ }
101
+ this.navigateToSheetById(o, e);
102
+ }
103
+ }
104
+ async navigateToRange(t, e, n, i) {
105
+ const r = await this.navigateToSheetById(t, e);
106
+ if (r) {
107
+ const o = _i(n, r);
108
+ await this._commandService.executeCommand(
109
+ Ln.id,
110
+ {
111
+ unitId: t,
112
+ subUnitId: e,
113
+ selections: [{
114
+ range: o,
115
+ primary: null
116
+ }]
117
+ }
118
+ ), await this._commandService.executeCommand(wn.id, {
119
+ range: o,
120
+ forceTop: i
121
+ });
122
+ }
123
+ }
124
+ async navigateToSheetById(t, e) {
125
+ const n = this._univerInstanceService.getUnit(t, w.UNIVER_SHEET);
126
+ if (!n)
127
+ return !1;
128
+ const i = n.getActiveSheet();
129
+ if (!i)
130
+ return !1;
131
+ if (i.getSheetId() === e)
132
+ return i;
133
+ const r = n.getSheetBySheetId(e);
134
+ return r ? n.getHiddenWorksheets().indexOf(e) > -1 ? (this._messageService.show({
135
+ content: this._localeService.t("hyperLink.message.hiddenSheet"),
136
+ type: Oe.Error
137
+ }), !1) : await this._commandService.executeCommand(Pn.id, { unitId: t, subUnitId: e }) ? r : !1 : (this._messageService.show({
138
+ content: this._localeService.t("hyperLink.message.noSheet"),
139
+ type: Oe.Error
140
+ }), !1);
141
+ }
142
+ async navigateToDefineName(t, e) {
143
+ return this._definedNamesService.focusRange(t, e), !0;
144
+ }
145
+ async navigateToOtherWebsite(t) {
146
+ var n;
147
+ const e = this._configService.getConfig(Hn);
148
+ if ((n = e == null ? void 0 : e.urlHandler) != null && n.navigateToOtherWebsite)
149
+ return e.urlHandler.navigateToOtherWebsite(t);
150
+ window.open(t, "_blank", "noopener noreferrer");
151
+ }
152
+ };
153
+ le = fi([
154
+ fe(0, Y),
155
+ fe(1, re),
156
+ fe(2, Tn),
157
+ fe(3, On),
158
+ fe(4, y(lt)),
159
+ fe(5, yn)
160
+ ], le);
161
+ const Dt = "SHEET_HYPER_LINK_UI_PLUGIN";
162
+ var Si = Object.getOwnPropertyDescriptor, Ci = (t, e, n, i) => {
163
+ for (var r = i > 1 ? void 0 : i ? Si(e, n) : e, o = t.length - 1, s; o >= 0; o--)
164
+ (s = t[o]) && (r = s(r) || r);
165
+ return r;
166
+ }, We = (t, e) => (n, i) => e(n, i, t);
167
+ let ze = class extends z {
168
+ constructor(e, n, i, r) {
169
+ super();
170
+ $(this, "_plainTextFilter", /* @__PURE__ */ new Set());
171
+ $(this, "_copyInfo");
172
+ this._sheetClipboardService = e, this._hyperLinkModel = n, this._injector = i, this._resolverService = r, this._initCopyPaste(), this.disposeWithMe(() => {
173
+ this._plainTextFilter.clear();
174
+ });
175
+ }
176
+ registerPlainTextFilter(e) {
177
+ this._plainTextFilter.add(e);
178
+ }
179
+ removePlainTextFilter(e) {
180
+ this._plainTextFilter.delete(e);
181
+ }
182
+ /* If return false the process of paste text will be stop */
183
+ _filterPlainText(e) {
184
+ return Array.from(this._plainTextFilter).every((n) => n(e));
185
+ }
186
+ _initCopyPaste() {
187
+ this._sheetClipboardService.addClipboardHook({
188
+ id: Dt,
189
+ onBeforeCopy: (e, n, i) => this._collect(e, n, i),
190
+ onPasteCells: (e, n, i, r) => {
191
+ const { copyType: o = Nr.COPY, pasteType: s } = r, { range: c } = e || {}, { range: u, unitId: p, subUnitId: l } = n;
192
+ return this._generateMutations(u, { copyType: o, pasteType: s, copyRange: c, unitId: p, subUnitId: l });
193
+ },
194
+ onPastePlainText: (e, n) => {
195
+ const i = this._filterPlainText(n);
196
+ if (Ye(n) && i) {
197
+ const { range: r, unitId: o, subUnitId: s } = e, { ranges: [c], mapFunc: u } = Lt([r]), p = [], l = [];
198
+ return Rn.foreach(c, (g, d) => {
199
+ const { row: _, col: S } = u(g, d), f = this._hyperLinkModel.getHyperLinkByLocation(o, s, _, S);
200
+ f && p.push({
201
+ id: Me.id,
202
+ params: {
203
+ unitId: o,
204
+ subUnitId: s,
205
+ id: f.id
206
+ }
207
+ }), f && l.push({
208
+ id: Ue.id,
209
+ params: {
210
+ unitId: o,
211
+ subUnitId: s,
212
+ link: f
213
+ }
214
+ });
215
+ }), { redos: p, undos: l };
216
+ }
217
+ return { undos: [], redos: [] };
218
+ },
219
+ priority: 99
220
+ });
221
+ }
222
+ _collect(e, n, i) {
223
+ const r = new er();
224
+ this._copyInfo = {
225
+ unitId: e,
226
+ subUnitId: n,
227
+ matrix: r
228
+ };
229
+ const o = this._injector.invoke((u) => pr(i, u, e, n));
230
+ if (!o)
231
+ return;
232
+ const { rows: s, cols: c } = o;
233
+ s.forEach((u, p) => {
234
+ c.forEach((l, g) => {
235
+ var _;
236
+ const d = this._hyperLinkModel.getHyperLinkByLocation(e, n, u, l);
237
+ r.setValue(p, g, (_ = d == null ? void 0 : d.id) != null ? _ : "");
238
+ });
239
+ });
240
+ }
241
+ // eslint-disable-next-line max-lines-per-function
242
+ _generateMutations(e, n) {
243
+ if (!this._copyInfo)
244
+ return { redos: [], undos: [] };
245
+ if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !n.copyRange)
246
+ return { redos: [], undos: [] };
247
+ if ([
248
+ Be.SPECIAL_PASTE_COL_WIDTH,
249
+ Be.SPECIAL_PASTE_VALUE,
250
+ Be.SPECIAL_PASTE_FORMAT,
251
+ Be.SPECIAL_PASTE_FORMULA
252
+ ].includes(n.pasteType))
253
+ return { redos: [], undos: [] };
254
+ const { unitId: r, subUnitId: o } = this._copyInfo, s = [], c = [], { ranges: [u, p], mapFunc: l } = Lt([n.copyRange, e]);
255
+ return Mr(u, p, !0).forEach(({ startRange: d }) => {
256
+ var _;
257
+ (_ = this._copyInfo) == null || _.matrix.forValue((S, f, k) => {
258
+ const a = ye.getPositionRange(
259
+ {
260
+ startRow: S,
261
+ endRow: S,
262
+ startColumn: f,
263
+ endColumn: f
264
+ },
265
+ d
266
+ ), b = this._hyperLinkModel.getHyperLink(r, o, k), { row: U, col: T } = l(a.startRow, a.startColumn), L = this._hyperLinkModel.getHyperLinkByLocation(n.unitId, n.subUnitId, U, T), A = Ce.generateRandomId();
267
+ L && s.push({
268
+ id: Me.id,
269
+ params: {
270
+ unitId: n.unitId,
271
+ subUnitId: n.subUnitId,
272
+ id: L.id
273
+ }
274
+ }), b && (s.push({
275
+ id: Ue.id,
276
+ params: {
277
+ unitId: n.unitId,
278
+ subUnitId: n.subUnitId,
279
+ link: {
280
+ ...b,
281
+ id: A,
282
+ row: U,
283
+ column: T
284
+ }
285
+ }
286
+ }), c.push({
287
+ id: Me.id,
288
+ params: {
289
+ unitId: n.unitId,
290
+ subUnitId: n.subUnitId,
291
+ id: A
292
+ }
293
+ })), L && c.push({
294
+ id: Ue.id,
295
+ params: {
296
+ unitId: n.unitId,
297
+ subUnitId: n.subUnitId,
298
+ link: L
299
+ }
300
+ });
301
+ });
302
+ }), { redos: s, undos: c };
303
+ }
304
+ };
305
+ ze = Ci([
306
+ We(0, Or),
307
+ We(1, y(pt)),
308
+ We(2, y(ut)),
309
+ We(3, y(le))
310
+ ], ze);
311
+ var m = /* @__PURE__ */ ((t) => (t.EDITING = "editing", t.VIEWING = "viewing", t.ZEN_EDITOR = "zen_mode", t))(m || {});
312
+ class xn extends z {
313
+ constructor() {
314
+ super(...arguments);
315
+ $(this, "_customHyperLinks", /* @__PURE__ */ new Map());
316
+ }
317
+ isBuiltInLinkType(n) {
318
+ return n !== C.URL;
319
+ }
320
+ getOptions() {
321
+ return Array.from(this._customHyperLinks.values()).map(({ option: n }) => n);
322
+ }
323
+ findCustomHyperLink(n) {
324
+ return Array.from(this._customHyperLinks.values()).find((r) => r.match(n));
325
+ }
326
+ registerCustomHyperLink(n) {
327
+ this._customHyperLinks.set(n.type, n);
328
+ }
329
+ getCustomHyperLink(n) {
330
+ return this._customHyperLinks.get(n);
331
+ }
332
+ removeCustomHyperLink(n) {
333
+ const { _customHyperLinks: i } = this;
334
+ i.delete(n);
335
+ }
336
+ dispose() {
337
+ super.dispose(), this._customHyperLinks.clear();
338
+ }
339
+ }
340
+ const Ii = "univer-cell-link-edit", yi = "univer-cell-link-edit-buttons", vn = {
341
+ cellLinkEdit: Ii,
342
+ cellLinkEditButtons: yi
343
+ }, Xe = () => {
344
+ var Zt;
345
+ const [t, e] = G(""), [n, i] = G(!1), [r, o] = G(""), [s, c] = G(!0), [u, p] = G(C.URL), [l, g] = G(""), d = I(lt), _ = I(Tn), S = I(ne), f = I(Y), k = I(K), a = Kr(k.currentEditing$), b = I(Ht), U = I(le), T = I(re), L = I(xn), A = Et(() => L.getOptions(), [L]), D = I(ht), X = I(De), Ee = I(Ur), Ve = I(xe), ie = I(tr), Re = I(nr), Le = I(xe), [Pe, Ae] = G(!1), he = I(wt), Gn = Et(() => he.getCurrentSelections(), []), $e = Et(() => {
346
+ if (!L.isBuiltInLinkType(u))
347
+ return L.getCustomHyperLink(u);
348
+ }, [L, u]), [ge, Kn] = G(!1), [ke, Wt] = G(!1), x = Un(!1), B = f.getCurrentUnitForType(w.UNIVER_SHEET), Yn = (B == null ? void 0 : B.getActiveSheet().getSheetId()) || "", J = pi((h) => {
349
+ o(h.replaceAll(cn.CUSTOM_RANGE_START, "").replaceAll(cn.CUSTOM_RANGE_END, ""));
350
+ }, [o]);
351
+ te(() => {
352
+ var h, E, R, P, M, F, Gt, Kt, Yt, zt, Xt, qt, Jt, Qt, en, tn, nn;
353
+ if ((a == null ? void 0 : a.row) !== void 0 && a.col !== void 0) {
354
+ const { customRange: oe, row: _t, col: St } = a;
355
+ let { label: q } = a;
356
+ typeof q == "number" && (q = `${q}`);
357
+ let W;
358
+ if (oe)
359
+ W = {
360
+ id: (h = oe == null ? void 0 : oe.rangeId) != null ? h : "",
361
+ display: q != null ? q : "",
362
+ payload: (R = (E = oe == null ? void 0 : oe.properties) == null ? void 0 : E.url) != null ? R : "",
363
+ row: _t,
364
+ column: St
365
+ };
366
+ else if (a.type === m.VIEWING) {
367
+ const O = f.getUnit(a.unitId), ee = O == null ? void 0 : O.getSheetBySheetId(a.subUnitId), H = ee == null ? void 0 : ee.getCellRaw(a.row, a.col), me = (F = (M = (P = H == null ? void 0 : H.p) == null ? void 0 : P.body) == null ? void 0 : M.customRanges) == null ? void 0 : F.find((on) => {
368
+ var sn;
369
+ return on.rangeType === Ke.HYPERLINK && ((sn = on.properties) == null ? void 0 : sn.url);
370
+ }), be = H == null ? void 0 : H.v;
371
+ H && (!_e.transform.isEmptyDocument((Kt = (Gt = H.p) == null ? void 0 : Gt.body) == null ? void 0 : Kt.dataStream) || Ce.isDefine(be)) && c(!1), W = {
372
+ id: "",
373
+ display: "",
374
+ payload: (zt = (Yt = me == null ? void 0 : me.properties) == null ? void 0 : Yt.url) != null ? zt : "",
375
+ row: _t,
376
+ column: St
377
+ };
378
+ } else {
379
+ const O = f.getCurrentUnitForType(w.UNIVER_DOC), ee = Ve.getActiveTextRange(), H = O == null ? void 0 : O.getBody(), me = ee && H ? ee : null, be = me && ((qt = _e.customRange.getCustomRangesInterestsWithSelection(me, (Xt = H == null ? void 0 : H.customRanges) != null ? Xt : [])) == null ? void 0 : qt[0]);
380
+ c(!1), W = {
381
+ id: "",
382
+ display: q != null ? q : "",
383
+ payload: (Qt = (Jt = be == null ? void 0 : be.properties) == null ? void 0 : Jt.url) != null ? Qt : "",
384
+ row: _t,
385
+ column: St
386
+ };
387
+ }
388
+ e(W.id);
389
+ const rn = L.findCustomHyperLink(W);
390
+ if (rn) {
391
+ const O = rn.convert(W);
392
+ p(O.type), g(O.payload), J(O.display);
393
+ return;
394
+ }
395
+ J(W.display);
396
+ const Q = b.parseHyperLink(W.payload);
397
+ switch (p(Q.type === C.INVALID ? C.RANGE : Q.type), Q.type) {
398
+ case C.URL: {
399
+ g(Q.url), Q.url === W.display && (x.current = !0);
400
+ break;
401
+ }
402
+ case C.RANGE: {
403
+ const O = Q.searchObj, ee = O.gid && (nn = (tn = (en = f.getUnit(a.unitId)) == null ? void 0 : en.getSheetBySheetId(O.gid)) == null ? void 0 : tn.getName()) != null ? nn : "", H = jr(ee, je(O.range).range);
404
+ g(H), H === W.display && (x.current = !0);
405
+ break;
406
+ }
407
+ case C.SHEET: {
408
+ const O = Q.searchObj;
409
+ g(O.gid);
410
+ break;
411
+ }
412
+ case C.DEFINE_NAME: {
413
+ const O = Q.searchObj;
414
+ g(O.rangeid);
415
+ break;
416
+ }
417
+ default:
418
+ g("");
419
+ break;
420
+ }
421
+ }
422
+ }, [a, U, L, Ve, f]), te(() => {
423
+ let h = null;
424
+ if (a && !a.customRangeId && a.type === m.VIEWING && Ce.isDefine(a.row) && Ce.isDefine(a.col)) {
425
+ const E = f.getUnit(a.unitId, w.UNIVER_SHEET), R = E == null ? void 0 : E.getSheetBySheetId(a.subUnitId), P = R == null ? void 0 : R.getMergedCell(a.row, a.col), M = new rr(Re.getCurrentTheme().hyacinth500).toRgb();
426
+ h = Ee.addShape(
427
+ {
428
+ range: P != null ? P : {
429
+ startColumn: a.col,
430
+ endColumn: a.col,
431
+ startRow: a.row,
432
+ endRow: a.row
433
+ },
434
+ style: {
435
+ // hasAutoFill: false,
436
+ fill: `rgb(${M.r}, ${M.g}, ${M.b}, 0.12)`,
437
+ strokeWidth: 1,
438
+ stroke: "#FFBD37",
439
+ widgets: {}
440
+ },
441
+ primary: null
442
+ },
443
+ [],
444
+ -1
445
+ );
446
+ }
447
+ return () => {
448
+ h && Ee.removeShape(h);
449
+ };
450
+ }, [a, Ee, Re, f]), te(() => {
451
+ Wt(u === C.RANGE);
452
+ }, [u]), te(() => {
453
+ const h = (a == null ? void 0 : a.type) === m.ZEN_EDITOR ? X.getRenderById(N) : X.getRenderById(S.getCurrentEditorId()), E = new ir();
454
+ if (h) {
455
+ const R = h.with(Mn);
456
+ R.setReserveRangesStatus(!0), E.add(() => {
457
+ R.setReserveRangesStatus(!1);
458
+ });
459
+ }
460
+ return () => {
461
+ S.disableForceKeepVisible(), E.dispose();
462
+ };
463
+ }, [a == null ? void 0 : a.type, S, X]), te(() => (ke && k.setIsKeepVisible(ke), k.setIsKeepVisible(Pe), () => {
464
+ k.setIsKeepVisible(!1);
465
+ }), [ke, Pe, k]), te(() => () => {
466
+ D.temporaryHidden && (D.show(), ie.setContextValue(Ct, !1));
467
+ }, [ie, D]), te(() => {
468
+ if (ke)
469
+ return S.enableForceKeepVisible(), () => {
470
+ S.disableForceKeepVisible();
471
+ };
472
+ }, [ke, S]);
473
+ const zn = [
474
+ {
475
+ label: d.t("hyperLink.form.link"),
476
+ value: C.URL
477
+ },
478
+ {
479
+ label: d.t("hyperLink.form.range"),
480
+ value: C.RANGE
481
+ },
482
+ {
483
+ label: d.t("hyperLink.form.worksheet"),
484
+ value: C.SHEET
485
+ },
486
+ {
487
+ label: d.t("hyperLink.form.definedName"),
488
+ value: C.DEFINE_NAME
489
+ },
490
+ ...A
491
+ ];
492
+ if (!B)
493
+ return;
494
+ const Xn = B.getHiddenWorksheets(), mt = B.getSheets().map((h) => ({ label: h.getName(), value: h.getSheetId() })).filter((h) => Xn.indexOf(h.value) === -1), vt = Object.values((Zt = _.getDefinedNameMap(B.getUnitId())) != null ? Zt : {}).map((h) => ({
495
+ label: h.name,
496
+ value: h.id
497
+ })), jt = (h, E) => {
498
+ if (h === C.URL)
499
+ return mi(E);
500
+ if (h === C.RANGE) {
501
+ const R = je(E), P = B.getSheetBySheetName(R.sheetName);
502
+ if (P)
503
+ return `#gid=${P.getSheetId()}&range=${Gr(R.range)}`;
504
+ }
505
+ return `#${h}=${E}`;
506
+ }, qn = Yr((h) => {
507
+ var M;
508
+ const R = h.split(",").map(je)[0];
509
+ if (!R || !En(R.range))
510
+ return;
511
+ R.sheetName || (R.sheetName = ((M = B.getActiveSheet()) == null ? void 0 : M.getName()) || "");
512
+ const P = Zr(R);
513
+ g(P), P && (x.current || !r) && (J(P), x.current = !0);
514
+ }), ft = async () => {
515
+ if (s && !r || !l || u === C.URL && !Ye(l)) {
516
+ Kn(!0);
517
+ return;
518
+ }
519
+ if (a)
520
+ if (t) {
521
+ const h = a.type === m.ZEN_EDITOR || a.type === m.EDITING ? Rr.id : Lr.id;
522
+ await T.executeCommand(h, {
523
+ id: t,
524
+ unitId: a.unitId,
525
+ subUnitId: a.subUnitId,
526
+ payload: {
527
+ display: s ? r : "",
528
+ payload: jt(u, l)
529
+ },
530
+ row: a.row,
531
+ column: a.col,
532
+ documentId: a.type === m.ZEN_EDITOR ? N : S.getCurrentEditorId()
533
+ });
534
+ } else {
535
+ const h = a.type === m.ZEN_EDITOR || a.type === m.EDITING ? Pr.id : kr.id;
536
+ await T.executeCommand(h, {
537
+ unitId: a.unitId,
538
+ subUnitId: a.subUnitId,
539
+ link: {
540
+ id: or(),
541
+ row: a.row,
542
+ column: a.col,
543
+ payload: jt(u, l),
544
+ display: s ? r : ""
545
+ },
546
+ documentId: a.type === m.ZEN_EDITOR ? N : S.getCurrentEditorId()
547
+ });
548
+ }
549
+ if ((a == null ? void 0 : a.type) === m.VIEWING) {
550
+ await T.executeCommand(Pn.id, {
551
+ unitId: a.unitId,
552
+ subUnitId: a.subUnitId
553
+ });
554
+ const h = 1;
555
+ await T.executeCommand(wn.id, {
556
+ range: {
557
+ startRow: Math.max(a.row - h, 0),
558
+ endRow: a.row + h,
559
+ startColumn: Math.max(a.col - h, 0),
560
+ endColumn: a.col + h
561
+ }
562
+ });
563
+ }
564
+ T.executeCommand(Je.id);
565
+ };
566
+ return a ? /* @__PURE__ */ Se("div", { className: vn.cellLinkEdit, style: { display: n ? "none" : "block" }, children: [
567
+ s ? /* @__PURE__ */ v(
568
+ ve,
569
+ {
570
+ label: d.t("hyperLink.form.label"),
571
+ error: ge && !r ? d.t("hyperLink.form.inputError") : "",
572
+ children: /* @__PURE__ */ v(
573
+ un,
574
+ {
575
+ value: r,
576
+ onChange: (h) => {
577
+ J(h), x.current = !1;
578
+ },
579
+ placeholder: d.t("hyperLink.form.labelPlaceholder"),
580
+ autoFocus: !0,
581
+ onKeyDown: (h) => {
582
+ h.keyCode === Pt.ENTER && ft();
583
+ }
584
+ }
585
+ )
586
+ }
587
+ ) : null,
588
+ /* @__PURE__ */ v(ve, { label: d.t("hyperLink.form.type"), children: /* @__PURE__ */ v(
589
+ yt,
590
+ {
591
+ options: zn,
592
+ value: u,
593
+ onChange: (h) => {
594
+ p(h), g("");
595
+ }
596
+ }
597
+ ) }),
598
+ u === C.URL && /* @__PURE__ */ v(
599
+ ve,
600
+ {
601
+ error: ge ? l ? Ye(l) ? "" : d.t("hyperLink.form.linkError") : d.t("hyperLink.form.inputError") : "",
602
+ children: /* @__PURE__ */ v(
603
+ un,
604
+ {
605
+ value: l,
606
+ onChange: (h) => {
607
+ g(h), h && (x.current || !r || r === l) && (J(h), x.current = !0);
608
+ },
609
+ placeholder: d.t("hyperLink.form.linkPlaceholder"),
610
+ autoFocus: !0,
611
+ onKeyDown: (h) => {
612
+ h.keyCode === Pt.ENTER && ft();
613
+ }
614
+ }
615
+ )
616
+ }
617
+ ),
618
+ u === C.RANGE && /* @__PURE__ */ v(ve, { error: ge && !l ? d.t("hyperLink.form.inputError") : "", children: /* @__PURE__ */ v(
619
+ di,
620
+ {
621
+ unitId: B.getUnitId(),
622
+ subUnitId: Yn,
623
+ maxRangeCount: 1,
624
+ supportAcrossSheet: !0,
625
+ initialValue: l,
626
+ resetRange: Gn,
627
+ onChange: (h, E) => qn(E),
628
+ onRangeSelectorDialogVisibleChange: async (h) => {
629
+ var E, R;
630
+ if (Ae(h), h)
631
+ a.type === m.ZEN_EDITOR && (D.hide(), ie.setContextValue(Ct, !0)), a.type !== m.VIEWING && S.enableForceKeepVisible(), i(!0);
632
+ else {
633
+ if (await U.navigateToRange(a.unitId, a.subUnitId, { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col }, !0), a.type === m.ZEN_EDITOR) {
634
+ await T.executeCommand(Ln.id, {
635
+ unitId: a.unitId,
636
+ subUnitId: a.subUnitId,
637
+ selections: [{ range: { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col } }]
638
+ }), D.show(), ie.setContextValue(Ct, !1);
639
+ const P = (E = X.getRenderById(N)) == null ? void 0 : E.with(ni), M = (R = Le.getTextRanges({ unitId: N, subUnitId: N })) == null ? void 0 : R[0];
640
+ P && M && (P.scrollToRange(M), Le.refreshSelection({ unitId: N, subUnitId: N }));
641
+ }
642
+ S.disableForceKeepVisible(), i(!1);
643
+ }
644
+ },
645
+ onFocusChange: (h) => Wt(h)
646
+ }
647
+ ) }),
648
+ u === C.SHEET && /* @__PURE__ */ v(ve, { error: ge && !l ? d.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ v(
649
+ yt,
650
+ {
651
+ options: mt,
652
+ value: l,
653
+ onChange: (h) => {
654
+ var P, M;
655
+ g(h);
656
+ const E = (P = mt.find((F) => F.value === h)) == null ? void 0 : P.label, R = (M = mt.find((F) => F.value === l)) == null ? void 0 : M.label;
657
+ E && (x.current || !r || r === R) && (J(E), x.current = !0);
658
+ }
659
+ }
660
+ ) }),
661
+ u === C.DEFINE_NAME && /* @__PURE__ */ v(ve, { error: ge && !l ? d.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ v(
662
+ yt,
663
+ {
664
+ options: vt,
665
+ value: l,
666
+ onChange: (h) => {
667
+ var P, M;
668
+ g(h);
669
+ const E = (P = vt.find((F) => F.value === h)) == null ? void 0 : P.label, R = (M = vt.find((F) => F.value === l)) == null ? void 0 : M.label;
670
+ E && (x.current || !r || r === R) && (J(E), x.current = !0);
671
+ }
672
+ }
673
+ ) }),
674
+ ($e == null ? void 0 : $e.Form) && /* @__PURE__ */ v(
675
+ $e.Form,
676
+ {
677
+ linkId: t,
678
+ payload: l,
679
+ display: r,
680
+ showError: ge,
681
+ setByPayload: x,
682
+ setDisplay: (h) => {
683
+ J(h), x.current = !0;
684
+ },
685
+ setPayload: g
686
+ }
687
+ ),
688
+ /* @__PURE__ */ Se("div", { className: vn.cellLinkEditButtons, children: [
689
+ /* @__PURE__ */ v(
690
+ dn,
691
+ {
692
+ onClick: () => {
693
+ a && U.navigateToRange(a.unitId, a.subUnitId, { startRow: a.row, endRow: a.row, startColumn: a.col, endColumn: a.col }, !0), T.executeCommand(Je.id);
694
+ },
695
+ children: d.t("hyperLink.form.cancel")
696
+ }
697
+ ),
698
+ /* @__PURE__ */ v(
699
+ dn,
700
+ {
701
+ type: "primary",
702
+ style: { marginLeft: 8 },
703
+ onClick: async () => {
704
+ ft();
705
+ },
706
+ children: d.t("hyperLink.form.ok")
707
+ }
708
+ )
709
+ ] })
710
+ ] }) : null;
711
+ };
712
+ Xe.componentKey = "univer.sheet.cell-link-edit";
713
+ var V = function() {
714
+ return V = Object.assign || function(t) {
715
+ for (var e, n = 1, i = arguments.length; n < i; n++) {
716
+ e = arguments[n];
717
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
718
+ }
719
+ return t;
720
+ }, V.apply(this, arguments);
721
+ }, Ei = function(t, e) {
722
+ var n = {};
723
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
724
+ if (t != null && typeof Object.getOwnPropertySymbols == "function")
725
+ for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
726
+ e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
727
+ return n;
728
+ }, pe = ue(function(t, e) {
729
+ var n = t.icon, i = t.id, r = t.className, o = t.extend, s = Ei(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), u = Un("_".concat(Pi()));
730
+ return Dn(n, "".concat(i), { defIds: n.defIds, idSuffix: u.current }, V({ ref: e, className: c }, s), o);
731
+ });
732
+ function Dn(t, e, n, i, r) {
733
+ return de(t.tag, V(V({ key: e }, Ri(t, n, r)), i), (Li(t, n).children || []).map(function(o, s) {
734
+ return Dn(o, "".concat(e, "-").concat(t.tag, "-").concat(s), n, void 0, r);
735
+ }));
736
+ }
737
+ function Ri(t, e, n) {
738
+ var i = V({}, t.attrs);
739
+ n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(function(o) {
740
+ var s = o[0], c = o[1];
741
+ s === "mask" && typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
742
+ });
743
+ var r = e.defIds;
744
+ return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(o) {
745
+ var s = o[0], c = o[1];
746
+ typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
747
+ })), i;
748
+ }
749
+ function Li(t, e) {
750
+ var n, i = e.defIds;
751
+ return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? V(V({}, t), { children: t.children.map(function(r) {
752
+ return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? V(V({}, r), { attrs: V(V({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
753
+ }) }) : t;
754
+ }
755
+ function Pi() {
756
+ return Math.random().toString(36).substring(2, 8);
757
+ }
758
+ pe.displayName = "UniverIcon";
759
+ var ki = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.9999 1.12915C8.03875 1.12915 8.07673 1.13284 8.11352 1.13989H12.2599C13.6958 1.13989 14.8599 2.30395 14.8599 3.73989V7.88619C14.867 7.92301 14.8707 7.96102 14.8707 7.9999C14.8707 8.03878 14.867 8.0768 14.8599 8.11362V12.2599C14.8599 13.6958 13.6958 14.8599 12.2599 14.8599H8.11362C8.0768 14.867 8.03878 14.8707 7.9999 14.8707C7.96102 14.8707 7.92301 14.867 7.88619 14.8599H3.73989C2.30396 14.8599 1.13989 13.6958 1.13989 12.2599V8.11352C1.13284 8.07673 1.12915 8.03875 1.12915 7.9999C1.12915 7.96106 1.13284 7.92308 1.13989 7.88629V3.73989C1.13989 2.30396 2.30395 1.13989 3.73989 1.13989H7.88629C7.92308 1.13284 7.96106 1.12915 7.9999 1.12915ZM2.33989 8.5999V12.2599C2.33989 13.0331 2.9667 13.6599 3.73989 13.6599H7.3999V8.5999H2.33989ZM7.3999 7.3999H2.33989V3.73989C2.33989 2.9667 2.96669 2.33989 3.73989 2.33989H7.3999V7.3999ZM8.5999 8.5999V13.6599H12.2599C13.0331 13.6599 13.6599 13.0331 13.6599 12.2599V8.5999H8.5999ZM13.6599 7.3999H8.5999V2.33989H12.2599C13.0331 2.33989 13.6599 2.96669 13.6599 3.73989V7.3999Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ge = ue(function(t, e) {
760
+ return de(pe, Object.assign({}, t, {
761
+ id: "all-border-single",
762
+ ref: e,
763
+ icon: ki
764
+ }));
765
+ });
766
+ Ge.displayName = "AllBorderSingle";
767
+ var bi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M4.1302 12.4251C4.25802 13.7417 5.36779 14.7708 6.71792 14.7708H11.7179C13.1539 14.7708 14.3179 13.6067 14.3179 12.1708V6.1708C14.3179 4.78586 13.2351 3.65383 11.8698 3.57517C11.742 2.25858 10.6323 1.22949 9.28213 1.22949H4.28213C2.84619 1.22949 1.68213 2.39355 1.68213 3.82949V9.82949C1.68213 11.2144 2.76497 12.3465 4.1302 12.4251ZM10.6583 3.5708H6.71792C5.28198 3.5708 4.11792 4.73486 4.11792 6.1708V11.22C3.4221 11.1387 2.88213 10.5471 2.88213 9.82949V3.82949C2.88213 3.05629 3.50893 2.42949 4.28213 2.42949H9.28213C9.96695 2.42949 10.5369 2.92119 10.6583 3.5708ZM13.1179 6.1708C13.1179 5.3976 12.4911 4.7708 11.7179 4.7708H6.71792C5.94472 4.7708 5.31792 5.3976 5.31792 6.1708V12.1708C5.31792 12.944 5.94472 13.5708 6.71792 13.5708H11.7179C12.4911 13.5708 13.1179 12.944 13.1179 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vn = ue(function(t, e) {
768
+ return de(pe, Object.assign({}, t, {
769
+ id: "copy-single",
770
+ ref: e,
771
+ icon: bi
772
+ }));
773
+ });
774
+ Vn.displayName = "CopySingle";
775
+ var wi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.8816 1.97978C11.0177 0.843607 12.862 0.884962 14.0004 2.02342C15.1389 3.16188 15.1803 5.00612 14.0441 6.14228L11.399 8.78737C11.1608 9.02559 10.7746 9.02559 10.5363 8.78737C10.2981 8.54915 10.2981 8.16292 10.5363 7.9247L13.1814 5.2796C13.8195 4.64155 13.8217 3.57006 13.1378 2.8861C12.4538 2.20211 11.3823 2.20438 10.7443 2.84245L7.6976 5.88911L7.69317 5.89349C7.05959 6.53211 7.05894 7.60014 7.74132 8.28252C7.97954 8.52074 7.97954 8.90697 7.74132 9.14519C7.5031 9.38341 7.11687 9.38341 6.87865 9.14519C5.74016 8.00671 5.69884 6.16251 6.83497 5.02633L6.84021 5.02116L9.8816 1.97978Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.61426 7.2364C4.85248 6.99818 5.23871 6.99818 5.47693 7.2364C5.71515 7.47462 5.71515 7.86085 5.47693 8.09907L2.83183 10.7442C2.19375 11.3823 2.1915 12.4537 2.87547 13.1377C3.55945 13.8217 4.6309 13.8194 5.26899 13.1813L8.31566 10.1347C8.32262 10.1277 8.32971 10.121 8.33691 10.1144C8.34408 10.1064 8.3515 10.0986 8.35916 10.091C8.99721 9.45291 8.99949 8.38145 8.3155 7.69746C8.07728 7.45924 8.07728 7.07301 8.3155 6.83479C8.55372 6.59657 8.93995 6.59657 9.17817 6.83479C10.3166 7.97327 10.358 9.81748 9.22183 10.9536C9.21487 10.9606 9.20779 10.9673 9.20058 10.9739C9.19341 10.9819 9.18599 10.9897 9.17833 10.9973L6.13166 14.044C4.99548 15.1802 3.15127 15.1389 2.01279 14.0004C0.874362 12.8619 0.83297 11.0177 1.96916 9.8815L4.61426 7.2364Z" } }] }, Vt = ue(function(t, e) {
776
+ return de(pe, Object.assign({}, t, {
777
+ id: "link-single",
778
+ ref: e,
779
+ icon: wi
780
+ }));
781
+ });
782
+ Vt.displayName = "LinkSingle";
783
+ var Ti = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.5935 3.47302C11.6354 2.51492 10.082 2.51492 9.12388 3.47302L7.83534 4.76157C7.60102 4.99588 7.22112 4.99588 6.98681 4.76157 6.75249 4.52725 6.75249 4.14735 6.98681 3.91304L8.27535 2.62449C9.70209 1.19776 12.0153 1.19776 13.442 2.62449 14.8688 4.05123 14.8688 6.36442 13.442 7.79116L12.1535 9.0797C11.9192 9.31402 11.5393 9.31402 11.3049 9.0797 11.0706 8.84539 11.0706 8.46549 11.3049 8.23117L12.5935 6.94263C13.5516 5.98452 13.5516 4.43113 12.5935 3.47302zM3.40637 12.6606C2.44827 11.7025 2.44827 10.1491 3.40637 9.19102L4.69492 7.90248C4.92923 7.66816 4.92923 7.28826 4.69492 7.05395 4.4606 6.81963 4.0807 6.81963 3.84639 7.05395L2.55784 8.34249C1.13111 9.76923 1.13111 12.0824 2.55784 13.5092 3.98458 14.9359 6.29777 14.9359 7.72451 13.5092L9.01305 12.2206C9.24737 11.9863 9.24737 11.6064 9.01305 11.3721 8.77874 11.1378 8.39884 11.1378 8.16452 11.3721L6.87598 12.6606C5.91787 13.6187 4.36448 13.6187 3.40637 12.6606zM3.5852 2.80332C3.35088 2.569 2.97098 2.569 2.73667 2.80332 2.50235 3.03763 2.50235 3.41753 2.73667 3.65185L12.4151 13.3302C12.6494 13.5646 13.0293 13.5646 13.2636 13.3302 13.4979 13.0959 13.4979 12.716 13.2636 12.4817L3.5852 2.80332z" } }] }, An = ue(function(t, e) {
784
+ return de(pe, Object.assign({}, t, {
785
+ id: "unlink-single",
786
+ ref: e,
787
+ icon: Ti
788
+ }));
789
+ });
790
+ An.displayName = "UnlinkSingle";
791
+ var Oi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.6551 1.98906C11.7476 1.08113 10.2757 1.08149 9.3686 1.98987L4.82542 6.53955C4.75087 6.61421 4.69336 6.70411 4.65682 6.80309L3.2461 10.625C3.16506 10.8446 3.21909 11.0912 3.3845 11.2568C3.54991 11.4224 3.79651 11.4767 4.01616 11.3959L7.85031 9.98517C7.94979 9.94856 8.04014 9.89077 8.11508 9.81579L12.6552 5.27327C13.5618 4.36621 13.5618 2.89607 12.6551 1.98906ZM10.2177 2.83779C10.6562 2.39869 11.3677 2.39851 11.8064 2.8374C12.2447 3.27584 12.2447 3.9865 11.8065 4.42497L7.3392 8.89457L4.82213 9.82068L5.74706 7.31487L10.2177 2.83779Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.79238 13.2999C1.46101 13.2999 1.19238 13.5685 1.19238 13.8999C1.19238 14.2313 1.46101 14.4999 1.79238 14.4999H14.4924C14.8238 14.4999 15.0924 14.2313 15.0924 13.8999C15.0924 13.5685 14.8238 13.2999 14.4924 13.2999H1.79238Z" } }] }, $n = ue(function(t, e) {
792
+ return de(pe, Object.assign({}, t, {
793
+ id: "write-single",
794
+ ref: e,
795
+ icon: Oi
796
+ }));
797
+ });
798
+ $n.displayName = "WriteSingle";
799
+ var Ni = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.4538 1.12549C2.70051 1.12549 2.08984 1.73615 2.08984 2.48945V13.5104C2.08984 14.2637 2.70051 14.8744 3.4538 14.8744H12.5468C13.3001 14.8744 13.9108 14.2637 13.9108 13.5104V5.0992L10.0094 1.12549H3.4538Z" } }, { tag: "path", attrs: { fill: "colorChannel1", d: "M10.0078 1.12549L13.9107 5.09842H10.6745C10.3063 5.09842 10.0078 4.79994 10.0078 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.80941 10.2949L6.37701 12.403C6.2632 12.5705 6.03516 12.614 5.86766 12.5002C5.70017 12.3864 5.65664 12.1584 5.77045 11.9909L7.36611 9.64252L5.94103 7.54519C5.82722 7.37769 5.87074 7.14964 6.03824 7.03583C6.20573 6.92202 6.43378 6.96555 6.54759 7.13304L7.80941 8.9901L9.07123 7.13304C9.18504 6.96555 9.41309 6.92202 9.58059 7.03583C9.74808 7.14964 9.7916 7.37769 9.67779 7.54519L8.25271 9.64252L9.84837 11.9909C9.96218 12.1584 9.91866 12.3864 9.75116 12.5002C9.58366 12.614 9.35562 12.5705 9.24181 12.403L7.80941 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Bn = ue(function(t, e) {
800
+ return de(pe, Object.assign({}, t, {
801
+ id: "xlsx",
802
+ ref: e,
803
+ icon: Ni
804
+ }));
805
+ });
806
+ Bn.displayName = "Xlsx";
807
+ const Mi = "univer-cell-link", Ui = "univer-cell-link-type", Hi = "univer-cell-link-content", xi = "univer-cell-link-content-error", Di = "univer-cell-link-url", Vi = "univer-cell-link-operations", Ai = "univer-cell-link-operation", $i = "univer-cell-link-operation-error", j = {
808
+ cellLink: Mi,
809
+ cellLinkType: Ui,
810
+ cellLinkContent: Hi,
811
+ cellLinkContentError: xi,
812
+ cellLinkUrl: Di,
813
+ cellLinkOperations: Vi,
814
+ cellLinkOperation: Ai,
815
+ cellLinkOperationError: $i
816
+ }, Bi = {
817
+ [C.URL]: /* @__PURE__ */ v(Vt, {}),
818
+ [C.SHEET]: /* @__PURE__ */ v(Bn, {}),
819
+ [C.RANGE]: /* @__PURE__ */ v(Ge, {}),
820
+ [C.DEFINE_NAME]: /* @__PURE__ */ v(Ge, {}),
821
+ [C.INVALID]: /* @__PURE__ */ v(Ge, {})
822
+ }, fn = (t) => {
823
+ var U, T;
824
+ const e = I(K), n = I(re), i = I(On), r = I(lt), o = I(le), s = I(ne), c = I(Ht), u = I(ht), { customRange: p, row: l, col: g, unitId: d, subUnitId: _, editPermission: S, copyPermission: f, type: k } = t;
825
+ if (!((U = p == null ? void 0 : p.properties) != null && U.url))
826
+ return null;
827
+ const a = c.parseHyperLink((T = p.properties.url) != null ? T : ""), b = a.type === C.INVALID;
828
+ return /* @__PURE__ */ Se("div", { className: j.cellLink, onClick: () => e.hideCurrentPopup(), children: [
829
+ /* @__PURE__ */ Se(
830
+ "div",
831
+ {
832
+ className: pn(j.cellLinkContent, { [j.cellLinkContentError]: b }),
833
+ onClick: () => {
834
+ u.visible || b || o.navigate(a);
835
+ },
836
+ children: [
837
+ /* @__PURE__ */ v("div", { className: j.cellLinkType, children: Bi[a.type] }),
838
+ /* @__PURE__ */ v(Fe, { showIfEllipsis: !0, title: a.name, asChild: !0, children: /* @__PURE__ */ v("span", { className: j.cellLinkUrl, children: a.name }) })
839
+ ]
840
+ }
841
+ ),
842
+ /* @__PURE__ */ Se("div", { className: j.cellLinkOperations, children: [
843
+ f && /* @__PURE__ */ v(
844
+ "div",
845
+ {
846
+ className: pn(j.cellLinkOperation, { [j.cellLinkOperationError]: b }),
847
+ onClick: () => {
848
+ if (!b) {
849
+ if (a.type !== C.URL) {
850
+ const L = new URL(window.location.href);
851
+ L.hash = a.url.slice(1), navigator.clipboard.writeText(L.href);
852
+ } else
853
+ navigator.clipboard.writeText(a.url);
854
+ i.show({
855
+ content: r.t("hyperLink.message.coped"),
856
+ type: Oe.Info
857
+ });
858
+ }
859
+ },
860
+ children: /* @__PURE__ */ v(Fe, { placement: "bottom", title: r.t("hyperLink.popup.copy"), children: /* @__PURE__ */ v(Vn, {}) })
861
+ }
862
+ ),
863
+ S && /* @__PURE__ */ Se(ui, { children: [
864
+ /* @__PURE__ */ v(
865
+ "div",
866
+ {
867
+ className: j.cellLinkOperation,
868
+ onClick: () => {
869
+ n.executeCommand($t.id, {
870
+ unitId: d,
871
+ subUnitId: _,
872
+ row: l,
873
+ col: g,
874
+ customRangeId: p.rangeId,
875
+ type: k
876
+ });
877
+ },
878
+ children: /* @__PURE__ */ v(Fe, { placement: "bottom", title: r.t("hyperLink.popup.edit"), children: /* @__PURE__ */ v($n, {}) })
879
+ }
880
+ ),
881
+ /* @__PURE__ */ v(
882
+ "div",
883
+ {
884
+ className: j.cellLinkOperation,
885
+ onClick: () => {
886
+ const L = k === m.EDITING || k === m.ZEN_EDITOR ? br.id : wr.id;
887
+ n.syncExecuteCommand(L, {
888
+ unitId: d,
889
+ subUnitId: _,
890
+ id: p.rangeId,
891
+ row: l,
892
+ column: g,
893
+ documentId: k === m.ZEN_EDITOR ? N : s.getCurrentEditorId()
894
+ }) && e.hideCurrentPopup(void 0, !0);
895
+ },
896
+ children: /* @__PURE__ */ v(Fe, { placement: "bottom", title: r.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ v(An, {}) })
897
+ }
898
+ )
899
+ ] })
900
+ ] })
901
+ ] });
902
+ }, qe = () => {
903
+ var r, o;
904
+ const t = I(K), [e, n] = G(null), i = I(Y);
905
+ if (te(() => {
906
+ n(t.currentPopup);
907
+ const s = t.currentPopup$.subscribe((c) => {
908
+ n(c);
909
+ });
910
+ return () => {
911
+ s.unsubscribe();
912
+ };
913
+ }, [t.currentPopup, t.currentPopup$]), !e)
914
+ return null;
915
+ if (e.showAll) {
916
+ const s = i.getUnit(e.unitId, w.UNIVER_SHEET), c = s == null ? void 0 : s.getSheetBySheetId(e.subUnitId), u = c == null ? void 0 : c.getCell(e.row, e.col), p = (o = (r = u == null ? void 0 : u.p) == null ? void 0 : r.body) == null ? void 0 : o.customRanges;
917
+ return p != null && p.length ? /* @__PURE__ */ v("div", { children: p.map((l) => /* @__PURE__ */ v(fn, { ...e, customRange: l }, l.rangeId)) }) : null;
918
+ }
919
+ return /* @__PURE__ */ v(fn, { ...e });
920
+ };
921
+ qe.componentKey = "univer.sheet.cell-link-popup";
922
+ var Fi = Object.getOwnPropertyDescriptor, Wi = (t, e, n, i) => {
923
+ for (var r = i > 1 ? void 0 : i ? Fi(e, n) : e, o = t.length - 1, s; o >= 0; o--)
924
+ (s = t[o]) && (r = s(r) || r);
925
+ return r;
926
+ }, se = (t, e) => (n, i) => e(n, i, t);
927
+ const _n = (t, e) => {
928
+ var n, i;
929
+ return t.unitId === e.unitId && t.subUnitId === e.subUnitId && t.row === e.row && t.col === e.col && ((n = t.customRange) == null ? void 0 : n.rangeId) === ((i = e.customRange) == null ? void 0 : i.rangeId) && t.type === e.type;
930
+ };
931
+ let K = class extends z {
932
+ constructor(e, n, i, r, o, s, c) {
933
+ super();
934
+ $(this, "_currentPopup", null);
935
+ $(this, "_currentPopup$", new si());
936
+ $(this, "currentPopup$", this._currentPopup$.asObservable());
937
+ $(this, "_currentEditingPopup", null);
938
+ $(this, "_currentEditing$", new ai(null));
939
+ $(this, "currentEditing$", this._currentEditing$.asObservable());
940
+ $(this, "_isKeepVisible", !1);
941
+ this._sheetCanvasPopManagerService = e, this._injector = n, this._univerInstanceService = i, this._editorBridgeService = r, this._textSelectionManagerService = o, this._docCanvasPopManagerService = s, this._zenZoneService = c, this.disposeWithMe(() => {
942
+ this.hideCurrentPopup(), this.endEditing(), this._currentEditing$.complete(), this._currentPopup$.complete();
943
+ });
944
+ }
945
+ get currentPopup() {
946
+ return this._currentPopup;
947
+ }
948
+ get currentEditing() {
949
+ return this._currentEditing$.getValue();
950
+ }
951
+ setIsKeepVisible(e) {
952
+ this._isKeepVisible = e;
953
+ }
954
+ getIsKeepVisible() {
955
+ return this._isKeepVisible;
956
+ }
957
+ showPopup(e) {
958
+ if (this._currentPopup && _n(e, this._currentPopup) || (this.hideCurrentPopup(void 0, !0), e.type !== m.ZEN_EDITOR && this._zenZoneService.visible))
959
+ return;
960
+ const n = this._currentEditing$.getValue();
961
+ if (n && _n(e, n))
962
+ return;
963
+ const { unitId: i, subUnitId: r, row: o, col: s, customRangeRect: c, customRange: u } = e;
964
+ let p;
965
+ const l = {
966
+ componentKey: qe.componentKey,
967
+ direction: "bottom",
968
+ onClickOutside: () => {
969
+ this.hideCurrentPopup();
970
+ },
971
+ onClick: () => {
972
+ this.hideCurrentPopup(e.type, !0);
973
+ }
974
+ };
975
+ if (e.type === m.EDITING) {
976
+ if (!u)
977
+ return;
978
+ p = c && this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
979
+ c,
980
+ l
981
+ );
982
+ } else if (e.type === m.ZEN_EDITOR) {
983
+ if (!u)
984
+ return;
985
+ p = this._docCanvasPopManagerService.attachPopupToRange(
986
+ {
987
+ startOffset: u.startIndex,
988
+ endOffset: u.endIndex + 1,
989
+ collapsed: !1
990
+ },
991
+ l,
992
+ N
993
+ );
994
+ } else if (e.showAll)
995
+ p = this._sheetCanvasPopManagerService.attachPopupToCell(e.row, e.col, l, i, r);
996
+ else {
997
+ if (!u)
998
+ return;
999
+ p = c && this._sheetCanvasPopManagerService.attachPopupByPosition(
1000
+ c,
1001
+ l,
1002
+ e
1003
+ );
1004
+ }
1005
+ p && (this._currentPopup = {
1006
+ unitId: i,
1007
+ subUnitId: r,
1008
+ disposable: p,
1009
+ row: o,
1010
+ col: s,
1011
+ editPermission: !!e.editPermission,
1012
+ copyPermission: !!e.copyPermission,
1013
+ customRange: u,
1014
+ type: e.type,
1015
+ showAll: e.showAll
1016
+ }, this._currentPopup$.next(this._currentPopup));
1017
+ }
1018
+ hideCurrentPopup(e, n) {
1019
+ var i, r;
1020
+ this._currentPopup && ((!e || e === this._currentPopup.type) && this._currentPopup.disposable.canDispose() || n) && ((r = (i = this._currentPopup) == null ? void 0 : i.disposable) == null || r.dispose(), this._currentPopup = null, this._currentPopup$.next(null));
1021
+ }
1022
+ _getEditingRange() {
1023
+ var i, r, o;
1024
+ const e = this._editorBridgeService.isVisible().visible, n = this._editorBridgeService.getEditCellState();
1025
+ if (e && n) {
1026
+ const s = this._textSelectionManagerService.getActiveTextRange(), c = (i = n.documentLayoutObject.documentModel) == null ? void 0 : i.getBody();
1027
+ if (!c)
1028
+ return null;
1029
+ if (!s || s.collapsed)
1030
+ return {
1031
+ startOffset: 0,
1032
+ endOffset: c.dataStream.length - 2,
1033
+ collapsed: c.dataStream.length - 2 === 0,
1034
+ label: _e.transform.getPlainText(c.dataStream)
1035
+ };
1036
+ const u = _e.customRange.getCustomRangesInterestsWithSelection(s, (o = (r = c.customRanges) == null ? void 0 : r.filter((g) => g.rangeType === Ke.HYPERLINK)) != null ? o : []);
1037
+ let p = s.startOffset, l = s.endOffset;
1038
+ return u.forEach((g) => {
1039
+ p = Math.min(p, g.startIndex), l = Math.max(l, g.endIndex + 1);
1040
+ }), {
1041
+ startOffset: p,
1042
+ endOffset: l,
1043
+ collapsed: p === l,
1044
+ label: _e.transform.getPlainText(c.dataStream.slice(p, l))
1045
+ };
1046
+ }
1047
+ return null;
1048
+ }
1049
+ get _editPopup() {
1050
+ return {
1051
+ componentKey: Xe.componentKey,
1052
+ direction: "vertical",
1053
+ onClickOutside: () => {
1054
+ this.endEditing();
1055
+ },
1056
+ onContextMenu: () => {
1057
+ this.endEditing();
1058
+ },
1059
+ hiddenType: "hide"
1060
+ };
1061
+ }
1062
+ startAddEditing(e) {
1063
+ var o, s, c, u, p;
1064
+ const { unitId: n, subUnitId: i, type: r } = e;
1065
+ if (r === m.ZEN_EDITOR) {
1066
+ const l = this._univerInstanceService.getUnit(N, w.UNIVER_DOC);
1067
+ if (!l)
1068
+ return;
1069
+ const g = this._textSelectionManagerService.getActiveTextRange();
1070
+ if (!g)
1071
+ return;
1072
+ this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(
1073
+ g,
1074
+ this._editPopup,
1075
+ N
1076
+ );
1077
+ const d = (o = l.getBody()) == null ? void 0 : o.dataStream.slice(g.startOffset, g.endOffset);
1078
+ this._currentEditing$.next({
1079
+ ...e,
1080
+ label: d
1081
+ });
1082
+ } else if (r === m.EDITING) {
1083
+ const l = this._getEditingRange();
1084
+ if (!l)
1085
+ return;
1086
+ this._textSelectionManagerService.replaceDocRanges([{ ...l }], { unitId: Ie, subUnitId: Ie });
1087
+ const g = this._injector.get(De).getRenderById(Ie);
1088
+ if (!g)
1089
+ return;
1090
+ const d = ii(l, g);
1091
+ if (!(d != null && d.length))
1092
+ return;
1093
+ this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
1094
+ d.pop(),
1095
+ this._editPopup,
1096
+ n,
1097
+ i
1098
+ ), this._currentEditing$.next({
1099
+ ...e,
1100
+ label: (s = l == null ? void 0 : l.label) != null ? s : ""
1101
+ });
1102
+ } else {
1103
+ this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(
1104
+ e.row,
1105
+ e.col,
1106
+ this._editPopup,
1107
+ n,
1108
+ i
1109
+ );
1110
+ const l = this._univerInstanceService.getUnit(n, w.UNIVER_SHEET), g = l == null ? void 0 : l.getSheetBySheetId(i), d = g == null ? void 0 : g.getCellRaw(e.row, e.col);
1111
+ this._currentEditing$.next({
1112
+ ...e,
1113
+ label: d != null && d.p ? _e.transform.getPlainText((u = (c = d.p.body) == null ? void 0 : c.dataStream) != null ? u : "") : ((p = d == null ? void 0 : d.v) != null ? p : "").toString()
1114
+ });
1115
+ }
1116
+ }
1117
+ // eslint-disable-next-line complexity, max-lines-per-function
1118
+ startEditing(e) {
1119
+ var s, c, u, p, l, g;
1120
+ (s = this._currentEditingPopup) == null || s.dispose(), this.hideCurrentPopup(void 0, !0);
1121
+ const { unitId: n, subUnitId: i } = e;
1122
+ let r, o;
1123
+ if (e.type === m.ZEN_EDITOR) {
1124
+ const d = this._univerInstanceService.getUnit(N, w.UNIVER_DOC);
1125
+ if (r = (u = (c = d == null ? void 0 : d.getBody()) == null ? void 0 : c.customRanges) == null ? void 0 : u.find((_) => _.rangeId === e.customRangeId), o = r ? (p = d == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(r.startIndex, r.endIndex + 1) : "", !r || !o)
1126
+ return;
1127
+ this._textSelectionManagerService.replaceTextRanges([
1128
+ {
1129
+ startOffset: r.startIndex,
1130
+ endOffset: r.endIndex + 1
1131
+ }
1132
+ ]), this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(
1133
+ {
1134
+ startOffset: r.startIndex,
1135
+ endOffset: r.endIndex,
1136
+ collapsed: !1
1137
+ },
1138
+ this._editPopup,
1139
+ N
1140
+ );
1141
+ } else if (e.type === m.EDITING) {
1142
+ const d = xr(this._injector, e.unitId, e.subUnitId, e.row, e.col, e.customRangeId);
1143
+ if (!d || !((l = d.rects) != null && l.length))
1144
+ return;
1145
+ r = d.customRange, o = d.label, this._textSelectionManagerService.replaceTextRanges([
1146
+ {
1147
+ startOffset: r.startIndex,
1148
+ endOffset: r.endIndex + 1
1149
+ }
1150
+ ]), this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToAbsolutePosition(
1151
+ d.rects.pop(),
1152
+ this._editPopup,
1153
+ n,
1154
+ i
1155
+ );
1156
+ } else {
1157
+ const d = this._univerInstanceService.getUnit(n, w.UNIVER_SHEET), _ = d == null ? void 0 : d.getSheetBySheetId(i), S = _ == null ? void 0 : _.getCellRaw(e.row, e.col), f = d == null ? void 0 : d.getStyles().getStyleByCell(S), k = f == null ? void 0 : f.tr, a = Dr(this._injector, e.unitId, e.subUnitId, e.row, e.col, e.customRangeId);
1158
+ if (!a || !((g = a.rects) != null && g.length))
1159
+ return;
1160
+ r = a.customRange, o = a.label, k ? this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupToCell(
1161
+ e.row,
1162
+ e.col,
1163
+ this._editPopup,
1164
+ n,
1165
+ i
1166
+ ) : this._currentEditingPopup = this._sheetCanvasPopManagerService.attachPopupByPosition(
1167
+ a.rects.pop(),
1168
+ this._editPopup,
1169
+ {
1170
+ unitId: n,
1171
+ subUnitId: i,
1172
+ row: e.row,
1173
+ col: e.col
1174
+ }
1175
+ );
1176
+ }
1177
+ this._currentEditing$.next({
1178
+ ...e,
1179
+ customRange: r,
1180
+ label: o
1181
+ });
1182
+ }
1183
+ endEditing(e) {
1184
+ var i;
1185
+ if (this.getIsKeepVisible())
1186
+ return;
1187
+ const n = this._currentEditing$.getValue();
1188
+ n && (!e || e === n.type) && ((i = this._currentEditingPopup) == null || i.dispose(), this._currentEditing$.next(null));
1189
+ }
1190
+ };
1191
+ K = Wi([
1192
+ se(0, y(Hr)),
1193
+ se(1, y(ut)),
1194
+ se(2, Y),
1195
+ se(3, ne),
1196
+ se(4, y(xe)),
1197
+ se(5, y(ri)),
1198
+ se(6, ht)
1199
+ ], K);
1200
+ var Ne = /* @__PURE__ */ ((t) => (t[t.ALLOWED = 0] = "ALLOWED", t[t.DISABLED_BY_CELL = 1] = "DISABLED_BY_CELL", t[t.ALLOW_ON_EDITING = 2] = "ALLOW_ON_EDITING", t))(Ne || {});
1201
+ const ji = /* @__PURE__ */ new Set([
1202
+ It.CHECKBOX,
1203
+ It.LIST,
1204
+ It.LIST_MULTIPLE
1205
+ ]), At = (t, e, n, i) => {
1206
+ var c, u, p, l, g;
1207
+ const r = e.getCell(n, i);
1208
+ if (r != null && r.f || r != null && r.si || (p = (u = (c = r == null ? void 0 : r.p) == null ? void 0 : c.body) == null ? void 0 : u.customBlocks) != null && p.length)
1209
+ return 1;
1210
+ const o = t.has(gn) ? t.get(gn) : null, s = o == null ? void 0 : o.getRuleByLocation(e.getUnitId(), e.getSheetId(), n, i);
1211
+ return s && ji.has(s.type) ? !0 : (g = (l = r == null ? void 0 : r.p) == null ? void 0 : l.drawingsOrder) != null && g.length ? 2 : 0;
1212
+ }, Zi = (t) => {
1213
+ const e = t.get(Y).getCurrentUnitForType(w.UNIVER_SHEET);
1214
+ if (!e)
1215
+ return !0;
1216
+ const n = e.getActiveSheet(), i = t.get(wt).getCurrentSelections();
1217
+ if (!i.length)
1218
+ return !0;
1219
+ const r = i[0].range.startRow, o = i[0].range.startColumn;
1220
+ return At(t, n, r, o) === 1;
1221
+ }, Gi = (t) => {
1222
+ const e = t.get(xe), n = t.get(Y), i = e.getTextRanges();
1223
+ if (!(i != null && i.length))
1224
+ return !0;
1225
+ const r = n.getCurrentUnitForType(w.UNIVER_DOC);
1226
+ return !!(!r || i.every((s) => s.collapsed) || !r.getSelfOrHeaderFooterModel(i[0].segmentId).getBody());
1227
+ }, $t = {
1228
+ type: dt.OPERATION,
1229
+ id: "sheet.operation.open-hyper-link-edit-panel",
1230
+ handler(t, e) {
1231
+ if (!e)
1232
+ return !1;
1233
+ const n = t.get(K);
1234
+ return e.customRangeId ? n.startEditing(e) : n.startAddEditing(e), !0;
1235
+ }
1236
+ }, Je = {
1237
+ type: dt.OPERATION,
1238
+ id: "sheet.operation.close-hyper-link-popup",
1239
+ handler(t) {
1240
+ return t.get(K).endEditing(), !0;
1241
+ }
1242
+ }, Bt = {
1243
+ type: dt.OPERATION,
1244
+ id: "sheet.operation.insert-hyper-link",
1245
+ handler(t) {
1246
+ var g;
1247
+ const e = t.get(Y), n = Tt(e), i = t.get(ne);
1248
+ if (!n)
1249
+ return !1;
1250
+ const r = t.get(re), s = t.get(wt).getCurrentLastSelection();
1251
+ if (!s)
1252
+ return !1;
1253
+ const c = s.range.startRow, u = s.range.startColumn, p = i.isVisible(), l = ((g = e.getFocusedUnit()) == null ? void 0 : g.getUnitId()) === N;
1254
+ return r.executeCommand($t.id, {
1255
+ unitId: n.unitId,
1256
+ subUnitId: n.subUnitId,
1257
+ row: c,
1258
+ col: u,
1259
+ type: l ? m.ZEN_EDITOR : p.visible ? m.EDITING : m.VIEWING
1260
+ });
1261
+ }
1262
+ }, ce = {
1263
+ type: dt.OPERATION,
1264
+ id: "sheet.operation.insert-hyper-link-toolbar",
1265
+ handler(t) {
1266
+ if (Zi(t))
1267
+ return !1;
1268
+ const e = t.get(re);
1269
+ return t.get(K).currentEditing ? e.executeCommand(Je.id) : e.executeCommand(Bt.id);
1270
+ }
1271
+ }, Ft = (t, e = N) => {
1272
+ var r;
1273
+ const n = t.get(Y), i = (r = t.get(De).getRenderById(e)) == null ? void 0 : r.with(Mn);
1274
+ return i ? i.textSelectionInner$.pipe(xt(() => {
1275
+ const s = t.get(ne).getEditCellState();
1276
+ if (!s)
1277
+ return !0;
1278
+ const c = Tt(n, { unitId: s.unitId, subUnitId: s.sheetId });
1279
+ return !(c != null && c.worksheet) || At(t, c.worksheet, s.row, s.column) === 1 ? !0 : Gi(t);
1280
+ })) : ae(!0);
1281
+ }, Fn = (t) => {
1282
+ var o;
1283
+ const e = Ar(t, { workbookTypes: [Ut], worksheetTypes: [Nt, kn, Mt], rangeTypes: [Ot] }, !0), n = t.get(Y), i = t.has(ne) ? t.get(ne) : null;
1284
+ return ((o = i == null ? void 0 : i.currentEditCellState$.pipe(
1285
+ xt((s) => {
1286
+ if (!s)
1287
+ return Ne.DISABLED_BY_CELL;
1288
+ const c = Tt(n, { unitId: s.unitId, subUnitId: s.sheetId });
1289
+ return c ? At(t, c.worksheet, s.row, s.column) : Ne.DISABLED_BY_CELL;
1290
+ }),
1291
+ He((s) => {
1292
+ if (s === Ne.DISABLED_BY_CELL)
1293
+ return ae(!0);
1294
+ const c = i ? i.visible$ : ae(null);
1295
+ return ci([c, n.getCurrentTypeOfUnit$(w.UNIVER_DOC)]).pipe(
1296
+ He(
1297
+ ([u, p]) => u != null && u.visible ? (p == null ? void 0 : p.getUnitId()) === sr ? ae(!0) : Ft(t, Ie) : ae(s !== Ne.ALLOWED)
1298
+ )
1299
+ );
1300
+ })
1301
+ )) != null ? o : ae(!0)).pipe(
1302
+ He((s) => s ? ae(!0) : e)
1303
+ );
1304
+ }, Qe = {
1305
+ commandId: Bt.id,
1306
+ type: Nn.BUTTON,
1307
+ title: "hyperLink.menu.add",
1308
+ icon: "LinkSingle"
1309
+ }, et = (t) => `${t}-zen-editor`, Ki = (t) => ({
1310
+ ...Qe,
1311
+ id: Qe.commandId,
1312
+ hidden$: gt(t, w.UNIVER_SHEET),
1313
+ disabled$: Fn(t)
1314
+ // disabled$: getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })),
1315
+ }), Yi = (t) => ({
1316
+ ...Qe,
1317
+ id: et(Qe.commandId),
1318
+ hidden$: gt(t, w.UNIVER_DOC, N),
1319
+ disabled$: Ft(t)
1320
+ }), tt = {
1321
+ tooltip: "hyperLink.form.addTitle",
1322
+ commandId: ce.id,
1323
+ type: Nn.BUTTON,
1324
+ icon: "LinkSingle"
1325
+ }, zi = (t) => ({
1326
+ ...tt,
1327
+ id: tt.commandId,
1328
+ hidden$: gt(t, w.UNIVER_SHEET),
1329
+ disabled$: Fn(t)
1330
+ }), Xi = (t) => ({
1331
+ ...tt,
1332
+ id: et(tt.commandId),
1333
+ hidden$: gt(t, w.UNIVER_DOC, N),
1334
+ disabled$: Ft(t)
1335
+ }), Wn = {
1336
+ id: ce.id,
1337
+ binding: Pt.K | zr.CTRL_COMMAND,
1338
+ preconditions: Vr
1339
+ };
1340
+ var qi = Object.getOwnPropertyDescriptor, Ji = (t, e, n, i) => {
1341
+ for (var r = i > 1 ? void 0 : i ? qi(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1342
+ (s = t[o]) && (r = s(r) || r);
1343
+ return r;
1344
+ }, Sn = (t, e) => (n, i) => e(n, i, t);
1345
+ let nt = class extends z {
1346
+ constructor(t, e) {
1347
+ super(), this._autoFillService = t, this._hyperLinkModel = e, this._initAutoFill();
1348
+ }
1349
+ // eslint-disable-next-line max-lines-per-function
1350
+ _initAutoFill() {
1351
+ const t = () => ({ redos: [], undos: [] }), e = (i, r) => {
1352
+ const { source: o, target: s, unitId: c, subUnitId: u } = i, p = Lt([o, s]), [l, g] = p.ranges, { mapFunc: d } = p, _ = {
1353
+ row: l.startRow,
1354
+ col: l.startColumn
1355
+ }, S = Br(l, g), f = [], k = [];
1356
+ return S.forEach((a) => {
1357
+ const b = a.repeatStartCell, U = a.relativeRange, T = {
1358
+ startRow: _.row,
1359
+ startColumn: _.col,
1360
+ endColumn: _.col,
1361
+ endRow: _.row
1362
+ }, L = {
1363
+ startRow: b.row,
1364
+ startColumn: b.col,
1365
+ endColumn: b.col,
1366
+ endRow: b.row
1367
+ };
1368
+ Rn.foreach(U, (A, D) => {
1369
+ const X = ye.getPositionRange(
1370
+ {
1371
+ startRow: A,
1372
+ startColumn: D,
1373
+ endColumn: D,
1374
+ endRow: A
1375
+ },
1376
+ T
1377
+ ), { row: Ee, col: Ve } = d(X.startRow, X.startColumn), ie = this._hyperLinkModel.getHyperLinkByLocation(c, u, Ee, Ve), Re = ye.getPositionRange(
1378
+ {
1379
+ startRow: A,
1380
+ startColumn: D,
1381
+ endColumn: D,
1382
+ endRow: A
1383
+ },
1384
+ L
1385
+ ), { row: Le, col: Pe } = d(Re.startRow, Re.startColumn), Ae = Ce.generateRandomId(), he = this._hyperLinkModel.getHyperLinkByLocation(c, u, Le, Pe);
1386
+ he && f.push({
1387
+ id: Me.id,
1388
+ params: {
1389
+ unitId: c,
1390
+ subUnitId: u,
1391
+ id: he.id
1392
+ }
1393
+ }), (we.COPY === r || we.SERIES === r) && ie && (f.push({
1394
+ id: Ue.id,
1395
+ params: {
1396
+ unitId: c,
1397
+ subUnitId: u,
1398
+ link: {
1399
+ ...ie,
1400
+ id: Ae,
1401
+ row: Le,
1402
+ column: Pe
1403
+ }
1404
+ }
1405
+ }), k.push({
1406
+ id: Me.id,
1407
+ params: {
1408
+ unitId: c,
1409
+ subUnitId: u,
1410
+ id: Ae
1411
+ }
1412
+ })), he && k.push({
1413
+ id: Ue.id,
1414
+ params: {
1415
+ unitId: c,
1416
+ subUnitId: u,
1417
+ link: he
1418
+ }
1419
+ });
1420
+ });
1421
+ }), {
1422
+ undos: k,
1423
+ redos: f
1424
+ };
1425
+ }, n = {
1426
+ id: Dt,
1427
+ onFillData: (i, r, o) => o === we.COPY || o === we.ONLY_FORMAT || o === we.SERIES ? e(i, o) : t()
1428
+ };
1429
+ this.disposeWithMe(this._autoFillService.addHook(n));
1430
+ }
1431
+ };
1432
+ nt = Ji([
1433
+ Sn(0, $r),
1434
+ Sn(1, y(pt))
1435
+ ], nt);
1436
+ var Qi = Object.getOwnPropertyDescriptor, eo = (t, e, n, i) => {
1437
+ for (var r = i > 1 ? void 0 : i ? Qi(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1438
+ (s = t[o]) && (r = s(r) || r);
1439
+ return r;
1440
+ }, Rt = (t, e) => (n, i) => e(n, i, t);
1441
+ let rt = class extends z {
1442
+ constructor(t, e, n) {
1443
+ super(), this._localeService = t, this._commandService = e, this._sheetPermissionCheckController = n, this._commandExecutedListener();
1444
+ }
1445
+ _commandExecutedListener() {
1446
+ this.disposeWithMe(
1447
+ this._commandService.beforeCommandExecuted((t) => {
1448
+ t.id === Wn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
1449
+ workbookTypes: [Ut],
1450
+ rangeTypes: [Ot],
1451
+ worksheetTypes: [Nt, kn, Mt]
1452
+ }) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.hyperLinkErr")));
1453
+ })
1454
+ );
1455
+ }
1456
+ };
1457
+ rt = eo([
1458
+ Rt(0, y(lt)),
1459
+ Rt(1, re),
1460
+ Rt(2, y(bn))
1461
+ ], rt);
1462
+ var to = Object.getOwnPropertyDescriptor, no = (t, e, n, i) => {
1463
+ for (var r = i > 1 ? void 0 : i ? to(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1464
+ (s = t[o]) && (r = s(r) || r);
1465
+ return r;
1466
+ }, Z = (t, e) => (n, i) => e(n, i, t);
1467
+ let it = class extends z {
1468
+ constructor(t, e, n, i, r, o, s, c, u, p) {
1469
+ super(), this._hoverManagerService = t, this._sheetsHyperLinkPopupService = e, this._renderManagerService = n, this._permissionService = i, this._sheetPermissionCheckController = r, this._commandService = o, this._editorBridgeService = s, this._textSelectionManagerService = c, this._univerInstanceService = u, this._zenZoneService = p, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
1470
+ }
1471
+ _getLinkPermission(t) {
1472
+ const { unitId: e, subUnitId: n, row: i, col: r } = t, o = this._univerInstanceService.getUnit(e, w.UNIVER_SHEET);
1473
+ if (!(o == null ? void 0 : o.getSheetBySheetId(n)))
1474
+ return {
1475
+ viewPermission: !1,
1476
+ editPermission: !1,
1477
+ copyPermission: !1
1478
+ };
1479
+ const c = this._sheetPermissionCheckController.permissionCheckWithRanges({
1480
+ workbookTypes: [mr],
1481
+ worksheetTypes: [gr],
1482
+ rangeTypes: [hr]
1483
+ }, [{ startRow: i, startColumn: r, endRow: i, endColumn: r }]), u = this._sheetPermissionCheckController.permissionCheckWithRanges({
1484
+ workbookTypes: [Ut],
1485
+ worksheetTypes: [Nt, Mt],
1486
+ rangeTypes: [Ot]
1487
+ }, [{ startRow: i, startColumn: r, endRow: i, endColumn: r }]), p = this._permissionService.composePermission([new vr(e).id, new fr(e, n).id]).every((l) => l.value);
1488
+ return {
1489
+ viewPermission: c,
1490
+ editPermission: u,
1491
+ copyPermission: p
1492
+ };
1493
+ }
1494
+ _initHoverListener() {
1495
+ this.disposeWithMe(
1496
+ // hover over not editing cell
1497
+ this._hoverManagerService.currentRichText$.pipe(Ze(200)).subscribe((t) => {
1498
+ var T, L;
1499
+ if (!t) {
1500
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1501
+ return;
1502
+ }
1503
+ const { unitId: e, subUnitId: n, row: i, col: r } = t, o = this._renderManagerService.getRenderById(e);
1504
+ if (!o)
1505
+ return;
1506
+ const s = this._univerInstanceService.getUnit(e, w.UNIVER_SHEET), c = s == null ? void 0 : s.getSheetBySheetId(n);
1507
+ if (!c)
1508
+ return;
1509
+ if (!o.with(Wr).active) {
1510
+ this._sheetsHyperLinkPopupService.hideCurrentPopup(m.VIEWING);
1511
+ return;
1512
+ }
1513
+ const p = (T = o == null ? void 0 : o.with(ln).getSkeletonParam(n)) == null ? void 0 : T.skeleton, l = r, g = i;
1514
+ let d = g, _ = l;
1515
+ p && p.overflowCache.forValue((A, D, X) => {
1516
+ ye.contains(X, { startColumn: l, endColumn: l, startRow: g, endRow: g }) && (d = A, _ = D);
1517
+ });
1518
+ const { viewPermission: S, editPermission: f, copyPermission: k } = this._getLinkPermission(t);
1519
+ if (!S) {
1520
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1521
+ return;
1522
+ }
1523
+ const a = c.getCellStyleOnly(d, _), b = s.getStyles().getStyleByCell(a), U = (L = b == null ? void 0 : b.tr) == null ? void 0 : L.a;
1524
+ if (!U && !t.customRange) {
1525
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1526
+ return;
1527
+ }
1528
+ this._sheetsHyperLinkPopupService.showPopup({
1529
+ row: d,
1530
+ col: _,
1531
+ editPermission: f,
1532
+ copyPermission: k,
1533
+ customRange: t.customRange,
1534
+ customRangeRect: t.rect,
1535
+ type: m.VIEWING,
1536
+ unitId: e,
1537
+ subUnitId: n,
1538
+ showAll: !!U
1539
+ });
1540
+ })
1541
+ );
1542
+ }
1543
+ _initHoverEditingListener() {
1544
+ let t = null;
1545
+ this.disposeWithMe(
1546
+ this._editorBridgeService.currentEditCellState$.pipe(He((e) => this._editorBridgeService.visible$.pipe(xt((n) => ({ visible: n, state: e }))))).subscribe(({ visible: e, state: n }) => {
1547
+ if (!n || n.editorUnitId !== Ie)
1548
+ return;
1549
+ if (!e.visible) {
1550
+ t == null || t.unsubscribe(), this._sheetsHyperLinkPopupService.hideCurrentPopup(m.EDITING), this._sheetsHyperLinkPopupService.endEditing(m.EDITING);
1551
+ return;
1552
+ }
1553
+ const { editorUnitId: i, unitId: r, sheetId: o, row: s, column: c } = n, u = this._renderManagerService.getRenderById(i);
1554
+ if (!u)
1555
+ return;
1556
+ const { editPermission: p, viewPermission: l, copyPermission: g } = this._getLinkPermission({ unitId: r, subUnitId: o, row: s, col: c }), d = u.with(hn);
1557
+ l && (t == null || t.unsubscribe(), t = d.hoverCustomRanges$.pipe(Ze(200)).subscribe((_) => {
1558
+ var b, U;
1559
+ const S = _.find((T) => T.range.rangeType === Ke.HYPERLINK);
1560
+ if (!S) {
1561
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1562
+ return;
1563
+ }
1564
+ const f = S.rects[S.rects.length - 1];
1565
+ if (!((U = (b = this._renderManagerService.getRenderById(r)) == null ? void 0 : b.with(ln).getSkeletonParam(o)) == null ? void 0 : U.skeleton) || !f)
1566
+ return;
1567
+ const a = u.engine.getCanvasElement().getBoundingClientRect();
1568
+ this._sheetsHyperLinkPopupService.showPopup({
1569
+ unitId: r,
1570
+ subUnitId: o,
1571
+ row: s,
1572
+ col: c,
1573
+ customRange: S.range,
1574
+ customRangeRect: {
1575
+ left: f.left + a.left,
1576
+ top: f.top + a.top,
1577
+ bottom: f.bottom + a.top,
1578
+ right: f.right + a.left
1579
+ },
1580
+ editPermission: p,
1581
+ copyPermission: g,
1582
+ type: m.EDITING
1583
+ });
1584
+ }));
1585
+ })
1586
+ ), this.disposeWithMe(() => {
1587
+ t == null || t.unsubscribe();
1588
+ });
1589
+ }
1590
+ _initZenEditor() {
1591
+ this.disposeWithMe(
1592
+ this._zenZoneService.visible$.subscribe((t) => {
1593
+ t ? (this._sheetsHyperLinkPopupService.hideCurrentPopup(m.VIEWING), this._sheetsHyperLinkPopupService.hideCurrentPopup(m.EDITING), this._sheetsHyperLinkPopupService.endEditing(m.EDITING), this._sheetsHyperLinkPopupService.hideCurrentPopup(m.VIEWING)) : (this._sheetsHyperLinkPopupService.hideCurrentPopup(m.ZEN_EDITOR), this._sheetsHyperLinkPopupService.endEditing(m.ZEN_EDITOR));
1594
+ })
1595
+ ), this.disposeWithMe(
1596
+ this._univerInstanceService.focused$.pipe(
1597
+ He((t) => {
1598
+ const e = t === N ? this._renderManagerService.getRenderById(t) : null;
1599
+ return e ? e.with(hn).hoverCustomRanges$.pipe(Ze(200)) : new li((n) => {
1600
+ n.next(null);
1601
+ });
1602
+ })
1603
+ ).subscribe((t) => {
1604
+ const e = t == null ? void 0 : t.find((i) => i.range.rangeType === Ke.HYPERLINK), n = this._editorBridgeService.getEditCellState();
1605
+ if (e && n) {
1606
+ const { unitId: i, sheetId: r, row: o, column: s } = n, { editPermission: c, viewPermission: u, copyPermission: p } = this._getLinkPermission({ unitId: i, subUnitId: r, row: o, col: s });
1607
+ u && this._sheetsHyperLinkPopupService.showPopup({
1608
+ type: m.ZEN_EDITOR,
1609
+ unitId: i,
1610
+ subUnitId: r,
1611
+ row: o,
1612
+ col: s,
1613
+ customRange: e.range,
1614
+ editPermission: c,
1615
+ copyPermission: p
1616
+ });
1617
+ } else
1618
+ this._sheetsHyperLinkPopupService.hideCurrentPopup(m.ZEN_EDITOR);
1619
+ })
1620
+ );
1621
+ }
1622
+ _initTextSelectionListener() {
1623
+ this.disposeWithMe(
1624
+ this._textSelectionManagerService.textSelection$.subscribe((t) => {
1625
+ t && t.unitId === Ie && this._sheetsHyperLinkPopupService.endEditing(m.EDITING);
1626
+ })
1627
+ );
1628
+ }
1629
+ _initCommandListener() {
1630
+ const t = [_r.id, Sr.id, Cr.id];
1631
+ this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
1632
+ t.includes(e.id) && this._sheetsHyperLinkPopupService.hideCurrentPopup();
1633
+ }));
1634
+ }
1635
+ };
1636
+ it = no([
1637
+ Z(0, y(Fr)),
1638
+ Z(1, y(K)),
1639
+ Z(2, y(De)),
1640
+ Z(3, y(ar)),
1641
+ Z(4, y(bn)),
1642
+ Z(5, re),
1643
+ Z(6, ne),
1644
+ Z(7, y(xe)),
1645
+ Z(8, Y),
1646
+ Z(9, ht)
1647
+ ], it);
1648
+ var ro = Object.getOwnPropertyDescriptor, jn = (t, e, n, i) => {
1649
+ for (var r = i > 1 ? void 0 : i ? ro(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1650
+ (s = t[o]) && (r = s(r) || r);
1651
+ return r;
1652
+ }, kt = (t, e) => (n, i) => e(n, i, t);
1653
+ let bt = class extends z {
1654
+ constructor(t, e) {
1655
+ super(), this._context = t, this._hyperLinkModel = e, this._initSkeletonChange();
1656
+ }
1657
+ _initSkeletonChange() {
1658
+ const t = () => {
1659
+ var e;
1660
+ (e = this._context.mainComponent) == null || e.makeForceDirty();
1661
+ };
1662
+ this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(Ze(16)).subscribe(() => {
1663
+ t();
1664
+ }));
1665
+ }
1666
+ };
1667
+ bt = jn([
1668
+ kt(1, y(pt))
1669
+ ], bt);
1670
+ let ot = class extends z {
1671
+ constructor(t, e) {
1672
+ super(), this._sheetInterceptorService = t, this._hyperLinkModel = e, this._initViewModelIntercept();
1673
+ }
1674
+ _initViewModelIntercept() {
1675
+ this.disposeWithMe(
1676
+ this._sheetInterceptorService.intercept(
1677
+ yr.CELL_CONTENT,
1678
+ {
1679
+ effect: cr.Value,
1680
+ priority: 100,
1681
+ handler: (t, e, n) => {
1682
+ const { row: i, col: r, unitId: o, subUnitId: s } = e, c = this._hyperLinkModel.getHyperLinkByLocation(o, s, i, r);
1683
+ return n(c ? {
1684
+ ...t,
1685
+ linkUrl: c.payload,
1686
+ linkId: c.id
1687
+ } : t);
1688
+ }
1689
+ }
1690
+ )
1691
+ );
1692
+ }
1693
+ };
1694
+ ot = jn([
1695
+ kt(0, y(Ir)),
1696
+ kt(1, y(pt))
1697
+ ], ot);
1698
+ const io = {
1699
+ [Jr.OTHERS]: {
1700
+ [ce.id]: {
1701
+ order: 2,
1702
+ menuItemFactory: zi
1703
+ },
1704
+ [et(ce.id)]: {
1705
+ order: 2,
1706
+ menuItemFactory: Xi
1707
+ }
1708
+ },
1709
+ [Xr.MAIN_AREA]: {
1710
+ [qr.OTHERS]: {
1711
+ order: 1,
1712
+ [ce.id]: {
1713
+ order: 0,
1714
+ menuItemFactory: Ki
1715
+ },
1716
+ [et(ce.id)]: {
1717
+ order: 0,
1718
+ menuItemFactory: Yi
1719
+ }
1720
+ }
1721
+ }
1722
+ };
1723
+ var oo = Object.getOwnPropertyDescriptor, so = (t, e, n, i) => {
1724
+ for (var r = i > 1 ? void 0 : i ? oo(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1725
+ (s = t[o]) && (r = s(r) || r);
1726
+ return r;
1727
+ }, Te = (t, e) => (n, i) => e(n, i, t);
1728
+ let st = class extends z {
1729
+ constructor(t, e, n, i, r) {
1730
+ super(), this._componentManager = t, this._commandService = e, this._menuManagerService = n, this._injector = i, this._shortcutService = r, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
1731
+ }
1732
+ _initComponents() {
1733
+ [
1734
+ [qe, qe.componentKey],
1735
+ [Xe, Xe.componentKey],
1736
+ [Vt, "LinkSingle"]
1737
+ ].forEach(([t, e]) => {
1738
+ this._componentManager.register(e, t);
1739
+ });
1740
+ }
1741
+ _initCommands() {
1742
+ [
1743
+ $t,
1744
+ Je,
1745
+ Bt,
1746
+ ce
1747
+ ].forEach((t) => {
1748
+ this._commandService.registerCommand(t);
1749
+ });
1750
+ }
1751
+ _initMenus() {
1752
+ this._menuManagerService.mergeMenu(io);
1753
+ }
1754
+ _initShortCut() {
1755
+ this._shortcutService.registerShortcut(Wn);
1756
+ }
1757
+ };
1758
+ st = so([
1759
+ Te(0, y(Qr)),
1760
+ Te(1, re),
1761
+ Te(2, ei),
1762
+ Te(3, y(ut)),
1763
+ Te(4, y(ti))
1764
+ ], st);
1765
+ var ao = Object.getOwnPropertyDescriptor, co = (t, e, n, i) => {
1766
+ for (var r = i > 1 ? void 0 : i ? ao(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1767
+ (s = t[o]) && (r = s(r) || r);
1768
+ return r;
1769
+ }, Cn = (t, e) => (n, i) => e(n, i, t);
1770
+ let at = class extends z {
1771
+ constructor(t, e) {
1772
+ super(), this._parserService = t, this._resolverService = e, this._handleInitUrl();
1773
+ }
1774
+ _handleInitUrl() {
1775
+ const t = location.hash;
1776
+ if (t) {
1777
+ const e = this._parserService.parseHyperLink(t);
1778
+ this._resolverService.navigate(e);
1779
+ }
1780
+ }
1781
+ };
1782
+ at = co([
1783
+ Cn(0, y(Ht)),
1784
+ Cn(1, y(le))
1785
+ ], at);
1786
+ var lo = Object.defineProperty, uo = Object.getOwnPropertyDescriptor, po = (t, e, n) => e in t ? lo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ho = (t, e, n, i) => {
1787
+ for (var r = i > 1 ? void 0 : i ? uo(e, n) : e, o = t.length - 1, s; o >= 0; o--)
1788
+ (s = t[o]) && (r = s(r) || r);
1789
+ return r;
1790
+ }, In = (t, e) => (n, i) => e(n, i, t), Zn = (t, e, n) => po(t, typeof e != "symbol" ? e + "" : e, n);
1791
+ let ct = class extends ur {
1792
+ constructor(t = mn, e, n) {
1793
+ super(), this._config = t, this._injector = e, this._configService = n;
1794
+ const { menu: i, ...r } = dr(
1795
+ {},
1796
+ mn,
1797
+ this._config
1798
+ );
1799
+ i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Hn, r);
1800
+ }
1801
+ onStarting() {
1802
+ [
1803
+ [le],
1804
+ [K],
1805
+ [xn],
1806
+ [ot],
1807
+ [it],
1808
+ [st],
1809
+ [nt],
1810
+ [ze],
1811
+ [rt],
1812
+ [at]
1813
+ ].forEach((e) => this._injector.add(e)), this._injector.get(ot);
1814
+ }
1815
+ onReady() {
1816
+ this._injector.get(De).registerRenderModule(w.UNIVER_SHEET, [bt]), this._injector.get(nt), this._injector.get(ze), this._injector.get(st);
1817
+ }
1818
+ onRendered() {
1819
+ this._injector.get(rt), this._injector.get(at), this._injector.get(it);
1820
+ }
1821
+ };
1822
+ Zn(ct, "pluginName", Dt);
1823
+ Zn(ct, "type", w.UNIVER_SHEET);
1824
+ ct = ho([
1825
+ lr(Tr, oi),
1826
+ In(1, y(ut)),
1827
+ In(2, yn)
1828
+ ], ct);
1829
+ export {
1830
+ Je as CloseHyperLinkPopupOperation,
1831
+ Bt as InsertHyperLinkOperation,
1832
+ Wn as InsertLinkShortcut,
1833
+ $t as OpenHyperLinkEditPanelOperation,
1834
+ ze as SheetsHyperLinkCopyPasteController,
1835
+ K as SheetsHyperLinkPopupService,
1836
+ le as SheetsHyperLinkResolverService,
1837
+ xn as SheetsHyperLinkSidePanelService,
1838
+ ct as UniverSheetsHyperLinkUIPlugin
1839
+ };