@univerjs/sheets-hyper-link-ui 0.2.4 → 0.2.6

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,137 +1,137 @@
1
- var Gt = Object.defineProperty;
2
- var qt = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var W = (e, t, n) => qt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { Disposable as O, UniverInstanceType as E, OnLifecycle as B, LifecycleStages as D, IUniverInstanceService as ue, BooleanNumber as Xt, ThemeService as Jt, isValidRange as ze, LocaleService as pe, RANGE_TYPE as lt, Rectangle as ne, ICommandService as K, Tools as re, DEFAULT_EMPTY_DOCUMENT_VALUE as Qt, createInternalEditorID as en, CommandType as je, CellValueType as dt, ObjectMatrix as _t, Range as Qe, CustomRangeType as tn, IPermissionService as nn, Plugin as rn, DependentOn as on } from "@univerjs/core";
5
- import { RemoveSheetCommand as sn, SheetInterceptorService as et, INTERCEPTOR_POINT as an, SetSelectionsOperation as cn, SetWorksheetActiveOperation as Ee, getSheetCommandTarget as Ct, SheetsSelectionsService as yt, SetRangeValuesMutation as fe, SetRangeValuesUndoMutationFactory as ut, SetRangeValuesCommand as ln, ClearSelectionContentCommand as dn, ClearSelectionAllCommand as un, ClearSelectionFormatCommand as pn, WorkbookViewPermission as hn, WorksheetViewPermission as mn, RangeProtectionPermissionViewPoint as gn, WorkbookEditablePermission as Ne, WorksheetEditPermission as $e, WorksheetInsertHyperlinkPermission as Be, RangeProtectionPermissionEditPoint as De, WorkbookCopyPermission as fn, WorksheetCopyPermission as vn, WorksheetSetCellValuePermission as tt } from "@univerjs/sheets";
6
- import { Inject as h, Injector as Ve } from "@wendellhu/redi";
7
- import { RemoveHyperLinkMutation as T, AddHyperLinkMutation as U, HyperLinkModel as H, ERROR_RANGE as Ge, UpdateHyperLinkCommand as St, AddHyperLinkCommand as Lt, CancelHyperLinkCommand as _n, UniverSheetsHyperLinkPlugin as Cn } from "@univerjs/sheets-hyper-link";
8
- import { SheetSkeletonManagerService as It, ScrollToRangeOperation as kt, SheetCanvasPopManagerService as yn, IEditorBridgeService as Sn, HoverManagerService as Ln, SheetPermissionInterceptorBaseController as Pt, whenSheetEditorFocused as In, getCurrentRangeDisable$ as bt, APPLY_TYPE as oe, IAutoFillService as kn, virtualizeDiscreteRanges as qe, getAutoFillRepeatRange as Pn, COPY_TYPE as bn, rangeToDiscreteRange as Rn, PREDEFINED_HOOK_NAME as ve, getRepeatRange as wn, ISheetClipboardService as En } from "@univerjs/sheets-ui";
9
- import { IRenderManagerService as nt } from "@univerjs/engine-render";
10
- import { debounceTime as Rt, Subject as On, BehaviorSubject as Mn } from "rxjs";
11
- import xn, { forwardRef as Y, useRef as wt, createElement as Z, useState as ee, useEffect as Et, useMemo as Tn } from "react";
12
- import { useDependency as k } from "@wendellhu/redi/react-bindings";
13
- import pt from "clsx";
14
- import { MessageType as ce, FormLayout as X, Input as ht, Select as Ke, Button as mt, Tooltip as _e } from "@univerjs/design";
15
- import { IMessageService as Ot, useObservable as Un, useEvent as Hn, RangeSelector as jn, ISidebarService as Mt, KeyCode as Nn, MetaKeys as $n, MenuItemType as xt, MenuPosition as Tt, getMenuHiddenObservable as Ut, MenuGroup as Bn, ComponentManager as Dn, IShortcutService as Vn, IMenuService as An } from "@univerjs/ui";
16
- import { deserializeRangeWithSheet as Oe, serializeRangeWithSheet as Ht, IDefinedNamesService as jt, serializeRangeToRefString as Wn, serializeRange as Fn } from "@univerjs/engine-formula";
17
- import { DOC_HYPER_LINK_PLUGIN as Kn } from "@univerjs/docs-hyper-link";
18
- import { getPlainTextFormDocument as Yn } from "@univerjs/docs";
19
- var Zn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Gn = (e, t, n, r) => {
20
- for (var i = r > 1 ? void 0 : r ? zn(t, n) : t, o = e.length - 1, s; o >= 0; o--)
21
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
22
- return r && i && Zn(t, n, i), i;
23
- }, Ye = (e, t) => (n, r) => t(n, r, e);
24
- let ye = class extends O {
25
- constructor(e, t, n) {
26
- super(), this._sheetInterceptorService = e, this._univerInstanceService = t, this._hyperLinkModel = n, this._initSheetChange();
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, UniverInstanceType, OnLifecycle, LifecycleStages, Inject, IUniverInstanceService, BooleanNumber, ThemeService, isValidRange, LocaleService, RANGE_TYPE, Rectangle, ICommandService, Tools, DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, createInternalEditorID, CommandType, CellValueType, ObjectMatrix, Range, CustomRangeType, Injector, IPermissionService, Plugin, DependentOn } from "@univerjs/core";
6
+ import { RemoveSheetCommand, SheetInterceptorService, INTERCEPTOR_POINT, SetSelectionsOperation, SetWorksheetActiveOperation, getSheetCommandTarget, SheetsSelectionsService, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRangeValuesCommand, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, WorkbookCopyPermission, WorksheetCopyPermission, WorksheetSetCellValuePermission } from "@univerjs/sheets";
7
+ import { RemoveHyperLinkMutation, AddHyperLinkMutation, HyperLinkModel, ERROR_RANGE, UpdateHyperLinkCommand, AddHyperLinkCommand, CancelHyperLinkCommand, UniverSheetsHyperLinkPlugin } from "@univerjs/sheets-hyper-link";
8
+ import { SheetSkeletonManagerService, ScrollToRangeOperation, SheetCanvasPopManagerService, IEditorBridgeService, HoverManagerService, SheetPermissionInterceptorBaseController, whenSheetEditorFocused, getCurrentRangeDisable$, APPLY_TYPE, IAutoFillService, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService } from "@univerjs/sheets-ui";
9
+ import { IRenderManagerService } from "@univerjs/engine-render";
10
+ import { debounceTime, Subject, BehaviorSubject } from "rxjs";
11
+ import require$$0, { forwardRef, useRef, createElement, useState, useEffect, useMemo } from "react";
12
+ import cs from "clsx";
13
+ import { MessageType, FormLayout, Input, Select, Button, Tooltip } from "@univerjs/design";
14
+ import { IMessageService, useObservable, useEvent, RangeSelector, ISidebarService, KeyCode, MetaKeys, MenuItemType, MenuPosition, getMenuHiddenObservable, MenuGroup, ComponentManager, IShortcutService, IMenuService } from "@univerjs/ui";
15
+ import { deserializeRangeWithSheet, serializeRangeWithSheet, IDefinedNamesService, serializeRangeToRefString, serializeRange } from "@univerjs/engine-formula";
16
+ import { DOC_HYPER_LINK_PLUGIN } from "@univerjs/docs-hyper-link";
17
+ import { getPlainTextFormDocument } from "@univerjs/docs";
18
+ var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
19
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
20
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
21
+ return kind && result && __defProp$b(target, key, result), result;
22
+ }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a;
23
+ let SheetsHyperLinkRemoveSheetController = (_a = class extends Disposable {
24
+ constructor(_sheetInterceptorService, _univerInstanceService, _hyperLinkModel) {
25
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._hyperLinkModel = _hyperLinkModel, this._initSheetChange();
27
26
  }
28
27
  _initSheetChange() {
29
28
  this.disposeWithMe(
30
29
  this._sheetInterceptorService.interceptCommand({
31
- getMutations: (e) => {
32
- var t;
33
- if (e.id === sn.id) {
34
- const n = e.params, r = n.unitId ? this._univerInstanceService.getUnit(n.unitId) : this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
35
- if (!r)
30
+ getMutations: /* @__PURE__ */ __name((commandInfo) => {
31
+ var _a14;
32
+ if (commandInfo.id === RemoveSheetCommand.id) {
33
+ const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
34
+ if (!workbook)
36
35
  return { redos: [], undos: [] };
37
- const i = r.getUnitId(), o = n.subUnitId || ((t = r.getActiveSheet()) == null ? void 0 : t.getSheetId());
38
- if (!o)
36
+ const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a14 = workbook.getActiveSheet()) == null ? void 0 : _a14.getSheetId());
37
+ if (!subUnitId)
39
38
  return { redos: [], undos: [] };
40
- const s = this._hyperLinkModel.getSubUnit(i, o), c = s.map((u) => ({
41
- id: T.id,
39
+ const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
40
+ id: RemoveHyperLinkMutation.id,
42
41
  params: {
43
- unitId: i,
44
- subUnitId: o,
45
- id: u.id
42
+ unitId,
43
+ subUnitId,
44
+ id: link.id
46
45
  }
47
- })), a = s.map((u) => ({
48
- id: U.id,
46
+ })), undos = links.map((link) => ({
47
+ id: AddHyperLinkMutation.id,
49
48
  params: {
50
- unitId: i,
51
- subUnitId: o,
52
- link: u
49
+ unitId,
50
+ subUnitId,
51
+ link
53
52
  }
54
53
  }));
55
- return { redos: c, undos: a };
54
+ return { redos, undos };
56
55
  }
57
56
  return { redos: [], undos: [] };
58
- }
57
+ }, "getMutations")
59
58
  })
60
59
  );
61
60
  }
62
- };
63
- ye = Gn([
64
- B(D.Ready, ye),
65
- Ye(0, h(et)),
66
- Ye(1, ue),
67
- Ye(2, h(H))
68
- ], ye);
69
- var qn = Object.defineProperty, Xn = Object.getOwnPropertyDescriptor, Nt = (e, t, n, r) => {
70
- for (var i = r > 1 ? void 0 : r ? Xn(t, n) : t, o = e.length - 1, s; o >= 0; o--)
71
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
72
- return r && i && qn(t, n, i), i;
73
- }, te = (e, t) => (n, r) => t(n, r, e);
74
- let Xe = class extends O {
75
- constructor(e, t, n, r) {
76
- super(), this._context = e, this._hyperLinkModel = t, this._sheetSkeletonManagerService = n, this._renderManagerService = r, this._initSkeletonChange();
61
+ }, __name(_a, "SheetsHyperLinkRemoveSheetController"), _a);
62
+ SheetsHyperLinkRemoveSheetController = __decorateClass$b([
63
+ OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRemoveSheetController),
64
+ __decorateParam$b(0, Inject(SheetInterceptorService)),
65
+ __decorateParam$b(1, IUniverInstanceService),
66
+ __decorateParam$b(2, Inject(HyperLinkModel))
67
+ ], SheetsHyperLinkRemoveSheetController);
68
+ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPropertyDescriptor, __decorateClass$a = /* @__PURE__ */ __name((decorators, target, key, kind) => {
69
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
70
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
71
+ return kind && result && __defProp$a(target, key, result), result;
72
+ }, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a2;
73
+ let SheetsHyperLinkRenderController = (_a2 = class extends Disposable {
74
+ constructor(_context, _hyperLinkModel, _sheetSkeletonManagerService, _renderManagerService) {
75
+ super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._renderManagerService = _renderManagerService, this._initSkeletonChange();
77
76
  }
78
77
  _initSkeletonChange() {
79
- const e = () => {
80
- var s;
81
- const t = this._context.unit, n = t.getUnitId(), r = (s = t.getActiveSheet()) == null ? void 0 : s.getSheetId();
82
- if (!r) {
78
+ const markSkeletonDirty = /* @__PURE__ */ __name(() => {
79
+ var _a14;
80
+ const workbook = this._context.unit, unitId = workbook.getUnitId(), subUnitId = (_a14 = workbook.getActiveSheet()) == null ? void 0 : _a14.getSheetId();
81
+ if (!subUnitId) {
83
82
  console.warn("No active sheet found");
84
83
  return;
85
84
  }
86
- const i = this._sheetSkeletonManagerService.getOrCreateSkeleton({ sheetId: r }), o = this._renderManagerService.getRenderById(n);
87
- i == null || i.makeDirty(!0), i == null || i.calculate(), o && o.mainComponent.makeForceDirty();
88
- };
89
- this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(Rt(16)).subscribe(() => {
90
- e();
85
+ const skeleton = this._sheetSkeletonManagerService.getOrCreateSkeleton({ sheetId: subUnitId }), currentRender = this._renderManagerService.getRenderById(unitId);
86
+ skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
87
+ }, "markSkeletonDirty");
88
+ this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
89
+ markSkeletonDirty();
91
90
  }));
92
91
  }
93
- };
94
- Xe = Nt([
95
- te(1, h(H)),
96
- te(2, h(It)),
97
- te(3, nt)
98
- ], Xe);
99
- let Se = class extends O {
100
- constructor(e, t, n) {
101
- super(), this._sheetInterceptorService = e, this._hyperLinkModel = t, this._themeService = n, this._initViewModelIntercept();
92
+ }, __name(_a2, "SheetsHyperLinkRenderController"), _a2);
93
+ SheetsHyperLinkRenderController = __decorateClass$a([
94
+ __decorateParam$a(1, Inject(HyperLinkModel)),
95
+ __decorateParam$a(2, Inject(SheetSkeletonManagerService)),
96
+ __decorateParam$a(3, IRenderManagerService)
97
+ ], SheetsHyperLinkRenderController);
98
+ var _a3;
99
+ let SheetsHyperLinkRenderManagerController = (_a3 = class extends Disposable {
100
+ constructor(_sheetInterceptorService, _hyperLinkModel, _themeService) {
101
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._themeService = _themeService, this._initViewModelIntercept();
102
102
  }
103
103
  _initViewModelIntercept() {
104
104
  this.disposeWithMe(
105
105
  this._sheetInterceptorService.intercept(
106
- an.CELL_CONTENT,
106
+ INTERCEPTOR_POINT.CELL_CONTENT,
107
107
  {
108
- handler: (e, t, n) => {
109
- const { row: r, col: i, unitId: o, subUnitId: s } = t, c = this._hyperLinkModel.getHyperLinkByLocation(o, s, r, i), a = this._themeService.getCurrentTheme();
110
- return n(c ? {
111
- ...e,
108
+ handler: /* @__PURE__ */ __name((cell, pos, next) => {
109
+ const { row, col, unitId, subUnitId } = pos, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col), styleSheet = this._themeService.getCurrentTheme();
110
+ return next(link ? {
111
+ ...cell,
112
112
  interceptorStyle: {
113
113
  ul: {
114
- s: Xt.TRUE
114
+ s: BooleanNumber.TRUE
115
115
  },
116
116
  cl: {
117
- rgb: a.blue500
117
+ rgb: styleSheet.blue500
118
118
  }
119
119
  }
120
- } : e);
121
- },
120
+ } : cell);
121
+ }, "handler"),
122
122
  priority: 100
123
123
  }
124
124
  )
125
125
  );
126
126
  }
127
- };
128
- Se = Nt([
129
- B(D.Ready, Se),
130
- te(0, h(et)),
131
- te(1, h(H)),
132
- te(2, h(Jt))
133
- ], Se);
134
- var $t = { exports: {} }, Ae = {};
127
+ }, __name(_a3, "SheetsHyperLinkRenderManagerController"), _a3);
128
+ SheetsHyperLinkRenderManagerController = __decorateClass$a([
129
+ OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRenderManagerController),
130
+ __decorateParam$a(0, Inject(SheetInterceptorService)),
131
+ __decorateParam$a(1, Inject(HyperLinkModel)),
132
+ __decorateParam$a(2, Inject(ThemeService))
133
+ ], SheetsHyperLinkRenderManagerController);
134
+ var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
135
135
  /**
136
136
  * @license React
137
137
  * react-jsx-runtime.production.min.js
@@ -141,158 +141,165 @@ var $t = { exports: {} }, Ae = {};
141
141
  * This source code is licensed under the MIT license found in the
142
142
  * LICENSE file in the root directory of this source tree.
143
143
  */
