!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery"),require("./util.js")):"function"==typeof define&&define.amd?define(["jquery","./util.js"],t):e.Modal=t(e.jQuery,e.Util)}(this,function(e,t){"use strict";function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},o=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),o.forEach(function(t){n(e,t,i[t])})}return e}return e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t,function(e){var n="modal",s=".bs.modal",a=e.fn.modal,r={backdrop:!0,keyboard:!0,focus:!0,show:!0},l={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},d={HIDE:"hide.bs.modal",HIDDEN:"hidden.bs.modal",SHOW:"show.bs.modal",SHOWN:"shown.bs.modal",FOCUSIN:"focusin.bs.modal",RESIZE:"resize.bs.modal",CLICK_DISMISS:"click.dismiss.bs.modal",KEYDOWN_DISMISS:"keydown.dismiss.bs.modal",MOUSEUP_DISMISS:"mouseup.dismiss.bs.modal",MOUSEDOWN_DISMISS:"mousedown.dismiss.bs.modal",CLICK_DATA_API:"click.bs.modal.data-api"},h="modal-scrollbar-measure",c="modal-backdrop",u="modal-open",_="fade",m="show",f={DIALOG:".modal-dialog",DATA_TOGGLE:'[data-toggle="modal"]',DATA_DISMISS:'[data-dismiss="modal"]',FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top"},g=function(){function a(e,t){this._config=this._getConfig(t),this._element=e,this._dialog=e.querySelector(f.DIALOG),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._scrollbarWidth=0}var g,p,b,S=a.prototype;return S.toggle=function(e){return this._isShown?this.hide():this.show(e)},S.show=function(t){var i=this;if(!this._isTransitioning&&!this._isShown){e(this._element).hasClass(_)&&(this._isTransitioning=!0);var n=e.Event(d.SHOW,{relatedTarget:t});e(this._element).trigger(n),this._isShown||n.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),e(document.body).addClass(u),this._setEscapeEvent(),this._setResizeEvent(),e(this._element).on(d.CLICK_DISMISS,f.DATA_DISMISS,function(e){return i.hide(e)}),e(this._dialog).on(d.MOUSEDOWN_DISMISS,function(){e(i._element).one(d.MOUSEUP_DISMISS,function(t){e(t.target).is(i._element)&&(i._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return i._showElement(t)}))}},S.hide=function(i){var n=this;if(i&&i.preventDefault(),!this._isTransitioning&&this._isShown){var o=e.Event(d.HIDE);if(e(this._element).trigger(o),this._isShown&&!o.isDefaultPrevented()){this._isShown=!1;var s=e(this._element).hasClass(_);if(s&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),e(document).off(d.FOCUSIN),e(this._element).removeClass(m),e(this._element).off(d.CLICK_DISMISS),e(this._dialog).off(d.MOUSEDOWN_DISMISS),s){var a=t.getTransitionDurationFromElement(this._element);e(this._element).one(t.TRANSITION_END,function(e){return n._hideModal(e)}).emulateTransitionEnd(a)}else this._hideModal()}}},S.dispose=function(){e.removeData(this._element,"bs.modal"),e(window,document,this._element,this._backdrop).off(s),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._scrollbarWidth=null},S.handleUpdate=function(){this._adjustDialog()},S._getConfig=function(e){return e=o({},r,e),t.typeCheckConfig(n,e,l),e},S._showElement=function(i){var n=this,o=e(this._element).hasClass(_);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.scrollTop=0,o&&t.reflow(this._element),e(this._element).addClass(m),this._config.focus&&this._enforceFocus();var s=e.Event(d.SHOWN,{relatedTarget:i}),a=function(){n._config.focus&&n._element.focus(),n._isTransitioning=!1,e(n._element).trigger(s)};if(o){var r=t.getTransitionDurationFromElement(this._element);e(this._dialog).one(t.TRANSITION_END,a).emulateTransitionEnd(r)}else a()},S._enforceFocus=function(){var t=this;e(document).off(d.FOCUSIN).on(d.FOCUSIN,function(i){document!==i.target&&t._element!==i.target&&0===e(t._element).has(i.target).length&&t._element.focus()})},S._setEscapeEvent=function(){var t=this;this._isShown&&this._config.keyboard?e(this._element).on(d.KEYDOWN_DISMISS,function(e){27===e.which&&(e.preventDefault(),t.hide())}):this._isShown||e(this._element).off(d.KEYDOWN_DISMISS)},S._setResizeEvent=function(){var t=this;this._isShown?e(window).on(d.RESIZE,function(e){return t.handleUpdate(e)}):e(window).off(d.RESIZE)},S._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1,this._showBackdrop(function(){e(document.body).removeClass(u),t._resetAdjustments(),t._resetScrollbar(),e(t._element).trigger(d.HIDDEN)})},S._removeBackdrop=function(){this._backdrop&&(e(this._backdrop).remove(),this._backdrop=null)},S._showBackdrop=function(i){var n=this,o=e(this._element).hasClass(_)?_:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className=c,o&&this._backdrop.classList.add(o),e(this._backdrop).appendTo(document.body),e(this._element).on(d.CLICK_DISMISS,function(e){n._ignoreBackdropClick?n._ignoreBackdropClick=!1:e.target===e.currentTarget&&("static"===n._config.backdrop?n._element.focus():n.hide())}),o&&t.reflow(this._backdrop),e(this._backdrop).addClass(m),!i)return;if(!o)return void i();var s=t.getTransitionDurationFromElement(this._backdrop);e(this._backdrop).one(t.TRANSITION_END,i).emulateTransitionEnd(s)}else if(!this._isShown&&this._backdrop){e(this._backdrop).removeClass(m);var a=function(){n._removeBackdrop(),i&&i()};if(e(this._element).hasClass(_)){var r=t.getTransitionDurationFromElement(this._backdrop);e(this._backdrop).one(t.TRANSITION_END,a).emulateTransitionEnd(r)}else a()}else i&&i()},S._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},S._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},S._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=e.left+e.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},S._setScrollbar=function(){var t=this;if(this._isBodyOverflowing){var i=[].slice.call(document.querySelectorAll(f.FIXED_CONTENT)),n=[].slice.call(document.querySelectorAll(f.STICKY_CONTENT));e(i).each(function(i,n){var o=n.style.paddingRight,s=e(n).css("padding-right");e(n).data("padding-right",o).css("padding-right",parseFloat(s)+t._scrollbarWidth+"px")}),e(n).each(function(i,n){var o=n.style.marginRight,s=e(n).css("margin-right");e(n).data("margin-right",o).css("margin-right",parseFloat(s)-t._scrollbarWidth+"px")});var o=document.body.style.paddingRight,s=e(document.body).css("padding-right");e(document.body).data("padding-right",o).css("padding-right",parseFloat(s)+this._scrollbarWidth+"px")}},S._resetScrollbar=function(){var t=[].slice.call(document.querySelectorAll(f.FIXED_CONTENT));e(t).each(function(t,i){var n=e(i).data("padding-right");e(i).removeData("padding-right"),i.style.paddingRight=n||""});var i=[].slice.call(document.querySelectorAll(""+f.STICKY_CONTENT));e(i).each(function(t,i){var n=e(i).data("margin-right");void 0!==n&&e(i).css("margin-right",n).removeData("margin-right")});var n=e(document.body).data("padding-right");e(document.body).removeData("padding-right"),document.body.style.paddingRight=n||""},S._getScrollbarWidth=function(){var e=document.createElement("div");e.className=h,document.body.appendChild(e);var t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},a._jQueryInterface=function(t,i){return this.each(function(){var n=e(this).data("bs.modal"),s=o({},r,e(this).data(),"object"==typeof t&&t?t:{});if(n||(n=new a(this,s),e(this).data("bs.modal",n)),"string"==typeof t){if(void 0===n[t])throw new TypeError('No method named "'+t+'"');n[t](i)}else s.show&&n.show(i)})},g=a,b=[{key:"VERSION",get:function(){return"4.1.3"}},{key:"Default",get:function(){return r}}],(p=null)&&i(g.prototype,p),b&&i(g,b),a}();return e(document).on(d.CLICK_DATA_API,f.DATA_TOGGLE,function(i){var n,s=this,a=t.getSelectorFromElement(this);a&&(n=document.querySelector(a));var r=e(n).data("bs.modal")?"toggle":o({},e(n).data(),e(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||i.preventDefault();var l=e(n).one(d.SHOW,function(t){t.isDefaultPrevented()||l.one(d.HIDDEN,function(){e(s).is(":visible")&&s.focus()})});g._jQueryInterface.call(e(n),r,this)}),e.fn.modal=g._jQueryInterface,e.fn.modal.Constructor=g,e.fn.modal.noConflict=function(){return e.fn.modal=a,g._jQueryInterface},g}(e)});