@ganwei-web/gw-base-components-plus 1.0.27 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ (function(a, D){ typeof exports == "object" && typeof module < "u" ? module.exports = D(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], D) : (a = typeof globalThis < "u" ? globalThis : a || self, a.EquipListVue3 = D(a.Vue)) })(this, function(a){
2
+ "use strict";const D = "";function qe(i, e){ let t = Object.keys(i);if(Object.getOwnPropertySymbols){ let s = Object.getOwnPropertySymbols(i);e && (s = s.filter(function(n){ return Object.getOwnPropertyDescriptor(i, n).enumerable })), t.push.apply(t, s) }return t }function F(i){ for(let e = 1;e < arguments.length;e++){ var t = arguments[e] != null ? arguments[e] : {};e % 2 ? qe(Object(t), !0).forEach(function(s){ ot(i, s, t[s]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(t)) : qe(Object(t)).forEach(function(s){ Object.defineProperty(i, s, Object.getOwnPropertyDescriptor(t, s)) }) }return i }function nt(i, e){ if(!(i instanceof e)){ throw new TypeError("Cannot call a class as a function") } }function Oe(i, e){ for(let t = 0;t < e.length;t++){ let s = e[t];s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(i, s.key, s) } }function rt(i, e, t){ return e && Oe(i.prototype, e), t && Oe(i, t), i }function ot(i, e, t){ return e in i ? Object.defineProperty(i, e, {value: t, enumerable: !0, configurable: !0, writable: !0}) : i[e] = t, i }function at(i){ return ht(i) || ct(i) || ut(i) || lt() }function ht(i){ if(Array.isArray(i)){ return ne(i) } }function ct(i){ if(typeof Symbol < "u" && i[Symbol.iterator] != null || i["@@iterator"] != null){ return Array.from(i) } }function ut(i, e){ if(i){ if(typeof i == "string"){ return ne(i, e); }let t = Object.prototype.toString.call(i).slice(8, -1);if(t === "Object" && i.constructor && (t = i.constructor.name), t === "Map" || t === "Set"){ return Array.from(i); }if(t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)){ return ne(i, e) } } }function ne(i, e){ (e == null || e > i.length) && (e = i.length);for(var t = 0, s = new Array(e);t < e;t++){ s[t] = i[t]; }return s }function lt(){
3
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)
5
+ }let I = {FRONT: "FRONT", BEHIND: "BEHIND"}, x = {INIT: "INIT", FIXED: "FIXED", DYNAMIC: "DYNAMIC"}, ve = 2, dt = (function(){ function i(e, t){ nt(this, i), this.init(e, t) }return rt(i, [{key: "init", value: function(t, s){ this.param = t, this.callUpdate = s, this.sizes = new Map, this.firstRangeTotalSize = 0, this.firstRangeAverageSize = 0, this.lastCalcIndex = 0, this.fixedSizeValue = 0, this.calcType = x.INIT, this.offset = 0, this.direction = "", this.range = Object.create(null), t && this.checkRange(0, t.keeps - 1) }}, {key: "destroy", value: function(){ this.init(null, null) }}, {key: "getRange", value: function(){ let t = Object.create(null);return t.start = this.range.start, t.end = this.range.end, t.padFront = this.range.padFront, t.padBehind = this.range.padBehind, t }}, {key: "isBehind", value: function(){ return this.direction === I.BEHIND }}, {key: "isFront", value: function(){ return this.direction === I.FRONT }}, {key: "getOffset", value: function(t){ return(t < 1 ? 0 : this.getIndexOffset(t)) + this.param.slotHeaderSize }}, {key: "updateParam", value: function(t, s){ let n = this;this.param && t in this.param && (t === "uniqueIds" && this.sizes.forEach(function(r, o){ s.includes(o) || n.sizes.delete(o) }), this.param[t] = s) }}, {key: "saveSize", value: function(t, s){ this.sizes.set(t, s), this.calcType === x.INIT ? (this.fixedSizeValue = s, this.calcType = x.FIXED) : this.calcType === x.FIXED && this.fixedSizeValue !== s && (this.calcType = x.DYNAMIC, delete this.fixedSizeValue), this.calcType !== x.FIXED && typeof this.firstRangeTotalSize < "u" && (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length) ? (this.firstRangeTotalSize = at(this.sizes.values()).reduce(function(n, r){ return n + r }, 0), this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)) : delete this.firstRangeTotalSize) }}, {key: "handleDataSourcesChange", value: function(){ let t = this.range.start;this.isFront() ? t = t - ve : this.isBehind() && (t = t + ve), t = Math.max(t, 0), this.updateRange(this.range.start, this.getEndByStart(t)) }}, {key: "handleSlotSizeChange", value: function(){ this.handleDataSourcesChange() }}, {key: "handleScroll", value: function(t){ this.direction = t < this.offset ? I.FRONT : I.BEHIND, this.offset = t, this.param && (this.direction === I.FRONT ? this.handleFront() : this.direction === I.BEHIND && this.handleBehind()) }}, {key: "handleFront", value: function(){ let t = this.getScrollOvers();if(!(t > this.range.start)){ let s = Math.max(t - this.param.buffer, 0);this.checkRange(s, this.getEndByStart(s)) } }}, {key: "handleBehind", value: function(){ let t = this.getScrollOvers();t < this.range.start + this.param.buffer || this.checkRange(t, this.getEndByStart(t)) }}, {key: "getScrollOvers", value: function(){ let t = this.offset - this.param.slotHeaderSize;if(t <= 0){ return 0; }if(this.isFixedType()){ return Math.floor(t / this.fixedSizeValue); }for(var s = 0, n = 0, r = 0, o = this.param.uniqueIds.length;s <= o;){ if(n = s + Math.floor((o - s) / 2), r = this.getIndexOffset(n), r === t){ return n; }r < t ? s = n + 1 : r > t && (o = n - 1) }return s > 0 ? --s : 0 }}, {key: "getIndexOffset", value: function(t){ if(!t){ return 0; }for(var s = 0, n = 0, r = 0;r < t;r++){ n = this.sizes.get(this.param.uniqueIds[r]), s = s + (typeof n == "number" ? n : this.getEstimateSize()); }return this.lastCalcIndex = Math.max(this.lastCalcIndex, t - 1), this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex()), s }}, {key: "isFixedType", value: function(){ return this.calcType === x.FIXED }}, {key: "getLastIndex", value: function(){ return this.param.uniqueIds.length - 1 }}, {key: "checkRange", value: function(t, s){ let n = this.param.keeps, r = this.param.uniqueIds.length;r <= n ? (t = 0, s = this.getLastIndex()) : s - t < n - 1 && (t = s - n + 1), this.range.start !== t && this.updateRange(t, s) }}, {key: "updateRange", value: function(t, s){ this.range.start = t, this.range.end = s, this.range.padFront = this.getPadFront(), this.range.padBehind = this.getPadBehind(), this.callUpdate(this.getRange()) }}, {key: "getEndByStart", value: function(t){ let s = t + this.param.keeps - 1, n = Math.min(s, this.getLastIndex());return n }}, {key: "getPadFront", value: function(){ return this.isFixedType() ? this.fixedSizeValue * this.range.start : this.getIndexOffset(this.range.start) }}, {key: "getPadBehind", value: function(){ let t = this.range.end, s = this.getLastIndex();return this.isFixedType() ? (s - t) * this.fixedSizeValue : this.lastCalcIndex === s ? this.getIndexOffset(s) - this.getIndexOffset(t) : (s - t) * this.getEstimateSize() }}, {key: "getEstimateSize", value: function(){ return this.isFixedType() ? this.fixedSizeValue : this.firstRangeAverageSize || this.param.estimateSize }}]), i })(), pt = {dataKey: {type: [String, Function], required: !0}, dataSources: {type: Array, required: !0, default: function(){ return[] }}, dataComponent: {type: [Object, Function], required: !0}, keeps: {type: Number, default: 30}, extraProps: {type: Object}, estimateSize: {type: Number, default: 50}, direction: {type: String, default: "vertical"}, start: {type: Number, default: 0}, offset: {type: Number, default: 0}, topThreshold: {type: Number, default: 0}, bottomThreshold: {type: Number, default: 0}, pageMode: {type: Boolean, default: !1}, rootTag: {type: String, default: "div"}, wrapTag: {type: String, default: "div"}, wrapClass: {type: String, default: "wrap"}, wrapStyle: {type: Object}, itemTag: {type: String, default: "div"}, itemClass: {type: String, default: ""}, itemClassAdd: {type: Function}, itemStyle: {type: Object}, headerTag: {type: String, default: "div"}, headerClass: {type: String, default: ""}, headerStyle: {type: Object}, footerTag: {type: String, default: "div"}, footerClass: {type: String, default: ""}, footerStyle: {type: Object}, itemScopedSlots: {type: Object}}, ft = {index: {type: Number}, event: {type: String}, tag: {type: String}, horizontal: {type: Boolean}, source: {type: Object}, component: {type: [Object, Function]}, uniqueKey: {type: [String, Number]}, extraProps: {type: Object}, scopedSlots: {type: Object}}, gt = {event: {type: String}, uniqueKey: {type: String}, tag: {type: String}, horizontal: {type: Boolean}}, Te = function(e, t, s){ let n = null, r = a.computed(function(){ return e.horizontal ? "offsetWidth" : "offsetHeight" }), o = function(){ return t.value ? t.value[r.value] : 0 }, h = function(){ let l = e.event, u = e.uniqueKey, d = e.hasInitial;s(l, u, o(), d) };a.onMounted(function(){ typeof ResizeObserver < "u" && (n = new ResizeObserver(function(){ h() }), t.value && n.observe(t.value)) }), a.onUpdated(function(){ h() }), a.onUnmounted(function(){ n && (n.disconnect(), n = null) }) }, mt = a.defineComponent({name: "VirtualListItem", props: ft, emits: ["itemResize"], setup: function(e, t){ let s = t.emit, n = a.ref(null);return Te(e, n, s), function(){ let r = e.tag, o = e.component, h = e.extraProps, c = h === void 0 ? {} : h, l = e.index, u = e.source, d = e.scopedSlots, w = d === void 0 ? {} : d, S = e.uniqueKey, N = F(F({}, c), {}, {source: u, index: l});return a.createVNode(r, {key: S, ref: n}, {default: function(){ return[a.createVNode(o, F(F({}, N), {}, {scopedSlots: w}), null)] }}) } }}), xe = a.defineComponent({name: "VirtualListSlot", props: gt, emits: ["slotResize"], setup: function(e, t){ let s = t.slots, n = t.emit, r = a.ref(null);return Te(e, r, n), function(){ let o, h = e.tag, c = e.uniqueKey;return a.createVNode(h, {ref: r, key: c}, {default: function(){ return[(o = s.default) === null || o === void 0 ? void 0 : o.call(s)] }}) } }}), G;(function(i){ i.ITEM = "itemResize", i.SLOT = "slotResize" })(G || (G = {}));let j;(function(i){ i.HEADER = "thead", i.FOOTER = "tfoot" })(j || (j = {}));let yt = a.defineComponent({name: "VirtualList", props: pt, setup: function(e, t){ let s = t.emit, n = t.slots, r = t.expose, o = e.direction === "horizontal", h = o ? "scrollLeft" : "scrollTop", c = a.ref(null), l = a.ref(), u = a.ref(null), d;a.watch(function(){ return e.dataSources.length }, function(){ d.updateParam("uniqueIds", Qe()), d.handleDataSourcesChange() }), a.watch(function(){ return e.keeps }, function(g){ d.updateParam("keeps", g), d.handleSlotSizeChange() }), a.watch(function(){ return e.start }, function(g){ be(g) }), a.watch(function(){ return e.offset }, function(g){ return R(g) });var w = function(p){ return d.sizes.get(p) }, S = function(){ return e.pageMode ? document.documentElement[h] || document.body[h] : l.value ? Math.ceil(l.value[h]) : 0 }, N = function(){ let p = o ? "clientWidth" : "clientHeight";return e.pageMode ? document.documentElement[p] || document.body[p] : l.value ? Math.ceil(l.value[p]) : 0 }, M = function(){ let p = o ? "scrollWidth" : "scrollHeight";return e.pageMode ? document.documentElement[p] || document.body[p] : l.value ? Math.ceil(l.value[p]) : 0 }, zs = function(p, m, b, C){ s("scroll", C, d.getRange()), d.isFront() && e.dataSources.length && p - e.topThreshold <= 0 ? s("totop") : d.isBehind() && p + m + e.bottomThreshold >= b && s("tobottom") }, Se = function(p){ let m = S(), b = N(), C = M();m < 0 || m + b > C + 1 || !C || (d.handleScroll(m), zs(m, b, C, p)) }, Qe = function(){ let p = e.dataKey, m = e.dataSources, b = m === void 0 ? [] : m;return b.map(function(C){ return typeof p == "function" ? p(C) : C[p] }) }, Ds = function(p){ c.value = p }, Fs = function(){ d = new dt({slotHeaderSize: 0, slotFooterSize: 0, keeps: e.keeps, estimateSize: e.estimateSize, buffer: Math.round(e.keeps / 3), uniqueIds: Qe()}, Ds), c.value = d.getRange() }, be = function(p){ if(p >= e.dataSources.length - 1){ et(); }else{ let m = d.getOffset(p);R(m) } }, R = function(p){ e.pageMode ? (document.body[h] = p, document.documentElement[h] = p) : l.value && (l.value[h] = p) }, Vs = function(){ for(var p = [], m = c.value, b = m.start, C = m.end, Ce = e.dataSources, L = e.dataKey, Ee = e.itemClass, ke = e.itemTag, Ne = e.itemStyle, _e = e.extraProps, se = e.dataComponent, ie = e.itemScopedSlots, O = b;O <= C;O++){ let A = Ce[O];if(A){ let z = typeof L == "function" ? L(A) : A[L];typeof z == "string" || typeof z == "number" ? p.push(a.createVNode(mt, {index: O, tag: ke, event: G.ITEM, horizontal: o, uniqueKey: z, source: A, extraProps: _e, component: se, scopedSlots: ie, style: Ne, class: "".concat(Ee).concat(e.itemClassAdd ? " " + e.itemClassAdd(O) : ""), onItemResize: Us}, null)) : console.warn("Cannot get the data-key '".concat(L, "' from data-sources.")) }else { console.warn("Cannot get the index '".concat(O, "' from data-sources.")) } }return p }, Us = function(p, m){ d.saveSize(p, m), s("resized", p, m) }, Ze = function(p, m, b){ p === j.HEADER ? d.updateParam("slotHeaderSize", m) : p === j.FOOTER && d.updateParam("slotFooterSize", m), b && d.handleSlotSizeChange() }, et = function g(){ if(u.value){ let p = u.value[o ? "offsetLeft" : "offsetTop"];R(p), setTimeout(function(){ S() + N() < M() && g() }, 3) } }, Ks = function(){ if(l.value){ let p = l.value.getBoundingClientRect(), m = l.value.ownerDocument.defaultView, b = o ? p.left + m.pageXOffset : p.top + m.pageYOffset;d.updateParam("slotHeaderSize", b) } }, Ws = function(){ return d.sizes.size };return a.onBeforeMount(function(){ Fs() }), a.onActivated(function(){ R(d.offset) }), a.onMounted(function(){ e.start ? be(e.start) : e.offset && R(e.offset), e.pageMode && (Ks(), document.addEventListener("scroll", Se, {passive: !1})) }), a.onUnmounted(function(){ d.destroy(), e.pageMode && document.removeEventListener("scroll", Se) }), r({scrollToBottom: et, getSizes: Ws, getSize: w, getOffset: S, getScrollSize: M, getClientSize: N, scrollToOffset: R, scrollToIndex: be}), function(){ let g = e.pageMode, p = e.rootTag, m = e.wrapTag, b = e.wrapClass, C = e.wrapStyle, Ce = e.headerTag, L = e.headerClass, Ee = e.headerStyle, ke = e.footerTag, Ne = e.footerClass, _e = e.footerStyle, se = c.value, ie = se.padFront, O = se.padBehind, A = {padding: o ? "0px ".concat(O, "px 0px ").concat(ie, "px") : "".concat(ie, "px 0px ").concat(O, "px")}, z = C ? Object.assign({}, C, A) : A, tt = n.header, st = n.footer;return a.createVNode(p, {ref: l, onScroll: !g && Se}, {default: function(){ return[tt && a.createVNode(xe, {class: L, style: Ee, tag: Ce, event: G.SLOT, uniqueKey: j.HEADER, onSlotResize: Ze}, {default: function(){ return[tt()] }}), a.createVNode(m, {class: b, style: z}, {default: function(){ return[Vs()] }}), st && a.createVNode(xe, {class: Ne, style: _e, tag: ke, event: G.SLOT, uniqueKey: j.FOOTER, onSlotResize: Ze}, {default: function(){ return[st()] }}), a.createVNode("div", {ref: u, style: {width: o ? "0px" : "100%", height: o ? "100%" : "0px"}}, null)] }}) } }});class wt{constructor(e, t, s){ this.groupNodeObject = e, this.nodesMap = t, this.controlObject = s }addNodesMap(e){ e && e.forEach(t=>{ this.nodesMap[t.key] = t }) }removeNodesMap(e){ e && e.forEach(t=>{ delete this.nodesMap[t.key] }) }recycleAllNodeCache(e){ for(let t in this.groupNodeObject){ this.groupNodeObject[t].expand = !1, this.groupNodeObject[t].count = 0, this.recycleGroupCache(this.groupNodeObject[t].key), e && delete this.groupNodeObject[t] } }recycleGroupCache(e){ if(this.groupNodeObject[e]){ this.groupNodeObject[e].children = [], this.removeNodesMap(this.groupNodeObject[e].equips), this.groupNodeObject[e].equips = [], this.groupNodeObject[e].equips.length = 0, this.groupNodeObject[e].expand = !1;for(let t in this.groupNodeObject){ this.groupNodeObject[t].groupId == e && this.recycleGroupCache(this.groupNodeObject[t].key) } } }closeBrotherNode(e){ if(e && this.groupNodeObject[e]){ let t = this.groupNodeObject[e].groupId;for(let s in this.groupNodeObject){ this.groupNodeObject[s].groupId == t && this.groupNodeObject[s].key != e && this.groupNodeObject[s].expand && (this.groupNodeObject[s].expand = !1, this.recycleGroupCache(this.groupNodeObject[s].key)) } } }}class V{constructor(){ this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }}const Me = {data(){ return{window: null} }, created(){ this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }};class St extends V{constructor(e, t, s, n, r, o){ super(), this.equipControllObject = s, this.groupNodeObject = e, this.nodesMap = t, this.controlObject = n, this.equipCheckObject = r, this.isSearchStatus = !1, this.searchStatusGroupObject = {}, this.aliasName = o }resetCheckedStatus(){ Object.values(this.nodesMap).forEach(e=>{ this.setCheckStatus(e.key, !1, !1) }), Object.keys(this.equipCheckObject).forEach(e=>delete this.equipCheckObject[e]), this.updateGroupCheckStatus() }reComputedCheckNum(e){ this.isSearchStatus = e, this.updateGroupCheckStatus() }updateCheckedStatusWithEquips(e){ Object.keys(this.equipCheckObject).forEach(s=>{ s.split("-").length === 2 && delete this.equipCheckObject[s] });let t = [];Array.isArray(e) ? t = e.map(s=>({equipNo: s, groupId: null})) : e !== null && typeof e == "object" && Object.keys(e).forEach(s=>{ Array.isArray(e[s]) && e[s].forEach(n=>{ t.push({equipNo: n, groupId: Number(s)}) }) });for(let s = 0, n = t.length;s < n;s++){ const{equipNo: r, groupId: o} = t[s];if(o != null){ const h = `${o}-${r}`;this.setEquipCheckObject(h, !0, !1, o), this.setCheckStatus(h, !0, !1), this.updateExpandControlCheckStatus(o, r) }else{ const h = this.window.equipCache && this.window.equipCache[r];h && (h.groupIds || (h.groupId ? [h.groupId] : [])).forEach(l=>{ const u = `${l}-${r}`;this.setEquipCheckObject(u, !0, !1, l), this.setCheckStatus(u, !0, !1), this.updateExpandControlCheckStatus(l, r) }) } } }updateExpandControlCheckStatus(e, t){ let s = this.nodesMap[`${e}-${t}`];s && s.settings && s.settings.length && s.settings.forEach(n=>{ this.nodesMap[`${e}-${t}-${n.setNo}`] && this.setCheckStatus(`${e}-${t}-${n.setNo}`, !0, !1) }) }updateCheckedStatusWithControls(e){ for(let t = 0, s = e.length;t < s;t++){ let n = e[t], r, o, h;if(n !== null && typeof n == "object" && !Array.isArray(n)){ r = n.equipNo, o = n.setNo, h = n.groupId; }else{ let l = n.split(".");r = l[0], o = l[1], h = null }this.equipControllObject[r] || (this.equipControllObject[r] = []), this.equipControllObject[r].push(Number(o));const c = this.window.equipCache && this.window.equipCache[r];c && (h != null ? [h] : c.groupIds || (c.groupId ? [c.groupId] : [])).forEach(u=>{ const d = `${u}-${r}`, w = `${u}-${r}-${o}`;this.nodesMap[w] && this.setCheckStatus(w, !0, !1), this.nodesMap[d] && this.setCheckStatus(d, !1, !0), this.setEquipCheckObject(d, !1, !0, u) }) } }updateGroupCheckStatus(){ this.getSortedGroupsByLevel().forEach(t=>{ const s = this.computeGroupStatus(t.key);this.setCheckStatus(t.key, s.checked, s.indeterminate), t.equipSelectCount = s.selectCount }) }getSortedGroupsByLevel(){ return Object.values(this.groupNodeObject).sort((e, t)=>t.level - e.level) }computeGroupStatus(e){ const t = this.groupNodeObject[e];if(!t){ return{checked: !1, indeterminate: !1, selectCount: 0}; }let s = this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || [];!this.isSearchStatus && s.length === 0 && this.aliasName && (s = this.window[`group-${e}`] || []);let n = 0, r = s.length || t.equipCount || 0;if(s.length > 0){ s.forEach(w=>{ const S = w.equipNo || w.id, N = `${e}-${S}`;this.equipCheckObject[N] && this.equipCheckObject[N].checked && n++ }); }else{ const w = `${e}-`;Object.keys(this.equipCheckObject).forEach(S=>{ S.startsWith(w) && S.split("-").length === 2 && this.equipCheckObject[S].checked && n++ }) }let o = 0, h = 0, c = !1, l = !1;t.groups && t.groups.length > 0 && t.groups.forEach(w=>{ const S = this.nodesMap[w.key], N = this.groupNodeObject[w.key];if(S){ const M = S.count || (N ? N.equipCount : 0) || 0;h += M, S.checked ? (o += M, c = !0) : S.indeterminate ? (l = !0, c = !0) : l = !0 } });const u = n + o;let d = t.count || 0;return d === 0 && (d = r + h), u === 0 && !c ? {checked: !1, indeterminate: !1, selectCount: 0} : d === 0 ? u > 0 ? {checked: !1, indeterminate: !0, selectCount: u} : {checked: !1, indeterminate: !1, selectCount: 0} : u === 0 ? c ? {checked: !1, indeterminate: !0, selectCount: u} : {checked: !1, indeterminate: !1, selectCount: 0} : u === d && !l ? {checked: !0, indeterminate: !1, selectCount: u} : {checked: !1, indeterminate: !0, selectCount: u} }setControlStatus(e, t, s, n){ e && e.forEach(r=>{ this.nodesMap[`${t}-${s}-${r.setNo}`] && this.setCheckStatus(`${t}-${s}-${r.setNo}`, n, !1) }) }updateControlCheckStatus(){ Object.keys(this.controlObject).forEach(e=>{ const[t, s] = e.split("-");let n = this.nodesMap[e];if(n){ if(n.checked){ let r = n.settings;this.setControlStatus(r, t, s, !0) }else if(!n.checked && !n.indeterminate){ let r = n.settings;this.setControlStatus(r, t, s, !1) }else { this.equipControllObject[s] && this.equipControllObject[s].forEach(r=>{ let o = `${t}-${s}-${r}`;this.nodesMap[o] && this.setCheckStatus(o, !0, !1) }) } } }) }getGroupChecked(){ let e = [];return Object.keys(this.groupNodeObject).forEach(t=>{ this.groupNodeObject[t].checked && e.push(t) }), e }getEquipSelectd(){ let e = [], t = new Set;return Object.keys(this.equipCheckObject).forEach(s=>{ if(this.equipCheckObject[s].checked){ try{ t.add(Number(s.split("-")[1])) }catch(n){ console.log(n) } } }), e = Array.from(t), e }getEquipGroupSelectd(){ let e = Object.keys(this.equipCheckObject);return e.length > 0 && (e = this.returnArray(e)), e }returnArray(e){ const t = [];return e.forEach(s=>{ const n = s.split("-");if(n.length >= 2){ const r = parseInt(n[0]), o = parseInt(n[1]);!isNaN(r) && !isNaN(o) && t.push({groupId: r, equipNo: o}) } }), t }parseEquipArrayToGroupFormat(e){ const t = {};return e.forEach(s=>{ const[n, r] = s.split("-"), o = parseInt(n);isNaN(o) || (t[o] || (t[o] = []), t[o].push(parseInt(r))) }), t }getControlSelected(){ let e = [];return Object.keys(this.equipControllObject).forEach(t=>{ e.push(...this.equipControllObject[t].map(s=>`${t}.${s}`)) }), e }onChecked(e, t){ this.isSearchStatus = t || !1, e.isGroup && !e.isEquip ? this.selectGroup(e) : e.isEquip ? this.selectEquip(e) : e.isSetting && this.selectControl(e) }setCheckStatus(e, t, s, n){ this.nodesMap[e] && (this.nodesMap[e].checked = t, this.nodesMap[e].isGroup && (this.nodesMap[e].indeterminate = s)) }setEquipCheckObject(e, t, s, n){ this.equipCheckObject[e] || (this.equipCheckObject[e] = {}), this.equipCheckObject[e].checked = t, this.equipCheckObject[e].indeterminate = s, this.equipCheckObject[e].groupId = n, !t && !s && delete this.equipCheckObject[e] }selectGroup(e){ this.updateAllEquipStatus(e.key, e.checked), this.updateControlCheckStatus(), this.updateGroupCheckStatus() }updateAllEquipStatus(e, t){ const s = this.groupNodeObject[e];if(!s){ return; }let n = this.isSearchStatus ? this.window[`group-${e}-search`] || [] : this.window[`group-${e}${this.aliasName}`] || [];!this.isSearchStatus && n.length === 0 && this.aliasName && (n = this.window[`group-${e}`] || []), n.forEach(r=>{ const o = r.equipNo || r.id, h = `${e}-${o}`;this.setEquipCheckObject(h, t, !1, e), this.nodesMap[h] && this.setCheckStatus(h, t, !1) }), s.groups && s.groups.length > 0 && s.groups.forEach(r=>{ this.updateAllEquipStatus(r.key, t) }) }selectEquip(e){ const t = `${e.groupId}-${e.equipNo}`;this.setEquipCheckObject(t, e.checked, !1, e.groupId), this.nodesMap[t] && this.setCheckStatus(t, e.checked, !1), this.updateControlCheckStatus(), this.updateGroupCheckStatus() }updateEquipControl(e, t, s){ this.equipControllObject[e] || (this.equipControllObject[e] = []), s ? this.equipControllObject[e].push(t) : this.equipControllObject[e] = this.equipControllObject[e].filter(n=>n != t) }selectControl(e){ const t = `${e.groupId}-${e.equipNo}`, s = `${e.groupId}-${e.equipNo}-${e.setNo}`, n = this.nodesMap[t];if(!n){ return; }this.updateEquipControl(e.equipNo, e.setNo, e.checked), this.setCheckStatus(s, e.checked, !1);const r = n.settings || [], o = this.equipControllObject[e.equipNo] || [], h = r.length, c = o.length;e.checked ? c === h ? (delete this.equipControllObject[e.equipNo], this.setEquipCheckObject(t, !0, !1, e.groupId), this.setCheckStatus(t, !0, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)) : c === 0 ? (this.setEquipCheckObject(t, !1, !1, e.groupId), this.setCheckStatus(t, !1, !1)) : (this.setEquipCheckObject(t, !1, !0, e.groupId), this.setCheckStatus(t, !1, !0)), this.updateGroupCheckStatus() }}class bt extends V{constructor(e, t){ super(), this.aliasName = t, this.groupNodeObject = e }resetGroupNum(e, t, s){ this.clearAllEquipNum();const n = Object.keys(this.groupNodeObject).sort((r, o)=>(this.groupNodeObject[o].level || 0) - (this.groupNodeObject[r].level || 0));for(let r of n){ let o = [];e ? o = this.window[`group-${r}-search`] : o = this.window[`group-${r}${this.aliasName}`], t && o && o.length && (o = o.filter(c=>s[c.equipNo] === 2));let h = o ? o.length : 0;this.groupNodeObject[r].equipCount = h, this.setGroupNum(r, h) } }clearAllEquipNum(){ for(let e in this.groupNodeObject){ this.groupNodeObject[e].equipCount = 0, this.groupNodeObject[e].count = 0 } }setGroupNum(e, t){ this.groupNodeObject[e] && (this.groupNodeObject[e].count = Number(this.groupNodeObject[e].count) + Number(t), this.setGroupNum(this.groupNodeObject[e].groupId, t)) }getAllEquipsNum(){ let e = 0;for(let t in this.groupNodeObject){ this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`] && (e = e + this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`].length); }return e }}const _ = Object.create(null);_.open = "0", _.close = "1", _.ping = "2", _.pong = "3", _.message = "4", _.upgrade = "5", _.noop = "6";const U = Object.create(null);Object.keys(_).forEach(i=>{ U[_[i]] = i });const re = {type: "error", data: "parser error"}, Ae = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Ie = typeof ArrayBuffer == "function", je = i=>typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(i) : i && i.buffer instanceof ArrayBuffer, oe = ({type: i, data: e}, t, s)=>Ae && e instanceof Blob ? t ? s(e) : Be(e, s) : Ie && (e instanceof ArrayBuffer || je(e)) ? t ? s(e) : Be(new Blob([e]), s) : s(_[i] + (e || "")), Be = (i, e)=>{ const t = new FileReader;return t.onload = function(){ const s = t.result.split(",")[1];e("b" + (s || "")) }, t.readAsDataURL(i) };function Re(i){ return i instanceof Uint8Array ? i : i instanceof ArrayBuffer ? new Uint8Array(i) : new Uint8Array(i.buffer, i.byteOffset, i.byteLength) }let ae;function Ct(i, e){ if(Ae && i.data instanceof Blob){ return i.data.arrayBuffer().then(Re).then(e); }if(Ie && (i.data instanceof ArrayBuffer || je(i.data))){ return e(Re(i.data)); }oe(i, !1, t=>{ ae || (ae = new TextEncoder), e(ae.encode(t)) }) }const Le = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", $ = typeof Uint8Array > "u" ? [] : new Uint8Array(256);for(let i = 0;i < Le.length;i++){ $[Le.charCodeAt(i)] = i; }const Et = i=>{ let e = i.length * .75, t = i.length, s, n = 0, r, o, h, c;i[i.length - 1] === "=" && (e--, i[i.length - 2] === "=" && e--);const l = new ArrayBuffer(e), u = new Uint8Array(l);for(s = 0;s < t;s += 4){ r = $[i.charCodeAt(s)], o = $[i.charCodeAt(s + 1)], h = $[i.charCodeAt(s + 2)], c = $[i.charCodeAt(s + 3)], u[n++] = r << 2 | o >> 4, u[n++] = (o & 15) << 4 | h >> 2, u[n++] = (h & 3) << 6 | c & 63; }return l }, kt = typeof ArrayBuffer == "function", he = (i, e)=>{ if(typeof i != "string"){ return{type: "message", data: Ge(i, e)}; }const t = i.charAt(0);return t === "b" ? {type: "message", data: Nt(i.substring(1), e)} : U[t] ? i.length > 1 ? {type: U[t], data: i.substring(1)} : {type: U[t]} : re }, Nt = (i, e)=>{ if(kt){ const t = Et(i);return Ge(t, e) }return{base64: !0, data: i} }, Ge = (i, e)=>{ switch(e){ case"blob":return i instanceof Blob ? i : new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer ? i : i.buffer } }, $e = String.fromCharCode(30), _t = (i, e)=>{ const t = i.length, s = new Array(t);let n = 0;i.forEach((r, o)=>{ oe(r, !1, h=>{ s[o] = h, ++n === t && e(s.join($e)) }) }) }, qt = (i, e)=>{ const t = i.split($e), s = [];for(let n = 0;n < t.length;n++){ const r = he(t[n], e);if(s.push(r), r.type === "error"){ break } }return s };function Ot(){ return new TransformStream({transform(i, e){ Ct(i, t=>{ const s = t.length;let n;if(s < 126){ n = new Uint8Array(1), new DataView(n.buffer).setUint8(0, s); }else if(s < 65536){ n = new Uint8Array(3);const r = new DataView(n.buffer);r.setUint8(0, 126), r.setUint16(1, s) }else{ n = new Uint8Array(9);const r = new DataView(n.buffer);r.setUint8(0, 127), r.setBigUint64(1, BigInt(s)) }i.data && typeof i.data != "string" && (n[0] |= 128), e.enqueue(n), e.enqueue(t) }) }}) }let ce;function K(i){ return i.reduce((e, t)=>e + t.length, 0) }function W(i, e){ if(i[0].length === e){ return i.shift(); }const t = new Uint8Array(e);let s = 0;for(let n = 0;n < e;n++){ t[n] = i[0][s++], s === i[0].length && (i.shift(), s = 0); }return i.length && s < i[0].length && (i[0] = i[0].slice(s)), t }function vt(i, e){ ce || (ce = new TextDecoder);const t = [];let s = 0, n = -1, r = !1;return new TransformStream({transform(o, h){ for(t.push(o);;){ if(s === 0){ if(K(t) < 1){ break; }const c = W(t, 1);r = (c[0] & 128) === 128, n = c[0] & 127, n < 126 ? s = 3 : n === 126 ? s = 1 : s = 2 }else if(s === 1){ if(K(t) < 2){ break; }const c = W(t, 2);n = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), s = 3 }else if(s === 2){ if(K(t) < 8){ break; }const c = W(t, 8), l = new DataView(c.buffer, c.byteOffset, c.length), u = l.getUint32(0);if(u > Math.pow(2, 53 - 32) - 1){ h.enqueue(re);break }n = u * Math.pow(2, 32) + l.getUint32(4), s = 3 }else{ if(K(t) < n){ break; }const c = W(t, n);h.enqueue(he(r ? c : ce.decode(c), e)), s = 0 }if(n === 0 || n > i){ h.enqueue(re);break } } }}) }const Pe = 4;function y(i){ if(i){ return Tt(i) } }function Tt(i){ for(let e in y.prototype){ i[e] = y.prototype[e]; }return i }y.prototype.on = y.prototype.addEventListener = function(i, e){ return this._callbacks = this._callbacks || {}, (this._callbacks["$" + i] = this._callbacks["$" + i] || []).push(e), this }, y.prototype.once = function(i, e){ function t(){ this.off(i, t), e.apply(this, arguments) }return t.fn = e, this.on(i, t), this }, y.prototype.off = y.prototype.removeListener = y.prototype.removeAllListeners = y.prototype.removeEventListener = function(i, e){ if(this._callbacks = this._callbacks || {}, arguments.length == 0){ return this._callbacks = {}, this; }let t = this._callbacks["$" + i];if(!t){ return this; }if(arguments.length == 1){ return delete this._callbacks["$" + i], this; }for(var s, n = 0;n < t.length;n++){ if(s = t[n], s === e || s.fn === e){ t.splice(n, 1);break } }return t.length === 0 && delete this._callbacks["$" + i], this }, y.prototype.emit = function(i){ this._callbacks = this._callbacks || {};for(var e = new Array(arguments.length - 1), t = this._callbacks["$" + i], s = 1;s < arguments.length;s++){ e[s - 1] = arguments[s]; }if(t){ t = t.slice(0);for(var s = 0, n = t.length;s < n;++s){ t[s].apply(this, e) } }return this }, y.prototype.emitReserved = y.prototype.emit, y.prototype.listeners = function(i){ return this._callbacks = this._callbacks || {}, this._callbacks["$" + i] || [] }, y.prototype.hasListeners = function(i){ return!!this.listeners(i).length };const H = (()=>typeof Promise == "function" && typeof Promise.resolve == "function" ? e=>Promise.resolve().then(e) : (e, t)=>t(e, 0))(), E = (()=>typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")())(), xt = "arraybuffer";function Hs(){}function ze(i, ...e){ return e.reduce((t, s)=>(i.hasOwnProperty(s) && (t[s] = i[s]), t), {}) }const Mt = E.setTimeout, At = E.clearTimeout;function J(i, e){ e.useNativeTimers ? (i.setTimeoutFn = Mt.bind(E), i.clearTimeoutFn = At.bind(E)) : (i.setTimeoutFn = E.setTimeout.bind(E), i.clearTimeoutFn = E.clearTimeout.bind(E)) }const It = 1.33;function jt(i){ return typeof i == "string" ? Bt(i) : Math.ceil((i.byteLength || i.size) * It) }function Bt(i){ let e = 0, t = 0;for(let s = 0, n = i.length;s < n;s++){ e = i.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4); }return t }function De(){ return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5) }function Rt(i){ let e = "";for(let t in i){ i.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(i[t])); }return e }function Lt(i){ let e = {}, t = i.split("&");for(let s = 0, n = t.length;s < n;s++){ let r = t[s].split("=");e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]) }return e }class Gt extends Error{constructor(e, t, s){ super(e), this.description = t, this.context = s, this.type = "TransportError" }}class ue extends y{constructor(e){ super(), this.writable = !1, J(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64 }onError(e, t, s){ return super.emitReserved("error", new Gt(e, t, s)), this }open(){ return this.readyState = "opening", this.doOpen(), this }close(){ return(this.readyState === "opening" || this.readyState === "open") && (this.doClose(), this.onClose()), this }send(e){ this.readyState === "open" && this.write(e) }onOpen(){ this.readyState = "open", this.writable = !0, super.emitReserved("open") }onData(e){ const t = he(e, this.socket.binaryType);this.onPacket(t) }onPacket(e){ super.emitReserved("packet", e) }onClose(e){ this.readyState = "closed", super.emitReserved("close", e) }pause(e){}createUri(e, t = {}){ return e + "://" + this._hostname() + this._port() + this.opts.path + this._query(t) }_hostname(){ const e = this.opts.hostname;return e.indexOf(":") === -1 ? e : "[" + e + "]" }_port(){ return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "" }_query(e){ const t = Rt(e);return t.length ? "?" + t : "" }}class $t extends ue{constructor(){ super(...arguments), this._polling = !1 }get name(){ return"polling" }doOpen(){ this._poll() }pause(e){ this.readyState = "pausing";const t = ()=>{ this.readyState = "paused", e() };if(this._polling || !this.writable){ let s = 0;this._polling && (s++, this.once("pollComplete", function(){ --s || t() })), this.writable || (s++, this.once("drain", function(){ --s || t() })) }else { t() } }_poll(){ this._polling = !0, this.doPoll(), this.emitReserved("poll") }onData(e){ const t = s=>{ if(this.readyState === "opening" && s.type === "open" && this.onOpen(), s.type === "close"){ return this.onClose({description: "transport closed by the server"}), !1; }this.onPacket(s) };qt(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll()) }doClose(){ const e = ()=>{ this.write([{type: "close"}]) };this.readyState === "open" ? e() : this.once("open", e) }write(e){ this.writable = !1, _t(e, t=>{ this.doWrite(t, ()=>{ this.writable = !0, this.emitReserved("drain") }) }) }uri(){ const e = this.opts.secure ? "https" : "http", t = this.query || {};return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = De()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t) }}let Fe = !1;try{ Fe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest }catch{}const Pt = Fe;function zt(){}class Dt extends $t{constructor(e){ if(super(e), typeof location < "u"){ const t = location.protocol === "https:";let s = location.port;s || (s = t ? "443" : "80"), this.xd = typeof location < "u" && e.hostname !== location.hostname || s !== e.port } }doWrite(e, t){ const s = this.request({method: "POST", data: e});s.on("success", t), s.on("error", (n, r)=>{ this.onError("xhr post error", n, r) }) }doPoll(){ const e = this.request();e.on("data", this.onData.bind(this)), e.on("error", (t, s)=>{ this.onError("xhr poll error", t, s) }), this.pollXhr = e }}class q extends y{constructor(e, t, s){ super(), this.createRequest = e, J(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create() }_create(){ let e;const t = ze(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");t.xdomain = !!this._opts.xd;const s = this._xhr = this.createRequest(t);try{ s.open(this._method, this._uri, !0);try{ if(this._opts.extraHeaders){ s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders){ this._opts.extraHeaders.hasOwnProperty(n) && s.setRequestHeader(n, this._opts.extraHeaders[n]) } } }catch{}if(this._method === "POST"){ try{ s.setRequestHeader("Content-type", "text/plain;charset=UTF-8") }catch{} }try{ s.setRequestHeader("Accept", "*/*") }catch{}(e = this._opts.cookieJar) === null || e === void 0 || e.addCookies(s), "withCredentials" in s && (s.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (s.timeout = this._opts.requestTimeout), s.onreadystatechange = ()=>{ let n;s.readyState === 3 && ((n = this._opts.cookieJar) === null || n === void 0 || n.parseCookies(s.getResponseHeader("set-cookie"))), s.readyState === 4 && (s.status === 200 || s.status === 1223 ? this._onLoad() : this.setTimeoutFn(()=>{ this._onError(typeof s.status == "number" ? s.status : 0) }, 0)) }, s.send(this._data) }catch(n){ this.setTimeoutFn(()=>{ this._onError(n) }, 0);return }typeof document < "u" && (this._index = q.requestsCount++, q.requests[this._index] = this) }_onError(e){ this.emitReserved("error", e, this._xhr), this._cleanup(!0) }_cleanup(e){ if(!(typeof this._xhr > "u" || this._xhr === null)){ if(this._xhr.onreadystatechange = zt, e){ try{ this._xhr.abort() }catch{} }typeof document < "u" && delete q.requests[this._index], this._xhr = null } }_onLoad(){ const e = this._xhr.responseText;e !== null && (this.emitReserved("data", e), this.emitReserved("success"), this._cleanup()) }abort(){ this._cleanup() }}if(q.requestsCount = 0, q.requests = {}, typeof document < "u"){ if(typeof attachEvent == "function"){ attachEvent("onunload", Ve); }else if(typeof addEventListener == "function"){ const i = "onpagehide" in E ? "pagehide" : "unload";addEventListener(i, Ve, !1) } }function Ve(){ for(let i in q.requests){ q.requests.hasOwnProperty(i) && q.requests[i].abort() } }const Ft = (function(){ const i = Ue({xdomain: !1});return i && i.responseType !== null })();class Vt extends Dt{constructor(e){ super(e);const t = e && e.forceBase64;this.supportsBinary = Ft && !t }request(e = {}){ return Object.assign(e, {xd: this.xd}, this.opts), new q(Ue, this.uri(), e) }}function Ue(i){ const e = i.xdomain;try{ if(typeof XMLHttpRequest < "u" && (!e || Pt)){ return new XMLHttpRequest } }catch{}if(!e){ try{ return new E[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP") }catch{} } }const Ke = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";class Ut extends ue{get name(){ return"websocket" }doOpen(){ const e = this.uri(), t = this.opts.protocols, s = Ke ? {} : ze(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);try{ this.ws = this.createSocket(e, t, s) }catch(n){ return this.emitReserved("error", n) }this.ws.binaryType = this.socket.binaryType, this.addEventListeners() }addEventListeners(){ this.ws.onopen = ()=>{ this.opts.autoUnref && this.ws._socket.unref(), this.onOpen() }, this.ws.onclose = e=>this.onClose({description: "websocket connection closed", context: e}), this.ws.onmessage = e=>this.onData(e.data), this.ws.onerror = e=>this.onError("websocket error", e) }write(e){ this.writable = !1;for(let t = 0;t < e.length;t++){ const s = e[t], n = t === e.length - 1;oe(s, this.supportsBinary, r=>{ try{ this.doWrite(s, r) }catch{}n && H(()=>{ this.writable = !0, this.emitReserved("drain") }, this.setTimeoutFn) }) } }doClose(){ typeof this.ws < "u" && (this.ws.onerror = ()=>{}, this.ws.close(), this.ws = null) }uri(){ const e = this.opts.secure ? "wss" : "ws", t = this.query || {};return this.opts.timestampRequests && (t[this.opts.timestampParam] = De()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t) }}const le = E.WebSocket || E.MozWebSocket;class Kt extends Ut{createSocket(e, t, s){ return Ke ? new le(e, t, s) : t ? new le(e, t) : new le(e) }doWrite(e, t){ this.ws.send(t) }}class Wt extends ue{get name(){ return"webtransport" }doOpen(){ try{ this._transport = new WebTransport(this.createUri("https"), this.opts.transportOptions[this.name]) }catch(e){ return this.emitReserved("error", e) }this._transport.closed.then(()=>{ this.onClose() }).catch(e=>{ this.onError("webtransport error", e) }), this._transport.ready.then(()=>{ this._transport.createBidirectionalStream().then(e=>{ const t = vt(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), n = Ot();n.readable.pipeTo(e.writable), this._writer = n.writable.getWriter();const r = ()=>{ s.read().then(({done: h, value: c})=>{ h || (this.onPacket(c), r()) }).catch(h=>{}) };r();const o = {type: "open"};this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`), this._writer.write(o).then(()=>this.onOpen()) }) }) }write(e){ this.writable = !1;for(let t = 0;t < e.length;t++){ const s = e[t], n = t === e.length - 1;this._writer.write(s).then(()=>{ n && H(()=>{ this.writable = !0, this.emitReserved("drain") }, this.setTimeoutFn) }) } }doClose(){ let e;(e = this._transport) === null || e === void 0 || e.close() }}const Ht = {websocket: Kt, webtransport: Wt, polling: Vt}, Jt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Yt = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];function de(i){ if(i.length > 8e3){ throw"URI too long"; }const e = i, t = i.indexOf("["), s = i.indexOf("]");t != -1 && s != -1 && (i = i.substring(0, t) + i.substring(t, s).replace(/:/g, ";") + i.substring(s, i.length));let n = Jt.exec(i || ""), r = {}, o = 14;for(;o--;){ r[Yt[o]] = n[o] || ""; }return t != -1 && s != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Xt(r, r.path), r.queryKey = Qt(r, r.query), r }function Xt(i, e){ const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");return(e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s }function Qt(i, e){ const t = {};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, n, r){ n && (t[n] = r) }), t }const pe = typeof addEventListener == "function" && typeof removeEventListener == "function", Y = [];pe && addEventListener("offline", ()=>{ Y.forEach(i=>i()) }, !1);class v extends y{constructor(e, t){ if(super(), this.binaryType = xt, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e){ const s = de(e);t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query) }else { t.host && (t.hostname = de(t.host).host); }J(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach(s=>{ const n = s.prototype.name;this.transports.push(n), this._transportsByName[n] = s }), this.opts = Object.assign({path: "/engine.io", agent: !1, withCredentials: !1, upgrade: !0, timestampParam: "t", rememberUpgrade: !1, addTrailingSlash: !0, rejectUnauthorized: !0, perMessageDeflate: {threshold: 1024}, transportOptions: {}, closeOnBeforeunload: !1}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Lt(this.opts.query)), pe && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = ()=>{ this.transport && (this.transport.removeAllListeners(), this.transport.close()) }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = ()=>{ this._onClose("transport close", {description: "network connection lost"}) }, Y.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open() }createTransport(e){ const t = Object.assign({}, this.opts.query);t.EIO = Pe, t.transport = e, this.id && (t.sid = this.id);const s = Object.assign({}, this.opts, {query: t, socket: this, hostname: this.hostname, secure: this.secure, port: this.port}, this.opts.transportOptions[e]);return new this._transportsByName[e](s) }_open(){ if(this.transports.length === 0){ this.setTimeoutFn(()=>{ this.emitReserved("error", "No transports available") }, 0);return }const e = this.opts.rememberUpgrade && v.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];this.readyState = "opening";const t = this.createTransport(e);t.open(), this.setTransport(t) }setTransport(e){ this.transport && this.transport.removeAllListeners(), this.transport = e, e.on("drain", this._onDrain.bind(this)).on("packet", this._onPacket.bind(this)).on("error", this._onError.bind(this)).on("close", t=>this._onClose("transport close", t)) }onOpen(){ this.readyState = "open", v.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush() }_onPacket(e){ if(this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing"){ switch(this.emitReserved("packet", e), this.emitReserved("heartbeat"), e.type){ case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"), this.emitReserved("ping"), this.emitReserved("pong"), this._resetPingTimeout();break;case"error":const t = new Error("server error");t.code = e.data, this._onError(t);break;case"message":this.emitReserved("data", e.data), this.emitReserved("message", e.data);break } } }onHandshake(e){ this.emitReserved("handshake", e), this.id = e.sid, this.transport.query.sid = e.sid, this._pingInterval = e.pingInterval, this._pingTimeout = e.pingTimeout, this._maxPayload = e.maxPayload, this.onOpen(), this.readyState !== "closed" && this._resetPingTimeout() }_resetPingTimeout(){ this.clearTimeoutFn(this._pingTimeoutTimer);const e = this._pingInterval + this._pingTimeout;this._pingTimeoutTime = Date.now() + e, this._pingTimeoutTimer = this.setTimeoutFn(()=>{ this._onClose("ping timeout") }, e), this.opts.autoUnref && this._pingTimeoutTimer.unref() }_onDrain(){ this.writeBuffer.splice(0, this._prevBufferLen), this._prevBufferLen = 0, this.writeBuffer.length === 0 ? this.emitReserved("drain") : this.flush() }flush(){ if(this.readyState !== "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length){ const e = this._getWritablePackets();this.transport.send(e), this._prevBufferLen = e.length, this.emitReserved("flush") } }_getWritablePackets(){ if(!(this._maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1)){ return this.writeBuffer; }let t = 1;for(let s = 0;s < this.writeBuffer.length;s++){ const n = this.writeBuffer[s].data;if(n && (t += jt(n)), s > 0 && t > this._maxPayload){ return this.writeBuffer.slice(0, s); }t += 2 }return this.writeBuffer }_hasPingExpired(){ if(!this._pingTimeoutTime){ return!0; }const e = Date.now() > this._pingTimeoutTime;return e && (this._pingTimeoutTime = 0, H(()=>{ this._onClose("ping timeout") }, this.setTimeoutFn)), e }write(e, t, s){ return this._sendPacket("message", e, t, s), this }send(e, t, s){ return this._sendPacket("message", e, t, s), this }_sendPacket(e, t, s, n){ if(typeof t == "function" && (n = t, t = void 0), typeof s == "function" && (n = s, s = null), this.readyState === "closing" || this.readyState === "closed"){ return; }s = s || {}, s.compress = s.compress !== !1;const r = {type: e, data: t, options: s};this.emitReserved("packetCreate", r), this.writeBuffer.push(r), n && this.once("flush", n), this.flush() }close(){ const e = ()=>{ this._onClose("forced close"), this.transport.close() }, t = ()=>{ this.off("upgrade", t), this.off("upgradeError", t), e() }, s = ()=>{ this.once("upgrade", t), this.once("upgradeError", t) };return(this.readyState === "opening" || this.readyState === "open") && (this.readyState = "closing", this.writeBuffer.length ? this.once("drain", ()=>{ this.upgrading ? s() : e() }) : this.upgrading ? s() : e()), this }_onError(e){ if(v.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening"){ return this.transports.shift(), this._open(); }this.emitReserved("error", e), this._onClose("transport error", e) }_onClose(e, t){ if(this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing"){ if(this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), pe && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)){ const s = Y.indexOf(this._offlineEventListener);s !== -1 && Y.splice(s, 1) }this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0 } }}v.protocol = Pe;class Zt extends v{constructor(){ super(...arguments), this._upgrades = [] }onOpen(){ if(super.onOpen(), this.readyState === "open" && this.opts.upgrade){ for(let e = 0;e < this._upgrades.length;e++){ this._probe(this._upgrades[e]) } } }_probe(e){ let t = this.createTransport(e), s = !1;v.priorWebsocketSuccess = !1;const n = ()=>{ s || (t.send([{type: "ping", data: "probe"}]), t.once("packet", d=>{ if(!s){ if(d.type === "pong" && d.data === "probe"){ if(this.upgrading = !0, this.emitReserved("upgrading", t), !t){ return; }v.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(()=>{ s || this.readyState !== "closed" && (u(), this.setTransport(t), t.send([{type: "upgrade"}]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush()) }) }else{ const w = new Error("probe error");w.transport = t.name, this.emitReserved("upgradeError", w) } } })) };function r(){ s || (s = !0, u(), t.close(), t = null) }const o = d=>{ const w = new Error("probe error: " + d);w.transport = t.name, r(), this.emitReserved("upgradeError", w) };function h(){ o("transport closed") }function c(){ o("socket closed") }function l(d){ t && d.name !== t.name && r() }const u = ()=>{ t.removeListener("open", n), t.removeListener("error", o), t.removeListener("close", h), this.off("close", c), this.off("upgrading", l) };t.once("open", n), t.once("error", o), t.once("close", h), this.once("close", c), this.once("upgrading", l), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(()=>{ s || t.open() }, 200) : t.open() }onHandshake(e){ this._upgrades = this._filterUpgrades(e.upgrades), super.onHandshake(e) }_filterUpgrades(e){ const t = [];for(let s = 0;s < e.length;s++){ ~this.transports.indexOf(e[s]) && t.push(e[s]); }return t }}let es = class extends Zt{constructor(e, t = {}){ const s = typeof e == "object" ? e : t;(!s.transports || s.transports && typeof s.transports[0] == "string") && (s.transports = (s.transports || ["polling", "websocket", "webtransport"]).map(n=>Ht[n]).filter(n=>!!n)), super(e, s) }};function ts(i, e = "", t){ let s = i;t = t || typeof location < "u" && location, i == null && (i = t.protocol + "//" + t.host), typeof i == "string" && (i.charAt(0) === "/" && (i.charAt(1) === "/" ? i = t.protocol + i : i = t.host + i), /^(https?|wss?):\/\//.test(i) || (typeof t < "u" ? i = t.protocol + "//" + i : i = "https://" + i), s = de(i)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";const r = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;return s.id = s.protocol + "://" + r + ":" + s.port + e, s.href = s.protocol + "://" + r + (t && t.port === s.port ? "" : ":" + s.port), s }const ss = typeof ArrayBuffer == "function", is = i=>typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(i) : i.buffer instanceof ArrayBuffer, We = Object.prototype.toString, ns = typeof Blob == "function" || typeof Blob < "u" && We.call(Blob) === "[object BlobConstructor]", rs = typeof File == "function" || typeof File < "u" && We.call(File) === "[object FileConstructor]";function fe(i){ return ss && (i instanceof ArrayBuffer || is(i)) || ns && i instanceof Blob || rs && i instanceof File }function X(i, e){ if(!i || typeof i != "object"){ return!1; }if(Array.isArray(i)){ for(let t = 0, s = i.length;t < s;t++){ if(X(i[t])){ return!0; } }return!1 }if(fe(i)){ return!0; }if(i.toJSON && typeof i.toJSON == "function" && arguments.length === 1){ return X(i.toJSON(), !0); }for(const t in i){ if(Object.prototype.hasOwnProperty.call(i, t) && X(i[t])){ return!0; } }return!1 }function os(i){ const e = [], t = i.data, s = i;return s.data = ge(t, e), s.attachments = e.length, {packet: s, buffers: e} }function ge(i, e){ if(!i){ return i; }if(fe(i)){ const t = {_placeholder: !0, num: e.length};return e.push(i), t }else if(Array.isArray(i)){ const t = new Array(i.length);for(let s = 0;s < i.length;s++){ t[s] = ge(i[s], e); }return t }else if(typeof i == "object" && !(i instanceof Date)){ const t = {};for(const s in i){ Object.prototype.hasOwnProperty.call(i, s) && (t[s] = ge(i[s], e)); }return t }return i }function as(i, e){ return i.data = me(i.data, e), delete i.attachments, i }function me(i, e){ if(!i){ return i; }if(i && i._placeholder === !0){ if(typeof i.num == "number" && i.num >= 0 && i.num < e.length){ return e[i.num]; }throw new Error("illegal attachments") }else if(Array.isArray(i)){ for(let t = 0;t < i.length;t++){ i[t] = me(i[t], e); } }else if(typeof i == "object"){ for(const t in i){ Object.prototype.hasOwnProperty.call(i, t) && (i[t] = me(i[t], e)); } }return i }const He = ["connect", "connect_error", "disconnect", "disconnecting", "newListener", "removeListener"], hs = 5;let f;(function(i){ i[i.CONNECT = 0] = "CONNECT", i[i.DISCONNECT = 1] = "DISCONNECT", i[i.EVENT = 2] = "EVENT", i[i.ACK = 3] = "ACK", i[i.CONNECT_ERROR = 4] = "CONNECT_ERROR", i[i.BINARY_EVENT = 5] = "BINARY_EVENT", i[i.BINARY_ACK = 6] = "BINARY_ACK" })(f || (f = {}));class cs{constructor(e){ this.replacer = e }encode(e){ return(e.type === f.EVENT || e.type === f.ACK) && X(e) ? this.encodeAsBinary({type: e.type === f.EVENT ? f.BINARY_EVENT : f.BINARY_ACK, nsp: e.nsp, data: e.data, id: e.id}) : [this.encodeAsString(e)] }encodeAsString(e){ let t = "" + e.type;return(e.type === f.BINARY_EVENT || e.type === f.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t }encodeAsBinary(e){ const t = os(e), s = this.encodeAsString(t.packet), n = t.buffers;return n.unshift(s), n }}class ye extends y{constructor(e){ super(), this.opts = Object.assign({reviver: void 0, maxAttachments: 10}, typeof e == "function" ? {reviver: e} : e) }add(e){ let t;if(typeof e == "string"){ if(this.reconstructor){ throw new Error("got plaintext data when reconstructing a packet"); }t = this.decodeString(e);const s = t.type === f.BINARY_EVENT;s || t.type === f.BINARY_ACK ? (t.type = s ? f.EVENT : f.ACK, this.reconstructor = new us(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t) }else if(fe(e) || e.base64){ if(this.reconstructor){ t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t)); }else { throw new Error("got binary data when not reconstructing a packet"); } }else { throw new Error("Unknown type: " + e) } }decodeString(e){ let t = 0;const s = {type: Number(e.charAt(0))};if(f[s.type] === void 0){ throw new Error("unknown packet type " + s.type); }if(s.type === f.BINARY_EVENT || s.type === f.BINARY_ACK){ const r = t + 1;for(;e.charAt(++t) !== "-" && t != e.length;){}const o = e.substring(r, t);if(o != Number(o) || e.charAt(t) !== "-"){ throw new Error("Illegal attachments"); }const h = Number(o);if(!Je(h) || h < 0){ throw new Error("Illegal attachments"); }if(h > this.opts.maxAttachments){ throw new Error("too many attachments"); }s.attachments = h }if(e.charAt(t + 1) === "/"){ const r = t + 1;for(;++t && !(e.charAt(t) === "," || t === e.length);){}s.nsp = e.substring(r, t) }else { s.nsp = "/"; }const n = e.charAt(t + 1);if(n !== "" && Number(n) == n){ const r = t + 1;for(;++t;){ const o = e.charAt(t);if(o == null || Number(o) != o){ --t;break }if(t === e.length){ break } }s.id = Number(e.substring(r, t + 1)) }if(e.charAt(++t)){ const r = this.tryParse(e.substr(t));if(ye.isPayloadValid(s.type, r)){ s.data = r; }else { throw new Error("invalid payload") } }return s }tryParse(e){ try{ return JSON.parse(e, this.opts.reviver) }catch{ return!1 } }static isPayloadValid(e, t){ switch(e){ case f.CONNECT:return Q(t);case f.DISCONNECT:return t === void 0;case f.CONNECT_ERROR:return typeof t == "string" || Q(t);case f.EVENT:case f.BINARY_EVENT:return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && He.indexOf(t[0]) === -1);case f.ACK:case f.BINARY_ACK:return Array.isArray(t) } }destroy(){ this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null) }}class us{constructor(e){ this.packet = e, this.buffers = [], this.reconPack = e }takeBinaryData(e){ if(this.buffers.push(e), this.buffers.length === this.reconPack.attachments){ const t = as(this.reconPack, this.buffers);return this.finishedReconstruction(), t }return null }finishedReconstruction(){ this.reconPack = null, this.buffers = [] }}function ls(i){ return typeof i == "string" }const Je = Number.isInteger || function(i){ return typeof i == "number" && isFinite(i) && Math.floor(i) === i };function ds(i){ return i === void 0 || Je(i) }function Q(i){ return Object.prototype.toString.call(i) === "[object Object]" }function ps(i, e){ switch(i){ case f.CONNECT:return e === void 0 || Q(e);case f.DISCONNECT:return e === void 0;case f.EVENT:return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && He.indexOf(e[0]) === -1);case f.ACK:return Array.isArray(e);case f.CONNECT_ERROR:return typeof e == "string" || Q(e);default:return!1 } }function fs(i){ return ls(i.nsp) && ds(i.id) && ps(i.type, i.data) }const gs = Object.freeze(Object.defineProperty({__proto__: null, Decoder: ye, Encoder: cs, get PacketType(){ return f }, isPacketValid: fs, protocol: hs}, Symbol.toStringTag, {value: "Module"}));function k(i, e, t){ return i.on(e, t), function(){ i.off(e, t) } }const ms = Object.freeze({connect: 1, connect_error: 1, disconnect: 1, disconnecting: 1, newListener: 1, removeListener: 1});class Ye extends y{constructor(e, t, s){ super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = e, this.nsp = t, s && s.auth && (this.auth = s.auth), this._opts = Object.assign({}, s), this.io._autoConnect && this.open() }get disconnected(){ return!this.connected }subEvents(){ if(this.subs){ return; }const e = this.io;this.subs = [k(e, "open", this.onopen.bind(this)), k(e, "packet", this.onpacket.bind(this)), k(e, "error", this.onerror.bind(this)), k(e, "close", this.onclose.bind(this))] }get active(){ return!!this.subs }connect(){ return this.connected ? this : (this.subEvents(), this.io._reconnecting || this.io.open(), this.io._readyState === "open" && this.onopen(), this) }open(){ return this.connect() }send(...e){ return e.unshift("message"), this.emit.apply(this, e), this }emit(e, ...t){ let s, n, r;if(ms.hasOwnProperty(e)){ throw new Error('"' + e.toString() + '" is a reserved event name'); }if(t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile){ return this._addToQueue(t), this; }const o = {type: f.EVENT, data: t};if(o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function"){ const u = this.ids++, d = t.pop();this._registerAckCallback(u, d), o.id = u }const h = (n = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || n === void 0 ? void 0 : n.writable, c = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());return this.flags.volatile && !h || (c ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this }_registerAckCallback(e, t){ let s;const n = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;if(n === void 0){ this.acks[e] = t;return }const r = this.io.setTimeoutFn(()=>{ delete this.acks[e];for(let h = 0;h < this.sendBuffer.length;h++){ this.sendBuffer[h].id === e && this.sendBuffer.splice(h, 1); }t.call(this, new Error("operation has timed out")) }, n), o = (...h)=>{ this.io.clearTimeoutFn(r), t.apply(this, h) };o.withError = !0, this.acks[e] = o }emitWithAck(e, ...t){ return new Promise((s, n)=>{ const r = (o, h)=>o ? n(o) : s(h);r.withError = !0, t.push(r), this.emit(e, ...t) }) }_addToQueue(e){ let t;typeof e[e.length - 1] == "function" && (t = e.pop());const s = {id: this._queueSeq++, tryCount: 0, pending: !1, args: e, flags: Object.assign({fromQueue: !0}, this.flags)};e.push((n, ...r)=>(this._queue[0], n !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(n)) : (this._queue.shift(), t && t(null, ...r)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue() }_drainQueue(e = !1){ if(!this.connected || this._queue.length === 0){ return; }const t = this._queue[0];t.pending && !e || (t.pending = !0, t.tryCount++, this.flags = t.flags, this.emit.apply(this, t.args)) }packet(e){ e.nsp = this.nsp, this.io._packet(e) }onopen(){ typeof this.auth == "function" ? this.auth(e=>{ this._sendConnectPacket(e) }) : this._sendConnectPacket(this.auth) }_sendConnectPacket(e){ this.packet({type: f.CONNECT, data: this._pid ? Object.assign({pid: this._pid, offset: this._lastOffset}, e) : e}) }onerror(e){ this.connected || this.emitReserved("connect_error", e) }onclose(e, t){ this.connected = !1, delete this.id, this.emitReserved("disconnect", e, t), this._clearAcks() }_clearAcks(){ Object.keys(this.acks).forEach(e=>{ if(!this.sendBuffer.some(s=>String(s.id) === e)){ const s = this.acks[e];delete this.acks[e], s.withError && s.call(this, new Error("socket has been disconnected")) } }) }onpacket(e){ if(e.nsp === this.nsp){ switch(e.type){ case f.CONNECT:e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case f.EVENT:case f.BINARY_EVENT:this.onevent(e);break;case f.ACK:case f.BINARY_ACK:this.onack(e);break;case f.DISCONNECT:this.ondisconnect();break;case f.CONNECT_ERROR:this.destroy();const s = new Error(e.data.message);s.data = e.data.data, this.emitReserved("connect_error", s);break } } }onevent(e){ const t = e.data || [];e.id != null && t.push(this.ack(e.id)), this.connected ? this.emitEvent(t) : this.receiveBuffer.push(Object.freeze(t)) }emitEvent(e){ if(this._anyListeners && this._anyListeners.length){ const t = this._anyListeners.slice();for(const s of t){ s.apply(this, e) } }super.emit.apply(this, e), this._pid && e.length && typeof e[e.length - 1] == "string" && (this._lastOffset = e[e.length - 1]) }ack(e){ const t = this;let s = !1;return function(...n){ s || (s = !0, t.packet({type: f.ACK, id: e, data: n})) } }onack(e){ const t = this.acks[e.id];typeof t == "function" && (delete this.acks[e.id], t.withError && e.data.unshift(null), t.apply(this, e.data)) }onconnect(e, t){ this.id = e, this.recovered = t && this._pid === t, this._pid = t, this.connected = !0, this.emitBuffered(), this._drainQueue(!0), this.emitReserved("connect") }emitBuffered(){ this.receiveBuffer.forEach(e=>this.emitEvent(e)), this.receiveBuffer = [], this.sendBuffer.forEach(e=>{ this.notifyOutgoingListeners(e), this.packet(e) }), this.sendBuffer = [] }ondisconnect(){ this.destroy(), this.onclose("io server disconnect") }destroy(){ this.subs && (this.subs.forEach(e=>e()), this.subs = void 0), this.io._destroy(this) }disconnect(){ return this.connected && this.packet({type: f.DISCONNECT}), this.destroy(), this.connected && this.onclose("io client disconnect"), this }close(){ return this.disconnect() }compress(e){ return this.flags.compress = e, this }get volatile(){ return this.flags.volatile = !0, this }timeout(e){ return this.flags.timeout = e, this }onAny(e){ return this._anyListeners = this._anyListeners || [], this._anyListeners.push(e), this }prependAny(e){ return this._anyListeners = this._anyListeners || [], this._anyListeners.unshift(e), this }offAny(e){ if(!this._anyListeners){ return this; }if(e){ const t = this._anyListeners;for(let s = 0;s < t.length;s++){ if(e === t[s]){ return t.splice(s, 1), this } } }else { this._anyListeners = []; }return this }listenersAny(){ return this._anyListeners || [] }onAnyOutgoing(e){ return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.push(e), this }prependAnyOutgoing(e){ return this._anyOutgoingListeners = this._anyOutgoingListeners || [], this._anyOutgoingListeners.unshift(e), this }offAnyOutgoing(e){ if(!this._anyOutgoingListeners){ return this; }if(e){ const t = this._anyOutgoingListeners;for(let s = 0;s < t.length;s++){ if(e === t[s]){ return t.splice(s, 1), this } } }else { this._anyOutgoingListeners = []; }return this }listenersAnyOutgoing(){ return this._anyOutgoingListeners || [] }notifyOutgoingListeners(e){ if(this._anyOutgoingListeners && this._anyOutgoingListeners.length){ const t = this._anyOutgoingListeners.slice();for(const s of t){ s.apply(this, e.data) } } }}function B(i){ i = i || {}, this.ms = i.min || 100, this.max = i.max || 1e4, this.factor = i.factor || 2, this.jitter = i.jitter > 0 && i.jitter <= 1 ? i.jitter : 0, this.attempts = 0 }B.prototype.duration = function(){ let i = this.ms * Math.pow(this.factor, this.attempts++);if(this.jitter){ let e = Math.random(), t = Math.floor(e * this.jitter * i);i = Math.floor(e * 10) & 1 ? i + t : i - t }return Math.min(i, this.max) | 0 }, B.prototype.reset = function(){ this.attempts = 0 }, B.prototype.setMin = function(i){ this.ms = i }, B.prototype.setMax = function(i){ this.max = i }, B.prototype.setJitter = function(i){ this.jitter = i };class we extends y{constructor(e, t){ let s;super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, J(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : .5), this.backoff = new B({min: this.reconnectionDelay(), max: this.reconnectionDelayMax(), jitter: this.randomizationFactor()}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;const n = t.parser || gs;this.encoder = new n.Encoder, this.decoder = new n.Decoder, this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open() }reconnection(e){ return arguments.length ? (this._reconnection = !!e, e || (this.skipReconnect = !0), this) : this._reconnection }reconnectionAttempts(e){ return e === void 0 ? this._reconnectionAttempts : (this._reconnectionAttempts = e, this) }reconnectionDelay(e){ let t;return e === void 0 ? this._reconnectionDelay : (this._reconnectionDelay = e, (t = this.backoff) === null || t === void 0 || t.setMin(e), this) }randomizationFactor(e){ let t;return e === void 0 ? this._randomizationFactor : (this._randomizationFactor = e, (t = this.backoff) === null || t === void 0 || t.setJitter(e), this) }reconnectionDelayMax(e){ let t;return e === void 0 ? this._reconnectionDelayMax : (this._reconnectionDelayMax = e, (t = this.backoff) === null || t === void 0 || t.setMax(e), this) }timeout(e){ return arguments.length ? (this._timeout = e, this) : this._timeout }maybeReconnectOnOpen(){ !this._reconnecting && this._reconnection && this.backoff.attempts === 0 && this.reconnect() }open(e){ if(~this._readyState.indexOf("open")){ return this; }this.engine = new es(this.uri, this.opts);const t = this.engine, s = this;this._readyState = "opening", this.skipReconnect = !1;const n = k(t, "open", function(){ s.onopen(), e && e() }), r = h=>{ this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen() }, o = k(t, "error", r);if(this._timeout !== !1){ const h = this._timeout, c = this.setTimeoutFn(()=>{ n(), r(new Error("timeout")), t.close() }, h);this.opts.autoUnref && c.unref(), this.subs.push(()=>{ this.clearTimeoutFn(c) }) }return this.subs.push(n), this.subs.push(o), this }connect(e){ return this.open(e) }onopen(){ this.cleanup(), this._readyState = "open", this.emitReserved("open");const e = this.engine;this.subs.push(k(e, "ping", this.onping.bind(this)), k(e, "data", this.ondata.bind(this)), k(e, "error", this.onerror.bind(this)), k(e, "close", this.onclose.bind(this)), k(this.decoder, "decoded", this.ondecoded.bind(this))) }onping(){ this.emitReserved("ping") }ondata(e){ try{ this.decoder.add(e) }catch(t){ this.onclose("parse error", t) } }ondecoded(e){ H(()=>{ this.emitReserved("packet", e) }, this.setTimeoutFn) }onerror(e){ this.emitReserved("error", e) }socket(e, t){ let s = this.nsps[e];return s ? this._autoConnect && !s.active && s.connect() : (s = new Ye(this, e, t), this.nsps[e] = s), s }_destroy(e){ const t = Object.keys(this.nsps);for(const s of t){ if(this.nsps[s].active){ return; } }this._close() }_packet(e){ const t = this.encoder.encode(e);for(let s = 0;s < t.length;s++){ this.engine.write(t[s], e.options) } }cleanup(){ this.subs.forEach(e=>e()), this.subs.length = 0, this.decoder.destroy() }_close(){ this.skipReconnect = !0, this._reconnecting = !1, this.onclose("forced close") }disconnect(){ return this._close() }onclose(e, t){ let s;this.cleanup(), (s = this.engine) === null || s === void 0 || s.close(), this.backoff.reset(), this._readyState = "closed", this.emitReserved("close", e, t), this._reconnection && !this.skipReconnect && this.reconnect() }reconnect(){ if(this._reconnecting || this.skipReconnect){ return this; }const e = this;if(this.backoff.attempts >= this._reconnectionAttempts){ this.backoff.reset(), this.emitReserved("reconnect_failed"), this._reconnecting = !1; }else{ const t = this.backoff.duration();this._reconnecting = !0;const s = this.setTimeoutFn(()=>{ e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open(n=>{ n ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", n)) : e.onreconnect() })) }, t);this.opts.autoUnref && s.unref(), this.subs.push(()=>{ this.clearTimeoutFn(s) }) } }onreconnect(){ const e = this.backoff.attempts;this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e) }}const P = {};function Z(i, e){ typeof i == "object" && (e = i, i = void 0), e = e || {};const t = ts(i, e.path || "/socket.io"), s = t.source, n = t.id, r = t.path, o = P[n] && r in P[n].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;let c;return h ? c = new we(s, e) : (P[n] || (P[n] = new we(s, e)), c = P[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e) }Object.assign(Z, {Manager: we, Socket: Ye, io: Z, connect: Z});class Xe{constructor(e, t, s = {}){ this.url = e, this.socket = null, this.reconnect = t, this.query = s, this.eventListeners = {}, this.errorCount = 0, this.isErrorShown = !1, this.maxReconnectAttempts = 5, this.currentReconnectAttempt = 0, this.reconnectDelay = 3e3 }openConnect(){ return this.socket && (this.socket.disconnect(), this.socket = null), this.socket = Z(this.url, {transports: ["websocket"], autoConnect: !1, reconnection: this.reconnect || !1, timeout: 5e5, forceNew: !0, query: this.query, withCredentials: !0}), new Promise((e, t)=>{ this.socket.on("connect", ()=>{ this.errorCount = 0, this.isErrorShown = !1, this.currentReconnectAttempt = 0, console.log("Socket.IO 连接成功"), e(this.socket) }), this.socket.on("connect_error", s=>{ this.errorCount++, this.isErrorShown || (console.error("Socket.IO 连接失败"), console.error("错误详情:", s.message), this.isErrorShown = !0), this.errorCount === 1 && (this.disconnect(), t(new Error(`Socket.IO 连接失败: ${s.message}`))) }), this.socket.on("disconnect", s=>{ console.log("Socket.IO 连接已断开,原因:", s), this.isErrorShown = !1, this.reconnect && s !== "io client disconnect" && (this.currentReconnectAttempt < this.maxReconnectAttempts ? (this.currentReconnectAttempt++, console.log(`准备第 ${this.currentReconnectAttempt} 次重连...`), setTimeout(()=>{ this.socket.connect() }, this.reconnectDelay)) : console.log("已达到最大重连次数,停止重连")) }), this.socket.connect() }) }on(e, t){ if(!this.socket){ console.error("Socket未初始化,请先调用openConnect()");return }this.socket.on(e, t) }off(e, t){ if(!this.socket){ console.error("Socket未初始化,请先调用openConnect()");return }this.socket.off(e, t) }emit(e, t){ if(!this.socket){ console.error("Socket未初始化,请先调用openConnect()");return }this.socket.emit(e, t) }disconnect(){ if(!this.socket){ console.error("Socket未初始化,请先调用openConnect()");return }this.socket.disconnect(), this.socket = null }}class ys extends V{constructor(e, t, s, n, r){ super(), this.equipStatusObject = t, this.groupNodeObject = s, this.aleadyUpdateStatus = {}, this.isGetAllEquipStatus = !1, this.nodesMap = e, this.statusChange = n, this.openSignlr(), this.aliasName = r }openSignlr(){ const t = `${location.protocol === "https:" ? "https" : "http"}://${location.hostname}:9600`;this.equipStatusSignlr = new Xe(t, !0, {hub: "equipStatusMonitor", userName: sessionStorage.userName}), this.equipStatusSignlr.openConnect().then(s=>{ s.on("connect", ()=>{ try{ s.emit("invoke", {method: "GetAllEquipStatus", data: {}}), s.emit("invoke", {method: "GetEquipChangeStatus", data: {}}) }catch(n){ console.log(n) } });try{ s.emit("invoke", {method: "GetAllEquipStatus", data: {}}) }catch(n){ console.log(n) }this.subscribeTo(s, "GetAllEquipStatus");try{ s.emit("invoke", {method: "GetEquipChangeStatus", data: {}}) }catch(n){ console.log(n) }this.subscribeTo(s, "GetEquipChangeStatus") }).catch(s=>{ console.error(s) }) }subscribeTo(e, t){ e.off(t), e.on(t, s=>{ const n = s == null ? void 0 : s.data;n && n.isSuccess && n.data && (this[t] ? this[t](n.data) : this.notice({func: t, data: n.data, key: n.groupId})) }) }GetAllEquipStatus(e){ this.isGetAllEquipStatus = !0, this.resetGroupStatus(), this.aleadyUpdateStatus = {}, Object.keys(e).forEach(t=>{ this.equipStatusObject[t] = e[t] }), Object.keys(this.groupNodeObject).forEach(t=>{ this.updateByGroup(t) }) }updateByGroup(e){ if(!this.aleadyUpdateStatus[e]){ let t = this.window[`group-${e}${this.aliasName}`] || [];if(t.length){ this.aleadyUpdateStatus[e] = !0;let s = !1, n = !0;t.forEach(r=>{ const o = this.equipStatusObject[r.equipNo];o === 1 ? (s = !0, n = !1) : o !== 0 && (n = !1) }), n && this.setOfflineStatus(e), t.forEach(r=>{ this.equipStatusObject[r.equipNo] == 2 ? this.setGroupStatus(e, !0, 2) : this.equipStatusObject[r.equipNo] == 6 && this.setGroupStatus(e, !0, 6), this.nodesMap[`${e}-${r.equipNo}`] && (this.nodesMap[`${e}-${r.equipNo}`].status = this.equipStatusObject[r.equipNo]) }), this.nodesMap[e].alarmCounts === 0 && this.nodesMap[e].backUpCounts === 0 && s && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) } } }updateGroupStatus(e){ this.isGetAllEquipStatus && this.updateByGroup(e) }GetEquipChangeStatus(e){ this.setStatus(e) }setGroupStatus(e, t, s){ t ? s == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts + 1, this.nodesMap[e].alarmCounts > 0 && (this.nodesMap[e].status = 2)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts + 1, this.nodesMap[e].alarmCounts == 0 && this.nodesMap[e].backUpCounts > 0 && (this.nodesMap[e].status = 6)) : s == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].status = 1)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].backUpCounts == 0 ? this.nodesMap[e].status = 1 : this.nodesMap[e].status = 6)), this.nodesMap[e].groupId && this.setGroupStatus(this.nodesMap[e].groupId, t, s) }setOfflineStatus(e){ this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && this.nodesMap[e].status !== 1 && (this.nodesMap[e].status = 0, this.nodesMap[e].groupId && this.setOfflineStatus(this.nodesMap[e].groupId)) }setNormalStatus(e){ this.nodesMap[e].status !== 2 && this.nodesMap[e].status !== 6 && (this.nodesMap[e].status = 1, this.nodesMap[e].groupId && this.setNormalStatus(this.nodesMap[e].groupId)) }getEquipGroupIds(e){ const t = [];if(this.window.groupCache && Object.keys(this.window.groupCache).forEach(s=>{ this.window.groupCache[s] && this.window.groupCache[s][e] && t.push(Number(s)) }), t.length === 0){ const s = this.window.equipCache && this.window.equipCache[e];if(s){ if(s.groupIds && s.groupIds.length > 0){ return s.groupIds; }s.groupId && t.push(s.groupId) } }return t }setStatus(e){ let t = this.equipStatusObject[e.equipNo];const s = this.getEquipGroupIds(e.equipNo);e.status != 3 && s.length > 0 && (s.forEach(n=>{ switch(e.status){ case 0:t == 6 && this.setGroupStatus(n, !1, 6);break;case 1:t == 6 ? this.setGroupStatus(n, !1, 6) : t == 2 && this.setGroupStatus(n, !1, 2);break;case 2:t != 2 && this.setGroupStatus(n, !0, 2), t == 6 && this.setGroupStatus(n, !1, 6);break;case 6:t == 2 && this.setGroupStatus(n, !1, 2), t != 6 && this.setGroupStatus(n, !0, 6);break }let r = `${n}-${e.equipNo}`;this.nodesMap[r] && (this.nodesMap[r].status = e.status) }), this.equipStatusObject[e.equipNo] = e.status, this.statusChange(s[0], e.equipNo, e.status)) }resetGroupStatus(){ for(let e in this.groupNodeObject){ this.groupNodeObject[e].alarmCounts = 0, this.groupNodeObject[e].backUpCount = 0 } }disconnect(){ this.equipStatusSignlr && (this.equipStatusSignlr.disconnect(), this.equipStatusSignlr = null) }}const ws = Object.assign({}, {getSetParm(i){ if(window.AxiosBuilder.axios){ return window.AxiosBuilder.axios({method: "post", url: "/IoT/api/v3/EquipList/GetFullSetParmByEquipNo", params: i, data: i, headers: {"Content-Type": "application/json;charset=UTF-8", "Accept-Language": window.sessionStorage.languageType || "zh-CN"}}) } }});class Ss{constructor(e, t){ this.nodesMap = e, this.equipControllObject = t }async getSetting(e, t, s, n){ let[r, o] = String(e).split("-"), h = {equipNo: o};await ws.getSetParm(h).then(c=>{ if(c.data.code == 200){ let l = c && c.data && c.data.data && c.data.data.rows || [];this.nodesMap[e].settings || (this.nodesMap[e].settings = []), l && l.length > 0 && this.nodesMap[e] && (l.forEach(u=>{ u.title = u.setNm, u.key = `${r}-${o}-${u.setNo}`, u.level = Number(s) + 1, u.checked = n || this.equipControllObject[o] && this.equipControllObject[o].includes(u.setNo), u.isSetting = !0, u.equipNo = o, u.groupId = r, u.setNo = u.setNo, u.equipName = t }), this.nodesMap[e].settings = [...l]) } }) }}class T{static formateList(e, t){ let s = [];for(const n of e){ let r = {};r.count = 0, r.equipSelectCount = 0, r.controlSelectCount = 0, r.equipCount = n.equipCount || 0, r.title = n.name, r.key = n.id, r.isGroup = !0, r.children = [], r.status = 1, r.level = t || 1, r.expand = !t, r.equips = [], r.groupId = n.parentId, r.groups = [], r.alarmCounts = 0, r.backUpCounts = 0, r.indeterminate = !1, r.checked = !1, r.visible = !0, r.nodeEquipSelectCount = 0, r.checkedEquips = [], r.halfCheckedEquips = [], r.selectControlCount = 0, n.children && n.children.length > 0 && (r.groups = [...this.formateList(n.children, t ? t + 1 : 2)]), s.push(r) }return s }static deepClone(e, t, s, n, r, o){ let h = [];if(e){ for(let c = 0, l = e.length;c < l;c++){ const u = e[c].id || e[c].equipNo, d = `${n}-${u}`;h.push({isGroup: s, key: d, status: o[u] || 0, title: e[c].title, level: t, expand: !1, isEquip: !0, loading: !1, indeterminate: r[d] && r[d].indeterminate || !1, checked: r[d] && r[d].checked || !1, groupId: n, equipNo: u, visible: !0, settings: []}) } }return h }static copyOrigin(e){ let t = [];return e.forEach(s=>{ t.push({...s}) }), t }static getPosition(e, t){ let s = 0;for(let n = 0, r = t.length;n < r;n++){ if(t[n].key == e){ s = n - 30;break } }return s }static flattern(e, t){ e.forEach(s=>{ if(s.isGroup){ const n = t[`${s.key}`];t[`${s.key}`] = s, n && (s.alarmCounts = n.alarmCounts, s.backUpCounts = n.backUpCounts, s.status = n.status) }s.groups && s.groups.length && this.flattern(s.groups, t) }) }static generateUUID(){ let e = new Date().getTime();return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s){ let n = (e + Math.random() * 16) % 16 | 0;return e = Math.floor(e / 16), (s === "x" ? n : n & 3 | 8).toString(16) }) }static listToTreeList(e){ const t = e, s = [], n = {};return t.forEach(r=>{ n[r.id] = r }), t.forEach(r=>{ const o = n[r.parentId];o ? (o.children || (o.children = [])).push(r) : s.push(r) }), s }}class bs extends V{constructor(e, t, s){ super(), this.showSettings = t, this.groupNodeObject = e, this.aliasName = s }filterMethod(e){ for(let t in this.groupNodeObject){ e && this.updateBySearch(t, e) } }updateBySearch(e, t){ let s = this.window[`group-${this.groupNodeObject[e].key}${this.aliasName}`];s && (s = s.filter(n=>n.title.includes(t)), this.window[`group-${this.groupNodeObject[e].key}-search`] = T.copyOrigin(s)) }}const Ys = "", ee = (i, e)=>{ const t = i.__vccOpts || i;for(const[s, n]of e){ t[s] = n; }return t }, Cs = {props: {source: {type: Object, default: ()=>{}}, groupEditAndNew: {type: Function, default: ()=>{}}, deleteGroup: {type: Function, default: ()=>{}}}}, Es = {class: "operates"};function ks(i, e, t, s, n, r){ const o = a.resolveComponent("el-button"), h = a.resolveComponent("el-button-group"), c = a.resolveComponent("el-popover");return a.openBlock(), a.createElementBlock("div", Es, [a.createVNode(c, {placement: "bottom", trigger: "hover"}, {reference: a.withCtx(()=>e[6] || (e[6] = [a.createElementVNode("i", {class: "iconfont icon-_gengduo"}, null, -1)])), default: a.withCtx(()=>[a.createVNode(h, {class: "new-button-group setModule"}, {default: a.withCtx(()=>[a.createVNode(o, {type: "text", size: "small", class: "elBtn", onClick: e[0] || (e[0] = a.withModifiers(l=>t.groupEditAndNew(!1, t.source), ["stop"]))}, {default: a.withCtx(()=>[e[3] || (e[3] = a.createElementVNode("i", {class: "iconfont icon-tubiao20_bianji"}, null, -1)), a.createTextVNode(" " + a.toDisplayString(i.$t("equipInfo.poverTips.rename")), 1)]), _: 1, __: [3]}), a.createVNode(o, {type: "text", size: "small", class: "elBtn", onClick: e[1] || (e[1] = l=>t.groupEditAndNew(!0, t.source))}, {default: a.withCtx(()=>[e[4] || (e[4] = a.createElementVNode("i", {class: "iconfont icon-tubiao20_tianjiashebei"}, null, -1)), a.createTextVNode(" " + a.toDisplayString(i.$t("equipInfo.poverTips.newChildGroup")), 1)]), _: 1, __: [4]}), t.source.level != 1 ? (a.openBlock(), a.createBlock(o, {key: 0, type: "text", size: "small", class: "delete-btn", onClick: e[2] || (e[2] = a.withModifiers(l=>t.deleteGroup(t.source), ["stop"]))}, {default: a.withCtx(()=>[e[5] || (e[5] = a.createElementVNode("i", {class: "iconfont icon-tubiao20_shanchu"}, null, -1)), a.createTextVNode(" " + a.toDisplayString(i.$t("publics.button.deletes")), 1)]), _: 1, __: [5]})) : a.createCommentVNode("", !0)]), _: 1})]), _: 1})]) }const Ns = {name: "ElTreeVirtualNode", componentName: "ElTreeVirtualNode", props: {searchName: {type: String, default: ""}, expanding: {type: Boolean, default: !1}, aleadyLoadAll: {type: Boolean, default: !1}, groupLoading: {type: Boolean, default: !1}, source: {type: Object, default(){ return{} }}, showCheckbox: {type: Boolean, default: !1}, showStatus: {type: Boolean, default: !1}, showOperate: {type: Boolean, default: !1}, currentSelect: {type: [Number, String], default: -1}, nodeClick: {type: Function}, onChecked: {type: Function}, groupEditAndNew: {type: Function}, deleteGroup: {type: Function}, childrenResetGroupNum: {type: Function}, getEquipStatus: {type: Function}, colorConfig: {type: Object, default: ()=>{}}, index: {type: Number, default: -1}}, components: {oparate: ee(Cs, [["render", ks]])}, computed: {getColor(){ return function(i){ this.colorConfig || (this.colorConfig = {noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c"});let e;switch(i){ case 0:e = this.colorConfig.noComm;break;case 1:e = this.colorConfig.normal;break;case 2:e = this.colorConfig.alarm;break;case 3:e = this.colorConfig.lsSet;break;case 4:e = this.colorConfig.initialize;break;case 5:e = this.colorConfig.withdraw;break;case 6:e = this.colorConfig.BackUp;break;default:e = this.colorConfig.noComm;break }return e } }}, data(){ return{indent: 13} }, methods: {clickFunction(){ this.source.expand = !this.source.expand, this.nodeClick(this.source, this.index, this.source.level, this.source.checked) }, checkedChange(i){ this.onChecked(this.source) }}}, _s = {class: "el-tree-node__content"}, qs = {class: "nodeContent"}, Os = {key: 1, class: "circle"}, vs = {class: "label"}, Ts = {key: 2, class: "equipNumber"}, xs = {key: 4, class: "el-tree-node__loading-icon el-icon-loading"};function Ms(i, e, t, s, n, r){ const o = a.resolveComponent("el-checkbox"), h = a.resolveComponent("oparate");return a.openBlock(), a.createElementBlock("div", {class: a.normalizeClass(["el-tree-node", {parent_tag: t.source.isGroup, child_tags: !t.source.isGroup, selectedColor: t.currentSelect === t.source.key && !t.source.isGroup}]), onClick: e[2] || (e[2] = (...c)=>r.clickFunction && r.clickFunction(...c))}, [a.createElementVNode("div", _s, [a.createElementVNode("span", {class: "el-tree__indent", "aria-hidden": "true", style: a.normalizeStyle({width: (t.source.level - 1) * n.indent + "px"})}, null, 4), t.source.isGroup ? (a.openBlock(), a.createElementBlock("span", {key: 0, class: a.normalizeClass([{"is-leaf": !t.source.isGroup, expanded: t.source.isGroup && t.source.expand}, "el-tree-node__expand-icon", "iconfont icon-fangxiangL"])}, null, 2)) : a.createCommentVNode("", !0), a.createElementVNode("div", qs, [t.showCheckbox ? (a.openBlock(), a.createBlock(o, {key: 0, onClick: e[0] || (e[0] = a.withModifiers(()=>{}, ["stop"])), modelValue: t.source.checked, "onUpdate:modelValue": e[1] || (e[1] = c=>t.source.checked = c), indeterminate: t.source.indeterminate, onChange: r.checkedChange}, null, 8, ["modelValue", "indeterminate", "onChange"])) : a.createCommentVNode("", !0), t.showStatus ? (a.openBlock(), a.createElementBlock("span", Os, [t.source.status != 6 ? (a.openBlock(), a.createElementBlock("span", {key: 0, class: "yd", style: a.normalizeStyle({backgroundColor: r.getColor(t.source.status)})}, null, 4)) : (a.openBlock(), a.createElementBlock("i", {key: 1, style: a.normalizeStyle({color: t.colorConfig.BackUp}), class: "iconfont icon-gw-icon-beiji2"}, null, 4))])) : a.createCommentVNode("", !0), a.createElementVNode("span", vs, a.toDisplayString(t.source.title), 1), t.source.isGroup && !t.source.isEquip || t.source.isGroup && !t.source.isEquip ? (a.openBlock(), a.createElementBlock("span", Ts, a.toDisplayString(t.source.count), 1)) : a.createCommentVNode("", !0), t.source.isGroup && t.showOperate ? (a.openBlock(), a.createBlock(h, {key: 3, source: t.source, groupEditAndNew: t.groupEditAndNew, deleteGroup: t.deleteGroup}, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) : a.createCommentVNode("", !0), t.source.loading ? (a.openBlock(), a.createElementBlock("span", xs)) : a.createCommentVNode("", !0)])])], 2) }const As = ee(Ns, [["render", Ms]]), Is = {components: {VirtualList: yt}, mixins: [Me], data(){ return{itemComponent: As, visibleList: [], currentSelect: -1, equipStatusManage: null, cacheManage: null, searchManage: null, equipNumManage: null, requestManage: null, checkStatusManage: null, groupNodeObject: {}, nodesMap: {}, equipCheckObject: {}, equipStatusObject: {}, controlObject: {}, isSearchStatus: !1, equipControllObject: {}, expandGroup: [], updateJob: null, filterEquipList: []} }, props: {data: {type: Array}, selectEquips: {type: [Array, Object], default: ()=>[]}, controllList: {type: Array, default: ()=>[]}, showSettings: {type: Boolean, default: !1}, showSelectNum: {type: Boolean, default(){ return!1 }}, showCheckbox: {type: Boolean, default: !1}, showStatus: {type: Boolean, default: !1}, filterEquip: {type: Boolean, default: !1}, showOperate: {type: Boolean, default: !1}, defaultExpandAll: {type: Boolean, default: !1}, currentNodeKey: [String, Number], colorConfig: {type: Object, default: ()=>({noComm: "#a0a0a0", normal: "#63e03f", alarm: "#f22433", lsSet: "#bebcaa", initialize: "#289ac0", withdraw: "#ffc0cb", BackUp: "#f8901c"})}, treeType: {type: String, default: ""}, buildTree: {type: Function, default: ()=>{}}, filterData: {type: Function, default: ()=>{}}, alias: {type: String, default: ""}}, watch: {data(i){ i && i.length && (T.flattern(this.data, this.groupNodeObject), this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map(e=>e)), this.init()) }, controllList(i){ this.updateCheckedStatusWithControls() }, selectEquips(i){ this.updateCheckedStatusWithEquips(), this.$nextTick(()=>{ this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus() }) }, filterEquip(i){ this.$nextTick(()=>{ this.visibleList = [], this.$refs.virtualList.scrollToIndex(0), this.updateTreeList(this.data), this.equipNumManage.resetGroupNum(this.isSearchStatus, i, this.equipStatusObject) }) }}, computed: {aliasName(){ return this.alias ? `-${this.alias}` : "" }}, created(){ this.showCheckbox && (this.checkStatusManage = new St(this.groupNodeObject, this.nodesMap, this.equipControllObject, this.controlObject, this.equipCheckObject, this.aliasName)), this.cacheManage = new wt(this.groupNodeObject, this.nodesMap, this.controlObject, this.equipCheckObject), this.searchManage = new bs(this.groupNodeObject, this.showSettings, this.aliasName), this.equipNumManage = new bt(this.groupNodeObject, this.aliasName), this.requestManage = new Ss(this.nodesMap, this.equipControllObject) }, mounted(){ this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", i=>{ i.data.type && this[i.data.type] && this[i.data.type](i.data.data) }) }, methods: {init(){ this.data[0].expand = !0, this.updateTreeList(), setTimeout(()=>{ Object.values(this.groupNodeObject).forEach((i, e)=>{ !i.expand && this.expandGroup.includes(i.key) && (i.expand = !0), this.filterWithAlias(i.key), this.updateGroupEquips(i.key, !0) }), this.showCheckbox && this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new ys(this.nodesMap, this.equipStatusObject, this.groupNodeObject, this.statusChange, this.aliasName)) }, 500) }, filterWithAlias(i){ if(this.aliasName){ let e = this.window[`group-${i}`] || [];this.window[`group-${i}${this.aliasName}`] = this.filterData(e) } }, updateCurrentSelect(){ this.window.equipCache && this.window.equipCache[this.currentNodeKey] && (this.currentSelect = `${this.window.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`) }, statusChange(i, e, t){ this.currentSelect == `${i}-${e}` && this.$emit("statusChange", e, t) }, updateCheckWidthJob(){ this.showCheckbox && (this.checkStatusManage.resetCheckedStatus(), this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, updateGroupEquips(i, e){ if(!this.isSearchStatus && this.groupNodeObject[i]){ let t = this.equipNumManage.getAllEquipsNum();this.$emit("getTotal", t) }this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.groupNodeObject[i].expand && this.updateList(i, this.groupNodeObject[i].level, null, !1) }, updateList(i){ if(this.groupNodeObject[i]){ let e = [];this.isSearchStatus ? (e = this.window[`group-${i}-search`], this.groupNodeObject[i].equips = [...T.deepClone(e, Number(this.groupNodeObject[i].level) + 1, this.showSettings, i, this.equipCheckObject, this.equipStatusObject)]) : (e = this.window[`group-${i}${this.aliasName}`], this.groupNodeObject[i].equips = [...T.deepClone(e, Number(this.groupNodeObject[i].level) + 1, this.showSettings, i, this.equipCheckObject, this.equipStatusObject)]), this.cacheManage.addNodesMap(this.groupNodeObject[i].equips), this.cacheManage.closeBrotherNode(i), this.visibleList = [], this.updateTreeList(this.data), this.showCheckbox && this.checkStatusManage && e && e.length && this.checkStatusManage.updateGroupCheckStatus(), this.showStatus && this.equipStatusManage && this.equipStatusManage.updateGroupStatus(i), this.updateCurrentSelect() } }, updateTreeList(i){ i && i.length > 0 && i.forEach(e=>{ this.filterEquip && e.status === 2 ? this.filterEquipList.includes(e.equipNo) || this.visibleList.push(e) : this.filterEquip || this.visibleList.push(e), e.expand ? e.isEquip ? (e.children || (e.children = []), e.settings && (e.children = [...e.settings || []])) : e.children = [...e.equips || [], ...e.groups || []] : e.children = [], this.updateTreeList(e.children || []) }) }, nodeClick(i, e, t, s){ this.$emit("node-click", {...i, key: i.isEquip ? i.equipNo : i.key}), i.isGroup ? i.isEquip ? this.equipClick(i, e, s) : this.groupClick(i, e, s) : this.currentSelect = i.key }, groupClick(i, e, t){ i.expand ? this.updateList(i.key, i.level, e, t) : (this.cacheManage.recycleGroupCache(i.key), this.visibleList = [], this.updateTreeList(this.data)) }, async equipClick(i, e, t){ this.showSettings && (i.expand ? (i.loading = !0, await this.requestManage.getSetting(i.key, i.title, i.level, t), this.controlObject[`${i.groupId}-${i.equipNo}`] = {groupId: i.groupId}, i.loading = !1, this.visibleList.splice(e + 1, 0, ...this.nodesMap[i.key].settings), this.cacheManage.addNodesMap(this.nodesMap[i.key].settings)) : (this.visibleList.splice(e + 1, this.nodesMap[i.key].settings.length), this.cacheManage.removeNodesMap(this.nodesMap[i.key].settings), this.nodesMap[i.key].settings = [], delete this.controlObject[`${i.groupId}-${i.equipNo}`])) }, onChecked(i){ this.checkStatusManage && this.checkStatusManage.onChecked(i, this.isSearchStatus), this.$emit("onCheck") }, groupEditAndNew(i, e){ this.$emit("groupEditAndNew", {isGroupNew: i, node: e}) }, deleteGroup(i){ this.$emit("deleteGroup", i) }, updateCheckedStatusWithControls(){ this.controllList && this.controllList.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithControls(this.controllList) }, updateCheckedStatusWithEquips(){ if(!this.checkStatusManage || !this.selectEquips){ return; }(Array.isArray(this.selectEquips) ? this.selectEquips.length > 0 : Object.keys(this.selectEquips).length > 0) && (this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips), this.checkStatusManage.updateGroupCheckStatus()) }, resetCheckedStatus(){ this.checkStatusManage && this.checkStatusManage.resetCheckedStatus() }, getEquipSelectd(){ return this.checkStatusManage && this.checkStatusManage.getEquipSelectd() }, getEquipGroupSelectd(){ return this.checkStatusManage && this.checkStatusManage.getEquipGroupSelectd() }, getControlSelected(){ return this.checkStatusManage && this.checkStatusManage.getControlSelected() }, recordExpandGroup(){ this.expandGroup = [], Object.values(this.groupNodeObject).forEach(i=>{ i.expand && this.expandGroup.push(i.key) }) }, removeExpandGroup(){ this.$nextTick(()=>{ this.expandGroup = [] }) }, filterMethod(i){ this.visibleList = [], this.cacheManage.recycleAllNodeCache(), i ? (this.isSearchStatus = !0, this.searchManage.filterMethod(i)) : this.isSearchStatus = !1, this.init(), this.$nextTick(()=>{ this.$refs.virtualList.scrollToIndex(0) }), this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.showCheckbox && (this.checkStatusManage && this.checkStatusManage.reComputedCheckNum(this.isSearchStatus), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus()) }, rebuildTree(){ this.recordExpandGroup(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus(), this.cacheManage.recycleAllNodeCache(!0), this.$nextTick(()=>{ this.buildTree(), this.removeExpandGroup() }) }, destroyTree(){ this.cacheManage.recycleAllNodeCache(!0), this.visibleList = [], this.updateTreeList(this.data) }, GetGroupEquips(i){ i.groupId && this.groupNodeObject[i.groupId] && !this.isSearchStatus && (this.updateGroupEquips(i.groupId, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(()=>{ this.equipNumManage.resetGroupNum(this.isSearchStatus, this.filterEquip, this.equipStatusObject), this.updateCheckWidthJob() }, 500)) }, DeleteEquip(i){ const{groupId: e, equips: t} = i || {};e && this.groupNodeObject[e] && (this.updateGroupEquips(i.groupId), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()), t.length && t.forEach(s=>{ let n = this.nodesMap[`${e}-${s.id}`];n && (this.currentSelect.toString().includes(s.id) && this.$emit("currentDelete"), this.showStatus && (n.status == 2 ? this.equipStatusManage.setGroupStatus(e, !1, 2) : n.status == 6 && this.equipStatusManage.setGroupStatus(e, !1, 6)), delete this.nodesMap[`${e}-${s.id}`], delete this.equipCheckObject[s.id]), delete this.equipStatusObject[s.id] }) }, MoveEquips(i){ const{updateGroups: e, buildTree: t} = i || {};!t && e ? e.forEach(s=>{ s && this.groupNodeObject[s] && (this.updateGroupEquips(s), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()) }) : t && this.rebuildTree() }, DeleteEquipGroup(i){ i.forEach(e=>{ e.groupId && this.nodesMap[e.groupId] && (this.isSearchStatus || this.rebuildTree()) }) }, AddEquipGroup(i){ const{parentGroupId: e, groupId: t} = i || {};t && this.nodesMap[e] && this.treeType && (this.isSearchStatus || this.rebuildTree()) }, EditEquipGroup(i){ const{groupId: e, groupName: t} = i;this.nodesMap[e] && (this.nodesMap[e].title = t) }, AddEquip(i){ const{groupId: e} = i || {};this.filterEquip && (this.filterEquipList = i == null ? void 0 : i.equips.map(t=>t.id)), e && this.groupNodeObject[e] && !this.isSearchStatus ? (this.updateGroupEquips(e, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(()=>{ this.updateCheckWidthJob() }, 500)) : e && !this.isSearchStatus && this.rebuildTree() }, EditEquip(i){ const{equipNo: e, groupId: t, equipName: s} = i || {};this.nodesMap[`${t}-${e}`] && (this.isSearchStatus || (this.nodesMap[`${t}-${e}`].title = s)) }, childrenResetGroupNum(i){ this.equipNumManage.resetGroupNum(i, this.filterEquip, this.equipStatusObject) }, getEquipStatus(i){ return this.equipStatusManage.equipStatusObject[i] }}}, js = {class: "gw-tree", style: {height: "100%"}}, Bs = {class: "tree", style: {height: "100%"}};function Rs(i, e, t, s, n, r){ const o = a.resolveComponent("virtual-list", !0);return a.openBlock(), a.createElementBlock("div", js, [a.createElementVNode("div", Bs, [a.createVNode(o, {ref: "virtualList", class: "virtualList", "data-key": "key", "data-sources": n.visibleList, "data-component": n.itemComponent, keeps: 40, "extra-props": {currentSelect: n.currentSelect, nodeClick: r.nodeClick, showStatus: t.showStatus, filterEquip: t.filterEquip, showSettings: t.showSettings, showCheckbox: t.showCheckbox, onChecked: r.onChecked, showOperate: t.showOperate, groupEditAndNew: r.groupEditAndNew, deleteGroup: r.deleteGroup, colorConfig: t.colorConfig, childrenResetGroupNum: r.childrenResetGroupNum, getEquipStatus: r.getEquipStatus}}, null, 8, ["data-sources", "data-component", "extra-props"])])]) }const Ls = ee(Is, [["render", Rs]]);class Gs{constructor(){ const t = `${location.protocol === "https:" ? "https" : "http"}://${location.hostname}:9600`;this.eGroupNotify = new Xe(t, !0, {hub: "eGroupNotify", userName: sessionStorage.userName}), this.alreadyUpdate = {}, this.notify = null, this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }stop(){ this.notify && this.notify.disconnect() }Init(){ this.eGroupNotify.openConnect().then(e=>{ this.notify = e;try{ e.emit("invoke", {method: "GetEquipGroupTree", data: {}}), e.emit("invoke", {method: "GetAllEquipGroupTree", data: {}}) }catch(t){ console.log(t) }this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");try{ e.emit("invoke", {method: "GetGroupEquips", data: {}}) }catch(t){ console.log(t) }this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "MoveEquips"), this.subscribeTo(e, "CopyEquips"), this.subscribeTo(e, "GetAllEquipGroupTree") }).catch(e=>{ console.error(e) }) }subscribeTo(e, t){ e.off(t), e.on(t, s=>{ const n = s == null ? void 0 : s.data;n && n.isSuccess && (this[t] ? this[t](n.data) : this.notice({func: t, data: n.data, key: n.groupId})) }) }GetEquipGroupTree(e){ this.window.groupList || (this.window.groupList = e, this.notice({type: "GetEquipGroupTree"})) }GetAllEquipGroupTree(e){ this.window.groupList_manageMent || (this.window.groupList_manageMent = e, this.notice({type: "GetEquipGroupTreeWidthTreeType"})) }AddEquipGroup(e){ const{parentGroupId: t, groupId: s, groupName: n} = e || {};s && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({parentId: t, id: s, name: n, equipCount: 0}), this.notice({type: "AddEquipGroup", data: e})) }EditEquipGroup(e){ const{groupId: t, groupName: s} = e;this.window.groupList && window.groupList.forEach(n=>{ n.id == t && (n.name = s) }), this.window.groupList_manageMent && window.groupList_manageMent.forEach(n=>{ n.id == t && (n.name = s) }), this.notice({type: "EditEquipGroup", data: e}) }deleteChildGroup(e, t){ let s = [];t.forEach(n=>{ n.parentId == e && s.push(n.id) }), s.forEach(n=>{ let r = t.findIndex(o=>o.id == n);r > -1 && t.splice(r, 1), this.deleteChildGroup(n, t) }) }DeleteEquipGroup(e){ e.forEach(t=>{ if(this.window.groupList){ let s = this.window.groupList.findIndex(n=>n.id == t.groupId);s > -1 && this.window.groupList.splice(s, 1), this.deleteChildGroup(t.groupId, this.window.groupList) }if(this.window.groupList_manageMent){ let s = this.window.groupList_manageMent.findIndex(n=>n.id == t.groupId);s > -1 && this.window.groupList_manageMent.splice(s, 1), this.deleteChildGroup(t.groupId, this.window.groupList_manageMent) } }), this.notice({type: "DeleteEquipGroup", data: e}) }GetGroupEquips(e){ const{groupId: t, equips: s} = e || {};this.alreadyUpdate[t] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] = {}, t && s && s instanceof Array && (s.forEach(n=>{ n.title = n.name, n.groupId = t, n.equipNo = n.id, this.window.equipCache || (this.window.equipCache = {}), this.window.equipCache[n.id] = n, this.window.groupCache[t][n.id] = n }), this.window[`group-${t}`] = s, this.notice({type: "GetGroupEquips", data: {groupId: t}}), this.alreadyUpdate[t] = !0)) }AddEquip(e){ const{groupId: t, equips: s} = e || {};this.window[`group-${t}`] || (this.window[`group-${t}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] || (this.window.groupCache[t] = {}), this.window.equipCache || (this.window.equipCache = {});let n = this.window[`group-${t}`].length;if(t && s){ if(s.forEach((r, o)=>{ this.window[`group-${t}`].push({equipNo: r.id, groupId: t, id: r.id, title: r.name}), this.window.equipCache[r.id] = this.window[`group-${t}`][n + o], this.window.groupCache[t][r.id] = this.window[`group-${t}`][n + o] }), !this.exist(t, this.window.groupList)){ let r = this.findParentList(t, this.window.groupList_manageMent);this.window.groupList.push(...r) }this.notice({type: "AddEquip", data: e}) } }MoveEquips(e){ let t = [], s = !0, n = [];const{sourceGroup: r, targetGroupId: o} = e || {};o && t.push(o), r.forEach(h=>{ if(t.push(h.groupId), (!this.window[`group-${o}`] || !this.window[`group-${o}`].length) && (this.window[`group-${o}`] = [], n.push(o)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[o] || (this.window.groupCache[o] = {}), h.equips.forEach(c=>{ if(!c.name && this.window.equipCache && this.window.equipCache[c.id] && (c.name = this.window.equipCache[c.id].title || this.window.equipCache[c.id].name), c.title = c.name || "", c.groupId = o, c.equipNo = c.id, this.window[`group-${h.groupId}`]){ let l = this.window[`group-${h.groupId}`].findIndex(u=>u.id == c.id);l > -1 && this.window[`group-${h.groupId}`].splice(l, 1) }this.window.equipCache || (this.window.equipCache = {}), this.window.equipCache[c.id] = c, this.window.groupCache[o][c.id] = c, this.window[`group-${o}`].push(c) }), !this.window[`group-${h.groupId}`].length){ let c = this.window.groupList.findIndex(l=>l.id == h.groupId);c > -1 && this.window.groupList.splice(c, 1), this.deleteChildGroup(h.groupId, this.window.groupList) } }), n.forEach(h=>{ if(!this.exist(h, this.window.groupList)){ let c = this.findParentList(h, this.window.groupList_manageMent);this.window.groupList.push(...c) } }), this.notice({type: "MoveEquips", data: {updateGroups: t, buildTree: s}}) }CopyEquips(e){ const{targetGroupId: t, equips: s} = e || {};if(!t || !s || !Array.isArray(s)){ console.warn("CopyEquips: 无效的数据格式", e);return }let n = [t], r = [];this.window[`group-${t}`] || (this.window[`group-${t}`] = [], r.push(t)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] || (this.window.groupCache[t] = {}), this.window.equipCache || (this.window.equipCache = {}), s.forEach(o=>{ !o.name && this.window.equipCache && this.window.equipCache[o.id] && (o.name = this.window.equipCache[o.id].title || this.window.equipCache[o.id].name);const h = {id: o.id, equipNo: o.id, groupId: t, title: o.name || "", name: o.name || ""};this.window.equipCache[o.id] = h, this.window.groupCache[t][o.id] = h, this.window[`group-${t}`].push(h) }), r.forEach(o=>{ if(!this.exist(o, this.window.groupList)){ let h = this.findParentList(o, this.window.groupList_manageMent);this.window.groupList.push(...h) } }), this.notice({type: "MoveEquips", data: {updateGroups: n, buildTree: !1, targetGroupId: t, equipCount: s.length}}) }exist(e, t){ return t ? t.some(s=>s.id == e) : !1 }findParentList(e, t){ let s = [];if(t){ let n = t.findIndex(r=>r.id == e);n > -1 && s.push({...t[n]}), t[n].parentId && !this.exist(t[n].parentId, this.window.groupList) && s.push(...this.findParentList(t[n].parentId, this.window.groupList_manageMent)) }return s }DeleteEquip(e){ const{groupId: t, equips: s} = e || {};if(t && s && s instanceof Array){ if(this.window[`group-${t}`]){ for(let n = 0, r = s.length;n < r;n++){ let o = this.window[`group-${t}`].findIndex(h=>h.id == s[n].id);o > -1 && this.window[`group-${t}`].splice(o, 1), delete this.window.equipCache[s[n].id], delete this.window.groupCache[t][s[n].id] } }this.notice({type: "DeleteEquip", data: e}) } }EditEquip(e){ const{equipNo: t, groupId: s, equipName: n} = e || {};s && t && (window[`group-${s}`] && (this.window.equipCache[t] = n), this.notice({type: "EditEquip", data: e})) }notice(e){ if(this.window.hasIframe){ let t = document.getElementsByTagName("iframe");for(let s of t){ s.contentWindow.postMessage(e) } }else { window.postMessage(e, "*") } }}const $s = {name: "treeV2", components: {tree: Ls}, mixins: [Me], data(){ return{list: [], refId: T.generateUUID(), treeKey: null, listKey: null, hasBuildTree: !1} }, props: {treeType: {type: String, default: ""}}, mounted(){ this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, this.window[this.treeKey] ? this.list = T.formateList(JSON.parse(JSON.stringify(this.window[this.treeKey]))) : this.window[this.listKey] && this.buildTree(), window.executeQueue || (window.executeQueues = {}), window.executeQueues[this.refId] = this.destroyTree, window.addEventListener("message", i=>{ i && i.data && i.data.type && this[i.data.type] && this[i.data.type](i.data.data) });try{ this.window.hasIframe || this.selfRequest() }catch{ this.selfRequest() } }, methods: {selfRequest(){ new Gs().Init() }, GetEquipGroupTreeWidthTreeType(){ this.treeType && this.window[this.listKey] && this.buildTree() }, GetEquipGroupTree(){ !this.treeType && this.window[this.listKey] && this.buildTree() }, AddEquip(i){ const{groupId: e} = i || {};this.window[this.listKey] && (!e || !this.$refs[this.refId] || !this.$refs[this.refId].groupNodeObject[e]) && this.buildTree() }, buildTree(){ if(this.window[this.listKey]){ let i = T.listToTreeList(JSON.parse(JSON.stringify(this.window[this.listKey])));this.list = T.formateList(JSON.parse(JSON.stringify(i))), this.window[`equipGroup${this.treeType}`] = i, this.hasBuildTree = !0 } }, filterMethod(i){ this.$refs[this.refId].filterMethod(i) }, resetCheckedStatus(){ this.$refs[this.refId].resetCheckedStatus() }, getEquipSelectd(){ return this.$refs[this.refId].getEquipSelectd() }, getEquipGroupSelectd(){ return this.$refs[this.refId].getEquipGroupSelectd() }, getControlSelected(){ return this.$refs[this.refId].getControlSelected() }, destroyTree(){ this.$refs[this.refId].destroyTree() }}};function Ps(i, e, t, s, n, r){ const o = a.resolveComponent("tree");return a.openBlock(), a.createBlock(o, a.mergeProps({ref: n.refId, data: n.list}, {...i.$attrs, ...i.$props}, a.toHandlers(i.$listeners), {buildTree: r.buildTree}), null, 16, ["data", "buildTree"]) }const te = ee($s, [["render", Ps]]);return te.install = function(i){ i.component(te.name, te) }, te
6
+ });
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.gw-tree{height:100%;font-size:14px;color:var(--tree-node-color)}.gw-tree .el-icon-more{transform:rotate(90deg)}.gw-tree .el-tree__indent{flex-shrink:0}.gw-tree .nodeContent{display:flex;justify-content:flex-start;align-items:center;width:calc(100% - 30px)}.gw-tree .nodeContent .label{line-height:30px;flex:1;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gw-tree .el-tree-node__expand-icon{padding:0!important}.gw-tree .hover-add-width{width:calc(100% + 8px)!important}.gw-tree .hover-add-width .el-tree-node{width:calc(100% - 12px)!important;position:relative}.gw-tree .notAllow{cursor:not-allowed!important}.gw-tree .el-tree-node{height:36px;position:relative}.gw-tree .el-tree-node .block{width:100%;height:100%;position:absolute;top:0;left:0;z-index:10;cursor:not-allowed}.gw-tree .virtualList{height:100%;overflow-y:auto;overflow-x:hidden}.gw-tree .el-loading-mask{visibility:visible!important}.gw-tree .el-tree__empty-block .el-tree__empty-text{color:var(--frame-main-color-1);display:flex;justify-content:center;align-items:center;font-size:18px}.gw-tree .selectNum{height:36px;line-height:36px;padding-left:20px;color:var(--tree-node-color);font-size:14px}.gw-tree .el-checkbox{margin-right:10px!important}.gw-tree .circle{width:14px;height:14px;display:flex;justify-content:center;align-items:center;margin-right:5px}.gw-tree .circle .yd{width:10px;height:10px;border-radius:50%;display:inline-block}.gw-tree .circle .iconfont{font-size:14px}.gw-tree .el-tree-node__content:hover{background-color:unset!important}.gw-tree>div .el-tree-node:hover{background-color:var(--tree-node-background_hover);border-top-right-radius:3px;border-bottom-right-radius:3px}.gw-tree>div .el-tree-node:hover>.el-tree-node__content>.nodeContent .el-tree-node__label{color:var(--tree-node-color__select)}.gw-tree .el-tree-node.selectedColor{border-left:4px solid var(--tree-node-border__select);background-color:var(--tree-node-background_select)}.gw-tree .el-tree-node.selectedColor .nodeContent .el-tree-node__label{color:#3875ff}.gw-tree .el-tree-node{-webkit-user-select:none;user-select:none}.gw-tree .el-tree-node__content{width:100%;height:100%!important;display:flex}.gw-tree .el-tree-node__content .nodeContent{flex:1;height:100%;display:flex;align-items:center;border-radius:3px}.gw-tree .el-tree-node__content .nodeContent .equipNumber{margin:0 12px}.gw-tree .el-tree-node__content .nodeContent .icon-gw-icon-yijian{width:16px;height:16px;margin-right:18px;opacity:0}.gw-tree .el-tree-node__content .nodeContent .icon-gw-icon-yijian path{fill:var(--tree-node-color)}.gw-tree .el-tree-node__content .nodeContent:hover .icon-gw-icon-yijian{opacity:1}.gw-tree .el-tree-node__content .nodeContent .el-tree-node__label{flex:1}.gw-tree .el-tree-node__content .nodeContent .expanded,.gw-tree .el-tree-node__content .nodeContent .el-tree-node__expand-icon{color:var(--tree-node-color)}.gw-tree .el-tree-node:focus>.el-tree-node__content{background-color:unset!important}.gw-tree .el-tree-node__expand-icon{margin:10px}.gw-tree .child_tags{position:relative;width:auto;height:36px;display:flex;flex-direction:row;justify-content:flex-start;align-items:center;line-height:30px;white-space:nowrap;text-overflow:ellipsis;color:var(--tre-node-color);cursor:pointer;border-left:4px solid transparent}.gw-tree .child_tags .nodeContent{padding-left:18px;background-size:.5px 12px;background-repeat:repeat-y;background-position:left}[data-theme=light] .gw-tree .child_tags .nodeContent{background-image:linear-gradient(to bottom,#979797 50%,#979797 50%,transparent 50%)}[data-theme=dark] .gw-tree .child_tags .nodeContent{background-image:linear-gradient(to bottom,#494D57 50%,#494D57 50%,transparent 50%)}.gw-tree .child_tags>label{margin-left:10px}.gw-tree .child_tags .icondian{font-size:.8rem;color:#8c8c8c;pointer-events:none}.gw-tree .child_tags a{font-size:14px;height:40px;line-height:40px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:72%}.operates .icon-_gengduo{color:var(--button-primary-color)}.setModule{display:flex;flex-direction:column;justify-content:left}.setModule .el-button{height:32px;display:flex;justify-content:left}.setModule .el-button span{color:var(--button-primary-color)}.setModule .el-button span i{margin-right:10px}.setModule .el-button:hover{border-radius:2px;background-color:var(--btn-selectBgColor)}.setModule .el-button:hover span{color:#fff}.setModule .delete-btn span{color:var(--gw-color-danger)}.setModule .delete-btn:hover{color:#fff}
@@ -22,11 +22,11 @@ class a {
22
22
  }
23
23
  class c {
24
24
  constructor() {
25
- this.eGroupNotify = new a("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.window = window;
25
+ this.eGroupNotify = new a("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, window = window;
26
26
  try {
27
- window.top.equipGroup, this.window = window.top;
27
+ window.top.equipGroup, window = window.top;
28
28
  } catch {
29
- this.window = window;
29
+ window = window;
30
30
  }
31
31
  }
32
32
  stop() {
@@ -65,16 +65,16 @@ class c {
65
65
  }
66
66
  // 获取分组---无权限管理的分组列表--空设备分组不展示
67
67
  GetEquipGroupTree(o) {
68
- this.window.groupList || (this.window.groupList = o, this.notice({ type: "GetEquipGroupTree" }));
68
+ window.groupList || (window.groupList = o, this.notice({ type: "GetEquipGroupTree" }));
69
69
  }
70
70
  // 获取全量分组---设备管理使用
71
71
  GetAllEquipGroupTree(o) {
72
- this.window.groupList_manageMent || (this.window.groupList_manageMent = o, this.notice({ type: "GetEquipGroupTreeWidthTreeType" }));
72
+ window.groupList_manageMent || (window.groupList_manageMent = o, this.notice({ type: "GetEquipGroupTreeWidthTreeType" }));
73
73
  }
74
74
  // 新增分组
75
75
  AddEquipGroup(o) {
76
76
  const { parentGroupId: i, groupId: t, groupName: e } = o || {};
77
- t && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({
77
+ t && (window.groupList_manageMent || (window.groupList_manageMent = []), window.groupList_manageMent.push({
78
78
  parentId: i,
79
79
  id: t,
80
80
  name: e,
@@ -84,9 +84,9 @@ class c {
84
84
  // 编辑分组
85
85
  EditEquipGroup(o) {
86
86
  const { groupId: i, groupName: t } = o;
87
- this.window.groupList && window.groupList.forEach((e) => {
87
+ window.groupList && window.groupList.forEach((e) => {
88
88
  e.id == i && (e.name = t);
89
- }), this.window.groupList_manageMent && window.groupList_manageMent.forEach((e) => {
89
+ }), window.groupList_manageMent && window.groupList_manageMent.forEach((e) => {
90
90
  e.id == i && (e.name = t);
91
91
  }), this.notice({ type: "EditEquipGroup", data: o });
92
92
  }
@@ -102,41 +102,41 @@ class c {
102
102
  // 删除分组
103
103
  DeleteEquipGroup(o) {
104
104
  o.forEach((i) => {
105
- if (this.window.groupList) {
106
- let t = this.window.groupList.findIndex((e) => e.id == i.groupId);
107
- t > -1 && this.window.groupList.splice(t, 1), this.deleteChildGroup(i.groupId, this.window.groupList);
105
+ if (window.groupList) {
106
+ let t = window.groupList.findIndex((e) => e.id == i.groupId);
107
+ t > -1 && window.groupList.splice(t, 1), this.deleteChildGroup(i.groupId, window.groupList);
108
108
  }
109
- if (this.window.groupList_manageMent) {
110
- let t = this.window.groupList_manageMent.findIndex((e) => e.id == i.groupId);
111
- t > -1 && this.window.groupList_manageMent.splice(t, 1), this.deleteChildGroup(i.groupId, this.window.groupList_manageMent);
109
+ if (window.groupList_manageMent) {
110
+ let t = window.groupList_manageMent.findIndex((e) => e.id == i.groupId);
111
+ t > -1 && window.groupList_manageMent.splice(t, 1), this.deleteChildGroup(i.groupId, window.groupList_manageMent);
112
112
  }
113
113
  }), this.notice({ type: "DeleteEquipGroup", data: o });
114
114
  }
115
115
  // 获取设备
116
116
  GetGroupEquips(o) {
117
117
  const { groupId: i, equips: t } = o || {};
118
- this.alreadyUpdate[i] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[i] = {}, i && t && t instanceof Array && (t.forEach((e) => {
119
- e.title = e.name, e.groupId = i, e.equipNo = e.id, delete e.name, window.equipCache || (this.window.equipCache = {}), this.window.equipCache[e.id] = e, this.window.groupCache[i][e.id] = e;
120
- }), this.window[`group-${i}`] = t, this.notice({ type: "GetGroupEquips", data: { groupId: i } }), this.alreadyUpdate[i] = !0));
118
+ this.alreadyUpdate[i] || (window.groupCache || (window.groupCache = {}), window.groupCache[i] = {}, i && t && t instanceof Array && (t.forEach((e) => {
119
+ e.title = e.name, e.groupId = i, e.equipNo = e.id, delete e.name, window.equipCache || (window.equipCache = {}), window.equipCache[e.id] = e, window.groupCache[i][e.id] = e;
120
+ }), window[`group-${i}`] = t, this.notice({ type: "GetGroupEquips", data: { groupId: i } }), this.alreadyUpdate[i] = !0));
121
121
  }
122
122
  // 新增设备
123
123
  AddEquip(o) {
124
124
  const { groupId: i, equips: t } = o || {};
125
- this.window[`group-${i}`] || (this.window[`group-${i}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[i] || (this.window.groupCache[i] = {}), this.window.equipCache || (this.window.equipCache = {});
126
- let e = this.window[`group-${i}`].length;
125
+ window[`group-${i}`] || (window[`group-${i}`] = []), window.groupCache || (window.groupCache = {}), window.groupCache[i] || (window.groupCache[i] = {}), window.equipCache || (window.equipCache = {});
126
+ let e = window[`group-${i}`].length;
127
127
  if (i && t) {
128
128
  if (t.forEach((n, s) => {
129
- this.window[`group-${i}`].push(
129
+ window[`group-${i}`].push(
130
130
  {
131
131
  equipNo: n.id,
132
132
  groupId: i,
133
133
  id: n.id,
134
134
  title: n.name
135
135
  }
136
- ), this.window.equipCache[n.id] = this.window[`group-${i}`][e + s], this.window.groupCache[i][n.id] = this.window[`group-${i}`][e + s];
137
- }), !this.exist(i, this.window.groupList)) {
138
- let n = this.findParentList(i, this.window.groupList_manageMent);
139
- this.window.groupList.push(...n);
136
+ ), window.equipCache[n.id] = window[`group-${i}`][e + s], window.groupCache[i][n.id] = window[`group-${i}`][e + s];
137
+ }), !this.exist(i, window.groupList)) {
138
+ let n = this.findParentList(i, window.groupList_manageMent);
139
+ window.groupList.push(...n);
140
140
  }
141
141
  this.notice({ type: "AddEquip", data: o });
142
142
  }
@@ -181,20 +181,20 @@ class c {
181
181
  let i = [], t = !0, e = [];
182
182
  const { sourceGroup: n, targetGroupId: s } = o || {};
183
183
  s && i.push(s), n.forEach((p) => {
184
- if (i.push(p.groupId), (!this.window[`group-${s}`] || !this.window[`group-${s}`].length) && (this.window[`group-${s}`] = [], e.push(s)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[s] || (this.window.groupCache[s] = {}), p.equips.forEach((d) => {
185
- if (d.title = d.name, d.groupId = s, d.equipNo = d.id, this.window[`group-${p.groupId}`]) {
186
- let r = this.window[`group-${p.groupId}`].findIndex((u) => u.id == d.id);
187
- r > -1 && this.window[`group-${p.groupId}`].splice(r, 1);
184
+ if (i.push(p.groupId), (!window[`group-${s}`] || !window[`group-${s}`].length) && (window[`group-${s}`] = [], e.push(s)), window.groupCache || (window.groupCache = {}), window.groupCache[s] || (window.groupCache[s] = {}), p.equips.forEach((d) => {
185
+ if (d.title = d.name, d.groupId = s, d.equipNo = d.id, window[`group-${p.groupId}`]) {
186
+ let r = window[`group-${p.groupId}`].findIndex((u) => u.id == d.id);
187
+ r > -1 && window[`group-${p.groupId}`].splice(r, 1);
188
188
  }
189
- window.equipCache || (this.window.equipCache = {}), this.window.equipCache[d.id] = d, this.window.groupCache[s][d.id] = d, this.window[`group-${s}`].push(d);
190
- }), !this.window[`group-${p.groupId}`].length) {
191
- let d = this.window.groupList.findIndex((r) => r.id == p.groupId);
192
- d > -1 && this.window.groupList.splice(d, 1), this.deleteChildGroup(p.groupId, this.window.groupList);
189
+ window.equipCache || (window.equipCache = {}), window.equipCache[d.id] = d, window.groupCache[s][d.id] = d, window[`group-${s}`].push(d);
190
+ }), !window[`group-${p.groupId}`].length) {
191
+ let d = window.groupList.findIndex((r) => r.id == p.groupId);
192
+ d > -1 && window.groupList.splice(d, 1), this.deleteChildGroup(p.groupId, window.groupList);
193
193
  }
194
194
  }), e.forEach((p) => {
195
- if (!this.exist(p, this.window.groupList)) {
196
- let d = this.findParentList(p, this.window.groupList_manageMent);
197
- this.window.groupList.push(...d);
195
+ if (!this.exist(p, window.groupList)) {
196
+ let d = this.findParentList(p, window.groupList_manageMent);
197
+ window.groupList.push(...d);
198
198
  }
199
199
  }), this.notice({ type: "moveEquips", data: { updateGroups: i, buildTree: t } });
200
200
  }
@@ -205,7 +205,7 @@ class c {
205
205
  let t = [];
206
206
  if (i) {
207
207
  let e = i.findIndex((n) => n.id == o);
208
- e > -1 && t.push({ ...i[e] }), i[e].parentId && !this.exist(i[e].parentId, this.window.groupList) && t.push(...this.findParentList(i[e].parentId, this.window.groupList_manageMent));
208
+ e > -1 && t.push({ ...i[e] }), i[e].parentId && !this.exist(i[e].parentId, window.groupList) && t.push(...this.findParentList(i[e].parentId, window.groupList_manageMent));
209
209
  }
210
210
  return t;
211
211
  }
@@ -213,22 +213,22 @@ class c {
213
213
  DeleteEquip(o) {
214
214
  const { groupId: i, equips: t } = o || {};
215
215
  if (i && t && t instanceof Array) {
216
- if (this.window[`group-${i}`]) {
217
- for (let e = 0, n = t.length; e < n; e++) {
218
- let s = this.window[`group-${i}`].findIndex((p) => p.id == t[e].id);
219
- s > -1 && this.window[`group-${i}`].splice(s, 1), delete this.window.equipCache[t[e].id], delete this.window.groupCache[i][t[e].id];
220
- }
221
- }
216
+ if (window[`group-${i}`]) {
217
+ for (let e = 0, n = t.length; e < n; e++) {
218
+ let s = window[`group-${i}`].findIndex((p) => p.id == t[e].id);
219
+ s > -1 && window[`group-${i}`].splice(s, 1), delete window.equipCache[t[e].id], delete window.groupCache[i][t[e].id];
220
+ }
221
+ }
222
222
  this.notice({ type: "DeleteEquip", data: o });
223
223
  }
224
224
  }
225
225
  // 编辑设备
226
226
  EditEquip(o) {
227
227
  const { equipNo: i, groupId: t, equipName: e } = o || {};
228
- t && i && (window[`group-${t}`] && (this.window.equipCache[i] = e), this.notice({ type: "EditEquip", data: o }));
228
+ t && i && (window[`group-${t}`] && (window.equipCache[i] = e), this.notice({ type: "EditEquip", data: o }));
229
229
  }
230
230
  notice(o) {
231
- if (this.window.hasIframe) {
231
+ if (window.hasIframe) {
232
232
  let i = document.getElementsByTagName("iframe");
233
233
  for (let t of i) { t.contentWindow.postMessage(o); }
234
234
  } else { window.postMessage(o, "*"); }
@@ -236,4 +236,5 @@ class c {
236
236
  }
237
237
  export {
238
238
  c as equipCache,
239
- a as Signalr};
239
+ a as Signalr
240
+ };
@@ -1 +1 @@
1
- (function(r, h){ typeof exports == "object" && typeof module < "u" ? h(exports, require("@aspnet/signalr")) : typeof define == "function" && define.amd ? define(["exports", "@aspnet/signalr"], h) : (r = typeof globalThis < "u" ? globalThis : r || self, h(r.index = {}, r.SignalR)) })(this, function(r, h){ "use strict";function c(u){ const e = Object.create(null, {[Symbol.toStringTag]: {value: "Module"}});if(u){ for(const i in u){ if(i !== "default"){ const o = Object.getOwnPropertyDescriptor(u, i);Object.defineProperty(e, i, o.get ? o : {enumerable: !0, get: ()=>u[i]}) } } }return e.default = u, Object.freeze(e) }const g = c(h);class a{constructor(e, i, o){ this.url = e, this.connectionId = i, this.equipNo = o, this.signalr = null }openConnect(){ return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new g.HubConnectionBuilder().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise(e=>{ this.signalr.start().then(()=>{ this.connectionId && this.send(), e(this.signalr) }).catch(i=>{ console.log(i) }) }) }async send(){ try{ await this.signalr.invoke(this.connectionId, this.equipNo) }catch(e){ console.log("connectHub 连接失败" + e) } }}class l{constructor(){ this.eGroupNotify = new a("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.window = window;try{ window.top.equipGroup, this.window = window.top }catch{ this.window = window } }stop(){ this.notify && this.notify.stop() }Init(){ this.eGroupNotify.openConnect().then(e=>{ this.notify = e;try{ e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree") }catch(i){ console.log(i) }this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");try{ e.invoke("GetGroupEquips") }catch(i){ console.log(i) }this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "CopyEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose(i=>{ try{ this.Init() }catch(o){ console.log(o) }console.log("重连", i) }) }).catch(e=>{ console.error(e) }) }subscribeTo(e, i){ e.off(i), e.on(i, o=>{ o && o.isSuccess && (this[i] ? this[i](o.data) : this.notice({func: i, data: o.data, key: o.groupId})) }) }GetEquipGroupTree(e){ this.window.groupList || (this.window.groupList = e, this.notice({type: "GetEquipGroupTree"})) }GetAllEquipGroupTree(e){ this.window.groupList_manageMent || (this.window.groupList_manageMent = e, this.notice({type: "GetEquipGroupTreeWidthTreeType"})) }AddEquipGroup(e){ const{parentGroupId: i, groupId: o, groupName: t} = e || {};o && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({parentId: i, id: o, name: t, equipCount: 0}), this.notice({type: "AddEquipGroup", data: e})) }EditEquipGroup(e){ const{groupId: i, groupName: o} = e;this.window.groupList && window.groupList.forEach(t=>{ t.id == i && (t.name = o) }), this.window.groupList_manageMent && window.groupList_manageMent.forEach(t=>{ t.id == i && (t.name = o) }), this.notice({type: "EditEquipGroup", data: e}) }deleteChildGroup(e, i){ let o = [];i.forEach(t=>{ t.parentId == e && o.push(t.id) }), o.forEach(t=>{ let s = i.findIndex(n=>n.id == t);s > -1 && i.splice(s, 1), this.deleteChildGroup(t, i) }) }DeleteEquipGroup(e){ e.forEach(i=>{ if(this.window.groupList){ let o = this.window.groupList.findIndex(t=>t.id == i.groupId);o > -1 && this.window.groupList.splice(o, 1), this.deleteChildGroup(i.groupId, this.window.groupList) }if(this.window.groupList_manageMent){ let o = this.window.groupList_manageMent.findIndex(t=>t.id == i.groupId);o > -1 && this.window.groupList_manageMent.splice(o, 1), this.deleteChildGroup(i.groupId, this.window.groupList_manageMent) } }), this.notice({type: "DeleteEquipGroup", data: e}) }GetGroupEquips(e){ const{groupId: i, equips: o} = e || {};this.alreadyUpdate[i] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[i] = {}, i && o && o instanceof Array && (o.forEach(t=>{ t.title = t.name, t.groupId = i, t.equipNo = t.id, delete t.name, window.equipCache || (this.window.equipCache = {}), this.window.equipCache[t.id] = t, this.window.groupCache[i][t.id] = t }), this.window[`group-${i}`] = o, this.notice({type: "GetGroupEquips", data: {groupId: i}}), this.alreadyUpdate[i] = !0)) }AddEquip(e){ const{groupId: i, equips: o} = e || {};this.window[`group-${i}`] || (this.window[`group-${i}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[i] || (this.window.groupCache[i] = {}), this.window.equipCache || (this.window.equipCache = {});let t = this.window[`group-${i}`].length;if(i && o){ if(o.forEach((s, n)=>{ this.window[`group-${i}`].push({equipNo: s.id, groupId: i, id: s.id, title: s.name}), this.window.equipCache[s.id] = this.window[`group-${i}`][t + n], this.window.groupCache[i][s.id] = this.window[`group-${i}`][t + n] }), !this.exist(i, this.window.groupList)){ let s = this.findParentList(i, this.window.groupList_manageMent);this.window.groupList.push(...s) }this.notice({type: "AddEquip", data: e}) } }CopyEquips(e){ const{targetGroupId: i, equips: o} = e || {};if(!i || !o || !Array.isArray(o)){ console.warn("CopyEquips: 无效的数据格式", e);return }let t = [i], s = [];window.top[`group-${i}`] || (window.top[`group-${i}`] = [], s.push(i)), window.top.groupCache || (window.top.groupCache = {}), window.top.groupCache[i] || (window.top.groupCache[i] = {}), window.top.equipCache || (window.top.equipCache = {}), o.forEach(n=>{ !n.name && window.top.equipCache && window.top.equipCache[n.id] && (n.name = window.top.equipCache[n.id].title || window.top.equipCache[n.id].name);const d = {id: n.id, equipNo: n.id, groupId: i, title: n.name || "", name: n.name || ""};window.top.equipCache[n.id] = d, window.top.groupCache[i][n.id] = d, window.top[`group-${i}`].push(d) }), s.forEach(n=>{ if(!this.exist(n, window.top.groupList)){ let d = this.findParentList(n, window.top.groupList_manageMent);window.top.groupList.push(...d) } }), this.notice({type: "moveEquips", data: {updateGroups: t, buildTree: !1, targetGroupId: i, equipCount: o.length}}) }moveEquips(e){ let i = [], o = !0, t = [];const{sourceGroup: s, targetGroupId: n} = e || {};n && i.push(n), s.forEach(d=>{ if(i.push(d.groupId), (!this.window[`group-${n}`] || !this.window[`group-${n}`].length) && (this.window[`group-${n}`] = [], t.push(n)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[n] || (this.window.groupCache[n] = {}), d.equips.forEach(p=>{ if(p.title = p.name, p.groupId = n, p.equipNo = p.id, this.window[`group-${d.groupId}`]){ let w = this.window[`group-${d.groupId}`].findIndex(f=>f.id == p.id);w > -1 && this.window[`group-${d.groupId}`].splice(w, 1) }window.equipCache || (this.window.equipCache = {}), this.window.equipCache[p.id] = p, this.window.groupCache[n][p.id] = p, this.window[`group-${n}`].push(p) }), !this.window[`group-${d.groupId}`].length){ let p = this.window.groupList.findIndex(w=>w.id == d.groupId);p > -1 && this.window.groupList.splice(p, 1), this.deleteChildGroup(d.groupId, this.window.groupList) } }), t.forEach(d=>{ if(!this.exist(d, this.window.groupList)){ let p = this.findParentList(d, this.window.groupList_manageMent);this.window.groupList.push(...p) } }), this.notice({type: "moveEquips", data: {updateGroups: i, buildTree: o}}) }exist(e, i){ return i ? i.some(o=>o.id == e) : !1 }findParentList(e, i){ let o = [];if(i){ let t = i.findIndex(s=>s.id == e);t > -1 && o.push({...i[t]}), i[t].parentId && !this.exist(i[t].parentId, this.window.groupList) && o.push(...this.findParentList(i[t].parentId, this.window.groupList_manageMent)) }return o }DeleteEquip(e){ const{groupId: i, equips: o} = e || {};if(i && o && o instanceof Array){ if(this.window[`group-${i}`]){ for(let t = 0, s = o.length;t < s;t++){ let n = this.window[`group-${i}`].findIndex(d=>d.id == o[t].id);n > -1 && this.window[`group-${i}`].splice(n, 1), delete this.window.equipCache[o[t].id], delete this.window.groupCache[i][o[t].id] } }this.notice({type: "DeleteEquip", data: e}) } }EditEquip(e){ const{equipNo: i, groupId: o, equipName: t} = e || {};o && i && (window[`group-${o}`] && (this.window.equipCache[i] = t), this.notice({type: "EditEquip", data: e})) }notice(e){ if(this.window.hasIframe){ let i = document.getElementsByTagName("iframe");for(let o of i){ o.contentWindow.postMessage(e) } }else { window.postMessage(e, "*") } }}r.Signalr = a, r.equipCache = l, Object.defineProperty(r, Symbol.toStringTag, {value: "Module"}) });
1
+ (function (r, h) { typeof exports == "object" && typeof module < "u" ? h(exports, require("@aspnet/signalr")) : typeof define == "function" && define.amd ? define(["exports", "@aspnet/signalr"], h) : (r = typeof globalThis < "u" ? globalThis : r || self, h(r.index = {}, r.SignalR)) })(this, function (r, h) { "use strict"; function c(u) { const e = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); if (u) { for (const i in u) { if (i !== "default") { const o = Object.getOwnPropertyDescriptor(u, i); Object.defineProperty(e, i, o.get ? o : { enumerable: !0, get: () => u[i] }) } } } return e.default = u, Object.freeze(e) } const g = c(h); class a { constructor(e, i, o) { this.url = e, this.connectionId = i, this.equipNo = o, this.signalr = null } openConnect() { return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new g.HubConnectionBuilder().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise(e => { this.signalr.start().then(() => { this.connectionId && this.send(), e(this.signalr) }).catch(i => { console.log(i) }) }) } async send() { try { await this.signalr.invoke(this.connectionId, this.equipNo) } catch (e) { console.log("connectHub 连接失败" + e) } } } class l { constructor() { this.eGroupNotify = new a("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, window = window; try { window.top.equipGroup, window = window.top } catch { window = window } } stop() { this.notify && this.notify.stop() } Init() { this.eGroupNotify.openConnect().then(e => { this.notify = e; try { e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree") } catch (i) { console.log(i) } this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup"); try { e.invoke("GetGroupEquips") } catch (i) { console.log(i) } this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "CopyEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose(i => { try { this.Init() } catch (o) { console.log(o) } console.log("重连", i) }) }).catch(e => { console.error(e) }) } subscribeTo(e, i) { e.off(i), e.on(i, o => { o && o.isSuccess && (this[i] ? this[i](o.data) : this.notice({ func: i, data: o.data, key: o.groupId })) }) } GetEquipGroupTree(e) { window.groupList || (window.groupList = e, this.notice({ type: "GetEquipGroupTree" })) } GetAllEquipGroupTree(e) { window.groupList_manageMent || (window.groupList_manageMent = e, this.notice({ type: "GetEquipGroupTreeWidthTreeType" })) } AddEquipGroup(e) { const { parentGroupId: i, groupId: o, groupName: t } = e || {}; o && (window.groupList_manageMent || (window.groupList_manageMent = []), window.groupList_manageMent.push({ parentId: i, id: o, name: t, equipCount: 0 }), this.notice({ type: "AddEquipGroup", data: e })) } EditEquipGroup(e) { const { groupId: i, groupName: o } = e; window.groupList && window.groupList.forEach(t => { t.id == i && (t.name = o) }), window.groupList_manageMent && window.groupList_manageMent.forEach(t => { t.id == i && (t.name = o) }), this.notice({ type: "EditEquipGroup", data: e }) } deleteChildGroup(e, i) { let o = []; i.forEach(t => { t.parentId == e && o.push(t.id) }), o.forEach(t => { let s = i.findIndex(n => n.id == t); s > -1 && i.splice(s, 1), this.deleteChildGroup(t, i) }) } DeleteEquipGroup(e) { e.forEach(i => { if (window.groupList) { let o = window.groupList.findIndex(t => t.id == i.groupId); o > -1 && window.groupList.splice(o, 1), this.deleteChildGroup(i.groupId, window.groupList) } if (window.groupList_manageMent) { let o = window.groupList_manageMent.findIndex(t => t.id == i.groupId); o > -1 && window.groupList_manageMent.splice(o, 1), this.deleteChildGroup(i.groupId, window.groupList_manageMent) } }), this.notice({ type: "DeleteEquipGroup", data: e }) } GetGroupEquips(e) { const { groupId: i, equips: o } = e || {}; this.alreadyUpdate[i] || (window.groupCache || (window.groupCache = {}), window.groupCache[i] = {}, i && o && o instanceof Array && (o.forEach(t => { t.title = t.name, t.groupId = i, t.equipNo = t.id, delete t.name, window.equipCache || (window.equipCache = {}), window.equipCache[t.id] = t, window.groupCache[i][t.id] = t }), window[`group-${i}`] = o, this.notice({ type: "GetGroupEquips", data: { groupId: i } }), this.alreadyUpdate[i] = !0)) } AddEquip(e) { const { groupId: i, equips: o } = e || {}; window[`group-${i}`] || (window[`group-${i}`] = []), window.groupCache || (window.groupCache = {}), window.groupCache[i] || (window.groupCache[i] = {}), window.equipCache || (window.equipCache = {}); let t = window[`group-${i}`].length; if (i && o) { if (o.forEach((s, n) => { window[`group-${i}`].push({ equipNo: s.id, groupId: i, id: s.id, title: s.name }), window.equipCache[s.id] = window[`group-${i}`][t + n], window.groupCache[i][s.id] = window[`group-${i}`][t + n] }), !this.exist(i, window.groupList)) { let s = this.findParentList(i, window.groupList_manageMent); window.groupList.push(...s) } this.notice({ type: "AddEquip", data: e }) } } CopyEquips(e) { const { targetGroupId: i, equips: o } = e || {}; if (!i || !o || !Array.isArray(o)) { console.warn("CopyEquips: 无效的数据格式", e); return } let t = [i], s = []; window.top[`group-${i}`] || (window.top[`group-${i}`] = [], s.push(i)), window.top.groupCache || (window.top.groupCache = {}), window.top.groupCache[i] || (window.top.groupCache[i] = {}), window.top.equipCache || (window.top.equipCache = {}), o.forEach(n => { !n.name && window.top.equipCache && window.top.equipCache[n.id] && (n.name = window.top.equipCache[n.id].title || window.top.equipCache[n.id].name); const d = { id: n.id, equipNo: n.id, groupId: i, title: n.name || "", name: n.name || "" }; window.top.equipCache[n.id] = d, window.top.groupCache[i][n.id] = d, window.top[`group-${i}`].push(d) }), s.forEach(n => { if (!this.exist(n, window.top.groupList)) { let d = this.findParentList(n, window.top.groupList_manageMent); window.top.groupList.push(...d) } }), this.notice({ type: "moveEquips", data: { updateGroups: t, buildTree: !1, targetGroupId: i, equipCount: o.length } }) } moveEquips(e) { let i = [], o = !0, t = []; const { sourceGroup: s, targetGroupId: n } = e || {}; n && i.push(n), s.forEach(d => { if (i.push(d.groupId), (!window[`group-${n}`] || !window[`group-${n}`].length) && (window[`group-${n}`] = [], t.push(n)), window.groupCache || (window.groupCache = {}), window.groupCache[n] || (window.groupCache[n] = {}), d.equips.forEach(p => { if (p.title = p.name, p.groupId = n, p.equipNo = p.id, window[`group-${d.groupId}`]) { let w = window[`group-${d.groupId}`].findIndex(f => f.id == p.id); w > -1 && window[`group-${d.groupId}`].splice(w, 1) } window.equipCache || (window.equipCache = {}), window.equipCache[p.id] = p, window.groupCache[n][p.id] = p, window[`group-${n}`].push(p) }), !window[`group-${d.groupId}`].length) { let p = window.groupList.findIndex(w => w.id == d.groupId); p > -1 && window.groupList.splice(p, 1), this.deleteChildGroup(d.groupId, window.groupList) } }), t.forEach(d => { if (!this.exist(d, window.groupList)) { let p = this.findParentList(d, window.groupList_manageMent); window.groupList.push(...p) } }), this.notice({ type: "moveEquips", data: { updateGroups: i, buildTree: o } }) } exist(e, i) { return i ? i.some(o => o.id == e) : !1 } findParentList(e, i) { let o = []; if (i) { let t = i.findIndex(s => s.id == e); t > -1 && o.push({ ...i[t] }), i[t].parentId && !this.exist(i[t].parentId, window.groupList) && o.push(...this.findParentList(i[t].parentId, window.groupList_manageMent)) } return o } DeleteEquip(e) { const { groupId: i, equips: o } = e || {}; if (i && o && o instanceof Array) { if (window[`group-${i}`]) { for (let t = 0, s = o.length; t < s; t++) { let n = window[`group-${i}`].findIndex(d => d.id == o[t].id); n > -1 && window[`group-${i}`].splice(n, 1), delete window.equipCache[o[t].id], delete window.groupCache[i][o[t].id] } } this.notice({ type: "DeleteEquip", data: e }) } } EditEquip(e) { const { equipNo: i, groupId: o, equipName: t } = e || {}; o && i && (window[`group-${o}`] && (window.equipCache[i] = t), this.notice({ type: "EditEquip", data: e })) } notice(e) { if (window.hasIframe) { let i = document.getElementsByTagName("iframe"); for (let o of i) { o.contentWindow.postMessage(e) } } else { window.postMessage(e, "*") } } } r.Signalr = a, r.equipCache = l, Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganwei-web/gw-base-components-plus",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "components",
5
5
  "main": "./dist/index.es.js",
6
6
  "scripts": {