@mwm/addon

Market addon using mwi-moonitoring library for WebSocket events

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name               @mwm/addon
// @name:en            MWI Market Addon
// @name:zh-CN         MWI 市场插件
// @namespace          https://milkyway.market/
// @version            1.12.1
// @author             mathewcst
// @description:en     Sync character data between MWI game and MilkyWay Market
// @description:zh-CN  同步 MWI 游戏和 MilkyWay Market 之间的角色数据
// @license            MIT
// @icon               https://www.google.com/s2/favicons?sz=64&domain=milkywayidle.com
// @match              https://www.milkywayidle.com/*
// @match              https://milkywayidle.com/*
// @match              https://test.milkywayidle.com/*
// @match              https://milkyway.market/*
// @match              https://www.milkyway.market/*
// @connect            milkyway.market
// @grant              GM_addStyle
// @grant              GM_addValueChangeListener
// @grant              GM_getValue
// @grant              GM_setClipboard
// @grant              GM_setValue
// @grant              GM_xmlhttpRequest
// @description Market addon using mwi-moonitoring library for WebSocket events
// ==/UserScript==

(function() {
var d = new Set();
	var _virtual_monkey_css_side_effects_default = async (e) => {
		d.has(e) || (d.add(e), ((t) => {
			typeof GM_addStyle == "function" ? GM_addStyle(t) : (document.head || document.documentElement).appendChild(document.createElement("style")).append(t);
		})(e));
	};

var _GM_addValueChangeListener = typeof GM_addValueChangeListener != "undefined" ? GM_addValueChangeListener : void 0;
	var _GM_getValue = typeof GM_getValue != "undefined" ? GM_getValue : void 0;
	var _GM_setClipboard = typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0;
	var _GM_setValue = typeof GM_setValue != "undefined" ? GM_setValue : void 0;
	var _GM_xmlhttpRequest = typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0, n$1, l$3, u$3, t$2, i$3, r$2, o$3, e$2, f$3, c$2, s$2, a$2, p$3 = {}, v$2 = [], y$3 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, d$3 = Array.isArray;
	function w$3(n, l) {
		for (var u in l) n[u] = l[u];
		return n;
	}
	function g$2(n) {
		n && n.parentNode && n.parentNode.removeChild(n);
	}
	function _$2(l, u, t) {
		var i, r, o, e = {};
		for (o in u) "key" == o ? i = u[o] : "ref" == o ? r = u[o] : e[o] = u[o];
		if (arguments.length > 2 && (e.children = arguments.length > 3 ? n$1.call(arguments, 2) : t), "function" == typeof l && null != l.defaultProps) for (o in l.defaultProps) void 0 === e[o] && (e[o] = l.defaultProps[o]);
		return m$3(l, e, i, r, null);
	}
	function m$3(n, t, i, r, o) {
		var e = {
			type: n,
			props: t,
			key: i,
			ref: r,
			__k: null,
			__: null,
			__b: 0,
			__e: null,
			__c: null,
			constructor: void 0,
			__v: null == o ? ++u$3 : o,
			__i: -1,
			__u: 0
		};
		return null == o && null != l$3.vnode && l$3.vnode(e), e;
	}
	function k$2(n) {
		return n.children;
	}
	function x$2(n, l) {
		this.props = n, this.context = l;
	}
	function S$1(n, l) {
		if (null == l) return n.__ ? S$1(n.__, n.__i + 1) : null;
		for (var u; l < n.__k.length; l++) if (null != (u = n.__k[l]) && null != u.__e) return u.__e;
		return "function" == typeof n.type ? S$1(n) : null;
	}
	function C$2(n) {
		if (n.__P && n.__d) {
			var u = n.__v, t = u.__e, i = [], r = [], o = w$3({}, u);
			o.__v = u.__v + 1, l$3.vnode && l$3.vnode(o), z$1(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? S$1(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, V(i, o, r), u.__e = u.__ = null, o.__e != t && M(o);
		}
	}
	function M(n) {
		if (null != (n = n.__) && null != n.__c) return n.__e = n.__c.base = null, n.__k.some(function(l) {
			if (null != l && null != l.__e) return n.__e = n.__c.base = l.__e;
		}), M(n);
	}
	function $(n) {
		(!n.__d && (n.__d = !0) && i$3.push(n) && !I.__r++ || r$2 != l$3.debounceRendering) && ((r$2 = l$3.debounceRendering) || o$3)(I);
	}
	function I() {
		try {
			for (var n, l = 1; i$3.length;) i$3.length > l && i$3.sort(e$2), n = i$3.shift(), l = i$3.length, C$2(n);
		} finally {
			i$3.length = I.__r = 0;
		}
	}
	function P(n, l, u, t, i, r, o, e, f, c, s) {
		var a, h, y, d, w, g, _, m = t && t.__k || v$2, b = l.length;
		for (f = A$1(u, l, m, f, b), a = 0; a < b; a++) null != (y = u.__k[a]) && (h = -1 != y.__i && m[y.__i] || p$3, y.__i = a, g = z$1(n, y, h, i, r, o, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && D$1(h.ref, null, y), s.push(y.ref, y.__c || d, y)), null == w && null != d && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = H(y, f, n, _) : "function" == typeof y.type && void 0 !== g ? f = g : d && (f = d.nextSibling), y.__u &= -7);
		return u.__e = w, f;
	}
	function A$1(n, l, u, t, i) {
		var r, o, e, f, c, s = u.length, a = s, h = 0;
		for (n.__k = new Array(i), r = 0; r < i; r++) null != (o = l[r]) && "boolean" != typeof o && "function" != typeof o ? ("string" == typeof o || "number" == typeof o || "bigint" == typeof o || o.constructor == String ? o = n.__k[r] = m$3(null, o, null, null, null) : d$3(o) ? o = n.__k[r] = m$3(k$2, { children: o }, null, null, null) : void 0 === o.constructor && o.__b > 0 ? o = n.__k[r] = m$3(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : n.__k[r] = o, f = r + h, o.__ = n, o.__b = n.__b + 1, e = null, -1 != (c = o.__i = T$1(o, u, f, a)) && (a--, (e = u[c]) && (e.__u |= 2)), null == e || null == e.__v ? (-1 == c && (i > s ? h-- : i < s && h++), "function" != typeof o.type && (o.__u |= 4)) : c != f && (c == f - 1 ? h-- : c == f + 1 ? h++ : (c > f ? h-- : h++, o.__u |= 4))) : n.__k[r] = null;
		if (a) for (r = 0; r < s; r++) null != (e = u[r]) && 0 == (2 & e.__u) && (e.__e == t && (t = S$1(e)), E$1(e, e));
		return t;
	}
	function H(n, l, u, t) {
		var i, r;
		if ("function" == typeof n.type) {
			for (i = n.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = n, l = H(i[r], l, u, t));
			return l;
		}
		n.__e != l && (t && (l && n.type && !l.parentNode && (l = S$1(n)), u.insertBefore(n.__e, l || null)), l = n.__e);
		do
			l = l && l.nextSibling;
		while (null != l && 8 == l.nodeType);
		return l;
	}
	function T$1(n, l, u, t) {
		var i, r, o, e = n.key, f = n.type, c = l[u], s = null != c && 0 == (2 & c.__u);
		if (null === c && null == e || s && e == c.key && f == c.type) return u;
		if (t > (s ? 1 : 0)) {
			for (i = u - 1, r = u + 1; i >= 0 || r < l.length;) if (null != (c = l[o = i >= 0 ? i-- : r++]) && 0 == (2 & c.__u) && e == c.key && f == c.type) return o;
		}
		return -1;
	}
	function j$1(n, l, u) {
		"-" == l[0] ? n.setProperty(l, null == u ? "" : u) : n[l] = null == u ? "" : "number" != typeof u || y$3.test(l) ? u : u + "px";
	}
	function F$1(n, l, u, t, i) {
		var r, o;
		n: if ("style" == l) if ("string" == typeof u) n.style.cssText = u;
		else {
			if ("string" == typeof t && (n.style.cssText = t = ""), t) for (l in t) u && l in u || j$1(n.style, l, "");
			if (u) for (l in u) t && u[l] == t[l] || j$1(n.style, l, u[l]);
		}
		else if ("o" == l[0] && "n" == l[1]) r = l != (l = l.replace(f$3, "$1")), o = l.toLowerCase(), l = o in n || "onFocusOut" == l || "onFocusIn" == l ? o.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + r] = u, u ? t ? u.u = t.u : (u.u = c$2, n.addEventListener(l, r ? a$2 : s$2, r)) : n.removeEventListener(l, r ? a$2 : s$2, r);
		else {
			if ("http://www.w3.org/2000/svg" == i) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
			else if ("width" != l && "height" != l && "href" != l && "list" != l && "form" != l && "tabIndex" != l && "download" != l && "rowSpan" != l && "colSpan" != l && "role" != l && "popover" != l && l in n) try {
				n[l] = null == u ? "" : u;
				break n;
			} catch (n) {}
			"function" == typeof u || (null == u || !1 === u && "-" != l[4] ? n.removeAttribute(l) : n.setAttribute(l, "popover" == l && 1 == u ? "" : u));
		}
	}
	function O(n) {
		return function(u) {
			if (this.l) {
				var t = this.l[u.type + n];
				if (null == u.t) u.t = c$2++;
				else if (u.t < t.u) return;
				return t(l$3.event ? l$3.event(u) : u);
			}
		};
	}
	function z$1(n, u, t, i, r, o, e, f, c, s) {
		var a, h, p, y, _, m, b, S, C, M, $, I, A, H, L, T = u.type;
		if (void 0 !== u.constructor) return null;
		128 & t.__u && (c = !!(32 & t.__u), o = [f = u.__e = t.__e]), (a = l$3.__b) && a(u);
		n: if ("function" == typeof T) try {
			if (S = u.props, C = T.prototype && T.prototype.render, M = (a = T.contextType) && i[a.__c], $ = a ? M ? M.props.value : a.__ : i, t.__c ? b = (h = u.__c = t.__c).__ = h.__E : (C ? u.__c = h = new T(S, $) : (u.__c = h = new x$2(S, $), h.constructor = T, h.render = G), M && M.sub(h), h.state || (h.state = {}), h.__n = i, p = h.__d = !0, h.__h = [], h._sb = []), C && null == h.__s && (h.__s = h.state), C && null != T.getDerivedStateFromProps && (h.__s == h.state && (h.__s = w$3({}, h.__s)), w$3(h.__s, T.getDerivedStateFromProps(S, h.__s))), y = h.props, _ = h.state, h.__v = u, p) C && null == T.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), C && null != h.componentDidMount && h.__h.push(h.componentDidMount);
			else {
				if (C && null == T.getDerivedStateFromProps && S !== y && null != h.componentWillReceiveProps && h.componentWillReceiveProps(S, $), u.__v == t.__v || !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(S, h.__s, $)) {
					u.__v != t.__v && (h.props = S, h.state = h.__s, h.__d = !1), u.__e = t.__e, u.__k = t.__k, u.__k.some(function(n) {
						n && (n.__ = u);
					}), v$2.push.apply(h.__h, h._sb), h._sb = [], h.__h.length && e.push(h);
					break n;
				}
				null != h.componentWillUpdate && h.componentWillUpdate(S, h.__s, $), C && null != h.componentDidUpdate && h.__h.push(function() {
					h.componentDidUpdate(y, _, m);
				});
			}
			if (h.context = $, h.props = S, h.__P = n, h.__e = !1, I = l$3.__r, A = 0, C) h.state = h.__s, h.__d = !1, I && I(u), a = h.render(h.props, h.state, h.context), v$2.push.apply(h.__h, h._sb), h._sb = [];
			else do
				h.__d = !1, I && I(u), a = h.render(h.props, h.state, h.context), h.state = h.__s;
			while (h.__d && ++A < 25);
			h.state = h.__s, null != h.getChildContext && (i = w$3(w$3({}, i), h.getChildContext())), C && !p && null != h.getSnapshotBeforeUpdate && (m = h.getSnapshotBeforeUpdate(y, _)), H = null != a && a.type === k$2 && null == a.key ? q$2(a.props.children) : a, f = P(n, d$3(H) ? H : [H], u, t, i, r, o, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), b && (h.__E = h.__ = null);
		} catch (n) {
			if (u.__v = null, c || null != o) if (n.then) {
				for (u.__u |= c ? 160 : 128; f && 8 == f.nodeType && f.nextSibling;) f = f.nextSibling;
				o[o.indexOf(f)] = null, u.__e = f;
			} else {
				for (L = o.length; L--;) g$2(o[L]);
				N(u);
			}
			else u.__e = t.__e, u.__k = t.__k, n.then || N(u);
			l$3.__e(n, u, t);
		}
		else null == o && u.__v == t.__v ? (u.__k = t.__k, u.__e = t.__e) : f = u.__e = B$1(t.__e, u, t, i, r, o, e, c, s);
		return (a = l$3.diffed) && a(u), 128 & u.__u ? void 0 : f;
	}
	function N(n) {
		n && (n.__c && (n.__c.__e = !0), n.__k && n.__k.some(N));
	}
	function V(n, u, t) {
		for (var i = 0; i < t.length; i++) D$1(t[i], t[++i], t[++i]);
		l$3.__c && l$3.__c(u, n), n.some(function(u) {
			try {
				n = u.__h, u.__h = [], n.some(function(n) {
					n.call(u);
				});
			} catch (n) {
				l$3.__e(n, u.__v);
			}
		});
	}
	function q$2(n) {
		return "object" != typeof n || null == n || n.__b > 0 ? n : d$3(n) ? n.map(q$2) : w$3({}, n);
	}
	function B$1(u, t, i, r, o, e, f, c, s) {
		var a, h, v, y, w, _, m, b = i.props || p$3, k = t.props, x = t.type;
		if ("svg" == x ? o = "http://www.w3.org/2000/svg" : "math" == x ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), null != e) {
			for (a = 0; a < e.length; a++) if ((w = e[a]) && "setAttribute" in w == !!x && (x ? w.localName == x : 3 == w.nodeType)) {
				u = w, e[a] = null;
				break;
			}
		}
		if (null == u) {
			if (null == x) return document.createTextNode(k);
			u = document.createElementNS(o, x, k.is && k), c && (l$3.__m && l$3.__m(t, e), c = !1), e = null;
		}
		if (null == x) b === k || c && u.data == k || (u.data = k);
		else {
			if (e = e && n$1.call(u.childNodes), !c && null != e) for (b = {}, a = 0; a < u.attributes.length; a++) b[(w = u.attributes[a]).name] = w.value;
			for (a in b) w = b[a], "dangerouslySetInnerHTML" == a ? v = w : "children" == a || a in k || "value" == a && "defaultValue" in k || "checked" == a && "defaultChecked" in k || F$1(u, a, null, w, o);
			for (a in k) w = k[a], "children" == a ? y = w : "dangerouslySetInnerHTML" == a ? h = w : "value" == a ? _ = w : "checked" == a ? m = w : c && "function" != typeof w || b[a] === w || F$1(u, a, w, b[a], o);
			if (h) c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];
			else if (v && (u.innerHTML = ""), P("template" == t.type ? u.content : u, d$3(y) ? y : [y], t, i, r, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : o, e, f, e ? e[0] : i.__k && S$1(i, 0), c, s), null != e) for (a = e.length; a--;) g$2(e[a]);
			c || (a = "value", "progress" == x && null == _ ? u.removeAttribute("value") : null != _ && (_ !== u[a] || "progress" == x && !_ || "option" == x && _ != b[a]) && F$1(u, a, _, b[a], o), a = "checked", null != m && m != u[a] && F$1(u, a, m, b[a], o));
		}
		return u;
	}
	function D$1(n, u, t) {
		try {
			if ("function" == typeof n) {
				var i = "function" == typeof n.__u;
				i && n.__u(), i && null == u || (n.__u = n(u));
			} else n.current = u;
		} catch (n) {
			l$3.__e(n, t);
		}
	}
	function E$1(n, u, t) {
		var i, r;
		if (l$3.unmount && l$3.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || D$1(i, null, u)), null != (i = n.__c)) {
			if (i.componentWillUnmount) try {
				i.componentWillUnmount();
			} catch (n) {
				l$3.__e(n, u);
			}
			i.base = i.__P = null;
		}
		if (i = n.__k) for (r = 0; r < i.length; r++) i[r] && E$1(i[r], u, t || "function" != typeof n.type);
		t || g$2(n.__e), n.__c = n.__ = n.__e = void 0;
	}
	function G(n, l, u) {
		return this.constructor(n, u);
	}
	function J(u, t, i) {
		var r, o, e, f;
		t == document && (t = document.documentElement), l$3.__ && l$3.__(u, t), o = (r = "function" == typeof i) ? null : i && i.__k || t.__k, e = [], f = [], z$1(t, u = (!r && i || t).__k = _$2(k$2, null, [u]), o || p$3, p$3, t.namespaceURI, !r && i ? [i] : o ? null : t.firstChild ? n$1.call(t.childNodes) : null, e, !r && i ? i : o ? o.__e : t.firstChild, r, f), V(e, u, f);
	}
	n$1 = v$2.slice, l$3 = { __e: function(n, l, u, t) {
		for (var i, r, o; l = l.__;) if ((i = l.__c) && !i.__) try {
			if ((r = i.constructor) && null != r.getDerivedStateFromError && (i.setState(r.getDerivedStateFromError(n)), o = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), o = i.__d), o) return i.__E = i;
		} catch (l) {
			n = l;
		}
		throw n;
	} }, u$3 = 0, t$2 = function(n) {
		return null != n && void 0 === n.constructor;
	}, x$2.prototype.setState = function(n, l) {
		var u = null != this.__s && this.__s != this.state ? this.__s : this.__s = w$3({}, this.state);
		"function" == typeof n && (n = n(w$3({}, u), this.props)), n && w$3(u, n), null != n && this.__v && (l && this._sb.push(l), $(this));
	}, x$2.prototype.forceUpdate = function(n) {
		this.__v && (this.__e = !0, n && this.__h.push(n), $(this));
	}, x$2.prototype.render = k$2, i$3 = [], o$3 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$2 = function(n, l) {
		return n.__v.__b - l.__v.__b;
	}, I.__r = 0, f$3 = /(PointerCapture)$|Capture$/i, c$2 = 0, s$2 = O(!1), a$2 = O(!0);
	var t$1, r$1, u$2, i$2, o$2 = 0, f$2 = [], c$1 = l$3, e$1 = c$1.__b, a$1 = c$1.__r, v$1 = c$1.diffed, l$2 = c$1.__c, m$2 = c$1.unmount, s$1 = c$1.__;
	function p$2(n, t) {
		c$1.__h && c$1.__h(r$1, n, o$2 || t), o$2 = 0;
		var u = r$1.__H || (r$1.__H = {
			__: [],
			__h: []
		});
		return n >= u.__.length && u.__.push({}), u.__[n];
	}
	function d$2(n) {
		return o$2 = 1, h$2(D, n);
	}
	function h$2(n, u, i) {
		var o = p$2(t$1++, 2);
		if (o.t = n, !o.__c && (o.__ = [i ? i(u) : D(void 0, u), function(n) {
			var t = o.__N ? o.__N[0] : o.__[0], r = o.t(t, n);
			t !== r && (o.__N = [r, o.__[1]], o.__c.setState({}));
		}], o.__c = r$1, !r$1.__f)) {
			var f = function(n, t, r) {
				if (!o.__c.__H) return !0;
				var u = o.__c.__H.__.filter(function(n) {
					return n.__c;
				});
				if (u.every(function(n) {
					return !n.__N;
				})) return !c || c.call(this, n, t, r);
				var i = o.__c.props !== n;
				return u.some(function(n) {
					if (n.__N) {
						var t = n.__[0];
						n.__ = n.__N, n.__N = void 0, t !== n.__[0] && (i = !0);
					}
				}), c && c.call(this, n, t, r) || i;
			};
			r$1.__f = !0;
			var c = r$1.shouldComponentUpdate, e = r$1.componentWillUpdate;
			r$1.componentWillUpdate = function(n, t, r) {
				if (this.__e) {
					var u = c;
					c = void 0, f(n, t, r), c = u;
				}
				e && e.call(this, n, t, r);
			}, r$1.shouldComponentUpdate = f;
		}
		return o.__N || o.__;
	}
	function y$2(n, u) {
		var i = p$2(t$1++, 3);
		!c$1.__s && C$1(i.__H, u) && (i.__ = n, i.u = u, r$1.__H.__h.push(i));
	}
	function A(n) {
		return o$2 = 5, T(function() {
			return { current: n };
		}, []);
	}
	function T(n, r) {
		var u = p$2(t$1++, 7);
		return C$1(u.__H, r) && (u.__ = n(), u.__H = r, u.__h = n), u.__;
	}
	function q$1(n, t) {
		return o$2 = 8, T(function() {
			return n;
		}, t);
	}
	function j() {
		for (var n; n = f$2.shift();) {
			var t = n.__H;
			if (n.__P && t) try {
				t.__h.some(z), t.__h.some(B), t.__h = [];
			} catch (r) {
				t.__h = [], c$1.__e(r, n.__v);
			}
		}
	}
	c$1.__b = function(n) {
		r$1 = null, e$1 && e$1(n);
	}, c$1.__ = function(n, t) {
		n && t.__k && t.__k.__m && (n.__m = t.__k.__m), s$1 && s$1(n, t);
	}, c$1.__r = function(n) {
		a$1 && a$1(n), t$1 = 0;
		var i = (r$1 = n.__c).__H;
		i && (u$2 === r$1 ? (i.__h = [], r$1.__h = [], i.__.some(function(n) {
			n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
		})) : (i.__h.some(z), i.__h.some(B), i.__h = [], t$1 = 0)), u$2 = r$1;
	}, c$1.diffed = function(n) {
		v$1 && v$1(n);
		var t = n.__c;
		t && t.__H && (t.__H.__h.length && (1 !== f$2.push(t) && i$2 === c$1.requestAnimationFrame || ((i$2 = c$1.requestAnimationFrame) || w$2)(j)), t.__H.__.some(function(n) {
			n.u && (n.__H = n.u), n.u = void 0;
		})), u$2 = r$1 = null;
	}, c$1.__c = function(n, t) {
		t.some(function(n) {
			try {
				n.__h.some(z), n.__h = n.__h.filter(function(n) {
					return !n.__ || B(n);
				});
			} catch (r) {
				t.some(function(n) {
					n.__h && (n.__h = []);
				}), t = [], c$1.__e(r, n.__v);
			}
		}), l$2 && l$2(n, t);
	}, c$1.unmount = function(n) {
		m$2 && m$2(n);
		var t, r = n.__c;
		r && r.__H && (r.__H.__.some(function(n) {
			try {
				z(n);
			} catch (n) {
				t = n;
			}
		}), r.__H = void 0, t && c$1.__e(t, r.__v));
	};
	var k$1 = "function" == typeof requestAnimationFrame;
	function w$2(n) {
		var t, r = function() {
			clearTimeout(u), k$1 && cancelAnimationFrame(t), setTimeout(n);
		}, u = setTimeout(r, 35);
		k$1 && (t = requestAnimationFrame(r));
	}
	function z(n) {
		var t = r$1, u = n.__c;
		"function" == typeof u && (n.__c = void 0, u()), r$1 = t;
	}
	function B(n) {
		var t = r$1;
		n.__c = n.__(), r$1 = t;
	}
	function C$1(n, t) {
		return !n || n.length !== t.length || t.some(function(t, r) {
			return t !== n[r];
		});
	}
	function D(n, t) {
		return "function" == typeof t ? t(n) : t;
	}
	var i$1 = Symbol.for("preact-signals");
	function t() {
		if (!(s > 1)) {
			var i, t = !1;
			(function() {
				var i = d$1;
				d$1 = void 0;
				while (void 0 !== i) {
					if (i.S.v === i.v) i.S.i = i.i;
					i = i.o;
				}
			})();
			while (void 0 !== h$1) {
				var n = h$1;
				h$1 = void 0;
				v++;
				while (void 0 !== n) {
					var r = n.u;
					n.u = void 0;
					n.f &= -3;
					if (!(8 & n.f) && w$1(n)) try {
						n.c();
					} catch (n) {
						if (!t) {
							i = n;
							t = !0;
						}
					}
					n = r;
				}
			}
			v = 0;
			s--;
			if (t) throw i;
		} else s--;
	}
	function n(i) {
		if (s > 0) return i();
		e = ++u$1;
		s++;
		try {
			return i();
		} finally {
			t();
		}
	}
	var r = void 0;
	function o$1(i) {
		var t = r;
		r = void 0;
		try {
			return i();
		} finally {
			r = t;
		}
	}
	var f$1, h$1 = void 0, s = 0, v = 0, u$1 = 0, e = 0, d$1 = void 0, c = 0;
	function a(i) {
		if (void 0 !== r) {
			var t = i.n;
			if (void 0 === t || t.t !== r) {
				t = {
					i: 0,
					S: i,
					p: r.s,
					n: void 0,
					t: r,
					e: void 0,
					x: void 0,
					r: t
				};
				if (void 0 !== r.s) r.s.n = t;
				r.s = t;
				i.n = t;
				if (32 & r.f) i.S(t);
				return t;
			} else if (-1 === t.i) {
				t.i = 0;
				if (void 0 !== t.n) {
					t.n.p = t.p;
					if (void 0 !== t.p) t.p.n = t.n;
					t.p = r.s;
					t.n = void 0;
					r.s.n = t;
					r.s = t;
				}
				return t;
			}
		}
	}
	function l$1(i, t) {
		this.v = i;
		this.i = 0;
		this.n = void 0;
		this.t = void 0;
		this.l = 0;
		this.W = null == t ? void 0 : t.watched;
		this.Z = null == t ? void 0 : t.unwatched;
		this.name = null == t ? void 0 : t.name;
	}
	l$1.prototype.brand = i$1;
	l$1.prototype.h = function() {
		return !0;
	};
	l$1.prototype.S = function(i) {
		var t = this, n = this.t;
		if (n !== i && void 0 === i.e) {
			i.x = n;
			this.t = i;
			if (void 0 !== n) n.e = i;
			else o$1(function() {
				var i;
				null == (i = t.W) || i.call(t);
			});
		}
	};
	l$1.prototype.U = function(i) {
		var t = this;
		if (void 0 !== this.t) {
			var n = i.e, r = i.x;
			if (void 0 !== n) {
				n.x = r;
				i.e = void 0;
			}
			if (void 0 !== r) {
				r.e = n;
				i.x = void 0;
			}
			if (i === this.t) {
				this.t = r;
				if (void 0 === r) o$1(function() {
					var i;
					null == (i = t.Z) || i.call(t);
				});
			}
		}
	};
	l$1.prototype.subscribe = function(i) {
		var t = this;
		return C(function() {
			var n = t.value, o = r;
			r = void 0;
			try {
				i(n);
			} finally {
				r = o;
			}
		}, { name: "sub" });
	};
	l$1.prototype.valueOf = function() {
		return this.value;
	};
	l$1.prototype.toString = function() {
		return this.value + "";
	};
	l$1.prototype.toJSON = function() {
		return this.value;
	};
	l$1.prototype.peek = function() {
		var i = r;
		r = void 0;
		try {
			return this.value;
		} finally {
			r = i;
		}
	};
	Object.defineProperty(l$1.prototype, "value", {
		get: function() {
			var i = a(this);
			if (void 0 !== i) i.i = this.i;
			return this.v;
		},
		set: function(i) {
			if (i !== this.v) {
				if (v > 100) throw new Error("Cycle detected");
				(function(i) {
					if (0 !== s && 0 === v) {
						if (i.l !== e) {
							i.l = e;
							d$1 = {
								S: i,
								v: i.v,
								i: i.i,
								o: d$1
							};
						}
					}
				})(this);
				this.v = i;
				this.i++;
				c++;
				s++;
				try {
					for (var n = this.t; void 0 !== n; n = n.x) n.t.N();
				} finally {
					t();
				}
			}
		}
	});
	function y$1(i, t) {
		return new l$1(i, t);
	}
	function w$1(i) {
		for (var t = i.s; void 0 !== t; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
		return !1;
	}
	function _$1(i) {
		for (var t = i.s; void 0 !== t; t = t.n) {
			var n = t.S.n;
			if (void 0 !== n) t.r = n;
			t.S.n = t;
			t.i = -1;
			if (void 0 === t.n) {
				i.s = t;
				break;
			}
		}
	}
	function b$1(i) {
		var t = i.s, n = void 0;
		while (void 0 !== t) {
			var r = t.p;
			if (-1 === t.i) {
				t.S.U(t);
				if (void 0 !== r) r.n = t.n;
				if (void 0 !== t.n) t.n.p = r;
			} else n = t;
			t.S.n = t.r;
			if (void 0 !== t.r) t.r = void 0;
			t = r;
		}
		i.s = n;
	}
	function p$1(i, t) {
		l$1.call(this, void 0);
		this.x = i;
		this.s = void 0;
		this.g = c - 1;
		this.f = 4;
		this.W = null == t ? void 0 : t.watched;
		this.Z = null == t ? void 0 : t.unwatched;
		this.name = null == t ? void 0 : t.name;
	}
	p$1.prototype = new l$1();
	p$1.prototype.h = function() {
		this.f &= -3;
		if (1 & this.f) return !1;
		if (32 == (36 & this.f)) return !0;
		this.f &= -5;
		if (this.g === c) return !0;
		this.g = c;
		this.f |= 1;
		if (this.i > 0 && !w$1(this)) {
			this.f &= -2;
			return !0;
		}
		var i = r;
		try {
			_$1(this);
			r = this;
			var t = this.x();
			if (16 & this.f || this.v !== t || 0 === this.i) {
				this.v = t;
				this.f &= -17;
				this.i++;
			}
		} catch (i) {
			this.v = i;
			this.f |= 16;
			this.i++;
		}
		r = i;
		b$1(this);
		this.f &= -2;
		return !0;
	};
	p$1.prototype.S = function(i) {
		if (void 0 === this.t) {
			this.f |= 36;
			for (var t = this.s; void 0 !== t; t = t.n) t.S.S(t);
		}
		l$1.prototype.S.call(this, i);
	};
	p$1.prototype.U = function(i) {
		if (void 0 !== this.t) {
			l$1.prototype.U.call(this, i);
			if (void 0 === this.t) {
				this.f &= -33;
				for (var t = this.s; void 0 !== t; t = t.n) t.S.U(t);
			}
		}
	};
	p$1.prototype.N = function() {
		if (!(2 & this.f)) {
			this.f |= 6;
			for (var i = this.t; void 0 !== i; i = i.x) i.t.N();
		}
	};
	Object.defineProperty(p$1.prototype, "value", { get: function() {
		if (1 & this.f) throw new Error("Cycle detected");
		var i = a(this);
		this.h();
		if (void 0 !== i) i.i = this.i;
		if (16 & this.f) throw this.v;
		return this.v;
	} });
	function g$1(i, t) {
		return new p$1(i, t);
	}
	function S(i) {
		var n = i.m;
		i.m = void 0;
		if ("function" == typeof n) {
			s++;
			var o = r;
			r = void 0;
			try {
				n();
			} catch (t) {
				i.f &= -2;
				i.f |= 8;
				m$1(i);
				throw t;
			} finally {
				r = o;
				t();
			}
		}
	}
	function m$1(i) {
		for (var t = i.s; void 0 !== t; t = t.n) t.S.U(t);
		i.x = void 0;
		i.s = void 0;
		S(i);
	}
	function x$1(i) {
		if (r !== this) throw new Error("Out-of-order effect");
		b$1(this);
		r = i;
		this.f &= -2;
		if (8 & this.f) m$1(this);
		t();
	}
	function E(i, t) {
		this.x = i;
		this.m = void 0;
		this.s = void 0;
		this.u = void 0;
		this.f = 32;
		this.name = null == t ? void 0 : t.name;
		if (f$1) f$1.push(this);
	}
	E.prototype.c = function() {
		var i = this.S();
		try {
			if (8 & this.f) return;
			if (void 0 === this.x) return;
			var t = this.x();
			if ("function" == typeof t) this.m = t;
		} finally {
			i();
		}
	};
	E.prototype.S = function() {
		if (1 & this.f) throw new Error("Cycle detected");
		this.f |= 1;
		this.f &= -9;
		S(this);
		_$1(this);
		s++;
		var i = r;
		r = this;
		return x$1.bind(this, i);
	};
	E.prototype.N = function() {
		if (!(2 & this.f)) {
			this.f |= 2;
			this.u = h$1;
			h$1 = this;
		}
	};
	E.prototype.d = function() {
		this.f |= 8;
		if (!(1 & this.f)) m$1(this);
	};
	E.prototype.dispose = function() {
		this.d();
	};
	function C(i, t) {
		var n = new E(i, t);
		try {
			n.c();
		} catch (i) {
			n.d();
			throw i;
		}
		var r = n.d.bind(n);
		r[Symbol.dispose] = r;
		return r;
	}
	var l, h, p = "undefined" != typeof window && !!window.__PREACT_SIGNALS_DEVTOOLS__, _ = [];
	C(function() {
		l = this.N;
	})();
	function g(i, r) {
		l$3[i] = r.bind(null, l$3[i] || function() {});
	}
	function b(i) {
		if (h) {
			var n = h;
			h = void 0;
			n();
		}
		h = i && i.S();
	}
	function y(i) {
		var n = this, t = i.data, e = useSignal(t);
		e.value = t;
		var f = T(function() {
			var i = n, t = n.__v;
			while (t = t.__) if (t.__c) {
				t.__c.__$f |= 4;
				break;
			}
			var o = g$1(function() {
				var i = e.value.value;
				return 0 === i ? 0 : !0 === i ? "" : i || "";
			}), f = g$1(function() {
				return !Array.isArray(o.value) && !t$2(o.value);
			}), a = C(function() {
				this.N = F;
				if (f.value) {
					var n = o.value;
					if (i.__v && i.__v.__e && 3 === i.__v.__e.nodeType) i.__v.__e.data = n;
				}
			}), v = n.__$u.d;
			n.__$u.d = function() {
				a();
				v.call(this);
			};
			return [f, o];
		}, []), a = f[0], v = f[1];
		return a.value ? v.peek() : v.value;
	}
	y.displayName = "ReactiveTextNode";
	Object.defineProperties(l$1.prototype, {
		constructor: {
			configurable: !0,
			value: void 0
		},
		type: {
			configurable: !0,
			value: y
		},
		props: {
			configurable: !0,
			get: function() {
				var i = this;
				return { data: { get value() {
					return i.value;
				} } };
			}
		},
		__b: {
			configurable: !0,
			value: 1
		}
	});
	g("__b", function(i, n) {
		if ("string" == typeof n.type) {
			var r, t = n.props;
			for (var o in t) if ("children" !== o) {
				var e = t[o];
				if (e instanceof l$1) {
					if (!r) n.__np = r = {};
					r[o] = e;
					t[o] = e.peek();
				}
			}
		}
		i(n);
	});
	g("__r", function(i, n) {
		i(n);
		if (n.type !== k$2) {
			b();
			var r, o = n.__c;
			if (o) {
				o.__$f &= -2;
				if (void 0 === (r = o.__$u)) o.__$u = r = function(i, n) {
					var r;
					C(function() {
						r = this;
					}, { name: n });
					r.c = i;
					return r;
				}(function() {
					var i;
					if (p) null == (i = r.y) || i.call(r);
					o.__$f |= 1;
					o.setState({});
				}, "function" == typeof n.type ? n.type.displayName || n.type.name : "");
			}
			b(r);
		}
	});
	g("__e", function(i, n, r, t) {
		b();
		i(n, r, t);
	});
	g("diffed", function(i, n) {
		b();
		var r;
		if ("string" == typeof n.type && (r = n.__e)) {
			var t = n.__np, o = n.props;
			if (t) {
				var e = r.U;
				if (e) for (var f in e) {
					var u = e[f];
					if (void 0 !== u && !(f in t)) {
						u.d();
						e[f] = void 0;
					}
				}
				else {
					e = {};
					r.U = e;
				}
				for (var a in t) {
					var c = e[a], v = t[a];
					if (void 0 === c) {
						c = w(r, a, v);
						e[a] = c;
					} else c.o(v, o);
				}
				for (var s in t) o[s] = t[s];
			}
		}
		i(n);
	});
	function w(i, n, r, t) {
		var o = n in i && void 0 === i.ownerSVGElement, e = y$1(r), f = r.peek();
		return {
			o: function(i, n) {
				e.value = i;
				f = i.peek();
			},
			d: C(function() {
				this.N = F;
				var r = e.value.value;
				if (f !== r) {
					f = void 0;
					if (o) i[n] = r;
					else if (null != r && (!1 !== r || "-" === n[4])) i.setAttribute(n, r);
					else i.removeAttribute(n);
				} else f = void 0;
			})
		};
	}
	g("unmount", function(i, n) {
		if ("string" == typeof n.type) {
			var r = n.__e;
			if (r) {
				var t = r.U;
				if (t) {
					r.U = void 0;
					for (var o in t) {
						var e = t[o];
						if (e) e.d();
					}
				}
			}
			n.__np = void 0;
		} else {
			var f = n.__c;
			if (f) {
				var u = f.__$u;
				if (u) {
					f.__$u = void 0;
					u.d();
				}
			}
		}
		i(n);
	});
	g("__h", function(i, n, r, t) {
		if (t < 3 || 9 === t) n.__$f |= 2;
		i(n, r, t);
	});
	x$2.prototype.shouldComponentUpdate = function(i, n) {
		if (this.__R) return !0;
		var r = this.__$u, t = r && void 0 !== r.s;
		for (var o in n) return !0;
		if (this.__f || "boolean" == typeof this.u && !0 === this.u) {
			var e = 2 & this.__$f;
			if (!(t || e || 4 & this.__$f)) return !0;
			if (1 & this.__$f) return !0;
		} else {
			if (!(t || 4 & this.__$f)) return !0;
			if (3 & this.__$f) return !0;
		}
		for (var f in i) if ("__source" !== f && i[f] !== this.props[f]) return !0;
		for (var u in this.props) if (!(u in i)) return !0;
		return !1;
	};
	function useSignal(i, n) {
		return T(function() {
			return y$1(i, n);
		}, []);
	}
	var q = function(i) {
		queueMicrotask(function() {
			queueMicrotask(i);
		});
	};
	function x() {
		n(function() {
			var i;
			while (i = _.shift()) l.call(i);
		});
	}
	function F() {
		if (1 === _.push(this)) (l$3.requestAnimationFrame || q)(x);
	}
var VERSION = "1.12.1";
var STORAGE_KEY$1 = "@mwm/character-data";
var WS_ENDPOINTS = ["api.milkywayidle.com/ws", "api-test.milkywayidle.com/ws"];
var MARKET_API = "https://milkyway.market/api";
var EVENTS = {
		REQUEST: "mwi-request-character-data",
		RESPONSE: "mwi-character-data-response",
		UPDATED: "mwi-character-data-updated",
		ADDON_READY: "mwm-addon-ready",
		PING: "mwm-ping",
		PONG: "mwm-pong"
	};
var isGameSite = location.hostname.includes("milkywayidle.com");
var isMarketSite = location.hostname.includes("milkyway.market") || location.hostname.includes("localhost"), f = 0;
	Array.isArray;
	function u(e, t, n, o, i, u) {
		t || (t = {});
		var a, c, p = t;
		if ("ref" in p) for (c in p = {}, t) "ref" == c ? a = t[c] : p[c] = t[c];
		var l = {
			type: e,
			props: p,
			key: n,
			ref: a,
			__k: null,
			__: null,
			__b: 0,
			__e: null,
			__c: null,
			constructor: void 0,
			__v: --f,
			__i: -1,
			__u: 0,
			__source: i,
			__self: u
		};
		if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
		return l$3.vnode && l$3.vnode(l), l;
	}
	var GREASYFORK_URL = "https://greasyfork.org/en/scripts/540058-mwi-market-addon";
	function UpdateBanner({ expectedVersion, onDismiss }) {
		return u("div", {
			class: "mwm-root mwm:fixed mwm:top-0 mwm:left-0 mwm:right-0 mwm:z-[999999] mwm:bg-gradient-to-r mwm:from-[rgba(220,38,38,0.95)] mwm:to-[rgba(185,28,28,0.95)] mwm:shadow-[0_4px_20px_rgba(0,0,0,0.3),0_0_40px_rgba(220,38,38,0.2)] mwm:animate-[mwm-slide-down_0.3s_ease-out]",
			children: u("div", {
				class: "mwm:flex mwm:items-center mwm:justify-center mwm:gap-3 mwm:px-4 mwm:py-2.5 mwm:max-w-full",
				children: [
u("span", {
						class: "mwm:text-lg mwm:shrink-0",
						children: "⚠️"
					}),
u("span", {
						class: "mwm:font-mono mwm:text-xs mwm:font-medium mwm:text-white mwm:tracking-[0.02em]",
						children: [
							"MWM Addon update required: v",
							VERSION,
							" → v",
							expectedVersion
						]
					}),
u("a", {
						href: GREASYFORK_URL,
						target: "_blank",
						rel: "noopener",
						onClick: onDismiss,
						class: "mwm:inline-flex mwm:items-center mwm:gap-1 mwm:px-3.5 mwm:py-1.5 mwm:bg-[rgba(255,255,255,0.2)] mwm:border mwm:border-[rgba(255,255,255,0.3)] mwm:rounded mwm:text-white mwm:font-mono mwm:text-[11px] mwm:font-semibold mwm:no-underline mwm:uppercase mwm:tracking-[0.05em] mwm:transition-all mwm:shrink-0 mwm:hover:bg-[rgba(255,255,255,0.3)] mwm:hover:border-[rgba(255,255,255,0.5)] mwm:hover:-translate-y-px",
						children: "Update Now"
					}),
u("button", {
						onClick: onDismiss,
						"aria-label": "Dismiss",
						class: "mwm:w-6 mwm:h-6 mwm:flex mwm:items-center mwm:justify-center mwm:border-none mwm:bg-[rgba(255,255,255,0.1)] mwm:text-[rgba(255,255,255,0.7)] mwm:cursor-pointer mwm:rounded mwm:text-lg mwm:leading-none mwm:transition-all mwm:shrink-0 mwm:ml-2 mwm:hover:bg-[rgba(255,255,255,0.2)] mwm:hover:text-white",
						children: "×"
					})
				]
			})
		});
	}
var ADDON_COLOR = "#8B5CF6";
	var WARN_COLOR = "#F59E0B";
var formatMessage = (msg) => {
		const prefix = `%c[MWM] [Addon v${VERSION}]%c`;
		const prefixStyle = `color: ${ADDON_COLOR}; font-weight: bold;`;
		return [
			`${prefix} ${msg}`,
			prefixStyle,
			"color: inherit; padding-left: 4px;"
		];
	};
var formatWarnMessage = (msg) => {
		const prefix = `%c[MWM] [Addon v${VERSION}]%c`;
		const prefixStyle = `color: ${WARN_COLOR}; font-weight: bold;`;
		return [
			`${prefix} ${msg}`,
			prefixStyle,
			"color: inherit; padding-left: 4px;"
		];
	};
var log = (msg, ...args) => {
		const [formatted, style1, style2] = formatMessage(msg);
		console.log(formatted, style1, style2, ...args);
	};
var warn = (msg, ...args) => {
		const [formatted, style1, style2] = formatWarnMessage(msg);
		console.warn(formatted, style1, style2, ...args);
	};
	var MAX_ERRORS = 10;
	var STALE_THRESHOLD_MS = 36e5;
	var errors = [];
	var checkpoints = [
		{
			id: "script_loaded",
			label: "Script Loaded",
			status: "pending"
		},
		{
			id: "ws_hooked",
			label: "WebSocket Hooked",
			status: "pending"
		},
		{
			id: "character_received",
			label: "Character Received",
			status: "pending"
		},
		{
			id: "storage_synced",
			label: "Storage Synced",
			status: "pending"
		},
		{
			id: "cross_tab",
			label: "Cross-tab Listener",
			status: "pending"
		}
	];
	function markCheckpoint(id, status, detail) {
		const cp = checkpoints.find((c) => c.id === id);
		if (!cp) return;
		cp.status = status;
		cp.detail = detail;
		cp.timestamp = Date.now();
		log(`Checkpoint [${id}]: ${status}${detail ? ` — ${detail}` : ""}`);
		refreshStatus();
	}
	function getCheckpoints() {
		return checkpoints.map((cp) => ({ ...cp }));
	}
var addonStatus = y$1({
		version: VERSION,
		status: "WS_DISCONNECTED",
		characterName: null,
		lastSyncTimestamp: null,
		errors: [],
		checkpoints: getCheckpoints()
	});
	function reportError(code, message) {
		errors.push({
			code,
			message,
			timestamp: Date.now()
		});
		if (errors.length > MAX_ERRORS) errors.shift();
		log(`Error reported: ${code} — ${message}`);
	}
	var _deps = null;
	function getStatus(deps) {
		if (errors.some((e) => e.code === "CONFLICT_DETECTED")) return "CONFLICT_DETECTED";
		if (errors.some((e) => e.code === "WS_HOOK_FAILED")) return "WS_HOOK_FAILED";
		if (errors.some((e) => e.code === "STORAGE_ERROR")) return "STORAGE_ERROR";
		const data = deps.getCharacterData();
		if (isMarketSite && !data) return "NO_CHARACTER_DATA";
		if (isGameSite && !data) return "WS_DISCONNECTED";
		try {
			const stored = _GM_getValue(STORAGE_KEY$1, null);
			if (stored?.timestamp && Date.now() - stored.timestamp > STALE_THRESHOLD_MS) return "STALE_DATA";
		} catch {}
		return "ADDON_OK";
	}
	function buildPong(deps) {
		const data = deps.getCharacterData();
		let lastSyncTimestamp = null;
		try {
			lastSyncTimestamp = _GM_getValue("@mwm/character-data", null)?.timestamp ?? null;
		} catch {}
		return {
			version: VERSION,
			protocolVersion: 2,
			status: getStatus(deps),
			site: isGameSite ? "game" : "market",
			gameConnected: data !== null,
			characterName: data?.character?.name ?? null,
			lastSyncTimestamp,
			errors: [...errors],
			checkpoints: getCheckpoints()
		};
	}
function refreshStatus() {
		if (!_deps) return;
		const data = _deps.getCharacterData();
		let lastSyncTimestamp = null;
		try {
			lastSyncTimestamp = _GM_getValue("@mwm/character-data", null)?.timestamp ?? null;
		} catch {}
		addonStatus.value = {
			version: VERSION,
			status: getStatus(_deps),
			characterName: data?.character?.name ?? null,
			lastSyncTimestamp,
			errors: [...errors],
			checkpoints: getCheckpoints()
		};
	}
	function initHealthCheck(deps) {
		_deps = deps;
		window.addEventListener(EVENTS.PING, () => {
			const pong = buildPong(deps);
			log("Ping received, responding with pong:", pong.status);
			window.dispatchEvent(new CustomEvent(EVENTS.PONG, { detail: pong }));
		});
		refreshStatus();
		log("Health check initialized");
	}
	var SETTINGS_STORAGE_KEY = "@mwm/settings";
	var DEFAULT_SETTINGS = {
		tooltipGraphEnabled: true,
		marketGraphEnabled: true,
		fetchDelayMs: 2e3,
		statusPillStyle: "pill",
		syncIntervalMs: 3e4
	};
	function readFromStorage() {
		try {
			const stored = localStorage.getItem(SETTINGS_STORAGE_KEY);
			if (stored) {
				const parsed = JSON.parse(stored);
				return {
					...DEFAULT_SETTINGS,
					...parsed,
					fetchDelayMs: Math.max(2e3, parsed.fetchDelayMs ?? DEFAULT_SETTINGS.fetchDelayMs),
					syncIntervalMs: Math.min(3e5, Math.max(3e4, parsed.syncIntervalMs ?? DEFAULT_SETTINGS.syncIntervalMs)),
					statusPillStyle: parsed.statusPillStyle === "icon" ? "icon" : "pill"
				};
			}
		} catch {}
		return { ...DEFAULT_SETTINGS };
	}
var settings = y$1(readFromStorage());
C(() => {
		try {
			localStorage.setItem(SETTINGS_STORAGE_KEY, JSON.stringify(settings.value));
			log("Settings saved:", settings.value);
		} catch {}
	});
function loadSettings() {
		settings.value = readFromStorage();
	}
function updateSetting(key, value) {
		settings.value = {
			...settings.value,
			[key]: value
		};
	}
function getSettings() {
		return settings.value;
	}
	var lastSyncTime = 0;
function mergeItems(target, newItems) {
		if (!newItems?.length) return;
		const itemMap = new Map();
		if (target.characterItems) for (const item of target.characterItems) {
			const key = `${item.itemHrid}:${item.enhancementLevel || 0}:${item.itemLocationHrid || ""}`;
			itemMap.set(key, item);
		}
		for (const item of newItems) {
			const key = `${item.itemHrid}:${item.enhancementLevel || 0}:${item.itemLocationHrid || ""}`;
			if (item.count > 0) itemMap.set(key, item);
			else itemMap.delete(key);
		}
		target.characterItems = Array.from(itemMap.values());
	}
function mergeSkills(target, newSkills) {
		if (!newSkills?.length) return;
		const skillMap = new Map();
		if (target.characterSkills) for (const skill of target.characterSkills) skillMap.set(skill.skillHrid, skill);
		for (const skill of newSkills) skillMap.set(skill.skillHrid, skill);
		target.characterSkills = Array.from(skillMap.values());
	}
function syncToStorage(characterData, force = false) {
		if (!characterData) return;
		const now = Date.now();
		if (!force && now - lastSyncTime < getSettings().syncIntervalMs) return;
		lastSyncTime = now;
		characterData.currentTimestamp = ( new Date()).toISOString();
		const storedData = {
			data: characterData,
			timestamp: now
		};
		try {
			_GM_setValue("characterId", characterData.character?.id);
			_GM_setValue("characterName", characterData.character?.name);
			_GM_setValue(STORAGE_KEY$1, storedData);
			log("Synced:", characterData.character?.name);
			markCheckpoint("storage_synced", "ok", characterData.character?.name);
			refreshStatus();
		} catch (err) {
			markCheckpoint("storage_synced", "failed", err instanceof Error ? err.message : "GM_setValue failed");
			reportError("STORAGE_ERROR", err instanceof Error ? err.message : "GM_setValue failed");
		}
	}
function loadFromStorage() {
		try {
			const stored = _GM_getValue(STORAGE_KEY$1, null);
			if (stored?.data) {
				log("Loaded from storage:", stored.data.character?.name);
				return stored.data;
			}
			return null;
		} catch (err) {
			reportError("STORAGE_ERROR", err instanceof Error ? err.message : "GM_getValue failed");
			return null;
		}
	}

function cls(prefix) {
		return `[class*="${prefix}"]`;
	}
function qcls(root, prefix) {
		return root.querySelector(cls(prefix));
	}
function hasCls(el, prefix) {
		for (const c of el.classList) if (c.startsWith(prefix)) return true;
		return false;
	}
var DOMObserver = class {
		observer = null;
		handlers = [];
		isObserving = false;
start() {
			if (this.isObserving) return;
			this.observer = new MutationObserver((mutations) => {
				for (const mutation of mutations) for (const node of mutation.addedNodes) {
					if (!(node instanceof Element)) continue;
					this.processNode(node);
				}
			});
			this.observer.observe(document.body, {
				childList: true,
				subtree: true
			});
			this.isObserving = true;
			log("DOM observer started");
		}
stop() {
			if (this.observer) {
				this.observer.disconnect();
				this.observer = null;
			}
			this.isObserving = false;
			log("DOM observer stopped");
		}
onClass(name, classPrefix, callback) {
			const handler = {
				name,
				classPrefix,
				callback
			};
			this.handlers.push(handler);
			return () => {
				const index = this.handlers.indexOf(handler);
				if (index > -1) this.handlers.splice(index, 1);
			};
		}
processNode(node) {
			for (const handler of this.handlers) {
				if (hasCls(node, handler.classPrefix)) try {
					handler.callback(node);
				} catch (err) {
					console.error(`[MWM] Handler error (${handler.name}):`, err);
				}
				const matches = node.querySelectorAll(cls(handler.classPrefix));
				for (const match of matches) try {
					handler.callback(match);
				} catch (err) {
					console.error(`[MWM] Handler error (${handler.name}):`, err);
				}
			}
		}
	};
	var domObserver = new DOMObserver();
var NON_TRADEABLE_ITEMS = new Set([
		"coin",
		"cowbell",
		"task_token",
		"chimerical_token",
		"sinister_token",
		"enchanted_token",
		"pirate_token",
		"purples_gift",
		"small_meteorite_cache",
		"medium_meteorite_cache",
		"large_meteorite_cache",
		"small_artisans_crate",
		"medium_artisans_crate",
		"large_artisans_crate",
		"small_treasure_chest",
		"medium_treasure_chest",
		"large_treasure_chest",
		"chimerical_chest",
		"chimerical_refinement_chest",
		"sinister_chest",
		"sinister_refinement_chest",
		"enchanted_chest",
		"enchanted_refinement_chest",
		"pirate_chest",
		"pirate_refinement_chest",
		"sinister_cape",
		"sinister_cape_refined",
		"chimerical_quiver",
		"chimerical_quiver_refined",
		"enchanted_cloak",
		"enchanted_cloak_refined",
		"trainee_milking_charm",
		"trainee_foraging_charm",
		"trainee_woodcutting_charm",
		"trainee_cheesesmithing_charm",
		"trainee_crafting_charm",
		"trainee_tailoring_charm",
		"trainee_cooking_charm",
		"trainee_brewing_charm",
		"trainee_alchemy_charm",
		"trainee_enhancing_charm",
		"trainee_stamina_charm",
		"trainee_intelligence_charm",
		"trainee_attack_charm",
		"trainee_defense_charm",
		"trainee_melee_charm",
		"trainee_ranged_charm",
		"trainee_magic_charm",
		"basic_task_badge",
		"advanced_task_badge",
		"expert_task_badge",
		"task_crystal"
	]);
function isNonTradeable(itemHrid) {
		return NON_TRADEABLE_ITEMS.has(itemHrid.toLowerCase());
	}
var needsUpdate = y$1(null);
function getCacheKey(itemHrid, enhancement) {
		return `${itemHrid}:${enhancement}`;
	}
var priceCache = new Map();
var CACHE_TTL = 300 * 1e3;
	setInterval(() => {
		const now = Date.now();
		for (const [key, entry] of priceCache) if (entry.expires <= now) priceCache.delete(key);
	}, CACHE_TTL);
async function fetchPriceChart(itemHrid, enhancement = 0) {
		if (isNonTradeable(itemHrid)) return [];
		const cacheKey = getCacheKey(itemHrid, enhancement);
		const cached = priceCache.get(cacheKey);
		if (cached && cached.expires > Date.now()) {
			log(`Cache hit for ${itemHrid} +${enhancement}`);
			return cached.data;
		}
		const characterId = _GM_getValue("characterId", null);
		const characterName = _GM_getValue("characterName", null);
		const url = enhancement > 0 ? `${MARKET_API}/addon/prices/${itemHrid}?enhancement=${enhancement}` : `${MARKET_API}/addon/prices/${itemHrid}`;
		return new Promise((resolve, reject) => {
			_GM_xmlhttpRequest({
				method: "GET",
				url,
				headers: {
					"Content-Type": "application/json",
					"X-MWM-Addon": VERSION,
					...characterId != null && { "X-MWM-Character-Id": String(characterId) },
					...characterName != null && { "X-MWM-Character-Name": characterName }
				},
				onload: (response) => {
					if (response.status === 426) {
						try {
							const errorData = JSON.parse(response.responseText);
							needsUpdate.value = /Expected ([^\s,]+)/.exec(errorData.error?.message)?.[1] || "latest";
						} catch {
							needsUpdate.value = "latest";
						}
						resolve([]);
						return;
					}
					try {
						const parsed = JSON.parse(response.responseText);
						if (parsed.success) {
							log(`Loaded ${parsed.data.length} price points for ${itemHrid} +${enhancement}`);
							priceCache.set(cacheKey, {
								data: parsed.data,
								expires: Date.now() + CACHE_TTL
							});
							resolve(parsed.data);
						} else {
							warn(`API error for ${itemHrid} +${enhancement}`);
							resolve([]);
						}
					} catch (err) {
						warn(`Parse error for ${itemHrid} +${enhancement}:`, err);
						reject(err);
					}
				},
				onerror: (err) => {
					warn(`Network error for ${itemHrid} +${enhancement}:`, err);
					reject(err);
				}
			});
		});
	}
	function usePriceData({ itemHrid, enhancement = 0, enabled = true, delayMs = 0, guardEl }) {
		const [state, setState] = d$2(enabled ? { status: "loading" } : { status: "idle" });
		y$2(() => {
			if (!enabled) {
				setState({ status: "idle" });
				return;
			}
			let cancelled = false;
			setState({ status: "loading" });
			async function load() {
				if (delayMs > 0) await new Promise((r) => setTimeout(r, delayMs));
				if (cancelled) return;
				if (guardEl && !document.body.contains(guardEl)) return;
				try {
					const data = await fetchPriceChart(itemHrid, enhancement);
					if (cancelled) return;
					if (guardEl && !document.body.contains(guardEl)) return;
					setState(data.length > 0 ? {
						status: "data",
						data
					} : { status: "empty" });
				} catch {
					if (!cancelled) setState({ status: "error" });
				}
			}
			load();
			return () => {
				cancelled = true;
			};
		}, [
			itemHrid,
			enhancement,
			enabled,
			delayMs,
			guardEl
		]);
		return state;
	}
function formatPrice(price) {
		if (price === null) return "—";
		if (price >= 1e6) return `${(price / 1e6).toFixed(1)}M`;
		if (price >= 1e3) return `${(price / 1e3).toFixed(1)}K`;
		return price.toLocaleString();
	}
function formatDate(timestamp) {
		return new Date(timestamp).toLocaleDateString("en-US", {
			month: "short",
			day: "numeric",
			hour: "2-digit",
			minute: "2-digit"
		});
	}
function calculateStats(data) {
		const bidPrices = data.map((d) => d.bidPrice).filter((p) => p !== null);
		const askPrices = data.map((d) => d.askPrice).filter((p) => p !== null);
		const currentBid = bidPrices[bidPrices.length - 1] ?? null;
		const currentAsk = askPrices[askPrices.length - 1] ?? null;
		const highBid = bidPrices.length > 0 ? Math.max(...bidPrices) : null;
		const lowBid = bidPrices.length > 0 ? Math.min(...bidPrices) : null;
		let change = 0;
		if (bidPrices.length >= 2) {
			const first = bidPrices[0];
			change = (bidPrices[bidPrices.length - 1] - first) / first * 100;
		}
		return {
			currentBid,
			currentAsk,
			highBid,
			lowBid,
			change
		};
	}
function calculateChange(data) {
		const bidPrices = data.map((d) => d.bidPrice).filter((p) => p !== null);
		if (bidPrices.length < 2) return 0;
		const first = bidPrices[0];
		return (bidPrices[bidPrices.length - 1] - first) / first * 100;
	}
function nameToHrid(name) {
		return name.toLowerCase().replace(/['\u2019]/g, "").replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, "");
	}
function hridToName(hrid) {
		return hrid.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
	}
var COLORS = {
		bid: "#c084fc",
		ask: "#5ee9c5",
		grid: "rgba(59, 89, 152, 0.15)",
		label: "rgba(226, 232, 240, 0.4)",
		empty: "rgba(226, 232, 240, 0.4)"
	};
	function PriceChart({ data, height = 180, reverseX = false }) {
		const canvasRef = A(null);
		const tooltipRef = A(null);
		const stateRef = A(null);
		y$2(() => {
			const canvas = canvasRef.current;
			const tooltipEl = tooltipRef.current;
			if (!canvas || !tooltipEl || data.length < 2) return;
			const state = createChartState(canvas, data, tooltipEl, reverseX);
			stateRef.current = state;
			state.render();
			const onMouseMove = (e) => {
				const bounds = canvas.getBoundingClientRect();
				const mouseX = e.clientX - bounds.left;
				state.handleHover(mouseX);
			};
			const onMouseLeave = () => state.handleLeave();
			canvas.addEventListener("mousemove", onMouseMove);
			canvas.addEventListener("mouseleave", onMouseLeave);
			const ro = new ResizeObserver(() => {
				state.resize();
				state.render();
			});
			ro.observe(canvas.parentElement ?? canvas);
			return () => {
				canvas.removeEventListener("mousemove", onMouseMove);
				canvas.removeEventListener("mouseleave", onMouseLeave);
				ro.disconnect();
				stateRef.current = null;
			};
		}, [data, reverseX]);
		return u("div", {
			class: "mwm:relative mwm:bg-mwm-bg-surface mwm:rounded mwm:border mwm:border-mwm-border",
			children: [ u("canvas", {
				ref: canvasRef,
				class: "mwm:block mwm:w-full mwm:cursor-crosshair",
				style: { height: `${height}px` }
			}), u("div", {
				ref: tooltipRef,
				class: "mwm:absolute mwm:bg-mwm-bg-panel mwm:border mwm:border-mwm-border mwm:rounded-lg mwm:px-3 mwm:py-2.5 mwm:pointer-events-none mwm:transition-opacity mwm:z-10 mwm:shadow-[0_4px_12px_rgba(0,0,0,0.3)]",
				style: {
					top: "8px",
					right: "8px",
					opacity: 0
				},
				children: [
u("div", { class: "mwm-tooltip-date mwm:text-[10px] mwm:text-mwm-text-muted mwm:mb-1.5 mwm:font-semibold" }),
u("div", {
						class: "mwm:flex mwm:flex-col mwm:gap-1",
						children: [ u("div", {
							class: "mwm:flex mwm:items-center mwm:justify-between mwm:gap-4",
							children: [ u("span", {
								class: "mwm:flex mwm:items-center mwm:gap-1.5",
								children: [ u("span", { class: "mwm:w-2 mwm:h-2 mwm:rounded-full mwm:bg-mwm-ask" }), u("span", {
									class: "mwm:text-[10px] mwm:text-mwm-text-muted",
									children: "Ask"
								})]
							}), u("span", { class: "mwm-tooltip-price ask mwm:text-[11px] mwm:text-mwm-ask mwm:font-medium" })]
						}), u("div", {
							class: "mwm:flex mwm:items-center mwm:justify-between mwm:gap-4",
							children: [ u("span", {
								class: "mwm:flex mwm:items-center mwm:gap-1.5",
								children: [ u("span", { class: "mwm:w-2 mwm:h-2 mwm:rounded-full mwm:bg-mwm-bid" }), u("span", {
									class: "mwm:text-[10px] mwm:text-mwm-text-muted",
									children: "Bid"
								})]
							}), u("span", { class: "mwm-tooltip-price bid mwm:text-[11px] mwm:text-mwm-bid mwm:font-medium" })]
						})]
					}),
u("div", { class: "mwm-tooltip-spread mwm:mt-1.5 mwm:pt-1.5 mwm:border-t mwm:border-mwm-border mwm:text-[10px] mwm:text-mwm-text-muted" })
				]
			})]
		});
	}
	function createChartState(canvas, data, tooltipEl, reverseX) {
		let hoverIndex = null;
		let width = 0;
		let height = 0;
		let chartWidth = 0;
		let chartHeight = 0;
		const padding = {
			top: 15,
			right: 10,
			bottom: 20,
			left: 45
		};
		function resize() {
			const rect = canvas.getBoundingClientRect();
			const dpr = window.devicePixelRatio || 1;
			width = rect.width;
			height = rect.height;
			canvas.width = width * dpr;
			canvas.height = height * dpr;
			chartWidth = width - padding.left - padding.right;
			chartHeight = height - padding.top - padding.bottom;
			const ctx = canvas.getContext("2d");
			if (ctx) ctx.scale(dpr, dpr);
		}
		function getX(i) {
			return reverseX ? padding.left + (data.length - 1 - i) / (data.length - 1) * chartWidth : padding.left + i / (data.length - 1) * chartWidth;
		}
		function render() {
			const ctx = canvas.getContext("2d");
			if (!ctx || width === 0) {
				resize();
				const c = canvas.getContext("2d");
				if (!c) return;
				renderFrame(c);
			} else {
				ctx.setTransform(1, 0, 0, 1, 0, 0);
				const dpr = window.devicePixelRatio || 1;
				ctx.scale(dpr, dpr);
				renderFrame(ctx);
			}
		}
		function renderFrame(ctx) {
			ctx.clearRect(0, 0, width, height);
			if (data.length < 2) {
				ctx.fillStyle = COLORS.empty;
				ctx.font = "11px sans-serif";
				ctx.textAlign = "center";
				ctx.fillText("No data available", width / 2, height / 2);
				return;
			}
			const bidPrices = data.map((d) => d.bidPrice).filter((p) => p !== null);
			const askPrices = data.map((d) => d.askPrice).filter((p) => p !== null);
			const allPrices = [...bidPrices, ...askPrices];
			const minPrice = Math.min(...allPrices);
			const maxPrice = Math.max(...allPrices);
			const priceRange = maxPrice - minPrice || 1;
			const getY = (price) => padding.top + chartHeight - (price - minPrice) / priceRange * chartHeight;
			ctx.strokeStyle = COLORS.grid;
			ctx.lineWidth = 1;
			ctx.setLineDash([3, 3]);
			for (let i = 0; i <= 4; i++) {
				const y = padding.top + i / 4 * chartHeight;
				ctx.beginPath();
				ctx.moveTo(padding.left, y);
				ctx.lineTo(width - padding.right, y);
				ctx.stroke();
				const price = maxPrice - i / 4 * priceRange;
				ctx.fillStyle = COLORS.label;
				ctx.font = "9px sans-serif";
				ctx.textAlign = "right";
				ctx.fillText(formatPrice(price), padding.left - 6, y + 3);
			}
			ctx.setLineDash([]);
			if (reverseX) {
				const dateCount = Math.min(5, data.length);
				ctx.fillStyle = COLORS.label;
				ctx.font = "10px sans-serif";
				ctx.textAlign = "center";
				for (let i = 0; i < dateCount; i++) {
					const dataIdx = dateCount === 1 ? 0 : Math.round((dateCount - 1 - i) / (dateCount - 1) * (data.length - 1));
					const x = getX(dataIdx);
					const point = data[dataIdx];
					if (!point) continue;
					const date = new Date(point.timestamp);
					const label = `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}`;
					ctx.fillText(label, x, height - 4);
				}
			}
			drawAreaLine(ctx, data, "askPrice", COLORS.ask, getX, getY, chartHeight, padding.top);
			drawAreaLine(ctx, data, "bidPrice", COLORS.bid, getX, getY, chartHeight, padding.top);
			if (hoverIndex !== null && hoverIndex >= 0 && hoverIndex < data.length) {
				const point = data[hoverIndex];
				if (!point) return;
				const x = getX(hoverIndex);
				ctx.strokeStyle = "rgba(226, 232, 240, 0.15)";
				ctx.lineWidth = 1;
				ctx.setLineDash([2, 2]);
				ctx.beginPath();
				ctx.moveTo(x, padding.top);
				ctx.lineTo(x, padding.top + chartHeight);
				ctx.stroke();
				ctx.setLineDash([]);
				if (point.askPrice !== null) drawDot(ctx, x, getY(point.askPrice), COLORS.ask);
				if (point.bidPrice !== null) drawDot(ctx, x, getY(point.bidPrice), COLORS.bid);
			}
		}
		function handleHover(mouseX) {
			const dataIndex = reverseX ? Math.round((1 - (mouseX - padding.left) / chartWidth) * (data.length - 1)) : Math.round((mouseX - padding.left) / chartWidth * (data.length - 1));
			if (dataIndex < 0 || dataIndex >= data.length) return;
			const point = data[dataIndex];
			if (!point) return;
			hoverIndex = dataIndex;
			render();
			const dateEl = tooltipEl.querySelector(".mwm-tooltip-date");
			const bidEl = tooltipEl.querySelector(".mwm-tooltip-price.bid");
			const askEl = tooltipEl.querySelector(".mwm-tooltip-price.ask");
			const spreadEl = tooltipEl.querySelector(".mwm-tooltip-spread");
			if (dateEl) dateEl.textContent = formatDate(point.timestamp);
			if (bidEl) bidEl.textContent = formatPrice(point.bidPrice);
			if (askEl) askEl.textContent = formatPrice(point.askPrice);
			if (spreadEl) if (point.askPrice !== null && point.bidPrice !== null && point.bidPrice > 0) {
				const spreadAbs = point.askPrice - point.bidPrice;
				const spreadPct = spreadAbs / point.bidPrice * 100;
				spreadEl.textContent = `Spread: ${formatPrice(spreadAbs)} (${spreadPct.toFixed(1)}%)`;
				spreadEl.style.display = "";
			} else spreadEl.style.display = "none";
			const tooltipWidth = tooltipEl.offsetWidth;
			const containerWidth = canvas.parentElement?.offsetWidth ?? width;
			let left = mouseX + 12;
			if (left + tooltipWidth > containerWidth - 8) left = mouseX - tooltipWidth - 12;
			tooltipEl.style.left = `${Math.max(4, left)}px`;
			tooltipEl.style.top = "8px";
			tooltipEl.style.right = "auto";
			tooltipEl.style.opacity = "1";
		}
		function handleLeave() {
			hoverIndex = null;
			render();
			tooltipEl.style.opacity = "0";
		}
		resize();
		return {
			render,
			resize,
			handleHover,
			handleLeave
		};
	}
	function drawAreaLine(ctx, data, key, color, getX, getY, chartHeight, topPadding) {
		const points = [];
		for (let i = 0; i < data.length; i++) {
			const price = data[i][key];
			if (price !== null) points.push({
				x: getX(i),
				y: getY(price)
			});
		}
		if (points.length < 2) return;
		const bottomY = topPadding + chartHeight;
		ctx.beginPath();
		ctx.moveTo(points[0].x, bottomY);
		for (const p of points) ctx.lineTo(p.x, p.y);
		ctx.lineTo(points[points.length - 1].x, bottomY);
		ctx.closePath();
		const gradient = ctx.createLinearGradient(0, topPadding, 0, bottomY);
		gradient.addColorStop(0, hexToRgba$1(color, .2));
		gradient.addColorStop(1, hexToRgba$1(color, 0));
		ctx.fillStyle = gradient;
		ctx.fill();
		ctx.beginPath();
		ctx.moveTo(points[0].x, points[0].y);
		for (let i = 1; i < points.length; i++) ctx.lineTo(points[i].x, points[i].y);
		ctx.strokeStyle = color;
		ctx.lineWidth = 2;
		ctx.lineCap = "round";
		ctx.lineJoin = "round";
		ctx.stroke();
	}
	function drawDot(ctx, x, y, color) {
		ctx.beginPath();
		ctx.arc(x, y, 3.5, 0, Math.PI * 2);
		ctx.fillStyle = color;
		ctx.fill();
		ctx.strokeStyle = "rgba(255, 255, 255, 0.6)";
		ctx.lineWidth = 1.5;
		ctx.stroke();
	}
	function hexToRgba$1(hex, alpha) {
		return `rgba(${parseInt(hex.slice(1, 3), 16)}, ${parseInt(hex.slice(3, 5), 16)}, ${parseInt(hex.slice(5, 7), 16)}, ${alpha})`;
	}
	function Legend() {
		return u("div", {
			class: "mwm:flex mwm:gap-4 mwm:mt-2 mwm:justify-center",
			children: [ u("div", {
				class: "mwm:flex mwm:items-center mwm:gap-1.5 mwm:text-[9px] mwm:text-mwm-text-muted",
				children: [ u("span", { class: "mwm:w-2 mwm:h-2 mwm:rounded-full mwm:bg-mwm-bid" }), u("span", { children: "Bid" })]
			}), u("div", {
				class: "mwm:flex mwm:items-center mwm:gap-1.5 mwm:text-[9px] mwm:text-mwm-text-muted",
				children: [ u("span", { class: "mwm:w-2 mwm:h-2 mwm:rounded-full mwm:bg-mwm-ask" }), u("span", { children: "Ask" })]
			})]
		});
	}
	function Loading({ text = "Loading prices..." }) {
		return u("div", {
			class: "mwm:flex mwm:items-center mwm:justify-center mwm:gap-2 mwm:py-3 mwm:text-mwm-text-muted mwm:text-[10px]",
			children: [ u("div", { class: "mwm:w-3 mwm:h-3 mwm:border-2 mwm:border-mwm-border mwm:border-t-mwm-accent-purple mwm:rounded-full mwm:animate-spin" }), u("span", { children: text })]
		});
	}
	function StatItem({ label, value, colorClass, compact }) {
		return u("div", {
			class: `mwm:bg-mwm-bg-surface mwm:rounded mwm:border mwm:border-mwm-border mwm:text-center ${compact ? "mwm:py-1 mwm:px-1" : "mwm:py-2 mwm:px-2"}`,
			children: [ u("div", {
				class: `mwm:uppercase mwm:tracking-wider mwm:text-mwm-text-muted ${compact ? "mwm:text-[7px] mwm:mb-0.5" : "mwm:text-[8px] mwm:mb-1"}`,
				children: label
			}), u("div", {
				class: `mwm:font-semibold mwm:text-mwm-text-primary ${colorClass ?? ""} ${compact ? "mwm:text-[11px]" : "mwm:text-[13px]"}`,
				children: formatPrice(value)
			})]
		});
	}
	function StatsRow({ bid, ask, high, low, compact }) {
		return u("div", {
			class: `mwm:grid mwm:grid-cols-4 ${compact ? "mwm:gap-1.5 mwm:mb-2" : "mwm:gap-2 mwm:mb-3"}`,
			children: [
u(StatItem, {
					label: "Bid",
					value: bid,
					colorClass: "mwm:text-mwm-bid",
					compact
				}),
u(StatItem, {
					label: "Ask",
					value: ask,
					colorClass: "mwm:text-mwm-ask",
					compact
				}),
u(StatItem, {
					label: "High",
					value: high,
					compact
				}),
u(StatItem, {
					label: "Low",
					value: low,
					compact
				})
			]
		});
	}
	function itemUrl$1(itemHrid, enhancement) {
		const base = `https://milkyway.market/items/${itemHrid}`;
		return enhancement > 0 ? `${base}?enhancement=${enhancement}` : base;
	}
	function ItemModalPanel({ itemHrid, itemName, enhancement }) {
		const state = usePriceData({
			itemHrid,
			enhancement
		});
		const stats = state.status === "data" ? calculateStats(state.data) : null;
		return u("div", {
			class: "mwm-root mwm:my-3 mwm:rounded-lg mwm:border mwm:border-mwm-border mwm:bg-mwm-bg-panel",
			children: [
u("div", {
					class: "mwm:flex mwm:items-center mwm:justify-between mwm:px-3.5 mwm:py-2.5 mwm:border-b mwm:border-mwm-border",
					children: u("span", {
						class: "mwm:text-sm mwm:font-medium mwm:text-mwm-text-primary",
						children: `${itemName}${enhancement > 0 ? ` +${enhancement}` : ""} (14d)`
					})
				}),
u("div", {
					class: "mwm:p-3.5",
					children: [
						state.status === "loading" && u(Loading, { text: "Loading market data..." }),
						state.status === "data" && stats && u(k$2, { children: [
u(StatsRow, {
								bid: stats.currentBid,
								ask: stats.currentAsk,
								high: stats.highBid,
								low: stats.lowBid
							}),
u(PriceChart, {
								data: state.data,
								height: 140
							}),
u(Legend, {})
						] }),
						state.status === "empty" && u("div", {
							class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-5 mwm:text-mwm-text-muted mwm:text-[11px] mwm:text-center",
							children: "No market data available"
						}),
						state.status === "error" && u("div", {
							class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-3 mwm:text-mwm-text-muted mwm:text-[10px]",
							children: "Failed to load market data"
						})
					]
				}),
u("div", {
					class: "mwm:px-3.5 mwm:py-2.5 mwm:border-t mwm:border-mwm-border mwm:flex mwm:items-center mwm:justify-between",
					children: [ u("a", {
						href: itemUrl$1(itemHrid, enhancement),
						target: "_blank",
						rel: "noopener",
						class: "mwm:text-[10px] mwm:text-mwm-accent-purple mwm:no-underline mwm:hover:opacity-80 mwm:transition-opacity",
						children: "View on MilkyWay Market →"
					}), u("span", {
						class: "mwm:text-[9px] mwm:text-mwm-text-muted",
						children: "MWM"
					})]
				})
			]
		});
	}
var GAME = {
		tooltip: {
			popper: "MuiTooltip-popper",
			name: "ItemTooltipText_name",
			content: "ItemTooltipText_itemTooltipText"
		},
		itemModal: {
			content: "ItemDictionary_modalContent",
			title: "ItemDictionary_title"
		},
		marketplace: {
			currentItem: "MarketplacePanel_currentItem",
			orderBooks: "MarketplacePanel_orderBooksContainer",
			infoContainer: "MarketplacePanel_infoContainer",
			tabPanels: "TabsComponent_tabPanelsContainer"
		},
		mainPanel: {
			subPanelContainer: "MainPanel_subPanelContainer",
			hidden: "MainPanel_hidden",
			marketplaceModal: "MainPanel_marketplaceModal"
		},
		header: {
			characterInfo: "Header_characterInfo",
			communityBuffs: "Header_communityBuffs"
		},
		settings: { profileTab: "SettingsPanel_profileTab" },
		items: {
			name: "Item_name",
			enhancement: "Item_enhancementLevel"
		}
	};
var ROOT_CLASS = "mwm-root";
function injectComponent(parent, vnode, options) {
		const { id, position = "append", ref, contain } = options ?? {};
		if (id && parent.querySelector(`#${id}`)) return () => {};
		const host = document.createElement("div");
		host.className = ROOT_CLASS;
		if (id) host.id = id;
		if (contain) {
			host.style.overflow = "hidden";
			host.style.maxWidth = "100%";
		}
		switch (position) {
			case "prepend":
				parent.prepend(host);
				break;
			case "before":
				(ref ?? parent).insertAdjacentElement("beforebegin", host);
				break;
			case "after":
				(ref ?? parent).insertAdjacentElement("afterend", host);
				break;
			default: parent.appendChild(host);
		}
		J(vnode, host);
		return () => {
			J(null, host);
			host.remove();
		};
	}
function registerInjection(config) {
		log(`Registering injection: ${config.name}`);
		return domObserver.onClass(config.name, config.watchPrefix, (detected) => {
			if (config.enabled && !config.enabled()) return;
			const target = config.resolve(detected);
			if (!target) return;
			if (target.parent.querySelector(`#${config.id}`)) return;
			const props = config.extract(detected);
			if (!props) return;
			injectComponent(target.parent, config.render(props), {
				id: config.id,
				position: target.position,
				ref: target.ref,
				contain: config.contain
			});
		});
	}
function initItemModal() {
		log("Initializing item modal prices");
		return registerInjection({
			id: "mwm-modal-panel",
			name: "item-modal-prices",
			watchPrefix: GAME.itemModal.content,
			resolve(modalContent) {
				const titleEl = qcls(modalContent, GAME.itemModal.title);
				if (!titleEl) return null;
				return {
					parent: modalContent,
					position: "after",
					ref: titleEl.parentElement || modalContent
				};
			},
			extract(modalContent) {
				const rawName = qcls(modalContent, GAME.itemModal.title)?.textContent?.trim();
				if (!rawName) return null;
				const enhMatch = /\s*\+(\d+)$/.exec(rawName);
				const enhancement = enhMatch ? parseInt(enhMatch[1], 10) : 0;
				const itemName = rawName.replace(/\s*\+\d+$/, "");
				const itemHrid = nameToHrid(itemName);
				log(`Item modal detected: ${rawName} -> ${itemHrid}`);
				return {
					itemHrid,
					itemName,
					enhancement
				};
			},
			render: (props) => u(ItemModalPanel, {
				itemHrid: props.itemHrid,
				itemName: props.itemName,
				enhancement: props.enhancement
			})
		});
	}
	var STORAGE_KEY = "@mwm/panel-visible";
	function getPanelVisible() {
		try {
			const stored = localStorage.getItem(STORAGE_KEY);
			if (stored === null) return false;
			return stored === "true";
		} catch {
			return false;
		}
	}
	function setPanelVisible(visible) {
		try {
			localStorage.setItem(STORAGE_KEY, String(visible));
		} catch {}
	}
	function itemUrl(itemHrid, enhancement) {
		const base = `https://milkyway.market/items/${itemHrid}`;
		return enhancement > 0 ? `${base}?enhancement=${enhancement}` : base;
	}
	function MarketplacePanel({ itemHrid, itemName, enhancement }) {
		const [expanded, setExpanded] = d$2(getPanelVisible);
		const state = usePriceData({
			itemHrid,
			enhancement,
			enabled: expanded
		});
		const stats = state.status === "data" ? calculateStats(state.data) : null;
		const title = `${itemName}${enhancement > 0 ? ` +${enhancement}` : ""} (14d)`;
		function togglePanel() {
			const next = !expanded;
			setExpanded(next);
			setPanelVisible(next);
		}
		return u("div", {
			class: "mwm-root mwm:my-2 mwm:rounded-lg mwm:border mwm:border-mwm-border mwm:bg-mwm-bg-panel mwm:w-full",
			children: [ u("div", {
				class: "mwm:flex mwm:items-center mwm:justify-between mwm:px-3 mwm:py-2",
				children: [ u("span", {
					class: "mwm:text-[11px] mwm:font-medium mwm:text-mwm-text-primary",
					children: title
				}), u("button", {
					onClick: togglePanel,
					title: expanded ? "Hide panel" : "Show panel",
					class: "mwm:w-5 mwm:h-5 mwm:flex mwm:items-center mwm:justify-center mwm:border mwm:border-mwm-border mwm:bg-mwm-bg-surface mwm:text-mwm-text-muted mwm:cursor-pointer mwm:rounded mwm:text-xs mwm:leading-none mwm:transition-colors mwm:hover:bg-[rgba(255,255,255,0.08)] mwm:hover:text-mwm-text-primary",
					children: expanded ? "−" : "+"
				})]
			}), expanded && u(k$2, { children: [ u("div", {
				class: "mwm:px-3 mwm:pb-3",
				children: [
					state.status === "loading" && u(Loading, { text: "Loading market data..." }),
					state.status === "data" && stats && u(k$2, { children: [
u(StatsRow, {
							bid: stats.currentBid,
							ask: stats.currentAsk,
							high: stats.highBid,
							low: stats.lowBid,
							compact: true
						}),
u(PriceChart, {
							data: state.data,
							height: 120,
							reverseX: true
						}),
u(Legend, {})
					] }),
					state.status === "empty" && u("div", {
						class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-4 mwm:text-mwm-text-muted mwm:text-[11px] mwm:text-center",
						children: "No market data available"
					}),
					state.status === "error" && u("div", {
						class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-3 mwm:text-mwm-text-muted mwm:text-[10px]",
						children: "Failed to load market data"
					})
				]
			}), u("div", {
				class: "mwm:px-3 mwm:py-2 mwm:border-t mwm:border-mwm-border mwm:flex mwm:items-center mwm:justify-between",
				children: [ u("a", {
					href: itemUrl(itemHrid, enhancement),
					target: "_blank",
					rel: "noopener",
					class: "mwm:text-[9px] mwm:text-mwm-accent-purple mwm:no-underline mwm:hover:opacity-80 mwm:transition-opacity",
					children: "View on MilkyWay Market →"
				}), u("span", {
					class: "mwm:text-[8px] mwm:text-mwm-text-muted",
					children: "MWM"
				})]
			})] })]
		});
	}
	var INJECT_ID = "mwm-marketplace-panel";
var currentItemKey = "";
	var cleanupPanel = null;
function isMarketplaceActive() {
		const panel = document.querySelector(`${cls(GAME.mainPanel.subPanelContainer)}${cls(GAME.mainPanel.marketplaceModal)}`);
		if (!panel) return false;
		return !hasCls(panel, GAME.mainPanel.hidden);
	}
function initMarketplacePrices() {
		log("Initializing marketplace prices");
		return domObserver.onClass("marketplace-prices", GAME.marketplace.currentItem, handleMarketplaceItem);
	}
	function removePanel() {
		if (cleanupPanel) {
			cleanupPanel();
			cleanupPanel = null;
			currentItemKey = "";
		}
	}
	function extractItemHrid(currentItemEl) {
		const useElement = currentItemEl.querySelector("use");
		if (useElement?.href?.baseVal) {
			const itemId = useElement.href.baseVal.split("#")[1];
			if (itemId) return itemId;
		}
		return null;
	}
	function extractEnhancementLevel(infoContainer) {
		const enhancementEl = infoContainer.querySelector(cls(GAME.items.enhancement));
		if (!enhancementEl) return 0;
		return parseInt(enhancementEl.textContent ?? "0", 10);
	}
	function handleMarketplaceItem(currentItemEl) {
		if (!getSettings().marketGraphEnabled) {
			removePanel();
			return;
		}
		const infoContainer = currentItemEl.closest(cls(GAME.marketplace.infoContainer));
		if (!infoContainer) {
			warn("Could not find marketplace info container");
			return;
		}
		const itemHrid = extractItemHrid(currentItemEl);
		if (!itemHrid) {
			warn("Could not extract item HRID from marketplace");
			return;
		}
		const enhancement = extractEnhancementLevel(infoContainer);
		const cacheKey = `${itemHrid}:${enhancement}`;
		if (isNonTradeable(itemHrid)) {
			log(`Skipping non-tradeable item: ${itemHrid}`);
			removePanel();
			return;
		}
		if (cacheKey === currentItemKey && cleanupPanel) return;
		removePanel();
		currentItemKey = cacheKey;
		const itemName = hridToName(itemHrid);
		cleanupPanel = injectComponent(infoContainer.parentElement ?? infoContainer, u(MarketplacePanel, {
			itemHrid,
			itemName,
			enhancement
		}), {
			id: INJECT_ID,
			position: "after",
			ref: infoContainer
		});
	}
var reportModalOpen = y$1(false);
	var REPORT_NAME_KEY = "@mwm/report-name";
	var REPORT_DISCORD_KEY = "@mwm/report-discord";
	function getReportName() {
		return _GM_getValue(REPORT_NAME_KEY, "");
	}
	function getReportDiscord() {
		return _GM_getValue(REPORT_DISCORD_KEY, "");
	}
	function setReportName(value) {
		_GM_setValue(REPORT_NAME_KEY, value);
	}
	function setReportDiscord(value) {
		_GM_setValue(REPORT_DISCORD_KEY, value);
	}
	async function sendReport(opts) {
		const payload = { ...addonStatus.value };
		const body = JSON.stringify({
			name: opts.name || void 0,
			discordHandle: opts.discordHandle || void 0,
			description: opts.description || void 0,
			payload,
			userAgent: navigator.userAgent
		});
		try {
			_GM_setClipboard(JSON.stringify(payload, null, 2), "text");
			log("Diagnostic JSON copied to clipboard");
		} catch {
			warn("Failed to copy to clipboard");
		}
		return new Promise((resolve) => {
			_GM_xmlhttpRequest({
				method: "POST",
				url: `${MARKET_API}/addon/report`,
				headers: {
					"Content-Type": "application/json",
					"X-MWM-Addon": VERSION
				},
				data: body,
				timeout: 15e3,
				ontimeout: () => {
					warn("Report request timed out");
					resolve({
						success: false,
						error: "timeout"
					});
				},
				onload: (response) => {
					try {
						const parsed = JSON.parse(response.responseText);
						if (parsed.success) {
							log("Bug report sent successfully");
							resolve({ success: true });
						} else if (parsed.error === "rate_limited") {
							log(`Rate limited, retry after ${parsed.retryAfter}s`);
							resolve({
								success: false,
								retryAfter: parsed.retryAfter,
								error: "rate_limited"
							});
						} else {
							warn("Report failed:", parsed.error);
							resolve({
								success: false,
								error: parsed.error
							});
						}
					} catch {
						warn("Failed to parse report response");
						resolve({
							success: false,
							error: "parse_error"
						});
					}
				},
				onerror: (err) => {
					warn("Report network error:", err);
					resolve({
						success: false,
						error: "network_error"
					});
				}
			});
		});
	}
	var SYNC_PRESETS$1 = [
		{
			label: "30s",
			value: 3e4
		},
		{
			label: "60s",
			value: 6e4
		},
		{
			label: "2m",
			value: 12e4
		},
		{
			label: "5m",
			value: 3e5
		}
	];
	function SettingsPanel() {
		const s = settings.value;
		return u("div", {
			class: "mwm-root",
			id: "mwm-settings",
			children: u("div", {
				class: "mwm:mt-5 mwm:mb-5 mwm:px-6 mwm:py-4 mwm:rounded-lg mwm:border mwm:border-mwm-border mwm:bg-mwm-bg-panel mwm:w-full",
				children: [ u("div", {
					class: "mwm:flex mwm:items-center mwm:gap-2 mwm:mb-4 mwm:pb-3 mwm:border-b mwm:border-mwm-border",
					children: [ u("span", {
						class: "mwm:text-[13px] mwm:font-semibold mwm:text-mwm-accent-purple mwm:uppercase mwm:tracking-wider mwm:flex mwm:items-center mwm:gap-2",
						children: [ u("span", { class: "mwm:w-1.5 mwm:h-1.5 mwm:bg-mwm-accent-purple mwm:rounded-full mwm:animate-pulse" }), "MWM Addon Settings"]
					}), u("span", {
						class: "mwm:text-[9px] mwm:text-mwm-text-muted",
						children: "(changes apply immediately)"
					})]
				}), u("div", {
					class: "mwm:flex mwm:flex-col mwm:gap-3",
					children: [
u("label", {
							class: "mwm:flex mwm:items-center mwm:gap-2.5 mwm:cursor-pointer",
							children: [ u("input", {
								type: "checkbox",
								checked: s.tooltipGraphEnabled,
								onChange: (e) => updateSetting("tooltipGraphEnabled", e.target.checked),
								class: "mwm:appearance-none mwm:w-[18px] mwm:h-[18px] mwm:border-2 mwm:border-mwm-border mwm:rounded mwm:bg-mwm-bg-surface mwm:cursor-pointer mwm:relative mwm:shrink-0 mwm:transition-all mwm:hover:border-mwm-accent-purple mwm:hover:bg-[rgba(139,92,246,0.1)] mwm:checked:bg-mwm-accent-purple mwm:checked:border-mwm-accent-purple"
							}), u("span", {
								class: "mwm:text-[11px] mwm:text-mwm-text-primary",
								children: "Show prices in tooltips"
							})]
						}),
u("label", {
							class: "mwm:flex mwm:items-center mwm:gap-2.5 mwm:cursor-pointer",
							children: [ u("input", {
								type: "checkbox",
								checked: s.marketGraphEnabled,
								onChange: (e) => updateSetting("marketGraphEnabled", e.target.checked),
								class: "mwm:appearance-none mwm:w-[18px] mwm:h-[18px] mwm:border-2 mwm:border-mwm-border mwm:rounded mwm:bg-mwm-bg-surface mwm:cursor-pointer mwm:relative mwm:shrink-0 mwm:transition-all mwm:hover:border-mwm-accent-purple mwm:hover:bg-[rgba(139,92,246,0.1)] mwm:checked:bg-mwm-accent-purple mwm:checked:border-mwm-accent-purple"
							}), u("span", {
								class: "mwm:text-[11px] mwm:text-mwm-text-primary",
								children: "Show price chart in marketplace"
							})]
						}),
u("div", {
							class: "mwm:flex mwm:flex-col mwm:gap-1.5",
							children: [ u("label", {
								class: "mwm:flex mwm:items-center mwm:gap-2.5 mwm:cursor-pointer",
								children: [ u("span", {
									class: "mwm:text-[11px] mwm:text-mwm-text-primary",
									children: "Fetch delay (seconds):"
								}), u("input", {
									type: "number",
									value: s.fetchDelayMs / 1e3,
									min: "2",
									step: "0.5",
									onInput: (e) => {
										const val = parseFloat(e.target.value);
										updateSetting("fetchDelayMs", isNaN(val) ? 2e3 : Math.max(2e3, val * 1e3));
									},
									class: "mwm:w-20 mwm:px-2.5 mwm:py-1.5 mwm:bg-mwm-bg-surface mwm:border mwm:border-mwm-border mwm:rounded mwm:text-mwm-text-primary mwm:text-[11px] mwm:transition-all mwm:hover:border-mwm-accent-purple mwm:focus:border-mwm-accent-purple mwm:focus:outline-none"
								})]
							}), u("span", {
								class: "mwm:text-[9px] mwm:text-mwm-text-muted",
								children: "Minimum 2s. Higher = fewer API calls on rapid hovers"
							})]
						}),
u("div", {
							class: "mwm:border-t mwm:border-mwm-border mwm:mt-1 mwm:pt-3",
							children: u("span", {
								class: "mwm:text-[10px] mwm:text-mwm-text-muted mwm:uppercase mwm:tracking-wider",
								children: "Status Indicator"
							})
						}),
u("div", {
							class: "mwm:flex mwm:flex-col mwm:gap-1.5",
							children: [ u("span", {
								class: "mwm:text-[11px] mwm:text-mwm-text-primary",
								children: "Appearance:"
							}), u("div", {
								class: "mwm:flex mwm:gap-1.5",
								children: [ u("button", {
									onClick: () => updateSetting("statusPillStyle", "pill"),
									class: `mwm:px-3 mwm:py-1.5 mwm:rounded mwm:text-[10px] mwm:font-medium mwm:transition-all mwm:border ${s.statusPillStyle === "pill" ? "mwm:bg-mwm-accent-purple mwm:border-mwm-accent-purple mwm:text-white" : "mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-primary mwm:hover:border-mwm-accent-purple"}`,
									children: "Pill with text"
								}), u("button", {
									onClick: () => updateSetting("statusPillStyle", "icon"),
									class: `mwm:px-3 mwm:py-1.5 mwm:rounded mwm:text-[10px] mwm:font-medium mwm:transition-all mwm:border ${s.statusPillStyle === "icon" ? "mwm:bg-mwm-accent-purple mwm:border-mwm-accent-purple mwm:text-white" : "mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-primary mwm:hover:border-mwm-accent-purple"}`,
									children: "Icon only"
								})]
							})]
						}),
u("div", {
							class: "mwm:flex mwm:flex-col mwm:gap-1.5",
							children: [
u("span", {
									class: "mwm:text-[11px] mwm:text-mwm-text-primary",
									children: "Sync frequency:"
								}),
u("div", {
									class: "mwm:flex mwm:gap-1.5",
									children: SYNC_PRESETS$1.map((preset) => u("button", {
										onClick: () => updateSetting("syncIntervalMs", preset.value),
										class: `mwm:px-3 mwm:py-1.5 mwm:rounded mwm:text-[10px] mwm:font-medium mwm:transition-all mwm:border ${s.syncIntervalMs === preset.value ? "mwm:bg-mwm-accent-purple mwm:border-mwm-accent-purple mwm:text-white" : "mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-primary mwm:hover:border-mwm-accent-purple"}`,
										children: preset.label
									}, preset.value))
								}),
u("span", {
									class: "mwm:text-[9px] mwm:text-mwm-text-muted",
									children: "How often character data syncs to storage"
								})
							]
						}),
u("div", {
							class: "mwm:border-t mwm:border-mwm-border mwm:mt-1 mwm:pt-3",
							children: u("span", {
								class: "mwm:text-[10px] mwm:text-mwm-text-muted mwm:uppercase mwm:tracking-wider",
								children: "Troubleshooting"
							})
						}),
u("div", {
							class: "mwm:flex mwm:gap-1.5",
							children: [ u("button", {
								onClick: () => location.reload(),
								class: "mwm:px-3 mwm:py-1.5 mwm:rounded mwm:text-[10px] mwm:font-medium mwm:transition-all mwm:border mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-primary mwm:hover:border-mwm-accent-purple",
								children: "Reload Page"
							}), u("button", {
								onClick: () => {
									reportModalOpen.value = true;
								},
								class: "mwm:px-3 mwm:py-1.5 mwm:rounded mwm:text-[10px] mwm:font-medium mwm:transition-all mwm:border mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-primary mwm:hover:border-mwm-accent-purple",
								children: "Report a Problem"
							})]
						})
					]
				})]
			})
		});
	}
function initSettings() {
		loadSettings();
		log("Settings initialized");
		return registerInjection({
			id: "mwm-settings",
			name: "settings-panel",
			watchPrefix: GAME.settings.profileTab,
			resolve: (settingsPanel) => ({
				parent: settingsPanel,
				position: "append"
			}),
			extract: () => ({}),
			render: () => u(SettingsPanel, {})
		});
	}
	function PriceDisplay({ bid, ask, change }) {
		const changeClass = change !== void 0 && change > 0 ? "mwm:text-mwm-bid mwm:bg-[rgba(192,132,252,0.15)]" : change !== void 0 && change < 0 ? "mwm:text-mwm-ask mwm:bg-[rgba(94,233,197,0.15)]" : "mwm:text-mwm-text-muted mwm:bg-mwm-bg-surface";
		const changeText = change !== void 0 ? change > 0 ? `+${change.toFixed(1)}%` : `${change.toFixed(1)}%` : null;
		return u("div", {
			class: "mwm:relative mwm:z-[1]",
			children: [changeText !== null && u("div", {
				class: "mwm:flex mwm:items-center mwm:justify-between mwm:mb-1.5",
				children: [ u("span", {
					class: "mwm:text-[9px] mwm:font-medium mwm:tracking-wider mwm:uppercase mwm:text-mwm-accent-purple mwm:flex mwm:items-center mwm:gap-1.5",
					children: [ u("span", { class: "mwm:w-1.5 mwm:h-1.5 mwm:bg-mwm-accent-purple mwm:rounded-full mwm:animate-pulse" }), "MWM Prices"]
				}), u("span", {
					class: `mwm:text-[10px] mwm:px-1.5 mwm:py-0.5 mwm:rounded ${changeClass}`,
					children: changeText
				})]
			}), u("div", {
				class: "mwm:flex mwm:items-center mwm:justify-between mwm:gap-3",
				children: [ u("div", {
					class: "mwm:flex mwm:flex-col mwm:gap-0.5",
					children: [ u("span", {
						class: "mwm:text-[8px] mwm:uppercase mwm:tracking-wider mwm:text-mwm-bid",
						children: "Bid"
					}), u("span", {
						class: "mwm:text-[13px] mwm:font-semibold mwm:text-mwm-text-primary",
						children: formatPrice(bid)
					})]
				}), u("div", {
					class: "mwm:flex mwm:flex-col mwm:gap-0.5",
					children: [ u("span", {
						class: "mwm:text-[8px] mwm:uppercase mwm:tracking-wider mwm:text-mwm-ask",
						children: "Ask"
					}), u("span", {
						class: "mwm:text-[13px] mwm:font-semibold mwm:text-mwm-text-primary",
						children: formatPrice(ask)
					})]
				})]
			})]
		});
	}
	var DEFAULT_OPTIONS = {
		height: 36,
		bidColor: "#c084fc",
		askColor: "#5ee9c5",
		fillOpacity: .15,
		lineWidth: 1.5
	};
function renderSparkline(canvas, data, options) {
		const opts = {
			...DEFAULT_OPTIONS,
			...options
		};
		const ctx = canvas.getContext("2d");
		if (!ctx) return;
		const dpr = window.devicePixelRatio || 1;
		canvas.width = opts.width * dpr;
		canvas.height = opts.height * dpr;
		canvas.style.width = `${opts.width}px`;
		canvas.style.height = `${opts.height}px`;
		ctx.scale(dpr, dpr);
		ctx.clearRect(0, 0, opts.width, opts.height);
		if (data.length < 2) return;
		const bidPrices = data.map((d) => d.bidPrice).filter((p) => p !== null);
		const askPrices = data.map((d) => d.askPrice).filter((p) => p !== null);
		const allPrices = [...bidPrices, ...askPrices];
		const minPrice = Math.min(...allPrices);
		const priceRange = Math.max(...allPrices) - minPrice || 1;
		const normalizeY = (price) => {
			const padding = 2;
			const height = opts.height - padding * 2;
			return padding + height - (price - minPrice) / priceRange * height;
		};
		const getX = (index, total) => {
			return index / (total - 1) * opts.width;
		};
		if (askPrices.length >= 2) drawLine(ctx, data, "askPrice", opts.askColor, opts, normalizeY, getX);
		if (bidPrices.length >= 2) drawLine(ctx, data, "bidPrice", opts.bidColor, opts, normalizeY, getX);
	}
function drawLine(ctx, data, priceKey, color, opts, normalizeY, getX) {
		const points = [];
		for (let i = 0; i < data.length; i++) {
			const price = data[i][priceKey];
			if (price !== null) points.push({
				x: getX(i, data.length),
				y: normalizeY(price)
			});
		}
		if (points.length < 2) return;
		ctx.beginPath();
		ctx.moveTo(points[0].x, opts.height);
		for (const point of points) ctx.lineTo(point.x, point.y);
		ctx.lineTo(points[points.length - 1].x, opts.height);
		ctx.closePath();
		const gradient = ctx.createLinearGradient(0, 0, 0, opts.height);
		gradient.addColorStop(0, hexToRgba(color, opts.fillOpacity));
		gradient.addColorStop(1, hexToRgba(color, 0));
		ctx.fillStyle = gradient;
		ctx.fill();
		ctx.beginPath();
		ctx.moveTo(points[0].x, points[0].y);
		for (let i = 1; i < points.length; i++) ctx.lineTo(points[i].x, points[i].y);
		ctx.strokeStyle = color;
		ctx.lineWidth = opts.lineWidth;
		ctx.lineCap = "round";
		ctx.lineJoin = "round";
		ctx.stroke();
	}
function hexToRgba(hex, alpha) {
		return `rgba(${parseInt(hex.slice(1, 3), 16)}, ${parseInt(hex.slice(3, 5), 16)}, ${parseInt(hex.slice(5, 7), 16)}, ${alpha})`;
	}
function createSparklineCanvas() {
		const canvas = document.createElement("canvas");
		canvas.className = "mwm-sparkline";
		canvas.style.width = "100%";
		canvas.style.display = "block";
		return canvas;
	}
	function Sparkline({ data, options }) {
		const containerRef = A(null);
		const canvasRef = A(null);
		const draw = q$1(() => {
			const container = containerRef.current;
			if (!container || data.length < 2) return;
			if (!canvasRef.current) {
				canvasRef.current = createSparklineCanvas();
				container.innerHTML = "";
				container.appendChild(canvasRef.current);
			}
			const width = container.clientWidth;
			if (width > 0) renderSparkline(canvasRef.current, data, {
				...options,
				width
			});
		}, [data, options]);
		y$2(() => {
			const container = containerRef.current;
			if (!container) return;
			canvasRef.current = null;
			draw();
			const ro = new ResizeObserver(() => draw());
			ro.observe(container);
			return () => {
				ro.disconnect();
				if (container) container.innerHTML = "";
				canvasRef.current = null;
			};
		}, [draw]);
		return u("div", {
			ref: containerRef,
			class: "mwm:w-full mwm:h-8 mwm:rounded mwm:bg-mwm-bg-surface mwm:relative mwm:z-[1]"
		});
	}
	function TooltipPrice({ itemHrid, enhancement, tooltipEl }) {
		const state = usePriceData({
			itemHrid,
			enhancement,
			delayMs: getSettings().fetchDelayMs,
			guardEl: tooltipEl
		});
		return u("div", {
			class: "mwm-root mwm:mt-2 mwm:px-2.5 mwm:py-2 mwm:rounded-md mwm:border mwm:border-mwm-border mwm:bg-mwm-bg-panel mwm:overflow-hidden",
			children: [
				state.status === "loading" && u(Loading, {}),
				state.status === "data" && u(k$2, { children: [ u(PriceDisplay, {
					bid: state.data[state.data.length - 1]?.bidPrice ?? null,
					ask: state.data[state.data.length - 1]?.askPrice ?? null,
					change: calculateChange(state.data)
				}), u("div", {
					class: "mwm:mt-1.5",
					children: u(Sparkline, { data: state.data })
				})] }),
				state.status === "empty" && u("div", {
					class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-1.5 mwm:text-mwm-text-muted mwm:text-[9px]",
					children: "No market data available"
				}),
				state.status === "error" && u("div", {
					class: "mwm:flex mwm:items-center mwm:justify-center mwm:py-1.5 mwm:text-mwm-text-muted mwm:text-[9px]",
					children: "Failed to load prices"
				})
			]
		});
	}
function initTooltipPrices() {
		log("Initializing tooltip prices");
		return registerInjection({
			id: "mwm-tooltip-price",
			name: "tooltip-prices",
			watchPrefix: GAME.tooltip.popper,
			contain: true,
			enabled: () => getSettings().tooltipGraphEnabled && !isMarketplaceActive(),
			resolve(tooltip) {
				const content = qcls(tooltip, GAME.tooltip.content);
				if (!content || content.querySelector(".mwm-root")) return null;
				return {
					parent: content,
					position: "append"
				};
			},
			extract(tooltip) {
				const itemName = qcls(tooltip, GAME.tooltip.name)?.textContent?.trim();
				if (!itemName) return null;
				const enhMatch = /\s*\+(\d+)$/.exec(itemName);
				const enhancement = enhMatch ? parseInt(enhMatch[1], 10) : 0;
				const itemHrid = nameToHrid(itemName.replace(/\s*\+\d+$/, ""));
				if (isNonTradeable(itemHrid)) return null;
				return {
					itemHrid,
					enhancement,
					tooltipEl: tooltip
				};
			},
			render: (props) => u(TooltipPrice, {
				itemHrid: props.itemHrid,
				enhancement: props.enhancement,
				tooltipEl: props.tooltipEl
			})
		});
	}
function hookWebSocket(onMessage) {
		const dataDesc = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
		if (!dataDesc?.get) {
			warn("Cannot hook WebSocket - MessageEvent.prototype.data not found");
			reportError("WS_HOOK_FAILED", "MessageEvent.prototype.data getter not found");
			markCheckpoint("ws_hooked", "failed", "data getter not found");
			return;
		}
		const originalGet = dataDesc.get;
		dataDesc.get = function hookedGet() {
			const socket = this.currentTarget;
			if (!(socket instanceof WebSocket)) return originalGet.call(this);
			if (!WS_ENDPOINTS.some((ep) => socket.url?.includes(ep))) return originalGet.call(this);
			const message = originalGet.call(this);
			Object.defineProperty(this, "data", { value: message });
			if (typeof message === "string") try {
				const data = JSON.parse(message);
				if (data?.type) setTimeout(() => onMessage(data.type, data), 0);
			} catch {}
			return message;
		};
		Object.defineProperty(MessageEvent.prototype, "data", dataDesc);
		markCheckpoint("ws_hooked", "ok");
		log("WebSocket hook installed");
	}
	function ReportModal() {
		const isOpen = reportModalOpen.value;
		const [status, setStatus] = d$2("idle");
		const [countdown, setCountdown] = d$2(0);
		const [name, setName] = d$2("");
		const [discord, setDiscord] = d$2("");
		const [message, setMessage] = d$2("");
		const backdropRef = A(null);
		const countdownRef = A(null);
		y$2(() => {
			if (isOpen) {
				setName(getReportName());
				setDiscord(getReportDiscord());
				setMessage("");
				setStatus("idle");
			}
		}, [isOpen]);
		y$2(() => {
			if (status === "rate_limited" && countdown > 0) {
				countdownRef.current = setInterval(() => {
					setCountdown((prev) => {
						if (prev <= 1) {
							if (countdownRef.current) clearInterval(countdownRef.current);
							setStatus("idle");
							return 0;
						}
						return prev - 1;
					});
				}, 1e3);
				return () => {
					if (countdownRef.current) clearInterval(countdownRef.current);
				};
			}
		}, [status, countdown]);
		const close = q$1(() => {
			reportModalOpen.value = false;
		}, []);
		y$2(() => {
			if (status === "success") {
				const timer = setTimeout(close, 2e3);
				return () => clearTimeout(timer);
			}
		}, [status, close]);
		y$2(() => {
			if (!isOpen) return;
			const handler = (e) => {
				if (e.key === "Escape") close();
			};
			window.addEventListener("keydown", handler);
			return () => window.removeEventListener("keydown", handler);
		}, [isOpen, close]);
		const handleSubmit = async () => {
			setStatus("sending");
			setReportName(name);
			setReportDiscord(discord);
			const result = await sendReport({
				name: name || void 0,
				discordHandle: discord || void 0,
				description: message || void 0
			});
			if (result.success) setStatus("success");
			else if (result.error === "rate_limited" && result.retryAfter) {
				setCountdown(result.retryAfter);
				setStatus("rate_limited");
			} else {
				setStatus("error");
				setTimeout(() => setStatus("idle"), 3e3);
			}
		};
		const handleBackdropClick = (e) => {
			if (e.target === backdropRef.current) close();
		};
		if (!isOpen) return null;
		const formatCountdown = (s) => {
			return `${Math.floor(s / 60)}:${(s % 60).toString().padStart(2, "0")}`;
		};
		const isDisabled = status === "sending" || status === "rate_limited";
		return u("div", {
			ref: backdropRef,
			onClick: handleBackdropClick,
			style: {
				position: "fixed",
				inset: 0,
				zIndex: 99999,
				display: "flex",
				alignItems: "center",
				justifyContent: "center",
				backgroundColor: "rgba(0, 0, 0, 0.5)"
			},
			children: u("div", {
				style: {
					width: "320px",
					backgroundColor: "var(--mwm-bg-panel, #1a1a2e)",
					border: "1px solid var(--mwm-border, #2a2a4a)",
					borderRadius: "8px",
					padding: "16px",
					fontFamily: "system-ui, sans-serif"
				},
				children: [
u("div", {
						style: {
							display: "flex",
							justifyContent: "space-between",
							alignItems: "center",
							marginBottom: "12px"
						},
						children: [ u("span", {
							style: {
								fontSize: "13px",
								fontWeight: 600,
								color: "var(--mwm-accent-purple, #8b5cf6)"
							},
							children: "Report a Problem"
						}), u("button", {
							onClick: close,
							style: {
								background: "none",
								border: "none",
								color: "var(--mwm-text-muted, #888)",
								cursor: "pointer",
								fontSize: "16px",
								padding: "0 4px",
								lineHeight: 1
							},
							children: "×"
						})]
					}),
u("div", {
						style: {
							display: "flex",
							flexDirection: "column",
							gap: "8px"
						},
						children: [
u("div", { children: [ u("input", {
								type: "text",
								placeholder: "Your name",
								value: name,
								onInput: (e) => setName(e.target.value),
								maxLength: 100,
								disabled: isDisabled,
								style: {
									width: "100%",
									boxSizing: "border-box",
									padding: "6px 8px",
									fontSize: "11px",
									backgroundColor: "var(--mwm-bg-surface, #16162a)",
									border: "1px solid var(--mwm-border, #2a2a4a)",
									borderRadius: "4px",
									color: "var(--mwm-text-primary, #e0e0e0)",
									outline: "none"
								}
							}), u("span", {
								style: {
									fontSize: "9px",
									color: "var(--mwm-text-muted, #888)",
									marginTop: "2px",
									display: "block"
								},
								children: "Helps us contact you for more details"
							})] }),
u("input", {
								type: "text",
								placeholder: "Discord handle (optional)",
								value: discord,
								onInput: (e) => setDiscord(e.target.value),
								maxLength: 100,
								disabled: isDisabled,
								style: {
									width: "100%",
									boxSizing: "border-box",
									padding: "6px 8px",
									fontSize: "11px",
									backgroundColor: "var(--mwm-bg-surface, #16162a)",
									border: "1px solid var(--mwm-border, #2a2a4a)",
									borderRadius: "4px",
									color: "var(--mwm-text-primary, #e0e0e0)",
									outline: "none"
								}
							}),
u("textarea", {
								placeholder: "Briefly describe the issue (optional)",
								value: message,
								onInput: (e) => setMessage(e.target.value),
								maxLength: 240,
								disabled: isDisabled,
								rows: 3,
								style: {
									width: "100%",
									boxSizing: "border-box",
									padding: "6px 8px",
									fontSize: "11px",
									backgroundColor: "var(--mwm-bg-surface, #16162a)",
									border: "1px solid var(--mwm-border, #2a2a4a)",
									borderRadius: "4px",
									color: "var(--mwm-text-primary, #e0e0e0)",
									outline: "none",
									resize: "none",
									fontFamily: "inherit"
								}
							}),
u("div", {
								style: {
									fontSize: "9px",
									color: "var(--mwm-text-muted, #888)",
									textAlign: "right"
								},
								children: [message.length, "/240"]
							})
						]
					}),
u("div", {
						style: {
							marginTop: "12px",
							display: "flex",
							gap: "8px"
						},
						children: [ u("button", {
							onClick: close,
							style: {
								flex: 1,
								padding: "6px",
								fontSize: "10px",
								fontWeight: 500,
								backgroundColor: "var(--mwm-bg-surface, #16162a)",
								border: "1px solid var(--mwm-border, #2a2a4a)",
								borderRadius: "4px",
								color: "var(--mwm-text-primary, #e0e0e0)",
								cursor: "pointer"
							},
							children: "Cancel"
						}), u("button", {
							onClick: handleSubmit,
							disabled: isDisabled,
							style: {
								flex: 1,
								padding: "6px",
								fontSize: "10px",
								fontWeight: 500,
								backgroundColor: isDisabled ? "var(--mwm-bg-surface, #16162a)" : "var(--mwm-accent-purple, #8b5cf6)",
								border: `1px solid ${isDisabled ? "var(--mwm-border, #2a2a4a)" : "var(--mwm-accent-purple, #8b5cf6)"}`,
								borderRadius: "4px",
								color: isDisabled ? "var(--mwm-text-muted, #888)" : "#fff",
								cursor: isDisabled ? "not-allowed" : "pointer",
								opacity: isDisabled ? .6 : 1
							},
							children: [
								status === "idle" && "Send Report",
								status === "sending" && "Sending...",
								status === "success" && "Sent! Copied to clipboard",
								status === "rate_limited" && `Sent! ${formatCountdown(countdown)}`,
								status === "error" && "Failed — copied to clipboard"
							]
						})]
					}),
u("div", {
						style: {
							marginTop: "8px",
							fontSize: "9px",
							color: "var(--mwm-text-muted, #888)",
							textAlign: "center"
						},
						children: "Diagnostic data will be sent alongside your report"
					})
				]
			})
		});
	}
	function initReportModal() {
		injectComponent(document.body, _$2(ReportModal, null), { id: "mwm-report-modal" });
	}
	var STATUS_LABELS = {
		ADDON_OK: "Connected",
		WS_DISCONNECTED: "Game Disconnected",
		WS_HOOK_FAILED: "WebSocket Hook Failed",
		STORAGE_ERROR: "Storage Error",
		NO_CHARACTER_DATA: "No Character Data",
		STALE_DATA: "Data is Stale",
		CONFLICT_DETECTED: "Conflict Detected"
	};
	var SEVERITY_DOT = {
		ok: "mwm:bg-emerald-400",
		warn: "mwm:bg-amber-400",
		error: "mwm:bg-red-400"
	};
	function statusSeverity(code) {
		if (code === "ADDON_OK") return "ok";
		if (code === "STALE_DATA" || code === "NO_CHARACTER_DATA") return "warn";
		return "error";
	}
	var SYNC_PRESETS = [
		{
			label: "30s",
			value: 3e4
		},
		{
			label: "60s",
			value: 6e4
		},
		{
			label: "2m",
			value: 12e4
		},
		{
			label: "5m",
			value: 3e5
		}
	];
	var CP_DOT = {
		ok: "mwm:bg-emerald-400",
		failed: "mwm:bg-red-400",
		pending: "mwm:bg-amber-400 mwm:animate-pulse",
		skipped: "mwm:bg-mwm-text-muted"
	};
	function CheckpointRow({ cp }) {
		return u("div", {
			class: "mwm:flex mwm:justify-between mwm:items-start mwm:gap-2",
			children: [ u("div", {
				class: "mwm:flex mwm:items-center mwm:gap-2",
				children: [ u("span", {
					class: `mwm:rounded-full mwm:shrink-0 ${CP_DOT[cp.status]}`,
					style: {
						width: "4px",
						height: "4px"
					}
				}), u("span", {
					class: "mwm:text-mwm-text-primary mwm:flex-1 mwm:text-xs",
					children: cp.label
				})]
			}), cp.detail && cp.status !== "skipped" && u("span", {
				class: "mwm:text-mwm-text-muted mwm:text-xs",
				children: cp.detail
			})]
		});
	}
	function StatusDetails({ info, version }) {
		const currentInterval = settings.value.syncIntervalMs;
		const severity = statusSeverity(info.status);
		const dotColor = SEVERITY_DOT[severity];
		const visibleCheckpoints = info.checkpoints.filter((cp) => cp.status !== "skipped");
		return u("div", {
			class: "mwm:absolute mwm:top-full mwm:right-0 mwm:rounded-lg   mwm:bg-mwm-bg-panel mwm:z-50 mwm:overflow-hidden ",
			style: {
				marginTop: "6px",
				width: "200px"
			},
			children: [
u("div", {
					class: "mwm:p-2 ",
					children: u("div", {
						class: "mwm:flex mwm:items-center mwm:justify-between",
						children: [ u("p", {
							class: "mwm:text-mwm-accent-purple mwm:font-semibold mwm:flex mwm:items-center mwm:gap-2 mwm:text-xs",
							children: ["MWM Addon", u("span", {
								class: "mwm:text-mwm-text-muted mwm:text-xs",
								children: ["v", version]
							})]
						}), u("span", { class: `mwm:rounded-full mwm:shrink-0 ${dotColor} mwm:size-2` })]
					})
				}),
				visibleCheckpoints.length > 0 && u("div", {
					class: "mwm:border-b mwm:border-mwm-border mwm:p-2",
					children: visibleCheckpoints.map((cp) => u(CheckpointRow, { cp }, cp.id))
				}),
				info.errors.length > 0 && u("div", {
					style: { padding: "6px 10px" },
					class: "mwm:border-b mwm:border-mwm-border",
					children: info.errors.slice(-3).map((err, i) => u("div", {
						class: "mwm:flex mwm:items-center mwm:gap-[6px]",
						style: { padding: "2px 0" },
						children: [ u("span", {
							class: "mwm:rounded-full mwm:shrink-0 mwm:bg-red-400",
							style: {
								width: "4px",
								height: "4px"
							}
						}), u("span", {
							class: "mwm:text-red-400",
							style: { fontSize: "10px" },
							children: STATUS_LABELS[err.code]
						})]
					}, i))
				}),
u("div", {
					style: { padding: "7px 10px 8px" },
					children: [ u("div", {
						class: "mwm:text-mwm-text-muted mwm:uppercase",
						style: {
							fontSize: "8px",
							letterSpacing: "0.08em",
							marginBottom: "5px"
						},
						children: "Sync interval"
					}), u("div", {
						class: "mwm:grid mwm:grid-cols-4 mwm:gap-[3px]",
						children: SYNC_PRESETS.map((preset) => {
							return u("button", {
								onClick: () => updateSetting("syncIntervalMs", preset.value),
								class: `mwm:rounded mwm:border mwm:text-center mwm:cursor-pointer mwm:transition-colors ${currentInterval === preset.value ? "mwm:bg-mwm-accent-purple/20 mwm:border-mwm-accent-purple/50 mwm:text-mwm-accent-purple" : "mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-muted mwm:hover:text-mwm-text-primary mwm:hover:border-mwm-accent-purple/30"}`,
								style: {
									fontSize: "9px",
									padding: "3px 0",
									fontWeight: 500
								},
								children: preset.label
							}, preset.value);
						})
					})]
				}),
				severity !== "ok" && u("div", {
					style: { padding: "7px 10px 8px" },
					class: "mwm:border-t mwm:border-mwm-border",
					children: u("div", {
						class: "mwm:grid mwm:grid-cols-2 mwm:gap-[3px]",
						children: [ u("button", {
							onClick: () => location.reload(),
							class: "mwm:rounded mwm:border mwm:text-center mwm:cursor-pointer mwm:transition-colors mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-muted mwm:hover:text-mwm-text-primary mwm:hover:border-mwm-accent-purple/30",
							style: {
								fontSize: "9px",
								padding: "3px 0",
								fontWeight: 500
							},
							children: "Reload"
						}), u("button", {
							onClick: () => {
								reportModalOpen.value = true;
							},
							class: "mwm:rounded mwm:border mwm:text-center mwm:cursor-pointer mwm:transition-colors mwm:bg-mwm-bg-surface mwm:border-mwm-border mwm:text-mwm-text-muted mwm:hover:text-mwm-text-primary mwm:hover:border-mwm-accent-purple/30",
							style: {
								fontSize: "9px",
								padding: "3px 0",
								fontWeight: 500
							},
							children: "Report"
						})]
					})
				})
			]
		});
	}
function MwmLogo({ class: cls, style: s }) {
		return u("svg", {
			xmlns: "http://www.w3.org/2000/svg",
			viewBox: "0 0 2589 1596",
			class: cls,
			style: {
				fillRule: "evenodd",
				clipRule: "evenodd",
				strokeLinejoin: "round",
				strokeMiterlimit: 2,
				...s
			},
			children: [
u("path", {
					d: "M4 14h32v25H4z",
					style: {
						fill: "#fefefe",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M32.5 1H7l-6 9.756v6.342C1.5 18.398 2.7 21 5.5 21s4.667-2.602 5-3.902c.333 1.3 2.2 3.902 5 3.902s4.167-2.602 4.5-3.902c.333 1.3 1.7 3.902 4.5 3.902s4.667-2.602 5-3.902c.333 1.3 1.8 3.902 5 3.902s4-2.602 4.5-3.902v-6.342L32.5 1Z",
					style: {
						fill: "#ce4317",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M32.5 1H7l-6 9.756v6.342C1.5 18.398 2.7 21 5.5 21s4.667-2.602 5-3.902c.333 1.3 2.2 3.902 5 3.902s4.167-2.602 4.5-3.902c.333 1.3 1.7 3.902 4.5 3.902s4.667-2.602 5-3.902c.333 1.3 1.8 3.902 5 3.902s4-2.602 4.5-3.902v-6.342L32.5 1Z",
					style: {
						fill: "#fff",
						fillOpacity: ".3",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M1 10.5 7 1h25.5l6.5 9.5H1Z",
					style: {
						fill: "#898989",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M1 10.5 7 1h25.5l6.5 9.5H1Z",
					style: {
						fill: "#fff",
						fillOpacity: ".6",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M12 26h7v13h-7z",
					style: {
						fill: "#546ddb",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M12 26h7v13h-7z",
					style: {
						fill: "#fff",
						fillOpacity: ".4",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M21 26h7v13h-7z",
					style: {
						fill: "#546ddb",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M21 26h7v13h-7z",
					style: {
						fill: "#fff",
						fillOpacity: ".4",
						fillRule: "nonzero"
					},
					transform: "matrix(41.98128 0 0 41.98128 514.587063 -41.936769)"
				}),
u("path", {
					d: "M12.552 22.61c2.528.016 7.039-.036 10.047.486l-.451 2.865-.057-.002c-3.875-.113-10.565-.322-11.408 2.968-.848 3.306 11.945 10.75 27.121 14.776 15.176 4.028 29.99 4.563 31.197.342.805-2.813-3.063-6.238-6.094-7.647l.377-2.457c1.972.8 4.027 1.991 5.997 3.128 2.304 1.328 10.624 6.003 9.595 10.018-1.12 4.37-15.07 6.45-41.858-.313C13.062 40.725-.668 31.547.633 26.469c.817-3.188 8.407-3.88 11.92-3.859h-.001Z",
					style: {
						fill: "#faa21e",
						fillRule: "nonzero"
					},
					transform: "rotate(-9.0668 1557.8701 1099.178805) scale(32.14441)"
				}),
u("path", {
					d: "M12.552 22.61c2.528.016 7.107-.047 10.115.475l-.519 2.876-.057-.002c-3.875-.113-10.565-.322-11.408 2.968-.848 3.306 11.945 10.75 27.121 14.776 15.176 4.028 29.99 4.563 31.197.342.805-2.813-3.04-6.207-6.071-7.616l.299-2.497c1.972.8 4.082 2 6.052 3.137 2.304 1.328 10.624 6.003 9.595 10.018-1.12 4.37-15.07 6.45-41.858-.313C13.062 40.725-.668 31.547.633 26.469c.817-3.188 8.407-3.88 11.92-3.859h-.001Z",
					style: {
						fill: "#fff",
						fillOpacity: ".2",
						fillRule: "nonzero"
					},
					transform: "rotate(-9.0668 1557.8701 1099.178805) scale(32.14441)"
				})
			]
		});
	}
	function getDisplay(status, hasData) {
		if (status === "ADDON_OK" && hasData) return {
			label: "Connected",
			dotColor: "mwm:bg-emerald-400",
			borderColor: "mwm:border-emerald-500"
		};
		if (status === "ADDON_OK" && !hasData) return {
			label: "Connecting",
			dotColor: "mwm:bg-amber-400",
			borderColor: "mwm:border-amber-500",
			pulse: true
		};
		if (["STALE_DATA", "NO_CHARACTER_DATA"].includes(status)) return {
			label: {
				STALE_DATA: "Stale",
				NO_CHARACTER_DATA: "No Data"
			}[status] ?? status,
			dotColor: "mwm:bg-amber-400",
			borderColor: "mwm:border-amber-500/30"
		};
		return {
			label: {
				WS_DISCONNECTED: "Offline",
				WS_HOOK_FAILED: "Error",
				STORAGE_ERROR: "Error",
				CONFLICT_DETECTED: "Conflict"
			}[status] ?? status,
			dotColor: "mwm:bg-red-400",
			borderColor: "mwm:border-red-500/30"
		};
	}
	function StatusPill() {
		const info = addonStatus.value;
		const style = settings.value.statusPillStyle;
		const hasData = info.characterName !== null;
		const display = getDisplay(info.status, hasData);
		const [hovered, setHovered] = d$2(false);
		const hideTimerRef = A(null);
		const showPanel = q$1(() => {
			if (hideTimerRef.current) {
				clearTimeout(hideTimerRef.current);
				hideTimerRef.current = null;
			}
			setHovered(true);
		}, []);
		const hidePanel = q$1(() => {
			hideTimerRef.current = setTimeout(() => setHovered(false), 200);
		}, []);
		y$2(() => {
			return () => {
				if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
			};
		}, []);
		const isPill = style === "pill";
		return u("div", {
			class: ` mwm:z-50 ${isPill ? "mwm:absolute mwm:-top-8 mwm:right-0" : ""}`,
			onMouseEnter: showPanel,
			onMouseLeave: hidePanel,
			children: [isPill ? u("div", {
				class: `mwm:flex mwm:items-center mwm:justify-between mwm:gap-2 mwm:rounded mwm:border mwm:border-mwm-accent-purple ${display.borderColor} mwm:bg-mwm-bg-surface mwm:px-2 mwm:py-1 mwm:cursor-default `,
				children: [
u(MwmLogo, { class: "mwm:size-4 " }),
u("span", {
						class: "mwm:text-mwm-text-primary mwm:font-medium mwm:text-xs mwm:leading-0.5",
						children: display.label
					}),
u("span", { class: `mwm:rounded-full ${display.dotColor} ${display.pulse ? "mwm:animate-pulse" : ""} mwm:size-2 mwm:shrink-0` })
				]
			}) : u("div", {
				class: `mwm:inline-flex mwm:items-center mwm:justify-center mwm:rounded mwm:border-2 ${display.borderColor}  mwm:cursor-default mwm:relative mwm:size-10`,
				title: `Milky Way Market: ${display.label}`,
				children: [ u(MwmLogo, { class: "mwm:size-5 mwm:shrink-0" }), u("span", { class: `mwm:rounded-full ${display.dotColor} ${display.pulse ? "mwm:animate-pulse" : ""} mwm:size-2 mwm:absolute mwm:bottom-0.5 mwm:right-0.5` })]
			}), hovered && u(StatusDetails, {
				info,
				version: VERSION
			})]
		});
	}
	function inject(communityBuffs) {
		if (communityBuffs.querySelector("#mwm-status-pill")) return;
		const el = communityBuffs;
		if (getComputedStyle(el).position === "static") el.style.position = "relative";
		injectComponent(communityBuffs, u(StatusPill, {}), {
			id: "mwm-status-pill",
			position: "append"
		});
		log("Status pill injected");
	}
function initStatusPill() {
		log("Initializing status pill");
		const existing = document.querySelector(cls(GAME.header.communityBuffs));
		if (existing) inject(existing);
		return domObserver.onClass("status-pill", GAME.header.communityBuffs, (el) => {
			inject(el);
		});
	}
	_virtual_monkey_css_side_effects_default("/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}@layer theme{:root,:host{--mwm-font-sans:ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--mwm-color-red-400:oklch(70.4% .191 22.216);--mwm-color-red-500:oklch(63.7% .237 25.331);--mwm-color-amber-400:oklch(82.8% .189 84.429);--mwm-color-amber-500:oklch(76.9% .188 70.08);--mwm-color-emerald-400:oklch(76.5% .177 163.223);--mwm-color-emerald-500:oklch(69.6% .17 162.48);--mwm-color-white:#fff;--mwm-spacing:.25rem;--mwm-text-xs:.75rem;--mwm-text-xs--line-height:calc(1 / .75);--mwm-text-sm:.875rem;--mwm-text-sm--line-height:calc(1.25 / .875);--mwm-text-lg:1.125rem;--mwm-text-lg--line-height:calc(1.75 / 1.125);--mwm-font-weight-medium:500;--mwm-font-weight-semibold:600;--mwm-tracking-wider:.05em;--mwm-radius-md:.375rem;--mwm-radius-lg:.5rem;--mwm-animate-spin:spin 1s linear infinite;--mwm-animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--mwm-default-transition-duration:.15s;--mwm-default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--mwm-default-font-family:var(--mwm-font-sans);--mwm-default-mono-font-family:\"SF Mono\", \"Fira Code\", Consolas, Monaco, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--mwm-default-font-family,ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");font-feature-settings:var(--mwm-default-font-feature-settings,normal);font-variation-settings:var(--mwm-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--mwm-default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace);font-feature-settings:var(--mwm-default-mono-font-feature-settings,normal);font-variation-settings:var(--mwm-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.mwm\\:pointer-events-none{pointer-events:none!important}.mwm\\:absolute{position:absolute!important}.mwm\\:fixed{position:fixed!important}.mwm\\:relative{position:relative!important}.mwm\\:-top-8{top:calc(var(--mwm-spacing) * -8)!important}.mwm\\:top-0{top:calc(var(--mwm-spacing) * 0)!important}.mwm\\:top-full{top:100%!important}.mwm\\:right-0{right:calc(var(--mwm-spacing) * 0)!important}.mwm\\:right-0\\.5{right:calc(var(--mwm-spacing) * .5)!important}.mwm\\:bottom-0\\.5{bottom:calc(var(--mwm-spacing) * .5)!important}.mwm\\:left-0{left:calc(var(--mwm-spacing) * 0)!important}.mwm\\:z-10{z-index:10!important}.mwm\\:z-50{z-index:50!important}.mwm\\:z-\\[1\\]{z-index:1!important}.mwm\\:z-\\[999999\\]{z-index:999999!important}.mwm\\:my-2{margin-block:calc(var(--mwm-spacing) * 2)!important}.mwm\\:my-3{margin-block:calc(var(--mwm-spacing) * 3)!important}.mwm\\:mt-1{margin-top:calc(var(--mwm-spacing) * 1)!important}.mwm\\:mt-1\\.5{margin-top:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:mt-2{margin-top:calc(var(--mwm-spacing) * 2)!important}.mwm\\:mt-5{margin-top:calc(var(--mwm-spacing) * 5)!important}.mwm\\:mb-0\\.5{margin-bottom:calc(var(--mwm-spacing) * .5)!important}.mwm\\:mb-1{margin-bottom:calc(var(--mwm-spacing) * 1)!important}.mwm\\:mb-1\\.5{margin-bottom:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:mb-2{margin-bottom:calc(var(--mwm-spacing) * 2)!important}.mwm\\:mb-3{margin-bottom:calc(var(--mwm-spacing) * 3)!important}.mwm\\:mb-4{margin-bottom:calc(var(--mwm-spacing) * 4)!important}.mwm\\:mb-5{margin-bottom:calc(var(--mwm-spacing) * 5)!important}.mwm\\:ml-2{margin-left:calc(var(--mwm-spacing) * 2)!important}.mwm\\:block{display:block!important}.mwm\\:flex{display:flex!important}.mwm\\:grid{display:grid!important}.mwm\\:inline-flex{display:inline-flex!important}.mwm\\:size-2{width:calc(var(--mwm-spacing) * 2)!important;height:calc(var(--mwm-spacing) * 2)!important}.mwm\\:size-4{width:calc(var(--mwm-spacing) * 4)!important;height:calc(var(--mwm-spacing) * 4)!important}.mwm\\:size-5{width:calc(var(--mwm-spacing) * 5)!important;height:calc(var(--mwm-spacing) * 5)!important}.mwm\\:size-10{width:calc(var(--mwm-spacing) * 10)!important;height:calc(var(--mwm-spacing) * 10)!important}.mwm\\:h-1\\.5{height:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:h-2{height:calc(var(--mwm-spacing) * 2)!important}.mwm\\:h-3{height:calc(var(--mwm-spacing) * 3)!important}.mwm\\:h-5{height:calc(var(--mwm-spacing) * 5)!important}.mwm\\:h-6{height:calc(var(--mwm-spacing) * 6)!important}.mwm\\:h-8{height:calc(var(--mwm-spacing) * 8)!important}.mwm\\:h-\\[18px\\]{height:18px!important}.mwm\\:w-1\\.5{width:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:w-2{width:calc(var(--mwm-spacing) * 2)!important}.mwm\\:w-3{width:calc(var(--mwm-spacing) * 3)!important}.mwm\\:w-5{width:calc(var(--mwm-spacing) * 5)!important}.mwm\\:w-6{width:calc(var(--mwm-spacing) * 6)!important}.mwm\\:w-20{width:calc(var(--mwm-spacing) * 20)!important}.mwm\\:w-\\[18px\\]{width:18px!important}.mwm\\:w-full{width:100%!important}.mwm\\:max-w-full{max-width:100%!important}.mwm\\:flex-1{flex:1!important}.mwm\\:shrink-0{flex-shrink:0!important}.mwm\\:animate-\\[mwm-slide-down_0\\.3s_ease-out\\]{animation:.3s ease-out mwm-slide-down!important}.mwm\\:animate-pulse{animation:var(--mwm-animate-pulse)!important}.mwm\\:animate-spin{animation:var(--mwm-animate-spin)!important}.mwm\\:cursor-crosshair{cursor:crosshair!important}.mwm\\:cursor-default{cursor:default!important}.mwm\\:cursor-pointer{cursor:pointer!important}.mwm\\:appearance-none{appearance:none!important}.mwm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}.mwm\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))!important}.mwm\\:flex-col{flex-direction:column!important}.mwm\\:items-center{align-items:center!important}.mwm\\:items-start{align-items:flex-start!important}.mwm\\:justify-between{justify-content:space-between!important}.mwm\\:justify-center{justify-content:center!important}.mwm\\:gap-0\\.5{gap:calc(var(--mwm-spacing) * .5)!important}.mwm\\:gap-1{gap:calc(var(--mwm-spacing) * 1)!important}.mwm\\:gap-1\\.5{gap:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:gap-2{gap:calc(var(--mwm-spacing) * 2)!important}.mwm\\:gap-2\\.5{gap:calc(var(--mwm-spacing) * 2.5)!important}.mwm\\:gap-3{gap:calc(var(--mwm-spacing) * 3)!important}.mwm\\:gap-4{gap:calc(var(--mwm-spacing) * 4)!important}.mwm\\:gap-\\[3px\\]{gap:3px!important}.mwm\\:gap-\\[6px\\]{gap:6px!important}.mwm\\:overflow-hidden{overflow:hidden!important}.mwm\\:rounded{border-radius:.25rem!important}.mwm\\:rounded-full{border-radius:3.40282e38px!important}.mwm\\:rounded-lg{border-radius:var(--mwm-radius-lg)!important}.mwm\\:rounded-md{border-radius:var(--mwm-radius-md)!important}.mwm\\:border{border-style:var(--tw-border-style)!important;border-width:1px!important}.mwm\\:border-2{border-style:var(--tw-border-style)!important;border-width:2px!important}.mwm\\:border-t{border-top-style:var(--tw-border-style)!important;border-top-width:1px!important}.mwm\\:border-b{border-bottom-style:var(--tw-border-style)!important;border-bottom-width:1px!important}.mwm\\:border-none{--tw-border-style:none!important;border-style:none!important}.mwm\\:border-\\[rgba\\(255\\,255\\,255\\,0\\.3\\)\\]{border-color:#ffffff4d!important}.mwm\\:border-amber-500,.mwm\\:border-amber-500\\/30{border-color:var(--mwm-color-amber-500)!important}@supports (color:color-mix(in lab, red, red)){.mwm\\:border-amber-500\\/30{border-color:color-mix(in oklab, var(--mwm-color-amber-500) 30%, transparent)!important}}.mwm\\:border-emerald-500{border-color:var(--mwm-color-emerald-500)!important}.mwm\\:border-mwm-accent-purple{border-color:#8b5cf6!important}.mwm\\:border-mwm-accent-purple\\/50{border-color:oklab(60.5631% .0845415 -.201932/.5)!important}.mwm\\:border-mwm-border{border-color:#3b599840!important}.mwm\\:border-red-500\\/30{border-color:var(--mwm-color-red-500)!important}@supports (color:color-mix(in lab, red, red)){.mwm\\:border-red-500\\/30{border-color:color-mix(in oklab, var(--mwm-color-red-500) 30%, transparent)!important}}.mwm\\:border-t-mwm-accent-purple{border-top-color:#8b5cf6!important}.mwm\\:bg-\\[rgba\\(94\\,233\\,197\\,0\\.15\\)\\]{background-color:#5ee9c526!important}.mwm\\:bg-\\[rgba\\(192\\,132\\,252\\,0\\.15\\)\\]{background-color:#c084fc26!important}.mwm\\:bg-\\[rgba\\(255\\,255\\,255\\,0\\.1\\)\\]{background-color:#ffffff1a!important}.mwm\\:bg-\\[rgba\\(255\\,255\\,255\\,0\\.2\\)\\]{background-color:#fff3!important}.mwm\\:bg-amber-400{background-color:var(--mwm-color-amber-400)!important}.mwm\\:bg-emerald-400{background-color:var(--mwm-color-emerald-400)!important}.mwm\\:bg-mwm-accent-purple{background-color:#8b5cf6!important}.mwm\\:bg-mwm-accent-purple\\/20{background-color:oklab(60.5631% .0845415 -.201932/.2)!important}.mwm\\:bg-mwm-ask{background-color:#5ee9c5!important}.mwm\\:bg-mwm-bg-panel{background-color:#12162af2!important}.mwm\\:bg-mwm-bg-surface{background-color:#1e243c99!important}.mwm\\:bg-mwm-bid{background-color:#c084fc!important}.mwm\\:bg-mwm-text-muted{background-color:#e2e8f080!important}.mwm\\:bg-red-400{background-color:var(--mwm-color-red-400)!important}.mwm\\:bg-gradient-to-r{--tw-gradient-position:to right in oklab!important;background-image:linear-gradient(var(--tw-gradient-stops))!important}.mwm\\:from-\\[rgba\\(220\\,38\\,38\\,0\\.95\\)\\]{--tw-gradient-from:#dc2626f2!important;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))!important}.mwm\\:to-\\[rgba\\(185\\,28\\,28\\,0\\.95\\)\\]{--tw-gradient-to:#b91c1cf2!important;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))!important}.mwm\\:p-2{padding:calc(var(--mwm-spacing) * 2)!important}.mwm\\:p-3\\.5{padding:calc(var(--mwm-spacing) * 3.5)!important}.mwm\\:px-1{padding-inline:calc(var(--mwm-spacing) * 1)!important}.mwm\\:px-1\\.5{padding-inline:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:px-2{padding-inline:calc(var(--mwm-spacing) * 2)!important}.mwm\\:px-2\\.5{padding-inline:calc(var(--mwm-spacing) * 2.5)!important}.mwm\\:px-3{padding-inline:calc(var(--mwm-spacing) * 3)!important}.mwm\\:px-3\\.5{padding-inline:calc(var(--mwm-spacing) * 3.5)!important}.mwm\\:px-4{padding-inline:calc(var(--mwm-spacing) * 4)!important}.mwm\\:px-6{padding-inline:calc(var(--mwm-spacing) * 6)!important}.mwm\\:py-0\\.5{padding-block:calc(var(--mwm-spacing) * .5)!important}.mwm\\:py-1{padding-block:calc(var(--mwm-spacing) * 1)!important}.mwm\\:py-1\\.5{padding-block:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:py-2{padding-block:calc(var(--mwm-spacing) * 2)!important}.mwm\\:py-2\\.5{padding-block:calc(var(--mwm-spacing) * 2.5)!important}.mwm\\:py-3{padding-block:calc(var(--mwm-spacing) * 3)!important}.mwm\\:py-4{padding-block:calc(var(--mwm-spacing) * 4)!important}.mwm\\:py-5{padding-block:calc(var(--mwm-spacing) * 5)!important}.mwm\\:pt-1\\.5{padding-top:calc(var(--mwm-spacing) * 1.5)!important}.mwm\\:pt-3{padding-top:calc(var(--mwm-spacing) * 3)!important}.mwm\\:pb-3{padding-bottom:calc(var(--mwm-spacing) * 3)!important}.mwm\\:text-center{text-align:center!important}.mwm\\:font-mono{font-family:SF Mono,Fira Code,Consolas,Monaco,monospace!important}.mwm\\:text-lg{font-size:var(--mwm-text-lg)!important;line-height:var(--tw-leading,var(--mwm-text-lg--line-height))!important}.mwm\\:text-sm{font-size:var(--mwm-text-sm)!important;line-height:var(--tw-leading,var(--mwm-text-sm--line-height))!important}.mwm\\:text-xs{font-size:var(--mwm-text-xs)!important;line-height:var(--tw-leading,var(--mwm-text-xs--line-height))!important}.mwm\\:text-\\[7px\\]{font-size:7px!important}.mwm\\:text-\\[8px\\]{font-size:8px!important}.mwm\\:text-\\[9px\\]{font-size:9px!important}.mwm\\:text-\\[10px\\]{font-size:10px!important}.mwm\\:text-\\[11px\\]{font-size:11px!important}.mwm\\:text-\\[13px\\]{font-size:13px!important}.mwm\\:leading-0\\.5{--tw-leading:calc(var(--mwm-spacing) * .5)!important;line-height:calc(var(--mwm-spacing) * .5)!important}.mwm\\:leading-none{--tw-leading:1!important;line-height:1!important}.mwm\\:font-medium{--tw-font-weight:var(--mwm-font-weight-medium)!important;font-weight:var(--mwm-font-weight-medium)!important}.mwm\\:font-semibold{--tw-font-weight:var(--mwm-font-weight-semibold)!important;font-weight:var(--mwm-font-weight-semibold)!important}.mwm\\:tracking-\\[0\\.02em\\]{--tw-tracking:.02em!important;letter-spacing:.02em!important}.mwm\\:tracking-\\[0\\.05em\\]{--tw-tracking:.05em!important;letter-spacing:.05em!important}.mwm\\:tracking-wider{--tw-tracking:var(--mwm-tracking-wider)!important;letter-spacing:var(--mwm-tracking-wider)!important}.mwm\\:text-\\[rgba\\(255\\,255\\,255\\,0\\.7\\)\\]{color:#ffffffb3!important}.mwm\\:text-mwm-accent-purple{color:#8b5cf6!important}.mwm\\:text-mwm-ask{color:#5ee9c5!important}.mwm\\:text-mwm-bid{color:#c084fc!important}.mwm\\:text-mwm-text-muted{color:#e2e8f080!important}.mwm\\:text-mwm-text-primary{color:#e2e8f0!important}.mwm\\:text-red-400{color:var(--mwm-color-red-400)!important}.mwm\\:text-white{color:var(--mwm-color-white)!important}.mwm\\:uppercase{text-transform:uppercase!important}.mwm\\:no-underline{text-decoration-line:none!important}.mwm\\:shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#0000004d)!important;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)!important}.mwm\\:shadow-\\[0_4px_20px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\,0_0_40px_rgba\\(220\\,38\\,38\\,0\\.2\\)\\]{--tw-shadow:0 4px 20px var(--tw-shadow-color,#0000004d), 0 0 40px var(--tw-shadow-color,#dc262633)!important;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)!important}.mwm\\:transition-all{transition-property:all!important;transition-timing-function:var(--tw-ease,var(--mwm-default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--mwm-default-transition-duration))!important}.mwm\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to!important;transition-timing-function:var(--tw-ease,var(--mwm-default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--mwm-default-transition-duration))!important}.mwm\\:transition-opacity{transition-property:opacity!important;transition-timing-function:var(--tw-ease,var(--mwm-default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--mwm-default-transition-duration))!important}.mwm\\:checked\\:border-mwm-accent-purple:checked{border-color:#8b5cf6!important}.mwm\\:checked\\:bg-mwm-accent-purple:checked{background-color:#8b5cf6!important}@media (hover:hover){.mwm\\:hover\\:-translate-y-px:hover{--tw-translate-y:-1px!important;translate:var(--tw-translate-x) var(--tw-translate-y)!important}.mwm\\:hover\\:border-\\[rgba\\(255\\,255\\,255\\,0\\.5\\)\\]:hover{border-color:#ffffff80!important}.mwm\\:hover\\:border-mwm-accent-purple:hover{border-color:#8b5cf6!important}.mwm\\:hover\\:border-mwm-accent-purple\\/30:hover{border-color:oklab(60.5631% .0845415 -.201932/.3)!important}.mwm\\:hover\\:bg-\\[rgba\\(139\\,92\\,246\\,0\\.1\\)\\]:hover{background-color:#8b5cf61a!important}.mwm\\:hover\\:bg-\\[rgba\\(255\\,255\\,255\\,0\\.2\\)\\]:hover{background-color:#fff3!important}.mwm\\:hover\\:bg-\\[rgba\\(255\\,255\\,255\\,0\\.3\\)\\]:hover{background-color:#ffffff4d!important}.mwm\\:hover\\:bg-\\[rgba\\(255\\,255\\,255\\,0\\.08\\)\\]:hover{background-color:#ffffff14!important}.mwm\\:hover\\:bg-red-500:hover{background-color:var(--mwm-color-red-500)!important}.mwm\\:hover\\:text-mwm-text-primary:hover{color:#e2e8f0!important}.mwm\\:hover\\:text-white:hover{color:var(--mwm-color-white)!important}.mwm\\:hover\\:opacity-80:hover{opacity:.8!important}}.mwm\\:focus\\:border-mwm-accent-purple:focus{border-color:#8b5cf6!important}.mwm\\:focus\\:outline-none:focus{--tw-outline-style:none!important;outline-style:none!important}}@keyframes mwm-slide-down{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}#mwm-status-pill{align-items:center!important;margin:0!important;padding:0!important;display:inline-flex!important}.mwm-sparkline{width:100%;display:block}.mwm-root input[type=checkbox]:checked:after{content:\"✓\";color:#fff;font-size:11px;font-weight:700;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:\"*\";inherits:false}@property --tw-gradient-from{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:\"*\";inherits:false}@property --tw-gradient-via-stops{syntax:\"*\";inherits:false}@property --tw-gradient-from-position{syntax:\"<length-percentage>\";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:\"<length-percentage>\";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:\"<length-percentage>\";inherits:false;initial-value:100%}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}");
	C(() => {
		const expectedVersion = needsUpdate.value;
		if (!expectedVersion) return;
		if (document.getElementById("mwm-update-banner")) return;
		const host = document.createElement("div");
		host.className = "mwm-root";
		host.id = "mwm-update-banner";
		document.body.appendChild(host);
		const dismiss = () => {
			J(null, host);
			host.remove();
		};
		J(_$2(UpdateBanner, {
			expectedVersion,
			onDismiss: dismiss
		}), host);
		warn(`Update required: v${VERSION} → v${expectedVersion}`);
	});
function signalPresence() {
		const existing = window.__MWM_ADDON__;
		if (existing && existing !== VERSION) reportError("CONFLICT_DETECTED", `Another addon version detected: ${existing}`);
		window.__MWM_ADDON__ = VERSION;
		window.dispatchEvent(new CustomEvent(EVENTS.ADDON_READY, { detail: { version: VERSION } }));
		log("Addon ready");
	}
	var characterData = null;
async function initGameSite() {
		markCheckpoint("cross_tab", "skipped", "game site");
		hookWebSocket((type, data) => {
			switch (type) {
				case "init_character_data":
					characterData = data;
					log("Character initialized:", characterData.character?.name);
					markCheckpoint("character_received", "ok", characterData.character?.name);
					syncToStorage(characterData, true);
					refreshStatus();
					break;
				case "items_updated": {
					if (!characterData) return;
					const itemsData = data;
					const items = itemsData.characterItems || itemsData.items;
					if (items) mergeItems(characterData, items);
					syncToStorage(characterData);
					break;
				}
				case "action_completed": {
					if (!characterData) return;
					const actionData = data;
					const items = actionData.characterItems || actionData.endCharacterItems;
					const skills = actionData.characterSkills || actionData.endCharacterSkills;
					if (items) mergeItems(characterData, items);
					if (skills) mergeSkills(characterData, skills);
					syncToStorage(characterData);
					break;
				}
			}
		});
		window.addEventListener(EVENTS.REQUEST, (event) => {
			log("Data request received");
			const customEvent = event;
			if (characterData) {
				syncToStorage(characterData, true);
				const detail = {
					requestId: customEvent.detail?.requestId,
					data: characterData,
					source: "game_site"
				};
				window.dispatchEvent(new CustomEvent(EVENTS.RESPONSE, { detail }));
			} else warn("No character data available");
		});
		domObserver.start();
		initSettings();
		initStatusPill();
		initReportModal();
		initTooltipPrices();
		initItemModal();
		initMarketplacePrices();
		log("Game site initialized");
	}
function initMarketSite() {
		markCheckpoint("ws_hooked", "skipped", "market site");
		markCheckpoint("character_received", "skipped", "market site");
		characterData = loadFromStorage();
		if (!characterData) reportError("NO_CHARACTER_DATA", "No character data in GM storage");
		try {
			_GM_addValueChangeListener(STORAGE_KEY$1, (_name, _oldValue, newValue, remote) => {
				if (!remote || !newValue?.data) return;
				const storedData = newValue;
				characterData = storedData.data;
				log("Cross-tab update:", characterData.character?.name);
				const detail = {
					data: characterData,
					source: "cross_tab",
					timestamp: storedData.timestamp
				};
				window.dispatchEvent(new CustomEvent(EVENTS.UPDATED, { detail }));
			});
			markCheckpoint("cross_tab", "ok");
		} catch (err) {
			markCheckpoint("cross_tab", "failed", err instanceof Error ? err.message : "GM_addValueChangeListener failed");
		}
		window.addEventListener(EVENTS.REQUEST, (event) => {
			log("Pull request received");
			const customEvent = event;
			if (characterData) {
				const detail = {
					requestId: customEvent.detail?.requestId,
					data: characterData,
					source: "storage"
				};
				window.dispatchEvent(new CustomEvent(EVENTS.RESPONSE, { detail }));
			} else warn("No character data in storage");
		});
		if (characterData) setTimeout(() => {
			const detail = {
				data: characterData,
				source: "initial_load",
				timestamp: Date.now()
			};
			window.dispatchEvent(new CustomEvent(EVENTS.UPDATED, { detail }));
		}, 100);
		log("Market site initialized");
	}
	function init() {
		markCheckpoint("script_loaded", "ok", VERSION);
		signalPresence();
		initHealthCheck({ getCharacterData: () => characterData });
		if (isGameSite) initGameSite();
		else if (isMarketSite) initMarketSite();
	}
	init();
})();