function classChange(n,t){t.className=n}function ResetScrollPosition(){setTimeout("window.scrollTo(0,100)",0)}function EditScrollPosition(){setTimeout("window.scrollTo(0,290)",0)}function listScrollTop(){var n=jQuery(".label.label-info.animated.fadeInLeft.pull-right");n.length>0&&jQuery("html, body").animate({scrollTop:jQuery(".label.animated.pull-right").offset().top-5},800)}function SessionStorageIsAvailable(){try{return sessionStorage.getItem}catch(n){return!1}}function SetTextToSession(n,t){try{SessionStorageIsAvailable&&sessionStorage.setItem(n,t+"")}catch(i){return!1}}function RemoveTextFromSession(n){try{SessionStorageIsAvailable&&sessionStorage.removeItem(n)}catch(t){return!1}}function GetTextFromSession(n){return SessionStorageIsAvailable?sessionStorage.getItem(n):""}function SetUpdateProgress(n){var t=jQuery(".formUpdateProg");t.fadeIn("fast",function(){n&&n.always(function(){t.fadeOut("fast")})})}function CloseUpdateProgress(){var n=jQuery(".formUpdateProg");n.fadeOut("fast")}function setCookie(n,t,i){var r=new Date,u;r.setDate(r.getDate()+i);u=escape(t)+(i===null?"":"; expires="+r.toUTCString())+"; path=/";document.cookie=n+"="+u}function getCookie(n){var t=document.cookie,i=t.indexOf(" "+n+"="),r;return i===-1&&(i=t.indexOf(n+"=")),i===-1?t=null:(i=t.indexOf("=",i)+1,r=t.indexOf(";",i),r===-1&&(r=t.length),t=unescape(t.substring(i,r))),t}function GetQueryStringParam(n){for(var t,r=GetQueryStringParamsArray(),i=0;i<r.length;i++)if(t=r[i].split("="),t[0].toLowerCase()===n)return t[1];return""}function GetQueryStringParamsArray(){var n=window.location.search.substring(1);return n.split("&")}function GetQueryStringParamsDic(){for(var n,i={},r=GetQueryStringParamsArray(),t=0;t<r.length;t++)n=r[t].split("="),i[n[0].toLowerCase()]=n[1];return i}function AddScriptLinkToBody(n,t){var r=document.getElementsByTagName("body")[0],i=document.createElement("script");i.src=n;i.type="text/javascript";i.onload=t;i.onreadystatechange=function(){this.readyState==="complete"&&t()};r.appendChild(i)}function AddStyleCssToHead(n){var i=document.getElementsByTagName("head")[0],t=document.createElement("style");t.setAttribute("type","text/css");t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));i.appendChild(t)}function AddStylesheetLinkToHead(n){var i=document.getElementsByTagName("head")[0],t=document.createElement("link");t.setAttribute("rel","stylesheet");t.setAttribute("href",n);i.appendChild(t)}function AddKnockoutJs(n){window.ko?n():AddScriptLinkToBody("../Scripts/knockout-3.4.2.js",function(){AddScriptLinkToBody("../Scripts/knockout.custom.min.js",n)})}function AddKnockoutViewmodelJs(n){window.ko.viewmodel?n():AddScriptLinkToBody("../Scripts/knockout.viewmodel.2.0.3.min.js",n)}function RegisterDateObj(n){var t=jQuery(n),i=t.val(),r=t.datepicker({dateFormat:"dd.mm.yyyy",toggleSelected:!1,autoClose:!0,todayButton:moment().startOf("day").toDate(),showButtonPanel:!0,keyboardNav:!1,onSelect:function(n){t.trigger("datepickerChanged");i=n}});t.change(function(){var u=t.val(),n=moment(u,"DD.MM.YYYY");n.isValid()||(n=moment(u));n.isValid()?(i=n.format("DD.MM.YYYY"),r.data("datepicker").selectDate(n.toDate())):t.val(i)});i&&i!=="01.01.1900"&&r.data("datepicker").selectDate(moment(i,"DD.MM.YYYY").toDate())}function localeCompareSupportsLocales(){try{"foo".localeCompare("bar","i")}catch(n){return n.name==="RangeError"}return!1}function GetLanguageName(){return jQuery.get("../api/framework/GetLanguageName")}function SetBootboxLanguage(){var n=jQuery.Deferred();return GetLanguageName().done(function(t){bootbox.setLocale(t);n.resolve()}),n.promise()}function isTouch(){function t(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch?!0:!1}var n=navigator.userAgent;return t()||n.match(/(iPhone|iPod|iPad)/)||n.match(/BlackBerry/)||n.match(/Android/)||n.match(/(Touch)/)?!0:!1}function toggleLoading(){jQuery('[id*="footer"]').toggleClass("displayBlock")}function HeaderFixedHeight(){return jQuery("header.row > .col").css("position")==="fixed"?jQuery("header").height():0}function focusNextElement(){focusNextElementAfter(document.activeElement)}function focusNextElementAfter(n){var t,i;n&&n.form&&(t=$('a:not([disabled]), button:not([disabled]), :input:not([type=hidden]):not([disabled]):not(.ac-hint), [tabindex]:not([disabled]):not([tabindex="-1"])'),i=t.index(n),$(t.get(i+1)).focus().select())}function focusFirstElementInside(n){var t;n&&(t=$(n).find('a:not([disabled]), button:not([disabled]), :input:not([type=hidden]):not([disabled]):not(.ac-hint), [tabindex]:not([disabled]):not([tabindex="-1"])'),t.first().focus().select())}function AddFixedAlert(n){for(var r,i=n,u=n.length,t=0;t<u;t++)$("#"+i[t].IdContainer).get(0)!==undefined&&(r=$("#"+i[t].IdContainer).get(0),i[t].AlertsFixed["0"].Messages[0]!==null&&i[t].AlertsFixed["0"].Messages!=""&&ko.applyBindingsToNode(r,{component:{name:"alerts-fixed",params:i[t]}}))}function GetDataList(n,t,i){return $.ajax({type:"GET",url:t,context:n,success:function(n){i.call(this,n)},dataType:"json"})}function ValidatorValidateOnBlur(n){setTimeout(function(){if(n.isvalid){var t=n.focusOnError;n.focusOnError="";ValidatorValidate(n);n.focusOnError=t}},300)}function copyToClipboardAndMessage(n,t){copyToClipboard($(n).text());alertify.success(t)}function copyToClipboard(n){var t=$("<textarea>");$("body").append(t);t.val(n).select();document.execCommand("copy");t.remove()}function PadValue(n,t,i){var r=String(n);for(i||(i="0");r.length<(t||2);)r=i+r;return r}function JsonGet(n,t,i,r){return JsonAjax("GET",n,t,i,r)}function JsonPost(n,t,i,r){return JsonAjax("POST",n,JSON.stringify(t),i,r)}function JsonAjax(n,t,i,r,u){return jqxhr=jQuery.ajax({type:n,url:t,data:i,contentType:"application/json"}).fail(function(n){console.log(n);n.responseJSON&&n.responseJSON.Message&&alertify.error(n.responseJSON.Message)}).done(function(n,t,i){PhcJsonProcessMessages(n,t,i,r,u)}),SetUpdateProgress(jqxhr),jqxhr}function PhcJsonProcessMessages(n,t,i,r,u){n&&(n.ReturnUrl&&(window.location=n.ReturnUrl),n.alerts&&n.alerts.forEach(function(n){switch(n.MessageType){case 1:alertify.success(n.Message,n.Delay);break;case 2:alertify.log(n.Message,n.Delay);break;case 3:alertify.error(n.Message,n.Delay)}}),n.Success?r&&r(n,t,i):(n.reload&&location.reload(!0),u&&u(n,t,i)),n.FixedAlerts&&AddFixedAlert(n.FixedAlerts))}function ShowModelDialog(n){bootbox.setLocale(n.locale);switch(n.type){case"alert":return bootbox.alert(n);case"confirm":return bootbox.confirm(n);case"prompt":return bootbox.prompt(n)}}function CallGetSession(){return jQuery.ajax({type:"GET",url:"../api/framework/GetSessionID"})}function GetFixedHeaderHeight(){return jQuery("header.row > .col").css("position")==="fixed"?jQuery("header").height():0}function ScrollTo(n){return n=n-GetFixedHeaderHeight(),jQuery("html, body").animate({scrollTop:n},800)}function ScrollToElement(n){var i=$(n),t;i.length&&(t=i.offset().top-10,t&&ScrollTo(t))}!function(n,t){"use strict";var r,i=n.document;r=function(){var e,c,l,y,w,b,k,h,f,r,g,o,d,u={},s={},v=!1,p={ENTER:13,ESC:27,SPACE:32},a=[];return s={buttons:{holder:'<nav class="alertify-buttons">{{buttons}}<\/nav>',submit:'<button type="submit" class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}<\/button>',ok:'<button class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}<\/button>',cancel:'<button class="alertify-button alertify-button-cancel" id="alertify-cancel">{{cancel}}<\/button>'},input:'<div class="alertify-text-wrapper"><input type="text" class="alertify-text" id="alertify-text"><\/div>',message:'<p class="alertify-message">{{message}}<\/p>',log:'<article class="alertify-log{{class}}">{{message}}<\/article>'},d=function(){var n,r,u=!1,e=i.createElement("fakeelement"),f={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"};for(n in f)if(e.style[n]!==t){r=f[n];u=!0;break}return{type:r,supported:u}},e=function(n){return i.getElementById(n)},u={labels:{ok:"OK",cancel:"Cancel"},delay:5e3,buttonReverse:!1,buttonFocus:"ok",transition:t,addListeners:function(n){var r,u,s,h,f,v="undefined"!=typeof l,e="undefined"!=typeof c,a="undefined"!=typeof o,b="",t=this;r=function(t){return"undefined"!=typeof t.preventDefault&&t.preventDefault(),s(t),"undefined"!=typeof o&&(b=o.value),"function"==typeof n&&("undefined"!=typeof o?n(!0,b):n(!0)),!1};u=function(t){return"undefined"!=typeof t.preventDefault&&t.preventDefault(),s(t),"function"==typeof n&&n(!1),!1};s=function(){t.hide();t.unbind(i.body,"keyup",h);t.unbind(y,"focus",f);v&&t.unbind(l,"click",r);e&&t.unbind(c,"click",u)};h=function(n){var t=n.keyCode;(t===p.SPACE&&!a||a&&t===p.ENTER)&&r(n);t===p.ESC&&e&&u(n)};f=function(){a?o.focus():!e||t.buttonReverse?l.focus():c.focus()};this.bind(y,"focus",f);this.bind(w,"focus",f);v&&this.bind(l,"click",r);e&&this.bind(c,"click",u);this.bind(i.body,"keyup",h);this.transition.supported||this.setFocus()},bind:function(n,t,i){"function"==typeof n.addEventListener?n.addEventListener(t,i,!1):n.attachEvent&&n.attachEvent("on"+t,i)},handleErrors:function(){if("undefined"!=typeof n.onerror){var t=this;return n.onerror=function(n,i,r){t.error("["+n+" on line "+r+" of "+i+"]",0)},!0}return!1},appendButtons:function(n,t){return this.buttonReverse?t+n:n+t},build:function(n){var t="",i=n.type,r=n.message,e=n.cssClass||"";switch(t+='<div class="alertify-dialog">',t+='<a id="alertify-resetFocusBack" class="alertify-resetFocus" href="#">Reset Focus<\/a>',"none"===u.buttonFocus&&(t+='<a href="#" id="alertify-noneFocus" class="alertify-hidden"><\/a>'),"prompt"===i&&(t+='<div id="alertify-form">'),t+='<article class="alertify-inner">',t+=s.message.replace("{{message}}",r),"prompt"===i&&(t+=s.input),t+=s.buttons.holder,t+="<\/article>","prompt"===i&&(t+="<\/div>"),t+='<a id="alertify-resetFocus" class="alertify-resetFocus" href="#">Reset Focus<\/a>',t+="<\/div>",i){case"confirm":t=t.replace("{{buttons}}",this.appendButtons(s.buttons.cancel,s.buttons.ok));t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"prompt":t=t.replace("{{buttons}}",this.appendButtons(s.buttons.cancel,s.buttons.submit));t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"alert":t=t.replace("{{buttons}}",s.buttons.ok);t=t.replace("{{ok}}",this.labels.ok)}return f.className="alertify alertify-"+i+" "+e,h.className="alertify-cover",t},close:function(n,t){var u,f,e=t&&!isNaN(t)?+t:this.delay,i=this;this.bind(n,"click",function(){u(n)});f=function(n){n.stopPropagation();i.unbind(this,i.transition.type,f);r.removeChild(this);r.hasChildNodes()||(r.className+=" alertify-logs-hidden")};u=function(n){"undefined"!=typeof n&&n.parentNode===r&&(i.transition.supported?(i.bind(n,i.transition.type,f),n.className+=" alertify-log-hide"):(r.removeChild(n),r.hasChildNodes()||(r.className+=" alertify-logs-hidden")))};0!==t&&setTimeout(function(){u(n)},e)},dialog:function(n,t,u,f,e){k=i.activeElement;var o=function(){r&&null!==r.scrollTop&&h&&null!==h.scrollTop||o()};if("string"!=typeof n)throw new Error("message must be a string");if("string"!=typeof t)throw new Error("type must be a string");if("undefined"!=typeof u&&"function"!=typeof u)throw new Error("fn must be a function");return this.init(),o(),a.push({type:t,message:n,callback:u,placeholder:f,cssClass:e}),v||this.setup(),this},extend:function(n){if("string"!=typeof n)throw new Error("extend method must have exactly one paramter");return function(t,i){return this.log(t,n,i),this}},hide:function(){var n,t=this;a.splice(0,1);a.length>0?this.setup(!0):(v=!1,n=function(i){i.stopPropagation();t.unbind(f,t.transition.type,n)},this.transition.supported?(this.bind(f,this.transition.type,n),f.className="alertify alertify-hide alertify-hidden"):f.className="alertify alertify-hide alertify-hidden alertify-isHidden",h.className="alertify-cover alertify-cover-hidden",k.focus())},init:function(){i.createElement("nav");i.createElement("article");i.createElement("section");null==e("alertify-cover")&&(h=i.createElement("div"),h.setAttribute("id","alertify-cover"),h.className="alertify-cover alertify-cover-hidden",i.body.appendChild(h));null==e("alertify")&&(v=!1,a=[],f=i.createElement("section"),f.setAttribute("id","alertify"),f.className="alertify alertify-hidden",i.body.appendChild(f));null==e("alertify-logs")&&(r=i.createElement("section"),r.setAttribute("id","alertify-logs"),r.className="alertify-logs alertify-logs-hidden",i.body.appendChild(r));i.body.setAttribute("tabindex","0");this.transition=d()},log:function(n,t,i){var u=function(){r&&null!==r.scrollTop||u()};return this.init(),u(),r.className="alertify-logs",this.notify(n,t,i),this},notify:function(n,t,u){var f=i.createElement("article");f.className="alertify-log"+("string"==typeof t&&""!==t?" alertify-log-"+t:"");f.innerHTML=n;r.appendChild(f);setTimeout(function(){f.className=f.className+" alertify-log-show"},50);this.close(f,u)},set:function(n){var t;if("object"!=typeof n&&n instanceof Array)throw new Error("args must be an object");for(t in n)n.hasOwnProperty(t)&&(this[t]=n[t])},setFocus:function(){o?(o.focus(),o.select()):b.focus()},setup:function(n){var r,i=a[0],s=this;v=!0;r=function(n){n.stopPropagation();s.setFocus();s.unbind(f,s.transition.type,r)};this.transition.supported&&!n&&this.bind(f,this.transition.type,r);f.innerHTML=this.build(i);y=e("alertify-resetFocus");w=e("alertify-resetFocusBack");l=e("alertify-ok")||t;c=e("alertify-cancel")||t;b="cancel"===u.buttonFocus?c:"none"===u.buttonFocus?e("alertify-noneFocus"):l;o=e("alertify-text")||t;g=e("alertify-form")||t;"string"==typeof i.placeholder&&""!==i.placeholder&&(o.value=i.placeholder);n&&this.setFocus();this.addListeners(i.callback)},unbind:function(n,t,i){"function"==typeof n.removeEventListener?n.removeEventListener(t,i,!1):n.detachEvent&&n.detachEvent("on"+t,i)}},{alert:function(n,t,i){return u.dialog(n,"alert",t,"",i),this},confirm:function(n,t,i){return u.dialog(n,"confirm",t,"",i),this},extend:u.extend,init:u.init,log:function(n,t,i){return u.log(n,t,i),this},prompt:function(n,t,i,r){return u.dialog(n,"prompt",t,i,r),this},success:function(n,t){return u.log(n,"success",t),this},error:function(n,t){return u.log(n,"error",t),this},set:function(n){u.set(n)},labels:u.labels,debug:u.handleErrors}};"function"==typeof define?define([],function(){return new r}):"undefined"==typeof n.alertify&&(n.alertify=new r)}(this),function(n,t,i){function l(){h=t[f](function(){r.each(function(){var i=n(this),r=i.width(),u=i.height(),t=n.data(this,e);(r!==t.w||u!==t.h)&&i.trigger(s,[t.w=r,t.h=u])});l()},u[c])}var r=n([]),u=n.resize=n.extend(n.resize,{}),h,f="setTimeout",s="resize",e=s+"-special-event",c="delay",o="throttleWindow";u[c]=250;u[o]=!0;n.event.special[s]={setup:function(){if(!u[o]&&this[f])return!1;var t=n(this);r=r.add(t);n.data(this,e,{w:t.width(),h:t.height()});r.length===1&&l()},teardown:function(){if(!u[o]&&this[f])return!1;var t=n(this);r=r.not(t);t.removeData(e);r.length||clearTimeout(h)},add:function(t){function s(t,u,f){var o=n(this),s=n.data(this,e);s.w=u!==i?u:o.width();s.h=f!==i?f:o.height();r.apply(this,arguments)}if(!u[o]&&this[f])return!1;var r;if(n.isFunction(t))return r=t,s;r=t.handler;t.handler=s}}}(jQuery,this);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(){listScrollTop()});jQuery(document).ready(function(){listScrollTop()}),function(n){"use strict";n.event.special.destroyed||(n.event.special.destroyed={remove:function(n){n.handler&&n.handler()}});n.fn.extend({maxlength:function(t,i){function c(n){for(var i,t=0,r=0;r<n.length;r++)i=n.charCodeAt(r),i<128?t++:t=i>127&&i<2048?t+2:t+3;return t}function f(n){var i=n.val(),r;return i=t.twoCharLinebreak?i.replace(/\r(?!\n)|\n(?!\r)/g,"\r\n"):i.replace(new RegExp("\r?\n","g"),"\n"),r=0,t.utf8?c(i):i.length}function l(n,i){var r=n.val(),u=0;t.twoCharLinebreak&&(r=r.replace(/\r(?!\n)|\n(?!\r)/g,"\r\n"),r.substr(r.length-1)==="\n"&&r.length%2==1&&(u=1));n.val(r.substr(0,i-u))}function a(n,i,r){var u=!0;return!t.alwaysShow&&r-f(n)>i&&(u=!1),u}function e(n,t){return t-f(n)}function o(n,t){t.css({display:"block"});n.trigger("maxlength.shown")}function v(n,i){t.alwaysShow||(i.css({display:"none"}),n.trigger("maxlength.hidden"))}function s(n,i,r){var u="";return t.message?u=typeof t.message=="function"?t.message(n,i):t.message.replace("%charsTyped%",r).replace("%charsRemaining%",i-r).replace("%charsTotal%",i):(t.preText&&(u+=t.preText),u+=t.showCharsTyped?r:i-r,t.showMaxLength&&(u+=t.separator+i),t.postText&&(u+=t.postText)),u}function h(n,i,r,u){u&&(u.html(s(i.val(),r,r-n)),n>0?a(i,t.threshold,r)?o(i,u.removeClass(t.limitReachedClass).addClass(t.warningClass)):v(i,u):o(i,u.removeClass(t.warningClass).addClass(t.limitReachedClass)));t.customMaxAttribute&&(n<0?i.addClass("overmax"):i.removeClass("overmax"))}function y(t){var i=t[0];return n.extend({},typeof i.getBoundingClientRect=="function"?i.getBoundingClientRect():{width:i.offsetWidth,height:i.offsetHeight},t.offset())}function p(i,r){if(i&&r){var u={};n.each(["top","bottom","left","right","position"],function(n,i){var r=t.placement[i];typeof r!="undefined"&&(u[i]=r)});r.css(u);return}}function r(i,r){var u=y(i);if(n.type(t.placement)==="function"){t.placement(i,r,u);return}if(n.isPlainObject(t.placement)){p(t.placement,r);return}var o=i.outerWidth(),e=r.outerWidth(),s=r.width(),f=r.height();t.appendToParent&&(u.top-=i.parent().offset().top,u.left-=i.parent().offset().left);switch(t.placement){case"bottom":r.css({top:u.top+u.height,left:u.left+u.width/2-s/2});break;case"top":r.css({top:u.top-f,left:u.left+u.width/2-s/2});break;case"left":r.css({top:u.top+u.height/2-f/2,left:u.left-s});break;case"right":r.css({top:u.top+u.height/2-f/2,left:u.left+u.width});break;case"bottom-right":r.css({top:u.top+u.height,left:u.left+u.width});break;case"top-right":r.css({top:u.top-f,left:u.left+o});break;case"top-left":r.css({top:u.top-f,left:u.left-e});break;case"bottom-left":r.css({top:u.top+i.outerHeight(),left:u.left-e});break;case"centered-right":r.css({top:u.top+f/2,left:u.left+o-e-3});break;case"bottom-right-inside":r.css({top:u.top+u.height,left:u.left+u.width-e});break;case"top-right-inside":r.css({top:u.top-f,left:u.left+o-e});break;case"top-left-inside":r.css({top:u.top-f,left:u.left});break;case"bottom-left-inside":r.css({top:u.top+i.outerHeight(),left:u.left})}}function w(){return t.placement==="bottom-right-inside"||t.placement==="top-right-inside"||typeof t.placement=="function"||t.message&&typeof t.message=="function"}function u(n){var i=n.attr("maxlength")||t.customMaxAttribute,r;return t.customMaxAttribute&&!t.allowOverMax&&(r=n.attr(t.customMaxAttribute),(!i||r<i)&&(i=r)),i||(i=n.attr("size")),i}var b=n("body");return n.isFunction(t)&&!i&&(i=t,t={}),t=n.extend({showOnReady:!1,alwaysShow:!1,threshold:10,warningClass:"label label-success",limitReachedClass:"label label-important label-danger",separator:" / ",preText:"",postText:"",showMaxLength:!0,placement:"bottom",message:null,showCharsTyped:!0,validate:!1,utf8:!1,appendToParent:!1,twoCharLinebreak:!0,customMaxAttribute:null,allowOverMax:!1},t),this.each(function(){function c(){var l=s(i.val(),o,"0"),c;o=u(i);f||(f=n('<span class="bootstrap-maxlength"><\/span>').css({display:"none",position:"absolute",whiteSpace:"nowrap",zIndex:1099}).html(l));i.is("textarea")&&(i.data("maxlenghtsizex",i.outerWidth()),i.data("maxlenghtsizey",i.outerHeight()),i.mouseup(function(){(i.outerWidth()!==i.data("maxlenghtsizex")||i.outerHeight()!==i.data("maxlenghtsizey"))&&r(i,f);i.data("maxlenghtsizex",i.outerWidth());i.data("maxlenghtsizey",i.outerHeight())}));t.appendToParent?(i.parent().append(f),i.parent().css("position","relative")):b.append(f);c=e(i,u(i));h(c,i,o,f);r(i,f)}var i=n(this),o,f;n(window).resize(function(){f&&r(i,f)});t.showOnReady?i.ready(function(){c()}):i.focus(function(){c()});i.on("maxlength.reposition",function(){r(i,f)});i.on("destroyed",function(){f&&f.remove()});i.on("blur",function(){f&&!t.showOnReady&&f.remove()});i.on("input",function(){var n=u(i),s=e(i,n),c=!0;return t.validate&&s<0?(l(i,n),c=!1):h(s,i,o,f),w()&&r(i,f),c})})}})}(jQuery),function(n,t,i,r){var e=t.createElement("canvas").getContext,u=n.fn.peity=function(t,i){return e&&this.each(function(){var e=n(this),r=e.data("peity"),o,s,h;r?(t&&(r.type=t),n.extend(r.opts,i),r.draw()):(o=u.defaults[t],s={},n.each(e.data(),function(n,t){n in o&&(s[n]=t)}),h=n.extend({},o,s,i),r=new f(e,t,h),r.draw(),e.change(function(){r.draw()}).data("peity",r))}),this},f=function(n,t,i){this.$el=n;this.type=t;this.opts=i},t=f.prototype;t.colours=function(){var t=this.opts.colours,i=t;return n.isFunction(i)||(i=function(n,i){return t[i%t.length]}),i};t.draw=function(){u.graphers[this.type].call(this,this.opts)};t.prepareCanvas=function(t,i){var u=this.canvas,f;return u?(this.context.clearRect(0,0,u.width,u.height),f=n(u)):(f=n("<canvas>").css({height:i,width:t}).addClass("peity").data("peity",this),this.canvas=u=f[0],this.context=u.getContext("2d"),this.$el.hide().after(u)),u.height=f.height()*r,u.width=f.width()*r,u};t.values=function(){return n.map(this.$el.text().split(this.opts.delimiter),function(n){return parseFloat(n)})};u.defaults={};u.graphers={};u.register=function(n,t,i){this.defaults[n]=t;this.graphers[n]=i};u.register("pie",{colours:["#ff9900","#fff4dd","#ffc66e"],delimiter:null,diameter:16},function(n){var u,t,f,o;n.delimiter||(t=this.$el.text().match(/[^0-9\.]/),n.delimiter=t?t[0]:",");t=this.values();"/"==n.delimiter&&(u=t[0],t=[u,t[1]-u]);for(var r=0,u=t.length,s=0;r<u;r++)s+=t[r];var e=this.prepareCanvas(n.width||n.diameter,n.height||n.diameter),n=this.context,r=e.width,f=e.height,e=i.min(r,f)/2,h=i.PI,c=this.colours();for(n.save(),n.translate(r/2,f/2),n.rotate(-h/2),r=0;r<u;r++)f=t[r],o=2*f/s*h,n.beginPath(),n.moveTo(0,0),n.arc(0,0,e,0,o,!1),n.fillStyle=c.call(this,f,r,t),n.fill(),n.rotate(o);n.restore()});u.register("line",{colour:"#c6d9fd",strokeColour:"#4d89f9",strokeWidth:1,delimiter:",",height:16,max:null,min:0,width:32},function(n){var f=this.values(),c,l;1==f.length&&f.push(f[0]);var s=i.max.apply(i,f.concat([n.max])),h=i.min.apply(i,f.concat([n.min])),e=this.prepareCanvas(n.width,n.height),t=this.context,a=e.width,e=e.height,v=a/(f.length-1),s=e/(s-h),o=[],u;for(t.beginPath(),t.moveTo(0,e+h*s),u=0;u<f.length;u++)c=u*v,l=e-s*(f[u]-h),o.push({x:c,y:l}),t.lineTo(c,l);if(t.lineTo(a,e+h*s),t.fillStyle=n.colour,t.fill(),n.strokeWidth){for(t.beginPath(),t.moveTo(0,o[0].y),u=0;u<o.length;u++)t.lineTo(o[u].x,o[u].y);t.lineWidth=n.strokeWidth*r;t.strokeStyle=n.strokeColour;t.stroke()}});u.register("bar",{colours:["#4D89F9"],delimiter:",",height:16,max:null,min:0,spacing:r,width:32},function(n){for(var f,o,s,t=this.values(),h=i.max.apply(i,t.concat([n.max])),e=i.min.apply(i,t.concat([n.min])),u=this.prepareCanvas(n.width,n.height),c=this.context,l=u.height,a=l/(h-e),n=n.spacing,u=(u.width+n)/t.length,v=this.colours(),r=0;r<t.length;r++)f=t[r],o=l-a*(f-e),0==f?((0<=e||0<h)&&(o-=1),s=1):s=a*t[r],c.fillStyle=v.call(this,f,r,t),c.fillRect(r*u,o,u-n,s)})}(jQuery,document,Math,window.devicePixelRatio||1),function(n,t){"use strict";typeof define=="function"&&define.amd?define(["jquery"],t):typeof exports=="object"?module.exports=typeof $=="undefined"?t(require("jquery")):t($):n.bootbox=t(n.jQuery)}(this,function init(n,t){"use strict";function a(n){var t=f[o.locale];return t?t[n]:f.en[n]}function e(t,i,r){t.stopPropagation();t.preventDefault();var u=n.isFunction(r)&&r.call(i,t)===!1;u||i.modal("hide")}function v(n){if(Object.keys)return Object.keys(n).length;var i,t=0;for(i in n)t++;return t}function r(t,i){var r=0;n.each(t,function(n,t){i(n,t,r++)})}function y(t){var i,u;if(typeof t!="object")throw new Error("Please supply an object of options");if(!t.message)throw new Error("Please specify a message");return t=n.extend({},o,t),t.buttons||(t.buttons={}),i=t.buttons,u=v(i),r(i,function(t,r,f){var e=f===u-1;if(n.isFunction(r)&&(r=i[t]={callback:r}),n.type(r)!=="object")throw new Error("button with key "+t+" must be an object");r.label||(r.label=t);r.className||(r.className=u<=2&&e?"btn-primary":"btn-default")}),t}function p(n,t){var r=n.length,i={};if(r<1||r>2)throw new Error("Invalid argument length");return r===2||typeof n[0]=="string"?(i[t[0]]=n[0],i[t[1]]=n[1]):i=n[0],i}function s(t,i,r){return n.extend(!0,{},t,p(i,r))}function h(n,t,i,r){var u={className:"bootbox-"+n,buttons:c.apply(null,t)};return l(s(u,r,i),t)}function c(){for(var t={},n=0,r=arguments.length;n<r;n++){var i=arguments[n],u=i.toLowerCase(),f=i.toUpperCase();t[u]={label:a(f)}}return t}function l(n,i){var u={};return r(i,function(n,t){u[t]=!0}),r(n.buttons,function(n){if(u[n]===t)throw new Error("button key "+n+" is not allowed (options are "+i.join("\n")+")");}),n}var u={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'><\/div><\/div><\/div><\/div><\/div>",header:"<div class='modal-header'><h4 class='modal-title'><\/h4><\/div>",footer:"<div class='modal-footer'><\/div>",closeButton:"<button type='button' class='bootbox-close-button close' aria-hidden='true'>&times;<\/button>",form:"<form class='bootbox-form'><\/form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",textarea:"<textarea class='bootbox-input bootbox-input-textarea form-control'><\/textarea>",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'><\/select>",checkbox:"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /><\/label><\/div>",date:"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",time:"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",number:"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",password:"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},i={},f;return i.alert=function(){var t;if(t=h("alert",["ok"],["message","callback"],arguments),t.callback&&!n.isFunction(t.callback))throw new Error("alert requires callback property to be a function when provided");return t.buttons.ok.callback=t.onEscape=function(){return n.isFunction(t.callback)?t.callback.call(this):!0},i.dialog(t)},i.confirm=function(){var t;if(t=h("confirm",["cancel","confirm"],["message","callback"],arguments),!n.isFunction(t.callback))throw new Error("confirm requires a callback");return t.buttons.cancel.callback=t.onEscape=function(){return t.callback.call(this,!1)},t.buttons.confirm.callback=function(){return t.callback.call(this,!0)},i.dialog(t)},i.prompt=function(){var f,y,h,v,e,p,o,a,w;if(v=n(u.form),y={className:"bootbox-prompt",buttons:c("cancel","confirm"),value:"",inputType:"text"},f=l(s(y,arguments,["title","callback"]),["cancel","confirm"]),p=f.show===t?!0:f.show,f.message=v,f.buttons.cancel.callback=f.onEscape=function(){return f.callback.call(this,null)},f.buttons.confirm.callback=function(){var t;return t=f.inputType==="checkbox"?e.find("input:checked").map(function(){return n(this).val()}).get():e.val(),f.callback.call(this,t)},f.show=!1,!f.title)throw new Error("prompt requires a title");if(!n.isFunction(f.callback))throw new Error("prompt requires a callback");if(!u.inputs[f.inputType])throw new Error("invalid prompt type");e=n(u.inputs[f.inputType]);switch(f.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":e.val(f.value);break;case"select":if(a={},o=f.inputOptions||[],!n.isArray(o))throw new Error("Please pass an array of input options");if(!o.length)throw new Error("prompt with select requires options");r(o,function(i,r){var u=e;if(r.value===t||r.text===t)throw new Error("each option needs a `value` and a `text` property");r.group&&(a[r.group]||(a[r.group]=n("<optgroup/>").attr("label",r.group)),u=a[r.group]);u.append("<option value='"+r.value+"'>"+r.text+"<\/option>")});r(a,function(n,t){e.append(t)});e.val(f.value);break;case"checkbox":if(w=n.isArray(f.value)?f.value:[f.value],o=f.inputOptions||[],!o.length)throw new Error("prompt with checkbox requires options");if(!o[0].value||!o[0].text)throw new Error("each option needs a `value` and a `text` property");e=n("<div/>");r(o,function(t,i){var o=n(u.inputs[f.inputType]);o.find("input").attr("value",i.value);o.find("label").append(i.text);r(w,function(n,t){t===i.value&&o.find("input").prop("checked",!0)});e.append(o)})}f.placeholder&&e.attr("placeholder",f.placeholder);f.pattern&&e.attr("pattern",f.pattern);f.maxlength&&e.attr("maxlength",f.maxlength);v.append(e);v.on("submit",function(n){n.preventDefault();n.stopPropagation();h.find(".btn-primary").click()});h=i.dialog(f);h.off("shown.bs.modal");h.on("shown.bs.modal",function(){e.focus()});return p===!0&&h.modal("show"),h},i.dialog=function(i){var h;i=y(i);var f=n(u.dialog),l=f.find(".modal-dialog"),s=f.find(".modal-body"),a=i.buttons,c="",o={onEscape:i.onEscape};if(n.fn.modal===t)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");r(a,function(n,t){c+="<button data-bb-handler='"+n+"' type='button' class='btn "+t.className+"'>"+t.label+"<\/button>";o[n]=t.callback});s.find(".bootbox-body").html(i.message);i.animate===!0&&f.addClass("fade");i.className&&f.addClass(i.className);i.size==="large"?l.addClass("modal-lg"):i.size==="small"&&l.addClass("modal-sm");i.title&&s.before(u.header);i.closeButton&&(h=n(u.closeButton),i.title?f.find(".modal-header").prepend(h):h.css("margin-top","-2px").prependTo(s));i.title&&f.find(".modal-title").html(i.title);c.length&&(s.after(u.footer),f.find(".modal-footer").html(c));f.one("hide.bs.modal",function(){f.off("escape.close.bb");f.off("click")});f.one("hidden.bs.modal",function(n){n.target===this&&f.remove()});f.one("shown.bs.modal",function(){f.find(".btn-primary:first").focus()});if(i.backdrop!=="static")f.on("click.dismiss.bs.modal",function(n){(f.children(".modal-backdrop").length&&(n.currentTarget=f.children(".modal-backdrop").get(0)),n.target===n.currentTarget)&&f.trigger("escape.close.bb")});f.on("escape.close.bb",function(n){o.onEscape&&e(n,f,o.onEscape)});f.on("click",".modal-footer button",function(t){var i=n(this).data("bb-handler");e(t,f,o[i])});f.on("click",".bootbox-close-button",function(n){e(n,f,o.onEscape)});f.on("keyup",function(n){n.which===27&&f.trigger("escape.close.bb")});return n(i.container).append(f),f.modal({backdrop:i.backdrop?"static":!1,keyboard:!1,show:!1}),i.show&&f.modal("show"),f},i.setDefaults=function(){var t={};arguments.length===2?t[arguments[0]]=arguments[1]:t=arguments[0];n.extend(o,t)},i.hideAll=function(){return n(".bootbox").modal("hide"),i},f={en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"Confirmer"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"}},i.addLocale=function(t,r){return n.each(["OK","CANCEL","CONFIRM"],function(n,t){if(!r[t])throw new Error("Please supply a translation for '"+t+"'");}),f[t]={OK:r.OK,CANCEL:r.CANCEL,CONFIRM:r.CONFIRM},i},i.removeLocale=function(n){return delete f[n],i},i.setLocale=function(n){return i.setDefaults("locale",n)},i.init=function(t){return init(t||n)},i})