1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).phonon=e()}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function t(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function d(o,s,a,l){return new(a||(a=Promise))(function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new a(function(t){t(e.value)}).then(n,i)}r((l=l.apply(o,s||[])).next())})}function u(n,i){var r,o,s,t,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=i.call(n,a)}catch(t){e=[6,t],o=0}finally{r=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var e={elementEvent:function(t,e,n,i){void 0===i&&(i={});var r=e+".ph."+n;t.dispatchEvent(new CustomEvent(r,{detail:i}))},pageEvent:function(t,e,n){void 0===n&&(n={});var i=e+"."+t;window.dispatchEvent(new CustomEvent(i,{detail:n})),document.dispatchEvent(new CustomEvent(i,{detail:n}))},winDocEvent:function(t,e,n){void 0===n&&(n={});var i=t+".ph."+e;window.dispatchEvent(new CustomEvent(i,{detail:n})),document.dispatchEvent(new CustomEvent(i,{detail:n}))}};var n=["mousedown","mousemove","mouseup"],r=!1;"undefined"!=typeof window&&(("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch)&&(r=!0,n=["touchstart","touchmove","touchend","touchcancel"]),window.navigator.pointerEnabled?n=["pointerdown","pointermove","pointerup","pointercancel"]:window.navigator.msPointerEnabled&&(n=["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerCancel"]));var o=window.document.createElement("div"),s=[{name:"transition",start:"transitionstart",end:"transitionend"},{name:"MozTransition",start:"transitionstart",end:"transitionend"},{name:"msTransition",start:"msTransitionStart",end:"msTransitionEnd"},{name:"WebkitTransition",start:"webkitTransitionStart",end:"webkitTransitionEnd"}].find(function(t){return void 0!==o.style[t.name]}),a=[{name:"animation",start:"animationstart",end:"animationend"},{name:"MozAnimation",start:"animationstart",end:"animationend"},{name:"msAnimation",start:"msAnimationStart",end:"msAnimationEnd"},{name:"WebkitAnimation",start:"webkitAnimationStart",end:"webkitAnimationEnd"}].find(function(t){return void 0!==o.style[t.name]}),l=s?s.start:"transitionstart",c=s?s.end:"transitionend",h=a?a.start:"animationstart",v=a?a.end:"animationend",p={TOUCH_SCREEN:r,NETWORK_ONLINE:"online",NETWORK_OFFLINE:"offline",NETWORK_RECONNECTING:"reconnecting",NETWORK_RECONNECTING_SUCCESS:"reconnect.success",NETWORK_RECONNECTING_FAILURE:"reconnect.failure",SHOW:"show",SHOWN:"shown",HIDE:"hide",HIDDEN:"hidden",HASH:"hash",START:n[0],MOVE:n[1],END:n[2],CANCEL:void 0===n[3]?null:n[3],CLICK:"click",TRANSITION_START:l,TRANSITION_END:c,ANIMATION_START:h,ANIMATION_END:v,ITEM_SELECTED:"itemSelected"};function m(t){return 1===t.nodeType&&"string"==typeof t.className}var g={attrConfig:function(t){if(!t)return null;var e=t.getAttribute("data-config");if(!e)return null;try{return JSON.parse(e)}catch(t){}var n=(e.match(/(\w+)\s*:\s*(["'])?/gim)||[]).map(function(t){return t.replace(/(\w+)\s*:\s*(["'])?/gim,"$1")}),r=e.match(/[^:]+(?=,|$)/gim)||[],o={};return n.forEach(function(t,e){var n=r[e].replace(/ /g,"").replace(/\'|"/g,""),i="";i="true"===n||"false"===n?"true"===n:isNaN(n)?n:parseFloat(n),o[t]=i}),o},removeClasses:function(n,t,i){void 0===i&&(i=null),t.forEach(function(t){var e=i?i+"-"+t:t;n.classList.contains(e)&&n.classList.remove(e)})},closest:function(t,e){Element.prototype.matches;var n=t;do{if(n.matches(e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null},isElement:m},f={};function E(t){return"string"==typeof t?t.toLowerCase():t.constructor.name.toLowerCase()}var y={addComponent:function(t){var e=E(t);f[e]||(f[e]=[]),f[e].push(t)},getComponent:function(t,e){var n=E(t),i=e.element;if(!i)return null;var r="string"==typeof i?document.querySelector(i):i,o=(f[n]||[]).find(function(t){return t.getElement()===r});return o?(e&&o.setProps(e),o):null},removeComponent:function(t,e){var n=E(t),i=(f[n]||[]).findIndex(function(t){return t.getElement()===e});-1!==i&&(f[n][i].destroy(),f[n].splice(i,1))}},b=[];function S(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var r=t[e];r&&r.apply(r,n)}function L(t,e){void 0===e&&(e=!0),function(t,e){if(void 0===e&&(e=!0),null===t.getAttribute("data-no-boot")){var n=t.className.split(" "),i=b.find(function(t){return-1<n.indexOf(t.componentClass)});if(i){var r=e?"onAdded":"onRemoved",o=e?[t,y.addComponent]:[t,y.removeComponent];S.apply(void 0,[i,r].concat(o))}}}(t,e);for(var n=t.firstElementChild;n;){var i=n.nextElementSibling;m(n)&&L(n,e),n=i}}function w(t){return Array.from(t).filter(function(t){return m(t)})}function A(){new MutationObserver(function(t){return t.forEach(function(t){if("attributes"!==t.type){var e=t.addedNodes,n=t.removedNodes;w(e).forEach(function(t){return L(t,!0)}),w(n).forEach(function(t){return L(t,!1)})}})}).observe(document,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}!function(){if("MutationObserver"in window)if(document.body)A();else{var t=new MutationObserver(function(){document.body&&(t.disconnect(),A())});t.observe(document,{childList:!0,subtree:!0})}}();var C={subscribe:function(e){b.push(e),document.body&&Array.from(document.body.querySelectorAll("."+e.componentClass)||[]).filter(function(t){return null===t.getAttribute("data-no-boot")}).forEach(function(t){S(e,"onAdded",t,y.addComponent)})},getComponent:y.getComponent};"undefined"!=typeof window&&window.addEventListener("error",function(t){console.error("-- Phonon Error --"),console.error("An error has occured! You can pen an issue here: https://github.com/quark-dev/Phonon-Framework/issues"),console.error(JSON.stringify(t))});var I={sleep:function(e){return new Promise(function(t){setTimeout(t,e)})},Event:p,Dispatch:e,Selector:g,Observer:C},T=(N.prototype.setTemplate=function(t){this.template=t},N.prototype.getTemplate=function(){return this.template},N.prototype.getElement=function(){return this.getProp("element")||null},N.prototype.setElement=function(t){this.props.element=t},N.prototype.getId=function(){return this.id},N.prototype.uid=function(){return Math.random().toString(36).substr(2,10)},N.prototype.getName=function(){return this.name},N.prototype.getProps=function(){return this.props},N.prototype.getProp=function(t){var e=this.defaultProps[t];return void 0!==this.props[t]?this.props[t]:e},N.prototype.setProps=function(t){var e=Object.assign({},t);this.props=Object.assign(this.props,e)},N.prototype.setProp=function(t,e){if(void 0===this.props[t])throw new Error("Cannot set an invalid prop");this.props[t]=e},N.prototype.registerElements=function(t){var e=this;t.forEach(function(t){return e.registerElement(t)})},N.prototype.registerElement=function(t){t.target.addEventListener(t.event,this.elementListener),this.registeredElements.push(t)},N.prototype.unregisterElements=function(){var e=this;this.registeredElements.forEach(function(t){e.unregisterElement(t)})},N.prototype.unregisterElement=function(e){var t=this.registeredElements.findIndex(function(t){return t.target===e.target&&t.event===e.event});-1<t?(e.target.removeEventListener(e.event,this.elementListener),this.registeredElements.splice(t,1)):console.error("Warning! Could not remove element: "+e.target+" with event: "+e.event+".")},N.prototype.triggerEvent=function(t,e,n){var i=this;void 0===e&&(e={}),void 0===n&&(n=!1);var r=t.split(".").reduce(function(t,e,n){return 0===n?e:t+e.charAt(0).toUpperCase()+e.slice(1)}),o="on"+r.charAt(0).toUpperCase()+r.slice(1),s=this.getProps();if(this.eventHandlers.forEach(function(t){"function"==typeof t[r]&&t[r].apply(i,[e]),"function"==typeof t[o]&&s[o].apply(i,[e])}),!n){var a=this.getElement();a?I.Dispatch.elementEvent(a,t,this.name,e):I.Dispatch.winDocEvent(t,this.name,e)}},N.prototype.preventClosable=function(){return!1},N.prototype.destroy=function(){this.unregisterElements()},N.prototype.onElementEvent=function(t){},N.prototype.setEventsHandler=function(){var n=this.getProps(),t=Object.keys(n).reduce(function(t,e){return"function"==typeof n[e]&&(t[e]=n[e]),t},{});0<Object.keys(t).length&&this.eventHandlers.push(t)},N.prototype.onBeforeElementEvent=function(t){this.preventClosable()||this.onElementEvent(t)},N);function N(t,e,n){var i=this;this.template="",this.id=null,this.eventHandlers=[],this.registeredElements=[],this.name=t;var r="string"==typeof n.element?document.querySelector(n.element):n.element,o={};if(r){var s=I.Selector.attrConfig(r);s&&(o=s)}this.defaultProps=e,this.props=Object.assign(e,o,n,{element:r}),this.id=this.uid(),this.elementListener=function(t){return i.onBeforeElementEvent(t)},this.setEventsHandler()}var O,P=(t(x,O=T),x.attachDOM=function(){var s="collapse";I.Observer.subscribe({componentClass:s,onAdded:function(t,e){e(new x({element:t}))},onRemoved:function(t,e){e("Collapse",t)}}),document.addEventListener(I.Event.CLICK,function(t){if(t.target){var e=I.Selector.closest(t.target,"[data-toggle]");if(e){var n=e.getAttribute("data-toggle");if(n&&n===s){var i=e.getAttribute("data-target")||e.getAttribute("href");if(!i)return;t.preventDefault();var r=document.querySelector(i);if(!r)return;var o=I.Observer.getComponent(s,{element:r});if(!o)return;o.toggle({element:r,toggle:!0})}}}})},x.prototype.getHeight=function(){return this.getElement().getBoundingClientRect(this.getElement()).height},x.prototype.toggle=function(){return this.isVisible()?this.hide():this.show()},x.prototype.show=function(){var t=this,e=this.getElement();if(e.classList.contains("collapsing")||this.isVisible())return!1;this.triggerEvent(I.Event.SHOW);var n=function(){t.triggerEvent(I.Event.SHOWN),e.classList.add("show"),e.classList.remove("collapsing"),e.removeEventListener(I.Event.TRANSITION_END,n),e.setAttribute("aria-expanded",!0),e.style.height="auto"};e.classList.contains("collapsing")||e.classList.add("collapsing"),e.addEventListener(I.Event.TRANSITION_END,n);var i=this.getHeight();return e.style.height="0px",setTimeout(function(){e.style.height=i+"px"},20),!0},x.prototype.hide=function(){var t=this,e=this.getElement();if(e.classList.contains("collapsing"))return!1;if(!e.classList.contains("show"))return!1;this.triggerEvent(I.Event.HIDE);var n=function(){t.triggerEvent(I.Event.HIDDEN),e.classList.remove("collapsing"),e.style.height="auto",e.removeEventListener(I.Event.TRANSITION_END,n),e.setAttribute("aria-expanded",!1)};return e.style.height=e.offsetHeight+"px",setTimeout(function(){e.style.height="0px"},20),e.addEventListener(I.Event.TRANSITION_END,n),e.classList.contains("collapsing")||e.classList.add("collapsing"),e.classList.remove("show"),!0},x.prototype.isVisible=function(){return this.getElement().classList.contains("show")},x);function x(t){void 0===t&&(t={toggle:!1});var e=O.call(this,"collapse",{toggle:!1},t)||this;return e.getProp("toggle")&&e.toggle(),e}P.attachDOM();var D,k=(t(q,D=T),q.attachDOM=function(){I.Observer.subscribe({componentClass:"accordion",onAdded:function(t,e){e(new q({element:t}))},onRemoved:function(t,e){e("Accordion",t)}})},q.prototype.addCollapse=function(t){var e=new P({element:t});return this.collapses.push(e),e},q.prototype.getCollapse=function(e){var n=this.getElement(),t=this.collapses.find(function(t){return n.getAttribute("id")===e.getAttribute("id")});return t||(t=this.addCollapse(e)),t},q.prototype.getCollapses=function(){return this.collapses},q.prototype.setCollapses=function(t){var e=this,n=(this.getElement(),this.getCollapse(t));this.getProp("multiple")||this.collapses.filter(function(t){return t.getElement()!==n.getElement()}).forEach(function(t){e.toggleIcon(t.getElement(),"icon-minus","icon-plus"),t.hide()});var i=n.isVisible();this.toggleIcon(n.getElement(),i?"icon-minus":"icon-plus",i?"icon-plus":"icon-minus"),n.toggle()},q.prototype.onElementEvent=function(t){var e=t.target,n=I.Selector.closest(e,'[data-toggle="accordion"]');if(n){var i=n.getAttribute("data-target")||n.getAttribute("href");if(i){var r=document.querySelector(i);I.Selector.closest(n,".accordion")&&r&&(t.preventDefault(),this.show(r))}}},q.prototype.toggleIcon=function(t,e,n){var i='[data-toggle="accordion"][href="#'+t.getAttribute("id")+'"] .collapse-toggle',r=document.querySelector(i);r&&r.classList.contains(e)&&(r.classList.remove(e),r.classList.add(n))},q.prototype.show=function(t){var e=t;if("string"==typeof t&&(e=document.querySelector(t)),!e)throw new Error("The collapsible "+t+" is an invalid HTMLElement.");return this.setCollapses(e),!0},q.prototype.hide=function(t){var e=t;if("string"==typeof t&&(e=document.querySelector(t)),!e)throw new Error("The collapsible "+t+" is an invalid HTMLElement.");return this.getCollapse(e).hide()},q);function q(t){var i=D.call(this,"accordion",{multiple:!1},t)||this;i.collapses=[];var e=i.getElement();return Array.from(e.querySelectorAll('[data-toggle="accordion"]')||[]).forEach(function(t){var e=t.getAttribute("href")||t.getAttribute("data-target");if(null===e)throw new Error("Accordion: collapse is missing href or data-target attribute");var n=document.querySelector(e);n&&i.addCollapse(n)}),i.registerElement({target:e,event:I.Event.CLICK}),i}k.attachDOM();var H,R,M,_,W,B,K,j=(t(V,H=T),V.attachDOM=function(){I.Observer.subscribe({componentClass:"alert",onAdded:function(t,e){e(new V({element:t}))},onRemoved:function(t,e){e("Alert",t)}})},V.prototype.show=function(){var e=this;if(this.onTransition)return!1;var n=this.getElement();if(n.classList.contains("show")&&0!==this.getOpacity())return!1;this.onTransition=!0,this.triggerEvent(I.Event.SHOW);var i=function(){e.triggerEvent(I.Event.SHOWN),n.classList.contains("fade")&&n.classList.remove("fade");var t=I.Selector.closest(e.getElement(),'[data-dismiss="alert"]');t&&e.registerElement({target:t,event:I.Event.CLICK}),n.removeEventListener(I.Event.TRANSITION_END,i),e.onTransition=!1},t=this.getProp("fade");return t&&!n.classList.contains("fade")&&n.classList.add("fade"),n.classList.add("show"),n.addEventListener(I.Event.TRANSITION_END,i),n.classList.contains("hide")&&n.classList.remove("hide"),t||i(),!0},V.prototype.hide=function(t){var e=this;if(this.onTransition||0===this.getOpacity())return!1;this.onTransition=!0;var n=t||this.getElement();this.triggerEvent(I.Event.HIDE);var i=function(){e.triggerEvent(I.Event.HIDDEN),n.removeEventListener(I.Event.TRANSITION_END,i),e.onTransition=!1},r=this.getProp("fade");return r&&!n.classList.contains("fade")&&n.classList.add("fade"),n.addEventListener(I.Event.TRANSITION_END,i),n.classList.contains("hide")||n.classList.add("hide"),n.classList.contains("show")&&n.classList.remove("show"),r||i(),!0},V.prototype.onElementEvent=function(t){t.type===I.Event.CLICK&&this.hide()},V.prototype.destroy=function(){this.unregisterElements(),this.hide()},V.prototype.getOpacity=function(){var t=this.getElement(),e=window.getComputedStyle(t).opacity;return parseFloat(e||"")},V);function V(t){void 0===t&&(t={fade:!0});var e=H.call(this,"alert",{fade:!0},t)||this;if(e.onTransition=!1,0!==e.getOpacity()){var n=e.getElement().querySelector('[data-dismiss="alert"]');n&&e.registerElement({target:n,event:I.Event.CLICK})}return e}j.attachDOM(),(M=R||(R={})).sm="sm",M.md="md",M.lg="lg",M.xl="xl",(W=_||(_={})).primary="primary",W.secondary="secondary",W.success="success",W.warning="warning",W.danger="danger",(K=B||(B={})).top="top",K.right="right",K.bottom="bottom",K.left="left";var z,G=(t(F,z=T),F.prototype.show=function(){var t=this.getElement();t.classList.contains("hide")&&t.classList.remove("hide"),this.triggerEvent(I.Event.SHOW);var e=this.getProp("size");I.Selector.removeClasses(t,Object.values(R),"loader"),t.classList.add("loader-"+e);var n=this.getProp("color"),i=this.getSpinner();return I.Selector.removeClasses(i,Object.values(_),"loader"),i.classList.add("loader-"+n),this.triggerEvent(I.Event.SHOWN),!0},F.prototype.animate=function(t){void 0===t&&(t=!0),t?this.show():this.hide();var e=this.getSpinner();return t&&!e.classList.contains("loader-spinner-animated")?e.classList.add("loader-spinner-animated"):!t&&e.classList.contains("loader-spinner-animated")&&e.classList.remove("loader-spinner-animated"),!0},F.prototype.hide=function(){var t=this.getElement();return t.classList.contains("hide")||t.classList.add("hide"),this.triggerEvent(I.Event.HIDE),this.triggerEvent(I.Event.HIDDEN),!0},F.prototype.getSpinner=function(){return this.getElement().querySelector(".loader-spinner")},F);function F(t){return void 0===t&&(t={color:_.primary,size:R.md}),z.call(this,"loader",{fade:!0,size:R.md,color:_.primary},t)||this}var U,Y=(t(X,U=T),X.attachDOM=function(){var s="modal";I.Observer.subscribe({componentClass:s,onAdded:function(t,e){e(new X({element:t}))},onRemoved:function(t,e){e("Modal",t)}}),document.addEventListener(I.Event.CLICK,function(t){var e=t.target;if(e){var n=I.Selector.closest(e,'[data-toggle="modal"]');if(n){var i=n.getAttribute("data-target");if(!i)return;var r=document.querySelector(i);if(!r)return;var o=I.Observer.getComponent(s,{element:r});if(!o)return;e.blur(),o.show()}}})},X.prototype.build=function(){var e=this;this.elementGenerated=!0;var t=document.createElement("div");t.innerHTML=this.getTemplate(),this.setElement(t.firstChild);var n=this.getElement(),i=this.getProp("title");null!==i&&(n.querySelector(".modal-title").innerHTML=i);var r=this.getProp("message");null!==r?n.querySelector(".modal-body").firstChild.innerHTML=r:this.removeTextBody(),this.getProp("cancelable")||(n.querySelector(".close").style.display="none");var o=this.getProp("buttons");Array.isArray(o)&&0<o.length?o.forEach(function(t){n.querySelector(".modal-footer").appendChild(e.buildButton(t))}):this.removeFooter(),document.body.appendChild(n)},X.prototype.show=function(){var t=this,i=this.getElement();return null===i&&this.build(),!i.classList.contains("show")&&(document.body.style.overflow="hidden",d(t,void 0,void 0,function(){var e,n=this;return u(this,function(t){switch(t.label){case 0:return[4,I.sleep(20)];case 1:return t.sent(),this.triggerEvent(I.Event.SHOW),this.buildBackdrop(),this.attachEvents(),e=function(){n.triggerEvent(I.Event.SHOWN),i.removeEventListener(I.Event.TRANSITION_END,e)},i.addEventListener(I.Event.TRANSITION_END,e),this.getProp("center")&&this.center(),i.classList.add("show"),[2]}})}),!0)},X.prototype.hide=function(){var t=this,e=this.getElement();if(!e.classList.contains("show"))return!1;document.body.style.overflow="visible",this.triggerEvent(I.Event.HIDE),this.detachEvents(),e.classList.add("hide"),e.classList.remove("show");var n=this.getBackdrop(),i=function(){n&&(document.body.removeChild(n),n.removeEventListener(I.Event.TRANSITION_END,i)),e.classList.remove("hide"),t.triggerEvent(I.Event.HIDDEN),t.elementGenerated&&document.body.removeChild(e)};return n&&(n.addEventListener(I.Event.TRANSITION_END,i),n.classList.add("fadeout")),!0},X.prototype.onElementEvent=function(e){if("keyup"!==e.type)if(e.type!==I.Event.START){if(e.type===I.Event.CLICK){var t=e.target,n=t.getAttribute("data-event");n&&this.triggerEvent(n);var i=I.Selector.closest(t,"[data-dismiss]");i&&"modal"===i.getAttribute("data-dismiss")&&this.hide()}}else this.hide();else this.getProp("cancelableKeyCodes").find(function(t){return t===e.keyCode})&&this.hide()},X.prototype.setBackgroud=function(){var t=this.getElement(),e=this.getProp("background");e&&(t.classList.contains("modal-"+e)||t.classList.add("modal-"+e),t.classList.contains("text-white")||t.classList.add("text-white"))},X.prototype.buildButton=function(t){var e=document.createElement("button");return e.setAttribute("type","button"),e.setAttribute("class",t.class||"btn"),e.setAttribute("data-event",t.event),e.innerHTML=t.text,t.dismiss&&e.setAttribute("data-dismiss","modal"),e},X.prototype.buildBackdrop=function(){var t=document.createElement("div");t.setAttribute("data-id",this.getId()),t.classList.add(this.backdropSelector),document.body.appendChild(t)},X.prototype.getBackdrop=function(){return document.querySelector("."+this.backdropSelector+'[data-id="'+this.getId()+'"]')},X.prototype.removeTextBody=function(){var t=this.getElement();t.querySelector(".modal-body").removeChild(t.querySelector(".modal-body").firstChild)},X.prototype.removeFooter=function(){var t=this.getElement(),e=t.querySelector(".modal-footer");t.querySelector(".modal-content").removeChild(e)},X.prototype.center=function(){var t=this.getElement(),e=window.getComputedStyle(t);if(e&&e.height){var n=e.height.slice(0,e.height.length-2),i=window.innerHeight/2-parseFloat(n)/2;t.style.top=i+"px"}},X.prototype.attachEvents=function(){var e=this,t=this.getElement();Array.from(t.querySelectorAll("[data-dismiss], .modal-footer button")||[]).forEach(function(t){return e.registerElement({target:t,event:I.Event.CLICK})});var n=this.getProp("cancelable"),i=this.getBackdrop();n&&i&&(this.registerElement({target:i,event:I.Event.START}),this.registerElement({target:document,event:"keyup"}))},X.prototype.detachEvents=function(){var e=this,t=this.getElement();if(Array.from(t.querySelectorAll("[data-dismiss], .modal-footer button")||[]).forEach(function(t){return e.unregisterElement({target:t,event:I.Event.CLICK})}),this.getProp("cancelable")){var n=this.getBackdrop();this.unregisterElement({target:n,event:I.Event.START}),this.unregisterElement({target:document,event:"keyup"})}},X);function X(t,e){void 0===e&&(e=!0);var n=U.call(this,"modal",{title:null,message:null,cancelable:!0,background:null,cancelableKeyCodes:[27,13],buttons:[{event:"confirm",text:"Ok",dismiss:!0,class:"btn btn-primary"}],center:!0},t)||this;return n.backdropSelector="modal-backdrop",n.elementGenerated=!1,n.setTemplate('<div class="modal" tabindex="-1" role="modal" data-no-boot><div class="modal-inner" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title"></h5><button type="button" class="icon-close" data-dismiss="modal" aria-label="Close"><span class="icon" aria-hidden="true"></span></button></div><div class="modal-body"><p></p></div><div class="modal-footer"></div></div></div></div>'),e&&null===n.getElement()&&n.build(),n}Y.attachDOM();var J,$=(t(Q,J=Y),Q);function Q(t){var e=J.call(this,Object.assign({buttons:[{event:"cancel",text:"Cancel",dismiss:!0,class:"btn btn-secondary"},{event:"confirm",text:"Ok",dismiss:!0,class:"btn btn-primary"}]},t),!1)||this;return e.setTemplate('<div class="modal" tabindex="-1" role="modal" data-no-boot><div class="modal-inner" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title"></h5><button type="button" class="icon-close" data-dismiss="modal" aria-label="Close"><span class="icon" aria-hidden="true"></span></button></div><div class="modal-body"><p></p></div><div class="modal-footer"></div></div></div></div>'),null===e.getElement()&&e.build(),e}var Z,tt=(t(et,Z=Y),et.prototype.show=function(){return Z.prototype.show.call(this),this.loader=new G({element:this.getElement().querySelector(".loader")}),this.loader.animate(!0),!0},et.prototype.hide=function(){return Z.prototype.hide.call(this),this.loader&&this.loader.animate(!1),!(this.loader=null)},et);function et(t){var e=Z.call(this,Object.assign({buttons:[{event:"cancel",text:"Cancel",dismiss:!0,class:"btn btn-secondary"},{event:"confirm",text:"Ok",dismiss:!0,class:"btn btn-primary"}]},t),!1)||this;return e.loader=null,e.setTemplate('<div class="modal" tabindex="-1" role="modal" data-no-boot><div class="modal-inner" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title"></h5><button type="button" class="icon-close" data-dismiss="modal" aria-label="Close"><span class="icon" aria-hidden="true"></span></button></div><div class="modal-body"><p></p><div class="mx-auto text-center"><div class="loader mx-auto d-block"><div class="loader-spinner"></div></div></div></div><div class="modal-footer"></div></div></div></div>'),null===e.getElement()&&e.build(),e}var nt,it=(t(rt,nt=Y),rt.prototype.show=function(){nt.prototype.show.call(this);var t=this.getProp("inputValue");return"string"==typeof t&&this.setInputValue(t),this.attachInputEvent(),!0},rt.prototype.hide=function(){return nt.prototype.hide.call(this),this.detachInputEvent(),!0},rt.prototype.setInputValue=function(t){void 0===t&&(t=""),this.getInput().value=t},rt.prototype.getInputValue=function(){return this.getInput().value},rt.prototype.onElementEvent=function(t){t.target,this.getInput()},rt.prototype.getInput=function(){return this.getElement().querySelector(".form-control")},rt.prototype.attachInputEvent=function(){this.registerElement({target:this.getInput(),event:"keyup"})},rt.prototype.detachInputEvent=function(){this.unregisterElement({target:this.getInput(),event:"keyup"})},rt);function rt(t){var e=nt.call(this,Object.assign({buttons:[{event:"cancel",text:"Cancel",dismiss:!0,class:"btn btn-secondary"},{event:"confirm",text:"Ok",dismiss:!0,class:"btn btn-primary"}],inputValue:""},t),!1)||this;return e.setTemplate('<div class="modal" tabindex="-1" role="modal" data-no-boot><div class="modal-inner" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title"></h5><button type="button" class="icon-close" data-dismiss="modal" aria-label="Close"><span class="icon" aria-hidden="true"></span></button></div><div class="modal-body"><p></p><input class="form-control" type="text" value=""></div><div class="modal-footer"></div></div></div></div>'),null===e.getElement()&&e.build(),e}var ot,st=(t(at,ot=T),at.attachDOM=function(){I.Observer.subscribe({componentClass:"notification",onAdded:function(t,e){e(new at({element:t}))},onRemoved:function(t,e){e("Notification",t)}})},at.prototype.build=function(){this.elementGenerated=!0;var t=document.createElement("div");t.innerHTML=this.getTemplate(),this.setElement(t.firstChild);var e=this.getElement();e.querySelector(".notification-title").innerHTML=this.getProp("title"),this.getProp("message")?e.querySelector(".notification-body").innerHTML=this.getProp("message"):e.querySelector(".notification-body").style.display="none",this.getProp("button")||(e.querySelector("button").style.display="none"),this.getProp("appendIn").appendChild(e)},at.prototype.setPosition=function(){var t=this.getProp("directionX"),e=this.getProp("directionY"),n=this.getProp("offsetX"),i=this.getProp("offsetY"),r=this.getElement();I.Selector.removeClasses(r,Object.values(B)),r.style.marginLeft="0px",r.style.marginRight="0px",r.classList.add("notification-"+t),r.classList.add("notification-"+e);var o=Array.from(document.querySelectorAll(".notification.show")||[]),s=0;o.forEach(function(t){if(r!==t){var e=getComputedStyle(t),n=parseInt(e.marginTop,10),i=parseInt(e.marginBottom,10);s+=t.offsetHeight+n+i}}),r.style.transform="translateY("+("top"===e?"":"-")+s+"px)",r.style["margin"+t.replace(/^\w/,function(t){return t.toUpperCase()})]=n+"px",r.style["margin"+e.replace(/^\w/,function(t){return t.toUpperCase()})]=i+"px"},at.prototype.show=function(){var t=this;null===this.getElement()&&this.build();var r=this.getElement();if(r.classList.contains("show"))return!1;var e=this.getProp("background");e&&(r.removeAttribute("class"),r.setAttribute("class","notification"),r.classList.add("notification-"+e),r.querySelector("button").classList.add("btn-"+e));var n=r.querySelector("button[data-dismiss]");return this.getProp("button")&&n&&this.registerElement({target:n,event:I.Event.CLICK}),r.querySelector("button[data-dismiss]"),this.registerElement({target:n,event:I.Event.CLICK}),d(t,void 0,void 0,function(){var e,n,i=this;return u(this,function(t){switch(t.label){case 0:return[4,I.sleep(20)];case 1:return t.sent(),this.setPosition(),e=this.getProp("timeout"),Number.isInteger(e)&&0<e&&(this.timeoutCallback=setTimeout(function(){i.hide()},e+1)),r.classList.add("show"),this.triggerEvent(I.Event.SHOW),n=function(){i.triggerEvent(I.Event.SHOWN),r.removeEventListener(I.Event.TRANSITION_END,n)},r.addEventListener(I.Event.TRANSITION_END,n),[2]}})}),!0},at.prototype.hideBody=function(){var t=this.getElement().querySelector(".notification-body");t.classList.contains("show")&&t.classList.remove("show")},at.prototype.hide=function(){var t=this;this.timeoutCallback&&(clearTimeout(this.timeoutCallback),this.timeoutCallback=null);var e=this.getElement();if(!e.classList.contains("show"))return!1;this.triggerEvent(I.Event.HIDE);var n=this.getProp("button"),i=e.querySelector("button[data-dismiss]");n&&i&&this.unregisterElement({target:i,event:I.Event.CLICK}),e.classList.remove("show"),e.classList.add("hide"),this.hideBody();var r=function(){e.removeEventListener(I.Event.TRANSITION_END,r),e.classList.remove("hide"),t.triggerEvent(I.Event.HIDDEN),t.elementGenerated&&document.body.removeChild(e)};return e.addEventListener(I.Event.TRANSITION_END,r),!0},at.prototype.onElementEvent=function(){this.hide()},at);function at(t){void 0===t&&(t={element:null,title:"",button:!0});var e=ot.call(this,"notification",{button:!0,timeout:null,title:"",message:null,background:"primary",appendIn:document.body,directionX:"right",directionY:"top",offsetX:0,offsetY:0},t)||this;return e.timeoutCallback=null,e.elementGenerated=!1,e.setTemplate('<div class="notification" data-no-boot><div class="notification-inner"><div class="notification-header"><h5 class="notification-title"></h5><button type="button" class="icon-close" data-dismiss="notification" aria-label="Close"><span class="icon" aria-hidden="true"></span></button></div><div class="notification-body"></div></div></div>'),null===e.getElement()&&e.build(),e}var lt,ct=(t(dt,lt=T),dt.attachDOM=function(){var s="offcanvas";I.Observer.subscribe({componentClass:s,onAdded:function(t,e){e(new dt({element:t}))},onRemoved:function(t,e){e("OffCanvas",t)}}),document.addEventListener(I.Event.CLICK,function(t){var e=t.target;if(e){var n=I.Selector.closest(e,'[data-toggle="'+s+'"]');if(n){var i=n.getAttribute("data-target");if(!i)return;var r=document.querySelector(i);if(!r)return;var o=I.Observer.getComponent(s,{element:r});if(!o)return;e.blur(),o.toggle()}}})},dt.prototype.checkDirection=function(){var e=this,n=this.getElement();this.directions.every(function(t){return!n.classList.contains("offcanvas-"+t)||(e.direction=t,!1)})},dt.prototype.checkWidth=function(){if("matchMedia"in window){var t=this.sizes.find(function(t){var e=t.media;return!(!e.media.match(/[a-z]?-width:\s?([0-9]+)/)||!e.matches)});t&&this.setAside(t.name)}},dt.prototype.setAside=function(t){var e=this.getContainer();if(this.currentWidthName!==t&&e){this.currentWidthName=t;var n=this.getProp("aside");if(this.showAside=!0===n[t],!0===n[t]){e.classList.contains("offcanvas-aside-"+this.direction)||e.classList.add("offcanvas-aside-"+this.direction),this.animate=!1,this.getBackdrop()&&this.removeBackdrop();var i=this.getShowClass();this.isVisible()&&!e.classList.contains(i)?e.classList.add(i):!this.isVisible()&&e.classList.contains(i)&&e.classList.remove(i)}else e.classList.contains("offcanvas-aside-"+this.direction)&&e.classList.remove("offcanvas-aside-"+this.direction),this.animate=!0,this.hide()}},dt.prototype.onElementEvent=function(e){var t=this.getProp("closableKeyCodes");"keyup"===e.type&&!t.find(function(t){return t===e.keyCode})||this.hide()},dt.prototype.isVisible=function(){return this.getElement().classList.contains("show")},dt.prototype.show=function(){var t=this;return!this.getElement().classList.contains("show")&&(this.triggerEvent(I.Event.SHOW),this.showAside||this.createBackdrop(),d(t,void 0,void 0,function(){var e,n,i,r,o=this;return u(this,function(t){switch(t.label){case 0:return[4,I.sleep(20)];case 1:return t.sent(),this.attachEvents(),e=function(){if(o.triggerEvent(I.Event.SHOWN),o.animate){var t=o.getElement();t.removeEventListener(I.Event.TRANSITION_END,e),t.classList.remove("animate")}},this.showAside&&(n=this.getContainer(),i=this.getShowClass(),n&&!n.classList.contains(i)&&n.classList.add(i)),r=this.getElement(),this.animate?(r.addEventListener(I.Event.TRANSITION_END,e),r.classList.add("animate")):e(),r.classList.add("show"),[2]}})}),!0)},dt.prototype.hide=function(){var t=this,e=this.getElement();if(!e.classList.contains("show"))return!1;if(this.triggerEvent(I.Event.HIDE),this.detachEvents(),this.animate&&e.classList.add("animate"),e.classList.remove("show"),this.showAside){var n=this.getContainer(),i=this.getShowClass();n&&n.classList.contains(i)&&n.classList.remove(i)}if(!this.showAside){var r=this.getBackdrop();if(!r)return!0;var o=function(){t.animate&&e.classList.remove("animate"),r.removeEventListener(I.Event.TRANSITION_END,o),t.triggerEvent(I.Event.HIDDEN),t.removeBackdrop()};r&&(r.addEventListener(I.Event.TRANSITION_END,o),r.classList.add("fadeout"))}return!0},dt.prototype.toggle=function(){return this.isVisible()?this.hide():this.show()},dt.prototype.createBackdrop=function(){var t=document.createElement("div"),e=this.getId();e&&t.setAttribute("data-id",e),t.classList.add(this.backdropSelector);var n=this.getContainer();n&&n.appendChild(t)},dt.prototype.getBackdrop=function(){return document.querySelector("."+this.backdropSelector+'[data-id="'+this.getId()+'"]')},dt.prototype.removeBackdrop=function(){var t=this.getBackdrop();t&&t.parentNode&&t.parentNode.removeChild(t)},dt.prototype.attachEvents=function(){var e=this,t=this.getElement();Array.from(t.querySelectorAll("[data-dismiss]")||[]).forEach(function(t){return e.registerElement({target:t,event:I.Event.CLICK})});var n=this.getBackdrop();!this.showAside&&n&&this.registerElement({target:n,event:I.Event.START}),this.registerElement({target:document,event:"keyup"})},dt.prototype.detachEvents=function(){var e=this,t=this.getElement().querySelectorAll("[data-dismiss]");t&&Array.from(t).forEach(function(t){return e.unregisterElement({target:t,event:I.Event.CLICK})});var n=this.getBackdrop();!this.showAside&&n&&this.unregisterElement({target:n,event:I.Event.START}),this.unregisterElement({target:document,event:"keyup"})},dt.prototype.getContainer=function(){var t=this.getProp("container");return"string"==typeof t&&(t=document.querySelector(t)),t},dt.prototype.getShowClass=function(){return"show-"+this.direction},dt);function dt(t){var e=lt.call(this,"off-canvas",{toggle:!1,closableKeyCodes:[27],container:document.body,setupContainer:!0,aside:{md:!1,lg:!0,xl:!0}},t)||this;e.currentWidthName=null,e.animate=!0,e.showAside=!1,e.directions=["left","right"],e.direction=null,e.sizes=[],e.backdropSelector="offcanvas-backdrop";var n={name:"sm",media:window.matchMedia("(min-width: 1px)")},i={name:"md",media:window.matchMedia("(min-width: 768px)")},r={name:"lg",media:window.matchMedia("(min-width: 992px)")},o={name:"xl",media:window.matchMedia("(min-width: 1200px)")};return e.sizes=[n,i,r,o].reverse(),e.checkDirection(),e.getProp("setupContainer")&&e.checkWidth(),e.getProp("toggle")&&e.toggle(),window.addEventListener("resize",function(){return e.checkWidth()},!1),e}ct.attachDOM();var ut,ht=(t(vt,ut=T),vt.attachDOM=function(){I.Observer.subscribe({componentClass:"progress",onAdded:function(t,e){e(new vt({element:t}))},onRemoved:function(t,e){e("Progress",t)}})},vt.prototype.set=function(t){void 0===t&&(t=0);var e=this.getProgressBar(),n=this.getProp("min"),i=this.getProp("max"),r=Math.round(t/(n+i)*100);return t<n?(console.error("Progress: Warning, "+t+" is under min value."),!1):i<t?(console.error("Progress: Warning, "+t+" is above max value."),!1):(e.setAttribute("aria-valuenow",""+t),this.getProp("label")&&(e.innerHTML=r+"%"),e.style.width=r+"%",!0)},vt.prototype.animateProgressBar=function(t){if(void 0===t&&(t=!0),!this.getProp("striped"))throw new Error("Progress: Animation works only with striped progress.");var e=this.getProgressBar();return t&&!e.classList.contains("progress-bar-animated")&&e.classList.add("progress-bar-animated"),!t&&e.classList.contains("progress-bar-animated")&&e.classList.remove("progress-bar-animated"),!0},vt.prototype.show=function(){return this.getElement().style.height=this.getProp("height")+"px",this.triggerEvent(I.Event.SHOW),this.triggerEvent(I.Event.SHOWN),!0},vt.prototype.hide=function(){return this.getElement().style.height="0px",this.triggerEvent(I.Event.HIDE),this.triggerEvent(I.Event.HIDDEN),!0},vt.prototype.destroy=function(){this.unregisterElements(),this.hide()},vt.prototype.setHeight=function(){this.getElement().style.height=this.getProp("height")+"px"},vt.prototype.setAccessibility=function(){var t=this.getElement();t.setAttribute("aria-valuemin",""+this.getProp("min")),t.setAttribute("aria-valuemax",""+this.getProp("max"))},vt.prototype.setStriped=function(){this.getProgressBar().classList.add("progress-bar-striped"),this.getProp("animate")&&this.animateProgressBar()},vt.prototype.setBackground=function(){var t=this.getProgressBar(),e=this.getProp("background");t.classList.contains("bg-"+e)&&t.classList.add("bg-"+e)},vt.prototype.getProgressBar=function(){return this.getElement().querySelector(".progress-bar")},vt);function vt(t){var e=ut.call(this,"progress",{height:8,min:0,max:100,now:0,label:!1,striped:!1,animate:!0,background:null},t)||this;return e.onTransition=!1,e.setHeight(),e.setAccessibility(),e.getProp("striped")&&e.setStriped(),e.getProp("background")&&e.setBackground(),e.set(e.getProp("now")),e}ht.attachDOM();var pt,mt=(t(gt,pt=T),gt.attachDOM=function(){I.Observer.subscribe({componentClass:"selectbox",onAdded:function(t,e){e(new gt({element:t}))},onRemoved:function(t,e){e("Selectbox",t)}})},gt.prototype.getSearchInput=function(){return this.getElement().querySelector(".input-select-one")},gt.prototype.filterItems=function(t,e){return void 0===t&&(t=""),-1<e.value.indexOf(t)||-1<e.text.indexOf(t)},gt.prototype.showItems=function(){this.getItems().forEach(function(t){t.element.style.display="block"})},gt.prototype.getItems=function(){var n=this;return Array.from(this.getElement().querySelectorAll(".selectbox-menu-item")||[]).map(function(t){var e=n.getItemData(t);return{text:e.text,value:e.value,element:t}})},gt.prototype.setSelected=function(t,e){if(void 0===t&&(t=""),void 0===e&&(e=""),!this.getProp("selectable"))return!1;var n=this.getElement();this.getProp("multiple")?this.addItemSelection(t):0===Array.from(n.querySelectorAll(".selectbox-item-selection .item-selected")||[]).length&&this.addItemSelection(t);var i=n.querySelector(".selectbox-item-selection .item-selected:last-child"),r=i.querySelector("[data-value]");r?r.innerHTML=e:i.innerHTML=e;var o=Array.from(this.getElement().querySelectorAll('input[type="hidden"]')||[]).slice(-1).pop();return o&&o.setAttribute("value",t),this.updateActiveList(),this.setSearchInputWidth(),this.getSearchInput(),""===t?this.showPlaceholder():this.showPlaceholder(!1),!0},gt.prototype.getSelected=function(){var t=Array.from(this.getElement().querySelectorAll('input[type="hidden"]')||[]);return this.getProp("multiple")?t.map(function(t){return t.value}):0<t.length?t[0].value:""},gt.prototype.setSearchInputWidth=function(){if(this.searchInputInContainer){var t=this.getElement(),e=t.querySelector(".selectbox-item-selection"),n=t.offsetWidth-e.offsetWidth,i=this.getSearchInput();if(!i)throw new Error("Selectbox: search input is not defined");var r=Array.from(t.querySelectorAll(".item-selected")||[]).reduce(function(t,e){return t+e.offsetWidth},0);0<n&&(i.style.width="calc(100% - "+(r+15)+"px)"),i.style.left=r+"px"}},gt.prototype.getItemData=function(t){void 0===t&&(t=null);var e="",n="";if(t){e=t.getAttribute("data-text")||t.innerHTML;var i=t.querySelector(".text");i&&(e=i.innerHTML),n=t.getAttribute("data-value")||""}return{text:e,value:n}},gt.prototype.onElementEvent=function(t){var e=t.target;if(t.type===I.Event.START){var n=I.Selector.closest(e,".selectbox");n&&n===this.getElement()||this.hide()}else if(t.type===I.Event.CLICK){var i=e.getAttribute("data-toggle");if(i&&"selectbox"===i)return void this.toggle();if(I.Selector.closest(e,'[data-dismiss="selectbox"]'))return void this.hide();var r=I.Selector.closest(e,".icon-close");if(r)return void this.removeSelected(r.parentNode);var o=I.Selector.closest(e,".selectbox-menu-item");if(o&&!o.classList.contains("disabled")){var s=this.getItemData(o);if(this.getSelected()!==s.value){this.setSelected(s.value,s.text),this.getElement().querySelector(".input-select-one").value="";var a={item:o,text:s.text,value:s.value};this.triggerEvent(I.Event.ITEM_SELECTED,a)}return void this.hide()}if(I.Selector.closest(e,".selectbox-menu"))return;this.toggle()}else if("keyup"===t.type&&8===t.keyCode){if(""!==t.target.value)return;if(!this.searchInputInContainer)return;this.removeLastSelected()}},gt.prototype.addItemSelection=function(t){var e=document.createElement("div");if(e.classList.add("item-selected"),this.getProp("tag")){e.classList.add("tag");var n=document.createElement("span");n.setAttribute("data-value","true"),e.appendChild(n);var i=document.createElement("button");i.setAttribute("type","button"),i.classList.add("icon-close");var r=document.createElement("span");r.setAttribute("class","icon"),r.setAttribute("aria-hidden","true"),i.appendChild(r),e.appendChild(i)}this.getElement().querySelector(".selectbox-item-selection").appendChild(e);var o=this.getElement(),s=Array.from(o.querySelectorAll('input[type="hidden"]')||[]),a=0<s.length?s[s.length-1]:null;if(!this.getProp("multiple")&&!a||this.getProp("multiple")){var l=document.createElement("input");l.setAttribute("type","hidden");var c=this.getProp("name");l.setAttribute("name",this.getProp("multiple")?c+"[]":c),l.setAttribute("value",t),o.insertBefore(l,a?a.nextSibling:o.firstChild)}},gt.prototype.removeLastSelected=function(){var t=this.getElement(),e=Array.from(t.querySelectorAll(".selectbox-item-selection .item-selected")||[]);if(0!==e.length){var n=e[e.length-1];this.removeSelected(n)}},gt.prototype.removeSelected=function(t){var e=this.getElement(),n=Array.from(e.querySelectorAll(".selectbox-item-selection .item-selected")||[]);if(0!==n.length){if(e.querySelector(".selectbox-item-selection").removeChild(t),this.getProp("multiple")){var i=this.getSelected(),r=e.querySelector('input[type="hidden"][value="'+i.slice(-1).pop()+'"]');this.getElement().removeChild(r)}else r=e.querySelector('input[type="hidden"]'),!this.getProp("multiple")&&r&&r.setAttribute("value","");this.updateActiveList(),this.setSearchInputWidth(),1===n.length&&this.showPlaceholder()}},gt.prototype.showPlaceholder=function(t){void 0===t&&(t=!0);var e=this.getSearchInput();e&&(t&&e.classList.contains("hide-placeholder")?e.classList.remove("hide-placeholder"):t||e.classList.contains("hide-placeholder")||e.classList.add("hide-placeholder"))},gt.prototype.updateActiveList=function(){var n=this,t=this.getSelected(),i=Array.isArray(t)?t:[t];Array.from(this.getElement().querySelectorAll(".selectbox-menu-item")||[]).forEach(function(t){var e=n.getItemData(t);-1<i.indexOf(e.value)?t.classList.contains("selected")||t.classList.add("selected"):t.classList.contains("selected")&&t.classList.remove("selected")})},gt.prototype.toggle=function(){return this.getElement().classList.contains("active")?this.hide():this.show()},gt.prototype.show=function(){var t=this.getElement();if(t.classList.contains("active"))return!1;t.classList.add("active");var e=t.querySelector(".selectbox-menu"),n=this.getSearchInput();e.scrollTop=0,this.triggerEvent(I.Event.SHOW),this.triggerEvent(I.Event.SHOWN),this.registerElement({target:document.body,event:I.Event.START}),n&&(this.registerElement({target:n,event:"keyup"}),n.addEventListener("keyup",this.filterItemsHandler),n.focus());var i=t.querySelector('[data-dismiss="selectbox"]');return i&&this.registerElement({target:i,event:I.Event.CLICK}),!0},gt.prototype.hide=function(){var t=this.getElement();if(!t.classList.contains("active"))return!1;t.classList.remove("active"),this.triggerEvent(I.Event.HIDE),this.triggerEvent(I.Event.HIDDEN),this.unregisterElement({target:document.body,event:I.Event.START});var e=t.querySelector('[data-dismiss="selectbox"]');e&&this.unregisterElement({target:e,event:I.Event.CLICK});var n=this.getSearchInput();return n&&(n.removeEventListener("keyup",this.filterItemsHandler),n.value="",this.unregisterElement({target:n,event:"keyup"})),this.showItems(),!0},gt);function gt(t){var i=pt.call(this,"selectbox",{name:null,selectable:!0,filterItems:null,multiple:!1,tag:!1},t)||this;if(!i.getProp("name")){var e=i.getElement().querySelector('input[type="hidden"]');e&&i.setProp("name",e.getAttribute("name"))}i.filterItemsHandler=function(t){var e=t.target;if(e){var n=e.value;""!==n?i.getItems().forEach(function(t){var e=i.getProp("filterItems");("function"==typeof e?e:i.filterItems)(n,t)?t.element.style.display="block":t.element.style.display="none"}):i.showItems()}},i.registerElement({target:i.getElement(),event:I.Event.CLICK}),i.searchInputInContainer=null!==i.getElement().querySelector(".selectbox-input-container .input-select-one");var n=i.getItemData(i.getElement().querySelector("[data-selected]"));return n&&i.setSelected(n.value,n.text),i}mt.attachDOM();var ft,Et=(t(yt,ft=T),yt.attachDOM=function(){I.Observer.subscribe({componentClass:"tabs",onAdded:function(t,e){e(new yt({element:t}))},onRemoved:function(t,e){e("Tab",t)}})},yt.prototype.onElementEvent=function(t){var e=t.target;if(e&&e.getAttribute("data-toggle")){if(!e.getAttribute("href")&&!e.getAttribute("data-target"))return;t.preventDefault(),this.show(e)}},yt.prototype.show=function(t){var e=this;if(this.onAnimation)return!1;var n=I.Selector.closest(t,"."+this.tabItemSelector);if(!n||n.classList.contains("active"))return!1;var i=t.getAttribute("href")||t.getAttribute("data-target");if(!i)return!1;var r=this.getElement();Array.from(r.querySelectorAll(".tab-item")||[]).forEach(function(t){t.classList.contains("active")&&t.classList.remove("active");var e=t.querySelector(".tab-link");e&&e.setAttribute("aria-selected","false")}),this.onAnimation=!0,n.classList.add("active"),t.setAttribute("aria-selected","true");var o=document.querySelector(i);if(!o)return!1;var s=o.parentNode;if(!s)return!1;var a=Array.from(s.querySelectorAll("."+this.tabContentSelector)||[]),l=r.querySelector(".tab-item.active");a.forEach(function(t){t.classList.contains("active")&&t.classList.remove("active")}),o.classList.add("showing"),this.triggerEvent(I.Event.SHOW,this.getTabEvent(t)),l&&this.triggerEvent(I.Event.HIDE,this.getTabEvent(l));var c=function(){o.classList.remove("animate"),o.classList.add("active"),o.classList.remove("showing"),e.triggerEvent(I.Event.SHOWN,e.getTabEvent(t)),l&&e.triggerEvent(I.Event.HIDDEN,e.getTabEvent(l)),e.onAnimation=!1,o.removeEventListener(I.Event.TRANSITION_END,c)};return d(e,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,I.sleep(20)];case 1:return t.sent(),o.addEventListener(I.Event.TRANSITION_END,c),o.classList.add("animate"),[2]}})}),!0},yt.prototype.getTabEvent=function(t){return{id:t.getAttribute("href")||t.getAttribute("data-target"),target:t}},yt.prototype.destroy=function(){this.registerElement({target:this.getElement(),event:I.Event.CLICK})},yt);function yt(t){var e=ft.call(this,"tab",{},t)||this;return e.tabSelector="tab",e.tabItemSelector="tab-item",e.tabContentSelector="tab-pane",e.onAnimation=!1,e.registerElement({target:e.getElement(),event:I.Event.CLICK}),e}Et.attachDOM();function bt(t,e){return void 0===e&&(e={}),I.Observer.getComponent(t,e)||new t(e)}var St={accordion:function(t){return bt(k,t)},alert:function(t){return bt(j,t)},modal:function(t){return bt(Y,t)},modalConfirm:function(t){return bt($,t)},modalLoader:function(t){return bt(tt,t)},modalPrompt:function(t){return bt(it,t)},loader:function(t){return bt(G,t)},collapse:function(t){return bt(P,t)},notification:function(t){return bt(st,t)},offCanvas:function(t){return bt(ct,t)},tab:function(t){return bt(Et,t)},selectbox:function(t){return bt(mt,t)},progress:function(t){return bt(ht,t)}};return Object.assign(St,I)});
|