(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["BoxPage"],{"06f6":function(e,t,n){"use strict";n("336c")},"268e":function(e,t,n){e.exports=n.p+"img/shirp.55210364.png"},2944:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var o,i=n("8785"),a=(n("b0c0"),n("5184"));function r(e,t){var n=t.definitions[0].name.value;return Object(a["a"])(o||(o=Object(i["a"])(["\n        query($filter: MongooseFilterDto",", $options: MongooseQueryOptionsDto){\n            findOne","(filter: $filter, options: $options){\n                ...","\n            }\n        }\n        ","\n    "])),e,e,n,t)}},"336c":function(e,t,n){},4298:function(e,t,n){"use strict";n("4b1e")},4437:function(e,t,n){"use strict";n.r(t);var o,i,a,r,s,c,u,l,b,x,p,d,m=n("a523"),f=n("0789"),h=n("adda"),g=n("3129"),v=n("2909"),y=(n("99af"),function(){var e=this,t=e._self._c;e._self._setupProxy;return t(m["a"],{attrs:{fluid:"",id:"box-page"}},[t("top-app-bar",{attrs:{title:e.pageTitle,balance:!0},scopedSlots:e._u([e.box?{key:"subtitle",fn:function(){return["FreeBox"===e.boxType?t("div",[e._v(" от "+e._s(e.box.level)+" уровня и суммы пополнений Вашего баланса не меньше чем "+e._s(e.box.level)+" рубля за 72 часа ")]):"FragmentBox"===e.boxType?t("div",{staticClass:"d-flex align-center"},[e._v(" стоимостью "),t("fragment-price",{staticClass:"ml-1",attrs:{"fragment-id":e.box.fragmentId,value:e.box.price}})],1):t("div",[e._v(" стоимостью "),"SnowBox"!==e.boxType?t("price",{staticClass:"font-weight-regular",attrs:{right:"","icon-color":"inherit",value:e.box.price}}):t("snow-price",{staticClass:"font-weight-regular",attrs:{right:"","icon-color":"inherit",value:e.box.price}})],1)]},proxy:!0}:null],null,!0)}),"GunBox"===e.boxType&&e.box&&"KNIFE_OR_NOTHING"===e.box.type?e._e():t("scroll-fetch-more",{attrs:{query:e.$apollo.queries.items,mode:"offset"}}),e.$apollo.queries.box.loading||!(e.items||[]).length?t(g["a"],{attrs:{elevation:"0",type:"image",id:"load-tape","max-height":"287","min-height":"287",height:"287"}}):t("box-tape",{ref:"tape",staticClass:"box-tape",attrs:{items:e.mostExpensiveItem&&e.items?[].concat(Object(v["a"])(e.mostExpensiveItem?[e.mostExpensiveItem]:[]),Object(v["a"])(e.items)):e.items},scopedSlots:e._u(["AccountBox"===e.boxType?{key:"item",fn:function(e){var n=e.item,o=e.active;return[t("account",{staticClass:"fit item",class:{active:o},attrs:{value:n}})]}}:null],null,!0)},[t(f["d"],[!e.opening&&0===e.openingCount&&e.box.image?t("div",{staticClass:"box-tape__image"},[t(h["a"],{attrs:{contain:"",width:"200px",height:"200px",src:e.box.image}})],1):e._e()]),t("border-container",{staticClass:"pa-2"},[t(f["g"],{attrs:{duration:"50",mode:"out-in"}},[e.user?"SnowBox"===e.boxType&&e.user.snowBalance<e.box.price&&!e.opening?[t("gradient-btn",{attrs:{"x-large":"",to:"/support#getSnowBalance"}},[e._v(" Как получить снежинки? ")])]:"FragmentBox"!==e.boxType||e.fragmentBoxesBalance&&!(e.fragmentBoxesBalance[e.box.fragmentId]<e.box.price)||e.opening?[e.opening?t("gradient-btn",{key:3,attrs:{loading:e.loading,"x-large":""},on:{click:e.skip}},[e._v(" Пропустить анимацию ")]):t("gradient-btn",{key:2,attrs:{disabled:"FreeBox"===e.boxType?e.user.levelPoints<e.box.levelPoints:"SnowBox"===e.boxType?e.user.snowBalance<e.box.price:"FragmentBox"===e.boxType?e.fragmentBoxesBalance[e.box.fragmentId]<e.box.price:"GunBox"===e.boxType?e.user.balance<e.boxPriceWithBonusBalance:e.user.balance<e.box.price,"x-large":""},on:{click:e.open}},["FreeBox"!==e.boxType?[e._v(" Открыть за "),"GunBox"===e.boxType?[t("price",{attrs:{right:!0,"icon-color":"white",value:e.boxPriceWithBonusBalance}}),e.boxBonusPrice?[e._v(" + "),t("bonus-price",{attrs:{right:!0,"icon-color":"white",value:e.boxBonusPrice}})]:e._e()]:"FragmentBox"===e.boxType?[t("fragment-price",{attrs:{"fragment-id":e.box.fragmentId,right:!0,value:e.box.price}})]:"SnowBox"!==e.boxType?t("price",{attrs:{right:!0,"icon-color":"white",value:e.box.price}}):t("snow-price",{attrs:{right:"","icon-color":"inherit",value:e.box.price}})]:[e.user.levelPoints>=e.box.levelPoints?[e._v(" Открыть ")]:[e._v(" Необходим "+e._s(e.box.level)+" уровень")]]],2)]:[t("gradient-btn",{attrs:{"x-large":"",to:"/support#getFragments"}},[e._v(" Как получить осколки? ")])]:[t("gradient-btn",{key:1,attrs:{"x-large":"",to:"#login"}},[e._v(" Авторизоваться ")])]],2)],1)],1),t("item-list",{staticClass:"mt-6 box-items-container",attrs:{basic:"",items:e.mostExpensiveItem&&e.items?[].concat(Object(v["a"])(e.mostExpensiveItem?[e.mostExpensiveItem]:[]),Object(v["a"])(e.items)):e.items,selectable:!1},scopedSlots:e._u(["AccountBox"===e.boxType?{key:"item",fn:function(e){var n=e.item,o=e.index;return[t("account",{key:o,attrs:{value:n}})]}}:null,{key:"title",fn:function(){return[t("div",{staticClass:"mb-2"},[null===e.itemsCount?t(g["a"],{attrs:{elevation:"0",type:"text"}}):[t("div",[e._v(" Содержимое кейса "),e.itemsCount?t("span",{staticClass:"secondary--text font-weight-regular ml-1 text-font-secondary"},[e._v(e._s(e.itemsCount))]):e._e()])]],2)]},proxy:!0}],null,!0)})],1)}),_=[],B=n("5530"),O=n("8785"),j=n("1da1"),I=n("d4ec"),w=n("bee2"),T=n("262e"),$=n("2caf"),k=(n("96cf"),n("b0c0"),n("a9e3"),n("b680"),n("ac1f"),n("b64b"),n("d81d"),n("4de4"),n("d3b7"),n("14d9"),n("9ab4")),F=n("1b40"),q=n("46de"),C=n("6d59"),P=n("fdc8"),U=n("3ba5"),A=n("85ee"),D=n("b8e9"),S=n("7feb"),G=n("76d9"),E=n("268e"),N=n.n(E),R=n("5184"),W=n("5fcf"),M=n("6e90"),L=n("4690"),z=n("a00c"),H=n("5a0d"),J=n("72df"),K=n("d207"),Q=n("1e5c"),Y=n("9655"),V=n.n(Y),X=n("435f"),Z=function(e){Object(T["a"])(n,e);var t=Object($["a"])(n);function n(e){var o;return Object(I["a"])(this,n),o=t.call(this,e),o.__typename="GunBox",o}return Object(w["a"])(n)}(X["a"]),ee=n("2585"),te=n("ff95"),ne=n("b4e3"),oe=n("b85a"),ie=n("50f2"),ae=n("2944"),re=n("4d90"),se=new Q["Howl"]({src:[V.a],preload:!0}),ce=function(e){Object(T["a"])(n,e);var t=Object($["a"])(n);function n(){var e;return Object(I["a"])(this,n),e=t.apply(this,arguments),e.opening=!1,e.openingCount=0,e.loading=!1,e.itemsCount=null,e.items=null,e.mostExpensiveItem=null,e.box=null,e}return Object(w["a"])(n,[{key:"boxType",get:function(){return-1!==this.$route.path.indexOf("gun-case")?"GunBox":-1!==this.$route.path.indexOf("free-case")?"FreeBox":-1!==this.$route.path.indexOf("account-box")?"AccountBox":-1!==this.$route.path.indexOf("snow-case")?"SnowBox":-1!==this.$route.path.indexOf("fragment-case")?"FragmentBox":"Box"}},{key:"pageTitle",get:function(){return this.box&&this.box.name?this.box.name:"Кейс"}},{key:"boxPriceWithBonusBalance",get:function(){return"GunBox"===this.boxType&&this.user&&this.box?Number((this.box.price-Math.min(.2*this.box.price,this.user.bonusBalance)).toFixed(2)):"price"in this.box?this.box.price:null}},{key:"boxBonusPrice",get:function(){return this.box&&this.boxPriceWithBonusBalance?Number((this.box.price-(this.boxPriceWithBonusBalance||0)).toFixed(2)):0}},{key:"exit",value:function(e){var t="Кейс временно недоступен";if("FreeBox"===this.boxType&&e&&this.box)if(-1!==e.message.indexOf("wait until")){var n=new Date(Number(/\s(\d+)$/.exec(e.message)[1]));t="Кейс можно открывать 1 раз в ".concat(this.$options.filters.duration(this.box.frequencyInMilliseconds,"humanize"),", следующий кейс будет доступен ").concat(this.$options.filters.moment(n,"from","now"))}else if(-1!==e.message.indexOf("nickname should contain")){var o="buyskins.ru".toUpperCase();t='Для открытия этого кейса Вы должны добавить <a class="white--text" href="https://steamcommunity.com/id/me/edit/info" target="_blank">в свой ник Steam</a> '.concat(o)}else-1!==e.message.indexOf("you must make a deposit")&&(t="Для открытия этого кейса сумма пополнений баланса Вашего аккаунта за последние 3 дня должна быть не меньше чем ".concat(this.box.level," руб."));this.$notify({text:t,type:"info"}),this.$router.back()}},{key:"skip",value:function(){var e=Object(j["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=this.$refs.tape,e.abrupt("return",t.skip());case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"open",value:function(){var e=Object(j["a"])(regeneratorRuntime.mark((function e(){var t,n,u,l,b,x=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.opening=!0,this.openingCount++,n=this.$refs.tape,u="FreeBox"===this.boxType?Object(R["a"])(o||(o=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openFreeBox(_id: $_id) {\n                  ...UserItemWithoutUser\n                }\n              }\n              ","\n            "])),W["u"]):"AccountBox"===this.boxType?Object(R["a"])(i||(i=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openAccountBox(_id: $_id) {\n                  ...Account\n                }\n              }\n              ","\n            "])),W["b"]):"GunBox"===this.boxType?Object(R["a"])(a||(a=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openGunBox(_id: $_id) {\n                  ...UserItemWithoutUser\n                }\n              }\n              ","\n            "])),W["u"]):"FragmentBox"===this.boxType?Object(R["a"])(r||(r=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openFragmentBox(_id: $_id) {\n                  ...UserItemWithoutUser\n                }\n              }\n              ","\n            "])),W["u"]):"SnowBox"===this.boxType?Object(R["a"])(s||(s=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openSnowBox(_id: $_id) {\n                  ...UserItemWithoutUser\n                }\n              }\n              ","\n            "])),W["u"]):Object(R["a"])(c||(c=Object(O["a"])(["\n              mutation ($_id: ID!) {\n                openBox(_id: $_id) {\n                  ...UserItemWithoutUser\n                }\n              }\n              ","\n            "])),W["u"]),this.loading=!0,e.next=6,this.$apollo.mutate({mutation:u,variables:{_id:null===(t=this.box)||void 0===t?void 0:t._id}}).then((function(e){var t=e.data,n=t[Object.keys(t)[0]];return"AccountBox"===x.boxType?new J["a"](n):new U["b"](n)})).catch((function(e){return x.exit(e),null}));case 6:if(l=e.sent,this.loading=!1,l){e.next=11;break}return this.opening=!1,e.abrupt("return");case 11:return se.play(),e.next=14,n.animate(l);case 14:se.stop(),this.opening=!1,"UserItem"===l.__typename&&(b="Поздравляем, вы выиграли предмет за ".concat(l.price," руб. Он добавлен в Ваш инвентарь."),l.fragmentId&&(b+=" Также вы получили осколок для открытия весенних кейсов."),this.$notify({text:b,title:l.name,data:{class:"notification-".concat(l.rarity),image:l.image}}));case 17:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}]),n}(Object(F["d"])(oe["a"]));Object(k["__decorate"])([Object(F["c"])(A["d"])],ce.prototype,"user",void 0),ce=Object(k["__decorate"])([Object(F["a"])({components:{FragmentPrice:ie["a"],BonusPrice:ne["a"],BoxTape:q["a"],ScrollFetchMore:M["a"],ItemList:G["a"],BorderContainer:S["a"],TopAppBar:z["a"],Account:K["a"],Price:P["a"],SnowPrice:ee["a"],GradientBtn:C["a"]},metaInfo:function(){return{title:this.pageTitle}},beforeRouteLeave:function(e,t,n){se.stop(),n()},apollo:{box:{update:function(e){var t=e[Object.keys(e)[0]];if(t&&!t.isAvailable&&"SnowBox"!==t.__typename&&"FragmentBox"!==t.__typename&&this.exit(),!t)return t;switch(this.boxType){case"AccountBox":return new H["a"](t);case"Box":return new D["a"](t);case"GunBox":return new Z(t);case"SnowBox":return t;case"FragmentBox":return t;case"FreeBox":return new L["a"](t)}},query:function(){switch(this.boxType){case"AccountBox":return Object(R["a"])(u||(u=Object(O["a"])(["\n              query ($boxId: ID!) {\n                accountBox(_id: $boxId) {\n                  _id\n                  image\n                  isAvailable\n                  name\n                  price\n                  accountIds\n                }\n              }\n            "])));case"GunBox":return Object(R["a"])(l||(l=Object(O["a"])(["\n              query ($boxId: ID!) {\n                gunBox(_id: $boxId) {\n                  ...GunBox\n                }\n              }\n              ","\n            "])),W["n"]);case"SnowBox":return Object(R["a"])(b||(b=Object(O["a"])(["\n              query ($boxId: ID!) {\n                snowBox(_id: $boxId) {\n                  ...SnowBox\n                }\n              }\n              ","\n            "])),W["p"]);case"FragmentBox":return Object(R["a"])(x||(x=Object(O["a"])(["\n              query ($boxId: ID!) {\n                fragmentBox(_id: $boxId) {\n                  ...FragmentBox\n                }\n              }\n              ","\n            "])),W["k"]);case"Box":return Object(R["a"])(p||(p=Object(O["a"])(["\n              query ($boxId: ID!) {\n                box(_id: $boxId) {\n                  ...Box\n                }\n              }\n              ","\n            "])),W["g"]);default:return Object(R["a"])(d||(d=Object(O["a"])(["\n              query ($boxId: ID!) {\n                freeBox(_id: $boxId) {\n                  ...FreeBox\n                }\n              }\n              ","\n            "])),W["m"])}},variables:function(){return{boxId:this.$route.params.id}}},mostExpensiveItem:{query:Object(ae["a"])("UserItem",W["r"]),fetchPolicy:"no-cache",update:function(e){return e.findOneUserItem?new U["b"](e.findOneUserItem):null},skip:function(){return!this.box||"FragmentBox"!==this.boxType||"FRAGMENT_4"!==this.box.fragmentId},variables:function(){return{options:{sort:"-price"},filter:{userId:{exists:!1},state:{eq:"DEFAULT"},isNameFirstUnique:{eq:!0}}}}},items:{update:function(e){var t=e[Object.keys(e)[0]];if((t&&!t.docs.length||"GunBox"===this.boxType&&t.docs.length<25&&this.box.price<t.docs[t.docs.length-1].price)&&this.exit(),!t)return this.itemsCount=null,t;switch(this.itemsCount=t.totalDocs,this.boxType){case"AccountBox":return t.docs.map((function(e){return new J["a"](e)}));default:var n=t.docs.map((function(e){return new U["b"](e)}));return"GunBox"===this.boxType&&"KNIFE_OR_NOTHING"===this.box.type&&(n=n.filter((function(e){var t=e.price;return t>50})),n.push(new U["b"]({_id:"nothing",name:"Предмет | дешевле 50 Р",image:N.a,rarity:re["a"].GREY,price:50,__typename:"UserItem"}))),n}},skip:function(){return!this.box},query:function(){return"AccountBox"===this.boxType?Object(te["a"])("Account",W["c"]):Object(te["a"])("UserItem",W["r"])},variables:function(){var e,t,n,o,i,a,r;return{options:{sort:"-price",limit:25},filter:Object(B["a"])({},"AccountBox"===this.boxType?{_id:{in:null===(e=this.box)||void 0===e?void 0:e.accountIds},isForBox:{eq:!0}}:"Box"===this.boxType?{price:{gte:null===(t=this.box)||void 0===t?void 0:t.itemsPriceRange[0],lte:null===(n=this.box)||void 0===n?void 0:n.itemsPriceRange[1]},isNameFirstUnique:{eq:!0},state:{eq:"DEFAULT"}}:"GunBox"===this.boxType?Object(B["a"])({price:{gte:this.box.minItemPrice,lte:this.box.maxItemPrice},isNameFirstUnique:{eq:!0},state:{eq:"DEFAULT"},gunBoxType:{eq:null===(o=this.box)||void 0===o?void 0:o.type}},"CUSTOM"===(null===(i=this.box)||void 0===i?void 0:i.type)?{name:{in:null===(a=this.box)||void 0===a?void 0:a.userItemNames}}:{}):"SnowBox"===this.boxType||"FragmentBox"===this.boxType?{price:{gte:this.box.minItemPrice,lte:this.box.maxItemPrice},isNameFirstUnique:{eq:!0},state:{eq:"DEFAULT"}}:{_id:{in:null===(r=this.box)||void 0===r?void 0:r.itemIds},state:{eq:"DEFAULT"}})}}}}})],ce);var ue=ce,le=ue,be=(n("4298"),n("2877")),xe=Object(be["a"])(le,y,_,!1,null,null,null);t["default"]=xe.exports},"4b1e":function(e,t,n){},"51ae":function(e,t,n){},"57f1":function(e,t,n){e.exports=n.p+"img/account-zip.d8e29a76.svg"},"72df":function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var o=n("bee2"),i=n("d4ec"),a=Object(o["a"])((function e(t){Object(i["a"])(this,e),this.__typename="Account",Object.assign(this,t)}))},"7feb":function(e,t,n){"use strict";var o=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"border-container",class:{grey:void 0!==e.grey}},[e._t("default")],2)},i=[],a=n("bee2"),r=n("d4ec"),s=n("262e"),c=n("2caf"),u=n("9ab4"),l=n("1b40"),b=function(e){Object(s["a"])(n,e);var t=Object(c["a"])(n);function n(){return Object(r["a"])(this,n),t.apply(this,arguments)}return Object(a["a"])(n)}(l["k"]);Object(u["__decorate"])([Object(l["e"])({default:void 0})],b.prototype,"grey",void 0),b=Object(u["__decorate"])([Object(l["a"])({})],b);var x=b,p=x,d=(n("06f6"),n("2877")),m=Object(d["a"])(p,o,i,!1,null,"227d63c8",null);t["a"]=m.exports},9655:function(e,t,n){e.exports=n.p+"media/openBox.9c98b379.mp3"},a984:function(e,t,n){"use strict";n("51ae")},d207:function(e,t,n){"use strict";var o=n("8336"),i=n("b0af"),a=n("99d9"),r=n("132d"),s=n("adda"),c=(n("9911"),function(){var e=this,t=e._self._c;e._self._setupProxy;return t(i["a"],{staticClass:"position-relative",class:{basic:void 0!==e.basic},attrs:{rounded:"",id:"account",color:"transparent",width:e.$attrs.width,height:e.$attrs.height}},[t("div",{style:{padding:"16px ".concat(16*e.aspectRatio,"px ")}},[t(s["a"],{staticClass:"item-image",attrs:{contain:"",src:e.value.image||e.defaultAccountImage,"aspect-ratio":e.aspectRatio}})],1),e.value.link?t("div",{staticClass:"position-absolute absolute-top-left mt-1 ml-1"},[t(o["a"],{attrs:{icon:"",color:"primary",type:"a",href:e.value.link,target:"_blank"}},[t(r["a"],[e._v("fas fa-cloud-download-alt")])],1)],1):e._e(),void 0===e.basic?t("div",{staticClass:"overflow-hidden position-absolute absolute-bottom mb-3 ml-1 price-container rounded-sm px-2"},[t(a["d"],{staticClass:"font-weight-bold text-font-secondary ma-0 pa-0 black--text text-truncate justify-center",staticStyle:{"font-size":"16px"}},[t("price",{attrs:{"icon-color":"black",right:!0,value:e.value.price}})],1)],1):e._e()])}),u=[],l=n("bee2"),b=n("d4ec"),x=n("262e"),p=n("2caf"),d=n("9ab4"),m=n("1b40"),f=n("fdc8"),h=n("57f1"),g=n.n(h),v=function(e){Object(x["a"])(n,e);var t=Object(p["a"])(n);function n(){var e;return Object(b["a"])(this,n),e=t.apply(this,arguments),e.defaultAccountImage=g.a,e}return Object(l["a"])(n)}(m["k"]);Object(d["__decorate"])([Object(m["e"])({default:91/89})],v.prototype,"aspectRatio",void 0),Object(d["__decorate"])([Object(m["e"])()],v.prototype,"basic",void 0),Object(d["__decorate"])([Object(m["e"])()],v.prototype,"value",void 0),v=Object(d["__decorate"])([Object(m["a"])({components:{Price:f["a"]}})],v);var y=v,_=y,B=(n("a984"),n("2877")),O=Object(B["a"])(_,c,u,!1,null,null,null);t["a"]=O.exports},ff95:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var o,i=n("8785"),a=(n("b0c0"),n("5184"));function r(e,t){var n=t.definitions[0].name.value;return Object(a["a"])(o||(o=Object(i["a"])(["\n    query($filter: MongooseFilterDto",", $options: MongooseScrollOptionsDto){\n        scroll","(filter: $filter, options: $options){\n        nextScrollToken\n        docs{\n            ...","\n        }\n     }\n    }\n    ","\n  "])),e,e,n,t)}}}]);
//# sourceMappingURL=BoxPage.8b4235d6.js.map