inputmask.dependencyLib.min.js 4.2 KB

123456789
  1. /*!
  2. * dependencyLibs/inputmask.dependencyLib.min.js
  3. * https://github.com/RobinHerbots/Inputmask
  4. * Copyright (c) 2010 - 2018 Robin Herbots
  5. * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. * Version: 4.0.1-beta.29
  7. */
  8. !function(e){"function"==typeof define&&define.amd?define(["../global/window","../global/document"],e):"object"==typeof exports?module.exports=e(require("../global/window"),require("../global/document")):window.dependencyLib=e(window,document)}(function(t,v){function l(e){return null!=e&&e===e.window}function d(e){return e instanceof Element}function p(e){return e instanceof p?e:this instanceof p?void(null!=e&&e!==t&&(this[0]=e.nodeName?e:void 0!==e[0]&&e[0].nodeName?e[0]:v.querySelector(e),void 0!==this[0]&&null!==this[0]&&(this[0].eventRegistry=this[0].eventRegistry||{}))):new p(e)}return p.prototype={on:function(e,t){if(d(this[0])){var n=this[0].eventRegistry,i=this[0];for(var o=e.split(" "),r=0;r<o.length;r++){var a=o[r].split("."),l=a[0],s=a[1]||"global";f=l,c=s,i.addEventListener?i.addEventListener(f,t,!1):i.attachEvent&&i.attachEvent("on"+f,t),n[f]=n[f]||{},n[f][c]=n[f][c]||[],n[f][c].push(t)}}var f,c;return this},off:function(e,l){if(d(this[0])){var s=this[0].eventRegistry,o=this[0];function t(e,t,n){if(e in s==!0)if(o.removeEventListener?o.removeEventListener(e,n,!1):o.detachEvent&&o.detachEvent("on"+e,n),"global"===t)for(var i in s[e])s[e][i].splice(s[e][i].indexOf(n),1);else s[e][t].splice(s[e][t].indexOf(n),1)}function n(e,t){var n,i,o=[];if(0<e.length)if(void 0===l)for(n=0,i=s[e][t].length;n<i;n++)o.push({ev:e,namespace:t&&0<t.length?t:"global",handler:s[e][t][n]});else o.push({ev:e,namespace:t&&0<t.length?t:"global",handler:l});else if(0<t.length)for(var r in s)for(var a in s[r])if(a===t)if(void 0===l)for(n=0,i=s[r][a].length;n<i;n++)o.push({ev:r,namespace:a,handler:s[r][a][n]});else o.push({ev:r,namespace:a,handler:l});return o}for(var i=e.split(" "),r=0;r<i.length;r++)for(var a=i[r].split("."),f=n(a[0],a[1]),c=0,u=f.length;c<u;c++)t(f[c].ev,f[c].namespace,f[c].handler)}return this},trigger:function(e){if(d(this[0]))for(var t=this[0].eventRegistry,n=this[0],i="string"==typeof e?e.split(" "):[e.type],o=0;o<i.length;o++){var r=i[o].split("."),a=r[0],l=r[1]||"global";if(void 0!==v&&"global"===l){var s,f,c={bubbles:!0,cancelable:!0,detail:arguments[1]};if(v.createEvent){try{s=new CustomEvent(a,c)}catch(e){(s=v.createEvent("CustomEvent")).initCustomEvent(a,c.bubbles,c.cancelable,c.detail)}e.type&&p.extend(s,e),n.dispatchEvent(s)}else(s=v.createEventObject()).eventType=a,s.detail=arguments[1],e.type&&p.extend(s,e),n.fireEvent("on"+s.eventType,s)}else if(void 0!==t[a])if(e=e.type?e:p.Event(e),"global"===l)for(var u in t[a])for(f=0;f<t[a][u].length;f++)t[a][u][f].apply(n,arguments);else for(f=0;f<t[a][l].length;f++)t[a][l][f].apply(n,arguments)}return this}},p.isFunction=function(e){return"function"==typeof e},p.noop=function(){},p.isArray=Array.isArray,p.inArray=function(e,t,n){return null==t?-1:function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}(t,e)},p.valHooks=void 0,p.isPlainObject=function(e){return"object"==typeof e&&!e.nodeType&&!l(e)&&!(e.constructor&&!Object.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))},p.extend=function(){var e,t,n,i,o,r,a=arguments[0]||{},l=1,s=arguments.length,f=!1;for("boolean"==typeof a&&(f=a,a=arguments[l]||{},l++),"object"==typeof a||p.isFunction(a)||(a={}),l===s&&(a=this,l--);l<s;l++)if(null!=(e=arguments[l]))for(t in e)n=a[t],a!==(i=e[t])&&(f&&i&&(p.isPlainObject(i)||(o=p.isArray(i)))?(o?(o=!1,r=n&&p.isArray(n)?n:[]):r=n&&p.isPlainObject(n)?n:{},a[t]=p.extend(f,r,i)):void 0!==i&&(a[t]=i));return a},p.each=function(e,t){var n,i,o,r=0;if(i="length"in(n=e)&&n.length,"function"!==(o=typeof n)&&!l(n)&&(1===n.nodeType&&i||"array"===o||0===i||"number"==typeof i&&0<i&&i-1 in n))for(var a=e.length;r<a&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},p.data=function(e,t,n){if(void 0===n)return e.__data?e.__data[t]:null;e.__data=e.__data||{},e.__data[t]=n},"function"==typeof t.CustomEvent?p.Event=t.CustomEvent:(p.Event=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=v.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}).prototype=t.Event.prototype,p});