1function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(n){var i=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(n);return _possibleConstructorReturn(this,i?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_toPropertyKey(i.key),i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}var Prime=function(e){"use strict";var t,n,i,s={detect:function(){this.name=this._searchString(this.dataBrowser)||"An unknown browser",this.version=this._searchVersion(navigator.userAgent)||this._searchVersion(navigator.appVersion)||"an unknown version",this.os=this._searchString(this.dataOS)||"an unknown OS"},_searchString:function(e){for(var t=0;t<e.length;t++){var n=e[t].string,i=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,n&&-1!==n.indexOf(e[t].subString))return e[t].identity;if(i)return e[t].identity}return null},_searchVersion:function(e){var t=e.indexOf(this.versionSearchString);return-1===t?null:parseFloat(e.substring(t+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"macOS"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.userAgent,subString:"iPad",identity:"iPad"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]},P=(s.detect(),/^(?:ARTICLE|ASIDE|BLOCKQUOTE|BODY|BR|BUTTON|CANVAS|CAPTION|COL|COLGROUP|DD|DIV|DL|DT|EMBED|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H1|H2|H3|H4|H5|H6|HEADER|HGROUP|HR|LI|MAP|OBJECT|OL|OUTPUT|P|PRE|PROGRESS|SECTION|TABLE|TBODY|TEXTAREA|TFOOT|TH|THEAD|TR|UL|VIDEO)$/),F=/^(?:click|dblclick|mousedown|mouseup|mouseover|mousemove|mouseout|mouseenter|mou
1seleave)$/,N=/^(?:abort|blur|change|error|focus|load|reset|resize|scroll|select|submit|unload)$/,o=1,V=/alpha\(opacity=(.+)\)/,l=function(){function l(e){if(_classCallCheck(this,l),!c.isDefined(e.nodeType)||1!==e.nodeType)throw new TypeError("You can only pass in DOM element Node objects to the PrimeDocument.Element constructor");c.bindAll(this),this.domElement=e,this.domElement.customEventListeners=[],this.domElement.eventListeners={}}return _createClass(l,[{key:"addClass",value:function(e){var t=this.domElement.className;if(""===t)t=e;else{for(var n=this.domElement.className.split(c.spaceRegex),i=e.split(c.spaceRegex),s=0;s<i.length;s++)-1===n.indexOf(i[s])&&n.push(i[s]);t=n.join(" ")}return this.domElement.className=t,this}},{key:"addDelegatedEventListener",value:function(e,t,n){this.domElement.delegatedListeners=this.domElement.delegatedListeners||[];var i=this.domElement.delegatedListeners,i=(e in i||(i[e]=[]),t in i[e]||(i[e][t]=[]),i[e][t]||[]);n in i||i.push(n),this.addEventListener(e,this._handleDelegatedEvent)}},{key:"addEventListener",value:function(e,t){return-1===e.indexOf(":")?(this.domElement.eventListeners=this.domElement.eventListeners||{},this.domElement.eventListeners[e]=this.domElement.eventListeners[e]||[],-1===this.domElement.eventListeners[e].indexOf(t)&&this.domElement.eventListeners[e].push(t),this.domElement.addEventListener(e,t,!1)):(this.domElement.customEventListeners=this.domElement.customEventListeners||{},this.domElement.customEventListeners[e]=this.domElement.customEventListeners[e]||[],-1===this.domElement.customEventListeners[e].indexOf(t)&&this.domElement.customEventListeners[e].push(t)),this}},{key:"appendElement",value:function(e){e=e instanceof l?e.domElement:e;return e.parentNode&&e.parentNode.removeChild(e),this.domElement.appendChild(e),this}},{key:"appendHTML",value:function(e){return this.domElement.insertAdjacentHTML("beforeend",e),this}},{key:"appendTo",value:function(e){if(this.domElement.parentNode)throw new TypeError("You can only insert new PrimeElements for now");e=e instanceof l?e.domElement:e;if(e.parentNode)return e.appendChild(this.domElement),this;throw new TypeError("The element you passed into appendTo is not in the DOM. You can't insert a PrimeElement inside an element that isn't in the DOM yet.")}},{key:"fireEvent",value:function(e,t,n,i,s){var o;if(t=c.isDefined(t)?t:{},n=c.isDefined(n)?n:this,i=!c.isDefined(i)||i,s=!c.isDefined(s)||s,-1===e.indexOf(":"))if(document.createEventObject)(o=document.createEventObject()).memo=t||{},o.cancelBubble=!i,this.domElement.fireEvent("on"+e,o);else{if(!document.createEvent)throw new TypeError("Unable to fire event. Neither createEventObject nor createEvent methods are available");if(l.mouseEventsRegexp.test(e))(o=document.createEvent("MouseEvents")).initMouseEvent(e,i,s,window,0,0,0,0,0,!1,!1,!1,!1,0,null);else{if(!l.htmlEventsRegexp.test(e))throw new TypeError("Invalid event ["+e+"]");(o=document.createEvent("HTMLEvents")).initEvent(e,i,s)}o.memo=t||{},this.domElement.dispatchEvent(o)}else for(var r in this.domElement.customEventListeners[e]=this.domElement.customEventListeners[e]||[],o={event:e,memo:t,target:n},this.domElement.customEventListeners[e])this.domElement.customEventListeners[e].hasOwnProperty(r)&&this.domElement.customEventListeners[e][r](o);return this}},{key:"fireCustomEvent",value:function(e,t){if(t=c.isDefined(t)?t:{},-1===e.indexOf(":"))throw new TypeError("This method can only be used for custom events");for(var n in this.domElement.customEventListeners[e]=this.domElement.customEventListeners[e]||[],this.domElement.customEventListeners[e])this.domElement.customEventListeners[e].hasOwnProperty(n)&&this.domElement.customEventListeners[e][n](t);return this}},{key:"focus",value:function(){return this.domElement.focus(),this}},{key:"getAbsoluteTop",value:function(){for(var e=0,t=this.domElement;t;)e+=t.offsetTop,t=t.offsetParent;return e}},{key:"getAttribute",value:function(e){e=this.domElement.attributes.getNamedItem(e);return e?e.value:null}},{key:"getAttributes",value:function(){var e={};if(this.domElement.hasAttributes())for(var t=0;t<this.domElement.attributes.length;t++)e[this.domElement.attributes[t].name]=this.domElement.attributes[t].value;return e}},{key:"getBorderedHeight",value:function(){return this.domElement.offsetHeight}},{key:"getBorderedWidth",value:function(){return this.domElement.offsetWidth}},{key:"getBottom",value:function(){return this.domElement.getBoundingClientRect().bottom}},{key:"getChildren",value:function(e){if(!c.isDefined(e))return new r(this.domElement.children);for(var t=[],n=0;n<this.domElement.children.length;n++){var i=this.domElement.children[n];i.matches(e)&&t.push(i)}return new r(t)}},{key:"getClass",value:function(){return this.domElement.className}},{key:"getComputedStyle",value:function(){return this.domElement.currentStyle||document.defaultView.getComputedStyle(this.domElement,null)}},{key:"getCoordinates",value:function(){var e=this.domElement.getBoundingClientRect(),t=document.body,n=document.documentElement,i=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,o=n.clientTop||t.clientTop||0,n=n.clientLeft||t.clientLeft||0,t=e.top+i-o,i=e.left+s-n;return{top:Math.round(t),left:Math.round(i)}}},{key:"getDataSet",value:function(){if(!this.domElement.dataset){this.domElement.dataset={};var e,t,n=this.getAttributes();for(e in n)n.hasOwnProperty(e)&&0===e.indexOf("data-")&&(t=e.substring(5).replace(/-([a-z])/g,function(e){return e[1].toUpperCase()}),this.domElement.dataset[t]=n[e])}return this.domElement.dataset}},{key:"getDataAttribute",value:function(e){return this.getDataSet()[e]||null}},{key:"getFirstChild",value:function(e){e=this.getChildren(e)[0];return c.isDefined(e)?e:null}},{key:"getHeight",value:function(){var e=this.getComputedStyle(),t=this.domElement.offsetHeight,n=e.borderTopWidth,e=e.borderBottomWidth;return t-c.parseCSSMeasure(n)-c.parseCSSMeasure(e)}},{key:"getHTML",value:function(){return this.domElement.innerHTML}},{key:"getId",value:function(){return this.domElement.id}},{key:"getLastChild",value:function(e){e=this.getChildren(e);return 0<e.length?e[e.length-1]:null}},{key:"getLeft",value:function(){return this.domElement.getBoundingClientRect().left}},{key:"getNextSibling",value:function(){for(var e=this.domElement.nextSibling;null!==e&&1!==e.nodeType;)e=e.nextSibling;return null===e?null:new l(e)}},{key:"getOffsetLeft",value:function(){return this.domElement.offsetLeft}},{key:"getOffsetTop",value:function(){return this.domElement.offsetTop}},{key:"getOpacity",value:function(){var e,t=this.getComputedStyle(),n=1;return"Explorer"===s.name&&s.version<9?void 0!==(e=t.filter)&&""!==e&&0<(e=l.ieAlphaRegexp.match(e)).length&&(n=parseFloat(e[0])):n=parseFloat(t.opacity),n}},{key:"getOptions",value:function(){if("SELECT"!==this.getTagName())throw new TypeError("You can only get the options for select elements");return new r(this.domElement.options)}},{key:"getOuterHeight",value:function(){var e=this.getComputedStyle(),t=this.domElement.offsetHeight,n=e.marginTop,e=e.marginBottom;return t+c.parseCSSMeasure(n)+c.parseCSSMeasure(e)}},{key:"getOuterHTML",value:function(){return this.domElement.outerHTML}},{key:"getOuterWidth",value:function(){var e=this.getComputedStyle(),t=this.domElement.offsetWidth,n=e.marginLeft,e=e.marginRight;return t+c.parseCSSMeasure(n)+c.parseCSSMeasure(e)}},{key:"getParent",value:function(){return c.isDefined(this.domElement.parentElement)?new l(this.domElement.parentElement):null}},{key:"getPreviousSibling",value:function(){for(var e=this.domElement.previousSibling;null!==e&&1!==e.nodeType;)e=e.previousSibling;return null===e?null:new l(e)}},{key:"getRelativeZIndex",value:function(){for(var e=this;null!==e&&"auto"===e.getComputedStyle().zIndex;)e=e.getParent();return null===e?0:parseInt(e.getComputedStyle().zIndex)}},{key:"getRight",value:function(){return this.domElement.getBoundingClientRect().right}},{key:"getScrollHeight",value:function(){return this.domElement.scrollHeight}},{key:"getScrollLeft",value:function(){return this.domElement.scrollLeft}},{key:"getScrollTop",value:function(){return this.domElement.scrollTop}},{key:"getScrollWidth",value:function(){return this.domElement.scrollWidth}},{key:"getSelectedTexts",value:function(){if("SELECT"===this.domElement.tagName)for(var e=[],t=0;t<this.domElement.options.length;t++)this.domElement.options[t].selected&&e.push(this.domElement.options[t].text);else e=null;return e}},{key:"getSelectedValues",value:function(){if("INPUT"!==this.domElement.tagName||"checkbox"!==this.domElement.type&&"radio"!==this.domElement.type)if("SELECT"===this.domElement.tagName){t=[];for(var e=0;e<this.domElement.length;e++)this.domElement.options[e].selected&&t.push(this.domElement.options[e].value)}else t=null;else{var t=[],n=this.domElement.name,i=h.queryUp("form",this.domElement);h.query('input[name="'+n+'"]',i).each(function(e){e.isChecked()&&t.push(e.getValue())})}return t}},{key:"getStyle",value:function(e){return e=c.convertStyleName(e),this.domElement.style[e]}},{key:"getTagName",value:function(){return this.domElement.tagName}},{key:"getTextContent",value:function(){return this.domElement.innerText||this.domElement.textContent}},{key:"getTop",value:function(){return this.domElement.getBoundingClientRect().top}},{key:"getWidth",value:function(){var e=this.getComputedStyle(),t=this.domElement.offsetWidth,n=e.borderLeftWidth,e=e.borderRightWidth;return t-c.parseCSSMeasure(n)-c.parseCSSMeasure(e)}},{key:"getValue",value:function(){return this.domElement.value}},{key:"hasClass",value:function(e){var t=this.domElement.className;if(""===t)return""===e;for(var n=t.split(c.spaceRegex),i=e.split(c.spaceRegex),s=0;s<i.length;s++)if(-1===n.indexOf(i[s]))return!1;return!0}},{key:"hide",value:function(){return this.domElement.style.display="none",this}},{key:"insertAfter",value:function(e){this.domElement.parentNode&&this.domElement.parentNode.removeChild(this.domElement);var e=e instanceof l?e.domElement:e,t=e.parentNode;if(t)return t.insertBefore(this.domElement,e.nextSibling),this;throw new TypeError("The element you passed into insertAfter is not in the DOM. You can't insert a PrimeElement after an element that isn't in the DOM yet.")}},{key:"insertBefore",value:function(e){this.domElement.parentNode&&this.domElement.parentNode.removeChild(this.domElement);var e=e instanceof l?e.domElement:e,t=e.parentNode;if(t)return t.insertBefore(this.domElement,e),this;throw new TypeError("The element you passed into insertBefore is not in the DOM. You can't insert a PrimeElement before an element that isn't in the DOM yet.")}},{key:"insertHTMLAfter",value:function(e){return this.domElement.insertAdjacentHTML("afterend",e),this}},{key:"insertHTMLAfterBegin",value:function(e){return this.domElement.insertAdjacentHTML("afterbegin",e),this}},{key:"insertTextAfter",value:function(e){if(this.domElement.parentNode)return e=document.createTextNode(e),this.domElement.parentNode.insertBefore(e,this.domElement.nextSibling),this;throw new TypeError("This Element is not currently in the DOM")}},{key:"insertTextBefore",value:function(e){if(this.domElement.parentNode)return e=document.createTextNode(e),this.domElement.parentNode.insertBefore(e,this.domElement),this;throw new TypeError("This Element is not currently in the DOM")}},{key:"is",value:function(e){return this.domElement.matches(e)}},{key:"isChecked",value:function(){return"INPUT"===this.domElement.tagName&&("checkbox"===this.domElement.type||"radio"===this.domElement.type)&&this.domElement.checked}},{key:"isChildOf",value:function(e){for(var t=e instanceof l?e.domElement:e,n=this.domElement.parentNode;t!==n&&null!==n;)n=n.parentNode;return t===n}},{key:"isDisabled",value:function(){return this.domElement.disabled}},{key:"isFocused",value:function(){return document.activeElement===this.domElement}},{key:"isInput",value:function(){var e=this.getTagName();return"SELECT"===e||"INPUT"===e||"TEXTAREA"===e}},{key:"isInside",value:function(e){if(this.domElement!==document.body&&this.domElement!==document.documentElement&&this.domElement!==document)for(var t=this.getParent();t.domElement!==document.body;){if(t.domElement===e.domElement)return!0;t=t.getParent()}return!1}},{key:"isSelected",value:function(){return"OPTION"===this.domElement.tagName&&this.domElement.selected}},{key:"isVisible",value:function(){var e=this.getComputedStyle();
1return"none"!==e.display&&"hidden"!==e.visibility}},{key:"prependTo",value:function(e){if(this.domElement.parentNode)throw new TypeError("You can only insert new PrimeElements for now");e=e instanceof l?e.domElement:e;if(e.parentNode)return e.insertBefore(this.domElement,e.firstChild),this;throw new TypeError("The element you passed into prependTo is not in the DOM. You can't insert a PrimeElement inside an element that isn't in the DOM yet.")}},{key:"query",value:function(e){return h.query(e,this)}},{key:"queryFirst",value:function(e){return h.queryFirst(e,this)}},{key:"queryLast",value:function(e){return h.queryLast(e,this)}},{key:"queryUp",value:function(e){return h.queryUp(e,this)}},{key:"removeAllEventListeners",value:function(){for(var e in this.domElement.eventListeners)if(this.domElement.eventListeners.hasOwnProperty(e))for(var t=0;t<this.domElement.eventListeners[e].length;t++)this._internalRemoveEventListener(e,this.domElement.eventListeners[e][t]);return this.domElement.eventListeners={},this.domElement.customEventListeners={},this}},{key:"removeAttribute",value:function(e){return this.domElement.removeAttribute(e),this}},{key:"removeClass",value:function(e){var t=this.domElement.className;if(""!==t){for(var n=t.split(c.spaceRegex),i=e.split(c.spaceRegex),s=0;s<i.length;s++)c.removeFromArray(n,i[s]);this.domElement.className=n.join(" ")}return this}},{key:"removeEventListener",value:function(e,t){e=(-1===e.indexOf(":")?(this._internalRemoveEventListener(e,t),this.domElement.eventListeners):this.domElement.customEventListeners)[e];return e&&c.removeFromArray(e,t),this}},{key:"removeEventListeners",value:function(e){if(-1===e.indexOf(":")){if(this.domElement.eventListeners[e]){for(var t=0;t<this.domElement.eventListeners[e].length;t++)this._internalRemoveEventListener(e,this.domElement.eventListeners[e][t]);delete this.domElement.eventListeners[e]}}else this.domElement.customEventListeners[e]&&delete this.domElement.customEventListeners[e];return this}},{key:"removeEventListenersByPattern",value:function(e){for(var t in this.domElement.eventListeners)if(this.domElement.eventListeners.hasOwnProperty(t)&&e.test(t)){for(var n=0;n<this.domElement.eventListeners[t].length;n++)this._internalRemoveEventListener(t,this.domElement.eventListeners[t][n]);delete this.domElement.eventListeners[t]}for(var i in this.domElement.customEventListeners)this.domElement.customEventListeners.hasOwnProperty(i)&&e.test(i)&&delete this.domElement.customEventListeners[i];return this}},{key:"removeFromDOM",value:function(){return this.domElement.parentNode&&this.domElement.parentNode.removeChild(this.domElement),this}},{key:"selectElementContents",value:function(){var e,t;return document.body.createTextRange?((e=document.body.createTextRange()).moveToElementText(this.domElement),e.select()):window.getSelection&&(t=window.getSelection(),(e=document.createRange()).selectNodeContents(this.domElement),t.removeAllRanges(),t.addRange(e)),this}},{key:"scrollIntoView",value:function(){return this.domElement.scrollIntoView(),this}},{key:"scrollLeftTo",value:function(e){return this.domElement.scrollLeft=e,this}},{key:"scrollTo",value:function(e){return this.domElement.scrollTop=e,this}},{key:"scrollToBottom",value:function(){return this.domElement.scrollTop=this.domElement.scrollHeight,this}},{key:"scrollToTop",value:function(){return this.domElement.scrollTop=0,this}},{key:"setAttribute",value:function(e,t){return"number"==typeof t&&(t=t.toString()),this.domElement.setAttribute?this.domElement.setAttribute(e,t):((e=document.createAttribute(e)).nodeValue=t,this.domElement.setAttributeNode(e)),this}},{key:"setDataAttribute",value:function(e,t){e="data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return this.setAttribute(e,t)}},{key:"setAttributes",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setAttribute(t,e[t]);return this}},{key:"setChecked",value:function(e){return this.domElement.checked=e,this}},{key:"setDisabled",value:function(e){return this.domElement.disabled=e,this}},{key:"setHeight",value:function(e){return"number"==typeof e&&(e+="px"),this.setStyle("height",e),this}},{key:"setHTML",value:function(e){return null!==e&&(this.domElement.innerHTML=e instanceof l?e.getHTML():e),this}},{key:"setId",value:function(e){return this.domElement.id=e,this}},{key:"setLeft",value:function(e){e="number"==typeof e?e+"px":e;return this.setStyle("left",e),this}},{key:"setOpacity",value:function(e){return"Explorer"===s.name&&s.version<9?this.domElement.style.filter="alpha(opacity="+e+")":this.domElement.style.opacity=e,this}},{key:"setSelected",value:function(e){this.domElement.selected=e}},{key:"setSelectedValues",value:function(){var t=null,t=1===arguments.length&&c.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments,0);if("INPUT"!==this.domElement.tagName||"checkbox"!==this.domElement.type&&"radio"!==this.domElement.type){if("SELECT"===this.domElement.tagName)for(var e=0;e<this.domElement.length;e++)this.domElement.options[e].selected=-1!==t.indexOf(this.domElement.options[e].value)}else{var n=this.domElement.name,i=h.queryUp("form",this.domElement);h.query('input[name="'+n+'"]',i).each(function(e){e.setChecked(-1!==t.indexOf(e.getValue()))})}return this}},{key:"setStyle",value:function(e,t){return"number"==typeof t&&(t=t.toString()),this.domElement.style[e]=t,this}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t]);return this}},{key:"setTextContent",value:function(e){return null!==e&&(e instanceof l?this.domElement.textContent=e.getTextContent():("number"==typeof e&&(e=e.toString()),this.domElement.textContent=e)),this}},{key:"setTop",value:function(e){e="number"==typeof e?e+"px":e;return this.setStyle("top",e),this}},{key:"setValue",value:function(e){return"number"==typeof e&&(e=e.toString()),this.domElement.value=e,this}}
1,{key:"setWidth",value:function(e){return"number"==typeof e&&(e+="px"),this.setStyle("width",e),this}},{key:"show",value:function(e){return c.isDefined(e)?this.domElement.style.display=e:(this.domElement.style.display="","none"===this.getComputedStyle().display&&(c.isDefined(e)||(e=l.blockElementRegexp.test(this.domElement.tagName)?"block":"inline"),this.domElement.style.display=e)),this}},{key:"toggleClass",value:function(e){return this.hasClass(e)?this.removeClass(e):this.addClass(e),this}},{key:"unwrap",value:function(){for(var e=this.getParent().domElement;this.domElement.firstChild;)e.insertBefore(this.domElement.firstChild,this.domElement);this.removeFromDOM()}},{key:"wrapInnerHTML",value:function(e,t){e=h.newElement(e,t);return e.setHTML(this.getOuterHTML()),this.domElement.outerHTML=e.domElement.outerHTML,this}},{key:"_handleDelegatedEvent",value:function(e){if(this._callMatchedListeners(e,e.target),e.bubbles)for(var t=e.target;;){if(t===this.domElement||t===document||e.isPropagationStopped)break;t=t.parentNode,this._callMatchedListeners(e,t)}}},{key:"_callMatchedListeners",value:function(e,t){var n,i=this.domElement.delegatedListeners[e.type]||[];for(n in i)if(i.hasOwnProperty(n)&&t.matches(n))for(var s=i[n],o=0;o<s.length;o++){if(e.isImmediatePropagationStopped)return;s[o](e,t)}}},{key:"_internalRemoveEventListener",value:function(e,t){if(-1===e.indexOf(":"))if(this.domElement.removeEventListener)this.domElement.removeEventListener(e,t,!1);else{if(!this.domElement.detachEvent)throw new TypeError("Unable to remove event from the element. Neither removeEventListener nor detachEvent methods are available");this.domElement.detachEvent("on"+e,t)}else this.domElement.customEventListeners&&this.domElement.customEventListeners[e]&&(e=this.domElement.customEventListeners[e],c.removeFromArray(e,t))}}],[{key:"blockElementRegexp",get:function(){return P}},{key:"mouseEventsRegexp",get:function(){return F}},{key:"htmlEventsRegexp",get:function(){return N}},{key:"anonymousId",get:function(){return o},set:function(e){o=e}},{key:"ieAlphaRegexp",get:function(){return V}},{key:"wrap",value:function(e){return e instanceof l?e:new l(e)}},{key:"unwrap",value:function(e){return e instanceof l?e.domElement:e}}]),l}(),r=(Element.prototype.matches||(Element.prototype.matches=function(e){for(var t=(this.parentNode||this.document).querySelectorAll(e),n=0;t[n]&&t[n]!==this;)n++;return!!t[n]}),Event.prototype.isPropagationStopped||(t=Event.prototype.stopPropagation,Event.prototype.stopPropagation=function(){this.isPropagationStopped=!0,t.apply(this,arguments)}),Event.prototype.isImmediatePropagationStopped||(n=Event.prototype.stopImmediatePropagation,Event.prototype.stopImmediatePropagation=function(){this.isImmediatePropagationStopped=!0,n.apply(this,arguments)}),function(){function n(e){_classCallCheck(this,n),c.bindAll(this),this.length=e.length;for(var t=0;t<e.length;t++)e[t]instanceof l?this[t]=e[t]:this[t]=new l(e[t])}return _createClass(n,[{key:"addClass",value:function(e){return this._proxyToElement("addClass",e)}},{key:"addEventListener",value:function(e,t){return this._proxyToElement("addEventListener",e,t)}},{key:"each",value:function(e){for(var t=0;t<this.length;t++)e(this[t],t);return this}},{key:"hide",value:function(){return this._proxyToElement("hide")}},{key:"indexOf",value:function(e){for(var t=e instanceof l?e.domElement:e,n=0;n<this.length;n++)if(this[n].domElement===t)return n;return-1}},{key:"removeAllFromDOM",value:function(){for(var e=0;e<this.length;e++)this[e].removeFromDOM();return this}},{key:"removeClass",value:function(e){return this._proxyToElement("removeClass",e)}},{key:"setChecked",value:function(e){return this._proxyToElement("setChecked",e)}},{key:"setDisabled",value:function(e){return this._proxyToElement("setDisabled",e)}},{key:"show",value:function(){return this._proxyToElement("show")}},{key:"some",value:function(e){for(var t=0;t<this.length;++t)if(e(this[t]))return!0;return!1}},{key:"_proxyToElement",value:function(){for(var e=Array.prototype.slice.apply(arguments),t=0;t<this.length;t++)this[t][e[0]].apply(this[t],e.slice(1));return this}}]),n}()),q=[],B=/^<(\w+)\s*\/?>.*(?:<\/\1>)?$/,a=null,h=function(){function o(){_classCallCheck(this,o)}return _createClass(o,null,[{key:"Element",get:function(){return l}},{key:"ElementList",get:function(){return r}},{key:"readyFunctions",get:function(){return q}},{key:"tagRegexp",get:function(){return B}},{key:"bodyElement",get:function(){return a=null===a?new l(document.body):a},set:function(e){a=e}},{key:"addDelegatedEventListener",value:function(e,t,n){o.bodyElement.addDelegatedEventListener(e,t,n)}},{key:"addEventListener",value:function(e,t){return-1===e.indexOf(":")?(document.eventListeners=document.eventListeners||{},document.eventListeners[e]=document.eventListeners[e]||[],document.eventListeners[e].push(t),document.addEventListener(e,t,!1)):(document.customEventListeners=document.customEventListeners||{},document.customEventListeners[e]=document.customEventListeners[e]||[],document.customEventListeners[e].push(t)),o}},{key:"getHeight",value:function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}},{key:"getWidth",value:function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollWidth,e.offsetWidth,t.clientWidth,t.scrollWidth,t.offsetWidth)}},{key:"newDocument",value:function(e){return(new DOMParser).parseFromString(e,"text/html")}},{key:"newElement",value:function(e,t){t=c.isDefined(t)?t:{};var n=o.tagRegexp.exec(e);if(null===n)throw new TypeError("Invalid string to create a new element ["+e+"]. It should look like <a/>");var i,s=new l(document.createElement(n[1]));for(i in t)t.hasOwnProperty(i)&&("id"===i?s.setId(t[i]):s.setAttribute(i,t[i]));return s}},{key:"onReady",value:function(e){if("complete"===document.readyState)e();else{if(0===this.readyFunctions.length)if(document.addEventListener)document.addEventListener("DOMContentLoaded",o._callReadyListeners,!1);else{if(!document.attachEvent)throw new TypeError("No way to attach an event to the document. What browser are you running?");document.attachEvent("onreadystatechange",o._callReadyListeners)}o.readyFunctions.push(e)}}},{key:"appendHTML",value:function(e){document.body.insertAdjacentHTML("beforeend",e)}},{key:"move",value:function(e,t){return e=e instanceof l?e:new l(e),(t=c.isDefined(t)?t instanceof l?t:new l(t):new l(
1document.body)).appendHTML(e.getOuterHTML()),e.removeFromDOM(),t.getLastChild()}},{key:"query",value:function(e,t){t=(c.isDefined(t)?t instanceof l?t.domElement:t:document).querySelectorAll(e);return new r(t)}},{key:"queryById",value:function(e){e=document.getElementById(e);return e?new l(e):null}},{key:"queryFirst",value:function(e,t){var n=null;return null===(n=(n=c.isDefined(t)?t instanceof l?t.domElement:t:document).querySelector(e))?null:new l(n)}},{key:"queryLast",value:function(e,t){t=(c.isDefined(t)?t instanceof l?t.domElement:t:document).querySelectorAll(e);return 0===t.length?null:new l(t[t.length-1])}},{key:"queryUp",value:function(e,t){var n=null;if(!c.isDefined(t))throw new SyntaxError("Missing required parameter. The element is required.");for(n=(n=t instanceof l?t.domElement:t).parentNode;null!==n&&!n.matches(e);)(n=n.parentNode)===document&&(n=null);return null!==n?new l(n):null}},{key:"removeEventListener",value:function(e,t){if(document.removeEventListener)document.removeEventListener(e,t,!1);else{if(!document.detachEvent)throw new TypeError("Unable to remove event from the element. Neither removeEventListener nor detachEvent methods are available");document.detachEvent("on"+e,t)}}},{key:"_callReadyListeners",value:function(){if(document.addEventListener||"complete"===document.readyState)for(var e;e=o.readyFunctions.shift();)e();document.removeEventListener?document.removeEventListener("DOMContentLoaded",o._callReadyListeners,!1):document.detachEvent("onreadystatechange",o._callReadyListeners)}}]),o}(),c=(!function(e){var t=e.prototype,n=t.parseFromString;try{if((new e).parseFromString("","text/html"))return}catch(e){}t.parseFromString=function(e,t){return/^\s*text\/html\s*(?:;|$)/i.test(t)?(t=document.implementation.createHTMLDocument(""),-1<e.toLowerCase().indexOf("<!doctype")?t.documentElement.innerHTML=e:t.body.innerHTML=e,t):n.apply(this,arguments)}}(DOMParser),{spaceRegex:/\s+/,typeRegex:/^\[object\s(.*)\]$/,bindAll:function(t){c.getAllPropertyNames(t).forEach(function(e){"constructor"===e||"function"!=typeof t[e]||t[e].name&&t[e].name.startsWith("bound ")||Object.defineProperty(t,e,{value:t[e].bind(t)})})},escapeHTML:function(e){var t=document.createElement("div");return t.appendChild(document.createTextNode(e)),t.innerHTML},unescapeHTML:function(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value},getAllPropertyNames:function(e){for(var t={};Object.getOwnPropertyNames(e).forEach(function(e){t[e]||(t[e]=e)}),e=Object.getPrototypeOf(e););return Object.keys(t)},bindSome:function(e){if(1<arguments.length)for(var t=1;t<arguments.length;t++){var n=e[arguments[t]];if(!(c.isDefined(n)&&n instanceof Function))throw new TypeError("The object does not contain a function named ["+arguments[t]+"]");e[arguments[t]]=n.bind(e)}for(var i in e)e[i]instanceof Function&&(e[i]=e[i].bind(e))},bindSafe:function(e,t){if(c.isDefined(e))return c.isDefined(t)?e.bind(t):e;throw new Error("Invalid arguments")},calculateTextLength:function(e,t){var e=e.getComputedStyle(),n=h.queryById("prime-text-calculator");return(n=null===n?h.newElement("<span/>").setStyles({position:"absolute",width:"auto",fontSize:e.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,letterSpacing:e.letterSpacing,whiteSpace:"nowrap"}).setId("prime-text-calculator").setTop(-9999).setLeft(-9999).appendTo(document.body):n).setHTML(t),n.getWidth()},callIteratively:function(e,t,n,i){var s=0,o=setInterval(function(){var e=t<=++s;n(e),e&&(clearInterval(o),c.isDefined(i))&&i()},e/t-1)},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substring(1)},convertStyleName:function(e){if("float"===e)return"cssFloat";if(-1===(s=e.indexOf("-")))return e;for(var t=0,n="";-1!==s;)var i=e.substring(t,s),n=0===t?n.concat(i):n.concat(c.capitalize(i)),t=s+1,s=e.indexOf("-",t);return n+c.capitalize(e.substring(t))},dataSetToOptions:function(e){var t,n,i={},s=e.getDataSet();for(t in s)s.hasOwnProperty(t)&&(n=s[t],isNaN(n)?i[t]="true"===n||"false"!==n&&n:i[t]=parseInt(n));return i},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},isDefined:function(e){return null!=e},leftPadNumber:function(e,t){return(-1===Math.sign(e)?"-":"")+new Array(t).concat([Math.abs(e)]).join("0").slice(-t)},parseCSSMeasure:function(e){return 0<e.indexOf("px")?parseInt(e.substring(0,e.length-2)):parseInt(e)||0},parseJSON:function(e){return JSON.parse(e)},removeAllFromArray:function(e,t){for(var n=0;n<t.length;n++)c.removeFromArray(e,t[n])},removeFromArray:function(e,t){var n,t=e.indexOf(t);-1!==t&&(n=e.splice(t+1,e.length),e.length=t,e.push.apply(e,n))},stopEvent:function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()},type:function(e){return Object.prototype.toString.call(e).match(c.typeRegex)[1]}}),u=function(){function e(){_classCallCheck(this,e),c.bindAll(this),this.overlay=h.queryById("prime-overlay"),null===this.overlay&&(this.overlay=h.newElement("<div/>").setId("prime-overlay").appendTo(document.body).hide()),this.bodyOverflow=null}return _createClass(e,[{key:"close",value:function(){var e=this.bodyOverflow||"";return h.bodyElement.setStyle("overflow",e),this.overlay.setStyle("zIndex","10"),this.overlay.hide(),this}},{key:"open",value:function(e){return null===this.bodyOverflow&&(this.bodyOverflow=h.bodyElement.getStyle("overflow")),h.bodyElement.setStyle("overflow","hidden"),this.overlay.show(),this.overlay.setStyle("zIndex",e.toString()),this}},{key:"setId",value:function(e){return this.overlay.setId(e),this}},{key:"setZIndex",value:function(e){return this.overlay.setStyle("zIndex",e.toString()),this}}],[{key:"instance",get:function(){return i},set:function(e){i=e}}]),e}(),d=(h.onReady(function(){u.instance=new u}),function(){function n(e,t){_classCallCheck(this,n),c.bindAll(this),this.xhr=new XMLHttpRequest,this.async=!0,this.body=null,this.queryParams=null,this.contentType=null,this.inProgress=null,this.errorHandler=this.onError,this.headers={},this.loadingHandler=this.onLoading,this.method=t||"GET",this.openHandler=this.onOpen,this.password=null,this.sendHandler=this.onSend,this.successHandler=this.onSuccess,this.unsetHandler=this.onUnset,this.url=e,this.username=null}return _createClass(n,[{key:"forURL",value:function(e){return this.url=e,this}},{key:"go",value:function(){if(!this.url)throw new TypeError("No URL set for AJAX request");var e=this.url;if("GET"!==this.method&&"DELETE"!==this.method||null===this.queryParams||(-1===e.indexOf("?")?e+="?"+this.queryParams:e+="&"+this.queryParams),this.async&&(null!==this.inProgress&&this.inProgress.open(),this.xhr.onreadystatechange=this._handler.bind(this)),this.xhr.open(this.method,e,this.async,this.username,this.password),0<Object.keys(this.headers).length)for(var t in this.headers)this.headers.hasOwnProperty(t)&&this.xhr.setRequestHeader(t,this.headers[t]);return this.contentType&&this.xhr.setRequestHeader("Content-Type",this.contentType),this.xhr.send(this.body),this}},{key:"onError",value:function(e){}},{key:"onLoading",value:function(e){}},{key:"onOpen",value:function(e){}},{key:"onSend",value:function(e){}},{key:"onSuccess",value:function(e){}},{key:"onUnset",value:function(e){}},{key:"synchronously",value:function(){return this.async=!1,this}},{key:"usingMethod",value:function(e){return this.method=e,this}},{key:"withBody",value:function(e){return this.body=e,this}},{key:"withContentType",value:function(e){return this.contentType=e,this}},{key:"withData",value:function(e){for(var t in e)e.hasOwnProperty(t)&&("PUT"===this.method||"POST"===this.method?this.body=this._addDataValue(this.body,t,e[t]):this.queryParams=this._addDataValue(this.queryParams,t,e[t]));return"PUT"!==this.method&&"POST"!==this.method||(this.contentType="application/x-www-form-urlencoded"),this}},{key:"withDataFromForm",value:function(e){var t=e;e instanceof l&&(t=e.domElement);for(var n=0;n<t.elements.length;n++){var i=new l(t.elements[n]);if(!i.isDisabled()&&i.isInput()){var s=i.getAttribute("name");if(null!==s&&0!==s.length){var o=i.getAttribute("type"),r=(null!==o&&(o=o.toLowerCase()),void 0);if("SELECT"===i.getTagName())r=i.getSelectedValues();else{if(!("radio"!==o&&"checkbox"!==o||i.isChecked()))continue;r=i.getValue()}"PUT"===this.method||"POST"===this.method?this.body=this._addDataValue(this.body,s,r):this.queryParams=this._addDataValue(this.queryParams,s,r)}}}return"PUT"!==this.method&&"POST"!==this.method||(this.contentType="application/x-www-form-urlencoded"),this}},{key:"withErrorHandler",value:function(e){return this.errorHandler=e,this}},{key:"withInProgress",value:function(e){return this.inProgress=e,this}},{key:"withJSON",value:function(e){return this.body=_typeof(e)===String?e:JSON.stringify(e),this.contentType="application/json",this}},{key:"withLoadingHandler",value:function(e){return this.loadingHandler=e,this}},{key:"withHeader",value:function(e,t){return this.headers[e]=t,this}},{key:"withHeaders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.headers[t]=e[t]);return this}},{key:"withResponseType",value:function(e){return this.xhr.responseType=e,this}},{key:"withOpenHandler",value:function(e){return this.openHandler=e,this}},{key:"withSendHandler",value:function(e){return this.sendHandler=e,this}},{key:"withSuccessHandler",value:function(e){return this.successHandler=e,this}},{key:"withUnsetHandler",value:function(e){return this.unsetHandler=e,this}},{key:"reset",value:function(){return this.queryParams=null,this.data=null,this.body=null,this.contentType=null,this}},{key:"_addDataValue",value:function(e,t,n){var i="";if(n instanceof Array)for(var s=0;s<n.length;s++)i+=encodeURIComponent(t)+"="+encodeURIComponent(n[s]),s+1<n.length&&(i+="&");else i=encodeURIComponent(t)+"="+encodeURIComponent(n);return null!==e&&""!==i?i=e+"&"+i:null!==e&&""===i&&(i=e),i}},{key:"_handler",value:function(){0===this.xhr.readyState?this.unsetHandler(this.xhr):1===this.xhr.readyState?this.openHandler(this.xhr):2===this.xhr.readyState?this.sendHandler(this.xhr):3===this.xhr.readyState?this.loadingHandler(this.xhr):4===this.xhr.readyState&&(null!==this.inProgress?this.inProgress.close(function(){200<=this.xhr.status&&this.xhr.status<=299?this.successHandler(this.xhr):this.errorHandler(this.xhr)}.bind(this)):200<=this.xhr.status&&this.xhr.status<=299?this.successHandler(this.xhr):this.errorHandler(this.xhr))}}]),n}()),m=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"addEventListener",value:function(e,t){if(-1===e.indexOf(":"))if(window.eventListeners=window.eventListeners||{},window.eventListeners[e]=window.eventListeners[e]||[],window.eventListeners[e].push(t),window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)throw new TypeError("Unable to set event onto the window. Neither addEventListener nor attachEvent methods are available");window.attachEvent("on"+e,t)}else window.customEventListeners=window.customEventListeners||{},window.customEventListeners[e]=window.customEventListeners[e]||[],window.customEventListeners[e].push(t);return window}
1},{key:"getInnerHeight",value:function(){if("number"==typeof window.innerHeight)return window.innerHeight;if(document.documentElement&&document.documentElement.clientHeight)return document.documentElement.clientHeight;if(document.body&&document.body.clientHeight)return document.body.clientHeight;throw new Error("Unable to determine inner height of the window")}},{key:"getInnerWidth",value:function(){if("number"==typeof window.innerWidth)return window.innerWidth;if(document.documentElement&&document.documentElement.clientWidth)return document.documentElement.clientWidth;if(document.body&&document.body.clientWidth)return document.body.clientWidth;throw new Error("Unable to determine inner width of the window")}},{key:"getScrollTop",value:function(){if("number"==typeof window.pageYOffset)return window.pageYOffset;if(document.body&&document.body.scrollTop)return document.body.scrollTop;if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;throw new Error("Unable to determine scrollTop of the window")}}]),e}(),p=function(){function n(e,t){if(_classCallCheck(this,n),c.bindAll(this),this.element=l.wrap(e),this.offset={},c.isDefined(t)){if(this.grip=this.element.queryFirst(t),null===this.grip)throw Error("Unable to find an element using the provided selector ["+t+"]")}else this.grip=this.element}return _createClass(n,[{key:"destroy",value:function(){this.element.removeClass("active"),this.element.setStyles(this.originalStyle),this.grip.removeEventListener("mousedown",this._handleMouseDown),h.removeEventListener("mousemove",this._handleMouseMove),h.removeEventListener("mouseup",this._handleMouseUp)}},{key:"initialize",value:function(){return this.originalStyle={cursor:this.element.getStyle("cursor"),zIndex:this.element.getStyle("zIndex")},this.grip.addEventListener("mousedown",this._handleMouseDown).setStyle("cursor","move"),this}},{key:"_handleMouseDown",value:function(e){e.preventDefault(),this.element.addClass("active"),this.offset={zIndex:this.element.getStyle("zIndex"),height:this.element.getOuterHeight(),width:this.element.getOuterWidth(),x:e.screenX,y:e.screenY},this.element.setStyle("zIndex",this.offset.zIndex+10),h.removeEventListener("mousemove",this._handleMouseMove),h.removeEventListener("mouseup",this._handleMouseUp),h.addEventListener("mousemove",this._handleMouseMove),h.addEventListener("mouseup",this._handleMouseUp)}},{key:"_handleMouseMove",value:function(e){var t=e.screenX-this.offset.x,n=e.screenY-this.offset.y;this.offset.x=e.screenX,this.offset.y=e.screenY,this.element.setLeft(this.element.getLeft()+t),this.element.setTop(this.element.getTop()+n)}},{key:"_handleMouseUp",value:function(){h.removeEventListener("mousemove",this._handleMouseMove),h.removeEventListener("mouseup",this._handleMouseUp),this.element.setStyle("zIndex",this.offset.zIndex),this.element.removeClass("active")}}]),n}(),v=function(){function e(){_classCallCheck(this,e),c.bindAll(this),this.draggable=null,this.element=null,this.initialized=!1,this._setInitialOptions()}return _createClass(e,[{key:"close",value:function(){if(null!==this.element)return this.element.removeClass("open"),null!==this.draggable&&(this.draggable.destroy(),this.draggable=null),document.removeEventListener("keydown",this._handleKeyDown),document.removeEventListener("click",this._handleClick),setTimeout(function(){this.element.removeFromDOM(),this.element=null;var e=this._determineZIndex();0!==e?u.instance.setZIndex(e):u.instance.close()}.bind(this),this.options.closeTimeout),this}},{key:"destroy",value:function(){return this.close(),this}},{key:"initialize",value:function(){return this}},{key:"open",value:function(e){return(this.options.ajaxRequest||new d(e,"GET")).withSuccessHandler(this._handleAJAXDialogResponse).withErrorHandler(this._handleAJAXDialogResponse).go(),this}},{key:"openPost",value:function(e,t,n){return new d(e,"POST").withDataFromForm(t).withData(n).withSuccessHandler(this._handleAJAXDialogResponse).go(),this}},{key:"setHTML",value:function(e){return this.element.setHTML(e),this._initializeDialog(),this}},{key:"withAdditionalClasses",value:function(e){return this.options.additionalClasses=e,this}},{key:"withAjaxRequest",value:function(e){return this.options.ajaxRequest=e,this}},{key:"withCallback",value:function(e){return this.options.callback=e,this}},{key:"withClassName",value:function(e){if(-1!==e.indexOf(" "))throw"Invalid class
1name ["+e+"]. You can use the additionalClasses options to add more classes.";return this.options.className=e,this}},{key:"withCloseButtonElementSelector",value:function(e){return this.options.closeButtonElementSelector=e,this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withDismissible",value:function(e){return this.options.dismissible=e,this}},{key:"withDraggableButtonElementSelector",value:function(e){return this.options.draggableElementSelector=e,this}},{key:"withFormErrorCallback",value:function(e){return this.options.formErrorCallback=e,this}},{key:"withFormHandling",value:function(e){return this.options.formHandling=e,this}},{key:"withFormPreSubmitCallback",value:function(e){return this.options.formPreSubmitCallback=e,this}},{key:"withFormSuccessCallback",value:function(e){return this.options.formSuccessCallback=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_determineZIndex",value:function(){var n=0;return h.query("."+this.options.className).each(function(e){var t=parseInt(e.getComputedStyle().zIndex);e.isVisible()&&n<t&&(n=t)}),n}},{key:"_handleCloseClickEvent",value:function(e){c.stopEvent(e),this.close()}},{key:"_handleAJAXDialogResponse",value:function(e){this.element=h.newElement("<div/>",{class:this.options.className+" "+this.options.additionalClasses}).appendTo(document.body),this.setHTML(e.responseText)}},{key:"_handleAJAXFormError",value:function(e){this.setHTML(e.responseText),this.form=this.element.queryFirst("form").addEventListener("submit",this._handleAJAXFormSubmit),null!==this.options.formErrorCallback&&this.options.formErrorCallback(this,e),null!==this.draggable&&this.draggable.destroy(),null!==this.options.draggableElementSelector&&null!==this.element.queryFirst(this.options.draggableElementSelector)&&(this.draggable=new p(this.element,this.options.draggableElementSelector).initialize())}},{key:"_handleAJAXFormSuccess",value:function(e){null!==this.options.formSuccessCallback?this.options.formSuccessCallback(this,e):void 0!==(e=this.form.getDataSet().ajaxSuccessUri)?window.location=e:window.location.reload()}},{key:"_handleAJAXFormSubmit",value:function(e){c.stopEvent(e),null!==this.options.formPreSubmitCallback&&this.options.formPreSubmitCallback(this),new d(this.form.getAttribute("action"),this.form.getAttribute("method")).withDataFromForm(this.form).withSuccessHandler(this._handleAJAXFormSuccess).withErrorHandler(this._handleAJAXFormError).go()}},{key:"_handleClick",value:function(e){e.target===u.instance.overlay.domElement&&this._isTopDialog()&&this.options.dismissible&&(c.stopEvent(e),this.close())}},{key:"_handleKeyDown",value:function(e){this._isTopDialog()&&"Escape"===e.key&&this.options.dismissible&&(c.stopEvent(e),this.close())}},{key:"_initializeDialog",value:function(){var e,t;this.element.query(this.options.closeButtonElementSelector).each(function(e){e.addEventListener("click",this._handleCloseClickEvent)}.bind(this)),this.options.dismissible&&(document.addEventListener("keydown",this._handleKeyDown),document.addEventListener("click",this._handleClick)),this.initialized||(e=this._determineZIndex(),u.instance.open(e+this.options.zIndexOffset),this.element.setStyle("zIndex",(e+this.options.zIndexOffset+10).toString()),this.element.addClass("open")),null!==this.options.callback&&this.options.callback(this),this.options.formHandling&&(this.form=this.element.queryFirst("form").addEventListener("submit",this._handleAJAXFormSubmit)),this.initialized||(e=m.getInnerHeight(),t=this.element.getHeight(),this.element.setTop((e-t)/2-20)),null!==this.options.draggableElementSelector&&null!==this.element.queryFirst(this.options.draggableElementSelector)&&(this.draggable=new p(this.element,this.options.draggableElementSelector).initialize()),this.initialized=!0}},{key:"_isTopDialog",value:function(){var e=this._determineZIndex();return parseInt(this.element.getComputedStyle().zIndex)===e}},{key:"_setInitialOptions",value:function(){this.options={additionalClasses:"",ajaxRequest:null,callback:null,className:"prime-dialog",closeButtonElementSelector:'[data-dialog-role="close-button"]',closeTimeout:200,dismissible:!0,draggableElementSelector:'[data-dialog-role="draggable"]',formErrorCallback:null,formHandling:!1,formPreSubmitCallback:null,formSuccessCallback:null,zIndexOffset:1e3}}}]),e}(),y={Keys:{BACKSPACE:8,ENTER:13,ESCAPE:27,SPACE:32,TAB:9,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,DELETE:46}},f={DAYS_IN_MONTH:[31,28,31,30,31,30,31,31,30,31,30,31],getHourOfDay:function(e){return(e.getHours()+24)%12||12},isLeapYear:function(e){return!(e%4||!(e%100)&&e%400)},numberOfDaysInMonth:function(e,t){return 1===t&&this.isLeapYear(e)?29:f.DAYS_IN_MONTH[t]},plusDays:function(e,t){if(0!==t){var n=e.getDate()+t,i=f.numberOfDaysInMonth(e.getFullYear(),e.getMonth());if(0<n)for(;i<n;)f.plusMonths(e,1),n-=i,i=f.numberOfDaysInMonth(e.getFullYear(),e.getMonth());else for(;n<=0;)f.plusMonths(e,-1),n+=i=f.numberOfDaysInMonth(e.getFullYear(),e.getMonth());e.setDate(n)}},plusHours:function(e,t){var n;0!==t&&(n=parseInt(t/24),f.plusDays(e,n),n=t%24,23<(t=e.getHours()+n)?(f.plusDays(e,1),e.setHours(t-24)):t<0?(f.plusDays(e,-1),e.setHours(24+t)):e.setHours(t))},plusMinutes:function(e,t){var n;0!==t&&(n=parseInt(t/60),f.plusHours(e,n),n=t%60,60<(t=e.getMinutes()+n)?(f.plusHours(e,1),e.setMinutes(t-60)):t<0?(f.plusHours(e,-1),e.setMinutes(60+t)):e.setMinutes(t))},plusMonths:function(e,t){var n,i,s;0!==t&&(n=parseInt(t/12),t=t%12,(s=(i=e.getMonth())+t)<0?(n--,t=s,i=12):12<=s&&(n++,t=s-12,i=0),e.setYear(e.getFullYear()+n),s=i+t,e.getDate()>this.DAYS_IN_MONTH[s]&&e.setDate(this.DAYS_IN_MONTH[s]),e.setMonth(s))},plusSeconds:function(e,t){var n;0!==t&&(n=parseInt(t/60),f.plusMinutes(e,n),n=t%60,60<(t=e.getSeconds()+n)?(f.plusMinutes(e,1),e.setSeconds(t-60)):t<0?(f.plusMinutes(e,-1),e.setSeconds(60+t)):e.setSeconds(t))},plusYears:function(e,t){0!==t&&e.setFullYear(e.getFullYear()+t)}
1,toDateOnlyISOString:function(e){if(e instanceof Date)return e.getFullYear()+"-"+c.leftPadNumber(e.getMonth()+1,2)+"-"+c.leftPadNumber(e.getDate(),2);throw TypeError("date parameter must be a Date object.")}},K=["Su","Mo","Tu","We","Th","Fr","Sa"],W=["January","February","March","April","May","June","July","August","September","October","November","December"],U=["AM","PM"],g=function(){function u(e){if(_classCallCheck(this,u),c.bindAll(this),this.element=l.wrap(e),!this.element.is("input"))throw new TypeError("You can only use DateTimePicker with an input element");this.callback=null,this.customFormatHandler=null,this._setInitialOptions()}return _createClass(u,[{key:"close",value:function(){return this.datepicker.removeClass("open"),setTimeout(function(){this.datepicker.hide()}.bind(this),this.options.closeTimeout),this}},{key:"closeMonthsSelect",value:function(){return this.months.removeClass("open"),setTimeout(function(){this.months.hide()}.bind(this),this.options.closeTimeout),this}},{key:"closeYearsSelect",value:function(){return this.years.removeClass("open"),setTimeout(function(){this.years.hide()}.bind(this),this.options.closeTimeout),this}},{key:"destroy",value:function(){this.datepicker.removeFromDOM(),this.element.removeEventListener("click",this._handleInputClick).removeEventListener("focus",this._handleInputClick).removeEventListener("keydown",this._handleInputKey),h.removeEventListener("click",this._handleGlobalClick),h.removeEventListener("keydown",this._handleGlobalKey)}},{key:"drawCalendar",value:function(e){for(var t=e.getMonth(),n=e.getFullYear(),i=new Date(n,t,1).getDay(),s=f.numberOfDaysInMonth(n,t),o=Math.ceil((i+s)/7),r="",l=1,a=0;a<o;a++){var h=0===a?i:0;r+=this._buildCalendarWeek(e,h,l,s),l+=7-h}return this.calendarBody.setHTML(r),this.monthDisplay.setDataAttribute("month",t),this.yearDisplay.setDataAttribute("year",n),this.monthDisplay.setTextContent(u.MONTHS[t]),this.yearDisplay.setTextContent(n),this}},{key:"initialize",value:function(){var e=this.element.getValue(),e=(this.date=""===e||null===e?new Date:new Date(e),this.date.getUTCFullYear(),"<span>".concat(u.TIME_SEPARATOR,"</span>")),t="<span>".concat(u.DATE_SEPARATOR,"</span>"),n='<div class="'.concat(this.options.className,'">\n <header>\n <span class="prev">◀</span>\n <span class="month"></span>\n <span class="year"></span>\n <span class="next">▶</span>\n </header>\n <table>\n <thead>\n <tr>\n <th>').concat(u.SHORT_DAY_NAMES[0],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[1],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[2],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[3],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[4],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[5],"</th>\n <th>").concat(u.SHORT_DAY_NAMES[6],'</th>\n </tr>\n </thead>\n <tbody>\n </tbody>\n </table>\n <div class="inputs">\n <div class="date">\n <input size="2" maxlength="2" type="text" name="month" autocomplete="off"/>').concat(t,'\n <input size="2" maxlength="2" type="text" name="day" autocomplete="off"/>').concat(t,'\n <input size="4" maxlength="4" type="text" name="year" autocomplete="off"/>\n </div>\n <div class="time">\n <input size="2" maxlength="2" type="text" name="hour" autocomplete="off"/>').concat(e,'\n <input size="2" maxlength="2" type="text" name="minute" autocomplete="off"/>').concat(e,'\n <input size="2" maxlength="2" type="text" name="second" autocomplete="off"/>\n <input size="2" maxlength="2" type="text" name="am_pm" autocomplete="off"/>\n </div>\n </div>\n</div>');h.appendHTML(n),this.datepicker=h.queryLast("."+this.options.className).hide(),this.element.addEventListener("click",this._handleInputClick),this.element.addEventListener("focus",this._handleInputClick),this.element.addEventListener("keydown",this._handleInputKey),this.calendarBody=this.datepicker.queryFirst("table tbody").addEventListener("click",this._handleDayClick),this.monthDisplay=this.datepicker.queryFirst("header .month").addEventListener("click",this._handleMonthExpand),this.yearDisplay=this.datepicker.queryFirst("header .year").addEventListener("click",this._handleYearExpand),this.time=this.datepicker.queryFirst(".time"),this.inputs=this.datepicker.queryFirst("div.inputs"),this.hourInput=this.inputs.queryFirst("input[name=hour]").addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleHourKey),this.minuteInput=this.inputs.queryFirst("input[name=minute]").addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleMinuteKey),this.secondInput=this.inputs.queryFirst("input[name=second]").addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleSecondKey),this.ampmInput=this.inputs.queryFirst("input[name=am_pm]").addEventListener("keydown",this._handleAmPmKey),this.monthInput=this.inputs.queryFirst("input[name=month]").setValue(this.date.getMonth()+1).addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleMonthKey
1),this.dayInput=this.inputs.queryFirst("input[name=day]").setValue(this.date.getDate()).addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleDayKey),this.yearInput=this.inputs.queryFirst("input[name=year]").setValue(this.date.getFullYear()).addEventListener("change",this._handleDateTimeChange).addEventListener("keydown",this._handleYearKey),this.datepicker.queryFirst("header .next").addEventListener("click",this._handleNextMonth),this.datepicker.queryFirst("header .prev").addEventListener("click",this._handlePreviousMonth),h.addEventListener("click",this._handleGlobalClick),h.addEventListener("keydown",this._handleGlobalKey);for(var n='<div class="months">',i=0;i<u.MONTHS.length;i++)n+='<div data-month="'.concat(i,'">').concat(u.MONTHS[i],"</div>");this.datepicker.appendHTML(n+="</div>"),this.months=this.datepicker.queryFirst(".months"),this.months.hide(),this.months.getChildren().each(function(e){e.addEventListener("click",function(){this.setMonth(parseInt(e.getDataAttribute("month"))),this.closeMonthsSelect()}.bind(this))}.bind(this)),n='<div class="years">';for(var t=this.date.getFullYear()-10,s=this.date.getFullYear()+10,o=t;o<s;o++)n+='<div data-year="'.concat(o,'">').concat(o,"</div>");return this.datepicker.appendHTML(n+="</div>"),this.years=this.datepicker.queryFirst(".years"),this.years.hide(),this.years.getChildren().each(function(e){e.addEventListener("click",function(){this.setYear(parseInt(e.getDataAttribute("year"))),this.closeYearsSelect()}.bind(this))}.bind(this)),this._rebuild(),null!==this.customFormatHandler&&this.element.setValue(this.customFormatHandler.call(null,this.date)),this}},{key:"getDate",value:function(){return new Date(this.date.getTime())}},{key:"nextMonth",value:function(){var e=new Date(this.date);return e.setDate(1),e.setMonth(parseInt(this.monthDisplay.getDataAttribute("month"))),e.setFullYear(parseInt(this.yearDisplay.getDataAttribute("year"))),f.plusMonths(e,1),this.drawCalendar(e),this}},{key:"open",value:function(){this.datepicker.setLeft(this.element.getLeft()),this.datepicker.setTop(this.element.getAbsoluteTop()+this.element.getHeight()+8),this.datepicker.show(),this.datepicker.addClass("open");var e=this.element.getRelativeZIndex();return this.datepicker.setStyle("zIndex",e+10),this}},{key:"openMonthSelect",value:function(){this.closeYearsSelect(),this.months.setLeft(this.monthDisplay.getOffsetLeft()-5),this.months.setTop(this.monthDisplay.getOffsetTop()-5),this.months.setStyle("zIndex",this.monthDisplay.getRelativeZIndex()+10),this.months.show(),this.months.addClass("open");var e=this.months.queryFirst('[data-month="'+this.date.getMonth()+'"]');this.months.getChildren().each(function(e){e.removeClass("selected")}),e.addClass("selected")}},{key:"openYearSelect",value:function(){this.closeMonthsSelect(),this.years.setLeft(this.yearDisplay.getOffsetLeft()-5),this.years.setTop(this.yearDisplay.getOffsetTop()-5),this.years.setStyle("zIndex",this.yearDisplay.getRelativeZIndex()+10),this.years.show(),this.years.addClass("open");var e=this.years.queryFirst('[data-year="'+this.date.getFullYear()+'"]');this.years.getChildren().each(function(e){e.removeClass("selected")}),e.addClass("selected")}},{key:"previousMonth",value:function(){var e=new Date(this.date);return e.setDate(1),e.setMonth(parseInt(this.monthDisplay.getDataAttribute("month"))),e.setFullYear(parseInt(this.yearDisplay.getDataAttribute("year"))),f.plusMonths(e,-1),this.drawCalendar(e),this}},{key:"setDate",value:function(e){return this.date=e,null!==this.customFormatHandler?this.element.setValue(this.customFormatHandler.call(null,this.date)):this.options.dateOnly?this.element.setValue(f.toDateOnlyISOString(e)):this.element.setValue(e.toISOString()),this._rebuild(),null!==this.callback&&this.callback(this),this}},{key:"setMonth",value:function(e){var t=parseInt(this.yearDisplay.getDataAttribute("year"));return e<0?(e=11,t--):11<e&&(t++,e=0),this.date.setMonth(e),this.date.setYear(t),this.setDate(this.date),this}},{key:"setYear",value:function(e){return this.yearDisplay.setDataAttribute("year",e),this.yearDisplay.setTextContent(e),this.date.setYear(e),this.setDate(this.date),this}},{key:"withCallback",value:function(e){return this.callback=e,this}},{key:"withClassName",value:function(e){return this.options.className=e,this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withCustomFormatHandler",value:function(e){return this.customFormatHandler=e,this}},{key:"withDateOnly",value:function(){return this.options.dateOnly=!0,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_buildCalendarWeek",value:function(e,t,n,i){for(var s=new Date(e.getFullYear(),e.getMonth(),0).getDate()-t+1,o=1,r="<tr>",l=0,a=e.getFullYear(),h=e.getMonth(),u=0;u<7;u++){var c=n+u;c<=t?(r+='<td><a class="inactive" href="#" data-year="'+a+'" data-month="'+(h-1)+'" data-day="'+s+'">'+s+"</a></td>",s++,l++):i<c?(r+='<td><a class="inactive" href="#" data-year="'+a+'" data-month="'+h+'" data-day="'+c+'">'+o+"</a></td>",o++):(c=c-l,r+="<td><a "+(this.date.getDate()===c&&this.date.getMonth()===h?'class="selected"':"")+'href="#" data-year="'+a+'" data-month="'+h+'" data-day="'+c+'">'+c+"</a></td>")}return r+="</tr>"}},{key:"_clamp",value:function(e,t,n){return Math.max(e,Math.min(n,t))}},{key:"_handleAmPmKey",value:function(e){if(e.keyCode===y.Keys.TAB)c.stopEvent(e),(e.shiftKey?(this.secondInput.domElement.setSelectionRange(0,this.secondInput.getValue().length),this.secondInput):(this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length),this.monthInput)).focus();else{var t=this.ampmInput.getValue();if(65===e.keyCode)t===u.AM_PM[1]&&f.plusHours(this.date,-12);else if(80===e.keyCode)t===u.AM_PM[0]&&f.plusHours(this.date,12);else if(e.keyCode===y.Keys.UP_ARROW||e.keyCode===y.Keys.DOWN_ARROW)t===u.AM_PM[0]?f.plusHours(this.date,12):t===u.AM_PM[1]&&f.plusHours(this.date,-12);else if(e.keyCode===y.Keys.ENTER||e.keyCode===y.Keys.ESCAPE)return;this.setDate(this.date),this.ampmInput.domElement.setSelectionRange(0,this.ampmInput.getValue().length),c.stopEvent(e)}}},{key:"_handleDateTimeChange",value:function(e){c.stopEvent(e);var e=new Date,t=this._clamp(1,12,parseInt(this.hourInput.getValue())),t=(this.ampmInput.getValue()===u.AM_PM[0]?12===t?e.setHours(0):e.setHours(t):12===t?e.setHours(12):e.setHours(t+12),this._clamp(0,59,parseInt(this.secondInput.getValue()))),n=this._clamp(0,59,parseInt(this.minuteInput.getValue()));e.setSeconds(t),e.setMinutes(n),e.setDate(1),e.setMonth(parseInt(this.monthInput.getValue())-1),e.setDate(parseInt(this.dayInput.getValue())),e.setYear(parseInt(this.yearInput.getValue())),this.setDate(e)}},{key:"_handleDayClick",value:function(e){c.stopEvent(e);var e=new l(e.target),t=(e.is("a")||(e=e.queryFirst("a")),new Date(this.date));t.setDate(1),t.setFullYear(parseInt(e.getDataAttribute("year"))),t.setMonth(parseInt(e.getDataAttribute("month"))),t.setDate(parseInt(e.getDataAttribute("day"))),this.setDate(t)}},{key:"_handleDayKey",value:function(e){e.keyCode===y.Keys.UP_ARROW?(f.plusDays(this.date,1),this.setDate(this.date),this.dayInput.domElement.setSelectionRange(0,this.dayInput.getValue().length),c.stopEvent(e)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusDays(this.date,-1),this.setDate(this.date),this.dayInput.domElement.setSelectionRange(0,this.dayInput.getValue().length)):e.keyCode===y.Keys.ENTER&&this.date.setDate(parseInt(this.dayInput.getValue()))}},{key:"_handleGlobalClick",value:function(e){var t,n,i,s;e.target!==this.element.domElement&&(t=this.datepicker.getTop(),n=this.datepicker.getBottom(),i=this.datepicker.getLeft(),s=this.datepicker.getRight(),this.datepicker.isVisible()&&(e.x<i||e.x>s||e.y<t||e.y>n)?(this.close(),this.closeYearsSelect(),this.closeMonthsSelect()):(this.years.isVisible()&&this.closeYearsSelect(),this.months.isVisible()&&this.closeMonthsSelect()))}},{key:"_handleGlobalKey",value:function(e){this.datepicker.isVisible()&&(e.keyCode===y.Keys.ENTER?(c.stopEvent(e),this.setDate(this.date),this.close(),this.element.focus()):e.keyCode===y.Keys.ESCAPE&&(this.close(),this.element.focus()))}},{key:"_handleHourKey",value:function(e){e.keyCode===y.Keys.UP_ARROW?(c.stopEvent(e),f.plusHours(this.date,1),this.setDate(this.date),this.hourInput.domElement.setSelectionRange(0,this.hourInput.getValue().length)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusHours(this.date,-1),this.setDate(this.date),this.hourInput.domElement.setSelectionRange(0,this.hourInput.getValue().length)):e.keyCode===y.Keys.ENTER&&this.date.setHours(parseInt(this.hourInput.getValue()))}},{key:"_handleInputClick",value:function(){this.datepicker.isVisible()||(this.open(),this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length),this.monthInput.focus())}},{key:"_handleInputKey",value:function(e){this.datepicker.isVisible()&&e.keyCode===y.Keys.TAB&&(c.stopEvent(e),(e.shiftKey?(this.ampmInput.domElement.setSelectionRange(0,this.ampmInput.getValue().length),this.ampmInput):(this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length),this.monthInput)).focus())}},{key:"_handleMinuteKey",value:function(e){e.keyCode===y.Keys.UP_ARROW?(c.stopEvent(e),f.plusMinutes(this.date,1),this.setDate(this.date),this.minuteInput.domElement.setSelectionRange(0,this.minuteInput.getValue().length)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusMinutes(this.date,-1),this.setDate(this.date),this.minuteInput.domElement.setSelectionRange(0,this.minuteInput.getValue().length)):e.keyCode===y.Keys.ENTER&&this.date.setMinutes(parseInt(this.minuteInput.getValue()))}},{key:"_handleMonthExpand",value:function(e){c.stopEvent(e),this.openMonthSelect()}},{key:"_handleMonthKey",value:function(e){e.keyCode===y.Keys.TAB&&e.shiftKey?(c.stopEvent(e),(this.options.dateOnly?(this.yearInput.domElement.setSelectionRange(0,this.yearInput.getValue().length),this.yearInput):(this.ampmInput.domElement.setSelectionRange(0,this.ampmInput.getValue().length),this.ampmInput)).focus()):e.keyCode===y.Keys.UP_ARROW?(c.stopEvent(e),f.plusMonths(this.date,1),this.setDate(this.date),this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusMonths(this.date,-1),this.setDate(this.date),this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length)):e.keyCode===y.Keys.ENTER&&this.date.setMonth(parseInt(this.monthInput.getValue())-1)}},{key:"_handleNextMonth",value:function(e){c.stopEvent(e),this.nextMonth()}},{key:"_handlePreviousMonth",value:function(e){c.stopEvent(e),this.previousMonth()}},{key:"_handleSecondKey",value:function(e){e.keyCode===y.Keys.UP_ARROW?(c.stopEvent(e),f.plusSeconds(this.date,1),this.setDate(this.date),this.secondInput.domElement.setSelectionRange(0,this.secondInput.getValue().length)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusSeconds(this.date,-1),this.setDate(this.date),this.secondInput.domElement.setSelectionRange(0,this.secondInput.getValue().length)):e.keyCode===y.Keys.ENTER&&this.date.setSeconds(parseInt(this.secondInput.getValue()))}},{key:"_handleYearExpand",value:function(e){c.stopEvent(e),this.openYearSelect()}},{key:"_handleYearKey",value:function(e){e.keyCode===y.Keys.UP_ARROW?(c.stopEvent(e),f.plusYears(this.date,1),this.setDate(this.date),this.yearInput.domElement.setSelectionRange(0,this.yearInput.getValue().length)):e.keyCode===y.Keys.DOWN_ARROW?(c.stopEvent(e),f.plusYears(this.date,-1),this.setDate(this.date),this.yearInput.domElement.setSelectionRange(0,this.yearInput.getValue().length)):e.keyCode===y.Keys.TAB&&this.options.dateOnly?(c.stopEvent(e),(e.shiftKey?(this.dayInput.domElement.setSelectionRange(0,this.dayInput.getValue().length),this.dayInput):(this.monthInput.domElement.setSelectionRange(0,this.monthInput.getValue().length),this.monthInput)).focus()):e.keyCode===y.Keys.ENTER&&this.date.setFullYear(parseInt(this.yearInput.getValue()))}},{key:"_rebuild",value:function(){this.drawCalendar(this.date),this._refreshInputs(),this.options.dateOnly&&this.time.hide()}},{key:"_refreshInputs",value:function(){var e=f.getHourOfDay(this.date),e=(this.hourInput.setValue(e),this.date.getMinutes()),e=(this.minuteInput.setValue(("00"+e).slice(-2)),this.date.getSeconds());this.secondInput.setValue(("00"+e).slice(-2)),12<=this.date.getHours()?this.ampmInput.setValue(u.AM_PM[1]):this.ampmInput.setValue(u.AM_PM[0]),this.monthInput.setValue(this.date.getMonth()+1),this.dayInput.setValue(this.date.getDate()),this.yearInput.setValue(this.date.getFullYear())}},{key:"_setInitialOptions",value:function(){this.options={className:"prime-date-picker",closeTimeout:200,dateOnly:!1};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}],[{key:"SHORT_DAY_NAMES",get:function(){return K}},{key:"MONTHS",get:function(){return W}},{key:"DATE_SEPARATOR",get:function(){return"/"}},{key:"TIME_SEPARATOR",get:function(){return":"}},{key:"AM_PM",get:function(){return U}}]),u}(),E=function(){function n(e,t){_classCallCheck(this,n),c.bindAll(this),this.element=l.wrap(e),this.dismissButton=t,this._setInitialOptions()}return _createClass(n,[{key:"close",value:function(){this.element.addClass("closed"),setTimeout(function(){this.element.removeFromDOM()}.bind(this),this.options.closeTimeout)}},{key:"destroy",value:function(){this.dismissButton.removeEventListener("click",this._handleClick)}},{key:"initialize",value:function(){return this.dismissButton.addEventListener("click",this._handleClick),this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_handleClick",value:function(e){c.stopEvent(e),this.close()}},{key:"_setInitialOptions",value:function(){this.options={closeTimeout:400}}}]),n}(),k=function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),this._setInitialOptions(),this.draggable=null}return _createClass(t,[{key:"close",value:function(){return this.element.removeClass("open"),null!==this.draggable&&(this.draggable.destroy(),this.draggable=null),setTimeout(function(){this.element.hide();var e=this._determineZIndex();0!==e?u.instance.setZIndex(e):u.instance.close()}.bind(this),this.options.closeTimeout),this}},{key:"destroy",value:function(){return this.close(),this}},{key:"initialize",value:function(){return this.element.hide(),this}},{key:"open",value:function(){var e=this._determineZIndex(),e=(u.instance.open(e+this.options.zIndexOffset),this.element.setStyle("zIndex",(e+this.options.zIndexOffset+10).toString()),this.element.show(),this.element.addClass("open"),null!==this.options.callback&&this.options.callback(this),m.getInnerHeight()),t=this.element.getHeight();return this.element.setTop((e-t)/2-20),this._setupButtons(),null===this.draggable&&null!==this.options.draggableElementSelector&&null!==this.element.queryFirst(this.options.draggableElementSelector)&&(this.draggable=new p(this.element,this.options.draggableElementSelector).initialize()),this}},{key:"setHTML",value:function(e){return this.element.setHTML(e),this._setupButtons(),this}},{key:"withCallback",value:function(e){return this.options.callback=e,this}},{key:"withClassName",value:function(e){return this.options.className=e,this}},{key:"withCloseButtonElementSelector",value:function(e){return this.options.closeButtonElementSelector=e,this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withDraggableButtonElementSelector",value:function(e){return this.options.draggableElementSelector=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_determineZIndex",value:function(){var n=0;return h.query("."+this.options.className).each(function(e){var t=parseInt(e.getComputedStyle().zIndex);e.isVisible()&&n<t&&(n=t)}),n}},{key:"_handleCloseClickEvent",value:function(e){c.stopEvent(e),this.close()}},{key:"_setupButtons",value:function(){this.element.query(this.options.closeButtonElementSelector).each(function(e){e.addEventListener("click",this._handleCloseClickEvent)}.bind(this))
1}},{key:"_setInitialOptions",value:function(){this.options={callback:null,className:"prime-dialog",closeButtonElementSelector:'[data-dialog-role="close-button"]',closeTimeout:200,draggableElementSelector:'[data-dialog-role="draggable"]',zIndexOffset:1e3};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),b=function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),this._setInitialOptions(),this.draggable=null}return _createClass(t,[{key:"close",value:function(e){try{this.options.endFunction(this)}finally{var t=(new Date).getTime()-this.startInstant;t<this.options.minimumTime?setTimeout(function(){this.overlay.removeFromDOM(),e&&e()}.bind(this),this.options.minimumTime-t):(this.overlay.removeFromDOM(),e&&e())}return this}},{key:"open",value:function(){this.startInstant=(new Date).getTime(),this.overlay=h.newElement("<div/>").setId("prime-in-progress-overlay").appendTo(document.body),h.newElement("<i/>",{class:"fa fa-spin fa-"+this.options.iconName}).appendTo(this.overlay);var e=this.element.getCoordinates(),t=h.bodyElement.getCoordinates();return this.overlay.setTop(e.top-t.top),this.overlay.setLeft(e.left-t.left),this.overlay.setWidth(this.element.getBorderedWidth()),this.overlay.setHeight(this.element.getBorderedHeight()),this.overlay.setStyle("zIndex",(this.element.getRelativeZIndex()+1e3).toString()),this.options.startFunction(this),this}},{key:"withEndFunction",value:function(e){return this.options.endFunction=e,this}},{key:"withIconName",value:function(e){return this.options.iconName=e,this}},{key:"withMinimumTime",value:function(e){return this.options.minimumTime=e,this}},{key:"withStartFunction",value:function(e){return this.options.startFunction=e,this}},{key:"_setInitialOptions",value:function(){this.options={endFunction:function(){},iconName:"refresh",minimumTime:1e3,startFunction:function(){}};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),C=function(){function i(e,t,n){if(_classCallCheck(this,i),c.bindAll(this),this.searchResults=l.wrap(t),this.inputElement=l.wrap(e),"INPUT"!==this.inputElement.domElement.tagName)throw new TypeError("You can only use Prime.Widgets.SearchResults with INPUT elements");this._setInitialOptions(n)}return _createClass(i,[{key:"closeSearchResults",value:function(){this._removeAllSearchResults(),this.inputElement.setValue(""),this.searchResults.removeClass("open"),setTimeout(function(){this.searchResults.hide(),this.resizeInput()}.bind(this),this.options.closeTimeout)}},{key:"destroy",value:function(){this.inputElement.removeEventListener("blur",this._handleBlurEvent).removeEventListener("click",this._handleClickEvent).removeEventListener("keyup",this._handleKeyUpEvent).removeEventListener("keydown",this._handleKeyDownEvent).removeEventListener("focus",this._handleFocusEvent)}},{key:"focus",value:function(){this.inputElement.focus()}},{key:"getHighlightedSearchResult",value:function(){return this.searchResults.queryFirst(".selected")}},{key:"highlightNextSearchResult",value:function(){var e=this.getHighlightedSearchResult();return null!==(e=null===(e=null!==e?e.getNextSibling():e)?this.searchResults.queryFirst(".search-result"):e)&&this.highlightSearchResult(e),this}},{key:"highlightPreviousSearchResult",value:function(){var e=this.getHighlightedSearchResult();return null!==(e=null===(e=null!==e?e.getPreviousSibling():e)?this.searchResults.queryFirst(".search-result"):e)&&this.highlightSearchResult(e),this}},{key:"highlightSearchResult",value:function(e){this.searchResults.getChildren().removeClass("selected"),e.addClass("selected");var t=this.searchResults.getScrollTop(),n=this.searchResults.getHeight(),i=e.getOffsetTop();return t+n<=i+1?this.searchResults.scrollTo(e.getOffsetTop()-this.searchResults.getHeight()+e.getOuterHeight()):i<t&&this.searchResults.scrollTo(i),this}},{key:"initialize",value:function(){return this.inputElement.addEventListener("blur",this._handleBlurEvent).addEventListener("click",this._handleClickEvent).addEventListener("input",this._handleInputEvent).addEventListener("keyup",this._handleKeyUpEvent).addEventListener("keydown",this._handleKeyDownEvent).addEventListener("focus",this._handleFocusEvent),this.closeSearchResults(),this}},{key:"isCustomAddVisible",value:function(){return null!==this.searchResults.queryFirst(".custom-add")}},{key:"isSearchResultsVisible",value:function(){return this.searchResults.hasClass("open")}},{key:"resizeInput",value:function(){var e=""===this.inputElement.getValue()?this.inputElement.getAttribute("placeholder"):this.inputElement.getValue(),e=c.calculateTextLength(this.inputElement,e)+35;this.inputElement.setWidth(e)}},{key:"search",value:function(e){c.isDefined(e)&&this.inputElement.getValue()!==e&&this.inputElement.setValue(e),e=c.isDefined(e)?e.toLowerCase():this.inputElement.getValue(),this.resizeInput(),this._removeAllSearchResults();
1var t=this.options.callbackObject.search(e);if(!t.hasOwnProperty("results")||!t.hasOwnProperty("tooManyResults"))throw new TypeError("The callback must return an Object that contains the properties results[Array] and tooManyResults[boolean]");for(var n=0,i=null,s=0;s<t.results.length;s++){var o=t.results[s],r=h.newElement("<li/>").addClass("search-result").setAttribute("value",o).setHTML(o).addEventListener("click",this._handleClickEvent).addEventListener("mouseover",this._handleMouseOverEvent).appendTo(this.searchResults);o.toLowerCase().trim()===e.toLowerCase().trim()&&(i=r),n++}var l=e.trim().length;return!this.options.customAddEnabled||0===l||null!==i||"doesNotContainValue"in this.options.callbackObject&&!this.options.callbackObject.doesNotContainValue(e)||(i=h.newElement("<li/>").addClass("custom-add").addEventListener("click",this._handleClickEvent).addEventListener("mouseover",this._handleMouseOverEvent).setHTML(this.options.customAddLabel+c.escapeHTML(e)).appendTo(this.searchResults),n++),0===n&&0!==l&&(h.newElement("<li/>").addClass("no-search-results").setHTML(this.options.noSearchResultsLabel+c.escapeHTML(e)).appendTo(this.searchResults),n++),t.tooManyResults&&(h.newElement("<li/>").addClass("too-many-search-results").setHTML(this.options.tooManySearchResultsLabel+c.escapeHTML(e)).appendTo(this.searchResults),n++),0!==n?(this.searchResults.show(),this.searchResults.addClass("open"),10<=n?this.searchResults.setHeight(10*this.searchResults.getChildren()[0].getOuterHeight()+1):this.searchResults.setHeight(this.searchResults.getChildren()[0].getOuterHeight()*n+1)):this.closeSearchResults(),null!==i&&this.highlightSearchResult(i),this}},{key:"selectHighlightedSearchResult",value:function(){var e,t=this.getHighlightedSearchResult();return null!==t&&(t=(e=t.hasClass("custom-add"))?this.inputElement.getValue().trim():t.getHTML(),!e||this.options.customAddCallback(t))&&(this.options.callbackObject.selectSearchResult(t),this.closeSearchResults()),this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withCustomAddEnabled",value:function(e){return this.options.customAddEnabled=e,this}},{key:"withCustomAddCallback",value:function(e){return this.options.customAddCallback=e,this}},{key:"withCustomAddLabel",value:function(e){return this.options.customAddLabel=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"withNoSearchResultsLabel",value:function(e){return this.options.noSearchResultsLabel=e,this}},{key:"withTooManySearchResultsLabel",value:function(e){return this.options.tooManySearchResultsLabel=e,this}},{key:"_handleBlurEvent",value:function(){window.setTimeout(function(){document.activeElement!==this.inputElement.domElement&&this.closeSearchResults()}.bind(this),300)}},{key:"_handleClickEvent",value:function(e){var t=new l(e.currentTarget);t.hasClass("custom-add")||t.hasClass("search-result")?this.selectHighlightedSearchResult():t.domElement===this.inputElement.domElement?this.search():console.log("Clicked something else target=["+e.target+"] currentTarget=["+e.currentTarget+"]")}},{key:"_handleFocusEvent",value:function(){this.search()}},{key:"_handleInputEvent",value:function(){this.search()}},{key:"_handleKeyDownEvent",value:function(e){var t=e.keyCode;t===y.Keys.BACKSPACE?this.previousSearchString=this.inputElement.getValue():t===y.Keys.UP_ARROW?(c.stopEvent(e),this.highlightPreviousSearchResult()):t===y.Keys.DOWN_ARROW?(c.stopEvent(e),this.isSearchResultsVisible()?this.highlightNextSearchResult():this.search()):(t===y.Keys.ENTER||t===y.Keys.TAB&&this.isSearchResultsVisible())&&c.stopEvent(e)}},{key:"_handleKeyUpEvent",value:function(e){var t=e.keyCode,n=this.inputElement.getValue();t===y.Keys.BACKSPACE?""===n&&""===this.previousSearchString?this.options.callbackObject.deletedBeyondSearchInput():this.search():t===y.Keys.ENTER?(c.stopEvent(e),null!==this.getHighlightedSearchResult()&&this.selectHighlightedSearchResult()):t===y.Keys.ESCAPE?this.closeSearchResults():t===y.Keys.TAB&&null!==this.getHighlightedSearchResult()&&(c.stopEvent(e),this.selectHighlightedSearchResult())}},{key:"_handleMouseOverEvent",value:function(e){e=new l(e.currentTarget);this.highlightSearchResult(e)}},{key:"_removeAllSearchResults",value:function(){this.searchResults.query("li").removeAllFromDOM()}},{key:"_setInitialOptions",value:function(e){this.options={callbackObject:e,closeTimeout:200,customAddEnabled:!0,customAddCallback:function(){return!0},customAddLabel:"Add Custom: ",noSearchResultsLabel:"No Matches For: ",tooManySearchResultsLabel:"Too Many Matches For: "};var t,n=c.dataSetToOptions(this.inputElement);for(t in n)n.hasOwnProperty(t)&&(this.options[t]=n[t])}}],[{key:"selectSearchFunction",value:function(e,t){for(var n=l.unwrap(t).options,i=[],s=0;s<n.length;s++){var o=new l(n[s]);o.isSelected()||(o=o.getHTML(),null!=e&&""!==e&&0!==o.toLowerCase().indexOf(e.toLowerCase()))||i.push(o)}return 0<i.length&&i.sort(),{results:i,tooManyResults:!1}}}]),i}(),w=1,S="MultipleSelect:addOption",T="MultipleSelect:deselectOption",_="MultipleSelect:selectOption",O=function(){function o(e){if(_classCallCheck(this,o),c.bindAll(this),this.initialized=!1,this.element=l.wrap(e),"SELECT"!==this.element.domElement.tagName)throw new TypeError("You can only use MultipleSelect with select elements");if("multiple"!==this.element.getAttribute("multiple"))throw new TypeError('The select box you are attempting to convert to a MultipleSelect must have the multiple="multiple" attribute set');this._setInitialOptions()}return _createClass(o,[{key:"addEventListener",value:function(e,t){return this.element.addEventListener(e,t),this}},{key:"containsOptionWithValue",value:function(e){return null!==this.findOptionWithValue(e)}},{key:"addOption",value:function(e,t,n){return null==n&&this.containsOptionWithValue(e)||(t=h.newElement("<option/>").setValue(e).setHTML(t).appendTo(this.element),n&&t.setDataAttribute("optionId",n),this.element.fireEvent(o.AddOptionEvent,e,this)),this}},{key:"deselectOptionWithValue",value:function(e){var t=this.findOptionWithValue(e);if(null===t)throw new Error("MultipleSelect doesn't contain an option with the value ["+e+"]");return this.deselectOption(t),this}},{key:"deselectOption",value:function(e){e.setSelected(!1);var t=e.getDataAttribute("optionId")||this._makeOptionID(e),t=h.queryById(t);return null!==t&&t.removeFromDOM(),1===this.optionList.query("li").length&&(this.input.setAttribute("placeholder",this.options.placeholder),this.searcher.resizeInput()),this.element.fireEvent(o.DeselectOptionEvent,e.getValue(),this),this}},{key:"destroy",value:function(){this.element.show(),this.displayContainer.removeFromDOM()}},{key:"findOptionWithText",value:function(e){for(var t=this.element.getOptions(),n=0;n<t.length;n++)if(t[n].getTextContent()===e)return t[n];return null}},{key:"deselectOptionWithId",value:function(e){var t=o.findOptionWithId(e);if(null===t)throw new Error("MultipleSelect doesn't contain an option with the id ["+e+"]");return this.deselectOption(t),this}},{key:"findOptionWithValue",value:function(e){for(var t=0;t<this.element.domElement.length;t++){var n=this.element.domElement.options[t];if(n.value===e)return new l(n)}return null}},{key:"getSelectedValues",value:function(){return this.element.getSelectedValues()}},{key:"hasOptionWithValue",value:function(e){return null!==this.findOptionWithValue(e)}},{key:"highlightOptionForUnselect",value:function(){var e=this.optionList.getChildren();return 1<e.length&&e[e.length-2].addClass("selected"),this}},{key:"initialize",value:function(){this.element.hide();var e=this.element.getId();if(null!==e&&""!==e||(e="prime-multiple-select"+o.count++,this.element.setId(e)),this.displayContainer=h.queryById(e+"-display"),(this.input=null)===this.displayContainer?(this.displayContainer=h.newElement("<div/>").setId(e+"-display").addClass(this.options.className).addEventListener("click",this._handleClickEvent).addEventListener("keyup",this._handleKeyUpEvent).insertAfter(this.element),this.optionList=h.newElement("<ul/>").addClass("option-list").appendTo(this.displayContainer),this.searchResults=h.newElement("<ul/>").addClass("search-results").hide().appendTo(this.displayContainer)):(this.displayContainer.removeAllEventListeners().addEventListener("click",this._handleClickEvent).addEventListener("keyup",this._handleKeyUpEvent),this.optionList=this.displayContainer.queryFirst(".option-list"),this.searchResults=this.displayContainer.queryFirst(".search-results")),h.queryFirst("html").addEventListener("click",this._handleGlobalClickEvent),this.searchResults.hide(),this._redraw(),0<this.options.initialSelectedOrder.length)for(var t=0;t<this.options.initialSelectedOrder.length;t++){var n=this.element.queryFirst("option[value="+this.options.initialSelectedOrder[t]+"]");null!==n&&n.isSelected()&&this.selectOption(n)}return this.initialized=!0,this}},{key:"isLastOptionHighlightedForUnselect",value:function(){var e=this.optionList.getChildren();return 1<e.length&&e[e.length-2].hasClass("selected")}},{key:"removeAllOptions",value:function(){for(var e=this.element.domElement.options,t=e.length-1;0<=t;t--)this.removeOption(new l(e[t]));return this}},{key:"removeHighlightedOption",value:function(){var e=this.optionList.getChildren();this.options.allowDuplicates?this.deselectOptionWithId(e[e.length-2].getId()):this.deselectOptionWithValue(e[e.length-2].getAttribute("value")),this.search()}},{key:"removeOption",value:function(e){if(e instanceof l)return e.removeFromDOM(),e=this.options.allowDuplicates?e.getDataAttribute("optionId"):this._makeOptionID(e),null!==(e=h.queryById(e))&&e.removeFromDOM(),this;throw new TypeError("MultipleSelect#removeOption only takes PrimeElement instances")}},{key:"removeOptionWithValue",value:function(e){var t=this.findOptionWithValue(e);if(null===t)throw new Error("MultipleSelect doesn't contain an option with the value ["+e+"]");return this.removeOption(t),this}},{key:"selectOption",value:function(e){var t,n,i,s;if(e instanceof l)return t=this._makeOptionID(e),n=h.queryById(t),i=!this.initialized&&0<this.options.initialSelectedOrder.length,(this.options.preserveDisplayedSelectionOrder||i)&&(s=(i=e.getParent()).getLastChild("option"),e.getValue()!==s.getValue())&&
1(e.removeFromDOM(),e.appendTo(i),null!==n)&&(n.removeFromDOM(),n=null),null===n&&(this.options.allowDuplicates&&(this.addOption(e.getValue(),e.getHTML(),t),e=o.findOptionWithId(t)),e.setSelected(!0),s=h.newElement("<li/>").setAttribute("value",e.getValue()).setId(t).insertBefore(this.inputOption),h.newElement("<span/>").setHTML(e.getHTML()).setAttribute("value",e.getValue()).appendTo(s),h.newElement("<a/>").setAttribute("href","#").setAttribute("value",e.getValue()).setHTML(this.options.removeIcon).addEventListener("click",this._handleClickEvent).appendTo(s)),this.input.removeAttribute("placeholder"),this.searcher.closeSearchResults(),this.optionList.scrollToBottom(),this.element.fireEvent(o.SelectOptionEvent,e.getValue(),this),this;throw new TypeError("MultipleSelect#selectOption only takes PrimeElement instances")}},{key:"selectOptionWithValue",value:function(e){var t=this.findOptionWithValue(e);if(null===t)throw new Error("MultipleSelect doesn't contain an option with the value ["+e+"]");return this.selectOption(t),this}},{key:"setSelectedValues",value:function(){return this.element.setSelectedValues.apply(this.element,arguments),this._redraw(),this}},{key:"unhighlightOptionForUnselect",value:function(){return this.optionList.getChildren().each(function(e){e.removeClass("selected")}),this}},{key:"withAllowDuplicates",value:function(e){return this.options.allowDuplicates=e,this}},{key:"withClassName",value:function(e){return this.options.className=e,this}},{key:"withCloseTimeout",value:function(e){return this.options.closeTimeout=e,this}},{key:"withCustomAddEnabled",value:function(e){return this.options.customAddEnabled=e,this}},{key:"withCustomAddLabel",value:function(e){return this.options.customAddLabel=e,this}},{key:"withErrorClassHandling",value:function(e){return this.options.errorClass=e,this}},{key:"withNoSearchResultsLabel",value:function(e){return this.options.noSearchResultsLabel=e,this}},{key:"withPlaceholder",value:function(e){return this.options.placeholder=e,this}},{key:"withPreserveDisplayedSelectionOrder",value:function(e){return this.options.preserveDisplayedSelectionOrder=e,this}},{key:"withRemoveIcon",value:function(e){return this.options.removeIcon=e,this}},{key:"withSearchFunction",value:function(e){return this.options.searchFunction=e,this}},{key:"withInitialSelectedOrder",value:function(e){return this.options.initialSelectedOrder=e,this}},{key:"deletedBeyondSearchInput",value:function(){this.isLastOptionHighlightedForUnselect()&&this.removeHighlightedOption(),this.highlightOptionForUnselect()}},{key:"doesNotContainValue",value:function(e){return!this.containsOptionWithValue(e)}},{key:"search",value:function(e){return this.unhighlightOptionForUnselect(),this.options.searchFunction.call(null,e,this.element)}},{key:"selectSearchResult",value:function(e){e=c.unescapeHTML(e);var t=this.findOptionWithText(e);null===t&&(this.addOption(e,c.escapeHTML(e)),t=this.findOptionWithValue(e)),this.selectOption(t)}},{key:"_handleBlurEvent",value:function(){window.setTimeout(function(){document.activeElement!==this.input.domElement&&this.searcher.closeSearchResults()}.bind(this),300),this.displayContainer.removeClass("focus")}},{key:"_handleClickEvent",value:function(e){c.stopEvent(e);var t,e=new l(e.target);e.is("a")?this.options.allowDuplicates?(t=e.getParent().getId(),this.removeOption(o.findOptionWithId(t))):this.removeOptionWithValue(e.getAttribute("value")):e.is("span")?e.selectElementContents():this.input.focus()}},{key:"_handleFocusEvent",value:function(){this.displayContainer.addClass("focus")}},{key:"_handleGlobalClickEvent",value:function(e){e=new l(e.target);this.displayContainer.domElement===e.domElement||e.isChildOf(this.displayContainer)||this.searcher.closeSearchResults()}},{key:"_handleKeyUpEvent",value:function(e){e.keyCode===y.Keys.ESCAPE&&this.unhighlightOptionForUnselect()}},{key:"_makeOptionID",value:function(e){var n;return!0===this.options.allowDuplicates?(n=(new Date).getTime(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})):this.element.getId()+"-option-"+e.getValue().replace(" ","-")}},{key:"_redraw",value:function(){this.optionList.getChildren().each(function(e){e.removeFromDOM()}),this.inputOption=h.newElement("<li/>").appendTo(this.optionList),this.input=h.newElement("<input/>").addEventListener("click",this._handleClickEvent).addEventListener("blur",this._handleBlurEvent).addEventListener("focus",this._handleFocusEvent).setAttribute("type","text").appendTo(this.inputOption),this.searcher=new C(this.input,this.searchResults,this).withOptions(this.options).initialize();for(var e=!1,t=this.element.getOptions(),n=0;n<t.length;n++){var i=t[n];i.isSelected()&&(this.selectOption(i),e=!0)}e||this.input.setAttribute("placeholder",this.options.placeholder),this.searcher.resizeInput(),this.options.errorClass&&this.element.hasClass(this.options.errorClass)&&this.displayContainer.addClass(this.options.errorClass)}},{key:"_setInitialOptions",value:function(){this.options={allowDuplicates:!1,className:"prime-multiple-select",closeTimeout:200,customAddEnabled:!0,customAddLabel:"Add Custom Value: ",errorClass:null,initialSelectedOrder:[],noSearchResultsLabel:"No Matches For: ",placeholder:"Choose",preserveDisplayedSelectionOrder:!1,searchFunction:C.selectSearchFunction,removeIcon:"X"};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}
1],[{key:"count",get:function(){return w},set:function(e){w=e}},{key:"AddOptionEvent",get:function(){return S},set:function(e){S=e}},{key:"DeselectOptionEvent",get:function(){return T},set:function(e){T=e}},{key:"SelectOptionEvent",get:function(){return _},set:function(e){_=e}},{key:"findOptionWithId",value:function(e){return h.queryFirst('[data-option-id="'+e+'"]')}}]),o}(),L=function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),this._setInitialOptions()}return _createClass(t,[{key:"destroy",value:function(){return this.element.removeEventListener("click",this._handleMoveDownClick),this.element.removeEventListener("click",this._handleMoveUpClick),this}},{key:"initialize",value:function(){return this.element.addDelegatedEventListener("click",this.options.moveDownSelector,this._handleMoveDownClick),this.element.addDelegatedEventListener("click",this.options.moveUpSelector,this._handleMoveUpClick),this._refreshButtonStates(),this}},{key:"moveDown",value:function(e){return null!==e&&e.getNextSibling().insertBefore(e),this._refreshButtonStates(),this.options.reorderCallback&&this.options.reorderCallback(this,e),this}},{key:"moveUp",value:function(e){return null!==e&&e.getPreviousSibling().insertAfter(e),this._refreshButtonStates(),this.options.reorderCallback&&this.options.reorderCallback(this,e),this}},{key:"withItemSelector",value:function(e){return this.options.itemSelector=e,this}},{key:"withDownSelector",value:function(e){return this.options.moveDownSelector=e,this}},{key:"withMoveUpSelector",value:function(e){return this.options.moveUpSelector=e,this}},{key:"withReorderCallback",value:function(e){return this.options.reorderCallback=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"redraw",value:function(){return this._refreshButtonStates(),this}},{key:"_handleMoveDownClick",value:function(e){c.stopEvent(e);e=new l(e.target).queryUp(this.options.itemSelector);this.moveDown(e)}},{key:"_handleMoveUpClick",value:function(e){c.stopEvent(e);e=new l(e.target).queryUp(this.options.itemSelector);this.moveUp(e)}},{key:"_refreshButtonStates",value:function(){var n=this.element.query(this.options.itemSelector);0!==n.length&&(1===n.length?(n[0].queryFirst(this.options.moveDownSelector).addClass("disabled"),n[0].queryFirst(this.options.moveUpSelector).addClass("disabled"),n[0].setDataAttribute("index",0)):n.each(function(e,t){0===t?(e.queryFirst(this.options.moveUpSelector).addClass("disabled"),e.queryFirst(this.options.moveDownSelector).removeClass("disabled")):t===n.length-1?(e.queryFirst(this.options.moveUpSelector).removeClass("disabled"),e.queryFirst(this.options.moveDownSelector).addClass("disabled")):(e.queryFirst(this.options.moveDownSelector).removeClass("disabled"),e.queryFirst(this.options.moveUpSelector).removeClass("disabled")),e.setDataAttribute("index",t)}.bind(this)))}},{key:"_setInitialOptions",value:function(){this.options={itemSelector:"data-item",moveDownSelector:"a.down",moveUpSelector:"a.up",reorderCallback:null};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),D=function(){function n(e,t){_classCallCheck(this,n),c.bindAll(this),this.element=l.wrap(e),this.eventPropagationHandler=t}return _createClass(n,[{key:"destroy",value:function(){this.element.removeEventListener("touchstart",this._handleTouchStart).removeEventListener("touchmove",this._handleTouchMove).removeEventListener("touchcancel",this._handleTouchCancel).removeEventListener("touchend",this._handleTouchEnd).removeEventListenersByPattern(/Prime\.Widgets\.Touchable:.+/)}},{key:"initialize",value:function(){return this.element.addEventListener("touchstart",this._handleTouchStart).addEventListener("touchmove",this._handleTouchMove).addEventListener("touchcancel",this._handleTouchCancel).addEventListener("touchend",this._handleTouchEnd),this}},{key:"withLongPressHandler",value:function(e){return this.element.addEventListener("Touchable:longPress",e),this}},{key:"withMoveHandler",value:function(e){return this.element.addEventListener("Touchable:move",e),this}},{key:"withSwipeDownHandler",value:function(e){return this.element.addEventListener("Touchable:swipeDown",e),this}},{key:"withSwipeLeftHandler",value:function(e){return this.element.addEventListener("Touchable:swipeLeft",e),this}},{key:"withSwipeRightHandler",value:function(e){return this.element.addEventListener("Touchable:swipeRight",e),this}},{key:"withSwipeUpHandler",value:function(e){return this.element.addEventListener("Touchable:swipeUp",e),this}},{key:"_collectTouchData",value:function(e){1<e.changedTouches.length||(e=e.changedTouches[0],this.elapsedTime=(new Date).getTime()-this.touchStarted,this.touchEndX=e.pageX,this.touchEndY=e.pageY,this.touchX=this.touchStartX-this.touchEndX,this.touchY=this.touchStartY-this.touchEndY)}},{key:"_finished",value:function(){var e={elapsedTime:this.elapsedTime,touchStartX:this.touchStartX,touchStartY:this.touchStartY,touchEndX:this.touchEndX,touchEndY:this.touchEndY,touchX:this.touchX,touchY:this.touchY,element:this.element,target:this.element.domElement};e.swipe=50<Math.abs(e.touchX)||50<Math.abs(e.touchY),e.swipeX=e.swipe&&Math.abs(e.touchX)>Math.abs(e.touchY),e.swipeY=e.swipe&&!e.swipeX,e.longPress=!e.swipe&&500<e.elapsedTime,e.longPress?this.element.fireCustomEvent("Touchable:longPress",e):e.swipeX&&0<e.touchX?this.element.fireCustomEvent("Touchable:swipeLeft",e):e.swipeX?this.element.fireCustomEvent("Touchable:swipeRight",e):e.swipeY&&0<e.touchY?this.element.fireCustomEvent("Touchable:swipeUp",e):e.swipeY&&this.element.fireCustomEvent("Touchable:swipeDown",e)}},{key:"_handleTouchCancel",value:function(e){this._collectTouchData(e),this._finished(),c.isDefined(this.eventPropagationHandler)&&this.eventPropagationHandler(e)}},{key:"_handleTouchEnd",value:function(e){this._collectTouchData(e),this._finished(),c.isDefined(this.eventPropagationHandler)&&this.eventPropagationHandler(e)}},{key:"_handleTouchMove",value:function(e){this.element.fireEvent("Touchable:move",e),c.isDefined(this.eventPropagationHandler)&&this.eventPropagationHandler(e)}},{key:"_handleTouchStart",value:function(e){var t;1<e.changedTouches.length||(t=e.changedTouches[0],this.touchStarted=(new Date).getTime(),this.touchStartX=t.pageX,this.touchStartY=t.pageY),c.isDefined(this.eventPropagationHandler)&&this.eventPropagationHandler(e)}}]),n}(),I=function(){function n(e,t){_classCallCheck(this,n),c.bindAll(this),this.sideMenu=l.wrap(t),this.button=l.wrap(e),this._setInitialOptions()}return _createClass(n,[{key:"close",value:function(){return h.bodyElement.hasClass(this.options.closedClass)||h.bodyElement.addClass(this.options.closedClass),h.bodyElement.hasClass(this.options.openClass)&&h.bodyElement.removeClass(this.options.openClass),this}},{key:"initialize",value:function(){return this.button.addEventListener("click",this._handleClickEvent),this}},{key:"isOpen",value:function(){return 0<=this.sideMenu.getLeft()}},{key:"open",value:function(){return h.bodyElement.hasClass(this.options.closedClass)&&h.bodyElement.removeClass(this.options.closedClass),h.bodyElement.hasClass(this.options.openClass)||h.bodyElement.addClass(this.options.openClass),this.touchable=new D(h.bodyElement).withSwipeLeftHandler(this._handleSwipeLeft),this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_handleClickEvent",value:function(e){c.stopEvent(e),this.isOpen()?this.close():this.open()}},{key:"_handleSwipeLeft",value:function(){this.isOpen()&&this.close(),c.isDefined(this.touchable)&&(this.touchable.destroy(),this.touchable=null)}},{key:"_setInitialOptions",value:function(){this.options={closedClass:"prime-side-menu-closed",openClass:"prime-side-menu-open"};var e,t=c.dataSetToOptions(this.sideMenu);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),n}(),A={supported:"undefined"!=typeof Storage,setSessionObject:function(e,t){A._setObject(sessionStorage,e,t)},getSessionObject:function(e){return A._getObject(sessionStorage,e)},setLocalObject:function(e,t){A._setObject(localStorage,e,t)},getLocalObject:function(e){return A._getObject(localStorage,e)},_getObject:function(e,t){if(A.supported){e=e.getItem(t);if(null!==e)return JSON.parse(e)}return null}
1,_setObject:function(e,t,n){A.supported&&e.setItem(t,JSON.stringify(n))}},M=function(){function t(e){if(_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),this.currentAction=this.element.queryFirst("a"),null===this.currentAction)throw new TypeError("The SplitButton element must contain an <a> that is the currently selected action.");if(this.loading=this.currentAction,this.button=this.element.queryFirst("button"),null===this.button)throw new TypeError("The SplitButton element must contain a <button> that is used to open it.");if(this.menu=this.element.queryFirst(".menu"),null===this.menu)throw new TypeError('The SplitButton element must contain a <div class="menu"> that contains the menu items.');if(this.items=this.menu.query(".item"),0===this.items.length)throw new TypeError("The SplitButton element must contain at least one item.");this.actionIndex=null,this.options={},this._setInitialOptions()}return _createClass(t,[{key:"destroy",value:function(){this.button.removeEventListener("click",this._handleButtonClick)}},{key:"initialize",value:function(){var t=this;return this.button.addEventListener("click",this._handleButtonClick),this.items.each(function(e){return e.addEventListener("click",t._handleItemClick)}),this.redraw(),this}},{key:"redraw",value:function(){var e=null;return A.supported&&null!==this.options.localStorageKey&&null!==(e=A.getSessionObject(this.options.localStorageKey))&&this.selectAction(e),null===e&&this.selectDefaultAction(),this}},{key:"selectAction",value:function(e){var t,e=h.queryById(e);return null!==e?(t="",null!==this.loading?(t=this.loading.getAttribute("class"),this.loading.removeFromDOM(),this.loading=null):(t=this.currentAction.getAttribute("class"),this.currentAction.setAttribute("class",this.currentAction.getAttribute("data-original-class")),this.currentAction.removeFromDOM(),this.currentAction.prependTo(this.menu)),e.setAttribute("data-original-class",e.getAttribute("class")),e.setAttribute("class",t),e.removeFromDOM(),e.prependTo(this.element),this.currentAction=e):this.selectDefaultAction(),this}},{key:"selectDefaultAction",value:function(){for(var e=null,t=0;t<this.items.length;t++)if(this.items[t].hasClass("default")){e=this.items[t].getId();break}return null!==(e=null===e?this.items[0].getId():e)&&(this._saveLastAction(e),this.selectAction(e)),this}},{key:"withLocalStorageKey",value:function(e){return this.options.localStorageKey=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_handleButtonClick",value:function(e){c.stopEvent(e),this.menu.isVisible()?this.menu.hide():this.menu.show()}},{key:"_handleItemClick",value:function(e){for(var t=0;t<this.items.length;t++)if(this.items[t].domElement===e.target){var n=this.items[t].getId();this._saveLastAction(n),this.selectAction(n),this.menu.hide();break}}},{key:"_saveLastAction",value:function(e){A.supported&&null!==this.options.localStorageKey&&A.setSessionObject(this.options.localStorageKey,e)}},{key:"_setInitialOptions",value:function(){this.options={localStorageKey:null};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),x=function(){function t(e){if(_classCallCheck(this,t),c.bindAll(this),this.column=null,this.columnIndex=0,this.sortAscending=!0,this.element=l.wrap(e),this.thead=this.element.queryFirst("thead"),this.tbody=this.element.queryFirst("tbody"),!this.element.is("table"))throw new TypeError("The element you passed in is not a table element.");this._setInitialOptions()}return _createClass(t,[{key:"initialize",value:function(){return"false"!==this.element.getDataAttribute("sortable")&&this._initializeSort(),this.selectAll=this.element.queryFirst('thead > tr > th input[type="checkbox"]'),null!==this.selectAll&&this.selectAll.addEventListener("change",this._handleSelectAllChange),this.element.query('tbody > tr > td input[type="checkbox"]').addEventListener("click",this._handleCheckboxEvent),this.checkedCount=0,this.numberofCheckboxes=this.element.query('tbody td input[type="checkbox"]').length,this}},{key:"sort",value:function(){this._clearSortIndicators(),this.column.hasClass("sort-up")?(this.column.removeClass("sort-up").addClass("sort-down"),this.sortAscending=!1):((this.column.hasClass("sort-down")?this.column.removeClass("sort-down"):this.column).addClass("sort-up"),this.sortAscending=!0);var e,t=[],n=(this.tbody.query("tr").each(function(e){t.push(e)}),t.sort(this._comparator),0),i=t.length;if(this.sortAscending)for(n=0;n<i;n++)this.tbody.appendElement(t[n]);else for(n=i;0<n;n--)this.tbody.appendElement(t[n-1]);A.supported&&null!==this.options.localStorageKey&&(e={columnIndex:this.columnIndex,sortAscending:this.sortAscending},A.setSessionObject(this.options.localStorageKey,e))}},{key:"withCheckEventCallback",value:function(e){return this.options.checkEventCallback=e,this}},{key:"withLocalStorageKey",value:function(e){return this.options.localStorageKey=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_clearSortIndicators",value:function(){this.thead.query("th").each(function(e){e.domElement!==this.column.domElement&&e.removeClass("sort-up sort-down")}.bind(this))}},{key:"_comparator",value:function(e,t){var n=this.thead.query("th")[this.columnIndex].getDataAttribute("sortType")||"string";if("string"!==n&&"number"!==n)throw new Error("Unsupported sort type. [string] or [number] are the two supported sort types.");var e=e.query("td")[this.columnIndex],t=t.query("td")[this.columnIndex],i=e.getDataAttribute("sortValue"),s=t.getDataAttribute("sortValue"),i=i||e.getTextContent().toLowerCase(),e=s||t.getTextContent().toLowerCase();return"string"===n?i.localeCompare(e):(i=this._toNumber(i))<(e=this._toNumber(e))?-1:e<i?1:0}},{key:"_getColumnIndex",value:function(e){for(var t=0,n=e,i=e;null!==i;)n=i=n.getPreviousSibling(),t++;return t-1}},{key:"_handleCheckboxEvent",value:function(e){var e=new l(e.currentTarget),t=this.checkedCount;this.checkedCount=this.checkedCount+(e.isChecked()?1:-1),null!==this.selectAll&&(t===this.numberofCheckboxes&&this.numberofCheckboxes!==this.checkedCount?this.selectAll.setChecked(!1):t!==this.numberofCheckboxes&&this.numberofCheckboxes===this.checkedCount&&this.selectAll.setChecked(!0)),null!==this.options.checkEventCallback&&this.options.checkEventCallback({checkedCount:this.checkedCount})}},{key:"_handleSelectAllChange",value:function(){this.selectAll.isChecked()?this.element.query('tbody tr > td input[type="checkbox"]').each(function(e){e.isChecked()||(e.setChecked(!0),this.checkedCount++)}.bind(this)):this.element.query('tbody tr > td input[type="checkbox"]').each(function(e){e.isChecked()&&(e.setChecked(!1),this.checkedCount--)}.bind(this)),null!==this.options.checkEventCallback&&this.options.checkEventCallback({checkedCount:this.checkedCount})}},{key:"_handleSortableColumnClick",value:function(e){c.stopEvent(e);e=new l(e.currentTarget);this.column=e,this.columnIndex=this._getColumnIndex(e),this.sort()}},{key:"_initializeColumn",value:function(e){e.is('[data-sortable="false"]')||null!==e.queryFirst('input[type="checkbox"]')||e.addClass("sortable").addEventListener("click",this._handleSortableColumnClick)}},{key:"_initializeSort",value:function(){var e;this.thead.query("th").each(this._initializeColumn),A.supported&&null!==this.options.localStorageKey&&null!==(e=A.getSessionObject(this.options.localStorageKey))&&(this.columnIndex=e.columnIndex,this.sortAscending=e.sortAscending,this.column=this.thead.query("th")[this.columnIndex],this.sortAscending?this.column.addClass("sort-down"):this.column.addClass("sort-up"),this.sort())}},{key:"_setInitialOptions",value:function(){this.options={localStorageKey:null,checkEventCallback:null};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}},{key:"_toNumber",value:function(e){var t=Number(e);return isNaN(e)?(console.error(new Error("Expected value ["+e+"] to be a number.")),e):t}}]),t}(),Y=function(){function t(e){if(_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),"ul"===this.element.getTagName().toLowerCase()?this.tabsContainer=this.element:this.tabsContainer=this.element.queryFirst("ul"),null===this.tabsContainer)throw new TypeError("Tabs requires a ul element. The passed element does not contain a ul element");this._setInitialOptions(),this.tabContents={},this.tabs={},this.tabArray=[],this.selectedTab=null}return _createClass(t,[{key:"destroy",value:function(){this.tabsContainer.query("a").each(function(e){e.removeEventListener("click",this._handleClick)}.bind(this));for(var e=0;e<this.tabs.length;e++)this.tabs[e].removeClass(this.options.tabContentClass)}},{key:"hideTab",value:function(e){this.tabs[e].hide(),this.redraw()}},{key:"initialize",value:function(){var e;return this.tabsContainer.query("li:not(.disabled)").each(function(e){var t=e.queryFirst("a").addEventListener("click",this._handleClick),n=e.getDataSet(),t=t.getAttribute("href"),i="#"===t.charAt(0),e=(i?(n.tabId=t.substring(1),n.tabUrl=""):(n.tabId=t,n.tabUrl=t),this.tabs[n.tabId]=e,this.tabArray.push(e),h.queryById(n.tabId));if(null===e&&i)throw new Error("A div is required with the following ID ["+n.tabId+"]");(e=null===e?h.newElement("<div>").insertAfter(this.element).setAttribute("id",t):e).hide(),e.addClass(this.options.tabContentClass),this.tabContents[n.tabId]=e}.bind(this)),this.options.deepLinkingEnabled&&(e=window.location.hash.replace(/^#/,""),c.isDefined(e))&&c.isDefined(this.tabs[e])&&this.selectTab(e),this.redraw(),this}},{key:"redraw",value:function(){for(var e=null,t=null,n=!1,i=!0,s=0;s<this.tabArray.length;s++)this.tabArray[s].isVisible()?(null===e&&(e=this.tabArray[s]),t=this.tabArray[s],this.tabArray[s].hasClass("selected")&&(i=!1)):this.tabArray[s].hasClass("selected")&&(n=!0),this.tabArray[s].removeClass("first-visible-tab"),this.tabArray[s].removeClass("last-visible-tab");e.addClass("first-visible-tab"),t.addClass("last-visible-tab");var o,r=null;if((n||i)&&(null!==(r=A.supported&&null!==this.options.localStorageKey&&null!==(o=A.getSessionObject(this.options.localStorageKey))?o.tabId:r)&&this.tabs[r]&&this.tabs[r].isVisible()||(r=e.getDataSet().tabId),this.selectTab(r)),this.options.errorClass)for(r in this.tabContents)this.tabContents.hasOwnProperty(r)&&null!==this.tabContents[r].queryFirst("."+this.options.errorClass)&&(this.tabs[r].queryFirst("a").addClass(this.options.errorClass),this.selectTab(r))}},{key:"selectTab",value:function(e){if(null===this.selectedTab||this.selectedTab.getDataSet().tabId!==e){for(var t in this.tabs)this.tabs.hasOwnProperty(t)&&this.tabs[t].removeClass("selected");for(var n in this.tabs[e].addClass("selected"),this.selectedTab=this.tabs[e],this.tabContents)this.tabContents.hasOwnProperty(n)&&n===e?(this.tabContents[n].show("block"),this.options.selectCallback&&this.options.selectCallback(this.tabs[n],this.tabContents[n])):this.tabContents[n].hide();A.supported&&null!==this.options.localStorageKey&&A.setSessionObject(this.options.localStorageKey,{tabId:e});var i=this.selectedTab.getDataSet().tabUrl;""!==i&&(this.selectedTab.addClass("loading"),this.tabContents[e].setHTML(""),this.tabContents[e].addClass("loading"),new d(i,"GET").withSuccessHandler(this._handleAJAXResponse).withErrorHandler(this._handleAJAXResponse).go())}}},{key:"showTab",value:function(e){this.tabs[e].show(),this.redraw()}},{key:"withAJAXCallback",value:function(e){return this.options.ajaxCallback=e,this}},{key:"withDeepLinkingDisabled",value:function(){return this.options.deepLinkingEnabled=!1,this}},{key:"withErrorClassHandling",value:function(e){return this.options.errorClass=e,this}},{key:"withLocalStorageKey",value:function(e){return this.options.localStorageKey=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"withSelectCallback",value:function(e){return this.options.selectCallback=e,this}},{key:"withTabContentClass",value:function(e){return this.options.tabContentClass=e,this}},{key:"_handleAJAXResponse",value:function(e){this.selectedTab.removeClass("loading");var t=this.tabContents[this.selectedTab.getDataSet().tabId];t.removeClass("loading"),t.setHTML(e.responseText),null!==this.options.ajaxCallback&&this.options.ajaxCallback(t)}},{key:"_handleClick",value:function(e){c.stopEvent(e);var e=new l(e.currentTarget);e.hasClass("disabled")||("#"===(e=e.getAttribute("href")).charAt(0)?this.selectTab(e.substring(1)):this.selectTab(e))}},{key:"_setInitialOptions",value:function(){this.options={ajaxCallback:null,errorClass:null,deepLinkingEnabled:!0,localStorageKey:null,
1selectCallback:null,tabContentClass:"prime-tab-content"};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),z=[],R=function(){function r(e){_classCallCheck(this,r),c.bindAll(this),this.element=l.wrap(e),this._setInitialOptions()}return _createClass(r,[{key:"hide",value:function(){return 0<r.open.length&&r.open.forEach(function(e){e.removeFromDOM()}),this}},{key:"initialize",value:function(){return this.element.addEventListener("mouseenter",this._handleMouseEnter).addEventListener("mouseleave",this._handleMouseLeave),h.addEventListener("scroll",this._handleMouseLeave),this}},{key:"show",value:function(){var e=this.element.getDataSet()[this.options.dataName]||this.element.getAttribute("title"),t=this.element.getRelativeZIndex(),n=this.options.className+" "+this.element.getTagName().toLocaleLowerCase(),n=(null!==this.options.additionalClasses&&(n=n+" "+this.options.additionalClasses),h.newElement("<span>").appendTo(h.bodyElement).addClass(n).setHTML(e).setStyle("zIndex",t+100)),e=this.element.getLeft(),t=this.element.getTop(),i=this.element.getWidth(),s=n.getWidth(),o=n.getHeight();return n.setLeft(e-s/2+i/2),n.setTop(t-o-8),t-o-8<0&&n.setTop(t+this.element.getHeight()+8).addClass("inverted"),r.open.push(n),this}},{key:"withAdditionalClassNames",value:function(e){return this.options.additionalClasses=e,this}},{key:"withClassName",value:function(e){return this.options.className=e,this}},{key:"withDataName",value:function(e){return this.options.dataName=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_handleMouseEnter",value:function(){this.show()}},{key:"_handleMouseLeave",value:function(){this.hide()}},{key:"_setInitialOptions",value:function(){this.options={additionalClasses:null,className:"prime-tooltip",dataName:"tooltip"};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}],[{key:"open",get:function(){return z}}]),r}(),j=(h.onReady(function(){m.addEventListener("beforeunload",function(){0<R.open.length&&R.open.forEach(function(e){e.removeFromDOM()})})}),function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.element=l.wrap(e),this._setInitialOptions()}return _createClass(t,[{key:"initialize",value:function(){return this.element.query("a."+this.options.folderToggleClassName).each(function(e){e.addEventListener("click",this._handleClick)}.bind(this)),this}},{key:"withFolderToggleClassName",value:function(e){return this.options.folderToggleClassName=e,this}},{key:"_handleClick",value:function(e){c.stopEvent(e);var e=l.wrap(e.target),t=e.getParent();e.hasClass("open")?(e.removeClass("open"),t.removeClass("open")):(e.addClass("open"),t.addClass("open"))}},{key:"_setInitialOptions",value:function(){this.options={folderToggleClassName:"prime-folder-toggle"};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}()),v=Object.freeze({__proto__:null,AJAXDialog:v,DateTimePicker:g,Dismissable:E,Draggable:p,HTMLDialog:k,InProgress:b,MultipleSelect:O,Overlay:u,Reorder:L,Searcher:C,SideMenu:I,SplitButton:M,Table:x,Tabs:Y,Tooltip:R,Touchable:D,TreeView:j}),H=function(){function n(e,t){_classCallCheck(this,n),c.bindAll(this),this.element=l.wrap(e),this.duration=1e3,this.endFunction=null,this.endValue=t,this.iterations=20}return _createClass(n,[{key:"withEndFunction",value:function(e){return this.endFunction=e,this}},{key:"withDuration",value:function(e){if(e<100)throw new TypeError("Duration should be greater than 100 milliseconds or it won't really be noticeable");return this.duration=e,this}},{key:"_changeNumberStyleIteratively",value:function(e,t){var n=e.call(this.element),i=Math.abs(this.endValue-n)/this.iterations,s=this;c.callIteratively(this.duration,this.iterations,function(e){e?n=s.endValue:n<s.endValue?n+=i:n-=i,t.call(s.element,n)},this._internalEndFunction)}},{key:"_internalEndFunction",value:function(){this._subclassEndFunction(this),this.endFunction&&this.endFunction(this)}},{key:"_subclassEndFunction",value:function(){}}]),n}(),g=function(){_inherits(n,H);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,0)}return _createClass(n,[{key:"_subclassEndFunction",value:function(){this.element.hide()}},{key:"go",value:function(){this._changeNumberStyleIteratively(this.element.getOpacity,this.element.setOpacity)}}]),n}(),E=function(){_inherits(i,H);var n=_createSuper(i);function i(e,t){return _classCallCheck(this,i),c.isDefined(t)||(t=1),n.call(this,e,t)}return _createClass(i,[{key:"go",value:function(){this.element.setOpacity(0),this.element.show(),this._changeNumberStyleIteratively(this.element.getOpacity,this.element.setOpacity)}}]),i}(),k=function(){_inherits(i,H);var n=_createSuper(i);function i(e,t){return _classCallCheck(this,i),(e=n.call(this,e,t)).axis="vertical",e}return _createClass(i,[{key:"withAxis",value:function(e){return this.axis=e||"vertical",this}},{key:"go",value:function(){"vertical"===this.axis?this._changeNumberStyleIteratively(this.element.getScrollTop,this.element.scrollTo):this._changeNumberStyleIteratively(this.element.getScrollLeft,this.element.scrollLeftTo)}}]),i}(),b=function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.element=e,this.isOpen()?e.domElement.primeVisibleHeight=e.getHeight():(e.setStyle("height","auto"),e.domElement.primeVisibleHeight=e.getHeight(),e.setStyle("height","0")),this.isTransitioning=!1,this._setInitialOptions()}return _createClass(t,[{key:"close",value:function(){this.isOpen()&&(this.element.setHeight(this.element.domElement.primeVisibleHeight),this.isTransitioning=!0,setTimeout(function(){this.element.setHeight(0),this.element.removeClass("open"),this.isTransitioning=!1,null!==this.options.closeCallback&&this.options.closeCallback()}.bind(this),this.options.timeout))}},{key:"isOpen",value:function(){return 0!==this.element.getHeight()||this.element.hasClass("open")}},{key:"open",value:function(){this.isOpen()||(this.element.setHeight(this.element.domElement.primeVisibleHeight),this.isTransitioning=!0,setTimeout(function(){this.element.setHeight("auto"),this.element.addClass("open"),this.isTransitioning=!1,null!==this.options.openCallback&&this.options.openCallback()}.bind(this),this.options.timeout))}},{key:"toggle",value:function(){this.isOpen()?this.close():this.open()}},{key:"withCloseCallback",value:function(e){return this.options.closeCallback=e,this}},{key:"withOpenCallback",value:function(e){return this.options.openCallback=e,this}},{key:"withOptions",value:function(e){if(c.isDefined(e))for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);return this}},{key:"_setInitialOptions",value:function(){this.options={openCallback:null,closeCallback:null,timeout:310};var e,t=c.dataSetToOptions(this.element);for(e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])}}]),t}(),O=Object.freeze({__proto__:null,Appear:E,BaseTransition:H,Fade:g,ScrollTo:k,SlideOpen:b}),L=function(){function e(){_classCallCheck(this,e),c.bindAll(this),this._elements={},this._head=0,this._tail=0}return _createClass(e,[{key:"add",value:function(e){return this._elements[this._head]=e,this._head++,this}},{key:"isEmpty",value:function(){return this._head===this._tail}},{key:"peek",value:function(){return this.isEmpty()?null:this._elements[this._tail]}},{key:"poll",value:function(){var e;return this.isEmpty()?null:(e=this._elements[this._tail],delete this._elements[this._tail],this._tail++,this._cursor<this._tail&&(this._cursor=this._tail),e)}},{key:"size",value:function(){return this._head-this._tail}}]),e}(),I=function(){function t(e){_classCallCheck(this,t),c.bindAll(this),this.init(e)}return _createClass(t,[{key:"init",value:function(e){this.template=e}},{key:"generate",value:function(e){e=c.isDefined(e)?e:{};var t,n=String(this.template);for(t in e)if(e.hasOwnProperty(t)){var i=e[t],s=void 0,s="function"==typeof i?i():i;if(0===t.indexOf("/")&&t.lastIndexOf("/")===t.length-1)n=n.replace(new RegExp(t.substring(1,t.length-1),"g"),s);else for(var o="#{"+t+"}";-1!==n.indexOf(o);)n=n.replace(o,s)}return n}},{key:"appendTo",value:function(e,t){if(!c.isDefined(e))throw new TypeError("Please supply an element to append to");e.setHTML(e.getHTML()+this.generate(t))}},{key:"insertBefore",value:function(e,t){if(!c.isDefined(e))throw new TypeError("Please supply an element to append to");var n=document.createElement("div");n.innerHTML=this.generate(t),new l(n.children[0]).insertBefore(e)}},{key:"insertAfter",value:function(e,t){if(!c.isDefined(e))throw new TypeError("Please supply an element to append to");var n=document.createElement("div");n.innerHTML=this.generate(t),new l(n.children[0]).insertAfter(e)}}]),t}(),M={Request:d},x={Queue:L};return e.Ajax=M,e.Browser=s,e.Data=x,e.Date=f,e.Document=h,e.Effects=O,e.Events=y,e.Storage=A,e.Template=I,e.Utils=c,e.Widgets=v,e.Window=m,e}({}); 2//# sourceMappingURL=prime-min-1.7.0.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.