UNPKG

@sheetxl/studio-vanilla

Version:

SheetXL Studio - Vanilla entry point for integrating SheetXL UI.

1,134 lines 58 kB
/** * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.6.4 * * (C) 2025-present SheetXL Inc. & Michael T. Ford * License: The license can be found at https://www.sheetxl.com/license. */ var ce, ue, ne = {}, ee = {}, U = {}, oe = {}, H = {}; function Ne() { if (ue) return H; ue = 1; var g = H && H.__awaiter || function(e, t, o, n) { return new (o || (o = Promise))(function(r, s) { function l(O) { try { D(n.next(O)); } catch (c) { s(c); } } function f(O) { try { D(n.throw(O)); } catch (c) { s(c); } } function D(O) { var c; O.done ? r(O.value) : (c = O.value, c instanceof o ? c : new o(function(i) { i(c); })).then(l, f); } D((n = n.apply(e, t || [])).next()); }); }, x = H && H.__generator || function(e, t) { var o, n, r, s, l = { label: 0, sent: function() { if (1 & r[0]) throw r[1]; return r[1]; }, trys: [], ops: [] }; return s = { next: f(0), throw: f(1), return: f(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() { return this; }), s; function f(D) { return function(O) { return function(c) { if (o) throw new TypeError("Generator is already executing."); for (; l; ) try { if (o = 1, n && (r = 2 & c[0] ? n.return : c[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, c[1])).done) return r; switch (n = 0, r && (c = [2 & c[0], r.value]), c[0]) { case 0: case 1: r = c; break; case 4: return l.label++, { value: c[1], done: !1 }; case 5: l.label++, n = c[1], c = [0]; continue; case 7: c = l.ops.pop(), l.trys.pop(); continue; default: if (!((r = (r = l.trys).length > 0 && r[r.length - 1]) || c[0] !== 6 && c[0] !== 2)) { l = 0; continue; } if (c[0] === 3 && (!r || c[1] > r[0] && c[1] < r[3])) { l.label = c[1]; break; } if (c[0] === 6 && l.label < r[1]) { l.label = r[1], r = c; break; } if (r && l.label < r[2]) { l.label = r[2], l.ops.push(c); break; } r[2] && l.ops.pop(), l.trys.pop(); continue; } c = t.call(e, l); } catch (i) { c = [6, i], n = 0; } finally { o = r = 0; } if (5 & c[0]) throw c[1]; return { value: c[0] ? c[1] : void 0, done: !0 }; }([D, O]); }; } }; Object.defineProperty(H, "__esModule", { value: !0 }), H.JsDelivrSourceResolver = void 0; var j = function() { function e() { } return e.prototype.resolvePackageJson = function(t, o, n) { return g(this, void 0, void 0, function() { return x(this, function(r) { switch (r.label) { case 0: return [4, this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(t).concat(o ? "@".concat(o) : "").concat(n ? "/".concat(n) : "", "/package.json"))]; case 1: return [2, r.sent()]; } }); }); }, e.prototype.resolveSourceFile = function(t, o, n) { return g(this, void 0, void 0, function() { return x(this, function(r) { switch (r.label) { case 0: return [4, this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(t).concat(o ? "@".concat(o) : "", "/").concat(n))]; case 1: return [2, r.sent()]; } }); }); }, e.prototype.resolveFile = function(t) { return g(this, void 0, void 0, function() { var o; return x(this, function(n) { switch (n.label) { case 0: return [4, fetch(t, { method: "GET" })]; case 1: return (o = n.sent()).ok ? [4, o.text()] : [3, 3]; case 2: return [2, n.sent()]; case 3: if (o.status === 404) return [2, ""]; throw Error("Error other than 404 while fetching from Unpkg at ".concat(t)); case 4: return [2]; } }); }); }, e; }(); return H.JsDelivrSourceResolver = j, H; } var le, pe, he, N = {}, V = {}; function se() { if (pe) return le; function g(e) { if (typeof e != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(e)); } function x(e, t) { for (var o, n = "", r = 0, s = -1, l = 0, f = 0; f <= e.length; ++f) { if (f < e.length) o = e.charCodeAt(f); else { if (o === 47) break; o = 47; } if (o === 47) { if (s !== f - 1 && l !== 1) if (s !== f - 1 && l === 2) { if (n.length < 2 || r !== 2 || n.charCodeAt(n.length - 1) !== 46 || n.charCodeAt(n.length - 2) !== 46) { if (n.length > 2) { var D = n.lastIndexOf("/"); if (D !== n.length - 1) { D === -1 ? (n = "", r = 0) : r = (n = n.slice(0, D)).length - 1 - n.lastIndexOf("/"), s = f, l = 0; continue; } } else if (n.length === 2 || n.length === 1) { n = "", r = 0, s = f, l = 0; continue; } } t && (n.length > 0 ? n += "/.." : n = "..", r = 2); } else n.length > 0 ? n += "/" + e.slice(s + 1, f) : n = e.slice(s + 1, f), r = f - s - 1; s = f, l = 0; } else o === 46 && l !== -1 ? ++l : l = -1; } return n; } pe = 1; var j = { resolve: function() { for (var e, t = "", o = !1, n = arguments.length - 1; n >= -1 && !o; n--) { var r; n >= 0 ? r = arguments[n] : (e === void 0 && (e = process.cwd()), r = e), g(r), r.length !== 0 && (t = r + "/" + t, o = r.charCodeAt(0) === 47); } return t = x(t, !o), o ? t.length > 0 ? "/" + t : "/" : t.length > 0 ? t : "."; }, normalize: function(e) { if (g(e), e.length === 0) return "."; var t = e.charCodeAt(0) === 47, o = e.charCodeAt(e.length - 1) === 47; return (e = x(e, !t)).length !== 0 || t || (e = "."), e.length > 0 && o && (e += "/"), t ? "/" + e : e; }, isAbsolute: function(e) { return g(e), e.length > 0 && e.charCodeAt(0) === 47; }, join: function() { if (arguments.length === 0) return "."; for (var e, t = 0; t < arguments.length; ++t) { var o = arguments[t]; g(o), o.length > 0 && (e === void 0 ? e = o : e += "/" + o); } return e === void 0 ? "." : j.normalize(e); }, relative: function(e, t) { if (g(e), g(t), e === t || (e = j.resolve(e)) === (t = j.resolve(t))) return ""; for (var o = 1; o < e.length && e.charCodeAt(o) === 47; ++o) ; for (var n = e.length, r = n - o, s = 1; s < t.length && t.charCodeAt(s) === 47; ++s) ; for (var l = t.length - s, f = r < l ? r : l, D = -1, O = 0; O <= f; ++O) { if (O === f) { if (l > f) { if (t.charCodeAt(s + O) === 47) return t.slice(s + O + 1); if (O === 0) return t.slice(s + O); } else r > f && (e.charCodeAt(o + O) === 47 ? D = O : O === 0 && (D = 0)); break; } var c = e.charCodeAt(o + O); if (c !== t.charCodeAt(s + O)) break; c === 47 && (D = O); } var i = ""; for (O = o + D + 1; O <= n; ++O) O !== n && e.charCodeAt(O) !== 47 || (i.length === 0 ? i += ".." : i += "/.."); return i.length > 0 ? i + t.slice(s + D) : (s += D, t.charCodeAt(s) === 47 && ++s, t.slice(s)); }, _makeLong: function(e) { return e; }, dirname: function(e) { if (g(e), e.length === 0) return "."; for (var t = e.charCodeAt(0), o = t === 47, n = -1, r = !0, s = e.length - 1; s >= 1; --s) if ((t = e.charCodeAt(s)) === 47) { if (!r) { n = s; break; } } else r = !1; return n === -1 ? o ? "/" : "." : o && n === 1 ? "//" : e.slice(0, n); }, basename: function(e, t) { if (t !== void 0 && typeof t != "string") throw new TypeError('"ext" argument must be a string'); g(e); var o, n = 0, r = -1, s = !0; if (t !== void 0 && t.length > 0 && t.length <= e.length) { if (t.length === e.length && t === e) return ""; var l = t.length - 1, f = -1; for (o = e.length - 1; o >= 0; --o) { var D = e.charCodeAt(o); if (D === 47) { if (!s) { n = o + 1; break; } } else f === -1 && (s = !1, f = o + 1), l >= 0 && (D === t.charCodeAt(l) ? --l === -1 && (r = o) : (l = -1, r = f)); } return n === r ? r = f : r === -1 && (r = e.length), e.slice(n, r); } for (o = e.length - 1; o >= 0; --o) if (e.charCodeAt(o) === 47) { if (!s) { n = o + 1; break; } } else r === -1 && (s = !1, r = o + 1); return r === -1 ? "" : e.slice(n, r); }, extname: function(e) { g(e); for (var t = -1, o = 0, n = -1, r = !0, s = 0, l = e.length - 1; l >= 0; --l) { var f = e.charCodeAt(l); if (f !== 47) n === -1 && (r = !1, n = l + 1), f === 46 ? t === -1 ? t = l : s !== 1 && (s = 1) : t !== -1 && (s = -1); else if (!r) { o = l + 1; break; } } return t === -1 || n === -1 || s === 0 || s === 1 && t === n - 1 && t === o + 1 ? "" : e.slice(t, n); }, format: function(e) { if (e === null || typeof e != "object") throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e); return o = (t = e).dir || t.root, n = t.base || (t.name || "") + (t.ext || ""), o ? o === t.root ? o + n : o + "/" + n : n; var t, o, n; }, parse: function(e) { g(e); var t = { root: "", dir: "", base: "", ext: "", name: "" }; if (e.length === 0) return t; var o, n = e.charCodeAt(0), r = n === 47; r ? (t.root = "/", o = 1) : o = 0; for (var s = -1, l = 0, f = -1, D = !0, O = e.length - 1, c = 0; O >= o; --O) if ((n = e.charCodeAt(O)) !== 47) f === -1 && (D = !1, f = O + 1), n === 46 ? s === -1 ? s = O : c !== 1 && (c = 1) : s !== -1 && (c = -1); else if (!D) { l = O + 1; break; } return s === -1 || f === -1 || c === 0 || c === 1 && s === f - 1 && s === l + 1 ? f !== -1 && (t.base = t.name = l === 0 && r ? e.slice(1, f) : e.slice(l, f)) : (l === 0 && r ? (t.name = e.slice(1, s), t.base = e.slice(1, f)) : (t.name = e.slice(l, s), t.base = e.slice(l, f)), t.ext = e.slice(s, f)), l > 0 ? t.dir = e.slice(0, l - 1) : r && (t.dir = "/"), t; }, sep: "/", delimiter: ":", win32: null, posix: null }; return j.posix = j, le = j; } var fe, te = {}; function Ie() { if (fe) return te; fe = 1; var g = te && te.__importDefault || function(j) { return j && j.__esModule ? j : { default: j }; }; Object.defineProperty(te, "__esModule", { value: !0 }), te.importResourcePathToString = void 0; var x = g(se()); return te.importResourcePathToString = function(j) { var e; switch (j.kind) { case "package": return x.default.join(j.packageName, (e = j.importPath) !== null && e !== void 0 ? e : "", "package.json"); case "relative": return x.default.join(j.sourcePath, j.importPath); case "relative-in-package": return x.default.join(j.packageName, j.sourcePath, j.importPath); } }, te; } var de, ie = {}; function ve() { return de || (de = 1, Object.defineProperty(ie, "__esModule", { value: !0 }), ie.invokeUpdate = void 0, ie.invokeUpdate = function(g, x) { var j, e = "".concat(g.type, ": "); switch (g.type) { case "CodeChanged": case "ResolveNewImports": e += ""; break; case "LookedUpTypeFile": e += '"'.concat(g.path, '" was ').concat(g.success ? "sucessfully" : "not sucessfully", " looked up"); break; case "AttemptedLookUpFile": e += '"'.concat(g.path, '" was ').concat(g.success ? "sucessfully" : "not sucessfully", " attempted to looked up"); break; case "LookedUpPackage": e += 'package.json for package "'.concat(g.package, '" was ').concat(g.success ? "sucessfully" : "not sucessfully", " looked up").concat(g.definitelyTyped ? " (found in definitely typed repo)" : ""); break; case "LoadedFromCache": e += '"'.concat(g.importPath, '" was loaded from cache'); break; case "StoredToCache": e += '"'.concat(g.importPath, '" was stored to cache'); } e.endsWith(": ") && (e = e.slice(void 0, -2)), (j = x.onUpdate) === null || j === void 0 || j.call(x, g, e); }), ie; } var ye, ge, me, be, ae = {}; function ke() { if (ye) return ae; ye = 1, Object.defineProperty(ae, "__esModule", { value: !0 }), ae.RecursionDepth = void 0; var g = function() { function x(j, e, t) { e === void 0 && (e = 0), t === void 0 && (t = 0), this.options = j, this.fileRecursionDepth = e, this.packageRecursionDepth = t; } return x.prototype.nextPackage = function() { return new x(this.options, this.fileRecursionDepth, this.packageRecursionDepth + 1); }, x.prototype.nextFile = function() { return new x(this.options, this.fileRecursionDepth + 1, this.packageRecursionDepth); }, x.prototype.same = function() { return new x(this.options, this.fileRecursionDepth, this.packageRecursionDepth); }, x.prototype.shouldStop = function() { return this.options.fileRecursionDepth > 0 && this.fileRecursionDepth >= this.options.fileRecursionDepth || this.options.packageRecursionDepth > 0 && this.packageRecursionDepth >= this.options.packageRecursionDepth; }, x; }(); return ae.RecursionDepth = g, ae; } function Le() { if (me) return U; me = 1; var g = U && U.__assign || function() { return g = Object.assign || function(i) { for (var b, k = 1, A = arguments.length; k < A; k++) for (var y in b = arguments[k]) Object.prototype.hasOwnProperty.call(b, y) && (i[y] = b[y]); return i; }, g.apply(this, arguments); }, x = U && U.__createBinding || (Object.create ? function(i, b, k, A) { A === void 0 && (A = k); var y = Object.getOwnPropertyDescriptor(b, k); y && !("get" in y ? !b.__esModule : y.writable || y.configurable) || (y = { enumerable: !0, get: function() { return b[k]; } }), Object.defineProperty(i, A, y); } : function(i, b, k, A) { A === void 0 && (A = k), i[A] = b[k]; }), j = U && U.__setModuleDefault || (Object.create ? function(i, b) { Object.defineProperty(i, "default", { enumerable: !0, value: b }); } : function(i, b) { i.default = b; }), e = U && U.__importStar || function(i) { if (i && i.__esModule) return i; var b = {}; if (i != null) for (var k in i) k !== "default" && Object.prototype.hasOwnProperty.call(i, k) && x(b, i, k); return j(b, i), b; }, t = U && U.__awaiter || function(i, b, k, A) { return new (k || (k = Promise))(function(y, F) { function E(X) { try { Z(A.next(X)); } catch (R) { F(R); } } function Y(X) { try { Z(A.throw(X)); } catch (R) { F(R); } } function Z(X) { var R; X.done ? y(X.value) : (R = X.value, R instanceof k ? R : new k(function(G) { G(R); })).then(E, Y); } Z((A = A.apply(i, b || [])).next()); }); }, o = U && U.__generator || function(i, b) { var k, A, y, F, E = { label: 0, sent: function() { if (1 & y[0]) throw y[1]; return y[1]; }, trys: [], ops: [] }; return F = { next: Y(0), throw: Y(1), return: Y(2) }, typeof Symbol == "function" && (F[Symbol.iterator] = function() { return this; }), F; function Y(Z) { return function(X) { return function(R) { if (k) throw new TypeError("Generator is already executing."); for (; E; ) try { if (k = 1, A && (y = 2 & R[0] ? A.return : R[0] ? A.throw || ((y = A.return) && y.call(A), 0) : A.next) && !(y = y.call(A, R[1])).done) return y; switch (A = 0, y && (R = [2 & R[0], y.value]), R[0]) { case 0: case 1: y = R; break; case 4: return E.label++, { value: R[1], done: !1 }; case 5: E.label++, A = R[1], R = [0]; continue; case 7: R = E.ops.pop(), E.trys.pop(); continue; default: if (!((y = (y = E.trys).length > 0 && y[y.length - 1]) || R[0] !== 6 && R[0] !== 2)) { E = 0; continue; } if (R[0] === 3 && (!y || R[1] > y[0] && R[1] < y[3])) { E.label = R[1]; break; } if (R[0] === 6 && E.label < y[1]) { E.label = y[1], y = R; break; } if (y && E.label < y[2]) { E.label = y[2], E.ops.push(R); break; } y[2] && E.ops.pop(), E.trys.pop(); continue; } R = b.call(i, E); } catch (G) { R = [6, G], A = 0; } finally { k = y = 0; } if (5 & R[0]) throw R[1]; return { value: R[0] ? R[1] : void 0, done: !0 }; }([Z, X]); }; } }, n = U && U.__values || function(i) { var b = typeof Symbol == "function" && Symbol.iterator, k = b && i[b], A = 0; if (k) return k.call(i); if (i && typeof i.length == "number") return { next: function() { return i && A >= i.length && (i = void 0), { value: i && i[A++], done: !i }; } }; throw new TypeError(b ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(U, "__esModule", { value: !0 }), U.AutoTypingsCore = void 0; var r = function() { if (ce) return oe; ce = 1, Object.defineProperty(oe, "__esModule", { value: !0 }), oe.DummySourceCache = void 0; var i = function() { function b() { } return b.prototype.getFile = function(k) { return Promise.resolve(void 0); }, b.prototype.isFileAvailable = function(k) { return Promise.resolve(!1); }, b.prototype.storeFile = function(k, A) { return Promise.resolve(void 0); }, b.prototype.clear = function() { return Promise.resolve(void 0); }, b; }(); return oe.DummySourceCache = i, oe; }(), s = Ne(), l = function() { if (ge) return N; ge = 1; var i = N && N.__assign || function() { return i = Object.assign || function(_) { for (var a, h = 1, v = arguments.length; h < v; h++) for (var u in a = arguments[h]) Object.prototype.hasOwnProperty.call(a, u) && (_[u] = a[u]); return _; }, i.apply(this, arguments); }, b = N && N.__createBinding || (Object.create ? function(_, a, h, v) { v === void 0 && (v = h); var u = Object.getOwnPropertyDescriptor(a, h); u && !("get" in u ? !a.__esModule : u.writable || u.configurable) || (u = { enumerable: !0, get: function() { return a[h]; } }), Object.defineProperty(_, v, u); } : function(_, a, h, v) { v === void 0 && (v = h), _[v] = a[h]; }), k = N && N.__setModuleDefault || (Object.create ? function(_, a) { Object.defineProperty(_, "default", { enumerable: !0, value: a }); } : function(_, a) { _.default = a; }), A = N && N.__importStar || function(_) { if (_ && _.__esModule) return _; var a = {}; if (_ != null) for (var h in _) h !== "default" && Object.prototype.hasOwnProperty.call(_, h) && b(a, _, h); return k(a, _), a; }, y = N && N.__awaiter || function(_, a, h, v) { return new (h || (h = Promise))(function(u, S) { function m(C) { try { p(v.next(C)); } catch (d) { S(d); } } function w(C) { try { p(v.throw(C)); } catch (d) { S(d); } } function p(C) { var d; C.done ? u(C.value) : (d = C.value, d instanceof h ? d : new h(function(P) { P(d); })).then(m, w); } p((v = v.apply(_, a || [])).next()); }); }, F = N && N.__generator || function(_, a) { var h, v, u, S, m = { label: 0, sent: function() { if (1 & u[0]) throw u[1]; return u[1]; }, trys: [], ops: [] }; return S = { next: w(0), throw: w(1), return: w(2) }, typeof Symbol == "function" && (S[Symbol.iterator] = function() { return this; }), S; function w(p) { return function(C) { return function(d) { if (h) throw new TypeError("Generator is already executing."); for (; m; ) try { if (h = 1, v && (u = 2 & d[0] ? v.return : d[0] ? v.throw || ((u = v.return) && u.call(v), 0) : v.next) && !(u = u.call(v, d[1])).done) return u; switch (v = 0, u && (d = [2 & d[0], u.value]), d[0]) { case 0: case 1: u = d; break; case 4: return m.label++, { value: d[1], done: !1 }; case 5: m.label++, v = d[1], d = [0]; continue; case 7: d = m.ops.pop(), m.trys.pop(); continue; default: if (!((u = (u = m.trys).length > 0 && u[u.length - 1]) || d[0] !== 6 && d[0] !== 2)) { m = 0; continue; } if (d[0] === 3 && (!u || d[1] > u[0] && d[1] < u[3])) { m.label = d[1]; break; } if (d[0] === 6 && m.label < u[1]) { m.label = u[1], u = d; break; } if (u && m.label < u[2]) { m.label = u[2], m.ops.push(d); break; } u[2] && m.ops.pop(), m.trys.pop(); continue; } d = a.call(_, m); } catch (P) { d = [6, P], v = 0; } finally { h = u = 0; } if (5 & d[0]) throw d[1]; return { value: d[0] ? d[1] : void 0, done: !0 }; }([p, C]); }; } }, E = N && N.__values || function(_) { var a = typeof Symbol == "function" && Symbol.iterator, h = a && _[a], v = 0; if (h) return h.call(_); if (_ && typeof _.length == "number") return { next: function() { return _ && v >= _.length && (_ = void 0), { value: _ && _[v++], done: !_ }; } }; throw new TypeError(a ? "Object is not iterable." : "Symbol.iterator is not defined."); }, Y = N && N.__read || function(_, a) { var h = typeof Symbol == "function" && _[Symbol.iterator]; if (!h) return _; var v, u, S = h.call(_), m = []; try { for (; (a === void 0 || a-- > 0) && !(v = S.next()).done; ) m.push(v.value); } catch (w) { u = { error: w }; } finally { try { v && !v.done && (h = S.return) && h.call(S); } finally { if (u) throw u.error; } } return m; }; Object.defineProperty(N, "__esModule", { value: !0 }), N.ImportResolver = void 0; var Z = function() { if (he) return V; he = 1; var _ = V && V.__createBinding || (Object.create ? function(w, p, C, d) { d === void 0 && (d = C); var P = Object.getOwnPropertyDescriptor(p, C); P && !("get" in P ? !p.__esModule : P.writable || P.configurable) || (P = { enumerable: !0, get: function() { return p[C]; } }), Object.defineProperty(w, d, P); } : function(w, p, C, d) { d === void 0 && (d = C), w[d] = p[C]; }), a = V && V.__setModuleDefault || (Object.create ? function(w, p) { Object.defineProperty(w, "default", { enumerable: !0, value: p }); } : function(w, p) { w.default = p; }), h = V && V.__importStar || function(w) { if (w && w.__esModule) return w; var p = {}; if (w != null) for (var C in w) C !== "default" && Object.prototype.hasOwnProperty.call(w, C) && _(p, w, C); return a(p, w), p; }, v = V && V.__read || function(w, p) { var C = typeof Symbol == "function" && w[Symbol.iterator]; if (!C) return w; var d, P, I = C.call(w), L = []; try { for (; (p === void 0 || p-- > 0) && !(d = I.next()).done; ) L.push(d.value); } catch (M) { P = { error: M }; } finally { try { d && !d.done && (C = I.return) && C.call(I); } finally { if (P) throw P.error; } } return L; }, u = V && V.__spreadArray || function(w, p, C) { if (C || arguments.length === 2) for (var d, P = 0, I = p.length; P < I; P++) !d && P in p || (d || (d = Array.prototype.slice.call(p, 0, P)), d[P] = p[P]); return w.concat(d || Array.prototype.slice.call(p)); }; Object.defineProperty(V, "__esModule", { value: !0 }), V.DependencyParser = void 0; var S = h(se()), m = function() { function w() { this.REGEX_CLEAN = /[\n|\r]/g, this.REGEX_DETECT_IMPORT = /(?:(?:(?:import)|(?:export))(?:.)*?from\s+["']([^"']+)["'])|(?:((?:require|import))(?:\s+)?\(["']([^"']+)["']\))|(?:\/+\s+<reference\s+path=["']([^"']+)["']\s+\/>)/g, this.REGEX_NODE_MODULE = /^node:([\w\W\/]+)$/; } return w.prototype.parseDependencies = function(p, C) { var d = this; return u([], v(p.matchAll(this.REGEX_DETECT_IMPORT)), !1).map(function(P) { var I, L; return (L = (I = P[1]) !== null && I !== void 0 ? I : P[2]) !== null && L !== void 0 ? L : P[3]; }).filter(function(P) { return !!P; }).map(function(P) { return d.resolvePath(P, C); }); }, w.prototype.resolvePath = function(p, C) { var d = p.match(this.REGEX_NODE_MODULE); if (d) return { kind: "relative-in-package", packageName: "@types/node", importPath: "".concat(d[1], ".d.ts"), sourcePath: "" }; if (typeof C == "string") { if (p.startsWith(".")) return { kind: "relative", importPath: p, sourcePath: C }; if (p.startsWith("@")) { var P = p.split("/"); return { kind: "package", packageName: "".concat(P[0], "/").concat(P[1]), importPath: P.slice(2).join("/") }; } return { kind: "package", packageName: (P = p.split("/"))[0], importPath: P.slice(1).join("/") }; } switch (C.kind) { case "package": throw Error("TODO?"); case "relative": throw Error("TODO2?"); case "relative-in-package": return p.startsWith(".") ? { kind: "relative-in-package", packageName: C.packageName, sourcePath: S.join(C.sourcePath, C.importPath), importPath: p } : p.startsWith("@") ? (P = p.split("/"), { kind: "package", packageName: "".concat(P[0], "/").concat(P[1]), importPath: P.slice(2).join("/") }) : { kind: "package", packageName: (P = p.split("/"))[0], importPath: P.slice(1).join("/") }; } }, w; }(); return V.DependencyParser = m, V; }(), X = Ie(), R = A(se()), G = ve(), Me = ke(), Ue = function() { function _(a) { var h, v; if (this.options = a, this.loadedFiles = [], this.dependencyParser = new Z.DependencyParser(), this.cache = a.sourceCache, this.sourceResolver = a.sourceResolver, this.newImportsResolved = !1, this.monaco = a.monaco, a.preloadPackages && a.versions) { this.versions = a.versions; try { for (var u = E(Object.entries(a.versions)), S = u.next(); !S.done; S = u.next()) { var m = Y(S.value, 2), w = m[0]; m[1], this.resolveImport({ kind: "package", packageName: w, importPath: "" }, new Me.RecursionDepth(this.options)).catch(function(p) { console.error(p); }); } } catch (p) { h = { error: p }; } finally { try { S && !S.done && (v = u.return) && v.call(u); } finally { if (h) throw h.error; } } } } return _.prototype.wereNewImportsResolved = function() { return this.newImportsResolved; }, _.prototype.resetNewImportsResolved = function() { this.newImportsResolved = !1; }, _.prototype.resolveImportsInFile = function(a, h, v) { var u, S, m; return y(this, void 0, void 0, function() { var w, p, C, d, P, I, L, M; return F(this, function(T) { switch (T.label) { case 0: if (v.shouldStop()) return [2]; w = this.dependencyParser.parseDependencies(a, h), T.label = 1; case 1: T.trys.push([1, 8, 9, 10]), p = E(w), C = p.next(), T.label = 2; case 2: if (C.done) return [3, 7]; d = C.value, T.label = 3; case 3: return T.trys.push([3, 5, , 6]), [4, this.resolveImport(d, v)]; case 4: return T.sent(), [3, 6]; case 5: return P = T.sent(), this.options.onError ? (S = (u = this.options).onError) === null || S === void 0 || S.call(u, (m = P.message) !== null && m !== void 0 ? m : P) : console.error(P), [3, 6]; case 6: return C = p.next(), [3, 2]; case 7: return [3, 10]; case 8: return I = T.sent(), L = { error: I }, [3, 10]; case 9: try { C && !C.done && (M = p.return) && M.call(p); } finally { if (L) throw L.error; } return [7]; case 10: return [2]; } }); }); }, _.prototype.resolveImport = function(a, h) { return y(this, void 0, void 0, function() { var v, u; return F(this, function(S) { switch (S.label) { case 0: if (v = this.hashImportResourcePath(a), this.loadedFiles.includes(v)) return [2]; switch (this.loadedFiles.push(v), a.kind) { case "package": return [3, 1]; case "relative": return [3, 5]; case "relative-in-package": return [3, 6]; } return [3, 8]; case 1: return [4, this.resolveImportFromPackageRoot(a)]; case 2: return (u = S.sent()) ? [4, this.resolveImportInPackage(u, h.nextPackage().nextFile())] : [3, 4]; case 3: case 7: return [2, S.sent()]; case 4: return [3, 8]; case 5: throw Error("Not implemented yet"); case 6: return [4, this.resolveImportInPackage(a, h.nextFile())]; case 8: return [2]; } }); }); }, _.prototype.resolveImportInPackage = function(a, h) { return y(this, void 0, void 0, function() { var v, u, S; return F(this, function(m) { switch (m.label) { case 0: return [4, this.loadSourceFileContents(a)]; case 1: return (v = m.sent()) ? (u = v.source, S = v.at, this.createModel(u, this.monaco.Uri.parse(this.options.fileRootPath + R.join("node_modules/".concat(a.packageName), S))), [4, this.resolveImportsInFile(u, { kind: "relative-in-package", packageName: a.packageName, sourcePath: R.dirname(S), importPath: "" }, h)]) : [3, 3]; case 2: m.sent(), m.label = 3; case 3: return [2]; } }); }); }, _.prototype.resolveImportFromPackageRoot = function(a) { var h, v, u, S, m, w, p, C, d; return y(this, void 0, void 0, function() { var P, I, L, M, T, B, re, J, W; return F(this, function($) { switch ($.label) { case 0: return P = { type: "LookedUpPackage", package: a.packageName, definitelyTyped: !1, success: !1 }, !this.options.onlySpecifiedPackages || (h = this.versions) !== null && h !== void 0 && h[a.packageName] || (v = this.versions) !== null && v !== void 0 && v["@types/" + a.packageName] ? (I = (S = (u = a.importPath) === null || u === void 0 ? void 0 : u.length) !== null && S !== void 0 && S, L = I ? "/".concat(a.importPath) : "", [4, this.resolvePackageJson(a.packageName, (m = this.versions) === null || m === void 0 ? void 0 : m[a.packageName], I ? a.importPath : void 0)]) : ((0, G.invokeUpdate)(P, this.options), [2]); case 1: return (M = $.sent()) || !I ? [3, 3] : [4, this.resolvePackageJson(a.packageName, (w = this.versions) === null || w === void 0 ? void 0 : w[a.packageName])]; case 2: M = $.sent(), L = "", $.label = 3; case 3: return M ? (T = JSON.parse(M)).typings || T.types ? (W = T.typings || T.types, this.createModel(M, this.monaco.Uri.parse("".concat(this.options.fileRootPath, "node_modules/").concat(a.packageName).concat(L, "/package.json"))), (0, G.invokeUpdate)({ type: "LookedUpPackage", package: a.packageName, definitelyTyped: !1, success: !0 }, this.options), this.setVersion(a.packageName, T.version), [2, { kind: "relative-in-package", packageName: a.packageName, sourcePath: "", importPath: R.join((p = a.importPath) !== null && p !== void 0 ? p : "", W.startsWith("./") ? W.slice(2) : W) }]) : [3, 4] : [3, 7]; case 4: return B = "@types/".concat(a.packageName.startsWith("@") ? a.packageName.slice(1).replace(/\//, "__") : a.packageName), [4, this.resolvePackageJson(B, (C = this.versions) === null || C === void 0 ? void 0 : C[B])]; case 5: if (re = $.sent()) { if ((J = JSON.parse(re)).typings || J.types) return W = J.typings || J.types, this.createModel(re, this.monaco.Uri.parse("".concat(this.options.fileRootPath, "node_modules/").concat(B, "/package.json"))), (0, G.invokeUpdate)({ type: "LookedUpPackage", package: B, definitelyTyped: !0, success: !0 }, this.options), this.setVersion(B, J.version), [2, { kind: "relative-in-package", packageName: B, sourcePath: "", importPath: R.join((d = a.importPath) !== null && d !== void 0 ? d : "", W.startsWith("./") ? W.slice(2) : W) }]; (0, G.invokeUpdate)(P, this.options); } else (0, G.invokeUpdate)(P, this.options); $.label = 6; case 6: return [3, 8]; case 7: (0, G.invokeUpdate)(P, this.options), $.label = 8; case 8: return [2]; } }); }); }, _.prototype.loadSourceFileContents = function(a) { return y(this, void 0, void 0, function() { var h, v, u, S, m, w, p, C, d, P, I, L, M, T, B, re; return F(this, function(J) { switch (J.label) { case 0: return h = R.join(a.packageName, a.sourcePath, a.importPath), v = { type: "LookedUpTypeFile", path: h, definitelyTyped: !1, success: !1 }, u = a.packageName, S = this.getVersion(a.packageName), (m = [".d.ts", "/index.d.ts", ".ts", ".tsx", "/index.ts", "/index.tsx"]).map(function(W) { return a.importPath.endsWith(W); }).reduce(function(W, $) { return W || $; }, !1) ? [4, this.resolveSourceFile(u, S, R.join(a.sourcePath, a.importPath))] : [3, 2]; case 1: return (T = J.sent()) ? [2, { source: T, at: R.join(a.sourcePath, a.importPath) }] : [3, 9]; case 2: J.trys.push([2, 7, 8, 9]), w = E(m), p = w.next(), J.label = 3; case 3: return p.done ? [3, 6] : (C = p.value, d = R.join(a.sourcePath, a.importPath), M = (C === ".d.ts" && d.endsWith(".js") ? d.slice(0, -3) : d) + C, [4, this.resolveSourceFile(u, S, M)]); case 4: if (T = J.sent(), (0, G.invokeUpdate)({ type: "AttemptedLookUpFile", path: R.join(u, M), success: !!T }, this.options), T) return (0, G.invokeUpdate)({ type: "LookedUpTypeFile", path: R.join(u, M), success: !0 }, this.options), [2, { source: T, at: M }]; J.label = 5; case 5: return p = w.next(), [3, 3]; case 6: return [3, 9]; case 7: return P = J.sent(), B = { error: P }, [3, 9]; case 8: try { p && !p.done && (re = w.return) && re.call(w); } finally { if (B) throw B.error; } return [7]; case 9: return [4, this.resolvePackageJson(u, S, R.join(a.sourcePath, a.importPath))]; case 10: return (I = J.sent()) && (L = JSON.parse(I).types) ? (M = R.join(a.sourcePath, a.importPath, L), [4, this.resolveSourceFile(u, S, M)]) : [3, 12]; case 11: if (T = J.sent()) return (0, G.invokeUpdate)({ type: "LookedUpTypeFile", path: R.join(u, M), success: !0 }, this.options), [2, { source: T, at: M }]; J.label = 12; case 12: return (0, G.invokeUpdate)(v, this.options), [2, null]; } }); }); }, _.prototype.getVersion = function(a) { var h; return (h = this.versions) === null || h === void 0 ? void 0 : h[a]; }, _.prototype.setVersions = function(a) { var h, v; this.versions = a, (v = (h = this.options).onUpdateVersions) === null || v === void 0 || v.call(h, a); }, _.prototype.setVersion = function(a, h) { var v; this.setVersions(i(i({}, this.versions), ((v = {})[a] = h, v))); }, _.prototype.createModel = function(a, h) { h = h.with({ path: h.path.replace("@types/", "") }), this.monaco.editor.getModel(h) || (this.monaco.editor.createModel(a, "typescript", h), this.newImportsResolved = !0); }, _.prototype.hashImportResourcePath = function(a) { return (0, X.importResourcePathToString)(a); }, _.prototype.resolvePackageJson = function(a, h, v) { return y(this, void 0, void 0, function() { var u, S, m, w; return F(this, function(p) { switch (p.label) { case 0: return u = R.join(a + (h ? "@".concat(h) : ""), v ?? "", "package.json"), S = !1, m = void 0, this.cache.isFileAvailable ? [4, this.cache.isFileAvailable(u)] : [3, 2]; case 1: return S = p.sent(), [3, 4]; case 2: return [4, this.cache.getFile(u)]; case 3: m = p.sent(), S = m !== void 0, p.label = 4; case 4: return S ? m == null ? [3, 5] : (w = m, [3, 7]) : [3, 8]; case 5: return [4, this.cache.getFile(u)]; case 6: w = p.sent(), p.label = 7; case 7: return [2, w]; case 8: return [4, this.sourceResolver.resolvePackageJson(a, h, v)]; case 9: return (m = p.sent()) && this.cache.storeFile(u, m), [2, m]; } }); }); }, _.prototype.resolveSourceFile = function(a, h, v) { return y(this, void 0, void 0, function() { var u, S, m, w; return F(this, function(p) { switch (p.label) { case 0: return u = R.join(a + (h ? "@".concat(h) : ""), v), S = !1, m = void 0, this.cache.isFileAvailable ? [4, this.cache.isFileAvailable(u)] : [3, 2]; case 1: return S = p.sent(), [3, 4]; case 2: return [4, this.cache.getFile(u)]; case 3: m = p.sent(), S = m !== void 0, p.label = 4; case 4: return S ? ((0, G.invokeUpdate)({ type: "LoadedFromCache", importPath: u }, this.options), m == null ? [3, 5] : (w = m, [3, 7])) : [3, 8]; case 5: return [4, this.cache.getFile(u)]; case 6: w = p.sent(), p.label = 7; case 7: return [2, w]; case 8: return [4, this.sourceResolver.resolveSourceFile(a, h, v)]; case 9: return (m = p.sent()) && ((0, G.invokeUpdate)({ type: "StoredToCache", importPath: u }, this.options), this.cache.storeFile(u, m)), [2, m]; } }); }); }, _; }(); return N.ImportResolver = Ue, N; }(), f = e(se()), D = ve(), O = ke(), c = function() { function i(b, k) { var A = this; this.editor = b, this.options = k, this.disposables = [], this.importResolver = new l.ImportResolver(k); var y = b.onDidChangeModelContent(function(F) { A.debouncedResolveContents(); }); this.disposables.push(y), this.resolveContents(), k.dontAdaptEditorOptions || k.monaco.languages.typescript.typescriptDefaults.setCompilerOptions(g(g({}, k.monaco.languages.typescript.typescriptDefaults.getCompilerOptions()), { moduleResolution: k.monaco.languages.typescript.ModuleResolutionKind.NodeJs, allowSyntheticDefaultImports: !0, rootDir: k.fileRootPath })); } return i.create = function(b, k) { var A, y; return t(this, void 0, void 0, function() { var F; return o(this, function(E) { if (k?.shareCache && k.sourceCache && !i.sharedCache && (i.sharedCache = k.sourceCache), !(F = k?.monaco)) throw new Error("monacoInstance not found, you can specify the monaco instance via options.monaco"); return [2, new i(b, g(g({ fileRootPath: "inmemory://model/", onlySpecifiedPackages: !1, preloadPackages: !1, shareCache: !1, dontAdaptEditorOptions: !1, dontRefreshModelValueAfterResolvement: !1, sourceCache: (A = i.sharedCache) !== null && A !== void 0 ? A : new r.DummySourceCache(), sourceResolver: (y = k?.sourceResolver) !== null && y !== void 0 ? y : new s.JsDelivrSourceResolver(), debounceDuration: 4e3, fileRecursionDepth: 10, packageRecursionDepth: 3 }, k), { monaco: F }))]; }); }); }, i.prototype.dispose = function() { var b, k; try { for (var A = n(this.disposables), y = A.next(); !y.done; y = A.next()) y.value.dispose(); } catch (F) { b = { error: F }; } finally { try { y && !y.done && (k = A.return) && k.call(A); } finally { if (b) throw b.error; } } }, i.prototype.setVersions = function(b) { this.importResolver.setVersions(b), this.options.versions = b; }, i.prototype.clearCache = function() { return t(this, void 0, void 0, function() { return o(this, function(b) { switch (b.label) { case 0: return [4, this.options.sourceCache.clear()]; case 1: return b.sent(), [2]; } }); }); }, i.prototype.debouncedResolveContents = function() { var b = this; this.isResolving || ((0, D.invokeUpdate)({ type: "CodeChanged" }, this.options), this.options.debounceDuration <= 0 ? this.resolveContents() : (this.debounceTimer !== void 0 && clearTimeout(this.debounceTimer), this.debounceTimer = setTimeout(function() { return t(b, void 0, void 0, function() { return o(this, function(k) { switch (k.label) { case 0: return [4, this.resolveContents()]; case 1: return k.sent(), this.debounceTimer = void 0, [2]; } }); }); }, this.options.debounceDuration))); }, i.prototype.resolveContents = function() { var b; return t(this, void 0, void 0, function() { var k, A, y, F; return o(this, function(E) { switch (E.label) { case 0: if (this.isResolving = !0, (0, D.invokeUpdate)({ type: "ResolveNewImports" }, this.options), !(k = this.editor.getModel())) throw Error("No model"); A = k.getLinesContent(), E.label = 1; case 1: return E.trys.push([1, 3, , 4]), [4, this.importResolver.resolveImportsInFile(A.join(` `), f.dirname(k.uri.toString()), new O.RecursionDepth(this.options))]; case 2: return E.sent(), [3, 4]; case 3: if (y = E.sent(), !this.options.onError) throw y; return this.options.onError((b = y.message) !== null && b !== void 0 ? b : y), [3, 4]; case 4: return this.importResolver.wereNewImportsResolved() && (this.options.dontRefreshModelValueAfterResolvement || (F = this.editor.getPosition(), k.setValue(k.getValue()), F && this.editor.setPosition(F)), this.importResolver.resetNewImportsResolved()), this.isResolving = !1, [2]; } }); }); }, i; }(); return U.AutoTypingsCore = c, U; } var we, z = {}, _e, Pe, Oe, je, Re, Ce, Se, xe, Ae = {}, De = {}, Ee = {}, Fe = {}, Q = {}; const Ge = function(g, x) { for (var j = 0; j < x.length; j++) { const e = x[j]; if (typeof e != "string" && !Array.isArray(e)) { for (const t in e) if (t !== "default" && !(t in g)) { const o = Object.getOwnPropertyDescriptor(e, t); o && Object.defineProperty(g, t, o.get ? o : { enumerable: !0, get: () => e[t] }); } } } return Object.freeze(Object.defineProperty(g, Symbol.toStringTag, { value: "Module" })); }({ __proto__: null }, [xe ? Se : (xe = 1, Ce || (Ce = 1, q = ne, Te = ne && ne.__createBinding || (Object.create ? function(g, x, j, e) { e === void 0 && (e = j); var t = Object.getOwnPropertyDescriptor(x, j); t && !("get" in t ? !x.__esModule : t.writable || t.configurable) || (t = { enumerable: !0, get: function() { return x[j]; } }), Object.defineProperty(g, e, t); } : function(g, x, j, e) { e === void 0 && (e = j), g[e] = x[j]; }), K = ne && ne.__exportStar || function(g, x) { for (var j in g) j === "default" || Object.prototype.hasOwnProperty.call(x, j) || Te(x, g, j); }, Object.defineProperty(q, "__esModule", { value: !0 }), K(function() { if (be) return ee; be = 1; var g, x = ee && ee.__extends || (g = function(e, t) { return (g = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(o, n) { o.__proto__ = n; } || function(o, n) { for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (o[r] = n[r]); })(e, t); }, function(e, t) { if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null"); function o() { this.constructor = e; } g(e, t), e.prototype = t === null ? Object.create(t) : (o.prototype = t.prototype, new o()); }); Object.defineProperty(ee, "__esModule", { value: !0 }), ee.AutoTypings = void 0; var j = function(e) { function t(o, n) { return e.call(this, o, n) || this; } return x(t, e), t; }(Le().AutoTypingsCore); return ee.AutoTypings = j, ee; }(), q), K(Ie(), q), K(function() { if (we) return z; we = 1; var g = z && z.__awaiter || function(t, o, n, r) { return new (n || (n = Promise))(function(s, l) { function f(c) { try { O(r.next(c)); } catch (i) { l(i); } } function D(c) { try { O(r.throw(c)); } catch (i) { l(i); } } function O(c) { var i; c.done ? s(c.value) : (i = c.value, i instanceof n ? i : new n(function(b) { b(i); })).then(f, D); } O((r = r.apply(t, o || [])).next()); }); }, x = z && z.__generator || function(t, o) { var n, r, s, l, f = { label: 0, sent: function() { if (1 & s[0]) throw s[1]; return s[1]; }, trys: [], ops: [] }; return l = { next: D(0), throw: D(1), return: D(2) }, typeof Symbol == "function" && (l[Symbol.iterator] = function() { return this; }), l; function D(O) { return function(c) { return function(i) { if (n) throw new TypeError("Generator is already executing."); for (; f; ) try { if (n = 1, r && (s = 2 & i[0] ? r.return : i[0] ? r.throw || ((s = r.return) && s.call(r), 0) : r.next) && !(s = s.call(r, i[1])).done) return s; switch (r = 0, s && (i = [2 & i[0], s.value]), i[0]) { case 0: case 1: s = i; break; case 4: return f.label++, { value: i[1], done: !1 }; case 5: f.label++, r