{"version":3,"file":"button.min.js","sources":["https:\/\/falms.fa.gov.sa\/theme\/boost\/amd\/src\/bootstrap\/button.js"],"sourcesContent":["\/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.6.2): button.js\n * Licensed under MIT (https:\/\/github.com\/twbs\/bootstrap\/blob\/main\/LICENSE)\n * --------------------------------------------------------------------------\n *\/\n\nimport $ from 'jquery'\n\n\/**\n * Constants\n *\/\n\nconst NAME = 'button'\nconst VERSION = '4.6.2'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\n\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_BUTTON = 'btn'\nconst CLASS_NAME_FOCUS = 'focus'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_FOCUS_BLUR_DATA_API = `focus${EVENT_KEY}${DATA_API_KEY} ` +\n `blur${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\n\nconst SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^=\"button\"]'\nconst SELECTOR_DATA_TOGGLES = '[data-toggle=\"buttons\"]'\nconst SELECTOR_DATA_TOGGLE = '[data-toggle=\"button\"]'\nconst SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle=\"buttons\"] .btn'\nconst SELECTOR_INPUT = 'input:not([type=\"hidden\"])'\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_BUTTON = '.btn'\n\n\/**\n * Class definition\n *\/\n\nclass Button {\n constructor(element) {\n this._element = element\n this.shouldAvoidTriggerChange = false\n }\n\n \/\/ Getters\n static get VERSION() {\n return VERSION\n }\n\n \/\/ Public\n toggle() {\n let triggerChangeEvent = true\n let addAriaPressed = true\n const rootElement = $(this._element).closest(SELECTOR_DATA_TOGGLES)[0]\n\n if (rootElement) {\n const input = this._element.querySelector(SELECTOR_INPUT)\n\n if (input) {\n if (input.type === 'radio') {\n if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {\n triggerChangeEvent = false\n } else {\n const activeElement = rootElement.querySelector(SELECTOR_ACTIVE)\n\n if (activeElement) {\n $(activeElement).removeClass(CLASS_NAME_ACTIVE)\n }\n }\n }\n\n if (triggerChangeEvent) {\n \/\/ if it's not a radio button or checkbox don't add a pointless\/invalid checked property to the input\n if (input.type === 'checkbox' || input.type === 'radio') {\n input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE)\n }\n\n if (!this.shouldAvoidTriggerChange) {\n $(input).trigger('change')\n }\n }\n\n input.focus()\n addAriaPressed = false\n }\n }\n\n if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {\n if (addAriaPressed) {\n this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE))\n }\n\n if (triggerChangeEvent) {\n $(this._element).toggleClass(CLASS_NAME_ACTIVE)\n }\n }\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n this._element = null\n }\n\n \/\/ Static\n static _jQueryInterface(config, avoidTriggerChange) {\n return this.each(function () {\n const $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Button(this)\n $element.data(DATA_KEY, data)\n }\n\n data.shouldAvoidTriggerChange = avoidTriggerChange\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n\/**\n * Data API implementation\n *\/\n\n$(document)\n .on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, event => {\n let button = event.target\n const initialButton = button\n\n if (!$(button).hasClass(CLASS_NAME_BUTTON)) {\n button = $(button).closest(SELECTOR_BUTTON)[0]\n }\n\n if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {\n event.preventDefault() \/\/ work around Firefox bug #1540995\n } else {\n const inputBtn = button.querySelector(SELECTOR_INPUT)\n\n if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {\n event.preventDefault() \/\/ work around Firefox bug #1540995\n return\n }\n\n if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {\n Button._jQueryInterface.call($(button), 'toggle', initialButton.tagName === 'INPUT')\n }\n }\n })\n .on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, event => {\n const button = $(event.target).closest(SELECTOR_BUTTON)[0]\n $(button).toggleClass(CLASS_NAME_FOCUS, \/^focus(in)?$\/.test(event.type))\n })\n\n$(window).on(EVENT_LOAD_DATA_API, () => {\n \/\/ ensure correct active class is set to match the controls' actual values\/states\n\n \/\/ find all checkboxes\/readio buttons inside data-toggle groups\n let buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS))\n for (let i = 0, len = buttons.length; i < len; i++) {\n const button = buttons[i]\n const input = button.querySelector(SELECTOR_INPUT)\n if (input.checked || input.hasAttribute('checked')) {\n button.classList.add(CLASS_NAME_ACTIVE)\n } else {\n button.classList.remove(CLASS_NAME_ACTIVE)\n }\n }\n\n \/\/ find all button toggles\n buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE))\n for (let i = 0, len = buttons.length; i < len; i++) {\n const button = buttons[i]\n if (button.getAttribute('aria-pressed') === 'true') {\n button.classList.add(CLASS_NAME_ACTIVE)\n } else {\n button.classList.remove(CLASS_NAME_ACTIVE)\n }\n }\n})\n\n\/**\n * jQuery\n *\/\n\n$.fn[NAME] = Button._jQueryInterface\n$.fn[NAME].Constructor = Button\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Button._jQueryInterface\n}\n\nexport default Button\n"],"names":["obj","_jquery","__esModule","default","NAME","JQUERY_NO_CONFLICT","$","fn","Button","constructor","element","this","_element","shouldAvoidTriggerChange","VERSION","toggle","triggerChangeEvent","addAriaPressed","rootElement","closest","input","querySelector","type","checked","classList","contains","activeElement","removeClass","trigger","focus","hasAttribute","setAttribute","toggleClass","dispose","removeData","_jQueryInterface","config","avoidTriggerChange","each","$element","data","document","on","event","button","target","initialButton","hasClass","preventDefault","inputBtn","tagName","call","test","window","buttons","slice","querySelectorAll","i","len","length","add","remove","getAttribute","Constructor","noConflict","_default","_exports"],"mappings":"uFAOsB,IAAAA,oFAAtBC,SAAsBD,IAAtBC,UAAsBD,IAAAE,WAAAF,KAAAG,QAAAH,KAMtB,MAAMI,KAAO,SAKPC,mBAAqBC,gBAAEC,GAAGH,MAuBhC,MAAMI,OACJC,WAAAA,CAAYC,SACVC,KAAKC,SAAWF,QAChBC,KAAKE,0BAA2B,EAIlC,kBAAWC,GACT,MAnCY,QAuCdC,MAAAA,GACE,IAAIC,oBAAqB,EACrBC,gBAAiB,EACrB,MAAMC,aAAc,EAAAZ,iBAAEK,KAAKC,UAAUO,QA1BX,2BA0B0C,GAEpE,GAAID,YAAa,CACf,MAAME,MAAQT,KAAKC,SAASS,cA1BX,8BA4BjB,GAAID,MAAO,CACT,GAAmB,UAAfA,MAAME,KACR,GAAIF,MAAMG,SAAWZ,KAAKC,SAASY,UAAUC,SA3C7B,UA4CdT,oBAAqB,MAChB,CACL,MAAMU,cAAgBR,YAAYG,cAhCtB,WAkCRK,gBACF,EAAApB,iBAAEoB,eAAeC,YAjDL,UAsDdX,qBAEiB,aAAfI,MAAME,MAAsC,UAAfF,MAAME,OACrCF,MAAMG,SAAWZ,KAAKC,SAASY,UAAUC,SAzD3B,WA4DXd,KAAKE,2BACR,EAAAP,iBAAEc,OAAOQ,QAAQ,WAIrBR,MAAMS,QACNZ,gBAAiB,GAIfN,KAAKC,SAASkB,aAAa,aAAenB,KAAKC,SAASY,UAAUC,SAAS,cAC3ER,gBACFN,KAAKC,SAASmB,aAAa,gBAAiBpB,KAAKC,SAASY,UAAUC,SAxElD,WA2EhBT,qBACF,EAAAV,iBAAEK,KAAKC,UAAUoB,YA5EC,WAiFxBC,OAAAA,GACE3B,gBAAE4B,WAAWvB,KAAKC,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