{"version":3,"file":"foundation.core.plugin.js","sources":["../../../../IREP.Web.Content/v7/node_modules/foundation-sites/js/foundation.core.plugin.js"],"sourcesContent":["import { GetYoDigits } from './foundation.core.utils';\n\n// Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST\n// {function} _setup (replaces previous constructor),\n// {function} _destroy (replaces previous destroy)\nclass Plugin {\n\n constructor(element, options) {\n this._setup(element, options);\n var pluginName = getPluginName(this);\n this.uuid = GetYoDigits(6, pluginName);\n\n if(!this.$element.attr(`data-${pluginName}`)){ this.$element.attr(`data-${pluginName}`, this.uuid); }\n if(!this.$element.data('zfPlugin')){ this.$element.data('zfPlugin', this); }\n /**\n * Fires when the plugin has initialized.\n * @event Plugin#init\n */\n this.$element.trigger(`init.zf.${pluginName}`);\n }\n\n destroy() {\n this._destroy();\n var pluginName = getPluginName(this);\n this.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')\n /**\n * Fires when the plugin has been destroyed.\n * @event Plugin#destroyed\n */\n .trigger(`destroyed.zf.${pluginName}`);\n for(var prop in this){\n if (this.hasOwnProperty(prop)) {\n this[prop] = null; //clean up script to prep for garbage collection.\n }\n }\n }\n}\n\n// Convert PascalCase to kebab-case\n// Thank you: http://stackoverflow.com/a/8955580\nfunction hyphenate(str) {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nfunction getPluginName(obj) {\n return hyphenate(obj.className);\n}\n\nexport {Plugin};\n"],"names":["Plugin","constructor","element","options","this","_setup","pluginName","getPluginName","uuid","GetYoDigits","$element","attr","data","trigger","destroy","_destroy","prop","removeAttr","removeData","hasOwnProperty","obj","className","replace","toLowerCase"],"mappings":"+CAKA,MAAMA,EAEJ,WAAAC,CAAYC,EAASC,GACnBC,KAAKC,OAAOH,EAASC,GACrB,IAAIG,EAAaC,EAAcH,MAC/BA,KAAKI,KAAOC,EAAY,EAAGH,GAEvBF,KAAKM,SAASC,KAAK,QAAQL,MAAgBF,KAAKM,SAASC,KAAK,QAAQL,IAAcF,KAAKI,MACzFJ,KAAKM,SAASE,KAAK,aAAcR,KAAKM,SAASE,KAAK,WAAYR,MAKpEA,KAAKM,SAASG,QAAQ,WAAWP,IACrC,CAEE,OAAAQ,GACEV,KAAKW,WACL,IAAIT,EAAaC,EAAcH,MAO/B,IAAI,IAAIY,KANRZ,KAAKM,SAASO,WAAW,QAAQX,KAAcY,WAAW,YAKrDL,QAAQ,gBAAgBP,KACbF,KACVA,KAAKe,eAAeH,KACtBZ,KAAKY,GAAQ,KAGrB,EASA,SAAST,EAAca,GACrB,OAAiBA,EAAIC,UAJVC,QAAQ,kBAAmB,SAASC,aAKjD","x_google_ignoreList":[0]}