144
- var Jn = xn, Qn = Symbol.for("react.element"), er = Symbol.for("react.fragment"), tr = Object.prototype.hasOwnProperty, nr = Jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, rr = { key: !0, ref: !0, __self: !0, __source: !0 };
145
- function Bt(e, t, n) {
146
- var r, i = {}, o = null, s = null;
147
- n !== void 0 && (o = "" + n), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
148
- for (r in t) tr.call(t, r) && !rr.hasOwnProperty(r) && (i[r] = t[r]);
149
- if (e && e.defaultProps) for (r in t = e.defaultProps, t) i[r] === void 0 && (i[r] = t[r]);
150
- return { $$typeof: Qn, type: e, key: o, ref: s, props: i, _owner: nr.current };
144
+ var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
145
+ function q(c, a, g) {
146
+ var b, d = {}, e = null, h = null;
147
+ g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
148
+ for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
149
+ if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
150
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
151
151
  }
152
- Ae.Fragment = er;
153
- Ae.jsx = Bt;
154
- Ae.jsxs = Bt;
155
- $t.exports = Ae;
156
- var d = $t.exports, b = function() {
157
- return b = Object.assign || function(e) {
158
- for (var t, n = 1, r = arguments.length; n < r; n++) {
159
- t = arguments[n];
160
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
152
+ __name(q, "q");
153
+ reactJsxRuntime_production_min.Fragment = l;
154
+ reactJsxRuntime_production_min.jsx = q;
155
+ reactJsxRuntime_production_min.jsxs = q;
156
+ jsxRuntime.exports = reactJsxRuntime_production_min;
157
+ var jsxRuntimeExports = jsxRuntime.exports, __assign = function() {
158
+ return __assign = Object.assign || function(t) {
159
+ for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
160
+ s = arguments[i];
161
+ for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && (t[p2] = s[p2]);
161
162
  }
162
- return e;
163
- }, b.apply(this, arguments);
164
- }, ir = function(e, t) {
165
- var n = {};
166
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
167
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
168
- for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++)
169
- t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
170
- return n;
171
- }, z = Y(function(e, t) {
172
- var n = e.icon, r = e.id, i = e.className, o = e.extend, s = ir(e, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), a = wt("_".concat(ar()));
173
- return Dt(n, "".concat(r), { defIds: n.defIds, idSuffix: a.current }, b({ ref: t, className: c }, s), o);
163
+ return t;
164
+ }, __assign.apply(this, arguments);
165
+ }, __rest = function(s, e) {
166
+ var t = {};
167
+ for (var p2 in s) Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0 && (t[p2] = s[p2]);
168
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
169
+ for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++)
170
+ e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]) && (t[p2[i]] = s[p2[i]]);
171
+ return t;
172
+ }, IconBase = forwardRef(function(props, ref) {
173
+ var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
174
+ return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
174
175
  });
175
- function Dt(e, t, n, r, i) {
176
- return Z(e.tag, b(b({ key: t }, or(e, n, i)), r), (sr(e, n).children || []).map(function(o, s) {
177
- return Dt(o, "".concat(t, "-").concat(e.tag, "-").concat(s), n, void 0, i);
176
+ function render(node, id, runtimeProps, rootProps, extend) {
177
+ return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
178
+ return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
178
179
  }));
179
180
  }
180
- function or(e, t, n) {
181
- var r = b({}, e.attrs);
182
- n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
183
- var i = t.defIds;
184
- return !i || i.length === 0 || (e.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + t.idSuffix), Object.entries(r).forEach(function(o) {
185
- var s = o[0], c = o[1];
186
- typeof c == "string" && (r[s] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
187
- })), r;
181
+ __name(render, "render");
182
+ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
183
+ var attrs = __assign({}, node.attrs);
184
+ extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
185
+ var defIds = runtimeProps.defIds;
186
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a14) {
187
+ var key = _a14[0], value = _a14[1];
188
+ typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
189
+ })), attrs;
188
190
  }
189
- function sr(e, t) {
190
- var n, r = t.defIds;
191
- return !r || r.length === 0 ? e : e.tag === "defs" && (!((n = e.children) === null || n === void 0) && n.length) ? b(b({}, e), { children: e.children.map(function(i) {
192
- return typeof i.attrs.id == "string" && r && r.indexOf(i.attrs.id) > -1 ? b(b({}, i), { attrs: b(b({}, i.attrs), { id: i.attrs.id + t.idSuffix }) }) : i;
193
- }) }) : e;
191
+ __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
192
+ function replaceRuntimeIdsInDefs(node, runtimeProps) {
193
+ var _a14, defIds = runtimeProps.defIds;
194
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a14 = node.children) === null || _a14 === void 0) && _a14.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
195
+ return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
196
+ }) }) : node;
194
197
  }
