{"size": 4547, "ext": "js", "max_stars_repo_path": "public/formvalidation/dist/js/plugins/MandatoryIcon.min.js", "max_stars_repo_name": "Farthest-Gate/sasyk", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/formvalidation/dist/js/plugins/MandatoryIcon.min.js", "max_issues_repo_name": "Farthest-Gate/sasyk", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/formvalidation/dist/js/plugins/MandatoryIcon.min.js", "max_forks_repo_name": "Farthest-Gate/sasyk", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 4547.0, "max_line_length": 4547, "alphanum_fraction": 0.7301517484}
!function(e,n){typeof exports==='object'&&typeof module!=='undefined'?module.exports=n():typeof define==='function'&&define.amd?define(n):(e.FormValidation=e.FormValidation||{}, e.FormValidation.plugins=e.FormValidation.plugins||{}, e.FormValidation.plugins.MandatoryIcon=n())}(this,(function(){"use strict";var e=FormValidation.Plugin,n;!function(e){e.Invalid="Invalid";e.NotValidated="NotValidated";e.Valid="Valid";e.Validating="Validating"}(n||(n={}));var t=n,i=FormValidation.utils.classSet,l=function(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}},a=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1;i.configurable=!0;"value" in i&&(i.writable=!0);Object.defineProperty(e,i.key,i)}}return function(n,t,i){t&&e(n.prototype,t);i&&e(n,i);return n}}(),o=function(e,n,t){n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):(e[n]=t);return e},s=function(e,n){if(typeof n!=="function"&&n!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof n)}e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)},d=function(e,n){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return n&&(typeof n==="object"||typeof n==="function")?n:e},c=function(e){s(n,e);function n(e){var i;l(this,n);var a=d(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));a.removedIcons=(i={}, o(i,t.Valid,''), o(i,t.Invalid,''), o(i,t.Validating,''), o(i,t.NotValidated,''), i);a.icons=new Map;a.elementValidatingHandler=a.onElementValidating.bind(a);a.elementValidatedHandler=a.onElementValidated.bind(a);a.elementNotValidatedHandler=a.onElementNotValidated.bind(a);a.iconPlacedHandler=a.onIconPlaced.bind(a);a.iconSetHandler=a.onIconSet.bind(a);return a}a(n,[{key:'install',value:function(){this.core.on('core.element.validating',this.elementValidatingHandler).on('core.element.validated',this.elementValidatedHandler).on('core.element.notvalidated',this.elementNotValidatedHandler).on('plugins.icon.placed',this.iconPlacedHandler).on('plugins.icon.set',this.iconSetHandler)}},{key:'uninstall',value:function(){this.icons.clear();this.core.off('core.element.validating',this.elementValidatingHandler).off('core.element.validated',this.elementValidatedHandler).off('core.element.notvalidated',this.elementNotValidatedHandler).off('plugins.icon.placed',this.iconPlacedHandler).off('plugins.icon.set',this.iconSetHandler)}},{key:'onIconPlaced',value:function(e){var n,l=this,a=this.core.getFields()[e.field].validators,s=this.core.getElements(e.field);if(a&&a.notEmpty&&a.notEmpty.enabled!==!1&&s.length){this.icons.set(e.element,e.iconElement);var d=s[0].getAttribute('type').toLowerCase(),c='checkbox'===d||'radio'===d?[s[0]]:s,r=!0,u=!1,f=void 0;try{for(var p=c[Symbol.iterator](),m;!(r=(m=p.next()).done);r=!0){var g=m.value;this.core.getElementValue(e.field,g)===''&&i(e.iconElement,o({},this.opts.icon,!0))}}catch(e){u=!0,f=e}finally{try{!r&&p.return&&p.return()}finally{if(u){throw f}}}}this.iconClasses=e.classes;var v=this.opts.icon.split(' '),V=(n={}, o(n,t.Valid,this.iconClasses.valid?this.iconClasses.valid.split(' '):[]), o(n,t.Invalid,this.iconClasses.invalid?this.iconClasses.invalid.split(' '):[]), o(n,t.Validating,this.iconClasses.validating?this.iconClasses.validating.split(' '):[]), n);Object.keys(V).forEach(function(e){var n=[],t=!0,i=!1,a=void 0;try{for(var o=v[Symbol.iterator](),s;!(t=(s=o.next()).done);t=!0){var d=s.value;V[e].indexOf(d)===-1&&n.push(d)}}catch(e){i=!0,a=e}finally{try{!t&&o.return&&o.return()}finally{if(i){throw a}}};l.removedIcons[e]=n.join(' ')})}},{key:'onElementValidating',value:function(e){this.updateIconClasses(e.element,t.Validating)}},{key:'onElementValidated',value:function(e){this.updateIconClasses(e.element,e.valid?t.Valid:t.Invalid)}},{key:'onElementNotValidated',value:function(e){this.updateIconClasses(e.element,t.NotValidated)}},{key:'updateIconClasses',value:function(e,n){var t=this.icons.get(e);if(t&&this.iconClasses&&(this.iconClasses.valid||this.iconClasses.invalid||this.iconClasses.validating)){var l;i(t,(l={}, o(l,this.removedIcons[n],!1), o(l,this.opts.icon,!1), l))}}},{key:'onIconSet',value:function(e){var n=this.icons.get(e.element);n&&e.status===t.NotValidated&&this.core.getElementValue(e.field,e.element)===''&&i(n,o({},this.opts.icon,!0))}}]);return n}(e);return c}))