/*
* # Fomantic UI - 2.8.8
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2021 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function($,I,O,L){"use strict";$.isFunction=$.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},I=void 0!==I&&I.Math==Math?I:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),$.fn.form=function(C){var w,V=$(this),A=V.selector||"",D=(new Date).getTime(),F=[],R=C,S=arguments[1],T="string"==typeof R,j=[].slice.call(arguments,1);return V.each(function(){var n,f,t,e,p,s,m,g,h,r,c,i,a,l,u,v,d=$(this),b=this,y=[],x=!1,o=!1,k=!1,E=["clean","clean"];(v={initialize:function(){v.get.settings(),T?(u===L&&v.instantiate(),v.invoke(R)):(u!==L&&(u.invoke("destroy"),v.refresh()),v.verbose("Initializing form validation",d,p),v.bindEvents(),v.set.defaults(),p.autoCheckRequired&&v.set.autoCheck(),v.instantiate())},instantiate:function(){v.verbose("Storing instance of module",v),u=v,d.data(a,v)},destroy:function(){v.verbose("Destroying previous module",u),v.removeEvents(),d.removeData(a)},refresh:function(){v.verbose("Refreshing selector cache"),n=d.find(g.field),f=d.find(g.group),t=d.find(g.message),d.find(g.prompt),e=d.find(g.submit),d.find(g.clear),d.find(g.reset)},submit:function(){v.verbose("Submitting form",d),o=!0,d.submit()},attachEvents:function(e,t){t=t||"submit",$(e).on("click"+l,function(e){v[t](),e.preventDefault()})},bindEvents:function(){v.verbose("Attaching form events"),d.on("submit"+l,v.validate.form).on("blur"+l,g.field,v.event.field.blur).on("click"+l,g.submit,v.submit).on("click"+l,g.reset,v.reset).on("click"+l,g.clear,v.clear),p.keyboardShortcuts&&d.on("keydown"+l,g.field,v.event.field.keydown),n.each(function(e,t){var n=$(t),r=n.prop("type"),i=v.get.changeEvent(r,n);n.on(i+l,v.event.field.change)}),p.preventLeaving&&$(I).on("beforeunload"+l,v.event.beforeUnload),n.on("change click keyup keydown blur",function(e){v.determine.isDirty()}),d.on("dirty"+l,function(e){p.onDirty.call()}),d.on("clean"+l,function(e){p.onClean.call()})},clear:function(){n.each(function(e,t){var n=$(t),r=n.parent(),i=n.closest(f),a=i.find(g.prompt),o=n.closest(g.uiCalendar),l=n.data(m.defaultValue)||"",s=r.is(g.uiCheckbox),u=r.is(g.uiDropdown)&&v.can.useElement("dropdown"),c=0")},fields:function(e){var n=$();return $.each(e,function(e,t){n=n.add(v.get.field(t))}),n},validation:function(r){var i,a;return!!s&&($.each(s,function(e,n){a=n.identifier||e,$.each(v.get.field(a),function(e,t){if(t==r[0])return n.identifier=a,i=n,!1})}),i||!1)},value:function(e){var t=[];return t.push(e),v.get.values.call(b,t)[e]},values:function(e){var t=Array.isArray(e)?v.get.fields(e):n,m={};return t.each(function(e,t){var n=$(t),r=n.closest(g.uiCalendar),i=n.prop("name"),a=n.val(),o=n.is(g.checkbox),l=n.is(g.radio),s=-1!==i.indexOf("[]"),u=0"+t+""}),$(n+="")},prompt:function(e,t){return $("").addClass(t).html(e[0])}},formatter:{date:function(e){return Intl.DateTimeFormat("en-GB").format(e)},datetime:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},time:function(e){return Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},month:function(e){return Intl.DateTimeFormat("en-GB",{month:"2-digit",year:"numeric"}).format(e)},year:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric"}).format(e)}},rules:{empty:function(e){return!(e===L||""===e||Array.isArray(e)&&0===e.length)},checked:function(){return 0<$(this).filter(":checked").length},email:function(e){return $.fn.form.settings.regExp.email.test(e)},url:function(e){return $.fn.form.settings.regExp.url.test(e)},regExp:function(e,t){if(t instanceof RegExp)return e.match(t);var n,r=t.match($.fn.form.settings.regExp.flags);return r&&(t=2<=r.length?r[1]:t,n=3<=r.length?r[2]:""),e.match(new RegExp(t,n))},minValue:function(e,t){return $.fn.form.settings.rules.range(e,t+"..","number")},maxValue:function(e,t){return $.fn.form.settings.rules.range(e,".."+t,"number")},integer:function(e,t){return $.fn.form.settings.rules.range(e,t,"integer")},range:function(e,t,n){var r,i,a;return"string"==typeof n&&(n=$.fn.form.settings.regExp[n]),n instanceof RegExp||(n=$.fn.form.settings.regExp.integer),t&&-1===["",".."].indexOf(t)&&(-1==t.indexOf("..")?n.test(t)&&(r=i=t-0):(a=t.split("..",2),n.test(a[0])&&(r=a[0]-0),n.test(a[1])&&(i=a[1]-0))),n.test(e)&&(r===L||r<=e)&&(i===L||e<=i)},decimal:function(e,t){return $.fn.form.settings.rules.range(e,t,"decimal")},number:function(e,t){return $.fn.form.settings.rules.range(e,t,"number")},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,(e="string"==typeof e?e.toLowerCase():e)==t},isExactly:function(e,t){return e==t},not:function(e,t){return(e="string"==typeof e?e.toLowerCase():e)!=(t="string"==typeof t?t.toLowerCase():t)},notExactly:function(e,t){return e!=t},contains:function(e,t){return t=t.replace($.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t,"i"))},containsExactly:function(e,t){return t=t.replace($.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t))},doesntContain:function(e,t){return t=t.replace($.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t,"i"))},doesntContainExactly:function(e,t){return t=t.replace($.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t))},minLength:function(e,t){return e!==L&&e.length>=t},length:function(e,t){return e!==L&&e.length>=t},exactLength:function(e,t){return e!==L&&e.length==t},maxLength:function(e,t){return e!==L&&e.length<=t},match:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length?r=i.val():0<(i=n.find("#"+t)).length?r=i.val():0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()==r.toString()},different:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length?r=i.val():0<(i=n.find("#"+t)).length?r=i.val():0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()!==r.toString()},creditCard:function(n,e){var t,r,i={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},a={},o=!1,l="string"==typeof e&&e.split(",");if("string"==typeof n&&0!==n.length){if(n=n.replace(/[\s\-]/g,""),l&&($.each(l,function(e,t){(r=i[t])&&(a={length:-1!==$.inArray(n.length,r.length),pattern:-1!==n.search(r.pattern)}).length&&a.pattern&&(o=!0)}),!o))return!1;if((t={number:-1!==$.inArray(n.length,i.unionPay.length),pattern:-1!==n.search(i.unionPay.pattern)}).number&&t.pattern)return!0;for(var s=n.length,u=0,c=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],d=0;s--;)d+=c[u][parseInt(n.charAt(s),10)],u^=1;return d%10==0&&0=t)},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0!=t&&(1==t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document);