import{V as e}from"./vue-DkJ1Kgzj-v4.3.1.js";import{V as i}from"./VariationMixin-ivzdHUsH-v4.3.1.js";import{t as r}from"./Toaster-euwuEYDO-v4.3.1.js";import"./vuedraggable-BDfjX5jl-v4.3.1.js";import"./blueimp-md5-ClWCTRan-v4.3.1.js";import"./Errors-Dscm1BJ0-v4.3.1.js";import"./@melloware-BTYRaMki-v4.3.1.js";import"./vue-toast-notification-KMO5b-nv-v4.3.1.js";new e({el:"#app",mixins:[i],created(){this.form=this.prepareFormData(FleetCart.data.variation)},mounted(){this.initColorPicker()},methods:{prepareFormData(t){return t.uid=this.uid(),t.values.forEach(s=>{s.uid=this.uid()}),t},submit(){this.formSubmitting=!0,$.ajax({type:"PUT",url:route("admin.variations.update",this.form.id),data:this.transformData(this.form),dataType:"json",success:t=>{r(t.message,{type:"success"}),this.errors.reset()}}).catch(t=>{r(t.responseJSON.message,{type:"default"}),this.errors.reset(),this.errors.record(t.responseJSON.errors),this.focusFirstErrorField(this.$refs.form.elements)}).always(()=>{this.formSubmitting=!1})}}});
