@univerjs/core
Version:
Core library for Univer.
1,895 lines • 667 kB
JavaScript
var Cc = Object.defineProperty;
var Rc = (e, t, n) => t in e ? Cc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var p = (e, t, n) => Rc(e, typeof t != "symbol" ? t + "" : t, n);
import { createIdentifier as lt, Inject as wt, Injector as zn } from "@wendellhu/redi";
export * from "@wendellhu/redi";
import { Subscription as Ic, Subject as it, Observable as yr, filter as wr, ReplaySubject as wc, take as Oc, tap as aa, debounceTime as vc, map as ro, BehaviorSubject as nt, merge as Pl, timer as Sc, distinctUntilChanged as bc, firstValueFrom as Ac, skip as kl, of as Lr, combineLatest as yc } from "rxjs";
import { filter as Nc, debounceTime as Tc, first as Mc, map as Lc } from "rxjs/operators";
import { defaultTheme as xr } from "@univerjs/themes";
function xc(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 Ut = typeof global < "u" ? global : typeof self < "u" ? self : window;
function Dc() {
const t = /* @__PURE__ */ new Map();
let n = 0;
typeof Ut.requestIdleCallback != "function" && (Ut.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 Ut.cancelIdleCallback != "function" && (Ut.cancelIdleCallback = function(s) {
const i = t.get(s);
i !== void 0 && (clearTimeout(i), t.delete(s));
});
}
function Uc() {
typeof Ut.Array.prototype.findLastIndex != "function" && (Ut.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 Ut.Array.prototype.findLast != "function" && (Ut.Array.prototype.findLast = function(t, n) {
const r = this.findLastIndex(t, n);
return r !== -1 ? this[r] : void 0;
});
}
function Pc() {
typeof Ut.String.prototype.at != "function" && (Ut.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 kc() {
Dc(), Uc(), Pc();
}
function Ss(e, t) {
const n = e.indexOf(t);
return n > -1 ? (e.splice(n, 1), !0) : !1;
}
function GC(e) {
const t = /* @__PURE__ */ new Set(), n = [];
for (const r of e)
t.has(r) || (t.add(r), n.push(r));
return n;
}
function KC(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 Fc(e, t) {
for (let n = e.length - 1; n > -1; n--) {
const r = e[n];
if (t(r, n))
return r;
}
return null;
}
function XC(e, t) {
if (e.length === 0)
return e;
const n = t % e.length;
return e.slice(n).concat(e.slice(0, n));
}
function qC(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 vt(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var zs, la;
function $c() {
if (la) return zs;
la = 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(k, W) {
i = k, o = W;
})), s = s || {};
var l = !1, u = null, c = null, h = null, d = this, f = function(k, W, w) {
c && (clearTimeout(c), c = null), h && (clearTimeout(h), h = null), k && (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), k && d.queues[t] && d.queues[t].length > 0 && d.queues[t].shift()();
}, g = function(k) {
if (l)
return f(k);
u && (clearTimeout(u), u = null), d.domainReentrant && k && (d.domains[t] = process.domain);
var W = s.maxExecutionTime || d.maxExecutionTime;
if (W && (h = setTimeout(function() {
d.queues[t] && f(k, new Error("Maximum execution time is exceeded " + t));
}, W)), n.length === 1) {
var w = !1;
try {
n(function(C, S) {
w || (w = !0, f(k, C, S));
});
} catch (C) {
w || (w = !0, f(k, C));
}
} else
d._promiseTry(function() {
return n();
}).then(function(C) {
f(k, void 0, C);
}, function(C) {
f(k, 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 $ = s.maxOccupationTime || d.maxOccupationTime;
if ($ && (c = setTimeout(function() {
d.queues[t] && f(!1, new Error("Maximum occupation time is exceeded in queue " + t));
}, $)), 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);
}
}, zs = e, zs;
}
var Vs, ua;
function Hc() {
return ua || (ua = 1, Vs = $c()), Vs;
}
var Bc = Hc();
const ZC = /* @__PURE__ */ vt(Bc), jc = /* @__PURE__ */ new Set(["true", "false"]);
function QC(e) {
return jc.has(e.toLowerCase());
}
const Vn = "__INTERNAL_EDITOR__", Fl = `${Vn}DOCS_NORMAL`, $l = `${Vn}DOCS_FORMULA_BAR`, Wc = `${Vn}ZEN_EDITOR`, Yc = `${Vn}COMMENT_EDITOR`, zc = `\r
`, Vc = "isRowStylePrecedeColumnStyle", Gc = /* @__PURE__ */ Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");
function eR(e) {
return `${Vn}${e}`;
}
function Kc(e) {
return e.startsWith(Vn);
}
function tR(e) {
return e === Yc;
}
function nR(e, t) {
t.forEach((n) => e.add(n));
}
function Xc(e, t) {
t.forEach(([n]) => {
e.has(n) && e.get(n);
});
}
function qc(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 Ri extends Error {
constructor(t) {
super(t), this.name = "CustomCommandExecutionError";
}
}
class rR extends Ri {
constructor() {
super("Canceled by facade"), this.name = "CanceledError";
}
}
function sR(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 or = /* @__PURE__ */ ((e) => (e[e.Style = 1] = "Style", e[e.Value = 2] = "Value", e))(or || {});
function iR(e) {
return `sheet_interceptor_${e}`;
}
const Jc = (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 oR {
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)), Jc(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 aR(e) {
return `sheet_async_interceptor_${e}`;
}
const Zc = (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 lR {
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)), Zc(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 Hl(e) {
return e.map((t) => t / 255);
}
function Bl(e) {
return e.map((t) => Math.round(t * 255));
}
function Qc([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 fs(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 ca(e, t) {
return (Math.max(e, t) + 0.05) / (Math.min(e, t) + 0.05);
}
function eh(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 Gs = { r: 1, g: 1, b: 1 }, Ks = { r: 0, g: 0, b: 0 }, th = fs(Gs.r, Gs.g, Gs.b), nh = fs(Ks.r, Ks.g, Ks.b);
function rh(e) {
const t = fs(e[0], e[1], e[2]), n = ca(
th,
t
), r = Qc(e);
let s = 1 - r[2], i, o, a;
do
i = eh(r[0], r[1], s), o = fs(i[0], i[1], i[2]), a = ca(o, nh), s += 0.01;
while (s <= 1 && s >= 0 && Math.abs(a - n) < 0.01);
return i;
}
function uR(e) {
return Bl(rh(Hl(e)));
}
const _t = [
[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 sh(e) {
const t = e[0], n = e[1], r = e[2];
let s = [
_t[0][0] * t + _t[0][1] * n + _t[0][2] * r + _t[0][4],
_t[1][0] * t + _t[1][1] * n + _t[1][2] * r + _t[1][4],
_t[2][0] * t + _t[2][1] * n + _t[2][2] * r + _t[2][4]
];
return s = s.map((i) => i > 1 ? 1 : i < 0 ? 0 : i), s;
}
function cR(e) {
return Bl(sh(Hl(e)));
}
var jl = typeof global == "object" && global && global.Object === Object && global, ih = typeof self == "object" && self && self.Object === Object && self, Rn = jl || ih || Function("return this")(), Hn = Rn.Symbol, Wl = Object.prototype, oh = Wl.hasOwnProperty, ah = Wl.toString, Zn = Hn ? Hn.toStringTag : void 0;
function lh(e) {
var t = oh.call(e, Zn), n = e[Zn];
try {
e[Zn] = void 0;
var r = !0;
} catch {
}
var s = ah.call(e);
return r && (t ? e[Zn] = n : delete e[Zn]), s;
}
var uh = Object.prototype, ch = uh.toString;
function hh(e) {
return ch.call(e);
}
var dh = "[object Null]", fh = "[object Undefined]", ha = Hn ? Hn.toStringTag : void 0;
function Nr(e) {
return e == null ? e === void 0 ? fh : dh : ha && ha in Object(e) ? lh(e) : hh(e);
}
function Gn(e) {
return e != null && typeof e == "object";
}
var mh = "[object Symbol]";
function bs(e) {
return typeof e == "symbol" || Gn(e) && Nr(e) == mh;
}
function gh(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 Bn = Array.isArray, da = Hn ? Hn.prototype : void 0, fa = da ? da.toString : void 0;
function Yl(e) {
if (typeof e == "string")
return e;
if (Bn(e))
return gh(e, Yl) + "";
if (bs(e))
return fa ? fa.call(e) : "";
var t = e + "";
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
var _h = /\s/;
function ph(e) {
for (var t = e.length; t-- && _h.test(e.charAt(t)); )
;
return t;
}
var Eh = /^\s+/;
function Ch(e) {
return e && e.slice(0, ph(e) + 1).replace(Eh, "");
}
function Ot(e) {
var t = typeof e;
return e != null && (t == "object" || t == "function");
}
var ma = NaN, Rh = /^[-+]0x[0-9a-f]+$/i, Ih = /^0b[01]+$/i, wh = /^0o[0-7]+$/i, Oh = parseInt;
function ga(e) {
if (typeof e == "number")
return e;
if (bs(e))
return ma;
if (Ot(e)) {
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
e = Ot(t) ? t + "" : t;
}
if (typeof e != "string")
return e === 0 ? e : +e;
e = Ch(e);
var n = Ih.test(e);
return n || wh.test(e) ? Oh(e.slice(2), n ? 2 : 8) : Rh.test(e) ? ma : +e;
}
function zl(e) {
return e;
}
var vh = "[object AsyncFunction]", Sh = "[object Function]", bh = "[object GeneratorFunction]", Ah = "[object Proxy]";
function so(e) {
if (!Ot(e))
return !1;
var t = Nr(e);
return t == Sh || t == bh || t == vh || t == Ah;
}
var Xs = Rn["__core-js_shared__"], _a = (function() {
var e = /[^.]+$/.exec(Xs && Xs.keys && Xs.keys.IE_PROTO || "");
return e ? "Symbol(src)_1." + e : "";
})();
function yh(e) {
return !!_a && _a in e;
}
var Nh = Function.prototype, Th = Nh.toString;
function Mh(e) {
if (e != null) {
try {
return Th.call(e);
} catch {
}
try {
return e + "";
} catch {
}
}
return "";
}
var Lh = /[\\^$.*+?()[\]{}|]/g, xh = /^\[object .+?Constructor\]$/, Dh = Function.prototype, Uh = Object.prototype, Ph = Dh.toString, kh = Uh.hasOwnProperty, Fh = RegExp(
"^" + Ph.call(kh).replace(Lh, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function $h(e) {
if (!Ot(e) || yh(e))
return !1;
var t = so(e) ? Fh : xh;
return t.test(Mh(e));
}
function Hh(e, t) {
return e == null ? void 0 : e[t];
}
function io(e, t) {
var n = Hh(e, t);
return $h(n) ? n : void 0;
}
var pa = Object.create, Bh = /* @__PURE__ */ (function() {
function e() {
}
return function(t) {
if (!Ot(t))
return {};
if (pa)
return pa(t);
e.prototype = t;
var n = new e();
return e.prototype = void 0, n;
};
})();
function jh(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 Wh(e, t) {
var n = -1, r = e.length;
for (t || (t = Array(r)); ++n < r; )
t[n] = e[n];
return t;
}
var Yh = 800, zh = 16, Vh = Date.now;
function Gh(e) {
var t = 0, n = 0;
return function() {
var r = Vh(), s = zh - (r - n);
if (n = r, s > 0) {
if (++t >= Yh)
return arguments[0];
} else
t = 0;
return e.apply(void 0, arguments);
};
}
function Kh(e) {
return function() {
return e;
};
}
var ms = (function() {
try {
var e = io(Object, "defineProperty");
return e({}, "", {}), e;
} catch {
}
})(), Xh = ms ? function(e, t) {
return ms(e, "toString", {
configurable: !0,
enumerable: !1,
value: Kh(t),
writable: !0
});
} : zl, qh = Gh(Xh), Jh = 9007199254740991, Zh = /^(?:0|[1-9]\d*)$/;
function oo(e, t) {
var n = typeof e;
return t = t == null ? Jh : t, !!t && (n == "number" || n != "symbol" && Zh.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function ao(e, t, n) {
t == "__proto__" && ms ? ms(e, t, {
configurable: !0,
enumerable: !0,
value: n,
writable: !0
}) : e[t] = n;
}
function As(e, t) {
return e === t || e !== e && t !== t;
}
var Qh = Object.prototype, ed = Qh.hasOwnProperty;
function Vl(e, t, n) {
var r = e[t];
(!(ed.call(e, t) && As(r, n)) || n === void 0 && !(t in e)) && ao(e, t, n);
}
function td(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 ? ao(n, a, l) : Vl(n, a, l);
}
return n;
}
var Ea = Math.max;
function nd(e, t, n) {
return t = Ea(t === void 0 ? e.length - 1 : t, 0), function() {
for (var r = arguments, s = -1, i = Ea(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), jh(e, this, a);
};
}
function rd(e, t) {
return qh(nd(e, t, zl), e + "");
}
var sd = 9007199254740991;
function Gl(e) {
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= sd;
}
function lo(e) {
return e != null && Gl(e.length) && !so(e);
}
function id(e, t, n) {
if (!Ot(n))
return !1;
var r = typeof t;
return (r == "number" ? lo(n) && oo(t, n.length) : r == "string" && t in n) ? As(n[t], e) : !1;
}
function Kl(e) {
return rd(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 && id(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 od = Object.prototype;
function Xl(e) {
var t = e && e.constructor, n = typeof t == "function" && t.prototype || od;
return e === n;
}
function ad(e, t) {
for (var n = -1, r = Array(e); ++n < e; )
r[n] = t(n);
return r;
}
var ld = "[object Arguments]";
function Ca(e) {
return Gn(e) && Nr(e) == ld;
}
var ql = Object.prototype, ud = ql.hasOwnProperty, cd = ql.propertyIsEnumerable, Ii = Ca(/* @__PURE__ */ (function() {
return arguments;
})()) ? Ca : function(e) {
return Gn(e) && ud.call(e, "callee") && !cd.call(e, "callee");
};
function hd() {
return !1;
}
var Jl = typeof exports == "object" && exports && !exports.nodeType && exports, Ra = Jl && typeof module == "object" && module && !module.nodeType && module, dd = Ra && Ra.exports === Jl, Ia = dd ? Rn.Buffer : void 0, fd = Ia ? Ia.isBuffer : void 0, Zl = fd || hd, md = "[object Arguments]", gd = "[object Array]", _d = "[object Boolean]", pd = "[object Date]", Ed = "[object Error]", Cd = "[object Function]", Rd = "[object Map]", Id = "[object Number]", wd = "[object Object]", Od = "[object RegExp]", vd = "[object Set]", Sd = "[object String]", bd = "[object WeakMap]", Ad = "[object ArrayBuffer]", yd = "[object DataView]", Nd = "[object Float32Array]", Td = "[object Float64Array]", Md = "[object Int8Array]", Ld = "[object Int16Array]", xd = "[object Int32Array]", Dd = "[object Uint8Array]", Ud = "[object Uint8ClampedArray]", Pd = "[object Uint16Array]", kd = "[object Uint32Array]", Pe = {};
Pe[Nd] = Pe[Td] = Pe[Md] = Pe[Ld] = Pe[xd] = Pe[Dd] = Pe[Ud] = Pe[Pd] = Pe[kd] = !0;
Pe[md] = Pe[gd] = Pe[Ad] = Pe[_d] = Pe[yd] = Pe[pd] = Pe[Ed] = Pe[Cd] = Pe[Rd] = Pe[Id] = Pe[wd] = Pe[Od] = Pe[vd] = Pe[Sd] = Pe[bd] = !1;
function Fd(e) {
return Gn(e) && Gl(e.length) && !!Pe[Nr(e)];
}
function $d(e) {
return function(t) {
return e(t);
};
}
var Ql = typeof exports == "object" && exports && !exports.nodeType && exports, Er = Ql && typeof module == "object" && module && !module.nodeType && module, Hd = Er && Er.exports === Ql, qs = Hd && jl.process, wa = (function() {
try {
var e = Er && Er.require && Er.require("util").types;
return e || qs && qs.binding && qs.binding("util");
} catch {
}
})(), Oa = wa && wa.isTypedArray, eu = Oa ? $d(Oa) : Fd;
function Bd(e, t) {
var n = Bn(e), r = !n && Ii(e), s = !n && !r && Zl(e), i = !n && !r && !s && eu(e), o = n || r || s || i, a = o ? ad(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.
oo(u, l)) || a.push(u);
return a;
}
function jd(e, t) {
return function(n) {
return e(t(n));
};
}
function Wd(e) {
var t = [];
if (e != null)
for (var n in Object(e))
t.push(n);
return t;
}
var Yd = Object.prototype, zd = Yd.hasOwnProperty;
function Vd(e) {
if (!Ot(e))
return Wd(e);
var t = Xl(e), n = [];
for (var r in e)
r == "constructor" && (t || !zd.call(e, r)) || n.push(r);
return n;
}
function tu(e) {
return lo(e) ? Bd(e) : Vd(e);
}
var Gd = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Kd = /^\w*$/;
function Xd(e, t) {
if (Bn(e))
return !1;
var n = typeof e;
return n == "number" || n == "symbol" || n == "boolean" || e == null || bs(e) ? !0 : Kd.test(e) || !Gd.test(e) || t != null && e in Object(t);
}
var Or = io(Object, "create");
function qd() {
this.__data__ = Or ? Or(null) : {}, this.size = 0;
}
function Jd(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t;
}
var Zd = "__lodash_hash_undefined__", Qd = Object.prototype, ef = Qd.hasOwnProperty;
function tf(e) {
var t = this.__data__;
if (Or) {
var n = t[e];
return n === Zd ? void 0 : n;
}
return ef.call(t, e) ? t[e] : void 0;
}
var nf = Object.prototype, rf = nf.hasOwnProperty;
function sf(e) {
var t = this.__data__;
return Or ? t[e] !== void 0 : rf.call(t, e);
}
var of = "__lodash_hash_undefined__";
function af(e, t) {
var n = this.__data__;
return this.size += this.has(e) ? 0 : 1, n[e] = Or && t === void 0 ? of : t, 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 = qd;
En.prototype.delete = Jd;
En.prototype.get = tf;
En.prototype.has = sf;
En.prototype.set = af;
function lf() {
this.__data__ = [], this.size = 0;
}
function ys(e, t) {
for (var n = e.length; n--; )
if (As(e[n][0], t))
return n;
return -1;
}
var uf = Array.prototype, cf = uf.splice;
function hf(e) {
var t = this.__data__, n = ys(t, e);
if (n < 0)
return !1;
var r = t.length - 1;
return n == r ? t.pop() : cf.call(t, n, 1), --this.size, !0;
}
function df(e) {
var t = this.__data__, n = ys(t, e);
return n < 0 ? void 0 : t[n][1];
}
function ff(e) {
return ys(this.__data__, e) > -1;
}
function mf(e, t) {
var n = this.__data__, r = ys(n, e);
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
}
function Gt(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]);
}
}
Gt.prototype.clear = lf;
Gt.prototype.delete = hf;
Gt.prototype.get = df;
Gt.prototype.has = ff;
Gt.prototype.set = mf;
var nu = io(Rn, "Map");
function gf() {
this.size = 0, this.__data__ = {
hash: new En(),
map: new (nu || Gt)(),
string: new En()
};
}
function _f(e) {
var t = typeof e;
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
function Ns(e, t) {
var n = e.__data__;
return _f(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
}
function pf(e) {
var t = Ns(this, e).delete(e);
return this.size -= t ? 1 : 0, t;
}
function Ef(e) {
return Ns(this, e).get(e);
}
function Cf(e) {
return Ns(this, e).has(e);
}
function Rf(e, t) {
var n = Ns(this, e), r = n.size;
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
}
function nn(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]);
}
}
nn.prototype.clear = gf;
nn.prototype.delete = pf;
nn.prototype.get = Ef;
nn.prototype.has = Cf;
nn.prototype.set = Rf;
var If = "Expected a function";
function uo(e, t) {
if (typeof e != "function" || t != null && typeof t != "function")
throw new TypeError(If);
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 (uo.Cache || nn)(), n;
}
uo.Cache = nn;
var wf = 500;
function Of(e) {
var t = uo(e, function(r) {
return n.size === wf && n.clear(), r;
}), n = t.cache;
return t;
}
var vf = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Sf = /\\(\\)?/g, bf = Of(function(e) {
var t = [];
return e.charCodeAt(0) === 46 && t.push(""), e.replace(vf, function(n, r, s, i) {
t.push(s ? i.replace(Sf, "$1") : r || n);
}), t;
});
function Af(e) {
return e == null ? "" : Yl(e);
}
function ru(e, t) {
return Bn(e) ? e : Xd(e, t) ? [e] : bf(Af(e));
}
function su(e) {
if (typeof e == "string" || bs(e))
return e;
var t = e + "";
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
}
function yf(e, t) {
t = ru(t, e);
for (var n = 0, r = t.length; e != null && n < r; )
e = e[su(t[n++])];
return n && n == r ? e : void 0;
}
function Nf(e, t, n) {
var r = e == null ? void 0 : yf(e, t);
return r === void 0 ? n : r;
}
var iu = jd(Object.getPrototypeOf, Object), Tf = "[object Object]", Mf = Function.prototype, Lf = Object.prototype, ou = Mf.toString, xf = Lf.hasOwnProperty, Df = ou.call(Object);
function Uf(e) {
if (!Gn(e) || Nr(e) != Tf)
return !1;
var t = iu(e);
if (t === null)
return !0;
var n = xf.call(t, "constructor") && t.constructor;
return typeof n == "function" && n instanceof n && ou.call(n) == Df;
}
function Pf() {
this.__data__ = new Gt(), this.size = 0;
}
function kf(e) {
var t = this.__data__, n = t.delete(e);
return this.size = t.size, n;
}
function Ff(e) {
return this.__data__.get(e);
}
function $f(e) {
return this.__data__.has(e);
}
var Hf = 200;
function Bf(e, t) {
var n = this.__data__;
if (n instanceof Gt) {
var r = n.__data__;
if (!nu || r.length < Hf - 1)
return r.push([e, t]), this.size = ++n.size, this;
n = this.__data__ = new nn(r);
}
return n.set(e, t), this.size = n.size, this;
}
function Kn(e) {
var t = this.__data__ = new Gt(e);
this.size = t.size;
}
Kn.prototype.clear = Pf;
Kn.prototype.delete = kf;
Kn.prototype.get = Ff;
Kn.prototype.has = $f;
Kn.prototype.set = Bf;
var au = typeof exports == "object" && exports && !exports.nodeType && exports, va = au && typeof module == "object" && module && !module.nodeType && module, jf = va && va.exports === au, Sa = jf ? Rn.Buffer : void 0;
Sa && Sa.allocUnsafe;
function Wf(e, t) {
return e.slice();
}
var ba = Rn.Uint8Array;
function Yf(e) {
var t = new e.constructor(e.byteLength);
return new ba(t).set(new ba(e)), t;
}
function zf(e, t) {
var n = Yf(e.buffer);
return new e.constructor(n, e.byteOffset, e.length);
}
function Vf(e) {
return typeof e.constructor == "function" && !Xl(e) ? Bh(iu(e)) : {};
}
function Gf(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 Kf = Gf(), Js = function() {
return Rn.Date.now();
}, Xf = "Expected a function", qf = Math.max, Jf = Math.min;
function hR(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(Xf);
t = ga(t) || 0, Ot(n) && (c = !!n.leading, h = "maxWait" in n, i = h ? qf(ga(n.maxWait) || 0, t) : i, d = "trailing" in n ? !!n.trailing : d);
function f(C) {
var S = r, y = s;
return r = s = void 0, u = C, o = e.apply(y, S), o;
}
function g(C) {
return u = C, a = setTimeout(b, t), c ? f(C) : o;
}
function _(C) {
var S = C - l, y = C - u, F = t - S;
return h ? Jf(F, i - y) : F;
}
function R(C) {
var S = C - l, y = C - u;
return l === void 0 || S >= t || S < 0 || h && y >= i;
}
function b() {
var C = Js();
if (R(C))
return $(C);
a = setTimeout(b, _(C));
}
function $(C) {
return a = void 0, d && r ? f(C) : (r = s = void 0, o);
}
function k() {
a !== void 0 && clearTimeout(a), u = 0, r = l = s = a = void 0;
}
function W() {
return a === void 0 ? o : $(Js());
}
function w() {
var C = Js(), S = R(C);
if (r = arguments, s = this, l = C, S) {
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 = k, w.flush = W, w;
}
function wi(e, t, n) {
(n !== void 0 && !As(e[t], n) || n === void 0 && !(t in e)) && ao(e, t, n);
}
function Zf(e) {
return Gn(e) && lo(e);
}
function Oi(e, t) {
if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
return e[t];
}
function Qf(e) {
return td(e, tu(e));
}
function em(e, t, n, r, s, i, o) {
var a = Oi(e, n), l = Oi(t, n), u = o.get(l);
if (u) {
wi(e, n, u);
return;
}
var c = i ? i(a, l, n + "", e, t, o) : void 0, h = c === void 0;
if (h) {
var d = Bn(l), f = !d && Zl(l), g = !d && !f && eu(l);
c = l, d || f || g ? Bn(a) ? c = a : Zf(a) ? c = Wh(a) : f ? (h = !1, c = Wf(l)) : g ? (h = !1, c = zf(l)) : c = [] : Uf(l) || Ii(l) ? (c = a, Ii(a) ? c = Qf(a) : (!Ot(a) || so(a)) && (c = Vf(l))) : h = !1;
}
h && (o.set(l, c), s(c, l, r, i, o), o.delete(l)), wi(e, n, c);
}
function co(e, t, n, r, s) {
e !== t && Kf(t, function(i, o) {
if (s || (s = new Kn()), Ot(i))
em(e, t, o, n, co, r, s);
else {
var a = r ? r(Oi(e, o), i, o + "", e, t, s) : void 0;
a === void 0 && (a = i), wi(e, o, a);
}
}, tu);
}
var dR = Kl(function(e, t, n, r) {
co(e, t, n, r);
}), ho = Kl(function(e, t, n) {
co(e, t, n);
});
function tm(e, t, n, r) {
if (!Ot(e))
return e;
t = ru(t, e);
for (var s = -1, i = t.length, o = i - 1, a = e; a != null && ++s < i; ) {
var l = su(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 = Ot(c) ? c : oo(t[s + 1]) ? [] : {});
}
Vl(a, l, u), a = a[l];
}
return e;
}
function fR(e, t, n) {
return e == null ? e : tm(e, t, n);
}
class Xn {
constructor() {
p(this, "cursor", 0);
}
reset() {
return this.cursor = 0, this;
}
moveCursor(t) {
this.cursor += t;
}
moveCursorTo(t) {
this.cursor = t;
}
}
function mR(e, t) {
for (const n in t)
t.hasOwnProperty(n) && (e[n] = t[n]);
}
function nm(e) {
return /^-?\d+(\.\d+)?$/.test(e);
}
function gR(e) {
return nm(e) ? Number(e) <= Number.MAX_SAFE_INTEGER : !1;
}
function _R(e) {
return Number(e) > Number.MAX_SAFE_INTEGER || e.length >= 18;
}
class lu {
constructor() {
p(this, "_data", []);
}
static create() {
return new lu();
}
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 uu {
constructor() {
p(this, "_data", /* @__PURE__ */ new Map());
}
static create() {
return new uu();
}
add(t, n) {
this._data.has(t) || this._data.set(t, n);
}
delete(t) {
this._data.delete(t);
}
getData() {
return this._data;
}
}
function pR(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 rm(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 sm(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 ER(e, t) {
return t.forEach((n) => e.add(n)), e;
}
function im(e) {
return e instanceof Ic || e instanceof it || e && "closed" in e && typeof e.unsubscribe < "u";
}
function je(e) {
let t = !1;
return e ? im(e) ? {
dispose: () => e.unsubscribe()
} : typeof e == "function" ? {
dispose: () => {
t || (t = !0, e());
}
} : e : je(() => {
});
}
function CR(e) {
return je(() => {
e.unsubscribe();
});
}
class fo {
constructor() {
p(this, "_disposables", /* @__PURE__ */ new Set());
}
add(t) {
const n = je(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 Ge {
constructor() {
p(this, "_disposed", !1);
p(this, "_collection", new fo());
}
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 RR extends Ge {
constructor() {
super(...arguments);
p(this, "dispose$", new it());
}
dispose() {
super.dispose(), this.dispose$.next(), this.dispose$.complete();
}
}
class IR extends Ge {
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 Oe = /* @__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))(Oe || {}), Re = /* @__PURE__ */ ((e) => (e[e.Reader = 0] = "Reader", e[e.Editor = 1] = "Editor", e[e.Owner = 2] = "Owner", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Re || {}), vi = /* @__PURE__ */ ((e) => (e[e.SomeCollaborator = 0] = "SomeCollaborator", e[e.AllCollaborator = 1] = "AllCollaborator", e[e.OneSelf = 2] = "OneSelf", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(vi || {});
class mo extends Ge {
}
const om = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
let am = (e) => crypto.getRandomValues(new Uint8Array(e)), lm = (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;
}
};
}, um = (e, t = 21) => lm(e, t | 0, am), cm = (e = 21) => {
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
for (; e--; )
t += om[n[e] & 63];
return t;
};
const cu = /* @__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"
]), hm = 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 dm(e) {
if (!Number.isNaN(+e))
return !1;
if (e.startsWith("http://localhost:3002") || e.startsWith("localhost:3002"))
return !0;
if (hm.test(e)) {
if (hu(e))
return !0;
try {
const r = new URL(du(e)).hostname.split(".").pop();
if (r && cu.has(r))
return !0;
} catch {
return !1;
}
}
return !1;
}
function hu(e) {
return /^[a-zA-Z]+:\/\//.test(e);
}
function fm(e) {
return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e);
}
function du(e) {
return hu(e) ? e : fm(e) ? `mailto://${e}` : `https://${e}`;
}
const qt = [
"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 go(e, t) {
const n = Z.getValueType(e), r = Z.getValueType(t);
return n !== r ? !1 : Z.isArray(e) ? mm(e, t) : Z.isObject(e) ? gm(e, t) : Z.isDate(e) ? e.getTime() === t.getTime() : Z.isRegExp(e) ? e.toString() === t.toString() : e === t;
}
function mm(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 (!go(s, i))
return !1;
}
return !0;
}
function gm(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 (!go(i, o))
return !1;
}
return !0;
}
class Z {
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 >= qt.length; )
r /= qt.length, r -= 1, n += qt[r % qt.length];
const s = t % qt.length;
return n += qt[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 += qt.length ** i + qt.length * s;
}
return n += t.charCodeAt(t.length - 1) - 65, n;
}
static deleteBlank(t) {
return Z.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 (Z.isArray(l)) {
const d = (c = a[u]) != null ? c : [];
a[u] = d, r(l, d);
return;
}
if (Z.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 (Z.isObject(u)) {
const d = (c = a[l]) != null ? c : {};
a[l] = d, s(u, d);
return;
}
if (Z.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 (Z.isArray(l)) {
const h = (u = t[a]) != null ? u : [];
t[a] = h, r(l, h);
return;
}
if (Z.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 go(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] = Z.deepClone(r);
}), n;
}
if (this.isObject(t)) {
const n = {};
return Object.keys(t).forEach((r) => {
const s = t[r];
n[r] = Z.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.getValueTyp