{"version":3,"file":"copy-crate-modal.66b2f730e71e1d13c6a7.bundle.js","sources":["webpack://djpVueComponents/copy-crate-modal.66b2f730e71e1d13c6a7.bundle.js"],"sourcesContent":["(window.webpackJsonpdjpVueComponents=window.webpackJsonpdjpVueComponents||[]).push([[\"copy-crate-modal\"],{532:function(t,o,e){\"use strict\";e.r(o);e(6),e(7),e(30);var n=e(22),a=e(0),r=e(62),c=e(53);function s(t){return(s=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t})(t)}var i,l=(i=function(t,o){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)o.hasOwnProperty(e)&&(t[e]=o[e])})(t,o)},function(t,o){function e(){this.constructor=t}i(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),p=function(t,o,e,n){var a,r=arguments.length,c=r<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,e):n;if(\"object\"===(\"undefined\"==typeof Reflect?\"undefined\":s(Reflect))&&\"function\"==typeof Reflect.decorate)c=Reflect.decorate(t,o,e,n);else for(var i=t.length-1;i>=0;i--)(a=t[i])&&(c=(r<3?a(c):r>3?a(o,e,c):a(o,e))||c);return r>3&&c&&Object.defineProperty(o,e,c),c},d=function(t){function o(){var o=null!==t&&t.apply(this,arguments)||this;return o.newCrateData={id:null,name:\"\"},o.crateData={id:null,name:\"\"},o.myCrates=[],o.loading=!1,o.crateInputFocus=!1,o.queryParams={name:o.crateData.name},o.urlParams={crateId:o.crateData.id},o}return l(o,t),o.prototype.mounted=function(){var t=this,o=document.getElementById(\"copyCrateModal\");this.modal=n.Modal.init(o,{preventScrolling:!1,onCloseEnd:function(){t.close()}}),this.$nextTick(function(){t.$bus.$on(\"open-copy-crate-modal\",t.open)})},o.prototype.open=function(t){this.crateData=t,this.modal.open()},o.prototype.copyCrate=function(){var t=this;if(!this.loading&&this.crateData.id){this.loading=!0;var o={crateId:this.crateData.id};r.a.copyCrate(o).then(function(e){t.loading=!1,t.$toast.success(\"Successfully copied crate! 🎉\"),t.$bus.$emit(\"copy-crate-success\",o.crateId),t.close()}).catch(function(o){var e=o.response;if(t.loading=!1,!e)return t.$toast.error(\"Something went wrong.\"),!1;t.$toast.error(e.data.Message)})}},o.prototype.close=function(){this.modal.close(),this.loading=!1},o=p([Object(a.a)({components:{Spinner:c.a}})],o)}(a.f),u=e(3),f=Object(u.a)(d,function(){var t=this,o=t.$createElement,e=t._self._c||o;return e(\"div\",{staticClass:\"djp-modal add-to-crate-modal\",attrs:{id:\"copyCrateModal\"}},[e(\"a\",{staticClass:\"modal-close\",attrs:{href:\"javascript:;\"}},[e(\"djp-icon\",{attrs:{name:\"icon-times\"}})],1),t._v(\" \"),e(\"div\",{staticClass:\"modal-content\"},[e(\"header\",{staticClass:\"djp-modal-header modal-container\"},[e(\"h2\",{staticClass:\"djp-modal-title\"},[t._v(\"\\n Copy the crate: \\n \"),e(\"strong\",[t._v(t._s(t.crateData.name))])])]),t._v(\" \"),e(\"section\",{staticClass:\"modal-container\"}),t._v(\" \"),e(\"footer\",{staticClass:\"djp-modal-footer actions modal-container\"},[e(\"button\",{staticClass:\"djp-btn\",class:{loading:t.loading},on:{click:t.copyCrate}},[t._v(\"\\n Copy\\n \"),e(\"spinner\",{attrs:{loading:t.loading}})],1),t._v(\" \"),e(\"button\",{staticClass:\"djp-btn white\",on:{click:t.close}},[t._v(\"Cancel\")])])])])},[],!1,null,null,null);o.default=f.exports}}]);"],"mappings":"AAAA","sourceRoot":""}