@univerjs/sheets-hyper-link 0.4.2 → 0.5.0-alpha.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/lib/es/index.js CHANGED
@@ -1,507 +1,1205 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Disposable, ObjectMatrix, UniverInstanceType, IUniverInstanceService, CommandType, Inject, ICommandService, sequenceExecuteAsync, isValidRange, toDisposable, IResourceManagerService, DependentOn, Injector, Plugin, IConfigService } from "@univerjs/core";
6
- import { Subject } from "rxjs";
7
- import { RefRangeService, SheetsSelectionsService, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, UniverSheetsPlugin } from "@univerjs/sheets";
8
- import { deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
9
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
10
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
11
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
12
- return kind && result && __defProp$4(target, key, result), result;
13
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a;
14
- let HyperLinkModel = (_a = class extends Disposable {
15
- constructor(_univerInstanceService) {
1
+ var xe = Object.defineProperty;
2
+ var Te = (s, e, t) => e in s ? xe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var I = (s, e, t) => Te(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Disposable as V, ObjectMatrix as J, UniverInstanceType as S, IUniverInstanceService as w, CommandType as E, Inject as R, ICommandService as U, sequenceExecuteAsync as ye, isValidRange as ve, toDisposable as Ae, CustomRangeType as N, DisposableCollection as We, Range as Be, Tools as ie, BuildTextUtils as X, generateRandomId as ae, TextX as oe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as je, IUndoRedoService as Se, CellValueType as Re, sequenceExecute as Fe, getBodySlice as be, IResourceManagerService as Ke, LocaleService as Ge, DependentOn as Ye, Injector as ze, Plugin as Je, registerDependencies as Xe, touchDependencies as qe, IConfigService as Ze } from "@univerjs/core";
5
+ import { Subject as Qe } from "rxjs";
6
+ import { RefRangeService as Pe, SheetsSelectionsService as Ne, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests as et, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests as tt, SheetInterceptorService as de, RemoveSheetCommand as nt, SetRangeValuesMutation as H, SetRangeValuesCommand as rt, ClearSelectionContentCommand as st, ClearSelectionAllCommand as it, ClearSelectionFormatCommand as at, getSheetCommandTarget as ce, AFTER_CELL_EDIT as ot, SetRangeValuesUndoMutationFactory as Ie, UniverSheetsPlugin as dt } from "@univerjs/sheets";
7
+ import { deserializeRangeWithSheet as Me, serializeRange as B, serializeRangeWithSheet as ct, IDefinedNamesService as lt } from "@univerjs/engine-formula";
8
+ import { addCustomRangeBySelectionFactory as ut, deleteCustomRangeFactory as pt, replaceSelectionFactory as Oe } from "@univerjs/docs";
9
+ var ht = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, ft = (s, e, t, n) => {
10
+ for (var r = n > 1 ? void 0 : n ? gt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
11
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
12
+ return n && r && ht(e, t, r), r;
13
+ }, _t = (s, e) => (t, n) => e(t, n, s);
14
+ let v = class extends V {
15
+ constructor(e) {
16
16
  super();
17
- __publicField(this, "_linkUpdate$", new Subject());
18
- __publicField(this, "linkUpdate$", this._linkUpdate$.asObservable());
19
- __publicField(this, "_linkMap", /* @__PURE__ */ new Map());
20
- __publicField(this, "_linkPositionMap", /* @__PURE__ */ new Map());
21
- this._univerInstanceService = _univerInstanceService, this.disposeWithMe({
22
- dispose: /* @__PURE__ */ __name(() => {
17
+ I(this, "_linkUpdate$", new Qe());
18
+ I(this, "linkUpdate$", this._linkUpdate$.asObservable());
19
+ I(this, "_linkMap", /* @__PURE__ */ new Map());
20
+ I(this, "_linkPositionMap", /* @__PURE__ */ new Map());
21
+ this._univerInstanceService = e, this.disposeWithMe({
22
+ dispose: () => {
23
23
  this._linkUpdate$.complete();
24
- }, "dispose")
24
+ }
25
25
  });
26
26
  }
27
- _ensureMap(unitId, subUnitId) {
28
- let unitMap = this._linkMap.get(unitId);
29
- unitMap || (unitMap = /* @__PURE__ */ new Map(), this._linkMap.set(unitId, unitMap));
30
- let matrix = unitMap.get(subUnitId);
31
- matrix || (matrix = new ObjectMatrix(), unitMap.set(subUnitId, matrix));
32
- let positionUnitMap = this._linkPositionMap.get(unitId);
33
- positionUnitMap || (positionUnitMap = /* @__PURE__ */ new Map(), this._linkPositionMap.set(unitId, positionUnitMap));
34
- let positionSubUnitMap = positionUnitMap.get(subUnitId);
35
- return positionSubUnitMap || (positionSubUnitMap = /* @__PURE__ */ new Map(), positionUnitMap.set(subUnitId, positionSubUnitMap)), {
36
- matrix,
37
- positionMap: positionSubUnitMap
27
+ _ensureMap(e, t) {
28
+ let n = this._linkMap.get(e);
29
+ n || (n = /* @__PURE__ */ new Map(), this._linkMap.set(e, n));
30
+ let r = n.get(t);
31
+ r || (r = new J(), n.set(t, r));
32
+ let i = this._linkPositionMap.get(e);
33
+ i || (i = /* @__PURE__ */ new Map(), this._linkPositionMap.set(e, i));
34
+ let a = i.get(t);
35
+ return a || (a = /* @__PURE__ */ new Map(), i.set(t, a)), {
36
+ matrix: r,
37
+ positionMap: a
38
38
  };
39
39
  }
40
- addHyperLink(unitId, subUnitId, link) {
41
- const { matrix, positionMap } = this._ensureMap(unitId, subUnitId);
42
- return matrix.setValue(link.row, link.column, link), positionMap.set(link.id, { row: link.row, column: link.column, link }), this._linkUpdate$.next({
43
- unitId,
44
- subUnitId,
45
- payload: link,
40
+ addHyperLink(e, t, n) {
41
+ const { matrix: r, positionMap: i } = this._ensureMap(e, t);
42
+ return r.setValue(n.row, n.column, n), i.set(n.id, { row: n.row, column: n.column, link: n }), this._linkUpdate$.next({
43
+ unitId: e,
44
+ subUnitId: t,
45
+ payload: n,
46
46
  type: "add"
47
47
  }), !0;
48
48
  }
49
- updateHyperLink(unitId, subUnitId, id, payload, silent = !1) {
50
- const { matrix, positionMap } = this._ensureMap(unitId, subUnitId), position = positionMap.get(id);
51
- if (!position)
49
+ updateHyperLink(e, t, n, r, i = !1) {
50
+ const { matrix: a, positionMap: o } = this._ensureMap(e, t), c = o.get(n);
51
+ if (!c)
52
52
  return !0;
53
- const link = matrix.getValue(position.row, position.column);
54
- return link && (Object.assign(link, payload), this._linkUpdate$.next({
55
- unitId,
56
- subUnitId,
53
+ const d = a.getValue(c.row, c.column);
54
+ return d && (Object.assign(d, r), this._linkUpdate$.next({
55
+ unitId: e,
56
+ subUnitId: t,
57
57
  payload: {
58
- display: link.display,
59
- payload: link.payload
58
+ display: d.display,
59
+ payload: d.payload
60
60
  },
61
- id,
61
+ id: n,
62
62
  type: "update",
63
- silent
63
+ silent: i
64
64
  })), !0;
65
65
  }
66
- updateHyperLinkRef(unitId, subUnitId, id, payload, silent = !1) {
67
- const { matrix, positionMap } = this._ensureMap(unitId, subUnitId), position = positionMap.get(id);
68
- if (!position)
66
+ updateHyperLinkRef(e, t, n, r, i = !1) {
67
+ const { matrix: a, positionMap: o } = this._ensureMap(e, t), c = o.get(n);
68
+ if (!c)
69
69
  return !0;
70
- let link = matrix.getValue(position.row, position.column);
71
- return !link || link.id !== id ? link = position.link : matrix.realDeleteValue(position.row, position.column), Object.assign(link, payload), positionMap.set(id, { ...payload, link }), matrix.setValue(payload.row, payload.column, link), this._linkUpdate$.next({
72
- unitId,
73
- subUnitId,
74
- payload,
75
- id,
70
+ let d = a.getValue(c.row, c.column);
71
+ return !d || d.id !== n ? d = c.link : a.realDeleteValue(c.row, c.column), Object.assign(d, r), o.set(n, { ...r, link: d }), a.setValue(r.row, r.column, d), this._linkUpdate$.next({
72
+ unitId: e,
73
+ subUnitId: t,
74
+ payload: r,
75
+ id: n,
76
76
  type: "updateRef",
77
- silent
77
+ silent: i
78
78
  }), !0;
79
79
  }
80
- removeHyperLink(unitId, subUnitId, id) {
81
- const { matrix, positionMap } = this._ensureMap(unitId, subUnitId), position = positionMap.get(id);
82
- if (!position)
80
+ removeHyperLink(e, t, n) {
81
+ const { matrix: r, positionMap: i } = this._ensureMap(e, t), a = i.get(n);
82
+ if (!a)
83
83
  return !1;
84
- positionMap.delete(id);
85
- const link = matrix.getValue(position.row, position.column);
86
- return link && link.id === id && matrix.realDeleteValue(position.row, position.column), this._linkUpdate$.next({
87
- unitId,
88
- subUnitId,
89
- payload: position.link,
84
+ i.delete(n);
85
+ const o = r.getValue(a.row, a.column);
86
+ return o && o.id === n && r.realDeleteValue(a.row, a.column), this._linkUpdate$.next({
87
+ unitId: e,
88
+ subUnitId: t,
89
+ payload: a.link,
90
90
  type: "remove"
91
91
  }), !0;
92
92
  }
93
- getHyperLink(unitId, subUnitId, id) {
94
- const { matrix, positionMap } = this._ensureMap(unitId, subUnitId), position = positionMap.get(id);
95
- if (position)
96
- return matrix.getValue(position.row, position.column);
93
+ getHyperLink(e, t, n) {
94
+ const { matrix: r, positionMap: i } = this._ensureMap(e, t), a = i.get(n);
95
+ if (a)
96
+ return r.getValue(a.row, a.column);
97
97
  }
98
- getHyperLinkByLocation(unitId, subUnitId, row, column) {
99
- const { matrix } = this._ensureMap(unitId, subUnitId);
100
- return matrix.getValue(row, column);
98
+ getHyperLinkByLocation(e, t, n, r) {
99
+ const { matrix: i } = this._ensureMap(e, t);
100
+ return i.getValue(n, r);
101
101
  }
102
- getHyperLinkByLocationSync(unitId, subUnitId, row, column) {
103
- var _a6, _b, _c, _d, _e;
104
- const { matrix } = this._ensureMap(unitId, subUnitId), workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), cell = (_a6 = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId)) == null ? void 0 : _a6.getCellRaw(row, column), cellValueStr = ((_e = (_d = cell == null ? void 0 : cell.v) != null ? _d : (_c = (_b = cell == null ? void 0 : cell.p) == null ? void 0 : _b.body) == null ? void 0 : _c.dataStream.slice(0, -2)) != null ? _e : "").toString(), link = matrix.getValue(row, column);
105
- if (link)
102
+ getHyperLinkByLocationSync(e, t, n, r) {
103
+ var l, u, h, g, p;
104
+ const { matrix: i } = this._ensureMap(e, t), a = this._univerInstanceService.getUnit(e, S.UNIVER_SHEET), o = (l = a == null ? void 0 : a.getSheetBySheetId(t)) == null ? void 0 : l.getCellRaw(n, r), c = ((p = (g = o == null ? void 0 : o.v) != null ? g : (h = (u = o == null ? void 0 : o.p) == null ? void 0 : u.body) == null ? void 0 : h.dataStream.slice(0, -2)) != null ? p : "").toString(), d = i.getValue(n, r);
105
+ if (d)
106
106
  return {
107
- ...link,
108
- display: cellValueStr
107
+ ...d,
108
+ display: c
109
109
  };
110
110
  }
111
- getSubUnit(unitId, subUnitId) {
112
- const { matrix } = this._ensureMap(unitId, subUnitId), links = [];
113
- return matrix.forValue((row, col, value) => {
114
- value && links.push(value);
115
- }), links;
111
+ getSubUnit(e, t) {
112
+ const { matrix: n } = this._ensureMap(e, t), r = [];
113
+ return n.forValue((i, a, o) => {
114
+ o && r.push(o);
115
+ }), r;
116
116
  }
117
- getUnit(unitId) {
118
- const unitMap = this._linkMap.get(unitId);
119
- return unitMap ? Array.from(unitMap.keys()).map((subUnitId) => {
120
- const links = this.getSubUnit(unitId, subUnitId);
117
+ getUnit(e) {
118
+ const t = this._linkMap.get(e);
119
+ return t ? Array.from(t.keys()).map((n) => {
120
+ const r = this.getSubUnit(e, n);
121
121
  return {
122
- unitId,
123
- subUnitId,
124
- links
122
+ unitId: e,
123
+ subUnitId: n,
124
+ links: r
125
125
  };
126
126
  }) : [];
127
127
  }
128
- deleteUnit(unitId) {
129
- const links = this.getUnit(unitId);
130
- this._linkMap.delete(unitId), this._linkPositionMap.delete(unitId), this._linkUpdate$.next({
128
+ deleteUnit(e) {
129
+ const t = this.getUnit(e);
130
+ this._linkMap.delete(e), this._linkPositionMap.delete(e), this._linkUpdate$.next({
131
131
  type: "unload",
132
- unitId,
133
- unitLinks: links
132
+ unitId: e,
133
+ unitLinks: t
134
134
  });
135
135
  }
136
136
  getAll() {
137
- return Array.from(this._linkMap.keys()).map((unitId) => this.getUnit(unitId));
138
- }
139
- }, __name(_a, "HyperLinkModel"), _a);
140
- HyperLinkModel = __decorateClass$4([
141
- __decorateParam$4(0, IUniverInstanceService)
142
- ], HyperLinkModel);
143
- var SheetHyperLinkType = /* @__PURE__ */ ((SheetHyperLinkType2) => (SheetHyperLinkType2.SHEET = "gid", SheetHyperLinkType2.RANGE = "range", SheetHyperLinkType2.DEFINE_NAME = "rangeid", SheetHyperLinkType2.INVALID = "invalid", SheetHyperLinkType2.URL = "url", SheetHyperLinkType2))(SheetHyperLinkType || {});
144
- const PLUGIN_CONFIG_KEY = "sheets-hyper-link.config", defaultPluginConfig = {}, AddHyperLinkMutation = {
145
- type: CommandType.MUTATION,
137
+ return Array.from(this._linkMap.keys()).map((t) => this.getUnit(t));
138
+ }
139
+ };
140
+ v = ft([
141
+ _t(0, w)
142
+ ], v);
143
+ var L = /* @__PURE__ */ ((s) => (s.SHEET = "gid", s.RANGE = "range", s.DEFINE_NAME = "rangeid", s.INVALID = "invalid", s.URL = "url", s))(L || {});
144
+ const mt = "sheets-hyper-link.config", yt = {}, O = {
145
+ type: E.MUTATION,
146
146
  id: "sheets.mutation.add-hyper-link",
147
- handler(accessor, params) {
148
- if (!params)
147
+ handler(s, e) {
148
+ if (!e)
149
149
  return !1;
150
- const model = accessor.get(HyperLinkModel), { unitId, subUnitId, link } = params;
151
- return model.addHyperLink(unitId, subUnitId, link);
150
+ const t = s.get(v), { unitId: n, subUnitId: r, link: i } = e;
151
+ return t.addHyperLink(n, r, i);
152
152
  }
153
- }, RemoveHyperLinkMutation = {
154
- type: CommandType.MUTATION,
153
+ }, k = {
154
+ type: E.MUTATION,
155
155
  id: "sheets.mutation.remove-hyper-link",
156
- handler(accessor, params) {
157
- if (!params)
156
+ handler(s, e) {
157
+ if (!e)
158
158
  return !1;
159
- const model = accessor.get(HyperLinkModel), { unitId, subUnitId, id } = params;
160
- return model.removeHyperLink(unitId, subUnitId, id);
159
+ const t = s.get(v), { unitId: n, subUnitId: r, id: i } = e;
160
+ return t.removeHyperLink(n, r, i);
161
161
  }
162
- }, UpdateHyperLinkMutation = {
163
- type: CommandType.MUTATION,
162
+ }, fe = {
163
+ type: E.MUTATION,
164
164
  id: "sheets.mutation.update-hyper-link",
165
- handler(accessor, params) {
166
- if (!params)
165
+ handler(s, e) {
166
+ if (!e)
167
167
  return !1;
168
- const model = accessor.get(HyperLinkModel), { unitId, subUnitId, payload, id } = params;
169
- return model.updateHyperLink(unitId, subUnitId, id, payload, !1);
168
+ const t = s.get(v), { unitId: n, subUnitId: r, payload: i, id: a } = e;
169
+ return t.updateHyperLink(n, r, a, i, !1);
170
170
  }
171
- }, UpdateHyperLinkRefMutation = {
172
- type: CommandType.MUTATION,
171
+ }, _e = {
172
+ type: E.MUTATION,
173
173
  id: "sheets.mutation.update-hyper-link-ref",
174
- handler(accessor, params) {
175
- if (!params)
174
+ handler(s, e) {
175
+ if (!e)
176
176
  return !1;
177
- const model = accessor.get(HyperLinkModel), { unitId, subUnitId, id, row, column, silent } = params;
178
- return model.updateHyperLinkRef(unitId, subUnitId, id, { row, column }, silent);
179
- }
180
- }, SHEET_HYPER_LINK_PLUGIN = "SHEET_HYPER_LINK_PLUGIN", ERROR_RANGE = "err";
181
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
182
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
183
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
184
- return kind && result && __defProp$3(target, key, result), result;
185
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a2;
186
- let SheetsHyperLinkRefRangeController = (_a2 = class extends Disposable {
187
- constructor(_refRangeService, _hyperLinkModel, _selectionManagerService, _commandService) {
177
+ const t = s.get(v), { unitId: n, subUnitId: r, id: i, row: a, column: o, silent: c } = e;
178
+ return t.updateHyperLinkRef(n, r, i, { row: a, column: o }, c);
179
+ }
180
+ }, ke = "SHEET_HYPER_LINK_PLUGIN", q = "err";
181
+ var vt = Object.defineProperty, St = Object.getOwnPropertyDescriptor, Rt = (s, e, t, n) => {
182
+ for (var r = n > 1 ? void 0 : n ? St(e, t) : e, i = s.length - 1, a; i >= 0; i--)
183
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
184
+ return n && r && vt(e, t, r), r;
185
+ }, Y = (s, e) => (t, n) => e(t, n, s);
186
+ let Z = class extends V {
187
+ constructor(e, t, n, r) {
188
188
  super();
189
- __publicField(this, "_disposableMap", /* @__PURE__ */ new Map());
190
- __publicField(this, "_watchDisposableMap", /* @__PURE__ */ new Map());
191
- __publicField(this, "_rangeDisableMap", /* @__PURE__ */ new Map());
192
- __publicField(this, "_rangeWatcherMap", /* @__PURE__ */ new Map());
193
- __publicField(this, "_handlePositionChange", /* @__PURE__ */ __name((unitId, subUnitId, link, resultRange, silent) => {
194
- const oldRange = {
195
- startColumn: link.column,
196
- endColumn: link.column,
197
- startRow: link.row,
198
- endRow: link.row
189
+ I(this, "_disposableMap", /* @__PURE__ */ new Map());
190
+ I(this, "_watchDisposableMap", /* @__PURE__ */ new Map());
191
+ I(this, "_rangeDisableMap", /* @__PURE__ */ new Map());
192
+ I(this, "_rangeWatcherMap", /* @__PURE__ */ new Map());
193
+ I(this, "_handlePositionChange", (e, t, n, r, i) => {
194
+ const a = {
195
+ startColumn: n.column,
196
+ endColumn: n.column,
197
+ startRow: n.row,
198
+ endRow: n.row
199
199
  };
200
- return resultRange ? {
200
+ return r ? {
201
201
  redos: [{
202
- id: UpdateHyperLinkRefMutation.id,
202
+ id: _e.id,
203
203
  params: {
204
- unitId,
205
- subUnitId,
206
- id: link.id,
207
- row: resultRange.startRow,
208
- column: resultRange.startColumn,
209
- silent
204
+ unitId: e,
205
+ subUnitId: t,
206
+ id: n.id,
207
+ row: r.startRow,
208
+ column: r.startColumn,
209
+ silent: i
210
210
  }
211
211
  }],
212
212
  undos: [{
213
- id: UpdateHyperLinkRefMutation.id,
213
+ id: _e.id,
214
214
  params: {
215
- unitId,
216
- subUnitId,
217
- id: link.id,
218
- row: oldRange.startRow,
219
- column: oldRange.startColumn,
220
- silent
215
+ unitId: e,
216
+ subUnitId: t,
217
+ id: n.id,
218
+ row: a.startRow,
219
+ column: a.startColumn,
220
+ silent: i
221
221
  }
222
222
  }]
223
223
  } : {
224
224
  redos: [{
225
- id: RemoveHyperLinkMutation.id,
225
+ id: k.id,
226
226
  params: {
227
- unitId,
228
- subUnitId,
229
- id: link.id
227
+ unitId: e,
228
+ subUnitId: t,
229
+ id: n.id
230
230
  }
231
231
  }],
232
232
  undos: [{
233
- id: AddHyperLinkMutation.id,
233
+ id: O.id,
234
234
  params: {
235
- unitId,
236
- subUnitId,
237
- link
235
+ unitId: e,
236
+ subUnitId: t,
237
+ link: n
238
238
  }
239
239
  }]
240
240
  };
241
- }, "_handlePositionChange"));
242
- this._refRangeService = _refRangeService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._commandService = _commandService, this._initData(), this._initRefRange();
243
- }
244
- _registerPosition(unitId, subUnitId, link) {
245
- const id = link.id, oldRange = {
246
- startColumn: link.column,
247
- endColumn: link.column,
248
- startRow: link.row,
249
- endRow: link.row
250
- }, handleRefRangeChange = /* @__PURE__ */ __name((commandInfo) => {
251
- const resultRanges = handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests(oldRange, commandInfo, { selectionManagerService: this._selectionManagerService }), resultRange = Array.isArray(resultRanges) ? resultRanges[0] : resultRanges;
252
- return resultRange && resultRange.startColumn === oldRange.startColumn && resultRange.startRow === oldRange.startRow ? {
241
+ });
242
+ this._refRangeService = e, this._hyperLinkModel = t, this._selectionManagerService = n, this._commandService = r, this._initData(), this._initRefRange();
243
+ }
244
+ _registerPosition(e, t, n) {
245
+ const r = n.id, i = {
246
+ startColumn: n.column,
247
+ endColumn: n.column,
248
+ startRow: n.row,
249
+ endRow: n.row
250
+ }, a = (o) => {
251
+ const c = et(i, o, { selectionManagerService: this._selectionManagerService }), d = Array.isArray(c) ? c[0] : c;
252
+ return d && d.startColumn === i.startColumn && d.startRow === i.startRow ? {
253
253
  undos: [],
254
254
  redos: []
255
- } : this._handlePositionChange(unitId, subUnitId, link, resultRange, !1);
256
- }, "handleRefRangeChange");
257
- this._disposableMap.set(id, this._refRangeService.registerRefRange(oldRange, handleRefRangeChange, unitId, subUnitId));
258
- }
259
- _watchPosition(unitId, subUnitId, link) {
260
- const id = link.id, oldRange = {
261
- startColumn: link.column,
262
- endColumn: link.column,
263
- startRow: link.row,
264
- endRow: link.row
255
+ } : this._handlePositionChange(e, t, n, d, !1);
256
+ };
257
+ this._disposableMap.set(r, this._refRangeService.registerRefRange(i, a, e, t));
258
+ }
259
+ _watchPosition(e, t, n) {
260
+ const r = n.id, i = {
261
+ startColumn: n.column,
262
+ endColumn: n.column,
263
+ startRow: n.row,
264
+ endRow: n.row
265
265
  };
266
266
  this._watchDisposableMap.set(
267
- id,
268
- this._refRangeService.watchRange(unitId, subUnitId, oldRange, (before, after) => {
269
- const { redos } = this._handlePositionChange(unitId, subUnitId, link, after, !0);
270
- sequenceExecuteAsync(redos, this._commandService, { onlyLocal: !0 });
267
+ r,
268
+ this._refRangeService.watchRange(e, t, i, (a, o) => {
269
+ const { redos: c } = this._handlePositionChange(e, t, n, o, !0);
270
+ ye(c, this._commandService, { onlyLocal: !0 });
271
271
  }, !0)
272
272
  );
273
273
  }
274
- _unregisterPosition(id) {
275
- const disposable = this._disposableMap.get(id);
276
- disposable == null || disposable.dispose(), this._disposableMap.delete(id);
277
- }
278
- _unwatchPosition(id) {
279
- const disposable = this._watchDisposableMap.get(id);
280
- disposable == null || disposable.dispose(), this._watchDisposableMap.delete(id);
281
- }
282
- _registerRange(unitId, id, payload, silent = !1) {
283
- var _a6, _b, _c;
284
- if (payload.startsWith("#")) {
285
- const search = new URLSearchParams(payload.slice(1)), searchObj = {
286
- gid: (_a6 = search.get("gid")) != null ? _a6 : "",
287
- range: (_b = search.get("range")) != null ? _b : "",
288
- rangeid: (_c = search.get("rangeid")) != null ? _c : ""
274
+ _unregisterPosition(e) {
275
+ const t = this._disposableMap.get(e);
276
+ t == null || t.dispose(), this._disposableMap.delete(e);
277
+ }
278
+ _unwatchPosition(e) {
279
+ const t = this._watchDisposableMap.get(e);
280
+ t == null || t.dispose(), this._watchDisposableMap.delete(e);
281
+ }
282
+ _registerRange(e, t, n, r = !1) {
283
+ var i, a, o;
284
+ if (n.startsWith("#")) {
285
+ const c = new URLSearchParams(n.slice(1)), d = {
286
+ gid: (i = c.get("gid")) != null ? i : "",
287
+ range: (a = c.get("range")) != null ? a : "",
288
+ rangeid: (o = c.get("rangeid")) != null ? o : ""
289
289
  };
290
- if (searchObj.range && searchObj.gid) {
291
- const subUnitId = searchObj.gid, range = deserializeRangeWithSheet(searchObj.range).range;
292
- if (isValidRange(range) && searchObj.range !== ERROR_RANGE) {
293
- const handleRangeChange = /* @__PURE__ */ __name((commandInfo) => {
294
- const resultRange = handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests(range, commandInfo, { selectionManagerService: this._selectionManagerService });
295
- return resultRange && serializeRange(resultRange) === serializeRange(range) ? {
290
+ if (d.range && d.gid) {
291
+ const l = d.gid, u = Me(d.range).range;
292
+ if (ve(u) && d.range !== q) {
293
+ const h = (g) => {
294
+ const p = tt(u, g, { selectionManagerService: this._selectionManagerService });
295
+ return p && B(p) === B(u) ? {
296
296
  redos: [],
297
297
  undos: []
298
298
  } : {
299
299
  redos: [{
300
- id: UpdateHyperLinkMutation.id,
300
+ id: fe.id,
301
301
  params: {
302
- unitId,
303
- subUnitId,
304
- id,
302
+ unitId: e,
303
+ subUnitId: l,
304
+ id: t,
305
305
  payload: {
306
- payload: `#gid=${subUnitId}&range=${resultRange ? serializeRange(resultRange) : "err"}`
306
+ payload: `#gid=${l}&range=${p ? B(p) : "err"}`
307
307
  }
308
308
  }
309
309
  }],
310
310
  undos: [{
311
- id: UpdateHyperLinkMutation.id,
311
+ id: fe.id,
312
312
  params: {
313
- unitId,
314
- subUnitId,
315
- id,
313
+ unitId: e,
314
+ subUnitId: l,
315
+ id: t,
316
316
  payload: {
317
- payload
317
+ payload: n
318
318
  }
319
319
  }
320
320
  }]
321
321
  };
322
- }, "handleRangeChange");
323
- this._rangeDisableMap.set(id, this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId)), silent || this._rangeWatcherMap.set(id, this._refRangeService.watchRange(unitId, subUnitId, range, (before, after) => {
324
- this._hyperLinkModel.updateHyperLink(unitId, subUnitId, id, {
325
- payload: `#gid=${subUnitId}&range=${after ? serializeRange(after) : "err"}`
322
+ };
323
+ this._rangeDisableMap.set(t, this._refRangeService.registerRefRange(u, h, e, l)), r || this._rangeWatcherMap.set(t, this._refRangeService.watchRange(e, l, u, (g, p) => {
324
+ this._hyperLinkModel.updateHyperLink(e, l, t, {
325
+ payload: `#gid=${l}&range=${p ? B(p) : "err"}`
326
326
  }, !0);
327
327
  }, !0));
328
328
  }
329
329
  }
330
330
  }
331
331
  }
332
- _unregisterRange(id) {
333
- const disposable = this._rangeDisableMap.get(id);
334
- disposable == null || disposable.dispose(), this._rangeDisableMap.delete(id);
332
+ _unregisterRange(e) {
333
+ const t = this._rangeDisableMap.get(e);
334
+ t == null || t.dispose(), this._rangeDisableMap.delete(e);
335
335
  }
336
- _unwatchRange(id) {
337
- const disposable = this._rangeWatcherMap.get(id);
338
- disposable == null || disposable.dispose(), this._rangeWatcherMap.delete(id);
336
+ _unwatchRange(e) {
337
+ const t = this._rangeWatcherMap.get(e);
338
+ t == null || t.dispose(), this._rangeWatcherMap.delete(e);
339
339
  }
340
340
  _initData() {
341
- this._hyperLinkModel.getAll().forEach((unitData) => {
342
- unitData.forEach((subUnitData) => {
343
- const { unitId, subUnitId, links } = subUnitData;
344
- links.forEach((link) => {
345
- this._registerPosition(unitId, subUnitId, link), this._watchPosition(unitId, subUnitId, link), this._registerRange(unitId, link.id, link.payload);
341
+ this._hyperLinkModel.getAll().forEach((t) => {
342
+ t.forEach((n) => {
343
+ const { unitId: r, subUnitId: i, links: a } = n;
344
+ a.forEach((o) => {
345
+ this._registerPosition(r, i, o), this._watchPosition(r, i, o), this._registerRange(r, o.id, o.payload);
346
346
  });
347
347
  });
348
348
  });
349
349
  }
350
350
  _initRefRange() {
351
351
  this.disposeWithMe(
352
- this._hyperLinkModel.linkUpdate$.subscribe((option) => {
353
- switch (option.type) {
352
+ this._hyperLinkModel.linkUpdate$.subscribe((e) => {
353
+ switch (e.type) {
354
354
  case "add": {
355
- this._registerPosition(option.unitId, option.subUnitId, option.payload), this._watchPosition(option.unitId, option.subUnitId, option.payload), this._registerRange(option.unitId, option.payload.id, option.payload.payload);
355
+ this._registerPosition(e.unitId, e.subUnitId, e.payload), this._watchPosition(e.unitId, e.subUnitId, e.payload), this._registerRange(e.unitId, e.payload.id, e.payload.payload);
356
356
  break;
357
357
  }
358
358
  case "remove": {
359
- this._unregisterPosition(option.payload.id), this._unwatchPosition(option.payload.id), this._unregisterRange(option.payload.id), this._unwatchRange(option.payload.id);
359
+ this._unregisterPosition(e.payload.id), this._unwatchPosition(e.payload.id), this._unregisterRange(e.payload.id), this._unwatchRange(e.payload.id);
360
360
  break;
361
361
  }
362
362
  case "updateRef": {
363
- const { unitId, subUnitId, id, silent } = option, link = this._hyperLinkModel.getHyperLink(unitId, subUnitId, id);
364
- if (!link)
363
+ const { unitId: t, subUnitId: n, id: r, silent: i } = e, a = this._hyperLinkModel.getHyperLink(t, n, r);
364
+ if (!a)
365
365
  return;
366
- this._unregisterPosition(id), this._registerPosition(unitId, subUnitId, link), silent || (this._unwatchPosition(id), this._watchPosition(unitId, subUnitId, link));
366
+ this._unregisterPosition(r), this._registerPosition(t, n, a), i || (this._unwatchPosition(r), this._watchPosition(t, n, a));
367
367
  break;
368
368
  }
369
369
  case "unload": {
370
- const { unitLinks } = option;
371
- unitLinks.forEach((subUnitData) => {
372
- const { links } = subUnitData;
373
- links.forEach((link) => {
374
- this._unregisterPosition(link.id), this._unwatchPosition(link.id), this._unregisterRange(link.id), this._unwatchRange(link.id);
370
+ const { unitLinks: t } = e;
371
+ t.forEach((n) => {
372
+ const { links: r } = n;
373
+ r.forEach((i) => {
374
+ this._unregisterPosition(i.id), this._unwatchPosition(i.id), this._unregisterRange(i.id), this._unwatchRange(i.id);
375
375
  });
376
376
  });
377
377
  break;
378
378
  }
379
379
  case "update": {
380
- option.silent || this._unwatchRange(option.id), this._unregisterRange(option.id), this._registerRange(option.unitId, option.id, option.payload.payload, option.silent);
380
+ e.silent || this._unwatchRange(e.id), this._unregisterRange(e.id), this._registerRange(e.unitId, e.id, e.payload.payload, e.silent);
381
381
  break;
382
382
  }
383
383
  }
384
384
  })
385
- ), this.disposeWithMe(toDisposable(() => {
386
- this._disposableMap.forEach((item) => {
387
- item.dispose();
385
+ ), this.disposeWithMe(Ae(() => {
386
+ this._disposableMap.forEach((e) => {
387
+ e.dispose();
388
388
  }), this._disposableMap.clear();
389
389
  }));
390
390
  }
391
- }, __name(_a2, "SheetsHyperLinkRefRangeController"), _a2);
392
- SheetsHyperLinkRefRangeController = __decorateClass$3([
393
- __decorateParam$3(0, Inject(RefRangeService)),
394
- __decorateParam$3(1, Inject(HyperLinkModel)),
395
- __decorateParam$3(2, Inject(SheetsSelectionsService)),
396
- __decorateParam$3(3, ICommandService)
397
- ], SheetsHyperLinkRefRangeController);
398
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
399
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
400
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
401
- return kind && result && __defProp$2(target, key, result), result;
402
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a3;
403
- let SheetsHyperLinkController = (_a3 = class extends Disposable {
404
- constructor(_commandService) {
405
- super(), this._commandService = _commandService, this._registerCommands();
391
+ };
392
+ Z = Rt([
393
+ Y(0, R(Pe)),
394
+ Y(1, R(v)),
395
+ Y(2, R(Ne)),
396
+ Y(3, U)
397
+ ], Z);
398
+ var It = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, Ct = (s, e, t, n) => {
399
+ for (var r = n > 1 ? void 0 : n ? Mt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
400
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
401
+ return n && r && It(e, t, r), r;
402
+ }, pe = (s, e) => (t, n) => e(t, n, s);
403
+ let Q = class extends V {
404
+ constructor(s, e, t) {
405
+ super(), this._sheetInterceptorService = s, this._univerInstanceService = e, this._hyperLinkModel = t, this._initSheetChange();
406
+ }
407
+ _initSheetChange() {
408
+ this.disposeWithMe(
409
+ this._sheetInterceptorService.interceptCommand({
410
+ getMutations: (s) => {
411
+ var e;
412
+ if (s.id === nt.id) {
413
+ const t = s.params, n = t.unitId ? this._univerInstanceService.getUnit(t.unitId) : this._univerInstanceService.getCurrentUnitForType(S.UNIVER_SHEET);
414
+ if (!n)
415
+ return { redos: [], undos: [] };
416
+ const r = n.getUnitId(), i = t.subUnitId || ((e = n.getActiveSheet()) == null ? void 0 : e.getSheetId());
417
+ if (!i)
418
+ return { redos: [], undos: [] };
419
+ const a = this._hyperLinkModel.getSubUnit(r, i), o = a.map((d) => ({
420
+ id: k.id,
421
+ params: {
422
+ unitId: r,
423
+ subUnitId: i,
424
+ id: d.id
425
+ }
426
+ })), c = a.map((d) => ({
427
+ id: O.id,
428
+ params: {
429
+ unitId: r,
430
+ subUnitId: i,
431
+ link: d
432
+ }
433
+ }));
434
+ return { redos: o, undos: c };
435
+ }
436
+ return { redos: [], undos: [] };
437
+ }
438
+ })
439
+ );
440
+ }
441
+ };
442
+ Q = Ct([
443
+ pe(0, R(de)),
444
+ pe(1, w),
445
+ pe(2, R(v))
446
+ ], Q);
447
+ var wt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Lt = (s, e, t, n) => {
448
+ for (var r = n > 1 ? void 0 : n ? Et(e, t) : e, i = s.length - 1, a; i >= 0; i--)
449
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
450
+ return n && r && wt(e, t, r), r;
451
+ }, he = (s, e) => (t, n) => e(t, n, s);
452
+ let ee = class extends V {
453
+ constructor(e, t, n) {
454
+ super();
455
+ I(this, "_refRangeMap", /* @__PURE__ */ new Map());
456
+ this._commandService = e, this._univerInstanceService = t, this._refRangeService = n, this._initWorkbookLoad(), this._initWorkbookUnload(), this._initSetRangesListener();
457
+ }
458
+ _enusreMap(e, t) {
459
+ let n = this._refRangeMap.get(e);
460
+ n || (n = /* @__PURE__ */ new Map(), this._refRangeMap.set(e, n));
461
+ let r = n.get(t);
462
+ return r || (r = new J(), n.set(t, r)), r;
463
+ }
464
+ _isLegalRangeUrl(e, t) {
465
+ var r, i, a;
466
+ const n = this._univerInstanceService.getUnit(e, S.UNIVER_SHEET);
467
+ if (!n)
468
+ return null;
469
+ if (t && t.startsWith("#")) {
470
+ const o = new URLSearchParams(t.slice(1)), c = {
471
+ gid: (r = o.get("gid")) != null ? r : "",
472
+ range: (i = o.get("range")) != null ? i : "",
473
+ rangeid: (a = o.get("rangeid")) != null ? a : ""
474
+ };
475
+ if (c.range && c.gid) {
476
+ const d = c.gid, l = n.getSheetBySheetId(d);
477
+ if (!l)
478
+ return null;
479
+ const u = Me(c.range).range;
480
+ if (ve(u, l) && c.range !== q)
481
+ return u;
482
+ }
483
+ }
484
+ return null;
485
+ }
486
+ _registerRange(e, t, n, r, i) {
487
+ var o, c, d, l;
488
+ const a = this._enusreMap(e, t);
489
+ if ((c = (o = i.body) == null ? void 0 : o.customRanges) != null && c.some((u) => {
490
+ var h;
491
+ return u.rangeType === N.HYPERLINK && this._isLegalRangeUrl(e, (h = u.properties) == null ? void 0 : h.url);
492
+ })) {
493
+ const u = new We();
494
+ (l = (d = i.body) == null ? void 0 : d.customRanges) == null || l.forEach((h) => {
495
+ var g;
496
+ if (h.rangeType === N.HYPERLINK) {
497
+ const p = (g = h.properties) == null ? void 0 : g.url, f = this._isLegalRangeUrl(e, p);
498
+ f && u.add(this._refRangeService.watchRange(e, t, f, (M, _) => {
499
+ h.properties.url = `#gid=${t}&range=${_ ? B(_) : q}`;
500
+ }));
501
+ }
502
+ }), a.setValue(n, r, u);
503
+ }
504
+ }
505
+ _initWorkbookLoad() {
506
+ const e = (t) => {
507
+ const n = t.getUnitId();
508
+ t.getSheets().forEach((r) => {
509
+ const i = r.getSheetId(), a = this._enusreMap(n, i);
510
+ r.getCellMatrix().forValue((o, c, d) => {
511
+ const l = a.getValue(o, c);
512
+ l && l.dispose(), d && d.p && this._registerRange(n, i, o, c, d.p);
513
+ });
514
+ });
515
+ };
516
+ this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).forEach((t) => {
517
+ e(t);
518
+ }), this.disposeWithMe(
519
+ this._univerInstanceService.unitAdded$.subscribe((t) => {
520
+ t.type === S.UNIVER_SHEET && e(t);
521
+ })
522
+ );
523
+ }
524
+ _initWorkbookUnload() {
525
+ this._univerInstanceService.unitDisposed$.subscribe((e) => {
526
+ if (e.type === S.UNIVER_SHEET) {
527
+ const t = e, n = t.getUnitId();
528
+ t.getSheets().forEach((r) => {
529
+ const i = r.getSheetId();
530
+ this._enusreMap(n, i).forValue((o, c, d) => {
531
+ d && d.dispose();
532
+ });
533
+ }), this._refRangeMap.delete(n);
534
+ }
535
+ });
536
+ }
537
+ _initSetRangesListener() {
538
+ this.disposeWithMe(
539
+ this._commandService.onCommandExecuted((e) => {
540
+ if (e.id === H.id) {
541
+ const t = e.params, { unitId: n, subUnitId: r, cellValue: i } = t, a = this._enusreMap(n, r);
542
+ i && new J(i).forValue((o, c, d) => {
543
+ const l = a.getValue(o, c);
544
+ l && l.dispose(), d && d.p && this._registerRange(n, r, o, c, d.p);
545
+ });
546
+ }
547
+ })
548
+ );
549
+ }
550
+ };
551
+ ee = Lt([
552
+ he(0, U),
553
+ he(1, w),
554
+ he(2, R(Pe))
555
+ ], ee);
556
+ var Ut = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, Pt = (s, e, t, n) => {
557
+ for (var r = n > 1 ? void 0 : n ? bt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
558
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
559
+ return n && r && Ut(e, t, r), r;
560
+ }, z = (s, e) => (t, n) => e(t, n, s);
561
+ let te = class extends V {
562
+ constructor(s, e, t, n) {
563
+ super(), this._sheetInterceptorService = s, this._hyperLinkModel = e, this._selectionManagerService = t, this._univerInstanceService = n, this._initCommandInterceptor(), this._initAfterEditor();
564
+ }
565
+ _initCommandInterceptor() {
566
+ this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
567
+ }
568
+ _initSetRangeValuesCommandInterceptor() {
569
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
570
+ getMutations: (s) => {
571
+ if (s.id === rt.id) {
572
+ const e = s.params, { unitId: t, subUnitId: n } = e, r = [], i = [];
573
+ return e.cellValue && new J(e.cellValue).forValue((a, o) => {
574
+ const c = this._hyperLinkModel.getHyperLinkByLocation(t, n, a, o);
575
+ c && (r.push({
576
+ id: k.id,
577
+ params: {
578
+ unitId: t,
579
+ subUnitId: n,
580
+ id: c.id
581
+ }
582
+ }), i.push({
583
+ id: O.id,
584
+ params: {
585
+ unitId: t,
586
+ subUnitId: n,
587
+ link: c
588
+ }
589
+ }));
590
+ }), {
591
+ undos: i,
592
+ redos: r
593
+ };
594
+ }
595
+ return {
596
+ redos: [],
597
+ undos: []
598
+ };
599
+ }
600
+ }));
601
+ }
602
+ _initClearSelectionCommandInterceptor() {
603
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
604
+ getMutations: (s) => {
605
+ if (s.id === st.id || s.id === it.id || s.id === at.id) {
606
+ const e = [], t = [], n = this._selectionManagerService.getCurrentLastSelection(), r = ce(this._univerInstanceService);
607
+ if (n && r) {
608
+ const { unitId: i, subUnitId: a } = r;
609
+ Be.foreach(n.range, (o, c) => {
610
+ const d = this._hyperLinkModel.getHyperLinkByLocation(i, a, o, c);
611
+ d && (e.push({
612
+ id: k.id,
613
+ params: {
614
+ unitId: i,
615
+ subUnitId: a,
616
+ id: d.id
617
+ }
618
+ }), t.push({
619
+ id: O.id,
620
+ params: {
621
+ unitId: i,
622
+ subUnitId: a,
623
+ link: d
624
+ }
625
+ }));
626
+ });
627
+ }
628
+ return {
629
+ redos: e,
630
+ undos: t
631
+ };
632
+ }
633
+ return {
634
+ redos: [],
635
+ undos: []
636
+ };
637
+ }
638
+ }));
639
+ }
640
+ _initAfterEditor() {
641
+ this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(ot, {
642
+ handler: (s, e, t) => {
643
+ if (!s || s.p)
644
+ return t(s);
645
+ if (typeof s.v == "string" && ie.isLegalUrl(s.v) && s.v[s.v.length - 1] !== " ") {
646
+ const { unitId: n, subUnitId: r } = e, i = this._univerInstanceService.getUnit(n, S.UNIVER_SHEET), a = i == null ? void 0 : i.getSheetBySheetId(r);
647
+ if (!a)
648
+ return t(s);
649
+ const o = a.getBlankCellDocumentModel(s);
650
+ if (!o.documentModel)
651
+ return t(s);
652
+ const c = X.selection.replace({
653
+ selection: {
654
+ startOffset: 0,
655
+ endOffset: s.v.length,
656
+ collapsed: !1
657
+ },
658
+ body: {
659
+ dataStream: `${s.v}`,
660
+ customRanges: [{
661
+ startIndex: 0,
662
+ endIndex: s.v.length - 1,
663
+ rangeId: ae(),
664
+ rangeType: N.HYPERLINK,
665
+ properties: {
666
+ url: s.v
667
+ }
668
+ }]
669
+ },
670
+ doc: o.documentModel
671
+ });
672
+ if (!c)
673
+ return t(s);
674
+ const d = o.documentModel.getBody();
675
+ return oe.apply(d, c.serialize()), t({
676
+ ...s,
677
+ p: {
678
+ id: je,
679
+ body: d,
680
+ documentStyle: {
681
+ pageSize: {
682
+ width: 1 / 0,
683
+ height: 1 / 0
684
+ }
685
+ }
686
+ }
687
+ });
688
+ }
689
+ return t(s);
690
+ }
691
+ }));
692
+ }
693
+ };
694
+ te = Pt([
695
+ z(0, R(de)),
696
+ z(1, R(v)),
697
+ z(2, R(Ne)),
698
+ z(3, w)
699
+ ], te);
700
+ const Nt = {
701
+ type: E.COMMAND,
702
+ id: "sheets.command.add-hyper-link",
703
+ // eslint-disable-next-line max-lines-per-function
704
+ async handler(s, e) {
705
+ if (!e) return !1;
706
+ const t = s.get(U), n = s.get(Se), r = s.get(w), i = s.get(v), a = s.get(de), o = ce(r, e);
707
+ if (!o) return !1;
708
+ const { unitId: c, subUnitId: d, workbook: l, worksheet: u } = o, { link: h } = e, { payload: g, display: p, row: f, column: M, id: _ } = h, b = u.getCell(f, M), m = u.getBlankCellDocumentModel(b), C = m.documentModel.getSnapshot(), y = ie.deepClone(C.body);
709
+ if (!y) return !1;
710
+ let P;
711
+ if (p ? P = X.selection.replace({
712
+ selection: {
713
+ startOffset: 0,
714
+ endOffset: y.dataStream.length - 2,
715
+ collapsed: !0
716
+ },
717
+ body: {
718
+ dataStream: `${p}`,
719
+ customRanges: [{
720
+ startIndex: 0,
721
+ endIndex: p.length - 1,
722
+ rangeType: N.HYPERLINK,
723
+ rangeId: _,
724
+ properties: {
725
+ url: g
726
+ // refId: id,
727
+ }
728
+ }]
729
+ },
730
+ doc: m.documentModel
731
+ }) : P = X.customRange.add({
732
+ body: y,
733
+ range: { startOffset: 0, endOffset: y.dataStream.length - 2, collapsed: !1 },
734
+ rangeId: _,
735
+ rangeType: N.HYPERLINK,
736
+ properties: {
737
+ url: g,
738
+ refId: _
739
+ }
740
+ }), !P) return !1;
741
+ const j = oe.apply(y, P.serialize()), D = {
742
+ p: {
743
+ ...C,
744
+ body: j
745
+ },
746
+ t: Re.STRING
747
+ }, x = await a.onWriteCell(l, u, f, M, D), T = {
748
+ unitId: c,
749
+ subUnitId: d,
750
+ cellValue: {
751
+ [h.row]: {
752
+ [h.column]: x
753
+ }
754
+ }
755
+ }, le = {
756
+ id: H.id,
757
+ params: T
758
+ }, K = Ie(s, T), ue = {
759
+ id: H.id,
760
+ params: K
761
+ }, F = [le], A = [ue], W = i.getHyperLinkByLocation(c, d, f, M);
762
+ return W && (F.push({
763
+ id: k.id,
764
+ params: {
765
+ unitId: c,
766
+ subUnitId: d,
767
+ id: W.id
768
+ }
769
+ }), A.push({
770
+ id: O.id,
771
+ params: {
772
+ unitId: c,
773
+ subUnitId: d,
774
+ link: W
775
+ }
776
+ })), await ye(F, t) ? (n.pushUndoRedo({
777
+ redoMutations: F,
778
+ undoMutations: A,
779
+ unitID: c
780
+ }), !0) : !1;
781
+ }
782
+ }, Ot = {
783
+ id: "sheets.command.add-rich-hyper-link",
784
+ type: E.COMMAND,
785
+ handler: async (s, e) => {
786
+ if (!e)
787
+ return !1;
788
+ const { documentId: t, link: n } = e, r = s.get(U), i = ae(), { payload: a } = n, o = ut(s, {
789
+ unitId: t,
790
+ rangeId: i,
791
+ rangeType: N.HYPERLINK,
792
+ properties: {
793
+ url: a,
794
+ refId: i
795
+ }
796
+ });
797
+ return o ? r.syncExecuteCommand(o.id, o.params) : !1;
798
+ }
799
+ }, kt = {
800
+ type: E.COMMAND,
801
+ id: "sheets.command.cancel-hyper-link",
802
+ // eslint-disable-next-line max-lines-per-function
803
+ handler(s, e) {
804
+ var D, x;
805
+ if (!e) return !1;
806
+ const t = s.get(U), n = s.get(Se), r = s.get(w), i = s.get(v), a = ce(r, e);
807
+ if (!a) return !1;
808
+ const { row: o, column: c, id: d } = e, { unitId: l, subUnitId: u, worksheet: h } = a, g = h.getCell(o, c);
809
+ if (!g) return !1;
810
+ const p = h.getCellDocumentModelWithFormula(g);
811
+ if (!(p != null && p.documentModel)) return !1;
812
+ const f = ie.deepClone(p.documentModel.getSnapshot());
813
+ if (!((x = (D = f.body) == null ? void 0 : D.customRanges) == null ? void 0 : x.find((T) => T.rangeId === d))) return !1;
814
+ const _ = X.customRange.delete(s, { documentDataModel: p.documentModel, rangeId: d });
815
+ if (!_) return !1;
816
+ const b = oe.apply(f.body, _.serialize()), m = [], C = [], y = {
817
+ unitId: l,
818
+ subUnitId: u,
819
+ cellValue: {
820
+ [o]: {
821
+ [c]: {
822
+ p: {
823
+ ...f,
824
+ body: b
825
+ },
826
+ t: Re.STRING
827
+ }
828
+ }
829
+ }
830
+ };
831
+ m.push({
832
+ id: H.id,
833
+ params: y
834
+ });
835
+ const P = Ie(s, y);
836
+ C.push({
837
+ id: H.id,
838
+ params: P
839
+ });
840
+ const j = i.getHyperLinkByLocation(l, u, o, c);
841
+ return j && (m.push({
842
+ id: k.id,
843
+ params: {
844
+ unitId: l,
845
+ subUnitId: u,
846
+ id: d
847
+ }
848
+ }), C.push({
849
+ id: O.id,
850
+ params: {
851
+ unitId: l,
852
+ subUnitId: u,
853
+ link: {
854
+ ...j
855
+ }
856
+ }
857
+ })), Fe(m, t).result ? (n.pushUndoRedo({
858
+ redoMutations: m,
859
+ undoMutations: C,
860
+ unitID: l
861
+ }), !0) : !1;
862
+ }
863
+ }, Dt = {
864
+ type: E.COMMAND,
865
+ id: "sheets.command.cancel-rich-hyper-link",
866
+ handler(s, e) {
867
+ var l, u;
868
+ if (!e)
869
+ return !1;
870
+ const { id: t, documentId: n } = e, r = s.get(U), a = s.get(w).getUnit(n, S.UNIVER_DOC), o = (u = (l = a == null ? void 0 : a.getBody()) == null ? void 0 : l.customRanges) == null ? void 0 : u.find((h) => h.rangeId === t);
871
+ let c = null;
872
+ o && o.endIndex === a.getBody().dataStream.length - 3 && (c = {
873
+ dataStream: " "
874
+ });
875
+ const d = pt(s, { unitId: n, rangeId: t, insert: c });
876
+ return d ? r.syncExecuteCommand(d.id, d.params) : !1;
877
+ }
878
+ }, Ht = {
879
+ type: E.COMMAND,
880
+ id: "sheets.command.update-hyper-link",
881
+ // eslint-disable-next-line max-lines-per-function
882
+ async handler(s, e) {
883
+ var Ce, we, Ee;
884
+ if (!e) return !1;
885
+ const t = s.get(U), n = s.get(Se), r = s.get(w), i = s.get(v), a = s.get(de), o = ce(r);
886
+ if (!o) return !1;
887
+ const { payload: c, row: d, column: l, id: u } = e, { workbook: h, worksheet: g, unitId: p, subUnitId: f } = o, { payload: M, display: _ = "" } = c, b = g.getCell(d, l);
888
+ if (!b) return !1;
889
+ const m = g.getCellDocumentModelWithFormula(b);
890
+ if (!(m != null && m.documentModel)) return !1;
891
+ const C = m.documentModel.getSnapshot(), y = (we = (Ce = C.body) == null ? void 0 : Ce.customRanges) == null ? void 0 : we.find(($e) => $e.rangeId === u);
892
+ if (!y) return !1;
893
+ const P = ae(), $ = (Ee = be(m.documentModel.getBody(), y.startIndex, y.endIndex + 1).textRuns) == null ? void 0 : Ee[0];
894
+ $ && ($.ed = _.length + 1);
895
+ const D = Oe(s, {
896
+ unitId: p,
897
+ body: {
898
+ dataStream: `${_}`,
899
+ customRanges: [{
900
+ rangeId: P,
901
+ rangeType: N.HYPERLINK,
902
+ startIndex: 0,
903
+ endIndex: _.length - 1,
904
+ properties: {
905
+ url: M
906
+ }
907
+ }],
908
+ textRuns: $ ? [$] : void 0
909
+ },
910
+ selection: {
911
+ startOffset: y.startIndex,
912
+ endOffset: y.endIndex + 1,
913
+ collapsed: !1
914
+ },
915
+ doc: m.documentModel
916
+ });
917
+ if (!D)
918
+ return !1;
919
+ const x = oe.apply(ie.deepClone(C.body), D.textX.serialize()), T = {
920
+ p: {
921
+ ...C,
922
+ body: x
923
+ },
924
+ t: Re.STRING
925
+ }, le = await a.onWriteCell(h, g, d, l, T), K = {
926
+ id: H.id,
927
+ params: {
928
+ unitId: p,
929
+ subUnitId: f,
930
+ cellValue: {
931
+ [d]: {
932
+ [l]: le
933
+ }
934
+ }
935
+ }
936
+ }, ue = Ie(s, K.params), F = {
937
+ id: H.id,
938
+ params: ue
939
+ }, A = [K], W = [F], G = i.getHyperLinkByLocation(p, f, d, l);
940
+ return G && (A.push({
941
+ id: k.id,
942
+ params: {
943
+ unitId: p,
944
+ subUnitId: f,
945
+ id: G.id
946
+ }
947
+ }), W.push({
948
+ id: O.id,
949
+ params: {
950
+ unitId: p,
951
+ subUnitId: f,
952
+ link: G
953
+ }
954
+ })), await ye(A, t) ? (n.pushUndoRedo({
955
+ redoMutations: A,
956
+ undoMutations: W,
957
+ unitID: p
958
+ }), !0) : !1;
959
+ }
960
+ }, Vt = {
961
+ type: E.COMMAND,
962
+ id: "sheets.command.update-rich-hyper-link",
963
+ handler: (s, e) => {
964
+ var p, f, M, _;
965
+ if (!e)
966
+ return !1;
967
+ const { documentId: t, payload: n, id: r } = e, i = s.get(w), a = s.get(U), o = i.getUnit(t, S.UNIVER_DOC);
968
+ if (!o)
969
+ return !1;
970
+ const c = (f = (p = o.getBody()) == null ? void 0 : p.customRanges) == null ? void 0 : f.find((b) => b.rangeId === r);
971
+ if (!c)
972
+ return !1;
973
+ const d = (M = e.payload.display) != null ? M : "", l = ae(), h = (_ = be(o.getBody(), c.startIndex, c.endIndex + 1).textRuns) == null ? void 0 : _[0];
974
+ h && (h.ed = d.length + 1);
975
+ const g = Oe(s, {
976
+ unitId: t,
977
+ body: {
978
+ dataStream: `${d}`,
979
+ customRanges: [{
980
+ rangeId: l,
981
+ rangeType: N.HYPERLINK,
982
+ startIndex: 0,
983
+ endIndex: d.length - 1,
984
+ properties: {
985
+ url: n.payload
986
+ }
987
+ }],
988
+ textRuns: h ? [h] : void 0
989
+ },
990
+ selection: {
991
+ startOffset: c.startIndex,
992
+ endOffset: c.endIndex + 1,
993
+ collapsed: !1
994
+ },
995
+ doc: o
996
+ });
997
+ return g ? a.syncExecuteCommand(g.id, g.params) : !1;
998
+ }
999
+ };
1000
+ var $t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, Tt = (s, e, t, n) => {
1001
+ for (var r = n > 1 ? void 0 : n ? xt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
1002
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
1003
+ return n && r && $t(e, t, r), r;
1004
+ }, At = (s, e) => (t, n) => e(t, n, s);
1005
+ let ne = class extends V {
1006
+ constructor(s) {
1007
+ super(), this._commandService = s, this._registerCommands();
406
1008
  }
407
1009
  _registerCommands() {
408
1010
  [
409
- AddHyperLinkMutation,
410
- UpdateHyperLinkMutation,
411
- RemoveHyperLinkMutation,
412
- UpdateHyperLinkRefMutation
413
- ].forEach((command) => {
414
- this._commandService.registerCommand(command);
1011
+ Nt,
1012
+ Ht,
1013
+ kt,
1014
+ Vt,
1015
+ Dt,
1016
+ Ot,
1017
+ O,
1018
+ fe,
1019
+ k,
1020
+ _e
1021
+ ].forEach((s) => {
1022
+ this._commandService.registerCommand(s);
415
1023
  });
416
1024
  }
417
- }, __name(_a3, "SheetsHyperLinkController"), _a3);
418
- SheetsHyperLinkController = __decorateClass$2([
419
- __decorateParam$2(0, ICommandService)
420
- ], SheetsHyperLinkController);
421
- var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}), __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
422
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
423
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
424
- return kind && result && __defProp$1(target, key, result), result;
425
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a4;
426
- let SheetsHyperLinkResourceController = (_a4 = class extends Disposable {
427
- constructor(_resourceManagerService, _hyperLinkModel) {
428
- super(), this._resourceManagerService = _resourceManagerService, this._hyperLinkModel = _hyperLinkModel, this._initSnapshot();
1025
+ };
1026
+ ne = Tt([
1027
+ At(0, U)
1028
+ ], ne);
1029
+ var De = /* @__PURE__ */ ((s) => (s[s.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", s[s.UNIVER_DOC = 1] = "UNIVER_DOC", s[s.UNIVER_SHEET = 2] = "UNIVER_SHEET", s[s.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", s[s.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", s[s.UNRECOGNIZED = -1] = "UNRECOGNIZED", s))(De || {}), Wt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, jt = (s, e, t, n) => {
1030
+ for (var r = n > 1 ? void 0 : n ? Bt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
1031
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
1032
+ return n && r && Wt(e, t, r), r;
1033
+ }, Le = (s, e) => (t, n) => e(t, n, s);
1034
+ let re = class extends V {
1035
+ constructor(s, e) {
1036
+ super(), this._resourceManagerService = s, this._hyperLinkModel = e, this._initSnapshot();
429
1037
  }
430
1038
  _initSnapshot() {
431
- const toJson = /* @__PURE__ */ __name((unitID) => {
432
- const map = this._hyperLinkModel.getUnit(unitID), resultMap = {};
433
- return map ? (map.forEach((info) => {
434
- resultMap[info.subUnitId] = info.links.map(({ display, ...link }) => link);
435
- }), JSON.stringify(resultMap)) : "";
436
- }, "toJson"), parseJson = /* @__PURE__ */ __name((json) => {
437
- if (!json)
1039
+ const s = (t) => {
1040
+ const n = this._hyperLinkModel.getUnit(t), r = {};
1041
+ return n ? (n.forEach((i) => {
1042
+ r[i.subUnitId] = i.links.map(({ display: a, ...o }) => o);
1043
+ }), JSON.stringify(r)) : "";
1044
+ }, e = (t) => {
1045
+ if (!t)
438
1046
  return {};
439
1047
  try {
440
- return JSON.parse(json);
1048
+ return JSON.parse(t);
441
1049
  } catch {
442
1050
  return {};
443
1051
  }
444
- }, "parseJson");
1052
+ };
445
1053
  this.disposeWithMe(
446
1054
  this._resourceManagerService.registerPluginResource({
447
- pluginName: SHEET_HYPER_LINK_PLUGIN,
448
- businesses: [_.UNIVER_SHEET],
449
- toJson: /* @__PURE__ */ __name((unitID) => toJson(unitID), "toJson"),
450
- parseJson: /* @__PURE__ */ __name((json) => parseJson(json), "parseJson"),
451
- onUnLoad: /* @__PURE__ */ __name((unitID) => {
452
- this._hyperLinkModel.deleteUnit(unitID);
453
- }, "onUnLoad"),
454
- onLoad: /* @__PURE__ */ __name(async (unitID, value) => {
455
- Object.keys(value).forEach((subunitId) => {
456
- value[subunitId].forEach((link) => {
457
- this._hyperLinkModel.addHyperLink(unitID, subunitId, link);
1055
+ pluginName: ke,
1056
+ businesses: [De.UNIVER_SHEET],
1057
+ toJson: (t) => s(t),
1058
+ parseJson: (t) => e(t),
1059
+ onUnLoad: (t) => {
1060
+ this._hyperLinkModel.deleteUnit(t);
1061
+ },
1062
+ onLoad: async (t, n) => {
1063
+ Object.keys(n).forEach((r) => {
1064
+ n[r].forEach((a) => {
1065
+ this._hyperLinkModel.addHyperLink(t, r, a);
458
1066
  });
459
1067
  });
460
- }, "onLoad")
1068
+ }
461
1069
  })
462
1070
  );
463
1071
  }
464
- }, __name(_a4, "SheetsHyperLinkResourceController"), _a4);
465
- SheetsHyperLinkResourceController = __decorateClass$1([
466
- __decorateParam$1(0, IResourceManagerService),
467
- __decorateParam$1(1, Inject(HyperLinkModel))
468
- ], SheetsHyperLinkResourceController);
469
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
470
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
471
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
472
- return kind && result && __defProp2(target, key, result), result;
473
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a5;
474
- let UniverSheetsHyperLinkPlugin = (_a5 = class extends Plugin {
475
- constructor(_config = defaultPluginConfig, _injector, _configService) {
476
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
477
- const { ...rest } = this._config;
478
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
1072
+ };
1073
+ re = jt([
1074
+ Le(0, Ke),
1075
+ Le(1, R(v))
1076
+ ], re);
1077
+ var Ft = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, Gt = (s, e, t, n) => {
1078
+ for (var r = n > 1 ? void 0 : n ? Kt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
1079
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
1080
+ return n && r && Ft(e, t, r), r;
1081
+ }, ge = (s, e) => (t, n) => e(t, n, s);
1082
+ let me = class {
1083
+ constructor(s, e, t) {
1084
+ this._univerInstanceService = s, this._localeService = e, this._definedNamesService = t;
1085
+ }
1086
+ buildHyperLink(s, e, t) {
1087
+ return `#${L.SHEET}=${e}${t ? `&${typeof t == "string" ? L.DEFINE_NAME : L.RANGE}=${typeof t == "string" ? t : B(t)}` : ""}`;
1088
+ }
1089
+ parseHyperLink(s) {
1090
+ var e, t, n, r;
1091
+ if (s.startsWith("#")) {
1092
+ const i = new URLSearchParams(s.slice(1)), a = {
1093
+ gid: (e = i.get("gid")) != null ? e : "",
1094
+ range: (t = i.get("range")) != null ? t : "",
1095
+ rangeid: (n = i.get("rangeid")) != null ? n : "",
1096
+ unitid: (r = i.get("unitid")) != null ? r : ""
1097
+ }, o = this._getURLName(a);
1098
+ return {
1099
+ type: o.type,
1100
+ name: o.name,
1101
+ url: s,
1102
+ searchObj: a
1103
+ };
1104
+ } else
1105
+ return {
1106
+ type: L.URL,
1107
+ name: s,
1108
+ url: s,
1109
+ searchObj: null
1110
+ };
1111
+ }
1112
+ _getURLName(s) {
1113
+ var d;
1114
+ const { gid: e, range: t, rangeid: n, unitid: r } = s, i = r ? this._univerInstanceService.getUnit(r, S.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(S.UNIVER_SHEET), a = {
1115
+ type: L.INVALID,
1116
+ name: this._localeService.t("hyperLink.message.refError")
1117
+ };
1118
+ if (!i)
1119
+ return a;
1120
+ const o = e ? i.getSheetBySheetId(e) : i.getActiveSheet(), c = (d = o == null ? void 0 : o.getName()) != null ? d : "";
1121
+ if (t) {
1122
+ if (!o) return a;
1123
+ const l = Me(t).range;
1124
+ return ve(l, o) && t !== q ? {
1125
+ type: L.RANGE,
1126
+ name: ct(c, l)
1127
+ } : a;
1128
+ }
1129
+ if (n) {
1130
+ const l = this._definedNamesService.getValueById(i.getUnitId(), n);
1131
+ return l ? {
1132
+ type: L.DEFINE_NAME,
1133
+ name: l.formulaOrRefString
1134
+ } : a;
1135
+ }
1136
+ if (e) {
1137
+ const l = i.getSheetBySheetId(e);
1138
+ return l ? {
1139
+ type: L.SHEET,
1140
+ name: l.getName()
1141
+ } : a;
1142
+ }
1143
+ return a;
1144
+ }
1145
+ };
1146
+ me = Gt([
1147
+ ge(0, w),
1148
+ ge(1, R(Ge)),
1149
+ ge(2, lt)
1150
+ ], me);
1151
+ var He = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, zt = (s, e, t) => e in s ? He(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Jt = (s, e, t, n) => {
1152
+ for (var r = n > 1 ? void 0 : n ? Yt(e, t) : e, i = s.length - 1, a; i >= 0; i--)
1153
+ (a = s[i]) && (r = (n ? a(e, t, r) : a(r)) || r);
1154
+ return n && r && He(e, t, r), r;
1155
+ }, Ue = (s, e) => (t, n) => e(t, n, s), Ve = (s, e, t) => zt(s, typeof e != "symbol" ? e + "" : e, t);
1156
+ let se = class extends Je {
1157
+ constructor(s = yt, e, t) {
1158
+ super(), this._config = s, this._injector = e, this._configService = t;
1159
+ const { ...n } = this._config;
1160
+ this._configService.setConfig(mt, n);
479
1161
  }
480
1162
  onStarting() {
481
- [
482
- [SheetsHyperLinkResourceController],
483
- [SheetsHyperLinkController],
484
- [SheetsHyperLinkRefRangeController],
485
- [HyperLinkModel]
486
- ].forEach((dep) => {
487
- this._injector.add(dep);
488
- }), this._injector.get(SheetsHyperLinkRefRangeController), this._injector.get(SheetsHyperLinkResourceController), this._injector.get(SheetsHyperLinkController);
489
- }
490
- }, __name(_a5, "UniverSheetsHyperLinkPlugin"), _a5);
491
- __publicField2(UniverSheetsHyperLinkPlugin, "pluginName", SHEET_HYPER_LINK_PLUGIN);
492
- __publicField2(UniverSheetsHyperLinkPlugin, "type", UniverInstanceType.UNIVER_SHEET);
493
- UniverSheetsHyperLinkPlugin = __decorateClass([
494
- DependentOn(UniverSheetsPlugin),
495
- __decorateParam(1, Inject(Injector)),
496
- __decorateParam(2, IConfigService)
497
- ], UniverSheetsHyperLinkPlugin);
1163
+ Xe(this._injector, [
1164
+ [v],
1165
+ [me],
1166
+ [re],
1167
+ [ne],
1168
+ [Z],
1169
+ [te],
1170
+ [Q],
1171
+ [ee]
1172
+ ]), qe(this._injector, [
1173
+ [Z],
1174
+ [re],
1175
+ [ne],
1176
+ [te],
1177
+ [Q],
1178
+ [ee]
1179
+ ]);
1180
+ }
1181
+ };
1182
+ Ve(se, "pluginName", ke);
1183
+ Ve(se, "type", S.UNIVER_SHEET);
1184
+ se = Jt([
1185
+ Ye(dt),
1186
+ Ue(1, R(ze)),
1187
+ Ue(2, Ze)
1188
+ ], se);
498
1189
  export {
499
- AddHyperLinkMutation,
500
- ERROR_RANGE,
501
- HyperLinkModel,
502
- RemoveHyperLinkMutation,
503
- SheetHyperLinkType,
504
- UniverSheetsHyperLinkPlugin,
505
- UpdateHyperLinkMutation,
506
- UpdateHyperLinkRefMutation
1190
+ Nt as AddHyperLinkCommand,
1191
+ O as AddHyperLinkMutation,
1192
+ Ot as AddRichHyperLinkCommand,
1193
+ kt as CancelHyperLinkCommand,
1194
+ Dt as CancelRichHyperLinkCommand,
1195
+ q as ERROR_RANGE,
1196
+ v as HyperLinkModel,
1197
+ k as RemoveHyperLinkMutation,
1198
+ L as SheetHyperLinkType,
1199
+ me as SheetsHyperLinkParserService,
1200
+ se as UniverSheetsHyperLinkPlugin,
1201
+ Ht as UpdateHyperLinkCommand,
1202
+ fe as UpdateHyperLinkMutation,
1203
+ _e as UpdateHyperLinkRefMutation,
1204
+ Vt as UpdateRichHyperLinkCommand
507
1205
  };