@univerjs/core
Version:
Core library for Univer.
1,896 lines • 652 kB
JavaScript
var _c = Object.defineProperty;
var pc = (e, t, n) => t in e ? _c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var p = (e, t, n) => pc(e, typeof t != "symbol" ? t + "" : t, n);
import { createIdentifier as ht, Inject as yt, Injector as Yn } from "@wendellhu/redi";
export * from "@wendellhu/redi";
import { Subscription as Ec, Subject as ot, Observable as br, filter as Rr, ReplaySubject as Cc, take as Rc, tap as ea, debounceTime as Ic, map as Zi, BehaviorSubject as tt, merge as Ml, timer as wc, distinctUntilChanged as Oc, firstValueFrom as Sc, skip as Ll, of as Mr, combineLatest as vc } from "rxjs";
import { filter as bc, debounceTime as Ac, first as yc, map as Tc } from "rxjs/operators";
import { defaultTheme as Lr } from "@univerjs/themes";
function Nc(e, t) {
for (var n = 0; n < t.length; n++) {
const r = t[n];
if (typeof r != "string" && !Array.isArray(r)) {
for (const s in r)
if (s !== "default" && !(s in e)) {
const i = Object.getOwnPropertyDescriptor(r, s);
i && Object.defineProperty(e, s, i.get ? i : {
enumerable: !0,
get: () => r[s]
});
}
}
}
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
}
const Dt = typeof global < "u" ? global : typeof self < "u" ? self : window;
function Mc() {
const t = /* @__PURE__ */ new Map();
let n = 0;
typeof Dt.requestIdleCallback != "function" && (Dt.requestIdleCallback = function(s) {
const i = Date.now(), o = ++n, a = setTimeout(function() {
t.delete(o);
const u = Math.max(0, 50 - (Date.now() - i));
s({
didTimeout: u === 0,
timeRemaining() {
return u;
}
});
}, 1);
return t.set(o, a), o;
}), typeof Dt.cancelIdleCallback != "function" && (Dt.cancelIdleCallback = function(s) {
const i = t.get(s);
i !== void 0 && (clearTimeout(i), t.delete(s));
});
}
function Lc() {
typeof Dt.Array.prototype.findLastIndex != "function" && (Dt.Array.prototype.findLastIndex = function(t, n) {
if (this == null)
throw new TypeError("Array.prototype.findLastIndex called on null or undefined");
if (typeof t != "function")
throw new TypeError("callback must be a function");
const r = this.length >>> 0;
for (let s = r - 1; s >= 0; s--)
if (s in this && t.call(n, this[s], s, this))
return s;
return -1;
}), typeof Dt.Array.prototype.findLast != "function" && (Dt.Array.prototype.findLast = function(t, n) {
const r = this.findLastIndex(t, n);
return r !== -1 ? this[r] : void 0;
});
}
function xc() {
typeof Dt.String.prototype.at != "function" && (Dt.String.prototype.at = function(t) {
if (this == null)
throw new TypeError("String.prototype.at called on null or undefined");
const n = this.length;
if (t < 0 && (t = n + t), !(t < 0 || t >= n))
return this.charAt(t);
});
}
function Dc() {
Mc(), Lc(), xc();
}
function Ss(e, t) {
const n = e.indexOf(t);
return n > -1 ? (e.splice(n, 1), !0) : !1;
}
function FC(e) {
const t = /* @__PURE__ */ new Set(), n = [];
for (const r of e)
t.has(r) || (t.add(r), n.push(r));
return n;
}
function $C(e, t) {
const n = /* @__PURE__ */ new Set(), r = [];
for (const s of e) {
const i = t(s);
n.has(i) || (n.add(i), r.push(s));
}
return r;
}
function Uc(e, t) {
for (let n = e.length - 1; n > -1; n--) {
const r = e[n];
if (t(r, n))
return r;
}
return null;
}
function HC(e, t) {
if (e.length === 0)
return e;
const n = t % e.length;
return e.slice(n).concat(e.slice(0, n));
}
function BC(e, t) {
const n = /* @__PURE__ */ new Map();
return e.forEach((r) => {
const s = t(r);
let i = n.get(s);
n.has(s) || (i = [], n.set(s, i)), i.push(r);
}), n;
}
function jC(e) {
return Array.isArray(e) ? e : [e];
}
function Rt(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var js, ta;
function kc() {
if (ta) return js;
ta = 1;
var e = function(t) {
if (t = t || {}, this.Promise = t.Promise || Promise, this.queues = /* @__PURE__ */ Object.create(null), this.domainReentrant = t.domainReentrant || !1, this.domainReentrant) {
if (typeof process > "u" || typeof process.domain > "u")
throw new Error(
"Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill."
);
this.domains = /* @__PURE__ */ Object.create(null);
}
this.timeout = t.timeout || e.DEFAULT_TIMEOUT, this.maxOccupationTime = t.maxOccupationTime || e.DEFAULT_MAX_OCCUPATION_TIME, this.maxExecutionTime = t.maxExecutionTime || e.DEFAULT_MAX_EXECUTION_TIME, t.maxPending === 1 / 0 || Number.isInteger(t.maxPending) && t.maxPending >= 0 ? this.maxPending = t.maxPending : this.maxPending = e.DEFAULT_MAX_PENDING;
};
return e.DEFAULT_TIMEOUT = 0, e.DEFAULT_MAX_OCCUPATION_TIME = 0, e.DEFAULT_MAX_EXECUTION_TIME = 0, e.DEFAULT_MAX_PENDING = 1e3, e.prototype.acquire = function(t, n, r, s) {
if (Array.isArray(t))
return this._acquireBatch(t, n, r, s);
if (typeof n != "function")
throw new Error("You must pass a function to execute");
var i = null, o = null, a = null;
typeof r != "function" && (s = r, r = null, a = new this.Promise(function(P, W) {
i = P, o = W;
})), s = s || {};
var l = !1, u = null, c = null, h = null, d = this, f = function(P, W, w) {
c && (clearTimeout(c), c = null), h && (clearTimeout(h), h = null), P && (d.queues[t] && d.queues[t].length === 0 && delete d.queues[t], d.domainReentrant && delete d.domains[t]), l || (a ? W ? o(W) : i(w) : typeof r == "function" && r(W, w), l = !0), P && d.queues[t] && d.queues[t].length > 0 && d.queues[t].shift()();
}, g = function(P) {
if (l)
return f(P);
u && (clearTimeout(u), u = null), d.domainReentrant && P && (d.domains[t] = process.domain);
var W = s.maxExecutionTime || d.maxExecutionTime;
if (W && (h = setTimeout(function() {
d.queues[t] && f(P, new Error("Maximum execution time is exceeded " + t));
}, W)), n.length === 1) {
var w = !1;
try {
n(function(C, v) {
w || (w = !0, f(P, C, v));
});
} catch (C) {
w || (w = !0, f(P, C));
}
} else
d._promiseTry(function() {
return n();
}).then(function(C) {
f(P, void 0, C);
}, function(C) {
f(P, C);
});
};
d.domainReentrant && process.domain && (g = process.domain.bind(g));
var _ = s.maxPending || d.maxPending;
if (!d.queues[t])
d.queues[t] = [], g(!0);
else if (d.domainReentrant && process.domain && process.domain === d.domains[t])
g(!1);
else if (d.queues[t].length >= _)
f(!1, new Error("Too many pending tasks in queue " + t));
else {
var R = function() {
g(!0);
};
s.skipQueue ? d.queues[t].unshift(R) : d.queues[t].push(R);
var b = s.timeout || d.timeout;
b && (u = setTimeout(function() {
u = null, f(!1, new Error("async-lock timed out in queue " + t));
}, b));
}
var H = s.maxOccupationTime || d.maxOccupationTime;
if (H && (c = setTimeout(function() {
d.queues[t] && f(!1, new Error("Maximum occupation time is exceeded in queue " + t));
}, H)), a)
return a;
}, e.prototype._acquireBatch = function(t, n, r, s) {
typeof r != "function" && (s = r, r = null);
var i = this, o = function(l, u) {
return function(c) {
i.acquire(l, u, c, s);
};
}, a = t.reduceRight(function(l, u) {
return o(u, l);
}, n);
if (typeof r == "function")
a(r);
else
return new this.Promise(function(l, u) {
a.length === 1 ? a(function(c, h) {
c ? u(c) : l(h);
}) : l(a());
});
}, e.prototype.isBusy = function(t) {
return t ? !!this.queues[t] : Object.keys(this.queues).length > 0;
}, e.prototype._promiseTry = function(t) {
try {
return this.Promise.resolve(t());
} catch (n) {
return this.Promise.reject(n);
}
}, js = e, js;
}
var Ws, na;
function Pc() {
return na || (na = 1, Ws = kc()), Ws;
}
var Fc = Pc();
const WC = /* @__PURE__ */ Rt(Fc), $c = /* @__PURE__ */ new Set(["true", "false"]);
function YC(e) {
return $c.has(e.toLowerCase());
}
const Ar = "__INTERNAL_EDITOR__", xl = `${Ar}DOCS_NORMAL`, Dl = `${Ar}DOCS_FORMULA_BAR`, Hc = `${Ar}ZEN_EDITOR`, Bc = `\r
`, jc = "isRowStylePrecedeColumnStyle", Wc = Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");
function zC(e) {
return `${Ar}${e}`;
}
function Yc(e) {
return e.startsWith(Ar);
}
function VC(e, t) {
t.forEach((n) => e.add(n));
}
function zc(e, t) {
t.forEach(([n]) => {
e.has(n) && e.get(n);
});
}
function Vc(e, t) {
if (Object.is(e, t))
return !0;
if (typeof e != "object" || !e || typeof t != "object" || !t)
return !1;
const n = Object.keys(e), r = Object.keys(t);
if (n.length !== r.length)
return !1;
const s = Object.prototype.hasOwnProperty.bind(t);
for (let i = 0; i < n.length; i++) {
const o = n[i];
if (!s(o))
return !1;
const a = e[o], l = t[o];
if (a !== l)
return !1;
}
return !0;
}
class gi extends Error {
constructor(t) {
super(t), this.name = "CustomCommandExecutionError";
}
}
class GC extends gi {
constructor() {
super("Canceled by facade"), this.name = "CanceledError";
}
}
function KC(e, t = 16) {
let n = 0, r = null;
return function(...i) {
const o = Date.now();
o - n < t ? (r && clearTimeout(r), r = setTimeout(() => {
n = o, e.apply(this, i);
}, t)) : (n = o, e.apply(this, i));
};
}
var sr = /* @__PURE__ */ ((e) => (e[e.Style = 1] = "Style", e[e.Value = 2] = "Value", e))(sr || {});
function XC(e) {
return `sheet_interceptor_${e}`;
}
const Gc = (e) => function(t, n) {
let r = -1, s = t;
for (let i = 0; i <= e.length; i++) {
if (i <= r)
throw new Error("[SheetInterceptorService]: next() called multiple times!");
if (r = i, i === e.length)
return s;
const o = e[i];
let a = !1;
if (s = o.handler(s, n, (l) => (a = !0, l)), !a)
break;
}
return s;
};
class qC {
constructor(t) {
p(this, "_interceptorsByName", /* @__PURE__ */ new Map());
p(this, "_interceptorPoints");
this._interceptorPoints = t;
}
/**
* Get the interceptors.
* @param name Name of the intercepted point.
* @param filter A callback function to filter the interceptors.
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
* you should cache the result instead of calling this function multiple times.
*/
fetchThroughInterceptors(t, n) {
const r = t;
let s = this._interceptorsByName.get(r);
return n && (s = s.filter(n)), Gc(s || []);
}
intercept(t, n) {
const r = t;
this._interceptorsByName.has(r) || this._interceptorsByName.set(r, []);
const s = this._interceptorsByName.get(r);
return s.push(n), this._interceptorsByName.set(
r,
s.sort((i, o) => {
var a, l;
return ((a = o.priority) != null ? a : 0) - ((l = i.priority) != null ? l : 0);
})
// from large to small
), () => Ss(this._interceptorsByName.get(r), n);
}
getInterceptPoints() {
return this._interceptorPoints;
}
dispose() {
this._interceptorsByName.clear();
}
}
function ZC(e) {
return `sheet_async_interceptor_${e}`;
}
const Kc = (e) => async function(t, n) {
let r = -1, s = t;
for (let i = 0; i <= e.length; i++) {
if (i <= r)
throw new Error("[SheetInterceptorService]: next() called multiple times!");
if (r = i, i === e.length)
return s;
const o = e[i];
let a = !1;
if (s = await o.handler(s, n, async (l) => (a = !0, l)), !a)
break;
}
return s;
};
class JC {
constructor(t) {
p(this, "_asyncInterceptorsByName", /* @__PURE__ */ new Map());
p(this, "_asyncInterceptorPoints");
this._asyncInterceptorPoints = t;
}
/**
* Get the interceptors.
* @param name Name of the intercepted point.
* @param filter A callback function to filter the interceptors.
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
* you should cache the result instead of calling this function multiple times.
*/
fetchThroughAsyncInterceptors(t, n) {
const r = t;
let s = this._asyncInterceptorsByName.get(r);
return n && (s = s.filter(n)), Kc(s || []);
}
async interceptAsync(t, n) {
const r = t;
this._asyncInterceptorsByName.has(r) || this._asyncInterceptorsByName.set(r, []);
const s = this._asyncInterceptorsByName.get(r);
return s.push(n), this._asyncInterceptorsByName.set(
r,
s.sort((i, o) => {
var a, l;
return ((a = o.priority) != null ? a : 0) - ((l = i.priority) != null ? l : 0);
})
// from large to small
), () => Ss(this._asyncInterceptorsByName.get(r), n);
}
getInterceptPoints() {
return this._asyncInterceptorPoints;
}
dispose() {
this._asyncInterceptorsByName.clear();
}
}
function Ul(e) {
return e.map((t) => t / 255);
}
function kl(e) {
return e.map((t) => Math.round(t * 255));
}
function Xc([e, t, n]) {
const r = Math.max(e, t, n), s = Math.min(e, t, n), i = (r + s) / 2;
let o = 0, a = 0;
if (r !== s) {
const l = r - s;
switch (a = i > 0.5 ? l / (2 - r - s) : l / (r + s), r) {
case e:
o = (t - n) / l + (t < n ? 6 : 0);
break;
case t:
o = (n - e) / l + 2;
break;
case n:
o = (e - t) / l + 4;
break;
}
o /= 6;
}
return [o, a, i];
}
function ds(e, t, n) {
const r = [e, t, n].map((s) => s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4);
return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
}
function ra(e, t) {
return (Math.max(e, t) + 0.05) / (Math.min(e, t) + 0.05);
}
function qc(e, t, n) {
let r, s, i;
if (t === 0)
r = s = i = n;
else {
const o = (u, c, h) => {
let d = h;
return d < 0 && (d += 1), d > 1 && (d -= 1), d < 0.16666666666666666 ? u + (c - u) * 6 * d : d < 0.5 ? c : d < 0.6666666666666666 ? u + (c - u) * (0.6666666666666666 - d) * 6 : u;
}, a = n < 0.5 ? n * (1 + t) : n + t - n * t, l = 2 * n - a;
r = o(l, a, e + 1 / 3), s = o(l, a, e), i = o(l, a, e - 1 / 3);
}
return [r, s, i];
}
const Ys = { r: 1, g: 1, b: 1 }, zs = { r: 0, g: 0, b: 0 }, Zc = ds(Ys.r, Ys.g, Ys.b), Jc = ds(zs.r, zs.g, zs.b);
function Qc(e) {
const t = ds(e[0], e[1], e[2]), n = ra(
Zc,
t
), r = Xc(e);
let s = 1 - r[2], i, o, a;
do
i = qc(r[0], r[1], s), o = ds(i[0], i[1], i[2]), a = ra(o, Jc), s += 0.01;
while (s <= 1 && s >= 0 && Math.abs(a - n) < 0.01);
return i;
}
function QC(e) {
return kl(Qc(Ul(e)));
}
const mt = [
[0.333, -0.667, -0.667, 0, 1],
[-0.667, 0.333, -0.667, 0, 1],
[-0.667, -0.667, 0.333, 0, 1],
[0, 0, 0, 1, 0]
];
function eh(e) {
const t = e[0], n = e[1], r = e[2];
let s = [
mt[0][0] * t + mt[0][1] * n + mt[0][2] * r + mt[0][4],
mt[1][0] * t + mt[1][1] * n + mt[1][2] * r + mt[1][4],
mt[2][0] * t + mt[2][1] * n + mt[2][2] * r + mt[2][4]
];
return s = s.map((i) => i > 1 ? 1 : i < 0 ? 0 : i), s;
}
function e1(e) {
return kl(eh(Ul(e)));
}
var Pl = typeof global == "object" && global && global.Object === Object && global, th = typeof self == "object" && self && self.Object === Object && self, Cn = Pl || th || Function("return this")(), $n = Cn.Symbol, Fl = Object.prototype, nh = Fl.hasOwnProperty, rh = Fl.toString, qn = $n ? $n.toStringTag : void 0;
function sh(e) {
var t = nh.call(e, qn), n = e[qn];
try {
e[qn] = void 0;
var r = !0;
} catch {
}
var s = rh.call(e);
return r && (t ? e[qn] = n : delete e[qn]), s;
}
var ih = Object.prototype, oh = ih.toString;
function ah(e) {
return oh.call(e);
}
var lh = "[object Null]", uh = "[object Undefined]", sa = $n ? $n.toStringTag : void 0;
function yr(e) {
return e == null ? e === void 0 ? uh : lh : sa && sa in Object(e) ? sh(e) : ah(e);
}
function zn(e) {
return e != null && typeof e == "object";
}
var ch = "[object Symbol]";
function vs(e) {
return typeof e == "symbol" || zn(e) && yr(e) == ch;
}
function hh(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, s = Array(r); ++n < r; )
s[n] = t(e[n], n, e);
return s;
}
var Hn = Array.isArray, ia = $n ? $n.prototype : void 0, oa = ia ? ia.toString : void 0;
function $l(e) {
if (typeof e == "string")
return e;
if (Hn(e))
return hh(e, $l) + "";
if (vs(e))
return oa ? oa.call(e) : "";
var t = e + "";
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
var dh = /\s/;
function fh(e) {
for (var t = e.length; t-- && dh.test(e.charAt(t)); )
;
return t;
}
var mh = /^\s+/;
function gh(e) {
return e && e.slice(0, fh(e) + 1).replace(mh, "");
}
function Ct(e) {
var t = typeof e;
return e != null && (t == "object" || t == "function");
}
var aa = NaN, _h = /^[-+]0x[0-9a-f]+$/i, ph = /^0b[01]+$/i, Eh = /^0o[0-7]+$/i, Ch = parseInt;
function la(e) {
if (typeof e == "number")
return e;
if (vs(e))
return aa;
if (Ct(e)) {
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
e = Ct(t) ? t + "" : t;
}
if (typeof e != "string")
return e === 0 ? e : +e;
e = gh(e);
var n = ph.test(e);
return n || Eh.test(e) ? Ch(e.slice(2), n ? 2 : 8) : _h.test(e) ? aa : +e;
}
function Hl(e) {
return e;
}
var Rh = "[object AsyncFunction]", Ih = "[object Function]", wh = "[object GeneratorFunction]", Oh = "[object Proxy]";
function Ji(e) {
if (!Ct(e))
return !1;
var t = yr(e);
return t == Ih || t == wh || t == Rh || t == Oh;
}
var Vs = Cn["__core-js_shared__"], ua = function() {
var e = /[^.]+$/.exec(Vs && Vs.keys && Vs.keys.IE_PROTO || "");
return e ? "Symbol(src)_1." + e : "";
}();
function Sh(e) {
return !!ua && ua in e;
}
var vh = Function.prototype, bh = vh.toString;
function Ah(e) {
if (e != null) {
try {
return bh.call(e);
} catch {
}
try {
return e + "";
} catch {
}
}
return "";
}
var yh = /[\\^$.*+?()[\]{}|]/g, Th = /^\[object .+?Constructor\]$/, Nh = Function.prototype, Mh = Object.prototype, Lh = Nh.toString, xh = Mh.hasOwnProperty, Dh = RegExp(
"^" + Lh.call(xh).replace(yh, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Uh(e) {
if (!Ct(e) || Sh(e))
return !1;
var t = Ji(e) ? Dh : Th;
return t.test(Ah(e));
}
function kh(e, t) {
return e == null ? void 0 : e[t];
}
function Qi(e, t) {
var n = kh(e, t);
return Uh(n) ? n : void 0;
}
var ca = Object.create, Ph = /* @__PURE__ */ function() {
function e() {
}
return function(t) {
if (!Ct(t))
return {};
if (ca)
return ca(t);
e.prototype = t;
var n = new e();
return e.prototype = void 0, n;
};
}();
function Fh(e, t, n) {
switch (n.length) {
case 0:
return e.call(t);
case 1:
return e.call(t, n[0]);
case 2:
return e.call(t, n[0], n[1]);
case 3:
return e.call(t, n[0], n[1], n[2]);
}
return e.apply(t, n);
}
function $h(e, t) {
var n = -1, r = e.length;
for (t || (t = Array(r)); ++n < r; )
t[n] = e[n];
return t;
}
var Hh = 800, Bh = 16, jh = Date.now;
function Wh(e) {
var t = 0, n = 0;
return function() {
var r = jh(), s = Bh - (r - n);
if (n = r, s > 0) {
if (++t >= Hh)
return arguments[0];
} else
t = 0;
return e.apply(void 0, arguments);
};
}
function Yh(e) {
return function() {
return e;
};
}
var fs = function() {
try {
var e = Qi(Object, "defineProperty");
return e({}, "", {}), e;
} catch {
}
}(), zh = fs ? function(e, t) {
return fs(e, "toString", {
configurable: !0,
enumerable: !1,
value: Yh(t),
writable: !0
});
} : Hl, Vh = Wh(zh), Gh = 9007199254740991, Kh = /^(?:0|[1-9]\d*)$/;
function eo(e, t) {
var n = typeof e;
return t = t == null ? Gh : t, !!t && (n == "number" || n != "symbol" && Kh.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function to(e, t, n) {
t == "__proto__" && fs ? fs(e, t, {
configurable: !0,
enumerable: !0,
value: n,
writable: !0
}) : e[t] = n;
}
function bs(e, t) {
return e === t || e !== e && t !== t;
}
var Xh = Object.prototype, qh = Xh.hasOwnProperty;
function Bl(e, t, n) {
var r = e[t];
(!(qh.call(e, t) && bs(r, n)) || n === void 0 && !(t in e)) && to(e, t, n);
}
function Zh(e, t, n, r) {
var s = !n;
n || (n = {});
for (var i = -1, o = t.length; ++i < o; ) {
var a = t[i], l = void 0;
l === void 0 && (l = e[a]), s ? to(n, a, l) : Bl(n, a, l);
}
return n;
}
var ha = Math.max;
function Jh(e, t, n) {
return t = ha(t === void 0 ? e.length - 1 : t, 0), function() {
for (var r = arguments, s = -1, i = ha(r.length - t, 0), o = Array(i); ++s < i; )
o[s] = r[t + s];
s = -1;
for (var a = Array(t + 1); ++s < t; )
a[s] = r[s];
return a[t] = n(o), Fh(e, this, a);
};
}
function Qh(e, t) {
return Vh(Jh(e, t, Hl), e + "");
}
var ed = 9007199254740991;
function jl(e) {
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= ed;
}
function no(e) {
return e != null && jl(e.length) && !Ji(e);
}
function td(e, t, n) {
if (!Ct(n))
return !1;
var r = typeof t;
return (r == "number" ? no(n) && eo(t, n.length) : r == "string" && t in n) ? bs(n[t], e) : !1;
}
function Wl(e) {
return Qh(function(t, n) {
var r = -1, s = n.length, i = s > 1 ? n[s - 1] : void 0, o = s > 2 ? n[2] : void 0;
for (i = e.length > 3 && typeof i == "function" ? (s--, i) : void 0, o && td(n[0], n[1], o) && (i = s < 3 ? void 0 : i, s = 1), t = Object(t); ++r < s; ) {
var a = n[r];
a && e(t, a, r, i);
}
return t;
});
}
var nd = Object.prototype;
function Yl(e) {
var t = e && e.constructor, n = typeof t == "function" && t.prototype || nd;
return e === n;
}
function rd(e, t) {
for (var n = -1, r = Array(e); ++n < e; )
r[n] = t(n);
return r;
}
var sd = "[object Arguments]";
function da(e) {
return zn(e) && yr(e) == sd;
}
var zl = Object.prototype, id = zl.hasOwnProperty, od = zl.propertyIsEnumerable, _i = da(/* @__PURE__ */ function() {
return arguments;
}()) ? da : function(e) {
return zn(e) && id.call(e, "callee") && !od.call(e, "callee");
};
function ad() {
return !1;
}
var Vl = typeof exports == "object" && exports && !exports.nodeType && exports, fa = Vl && typeof module == "object" && module && !module.nodeType && module, ld = fa && fa.exports === Vl, ma = ld ? Cn.Buffer : void 0, ud = ma ? ma.isBuffer : void 0, Gl = ud || ad, cd = "[object Arguments]", hd = "[object Array]", dd = "[object Boolean]", fd = "[object Date]", md = "[object Error]", gd = "[object Function]", _d = "[object Map]", pd = "[object Number]", Ed = "[object Object]", Cd = "[object RegExp]", Rd = "[object Set]", Id = "[object String]", wd = "[object WeakMap]", Od = "[object ArrayBuffer]", Sd = "[object DataView]", vd = "[object Float32Array]", bd = "[object Float64Array]", Ad = "[object Int8Array]", yd = "[object Int16Array]", Td = "[object Int32Array]", Nd = "[object Uint8Array]", Md = "[object Uint8ClampedArray]", Ld = "[object Uint16Array]", xd = "[object Uint32Array]", Ue = {};
Ue[vd] = Ue[bd] = Ue[Ad] = Ue[yd] = Ue[Td] = Ue[Nd] = Ue[Md] = Ue[Ld] = Ue[xd] = !0;
Ue[cd] = Ue[hd] = Ue[Od] = Ue[dd] = Ue[Sd] = Ue[fd] = Ue[md] = Ue[gd] = Ue[_d] = Ue[pd] = Ue[Ed] = Ue[Cd] = Ue[Rd] = Ue[Id] = Ue[wd] = !1;
function Dd(e) {
return zn(e) && jl(e.length) && !!Ue[yr(e)];
}
function Ud(e) {
return function(t) {
return e(t);
};
}
var Kl = typeof exports == "object" && exports && !exports.nodeType && exports, _r = Kl && typeof module == "object" && module && !module.nodeType && module, kd = _r && _r.exports === Kl, Gs = kd && Pl.process, ga = function() {
try {
var e = _r && _r.require && _r.require("util").types;
return e || Gs && Gs.binding && Gs.binding("util");
} catch {
}
}(), _a = ga && ga.isTypedArray, Xl = _a ? Ud(_a) : Dd;
function Pd(e, t) {
var n = Hn(e), r = !n && _i(e), s = !n && !r && Gl(e), i = !n && !r && !s && Xl(e), o = n || r || s || i, a = o ? rd(e.length, String) : [], l = a.length;
for (var u in e)
o && // Safari 9 has enumerable `arguments.length` in strict mode.
(u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
s && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
i && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
eo(u, l)) || a.push(u);
return a;
}
function Fd(e, t) {
return function(n) {
return e(t(n));
};
}
function $d(e) {
var t = [];
if (e != null)
for (var n in Object(e))
t.push(n);
return t;
}
var Hd = Object.prototype, Bd = Hd.hasOwnProperty;
function jd(e) {
if (!Ct(e))
return $d(e);
var t = Yl(e), n = [];
for (var r in e)
r == "constructor" && (t || !Bd.call(e, r)) || n.push(r);
return n;
}
function ql(e) {
return no(e) ? Pd(e) : jd(e);
}
var Wd = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Yd = /^\w*$/;
function zd(e, t) {
if (Hn(e))
return !1;
var n = typeof e;
return n == "number" || n == "symbol" || n == "boolean" || e == null || vs(e) ? !0 : Yd.test(e) || !Wd.test(e) || t != null && e in Object(t);
}
var Ir = Qi(Object, "create");
function Vd() {
this.__data__ = Ir ? Ir(null) : {}, this.size = 0;
}
function Gd(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t;
}
var Kd = "__lodash_hash_undefined__", Xd = Object.prototype, qd = Xd.hasOwnProperty;
function Zd(e) {
var t = this.__data__;
if (Ir) {
var n = t[e];
return n === Kd ? void 0 : n;
}
return qd.call(t, e) ? t[e] : void 0;
}
var Jd = Object.prototype, Qd = Jd.hasOwnProperty;
function ef(e) {
var t = this.__data__;
return Ir ? t[e] !== void 0 : Qd.call(t, e);
}
var tf = "__lodash_hash_undefined__";
function nf(e, t) {
var n = this.__data__;
return this.size += this.has(e) ? 0 : 1, n[e] = Ir && t === void 0 ? tf : t, this;
}
function _n(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
_n.prototype.clear = Vd;
_n.prototype.delete = Gd;
_n.prototype.get = Zd;
_n.prototype.has = ef;
_n.prototype.set = nf;
function rf() {
this.__data__ = [], this.size = 0;
}
function As(e, t) {
for (var n = e.length; n--; )
if (bs(e[n][0], t))
return n;
return -1;
}
var sf = Array.prototype, of = sf.splice;
function af(e) {
var t = this.__data__, n = As(t, e);
if (n < 0)
return !1;
var r = t.length - 1;
return n == r ? t.pop() : of.call(t, n, 1), --this.size, !0;
}
function lf(e) {
var t = this.__data__, n = As(t, e);
return n < 0 ? void 0 : t[n][1];
}
function uf(e) {
return As(this.__data__, e) > -1;
}
function cf(e, t) {
var n = this.__data__, r = As(n, e);
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
}
function Vt(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
Vt.prototype.clear = rf;
Vt.prototype.delete = af;
Vt.prototype.get = lf;
Vt.prototype.has = uf;
Vt.prototype.set = cf;
var Zl = Qi(Cn, "Map");
function hf() {
this.size = 0, this.__data__ = {
hash: new _n(),
map: new (Zl || Vt)(),
string: new _n()
};
}
function df(e) {
var t = typeof e;
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
function ys(e, t) {
var n = e.__data__;
return df(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
}
function ff(e) {
var t = ys(this, e).delete(e);
return this.size -= t ? 1 : 0, t;
}
function mf(e) {
return ys(this, e).get(e);
}
function gf(e) {
return ys(this, e).has(e);
}
function _f(e, t) {
var n = ys(this, e), r = n.size;
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
}
function en(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
en.prototype.clear = hf;
en.prototype.delete = ff;
en.prototype.get = mf;
en.prototype.has = gf;
en.prototype.set = _f;
var pf = "Expected a function";
function ro(e, t) {
if (typeof e != "function" || t != null && typeof t != "function")
throw new TypeError(pf);
var n = function() {
var r = arguments, s = t ? t.apply(this, r) : r[0], i = n.cache;
if (i.has(s))
return i.get(s);
var o = e.apply(this, r);
return n.cache = i.set(s, o) || i, o;
};
return n.cache = new (ro.Cache || en)(), n;
}
ro.Cache = en;
var Ef = 500;
function Cf(e) {
var t = ro(e, function(r) {
return n.size === Ef && n.clear(), r;
}), n = t.cache;
return t;
}
var Rf = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, If = /\\(\\)?/g, wf = Cf(function(e) {
var t = [];
return e.charCodeAt(0) === 46 && t.push(""), e.replace(Rf, function(n, r, s, i) {
t.push(s ? i.replace(If, "$1") : r || n);
}), t;
});
function Of(e) {
return e == null ? "" : $l(e);
}
function Jl(e, t) {
return Hn(e) ? e : zd(e, t) ? [e] : wf(Of(e));
}
function Ql(e) {
if (typeof e == "string" || vs(e))
return e;
var t = e + "";
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
function Sf(e, t) {
t = Jl(t, e);
for (var n = 0, r = t.length; e != null && n < r; )
e = e[Ql(t[n++])];
return n && n == r ? e : void 0;
}
function vf(e, t, n) {
var r = e == null ? void 0 : Sf(e, t);
return r === void 0 ? n : r;
}
var eu = Fd(Object.getPrototypeOf, Object), bf = "[object Object]", Af = Function.prototype, yf = Object.prototype, tu = Af.toString, Tf = yf.hasOwnProperty, Nf = tu.call(Object);
function Mf(e) {
if (!zn(e) || yr(e) != bf)
return !1;
var t = eu(e);
if (t === null)
return !0;
var n = Tf.call(t, "constructor") && t.constructor;
return typeof n == "function" && n instanceof n && tu.call(n) == Nf;
}
function Lf() {
this.__data__ = new Vt(), this.size = 0;
}
function xf(e) {
var t = this.__data__, n = t.delete(e);
return this.size = t.size, n;
}
function Df(e) {
return this.__data__.get(e);
}
function Uf(e) {
return this.__data__.has(e);
}
var kf = 200;
function Pf(e, t) {
var n = this.__data__;
if (n instanceof Vt) {
var r = n.__data__;
if (!Zl || r.length < kf - 1)
return r.push([e, t]), this.size = ++n.size, this;
n = this.__data__ = new en(r);
}
return n.set(e, t), this.size = n.size, this;
}
function Vn(e) {
var t = this.__data__ = new Vt(e);
this.size = t.size;
}
Vn.prototype.clear = Lf;
Vn.prototype.delete = xf;
Vn.prototype.get = Df;
Vn.prototype.has = Uf;
Vn.prototype.set = Pf;
var nu = typeof exports == "object" && exports && !exports.nodeType && exports, pa = nu && typeof module == "object" && module && !module.nodeType && module, Ff = pa && pa.exports === nu, Ea = Ff ? Cn.Buffer : void 0;
Ea && Ea.allocUnsafe;
function $f(e, t) {
return e.slice();
}
var Ca = Cn.Uint8Array;
function Hf(e) {
var t = new e.constructor(e.byteLength);
return new Ca(t).set(new Ca(e)), t;
}
function Bf(e, t) {
var n = Hf(e.buffer);
return new e.constructor(n, e.byteOffset, e.length);
}
function jf(e) {
return typeof e.constructor == "function" && !Yl(e) ? Ph(eu(e)) : {};
}
function Wf(e) {
return function(t, n, r) {
for (var s = -1, i = Object(t), o = r(t), a = o.length; a--; ) {
var l = o[++s];
if (n(i[l], l, i) === !1)
break;
}
return t;
};
}
var Yf = Wf(), Ks = function() {
return Cn.Date.now();
}, zf = "Expected a function", Vf = Math.max, Gf = Math.min;
function t1(e, t, n) {
var r, s, i, o, a, l, u = 0, c = !1, h = !1, d = !0;
if (typeof e != "function")
throw new TypeError(zf);
t = la(t) || 0, Ct(n) && (c = !!n.leading, h = "maxWait" in n, i = h ? Vf(la(n.maxWait) || 0, t) : i, d = "trailing" in n ? !!n.trailing : d);
function f(C) {
var v = r, y = s;
return r = s = void 0, u = C, o = e.apply(y, v), o;
}
function g(C) {
return u = C, a = setTimeout(b, t), c ? f(C) : o;
}
function _(C) {
var v = C - l, y = C - u, F = t - v;
return h ? Gf(F, i - y) : F;
}
function R(C) {
var v = C - l, y = C - u;
return l === void 0 || v >= t || v < 0 || h && y >= i;
}
function b() {
var C = Ks();
if (R(C))
return H(C);
a = setTimeout(b, _(C));
}
function H(C) {
return a = void 0, d && r ? f(C) : (r = s = void 0, o);
}
function P() {
a !== void 0 && clearTimeout(a), u = 0, r = l = s = a = void 0;
}
function W() {
return a === void 0 ? o : H(Ks());
}
function w() {
var C = Ks(), v = R(C);
if (r = arguments, s = this, l = C, v) {
if (a === void 0)
return g(l);
if (h)
return clearTimeout(a), a = setTimeout(b, t), f(l);
}
return a === void 0 && (a = setTimeout(b, t)), o;
}
return w.cancel = P, w.flush = W, w;
}
function pi(e, t, n) {
(n !== void 0 && !bs(e[t], n) || n === void 0 && !(t in e)) && to(e, t, n);
}
function Kf(e) {
return zn(e) && no(e);
}
function Ei(e, t) {
if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
return e[t];
}
function Xf(e) {
return Zh(e, ql(e));
}
function qf(e, t, n, r, s, i, o) {
var a = Ei(e, n), l = Ei(t, n), u = o.get(l);
if (u) {
pi(e, n, u);
return;
}
var c = i ? i(a, l, n + "", e, t, o) : void 0, h = c === void 0;
if (h) {
var d = Hn(l), f = !d && Gl(l), g = !d && !f && Xl(l);
c = l, d || f || g ? Hn(a) ? c = a : Kf(a) ? c = $h(a) : f ? (h = !1, c = $f(l)) : g ? (h = !1, c = Bf(l)) : c = [] : Mf(l) || _i(l) ? (c = a, _i(a) ? c = Xf(a) : (!Ct(a) || Ji(a)) && (c = jf(l))) : h = !1;
}
h && (o.set(l, c), s(c, l, r, i, o), o.delete(l)), pi(e, n, c);
}
function so(e, t, n, r, s) {
e !== t && Yf(t, function(i, o) {
if (s || (s = new Vn()), Ct(i))
qf(e, t, o, n, so, r, s);
else {
var a = r ? r(Ei(e, o), i, o + "", e, t, s) : void 0;
a === void 0 && (a = i), pi(e, o, a);
}
}, ql);
}
var n1 = Wl(function(e, t, n, r) {
so(e, t, n, r);
}), io = Wl(function(e, t, n) {
so(e, t, n);
});
function Zf(e, t, n, r) {
if (!Ct(e))
return e;
t = Jl(t, e);
for (var s = -1, i = t.length, o = i - 1, a = e; a != null && ++s < i; ) {
var l = Ql(t[s]), u = n;
if (l === "__proto__" || l === "constructor" || l === "prototype")
return e;
if (s != o) {
var c = a[l];
u = void 0, u === void 0 && (u = Ct(c) ? c : eo(t[s + 1]) ? [] : {});
}
Bl(a, l, u), a = a[l];
}
return e;
}
function r1(e, t, n) {
return e == null ? e : Zf(e, t, n);
}
class Gn {
constructor() {
p(this, "cursor", 0);
}
reset() {
return this.cursor = 0, this;
}
moveCursor(t) {
this.cursor += t;
}
moveCursorTo(t) {
this.cursor = t;
}
}
function s1(e, t) {
for (const n in t)
t.hasOwnProperty(n) && (e[n] = t[n]);
}
function Jf(e) {
return /^-?\d+(\.\d+)?$/.test(e);
}
function i1(e) {
return Jf(e) ? Number(e) <= Number.MAX_SAFE_INTEGER : !1;
}
function o1(e) {
return Number(e) > Number.MAX_SAFE_INTEGER || e.length >= 18;
}
class ru {
constructor() {
p(this, "_data", []);
}
static create() {
return new ru();
}
add(t) {
this._data.indexOf(t) > -1 || this._data.push(t);
}
delete(t) {
const n = this._data.indexOf(t);
this._data.splice(n, 1);
}
getData() {
return this._data;
}
}
class su {
constructor() {
p(this, "_data", /* @__PURE__ */ new Map());
}
static create() {
return new su();
}
add(t, n) {
this._data.has(t) || this._data.set(t, n);
}
delete(t) {
this._data.delete(t);
}
getData() {
return this._data;
}
}
function a1(e) {
const t = new MessageChannel();
let n = !1;
const r = () => {
n || e();
};
return t.port1.onmessage = r, t.port2.postMessage(null), () => {
n = !0, t.port1.onmessage = null, t.port1.close(), t.port2.close();
};
}
async function Qf(e) {
for (const [t, n] of e.entries())
try {
if (!await n())
return {
index: t,
result: !1
};
} catch (r) {
return {
index: t,
result: !1,
error: r
};
}
return {
result: !0,
index: -1
};
}
function em(e) {
for (const [t, n] of e.entries())
try {
if (!n())
return {
index: t,
result: !1
};
} catch (r) {
return {
index: t,
result: !1,
error: r
};
}
return {
result: !0,
index: -1
};
}
function l1(e, t) {
return t.forEach((n) => e.add(n)), e;
}
function tm(e) {
return e instanceof Ec || e instanceof ot || e && "closed" in e && typeof e.unsubscribe < "u";
}
function We(e) {
let t = !1;
return e ? tm(e) ? {
dispose: () => e.unsubscribe()
} : typeof e == "function" ? {
dispose: () => {
t || (t = !0, e());
}
} : e : We(() => {
});
}
function u1(e) {
return We(() => {
e.unsubscribe();
});
}
class oo {
constructor() {
p(this, "_disposables", /* @__PURE__ */ new Set());
}
add(t) {
const n = We(t);
return this._disposables.add(n), {
dispose: (r = !1) => {
r || n.dispose(), this._disposables.delete(n);
}
};
}
dispose() {
this._disposables.forEach((t) => {
t.dispose();
}), this._disposables.clear();
}
}
class Ve {
constructor() {
p(this, "_disposed", !1);
p(this, "_collection", new oo());
}
disposeWithMe(t) {
return this._collection.add(t);
}
ensureNotDisposed() {
if (this._disposed)
throw new Error("[Disposable]: object is disposed!");
}
dispose() {
this._disposed || (this._disposed = !0, this._collection.dispose());
}
}
class c1 extends Ve {
constructor() {
super(...arguments);
p(this, "dispose$", new ot());
}
dispose() {
super.dispose(), this.dispose$.next(), this.dispose$.complete();
}
}
class h1 extends Ve {
constructor(n) {
super();
p(this, "_ref", 0);
this._rootDisposable = n;
}
inc() {
if (this._disposed)
throw new Error("[RCDisposable]: should not ref to a disposed.");
this._ref += 1;
}
dec() {
this._ref -= 1, this._ref === 0 && (this._rootDisposable.dispose(), this.dispose());
}
}
var Se = /* @__PURE__ */ ((e) => (e[e.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", e[e.UNIVER_DOC = 1] = "UNIVER_DOC", e[e.UNIVER_SHEET = 2] = "UNIVER_SHEET", e[e.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", e[e.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Se || {}), xt = /* @__PURE__ */ ((e) => (e[e.Reader = 0] = "Reader", e[e.Editor = 1] = "Editor", e[e.Owner = 2] = "Owner", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(xt || {}), Ci = /* @__PURE__ */ ((e) => (e[e.SomeCollaborator = 0] = "SomeCollaborator", e[e.AllCollaborator = 1] = "AllCollaborator", e[e.OneSelf = 2] = "OneSelf", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Ci || {});
class ao extends Ve {
}
const nm = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
let rm = (e) => crypto.getRandomValues(new Uint8Array(e)), sm = (e, t, n) => {
let r = (2 << Math.log2(e.length - 1)) - 1, s = -~(1.6 * r * t / e.length);
return (i = t) => {
let o = "";
for (; ; ) {
let a = n(s), l = s | 0;
for (; l--; )
if (o += e[a[l] & r] || "", o.length >= i) return o;
}
};
}, im = (e, t = 21) => sm(e, t | 0, rm), om = (e = 21) => {
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
for (; e--; )
t += nm[n[e] & 63];
return t;
};
const iu = /* @__PURE__ */ new Set([
"ac",
"ad",
"ae",
"aero",
"af",
"ag",
"ai",
"al",
"am",
"ao",
"aq",
"ar",
"arpa",
"as",
"asia",
"at",
"au",
"aw",
"ax",
"az",
"ba",
"bb",
"bd",
"be",
"bf",
"bg",
"bh",
"bi",
"biz",
"bj",
"bm",
"bn",
"bo",
"br",
"bs",
"bt",
"bv",
"bw",
"by",
"bz",
"ca",
"cat",
"cc",
"cd",
"cf",
"cg",
"ch",
"ci",
"ck",
"cl",
"cm",
"cn",
"co",
"com",
"coop",
"cr",
"cu",
"cv",
"cw",
"cx",
"cy",
"cz",
"de",
"dj",
"dk",
"dm",
"do",
"dz",
"ec",
"edu",
"ee",
"eg",
"er",
"es",
"et",
"eu",
"fi",
"fj",
"fk",
"fm",
"fo",
"fr",
"ga",
"gb",
"gd",
"ge",
"gf",
"gg",
"gh",
"gi",
"gl",
"gm",
"gn",
"gov",
"gp",
"gq",
"gr",
"gs",
"gt",
"gu",
"gw",
"gy",
"hk",
"hm",
"hn",
"hr",
"ht",
"hu",
"id",
"ie",
"il",
"im",
"in",
"info",
"int",
"io",
"iq",
"ir",
"is",
"it",
"je",
"jm",
"jo",
"jobs",
"jp",
"ke",
"kg",
"kh",
"ki",
"km",
"kn",
"kp",
"kr",
"kw",
"ky",
"kz",
"la",
"lb",
"lc",
"li",
"lk",
"lr",
"ls",
"lt",
"lu",
"lv",
"ly",
"ma",
"mc",
"md",
"me",
"mg",
"mh",
"mil",
"mk",
"ml",
"mm",
"mn",
"mo",
"mobi",
"mp",
"mq",
"mr",
"ms",
"mt",
"mu",
"museum",
"mv",
"mw",
"mx",
"my",
"mz",
"na",
"name",
"nc",
"ne",
"net",
"nf",
"ng",
"ni",
"nl",
"no",
"np",
"nr",
"nu",
"nz",
"om",
"onion",
"org",
"pa",
"pe",
"pf",
"pg",
"ph",
"pk",
"pl",
"pm",
"pn",
"post",
"pr",
"pro",
"ps",
"pt",
"pw",
"py",
"qa",
"re",
"ro",
"rs",
"ru",
"rw",
"sa",
"sb",
"sc",
"sd",
"se",
"sg",
"sh",
"si",
"sj",
"sk",
"sl",
"sm",
"sn",
"so",
"sr",
"ss",
"st",
"su",
"sv",
"sx",
"sy",
"sz",
"tc",
"td",
"tel",
"tf",
"tg",
"th",
"tj",
"tk",
"tl",
"tm",
"tn",
"to",
"tr",
"tt",
"tv",
"tw",
"tz",
"ua",
"ug",
"uk",
"us",
"uy",
"uz",
"va",
"vc",
"ve",
"vg",
"vi",
"vn",
"vu",
"wf",
"ws",
"yt",
"za",
"zm",
"zw"
]), am = new RegExp(
"^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$",
"i"
);
function lm(e) {
if (!Number.isNaN(+e))
return !1;
if (e.startsWith("http://localhost:3002") || e.startsWith("localhost:3002"))
return !0;
if (am.test(e)) {
if (ou(e))
return !0;
try {
const r = new URL(au(e)).hostname.split(".").pop();
if (r && iu.has(r))
return !0;
} catch {
return !1;
}
}
return !1;
}
function ou(e) {
return /^[a-zA-Z]+:\/\//.test(e);
}
function um(e) {
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e);
}
function au(e) {
return ou(e) ? e : um(e) ? `mailto://${e}` : `https://${e}`;
}
const Xt = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
];
function lo(e, t) {
const n = J.getValueType(e), r = J.getValueType(t);
return n !== r ? !1 : J.isArray(e) ? cm(e, t) : J.isObject(e) ? hm(e, t) : J.isDate(e) ? e.getTime() === t.getTime() : J.isRegExp(e) ? e.toString() === t.toString() : e === t;
}
function cm(e, t) {
if (e.length !== t.length)
return !1;
for (let n = 0, r = e.length; n < r; n++) {
const s = e[n], i = t[n];
if (!lo(s, i))
return !1;
}
return !0;
}
function hm(e, t) {
const n = Object.keys(e), r = Object.keys(t);
if (n.length !== r.length)
return !1;
for (const s of n) {
if (!r.includes(s))
return !1;
const i = e[s], o = t[s];
if (!lo(i, o))
return !1;
}
return !0;
}
class J {
static deleteNull(t) {
for (const n in t)
(t[n] === null || t[n] === void 0) && delete t[n];
return t;
}
static stringAt(t) {
let n = "", r = t;
for (; r >= Xt.length; )
r /= Xt.length, r -= 1, n += Xt[r % Xt.length];
const s = t % Xt.length;
return n += Xt[s], n;
}
static indexAt(t) {
let n = 0;
for (let r = 0; r < t.length - 1; r += 1) {
const s = t.charCodeAt(r) - 65, i = t.length - 1 - r;
n += Xt.length ** i + Xt.length * s;
}
return n += t.charCodeAt(t.length - 1) - 65, n;
}
static deleteBlank(t) {
return J.isString(t) ? t.replace(/\s/g, "") : t;
}
// eslint-disable-next-line complexity
static getSystemType() {
const t = navigator.userAgent, n = navigator.platform === "Win32" || navigator.platform === "Windows", r = navigator.platform === "Mac68K" || navigator.platform === "MacPPC" || navigator.platform === "Macintosh" || navigator.platform === "MacIntel";
if (r) return "Mac";
if (navigator.platform === "X11" && !n && !r) return "Unix";
if (String(navigator.platform).indexOf("Linux") > -1) return "Linux";
if (n) {
if (t.indexOf("Windows NT 5.0") > -1 || t.indexOf("Windows 2000") > -1) return "Windows 2000";
if (t.indexOf("Windows NT 5.1") > -1 || t.indexOf("Windows XP") > -1) return "Windows XP";
if (t.indexOf("Windows NT 5.2") > -1 || t.indexOf("Windows 2003") > -1) return "Windows 2003";
if (t.indexOf("Windows NT 6.0") > -1 || t.indexOf("Windows Vista") > -1) return "Windows Vista";
if (t.indexOf("Windows NT 6.1") > -1 || t.indexOf("Windows 7") > -1) return "Windows 7";
if (t.indexOf("Windows NT 10") > -1 || t.indexOf("Windows 10") > -1) return "Windows 10";
if (t.indexOf("Windows NT 11") > -1 || t.indexOf("Windows 11") > -1) return "Windows 11";
}
return "Unknown system";
}
static getBrowserType() {
const t = navigator.userAgent, n = t.indexOf("Opera") > -1, r = t.indexOf("compatible") > -1 && t.indexOf("MSIE") > -1 && !n, s = t.indexOf("Trident") > -1 && t.indexOf("rv:11.0") > -1, i = t.indexOf("Edge") > -1, o = t.indexOf("Firefox") > -1, a = t.indexOf("Safari") > -1 && t.indexOf("Chrome") === -1, l = t.indexOf("Chrome") > -1 && t.indexOf("Safari") > -1;
if (r) {
new RegExp("MSIE (\\d+\\.\\d+);").test(t);
const c = Number.parseFloat(RegExp.$1);
return c === 7 ? "IE7" : c === 8 ? "IE8" : c === 9 ? "IE9" : c === 10 ? "IE10" : "0";
}
return o ? "FF" : n ? "Opera" : a ? "Safari" : l ? "Chrome" : i ? "Edge" : s ? "IE11" : "Unknown browser";
}
static getClassName(t) {
return t.constructor.name;
}
/** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
static deepMerge(t, ...n) {
n.forEach((o) => o && i(o));
function r(o, a) {
o.forEach((l, u) => {
var c, h;
if (J.isArray(l)) {
const d = (c = a[u]) != null ? c : [];
a[u] = d, r(l, d);
return;
}
if (J.isObject(l)) {
const d = (h = a[u]) != null ? h : {};
a[u] = d, s(l, d);
return;
}
a[u] = l;
});
}
function s(o, a) {
Object.keys(o).forEach((l) => {
var c, h;
const u = o[l];
if (J.isObject(u)) {
const d = (c = a[l]) != null ? c : {};
a[l] = d, s(u, d);
return;
}
if (J.isArray(u)) {
const d = (h = a[l]) != null ? h : [];
a[l] = d, r(u, d);
return;
}
a[l] = u;
});
}
function i(o) {
Object.keys(o).forEach((a) => {
var u, c;
const l = o[a];
if (J.isArray(l)) {
const h = (u = t[a]) != null ? u : [];
t[a] = h, r(l, h);
return;
}
if (J.isObject(l)) {
const h = (c = t[a]) != null ? c : {};
t[a] = h, s(l, h);
return;
}
t[a] = l;
});
}
return t;
}
static numberFixed(t, n) {
return Number(Number(t).toFixed(n));
}
static diffValue(t, n) {
return lo(t, n);
}
static deepClone(t) {
if (!this.isDefine(t))
return t;
if (this.isRegExp(t))
return new RegExp(t);
if (this.isDate(t))
return new Date(t);
if (this.isArray(t)) {
const n = [];
return t.forEach((r, s) => {
n[s] = J.deepClone(r);
}), n;
}
if (this.isObject(t)) {
const n = {};
return Object.keys(t).forEach((r) => {
const s = t[r];
n[r] = J.deepClone(s);
}), Object.setPrototypeOf(n, Object.getPrototypeOf(t)), n;
}
return t;
}
static getLanguage() {
const t = "en-US";
return globalThis.navigator && (navigator.languages && navigator.languages[0] || navigator.language) || t;
}
static getValueType(t) {
return Object.prototype.toString.apply(t);
}
static isDefine(t) {
return t != null;
}
static isBlank(t) {
return this.isDefine(t) ? this.isString(t) ? t.trim() === "" : !1 : !0;
}
static isPlainObject(t) {
return this.isDefine(t) ? Object.getPrototypeOf(t) === Object.getPrototypeOf({}) : !1;
}
static isDate(t) {
return this.getValueType(t) === "[object Date]";
}
static isRegExp(t) {
return this.getValueType(t) === "[object RegExp]";
}
static isArray(t) {
return this.getValueType(t) === "[object Array]";
}
static isString(t) {
return this.getValueType(t) === "[object String]";
}
static isNumber(t) {
return this.getValueType(t) === "[object Number]";
}
static isStringNumber(t) {
return !isNaN(Number.parseFloat(t)) && isFinite(t);
}
static isObject(t) {
return this.getValueType(t) === "[object Object]";
}
static isEmptyObject(t) {
for (const n in t)
ret