195
- function ar() {
198
+ __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
199
+ function generateShortUuid() {
196
200
  return Math.random().toString(36).substring(2, 8);
197
201
  }
198
- z.displayName = "UniverIcon";
199
- var cr = { 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" } }] }, Le = Y(function(e, t) {
200
- return Z(z, Object.assign({}, e, {
202
+ __name(generateShortUuid, "generateShortUuid");
203
+ IconBase.displayName = "UniverIcon";
204
+ var element$5 = { 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" } }] }, AllBorderSingle = forwardRef(function(props, ref) {
205
+ return createElement(IconBase, Object.assign({}, props, {
201
206
  id: "all-border-single",
202
- ref: t,
203
- icon: cr
207
+ ref,
208
+ icon: element$5
204
209
  }));
205
210
  });
206
- Le.displayName = "AllBorderSingle";
207
- var lr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.02547 12.4251C5.15328 13.7417 6.26305 14.7708 7.61318 14.7708H12.6132C14.0491 14.7708 15.2132 13.6067 15.2132 12.1708V6.1708C15.2132 4.78586 14.1303 3.65383 12.7651 3.57517C12.6373 2.25858 11.5275 1.22949 10.1774 1.22949H5.17739C3.74145 1.22949 2.57739 2.39355 2.57739 3.82949V9.82949C2.57739 11.2144 3.66024 12.3465 5.02547 12.4251ZM11.5535 3.5708H7.61318C6.17724 3.5708 5.01318 4.73486 5.01318 6.1708V11.22C4.31736 11.1387 3.77739 10.5471 3.77739 9.82949V3.82949C3.77739 3.05629 4.40419 2.42949 5.17739 2.42949H10.1774C10.8622 2.42949 11.4322 2.92119 11.5535 3.5708ZM14.0132 6.1708C14.0132 5.3976 13.3864 4.7708 12.6132 4.7708H7.61318C6.83998 4.7708 6.21318 5.3976 6.21318 6.1708V12.1708C6.21318 12.944 6.83998 13.5708 7.61318 13.5708H12.6132C13.3864 13.5708 14.0132 12.944 14.0132 12.1708V6.1708Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Vt = Y(function(e, t) {
208
- return Z(z, Object.assign({}, e, {
211
+ AllBorderSingle.displayName = "AllBorderSingle";
212
+ var element$4 = { 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" } }] }, CopySingle = forwardRef(function(props, ref) {
213
+ return createElement(IconBase, Object.assign({}, props, {
209
214
  id: "copy-single",
210
- ref: t,
211
- icon: lr
215
+ ref,
216
+ icon: element$4
212
217
  }));
213
218
  });
214
- Vt.displayName = "CopySingle";
215
- var dr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332", fillRule: "evenodd", clipRule: "evenodd" } }] }, Me = Y(function(e, t) {
216
- return Z(z, Object.assign({}, e, {
219
+ CopySingle.displayName = "CopySingle";
220
+ var element$3 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.9564 2.91332C4.91407 1.87102 3.22413 1.87101 2.18182 2.91333L2.18182 2.91333C1.13953 3.95567 1.13952 5.6456 2.18182 6.68791L8.27777 12.7838C9.72408 14.2302 12.069 14.2302 13.5154 12.7839L13.0911 12.3596L13.5154 12.7839C14.9617 11.3375 14.9617 8.99257 13.5154 7.54626L8.39476 2.42566C8.16044 2.19134 7.78054 2.19134 7.54623 2.42566C7.31191 2.65997 7.31191 3.03987 7.54623 3.27419L12.6668 8.39479L13.0911 7.97052L12.6668 8.39479C13.6445 9.37247 13.6445 10.9576 12.6668 11.9353L13.0399 12.3084L12.6668 11.9353C11.6891 12.913 10.104 12.913 9.1263 11.9353L3.03035 5.83938C2.45668 5.26571 2.45667 4.33556 3.03036 3.76184C3.60403 3.18818 4.53416 3.18817 5.10788 3.76185C5.10788 3.76186 5.10788 3.76186 5.10789 3.76186L11.2038 9.8578L11.601 9.46061L11.2038 9.8578C11.3735 10.0275 11.3735 10.3026 11.2038 10.4723L11.2038 10.4723C11.0341 10.642 10.759 10.642 10.5893 10.4723L5.46874 5.35171C5.23442 5.1174 4.85452 5.1174 4.62021 5.35171C4.38589 5.58602 4.38589 5.96592 4.62021 6.20024L9.74078 11.3208C10.3791 11.9591 11.414 11.9591 12.0523 11.3208C12.0523 11.3208 12.0523 11.3208 12.0523 11.3208M12.0523 11.3208C12.6907 10.6825 12.6906 9.64757 12.0523 9.00927L5.95641 2.91333L5.9564 2.91332", fillRule: "evenodd", clipRule: "evenodd" } }] }, LinkSingle = forwardRef(function(props, ref) {
221
+ return createElement(IconBase, Object.assign({}, props, {
217
222
  id: "link-single",
218
- ref: t,
219
- icon: dr
223
+ ref,
224
+ icon: element$3
220
225
  }));
221
226
  });
222
- Me.displayName = "LinkSingle";
223
- var ur = { 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" } }] }, At = Y(function(e, t) {
224
- return Z(z, Object.assign({}, e, {
227
+ LinkSingle.displayName = "LinkSingle";
228
+ var element$2 = { 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" } }] }, UnlinkSingle = forwardRef(function(props, ref) {
229
+ return createElement(IconBase, Object.assign({}, props, {
225
230
  id: "unlink-single",
226
- ref: t,
227
- icon: ur
231
+ ref,
232
+ icon: element$2
228
233
  }));
229
234
  });
230
- At.displayName = "UnlinkSingle";
231
- var pr = { 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" } }] }, Wt = Y(function(e, t) {
232
- return Z(z, Object.assign({}, e, {
235
+ UnlinkSingle.displayName = "UnlinkSingle";
236
+ var element$1 = { 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" } }] }, WriteSingle = forwardRef(function(props, ref) {
237
+ return createElement(IconBase, Object.assign({}, props, {
233
238
  id: "write-single",
234
- ref: t,
235
- icon: pr
239
+ ref,
240
+ icon: element$1
236
241
  }));
237
242
  });
238
- Wt.displayName = "WriteSingle";
239
- var hr = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#35BD4B", d: "M3.36396 1.12549C2.61066 1.12549 2 1.73615 2 2.48945V13.5104C2 14.2637 2.61066 14.8744 3.36396 14.8744H12.457C13.2103 14.8744 13.821 14.2637 13.821 13.5104V5.0992L9.91954 1.12549H3.36396Z" } }, { tag: "path", attrs: { fill: "#32A846", d: "M9.91797 1.12549L13.8209 5.09842H10.5846C10.2164 5.09842 9.91797 4.79994 9.91797 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.71926 10.2949L6.28687 12.403C6.17306 12.5705 5.94501 12.614 5.77751 12.5002C5.61002 12.3864 5.56649 12.1584 5.6803 11.9909L7.27596 9.64252L5.85088 7.54519C5.73707 7.37769 5.78059 7.14964 5.94809 7.03583C6.11558 6.92202 6.34363 6.96555 6.45744 7.13304L7.71926 8.9901L8.98108 7.13304C9.09489 6.96555 9.32294 6.92202 9.49044 7.03583C9.65793 7.14964 9.70146 7.37769 9.58765 7.54519L8.16256 9.64252L9.75822 11.9909C9.87203 12.1584 9.82851 12.3864 9.66101 12.5002C9.49351 12.614 9.26547 12.5705 9.15166 12.403L7.71926 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Je = Y(function(e, t) {
240
- return Z(z, Object.assign({}, e, {
243
+ WriteSingle.displayName = "WriteSingle";
244
+ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "#35BD4B", d: "M3.4535 1.12549C2.7002 1.12549 2.08954 1.73615 2.08954 2.48945V13.5104C2.08954 14.2637 2.7002 14.8744 3.4535 14.8744H12.5465C13.2998 14.8744 13.9105 14.2637 13.9105 13.5104V5.0992L10.0091 1.12549H3.4535Z" } }, { tag: "path", attrs: { fill: "#32A846", d: "M10.0075 1.12549L13.9104 5.09842H10.6742C10.306 5.09842 10.0075 4.79994 10.0075 4.43175V1.12549Z" } }, { tag: "path", attrs: { fill: "#fff", d: "M7.8088 10.2949L6.3764 12.403C6.26259 12.5705 6.03455 12.614 5.86705 12.5002C5.69955 12.3864 5.65603 12.1584 5.76984 11.9909L7.3655 9.64252L5.94042 7.54519C5.82661 7.37769 5.87013 7.14964 6.03763 7.03583C6.20512 6.92202 6.43317 6.96555 6.54698 7.13304L7.8088 8.9901L9.07062 7.13304C9.18443 6.96555 9.41248 6.92202 9.57997 7.03583C9.74747 7.14964 9.79099 7.37769 9.67718 7.54519L8.2521 9.64252L9.84776 11.9909C9.96157 12.1584 9.91805 12.3864 9.75055 12.5002C9.58305 12.614 9.35501 12.5705 9.2412 12.403L7.8088 10.2949Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Xlsx = forwardRef(function(props, ref) {
245
+ return createElement(IconBase, Object.assign({}, props, {
241
246
  id: "xlsx",
242
- ref: t,
243
- icon: hr
247
+ ref,
248
+ icon: element
244
249
  }));
245
250
  });
246
- Je.displayName = "Xlsx";
247
- var mr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, fr = (e, t, n, r) => {
248
- for (var i = r > 1 ? void 0 : r ? gr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
249
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
250
- return r && i && mr(t, n, i), i;
251
- }, se = (e, t) => (n, r) => t(n, r, e);
252
- function vr(e, t) {
253
- const n = t.getMergeData(), r = t.getMaxColumns() - 1, i = t.getMaxRows() - 1;
254
- if (r < e.endColumn && (e.endColumn = r), i < e.endRow && (e.endRow = i), e.rangeType === lt.COLUMN || lt.ROW)
255
- return e;
256
- const o = [];
257
- return n.forEach((s) => {
258
- ne.intersects(e, s) && o.push(s);
259
- }), ne.realUnion(e, ...o);
251
+ Xlsx.displayName = "Xlsx";
252
+ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
253
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
254
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
255
+ return kind && result && __defProp$9(target, key, result), result;
256
+ }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9");
257
+ function getContainRange(range, worksheet) {
258
+ const mergedCells = worksheet.getMergeData(), maxCol = worksheet.getMaxColumns() - 1, maxRow = worksheet.getMaxRows() - 1;
259
+ if (maxCol < range.endColumn && (range.endColumn = maxCol), maxRow < range.endRow && (range.endRow = maxRow), range.rangeType === RANGE_TYPE.COLUMN || RANGE_TYPE.ROW)
260
+ return range;
261
+ const relativeCells = [];
262
+ return mergedCells.forEach((cell) => {
263
+ Rectangle.intersects(range, cell) && relativeCells.push(cell);
264
+ }), Rectangle.realUnion(range, ...relativeCells);
260
265
  }
261
- let F = class {
262
- constructor(e, t, n, r, i) {
263
- this._univerInstanceService = e, this._commandService = t, this._definedNamesService = n, this._messageService = r, this._localeService = i;
266
+ __name(getContainRange, "getContainRange");
267
+ var _a4;
268
+ let SheetsHyperLinkResolverService = (_a4 = class {
269
+ constructor(_univerInstanceService, _commandService, _definedNamesService, _messageService, _localeService) {
270
+ this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._definedNamesService = _definedNamesService, this._messageService = _messageService, this._localeService = _localeService;
264
271
  }
265
- _getURLName(e) {
266
- var c;
267
- const { gid: t, range: n, rangeid: r } = e, i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
268
- if (!i)
272
+ _getURLName(params) {
273
+ var _a14;
274
+ const { gid, range, rangeid } = params, workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
275
+ if (!workbook)
269
276
  return null;
270
- const o = t ? i.getSheetBySheetId(t) : i.getActiveSheet(), s = (c = o == null ? void 0 : o.getName()) != null ? c : "";
271
- if (n) {
272
- const a = Oe(n).range;
273
- return ze(a) && n !== Ge ? {
277
+ const sheet = gid ? workbook.getSheetBySheetId(gid) : workbook.getActiveSheet(), sheetName = (_a14 = sheet == null ? void 0 : sheet.getName()) != null ? _a14 : "";
278
+ if (range) {
279
+ const rangeObj = deserializeRangeWithSheet(range).range;
280
+ return isValidRange(rangeObj) && range !== ERROR_RANGE ? {
274
281
  type: "range",
275
- name: Ht(s, a)
282
+ name: serializeRangeWithSheet(sheetName, rangeObj)
276
283
  } : {
277
284
  type: "range-error",
278
285
  name: this._localeService.t("hyperLink.message.refError")
279
286
  };
280
287
  }
281
- if (r) {
282
- const a = this._definedNamesService.getValueById(i.getUnitId(), r);
283
- return a ? {
288
+ if (rangeid) {
289
+ const range2 = this._definedNamesService.getValueById(workbook.getUnitId(), rangeid);
290
+ return range2 ? {
284
291
  type: "defineName",
285
- name: a.formulaOrRefString
292
+ name: range2.formulaOrRefString
286
293
  } : {
287
294
  type: "range-error",
288
295
  name: this._localeService.t("hyperLink.message.refError")
289
296
  };
290
297
  }
291
- if (t) {
292
- const a = i.getSheetBySheetId(t);
293
- return a ? {
298
+ if (gid) {
299
+ const worksheet = workbook.getSheetBySheetId(gid);
300
+ return worksheet ? {
294
301
  type: "sheet",
295
- name: a.getName()
302
+ name: worksheet.getName()
296
303
  } : {
297
304
  type: "sheet-error",
298
305
  name: this._localeService.t("hyperLink.message.refError")
@@ -300,558 +307,564 @@ let F = class {
300
307
  }
301
308
  return null;
302
309
  }
303
- navigateTo(e) {
304
- const { gid: t, range: n, rangeid: r } = e, i = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SHEET);
305
- if (!i)
310
+ navigateTo(params) {
311
+ const { gid, range, rangeid } = params, workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
312
+ if (!workbook)
306
313
  return;
307
- const o = i.getUnitId();
308
- if (r && this.navigateToDefineName(o, r), !!t) {
309
- if (n) {
310
- const s = Oe(n);
311
- ze(s.range) && n !== Ge && this.navigateToRange(o, t, s.range);
314
+ const unitId = workbook.getUnitId();
315
+ if (rangeid && this.navigateToDefineName(unitId, rangeid), !!gid) {
316
+ if (range) {
317
+ const rangeInfo = deserializeRangeWithSheet(range);
318
+ isValidRange(rangeInfo.range) && range !== ERROR_RANGE && this.navigateToRange(unitId, gid, rangeInfo.range);
312
319
  return;
313
320
  }
314
- this.navigateToSheetById(o, t);
321
+ this.navigateToSheetById(unitId, gid);
315
322
  }
316
323
  }
317
- parseHyperLink(e) {
318
- var t, n, r;
319
- if (e != null && e.startsWith("#")) {
320
- const i = new URLSearchParams(e.slice(1)), o = {
321
- gid: (t = i.get("gid")) != null ? t : "",
322
- range: (n = i.get("range")) != null ? n : "",
323
- rangeid: (r = i.get("rangeid")) != null ? r : ""
324
- }, s = this._getURLName(o);
324
+ parseHyperLink(urlStr) {
325
+ var _a14, _b, _c;
326
+ if (urlStr != null && urlStr.startsWith("#")) {
327
+ const search = new URLSearchParams(urlStr.slice(1)), searchObj = {
328
+ gid: (_a14 = search.get("gid")) != null ? _a14 : "",
329
+ range: (_b = search.get("range")) != null ? _b : "",
330
+ rangeid: (_c = search.get("rangeid")) != null ? _c : ""
331
+ }, urlInfo = this._getURLName(searchObj);
325
332
  return {
326
- type: (s == null ? void 0 : s.type) || "link",
327
- name: (s == null ? void 0 : s.name) || e,
328
- url: e,
329
- searchObj: o,
330
- handler: () => {
331
- this.navigateTo(o);
332
- }
333
+ type: (urlInfo == null ? void 0 : urlInfo.type) || "link",
334
+ name: (urlInfo == null ? void 0 : urlInfo.name) || urlStr,
335
+ url: urlStr,
336
+ searchObj,
337
+ handler: /* @__PURE__ */ __name(() => {
338
+ this.navigateTo(searchObj);
339
+ }, "handler")
333
340
  };
334
341
  } else
335
342
  return {
336
343
  type: "outer",
337
- name: e,
338
- url: e,
339
- handler: () => {
340
- this.navigateToOtherWebsite(e);
341
- }
344
+ name: urlStr,
345
+ url: urlStr,
346
+ handler: /* @__PURE__ */ __name(() => {
347
+ this.navigateToOtherWebsite(urlStr);
348
+ }, "handler")
342
349
  };
343
350
  }
344
- async navigateToRange(e, t, n) {
345
- const r = await this.navigateToSheetById(e, t);
346
- if (r) {
347
- const i = vr(n, r);
351
+ async navigateToRange(unitId, subUnitId, range) {
352
+ const worksheet = await this.navigateToSheetById(unitId, subUnitId);
353
+ if (worksheet) {
354
+ const realRange = getContainRange(range, worksheet);
348
355
  await this._commandService.executeCommand(
349
- cn.id,
356
+ SetSelectionsOperation.id,
350
357
  {
351
- unitId: e,
352
- subUnitId: t,
358
+ unitId,
359
+ subUnitId,
353
360
  selections: [{
354
- range: i
361
+ range: realRange
355
362
  }]
356
363
  }
357
- ), await this._commandService.executeCommand(kt.id, {
358
- range: i
364
+ ), await this._commandService.executeCommand(ScrollToRangeOperation.id, {
365
+ range: realRange
359
366
  });
360
367
  }
361
368
  }
362
- async navigateToSheet(e, t) {
363
- const n = this._univerInstanceService.getUnit(e, E.UNIVER_SHEET);
364
- if (!n)
369
+ async navigateToSheet(unitId, sheetName) {
370
+ const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
371
+ if (!workbook)
365
372
  return !1;
366
- const r = n.getActiveSheet();
367
- if ((r == null ? void 0 : r.getName()) === t)
373
+ const worksheet = workbook.getActiveSheet();
374
+ if ((worksheet == null ? void 0 : worksheet.getName()) === sheetName)
368
375
  return !0;
369
- const i = n.getSheetBySheetName(t);
370
- if (!i) {
376
+ const targetSheet = workbook.getSheetBySheetName(sheetName);
377
+ if (!targetSheet) {
371
378
  this._messageService.show({
372
379
  content: this._localeService.t("hyperLink.message.noSheet"),
373
- type: ce.Error
380
+ type: MessageType.Error
374
381
  });
375
382
  return;
376
383
  }
377
- const o = i.getSheetId();
378
- return n.getHiddenWorksheets().indexOf(o) > -1 && this._messageService.show({
384
+ const sheetId = targetSheet.getSheetId();
385
+ return workbook.getHiddenWorksheets().indexOf(sheetId) > -1 && this._messageService.show({
379
386
  content: this._localeService.t("hyperLink.message.hiddenSheet"),
380
- type: ce.Error
381
- }), await this._commandService.executeCommand(Ee.id, { unitId: e, subUnitId: o });
387
+ type: MessageType.Error
388
+ }), await this._commandService.executeCommand(SetWorksheetActiveOperation.id, { unitId, subUnitId: sheetId });
382
389
  }
383
- async navigateToSheetById(e, t) {
384
- const n = this._univerInstanceService.getUnit(e, E.UNIVER_SHEET);
385
- if (!n)
390
+ async navigateToSheetById(unitId, subUnitId) {
391
+ const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
392
+ if (!workbook)
386
393
  return !1;
387
- const r = n.getActiveSheet();
388
- if (!r)
394
+ const worksheet = workbook.getActiveSheet();
395
+ if (!worksheet)
389
396
  return !1;
390
- if (r.getSheetId() === t)
391
- return r;
392
- const i = n.getSheetBySheetId(t);
393
- return i ? n.getHiddenWorksheets().indexOf(t) > -1 ? (this._messageService.show({
397
+ if (worksheet.getSheetId() === subUnitId)
398
+ return worksheet;
399
+ const targetSheet = workbook.getSheetBySheetId(subUnitId);
400
+ return targetSheet ? workbook.getHiddenWorksheets().indexOf(subUnitId) > -1 ? (this._messageService.show({
394
401
  content: this._localeService.t("hyperLink.message.hiddenSheet"),
395
- type: ce.Error
396
- }), !1) : await this._commandService.executeCommand(Ee.id, { unitId: e, subUnitId: t }) ? i : !1 : (this._messageService.show({
402
+ type: MessageType.Error
403
+ }), !1) : await this._commandService.executeCommand(SetWorksheetActiveOperation.id, { unitId, subUnitId }) ? targetSheet : !1 : (this._messageService.show({
397
404
  content: this._localeService.t("hyperLink.message.noSheet"),
398
- type: ce.Error
405
+ type: MessageType.Error
399
406
  }), !1);
400
407
  }
401
- async navigateToDefineName(e, t) {
402
- return this._definedNamesService.focusRange(e, t), !0;
408
+ async navigateToDefineName(unitId, rangeid) {
409
+ return this._definedNamesService.focusRange(unitId, rangeid), !0;
403
410
  }
404
- async navigateToOtherWebsite(e) {
405
- window.open(e, "_blank", "noopener noreferrer");
411
+ async navigateToOtherWebsite(url) {
412
+ window.open(url, "_blank", "noopener noreferrer");
406
413
  }
407
- };
408
- F = fr([
409
- se(0, ue),
410
- se(1, K),
411
- se(2, jt),
412
- se(3, Ot),
413
- se(4, h(pe))
414
- ], F);
415
- function de(e) {
416
- return re.isLegalUrl(e);
414
+ }, __name(_a4, "SheetsHyperLinkResolverService"), _a4);
415
+ SheetsHyperLinkResolverService = __decorateClass$9([
416
+ __decorateParam$9(0, IUniverInstanceService),
417
+ __decorateParam$9(1, ICommandService),
418
+ __decorateParam$9(2, IDefinedNamesService),
419
+ __decorateParam$9(3, IMessageService),
420
+ __decorateParam$9(4, Inject(LocaleService))
421
+ ], SheetsHyperLinkResolverService);
422
+ function isLegalLink(link) {
423
+ return Tools.isLegalUrl(link);
417
424
  }
418
- function _r(e) {
419
- return /^[a-zA-Z]+:\/\//.test(e);
425
+ __name(isLegalLink, "isLegalLink");
426
+ function hasProtocol(urlString) {
427
+ return /^[a-zA-Z]+:\/\//.test(urlString);
420
428
  }
421
- function Cr(e) {
422
- return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e);
429
+ __name(hasProtocol, "hasProtocol");
430
+ function isEmail(url) {
431
+ return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url);
423
432
  }
424
- function rt(e) {
425
- if (de(e)) {
426
- const t = _r(e) ? e : Cr(e) ? `mailto://${e}` : `http://${e}`, n = new URL(t);
427
- return n.hostname === location.hostname && n.port === location.port && n.protocol === location.protocol && n.pathname === location.pathname && n.hash && !n.search ? n.hash : t;
433
+ __name(isEmail, "isEmail");
434
+ function serializeUrl(urlStr) {
435
+ if (isLegalLink(urlStr)) {
436
+ const transformedUrl = hasProtocol(urlStr) ? urlStr : isEmail(urlStr) ? `mailto://${urlStr}` : `http://${urlStr}`, url = new URL(transformedUrl);
437
+ return url.hostname === location.hostname && url.port === location.port && url.protocol === location.protocol && url.pathname === location.pathname && url.hash && !url.search ? url.hash : transformedUrl;
428
438
  }
429
- return e;
439
+ return urlStr;
430
440
  }
431
- function yr(e) {
432
- if (e === null)
441
+ __name(serializeUrl, "serializeUrl");
442
+ function getCellValueOrigin(cell) {
443
+ if (cell === null)
433
444
  return "";
434
- if (e != null && e.p) {
435
- const t = e == null ? void 0 : e.p.body;
436
- if (t == null)
445
+ if (cell != null && cell.p) {
446
+ const body = cell == null ? void 0 : cell.p.body;
447
+ if (body == null)
437
448
  return "";
438
- const n = t.dataStream;
439
- return n.substring(n.length - 2, n.length) === Qt ? n.substring(0, n.length - 2) : n;
449
+ const data = body.dataStream;
450
+ return data.substring(data.length - 2, data.length) === DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
440
451
  }
441
- return e == null ? void 0 : e.v;
452
+ return cell == null ? void 0 : cell.v;
442
453
  }
443
- const Sr = "univer-cell-link-edit-buttons", Lr = {
444
- cellLinkEditButtons: Sr
445
- }, xe = () => {
446
- var ie;
447
- const [e, t] = ee(""), [n, r] = ee(""), [i, o] = ee(
454
+ __name(getCellValueOrigin, "getCellValueOrigin");
455
+ const cellLinkEditButtons = "univer-cell-link-edit-buttons", styles$1 = {
456
+ cellLinkEditButtons
457
+ }, CellLinkEdit = /* @__PURE__ */ __name(() => {
458
+ var _a14;
459
+ const [id, setId] = useState(""), [display, setDisplay] = useState(""), [type, setType] = useState(
448
460
  "link"
449
461
  /* link */
450
- ), [s, c] = ee(""), a = k(pe), u = k(jt), g = k(ue), f = k($), l = Un(f.currentEditing$), m = k(H), _ = k(F), v = k(K), [L, M] = ee(!1), y = wt(!1);
451
- Et(() => {
452
- var p, S, I;
453
- if ((l == null ? void 0 : l.row) !== void 0 && l.column !== void 0) {
454
- const C = m.getHyperLinkByLocationSync(l.unitId, l.subUnitId, l.row, l.column);
455
- if (C) {
456
- const ge = _.parseHyperLink(C.payload);
457
- if (t(C.id), r(C.display), ge.type === "outer") {
458
- o(
462
+ ), [payload, setPayload] = useState(""), localeService = useDependency(LocaleService), definedNameService = useDependency(IDefinedNamesService), univerInstanceService = useDependency(IUniverInstanceService), popupService = useDependency(SheetsHyperLinkPopupService), editing = useObservable(popupService.currentEditing$), hyperLinkModel = useDependency(HyperLinkModel), resolverService = useDependency(SheetsHyperLinkResolverService), commandService = useDependency(ICommandService), [showError, setShowError] = useState(!1), setByPayload = useRef(!1);
463
+ useEffect(() => {
464
+ var _a15, _b, _c;
465
+ if ((editing == null ? void 0 : editing.row) !== void 0 && editing.column !== void 0) {
466
+ const link = hyperLinkModel.getHyperLinkByLocationSync(editing.unitId, editing.subUnitId, editing.row, editing.column);
467
+ if (link) {
468
+ const linkInfo = resolverService.parseHyperLink(link.payload);
469
+ if (setId(link.id), setDisplay(link.display), linkInfo.type === "outer") {
470
+ setType(
459
471
  "link"
460
472
  /* link */
461
- ), c(ge.url), ge.url === C.display && (y.current = !0);
473
+ ), setPayload(linkInfo.url), linkInfo.url === link.display && (setByPayload.current = !0);
462
474
  return;
463
475
  } else {
464
- const N = ge.searchObj;
465
- if (N.rangeid) {
466
- o(
476
+ const params = linkInfo.searchObj;
477
+ if (params.rangeid) {
478
+ setType(
467
479
  "rangeid"
468
480
  /* definedName */
469
- ), c(N.rangeid);
481
+ ), setPayload(params.rangeid);
470
482
  return;
471
483
  }
472
- if (N.range) {
473
- const zt = N.gid && (I = (S = (p = g.getUnit(l.unitId)) == null ? void 0 : p.getSheetBySheetId(N.gid)) == null ? void 0 : S.getName()) != null ? I : "";
474
- if (o(
484
+ if (params.range) {
485
+ const sheetName = params.gid && (_c = (_b = (_a15 = univerInstanceService.getUnit(editing.unitId)) == null ? void 0 : _a15.getSheetBySheetId(params.gid)) == null ? void 0 : _b.getName()) != null ? _c : "";
486
+ if (setType(
475
487
  "range"
476
488
  /* range */
477
- ), N.range === Ge)
478
- c("");
489
+ ), params.range === ERROR_RANGE)
490
+ setPayload("");
479
491
  else {
480
- const ct = Ht(zt, Oe(N.range).range);
481
- c(ct), ct === C.display && (y.current = !0);
492
+ const payload2 = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
493
+ setPayload(payload2), payload2 === link.display && (setByPayload.current = !0);
482
494
  }
483
495
  return;
484
496
  }
485
- if (N.gid) {
486
- o(
497
+ if (params.gid) {
498
+ setType(
487
499
  "gid"
488
500
  /* sheet */
489
- ), c(N.gid);
501
+ ), setPayload(params.gid);
490
502
  return;
491
503
  }
492
504
  }
493
505
  }
494
- const j = g.getUnit(l.unitId), w = j == null ? void 0 : j.getSheetBySheetId(l.subUnitId), Zt = w == null ? void 0 : w.getCellRaw(l.row, l.column), Fe = yr(Zt);
495
- o(
506
+ const workbook2 = univerInstanceService.getUnit(editing.unitId), worksheet = workbook2 == null ? void 0 : workbook2.getSheetBySheetId(editing.subUnitId), cell = worksheet == null ? void 0 : worksheet.getCellRaw(editing.row, editing.column), cellValue = getCellValueOrigin(cell);
507
+ setType(
496
508
  "link"
497
509
  /* link */
498
- ), c(""), r((Fe != null ? Fe : "").toString()), t("");
510
+ ), setPayload(""), setDisplay((cellValue != null ? cellValue : "").toString()), setId("");
499
511
  return;
500
512
  }
501
- o(
513
+ setType(
502
514
  "link"
503
515
  /* link */
504
- ), c(""), r(""), t("");
505
- }, [l, m, _, g]);
506
- const V = Tn(() => s, [i]), R = [
516
+ ), setPayload(""), setDisplay(""), setId("");
517
+ }, [editing, hyperLinkModel, resolverService, univerInstanceService]);
518
+ const payloadInitial = useMemo(() => payload, [type]), linkTypeOptions = [
507
519
  {
508
- label: a.t("hyperLink.form.link"),
520
+ label: localeService.t("hyperLink.form.link"),
509
521
  value: "link"
510
522
  /* link */
511
523
  },
512
524
  {
513
- label: a.t("hyperLink.form.range"),
525
+ label: localeService.t("hyperLink.form.range"),
514
526
  value: "range"
515
527
  /* range */
516
528
  },
517
529
  {
518
- label: a.t("hyperLink.form.worksheet"),
530
+ label: localeService.t("hyperLink.form.worksheet"),
519
531
  value: "gid"
520
532
  /* sheet */
521
533
  },
522
534
  {
523
- label: a.t("hyperLink.form.definedName"),
535
+ label: localeService.t("hyperLink.form.definedName"),
524
536
  value: "rangeid"
525
537
  /* definedName */
526
538
  }
527
- ], P = g.getCurrentUnitForType(E.UNIVER_SHEET);
528
- if (!P)
539
+ ], workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
540
+ if (!workbook)
529
541
  return;
530
- const G = P.getHiddenWorksheets(), A = P.getSheets().map((p) => ({ label: p.getName(), value: p.getSheetId() })).filter((p) => G.indexOf(p.value) === -1), q = Object.values((ie = u.getDefinedNameMap(P.getUnitId())) != null ? ie : {}).map((p) => ({
531
- label: p.name,
532
- value: p.id
533
- })), he = (p, S) => {
534
- if (p === "link")
535
- return rt(S);
536
- if (p === "range") {
537
- const I = Oe(S), C = P.getSheetBySheetName(I.sheetName);
538
- if (C)
539
- return `#gid=${C.getSheetId()}&range=${Fn(I.range)}`;
542
+ const hiddens = workbook.getHiddenWorksheets(), sheetsOption = workbook.getSheets().map((sheet) => ({ label: sheet.getName(), value: sheet.getSheetId() })).filter((opt) => hiddens.indexOf(opt.value) === -1), definedNames = Object.values((_a14 = definedNameService.getDefinedNameMap(workbook.getUnitId())) != null ? _a14 : {}).map((value) => ({
543
+ label: value.name,
544
+ value: value.id
545
+ })), formatUrl = /* @__PURE__ */ __name((type2, payload2) => {
546
+ if (type2 === "link")
547
+ return serializeUrl(payload2);
548
+ if (type2 === "range") {
549
+ const info = deserializeRangeWithSheet(payload2), worksheet = workbook.getSheetBySheetName(info.sheetName);
550
+ if (worksheet)
551
+ return `#gid=${worksheet.getSheetId()}&range=${serializeRange(info.range)}`;
540
552
  }
541
- return `#${p}=${S}`;
542
- }, We = Hn((p) => {
543
- var C;
544
- const S = p[0];
545
- if (!S || !ze(S.range))
553
+ return `#${type2}=${payload2}`;
554
+ }, "formatUrl"), handleRangeChange = useEvent((newValue) => {
555
+ var _a15;
556
+ const range = newValue[0];
557
+ if (!range || !isValidRange(range.range))
546
558
  return;
547
- S.sheetName || (S.sheetName = ((C = P.getActiveSheet()) == null ? void 0 : C.getName()) || "");
548
- const I = Wn(S);
549
- c(I), I && (y.current || !n) && (r(I), y.current = !0);
550
- }), me = async () => {
551
- if (l && (e ? await v.executeCommand(St.id, {
552
- unitId: l.unitId,
553
- subUnitId: l.subUnitId,
554
- id: e,
559
+ range.sheetName || (range.sheetName = ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getName()) || "");
560
+ const newPayload = serializeRangeToRefString(range);
561
+ setPayload(newPayload), newPayload && (setByPayload.current || !display) && (setDisplay(newPayload), setByPayload.current = !0);
562
+ }), handleSubmit = /* @__PURE__ */ __name(async () => {
563
+ if (editing && (id ? await commandService.executeCommand(UpdateHyperLinkCommand.id, {
564
+ unitId: editing.unitId,
565
+ subUnitId: editing.subUnitId,
566
+ id,
555
567
  payload: {
556
- display: n,
557
- payload: he(i, s)
568
+ display,
569
+ payload: formatUrl(type, payload)
558
570
  }
559
- }) : await v.executeCommand(Lt.id, {
560
- unitId: l.unitId,
561
- subUnitId: l.subUnitId,
571
+ }) : await commandService.executeCommand(AddHyperLinkCommand.id, {
572
+ unitId: editing.unitId,
573
+ subUnitId: editing.subUnitId,
562
574
  link: {
563
- id: re.generateRandomId(),
564
- row: l.row,
565
- column: l.column,
566
- payload: he(i, s),
567
- display: n
575
+ id: Tools.generateRandomId(),
576
+ row: editing.row,
577
+ column: editing.column,
578
+ payload: formatUrl(type, payload),
579
+ display
568
580
  }
569
- })), l) {
570
- await v.executeCommand(Ee.id, {
571
- unitId: l.unitId,
572
- subUnitId: l.subUnitId
581
+ })), editing) {
582
+ await commandService.executeCommand(SetWorksheetActiveOperation.id, {
583
+ unitId: editing.unitId,
584
+ subUnitId: editing.subUnitId
573
585
  });
574
- const p = 1;
575
- await v.executeCommand(kt.id, {
586
+ const GAP = 1;
587
+ await commandService.executeCommand(ScrollToRangeOperation.id, {
576
588
  range: {
577
- startRow: Math.max(l.row - p, 0),
578
- endRow: l.row + p,
579
- startColumn: Math.max(l.column - p, 0),
580
- endColumn: l.column + p
589
+ startRow: Math.max(editing.row - GAP, 0),
590
+ endRow: editing.row + GAP,
591
+ startColumn: Math.max(editing.column - GAP, 0),
592
+ endColumn: editing.column + GAP
581
593
  }
582
594
  });
583
595
  }
584
- v.executeCommand(Te.id);
585
- };
586
- return /* @__PURE__ */ d.jsxs("div", { children: [
587
- /* @__PURE__ */ d.jsx(
588
- X,
596
+ commandService.executeCommand(CloseHyperLinkSidebarOperation.id);
597
+ }, "handleSubmit");
598
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
599
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
600
+ FormLayout,
589
601
  {
590
- label: a.t("hyperLink.form.label"),
591
- error: L && !n ? a.t("hyperLink.form.inputError") : "",
592
- children: /* @__PURE__ */ d.jsx(
593
- ht,
602
+ label: localeService.t("hyperLink.form.label"),
603
+ error: showError && !display ? localeService.t("hyperLink.form.inputError") : "",
604
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
605
+ Input,
594
606
  {
595
- value: n,
596
- onChange: (p) => {
597
- r(p), y.current = !1;
598
- },
599
- placeholder: a.t("hyperLink.form.labelPlaceholder")
607
+ value: display,
608
+ onChange: /* @__PURE__ */ __name((v) => {
609
+ setDisplay(v), setByPayload.current = !1;
610
+ }, "onChange"),
611
+ placeholder: localeService.t("hyperLink.form.labelPlaceholder")
600
612
  }
601
613
  )
602
614
  }
603
615
  ),
604
- /* @__PURE__ */ d.jsx(X, { label: a.t("hyperLink.form.type"), children: /* @__PURE__ */ d.jsx(
605
- Ke,
616
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("hyperLink.form.type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
617
+ Select,
606
618
  {
607
- options: R,
608
- value: i,
609
- onChange: (p) => {
610
- o(p), c("");
611
- }
619
+ options: linkTypeOptions,
620
+ value: type,
621
+ onChange: /* @__PURE__ */ __name((newType) => {
622
+ setType(newType), setPayload("");
623
+ }, "onChange")
612
624
  }
613
625
  ) }),
614
- i === "link" && /* @__PURE__ */ d.jsx(
615
- X,
626
+ type === "link" && /* @__PURE__ */ jsxRuntimeExports.jsx(
627
+ FormLayout,
616
628
  {
617
- error: L ? s ? de(s) ? "" : a.t("hyperLink.form.linkError") : a.t("hyperLink.form.inputError") : "",
618
- children: /* @__PURE__ */ d.jsx(
619
- ht,
629
+ error: showError ? payload ? isLegalLink(payload) ? "" : localeService.t("hyperLink.form.linkError") : localeService.t("hyperLink.form.inputError") : "",
630
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
631
+ Input,
620
632
  {
621
- value: s,
622
- onChange: (p) => {
623
- c(p), p && (y.current || !n || n === s) && (r(p), y.current = !0);
624
- },
625
- placeholder: a.t("hyperLink.form.linkPlaceholder")
633
+ value: payload,
634
+ onChange: /* @__PURE__ */ __name((newLink) => {
635
+ setPayload(newLink), newLink && (setByPayload.current || !display || display === payload) && (setDisplay(newLink), setByPayload.current = !0);
636
+ }, "onChange"),
637
+ placeholder: localeService.t("hyperLink.form.linkPlaceholder")
626
638
  }
627
639
  )
628
640
  }
629
641
  ),
630
- i === "range" && /* @__PURE__ */ d.jsx(X, { error: L && !s ? a.t("hyperLink.form.inputError") : "", children: /* @__PURE__ */ d.jsx(
631
- jn,
642
+ type === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: showError && !payload ? localeService.t("hyperLink.form.inputError") : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
643
+ RangeSelector,
632
644
  {
633
- openForSheetUnitId: P.getUnitId(),
634
- id: en("hyper-link-edit"),
645
+ openForSheetUnitId: workbook.getUnitId(),
646
+ id: createInternalEditorID("hyper-link-edit"),
635
647
  isSingleChoice: !0,
636
- value: V,
637
- onChange: We
648
+ value: payloadInitial,
649
+ onChange: handleRangeChange
638
650
  }
639
651
  ) }),
640
- i === "gid" && /* @__PURE__ */ d.jsx(X, { error: L && !s ? a.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ d.jsx(
641
- Ke,
652
+ type === "gid" && /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: showError && !payload ? localeService.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
653
+ Select,
642
654
  {
643
- options: A,
644
- value: s,
645
- onChange: (p) => {
646
- var C, j;
647
- c(p);
648
- const S = (C = A.find((w) => w.value === p)) == null ? void 0 : C.label, I = (j = A.find((w) => w.value === s)) == null ? void 0 : j.label;
649
- S && (y.current || !n || n === I) && (r(S), y.current = !0);
650
- }
655
+ options: sheetsOption,
656
+ value: payload,
657
+ onChange: /* @__PURE__ */ __name((newPayload) => {
658
+ var _a15, _b;
659
+ setPayload(newPayload);
660
+ const label = (_a15 = sheetsOption.find((i) => i.value === newPayload)) == null ? void 0 : _a15.label, oldLabel = (_b = sheetsOption.find((i) => i.value === payload)) == null ? void 0 : _b.label;
661
+ label && (setByPayload.current || !display || display === oldLabel) && (setDisplay(label), setByPayload.current = !0);
662
+ }, "onChange")
651
663
  }
652
664
  ) }),
653
- i === "rangeid" && /* @__PURE__ */ d.jsx(X, { error: L && !s ? a.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ d.jsx(
654
- Ke,
665
+ type === "rangeid" && /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: showError && !payload ? localeService.t("hyperLink.form.selectError") : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
666
+ Select,
655
667
  {
656
- options: q,
657
- value: s,
658
- onChange: (p) => {
659
- var C, j;
660
- c(p);
661
- const S = (C = q.find((w) => w.value === p)) == null ? void 0 : C.label, I = (j = q.find((w) => w.value === s)) == null ? void 0 : j.label;
662
- S && (y.current || !n || n === I) && (r(S), y.current = !0);
663
- }
668
+ options: definedNames,
669
+ value: payload,
670
+ onChange: /* @__PURE__ */ __name((newValue) => {
671
+ var _a15, _b;
672
+ setPayload(newValue);
673
+ const label = (_a15 = definedNames.find((i) => i.value === newValue)) == null ? void 0 : _a15.label, oldLabel = (_b = definedNames.find((i) => i.value === payload)) == null ? void 0 : _b.label;
674
+ label && (setByPayload.current || !display || display === oldLabel) && (setDisplay(label), setByPayload.current = !0);
675
+ }, "onChange")
664
676
  }
665
677
  ) }),
666
- /* @__PURE__ */ d.jsxs("div", { className: Lr.cellLinkEditButtons, children: [
667
- /* @__PURE__ */ d.jsx(
668
- mt,
678
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.cellLinkEditButtons, children: [
679
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
680
+ Button,
669
681
  {
670
- onClick: () => {
671
- l && v.executeCommand(Ee.id, {
672
- unitId: l.unitId,
673
- subUnitId: l.subUnitId
674
- }), v.executeCommand(Te.id);
675
- },
676
- children: a.t("hyperLink.form.cancel")
682
+ onClick: /* @__PURE__ */ __name(() => {
683
+ editing && commandService.executeCommand(SetWorksheetActiveOperation.id, {
684
+ unitId: editing.unitId,
685
+ subUnitId: editing.subUnitId
686
+ }), commandService.executeCommand(CloseHyperLinkSidebarOperation.id);
687
+ }, "onClick"),
688
+ children: localeService.t("hyperLink.form.cancel")
677
689
  }
678
690
  ),
679
- /* @__PURE__ */ d.jsx(
680
- mt,
691
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
692
+ Button,
681
693
  {
682
694
  type: "primary",
683
695
  style: { marginLeft: 8 },
684
- onClick: async () => {
685
- if (!n || !s || i === "link" && !de(s)) {
686
- M(!0);
696
+ onClick: /* @__PURE__ */ __name(async () => {
697
+ if (!display || !payload || type === "link" && !isLegalLink(payload)) {
698
+ setShowError(!0);
687
699
  return;
688
700
  }
689
- me();
690
- },
691
- children: a.t("hyperLink.form.ok")
701
+ handleSubmit();
702
+ }, "onClick"),
703
+ children: localeService.t("hyperLink.form.ok")
692
704
  }
693
705
  )
694
706
  ] })
695
707
  ] });
696
- };
697
- xe.componentKey = "univer.sheet.cell-link-edit";
698
- const it = {
699
- type: je.OPERATION,
708
+ }, "CellLinkEdit");
709
+ CellLinkEdit.componentKey = "univer.sheet.cell-link-edit";
710
+ const OpenHyperLinkSidebarOperation = {
711
+ type: CommandType.OPERATION,
700
712
  id: "sheet.operation.open-hyper-link-sidebar",
701
- handler(e, t) {
702
- if (!t)
713
+ handler(accessor, params) {
714
+ if (!params)
703
715
  return !1;
704
- const { unitId: n, subUnitId: r, row: i, column: o } = t, s = e.get(H), c = e.get(Mt), a = e.get($), u = s.getHyperLinkByLocation(n, r, i, o);
705
- return a.startEditing(t), c.open({
716
+ const { unitId, subUnitId, row, column } = params, hyperLinkModel = accessor.get(HyperLinkModel), sidebarService = accessor.get(ISidebarService), popupService = accessor.get(SheetsHyperLinkPopupService), currentLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
717
+ return popupService.startEditing(params), sidebarService.open({
706
718
  header: {
707
- title: u ? "hyperLink.form.editTitle" : "hyperLink.form.addTitle"
719
+ title: currentLink ? "hyperLink.form.editTitle" : "hyperLink.form.addTitle"
708
720
  },
709
721
  children: {
710
- label: xe.componentKey
722
+ label: CellLinkEdit.componentKey
711
723
  }
712
724
  }), !0;
713
725
  }
714
- }, Te = {
715
- type: je.OPERATION,
726
+ }, CloseHyperLinkSidebarOperation = {
727
+ type: CommandType.OPERATION,
716
728
  id: "sheet.operation.close-hyper-link-sidebar",
717
- handler(e) {
718
- const t = e.get(Mt), n = e.get($);
719
- return t.close(), n.endEditing(), !0;
729
+ handler(accessor) {
730
+ const sidebarService = accessor.get(ISidebarService), popupService = accessor.get(SheetsHyperLinkPopupService);
731
+ return sidebarService.close(), popupService.endEditing(), !0;
720
732
  }
721
- }, ot = {
722
- type: je.OPERATION,
733
+ }, InsertHyperLinkOperation = {
734
+ type: CommandType.OPERATION,
723
735
  id: "sheet.operation.insert-hyper-link",
724
- handler(e) {
725
- const t = e.get(ue), n = Ct(t);
726
- if (!n)
736
+ handler(accessor) {
737
+ const univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
738
+ if (!target)
727
739
  return !1;
728
- const r = e.get(K), o = e.get(yt).getCurrentLastSelection();
729
- if (!o)
740
+ const commandService = accessor.get(ICommandService), selection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
741
+ if (!selection)
730
742
  return !1;
731
- const s = o.primary.startRow, c = o.primary.startColumn;
732
- return r.executeCommand(it.id, {
733
- unitId: n.unitId,
734
- subUnitId: n.subUnitId,
735
- row: s,
736
- column: c
743
+ const row = selection.primary.startRow, column = selection.primary.startColumn;
744
+ return commandService.executeCommand(OpenHyperLinkSidebarOperation.id, {
745
+ unitId: target.unitId,
746
+ subUnitId: target.subUnitId,
747
+ row,
748
+ column
737
749
  });
738
750
  }
739
- }, st = {
740
- type: je.OPERATION,
751
+ }, InsertHyperLinkToolbarOperation = {
752
+ type: CommandType.OPERATION,
741
753
  id: "sheet.operation.insert-hyper-link-toolbar",
742
- handler(e) {
743
- const t = e.get(K);
744
- return e.get($).currentEditing ? t.executeCommand(Te.id) : t.executeCommand(ot.id);
754
+ handler(accessor) {
755
+ const commandService = accessor.get(ICommandService);
756
+ return accessor.get(SheetsHyperLinkPopupService).currentEditing ? commandService.executeCommand(CloseHyperLinkSidebarOperation.id) : commandService.executeCommand(InsertHyperLinkOperation.id);
745
757
  }
746
- }, Ir = "univer-cell-link", kr = "univer-cell-link-type", Pr = "univer-cell-link-content", br = "univer-cell-link-content-error", Rr = "univer-cell-link-url", wr = "univer-cell-link-operations", Er = "univer-cell-link-operation", Or = "univer-cell-link-operation-error", x = {
747
- cellLink: Ir,
748
- cellLinkType: kr,
749
- cellLinkContent: Pr,
750
- cellLinkContentError: br,
751
- cellLinkUrl: Rr,
752
- cellLinkOperations: wr,
753
- cellLinkOperation: Er,
754
- cellLinkOperationError: Or
755
- }, Mr = {
756
- outer: /* @__PURE__ */ d.jsx(Me, {}),
757
- link: /* @__PURE__ */ d.jsx(Me, {}),
758
- sheet: /* @__PURE__ */ d.jsx(Je, {}),
759
- range: /* @__PURE__ */ d.jsx(Le, {}),
760
- defineName: /* @__PURE__ */ d.jsx(Le, {}),
761
- "range-error": /* @__PURE__ */ d.jsx(Le, {}),
762
- "sheet-error": /* @__PURE__ */ d.jsx(Je, {})
763
- }, Ue = () => {
764
- const e = k($), t = k(H), n = k(K), r = k(Ot), i = k(pe), [o, s] = ee(null), c = k(F);
765
- if (Et(() => {
766
- s(e.currentPopup);
767
- const _ = e.currentPopup$.subscribe((v) => {
768
- s(v);
758
+ }, cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cellLinkContent = "univer-cell-link-content", cellLinkContentError = "univer-cell-link-content-error", cellLinkUrl = "univer-cell-link-url", cellLinkOperations = "univer-cell-link-operations", cellLinkOperation = "univer-cell-link-operation", cellLinkOperationError = "univer-cell-link-operation-error", styles = {
759
+ cellLink,
760
+ cellLinkType,
761
+ cellLinkContent,
762
+ cellLinkContentError,
763
+ cellLinkUrl,
764
+ cellLinkOperations,
765
+ cellLinkOperation,
766
+ cellLinkOperationError
767
+ }, iconsMap = {
768
+ outer: /* @__PURE__ */ jsxRuntimeExports.jsx(LinkSingle, {}),
769
+ link: /* @__PURE__ */ jsxRuntimeExports.jsx(LinkSingle, {}),
770
+ sheet: /* @__PURE__ */ jsxRuntimeExports.jsx(Xlsx, {}),
771
+ range: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {}),
772
+ defineName: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {}),
773
+ "range-error": /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {}),
774
+ "sheet-error": /* @__PURE__ */ jsxRuntimeExports.jsx(Xlsx, {})
775
+ }, CellLinkPopup = /* @__PURE__ */ __name(() => {
776
+ const popupService = useDependency(SheetsHyperLinkPopupService), hyperLinkModel = useDependency(HyperLinkModel), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService);
777
+ if (useEffect(() => {
778
+ setCurrentPopup(popupService.currentPopup);
779
+ const ob = popupService.currentPopup$.subscribe((popup) => {
780
+ setCurrentPopup(popup);
769
781
  });
770
782
  return () => {
771
- _.unsubscribe();
783
+ ob.unsubscribe();
772
784
  };
773
- }, [e.currentPopup, e.currentPopup$]), !o)
785
+ }, [popupService.currentPopup, popupService.currentPopup$]), !currentPopup)
774
786
  return null;
775
- const { unitId: a, subUnitId: u, id: g } = o, f = t.getHyperLink(a, u, g);
776
- if (!f)
787
+ const { unitId, subUnitId, id } = currentPopup, link = hyperLinkModel.getHyperLink(unitId, subUnitId, id);
788
+ if (!link)
777
789
  return null;
778
- const l = c.parseHyperLink(f.payload), m = l.type.indexOf("error") > -1;
779
- return /* @__PURE__ */ d.jsxs("div", { className: x.cellLink, onClick: () => e.hideCurrentPopup(), children: [
780
- /* @__PURE__ */ d.jsxs("div", { className: pt(x.cellLinkContent, { [x.cellLinkContentError]: m }), onClick: l.handler, children: [
781
- /* @__PURE__ */ d.jsx("div", { className: x.cellLinkType, children: Mr[l.type] }),
782
- /* @__PURE__ */ d.jsx(_e, { showIfEllipsis: !0, title: l.name, children: /* @__PURE__ */ d.jsx("span", { className: x.cellLinkUrl, children: l.name }) })
790
+ const linkObj = resolverService.parseHyperLink(link.payload), isError = linkObj.type.indexOf("error") > -1;
791
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLink, onClick: /* @__PURE__ */ __name(() => popupService.hideCurrentPopup(), "onClick"), children: [
792
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cs(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }), onClick: linkObj.handler, children: [
793
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
794
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: linkObj.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.cellLinkUrl, children: linkObj.name }) })
783
795
  ] }),
784
- /* @__PURE__ */ d.jsxs("div", { className: x.cellLinkOperations, children: [
785
- o.copyPermission && /* @__PURE__ */ d.jsx(
796
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLinkOperations, children: [
797
+ currentPopup.copyPermission && /* @__PURE__ */ jsxRuntimeExports.jsx(
786
798
  "div",
787
799
  {
788
- className: pt(x.cellLinkOperation, { [x.cellLinkOperationError]: m }),
789
- onClick: () => {
790
- if (!m) {
791
- if (l.type !== "outer") {
792
- const _ = new URL(window.location.href);
793
- _.hash = l.url.slice(1), navigator.clipboard.writeText(_.href);
800
+ className: cs(styles.cellLinkOperation, { [styles.cellLinkOperationError]: isError }),
801
+ onClick: /* @__PURE__ */ __name(() => {
802
+ if (!isError) {
803
+ if (linkObj.type !== "outer") {
804
+ const url = new URL(window.location.href);
805
+ url.hash = linkObj.url.slice(1), navigator.clipboard.writeText(url.href);
794
806
  } else
795
- navigator.clipboard.writeText(l.url);
796
- r.show({
797
- content: i.t("hyperLink.message.coped"),
798
- type: ce.Info
807
+ navigator.clipboard.writeText(linkObj.url);
808
+ messageService.show({
809
+ content: localeService.t("hyperLink.message.coped"),
810
+ type: MessageType.Info
799
811
  });
800
812
  }
801
- },
802
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.copy"), children: /* @__PURE__ */ d.jsx(Vt, {}) })
813
+ }, "onClick"),
814
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("hyperLink.popup.copy"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopySingle, {}) })
803
815
  }
804
816
  ),
805
- o.editPermission && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
806
- /* @__PURE__ */ d.jsx(
817
+ currentPopup.editPermission && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
818
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
807
819
  "div",
808
820
  {
809
- className: x.cellLinkOperation,
810
- onClick: () => {
811
- n.executeCommand(it.id, {
812
- unitId: a,
813
- subUnitId: u,
814
- row: f.row,
815
- column: f.column
821
+ className: styles.cellLinkOperation,
822
+ onClick: /* @__PURE__ */ __name(() => {
823
+ commandService.executeCommand(OpenHyperLinkSidebarOperation.id, {
824
+ unitId,
825
+ subUnitId,
826
+ row: link.row,
827
+ column: link.column
816
828
  });
817
- },
818
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.edit"), children: /* @__PURE__ */ d.jsx(Wt, {}) })
829
+ }, "onClick"),
830
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("hyperLink.popup.edit"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(WriteSingle, {}) })
819
831
  }
820
832
  ),
821
- /* @__PURE__ */ d.jsx(
833
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
822
834
  "div",
823
835
  {
824
- className: x.cellLinkOperation,
825
- onClick: () => {
826
- n.executeCommand(_n.id, {
827
- unitId: a,
828
- subUnitId: u,
829
- id: f.id
836
+ className: styles.cellLinkOperation,
837
+ onClick: /* @__PURE__ */ __name(() => {
838
+ commandService.executeCommand(CancelHyperLinkCommand.id, {
839
+ unitId,
840
+ subUnitId,
841
+ id: link.id
830
842
  });
831
- },
832
- children: /* @__PURE__ */ d.jsx(_e, { placement: "bottom", title: i.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ d.jsx(At, {}) })
843
+ }, "onClick"),
844
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { placement: "bottom", title: localeService.t("hyperLink.popup.cancel"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(UnlinkSingle, {}) })
833
845
  }
834
846
  )
835
847
  ] })
836
848
  ] })
837
849
  ] });
838
- };
839
- Ue.componentKey = "univer.sheet.cell-link-popup";
840
- var xr = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ur = (e, t, n, r) => {
841
- for (var i = r > 1 ? void 0 : r ? Tr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
842
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
843
- return r && i && xr(t, n, i), i;
844
- }, gt = (e, t) => (n, r) => t(n, r, e);
845
- const Hr = (e, t) => e.unitId === t.unitId && e.subUnitId === t.subUnitId && e.row === t.row && e.col === t.col;
846
- let $ = class extends O {
847
- constructor(t, n) {
850
+ }, "CellLinkPopup");
851
+ CellLinkPopup.componentKey = "univer.sheet.cell-link-popup";
852
+ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
853
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
854
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
855
+ return kind && result && __defProp$8(target, key, result), result;
856
+ }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
857
+ const isEqualLink = /* @__PURE__ */ __name((a, b) => a.unitId === b.unitId && a.subUnitId === b.subUnitId && a.row === b.row && a.col === b.col, "isEqualLink");
858
+ var _a5;
859
+ let SheetsHyperLinkPopupService = (_a5 = class extends Disposable {
860
+ constructor(_hyperLinkModel, _sheetCanvasPopManagerService) {
848
861
  super();
849
- W(this, "_currentPopup", null);
850
- W(this, "_currentPopup$", new On());
851
- W(this, "currentPopup$", this._currentPopup$.asObservable());
852
- W(this, "_currentEditing$", new Mn(null));
853
- W(this, "currentEditing$", this._currentEditing$.asObservable());
854
- this._hyperLinkModel = t, this._sheetCanvasPopManagerService = n, this.disposeWithMe(() => {
862
+ __publicField(this, "_currentPopup", null);
863
+ __publicField(this, "_currentPopup$", new Subject());
864
+ __publicField(this, "currentPopup$", this._currentPopup$.asObservable());
865
+ __publicField(this, "_currentEditing$", new BehaviorSubject(null));
866
+ __publicField(this, "currentEditing$", this._currentEditing$.asObservable());
867
+ this._hyperLinkModel = _hyperLinkModel, this._sheetCanvasPopManagerService = _sheetCanvasPopManagerService, this.disposeWithMe(() => {
855
868
  this.hideCurrentPopup(), this.endEditing(), this._currentEditing$.complete(), this._currentPopup$.complete();
856
869
  });
857
870
  }
@@ -861,78 +874,78 @@ let $ = class extends O {
861
874
  get currentEditing() {
862
875
  return this._currentEditing$.getValue();
863
876
  }
864
- showPopup(t) {
865
- if (this._currentPopup && Hr(t, this._currentPopup))
877
+ showPopup(location2) {
878
+ if (this._currentPopup && isEqualLink(location2, this._currentPopup))
866
879
  return;
867
880
  this.hideCurrentPopup();
868
- const { unitId: n, subUnitId: r, row: i, col: o } = t, s = this._hyperLinkModel.getHyperLinkByLocation(n, r, i, o);
869
- if (!s)
881
+ const { unitId, subUnitId, row, col } = location2, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
882
+ if (!link)
870
883
  return;
871
- const c = this._sheetCanvasPopManagerService.attachPopupToCell(i, o, {
872
- componentKey: Ue.componentKey,
884
+ const disposable = this._sheetCanvasPopManagerService.attachPopupToCell(row, col, {
885
+ componentKey: CellLinkPopup.componentKey,
873
886
  direction: "bottom",
874
887
  closeOnSelfTarget: !0,
875
- onClickOutside: () => {
888
+ onClickOutside: /* @__PURE__ */ __name(() => {
876
889
  this.hideCurrentPopup();
877
- }
890
+ }, "onClickOutside")
878
891
  });
879
- c && (this._currentPopup = {
880
- unitId: n,
881
- subUnitId: r,
882
- id: s.id,
883
- disposable: c,
884
- row: i,
885
- col: o,
886
- editPermission: !!t.editPermission,
887
- copyPermission: !!t.copyPermission
892
+ disposable && (this._currentPopup = {
893
+ unitId,
894
+ subUnitId,
895
+ id: link.id,
896
+ disposable,
897
+ row,
898
+ col,
899
+ editPermission: !!location2.editPermission,
900
+ copyPermission: !!location2.copyPermission
888
901
  }, this._currentPopup$.next(this._currentPopup));
889
902
  }
890
903
  hideCurrentPopup() {
891
- var t;
892
- this._currentPopup && ((t = this._currentPopup.disposable) == null || t.dispose(), this._currentPopup = null, this._currentPopup$.next(null));
904
+ var _a14;
905
+ this._currentPopup && ((_a14 = this._currentPopup.disposable) == null || _a14.dispose(), this._currentPopup = null, this._currentPopup$.next(null));
893
906
  }
894
- startEditing(t) {
895
- this._currentEditing$.next(t);
907
+ startEditing(link) {
908
+ this._currentEditing$.next(link);
896
909
  }
897
910
  endEditing() {
898
911
  this._currentEditing$.next(null);
899
912
  }
900
- };
901
- $ = Ur([
902
- gt(0, h(H)),
903
- gt(1, h(yn))
904
- ], $);
905
- var jr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, $r = (e, t, n, r) => {
906
- for (var i = r > 1 ? void 0 : r ? Nr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
907
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
908
- return r && i && jr(t, n, i), i;
909
- }, J = (e, t) => (n, r) => t(n, r, e);
910
- let Ie = class extends O {
911
- constructor(e, t, n, r, i, o) {
912
- super(), this._sheetInterceptorService = e, this._injector = t, this._hyperLinkModel = n, this._selectionManagerService = r, this._univerInstanceService = i, this._editorBridgeService = o, this._initCommandInterceptor();
913
+ }, __name(_a5, "SheetsHyperLinkPopupService"), _a5);
914
+ SheetsHyperLinkPopupService = __decorateClass$8([
915
+ __decorateParam$8(0, Inject(HyperLinkModel)),
916
+ __decorateParam$8(1, Inject(SheetCanvasPopManagerService))
917
+ ], SheetsHyperLinkPopupService);
918
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
919
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
920
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
921
+ return kind && result && __defProp$7(target, key, result), result;
922
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a6;
923
+ let SheetHyperLinkSetRangeController = (_a6 = class extends Disposable {
924
+ constructor(_sheetInterceptorService, _injector, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService) {
925
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._injector = _injector, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._initCommandInterceptor();
913
926
  }
914
927
  _initCommandInterceptor() {
915
928
  this._initAddHyperLinkCommandInterceptor(), this._initSetRangeValuesCommandInterceptor(), this._initUpdateHyperLinkCommandInterceptor(), this._initClearSelectionCommandInterceptor(), this._initRichTextEditorInterceptor();
916
929
  }
917
- _getCurrentCell(e, t, n, r) {
918
- var i, o;
919
- return (o = (i = this._univerInstanceService.getUnit(e, E.UNIVER_SHEET)) == null ? void 0 : i.getSheetBySheetId(t)) == null ? void 0 : o.getCell(n, r);
930
+ _getCurrentCell(unitId, subUnitId, row, col) {
931
+ var _a14, _b;
932
+ return (_b = (_a14 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a14.getSheetBySheetId(subUnitId)) == null ? void 0 : _b.getCell(row, col);
920
933
  }
921
934
  _initAddHyperLinkCommandInterceptor() {
922
935
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
923
- getMutations: (e) => {
924
- var t;
925
- if (e.id === Lt.id) {
926
- const n = e.params, { unitId: r, subUnitId: i, link: o } = n, s = this._getCurrentCell(r, i, o.row, o.column), c = {
927
- unitId: r,
928
- subUnitId: i,
936
+ getMutations: /* @__PURE__ */ __name((command) => {
937
+ var _a14;
938
+ if (command.id === AddHyperLinkCommand.id) {
939
+ const params = command.params, { unitId, subUnitId, link } = params, currentCell = this._getCurrentCell(unitId, subUnitId, link.row, link.column), redoParams = {
940
+ unitId,
941
+ subUnitId,
929
942
  cellValue: {
930
- [o.row]: {
931
- [o.column]: {
932
- v: o.display,
943
+ [link.row]: {
944
+ [link.column]: {
945
+ v: link.display,
933
946
  // t: CellValueType.STRING, // Setting a link to a number is still a number
934
947
  p: null,
935
- t: (t = s == null ? void 0 : s.t) != null ? t : void 0
948
+ t: (_a14 = currentCell == null ? void 0 : currentCell.t) != null ? _a14 : void 0
936
949
  // Keep force string type
937
950
  }
938
951
  }
@@ -940,12 +953,12 @@ let Ie = class extends O {
940
953
  };
941
954
  return {
942
955
  redos: [{
943
- id: fe.id,
944
- params: c
956
+ id: SetRangeValuesMutation.id,
957
+ params: redoParams
945
958
  }],
946
959
  undos: [{
947
- id: fe.id,
948
- params: ut(this._injector, c)
960
+ id: SetRangeValuesMutation.id,
961
+ params: SetRangeValuesUndoMutationFactory(this._injector, redoParams)
949
962
  }]
950
963
  };
951
964
  }
@@ -953,23 +966,23 @@ let Ie = class extends O {
953
966
  redos: [],
954
967
  undos: []
955
968
  };
956
- }
969
+ }, "getMutations")
957
970
  }));
958
971
  }
959
972
  _initUpdateHyperLinkCommandInterceptor() {
960
973
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
961
- getMutations: (e) => {
962
- if (e.id === St.id) {
963
- const t = e.params, { unitId: n, subUnitId: r, id: i, payload: o } = t, s = this._hyperLinkModel.getHyperLink(n, r, i);
964
- if (s && s.display !== o.display) {
965
- const c = {
966
- unitId: n,
967
- subUnitId: r,
974
+ getMutations: /* @__PURE__ */ __name((command) => {
975
+ if (command.id === UpdateHyperLinkCommand.id) {
976
+ const params = command.params, { unitId, subUnitId, id, payload } = params, current = this._hyperLinkModel.getHyperLink(unitId, subUnitId, id);
977
+ if (current && current.display !== payload.display) {
978
+ const redoParams = {
979
+ unitId,
980
+ subUnitId,
968
981
  cellValue: {
969
- [s.row]: {
970
- [s.column]: {
971
- v: o.display,
972
- t: dt.STRING,
982
+ [current.row]: {
983
+ [current.column]: {
984
+ v: payload.display,
985
+ t: CellValueType.STRING,
973
986
  p: null
974
987
  }
975
988
  }
@@ -977,12 +990,12 @@ let Ie = class extends O {
977
990
  };
978
991
  return {
979
992
  redos: [{
980
- id: fe.id,
981
- params: c
993
+ id: SetRangeValuesMutation.id,
994
+ params: redoParams
982
995
  }],
983
996
  undos: [{
984
- id: fe.id,
985
- params: ut(this._injector, c)
997
+ id: SetRangeValuesMutation.id,
998
+ params: SetRangeValuesUndoMutationFactory(this._injector, redoParams)
986
999
  }]
987
1000
  };
988
1001
  }
@@ -991,107 +1004,107 @@ let Ie = class extends O {
991
1004
  redos: [],
992
1005
  undos: []
993
1006
  };
994
- }
1007
+ }, "getMutations")
995
1008
  }));
996
1009
  }
997
1010
  _initSetRangeValuesCommandInterceptor() {
998
1011
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
999
- getMutations: (e) => {
1000
- if (e.id === ln.id) {
1001
- const t = e.params, { unitId: n, subUnitId: r } = t, i = [], o = [];
1002
- return t.cellValue && new _t(t.cellValue).forValue((s, c, a) => {
1003
- var l, m, _, v, L, M, y;
1004
- const u = (_ = a == null ? void 0 : a.v) != null ? _ : (m = (l = a == null ? void 0 : a.p) == null ? void 0 : l.body) == null ? void 0 : m.dataStream.slice(0, -2), g = (u != null ? u : "").toString(), f = this._hyperLinkModel.getHyperLinkByLocation(n, r, s, c);
1005
- if (!f) {
1006
- if (de(g) || (v = a == null ? void 0 : a.custom) != null && v.__link_url) {
1007
- const V = (M = (L = a == null ? void 0 : a.custom) == null ? void 0 : L.__link_url) != null ? M : g, R = re.generateRandomId();
1008
- o.push({
1009
- id: T.id,
1012
+ getMutations: /* @__PURE__ */ __name((command) => {
1013
+ if (command.id === SetRangeValuesCommand.id) {
1014
+ const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
1015
+ return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col, cell) => {
1016
+ var _a14, _b, _c, _d, _e, _f, _g;
1017
+ const cellValueRaw = (_c = cell == null ? void 0 : cell.v) != null ? _c : (_b = (_a14 = cell == null ? void 0 : cell.p) == null ? void 0 : _a14.body) == null ? void 0 : _b.dataStream.slice(0, -2), cellValue = (cellValueRaw != null ? cellValueRaw : "").toString(), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1018
+ if (!link) {
1019
+ if (isLegalLink(cellValue) || (_d = cell == null ? void 0 : cell.custom) != null && _d.__link_url) {
1020
+ const url = (_f = (_e = cell == null ? void 0 : cell.custom) == null ? void 0 : _e.__link_url) != null ? _f : cellValue, id = Tools.generateRandomId();
1021
+ undos.push({
1022
+ id: RemoveHyperLinkMutation.id,
1010
1023
  params: {
1011
- unitId: n,
1012
- subUnitId: r,
1013
- id: R
1024
+ unitId,
1025
+ subUnitId,
1026
+ id
1014
1027
  }
1015
- }), i.push({
1016
- id: U.id,
1028
+ }), redos.push({
1029
+ id: AddHyperLinkMutation.id,
1017
1030
  params: {
1018
- unitId: n,
1019
- subUnitId: r,
1031
+ unitId,
1032
+ subUnitId,
1020
1033
  link: {
1021
- id: R,
1022
- row: s,
1023
- column: c,
1024
- display: g,
1025
- payload: rt(V)
1034
+ id,
1035
+ row,
1036
+ column: col,
1037
+ display: cellValue,
1038
+ payload: serializeUrl(url)
1026
1039
  }
1027
1040
  }
1028
1041
  });
1029
1042
  }
1030
1043
  return;
1031
1044
  }
1032
- (u === "" || ((y = a == null ? void 0 : a.custom) == null ? void 0 : y.__link_url) === "") && (i.push({
1033
- id: T.id,
1045
+ (cellValueRaw === "" || ((_g = cell == null ? void 0 : cell.custom) == null ? void 0 : _g.__link_url) === "") && (redos.push({
1046
+ id: RemoveHyperLinkMutation.id,
1034
1047
  params: {
1035
- unitId: n,
1036
- subUnitId: r,
1037
- id: f.id
1048
+ unitId,
1049
+ subUnitId,
1050
+ id: link.id
1038
1051
  }
1039
- }), o.push({
1040
- id: U.id,
1052
+ }), undos.push({
1053
+ id: AddHyperLinkMutation.id,
1041
1054
  params: {
1042
- unitId: n,
1043
- subUnitId: r,
1044
- link: f
1055
+ unitId,
1056
+ subUnitId,
1057
+ link
1045
1058
  }
1046
1059
  }));
1047
1060
  }), {
1048
- undos: o,
1049
- redos: i
1061
+ undos,
1062
+ redos
1050
1063
  };
1051
1064
  }
1052
1065
  return {
1053
1066
  redos: [],
1054
1067
  undos: []
1055
1068
  };
1056
- }
1069
+ }, "getMutations")
1057
1070
  }));
1058
1071
  }
1059
1072
  _initClearSelectionCommandInterceptor() {
1060
1073
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1061
- getMutations: (e) => {
1062
- if (e.id === dn.id || e.id === un.id || e.id === pn.id) {
1063
- const t = [], n = [], r = this._selectionManagerService.getCurrentLastSelection(), i = Ct(this._univerInstanceService);
1064
- if (r && i) {
1065
- const { unitId: o, subUnitId: s } = i;
1066
- Qe.foreach(r.range, (c, a) => {
1067
- const u = this._hyperLinkModel.getHyperLinkByLocation(o, s, c, a);
1068
- u && (t.push({
1069
- id: T.id,
1074
+ getMutations: /* @__PURE__ */ __name((command) => {
1075
+ if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
1076
+ const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
1077
+ if (selection && target) {
1078
+ const { unitId, subUnitId } = target;
1079
+ Range.foreach(selection.range, (row, col) => {
1080
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1081
+ link && (redos.push({
1082
+ id: RemoveHyperLinkMutation.id,
1070
1083
  params: {
1071
- unitId: o,
1072
- subUnitId: s,
1073
- id: u.id
1084
+ unitId,
1085
+ subUnitId,
1086
+ id: link.id
1074
1087
  }
1075
- }), n.push({
1076
- id: U.id,
1088
+ }), undos.push({
1089
+ id: AddHyperLinkMutation.id,
1077
1090
  params: {
1078
- unitId: o,
1079
- subUnitId: s,
1080
- link: u
1091
+ unitId,
1092
+ subUnitId,
1093
+ link
1081
1094
  }
1082
1095
  }));
1083
1096
  });
1084
1097
  }
1085
1098
  return {
1086
- redos: t,
1087
- undos: n
1099
+ redos,
1100
+ undos
1088
1101
  };
1089
1102
  }
1090
1103
  return {
1091
1104
  redos: [],
1092
1105
  undos: []
1093
1106
  };
1094
- }
1107
+ }, "getMutations")
1095
1108
  }));
1096
1109
  }
1097
1110
  _initRichTextEditorInterceptor() {
@@ -1099,522 +1112,522 @@ let Ie = class extends O {
1099
1112
  this._editorBridgeService.interceptor.intercept(
1100
1113
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
1101
1114
  {
1102
- handler: (e, t, n) => {
1103
- var r, i, o, s, c, a;
1104
- if (e != null && e.p) {
1105
- const u = (i = (r = e.p.body) == null ? void 0 : r.customRanges) == null ? void 0 : i.find((f) => f.rangeType === tn.HYPERLINK), g = (o = e.p.resources) == null ? void 0 : o.find((f) => f.name === Kn);
1106
- if (u && g) {
1107
- const f = u.rangeId, l = (a = (c = (s = JSON.parse(g.data)) == null ? void 0 : s.links) == null ? void 0 : c.find((m) => m.id === f)) == null ? void 0 : a.payload;
1108
- return n({
1109
- ...e,
1115
+ handler: /* @__PURE__ */ __name((data, context, next) => {
1116
+ var _a14, _b, _c, _d, _e, _f;
1117
+ if (data != null && data.p) {
1118
+ const range = (_b = (_a14 = data.p.body) == null ? void 0 : _a14.customRanges) == null ? void 0 : _b.find((i) => i.rangeType === CustomRangeType.HYPERLINK), resource = (_c = data.p.resources) == null ? void 0 : _c.find((i) => i.name === DOC_HYPER_LINK_PLUGIN);
1119
+ if (range && resource) {
1120
+ const rangeId = range.rangeId, url = (_f = (_e = (_d = JSON.parse(resource.data)) == null ? void 0 : _d.links) == null ? void 0 : _e.find((i) => i.id === rangeId)) == null ? void 0 : _f.payload;
1121
+ return next({
1122
+ ...data,
1110
1123
  p: null,
1111
- v: Yn(e.p),
1112
- t: dt.STRING,
1124
+ v: getPlainTextFormDocument(data.p),
1125
+ t: CellValueType.STRING,
1113
1126
  custom: {
1114
- __link_url: l
1127
+ __link_url: url
1115
1128
  }
1116
1129
  });
1117
1130
  }
1118
1131
  }
1119
- return n(e);
1120
- }
1132
+ return next(data);
1133
+ }, "handler")
1121
1134
  }
1122
1135
  )
1123
1136
  );
1124
1137
  }
1125
- };
1126
- Ie = $r([
1127
- B(D.Starting, Ie),
1128
- J(0, h(et)),
1129
- J(1, h(Ve)),
1130
- J(2, h(H)),
1131
- J(3, h(yt)),
1132
- J(4, ue),
1133
- J(5, Sn)
1134
- ], Ie);
1135
- var Br = Object.defineProperty, Dr = Object.getOwnPropertyDescriptor, Vr = (e, t, n, r) => {
1136
- for (var i = r > 1 ? void 0 : r ? Dr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1137
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1138
- return r && i && Br(t, n, i), i;
1139
- }, ae = (e, t) => (n, r) => t(n, r, e);
1140
- let ke = class extends O {
1141
- constructor(e, t, n, r, i) {
1142
- super(), this._hoverManagerService = e, this._sheetsHyperLinkPopupService = t, this._renderManagerService = n, this._permissionService = r, this._sheetPermissionInterceptorBaseController = i, this._initHoverListener();
1138
+ }, __name(_a6, "SheetHyperLinkSetRangeController"), _a6);
1139
+ SheetHyperLinkSetRangeController = __decorateClass$7([
1140
+ OnLifecycle(LifecycleStages.Starting, SheetHyperLinkSetRangeController),
1141
+ __decorateParam$7(0, Inject(SheetInterceptorService)),
1142
+ __decorateParam$7(1, Inject(Injector)),
1143
+ __decorateParam$7(2, Inject(HyperLinkModel)),
1144
+ __decorateParam$7(3, Inject(SheetsSelectionsService)),
1145
+ __decorateParam$7(4, IUniverInstanceService),
1146
+ __decorateParam$7(5, IEditorBridgeService)
1147
+ ], SheetHyperLinkSetRangeController);
1148
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1149
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1150
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1151
+ return kind && result && __defProp$6(target, key, result), result;
1152
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a7;
1153
+ let SheetsHyperLinkPopupController = (_a7 = class extends Disposable {
1154
+ constructor(_hoverManagerService, _sheetsHyperLinkPopupService, _renderManagerService, _permissionService, _sheetPermissionInterceptorBaseController) {
1155
+ super(), this._hoverManagerService = _hoverManagerService, this._sheetsHyperLinkPopupService = _sheetsHyperLinkPopupService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._initHoverListener();
1143
1156
  }
1144
1157
  _initHoverListener() {
1145
1158
  this.disposeWithMe(
1146
- this._hoverManagerService.currentCell$.pipe(Rt(100)).subscribe((e) => {
1147
- var f, l;
1148
- if (!e) {
1159
+ this._hoverManagerService.currentCell$.pipe(debounceTime(200)).subscribe((currentCell) => {
1160
+ var _a14, _b;
1161
+ if (!currentCell) {
1149
1162
  this._sheetsHyperLinkPopupService.hideCurrentPopup();
1150
1163
  return;
1151
1164
  }
1152
- const t = (l = (f = this._renderManagerService.getRenderById(e.location.unitId)) == null ? void 0 : f.with(It).getWorksheetSkeleton(e.location.subUnitId)) == null ? void 0 : l.skeleton, n = e.location.col, r = e.location.row;
1153
- let i = r, o = n;
1154
- if (t && t.overflowCache.forValue((m, _, v) => {
1155
- ne.contains(v, { startColumn: n, endColumn: n, startRow: r, endRow: r }) && (i = m, o = _);
1165
+ const skeleton = (_b = (_a14 = this._renderManagerService.getRenderById(currentCell.location.unitId)) == null ? void 0 : _a14.with(SheetSkeletonManagerService).getWorksheetSkeleton(currentCell.location.subUnitId)) == null ? void 0 : _b.skeleton, currentCol = currentCell.location.col, currentRow = currentCell.location.row;
1166
+ let targetRow = currentRow, targetCol = currentCol;
1167
+ if (skeleton && skeleton.overflowCache.forValue((row, col, value) => {
1168
+ Rectangle.contains(value, { startColumn: currentCol, endColumn: currentCol, startRow: currentRow, endRow: currentRow }) && (targetRow = row, targetCol = col);
1156
1169
  }), !this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1157
- workbookTypes: [hn],
1158
- worksheetTypes: [mn],
1159
- rangeTypes: [gn]
1160
- }, [{ startRow: r, startColumn: n, endRow: r, endColumn: n }])) {
1170
+ workbookTypes: [WorkbookViewPermission],
1171
+ worksheetTypes: [WorksheetViewPermission],
1172
+ rangeTypes: [RangeProtectionPermissionViewPoint]
1173
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }])) {
1161
1174
  this._sheetsHyperLinkPopupService.hideCurrentPopup();
1162
1175
  return;
1163
1176
  }
1164
- const c = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1165
- workbookTypes: [Ne],
1166
- worksheetTypes: [$e, Be],
1167
- rangeTypes: [De]
1168
- }, [{ startRow: r, startColumn: n, endRow: r, endColumn: n }]), a = e.location.unitId, u = e.location.subUnitId, g = this._permissionService.composePermission([new fn(a).id, new vn(a, u).id]).every((m) => m.value);
1177
+ const editPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1178
+ workbookTypes: [WorkbookEditablePermission],
1179
+ worksheetTypes: [WorksheetEditPermission, WorksheetInsertHyperlinkPermission],
1180
+ rangeTypes: [RangeProtectionPermissionEditPoint]
1181
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), unitId = currentCell.location.unitId, subUnitId = currentCell.location.subUnitId, copyPermission = this._permissionService.composePermission([new WorkbookCopyPermission(unitId).id, new WorksheetCopyPermission(unitId, subUnitId).id]).every((permission) => permission.value);
1169
1182
  this._sheetsHyperLinkPopupService.showPopup({
1170
- ...e.location,
1171
- row: i,
1172
- col: o,
1173
- editPermission: c,
1174
- copyPermission: g
1183
+ ...currentCell.location,
1184
+ row: targetRow,
1185
+ col: targetCol,
1186
+ editPermission,
1187
+ copyPermission
1175
1188
  });
1176
1189
  })
1177
1190
  );
1178
1191
  }
1179
- };
1180
- ke = Vr([
1181
- B(D.Rendered, ke),
1182
- ae(0, h(Ln)),
1183
- ae(1, h($)),
1184
- ae(2, h(nt)),
1185
- ae(3, h(nn)),
1186
- ae(4, h(Pt))
1187
- ], ke);
1188
- const Ar = (e) => ({
1189
- id: ot.id,
1190
- type: xt.BUTTON,
1191
- positions: [Tt.CONTEXT_MENU],
1192
+ }, __name(_a7, "SheetsHyperLinkPopupController"), _a7);
1193
+ SheetsHyperLinkPopupController = __decorateClass$6([
1194
+ OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPopupController),
1195
+ __decorateParam$6(0, Inject(HoverManagerService)),
1196
+ __decorateParam$6(1, Inject(SheetsHyperLinkPopupService)),
1197
+ __decorateParam$6(2, Inject(IRenderManagerService)),
1198
+ __decorateParam$6(3, Inject(IPermissionService)),
1199
+ __decorateParam$6(4, Inject(SheetPermissionInterceptorBaseController))
1200
+ ], SheetsHyperLinkPopupController);
1201
+ const insertLinkMenuFactory = /* @__PURE__ */ __name((accessor) => ({
1202
+ id: InsertHyperLinkOperation.id,
1203
+ type: MenuItemType.BUTTON,
1204
+ positions: [MenuPosition.CONTEXT_MENU],
1192
1205
  title: "hyperLink.menu.add",
1193
- hidden$: Ut(e, E.UNIVER_SHEET),
1206
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1194
1207
  icon: "LinkSingle",
1195
- disabled$: bt(e, { workbookTypes: [Ne], worksheetTypes: [$e, tt, Be], rangeTypes: [De] })
1196
- }), Wr = (e) => ({
1208
+ disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1209
+ }), "insertLinkMenuFactory"), insertLinkMenuToolbarFactory = /* @__PURE__ */ __name((accessor) => ({
1197
1210
  tooltip: "hyperLink.form.addTitle",
1198
- positions: Tt.TOOLBAR_START,
1199
- group: Bn.TOOLBAR_OTHERS,
1200
- id: st.id,
1201
- type: xt.BUTTON,
1211
+ positions: MenuPosition.TOOLBAR_START,
1212
+ group: MenuGroup.TOOLBAR_OTHERS,
1213
+ id: InsertHyperLinkToolbarOperation.id,
1214
+ type: MenuItemType.BUTTON,
1202
1215
  icon: "LinkSingle",
1203
- hidden$: Ut(e, E.UNIVER_SHEET),
1204
- disabled$: bt(e, { workbookTypes: [Ne], worksheetTypes: [$e, tt, Be], rangeTypes: [De] })
1205
- }), Ft = {
1206
- id: st.id,
1207
- binding: Nn.K | $n.CTRL_COMMAND,
1208
- preconditions: In
1216
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
1217
+ disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
1218
+ }), "insertLinkMenuToolbarFactory"), InsertLinkShortcut = {
1219
+ id: InsertHyperLinkToolbarOperation.id,
1220
+ binding: KeyCode.K | MetaKeys.CTRL_COMMAND,
1221
+ preconditions: whenSheetEditorFocused
1209
1222
  };
1210
- var Fr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, Yr = (e, t, n, r) => {
1211
- for (var i = r > 1 ? void 0 : r ? Kr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1212
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1213
- return r && i && Fr(t, n, i), i;
1214
- }, Q = (e, t) => (n, r) => t(n, r, e);
1215
- let le = class extends O {
1216
- constructor(e, t, n, r, i, o, s) {
1217
- super(), this._config = e, this._componentManager = t, this._commandService = n, this._localeService = r, this._menuService = i, this._injector = o, this._shortcutService = s, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
1223
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1224
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1225
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1226
+ return kind && result && __defProp$5(target, key, result), result;
1227
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a8;
1228
+ let SheetsHyperLinkUIController = (_a8 = class extends Disposable {
1229
+ constructor(_config, _componentManager, _commandService, _localeService, _menuService, _injector, _shortcutService) {
1230
+ super(), this._config = _config, this._componentManager = _componentManager, this._commandService = _commandService, this._localeService = _localeService, this._menuService = _menuService, this._injector = _injector, this._shortcutService = _shortcutService, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
1218
1231
  }
1219
1232
  _initComponents() {
1220
1233
  [
1221
- [Ue, Ue.componentKey],
1222
- [xe, xe.componentKey],
1223
- [Me, "LinkSingle"]
1224
- ].forEach(([e, t]) => {
1225
- this._componentManager.register(t, e);
1234
+ [CellLinkPopup, CellLinkPopup.componentKey],
1235
+ [CellLinkEdit, CellLinkEdit.componentKey],
1236
+ [LinkSingle, "LinkSingle"]
1237
+ ].forEach(([comp, key]) => {
1238
+ this._componentManager.register(key, comp);
1226
1239
  });
1227
1240
  }
1228
1241
  _initCommands() {
1229
1242
  [
1230
- it,
1231
- Te,
1232
- ot,
1233
- st
1234
- ].forEach((e) => {
1235
- this._commandService.registerCommand(e);
1243
+ OpenHyperLinkSidebarOperation,
1244
+ CloseHyperLinkSidebarOperation,
1245
+ InsertHyperLinkOperation,
1246
+ InsertHyperLinkToolbarOperation
1247
+ ].forEach((command) => {
1248
+ this._commandService.registerCommand(command);
1236
1249
  });
1237
1250
  }
1238
1251
  _initMenus() {
1239
- var e, t, n, r;
1240
- this._menuService.addMenuItem(Ar(this._injector), (t = (e = this._config) == null ? void 0 : e.menu) != null ? t : {}), this._menuService.addMenuItem(Wr(this._injector), (r = (n = this._config) == null ? void 0 : n.menu) != null ? r : {});
1252
+ var _a14, _b, _c, _d;
1253
+ this._menuService.addMenuItem(insertLinkMenuFactory(this._injector), (_b = (_a14 = this._config) == null ? void 0 : _a14.menu) != null ? _b : {}), this._menuService.addMenuItem(insertLinkMenuToolbarFactory(this._injector), (_d = (_c = this._config) == null ? void 0 : _c.menu) != null ? _d : {});
1241
1254
  }
1242
1255
  _initShortCut() {
1243
- this._shortcutService.registerShortcut(Ft);
1256
+ this._shortcutService.registerShortcut(InsertLinkShortcut);
1244
1257
  }
1245
- };
1246
- le = Yr([
1247
- B(D.Ready, le),
1248
- Q(1, h(Dn)),
1249
- Q(2, K),
1250
- Q(3, h(pe)),
1251
- Q(4, An),
1252
- Q(5, h(Ve)),
1253
- Q(6, h(Vn))
1254
- ], le);
1255
- const at = "SHEET_HYPER_LINK_UI_PLUGIN";
1256
- var Zr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, Gr = (e, t, n, r) => {
1257
- for (var i = r > 1 ? void 0 : r ? zr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1258
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1259
- return r && i && Zr(t, n, i), i;
1260
- }, ft = (e, t) => (n, r) => t(n, r, e);
1261
- let Pe = class extends O {
1262
- constructor(e, t) {
1263
- super(), this._autoFillService = e, this._hyperLinkModel = t, this._initAutoFill();
1258
+ }, __name(_a8, "SheetsHyperLinkUIController"), _a8);
1259
+ SheetsHyperLinkUIController = __decorateClass$5([
1260
+ OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkUIController),
1261
+ __decorateParam$5(1, Inject(ComponentManager)),
1262
+ __decorateParam$5(2, ICommandService),
1263
+ __decorateParam$5(3, Inject(LocaleService)),
1264
+ __decorateParam$5(4, IMenuService),
1265
+ __decorateParam$5(5, Inject(Injector)),
1266
+ __decorateParam$5(6, Inject(IShortcutService))
1267
+ ], SheetsHyperLinkUIController);
1268
+ const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
1269
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1270
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1271
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1272
+ return kind && result && __defProp$4(target, key, result), result;
1273
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a9;
1274
+ let SheetsHyperLinkAutoFillController = (_a9 = class extends Disposable {
1275
+ constructor(_autoFillService, _hyperLinkModel) {
1276
+ super(), this._autoFillService = _autoFillService, this._hyperLinkModel = _hyperLinkModel, this._initAutoFill();
1264
1277
  }
1265
1278
  // eslint-disable-next-line max-lines-per-function
1266
1279
  _initAutoFill() {
1267
- const e = () => ({ redos: [], undos: [] }), t = (r, i) => {
1268
- const { source: o, target: s, unitId: c, subUnitId: a } = r, u = qe([o, s]), [g, f] = u.ranges, { mapFunc: l } = u, m = {
1269
- row: g.startRow,
1270
- col: g.startColumn
1271
- }, _ = Pn(g, f), v = [], L = [];
1272
- return _.forEach((M) => {
1273
- const y = M.repeatStartCell, V = M.relativeRange, R = {
1274
- startRow: m.row,
1275
- startColumn: m.col,
1276
- endColumn: m.col,
1277
- endRow: m.row
1278
- }, P = {
1279
- startRow: y.row,
1280
- startColumn: y.col,
1281
- endColumn: y.col,
1282
- endRow: y.row
1280
+ const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), generalApplyFunc = /* @__PURE__ */ __name((location2, applyType) => {
1281
+ const { source: sourceRange, target: targetRange, unitId, subUnitId } = location2, virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
1282
+ row: vSourceRange.startRow,
1283
+ col: vSourceRange.startColumn
1284
+ }, repeats = getAutoFillRepeatRange(vSourceRange, vTargetRange), redos = [], undos = [];
1285
+ return repeats.forEach((repeat) => {
1286
+ const targetStartCell = repeat.repeatStartCell, relativeRange = repeat.relativeRange, sourceRange2 = {
1287
+ startRow: sourceStartCell.row,
1288
+ startColumn: sourceStartCell.col,
1289
+ endColumn: sourceStartCell.col,
1290
+ endRow: sourceStartCell.row
1291
+ }, targetRange2 = {
1292
+ startRow: targetStartCell.row,
1293
+ startColumn: targetStartCell.col,
1294
+ endColumn: targetStartCell.col,
1295
+ endRow: targetStartCell.row
1283
1296
  };
1284
- Qe.foreach(V, (G, A) => {
1285
- const q = ne.getPositionRange(
1297
+ Range.foreach(relativeRange, (row, col) => {
1298
+ const sourcePositionRange = Rectangle.getPositionRange(
1286
1299
  {
1287
- startRow: G,
1288
- startColumn: A,
1289
- endColumn: A,
1290
- endRow: G
1300
+ startRow: row,
1301
+ startColumn: col,
1302
+ endColumn: col,
1303
+ endRow: row
1291
1304
  },
1292
- R
1293
- ), { row: he, col: We } = l(q.startRow, q.startColumn), me = this._hyperLinkModel.getHyperLinkByLocation(c, a, he, We);
1294
- if (me) {
1295
- const ie = ne.getPositionRange(
1305
+ sourceRange2
1306
+ ), { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol);
1307
+ if (link) {
1308
+ const targetPositionRange = Rectangle.getPositionRange(
1296
1309
  {
1297
- startRow: G,
1298
- startColumn: A,
1299
- endColumn: A,
1300
- endRow: G
1310
+ startRow: row,
1311
+ startColumn: col,
1312
+ endColumn: col,
1313
+ endRow: row
1301
1314
  },
1302
- P
1303
- ), { row: p, col: S } = l(ie.startRow, ie.startColumn), I = re.generateRandomId(), C = this._hyperLinkModel.getHyperLinkByLocation(c, a, p, S);
1304
- C && v.push({
1305
- id: T.id,
1315
+ targetRange2
1316
+ ), { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn), id = Tools.generateRandomId(), currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
1317
+ currentLink && redos.push({
1318
+ id: RemoveHyperLinkMutation.id,
1306
1319
  params: {
1307
- unitId: c,
1308
- subUnitId: a,
1309
- id: C.id
1320
+ unitId,
1321
+ subUnitId,
1322
+ id: currentLink.id
1310
1323
  }
1311
- }), (oe.COPY === i || oe.SERIES === i) && (v.push({
1312
- id: U.id,
1324
+ }), (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && (redos.push({
1325
+ id: AddHyperLinkMutation.id,
1313
1326
  params: {
1314
- unitId: c,
1315
- subUnitId: a,
1327
+ unitId,
1328
+ subUnitId,
1316
1329
  link: {
1317
- ...me,
1318
- id: I,
1319
- row: p,
1320
- column: S
1330
+ ...link,
1331
+ id,
1332
+ row: targetRow,
1333
+ column: targetCol
1321
1334
  }
1322
1335
  }
1323
- }), L.push({
1324
- id: T.id,
1336
+ }), undos.push({
1337
+ id: RemoveHyperLinkMutation.id,
1325
1338
  params: {
1326
- unitId: c,
1327
- subUnitId: a,
1328
- id: I
1339
+ unitId,
1340
+ subUnitId,
1341
+ id
1329
1342
  }
1330
- })), C && L.push({
1331
- id: U.id,
1343
+ })), currentLink && undos.push({
1344
+ id: AddHyperLinkMutation.id,
1332
1345
  params: {
1333
- unitId: c,
1334
- subUnitId: a,
1335
- link: C
1346
+ unitId,
1347
+ subUnitId,
1348
+ link: currentLink
1336
1349
  }
1337
1350
  });
1338
1351
  }
1339
1352
  });
1340
1353
  }), {
1341
- undos: L,
1342
- redos: v
1354
+ undos,
1355
+ redos
1343
1356
  };
1344
- }, n = {
1345
- id: at,
1346
- onFillData: (r, i, o) => o === oe.COPY || o === oe.ONLY_FORMAT || o === oe.SERIES ? t(r, o) : e()
1357
+ }, "generalApplyFunc"), hook = {
1358
+ id: SHEET_HYPER_LINK_UI_PLUGIN,
1359
+ onFillData: /* @__PURE__ */ __name((location2, direction, applyType) => applyType === APPLY_TYPE.COPY || applyType === APPLY_TYPE.ONLY_FORMAT || applyType === APPLY_TYPE.SERIES ? generalApplyFunc(location2, applyType) : noopReturnFunc(), "onFillData")
1347
1360
  };
1348
- this.disposeWithMe(this._autoFillService.addHook(n));
1361
+ this.disposeWithMe(this._autoFillService.addHook(hook));
1349
1362
  }
1350
- };
1351
- Pe = Gr([
1352
- B(D.Ready, Pe),
1353
- ft(0, kn),
1354
- ft(1, h(H))
1355
- ], Pe);
1356
- var qr = Object.defineProperty, Xr = Object.getOwnPropertyDescriptor, Jr = (e, t, n, r) => {
1357
- for (var i = r > 1 ? void 0 : r ? Xr(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1358
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1359
- return r && i && qr(t, n, i), i;
1360
- }, Ce = (e, t) => (n, r) => t(n, r, e);
1361
- let be = class extends O {
1362
- constructor(t, n, r, i) {
1363
+ }, __name(_a9, "SheetsHyperLinkAutoFillController"), _a9);
1364
+ SheetsHyperLinkAutoFillController = __decorateClass$4([
1365
+ OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkAutoFillController),
1366
+ __decorateParam$4(0, IAutoFillService),
1367
+ __decorateParam$4(1, Inject(HyperLinkModel))
1368
+ ], SheetsHyperLinkAutoFillController);
1369
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1370
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1371
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1372
+ return kind && result && __defProp$3(target, key, result), result;
1373
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a10;
1374
+ let SheetsHyperLinkCopyPasteController = (_a10 = class extends Disposable {
1375
+ constructor(_sheetClipboardService, _hyperLinkModel, _injector, _resolverService) {
1363
1376
  super();
1364
- W(this, "_copyInfo");
1365
- this._sheetClipboardService = t, this._hyperLinkModel = n, this._injector = r, this._resolverService = i, this._initCopyPaste();
1377
+ __publicField(this, "_copyInfo");
1378
+ this._sheetClipboardService = _sheetClipboardService, this._hyperLinkModel = _hyperLinkModel, this._injector = _injector, this._resolverService = _resolverService, this._initCopyPaste();
1366
1379
  }
1367
1380
  _initCopyPaste() {
1368
1381
  this._sheetClipboardService.addClipboardHook({
1369
- id: at,
1370
- onBeforeCopy: (t, n, r) => this._collect(t, n, r),
1371
- onPasteCells: (t, n, r, i) => {
1372
- const { copyType: o = bn.COPY, pasteType: s } = i, { range: c } = t || {}, { range: a, unitId: u, subUnitId: g } = n;
1373
- return this._generateMutations(a, { copyType: o, pasteType: s, copyRange: c, unitId: u, subUnitId: g });
1374
- },
1375
- onPastePlainText: (t, n) => {
1376
- if (de(n)) {
1377
- const r = rt(n), { range: i, unitId: o, subUnitId: s } = t, { ranges: [c], mapFunc: a } = qe([i]), u = [], g = [];
1378
- return Qe.foreach(c, (f, l) => {
1379
- const { row: m, col: _ } = a(f, l), v = this._hyperLinkModel.getHyperLinkByLocation(o, s, m, _);
1380
- v && u.push({
1381
- id: T.id,
1382
+ id: SHEET_HYPER_LINK_UI_PLUGIN,
1383
+ onBeforeCopy: /* @__PURE__ */ __name((unitId, subUnitId, range) => this._collect(unitId, subUnitId, range), "onBeforeCopy"),
1384
+ onPasteCells: /* @__PURE__ */ __name((pasteFrom, pasteTo, data, payload) => {
1385
+ const { copyType = COPY_TYPE.COPY, pasteType } = payload, { range: copyRange } = pasteFrom || {}, { range: pastedRange, unitId, subUnitId } = pasteTo;
1386
+ return this._generateMutations(pastedRange, { copyType, pasteType, copyRange, unitId, subUnitId });
1387
+ }, "onPasteCells"),
1388
+ onPastePlainText: /* @__PURE__ */ __name((pasteTo, clipText) => {
1389
+ if (isLegalLink(clipText)) {
1390
+ const text = serializeUrl(clipText), { range, unitId, subUnitId } = pasteTo, { ranges: [pasteToRange], mapFunc } = virtualizeDiscreteRanges([range]), redos = [], undos = [];
1391
+ return Range.foreach(pasteToRange, (originRow, originCol) => {
1392
+ const { row, col: column } = mapFunc(originRow, originCol), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
1393
+ link && redos.push({
1394
+ id: RemoveHyperLinkMutation.id,
1382
1395
  params: {
1383
- unitId: o,
1384
- subUnitId: s,
1385
- id: v.id
1396
+ unitId,
1397
+ subUnitId,
1398
+ id: link.id
1386
1399
  }
1387
1400
  });
1388
- const L = re.generateRandomId();
1389
- u.push({
1390
- id: U.id,
1401
+ const newId = Tools.generateRandomId();
1402
+ redos.push({
1403
+ id: AddHyperLinkMutation.id,
1391
1404
  params: {
1392
- unitId: o,
1393
- subUnitId: s,
1405
+ unitId,
1406
+ subUnitId,
1394
1407
  link: {
1395
- id: L,
1396
- row: m,
1397
- column: _,
1398
- payload: r
1408
+ id: newId,
1409
+ row,
1410
+ column,
1411
+ payload: text
1399
1412
  }
1400
1413
  }
1401
- }), g.push({
1402
- id: T.id,
1414
+ }), undos.push({
1415
+ id: RemoveHyperLinkMutation.id,
1403
1416
  params: {
1404
- unitId: o,
1405
- subUnitId: s,
1406
- id: L
1417
+ unitId,
1418
+ subUnitId,
1419
+ id: newId
1407
1420
  }
1408
- }), v && g.push({
1409
- id: U.id,
1421
+ }), link && undos.push({
1422
+ id: AddHyperLinkMutation.id,
1410
1423
  params: {
1411
- unitId: o,
1412
- subUnitId: s,
1413
- link: v
1424
+ unitId,
1425
+ subUnitId,
1426
+ link
1414
1427
  }
1415
1428
  });
1416
- }), { redos: u, undos: g };
1429
+ }), { redos, undos };
1417
1430
  }
1418
1431
  return { undos: [], redos: [] };
1419
- }
1432
+ }, "onPastePlainText")
1420
1433
  });
1421
1434
  }
1422
- _collect(t, n, r) {
1423
- const i = new _t();
1435
+ _collect(unitId, subUnitId, range) {
1436
+ const matrix = new ObjectMatrix();
1424
1437
  this._copyInfo = {
1425
- unitId: t,
1426
- subUnitId: n,
1427
- matrix: i
1438
+ unitId,
1439
+ subUnitId,
1440
+ matrix
1428
1441
  };
1429
- const o = {
1442
+ const accessor = {
1430
1443
  get: this._injector.get.bind(this._injector)
1431
- }, s = Rn(r, o, t, n);
1432
- if (!s)
1444
+ }, discreteRange = rangeToDiscreteRange(range, accessor, unitId, subUnitId);
1445
+ if (!discreteRange)
1433
1446
  return;
1434
- const { rows: c, cols: a } = s;
1435
- c.forEach((u, g) => {
1436
- a.forEach((f, l) => {
1437
- var _;
1438
- const m = this._hyperLinkModel.getHyperLinkByLocation(t, n, u, f);
1439
- i.setValue(g, l, (_ = m == null ? void 0 : m.id) != null ? _ : "");
1447
+ const { rows, cols } = discreteRange;
1448
+ rows.forEach((row, rowIndex) => {
1449
+ cols.forEach((col, colIndex) => {
1450
+ var _a14;
1451
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1452
+ matrix.setValue(rowIndex, colIndex, (_a14 = link == null ? void 0 : link.id) != null ? _a14 : "");
1440
1453
  });
1441
1454
  });
1442
1455
  }
1443
1456
  // eslint-disable-next-line max-lines-per-function
1444
- _generateMutations(t, n) {
1457
+ _generateMutations(pastedRange, copyInfo) {
1445
1458
  if (!this._copyInfo)
1446
1459
  return { redos: [], undos: [] };
1447
- if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !n.copyRange)
1460
+ if (!this._copyInfo || !this._copyInfo.matrix.getSizeOf() || !copyInfo.copyRange)
1448
1461
  return { redos: [], undos: [] };
1449
1462
  if ([
1450
- ve.SPECIAL_PASTE_COL_WIDTH,
1451
- ve.SPECIAL_PASTE_VALUE,
1452
- ve.SPECIAL_PASTE_FORMAT,
1453
- ve.SPECIAL_PASTE_FORMULA
1463
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH,
1464
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE,
1465
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT,
1466
+ PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMULA
1454
1467
  ].includes(
1455
- n.pasteType
1468
+ copyInfo.pasteType
1456
1469
  ))
1457
1470
  return { redos: [], undos: [] };
1458
- const { unitId: r, subUnitId: i } = this._copyInfo, o = [], s = [], { ranges: [c, a], mapFunc: u } = qe([n.copyRange, t]);
1459
- return wn(c, a, !0).forEach(({ startRange: f }) => {
1460
- var l;
1461
- (l = this._copyInfo) == null || l.matrix.forValue((m, _, v) => {
1462
- const L = ne.getPositionRange(
1471
+ const { unitId, subUnitId } = this._copyInfo, redos = [], undos = [], { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
1472
+ return getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
1473
+ var _a14;
1474
+ (_a14 = this._copyInfo) == null || _a14.matrix.forValue((row, col, ruleId) => {
1475
+ const range = Rectangle.getPositionRange(
1463
1476
  {
1464
- startRow: m,
1465
- endRow: m,
1466
- startColumn: _,
1467
- endColumn: _
1477
+ startRow: row,
1478
+ endRow: row,
1479
+ startColumn: col,
1480
+ endColumn: col
1468
1481
  },
1469
- f
1470
- ), M = this._hyperLinkModel.getHyperLink(r, i, v), { row: y, col: V } = u(L.startRow, L.startColumn), R = this._hyperLinkModel.getHyperLinkByLocation(n.unitId, n.subUnitId, y, V), P = re.generateRandomId();
1471
- R && o.push({
1472
- id: T.id,
1482
+ startRange
1483
+ ), oldLink = this._hyperLinkModel.getHyperLink(unitId, subUnitId, ruleId), { row: startRow, col: startColumn } = mapFunc(range.startRow, range.startColumn), currentLink = this._hyperLinkModel.getHyperLinkByLocation(copyInfo.unitId, copyInfo.subUnitId, startRow, startColumn), id = Tools.generateRandomId();
1484
+ currentLink && redos.push({
1485
+ id: RemoveHyperLinkMutation.id,
1473
1486
  params: {
1474
- unitId: n.unitId,
1475
- subUnitId: n.subUnitId,
1476
- id: R.id
1487
+ unitId: copyInfo.unitId,
1488
+ subUnitId: copyInfo.subUnitId,
1489
+ id: currentLink.id
1477
1490
  }
1478
- }), M && (o.push({
1479
- id: U.id,
1491
+ }), oldLink && (redos.push({
1492
+ id: AddHyperLinkMutation.id,
1480
1493
  params: {
1481
- unitId: n.unitId,
1482
- subUnitId: n.subUnitId,
1494
+ unitId: copyInfo.unitId,
1495
+ subUnitId: copyInfo.subUnitId,
1483
1496
  link: {
1484
- ...M,
1485
- id: P,
1486
- row: y,
1487
- column: V
1497
+ ...oldLink,
1498
+ id,
1499
+ row: startRow,
1500
+ column: startColumn
1488
1501
  }
1489
1502
  }
1490
- }), s.push({
1491
- id: T.id,
1503
+ }), undos.push({
1504
+ id: RemoveHyperLinkMutation.id,
1492
1505
  params: {
1493
- unitId: n.unitId,
1494
- subUnitId: n.subUnitId,
1495
- id: P
1506
+ unitId: copyInfo.unitId,
1507
+ subUnitId: copyInfo.subUnitId,
1508
+ id
1496
1509
  }
1497
- })), R && s.push({
1498
- id: U.id,
1510
+ })), currentLink && undos.push({
1511
+ id: AddHyperLinkMutation.id,
1499
1512
  params: {
1500
- unitId: n.unitId,
1501
- subUnitId: n.subUnitId,
1502
- link: R
1513
+ unitId: copyInfo.unitId,
1514
+ subUnitId: copyInfo.subUnitId,
1515
+ link: currentLink
1503
1516
  }
1504
1517
  });
1505
1518
  });
1506
- }), { redos: o, undos: s };
1519
+ }), { redos, undos };
1507
1520
  }
1508
- };
1509
- be = Jr([
1510
- B(D.Ready, be),
1511
- Ce(0, En),
1512
- Ce(1, h(H)),
1513
- Ce(2, h(Ve)),
1514
- Ce(3, h(F))
1515
- ], be);
1516
- var Qr = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (e, t, n, r) => {
1517
- for (var i = r > 1 ? void 0 : r ? ei(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1518
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1519
- return r && i && Qr(t, n, i), i;
1520
- }, ni = (e, t) => (n, r) => t(n, r, e);
1521
- let Re = class extends O {
1522
- constructor(e) {
1523
- super(), this._resolverService = e, this._handleInitUrl();
1521
+ }, __name(_a10, "SheetsHyperLinkCopyPasteController"), _a10);
1522
+ SheetsHyperLinkCopyPasteController = __decorateClass$3([
1523
+ OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkCopyPasteController),
1524
+ __decorateParam$3(0, ISheetClipboardService),
1525
+ __decorateParam$3(1, Inject(HyperLinkModel)),
1526
+ __decorateParam$3(2, Inject(Injector)),
1527
+ __decorateParam$3(3, Inject(SheetsHyperLinkResolverService))
1528
+ ], SheetsHyperLinkCopyPasteController);
1529
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1530
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1531
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1532
+ return kind && result && __defProp$2(target, key, result), result;
1533
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a11;
1534
+ let SheetHyperLinkUrlController = (_a11 = class extends Disposable {
1535
+ constructor(_resolverService) {
1536
+ super(), this._resolverService = _resolverService, this._handleInitUrl();
1524
1537
  }
1525
1538
  _handleInitUrl() {
1526
- const e = location.hash;
1527
- e && this._resolverService.parseHyperLink(e).handler();
1539
+ const hash = location.hash;
1540
+ hash && this._resolverService.parseHyperLink(hash).handler();
1528
1541
  }
1529
- };
1530
- Re = ti([
1531
- B(D.Rendered, Re),
1532
- ni(0, h(F))
1533
- ], Re);
1534
- var ri = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, oi = (e, t, n, r) => {
1535
- for (var i = r > 1 ? void 0 : r ? ii(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1536
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1537
- return r && i && ri(t, n, i), i;
1538
- }, Ze = (e, t) => (n, r) => t(n, r, e);
1539
- let we = class extends O {
1540
- constructor(e, t, n) {
1541
- super(), this._localeService = e, this._commandService = t, this._sheetPermissionInterceptorBaseController = n, this._commandExecutedListener();
1542
+ }, __name(_a11, "SheetHyperLinkUrlController"), _a11);
1543
+ SheetHyperLinkUrlController = __decorateClass$2([
1544
+ OnLifecycle(LifecycleStages.Rendered, SheetHyperLinkUrlController),
1545
+ __decorateParam$2(0, Inject(SheetsHyperLinkResolverService))
1546
+ ], SheetHyperLinkUrlController);
1547
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1548
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1549
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1550
+ return kind && result && __defProp$1(target, key, result), result;
1551
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a12;
1552
+ let SheetsHyperLinkPermissionController = (_a12 = class extends Disposable {
1553
+ constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
1554
+ super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
1542
1555
  }
1543
1556
  _commandExecutedListener() {
1544
1557
  this.disposeWithMe(
1545
- this._commandService.beforeCommandExecuted((e) => {
1546
- e.id === Ft.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1547
- workbookTypes: [Ne],
1548
- rangeTypes: [De],
1549
- worksheetTypes: [$e, tt, Be]
1558
+ this._commandService.beforeCommandExecuted((command) => {
1559
+ command.id === InsertLinkShortcut.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1560
+ workbookTypes: [WorkbookEditablePermission],
1561
+ rangeTypes: [RangeProtectionPermissionEditPoint],
1562
+ worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission]
1550
1563
  }) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
1551
1564
  })
1552
1565
  );
1553
1566
  }
1554
- };
1555
- we = oi([
1556
- B(D.Rendered, we),
1557
- Ze(0, h(pe)),
1558
- Ze(1, K),
1559
- Ze(2, h(Pt))
1560
- ], we);
1561
- var Kt = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (e, t, n) => t in e ? Kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ci = (e, t, n, r) => {
1562
- for (var i = r > 1 ? void 0 : r ? si(t, n) : t, o = e.length - 1, s; o >= 0; o--)
1563
- (s = e[o]) && (i = (r ? s(t, n, i) : s(i)) || i);
1564
- return r && i && Kt(t, n, i), i;
1565
- }, vt = (e, t) => (n, r) => t(n, r, e), Yt = (e, t, n) => ai(e, typeof t != "symbol" ? t + "" : t, n);
1566
- let He = class extends rn {
1567
- constructor(e, t, n) {
1568
- super(), this._config = e, this._injector = t, this._renderManagerService = n;
1567
+ }, __name(_a12, "SheetsHyperLinkPermissionController"), _a12);
1568
+ SheetsHyperLinkPermissionController = __decorateClass$1([
1569
+ OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPermissionController),
1570
+ __decorateParam$1(0, Inject(LocaleService)),
1571
+ __decorateParam$1(1, ICommandService),
1572
+ __decorateParam$1(2, Inject(SheetPermissionInterceptorBaseController))
1573
+ ], SheetsHyperLinkPermissionController);
1574
+ 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) => {
1575
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1576
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1577
+ return kind && result && __defProp2(target, key, result), result;
1578
+ }, "__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"), _a13;
1579
+ let UniverSheetsHyperLinkUIPlugin = (_a13 = class extends Plugin {
1580
+ constructor(_config, _injector, _renderManagerService) {
1581
+ super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService;
1569
1582
  }
1570
- onStarting(e) {
1583
+ onStarting() {
1571
1584
  [
1572
- [F],
1573
- [$],
1574
- [ye],
1575
- [Se],
1576
- [Ie],
1577
- [ke],
1585
+ [SheetsHyperLinkResolverService],
1586
+ [SheetsHyperLinkPopupService],
1587
+ [SheetsHyperLinkRemoveSheetController],
1588
+ [SheetsHyperLinkRenderManagerController],
1589
+ [SheetHyperLinkSetRangeController],
1590
+ [SheetsHyperLinkPopupController],
1578
1591
  [
1579
- le,
1592
+ SheetsHyperLinkUIController,
1580
1593
  {
1581
- useFactory: () => this._injector.createInstance(le, this._config)
1594
+ useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetsHyperLinkUIController, this._config), "useFactory")
1582
1595
  }
1583
1596
  ],
1584
- [Pe],
1585
- [be],
1586
- [we],
1587
- [Re]
1588
- ].forEach((n) => e.add(n));
1597
+ [SheetsHyperLinkAutoFillController],
1598
+ [SheetsHyperLinkCopyPasteController],
1599
+ [SheetsHyperLinkPermissionController],
1600
+ [SheetHyperLinkUrlController]
1601
+ ].forEach((dep) => this._injector.add(dep));
1589
1602
  }
1590
1603
  onReady() {
1591
1604
  [
1592
- [Xe]
1593
- ].forEach((t) => this._renderManagerService.registerRenderModule(E.UNIVER_SHEET, t));
1605
+ [SheetsHyperLinkRenderController]
1606
+ ].forEach((d) => this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, d));
1594
1607
  }
1595
- };
1596
- Yt(He, "pluginName", at);
1597
- Yt(He, "type", E.UNIVER_SHEET);
1598
- He = ci([
1599
- on(Cn),
1600
- vt(1, h(Ve)),
1601
- vt(2, nt)
1602
- ], He);
1608
+ }, __name(_a13, "UniverSheetsHyperLinkUIPlugin"), _a13);
1609
+ __publicField2(UniverSheetsHyperLinkUIPlugin, "pluginName", SHEET_HYPER_LINK_UI_PLUGIN);
1610
+ __publicField2(UniverSheetsHyperLinkUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1611
+ UniverSheetsHyperLinkUIPlugin = __decorateClass([
1612
+ DependentOn(UniverSheetsHyperLinkPlugin),
1613
+ __decorateParam(1, Inject(Injector)),
1614
+ __decorateParam(2, IRenderManagerService)
1615
+ ], UniverSheetsHyperLinkUIPlugin);
1603
1616
  export {
1604
- Te as CloseHyperLinkSidebarOperation,
1605
- ot as InsertHyperLinkOperation,
1606
- Ft as InsertLinkShortcut,
1607
- it as OpenHyperLinkSidebarOperation,
1608
- Ie as SheetHyperLinkSetRangeController,
1609
- Re as SheetHyperLinkUrlController,
1610
- Pe as SheetsHyperLinkAutoFillController,
1611
- be as SheetsHyperLinkCopyPasteController,
1612
- ke as SheetsHyperLinkPopupController,
1613
- $ as SheetsHyperLinkPopupService,
1614
- ye as SheetsHyperLinkRemoveSheetController,
1615
- Xe as SheetsHyperLinkRenderController,
1616
- Se as SheetsHyperLinkRenderManagerController,
1617
- F as SheetsHyperLinkResolverService,
1618
- le as SheetsHyperLinkUIController,
1619
- He as UniverSheetsHyperLinkUIPlugin
1617
+ CloseHyperLinkSidebarOperation,
1618
+ InsertHyperLinkOperation,
1619
+ InsertLinkShortcut,
1620
+ OpenHyperLinkSidebarOperation,
1621
+ SheetHyperLinkSetRangeController,
1622
+ SheetHyperLinkUrlController,
1623
+ SheetsHyperLinkAutoFillController,
1624
+ SheetsHyperLinkCopyPasteController,
1625
+ SheetsHyperLinkPopupController,
1626
+ SheetsHyperLinkPopupService,
1627
+ SheetsHyperLinkRemoveSheetController,
1628
+ SheetsHyperLinkRenderController,
1629
+ SheetsHyperLinkRenderManagerController,
1630
+ SheetsHyperLinkResolverService,
1631
+ SheetsHyperLinkUIController,
1632
+ UniverSheetsHyperLinkUIPlugin
1620
1633
  };