var VueFormulario=function(){"use strict";var t=function(t,r){return{classification:t,component:"FormularioInput"+(r||t[0].toUpperCase()+t.substr(1))}},r=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(r,e){var i;return Object.assign({},r,((i={})[e]=t("text"),i))}),{}),{range:t("slider"),textarea:t("textarea","TextArea"),checkbox:t("box"),radio:t("box"),submit:t("button"),button:t("button"),select:t("select"),file:t("file"),image:t("file"),group:t("group")}),e=function(t){if("string"!=typeof t)return!1;var r=t.match(i);if(!r)return!1;var e=r[1];if(!e)return!1;if(o.test(e)||n.test(e))return!0;return!1},i=/^(?:\w+:)?\/\/(\S+)$/,o=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;for(var s="-_",a=36;a--;)s+=a.toString(36);for(a=36;a---10;)s+=a.toString(36).toUpperCase();var u=function(t){var r="";for(a=t||21;a--;)r+=s[64*Math.random()|0];return r},l=function(t,r,e){void 0===e&&(e={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},e),this.results=!1,this.context=r,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function f(t,r){if(t===r)return!0;if(!t||!r)return!1;var e=Object.keys(t),i=Object.keys(r),o=e.length;if(i.length!==o)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(0===o)return t===r;for(var n=0;n=100&&(r.complete||(r.justFinished=!0,setTimeout((function(){r.justFinished=!1}),t.options.uploadJustCompleteDuration)),r.complete=!0)}),(function(t){r.progress=0,r.error=t,r.complete=!0}),t.options)}))).then((function(e){t.results=e,r(e)})).catch((function(t){throw new Error(t)}))}))},l.prototype.removeFile=function(t){if(this.files=this.files.filter((function(r){return r.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var r=new DataTransfer;this.files.map((function(t){return r.items.add(t.file)})),this.fileList=r.files,this.input.files=this.fileList}},l.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var r=new FileReader;r.onload=function(r){return Object.assign(t,{previewData:r.target.result})},r.readAsDataURL(t.file)}}))},l.prototype.getFileList=function(){return this.fileList},l.prototype.getFiles=function(){return this.files},l.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var y={accepted:function(t){var r=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(r))},after:function(t,r){var e=t.value;void 0===r&&(r=!1);var i=Date.parse(r||new Date),o=Date.parse(e);return Promise.resolve(!isNaN(o)&&o>i)},alpha:function(t,r){var e=t.value;void 0===r&&(r="default");var i={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},o=i.hasOwnProperty(r)?r:"default";return Promise.resolve(i[o].test(e))},alphanumeric:function(t,r){var e=t.value;void 0===r&&(r="default");var i={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},o=i.hasOwnProperty(r)?r:"default";return Promise.resolve(i[o].test(e))},before:function(t,r){var e=t.value;void 0===r&&(r=!1);var i=Date.parse(r||new Date),o=Date.parse(e);return Promise.resolve(!isNaN(o)&&or&&or&&o.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(r))},endsWith:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return r?Promise.resolve("string"==typeof r&&e.length?void 0!==e.find((function(t){return r.endsWith(t)})):"string"==typeof r&&0===e.length):Promise.resolve((function(){return!0}))},in:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Promise.resolve(void 0!==e.find((function(t){return"object"==typeof t?f(t,r):t===r})))},matches:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Promise.resolve(!!e.find((function(t){return"string"==typeof t&&"/"===t.substr(0,1)&&"/"===t.substr(-1)&&(t=new RegExp(t.substr(1,t.length-2))),t instanceof RegExp?t.test(r):t===r})))},mime:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Promise.resolve(function(){if(r instanceof l)for(var t=r.getFiles(),i=0;i=r):!isNaN(i)&&"length"!==e||"value"===e?(i=isNaN(i)?i:Number(i))>=r:("string"==typeof i||"length"===e)&&(i=isNaN(i)?i:i.toString()).length>=r)},max:function(t,r,e){var i=t.value;return void 0===r&&(r=10),Promise.resolve(Array.isArray(i)?(r=isNaN(r)?r:Number(r),i.length<=r):!isNaN(i)&&"length"!==e||"value"===e?(i=isNaN(i)?i:Number(i))<=r:("string"==typeof i||"length"===e)&&(i=isNaN(i)?i:i.toString()).length<=r)},not:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Promise.resolve(void 0===e.find((function(t){return"object"==typeof t?f(t,r):t===r})))},number:function(t){var r=t.value;return Promise.resolve(!isNaN(r))},required:function(t,r){var e=t.value;return void 0===r&&(r=!0),Promise.resolve(!(r&&!["no","false"].includes(r))||(Array.isArray(e)?!!e.length:e instanceof l?e.getFiles().length>0:"string"==typeof e?!!e:"object"!=typeof e||!!e&&!!Object.keys(e).length))},startsWith:function(t){for(var r=t.value,e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return r?Promise.resolve("string"==typeof r&&e.length?void 0!==e.find((function(t){return r.startsWith(t)})):"string"==typeof r&&0===e.length):Promise.resolve((function(){return!0}))},url:function(t){var r=t.value;return Promise.resolve(e(r))},bail:function(){return Promise.resolve(!0)}},b="image/",E={csv:"text/csv",gif:b+"gif",jpg:b+"jpeg",jpeg:b+"jpeg",png:b+"png",pdf:"application/pdf",svg:b+"svg+xml"},x={default:function(t,r){return t.$t("validation.default",r)},accepted:function(t,r){return t.$t("validation.accepted",r)},after:function(t,r){return Array.isArray(r.args)&&r.args.length?(r.compare=r.args[0],t.$t("validation.after.compare",r)):t.$t("validation.after.default",r)},alpha:function(t,r){return t.$t("validation.alpha",r)},alphanumeric:function(t,r){return t.$t("validation.alphanumeric",r)},before:function(t,r){return Array.isArray(r.args)&&r.args.length?(r.compare=r.args[0],t.$t("validation.before.compare",r)):t.$t("validation.before.default",r)},between:function(t,r){r.from=r.args[0],r.to=r.args[1];var e=!(!Array.isArray(r.args)||!r.args[2])&&r.args[2];return!isNaN(value)&&"length"!==e||"value"===e?t.$t("validation.between.force",r):t.$t("validation.between.default",r)},confirm:function(t,r){return t.$t("validation.confirm",r)},date:function(t,r){return Array.isArray(r.args)&&r.args.length?(r.format=r.args[0],t.$t("validation.date.format",r)):t.$t("validation.date.default",r)},email:function(t,r){return t.$t("validation.email.default",r)},endsWith:function(t,r){return t.$t("validation.endsWith.default",r)},in:function(t,r){return"string"==typeof r.value&&r.value?t.$t("validation.in.string",r):t.$t("validation.in.default",r)},matches:function(t,r){return t.$t("validation.matches.default",r)},max:function(t,r){if(r.maximum=r.args[0],Array.isArray(r.value))return t.$tc("validation.max.array",r.maximum,r);var e=!(!Array.isArray(r.args)||!r.args[1])&&r.args[1];return!isNaN(r.value)&&"length"!==e||"value"===e?t.$tc("validation.max.force",r.maximum,r):t.$tc("validation.max.default",r.maximum,r)},mime:function(t,r){return r.types=r.args[0],r.types?t.$t("validation.mime.default",r):t.$t("validation.mime.no_formats_allowed",r)},min:function(t,r){if(r.minimum=r.args[0],Array.isArray(r.value))return t.$tc("validation.min.array",r.minimum,r);var e=!(!Array.isArray(r.args)||!r.args[1])&&r.args[1];return!isNaN(r.value)&&"length"!==e||"value"===e?t.$tc("validation.min.force",r.minimum,r):t.$tc("validation.min.default",r.minimum,r)},not:function(t,r){return t.$t("validation.not.default",r)},number:function(t,r){return t.$t("validation.number.default",r)},required:function(t,r){return t.$t("validation.required.default",r)},startsWith:function(t,r){return t.$t("validation.startsWith.default",r)},url:function(t,r){return t.$t("validation.url.default",r)}};function V(t){t.extend({validationMessages:x})} /*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function w(t){return!0==(null!=(r=t)&&"object"==typeof r&&!1===Array.isArray(r))&&"[object Object]"===Object.prototype.toString.call(t);var r}function O(t){var r,e;return!1!==w(t)&&("function"==typeof(r=t.constructor)&&(!1!==w(e=r.prototype)&&!1!==e.hasOwnProperty("isPrototypeOf")))}function $(t,r,e,i){return new Promise((function(e,o){var n=(i.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var i=performance.now()-s,o=Math.min(100,Math.round(i/n*100));if(r(o),o>=100)return e({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}function F(t,r){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&-1===r.indexOf(i)&&(e[i]=t[i]);return e}var j=function(t){this.registry=new Map,this.ctx=t};j.prototype.add=function(t,r){return this.registry.set(t,r),this},j.prototype.remove=function(t){this.registry.delete(t);var r=this.ctx.proxy,e=(r[t],F(r,[String(t)]));return this.ctx.proxy=e,this},j.prototype.has=function(t){return this.registry.has(t)},j.prototype.get=function(t){return this.registry.get(t)},j.prototype.map=function(t){var r={};return this.registry.forEach((function(e,i){var o;return Object.assign(r,((o={})[i]=t(e,i),o))})),r},j.prototype.keys=function(){return Array.from(this.registry.keys())},j.prototype.register=function(t,r){if(this.registry.has(t))return!1;this.registry.set(t,r);var e=v(r.$options.propsData,"formularioValue"),i=v(r.$options.propsData,"value");!e&&this.ctx.hasInitialValue&&void 0!==g(this.ctx.initialValues,t)?r.context.model=g(this.ctx.initialValues,t):!e&&!i||f(r.proxy,g(this.ctx.initialValues,t))||this.ctx.setFieldValue(t,r.proxy),this.childrenShouldShowErrors&&(r.formShouldShowErrors=!0)},j.prototype.reduce=function(t,r){return this.registry.forEach((function(e,i){r=t(r,e,i)})),r},j.prototype.dataProps=function(){var t=this;return{proxy:{},registry:this,register:this.register.bind(this),deregister:function(r){return t.remove(r)},childrenShouldShowErrors:!1}};var A=function(t){this.form=t};function P(t,r,e,i,o,n,s,a,u,l){"boolean"!=typeof s&&(u=a,a=s,s=!1);var f,h="function"==typeof e?e.options:e;if(t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,o&&(h.functional=!0)),i&&(h._scopeId=i),n?(f=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,u(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},h._ssrRegister=f):r&&(f=s?function(t){r.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){r.call(this,a(t))}),f)if(h.functional){var c=h.render;h.render=function(t,r){return f.call(r),c(t,r)}}else{var d=h.beforeCreate;h.beforeCreate=d?[].concat(d,f):[f]}return e}A.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},A.prototype.values=function(){var t=this;return new Promise((function(r,e){var i=[],o=function t(r){if("object"!=typeof r)return r;var e=Array.isArray(r)?[]:{};for(var i in r)r[i]instanceof l||m(r[i])?e[i]=r[i]:e[i]=t(r[i]);return e}(t.form.proxy),n=function(r){"object"==typeof t.form.proxy[r]&&t.form.proxy[r]instanceof l&&i.push(t.form.proxy[r].upload().then((function(t){var e;return Object.assign(o,((e={})[r]=t,e))})))};for(var s in o)n(s);Promise.all(i).then((function(){return r(o)})).catch((function(t){return e(t)}))}))};var S={provide:function(){return Object.assign({},{formularioSetter:(t=this).setFieldValue,formularioRegister:t.register,formularioDeregister:t.deregister,getFormValues:t.getFormValues},{observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formularioFieldValidation:this.formularioFieldValidation,path:""});var t},name:"FormularioForm",model:{prop:"formularioValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formularioValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return Object.assign({},new j(this).dataProps(),{formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}})},computed:Object.assign({},{hasInitialValue:function(){return this.formularioValue&&"object"==typeof this.formularioValue||this.values&&"object"==typeof this.values||this.isGrouping&&"object"==typeof this.context.model[this.index]},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formularioValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return v(this.$options.propsData,"formularioValue")&&"object"==typeof this.formularioValue?Object.assign({},this.formularioValue):v(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):this.isGrouping&&"object"==typeof this.context.model[this.index]?this.context.model[this.index]:{}}},{classes:function(){var t={"formulario-form":!0};return this.name&&(t["formulario-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var r in this.errors)t[r]=c(this.errors[r]);for(var e in this.namedFieldErrors)t[e]=c(this.namedFieldErrors[e]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}}),watch:{formularioValue:{handler:function(t){this.isVmodeled&&t&&"object"==typeof t&&this.setValues(t)},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(r){return r.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(r){return r.callback(t[r.field]||[])}))},immediate:!0}},created:function(){this.$formulario.register(this),this.applyInitialValues()},destroyed:function(){this.$formulario.deregister(this)},methods:Object.assign({},function(t){void 0===t&&(t=[]);var r={applyInitialValues:function(){this.hasInitialValue&&(this.proxy=this.initialValues)},setFieldValue:function(t,r){if(void 0===r){var e=this.proxy,i=(e[t],F(e,[String(t)]));this.proxy=i}else!function(t,r,e){for(var i=r.split("."),o=t,n=0;n=0){var i=t.splice(0,e+1).slice(0,-1);i.length&&r.push(i),t.map((function(t){return r.push(Object.defineProperty([t],"bail",{value:!0}))}))}else r.push(t);return r.reduce((function(t,r){var e=function(t,r){if(void 0===r&&(r=!1),t.length<2)return Object.defineProperty([t],"bail",{value:r});var i=[],o=t.findIndex((function(t){return"^"===t[3]}));if(o>=0){var n=t.splice(0,o);n.length&&i.push.apply(i,e(n,r)),i.push(Object.defineProperty([t.shift()],"bail",{value:!0})),t.length&&i.push.apply(i,e(t,r))}else i.push(t);return i};return t.concat(e(r))}),[])}(t))}))},didValidate:function(t){var r=!f(t,this.validationErrors);if(this.validationErrors=t,r){var e=this.getErrorObject();this.$emit("validation",e),this.formularioFieldValidation&&"function"==typeof this.formularioFieldValidation&&this.formularioFieldValidation(e)}},getMessageObject:function(t,r){var e={args:r,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()};return{message:this.getMessageFunc(t)(e),rule:t,context:e}},getMessageFunc:function(t){var r=this;if(t=h(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":case"boolean":return function(){return r.messages[t]}}return function(e){return r.$formulario.validationMessage(t,e,r)}},hasValidationErrors:function(){var t=this;return new Promise((function(r){t.$nextTick((function(){t.pendingValidation.then((function(){return r(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(r){t.$nextTick((function(){return t.pendingValidation.then((function(){return r(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors.filter((function(t){return"object"==typeof t})),hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=c(t)},registerRule:function(t,r,e,i){void 0===i&&(i=null),this.ruleRegistry.some((function(t){return t[2]===e}))||(this.ruleRegistry.push([t,r,e]),null!==i&&(this.messageRegistry[e]=i))},removeRule:function(t){var r=this.ruleRegistry.findIndex((function(r){return r[2]===t}));r>=0&&(this.ruleRegistry.splice(r,1),delete this.messageRegistry[t])}}},B=function(){var t=this,r=t.$createElement;return(t._self._c||r)("div",{staticClass:"formulario-input",attrs:{"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[t._t("default",null,{id:t.id,context:t.context,errors:t.errors,validationErrors:t.validationErrors})],2)};B._withStripped=!0;var L=P({render:B,staticRenderFns:[]},void 0,M,void 0,!1,void 0,!1,void 0,void 0,void 0),C={name:"FormularioGrouping",props:{name:{type:String,required:!0},isArrayItem:{type:Boolean,default:!1}},provide:function(){return{path:this.groupPath}},inject:["path"],computed:{groupPath:function(){return this.isArrayItem?this.path+"["+this.name+"]":""===this.path?this.name:this.path+"."+this.name}}},T=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"formulario-group",attrs:{"data-type":"group"}},[this._t("default")],2)};T._withStripped=!0;var W=P({render:T,staticRenderFns:[]},void 0,C,void 0,!1,void 0,!1,void 0,void 0,void 0),G=function(){this.options={},this.defaults={components:{FormularioForm:R,FormularioInput:L,FormularioGrouping:W},library:r,rules:y,mimes:E,locale:!1,uploader:$,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[V],validationMessages:{},idPrefix:"formulario-"},this.registry=new Map,this.idRegistry={}};return G.prototype.install=function(t,r){var e=this;t.prototype.$formulario=this,this.options=this.defaults;var i=this.defaults.plugins;for(var o in r&&Array.isArray(r.plugins)&&r.plugins.length&&(i=i.concat(r.plugins)),i.forEach((function(t){return"function"==typeof t?t(e):null})),this.extend(r||{}),this.options.components)t.component(o,this.options.components[o])},G.prototype.nextId=function(t){var r=!(!t.$route||!t.$route.path)&&t.$route.path?t.$route.path.replace(/[/\\.\s]/g,"-"):"global";return Object.prototype.hasOwnProperty.call(this.idRegistry,r)||(this.idRegistry[r]=0),""+this.options.idPrefix+r+"-"+ ++this.idRegistry[r]},G.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulario extend() should be passed an object (was "+typeof t+")")},G.prototype.merge=function(t,r,e){void 0===e&&(e=!0);var i={};for(var o in t)r.hasOwnProperty(o)?O(r[o])&&O(t[o])?i[o]=this.merge(t[o],r[o],e):e&&Array.isArray(t[o])&&Array.isArray(r[o])?i[o]=t[o].concat(r[o]):i[o]=r[o]:i[o]=t[o];for(var n in r)i.hasOwnProperty(n)||(i[n]=r[n]);return i},G.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},G.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},G.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},G.prototype.validationMessage=function(t,r,e){return this.options.validationMessages.hasOwnProperty(t)?this.options.validationMessages[t](e,r):this.options.validationMessages.default(e,r)},G.prototype.register=function(t){"FormularioForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},G.prototype.deregister=function(t){"FormularioForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},G.prototype.handle=function(t,r,e){void 0===e&&(e=!1);var i=e?t:this.options.errorHandler(t,r);return r&&this.registry.has(r)&&this.registry.get(r).applyErrors({formErrors:c(i.formErrors),inputErrors:i.inputErrors||{}}),i},G.prototype.reset=function(t,r){void 0===r&&(r={}),this.resetValidation(t),this.setValues(t,r)},G.prototype.resetValidation=function(t){var r=this.registry.get(t);r.hideErrors(t),r.namedErrors=[],r.namedFieldErrors={}},G.prototype.setValues=function(t,r){r&&!Array.isArray(r)&&"object"==typeof r&&this.registry.get(t).setValues(Object.assign({},r))},G.prototype.getUploader=function(){return this.options.uploader||!1},G.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},G.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},G.prototype.createUpload=function(t,r){return new l(t,r,this.options)},new G}();