UNPKG

@bobmatnyc/claude-pm-portfolio-manager

Version:

Claude PM Portfolio Management Dashboard - React-based monitoring and reporting for Claude PM managed projects

1,638 lines (1,635 loc) 400 kB
var la = Object.defineProperty; var oa = (s, t, r) => t in s ? la(s, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[t] = r; var G = (s, t, r) => (oa(s, typeof t != "symbol" ? t + "" : t, r), r); import * as S from "react"; import gt, { forwardRef as ca, createElement as Ms, useState as A, useEffect as Se, useMemo as $t, useRef as Mt } from "react"; import "react-dom"; var qt = { exports: {} }, Oe = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ts; function da() { if (Ts) return Oe; Ts = 1; var s = gt, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, n = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 }; function i(o, c, d) { var m, x = {}, y = null, f = null; d !== void 0 && (y = "" + d), c.key !== void 0 && (y = "" + c.key), c.ref !== void 0 && (f = c.ref); for (m in c) a.call(c, m) && !l.hasOwnProperty(m) && (x[m] = c[m]); if (o && o.defaultProps) for (m in c = o.defaultProps, c) x[m] === void 0 && (x[m] = c[m]); return { $$typeof: t, type: o, key: y, ref: f, props: x, _owner: n.current }; } return Oe.Fragment = r, Oe.jsx = i, Oe.jsxs = i, Oe; } var Ie = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Os; function ua() { return Os || (Os = 1, process.env.NODE_ENV !== "production" && function() { var s = gt, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), o = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), f = Symbol.for("react.offscreen"), u = Symbol.iterator, b = "@@iterator"; function g(h) { if (h === null || typeof h != "object") return null; var w = u && h[u] || h[b]; return typeof w == "function" ? w : null; } var v = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function p(h) { { for (var w = arguments.length, C = new Array(w > 1 ? w - 1 : 0), R = 1; R < w; R++) C[R - 1] = arguments[R]; j("error", h, C); } } function j(h, w, C) { { var R = v.ReactDebugCurrentFrame, F = R.getStackAddendum(); F !== "" && (w += "%s", C = C.concat([F])); var L = C.map(function(I) { return String(I); }); L.unshift("Warning: " + w), Function.prototype.apply.call(console[h], console, L); } } var N = !1, M = !1, P = !1, k = !1, E = !1, _; _ = Symbol.for("react.module.reference"); function $(h) { return !!(typeof h == "string" || typeof h == "function" || h === a || h === l || E || h === n || h === d || h === m || k || h === f || N || M || P || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === x || h.$$typeof === i || h.$$typeof === o || h.$$typeof === c || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. h.$$typeof === _ || h.getModuleId !== void 0)); } function X(h, w, C) { var R = h.displayName; if (R) return R; var F = w.displayName || w.name || ""; return F !== "" ? C + "(" + F + ")" : C; } function Ae(h) { return h.displayName || "Context"; } function K(h) { if (h == null) return null; if (typeof h.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof h == "function") return h.displayName || h.name || null; if (typeof h == "string") return h; switch (h) { case a: return "Fragment"; case r: return "Portal"; case l: return "Profiler"; case n: return "StrictMode"; case d: return "Suspense"; case m: return "SuspenseList"; } if (typeof h == "object") switch (h.$$typeof) { case o: var w = h; return Ae(w) + ".Consumer"; case i: var C = h; return Ae(C._context) + ".Provider"; case c: return X(h, h.render, "ForwardRef"); case x: var R = h.displayName || null; return R !== null ? R : K(h.type) || "Memo"; case y: { var F = h, L = F._payload, I = F._init; try { return K(I(L)); } catch { return null; } } } return null; } var de = Object.assign, De = 0, ds, us, hs, ms, xs, fs, ps; function gs() { } gs.__reactDisabledLog = !0; function Or() { { if (De === 0) { ds = console.log, us = console.info, hs = console.warn, ms = console.error, xs = console.group, fs = console.groupCollapsed, ps = console.groupEnd; var h = { configurable: !0, enumerable: !0, value: gs, writable: !0 }; Object.defineProperties(console, { info: h, log: h, warn: h, error: h, group: h, groupCollapsed: h, groupEnd: h }); } De++; } } function Ir() { { if (De--, De === 0) { var h = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: de({}, h, { value: ds }), info: de({}, h, { value: us }), warn: de({}, h, { value: hs }), error: de({}, h, { value: ms }), group: de({}, h, { value: xs }), groupCollapsed: de({}, h, { value: fs }), groupEnd: de({}, h, { value: ps }) }); } De < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var wt = v.ReactCurrentDispatcher, St; function tt(h, w, C) { { if (St === void 0) try { throw Error(); } catch (F) { var R = F.stack.trim().match(/\n( *(at )?)/); St = R && R[1] || ""; } return ` ` + St + h; } } var kt = !1, st; { var _r = typeof WeakMap == "function" ? WeakMap : Map; st = new _r(); } function ys(h, w) { if (!h || kt) return ""; { var C = st.get(h); if (C !== void 0) return C; } var R; kt = !0; var F = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var L; L = wt.current, wt.current = null, Or(); try { if (w) { var I = function() { throw Error(); }; if (Object.defineProperty(I.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(I, []); } catch (z) { R = z; } Reflect.construct(h, [], I); } else { try { I.call(); } catch (z) { R = z; } h.call(I.prototype); } } else { try { throw Error(); } catch (z) { R = z; } h(); } } catch (z) { if (z && R && typeof z.stack == "string") { for (var O = z.stack.split(` `), Q = R.stack.split(` `), q = O.length - 1, V = Q.length - 1; q >= 1 && V >= 0 && O[q] !== Q[V]; ) V--; for (; q >= 1 && V >= 0; q--, V--) if (O[q] !== Q[V]) { if (q !== 1 || V !== 1) do if (q--, V--, V < 0 || O[q] !== Q[V]) { var Y = ` ` + O[q].replace(" at new ", " at "); return h.displayName && Y.includes("<anonymous>") && (Y = Y.replace("<anonymous>", h.displayName)), typeof h == "function" && st.set(h, Y), Y; } while (q >= 1 && V >= 0); break; } } } finally { kt = !1, wt.current = L, Ir(), Error.prepareStackTrace = F; } var be = h ? h.displayName || h.name : "", ue = be ? tt(be) : ""; return typeof h == "function" && st.set(h, ue), ue; } function Fr(h, w, C) { return ys(h, !1); } function Lr(h) { var w = h.prototype; return !!(w && w.isReactComponent); } function rt(h, w, C) { if (h == null) return ""; if (typeof h == "function") return ys(h, Lr(h)); if (typeof h == "string") return tt(h); switch (h) { case d: return tt("Suspense"); case m: return tt("SuspenseList"); } if (typeof h == "object") switch (h.$$typeof) { case c: return Fr(h.render); case x: return rt(h.type, w, C); case y: { var R = h, F = R._payload, L = R._init; try { return rt(L(F), w, C); } catch { } } } return ""; } var Me = Object.prototype.hasOwnProperty, vs = {}, bs = v.ReactDebugCurrentFrame; function at(h) { if (h) { var w = h._owner, C = rt(h.type, h._source, w ? w.type : null); bs.setExtraStackFrame(C); } else bs.setExtraStackFrame(null); } function Ur(h, w, C, R, F) { { var L = Function.call.bind(Me); for (var I in h) if (L(h, I)) { var O = void 0; try { if (typeof h[I] != "function") { var Q = Error((R || "React class") + ": " + C + " type `" + I + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[I] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw Q.name = "Invariant Violation", Q; } O = h[I](w, I, R, C, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (q) { O = q; } O && !(O instanceof Error) && (at(F), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", R || "React class", C, I, typeof O), at(null)), O instanceof Error && !(O.message in vs) && (vs[O.message] = !0, at(F), p("Failed %s type: %s", C, O.message), at(null)); } } } var $r = Array.isArray; function Et(h) { return $r(h); } function qr(h) { { var w = typeof Symbol == "function" && Symbol.toStringTag, C = w && h[Symbol.toStringTag] || h.constructor.name || "Object"; return C; } } function Vr(h) { try { return js(h), !1; } catch { return !0; } } function js(h) { return "" + h; } function Ns(h) { if (Vr(h)) return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qr(h)), js(h); } var Te = v.ReactCurrentOwner, Wr = { key: !0, ref: !0, __self: !0, __source: !0 }, ws, Ss, Ct; Ct = {}; function Br(h) { if (Me.call(h, "ref")) { var w = Object.getOwnPropertyDescriptor(h, "ref").get; if (w && w.isReactWarning) return !1; } return h.ref !== void 0; } function Qr(h) { if (Me.call(h, "key")) { var w = Object.getOwnPropertyDescriptor(h, "key").get; if (w && w.isReactWarning) return !1; } return h.key !== void 0; } function Kr(h, w) { if (typeof h.ref == "string" && Te.current && w && Te.current.stateNode !== w) { var C = K(Te.current.type); Ct[C] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', K(Te.current.type), h.ref), Ct[C] = !0); } } function zr(h, w) { { var C = function() { ws || (ws = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w)); }; C.isReactWarning = !0, Object.defineProperty(h, "key", { get: C, configurable: !0 }); } } function Hr(h, w) { { var C = function() { Ss || (Ss = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", w)); }; C.isReactWarning = !0, Object.defineProperty(h, "ref", { get: C, configurable: !0 }); } } var Gr = function(h, w, C, R, F, L, I) { var O = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: h, key: w, ref: C, props: I, // Record the component responsible for creating this element. _owner: L }; return O._store = {}, Object.defineProperty(O._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(O, "_self", { configurable: !1, enumerable: !1, writable: !1, value: R }), Object.defineProperty(O, "_source", { configurable: !1, enumerable: !1, writable: !1, value: F }), Object.freeze && (Object.freeze(O.props), Object.freeze(O)), O; }; function Yr(h, w, C, R, F) { { var L, I = {}, O = null, Q = null; C !== void 0 && (Ns(C), O = "" + C), Qr(w) && (Ns(w.key), O = "" + w.key), Br(w) && (Q = w.ref, Kr(w, F)); for (L in w) Me.call(w, L) && !Wr.hasOwnProperty(L) && (I[L] = w[L]); if (h && h.defaultProps) { var q = h.defaultProps; for (L in q) I[L] === void 0 && (I[L] = q[L]); } if (O || Q) { var V = typeof h == "function" ? h.displayName || h.name || "Unknown" : h; O && zr(I, V), Q && Hr(I, V); } return Gr(h, O, Q, F, R, Te.current, I); } } var Pt = v.ReactCurrentOwner, ks = v.ReactDebugCurrentFrame; function ve(h) { if (h) { var w = h._owner, C = rt(h.type, h._source, w ? w.type : null); ks.setExtraStackFrame(C); } else ks.setExtraStackFrame(null); } var Rt; Rt = !1; function At(h) { return typeof h == "object" && h !== null && h.$$typeof === t; } function Es() { { if (Pt.current) { var h = K(Pt.current.type); if (h) return ` Check the render method of \`` + h + "`."; } return ""; } } function Jr(h) { { if (h !== void 0) { var w = h.fileName.replace(/^.*[\\\/]/, ""), C = h.lineNumber; return ` Check your code at ` + w + ":" + C + "."; } return ""; } } var Cs = {}; function Xr(h) { { var w = Es(); if (!w) { var C = typeof h == "string" ? h : h.displayName || h.name; C && (w = ` Check the top-level render call using <` + C + ">."); } return w; } } function Ps(h, w) { { if (!h._store || h._store.validated || h.key != null) return; h._store.validated = !0; var C = Xr(w); if (Cs[C]) return; Cs[C] = !0; var R = ""; h && h._owner && h._owner !== Pt.current && (R = " It was passed a child from " + K(h._owner.type) + "."), ve(h), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', C, R), ve(null); } } function Rs(h, w) { { if (typeof h != "object") return; if (Et(h)) for (var C = 0; C < h.length; C++) { var R = h[C]; At(R) && Ps(R, w); } else if (At(h)) h._store && (h._store.validated = !0); else if (h) { var F = g(h); if (typeof F == "function" && F !== h.entries) for (var L = F.call(h), I; !(I = L.next()).done; ) At(I.value) && Ps(I.value, w); } } } function Zr(h) { { var w = h.type; if (w == null || typeof w == "string") return; var C; if (typeof w == "function") C = w.propTypes; else if (typeof w == "object" && (w.$$typeof === c || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. w.$$typeof === x)) C = w.propTypes; else return; if (C) { var R = K(w); Ur(C, h.props, "prop", R, h); } else if (w.PropTypes !== void 0 && !Rt) { Rt = !0; var F = K(w); p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", F || "Unknown"); } typeof w.getDefaultProps == "function" && !w.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ea(h) { { for (var w = Object.keys(h.props), C = 0; C < w.length; C++) { var R = w[C]; if (R !== "children" && R !== "key") { ve(h), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", R), ve(null); break; } } h.ref !== null && (ve(h), p("Invalid attribute `ref` supplied to `React.Fragment`."), ve(null)); } } var As = {}; function Ds(h, w, C, R, F, L) { { var I = $(h); if (!I) { var O = ""; (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (O += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var Q = Jr(F); Q ? O += Q : O += Es(); var q; h === null ? q = "null" : Et(h) ? q = "array" : h !== void 0 && h.$$typeof === t ? (q = "<" + (K(h.type) || "Unknown") + " />", O = " Did you accidentally export a JSX literal instead of a component?") : q = typeof h, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, O); } var V = Yr(h, w, C, F, L); if (V == null) return V; if (I) { var Y = w.children; if (Y !== void 0) if (R) if (Et(Y)) { for (var be = 0; be < Y.length; be++) Rs(Y[be], h); Object.freeze && Object.freeze(Y); } else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Rs(Y, h); } if (Me.call(w, "key")) { var ue = K(h), z = Object.keys(w).filter(function(ia) { return ia !== "key"; }), Dt = z.length > 0 ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!As[ue + Dt]) { var na = z.length > 0 ? "{" + z.join(": ..., ") + ": ...}" : "{}"; p(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Dt, ue, na, ue), As[ue + Dt] = !0; } } return h === a ? ea(V) : Zr(V), V; } } function ta(h, w, C) { return Ds(h, w, C, !0); } function sa(h, w, C) { return Ds(h, w, C, !1); } var ra = sa, aa = ta; Ie.Fragment = a, Ie.jsx = ra, Ie.jsxs = aa; }()), Ie; } process.env.NODE_ENV === "production" ? qt.exports = da() : qt.exports = ua(); var e = qt.exports; class He { constructor() { this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this); } subscribe(t) { const r = { listener: t }; return this.listeners.add(r), this.onSubscribe(), () => { this.listeners.delete(r), this.onUnsubscribe(); }; } hasListeners() { return this.listeners.size > 0; } onSubscribe() { } onUnsubscribe() { } } const We = typeof window > "u" || "Deno" in window; function J() { } function ha(s, t) { return typeof s == "function" ? s(t) : s; } function Vt(s) { return typeof s == "number" && s >= 0 && s !== 1 / 0; } function nr(s, t) { return Math.max(s + (t || 0) - Date.now(), 0); } function Ue(s, t, r) { return yt(s) ? typeof t == "function" ? { ...r, queryKey: s, queryFn: t } : { ...t, queryKey: s } : s; } function ae(s, t, r) { return yt(s) ? [{ ...t, queryKey: s }, r] : [s || {}, t]; } function Is(s, t) { const { type: r = "all", exact: a, fetchStatus: n, predicate: l, queryKey: i, stale: o } = s; if (yt(i)) { if (a) { if (t.queryHash !== ts(i, t.options)) return !1; } else if (!Ne(t.queryKey, i)) return !1; } if (r !== "all") { const c = t.isActive(); if (r === "active" && !c || r === "inactive" && c) return !1; } return !(typeof o == "boolean" && t.isStale() !== o || typeof n < "u" && n !== t.state.fetchStatus || l && !l(t)); } function _s(s, t) { const { exact: r, fetching: a, predicate: n, mutationKey: l } = s; if (yt(l)) { if (!t.options.mutationKey) return !1; if (r) { if (ge(t.options.mutationKey) !== ge(l)) return !1; } else if (!Ne(t.options.mutationKey, l)) return !1; } return !(typeof a == "boolean" && t.state.status === "loading" !== a || n && !n(t)); } function ts(s, t) { return ((t == null ? void 0 : t.queryKeyHashFn) || ge)(s); } function ge(s) { return JSON.stringify(s, (t, r) => Bt(r) ? Object.keys(r).sort().reduce((a, n) => (a[n] = r[n], a), {}) : r); } function Ne(s, t) { return ir(s, t); } function ir(s, t) { return s === t ? !0 : typeof s != typeof t ? !1 : s && t && typeof s == "object" && typeof t == "object" ? !Object.keys(t).some((r) => !ir(s[r], t[r])) : !1; } function lr(s, t) { if (s === t) return s; const r = Fs(s) && Fs(t); if (r || Bt(s) && Bt(t)) { const a = r ? s.length : Object.keys(s).length, n = r ? t : Object.keys(t), l = n.length, i = r ? [] : {}; let o = 0; for (let c = 0; c < l; c++) { const d = r ? c : n[c]; i[d] = lr(s[d], t[d]), i[d] === s[d] && o++; } return a === l && o === a ? s : i; } return t; } function Wt(s, t) { if (s && !t || t && !s) return !1; for (const r in s) if (s[r] !== t[r]) return !1; return !0; } function Fs(s) { return Array.isArray(s) && s.length === Object.keys(s).length; } function Bt(s) { if (!Ls(s)) return !1; const t = s.constructor; if (typeof t > "u") return !0; const r = t.prototype; return !(!Ls(r) || !r.hasOwnProperty("isPrototypeOf")); } function Ls(s) { return Object.prototype.toString.call(s) === "[object Object]"; } function yt(s) { return Array.isArray(s); } function or(s) { return new Promise((t) => { setTimeout(t, s); }); } function Us(s) { or(0).then(s); } function ma() { if (typeof AbortController == "function") return new AbortController(); } function Qt(s, t, r) { return r.isDataEqual != null && r.isDataEqual(s, t) ? s : typeof r.structuralSharing == "function" ? r.structuralSharing(s, t) : r.structuralSharing !== !1 ? lr(s, t) : t; } class xa extends He { constructor() { super(), this.setup = (t) => { if (!We && window.addEventListener) { const r = () => t(); return window.addEventListener("visibilitychange", r, !1), window.addEventListener("focus", r, !1), () => { window.removeEventListener("visibilitychange", r), window.removeEventListener("focus", r); }; } }; } onSubscribe() { this.cleanup || this.setEventListener(this.setup); } onUnsubscribe() { if (!this.hasListeners()) { var t; (t = this.cleanup) == null || t.call(this), this.cleanup = void 0; } } setEventListener(t) { var r; this.setup = t, (r = this.cleanup) == null || r.call(this), this.cleanup = t((a) => { typeof a == "boolean" ? this.setFocused(a) : this.onFocus(); }); } setFocused(t) { this.focused !== t && (this.focused = t, this.onFocus()); } onFocus() { this.listeners.forEach(({ listener: t }) => { t(); }); } isFocused() { return typeof this.focused == "boolean" ? this.focused : typeof document > "u" ? !0 : [void 0, "visible", "prerender"].includes(document.visibilityState); } } const ht = new xa(), $s = ["online", "offline"]; class fa extends He { constructor() { super(), this.setup = (t) => { if (!We && window.addEventListener) { const r = () => t(); return $s.forEach((a) => { window.addEventListener(a, r, !1); }), () => { $s.forEach((a) => { window.removeEventListener(a, r); }); }; } }; } onSubscribe() { this.cleanup || this.setEventListener(this.setup); } onUnsubscribe() { if (!this.hasListeners()) { var t; (t = this.cleanup) == null || t.call(this), this.cleanup = void 0; } } setEventListener(t) { var r; this.setup = t, (r = this.cleanup) == null || r.call(this), this.cleanup = t((a) => { typeof a == "boolean" ? this.setOnline(a) : this.onOnline(); }); } setOnline(t) { this.online !== t && (this.online = t, this.onOnline()); } onOnline() { this.listeners.forEach(({ listener: t }) => { t(); }); } isOnline() { return typeof this.online == "boolean" ? this.online : typeof navigator > "u" || typeof navigator.onLine > "u" ? !0 : navigator.onLine; } } const mt = new fa(); function pa(s) { return Math.min(1e3 * 2 ** s, 3e4); } function vt(s) { return (s ?? "online") === "online" ? mt.isOnline() : !0; } class cr { constructor(t) { this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent; } } function it(s) { return s instanceof cr; } function dr(s) { let t = !1, r = 0, a = !1, n, l, i; const o = new Promise((g, v) => { l = g, i = v; }), c = (g) => { a || (f(new cr(g)), s.abort == null || s.abort()); }, d = () => { t = !0; }, m = () => { t = !1; }, x = () => !ht.isFocused() || s.networkMode !== "always" && !mt.isOnline(), y = (g) => { a || (a = !0, s.onSuccess == null || s.onSuccess(g), n == null || n(), l(g)); }, f = (g) => { a || (a = !0, s.onError == null || s.onError(g), n == null || n(), i(g)); }, u = () => new Promise((g) => { n = (v) => { const p = a || !x(); return p && g(v), p; }, s.onPause == null || s.onPause(); }).then(() => { n = void 0, a || s.onContinue == null || s.onContinue(); }), b = () => { if (a) return; let g; try { g = s.fn(); } catch (v) { g = Promise.reject(v); } Promise.resolve(g).then(y).catch((v) => { var p, j; if (a) return; const N = (p = s.retry) != null ? p : 3, M = (j = s.retryDelay) != null ? j : pa, P = typeof M == "function" ? M(r, v) : M, k = N === !0 || typeof N == "number" && r < N || typeof N == "function" && N(r, v); if (t || !k) { f(v); return; } r++, s.onFail == null || s.onFail(r, v), or(P).then(() => { if (x()) return u(); }).then(() => { t ? f(v) : b(); }); }); }; return vt(s.networkMode) ? b() : u().then(b), { promise: o, cancel: c, continue: () => (n == null ? void 0 : n()) ? o : Promise.resolve(), cancelRetry: d, continueRetry: m }; } const ss = console; function ga() { let s = [], t = 0, r = (m) => { m(); }, a = (m) => { m(); }; const n = (m) => { let x; t++; try { x = m(); } finally { t--, t || o(); } return x; }, l = (m) => { t ? s.push(m) : Us(() => { r(m); }); }, i = (m) => (...x) => { l(() => { m(...x); }); }, o = () => { const m = s; s = [], m.length && Us(() => { a(() => { m.forEach((x) => { r(x); }); }); }); }; return { batch: n, batchCalls: i, schedule: l, setNotifyFunction: (m) => { r = m; }, setBatchNotifyFunction: (m) => { a = m; } }; } const W = ga(); class ur { destroy() { this.clearGcTimeout(); } scheduleGc() { this.clearGcTimeout(), Vt(this.cacheTime) && (this.gcTimeout = setTimeout(() => { this.optionalRemove(); }, this.cacheTime)); } updateCacheTime(t) { this.cacheTime = Math.max(this.cacheTime || 0, t ?? (We ? 1 / 0 : 5 * 60 * 1e3)); } clearGcTimeout() { this.gcTimeout && (clearTimeout(this.gcTimeout), this.gcTimeout = void 0); } } class ya extends ur { constructor(t) { super(), this.abortSignalConsumed = !1, this.defaultOptions = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.cache = t.cache, this.logger = t.logger || ss, this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.initialState = t.state || va(this.options), this.state = this.initialState, this.scheduleGc(); } get meta() { return this.options.meta; } setOptions(t) { this.options = { ...this.defaultOptions, ...t }, this.updateCacheTime(this.options.cacheTime); } optionalRemove() { !this.observers.length && this.state.fetchStatus === "idle" && this.cache.remove(this); } setData(t, r) { const a = Qt(this.state.data, t, this.options); return this.dispatch({ data: a, type: "success", dataUpdatedAt: r == null ? void 0 : r.updatedAt, manual: r == null ? void 0 : r.manual }), a; } setState(t, r) { this.dispatch({ type: "setState", state: t, setStateOptions: r }); } cancel(t) { var r; const a = this.promise; return (r = this.retryer) == null || r.cancel(t), a ? a.then(J).catch(J) : Promise.resolve(); } destroy() { super.destroy(), this.cancel({ silent: !0 }); } reset() { this.destroy(), this.setState(this.initialState); } isActive() { return this.observers.some((t) => t.options.enabled !== !1); } isDisabled() { return this.getObserversCount() > 0 && !this.isActive(); } isStale() { return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some((t) => t.getCurrentResult().isStale); } isStaleByTime(t = 0) { return this.state.isInvalidated || !this.state.dataUpdatedAt || !nr(this.state.dataUpdatedAt, t); } onFocus() { var t; const r = this.observers.find((a) => a.shouldFetchOnWindowFocus()); r && r.refetch({ cancelRefetch: !1 }), (t = this.retryer) == null || t.continue(); } onOnline() { var t; const r = this.observers.find((a) => a.shouldFetchOnReconnect()); r && r.refetch({ cancelRefetch: !1 }), (t = this.retryer) == null || t.continue(); } addObserver(t) { this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.cache.notify({ type: "observerAdded", query: this, observer: t })); } removeObserver(t) { this.observers.includes(t) && (this.observers = this.observers.filter((r) => r !== t), this.observers.length || (this.retryer && (this.abortSignalConsumed ? this.retryer.cancel({ revert: !0 }) : this.retryer.cancelRetry()), this.scheduleGc()), this.cache.notify({ type: "observerRemoved", query: this, observer: t })); } getObserversCount() { return this.observers.length; } invalidate() { this.state.isInvalidated || this.dispatch({ type: "invalidate" }); } fetch(t, r) { var a, n; if (this.state.fetchStatus !== "idle") { if (this.state.dataUpdatedAt && r != null && r.cancelRefetch) this.cancel({ silent: !0 }); else if (this.promise) { var l; return (l = this.retryer) == null || l.continueRetry(), this.promise; } } if (t && this.setOptions(t), !this.options.queryFn) { const f = this.observers.find((u) => u.options.queryFn); f && this.setOptions(f.options); } process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || this.logger.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']")); const i = ma(), o = { queryKey: this.queryKey, pageParam: void 0, meta: this.meta }, c = (f) => { Object.defineProperty(f, "signal", { enumerable: !0, get: () => { if (i) return this.abortSignalConsumed = !0, i.signal; } }); }; c(o); const d = () => this.options.queryFn ? (this.abortSignalConsumed = !1, this.options.queryFn(o)) : Promise.reject("Missing queryFn for queryKey '" + this.options.queryHash + "'"), m = { fetchOptions: r, options: this.options, queryKey: this.queryKey, state: this.state, fetchFn: d }; if (c(m), (a = this.options.behavior) == null || a.onFetch(m), this.revertState = this.state, this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((n = m.fetchOptions) == null ? void 0 : n.meta)) { var x; this.dispatch({ type: "fetch", meta: (x = m.fetchOptions) == null ? void 0 : x.meta }); } const y = (f) => { if (it(f) && f.silent || this.dispatch({ type: "error", error: f }), !it(f)) { var u, b, g, v; (u = (b = this.cache.config).onError) == null || u.call(b, f, this), (g = (v = this.cache.config).onSettled) == null || g.call(v, this.state.data, f, this), process.env.NODE_ENV !== "production" && this.logger.error(f); } this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1; }; return this.retryer = dr({ fn: m.fetchFn, abort: i == null ? void 0 : i.abort.bind(i), onSuccess: (f) => { var u, b, g, v; if (typeof f > "u") { process.env.NODE_ENV !== "production" && this.logger.error("Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: " + this.queryHash), y(new Error(this.queryHash + " data is undefined")); return; } this.setData(f), (u = (b = this.cache.config).onSuccess) == null || u.call(b, f, this), (g = (v = this.cache.config).onSettled) == null || g.call(v, f, this.state.error, this), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1; }, onError: y, onFail: (f, u) => { this.dispatch({ type: "failed", failureCount: f, error: u }); }, onPause: () => { this.dispatch({ type: "pause" }); }, onContinue: () => { this.dispatch({ type: "continue" }); }, retry: m.options.retry, retryDelay: m.options.retryDelay, networkMode: m.options.networkMode }), this.promise = this.retryer.promise, this.promise; } dispatch(t) { const r = (a) => { var n, l; switch (t.type) { case "failed": return { ...a, fetchFailureCount: t.failureCount, fetchFailureReason: t.error }; case "pause": return { ...a, fetchStatus: "paused" }; case "continue": return { ...a, fetchStatus: "fetching" }; case "fetch": return { ...a, fetchFailureCount: 0, fetchFailureReason: null, fetchMeta: (n = t.meta) != null ? n : null, fetchStatus: vt(this.options.networkMode) ? "fetching" : "paused", ...!a.dataUpdatedAt && { error: null, status: "loading" } }; case "success": return { ...a, data: t.data, dataUpdateCount: a.dataUpdateCount + 1, dataUpdatedAt: (l = t.dataUpdatedAt) != null ? l : Date.now(), error: null, isInvalidated: !1, status: "success", ...!t.manual && { fetchStatus: "idle", fetchFailureCount: 0, fetchFailureReason: null } }; case "error": const i = t.error; return it(i) && i.revert && this.revertState ? { ...this.revertState, fetchStatus: "idle" } : { ...a, error: i, errorUpdateCount: a.errorUpdateCount + 1, errorUpdatedAt: Date.now(), fetchFailureCount: a.fetchFailureCount + 1, fetchFailureReason: i, fetchStatus: "idle", status: "error" }; case "invalidate": return { ...a, isInvalidated: !0 }; case "setState": return { ...a, ...t.state }; } }; this.state = r(this.state), W.batch(() => { this.observers.forEach((a) => { a.onQueryUpdate(t); }), this.cache.notify({ query: this, type: "updated", action: t }); }); } } function va(s) { const t = typeof s.initialData == "function" ? s.initialData() : s.initialData, r = typeof t < "u", a = r ? typeof s.initialDataUpdatedAt == "function" ? s.initialDataUpdatedAt() : s.initialDataUpdatedAt : 0; return { data: t, dataUpdateCount: 0, dataUpdatedAt: r ? a ?? Date.now() : 0, error: null, errorUpdateCount: 0, errorUpdatedAt: 0, fetchFailureCount: 0, fetchFailureReason: null, fetchMeta: null, isInvalidated: !1, status: r ? "success" : "loading", fetchStatus: "idle" }; } class ba extends He { constructor(t) { super(), this.config = t || {}, this.queries = [], this.queriesMap = {}; } build(t, r, a) { var n; const l = r.queryKey, i = (n = r.queryHash) != null ? n : ts(l, r); let o = this.get(i); return o || (o = new ya({ cache: this, logger: t.getLogger(), queryKey: l, queryHash: i, options: t.defaultQueryOptions(r), state: a, defaultOptions: t.getQueryDefaults(l) }), this.add(o)), o; } add(t) { this.queriesMap[t.queryHash] || (this.queriesMap[t.queryHash] = t, this.queries.push(t), this.notify({ type: "added", query: t })); } remove(t) { const r = this.queriesMap[t.queryHash]; r && (t.destroy(), this.queries = this.queries.filter((a) => a !== t), r === t && delete this.queriesMap[t.queryHash], this.notify({ type: "removed", query: t })); } clear() { W.batch(() => { this.queries.forEach((t) => { this.remove(t); }); }); } get(t) { return this.queriesMap[t]; } getAll() { return this.queries; } /** * @deprecated This method should be used with only one object argument. */ find(t, r) { const [a] = ae(t, r); return typeof a.exact > "u" && (a.exact = !0), this.queries.find((n) => Is(a, n)); } /** * @deprecated This method should be used with only one object argument. */ findAll(t, r) { const [a] = ae(t, r); return Object.keys(a).length > 0 ? this.queries.filter((n) => Is(a, n)) : this.queries; } notify(t) { W.batch(() => { this.listeners.forEach(({ listener: r }) => { r(t); }); }); } onFocus() { W.batch(() => { this.queries.forEach((t) => { t.onFocus(); }); }); } onOnline() { W.batch(() => { this.queries.forEach((t) => { t.onOnline(); }); }); } } class ja extends ur { constructor(t) { super(), this.defaultOptions = t.defaultOptions, this.mutationId = t.mutationId, this.mutationCache = t.mutationCache, this.logger = t.logger || ss, this.observers = [], this.state = t.state || Na(), this.setOptions(t.options), this.scheduleGc(); } setOptions(t) { this.options = { ...this.defaultOptions, ...t }, this.updateCacheTime(this.options.cacheTime); } get meta() { return this.options.meta; } setState(t) { this.dispatch({ type: "setState", state: t }); } addObserver(t) { this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.mutationCache.notify({ type: "observerAdded", mutation: this, observer: t })); } removeObserver(t) { this.observers = this.observers.filter((r) => r !== t), this.scheduleGc(), this.mutationCache.notify({ type: "observerRemoved", mutation: this, observer: t }); } optionalRemove() { this.observers.length || (this.state.status === "loading" ? this.scheduleGc() : this.mutationCache.remove(this)); } continue() { var t, r; return (t = (r = this.retryer) == null ? void 0 : r.continue()) != null ? t : this.execute(); } async execute() { const t = () => { var k; return this.retryer = dr({ fn: () => this.options.mutationFn ? this.options.mutationFn(this.state.variables) : Promise.reject("No mutationFn found"), onFail: (E, _) => { this.dispatch({ type: "failed", failureCount: E, error: _ }); }, onPause: () => { this.dispatch({ type: "pause" }); }, onContinue: () => { this.dispatch({ type: "continue" }); }, retry: (k = this.options.retry) != null ? k : 0, retryDelay: this.options.retryDelay, networkMode: this.options.networkMode }), this.retryer.promise; }, r = this.state.status === "loading"; try { var a, n, l, i, o, c, d, m; if (!r) { var x, y, f, u; this.dispatch({ type: "loading", variables: this.options.variables }), await ((x = (y = this.mutationCache.config).onMutate) == null ? void 0 : x.call(y, this.state.variables, this)); const E = await ((f = (u = this.options).onMutate) == null ? void 0 : f.call(u, this.state.variables)); E !== this.state.context && this.dispatch({ type: "loading", context: E, variables: this.state.variables }); } const k = await t(); return await ((a = (n = this.mutationCache.config).onSuccess) == null ? void 0 : a.call(n, k, this.state.variables, this.state.context, this)), await ((l = (i = this.options).onSuccess) == null ? void 0 : l.call(i, k, this.state.variables, this.state.context)), await ((o = (c = this.mutationCache.config).onSettled) == null ? void 0 : o.call(c, k, null, this.state.variables, this.state.context, this)), await ((d = (m = this.options).onSettled) == null ? void 0 : d.call(m, k, null, this.state.variables, this.state.context)), this.dispatch({ type: "success", data: k }), k; } catch (k) { try { var b, g, v, p, j, N, M, P; throw await ((b = (g = this.mutationCache.config).onError) == null ? void 0 : b.call(g, k, this.state.variables, this.state.context, this)), process.env.NODE_ENV !== "production" && this.logger.error(k), await ((v = (p = this.options).onError) == null ? void 0 : v.call(p, k, this.state.variables, this.state.context)), await ((j = (N = this.mutationCache.config).onSettled) == null ? void 0 : j.call(N, void 0, k, this.state.variables, this.state.context, this)), await ((M = (P = this.options).onSettled) == null ? void 0 : M.call(P, void 0, k, this.state.variables, this.state.context)), k; } finally { this.dispatch({ type: "error", error: k }); } } } dispatch(t) { const r = (a) => { switch (t.type) { case "failed": return { ...a, failureCount: t.failureCount, failureReason: t.error }; case "pause": return { ...a, isPaused: !0 }; case "continue": return { ...a, isPaused: !1 }; case "loading": return { ...a, context: t.context, data: void 0, failureCount: 0, failureReason: null, error: null, isPaused: !vt(this.options.networkMode), status: "loading", variables: t.variables }; case "success": return { ...a, data: t.data, failureCount: 0, failureReason: null, error: null, status: "success", isPaused: !1 }; case "error": return { ...a, data: void 0, error: t.error, failureCount: a.failureCount + 1, failureReason: t.error, isPaused: !1, status: "error" }; case "setState": return { ...a, ...t.state }; } }; this.state = r(this.state), W.batch(() => { this.observers.forEach((a) => { a.onMutationUpdate(t); }), this.mutationCache.notify({ mutation: this, type: "updated", action: t }); }); } } function Na() { return { context: void 0, data: void 0, error: null, failureCount: 0, failureReason: null, isPaused: !1, status: "idle", variables: void 0 }; } class wa extends He { constructor(t) { super(), this.config = t || {}, this.mutations = [], this.mutationId = 0; } build(t, r, a) { const n = new ja({ mutationCache: this, logger: t.getLogger(), mutationId: ++this.mutationId, options: t.defaultMutationOptions(r), state: a, defaultOptions: r.mutationKey ? t.getMutationDefaults(r.mutationKey) : void 0 }); return this.add(n), n; } add(t) { this.mutations.push(t), this.notify({ type: "added", mutation: t }); } remove(t) { this.mutations = this.mutations.filter((r) => r !== t), this.notify({ type: "removed", mutation: t }); } clear() { W.batch(() => { this.mutations.forEach((t) => { this.remove(t); }); }); } getAll() { return this.mutations; } find(t) { return typeof t.exact > "u" && (t.exact = !0), this.mutations.find((r) => _s(t, r)); } findAll(t) { return this.mutations.filter((r) => _s(t, r)); } notify(t) { W.batch(() => { this.listeners.forEach(({ listener: r }) => { r(t); }); }); } resumePausedMutations() { var t; return this.resuming = ((t = this.resuming) != null ? t : Promise.resolve()).then(() => { const r = this.mutations.filter((a) => a.state.isPaused); return W.batch(() => r.reduce((a, n) => a.then(() => n.continue().catch(J)), Promise.resolve())); }).then(() => { this.resuming = void 0; }), this.resuming; } } function Sa() { return { onFetch: (s) => { s.fetchFn = () => { var t, r, a,