var t = require; var e = module; var i = exports; Object.defineProperty(i, "__esModule", {value: !0}), (i.getShopItemData = i.ShopGiftItemData = i.ShopBoxItemData = i.ShopItemData = void 0); const a = t("App"), s = t("GameText"), o = t("ConfigManager"), n = t("ControllerConst"), r = t("BagConst"), l = t("SystemOpenConst"), h = t("ShopConst"); class c { constructor() { this.buyCnt = 0; } parse(t) { for (var e in t) this[e] = t[e]; return (this.cfg = t), (this.shopType = t.shopType), this; } parseMutil(t) { let e = []; for (const s of t.split("|")) { const t = s.split(":"); var i = {id: parseInt(t[0]), cnt: parseInt(t[1])}; e.push(i); } return e; } parseMutil_1(t) { let e = [], i = t.split("|"); for (var s of i) e.push(parseInt(s)); return e; } getDiamondIconUrl() { return "Texture/itemIcon/diamond_" + this.cfg.icon; } getName() { return s.GameText.getTextByStr("shop_name_" + this.id); } } class d extends (i.ShopItemData = c) {} i.ShopBoxItemData = d; class u extends c { constructor() { super(...arguments), (this.items = null), (this.costumeItemIds = null), (this._costumes = null), (this.isSysOpen = !0); } get costumes() { var t = this.cfg.shopGift.costumes; return t && !this._costumes && this.parseCostume(t), this._costumes; } parse(t) { return ( super.parse(t), (this.items = this.parseMutil(t.shopGift.items)), (this.giftType = t.shopGift.type), this ); } parseCostume(t) { let e = [], i = []; const s = t.split("|"); for (const o of s) { const t = parseInt(o); i.push(t); const s = a.default.ControllerManager.applyFunc(n.ControllerConst.Item, r.BagConst.GET_ITEM, t); e.push(s.getTempCostume()); } e.length && ((this._costumes = e), (this.costumeItemIds = i)); } isCanGetFirstGift() { return ( this.buyCnt && this.buyCnt <= 3 && a.default.DateUtils.isLastDay(this.time, a.default.DateUtils.secondNow()) ); } isBuyGift() { return 0 < this.buyCnt; } isHideGift() { return this.shopType == h.ShopType.GIFT ? 3 < this.buyCnt : 0 < this.buyCnt; } isShowInShopView() { return ( a.default.ControllerManager.applyFunc( n.ControllerConst.SystemOpen, l.OpenConst.CHCEK_OPEN, l.OpenTypeConst.FIRST_GIFT ) && !this.buyCnt ); } } (i.ShopGiftItemData = u), (i.getShopItemData = function (t) { let e = null; switch (t.shopType) { case h.ShopType.REMOVE_AD_GIFT: case h.ShopType.GIFT: case h.ShopType.ONCE_GIFT: e = new u(); break; case h.ShopType.BOX: e = new d(); break; default: e = new c(); } return e.parse(t); }), o.registerJSONConf("ShopItemConfig", "files/shopItem"), o.registerJSONConf("ProductConfig", "files/productConfig");