PageSourceSearch

https://www.camdencountync.gov/739942322.js

js camdencountync.gov collected 2026-10-02 08:01:32 UTC 299,717 bytes, 3,727 lines download raw bytes

1/*
2The following errors were found when attempting to minify this file:
3- Line 351: Parse error. syntax error
4- Line 3097: Parse error. syntax error
5- Line 3103: Parse error. syntax error
6- Line 3124: Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option.
7- Line 3164: Parse error. missing ; before statement
8- Line 3164: Parse error. missing ; before statement
9- Line 3164: Parse error. syntax error
10- Line 3164: Parse error. missing ; before statement
11- Line 3164: Parse error. illegal character
12- Line 3164: Parse error. syntax error
13- Line 3164: Parse error. illegal character
14- Line 3164: Parse error. illegal character
15*/
16/**
17* @license Includes Modernizr 2.5.3 (Custom Build) | MIT & BSD
18* Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
19*/
20;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function L(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(k),g.offsetWidth,e=k.value!=l,g.removeChild(k)):e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.5.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),k.appendChild(j);return f=["&#173;","<style>",a,"</style>"].join(""),k.id=h,m.innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;
20var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e});var K=function(c,d){var f=c.join(""),g=d.length;y(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch||(j.touch&&j.touch.offsetTop)===9,e.csstransforms3d=(j.csstransforms3d&&j.csstransforms3d.offsetLeft)===9&&j.csstransforms3d.offsetHeight===3,e.generatedcontent=(j.generatedcontent&&j.generatedcontent.offsetHeight)>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",n.join("touch-enabled),("),h,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",n.join("transform-3d),("),h,")","{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join(""),['#generatedcontent:after{content:"',l,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);s.flexbox=function(){return J("flexOrder")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){try{var d=b.createElement("canvas"),e;e=!(!a.WebGLRenderingContext||!d.getContext("experimental-webgl")&&!d.getContext("webgl")),d=c}catch(f){e=!1}return e},s.touch=function(){return e.touch},s.geolocation=function(){return!!navigator.geolocation},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b]+"WebSocket"])return!0;return"WebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){return e.fontface},s.generatedcontent=function(){return e.generatedcontent},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}}
20,s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var M in s)C(s,M)&&(x=M.toLowerCase(),e[x]=s[M](),v.push((e[x]?"":"no-")+x));return e.input||L(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},D(""),i=k=null,function(a,b){function g(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="<xyz></xyz>",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,i){var j=b(a),l=j.autoCallback;j.url.split(".").pop().split("?").shift(),j.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]||h),j.instead?j.instead(a,e,f,g,i):(y[j.url]?j.noexec=!0:y[j.url]=1,f.load(j.url,j.forceCSS||!j.forceJS&&"css"==j.url.split(".").pop().split("?").shift()?"c":c,j.noexec,j.attrs,j.timeout),(d(e)||d(l))&&f.load(function(){k(),e&&e(j.origUrl,i,g),l&&l(j.origUrl,i,g),y[j.url]=2})))}function i(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var j,l,m=this.yepnope.loader;if(e(a))g(a,0,m,0);else if(w(a))for(j=0;j<a.length;j++)l=a[j],e(l)?g(l,0,m,0):w(l)?B(l):Object(l)===l&&i(l,m);else Object(a)===a&&i(a,m)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
21;
22//----------------------------------------------------------
23// Copyright (C) Microsoft Corporation. All rights reserved.
24//----------------------------------------------------------
25// MicrosoftAjax.js
26Function.__typeName="Function";Function.__class=true;Function.createCallback=function(b,a){return function(){var e=arguments.length;if(e>0){var d=[];for(var c=0;c<e;c++)d[c]=arguments[c];d[e]=a;return b.apply(this,d)}return b.call(this,a)}};Function.createDelegate=function(a,b){return function(){return b.apply(a,arguments)}};Function.emptyFunction=Function.emptyMethod=function(){};Function._validateParams=function(e,c){var a;a=Function._validateParameterCount(e,c);if(a){a.popStackFrame();return a}for(var b=0;b<e.length;b++){var d=c[Math.min(b,c.length-1)],f=d.name;if(d.parameterArray)f+="["+(b-c.length+1)+"]";a=Function._validateParameter(e[b],d,f);if(a){a.popStackFrame();return a}}return null};Function._validateParameterCount=function(e,a){var c=a.length,d=0;for(var b=0;b<a.length;b++)if(a[b].parameterArray)c=Number.MAX_VALUE;else if(!a[b].optional)d++;if(e.length<d||e.length>c){var f=Error.parameterCount();f.popStackFrame();return f}return null};Function._validateParameter=function(c,a,h){var b,g=a.type,l=!!a.integer,k=!!a.domElement,m=!!a.mayBeNull;b=Function._validateParameterType(c,g,l,k,m,h);if(b){b.popStackFrame();return b}var e=a.elementType,f=!!a.elementMayBeNull;if(g===Array&&typeof c!=="undefined"&&c!==null&&(e||!f)){var j=!!a.elementInteger,i=!!a.elementDomElement;for(var d=0;d<c.length;d++){var n=c[d];b=Function._validateParameterType(n,e,j,i,f,h+"["+d+"]");if(b){b.popStackFrame();return b}}}return null};Function._validateParameterType=function(a,c,n,m,k,d){var b;if(typeof a==="undefined")if(k)return null;else{b=Error.argumentUndefined(d);b.popStackFrame();return b}if(a===null)if(k)return null;else{b=Error.argumentNull(d);b.popStackFrame();return b}if(c&&c.__enum){if(typeof a!=="number"){b=Error.argumentType(d,Object.getType(a),c);b.popStackFrame();return b}if(a%1===0){var e=c.prototype;if(!c.__flags||a===0){for(var i in e)if(e[i]===a)return null}else{var l=a;for(var i in e){var f=e[i];if(f===0)continue;if((f&a)===f)l-=f;if(l===0)return null}}}b=Error.argumentOutOfRange(d,a,String.format(Sys.Res.enumInvalidValue,a,c.getName()));b.popStackFrame();return b}if(m){var h;if(typeof a.nodeType!=="number"){var g=a.ownerDocument||a.document||a;if(g!=a){var j=g.defaultView||g.parentWindow;h=j!=a&&!(j.document&&a.document&&j.document===a.document)}else h=typeof g.body==="undefined"}else h=a.nodeType===3;if(h){b=Error.argument(d,Sys.Res.argumentDomElement);b.popStackFrame();return b}}if(c&&!c.isInstanceOfType(a)){b=Error.argumentType(d,Object.getType(a),c);b.popStackFrame();return b}if(c===Number&&n)if(a%1!==0){b=Error.argumentOutOfRange(d,a,Sys.Res.argumentInteger);b.popStackFrame();return b}return null};Error.__typeName="Error";Error.__class=true;Error.create=function(d,b){var a=new Error(d);a.message=d;if(b)for(var c in b)a[c]=b[c];a.popStackFrame();return a};Error.argument=function(a,c){var b="Sys.ArgumentException: "+(c?c:Sys.Res.argument);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentException",paramName:a});d.popStackFrame();return d};Error.argumentNull=function(a,c){var b="Sys.ArgumentNullException: "+(c?c:Sys.Res.argumentNull);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentNullException",paramName:a});d.popStackFrame();return d};Error.argumentOutOfRange=function(c,a,d){var b="Sys.ArgumentOutOfRangeException: "+(d?d:Sys.Res.argumentOutOfRange);if(c)b+="\n"+String.format(Sys.Res.paramName,c);if(typeof a!=="undefined"&&a!==null)b+="\n"+String.format(Sys.Res.actualValue,a);var e=Error.create(b,{name:"Sys.ArgumentOutOfRangeException",paramName:c,actualValue:a});e.popStackFrame();return e};Error.argumentType=function(d,c,b,e){var a="Sys.ArgumentTypeException: ";if(e)a+=e;else if(c&&b)a+=String.format(Sys.Res.argumentTypeWithTypes,c.getName(),b.getName());else a+=Sys.Res.argumentType;if(d)a+="\n"+String.format(Sys.Res.paramName,d);var f=Error.create(a,{name:"Sys.ArgumentTypeException",paramName:d,actualType:c,expectedType:b});f.popStackFrame();return f};Error.argumentUndefined=function(a,c){var b="Sys.ArgumentUndefinedException: "+(c?c:Sys.Res.argumentUndefined);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentUndefinedException",paramName:a});d.popStackFrame();return d};Error.format=function(a){var c="Sys.FormatException: "+(a?a:Sys.Res.format),b=Error.create(c,{name:"Sys.FormatException"});b.popStackFrame();return b};
26Error.invalidOperation=function(a){var c="Sys.InvalidOperationException: "+(a?a:Sys.Res.invalidOperation),b=Error.create(c,{name:"Sys.InvalidOperationException"});b.popStackFrame();return b};Error.notImplemented=function(a){var c="Sys.NotImplementedException: "+(a?a:Sys.Res.notImplemented),b=Error.create(c,{name:"Sys.NotImplementedException"});b.popStackFrame();return b};Error.parameterCount=function(a){var c="Sys.ParameterCountException: "+(a?a:Sys.Res.parameterCount),b=Error.create(c,{name:"Sys.ParameterCountException"});b.popStackFrame();return b};Error.prototype.popStackFrame=function(){if(typeof this.stack==="undefined"||this.stack===null||typeof this.fileName==="undefined"||this.fileName===null||typeof this.lineNumber==="undefined"||this.lineNumber===null)return;var a=this.stack.split("\n"),c=a[0],e=this.fileName+":"+this.lineNumber;while(typeof c!=="undefined"&&c!==null&&c.indexOf(e)===-1){a.shift();c=a[0]}var d=a[1];if(typeof d==="undefined"||d===null)return;var b=d.match(/@(.*):(\d+)$/);if(typeof b==="undefined"||b===null)return;this.fileName=b[1];this.lineNumber=parseInt(b[2]);a.shift();this.stack=a.join("\n")};Object.__typeName="Object";Object.__class=true;
26Object.getType=function(b){var a=b.constructor;if(!a||typeof a!=="function"||!a.__typeName||a.__typeName==="Object")return Object;return a};Object.getTypeName=function(a){return Object.getType(a).getName()};String.__typeName="String";String.__class=true;String.prototype.endsWith=function(a){return this.substr(this.length-a.length)===a};String.prototype.startsWith=function(a){return this.substr(0,a.length)===a};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.trimEnd=function(){return this.replace(/\s+$/,"")};String.prototype.trimStart=function(){return this.replace(/^\s+/,"")};String.format=function(){return String._toFormattedString(false,arguments)};String.localeFormat=function(){return String._toFormattedString(true,arguments)};String._toFormattedString=function(l,j){var c="",e=j[0];for(var a=0;true;){var f=e.indexOf("{",a),d=e.indexOf("}",a);if(f<0&&d<0){c+=e.slice(a);break}if(d>0&&(d<f||f<0)){c+=e.slice(a,d+1);a=d+2;continue}c+=e.slice(a,f);a=f+1;if(e.charAt(a)==="{"){c+="{";a++;continue}if(d<0)break;var h=e.substring(a,d),g=h.indexOf(":"),k=parseInt(g<0?h:h.substring(0,g),10)+1,i=g<0?"":h.substring(g+1),b=j[k];if(typeof b==="undefined"||b===null)b="";if(b.toFormattedString)c+=b.toFormattedString(i);else if(l&&b.localeFormat)c+=b.localeFormat(i);else if(b.format)c+=b.format(i);else c+=b.toString();a=d+1}return c};Boolean.__typeName="Boolean";Boolean.__class=true;Boolean.parse=function(b){var a=b.trim().toLowerCase();if(a==="false")return false;if(a==="true")return true};Date.__typeName="Date";Date.__class=true;Date._appendPreOrPostMatch=function(e,b){var d=0,a=false;for(var c=0,g=e.length;c<g;c++){var f=e.charAt(c);switch(f){case "'":if(a)b.append("'");else d++;a=false;break;case "\\":if(a)b.append("\\");a=!a;break;default:b.append(f);a=false}}return d};Date._expandFormat=function(a,b){if(!b)b="F";if(b.length===1)switch(b){case "d":return a.ShortDatePattern;case "D":return a.LongDatePattern;case "t":return a.ShortTimePattern;case "T":return a.LongTimePattern;case "F":return a.FullDateTimePattern;case "M":case "m":return a.MonthDayPattern;case "s":return a.SortableDateTimePattern;case "Y":case "y":return a.YearMonthPattern;default:throw Error.format(Sys.Res.formatInvalidString)}return b};Date._expandYear=function(c,a){if(a<100){var b=(new Date).getFullYear();a+=b-b%100;if(a>c.Calendar.TwoDigitYearMax)return a-100}return a};Date._getParseRegExp=function(b,e){if(!b._parseRegExp)b._parseRegExp={};else if(b._parseRegExp[e])return b._parseRegExp[e];var c=Date._expandFormat(b,e);c=c.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1");var a=new Sys.StringBuilder("^"),j=[],f=0,i=0,h=Date._getTokenRegExp(),d;while((d=h.exec(c))!==null){var l=c.slice(f,d.index);f=h.lastIndex;i+=Date._appendPreOrPostMatch(l,a);if(i%2===1){a.append(d[0]);continue}switch(d[0]){case "dddd":case "ddd":case "MMMM":case "MMM":a.append("(\\D+)");break;case "tt":case "t":a.append("(\\D*)");break;case "yyyy":a.append("(\\d{4})");break;case "fff":a.append("(\\d{3})");break;case "ff":a.append("(\\d{2})");break;case "f":a.append("(\\d)");break;case "dd":case "d":case "MM":case "M":case "yy":case "y":case "HH":case "H":case "hh":case "h":case "mm":case "m":case "ss":case "s":a.append("(\\d\\d?)");break;case "zzz":a.append("([+-]?\\d\\d?:\\d{2})");break;case "zz":case "z":a.append("([+-]?\\d\\d?)")}Array.add(j,d[0])}Date._appendPreOrPostMatch(c.slice(f),a);a.append("$");var k=a.toString().replace(/\s+/g,"\\s+"),g={"regExp":k,"groups":j};b._parseRegExp[e]=g;return g};Date._getTokenRegExp=function(){return /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z/g};Date.parseLocale=function(a){return Date._parse(a,Sys.CultureInfo.CurrentCulture,arguments)};Date.parseInvariant=function(a){return Date._parse(a,Sys.CultureInfo.InvariantCulture,arguments)};Date._parse=function(g,c,h){var e=false;for(var a=1,i=h.length;a<i;a++){var f=h[a];if(f){e=true;var b=Date._parseExact(g,f,c);if(b)return b}}if(!e){var d=c._getDateTimeFormats();for(var a=0,i=d.length;a<i;a++){var b=Date._parseExact(g,d[a],c);if(b)return b}}return null};Date._parseExact=function(s,y,j){s=s.trim();var m=j.dateTimeFormat,v=Date._getParseRegExp(m,y),x=(new RegExp(v.regExp)).exec(s);if(x===null)return null;var w=v.groups,f=null,c=null,h=null,g=null,d=0,n=0,o=0,e=0,k=null,r=false;for(var p=0,z=w.length;p<z;p++){var a=x[p+1];if(a)switch(w[p]){case "dd":case "d":h=parseInt(a,10);if(h<1||h>31)return null;break;case "MMMM":c=j._getMonthIndex(a);if(c<0||c>11)return null;break;case "MMM":c=j._getAbbrMonthIndex(a);if(c<0||c>11)return null;break;case "M":case "MM":var c=parseInt(a,10)-1;if(c<0||c>11)return null;break;case "y":case "yy":f=Date._expandYear(m,parseInt(a,10));if(f<0||f>9999)return null;break;case "yyyy":f=parseInt(a,10);if(f<0||f>9999)return null;break;case "h":case "hh":d=parseInt(a,10);if(d===12)d=0;if(d<0||d>11)return null;break;case "H":case "HH":d=parseInt(a,10);if(d<0||d>23)return null;break;case "m":case "mm":n=parseInt(a,10);if(n<0||n>59)return null;break;case "s":case "ss":o=parseInt(a,10);if(o<0||o>59)return null;break;case "tt":case "t":var u=a.toUpperCase();r=u===m.PMDesignator.toUpperCase();if(!r&&u!==m.AMDesignator.toUpperCase())return null;break;case "f":e=parseInt(a,10)*100;if(e<0||e>999)return null;break;case "ff":e=parseInt(a,10)*10;if(e<0||e>999)return null;break;case "fff":e=parseInt(a,10);if(e<0||e>999)return null;break;case "dddd":g=j._getDayIndex(a);if(g<0||g>6)return null;break;case "ddd":g=j._getAbbrDayIndex(a);if(g<0||g>6)return null;break;case "zzz":var q=a.split(/:/);if(q.length!==2)return null;var i=parseInt(q[0],10);if(i<-12||i>13)return null;var l=parseInt(q[1],10);if(l<0||l>59)return null;
26k=i*60+(a.startsWith("-")?-l:l);break;case "z":case "zz":var i=parseInt(a,10);if(i<-12||i>13)return null;k=i*60}}var b=new Date;if(f===null)f=b.getFullYear();if(c===null)c=b.getMonth();if(h===null)h=b.getDate();b.setFullYear(f,c,h);if(b.getDate()!==h)return null;if(g!==null&&b.getDay()!==g)return null;if(r&&d<12)d+=12;b.setHours(d,n,o,e);if(k!==null){var t=b.getMinutes()-(k+b.getTimezoneOffset());b.setHours(b.getHours()+parseInt(t/60,10),t%60)}return b};Date.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Date.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Date.prototype._toFormattedString=function(e,h){if(!e||e.length===0||e==="i")if(h&&h.name.length>0)return this.toLocaleString();else return this.toString();var d=h.dateTimeFormat;e=Date._expandFormat(d,e);var a=new Sys.StringBuilder,b;function c(a){if(a<10)return "0"+a;return a.toString()}function g(a){if(a<10)return "00"+a;if(a<100)return "0"+a;return a.toString()}var j=0,i=Date._getTokenRegExp();for(;true;){var l=i.lastIndex,f=i.exec(e),k=e.slice(l,f?f.index:e.length);j+=Date._appendPreOrPostMatch(k,a);if(!f)break;if(j%2===1){a.append(f[0]);continue}switch(f[0]){case "dddd":a.append(d.DayNames[this.getDay()]);break;case "ddd":a.append(d.AbbreviatedDayNames[this.getDay()]);break;case "dd":a.append(c(this.getDate()));break;case "d":a.append(this.getDate());break;case "MMMM":a.append(d.MonthNames[this.getMonth()]);break;case "MMM":a.append(d.AbbreviatedMonthNames[this.getMonth()]);break;case "MM":a.append(c(this.getMonth()+1));break;case "M":a.append(this.getMonth()+1);break;case "yyyy":a.append(this.getFullYear());break;case "yy":a.append(c(this.getFullYear()%100));break;case "y":a.append(this.getFullYear()%100);break;case "hh":b=this.getHours()%12;if(b===0)b=12;a.append(c(b));break;case "h":b=this.getHours()%12;if(b===0)b=12;a.append(b);break;case "HH":a.append(c(this.getHours()));break;case "H":a.append(this.getHours());break;case "mm":a.append(c(this.getMinutes()));break;case "m":a.append(this.getMinutes());break;case "ss":a.append(c(this.getSeconds()));break;case "s":a.append(this.getSeconds());break;case "tt":a.append(this.getHours()<12?d.AMDesignator:d.PMDesignator);break;case "t":a.append((this.getHours()<12?d.AMDesignator:d.PMDesignator).charAt(0));break;case "f":a.append(g(this.getMilliseconds()).charAt(0));break;case "ff":a.append(g(this.getMilliseconds()).substr(0,2));break;case "fff":a.append(g(this.getMilliseconds()));break;case "z":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+Math.floor(Math.abs(b)));break;case "zz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b))));break;case "zzz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b)))+d.TimeSeparator+c(Math.abs(this.getTimezoneOffset()%60)))}}return a.toString()};Number.__typeName="Number";Number.__class=true;Number.parseLocale=function(a){return Number._parse(a,Sys.CultureInfo.CurrentCulture)};Number.parseInvariant=function(a){return Number._parse(a,Sys.CultureInfo.InvariantCulture)};Number._parse=function(b,o){b=b.trim();if(b.match(/^[+-]?infinity$/i))return parseFloat(b);if(b.match(/^0x[a-f0-9]+$/i))return parseInt(b);var a=o.numberFormat,g=Number._parseNumberNegativePattern(b,a,a.NumberNegativePattern),h=g[0],e=g[1];if(h===""&&a.NumberNegativePattern!==1){g=Number._parseNumberNegativePattern(b,a,1);h=g[0];e=g[1]}if(h==="")h="+";var j,d,f=e.indexOf("e");if(f<0)f=e.indexOf("E");if(f<0){d=e;j=null}else{d=e.substr(0,f);j=e.substr(f+1)}var c,k,m=d.indexOf(a.NumberDecimalSeparator);if(m<0){c=d;k=null}else{c=d.substr(0,m);k=d.substr(m+a.NumberDecimalSeparator.length)}c=c.split(a.NumberGroupSeparator).join("");var n=a.NumberGroupSeparator.replace(/\u00A0/g," ");if(a.NumberGroupSeparator!==n)c=c.split(n).join("");var l=h+c;if(k!==null)l+="."+k;if(j!==null){var i=Number._parseNumberNegativePattern(j,a,1);if(i[0]==="")i[0]="+";l+="e"+i[0]+i[1]}if(l.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/))return parseFloat(l);return Number.NaN};Number._parseNumberNegativePattern=function(a,d,e){var b=d.NegativeSign,c=d.PositiveSign;switch(e){case 4:b=" "+b;c=" "+c;case 3:if(a.endsWith(b))return ["-",a.substr(0,a.length-b.length)];else if(a.endsWith(c))return ["+",a.substr(0,a.length-c.length)];break;case 2:b+=" ";c+=" ";case 1:if(a.startsWith(b))return ["-",a.substr(b.length)];else if(a.startsWith(c))return ["+",a.substr(c.length)];break;case 0:if(a.startsWith("(")&&a.endsWith(")"))return ["-",a.substr(1,a.length-2)]}return ["",a]};Number.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Number.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Number.prototype._toFormattedString=function(d,j){if(!d||d.length===0||d==="i")if(j&&j.name.length>
260)return this.toLocaleString();else return this.toString();var o=["n %","n%","%n"],n=["-n %","-n%","-%n"],p=["(n)","-n","- n","n-","n -"],m=["$n","n$","$ n","n $"],l=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];function g(a,c,d){for(var b=a.length;b<c;b++)a=d?"0"+a:a+"0";return a}function i(j,i,l,n,p){var h=l[0],k=1,o=Math.pow(10,i),m=Math.round(j*o)/o;if(!isFinite(m))m=j;j=m;var b=j.toString(),a="",c,e=b.split(/e/i);b=e[0];c=e.length>1?parseInt(e[1]):0;e=b.split(".");b=e[0];a=e.length>1?e[1]:"";var q;if(c>0){a=g(a,c,false);b+=a.slice(0,c);a=a.substr(c)}else if(c<0){c=-c;b=g(b,c+1,true);a=b.slice(-c,b.length)+a;b=b.slice(0,-c)}if(i>0){if(a.length>i)a=a.slice(0,i);else a=g(a,i,false);a=p+a}else a="";var d=b.length-1,f="";while(d>=0){if(h===0||h>d)if(f.length>0)return b.slice(0,d+1)+n+f+a;else return b.slice(0,d+1)+a;if(f.length>0)f=b.slice(d-h+1,d+1)+n+f;else f=b.slice(d-h+1,d+1);d-=h;if(k<l.length){h=l[k];k++}}return b.slice(0,d+1)+n+f+a}var a=j.numberFormat,e=Math.abs(this);if(!d)d="D";var b=-1;if(d.length>1)b=parseInt(d.slice(1),10);var c;switch(d.charAt(0)){case "d":case "D":c="n";if(b!==-1)e=g(""+e,b,true);if(this<0)e=-e;break;case "c":case "C":if(this<0)c=l[a.CurrencyNegativePattern];else c=m[a.CurrencyPositivePattern];if(b===-1)b=a.CurrencyDecimalDigits;e=i(Math.abs(this),b,a.CurrencyGroupSizes,a.CurrencyGroupSeparator,a.CurrencyDecimalSeparator);break;case "n":case "N":if(this<0)c=p[a.NumberNegativePattern];else c="n";if(b===-1)b=a.NumberDecimalDigits;e=i(Math.abs(this),b,a.NumberGroupSizes,a.NumberGroupSeparator,a.NumberDecimalSeparator);break;case "p":case "P":if(this<0)c=n[a.PercentNegativePattern];else c=o[a.PercentPositivePattern];if(b===-1)b=a.PercentDecimalDigits;e=i(Math.abs(this)*100,b,a.PercentGroupSizes,a.PercentGroupSeparator,a.PercentDecimalSeparator);break;default:throw Error.format(Sys.Res.formatBadFormatSpecifier)}var k=/n|\$|-|%/g,f="";for(;true;){var q=k.lastIndex,h=k.exec(c);f+=c.slice(q,h?h.index:c.length);if(!h)break;switch(h[0]){case "n":f+=e;break;case "$":f+=a.CurrencySymbol;break;case "-":f+=a.NegativeSign;break;case "%":f+=a.PercentSymbol}}return f};RegExp.__typeName="RegExp";RegExp.__class=true;Array.__typeName="Array";Array.__class=true;Array.add=Array.enqueue=function(a,b){a[a.length]=b};Array.addRange=function(a,b){a.push.apply(a,b)};Array.clear=function(a){a.length=0};Array.clone=function(a){if(a.length===1)return [a[0]];else return Array.apply(null,a)};Array.contains=function(a,b){return Array.indexOf(a,b)>=0};Array.dequeue=function(a){return a.shift()};Array.forEach=function(b,e,d){for(var a=0,f=b.length;a<f;a++){var c=b[a];if(typeof c!=="undefined")e.call(d,c,a,b)}};Array.indexOf=function(d,e,a){if(typeof e==="undefined")return -1;var c=d.length;if(c!==0){a=a-0;if(isNaN(a))a=0;else{if(isFinite(a))a=a-a%1;if(a<0)a=Math.max(0,c+a)}for(var b=a;b<c;b++)if(typeof d[b]!=="undefined"&&d[b]===e)return b}return -1};Array.insert=function(a,b,c){a.splice(b,0,c)};Array.parse=function(value){if(!value)return [];return eval(value)};Array.remove=function(b,c){var a=Array.indexOf(b,c);if(a>=0)b.splice(a,1);return a>=0};Array.removeAt=function(a,b){a.splice(b,1)};if(!window)this.window=this;window.Type=Function;Type.prototype.callBaseMethod=function(a,d,b){var c=this.getBaseMethod(a,d);if(!b)return c.apply(a);else return c.apply(a,b)};Type.prototype.getBaseMethod=function(d,c){var b=this.getBaseType();if(b){var a=b.prototype[c];return a instanceof Function?a:null}return null};Type.prototype.getBaseType=function(){return typeof this.__baseType==="undefined"?null:this.__baseType};Type.prototype.getInterfaces=function(){var a=[],b=this;while(b){var c=b.__interfaces;if(c)for(var d=0,f=c.length;d<f;d++){var e=c[d];if(!Array.contains(a,e))a[a.length]=e}b=b.__baseType}return a};Type.prototype.getName=function(){return typeof this.__typeName==="undefined"?"":this.__typeName};Type.prototype.implementsInterface=function(d){this.resolveInheritance();var c=d.getName(),a=this.__interfaceCache;if(a){var e=a[c];if(typeof e!=="undefined")return e}else a=this.__interfaceCache={};var b=this;while(b){var f=b.__interfaces;if(f)if(Array.indexOf(f,d)!==-1)return a[c]=true;b=b.__baseType}return a[c]=false};Type.prototype.inheritsFrom=function(b){this.resolveInheritance();var a=this.__baseType;while(a){if(a===b)return true;a=a.__baseType}return false};Type.prototype.initializeBase=function(a,b){this.resolveInheritance();if(this.__baseType)if(!b)this.__baseType.apply(a);else this.__baseType.apply(a,b);return a};
26Type.prototype.isImplementedBy=function(a){if(typeof a==="undefined"||a===null)return false;var b=Object.getType(a);return !!(b.implementsInterface&&b.implementsInterface(this))};Type.prototype.isInstanceOfType=function(b){if(typeof b==="undefined"||b===null)return false;if(b instanceof this)return true;var a=Object.getType(b);return !!(a===this)||a.inheritsFrom&&a.inheritsFrom(this)||a.implementsInterface&&a.implementsInterface(this)};Type.prototype.registerClass=function(c,b,d){this.prototype.constructor=this;this.__typeName=c;this.__class=true;if(b){this.__baseType=b;this.__basePrototypePending=true}Sys.__upperCaseTypes[c.toUpperCase()]=this;if(d){this.__interfaces=[];for(var a=2,f=arguments.length;a<f;a++){var e=arguments[a];this.__interfaces.push(e)}}return this};Type.prototype.registerInterface=function(a){Sys.__upperCaseTypes[a.toUpperCase()]=this;this.prototype.constructor=this;this.__typeName=a;this.__interface=true;return this};Type.prototype.resolveInheritance=function(){if(this.__basePrototypePending){var b=this.__baseType;b.resolveInheritance();for(var a in b.prototype){var c=b.prototype[a];if(!this.prototype[a])this.prototype[a]=c}delete this.__basePrototypePending}};Type.getRootNamespaces=function(){return Array.clone(Sys.__rootNamespaces)};Type.isClass=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__class};Type.isInterface=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__interface};Type.isNamespace=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__namespace};Type.parse=function(typeName,ns){var fn;if(ns){fn=Sys.__upperCaseTypes[ns.getName().toUpperCase()+"."+typeName.toUpperCase()];return fn||null}if(!typeName)return null;if(!Type.__htClasses)Type.__htClasses={};fn=Type.__htClasses[typeName];if(!fn){fn=eval(typeName);Type.__htClasses[typeName]=fn}return fn};Type.registerNamespace=function(f){var d=window,c=f.split(".");for(var b=0;b<c.length;b++){var e=c[b],a=d[e];if(!a){a=d[e]={__namespace:true,__typeName:c.slice(0,b+1).join(".")};if(b===0)Sys.__rootNamespaces[Sys.__rootNamespaces.length]=a;a.getName=function(){return this.__typeName}}d=a}};window.Sys={__namespace:true,__typeName:"Sys",getName:function(){return "Sys"},__upperCaseTypes:{}};Sys.__rootNamespaces=[Sys];Sys.IDisposable=function(){};Sys.IDisposable.prototype={};Sys.IDisposable.registerInterface("Sys.IDisposable");Sys.StringBuilder=function(a){this._parts=typeof a!=="undefined"&&a!==null&&a!==""?[a.toString()]:[];this._value={};this._len=0};Sys.StringBuilder.prototype={append:function(a){this._parts[this._parts.length]=a},appendLine:function(a){this._parts[this._parts.length]=typeof a==="undefined"||a===null||a===""?"\r\n":a+"\r\n"},clear:function(){this._parts=[];this._value={};this._len=0},isEmpty:function(){if(this._parts.length===0)return true;return this.toString()===""},toString:function(a){a=a||"";var b=this._parts;if(this._len!==b.length){this._value={};this._len=b.length}var d=this._value;if(typeof d[a]==="undefined"){if(a!=="")for(var c=0;c<b.length;)if(typeof b[c]==="undefined"||b[c]===""||b[c]===null)b.splice(c,1);else c++;d[a]=this._parts.join(a)}return d[a]}};Sys.StringBuilder.registerClass("Sys.StringBuilder");if(!window.XMLHttpRequest)window.XMLHttpRequest=function(){var b=["Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP"];for(var a=0,c=b.length;a<c;a++)try{return new ActiveXObject(b[a])}catch(d){}return null};Sys.Browser={};Sys.Browser.InternetExplorer={};Sys.Browser.Firefox={};Sys.Browser.Safari={};Sys.Browser.Opera={};Sys.Browser.agent=null;Sys.Browser.hasDebuggerStatement=false;Sys.Browser.name=navigator.appName;Sys.Browser.version=parseFloat(navigator.appVersion);Sys.Browser.documentMode=0;if(navigator.userAgent.indexOf(" MSIE ")>-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;Sys.Browser.version=parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);if(Sys.Browser.version>=8)if(document.documentMode>=7)Sys.Browser.documentMode=document.documentMode;Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" Firefox/")>-1){Sys.Browser.agent=Sys.Browser.Firefox;Sys.Browser.version=parseFloat(navigator.userAgent.match(/Firefox\/(\d+\.\d+)/)[1]);Sys.Browser.name="Firefox";Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" AppleWebKit/")>-1){Sys.Browser.agent=Sys.Browser.Safari;Sys.Browser.version=parseFloat(navigator.userAgent.match(/AppleWeb
26Kit\/(\d+(\.\d+)?)/)[1]);Sys.Browser.name="Safari"}else if(navigator.userAgent.indexOf("Opera/")>-1)Sys.Browser.agent=Sys.Browser.Opera;Type.registerNamespace("Sys.UI");Sys._Debug=function(){};Sys._Debug.prototype={_appendConsole:function(a){if(typeof Debug!=="undefined"&&Debug.writeln)Debug.writeln(a);if(window.console&&window.console.log)window.console.log(a);if(window.opera)window.opera.postError(a);if(window.debugService)window.debugService.trace(a)},_appendTrace:function(b){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value+=b+"\n"},assert:function(c,a,b){if(!c){a=b&&this.assert.caller?String.format(Sys.Res.assertFailedCaller,a,this.assert.caller):String.format(Sys.Res.assertFailed,a);if(confirm(String.format(Sys.Res.breakIntoDebugger,a)))this.fail(a)}},clearTrace:function(){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value=""},fail:function(message){this._appendConsole(message);if(Sys.Browser.hasDebuggerStatement)eval("debugger")},trace:function(a){this._appendConsole(a);this._appendTrace(a)},traceDump:function(a,b){var c=this._traceDump(a,b,true)},_traceDump:function(a,c,f,b,d){c=c?c:"traceDump";b=b?b:"";if(a===null){this.trace(b+c+": null");return}switch(typeof a){case "undefined":this.trace(b+c+": Undefined");break;case "number":case "string":case "boolean":this.trace(b+c+": "+a);break;default:if(Date.isInstanceOfType(a)||RegExp.isInstanceOfType(a)){this.trace(b+c+": "+a.toString());break}if(!d)d=[];else if(Array.contains(d,a)){this.trace(b+c+": ...");return}Array.add(d,a);if(a==window||a===document||window.HTMLElement&&a instanceof HTMLElement||typeof a.nodeName==="string"){var k=a.tagName?a.tagName:"DomElement";if(a.id)k+=" - "+a.id;this.trace(b+c+" {"+k+"}")}else{var i=Object.getTypeName(a);this.trace(b+c+(typeof i==="string"?" {"+i+"}":""));if(b===""||f){b+="    ";var e,j,l,g,h;if(Array.isInstanceOfType(a)){j=a.length;for(e=0;e<j;e++)this._traceDump(a[e],"["+e+"]",f,b,d)}else for(g in a){h=a[g];if(!Function.isInstanceOfType(h))this._traceDump(h,g,f,b,d)}}}Array.remove(d,a)}}};Sys._Debug.registerClass("Sys._Debug");Sys.Debug=new Sys._Debug;Sys.Debug.isDebug=false;function Sys$Enum$parse(c,e){var a,b,i;if(e){a=this.__lowerCaseValues;if(!a){this.__lowerCaseValues=a={};var g=this.prototype;for(var f in g)a[f.toLowerCase()]=g[f]}}else a=this.prototype;if(!this.__flags){i=e?c.toLowerCase():c;b=a[i.trim()];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c,this.__typeName));return b}else{var h=(e?c.toLowerCase():c).split(","),j=0;for(var d=h.length-1;d>=0;d--){var k=h[d].trim();b=a[k];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c.split(",")[d].trim(),this.__typeName));j|=b}return j}}function Sys$Enum$toString(c){if(typeof c==="undefined"||c===null)return this.__string;var d=this.prototype,a;if(!this.__flags||c===0){for(a in d)if(d[a]===c)return a}else{var b=this.__sortedValues;if(!b){b=[];for(a in d)b[b.length]={key:a,value:d[a]};b.sort(function(a,b){return a.value-b.value});this.__sortedValues=b}var e=[],g=c;for(a=b.length-1;a>=0;a--){var h=b[a],f=h.value;if(f===0)continue;if((f&c)===f){e[e.length]=h.key;g-=f;if(g===0)break}}if(e.length&&g===0)return e.reverse().join(", ")}return ""}Type.prototype.registerEnum=function(b,c){Sys.__upperCaseTypes[b.toUpperCase()]=this;for(var a in this.prototype)this[a]=this.prototype[a];this.__typeName=b;this.parse=Sys$Enum$parse;this.__string=this.toString();this.toString=Sys$Enum$toString;this.__flags=c;this.__enum=true};Type.isEnum=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__enum};Type.isFlags=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__flags};Sys.EventHandlerList=function(){this._list={}};Sys.EventHandlerList.prototype={addHandler:function(b,a){Array.add(this._getEvent(b,true),a)},removeHandler:function(c,b){var a=this._getEvent(c);if(!a)return;Array.remove(a,b)},getHandler:function(b){var a=this._getEvent(b);if(!a||a.length===0)return null;a=Array.clone(a);return function(c,d){for(var b=0,e=a.length;b<e;b++)a[b](c,d)}},_getEvent:function(a,b){if(!this._list[a]){if(!b)return null;this._list[a]=[]}return this._list[a]}};Sys.EventHandlerList.registerClass("Sys.EventHandlerList");Sys.EventArgs=function(){};Sys.EventArgs.registerClass("Sys.EventArgs");Sys.EventArgs.Empty=new Sys.EventArgs;Sys.CancelEventArgs=function(){Sys.CancelEventArgs.initializeBase(this);this._cancel=false};Sys.CancelEventArgs.prototype={get_cancel:function(){return this._cancel},set_cancel:function(a){this._cancel=a}};Sys.CancelEventArgs.registerClass("Sys.CancelEventArgs",Sys.EventArgs);Sys.INotifyPropertyChange=function(){};Sys.INotifyPropertyChange.prototype={};Sys.INotifyPropertyChange.registerInterface("Sys.INotifyPropertyChange");Sys.PropertyChangedEventArgs=function(a){Sys.PropertyChangedEventArgs.initializeBase(this);this._propertyName=a};Sys.PropertyChangedEventArgs.prototype={get_propertyName:function(){return this._propertyName}};Sys.PropertyChangedEventArgs.registerClass("Sys.PropertyChangedEventArgs",Sys.EventArgs);Sys.INotifyDisposing=function(){};Sys.INotifyDisposing.prototype={};Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");Sys.Component=function(){if(Sys.Application)Sys.Application.registerDisposableObject(this)};Sys.Component.prototype={_id:null,_initialized:false,_updating:false,get_events:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_id:function(){return this._id},set_id:function(a){this._id=a},get_isInitialized:function(){return this._initialized},get_isUpdating:function(){return this._updating},add_disposing:function(a){this.get_events().addHandler("disposing",a)},remove_disposing:function(a){this.get_events().removeHandler("disposing",a)},add_propertyChanged:function(a){this.get_events().addHandler("propertyChanged",a)},remove_propertyChanged:function(a){this.get_events().removeHandler("propertyChanged",a)},beginUpdate:function(){this._updating=true},dispose:function(){if(this._events){var a=this._events.getHandler("disposing");if(a)a(this,Sys.EventArgs.Empty)}delete this._events;Sys.Application.unregisterDisposableObject(this);Sys.Application.removeComponent(this)},endUpdate:function(){this._updating=false;if(!this._initialized)this.initialize();this.updated()},initialize:function(){this._initialized=true},raisePropertyChanged:function(b){if(!this._events)return;var a=this._events.getHandler("propertyChanged");if(a)a(this,new Sys.PropertyChangedEventArgs(b))},updated:function(){}};Sys.Component.registerClass("Sys.Component",null,Sys.IDisposable,Sys.INotifyPropertyChange,Sys.INotifyDisposing);function Sys$Component$_setProperties(a,i){var d,j=Object.getType(a),e=j===Object||j===Sys.UI.DomElement,h=Sys.Component.isInstanceOfType(a)&&!a.get_isUpdating();if(h)a.beginUpdate();for(var c in i){var b=i[c],f=e?null:a["get_"+c];if(e||typeof f!=="function"){var k=a[c];if(!b||typeof b!=="object"||e&&!k)a[c]=b;else Sys$Component$_setProperties(k,b)}else{var l=a["set_"+c];if(typeof l==="function")l.apply(a,[b]);else if(b instanceof Array){d=f.apply(a);for(var g=0,m=d.length,n=b.length;g<n;g++,m++)d[m]=b[g]}else if(typeof b==="object"&&Object.getType(b)===Object){d=f.apply(a);Sys$Component$_setProperties(d,b)}}}if(h)a.endUpdate()}function Sys$Component$_setReferences(c,b){for(var a in b){var e=c["set_"+a],d=$find(b[a]);e.apply(c,[d])}}var $create=Sys.Component.create=function(h,f,d,c,g){var a=g?new h(g):new h,b=Sys.Application,i=b.get_isCreatingComponents();a.beginUpdate();if(f)Sys$Component$_setProperties(a,f);if(d)for(var e in d)a["add_"+e](d[e]);if(a.get_id())b.addComponent(a);if(i){b._createdComponents[b._createdComponents.length]=a;if(c)b._addComponentToSecondPass(a,c);else a.endUpdate()}else{if(c)Sys$Component$_setReferences(a,c);a.endUpdate()}return a};Sys.UI.MouseButton=function(){throw Error.notImplemented()};Sys.UI.MouseButton.prototype={leftButton:0,middleButton:1,rightButton:2};Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");Sys.UI.Key=function(){throw Error.notImplemented()};Sys.UI.Key.prototype={backspace:8,tab:9,enter:13,esc:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,del:127};Sys.UI.Key.registerEnum("Sys.UI.Key");Sys.UI.Point=function(a,b){this.x=a;this.y=b};Sys.UI.Point.registerClass("Sys.UI.Point");Sys.UI.Bounds=function(c,d,b,a){this.x=c;this.y=d;this.height=a;this.width=b};Sys.UI.Bounds.registerClass("Sys.UI.Bounds");
26Sys.UI.DomEvent=function(e){var a=e,b=this.type=a.type.toLowerCase();this.rawEvent=a;this.altKey=a.altKey;if(typeof a.button!=="undefined")this.button=typeof a.which!=="undefined"?a.button:a.button===4?Sys.UI.MouseButton.middleButton:a.button===2?Sys.UI.MouseButton.rightButton:Sys.UI.MouseButton.leftButton;if(b==="keypress")this.charCode=a.charCode||a.keyCode;else if(a.keyCode&&a.keyCode===46)this.keyCode=127;else this.keyCode=a.keyCode;this.clientX=a.clientX;this.clientY=a.clientY;this.ctrlKey=a.ctrlKey;this.target=a.target?a.target:a.srcElement;if(!b.startsWith("key"))if(typeof a.offsetX!=="undefined"&&typeof a.offsetY!=="undefined"){this.offsetX=a.offsetX;this.offsetY=a.offsetY}else if(this.target&&this.target.nodeType!==3&&typeof a.clientX==="number"){var c=Sys.UI.DomElement.getLocation(this.target),d=Sys.UI.DomElement._getWindow(this.target);this.offsetX=(d.pageXOffset||0)+a.clientX-c.x;this.offsetY=(d.pageYOffset||0)+a.clientY-c.y}this.screenX=a.screenX;this.screenY=a.screenY;this.shiftKey=a.shiftKey};Sys.UI.DomEvent.prototype={preventDefault:function(){if(this.rawEvent.preventDefault)this.rawEvent.preventDefault();else if(window.event)this.rawEvent.returnValue=false},stopPropagation:function(){if(this.rawEvent.stopPropagation)this.rawEvent.stopPropagation();else if(window.event)this.rawEvent.cancelBubble=true}};Sys.UI.DomEvent.registerClass("Sys.UI.DomEvent");var $addHandler=Sys.UI.DomEvent.addHandler=function(a,d,e){if(!a._events)a._events={};var c=a._events[d];if(!c)a._events[d]=c=[];var b;if(a.addEventListener){b=function(b){return e.call(a,new Sys.UI.DomEvent(b))};a.addEventListener(d,b,false)}else if(a.attachEvent){b=function(){var b={};try{b=Sys.UI.DomElement._getWindow(a).event}catch(c){}return e.call(a,new Sys.UI.DomEvent(b))};a.attachEvent("on"+d,b)}c[c.length]={handler:e,browserHandler:b}},$addHandlers=Sys.UI.DomEvent.addHandlers=function(e,d,c){for(var b in d){var a=d[b];if(c)a=Function.createDelegate(c,a);$addHandler(e,b,a)}},$clearHandlers=Sys.UI.DomEvent.clearHandlers=function(a){if(a._events){var e=a._events;for(var b in e){var d=e[b];for(var c=d.length-1;c>=0;c--)$removeHandler(a,b,d[c].handler)}a._events=null}},$removeHandler=Sys.UI.DomEvent.removeHandler=function(a,e,f){var d=null,c=a._events[e];for(var b=0,g=c.length;b<g;b++)if(c[b].handler===f){d=c[b].browserHandler;break}if(a.removeEventListener)a.removeEventListener(e,d,false);else if(a.detachEvent)a.detachEvent("on"+e,d);c.splice(b,1)};Sys.UI.DomElement=function(){};Sys.UI.DomElement.registerClass("Sys.UI.DomElement");Sys.UI.DomElement.addCssClass=function(a,b){if(!Sys.UI.DomElement.containsCssClass(a,b))if(a.className==="")a.className=b;else a.className+=" "+b};Sys.UI.DomElement.containsCssClass=function(b,a){return Array.contains(b.className.split(" "),a)};Sys.UI.DomElement.getBounds=function(a){var b=Sys.UI.DomElement.getLocation(a);return new Sys.UI.Bounds(b.x,b.y,a.offsetWidth||0,a.offsetHeight||0)};var $get=Sys.UI.DomElement.getElementById=function(f,e){if(!e)return document.getElementById(f);if(e.getElementById)return e.getElementById(f);var c=[],d=e.childNodes;for(var b=0;b<d.length;b++){var a=d[b];if(a.nodeType==1)c[c.length]=a}while(c.length){a=c.shift();if(a.id==f)return a;d=a.childNodes;for(b=0;b<d.length;b++){a=d[b];if(a.nodeType==1)c[c.length]=a}}return null};switch(Sys.Browser.agent){case Sys.Browser.InternetExplorer:Sys.UI.DomElement.getLocation=function(a){if(a.self||a.nodeType===9)return new Sys.UI.Point(0,0);var b=a.getBoundingClientRect();if(!b)return new Sys.UI.Point(0,0);var d=a.ownerDocument.documentElement,e=b.left-2+d.scrollLeft,f=b.top-2+d.scrollTop;try{var c=a.ownerDocument.parentWindow.frameElement||null;if(c){var g=c.frameBorder==="0"||c.frameBorder==="no"?2:0;e+=g;f+=g}}catch(h){}return new Sys.UI.Point(e,f)};break;case Sys.Browser.Safari:Sys.UI.DomElement.getLocation=function(c){if(c.window&&c.window===c||c.nodeType===9)return new Sys.UI.Point(0,0);var f=0,g=0,j=null,e=null,b;for(var a=c;a;j=a,(e=b,a=a.offsetParent)){b=Sys.UI.DomElement._getCurrentStyle(a);var d=a.tagName?a.tagName.toUpperCase():null;if((a.offsetLeft||a.offsetTop)&&(d!=="BODY"||(!e||e.position!=="absolute"))){f+=a.offsetLeft;g+=a.offsetTop}}b=Sys.UI.DomElement._getCurrentStyle(c);var h=b?b.position:null;if(!h||h!=="absolute")for(var a=c.parentNode;a;a=a.parentNode){d=a.tagName?a.tagName.toUpperCase():null;if(d!=="BODY"&&d!=="HTML"&&(a.scrollLeft||a.scrollTop)){f-=a.scrollLeft||0;g-=a.scrollTop||0}b=Sys.UI.DomElement._getCurrentStyle(a);var i=b?b.position:null;if(i&&i==="absolute")break}return new Sys.UI.Point(f,g)};break;case Sys.Browser.Opera:Sys.UI.DomElement.getLocation=function(b){if(b.window&&b.window===b||b.nodeType===9)return new Sys.UI.Point(0,0);var d=0,e=0,i=null;for(var a=b;a;i=a,a=a.offsetParent){var f=a.tagName;d+=a.offsetLeft||0;e+=a.offsetTop||0}var g=b.style.position,c=g&&g!=="static";
26for(var a=b.parentNode;a;a=a.parentNode){f=a.tagName?a.tagName.toUpperCase():null;if(f!=="BODY"&&f!=="HTML"&&(a.scrollLeft||a.scrollTop)&&(c&&(a.style.overflow==="scroll"||a.style.overflow==="auto"))){d-=a.scrollLeft||0;e-=a.scrollTop||0}var h=a&&a.style?a.style.position:null;c=c||h&&h!=="static"}return new Sys.UI.Point(d,e)};break;default:Sys.UI.DomElement.getLocation=function(d){if(d.window&&d.window===d||d.nodeType===9)return new Sys.UI.Point(0,0);var e=0,f=0,i=null,g=null,b=null;for(var a=d;a;i=a,(g=b,a=a.offsetParent)){var c=a.tagName?a.tagName.toUpperCase():null;b=Sys.UI.DomElement._getCurrentStyle(a);if((a.offsetLeft||a.offsetTop)&&!(c==="BODY"&&(!g||g.position!=="absolute"))){e+=a.offsetLeft;f+=a.offsetTop}if(i!==null&&b){if(c!=="TABLE"&&c!=="TD"&&c!=="HTML"){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}if(c==="TABLE"&&(b.position==="relative"||b.position==="absolute")){e+=parseInt(b.marginLeft)||0;f+=parseInt(b.marginTop)||0}}}b=Sys.UI.DomElement._getCurrentStyle(d);var h=b?b.position:null;if(!h||h!=="absolute")for(var a=d.parentNode;a;a=a.parentNode){c=a.tagName?a.tagName.toUpperCase():null;if(c!=="BODY"&&c!=="HTML"&&(a.scrollLeft||a.scrollTop)){e-=a.scrollLeft||0;f-=a.scrollTop||0;b=Sys.UI.DomElement._getCurrentStyle(a);if(b){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}}}return new Sys.UI.Point(e,f)}}Sys.UI.DomElement.removeCssClass=function(d,c){var a=" "+d.className+" ",b=a.indexOf(" "+c+" ");if(b>=0)d.className=(a.substr(0,b)+" "+a.substring(b+c.length+1,a.length)).trim()};Sys.UI.DomElement.setLocation=function(b,c,d){var a=b.style;a.position="absolute";a.left=c+"px";a.top=d+"px"};Sys.UI.DomElement.toggleCssClass=function(b,a){if(Sys.UI.DomElement.containsCssClass(b,a))Sys.UI.DomElement.removeCssClass(b,a);else Sys.UI.DomElement.addCssClass(b,a)};Sys.UI.DomElement.getVisibilityMode=function(a){return a._visibilityMode===Sys.UI.VisibilityMode.hide?Sys.UI.VisibilityMode.hide:Sys.UI.VisibilityMode.collapse};Sys.UI.DomElement.setVisibilityMode=function(a,b){Sys.UI.DomElement._ensureOldDisplayMode(a);if(a._visibilityMode!==b){a._visibilityMode=b;if(Sys.UI.DomElement.getVisible(a)===false)if(a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none";a._visibilityMode=b}};Sys.UI.DomElement.getVisible=function(b){var a=b.currentStyle||Sys.UI.DomElement._getCurrentStyle(b);if(!a)return true;return a.visibility!=="hidden"&&a.display!=="none"};Sys.UI.DomElement.setVisible=function(a,b){if(b!==Sys.UI.DomElement.getVisible(a)){Sys.UI.DomElement._ensureOldDisplayMode(a);a.style.visibility=b?"visible":"hidden";if(b||a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none"}};Sys.UI.DomElement._ensureOldDisplayMode=function(a){if(!a._oldDisplayMode){var b=a.currentStyle||Sys.UI.DomElement._getCurrentStyle(a);a._oldDisplayMode=b?b.display:null;if(!a._oldDisplayMode||a._oldDisplayMode==="none")switch(a.tagName.toUpperCase()){case "DIV":case "P":case "ADDRESS":case "BLOCKQUOTE":case "BODY":case "COL":case "COLGROUP":case "DD":case "DL":case "DT":case "FIELDSET":case "FORM":case "H1":case "H2":case "H3":case "H4":case "H5":case "H6":case "HR":case "IFRAME":case "LEGEND":case "OL":case "PRE":case "TABLE":case "TD":case "TH":case "TR":case "UL":a._oldDisplayMode="block";break;case "LI":a._oldDisplayMode="list-item";break;default:a._oldDisplayMode="inline"}}};Sys.UI.DomElement._getWindow=function(a){var b=a.ownerDocument||a.document||a;return b.defaultView||b.parentWindow};Sys.UI.DomElement._getCurrentStyle=function(a){if(a.nodeType===3)return null;var c=Sys.UI.DomElement._getWindow(a);if(a.documentElement)a=a.documentElement;var b=c&&a!==c&&c.getComputedStyle?c.getComputedStyle(a,null):a.currentStyle||a.style;if(!b&&Sys.Browser.agent===Sys.Browser.Safari&&a.style){var g=a.style.display,f=a.style.position;a.style.position="absolute";a.style.display="block";var e=c.getComputedStyle(a,null);a.style.display=g;a.style.position=f;b={};for(var d in e)b[d]=e[d];b.display="none"}return b};Sys.IContainer=function(){};Sys.IContainer.prototype={};Sys.IContainer.registerInterface("Sys.IContainer");Sys._ScriptLoader=function(){this._scriptsToLoad=null;this._sessions=[];this._scriptLoadedDelegate=Function.createDelegate(this,this._scriptLoadedHandler)};Sys._ScriptLoader.prototype={dispose:function(){this._stopSession();this._loading=false;if(this._events)delete this._events;this._sessions=null;this._currentSession=null;this._scriptLoadedDelegate=null},loadScripts:function(d,b,c,a){var e={allScriptsLoadedCallback:b,scriptLoadFailedCallback:c,scriptLoadTimeoutCallback:a,scriptsToLoad:this._scriptsToLoad,scriptTimeout:d};this._scriptsToLoad=null;this._sessions[this._sessions.length]=e;if(!this._loading)this._nextSession()},notifyScriptLoaded:function(){if(!this._loading)return;this._currentTask._notified++;if(Sys.Browser.agent===Sys.Browser.Safari)if(this._currentTask._notified===1)window.setTimeout(Function.createDelegate(this,function(){this._scriptLoadedHandler(this._currentTask.get_scriptElement(),true)}),0)}
26,queueCustomScriptTag:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,a)},queueScriptBlock:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{text:a})},queueScriptReference:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{src:a})},_createScriptElement:function(c){var a=document.createElement("script");a.type="text/javascript";for(var b in c)a[b]=c[b];return a},_loadScriptsInternal:function(){var b=this._currentSession;if(b.scriptsToLoad&&b.scriptsToLoad.length>0){var c=Array.dequeue(b.scriptsToLoad),a=this._createScriptElement(c);if(a.text&&Sys.Browser.agent===Sys.Browser.Safari){a.innerHTML=a.text;delete a.text}if(typeof c.src==="string"){this._currentTask=new Sys._ScriptLoaderTask(a,this._scriptLoadedDelegate);this._currentTask.execute()}else{document.getElementsByTagName("head")[0].appendChild(a);Sys._ScriptLoader._clearScript(a);this._loadScriptsInternal()}}else{this._stopSession();var d=b.allScriptsLoadedCallback;if(d)d(this);this._nextSession()}},_nextSession:function(){if(this._sessions.length===0){this._loading=false;this._currentSession=null;return}this._loading=true;var a=Array.dequeue(this._sessions);this._currentSession=a;if(a.scriptTimeout>0)this._timeoutCookie=window.setTimeout(Function.createDelegate(this,this._scriptLoadTimeoutHandler),a.scriptTimeout*1000);this._loadScriptsInternal()},_raiseError:function(a){var c=this._currentSession.scriptLoadFailedCallback,b=this._currentTask.get_scriptElement();this._stopSession();if(c){c(this,b,a);this._nextSession()}else{this._loading=false;throw Sys._ScriptLoader._errorScriptLoadFailed(b.src,a)}},_scriptLoadedHandler:function(a,b){if(b&&this._currentTask._notified)if(this._currentTask._notified>1)this._raiseError(true);else{Array.add(Sys._ScriptLoader._getLoadedScripts(),a.src);this._currentTask.dispose();this._currentTask=null;this._loadScriptsInternal()}else this._raiseError(false)},_scriptLoadTimeoutHandler:function(){var a=this._currentSession.scriptLoadTimeoutCallback;this._stopSession();if(a)a(this);this._nextSession()},_stopSession:function(){if(this._timeoutCookie){window.clearTimeout(this._timeoutCookie);this._timeoutCookie=null}if(this._currentTask){this._currentTask.dispose();this._currentTask=null}}};Sys._ScriptLoader.registerClass("Sys._ScriptLoader",null,Sys.IDisposable);Sys._ScriptLoader.getInstance=function(){var a=Sys._ScriptLoader._activeInstance;if(!a)a=Sys._ScriptLoader._activeInstance=new Sys._ScriptLoader;return a};Sys._ScriptLoader.isScriptLoaded=function(b){var a=document.createElement("script");a.src=b;return Array.contains(Sys._ScriptLoader._getLoadedScripts(),a.src)};Sys._ScriptLoader.readLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){var b=Sys._ScriptLoader._referencedScripts=[],c=document.getElementsByTagName("script");for(i=c.length-1;i>=0;i--){var d=c[i],a=d.src;if(a.length)if(!Array.contains(b,a))Array.add(b,a)}}};Sys._ScriptLoader._clearScript=function(a){if(!Sys.Debug.isDebug)a.parentNode.removeChild(a)};Sys._ScriptLoader._errorScriptLoadFailed=function(b,d){var a;if(d)a=Sys.Res.scriptLoadMultipleCallbacks;else a=Sys.Res.scriptLoadFailed;var e="Sys.ScriptLoadFailedException: "+String.format(a,b),c=Error.create(e,{name:"Sys.ScriptLoadFailedException","scriptUrl":b});c.popStackFrame();return c};Sys._ScriptLoader._getLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){Sys._ScriptLoader._referencedScripts=[];Sys._ScriptLoader.readLoadedScripts()}return Sys._ScriptLoader._referencedScripts};Sys._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a;this._notified=0};Sys._ScriptLoaderTask.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){if(this._disposed)return;this._disposed=true;this._removeScriptElementHandlers();Sys._ScriptLoader._clearScript(this._scriptElement);this._scriptElement=null},execute:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_addScriptElementHandlers:function(){this._scriptLoadDelegate=Function.createDelegate(this,this._scriptLoadHandler);if(Sys.Browser.agent!==Sys.Browser.InternetExplorer){this._scriptElement.readyState="loaded";$addHandler(this._scriptElement,"load",this._scriptLoadDelegate)}else $addHandler(this._scriptElement,"readystatechange",this._scriptLoadDelegate);if(this._scriptElement.addEventListener){this._scriptErrorDelegate=Function.createDelegate(this,this._scriptErrorHandler);this._scriptElement.addEventListener("error",this._scriptErrorDelegate,false)}},_removeScriptElementHandlers:function(){if(this._scriptLoadDelegate){var a=this.get_scriptElement();if(Sys.Browser.agent!==Sys.Browser.InternetExplorer)$removeHandler(a,"load",this._scriptLoadDelegate);else $removeHandler(a,"readystatechange",this._scriptLoadDelegate);if(this._scriptErrorDelegate){this._scriptElement.removeEventListener("error",this._scriptErrorDelegate,false);this._scriptErrorDelegate=null}this._scriptLoadDelegate=null}},_scriptErrorHandler:function(){if(this._disposed)return;this._completedCallback(this.get_scriptElement(),false)},_scriptLoadHandler:function(){if(this._disposed)return;var a=this.get_scriptElement();if(a.readyState!=="loaded"&&a.readyState!=="complete")return;var b=this;window.setTimeout(function(){b._completedCallback(a,true)},0)}};Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask",null,Sys.IDisposable);Sys.ApplicationLoadEventArgs=function(b,a){Sys.ApplicationLoadEventArgs.initializeBase(this);this._components=b;this._isPartialLoad=a};Sys.ApplicationLoadEventArgs.prototype={get_components:function(){return this._components},get_isPartialLoad:function(){return this._isPartialLoad}};Sys.ApplicationLoadEventArgs.registerClass("Sys.ApplicationLoadEventArgs",Sys.EventArgs);Sys.HistoryEventArgs=function(a){Sys.HistoryEventArgs.initializeBase(this);this._state=a};Sys.HistoryEventArgs.prototype={get_state:function(){return this._state}};Sys.HistoryEventArgs.registerClass("Sys.HistoryEventArgs",Sys.EventArgs);Sys._Application=function(){Sys._Application.initializeBase(this);this._disposableObjects=[];this._components={};this._createdComponents=[];this._secondPassComponents=[];this._appLoadHandler=null;this._beginRequestHandler=null;this._clientId=null;this._currentEntry="";this._endRequestHandler=null;this._history=null;this._enableHistory=false;this._historyFrame=null;this._historyInitialized=false;this._historyInitialLength=0;this._historyLength=0;this._historyPointIsNew=false;this._ignoreTimer=false;this._initialState=null;this._state={};this._timerCookie=0;this._timerHandler=null;this._uniqueId=null;this._unloadHandlerDelegate=Function.createDelegate(this,this._unloadHandler);this._loadHandlerDelegate=Function.createDelegate(this,this._loadHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._unloadHandlerDelegate);Sys.UI.DomEvent.addHandler(window,"load",this._loadHandlerDelegate)};Sys._Application.prototype={_creatingComponents:false,_disposing:false,get_isCreatingComponents:function(){return this._creatingComponents},get_stateString:function(){var a=window.location.hash;if(this._isSafari2()){var b=this._getHistory();if(b)a=b[window.history.length-this._historyInitialLength]}if(a.length>0&&a.charAt(0)==="#")a=a.substring(1);if(Sys.Browser.agent===Sys.Browser.Firefox)a=this._serializeState(this._deserializeState(a,true));return a},get_enableHistory:function(){return this._enableHistory},set_enableHistory:function(a){this._enableHistory=a}
26,add_init:function(a){if(this._initialized)a(this,Sys.EventArgs.Empty);else this.get_events().addHandler("init",a)},remove_init:function(a){this.get_events().removeHandler("init",a)},add_load:function(a){this.get_events().addHandler("load",a)},remove_load:function(a){this.get_events().removeHandler("load",a)},add_navigate:function(a){this.get_events().addHandler("navigate",a)},remove_navigate:function(a){this.get_events().removeHandler("navigate",a)},add_unload:function(a){this.get_events().addHandler("unload",a)},remove_unload:function(a){this.get_events().removeHandler("unload",a)},addComponent:function(a){this._components[a.get_id()]=a},addHistoryPoint:function(c,f){this._ensureHistory();var b=this._state;for(var a in c){var d=c[a];if(d===null){if(typeof b[a]!=="undefined")delete b[a]}else b[a]=d}var e=this._serializeState(b);this._historyPointIsNew=true;this._setState(e,f);this._raiseNavigate()},beginCreateComponents:function(){this._creatingComponents=true},dispose:function(){if(!this._disposing){this._disposing=true;if(this._timerCookie){window.clearTimeout(this._timerCookie);delete this._timerCookie}if(this._endRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);delete this._endRequestHandler}if(this._beginRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);delete this._beginRequestHandler}if(window.pageUnload)window.pageUnload(this,Sys.EventArgs.Empty);var c=this.get_events().getHandler("unload");if(c)c(this,Sys.EventArgs.Empty);var b=Array.clone(this._disposableObjects);for(var a=0,e=b.length;a<e;a++)b[a].dispose();Array.clear(this._disposableObjects);Sys.UI.DomEvent.removeHandler(window,"unload",this._unloadHandlerDelegate);if(this._loadHandlerDelegate){Sys.UI.DomEvent.removeHandler(window,"load",this._loadHandlerDelegate);this._loadHandlerDelegate=null}var d=Sys._ScriptLoader.getInstance();if(d)d.dispose();Sys._Application.callBaseMethod(this,"dispose")}},endCreateComponents:function(){var b=this._secondPassComponents;for(var a=0,d=b.length;a<d;a++){var c=b[a].component;Sys$Component$_setReferences(c,b[a].references);c.endUpdate()}this._secondPassComponents=[];this._creatingComponents=false},findComponent:function(b,a){return a?Sys.IContainer.isInstanceOfType(a)?a.findComponent(b):a[b]||null:Sys.Application._components[b]||null},getComponents:function(){var a=[],b=this._components;for(var c in b)a[a.length]=b[c];return a},initialize:function(){if(!this._initialized&&!this._initializing){this._initializing=true;window.setTimeout(Function.createDelegate(this,this._doInitialize),0)}},notifyScriptLoaded:function(){var a=Sys._ScriptLoader.getInstance();if(a)a.notifyScriptLoaded()},registerDisposableObject:function(a){if(!this._disposing)this._disposableObjects[this._disposableObjects.length]=a},raiseLoad:function(){var b=this.get_events().getHandler("load"),a=new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents),!this._initializing);if(b)b(this,a);if(window.pageLoad)window.pageLoad(this,a);this._createdComponents=[]},removeComponent:function(b){var a=b.get_id();if(a)delete this._components[a]},setServerId:function(a,b){this._clientId=a;this._uniqueId=b},setServerState:function(a){this._ensureHistory();this._state.__s=a;this._updateHiddenField(a)},unregisterDisposableObject:function(a){if(!this._disposing)Array.remove(this._disposableObjects,a)},_addComponentToSecondPass:function(b,a){this._secondPassComponents[this._secondPassComponents.length]={component:b,references:a}},_deserializeState:function(a,i){var e={};a=a||"";var b=a.indexOf("&&");if(b!==-1&&b+2<a.length){e.__s=a.substr(b+2);a=a.substr(0,b)}var g=a.split("&");for(var f=0,k=g.length;f<k;f++){var d=g[f],c=d.indexOf("=");if(c!==-1&&c+1<d.length){var j=d.substr(0,c),h=d.substr(c+1);e[j]=i?h:decodeURIComponent(h)}}return e},_doInitialize:function(){Sys._Application.callBaseMethod(this,"initialize");var b=this.get_events().getHandler("init");if(b){this.beginCreateComponents();b(this,Sys.EventArgs.Empty);this.endCreateComponents()}if(Sys.WebForms){this._beginRequestHandler=Function.createDelegate(this,this._onPageRequestManagerBeginRequest);Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);this._endRequestHandler=Function.createDelegate(this,this._onPageRequestManagerEndRequest);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler)}var a=this.get_stateString();if(a!==this._currentEntry)this._navigate(a);
26this.raiseLoad();this._initializing=false},_enableHistoryInScriptManager:function(){this._enableHistory=true},_ensureHistory:function(){if(!this._historyInitialized&&this._enableHistory){if(Sys.Browser.agent===Sys.Browser.InternetExplorer&&Sys.Browser.documentMode<8){this._historyFrame=document.getElementById("__historyFrame");this._ignoreIFrame=true}if(this._isSafari2()){var a=document.getElementById("__history");this._setHistory([window.location.hash]);this._historyInitialLength=window.history.length}this._timerHandler=Function.createDelegate(this,this._onIdle);this._timerCookie=window.setTimeout(this._timerHandler,100);try{this._initialState=this._deserializeState(this.get_stateString())}catch(b){}this._historyInitialized=true}},_getHistory:function(){var a=document.getElementById("__history");if(!a)return "";var b=a.value;return b?Sys.Serialization.JavaScriptSerializer.deserialize(b,true):""},_isSafari2:function(){return Sys.Browser.agent===Sys.Browser.Safari&&Sys.Browser.version<=419.3},_loadHandler:function(){if(this._loadHandlerDelegate){Sys.UI.DomEvent.removeHandler(window,"load",this._loadHandlerDelegate);this._loadHandlerDelegate=null}this.initialize()},_navigate:function(c){this._ensureHistory();var b=this._deserializeState(c);if(this._uniqueId){var d=this._state.__s||"",a=b.__s||"";if(a!==d){this._updateHiddenField(a);__doPostBack(this._uniqueId,a);this._state=b;return}}this._setState(c);this._state=b;this._raiseNavigate()},_onIdle:function(){delete this._timerCookie;var a=this.get_stateString();if(a!==this._currentEntry){if(!this._ignoreTimer){this._historyPointIsNew=false;this._navigate(a);this._historyLength=window.history.length}}else this._ignoreTimer=false;this._timerCookie=window.setTimeout(this._timerHandler,100)},_onIFrameLoad:function(a){this._ensureHistory();if(!this._ignoreIFrame){this._historyPointIsNew=false;this._navigate(a)}this._ignoreIFrame=false},_onPageRequestManagerBeginRequest:function(){this._ignoreTimer=true},_onPageRequestManagerEndRequest:function(e,d){var b=d.get_dataItems()[this._clientId],a=document.getElementById("__EVENTTARGET");if(a&&a.value===this._uniqueId)a.value="";if(typeof b!=="undefined"){this.setServerState(b);this._historyPointIsNew=true}else this._ignoreTimer=false;var c=this._serializeState(this._state);if(c!==this._currentEntry){this._ignoreTimer=true;this._setState(c);this._raiseNavigate()}},_raiseNavigate:function(){var c=this.get_events().getHandler("navigate"),b={};for(var a in this._state)if(a!=="__s")b[a]=this._state[a];var d=new Sys.HistoryEventArgs(b);if(c)c(this,d)},_serializeState:function(d){var b=[];for(var a in d){var e=d[a];if(a==="__s")var c=e;else b[b.length]=a+"="+encodeURIComponent(e)}return b.join("&")+(c?"&&"+c:"")},_setHistory:function(b){var a=document.getElementById("__history");if(a)a.value=Sys.Serialization.JavaScriptSerializer.serialize(b)},_setState:function(a,c){a=a||"";if(a!==this._currentEntry){if(window.theForm){var e=window.theForm.action,f=e.indexOf("#");window.theForm.action=(f!==-1?e.substring(0,f):e)+"#"+a}if(this._historyFrame&&this._historyPointIsNew){this._ignoreIFrame=true;this._historyPointIsNew=false;var d=this._historyFrame.contentWindow.document;d.open("javascript:'<html></html>'");d.write("<html><head><title>"+(c||document.title)+"</title><scri"+'pt type="text/javascript">parent.Sys.Application._onIFrameLoad(\''+a+"');</scri"+"pt></head><body></body></html>");d.close()}this._ignoreTimer=false;var h=this.get_stateString();this._currentEntry=a;if(a!==h){if(this._isSafari2()){var g=this._getHistory();g[window.history.length-this._historyInitialLength+1]=a;this._setHistory(g);this._historyLength=window.history.length+1;var b=document.createElement("form");b.method="get";b.action="#"+a;document.appendChild(b);b.submit();document.removeChild(b)}else window.location.hash=a;if(typeof c!=="undefined"&&c!==null)document.title=c}}},_unloadHandler:function(){this.dispose()},_updateHiddenField:function(b){if(this._clientId){var a=document.getElementById(this._clientId);if(a)a.value=b}}};Sys._Application.registerClass("Sys._Application",Sys.Component,Sys.IContainer);Sys.Application=new Sys._Application;
26var $find=Sys.Application.findComponent;Type.registerNamespace("Sys.Net");Sys.Net.WebRequestExecutor=function(){this._webRequest=null;this._resultObject=null};Sys.Net.WebRequestExecutor.prototype={get_webRequest:function(){return this._webRequest},_set_webRequest:function(a){this._webRequest=a},get_started:function(){throw Error.notImplemented()},get_responseAvailable:function(){throw Error.notImplemented()},get_timedOut:function(){throw Error.notImplemented()},get_aborted:function(){throw Error.notImplemented()},get_responseData:function(){throw Error.notImplemented()},get_statusCode:function(){throw Error.notImplemented()},get_statusText:function(){throw Error.notImplemented()},get_xml:function(){throw Error.notImplemented()},get_object:function(){if(!this._resultObject)this._resultObject=Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());return this._resultObject},executeRequest:function(){throw Error.notImplemented()},abort:function(){throw Error.notImplemented()},getResponseHeader:function(){throw Error.notImplemented()},getAllResponseHeaders:function(){throw Error.notImplemented()}};Sys.Net.WebRequestExecutor.registerClass("Sys.Net.WebRequestExecutor");Sys.Net.XMLDOM=function(d){if(!window.DOMParser){var c=["Msxml2.DOMDocument.3.0","Msxml2.DOMDocument"];for(var b=0,f=c.length;b<f;b++)try{var a=new ActiveXObject(c[b]);a.async=false;a.loadXML(d);a.setProperty("SelectionLanguage","XPath");return a}catch(g){}}else try{var e=new window.DOMParser;return e.parseFromString(d,"text/xml")}catch(g){}return null};Sys.Net.XMLHttpExecutor=function(){Sys.Net.XMLHttpExecutor.initializeBase(this);var a=this;this._xmlHttpRequest=null;this._webRequest=null;this._responseAvailable=false;this._timedOut=false;this._timer=null;this._aborted=false;this._started=false;this._onReadyStateChange=function(){if(a._xmlHttpRequest.readyState===4){try{if(typeof a._xmlHttpRequest.status==="undefined")return}catch(b){return}a._clearTimer();a._responseAvailable=true;try{a._webRequest.completed(Sys.EventArgs.Empty)}finally{if(a._xmlHttpRequest!=null){a._xmlHttpRequest.onreadystatechange=Function.emptyMethod;a._xmlHttpRequest=null}}}};this._clearTimer=function(){if(a._timer!=null){window.clearTimeout(a._timer);a._timer=null}};this._onTimeout=function(){if(!a._responseAvailable){a._clearTimer();a._timedOut=true;a._xmlHttpRequest.onreadystatechange=Function.emptyMethod;a._xmlHttpRequest.abort();a._webRequest.completed(Sys.EventArgs.Empty);a._xmlHttpRequest=null}}};Sys.Net.XMLHttpExecutor.prototype={get_timedOut:function(){return this._timedOut},get_started:function(){return this._started},get_responseAvailable:function(){return this._responseAvailable},get_aborted:function(){return this._aborted},executeRequest:function(){this._webRequest=this.get_webRequest();var c=this._webRequest.get_body(),a=this._webRequest.get_headers();this._xmlHttpRequest=new XMLHttpRequest;this._xmlHttpRequest.onreadystatechange=this._onReadyStateChange;var e=this._webRequest.get_httpVerb();this._xmlHttpRequest.open(e,this._webRequest.getResolvedUrl(),true);if(a)for(var b in a){var f=a[b];if(typeof f!=="function")this._xmlHttpRequest.setRequestHeader(b,f)}if(e.toLowerCase()==="post"){if(a===null||!a["Content-Type"])this._xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");if(!c)c=""}var d=this._webRequest.get_timeout();if(d>0)this._timer=window.setTimeout(Function.createDelegate(this,this._onTimeout),d);this._xmlHttpRequest.send(c);this._started=true},getResponseHeader:function(b){var a;try{a=this._xmlHttpRequest.getResponseHeader(b)}catch(c){}if(!a)a="";return a},getAllResponseHeaders:function(){return this._xmlHttpRequest.getAllResponseHeaders()},get_responseData:function(){return this._xmlHttpRequest.responseText},get_statusCode:function(){var a=0;try{a=this._xmlHttpRequest.status}catch(b){}return a},get_statusText:function(){return this._xmlHttpRequest.statusText},get_xml:function(){var a=this._xmlHttpRequest.responseXML;if(!a||!a.documentElement){a=Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);if(!a||!a.documentElement)return null}else if(navigator.userAgent.indexOf("MSIE")!==-1)a.setProperty("SelectionLanguage","XPath");if(a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml"&&a.documentElement.tagName==="parsererror")return null;if(a.documentElement.firstChild&&a.documentElement.firstChild.tagName==="parsererror")return null;return a},abort:function(){if(this._aborted||this._responseAvailable||this._timedOut)return;this._aborted=true;this._clearTimer();if(this._xmlHttpRequest&&!this._responseAvailable){this._xmlHttpRequest.onreadystatechange=Function.emptyMethod;this._xmlHttpRequest.abort();this._xmlHttpRequest=null;this._webRequest.completed(Sys.EventArgs.Empty)}}};Sys.Net.XMLHttpExecutor.registerClass("Sys.Net.XMLHttpExecutor",Sys.Net.WebRequestExecutor);Sys.Net._WebRequestManager=function(){this._defaultTimeout=0;this._defaultExecutorType="Sys.Net.XMLHttpExecutor"};Sys.Net._WebRequestManager.prototype={add_invokingRequest:function(a){this._get_eventHandlerList().addHandler("invokingRequest",a)},remove_invokingRequest:function(a){this._get_eventHandlerList().removeHandler("invokingRequest",a)},add_completedRequest:function(a){this._get_eventHandlerList().addHandler("completedRequest",a)},remove_completedRequest:function(a){this._get_eventHandlerList().removeHandler("completedRequest",a)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_defaultTimeout:function(){return this._defaultTimeout},set_defaultTimeout:function(a){this._defaultTimeout=a},get_defaultExecutorType:function(){return this._defaultExecutorType},set_defaultExecutorType:function(a){this._defaultExecutorType=a},executeRequest:function(webRequest){var executor=webRequest.get_executor();if(!executor){var failed=false;try{var executorType=eval(this._defaultExecutorType);executor=new executorType}catch(a){failed=true}webRequest.set_executor(executor)}if(executor.get_aborted())return;var evArgs=new Sys.Net.NetworkRequestEventArgs(webRequest),handler=this._get_eventHandlerList().getHandler("invokingRequest");
26if(handler)handler(this,evArgs);if(!evArgs.get_cancel())executor.executeRequest()}};Sys.Net._WebRequestManager.registerClass("Sys.Net._WebRequestManager");Sys.Net.WebRequestManager=new Sys.Net._WebRequestManager;Sys.Net.NetworkRequestEventArgs=function(a){Sys.Net.NetworkRequestEventArgs.initializeBase(this);this._webRequest=a};Sys.Net.NetworkRequestEventArgs.prototype={get_webRequest:function(){return this._webRequest}};Sys.Net.NetworkRequestEventArgs.registerClass("Sys.Net.NetworkRequestEventArgs",Sys.CancelEventArgs);Sys.Net.WebRequest=function(){this._url="";this._headers={};this._body=null;this._userContext=null;this._httpVerb=null;this._executor=null;this._invokeCalled=false;this._timeout=0};Sys.Net.WebRequest.prototype={add_completed:function(a){this._get_eventHandlerList().addHandler("completed",a)},remove_completed:function(a){this._get_eventHandlerList().removeHandler("completed",a)},completed:function(b){var a=Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");if(a)a(this._executor,b);a=this._get_eventHandlerList().getHandler("completed");if(a)a(this._executor,b)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_url:function(){return this._url},set_url:function(a){this._url=a},get_headers:function(){return this._headers},get_httpVerb:function(){if(this._httpVerb===null){if(this._body===null)return "GET";return "POST"}return this._httpVerb},set_httpVerb:function(a){this._httpVerb=a},get_body:function(){return this._body},set_body:function(a){this._body=a},get_userContext:function(){return this._userContext},set_userContext:function(a){this._userContext=a},get_executor:function(){return this._executor},set_executor:function(a){this._executor=a;this._executor._set_webRequest(this)},get_timeout:function(){if(this._timeout===0)return Sys.Net.WebRequestManager.get_defaultTimeout();return this._timeout},set_timeout:function(a){this._timeout=a},getResolvedUrl:function(){return Sys.Net.WebRequest._resolveUrl(this._url)},invoke:function(){Sys.Net.WebRequestManager.executeRequest(this);this._invokeCalled=true}};Sys.Net.WebRequest._resolveUrl=function(b,a){if(b&&b.indexOf("://")!==-1)return b;if(!a||a.length===0){var d=document.getElementsByTagName("base")[0];if(d&&d.href&&d.href.length>0)a=d.href;else a=document.URL}var c=a.indexOf("?");if(c!==-1)a=a.substr(0,c);c=a.indexOf("#");if(c!==-1)a=a.substr(0,c);a=a.substr(0,a.lastIndexOf("/")+1);if(!b||b.length===0)return a;if(b.charAt(0)==="/"){var e=a.indexOf("://"),g=a.indexOf("/",e+3);return a.substr(0,g)+b}else{var f=a.lastIndexOf("/");return a.substr(0,f+1)+b}};Sys.Net.WebRequest._createQueryString=function(d,b){if(!b)b=encodeURIComponent;var a=new Sys.StringBuilder,f=0;for(var c in d){var e=d[c];if(typeof e==="function")continue;var g=Sys.Serialization.JavaScriptSerializer.serialize(e);if(f!==0)a.append("&");a.append(c);a.append("=");a.append(b(g));f++}return a.toString()};Sys.Net.WebRequest._createUrl=function(a,b){if(!b)return a;var d=Sys.Net.WebRequest._createQueryString(b);if(d.length>0){var c="?";if(a&&a.indexOf("?")!==-1)c="&";return a+c+d}else return a};Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout},set_timeout:function(a){if(a<0)throw Error.argumentOutOfRange("value",a,Sys.Res.invalidTimeout);this._timeout=a},get_defaultUserContext:function(){return this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed},set_defaultFailedCallback:function(a){this._failed=a},get_path:function(){return this._path},set_path:function(a){this._path=a},_invoke:function(d,e,g,f,c,b,a){if(c===null||typeof c==="undefined")c=this.get_defaultSucceededCallback();if(b===null||typeof b==="undefined")b=this.get_defaultFailedCallback();if(a===null||typeof a==="undefined")a=this.get_defaultUserContext();return Sys.Net.WebServiceProxy.invoke(d,e,g,f,c,b,a,this.get_timeout())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(k,a,j,d,i,c,f,h){var b=new Sys.Net.WebRequest;b.get_headers()["Content-Type"]="application/json; charset=utf-8";if(!d)d={};var g=d;if(!j||!g)g={};
26b.set_url(Sys.Net.WebRequest._createUrl(k+"/"+encodeURIComponent(a),g));var e=null;if(!j){e=Sys.Serialization.JavaScriptSerializer.serialize(d);if(e==="{}")e=""}b.set_body(e);b.add_completed(l);if(h&&h>0)b.set_timeout(h);b.invoke();function l(d){if(d.get_responseAvailable()){var g=d.get_statusCode(),b=null;try{var e=d.getResponseHeader("Content-Type");if(e.startsWith("application/json"))b=d.get_object();else if(e.startsWith("text/xml"))b=d.get_xml();else b=d.get_responseData()}catch(m){}var k=d.getResponseHeader("jsonerror"),h=k==="true";if(h){if(b)b=new Sys.Net.WebServiceError(false,b.Message,b.StackTrace,b.ExceptionType)}else if(e.startsWith("application/json"))b=b.d;if(g<200||g>=300||h){if(c){if(!b||!h)b=new Sys.Net.WebServiceError(false,String.format(Sys.Res.webServiceFailedNoMsg,a),"","");b._statusCode=g;c(b,f,a)}}else if(i)i(b,f,a)}else{var j;if(d.get_timedOut())j=String.format(Sys.Res.webServiceTimedOut,a);else j=String.format(Sys.Res.webServiceFailedNoMsg,a);if(c)c(new Sys.Net.WebServiceError(d.get_timedOut(),j,"",""),f,a)}}return b};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys.Net.WebServiceError=function(c,d,b,a){this._timedOut=c;this._message=d;this._stackTrace=b;this._exceptionType=a;this._statusCode=-1};Sys.Net.WebServiceError.prototype={get_timedOut:function(){return this._timedOut},get_statusCode:function(){return this._statusCode},get_message:function(){return this._message},get_stackTrace:function(){return this._stackTrace},get_exceptionType:function(){return this._exceptionType}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError");Type.registerNamespace("Sys.Services");Sys.Services._ProfileService=function(){Sys.Services._ProfileService.initializeBase(this);this.properties={}};Sys.Services._ProfileService.DefaultWebServicePath="";Sys.Services._ProfileService.prototype={_defaultLoadCompletedCallback:null,_defaultSaveCompletedCallback:null,_path:"",_timeout:0,get_defaultLoadCompletedCallback:function(){return this._defaultLoadCompletedCallback},set_defaultLoadCompletedCallback:function(a){this._defaultLoadCompletedCallback=a},get_defaultSaveCompletedCallback:function(){return this._defaultSaveCompletedCallback},set_defaultSaveCompletedCallback:function(a){this._defaultSaveCompletedCallback=a},get_path:function(){return this._path||""},load:function(c,d,e,f){var b,a;if(!c){a="GetAllPropertiesForCurrentUser";b={authenticatedUserOnly:false}}else{a="GetPropertiesForCurrentUser";b={properties:this._clonePropertyNames(c),authenticatedUserOnly:false}}this._invoke(this._get_path(),a,false,b,Function.createDelegate(this,this._onLoadComplete),Function.createDelegate(this,this._onLoadFailed),[d,e,f])},save:function(d,b,c,e){var a=this._flattenProperties(d,this.properties);this._invoke(this._get_path(),"SetPropertiesForCurrentUser",false,{values:a.value,authenticatedUserOnly:false},Function.createDelegate(this,this._onSaveComplete),Function.createDelegate(this,this._onSaveFailed),[b,c,e,a.count])},_clonePropertyNames:function(e){var c=[],d={};for(var b=0;b<e.length;b++){var a=e[b];if(!d[a]){Array.add(c,a);d[a]=true}}return c},_flattenProperties:function(a,i,j){var b={},e,d,g=0;if(a&&a.length===0)return {value:b,count:0};for(var c in i){e=i[c];d=j?j+"."+c:c;if(Sys.Services.ProfileGroup.isInstanceOfType(e)){var k=this._flattenProperties(a,e,d),h=k.value;g+=k.count;for(var f in h){var l=h[f];b[f]=l}}else if(!a||Array.indexOf(a,d)!==-1){b[d]=e;g++}}return {value:b,count:g}},_get_path:function(){var a=this.get_path();if(!a.length)a=Sys.Services._ProfileService.DefaultWebServicePath;if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_onLoadComplete:function(a,e,g){if(typeof a!=="object")throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,g,"Object"));var c=this._unflattenProperties(a);for(var b in c)this.properties[b]=c[b];var d=e[0]||this.get_defaultLoadCompletedCallback()||this.get_defaultSucceededCallback();if(d){var f=e[2]||this.get_defaultUserContext();d(a.length,f,"Sys.Services.ProfileService.load")}},_onLoadFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.ProfileService.load")}},_onSaveComplete:function(a,b,f){var c=b[3];if(a!==null)if(a instanceof Array)c-=a.length;else if(typeof a==="number")c=a;
26else throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Array"));var d=b[0]||this.get_defaultSaveCompletedCallback()||this.get_defaultSucceededCallback();if(d){var e=b[2]||this.get_defaultUserContext();d(c,e,"Sys.Services.ProfileService.save")}},_onSaveFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.ProfileService.save")}},_unflattenProperties:function(e){var c={},d,f,h=0;for(var a in e){h++;f=e[a];d=a.indexOf(".");if(d!==-1){var g=a.substr(0,d);a=a.substr(d+1);var b=c[g];if(!b||!Sys.Services.ProfileGroup.isInstanceOfType(b)){b=new Sys.Services.ProfileGroup;c[g]=b}b[a]=f}else c[a]=f}e.length=h;return c}};Sys.Services._ProfileService.registerClass("Sys.Services._ProfileService",Sys.Net.WebServiceProxy);Sys.Services.ProfileService=new Sys.Services._ProfileService;Sys.Services.ProfileGroup=function(a){if(a)for(var b in a)this[b]=a[b]};Sys.Services.ProfileGroup.registerClass("Sys.Services.ProfileGroup");Sys.Services._AuthenticationService=function(){Sys.Services._AuthenticationService.initializeBase(this)};Sys.Services._AuthenticationService.DefaultWebServicePath="";Sys.Services._AuthenticationService.prototype={_defaultLoginCompletedCallback:null,_defaultLogoutCompletedCallback:null,_path:"",_timeout:0,_authenticated:false,get_defaultLoginCompletedCallback:function(){return this._defaultLoginCompletedCallback},set_defaultLoginCompletedCallback:function(a){this._defaultLoginCompletedCallback=a},get_defaultLogoutCompletedCallback:function(){return this._defaultLogoutCompletedCallback},set_defaultLogoutCompletedCallback:function(a){this._defaultLogoutCompletedCallback=a},get_isLoggedIn:function(){return this._authenticated},get_path:function(){return this._path||""},login:function(c,b,a,h,f,d,e,g){this._invoke(this._get_path(),"Login",false,{userName:c,password:b,createPersistentCookie:a},Function.createDelegate(this,this._onLoginComplete),Function.createDelegate(this,this._onLoginFailed),[c,b,a,h,f,d,e,g])},logout:function(c,a,b,d){this._invoke(this._get_path(),"Logout",false,{},Function.createDelegate(this,this._onLogoutComplete),Function.createDelegate(this,this._onLogoutFailed),[c,a,b,d])},_get_path:function(){var a=this.get_path();if(!a.length)a=Sys.Services._AuthenticationService.DefaultWebServicePath;if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_onLoginComplete:function(e,c,f){if(typeof e!=="boolean")throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Boolean"));var b=c[4],d=c[7]||this.get_defaultUserContext(),a=c[5]||this.get_defaultLoginCompletedCallback()||this.get_defaultSucceededCallback();if(e){this._authenticated=true;if(a)a(true,d,"Sys.Services.AuthenticationService.login");if(typeof b!=="undefined"&&b!==null)window.location.href=b}else if(a)a(false,d,"Sys.Services.AuthenticationService.login")},_onLoginFailed:function(d,b){var a=b[6]||this.get_defaultFailedCallback();if(a){var c=b[7]||this.get_defaultUserContext();a(d,c,"Sys.Services.AuthenticationService.login")}},_onLogoutComplete:function(f,a,e){if(f!==null)throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,e,"null"));var b=a[0],d=a[3]||this.get_defaultUserContext(),c=a[1]||this.get_defaultLogoutCompletedCallback()||this.get_defaultSucceededCallback();this._authenticated=false;if(c)c(null,d,"Sys.Services.AuthenticationService.logout");if(!b)window.location.reload();else window.location.href=b},_onLogoutFailed:function(c,b){var a=b[2]||this.get_defaultFailedCallback();if(a)a(c,b[3],"Sys.Services.AuthenticationService.logout")},_setAuthenticated:function(a){this._authenticated=a}};Sys.Services._AuthenticationService.registerClass("Sys.Services._AuthenticationService",Sys.Net.WebServiceProxy);Sys.Services.AuthenticationService=new Sys.Services._AuthenticationService;Sys.Services._RoleService=function(){Sys.Services._RoleService.initializeBase(this);this._roles=[]};Sys.Services._RoleService.DefaultWebServicePath="";Sys.Services._RoleService.prototype={_defaultLoadCompletedCallback:null,_rolesIndex:null,_timeout:0,_path:"",get_defaultLoadCompletedCallback:function(){return this._defaultLoadCompletedCallback},set_defaultLoadCompletedCallback:function(a){this._defaultLoadCompletedCallback=a},get_path:function(){return this._path||""},get_roles:function(){return Array.clone(this._roles)},isUserInRole:function(a){var b=this._get_rolesIndex()[a.trim().toLowerCase()];return !!b},load:function(a,b,c){Sys.Net.WebServiceProxy.invoke(this._get_path(),"GetRolesForCurrentUser",false,{},Function.createDelegate(this,this._onLoadComplete),Function.createDelegate(this,this._onLoadFailed),[a,b,c],this.get_timeout())},_get_path:function(){var a=this.get_path();if(!a||!a.length)a=Sys.Services._RoleService.DefaultWebServicePath;
26if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_get_rolesIndex:function(){if(!this._rolesIndex){var b={};for(var a=0;a<this._roles.length;a++)b[this._roles[a].toLowerCase()]=true;this._rolesIndex=b}return this._rolesIndex},_onLoadComplete:function(a,c,f){if(a&&!(a instanceof Array))throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Array"));this._roles=a;this._rolesIndex=null;var b=c[0]||this.get_defaultLoadCompletedCallback()||this.get_defaultSucceededCallback();if(b){var e=c[2]||this.get_defaultUserContext(),d=Array.clone(a);b(d,e,"Sys.Services.RoleService.load")}},_onLoadFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.RoleService.load")}}};Sys.Services._RoleService.registerClass("Sys.Services._RoleService",Sys.Net.WebServiceProxy);Sys.Services.RoleService=new Sys.Services._RoleService;Type.registerNamespace("Sys.Serialization");Sys.Serialization.JavaScriptSerializer=function(){};Sys.Serialization.JavaScriptSerializer.registerClass("Sys.Serialization.JavaScriptSerializer");Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs=[];Sys.Serialization.JavaScriptSerializer._charsToEscape=[];Sys.Serialization.JavaScriptSerializer._dateRegEx=new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"',"g");Sys.Serialization.JavaScriptSerializer._escapeChars={};Sys.Serialization.JavaScriptSerializer._escapeRegEx=new RegExp('["\\\\\\x00-\\x1F]',"i");Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal=new RegExp('["\\\\\\x00-\\x1F]',"g");Sys.Serialization.JavaScriptSerializer._jsonRegEx=new RegExp("[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]","g");Sys.Serialization.JavaScriptSerializer._jsonStringRegEx=new RegExp('"(\\\\.|[^"\\\\])*"',"g");Sys.Serialization.JavaScriptSerializer._serverTypeFieldName="__type";Sys.Serialization.JavaScriptSerializer._init=function(){var c=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f"];Sys.Serialization.JavaScriptSerializer._charsToEscape[0]="\\";Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs["\\"]=new RegExp("\\\\","g");Sys.Serialization.JavaScriptSerializer._escapeChars["\\"]="\\\\";Sys.Serialization.JavaScriptSerializer._charsToEscape[1]='"';Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"']=new RegExp('"',"g");Sys.Serialization.JavaScriptSerializer._escapeChars['"']='\\"';for(var a=0;a<32;a++){var b=String.fromCharCode(a);Sys.Serialization.JavaScriptSerializer._charsToEscape[a+2]=b;Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b]=new RegExp(b,"g");Sys.Serialization.JavaScriptSerializer._escapeChars[b]=c[a]}};Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder=function(b,a){a.append(b.toString())};Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder=function(a,b){if(isFinite(a))b.append(String(a));else throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers)};Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder=function(a,c){c.append('"');if(Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(a)){if(Sys.Serialization.JavaScriptSerializer._charsToEscape.length===0)Sys.Serialization.JavaScriptSerializer._init();if(a.length<128)a=a.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,function(a){return Sys.Serialization.JavaScriptSerializer._escapeChars[a]});else for(var d=0;d<34;d++){var b=Sys.Serialization.JavaScriptSerializer._charsToEscape[d];if(a.indexOf(b)!==-1)if(Sys.Browser.agent===Sys.Browser.Opera||Sys.Browser.agent===Sys.Browser.FireFox)a=a.split(b).join(Sys.Serialization.JavaScriptSerializer._escapeChars[b]);else a=a.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b],Sys.Serialization.JavaScriptSerializer._escapeChars[b])}}c.append(a);c.append('"')};Sys.Serialization.JavaScriptSerializer._serializeWithBuilder=function(b,a,i,g){var c;switch(typeof b){case "object":if(b)if(Number.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b,a);else if(Boolean.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b,a);else if(String.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b,a);else if(Array.isInstanceOfType(b)){a.append("[");for(c=0;c<b.length;++c){if(c>0)a.append(",");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b[c],a,false,g)}a.append("]")}else{if(Date.isInstanceOfType(b)){a.append('"\\/Date(');a.append(b.getTime());a.append(')\\/"');break}var d=[],f=0;for(var e in b){if(e.startsWith("$"))continue;if(e===Sys.Serialization.JavaScriptSerializer._serverTypeFieldName&&f!==0){d[f++]=d[0];d[0]=e}else d[f++]=e}if(i)d.sort();a.append("{");var j=false;for(c=0;c<f;c++){var h=b[d[c]];if(typeof h!=="undefined"&&typeof h!=="function"){if(j)a.append(",");else j=true;Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(d[c],a,i,g);a.append(":");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(h,a,i,g)}}a.append("}")}else a.append("null");break;case "number":Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b,a);break;case "string":Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b,a);break;case "boolean":Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b,a);break;default:a.append("null")}};Sys.Serialization.JavaScriptSerializer.serialize=function(b){var a=new Sys.StringBuilder;Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b,a,false);return a.toString()};Sys.Serialization.JavaScriptSerializer.deserialize=function(data,secure){if(data.length===0)throw Error.argument("data",Sys.Res.cannotDeserializeEmptyString);try{var exp=data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx,"$1new Date($2)");if(secure&&Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx,"")))throw null;return eval("("+exp+")")}catch(a){throw Error.argument("data",Sys.Res.cannotDeserializeInvalidJson)}};Sys.CultureInfo=function(c,b,a){this.name=c;this.numberFormat=b;this.dateTimeFormat=a};Sys.CultureInfo.prototype={_getDateTimeFormats:function(){if(!this._dateTimeFormats){var a=this.dateTimeFormat;this._dateTimeFormats=[a.MonthDayPattern,a.YearMonthPattern,a.ShortDatePattern,a.ShortTimePattern,a.LongDatePattern,a.LongTimePattern,a.FullDateTimePattern,a.RFC1123Pattern,a.SortableDateTimePattern,a.UniversalSortableDateTimePattern]}return this._dateTimeFormats}
26,_getMonthIndex:function(a){if(!this._upperMonths)this._upperMonths=this._toUpperArray(this.dateTimeFormat.MonthNames);return Array.indexOf(this._upperMonths,this._toUpper(a))},_getAbbrMonthIndex:function(a){if(!this._upperAbbrMonths)this._upperAbbrMonths=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);return Array.indexOf(this._upperAbbrMonths,this._toUpper(a))},_getDayIndex:function(a){if(!this._upperDays)this._upperDays=this._toUpperArray(this.dateTimeFormat.DayNames);return Array.indexOf(this._upperDays,this._toUpper(a))},_getAbbrDayIndex:function(a){if(!this._upperAbbrDays)this._upperAbbrDays=this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);return Array.indexOf(this._upperAbbrDays,this._toUpper(a))},_toUpperArray:function(c){var b=[];for(var a=0,d=c.length;a<d;a++)b[a]=this._toUpper(c[a]);return b},_toUpper:function(a){return a.split("\u00a0").join(" ").toUpperCase()}};Sys.CultureInfo._parse=function(b){var a=Sys.Serialization.JavaScriptSerializer.deserialize(b);return new Sys.CultureInfo(a.name,a.numberFormat,a.dateTimeFormat)};Sys.CultureInfo.registerClass("Sys.CultureInfo");Sys.CultureInfo.InvariantCulture=Sys.CultureInfo._parse('{"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00a4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]}}');if(typeof __cultureInfo==="undefined")var __cultureInfo='{"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
26ay","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]}}';Sys.CultureInfo.CurrentCulture=Sys.CultureInfo._parse(__cultureInfo);delete __cultureInfo;Sys.UI.Behavior=function(b){Sys.UI.Behavior.initializeBase(this);this._element=b;var a=b._behaviors;if(!a)b._behaviors=[this];else a[a.length]=this};Sys.UI.Behavior.prototype={_name:null,get_element:function(){return this._element},get_id:function(){var a=Sys.UI.Behavior.callBaseMethod(this,"get_id");if(a)return a;if(!this._element||!this._element.id)return "";return this._element.id+"$"+this.get_name()},get_name:function(){if(this._name)return this._name;var a=Object.getTypeName(this),b=a.lastIndexOf(".");if(b!=-1)a=a.substr(b+1);if(!this.get_isInitialized())this._name=a;return a},set_name:function(a){this._name=a},initialize:function(){Sys.UI.Behavior.callBaseMethod(this,"initialize");var a=this.get_name();if(a)this._element[a]=this},dispose:function(){Sys.UI.Behavior.callBaseMethod(this,"dispose");if(this._element){var a=this.get_name();if(a)this._element[a]=null;Array.remove(this._element._behaviors,this);delete this._element}}};Sys.UI.Behavior.registerClass("Sys.UI.Behavior",Sys.Component);Sys.UI.Behavior.getBehaviorByName=function(b,c){var a=b[c];return a&&Sys.UI.Behavior.isInstanceOfType(a)?a:null};Sys.UI.Behavior.getBehaviors=function(a){if(!a._behaviors)return [];return Array.clone(a._behaviors)};Sys.UI.Behavior.getBehaviorsByType=function(d,e){var a=d._behaviors,c=[];if(a)for(var b=0,f=a.length;b<f;b++)if(e.isInstanceOfType(a[b]))c[c.length]=a[b];return c};Sys.UI.VisibilityMode=function(){throw Error.notImplemented()};Sys.UI.VisibilityMode.prototype={hide:0,collapse:1};Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");Sys.UI.Control=function(a){Sys.UI.Control.initializeBase(this);this._element=a;a.control=this};Sys.UI.Control.prototype={_parent:null,_visibilityMode:Sys.UI.VisibilityMode.hide,get_element:function(){return this._element},get_id:function(){if(!this._element)return "";return this._element.id},set_id:function(){throw Error.invalidOperation(Sys.Res.cantSetId)},get_parent:function(){if(this._parent)return this._parent;if(!this._element)return null;var a=this._element.parentNode;while(a){if(a.control)return a.control;a=a.parentNode}return null},set_parent:function(a){this._parent=a},get_visibilityMode:function(){return Sys.UI.DomElement.getVisibilityMode(this._element)},set_visibilityMode:function(a){Sys.UI.DomElement.setVisibilityMode(this._element,a)},get_visible:function(){return Sys.UI.DomElement.getVisible(this._element)},set_visible:function(a){Sys.UI.DomElement.setVisible(this._element,a)},addCssClass:function(a){Sys.UI.DomElement.addCssClass(this._element,a)},dispose:function(){Sys.UI.Control.callBaseMethod(this,"dispose");if(this._element){this._element.control=undefined;delete this._element}if(this._parent)delete this._parent},onBubbleEvent:function(){return false},raiseBubbleEvent:function(b,c){var a=this.get_parent();while(a){if(a.onBubbleEvent(b,c))return;a=a.get_parent()}},removeCssClass:function(a){Sys.UI.DomElement.removeCssClass(this._element,a)},toggleCssClass:function(a){Sys.UI.DomElement.toggleCssClass(this._element,a)}};Sys.UI.Control.registerClass("Sys.UI.Control",Sys.Component);
27Type.registerNamespace('Sys');Sys.Res={'argumentInteger':'Value must be an integer.','scriptLoadMultipleCallbacks':'The script \'{0}\' contains multiple calls to Sys.Application.notifyScriptLoaded(). Only one is allowed.','invokeCalledTwice':'Cannot call invoke more than once.','webServiceFailed':'The server method \'{0}\' failed with the following error: {1}','webServiceInvalidJsonWrapper':'The server method \'{0}
27\' returned invalid data. The \'d\' property is missing from the JSON wrapper.','argumentType':'Object cannot be converted to the required type.','argumentNull':'Value cannot be null.','controlCantSetId':'The id property can\'t be set on a control.','formatBadFormatSpecifier':'Format specifier was invalid.','webServiceFailedNoMsg':'The server method \'{0}\' failed.','argumentDomElement':'Value must be a DOM element.','invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.','cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.','actualValue':'Actual value was {0}.','enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.','scriptLoadFailed':'The script \'{0}\' could not be loaded.','parameterCount':'Parameter count mismatch.','cannotDeserializeEmptyString':'Cannot deserialize empty string.','formatInvalidString':'Input string was not in a correct format.','invalidTimeout':'Value must be greater than or equal to zero.','cannotAbortBeforeStart':'Cannot abort when executor has not started.','argument':'Value does not fall within the expected range.','cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.','invalidHttpVerb':'httpVerb cannot be set to an empty or null string.','nullWebRequest':'Cannot call executeRequest with a null webRequest.','eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.','cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.','argumentUndefined':'Value cannot be undefined.','webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}','servicePathNotSet':'The path to the web service has not been set.','argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.','cannotCallOnceStarted':'Cannot call {0} once started.','badBaseUrl1':'Base URL does not contain ://.','badBaseUrl2':'Base URL does not contain another /.','badBaseUrl3':'Cannot find last / in base URL.','setExecutorAfterActive':'Cannot set executor after it has become active.','paramName':'Parameter name: {0}','cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.','cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.','format':'One of the identified items was in an invalid format.','assertFailedCaller':'Assertion Failed: {0}\r\nat {1}','argumentOutOfRange':'Specified argument was out of the range of valid values.','webServiceTimedOut':'The server method \'{0}\' timed out.','notImplemented':'The method or operation is not implemented.','assertFailed':'Assertion Failed: {0}','invalidOperation':'Operation is not valid due to the current state of the object.','breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'};
28if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
29;
30//----------------------------------------------------------
31// Copyright (C) Microsoft Corporation. All rights reserved.
32//----------------------------------------------------------
33// MicrosoftMvcAjax.js
34
35Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};}
36Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2}
37Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;}
38Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}}
39Sys.Mvc.AsyncHyperlink=function(){}
40Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);}
41Sys.Mvc.MvcHelpers=function(){}
42Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;
42if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;}
43Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();}
44Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}
44if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){
45Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}}
46Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}}
47Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}}
48Sys.Mvc.AsyncForm=function(){}
49Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;}
50Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=form.validationCallbacks;if($0){for(var $2=0;$2<$0.length;$2++){var $3=$0[$2];if(!$3()){return;}}}var $1=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$1,form,ajaxOptions);}
51Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm');
52// ---- Do not remove this footer ----
53// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net)
54// -----------------------------------
55;
56/*
57JQuery plug-in to handle modals on MVC modules.
58It assumes existing markup as defined on MvcAdmin.Master or MvcFront.Master (It could be used custom in own view if needed nested modals).
59*/
60
61$(function () {
62	(function ($) {
63		$.fn.cpModal = function (opt) {
64			//Here extends more options when needed modal with new behaviors LC.
65			var defaults = {
66				title: 'CP modal', 	// [html content] modal title's
67				url: '', 			// [string] URL to be loaded on modal
68				type: 'GET', 		// [string] type used for request (only in Ajax call. 'GET' or 'POST').
69				contentType: 'application/x-www-form-urlencoded', // [string] contentType used for request (only in Ajax call).
70				data: null, 		// [Object/string] data used for request (only in Ajax call).
71				cache: false, 		// [bool] cache used for request (only in Ajax call).
72				htmlContent: '', 	// [html content] When url is empty, uses this as modal's content
73				className: '', 		// [string] CSS class for modal container
74				isFrontEnd: true, 	// [bool] Whether modal's border color will be displayed as front-end or not
75				parentWindowID: '', // [string] modal's parent window identifier (used for nested modals)
76				isNestedModal: false, // [bool] is this a nested modal
77				onClose: null, 		// [function] code to execute when close button is clicked
78				autoLoad: true, 	// [bool] load content when invoking plug-in
79				autoAdjust: false, // [bool] whether or not the modal will be auto positioned when scrolling
80				useIframe: false, 	// [bool] whether or not to use an iFrame to load content
81				iframeHeight: '', // [string] if using iframe, set specifc height for it (ex: '200px').
82				elementID: null, //If a modal needs to be created with a custom ID, not using  mvcModal as ID.
83				draggable: true, //Whether or not the modal is draggable.
84				insideEditor: false, //Whether or not the modal is opening inside editor, in case of slideshow within editor, for example.
85				showLoading: false, //Whether or not to show loading graphic while loading the modal.
86				async: false, //Whether or not to load asynchronously the html content (only if options.url is defined).
87				onLoadComplete: null,  //[function] code to execute when the modal has loaded successfully from AJAX
88				scrolling: false, // [bool] whether iframe is scrollable.
89				verticalCenter: false
90			};
91
92			var options = $.extend(defaults, opt);
93			// cache the base element
94			var base = this;
95			base.options = options;
96			// initialize (and localize) all variables
97			var $modal = '';
98			var $parentWindow = (options.parentWindowID && options.parentWindowID != '') ? $('#' + options.parentWindowID) : $(window);
99			var triggeringElement = null;
100
101			// PUBLIC FUNCTIONS
102			this.init = function () {
103				$modal = $(this);
104				$modal.attr("role", "dialog");
105				$modal.attr("aria-modal", "true");
106				$modal.attr("tabindex", "-1");
107				var titleId = (Math.random().toString(36)).slice(2);
108				$modal.attr("aria-labelledby", titleId);
109
110				// If this modal is appearing inside an iframe remove admin wrap which can cause some issues 
111				if (window.self !== window.top) {
112					$modal.attr('style', function (i, s) { return s + 'height: auto !important;' });
113				}
114
115				// Saves current jquery object reference for future references to call public methods if needed
116				if (!$modal.data('cpModal'))
117					$modal.data('cpModal', base);
118
119				// Sets modal title
120				var $modalTitle = $modal.find('.modalTitle').filter(":first");
121				$modalTitle.html(options.title);
122				$modalTitle.attr("id", titleId);
123				// Sets modal close button event.
124				if (options.onClose != null) {
125					$modal.find('.modalClose').filter(":first").attr('onclick', '').unbind('click');
126					$modal.find('.modalClose').filter(":first").bind("click", function (e) {
127						e.preventDefault();
128						options.onClose(e, base);
129						var element = document.getElementsByClassName('modalTitle')[0]
130						var events = $._data(element, "events");
131						if(events != undefined)
132							events.mouseout = undefined;
133					});
134				} else {
135					$modal.find('.modalClose').filter(":first").attr('onclick', '').unbind('click');
136					$modal.find('.modalClose').filter(":first").bind("click", function (e) {
137						e.preventDefault();
138						base.hide();
139						var element = document.getElementsByClassName('modalTitle')[0]
140						var events = $._data(element, "events");
141						if(events != undefined)
142							events.mouseout = undefined;
143						return false;
144					});
145				}
146
147				$(".modalTitle").mouseout(function () {
148					$("body").trigger($.Event("mouseup", { which: 1 }));
149				});
150
151				if ($.fn.draggable) {
152					if (!options.draggable)
153						$modal.css({ 'top': '', 'left': '' }); //reset to default position
154					if ($modal.data('draggable') && !options.draggable) {
155						$modal.draggable('destroy');
156						$modalTitle.css('cursor', 'auto');
157					}
158					if (!$modal.data('draggable') && options.draggable) {
159						$modal.draggable({
160							handle: '.modalTitleLeft',
161							iframeFix: self !== top,
162							start: function (event, ui) {
163							}
164						});
165						$modalTitle.css('cursor', 'move');
166					}
167				}
168
169				// if needed, loads modal after initialization
170				if (options.autoLoad)
171					base.load();
172			};
173
174			this.load = function () {
175				if (options.useIframe) {
176					//create iframe on the fly
177					var iframeUrl = document.createElement('a');
178					iframeUrl.href = options.url;
179					if (iframeUrl.protocol !== window.location.protocol || iframeUrl.host !== window.location.host) {
180						alert('Modal was incorrectly configured to display content.');
181						return;
182					}
183					var $iframe = $('<iframe/>', {
184						'data-src': iframeUrl.pathname + iframeUrl.search + iframeUrl.hash,
185						id: 'iframeModal',
186						name: 'iframeModal',
187						frameborder: 0
188					}).css('border', 'none');
189					if (options.iframeHeight)
190						$iframe.css('height', options.iframeHeight);
191					if (options.scrolling)
192						$iframe.css('overflow-y', 'auto');
193					else
194						$iframe.attr('scrolling', 'no');
195					$modal.find('.modalContent').filter(":first").html($iframe);
196					base.show();
197
198					if (options.onLoadComplete != null) {
199						options.onLoadComplete(base);
200					}
201				} else if (options.url && options.url != '') {
202					var ignoreEditor = options.insideEditor;
203					//load from URL
204					$.ajax({
205						url: options.url,
206						type: options.type,
207						contentType: options.contentType,
208						data: options.data,
209						async: options.async,
210						ignoreEditor: ignoreEditor,
211						cache: options.cache,
212						success: function (result) {
213							var content = parseContent(result);
214							$modal.find('.modalContent').filter(":first").html(content.body);
215							$modal.find('.modalBottom').filter(":first").html(content.footer);
216							base.show();
217
218							if (options.onLoadComplete != null) {
219								options.onLoadComplete(base);
220							}
221						},
222						error: function (xhr, textStatus, exception) {
223							alert('Error encountered while loading modal.' + "\nStatus: " + xhr.status + "\n" + "Exception: " + exception);
224							$('#ajaxErrorLog').text(xhr.responseText);
225						},
226						beforeSend: function () {
227							if (options.showLoading)
228								ajaxPostBackStart('Loading');
229						},
230						complete: function () {
231							if (options.showLoading)
232								ajaxPostBackEnd();
233						}
234					});
235				} else if (options.htmlContent && options.htmlContent != '') {
236					//Load specific content
237					var content = parseContent(options.htmlContent);
238					$modal.find('.modalContent').filter(":first").html(content.body);
239					$modal.find('.modalBottom').filter(":first").html(content.footer);
240					base.show();
241
242					if (options.onLoadComplete != null) {
243						options.onLoadComplete(base);
244					}
245				} else {
246					alert('Modal was incorrectly configured to display content.');
247				}
248			};
249
250			this.show = function () {
251				if (options.useIframe) {
252					if (isie) {
253						window.frames['iframeModal'].document.location.href = $modal.find('iframe').attr('data-src'); // This method was required tp address issue in IE 9 with moving IFrames arund and javascript errors					
254					}
255				}
256
257				if ($modal.hasClass('modalContainerCP') && options.isFrontEnd) {
258					$modal.removeClass('modalContainerCP');
259					$modal.find('.modalContent').filter(":first").removeClass('adminWrap');
260				} else if (!$modal.hasClass('modalContainerCP') && !options.isFrontEnd) {
261					$modal.addClass('modalContainerCP');
262					$modal.find('.modalContent').filter(":first").addClass('adminWrap');
263				}
264
265				if (options.useIframe && $modal.hasClass('noIframe')) {
266					$modal.removeClass('noIframe');
267				} else if (!options.useIframe && !$modal.hasClass('noIframe')) {
268					$modal.addClass('noIframe');
269				}
270
271				if (options.className && options.className != '')
272					$modal.addClass(options.className);
273
274				if (options.useIframe && window.self !== window.top) { //IFrame loaded inside IFrame
275					$modal.addClass('nestedIframe');
276				}
277
278				if (options.autoAdjust) {
279					$(window).bind("scroll." + $modal.attr('id'), function () {
280						adjustPosition();
281					});
282					adjustPosition();
283				}
284
285				if ($('.modalBackground').length == 0) {
286					//creates a modal background for the page on the fly
287					$('<div id="mvcModal_backgroundElement" class="modalBackground"></div>').prependTo('body');
288				}
289
290				$(document).on("keydown.cpModal." + $modal.attr('id'), function (e) {
291					if (e.key === "Escape") {
292						base.hide();
293						return;
294					}
295
296					if (e.key !== "Tab") {
297						return;
298					}
299
300					var $focusableElements = $modal.find('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])').filter(':visible');
301					if ($focusableElements.length === 0) {
302						e.preventDefault();
303						$modal.focus();
304						return;
305					}
306
307					var first = $focusableElements.get(0);
308					var last = $focusableElements.get($focusableElements.length - 1);
309
310					if (e.shiftKey && document.activeElement === first) {
311						e.preventDefault();
312						last.focus();
313					} else if (!e.shiftKey && document.activeElement === last) {
314						e.preventDefault();
315						first.focus();
316					}
317				});
318
319				$modal.show();
320				triggeringElement = document.activeElement;
321
322				var $initialFocusableElement = $modal.find('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
323					.filter(':visible')
324					.first();
325
326				if ($initialFocusableElement.length > 0) {
327					$initialFocusableElement.get(0).focus({ preventScroll: true });
328				} else {
329					$modal.get(0).focus({ preventScroll: true });
330				}
331				
332				if (!isie) {
333					$modal.find('iframe').attr('src', $modal.find('iframe').attr('data-src'));
334				}
335				if (!options.autoAdjust || !options.verticalCenter)
336					window.CommonPopoverInstance.resizeToWindow($modal);
337
338				$(window).unbind('resize orientationChanged', setModalHeightWidthToFull).bind('resize orientationChanged', setModalHeightWidthToFull);
339
340				setModalHeightWidthToFull($modal);
341
342				$('.modalBackground').show(); //TODO: How to handle this better for nested modals
343
344				options.verticalCenter && verticalCenter($modal);
345			};
346
347			function verticalCenter($modal) {
348				parent = window;
349				$modal.css({
350					"position": "absolute",
351					"top": ((($(parent).height() - $modal.outerHeight()) / 2) + $(parent).scrollTop() + "px"),
352					"left": ((($(parent).width() - $modal.outerWidth()) / 2) + $(parent).scrollLeft() + "px")
353				});
354			}
355
356			this.hide = function () {
357				$modal.hide();
358				$modal.removeClass(options.className);
359				$(window).unbind("scroll." + $modal.attr('id'));
360				$(window).unbind('resize orientationChanged', setModalHeightWidthToFull);
361				var $visibleModals = $('.modalContainer:visible, .modalContainerCP:visible');
362				var hasOpenNestedModals = $visibleModals.length > 0;
363				if (!options.isNestedModal || !hasOpenNestedModals)
364					$('.modalBackground').hide(); //TODO: How to handle this better for nested modals
365				$(document).off("keydown.cpModal." + $modal.attr('id'));
366				triggeringElement?.focus();
367			};
368
369			this.destroy = function () {
370				//TODO: This needs more work
371				$modal.data('cpModal').remove();
372				$(document).off("keydown.cpModal." + $modal.attr('id'));
373			};
374
375			// PRIVATE FUNCTIONS
376
377			function adjustPosition() {
378				var top = (($parentWindow.height() - $modal.outerHeight(false)) / 2) + $parentWindow.scrollTop();
379				if (top < 0) // do not tolerate negative on top position.
380					top = 0;
381				$modal.css({ "top": top + "px" });
382	            /* Not needed since left position is managed with styles and it works fine for nested modals too.
383				if (options.isNestedModal)
384				$modal.css({ "left": (($parentWindow.width() - $modal.outerWidth()) / 2) + $parentWindow.scrollLeft() + "px" });*/
385			}
386
387			/*This is used to adjust the modal when the users screen view is smaller than the modal. -Zach Terwort*/
388			var lastScroll = 0;
389			$(window).scroll(function () {
390				var top = $parentWindow.height() - $modal.outerHeight(false);
391				var scrollDirection = $parentWindow.scrollTop();
392				if (top < 0 && scrollDirection > lastScroll) {
393					top = $parentWindow.height() - $modal.height() - 20;
394					$modal.css({ "top": top + "px" });
395				}
396				else if (top < 0) {
397					top = 20;
398					$modal.css({ "top": top + "px" });
399				}
400				lastScroll = scrollDirection;
401			});
402
403			/*This is used to make sure the modal isn't off the screen, and inaccessible after the user drops the modal. -Zach Terwort */
404			$(document).mouseup(function (event) {
405				var top = $modal.position().top;
406				if (top < 0) {
407					top = 20;
408					$modal.css({ "top": top + "px" });
409				}
410			});
411
412			function parseContent(htmlContent) {
413				htmlContent = htmlContent || '';
414				var content = { body: htmlContent, footer: '' };
415				var indexFooter = htmlContent.indexOf('<modalfooter>');
416				if (indexFooter != -1) {
417					content.body = htmlContent.substr(0, indexFooter);
418					content.footer = htmlContent.substr(indexFooter).replace('<modalfooter>', '').replace('</modalfooter>', '');
419				}
420				return content;
421			}
422
423			function setModalHeightWidthToFull() {
424				var viewportHeight = $(window).height();
425				var maxHeight = viewportHeight - 140;
426				if (maxHeight <= $modal.height() && $(document.body).hasClass('wide')) {
427					$('.modalContentRight > .modalContent', $modal).css('max-height', maxHeight + 'px');
428					$modal.addClass('fullHeight');
429				}
430				else {
431					$('.modalContentRight > .modalContent', $modal).css('max-height', '');
432					$modal.removeClass('fullHeight');
433				}
434
435				if ($(document.body).hasClass('wide') && $modal.hasClass('fullWidth')) {
436					$modal.removeClass('fullWidth');
437					$modal.css('margin-top', '');
438				}
439			}
440
441			base.init();
442			return this;
443		};
444	})(jQuery);
445});
446
447//Standard function to open modals in most of the scenarios
448function openCpModal(options) {
449	//override modal options for mobile view
450	if ($('#IsMobile').val() == 'True') {
451		var mobileOptions = {
452			autoAdjust: false //do not autoadjust when is mobile view. Modal nneds to be accessed from small browser in one spot.
453		};
454		options = $.extend(mobileOptions, options);
455		if (options.className == null || options.className.indexOf('mobile') < 0)
456			options.className = options.className + ' mobile'; //if needed add mobile class to modal.
457	}
458
459	var $modal = getCommonCpModal(options.elementID);
460	if ($modal.parent() != $('body'))
461		$modal.appendTo('body'); //if needed move at the end of the body
462
463	if ($.fn.cpModal === undefined) { //Multiple versions of Jquery causing fn not to be registered.
464		$.getScript('/Assets/Scripts/Modal.js', function () { return $modal.cpModal(options); });
465	} else {
466		return $modal.cpModal(options);
467	}
468}
469
470//Standard function to close modals in most of the sceneries
471function closeCpModal() {
472	if (getCommonCpModal().data('cpModal')) {
473		return getCommonCpModal().data('cpModal').hide();
474	}
475}
476
477//Get markup modal or create one on the fly if needed
478function getCommonCpModal(elementID) {
479	//If elementID is not provided, use the default 'mvcModal' id.
480	if (elementID == null)
481		elementID = 'mvcModal';
482	//If the element already exists on the page, simply return the element to be reused.
483	if ($('#' + elementID).length > 0) {
484		return $('#' + elementID);
485	}
486	else {
487		//Create on the fly a common mvc modal markup with custom ID.
488		var $modalContainer = $('<div id="' + elementID + '" class="modalContainer modalContainerCP MVC noIframe" style="display: none;"></div>');
489		var $modalTitleLeft = $('<div class="modalTitleLeft"><h3 class="modalTitle"></h3><a class="modalClose" href="#" aria-label="Close this modal" title="Close this window">' +
490								'<svg viewBox="0 0 25 25" id="modalIconClose"><polygon style="fill:currentcolor" points="18.806,6.98 18.075,6.248 12.532,11.792 6.989,6.248 6.257,6.98 11.786,12.508 6.212,18.084 6.943,18.815 12.532,13.224 18.12,18.815 18.851,18.084 13.277,12.508"></polygon>' +
491								'</svg></a></div>');
492		var $modalContentLeft = $('<div class="modalContentLeft"><div class="modalContentRight"><div class="newCP adminWrap modalContent"></div></div></div>');
493		var $modalBottomLeft = $('<div class="modalBottomLeft"><div class="modalBottomRight"><div class="modalBottom"></div></div></div>');
494		$modalContainer.append($modalTitleLeft).append($modalContentLeft).append($modalBottomLeft);
495		$modalContainer.appendTo('body');
496		return $modalContainer;
497	}
498}
499
500function PositionVerticle($modal) {
501	$modal.css({ "top": (($(window).height() - $modal.outerHeight(false)) / 2) + $(window).scrollTop() + "px" });
502	$modal.css({ "top": ($parentWindow.height() - $modal.outerHeight(false)) / 2 + $parentWindow.scrollTop() + "px" });
503}
504
505function showModal(className) {
506	var $modal = $('.modalContainer.' + className);
507	window.onscroll = function () {
508		PositionVerticle($modal);
509	};
510	PositionVerticle($modal);
511	$modal.show();
512	$(window).unbind('resize orientationChanged', setModalHeightWidthToFull).bind('resize orientationChanged', setModalHeightWidthToFull);
513	setModalHeightWidthToFull($modal);
514	$('.modalBackground').show();
515}
516
517function hideModal(className) {
518	$('.modalContainer.' + className).hide();
519	$('.modalBackground').hide();
520}
521
522function hideModalAndReloadPage(className) {
523	hideModal(className);
524	location.reload(true);
525}
526
527/*
528JQuery plug-in to handle popovers.
529
530*/
531function CommonPopoverClass() {
532	this.popovers = [];
533	this.initialized = false;
534	this.$commonPopup = null;
535
536	this.PopoverWrap = function ($popover, options) {
537		this.ID = $popover.attr('id');
538		this.$popoverContent = $popover.children();
539		this.isVisible = false;
540		this.options = options;
541		this.onClose = null;
542	};
543}
544
545CommonPopoverClass.prototype.hideAll = function (animate) {
546	var self = this;
547	if (self.$commonPopup != null) {
548		self.$commonPopup.fadeOut(animate ? 300 : 0, function () {
549			for (var i = 0; i < self.popovers.length; i++) {
550				if (self.popovers[i].options.className && self.popovers[i].options.className != '')
551					self.$commonPopup.removeClass(self.popovers[i].options.className);
552				self.popovers[i].isVisible = false;
553			}
554		});
555	}
556};
557
558CommonPopoverClass.prototype.show = function (popoverWrap) {
559	var self = this;
560	var alreadyOpened = false; //To prevent creating animation if popover is already opened
561	for (var i = 0; i < self.popovers.length; i++) {
562		if (self.popovers[i].options.className)
563			self.$commonPopup.removeClass(self.popovers[i].options.className);
564		if (self.popovers[i].isVisible)
565			alreadyOpened = true;
566		self.popovers[i].isVisible = false;
567	}
568	self.$commonPopup.children().detach();
569	self.$commonPopup.append(popoverWrap.$popoverContent);
570
571	if (popoverWrap.options.className) {
572		self.$commonPopup.addClass(popoverWrap.options.className);
573		window.setTimeout(function () {
574			self.$commonPopup.addClass(popoverWrap.options.className);
575		}, 0);
576	}
577
578	popoverWrap.isVisible = true;
579	self.$commonPopup.fadeIn(alreadyOpened ? 0 : 300, function () {
580		//If needed call back onOpen event
581		if (popoverWrap.options.onOpen != null && typeof (popoverWrap.options.onOpen) == "function")
582			popoverWrap.options.onOpen(popoverWrap);
583	});
584};
585
586CommonPopoverClass.prototype.hide = function (popoverWrap) {
587	var self = this;
588	if (popoverWrap && popoverWrap.options) {
589		self.$commonPopup.fadeOut(300, function () {
590			if (popoverWrap.options.className)
591				self.$commonPopup.removeClass(popoverWrap.options.className);
592			popoverWrap.isVisible = false;
593		});
594	}
595};
596
597CommonPopoverClass.prototype.RegisterPopover = function ($popover, options) {
598	var self = this;
599	if ($popover.attr('id') == null || $popover.attr('id') == "") {
600		$.ajaxSetup({ async: false });
601		AJAX("/Utility/NewGuid", "post", null, function (reponse) {
602			$popover.attr('id', reponse.Guid);
603		}, false);
604		$.ajaxSetup({ async: true });
605	}
606
607	//Creates popover wrapper
608	var newPopoverWrap = new self.PopoverWrap($popover, options);
609	//remove popover if nedded
610	self.RemovePopover(newPopoverWrap);
611	//add popover to global array
612	self.popovers.push(newPopoverWrap);
613
614	//common popover initialization if needed
615	self.init();
616
617	//pop over specific initialization
618
619	// Sets popover close button event.
620	if (options.onClose != null && typeof (options.onClose) == "function") {
621		$popover.find('.cpClosePopOver').filter(":first").attr('onclick', '').unbind('click');
622		$popover.find('.cpClosePopOver').filter(":first").bind("click", function (e) {
623			options.onClose(e, newPopoverWrap);
624		});
625	} else {
626		$popover.find('.cpClosePopOver').filter(":first").attr('onclick', '').unbind('click');
627		$popover.find('.cpClosePopOver').filter(":first").bind("click", function (e) {
628			e.preventDefault();
629			self.hide(newPopoverWrap);
630		});
631	}
632
633	return newPopoverWrap;
634};
635
636CommonPopoverClass.prototype.RemovePopover = function (popoverWrap) {
637	var self = this;
638	for (var i = 0; i < self.popovers.length; i++) {
639		if (self.popovers[i].ID == popoverWrap.ID)
640			self.popovers.splice(i);
641	}
642};
643
644CommonPopoverClass.prototype.init = function () {
645	var self = this;
646	if (!self.initialized) {
647		self.$commonPopup = self.getCommonPopover();
648
649		self.$commonPopup.click(function (e) {
650			e.stopPropagation();
651		}).draggable({
652			handle: '.cpPopOverHeader'
653		});
654
655		$('html').click(function () {
656			self.hideAll(true);
657		});
658
659		self.initialized = true;
660	}
661};
662
663CommonPopoverClass.prototype.getCommonPopover = function (elementID) {
664	var commonElementID = "cpCommonPopover";
665	if (elementID == null) {
666		if ($('#cpCommonPopover').length == 1)
667			return $('#cpCommonPopover');
668		if ($('.cpPopOver.common').length == 1)
669			return $('.cpPopOver.common');
670	}
671	else
672		commonElementID = elementID;
673	//create on the fly a common popover markup.
674	//Sets initial top position based on toolbar if exists
675	var topPosition = "";
676	if ($("#divToolbars").length > 0) {
677		topPosition = " top: " + ($("#divToolbars").height() + $('div.cp-Toolbars').height() + 30) + "px;";
678	}
679
680	var $commonPopover = $("<div id=\"" + commonElementID + "\" class=\"cpPopOver common\" style=\"display: none; z-index:100; position:fixed;" + topPosition + "\"></div>");
681	return $commonPopover.appendTo('body');
682};
683
684(function ($) {
685	$.fn.cpPopover = function (opt) {
686		//Here extends more options when needed popover with new behaviors LC.
687		var defaults = {
688			url: '', 			// [string] URL to be loaded on popover
689			type: 'GET', 		// [string] type used for request (only in Ajax call. 'GET' or 'POST').
690			contentType: 'application/x-www-form-urlencoded', // [string] contentType used for request (only in Ajax call).
691			data: null, 		// [Object/string] data used for request (only in Ajax call).
692			cache: false, 		// [bool] cache used for request (only in Ajax call).
693			htmlContent: '', 	// [html content] When url is empty, uses this as popover's content
694			onClose: null, 		// [function] code to execute when close button is clicked
695			onOpen: null, 		// [function] code to execute when popover is opened
696			onInit: null, 		// [function] code to execute when popover is initialized (after loading)
697			className: '', 		// [string] CSS class for popover container
698			makeAjaxCallEverytime: false //Whether or not an ajax call is always made whenever the control is clicked. If false, uses the cached(already rendered) version.
699		};
700
701		var options = $.extend(defaults, opt);
702
703		// cache the base element
704		var base = this;
705		// initialize (and localize) all variables
706		var $handler = null;
707		var $popover = null;
708		var popoverWrapper = null;
709
710		// PUBLIC FUNCTIONS
711		this.init = function () {
712			$handler = $(this);
713			$popover = $handler.nextAll("div.cpPopOver");
714
715			// Saves current jquery object reference for future references to call public methods if needed
716			if (!$handler.data('cpPopover'))
717				$handler.data('cpPopover', base);
718
719			$handler.unbind("click.cpPopover").bind("click.cpPopover", function (e) {
720				e.preventDefault();
721				e.stopPropagation();
722				if ($popover.length == 0 || options.makeAjaxCallEverytime) {
723					//if popup has not being rendered yet, loaded it only first time
724					base.load();
725				} else {
726					//toggle display
727					base.toggle();
728				}
729			});
730
731			if ($popover.length != 0) {
732				base.initPopOver();
733			}
734		};
735
736		this.initPopOver = function () {
737			$popover = $handler.nextAll("div.cpPopOver");
738
739			//Register popover and store wrap reference
740			popoverWrapper = window.CommonPopoverInstance.RegisterPopover($popover, options);
741
742			//If needed call back onInit event
743			if (options.onInit != null && typeof (options.onInit) == "function")
744				options.onInit(popoverWrapper);
745		};
746
747		this.load = function () {
748			if (options.url && options.url != '') {
749				//load from URL
750				$.ajax({
751					url: options.url,
752					type: options.type,
753					contentType: options.contentType,
754					data: options.data,
755					async: false,
756					cache: options.cache,
757					success: function (response) {
758						if (response.ErrorMessage) {
759							alert(response.ErrorMessage);
760						}
761						else {
762							$handler.after(response);
763							base.initPopOver();
764							base.show();
765						}
766					},
767					error: function (xhr, textStatus, exception) {
768						alert('Error encountered while loading popover.' + "\nStatus: " + xhr.status + "\n" + "Exception: " + exception);
769						$('#ajaxErrorLog').text(xhr.responseText);
770					}
771				});
772			} else if (options.htmlContent && options.htmlContent != '') {
773				//Load specific content //TOOD: ????
774				$handler.after(options.htmlContent);
775				base.initPopOver();
776				base.show();
777			} else {
778				alert('Popover was incorrectly configured to display content.');
779			}
780		};
781
782		this.show = function () {
783			window.CommonPopoverInstance.show(popoverWrapper);
784		};
785
786		this.hide = function () {
787			window.CommonPopoverInstance.hide(popoverWrapper);
788		};
789
790		this.toggle = function () {
791			if (popoverWrapper.isVisible)
792				base.hide();
793			else
794				base.show();
795		};
796
797		this.destroy = function () {
798			if ($popover.length != 0) {
799				$popover.find('.cpClosePopOver').filter(":first").unbind('click');
800				$popover.unbind("click");
801				if($popover.data('draggable'))
802					$popover.draggable('destroy');
803				window.CommonPopoverInstance.RemovePopover(popoverWrapper);
804				$popover.remove();
805			}
806			$handler.unbind("click.cpPopover");
807			$handler.removeData('cpPopover');
808		};
809
810		// PRIVATE FUNCTIONS
811
812		base.init();
813		return this;
814	};
815})(jQuery);
816
817$(function () {
818	if (!window.CommonPopoverInstance) {
819		window.CommonPopoverInstance = new CommonPopoverClass();
820	}
821});
822
823CommonPopoverClass.prototype.resizeToWindow = function ($popup) {
824	var viewportHeight = $(window).height();
825	var toolbarHeight = ($('#divToolbars').height() + $('div.cp-Toolbars').height());
826	var maxHeight = viewportHeight - toolbarHeight - 205;
827	var popupHeight = $popup.height();
828	var popupOffset = $popup.offset();
829	var scrollTop = $popup.scrollTop();
830	var pageScroll = getPageScroll();
831	$popup.find('.cpTabPanel').css('max-height', maxHeight + 'px');
832	$popup.css('top', 20 + 'px'); //This always needs to have a top. So we set it here.
833};
834
835function getPageScroll() {
836	var xScroll, yScroll;
837	if (self.pageYOffset) {
838		yScroll = self.pageYOffset;
839		xScroll = self.pageXOffset;
840	} else if (document.documentElement && document.documentElement.scrollTop) {
841		yScroll = document.documentElement.scrollTop;
842		xScroll = document.documentElement.scrollLeft;
843	} else if (document.body) {// all other Explorers
844		yScroll = document.body.scrollTop;
845		xScroll = document.body.scrollLeft;
846	}
847	return new Array(xScroll, yScroll);
848}
849
850// Adapted from getPageSize() by quirksmode.com
851function getPageHeight() {
852	var windowHeight;
853	if (self.innerHeight) { // all except Explorer
854		windowHeight = self.innerHeight;
855	} else if (document.documentElement && document.documentElement.clientHeight) {
856		windowHeight = document.documentElement.clientHeight;
857	} else if (document.body) { // other Explorers
858		windowHeight = document.body.clientHeight;
859	}
860	return windowHeight;
861}
862;
863
864var isie6 = false, isie7 = false, isie6or7 = false;
865var intCountryCode =  840;
866var urlLengthLimit = false;
867
868function setEditorVariables(urlLengthLimitParameter, intCountryCodeParameter) {
869	urlLengthLimit = urlLengthLimitParameter;
870	intCountryCode = intCountryCodeParameter;
871}
872
873function setUrlLength(editor) {
874	if (urlLengthLimit) {
875		editor.get_dialogOpener()._dialogUrlLengthLimit = 1000;
876	}
877	setMenuItems(editor);
878	removeIEParagraphs(editor);
879}
880
881function setUrlLengthAndToolToggle(editor) {
882	if (!$telerik.isIE) {
883		editor.fire("PastePlainText");
884		editor.get_dialogOpener()._dialogContainers.CleanPasteTextContent.close();
885	}
886	if (urlLengthLimit) {
887		editor.get_dialogOpener()._dialogUrlLengthLimit = 1000;
888	}
889	var minToolsGroups = 2; // Number of MinimumSetOfTools tools groups.
890	
891	// Hide the MinimumSetOfTools on load.
892	var toolbar = editor.get_toolContainer(); // Get toolbar container.
893	var toolgroups = toolbar.getElementsByTagName("UL"); 
894	
895	for (var i = toolgroups.length - 1; i >= minToolsGroups; i--)
896		toolgroups[i].style.display = "none";
897	
898	if (editor.isIE) {
899		var elem = editor.get_element();
900		elem.style.height = "430px"; 
901		elem.style.minHeight = "430px";
902	}
903	
904	// Toggle Image Context Menu Items.
905	setMenuItems(editor);
906	//setContentBackgroundColor(editor);
907	removeIEParagraphs(editor);
908}
909;
910function bindImageWidgetClickHandler(widgetID) {
911	var insideContainerWidget = $('#divImageOuter' + widgetID).parents('.tabbedWidget,.widgetCarousel').length > 0;
912	if (!insideContainerWidget) {
913		//Normal image widget on page.
914		$('#divImageOuter' + widgetID).parents('div.inner.col').click(function (e) {
915			if (!liveEditHidden && typeof window.imageRepository != 'undefined' && typeof window.imageRepository.openImageUploadModal != 'undefined') {
916				var options = {
917					loadSource: window.imageRepository.loadSource.Content,
918					targetID: widgetID,
919					$target: null,
920					callback: window.imageRepository.closeImageWidgetUploadModal,
921					modalTitle: window.ContentCollectionInstance.resources.ContentImages,
922					contentCollection: window.ContentCollectionInstance,
923					pageID: window.ContentCollectionInstance.PageID,
924					moduleID: window.ContentCollectionInstance.ModuleID || 76
925				};
926				window.imageRepository.openImageUploadModal(options);
927			}
928		}).find('.handle.move').unbind('click').click(function (e) {
929			if (e.stopPropagation)
930				e.stopPropagation();
931		});
932	}
933	else {
934		//Inside container widget.
935		$('#divImageOuter' + widgetID +' > .widgetBody').click(function () {
936			if (!liveEditHidden && typeof window.imageRepository != 'undefined' && typeof window.imageRepository.openImageUploadModal != 'undefined') {
937				var options = {
938					loadSource: window.imageRepository.loadSource.Content,
939					targetID: widgetID,
940					$target: null,
941					callback: window.imageRepository.closeImageWidgetUploadModal,
942					modalTitle: window.ContentCollectionInstance.resources.ContentImages,
943					contentCollection: window.ContentCollectionInstance,
944					pageID: window.ContentCollectionInstance.PageID,
945					moduleID: window.ContentCollectionInstance.ModuleID || 76
946				};
947				window.imageRepository.openImageUploadModal(options);
948			}
949		});
950	}
951}
952
953function ImageWidgetCallback(widgetID, response) {
954    if (window.ContentCollectionInstance.IsWorkingCopy) {
955        $('#divImage' + widgetID).html(response);        
956        contentUpdated();
957        bindImageWidgetClickHandler('' + widgetID);        
958    }
959    else {
960        ContentCollectionInstance.reloadContent();
961    }
962};
963var ajax_call_counter = 0;
964var safariRateLimited = null;
965var validationCallbacks = new Array();
966var numbersOnly = new RegExp('^[0-9]*$');
967var gDateFormat;
968var isie6 = false; // Should be set by conditional comments on page.
969var isie7 = false;
970var isie8 = false;
971var isie = window.clipboardData;
972
973function CoreNamespace() {
974	this.timer = 0;
975	this.performSetHeights = true;
976}
977
978CoreNamespace.prototype.resetTimer = function () {
979	this.timer = this.getTimer();
980	console.log('timer reset: ' + this.timer);
981};
982
983CoreNamespace.prototype.logTime = function (label) {
984	var datetime = new Date();
985	if (label == null) label = '';
986	var localTimer = this.getTimer();
987	var duration = this.timer == 0 ? 0 : localTimer - this.timer;
988	this.timer = localTimer;
989	console.log(label + ': ' + duration);
990};
991
992CoreNamespace.prototype.getTimer = function (label) {
993	var datetime = new Date();
994	return datetime.getMinutes() * 60 * 1000 + datetime.getSeconds() * 1000 + datetime.getMilliseconds();
995};
996
997//gets the cookie, if it exists
998function getCookieValue(cookiename) {
999	var ck = document.cookie;
1000	var cn = cookiename + "=";
1001	var pos = ck.indexOf(cn);
1002
1003	if (pos != -1) {
1004		var start = pos + cn.length;
1005		var end = ck.indexOf(";", start);
1006		if (end == -1) end = ck.length;
1007		var cookieValue = ck.substring(start, end);
1008		return (cookieValue);
1009	}
1010
1011	return (null);
1012}
1013
1014// Gets Json object using a given url.
1015function GetJson(url) {
1016	var result;
1017	var alreadySync = !$.ajaxSettings.async;
1018	if (!alreadySync)
1019		$.ajaxSetup({ async: false });
1020	$.post(url, function (data) {
1021		result = data;
1022	});
1023	if (!alreadySync)
1024		$.ajaxSetup({ async: true });
1025	return result;
1026}
1027
1028//Update and maintain the value of "daysSinceLastLogin" cookie
1029function setDaysSinceLastLoginCookie() {
1030	var currentDate = new Date();
1031	var curDateStr = currentDate.getMonth() + 1 + '/' + currentDate.getDate() + '/' + currentDate.getFullYear();
1032	if ($.cookie('lastLoginDate') == null) {
1033		$.cookie('lastLoginDate', curDateStr, { path: '/' });
1034		$.cookie('daysSinceLastLogin', '0', { path: '/' });
1035	}
1036	else {
1037		var lastLoginDate = $.cookie('lastLoginDate');
1038		$.cookie('lastLoginDate', curDateStr, { path: '/' });
1039		$.cookie('daysSinceLastLogin', dayDifference(curDateStr, lastLoginDate), { path: '/', expires: 9999 });
1040	}
1041}
1042
1043// Do not use in new code. Use jQuery with event.preventDefault().
1044function hookAnchorClick(anchor, fn) {
1045	/// <summary>Hooks an anchor onclick and prevents default HREF behavior.</summary>
1046	/// <param name="anchor" type="domElement">The DOM element to attach the event handler for.</param>
1047	/// <param name="fn" type="Function">Function to be called when anchor is clicked. Should have sender and event argument, in that order.</param>
1048	var clickHandler = function (event) {
1049		var sender;
1050
1051		if (window.event) {
1052			event = window.event;
1053			sender = event.srcElement;
1054		}
1055		else
1056			sender = event.target;
1057
1058		fn(sender, event);
1059
1060		if (event.stopPropagation)
1061			event.stopPropagation();
1062		else
1063			event.cancelBubble = true;
1064
1065		return false;
1066	}
1067
1068	// HACK: MSIE/Opera onclick fails to operate correctly.
1069	if (isie || isie8 || isie7 || isie6 || (document.documentMode < 8) || window.opera)
1070		anchor.onmousedown = clickHandler;
1071	else
1072		anchor.onclick = clickHandler;
1073}
1074
1075function beginRequest(sender, args) {
1076	document.body.style.cursor = "wait";
1077}
1078
1079function pageLoaded(sender, args) {
1080	document.body.style.cursor = "default";
1081}
1082
1083var ajaxSpinnerVisible = false;
1084// Called when async postbacks begins
1085function onAjaxPostBackStart(sender, args) {
1086	ajaxPostBackStart('Loading');
1087}
1088
1089// Called when async postback ends
1090function onAjaxPostBackEnd(sender, args) {
1091	ajaxPostBackEnd();
1092}
1093
1094// Show ajax process panel with a customized text
1095function ajaxPostBackStart(textProcessing) {
1096	if (!textProcessing || textProcessing == "")
1097		textProcessing = 'Loading';
1098	if (!ajaxSpinnerVisible) {
1099		var panelAjaxProgress = $("#divAjaxProgress"),
1100				divAjaxImgProgress = $("#divAjaxImgProgress"),
1101				panelAjaxShade = $("#divAjaxShade");
1102
1103		if (panelAjaxProgress.length == 0) {
1104			//create divs on the fly
1105			panelAjaxProgress = $('<div id="divAjaxProgress" style="display:none;"></div>');
1106			panelAjaxShade = $('<div id="divAjaxShade"></div>');
1107			divAjaxImgProgress = $('<div id="divAjaxImgProgress" class="loading"><img src="/Common/images/ajax-loader.gif" /><p></p></div>');
1108
1109			panelAjaxProgress.append(panelAjaxShade);
1110			panelAjaxProgress.append(divAjaxImgProgress);
1111			panelAjaxProgress.prependTo('body');
1112
1113			panelAjaxProgress
1114				.css({ 'position': 'fixed', 'top': '0px', 'left': '0px', 'bottom': '0px', 'right': '0px',
1115					'text-align': 'center', 'border': '1px solid #666',
1116					'z-index': '90000000'
1117				});
1118			panelAjaxShade
1119				.css({ 'position': 'fixed', 'top': '0px', 'left': '0px', 'bottom': '0px', 'right': '0px',
1120					'background': '#fff', 'opacity': '0.5'
1121				});
1122
1123			divAjaxImgProgress.css({ 'position': 'relative' });
1124		}
1125
1126		ajaxSpinnerVisible = true;
1127		ajaxProcesingResizing();
1128		ajaxUpdateText(textProcessing);
1129		panelAjaxProgress.show();
1130		divAjaxImgProgress.show();
1131
1132		$(window).bind('resize', ajaxProcesingResizing);
1133	}
1134}
1135
1136// Hide ajax process panel
1137function ajaxPostBackEnd(noAnimation) {
1138	if (ajaxSpinnerVisible) {
1139		var panelAjaxProgress = $("#divAjaxProgress");
1140		var divAjaxImgProgress = $("#divAjaxImgProgress");
1141
1142		if (noAnimation) {
1143			divAjaxImgProgress.hide();
1144			panelAjaxProgress.hide();
1145		} else {
1146			divAjaxImgProgress.fadeOut("fast", function () {
1147				panelAjaxProgress.hide();
1148			});
1149		}
1150
1151		ajaxSpinnerVisible = false;
1152		$(window).unbind('resize', ajaxProcesingResizing);
1153	}
1154}
1155
1156// Update ajax panel feedback text while panel is being displayed
1157function ajaxUpdateText(text) {
1158	if (ajaxSpinnerVisible) {
1159		var divAjaxImgProgress = $("#divAjaxImgProgress");
1160		divAjaxImgProgress.children('img').attr('alt', text).attr('title', text);
1161		divAjaxImgProgress.children('p').html(text);
1162	}
1163}
1164
1165// Resize ajax panel when on window resize
1166function ajaxProcesingResizing() {
1167	if (ajaxSpinnerVisible) {
1168		var panelAjaxProgress = $("#divAjaxProgress");
1169		var divAjaxImgProgress = $("#divAjaxImgProgress");
1170		var panelAjaxShade = $("#divAjaxShade");
1171
1172		panelAjaxProgress.height($(window).height()).width($(window).width());
1173		panelAjaxShade.height($(window).height()).width($(window).width());
1174
1175		divAjaxImgProgress.css({ 'top': ($(window).height() / 2) - (divAjaxImgProgress.height() / 2) + 'px' });
1176	}
1177}
1178
1179// Implements HTML5 placeholder attribute for browsers that do not support it (and for HTML5 server-side control).
1180var tmpPH = document.createElement('input');
1181var supportPH = (tmpPH.placeholder != null);
1182//var colorPH = '#c0c0c0';
1183
1184var removePlaceholder = (supportPH ?
1185	function (elem) { } : function (elem) {
1186		if (elem != null) {
1187			if (elem.hidePlaceholder)
1188				elem.hidePlaceholder();
1189
1190			elem.hidePlaceholder = null;
1191			elem.showPlaceholder = null;
1192
1193			removeEvent(elem, 'focus', elem._ph_focus, false);
1194			removeEvent(elem, 'blur', elem._ph_onblur, false);
1195			removeEvent(elem, 'onmouseout', elem.ph_onmouseout, false);
1196			removeEvent(elem._ph_form, 'submit', elem._ph_form_submit, false);
1197		}
1198	});
1199
1200var setPlaceholder = (supportPH ?
1201	function (elem) { } : function (elem) {
1202		if (elem != null) {
1203			if (elem.showPlaceholder != null)
1204				removePlaceholder(elem);
1205
1206			var attrVal = elem.getAttribute('placeholder');
1207
1208			elem.hidePlaceholder = function () {
1209				if (elem.value == attrVal) {
1210					if (elem.oldClassName != null)
1211						elem.className = elem.oldClassName;
1212
1213					elem.value = '';
1214				}
1215			}
1216
1217			elem.showPlaceholder = function () {
1218				if (elem.value == '') {
1219					if (attrVal == null)
1220						attrVal = '';
1221					elem.value = attrVal;
1222
1223					var className = elem.className;
1224					className = (className == null ? '' : elem.className);
1225					elem.oldClassName = className;
1226					elem.className = className + ' fakePlaceholder';
1227				}
1228			}
1229
1230			if (elem.value == null || elem.value == '')
1231				elem.showPlaceholder();
1232
1233			elem._ph_focus = function (event) {
1234				elem.hidePlaceholder();
1235			};
1236
1237			elem._ph_blur = function (event) {
1238				elem.showPlaceholder();
1239			};
1240
1241			addEvent(elem, 'focus', elem._ph_focus, false);
1242			addEvent(elem, 'blur', elem._ph_blur, false);
1243
1244			if (elem.form) {
1245				elem._ph_form = elem.form;
1246
1247				elem._ph_form_submit = function (event) {
1248					if (elem)
1249						removePlaceholder(elem);
1250				};
1251
1252				addEvent(elem._ph_form, 'submit', elem._ph_form_submit, false);
1253			}
1254		}
1255	});
1256
1257//When programtically form.submit() is invoked, the placeholders are not removed automatically (onsubmit event is not called).
1258//This function could be invoked before form.submit() if necessary.
1259function removePlaceHolders() {
1260	$('input[placeholder]').each(function () {
1261		removePlaceholder($(this).get(0));
1262	});
1263}
1264
1265var setPlaceHolder = setPlaceholder;
1266
1267// Validation plugs for runat=server form in master page.
1268function headerValidationCallback() {
1269	for (var i = 0; i < validationCallbacks.length; i++) {
1270		if (!validationCallbacks[i]())
1271			return false;
1272	}
1273	return true;
1274}
1275
1276function addHeaderValidator(method) {
1277	validationCallbacks.push(method);
1278}
1279
1280function getBrowser() {
1281	var N = navigator.appName, ua = navigator.userAgent, tem;
1282	var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
1283	if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1];
1284	M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?'];
1285	return M[0];
1286}
1287
1288function getBrowserVersion() {
1289	var N = navigator.appName, ua = navigator.userAgent, tem;
1290	var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
1291	if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1];
1292	M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?'];
1293	return M[1];
1294}
1295
1296function isLegacyBrowser() {
1297	var browser = getBrowser(),
1298	browserVersion = getBrowserVersion(),
1299	browserMajorVersion = Number(browserVersion.split('.')[0]);
1300
1301	var legacyBrowser = ((browser == 'MSIE' && browserMajorVersion < 10) || (browser == 'Chrome' && browserMajorVersion < 30) || (browser == 'Firefox' && browserMajorVersion < 24) || (browser == 'Netscape' && browserMajorVersion != 5)
1302	|| (browser == 'Safari' && browserMajorVersion < 5) || (browser != 'MSIE' && browser != 'Chrome' && browser != 'Firefox' && browser != 'Safari' && browser != 'Netscape'));
1303
1304	return legacyBrowser;
1305}
1306
1307function setTrackBrowserCookie(trackValue) {
1308	var date = new Date();
1309	date.setYear(2100);
1310	document.cookie += ("; expires=" + date.toUTCString());
1311	document.cookie = "CP_TrackBrowser=" + JSON.stringify(trackValue) + "; expires=" + date.toUTCString() + "; path=/";
1312};
1313
1314function getTrackBrowserCookie() {
1315	var trackBrowser = { doNotShowLegacyMsg: false, supportNewUI: true };
1316	var trackBrowserRaw = getCookieValue('CP_TrackBrowser');
1317	if (trackBrowserRaw != null) {
1318		trackBrowser = JSON.parse(trackBrowserRaw);
1319	} else {
1320		trackBrowser.legacy = isLegacyBrowser();
1321		trackBrowser.isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) || false;
1322		setTrackBrowserCookie(trackBrowser);
1323	}
1324	return trackBrowser;
1325}
1326
1327function browserFailOvers() {
1328	var trackBrowser = getTrackBrowserCookie();
1329
1330	if (trackBrowser.legacy && !trackBrowser.isMobile && !trackBrowser.doNotShowLegacyMsg && !$('body').hasClass('mobile') && !$('body').hasClass('narrow')) {
1331		$.ajax({
1332			url: '/Site/Browser/Message',
1333			type: 'GET',
1334			success: function (response) {
1335				$('#divToolbars').append(response);
1336
1337				$('.browserMessage a.dismiss').click(function (e) {
1338					e.preventDefault();
1339					trackBrowser.doNotShowLegacyMsg = true;
1340					setTrackBrowserCookie(trackBrowser);
1341					$('.browserMessage').slideUp();
1342				});
1343
1344				$('.browserMessage').slideDown();
1345			}
1346		});
1347	}
1348};
1349function MarkNotificationsAsNotified(target) {
1350	$.ajaxSetup({ cache: false });
1351
1352	$.ajax({
1353		url: '/MyAccount/UpdateNotifications',
1354		cache: false,
1355		global: false
1356	});
1357
1358	$.ajax({
1359		url: '/Toolbar/Toolbar?currentUrl=' + location.href,
1360		cache: false,
1361		async: false,
1362		success: function (response) {
1363			//$('#divToolbars').html(response);
1364			initToolBar();
1365		}
1366	});
1367	return false;
1368}
1369
1370$(document).ready(function () {
1371
1372	$('[name="myAccountNotificationOther"]').click(function () {
1373		$.ajaxSetup({ cache: false });
1374
1375		$.ajax({
1376			url: '/MyAccount/UpdateNotifications',
1377			cache: false,
1378			global: false,
1379			async: false
1380		});
1381	});
1382
1383	var pattern = new RegExp(window.location.hostname + "/[A|a]dmin/"); // does the URL contain /Admin/ ?
1384	if (pattern.test(window.location.href)) { //if url contains Admin
1385		//On backend, toolbar needs to be loaded after rendering page.
1386		$.ajax({
1387			url: '/Toolbar/Toolbar',
1388			cache: false,
1389			async: false,
1390			success: function (response) {
1391
1392				$('#divToolbars').html(response);
1393
1394				$('#divToolbars').find('div.cpToolbar.user').removeClass('public').addClass('admin adminWrap');
1395
1396				initToolBar();
1397
1398                // The htmx plugin has already initialized at this point, so we need to trigger the process for the toolbar.
1399                htmx.process("#divToolbars");
1400			}
1401		});
1402	} else {
1403		if ($('.cp-InnerWrap').length > 0) {
1404			$('#divToolbars').before($('.cp-InnerWrap'));
1405
1406			if ($(window).width() > 720) {
1407				$('#divToolbars').css("padding-top", "71px");
1408			}
1409		}
1410		//Front-end toolbar will be rendered along with layout.
1411		initToolBar();
1412	}
1413
1414	var $toolbars = $('#divToolbars').children('.cpToolbar');
1415	var zIndex = $toolbars.length;
1416	$toolbars.each(function () {
1417		$(this).css('z-index', zIndex.toString());
1418		zIndex--;
1419	});
1420
1421
1422	var hideWelcomeMessage = function () {
1423	    if ($(window).width() <= 825) {
1424	        $('.welcomeMessage').hide();
1425	        resetBodyPadding();
1426	    } else {
1427	        $('.welcomeMessage').show();
1428	    }
1429	};
1430
1431	hideWelcomeMessage();
1432
1433	window.addEventListener("orientationchange", function () {
1434	    hideWelcomeMessage();
1435	}, false);
1436
1437	window.addEventListener("resize", function () {
1438	    hideWelcomeMessage();
1439	}, false);
1440
1441});
1442
1443function liveEditTooltip () {
1444	if ($.showTooltip) {
1445		$.showTooltip({
1446			Id: 'liveEditTooltip',
1447			tooltipContent: '<p>Live Edit is off. Click this button to turn it on so you can edit your page content and menus.</p><p><a href="#" class="button closeTooltip"><span>Thanks</span></a></p>',
1448			className: 'newCP flyOut bottom center withArrow fixed cpPopOver admin adminWrap helpTip',
1449			$target: $('.openLiveEditMenu'),
1450			$referenceElements: null,
1451			slideOrientation: 'down'
1452		});
1453	}
1454}
1455
1456function resetBodyPadding() {
1457	var toolbarHeight = $('#divToolbars').height();
1458	var navBarButton = $('#nav-open-btn');
1459	var hamburgerMenuHeight = navBarButton.length > 0 ? ((window.fixedResponsiveMenu || $('.cpToolbar.user.public').length >
1459 0) ? 0 : navBarButton.height()) : 0;
1460	var totalHeight = toolbarHeight + hamburgerMenuHeight;
1461	$('#bodyWrapper').css('padding-top', totalHeight + 'px');
1462	return toolbarHeight;
1463}
1464
1465function initToolBar() {
1466	if ($('.cpToolbar', '#divToolbars').length == 0) {
1467		return; // bail if there is not any toolbar displayed.
1468	}
1469
1470	$('.cpToolbar .openLiveEditMenu').click(function (e) {
1471		e.preventDefault();
1472		if ($(this).hasClass('off')) {
1473			enableLiveEdit(true);
1474		}
1475	});
1476
1477	$('.dropdown.liveEdit').click(function () {
1478		if ($('.dropdown.liveEdit').hasClass('open')) {
1479			$.cookie('liveEditOpen', 'true', ' path=/');
1480		} else {
1481			$.cookie('liveEditOpen', 'false', ' path=/');
1482		}
1483	});
1484
1485	// Handle Event Bubbling
1486	$('html').click(function () {
1487		//Hide the menus if visible
1488		closeMenus();
1489	});
1490
1491	$('#divToolbars').click(function (event) {
1492		if (event.target != null && $(event.target).hasClass('noStopPropagation')) return;
1493		event.stopPropagation();
1494		$('.popUp:visible').fadeOut(200, function () {
1495			$('.popUpParent').removeClass('popped');
1496		}).removeClass('popped');
1497	});
1498
1499	// Handle pages context toolbar - This should be refactored into a more general solution
1500	$('.cpToolbar.admin.actions.adminWrap')
1501		.insertAfter('.cpToolbar.user.admin.adminWrap')
1502		.removeClass("hidden");
1503
1504	// Hiding all menus
1505	$('.menu', '#divToolbars').hide();
1506
1507	var $body = $('body');
1508	// Shifting the page down to accommodate fixed toolbars
1509	var toolbarHeight = resetBodyPadding();
1510	$body.css('background-position', 'center ' + toolbarHeight);
1511
1512	if (!$body.hasClass('mobile') && (!$body.hasClass('narrow') || !$body.hasClass('wide'))) {
1513		$body.addClass('wide');
1514	}
1515
1516	// Opening/closing menus when clicked
1517	$('.dropdown > a:not(.myConnections):not(.moreInfo)', '#divToolbars').click(function (e) {
1518		e.preventDefault();
1519
1520		var $toggle = $(this).parent(),
1521			target = $(this).attr('href');
1522		target = target.substring(target.indexOf('#'));
1523		var $menu = $(target);
1524
1525		if ($toggle.hasClass('open')) {
1526			$menu.fadeOut(200).removeClass('showing');
1527			$toggle.removeClass('open');
1528		} else {
1529			$('.showing', '.cpToolbar.user').removeClass('showing').fadeOut(200);
1530			$('.open', '.cpToolbar.user').removeClass('open');
1531			$menu.fadeIn(200).addClass('showing');
1532			$toggle.addClass('open');
1533		}
1534	});
1535
1536	$('.dropdown > a', '#divToolbars').mouseout(function (e) {
1537		e.preventDefault();
1538
1539		var target = $(this).attr('href');
1540		if (target.toLowerCase() == '/myaccount/profilecreate') {
1541			target = 'myaccount';
1542		}
1543		target = target.substring(target.indexOf('#'));
1544		var $menu = $(target);
1545
1546		if ($menu.queue() && $menu.queue().length > 0) { //stop menu opening if client did not intend to open menu.
1547			$('.cpToolbar .open').removeClass('open');
1548			$('.cpToolbar .favoritesMenu').stop(true, true);
1549			$('.cpToolbar .modulesMenu, #notifications').stop(true, true);
1550			$('.cpToolbar #liveEditMenu').stop(true, true);
1551			$('.cpToolbar .secondary .dropdown #userMenu').stop(true, true);
1552			$('.cpToolbar .secondary .dropdown #helpMenu').stop(true, true);
1553			$('.cpToolbar #applicationsMenu').stop(true, true);
1554			$('.cpToolbar .dropdown #homeMenu').stop(true, true);
1555		}
1556	});
1557
1558	$('a.moreInfo, a.myConnections').click(function (e) {
1559		e.preventDefault();
1560
1561		var $toggle = $(this).parent(),
1562			target = $(this).attr('href');
1563		if (target.toLowerCase() == '/myaccount/profilecreate') {
1564			target = 'myaccount';
1565		}
1566		target = target.substring(target.indexOf('#'));
1567		var $menu = $(target);
1568
1569		if (!$toggle.hasClass('open') && !$menu.is(':visible')) {
1570			$('.showing', '.cpToolbar.user').removeClass('showing').fadeOut(200);
1571			$('.open', '.cpToolbar.user').removeClass('open');
1572			$menu.fadeIn(200).addClass('showing');
1573			$toggle.addClass('open');
1574		} else {
1575			$('.showing', '.cpToolbar.user').removeClass('showing').fadeOut(200);
1576			$('.open', '.cpToolbar.user').removeClass('open');
1577			$menu.fadeOut(200).removeClass('showing');
1578		}
1579	});
1580
1581	$('.nodropdown > a').click(function (e) {
1582		closeMenus();
1583		if ($(this).attr('href') != '/admin/PageMenu.aspx') {
1584			e.preventDefault();
1585		}
1586	});
1587
1588	// Opening/closing sub-tabs when hovered
1589	$('#modulesMenu .subTabs > li > a', '#divToolbars').click(function (e) {
1590		e.preventDefault();
1591
1592		var $subTab = $(this),
1593			target = $(this).attr('href');
1594		target = target.substring(target.indexOf('#'));
1595		var $menu = $(target);
1596
1597		if ($subTab.hasClass('active')) {
1598			return;
1599		}
1600
1601		$('.modulesMenu .subTabs .active').removeClass('active');
1602		$subTab.addClass('active');
1603		$('.modulesMenu .subTab').hide();
1604		$menu.show();
1605		document.cookie = 'currentSubTab=' + target + '; path=/';
1606	});
1607
1608	function closeMenus () {
1609		$('.cpToolbar .favoritesMenu').stop(true, true).slideUp('fast');
1610		$('.cpToolbar .modulesMenu, #notifications').stop(true, true).slideUp('fast');
1611		$('.cpToolbar #liveEditMenu').stop(true, true).slideUp('fast', function () {
1612			if ($.cookie != undefined) {
1613				$.cookie('liveEditOpen', 'false', ' path=/');
1614			}
1615		});
1616		$('.cpToolbar .secondary .dropdown #userMenu').stop(true, true).slideUp('fast');
1617		$('.cpToolbar .secondary .dropdown #helpMenu').stop(true, true).slideUp('fast');
1618		$('.cpToolbar .open').stop(true, true).removeClass('open');
1619		$('.cpToolbar #applicationsMenu').stop(true, true).slideUp('fast');
1620		$('.cpToolbar .dropdown #homeMenu').stop(true, true).slideUp('fast');
1621	}
1622
1623	$('#applicationsMenu').click(function (e) {
1624		e.preventDefault();
1625
1626		var $toggle = $(this).parent(),
1627			target = $(this).attr('href');
1628		var $menu = $(target);
1629
1630		if ($toggle.hasClass('open')) {
1631			$menu.fadeOut(100);
1632		} else {
1633			$('.showing', '.cpToolbar.user').removeClass('showing').fadeOut(100);
1634			$('.open', '.cpToolbar.user').removeClass('open');
1635			$menu.fadeIn(100).addClass('showing');
1636		}
1637		$toggle.toggleClass('open');
1638	});
1639
1640	$('.applicationsMenu a').click(function () { location.href = $(this).attr('href'); });
1641	if (getCookieValue('liveEditOpen') === 'true') {
1642		$('#liveEditMenu').show();
1643		$('.dropdown.liveEdit').toggleClass('open');
1644	}
1645	$('.betaModal', '#adminModules').unbind().bind({
1646		click: function (event) {
1647			event.preventDefault();
1648
1649			var anchorTag = $(this);
1650
1651			var moduleName = anchorTag.attr('class').replace('admin beta betaModal ', '');
1652
1653			var data = {
1654				moduleName: moduleName
1655			};
1656
1657			$.ajax({
1658				url: '/BetaModal',
1659				type: 'POST',
1660				data: data,
1661				cache: false,
1662				success: function (response) {
1663					openCpModal({
1664						title: response.title,
1665						className: 'modalBetaTurnOn',
1666						htmlContent: response.view,
1667						autoAdjust: true,
1668						isFrontEnd: false,
1669						elementID: 'betaModal'
1670					});
1671				},
1672				beforeSend: function () {
1673					ajaxPostBackStart('Loading');
1674				},
1675				complete: function () {
1676					ajaxPostBackEnd();
1677				}
1678			});
1679		}
1680	});
1681
1682	if (!window.isResponsiveEnabled) {
1683		displayToolBar();
1684	}
1685}
1686
1687window.Pages = window.Pages || {};
1688$.when(window.Pages.toolBarDeferred).done(function () {
1689	displayToolBar();
1690});
1691
1692function displayToolBar() {
1693	$('#divToolbars').slideDown(200, function () {
1694		$(this).css('overflow', 'visible');
1695		if (typeof (PopulateFavoritesMenu) === 'function')
1696			PopulateFavoritesMenu();
1697		//Prevent the tooltip to appear on DesignCenter, mobile view, backend.
1698		var enableLiveEditCookieValue = cookieGet("enableLiveEdit");
1699		if (!($('.cpToolbar').hasClass('designCenter')) && $('body').hasClass('wide') && (enableLiveEditCookieValue === "false") && !$('#backend').length && !$('div.mobile.header').length) {
1700			liveEditTooltip();
1701		}
1702		if (typeof (toolBarHelpVideoSetup) === 'function')
1703		    toolBarHelpVideoSetup();
1704
1705		if (window.Pages != null && window.Pages.frontEndToolbarComplete != null) {
1706		    window.Pages.frontEndToolbarComplete.resolve();
1707		}
1708	});
1709}
1710
1711$(document).delegate('#btnClose', 'click', function () {
1712	hideModal('modalBetaTurnOn');
1713
1714	return false;
1715});
1716
1717$(document).delegate('#turnOnModule', 'click', function () {
1718	var moduleID = $(this).attr('data-moduleID');
1719	var redirect = $(this).attr('data-redirect');
1720
1721	var data = {
1722		moduleID: moduleID
1723	};
1724
1725	if(typeof(AdditionModuleData) === "function" && AdditionModuleData != null )
1726	{
1727		var retVal = AdditionModuleData(data);
1728
1729		if (!retVal) {
1730			return false;
1731		}
1732	}
1733
1734	$.ajax({
1735		url: '/BetaModal/TurnOn',
1736		type: 'POST',
1737		data: data,
1738		cache: false,
1739		success: function (response) {
1740			try {
1741				var redirectUrl = new URL(redirect, window.location.href);
1742				if (redirectUrl.protocol === window.location.protocol && redirectUrl.host === window.location.host)
1743					window.location = redirectUrl.href;
1744			} catch (e) { }
1745		},
1746		beforeSend: function () {
1747			ajaxPostBackStart('Loading');
1748		},
1749		complete: function () {
1750			ajaxPostBackEnd();
1751		}
1752	});
1753
1754	return false;
1755});
1756
1757function ShowSubTab($subTab, target) {
1758	var $menu = $(target);
1759
1760	if ($subTab.hasClass('active')) {
1761		return;
1762	}
1763
1764	$('.modulesMenu .subTabs .active').removeClass('active');
1765	$subTab.addClass('active');
1766	$('.modulesMenu .subTab').hide();
1767	$menu.show();
1768}
1769
1770//Notifications
1771$(document).ready(function () {
1772    var dontCall = $('#hdnDontCallNotifications').val();
1773
1774    if (!dontCall) {
1775$(function () { setTimeout(NotifyUserOfNotifications, 5000); }); //delay to speed up page load.
1776    }
1777});
1778
1779
1780// Notifies the user via a small drop down modal.
1781// Gets the list of notifications and displays them
1782// Called
1783//	when the page changes
1784//	when an ajax call that awards points occurs
1785//	when the user logs in
1786var NotifyUserOfNotifications = function () {
1787	// Get list of notifications
1788	var url = '/CommunityVoice/Home/Notifications';
1789
1790	if (typeof (LoginBox) != "undefined") {
1791		url = (new LoginBox()).hostUrl + url;
1792	}
1793
1794	var notification;
1795	if ($(".userAlertSlider .userAlert").length != 0) {
1796		$.ajax({
1797			url: url,
1798			type: 'POST',
1799			ignoreEditor: true, //prevent executing global editor event
1800			async: true,
1801			success: function (data) {
1802				// Notify the user
1803				if (data != "<div></div>")
1804					NotificationAlert(data);
1805			}
1806		});
1807	}
1808};
1809
1810var NotificationAlert = function (text) {
1811	var alertModal$ = $(".userAlertSlider .userAlert");
1812	alertModal$.html(text);
1813	alertModal$.removeClass('hidden');
1814	alertModal$.css('opacity', 0);
1815	var oldTop = alertModal$.css('margin-top');
1816	alertModal$.css('margin-top', (-1) * alertModal$.outerHeight() * 2);
1817
1818	var slideUp = function () {
1819		var newTop = alertModal$.css('margin-top');
1820
1821		alertModal$.animate({
1822			opacity: 0,
1823			marginTop: (-1) * alertModal$.outerHeight() * 2
1824		},
1825			1000,
1826			'swing',
1827			function () { alertModal$.css('margin-top', newTop); }
1828			);
1829	}; //
1830
1831	alertModal$.animate({
1832		opacity: 1,
1833		marginTop: oldTop
1834	},
1835			1000,
1836			'swing',
1837			setTimeout(function () {
1838				slideUp();
1839			},
1840				7000)
1841		);
1842};
1843
1844// From Menu.ascx
1845function cpconnecttLogin() {
1846	document.cpconnect.submit();
1847}
1848
1849function moduleV3(formAction, moduleID) {
1850	var hidePageMenu = false;
1851
1852	if (moduleID == 0) {
1853		navigateV3('PageMenu.aspx', '', '', '', '0', '', '', '');
1854	}
1855	else if (moduleID == 59) {
1856		cpconnecttLogin();
1857	}
1858	else if (formAction.indexOf(".asp") == -1) { //for mvc modules
1859		window.location = "/Admin/" + formAction;
1860	}
1861	else {
1862		var frmV3 = document.frmLegacyModuleAccess;
1863		frmV3.action = "/Admin/" + formAction;
1864		frmV3.strResourceType.value = 'M';
1865		frmV3.lngResourceID.value = moduleID;
1866		frmV3.lngExpandCategoryID.value = 0;
1867		frmV3.submit();
1868	}
1869}
1870
1871function navigateV3(formAction, strResourceType, lngResourceID, lngExpandCategoryID, lngParentID, lngCategoryID, strPage, strAction) {
1872	var frmV3 = document.frmLegacyModuleAccess;
1873	frmV3.action = "/admin/" + formAction;
1874	frmV3.strResourceType.value = strResourceType;
1875	frmV3.lngResourceID.value = lngResourceID;
1876	frmV3.lngExpandCategoryID.value = lngExpandCategoryID;
1877	frmV3.lngParentID.value = lngParentID;
1878	frmV3.lngCategoryID.value = lngCategoryID;
1879	frmV3.strPage.value = strPage;
1880	frmV3.straction.value = strAction;
1881	frmV3.submit();
1882}
1883
1884function createDynamicLMA() {
1885	if (document.frmLegacyModuleAccess) {
1886		return document.frmLegacyModuleAccess;
1887	}
1888	var frmV3 = document.createElement('FORM');
1889	document.body.appendChild(frmV3);
1890	frmV3.name = 'frmLegacyModuleAccess'
1891	frmV3.method = 'POST';
1892	createHiddenOnForm(frmV3, 'strResourceType');
1893	createHiddenOnForm(frmV3, 'lngResourceID');
1894	createHiddenOnForm(frmV3, 'lngExpandCategoryID');
1895	createHiddenOnForm(frmV3, 'lngParentID');
1896	createHiddenOnForm(frmV3, 'lngCategoryID');
1897	createHiddenOnForm(frmV3, 'strPage');
1898	createHiddenOnForm(frmV3, 'straction');
1899	return frmV3;
1900}
1901
1902function createHiddenOnForm(frm, name) {
1903	hf = document.createElement('INPUT');
1904	hf.type = 'HIDDEN';
1905	hf.name = name;
1906	frm.appendChild(hf);
1907}
1908
1909// Fired if a profile image is missing.
1910function profileImageFallback(img) {
1911	img.src = '/Assets/Images/ProfilePlaceholder.png';
1912}
1913
1914function SignOut() {
1915	window.location.href = '/publiclogin.aspx?out=true&txtRedirect=' + window.location.pathname.substring(1) + window.location.search;
1916}
1917
1918function initPagesHelpMenu() {
1919	var moduleID = $('#pageModuleID').val() === "76" || $('#pagePageID').val() ? 76 : "";
1920	var player = null;
1921
1922	if (moduleID === 76) {
1923		$('.helpVideosOpenButton').show();
1924
1925		$('.helpVideosOpenButton').cpPopover({
1926			url: '/Help/Video',
1927			type: 'POST',
1928			contentType: 'application/json',
1929			data: JSON.stringify({ isFrontend: $('#pageIsFrontEnd').val() == "true", moduleID: moduleID }),
1930			className: 'newCP cpPopOver cpPopOverModal adminWrap helpVideos',
1931			onInit: function () {
1932				connectCPC();
1933				videojs.options.flash.swf = "/Assets/Scripts/video-js.swf";
1934				videojs.options.techOrder = ["flash", "html5", "links"];
1935
1936				var config = {
1937					selector: {
1938						backToVideoListButton: '.cpPopOver.helpVideos .videoTab a.button',
1939						linkToVideoButtons: '.cpPopOver.helpVideos .listTab ol li',
1940						playVideoTab: '.cpPopOver.helpVideos .videoTab',
1941						listVideoTab: '.cpPopOver.helpVideos .listTab',
1942						videoSource: '.cpPopOver.helpVideos .videoTab .video'
1943					}
1944				};
1945
1946				$(config.selector.backToVideoListButton).click(function () {
1947					$(config.selector.listVideoTab).show();
1948					$(config.selector.playVideoTab).hide();
1949
1950				});
1951
1952				$(config.selector.linkToVideoButtons).click(function () {
1953					//$(config.selector.videoSource).attr('src', $(this).find('a').data('url'));
1954					var url = $(this).find('a').data('url');
1955					var id = $(this).find('a').data('linkid');
1956					$(config.selector.videoSource).addClass('hidden');
1957					$(config.selector.videoSource + '[data-linkid=' + id + ']').removeClass('hidden');
1958					$(config.selector.listVideoTab).hide();
1959					$(config.selector.playVideoTab).show();
1960
1961					player = videojs("helpVideoPlayer_" + id, { preload: "none", techOrder: ["flash", "html5", "links"] }, function () {
1962						this.play();
1963					});
1964
1965
1966				});
1967			},
1968			onClose: function (e, popoverWrap) {
1969				e.preventDefault();
1970
1971				window.CommonPopoverInstance.hide(popoverWrap);
1972			}
1973		});
1974
1975		if (!($('.cpToolbar').hasClass('designCenter')) && $('body').hasClass('wide')) {
1976			$.showTooltip({
1977				Id: 'videoHelpTooltip',
1978				tooltipContent: '<p>Need some help with Pages Live Edit? Check out the Pages help videos</p><p><a href="#thanks" class="button closeTooltip"><span>Thanks</span></a></p>',
1979				className: 'newCP flyOut bottom center withArrow fixed cpPopOver admin adminWrap helpTip',
1980				$target: $('#helpMenu').parent(),
1981				$referenceElements: null,
1982				slideOrientation: 'down'
1983			});
1984			$('#videoHelpTooltip').css('z-index', 102);
1985			$('#videoHelpTooltip').css('position', 'absolute');
1986		}
1987	} else {
1988		$('.helpVideosOpenButton').hide();
1989	}
1990}
1991
1992//
1993// This function should probably live in its own file, however, if we put it in its own file, Firefox causes some weird
1994// flickering with the Toolbar, was not able to determine the root cause of this (even with bundling in the header the flicker was
1995// still there, so I am putting it directly in this file. -- MDF
1996//
1997var SubmitARequest = (function () {
1998
1999	var dzScreenshot;		// Dropzone for Screenshot
2000
2001	return {
2002		showInputModal: showInputModal,
2003		initModalEventHandlers: initModalEventHandlers
2004	};
2005
2006
2007	function showInputModal() {
2008		var modalOptions = {
2009			title: 'Submit a Request',
2010			url: '/SubmitARequest/SubmitRequest',
2011			classname: 'submitARequestModal',
2012			isFrontEnd: false,
2013			useIframe: true,
2014			showLoading: true,
2015			autoAdjust: true,
2016			iframeHeight: '580px',
2017			className: 'modalSubmitASupportRequest minor',
2018			onLoadComplete: function () {
2019				$('.cpToolbar .secondary .dropdown #helpMenu', window.parent.document).stop(true, true).slideUp('fast');
2020			}
2021		};
2022		openCpModal(modalOptions);
2023	}
2024
2025	function initModalEventHandlers($submitButton, $cancelButton, dropzone) {
2026
2027		dzScreenshot = dropzone;
2028
2029		($submitButton).click(function (e) {
2030			e.preventDefault();
2031			submit();
2032		});
2033
2034		($cancelButton).click(function (e) {
2035			e.preventDefault();
2036			window.parent.closeCpModal();
2037		});
2038	}
2039
2040
2041	function submit() {
2042		if (dzScreenshot.className !== 'fallback' && dzScreenshot.getQueuedFiles().length > 0) {
2043			dzScreenshot.processQueue();
2044		} else {
2045			$('#submitASupportRequest').submit();
2046		}
2047	}
2048
2049}());
2050;
2051/*!
2052loadCSS: load a CSS file asynchronously.
2053[c]2014 @scottjehl, Filament Group, Inc.
2054Licensed MIT
2055*/
2056
2057/* exported loadCSS */
2058function loadCSS(href, before, media, callback) {
2059    "use strict";
2060    // Arguments explained:
2061    // `href` is the URL for your CSS file.
2062    // `before` optionally defines the element we'll use as a reference for injecting our <link>
2063    // By default, `before` uses the first <script> element in the page.
2064    // However, since the order in which stylesheets are referenced matters, you might need a more specific location in your document.
2065    // If so, pass a different reference element to the `before` argument and it'll insert before that instead
2066    // note: `insertBefore` is used instead of `appendChild`, for safety re: http://www.paulirish.com/2011/surefire-dom-element-insertion/
2067    var ss = window.document.createElement("link");
2068    var ref = before || window.document.getElementsByTagName("script")[0];
2069    var sheets = window.document.styleSheets;
2070    ss.rel = "stylesheet";
2071    ss.href = href;
2072    // temporarily, set media to something non-matching to ensure it'll fetch without blocking render
2073    ss.media = "only x";
2074    // DEPRECATED
2075    if (callback) {
2076        ss.onload = callback;
2077    }
2078
2079    // inject link
2080    ref.parentNode.insertBefore(ss, ref);
2081    // This function sets the link's media back to `all` so that the stylesheet applies once it loads
2082    // It is designed to poll until document.styleSheets includes the new sheet.
2083    ss.onloadcssdefined = function (cb) {
2084        var defined;
2085        for (var i = 0; i < sheets.length; i++) {
2086            if (sheets[i].href && sheets[i].href === ss.href) {
2087                defined = true;
2088            }
2089        }
2090        if (defined) {
2091            cb();
2092        } else {
2093            setTimeout(function () {
2094                ss.onloadcssdefined(cb);
2095            });
2096        }
2097    };
2098    ss.onloadcssdefined(function () {
2099        ss.media = media || "all";
2100    });
2101    return ss;
2102};
2103/**
2104 * @license
2105 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
2106 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
2107 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
2108 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
2109 * Code distributed by Google as part of the polymer project is also
2110 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2111 */
2112
2113if (typeof WeakMap === 'undefined') {
2114	(function () {
2115		var defineProperty = Object.defineProperty;
2116		var counter = Date.now() % 1e9;
2117
2118		var WeakMap = function () {
2119			this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__');
2120		};
2121
2122		WeakMap.prototype = {
2123			set: function (key, value) {
2124				var entry = key[this.name];
2125				if (entry && entry[0] === key)
2126					entry[1] = value;
2127				else
2128					defineProperty(key, this.name, { value: [key, value], writable: true });
2129				return this;
2130			},
2131			get: function (key) {
2132				var entry;
2133				return (entry = key[this.name]) && entry[0] === key ?
2134					entry[1] : undefined;
2135			},
2136			delete: function (key) {
2137				var entry = key[this.name];
2138				if (!entry || entry[0] !== key) return false;
2139				entry[0] = entry[1] = undefined;
2140				return true;
2141			},
2142			has: function (key) {
2143				var entry = key[this.name];
2144				if (!entry) return false;
2145				return entry[0] === key;
2146			}
2147		};
2148
2149		window.WeakMap = WeakMap;
2150	})();
2151};
2152/**
2153 * @license
2154 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
2155 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
2156 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
2157 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
2158 * Code distributed by Google as part of the polymer project is also
vendor: 6,997 bytes, lines 2159-2388
2159 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2160 */
2161
2162(function (global) {
2163
2164	// Don't allow this object to be redefined.
2165	if (global.JsMutationObserver) {
2166		return;
2167	}
2168
2169	var registrationsTable = new WeakMap();
2170
2171	var setImmediate;
2172
2173	// As much as we would like to use the native implementation, IE
2174	// (all versions) suffers a rather annoying bug where it will drop or defer
2175	// callbacks when heavy DOM operations are being performed concurrently.
2176	//
2177	// For a thorough discussion on this, see:
2178	// http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
2179	if (/Trident|Edge/.test(navigator.userAgent)) {
2180		// Sadly, this bug also affects postMessage and MessageQueues.
2181		//
2182		// We would like to use the onreadystatechange hack for IE <= 10, but it is
2183		// dangerous in the polyfilled environment due to requiring that the
2184		// observed script element be in the document.
2185		setImmediate = setTimeout;
2186
2187		// If some other browser ever implements it, let's prefer their native
2188		// implementation:
2189	} else if (window.setImmediate) {
2190		setImmediate = window.setImmediate;
2191
2192		// Otherwise, we fall back to postMessage as a means of emulating the next
2193		// task semantics of setImmediate.
2194	} else {
2195		var setImmediateQueue = [];
2196		var sentinel = String(Math.random());
2197		window.addEventListener('message', function (e) {
2198			if (e.data === sentinel) {
2199				var queue = setImmediateQueue;
2200				setImmediateQueue = [];
2201				queue.forEach(function (func) {
2202					func();
2203				});
2204			}
2205		});
2206		setImmediate = function (func) {
2207			setImmediateQueue.push(func);
2208			window.postMessage(sentinel, '*');
2209		};
2210	}
2211
2212	// This is used to ensure that we never schedule 2 callas to setImmediate
2213	var isScheduled = false;
2214
2215	// Keep track of observers that needs to be notified next time.
2216	var scheduledObservers = [];
2217
2218	/**
2219	 * Schedules |dispatchCallback| to be called in the future.
2220	 * @param {MutationObserver} observer
2221	 */
2222	function scheduleCallback(observer) {
2223		scheduledObservers.push(observer);
2224		if (!isScheduled) {
2225			isScheduled = true;
2226			setImmediate(dispatchCallbacks);
2227		}
2228	}
2229
2230	function wrapIfNeeded(node) {
2231		return window.ShadowDOMPolyfill &&
2232			window.ShadowDOMPolyfill.wrapIfNeeded(node) ||
2233			node;
2234	}
2235
2236	function dispatchCallbacks() {
2237		// http://dom.spec.whatwg.org/#mutation-observers
2238
2239		isScheduled = false; // Used to allow a new setImmediate call above.
2240
2241		var observers = scheduledObservers;
2242		scheduledObservers = [];
2243		// Sort observers based on their creation UID (incremental).
2244		observers.sort(function (o1, o2) {
2245			return o1.uid_ - o2.uid_;
2246		});
2247
2248		var anyNonEmpty = false;
2249		observers.forEach(function (observer) {
2250
2251			// 2.1, 2.2
2252			var queue = observer.takeRecords();
2253			// 2.3. Remove all transient registered observers whose observer is mo.
2254			removeTransientObserversFor(observer);
2255
2256			// 2.4
2257			if (queue.length) {
2258				observer.callback_(queue, observer);
2259				anyNonEmpty = true;
2260			}
2261		});
2262
2263		// 3.
2264		if (anyNonEmpty)
2265			dispatchCallbacks();
2266	}
2267
2268	function removeTransientObserversFor(observer) {
2269		observer.nodes_.forEach(function (node) {
2270			var registrations = registrationsTable.get(node);
2271			if (!registrations)
2272				return;
2273			registrations.forEach(function (registration) {
2274				if (registration.observer === observer)
2275					registration.removeTransientObservers();
2276			});
2277		});
2278	}
2279
2280	/**
2281	 * This function is used for the "For each registered observer observer (with
2282	 * observer's options as options) in target's list of registered observers,
2283	 * run these substeps:" and the "For each ancestor ancestor of target, and for
2284	 * each registered observer observer (with options options) in ancestor's list
2285	 * of registered observers, run these substeps:" part of the algorithms. The
2286	 * |options.subtree| is checked to ensure that the callback is called
2287	 * correctly.
2288	 *
2289	 * @param {Node} target
2290	 * @param {function(MutationObserverInit):MutationRecord} callback
2291	 */
2292	function forEachAncestorAndObserverEnqueueRecord(target, callback) {
2293		for (var node = target; node; node = node.parentNode) {
2294			var registrations = registrationsTable.get(node);
2295
2296			if (registrations) {
2297				for (var j = 0; j < registrations.length; j++) {
2298					var registration = registrations[j];
2299					var options = registration.options;
2300
2301					// Only target ignores subtree.
2302					if (node !== target && !options.subtree)
2303						continue;
2304
2305					var record = callback(options);
2306					if (record)
2307						registration.enqueue(record);
2308				}
2309			}
2310		}
2311	}
2312
2313	var uidCounter = 0;
2314
2315	/**
2316	 * The class that maps to the DOM MutationObserver interface.
2317	 * @param {Function} callback.
2318	 * @constructor
2319	 */
2320	function JsMutationObserver(callback) {
2321		this.callback_ = callback;
2322		this.nodes_ = [];
2323		this.records_ = [];
2324		this.uid_ = ++uidCounter;
2325	}
2326
2327	JsMutationObserver.prototype = {
2328		observe: function (target, options) {
2329			target = wrapIfNeeded(target);
2330
2331			// 1.1
2332			if (!options.childList && !options.attributes && !options.characterData ||
2333
2334				// 1.2
2335				options.attributeOldValue && !options.attributes ||
2336
2337				// 1.3
2338				options.attributeFilter && options.attributeFilter.length &&
2339					!options.attributes ||
2340
2341				// 1.4
2342				options.characterDataOldValue && !options.characterData) {
2343
2344				throw new SyntaxError();
2345			}
2346
2347			var registrations = registrationsTable.get(target);
2348			if (!registrations)
2349				registrationsTable.set(target, registrations = []);
2350
2351			// 2
2352			// If target's list of registered observers already includes a registered
2353			// observer associated with the context object, replace that registered
2354			// observer's options with options.
2355			var registration;
2356			for (var i = 0; i < registrations.length; i++) {
2357				if (registrations[i].observer === this) {
2358					registration = registrations[i];
2359					registration.removeListeners();
2360					registration.options = options;
2361					break;
2362				}
2363			}
2364
2365			// 3.
2366			// Otherwise, add a new registered observer to target's list of registered
2367			// observers with the context object as the observer and options as the
2368			// options, and add target to context object's list of nodes on which it
2369			// is registered.
2370			if (!registration) {
2371				registration = new Registration(this, target, options);
2372				registrations.push(registration);
2373				this.nodes_.push(target);
2374			}
2375
2376			registration.addListeners();
2377		},
2378
2379		disconnect: function () {
2380			this.nodes_.forEach(function (node) {
2381				var registrations = registrationsTable.get(node);
2382				for (var i = 0; i < registrations.length; i++) {
2383					var registration = registrations[i];
2384					if (registration.observer === this) {
2385						registration.removeListeners();
2386						registrations.splice(i, 1);
2387						// Each node can only have one registered observer associated with
2388						// this observer.
2389						break;
2390					}
2391				}
2392			}, this);
2393			this.records_ = [];
2394		},
2395
2396		takeRecords: function () {
2397			var copyOfRecords = this.records_;
2398			this.records_ = [];
2399			return copyOfRecords;
2400		}
2401	};
2402
2403	/**
2404	 * @param {string} type
2405	 * @param {Node} target
2406	 * @constructor
2407	 */
2408	function MutationRecord(type, target) {
2409		this.type = type;
2410		this.target = target;
2411		this.addedNodes = [];
2412		this.removedNodes = [];
2413		this.previousSibling = null;
2414		this.nextSibling = null;
2415		this.attributeName = null;
2416		this.attributeNamespace = null;
2417		this.oldValue = null;
2418	}
2419
2420	function copyMutationRecord(original) {
2421		var record = new MutationRecord(original.type, original.target);
2422		record.addedNodes = original.addedNodes.slice();
2423		record.removedNodes = original.removedNodes.slice();
2424		record.previousSibling = original.previousSibling;
2425		record.nextSibling = original.nextSibling;
2426		record.attributeName = original.attributeName;
2427		record.attributeNamespace = original.attributeNamespace;
2428		record.oldValue = original.oldValue;
2429		return record;
2430	};
2431
2432	// We keep track of the two (possibly one) records used in a single mutation.
2433	var currentRecord, recordWithOldValue;
2434
2435	/**
2436	 * Creates a record without |oldValue| and caches it as |currentRecord| for
2437	 * later use.
2438	 * @param {string} oldValue
2439	 * @return {MutationRecord}
2440	 */
2441	function getRecord(type, target) {
2442		return currentRecord = new MutationRecord(type, target);
2443	}
2444
2445	/**
2446	 * Gets or creates a record with |oldValue| based in the |currentRecord|
2447	 * @param {string} oldValue
2448	 * @return {MutationRecord}
2449	 */
2450	function getRecordWithOldValue(oldValue) {
2451		if (recordWithOldValue)
2452			return recordWithOldValue;
2453		recordWithOldValue = copyMutationRecord(currentRecord);
2454		recordWithOldValue.oldValue = oldValue;
2455		return recordWithOldValue;
2456	}
2457
2458	function clearRecords() {
2459		currentRecord = recordWithOldValue = undefined;
2460	}
2461
2462	/**
2463	 * @param {MutationRecord} record
2464	 * @return {boolean} Whether the record represents a record from the current
2465	 * mutation event.
2466	 */
2467	function recordRepresentsCurrentMutation(record) {
2468		return record === recordWithOldValue || record === currentRecord;
2469	}
2470
2471	/**
2472	 * Selects which record, if any, to replace the last record in the queue.
2473	 * This returns |null| if no record should be replaced.
2474	 *
2475	 * @param {MutationRecord} lastRecord
2476	 * @param {MutationRecord} newRecord
2477	 * @param {MutationRecord}
2478	 */
2479	function selectRecord(lastRecord, newRecord) {
2480		if (lastRecord === newRecord)
2481			return lastRecord;
2482
2483		// Check if the the record we are adding represents the same record. If
2484		// so, we keep the one with the oldValue in it.
2485		if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord))
2486			return recordWithOldValue;
2487
2488		return null;
2489	}
2490
2491	/**
2492	 * Class used to represent a registered observer.
2493	 * @param {MutationObserver} observer
2494	 * @param {Node} target
2495	 * @param {MutationObserverInit} options
2496	 * @constructor
2497	 */
2498	function Registration(observer, target, options) {
2499		this.observer = observer;
2500		this.target = target;
2501		this.options = options;
2502		this.transientObservedNodes = [];
2503	}
2504
2505	Registration.prototype = {
2506		enqueue: function (record) {
2507			var records = this.observer.records_;
2508			var length = records.length;
2509
2510			// There are cases where we replace the last record with the new record.
2511			// For example if the record represents the same mutation we need to use
2512			// the one with the oldValue. If we get same record (this can happen as we
2513			// walk up the tree) we ignore the new record.
2514			if (records.length > 0) {
2515				var lastRecord = records[length - 1];
2516				var recordToReplaceLast = selectRecord(lastRecord, record);
2517				if (recordToReplaceLast) {
2518					records[length - 1] = recordToReplaceLast;
2519					return;
2520				}
2521			} else {
2522				scheduleCallback(this.observer);
2523			}
2524
2525			records[length] = record;
2526		},
2527
2528		addListeners: function () {
2529			this.addListeners_(this.target);
2530		},
2531
2532		addListeners_: function (node) {
2533			var options = this.options;
2534			if (options.attributes)
2535				node.addEventListener('DOMAttrModified', this, true);
2536
2537			if (options.characterData)
2538				node.addEventListener('DOMCharacterDataModified', this, true);
2539
2540			if (options.childList)
2541				node.addEventListener('DOMNodeInserted', this, true);
2542
2543			if (options.childList || options.subtree)
2544				node.addEventListener('DOMNodeRemoved', this, true);
2545		},
2546
2547		removeListeners: function () {
2548			this.removeListeners_(this.target);
2549		},
2550
2551		removeListeners_: function (node) {
2552			var options = this.options;
2553			if (options.attributes)
2554				node.removeEventListener('DOMAttrModified', this, true);
2555
2556			if (options.characterData)
2557				node.removeEventListener('DOMCharacterDataModified', this, true);
2558
2559			if (options.childList)
2560				node.removeEventListener('DOMNodeInserted', this, true);
2561
2562			if (options.childList || options.subtree)
2563				node.removeEventListener('DOMNodeRemoved', this, true);
2564		},
2565
2566		/**
2567		 * Adds a transient observer on node. The transient observer gets removed
2568		 * next time we deliver the change records.
2569		 * @param {Node} node
2570		 */
2571		addTransientObserver: function (node) {
2572			// Don't add transient observers on the target itself. We already have all
2573			// the required listeners set up on the target.
2574			if (node === this.target)
2575				return;
2576
2577			this.addListeners_(node);
2578			this.transientObservedNodes.push(node);
2579			var registrations = registrationsTable.get(node);
2580			if (!registrations)
2581				registrationsTable.set(node, registrations = []);
2582
2583			// We know that registrations does not contain this because we already
2584			// checked if node === this.target.
2585			registrations.push(this);
2586		},
2587
2588		removeTransientObservers: function () {
2589			var transientObservedNodes = this.transientObservedNodes;
2590			this.transientObservedNodes = [];
2591
2592			transientObservedNodes.forEach(function (node) {
2593				// Transient observers are never added to the target.
2594				this.removeListeners_(node);
2595
2596				var registrations = registrationsTable.get(node);
2597				for (var i = 0; i < registrations.length; i++) {
2598					if (registrations[i] === this) {
2599						registrations.splice(i, 1);
2600						// Each node can only have one registered observer associated with
2601						// this observer.
2602						break;
2603					}
2604				}
2605			}, this);
2606		},
2607
2608		handleEvent: function (e) {
2609			// Stop propagation since we are managing the propagation manually.
2610			// This means that other mutation events on the page will not work
2611			// correctly but that is by design.
2612			e.stopImmediatePropagation();
2613
2614			switch (e.type) {
2615				case 'DOMAttrModified':
2616					// http://dom.spec.whatwg.org/#concept-mo-queue-attributes
2617
2618					var name = e.attrName;
2619					var namespace = e.relatedNode.namespaceURI;
2620					var target = e.target;
2621
2622					// 1.
2623					var record = new getRecord('attributes', target);
2624					record.attributeName = name;
2625					record.attributeNamespace = namespace;
2626
2627					// 2.
2628					var oldValue =
2629						e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
2630
2631					forEachAncestorAndObserverEnqueueRecord(target, function (options) {
2632						// 3.1, 4.2
2633						if (!options.attributes)
2634							return;
2635
2636						// 3.2, 4.3
2637						if (options.attributeFilter && options.attributeFilter.length &&
2638							options.attributeFilter.indexOf(name) === -1 &&
2639							options.attributeFilter.indexOf(namespace) === -1) {
2640							return;
2641						}
2642						// 3.3, 4.4
2643						if (options.attributeOldValue)
2644							return getRecordWithOldValue(oldValue);
2645
2646						// 3.4, 4.5
2647						return record;
2648					});
2649
2650					break;
2651
2652				case 'DOMCharacterDataModified':
2653					// http://dom.spec.whatwg.org/#concept-mo-queue-characterdata
2654					var target = e.target;
2655
2656					// 1.
2657					var record = getRecord('characterData', target);
2658
2659					// 2.
2660					var oldValue = e.prevValue;
2661
2662
2663					forEachAncestorAndObserverEnqueueRecord(target, function (options) {
2664						// 3.1, 4.2
2665						if (!options.characterData)
2666							return;
2667
2668						// 3.2, 4.3
2669						if (options.characterDataOldValue)
2670							return getRecordWithOldValue(oldValue);
2671
2672						// 3.3, 4.4
2673						return record;
2674					});
2675
2676					break;
2677
2678				case 'DOMNodeRemoved':
2679					this.addTransientObserver(e.target);
2680					// Fall through.
2681				case 'DOMNodeInserted':
2682					// http://dom.spec.whatwg.org/#concept-mo-queue-childlist
2683					var changedNode = e.target;
2684					var addedNodes, removedNodes;
2685					if (e.type === 'DOMNodeInserted') {
2686						addedNodes = [changedNode];
2687						removedNodes = [];
2688					} else {
2689
2690						addedNodes = [];
2691						removedNodes = [changedNode];
2692					}
2693					var previousSibling = changedNode.previousSibling;
2694					var nextSibling = changedNode.nextSibling;
2695
2696					// 1.
2697					var record = getRecord('childList', e.target.parentNode);
2698					record.addedNodes = addedNodes;
2699					record.removedNodes = removedNodes;
2700					record.previousSibling = previousSibling;
2701					record.nextSibling = nextSibling;
2702
2703					forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function (options) {
2704						// 2.1, 3.2
2705						if (!options.childList)
2706							return;
2707
2708						// 2.2, 3.3
2709						return record;
2710					});
2711
2712			}
2713
2714			clearRecords();
2715		}
2716	};
2717
2718	global.JsMutationObserver = JsMutationObserver;
2719
2720	if (!global.MutationObserver) {
2721		global.MutationObserver = JsMutationObserver;
2722		// Explicltly mark MO as polyfilled for user reference.
2723		JsMutationObserver._isPolyfilled = true;
2724	}
2725
2726})(self);
2727!function (e) { ("object" != typeof exports || "undefined" == typeof module) && "function" == typeof define && define.amd ? define("inert", e) : e() }(function () { "use strict"; var o, r, t, i, s, n, e = function (e, t, n) { return t && a(e.prototype, t), n && a(e, n), e }; function a(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, i.key, i) } } function d(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function u(e, t) { d(this, u), this._inertManager = t, this._rootElement = e, this._managedNodes = new Set, this._rootElement.hasAttribute("aria-hidden") ? this._savedAriaHidden = this._rootElement.getAttribute("aria-hidden") : this._savedAriaHidden = null, this._rootElement.setAttribute("aria-hidden", "true"), this._makeSubtreeUnfocusable(this._rootElement), this._observer = new MutationObserver(this._onMutation.bind(this)), this._observer.observe(this._rootElement, { attributes: !0, childList: !0, subtree: !0 }) } function h(e, t) { d(this, h), this._node = e, this._overrodeFocusMethod = !1, this._inertRoots = new Set([t]), this._savedTabIndex = null, this._destroyed = !1, this.ensureUntabbable() } function l(e) { if (d(this, l), !e) throw new Error("Missing required argument; InertManager needs to wrap a document."); this._document = e, this._managedNodes = new Map, this._inertRoots = new Map, this._observer = new MutationObserver(this._watchForInert.bind(this)), _(e.head || e.body || e.documentElement), "loading" === e.readyState ? e.addEventListener("DOMContentLoaded", this._onDocumentLoaded.bind(this)) : this._onDocumentLoaded() } function c(e, t, n) { if (e.nodeType == Node.ELEMENT_NODE) { var i = e, o = (t && t(i), i.shadowRoot); if (o) return void c(o, t, o); if ("content" == i.localName) { for (var o = i, r = o.getDistributedNodes ? o.getDistributedNodes() : [], s = 0; s < r.length; s++)c(r[s], t, n); return } if ("slot" == i.localName) { for (var o = i, a = o.assignedNodes ? o.assignedNodes({ flatten: !0 }) : [], d = 0; d < a.length; d++)c(a[d], t, n); return } } for (var u = e.firstChild; null != u;)c(u, t, n), u = u.nextSibling } function _(e) { var t; e.querySelector("style#inert-style, link#inert-style") || ((t = document.createElement("style")).setAttribute("id", "inert-style"), t.textContent = "\n[inert] {\n  pointer-events: none;\n  cursor: default;\n}\n\n[inert], [inert] * {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n", e.appendChild(t)) } "undefined" != typeof window && "undefined" != typeof Element && (o = Array.prototype.slice, r = Element.prototype.matches || Element.prototype.msMatchesSelector, t = ["a[href]", "area[href]", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "button:not([disabled])", "details", "summary", "iframe", "object", "embed", "video", "[contenteditable]"].join(","), e(u, [{ key: "de
2727structor", value: function () { this._observer.disconnect(), this._rootElement && (null !== this._savedAriaHidden ? this._rootElement.setAttribute("aria-hidden", this._savedAriaHidden) : this._rootElement.removeAttribute("aria-hidden")), this._managedNodes.forEach(function (e) { this._unmanageNode(e.node) }, this), this._observer = null, this._rootElement = null, this._managedNodes = null, this._inertManager = null } }, { key: "_makeSubtreeUnfocusable", value: function (e) { var t = this, n = (c(e, function (e) { return t._visitNode(e) }), document.activeElement); if (!document.body.contains(e)) { for (var i = e, o = void 0; i;) { if (i.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { o = i; break } i = i.parentNode } o && (n = o.activeElement) } e.contains(n) && (n.blur(), n === document.activeElement && document.body.focus()) } }, { key: "_visitNode", value: function (e) { e.nodeType === Node.ELEMENT_NODE && ((e = e) !== this._rootElement && e.hasAttribute("inert") && this._adoptInertRoot(e), (r.call(e, t) || e.hasAttribute("tabindex")) && this._manageNode(e)) } }, { key: "_manageNode", value: function (e) { e = this._inertManager.register(e, this); this._managedNodes.add(e) } }, { key: "_unmanageNode", value: function (e) { e = this._inertManager.deregister(e, this); e && this._managedNodes.delete(e) } }, { key: "_unmanageSubtree", value: function (e) { var t = this; c(e, function (e) { return t._unmanageNode(e) }) } }, { key: "_adoptInertRoot", value: function (e) { var t = this._inertManager.getInertRoot(e); t || (this._inertManager.setInert(e, !0), t = this._inertManager.getInertRoot(e)), t.managedNodes.forEach(function (e) { this._manageNode(e.node) }, this) } }, { key: "_onMutation", value: function (e, t) { e.forEach(function (e) { var t, n = e.target; "childList" === e.type ? (o.call(e.addedNodes).forEach(function (e) { this._makeSubtreeUnfocusable(e) }, this), o.call(e.removedNodes).forEach(function (e) { this._unmanageSubtree(e) }, this)) : "attributes" === e.type && ("tabindex" === e.attributeName ? this._manageNode(n) : n !== this._rootElement && "inert" === e.attributeName && n.hasAttribute("inert") && (this._adoptInertRoot(n), t = this._inertManager.getInertRoot(n), this._managedNodes.forEach(function (e) { n.contains(e.node) && t._manageNode(e.node) }))) }, this) } }, { key: "managedNodes", get: function () { return new Set(this._managedNodes) } }, { key: "hasSavedAriaHidden", get: function () { return null !== this._savedAriaHidden } }, { key: "savedAriaHidden", set: function (e) { this._savedAriaHidden = e }, get: function () { return this._savedAriaHidden } }]), i = u, e(h, [{ key: "destructor", value: function () { var e; this._throwIfDestroyed(), this._node && this._node.nodeType === Node.ELEMENT_NODE && (e = this._node, null !== this._savedTabIndex ? e.setAttribute("tabindex", this._savedTabIndex) : e.removeAttribute("tabindex"), this._overrodeFocusMethod && delete e.focus), this._node = null, this._inertRoots = null, this._destroyed = !0 } }, { key: "_throwIfDestroyed", value: function () { if (this.destroyed) throw new Error("Trying to access destroyed InertNode") } }, { key: "ensureUntabbable", value: function () { var e; this.node.nodeType === Node.ELEMENT_NODE && (e = this.node, r.call(e, t) ? -1 === e.tabIndex && this.hasSavedTabIndex || (e.hasAttribute("tabindex") && (this._savedTabIndex = e.tabIndex), e.setAttribute("tabindex", "-1"), e.nodeType === Node.ELEMENT_NODE && (e.focus = function () { }, this._overrodeFocusMethod = !0)) : e.hasAttribute("tabindex") && (this._savedTabIndex = e.tabIndex, e.removeAttribute("tabindex"))) } }, { key: "addInertRoot", value: function (e) { this._throwIfDestroyed(), this._inertRoots.add(e) } }, { key: "removeInertRoot", value: function (e) { this._throwIfDestroyed(), this._inertRoots.delete(e), 0 === this._inertRoots.size && this.destructor() } }
2727, { key: "destroyed", get: function () { return this._destroyed } }, { key: "hasSavedTabIndex", get: function () { return null !== this._savedTabIndex } }, { key: "node", get: function () { return this._throwIfDestroyed(), this._node } }, { key: "savedTabIndex", set: function (e) { this._throwIfDestroyed(), this._savedTabIndex = e }, get: function () { return this._throwIfDestroyed(), this._savedTabIndex } }]), s = h, e(l, [{ key: "setInert", value: function (e, t) { if (t) { if (!this._inertRoots.has(e)) { t = new i(e, this); if (e.setAttribute("inert", ""), this._inertRoots.set(e, t), !this._document.body.contains(e)) for (var n = e.parentNode; n;)11 === n.nodeType && _(n), n = n.parentNode } } else this._inertRoots.has(e) && (this._inertRoots.get(e).destructor(), this._inertRoots.delete(e), e.removeAttribute("inert")) } }, { key: "getInertRoot", value: function (e) { return this._inertRoots.get(e) } }, { key: "register", value: function (e, t) { var n = this._managedNodes.get(e); return void 0 !== n ? n.addInertRoot(t) : n = new s(e, t), this._managedNodes.set(e, n), n } }, { key: "deregister", value: function (e, t) { var n = this._managedNodes.get(e); return n ? (n.removeInertRoot(t), n.destroyed && this._managedNodes.delete(e), n) : null } }, { key: "_onDocumentLoaded", value: function () { o.call(this._document.querySelectorAll("[inert]")).forEach(function (e) { this.setInert(e, !0) }, this), this._observer.observe(this._document.body || this._document.documentElement, { attributes: !0, subtree: !0, childList: !0 }) } }, { key: "_watchForInert", value: function (e, t) { var i = this; e.forEach(function (e) { switch (e.type) { case "childList": o.call(e.addedNodes).forEach(function (e) { var t; e.nodeType === Node.ELEMENT_NODE && (t = o.call(e.querySelectorAll("[inert]")), r.call(e, "[inert]") && t.unshift(e), t.forEach(function (e) { this.setInert(e, !0) }, i)) }, i); break; case "attributes": if ("inert" !== e.attributeName) return; var t = e.target, n = t.hasAttribute("inert"); i.setInert(t, n) } }, this) } }]), e = l, HTMLElement.prototype.hasOwnProperty("inert") || (n = new e(document), Object.defineProperty(HTMLElement.prototype, "inert", { enumerable: !0, get: function () { return this.hasAttribute("inert") }, set: function (e) { n.setInert(this, e) } }))) });
2728//# sourceMappingURL=inert.min.js.map;
2729/// <reference path="../../Common/Controls/jquery-ui-1.14.2/jquery-ui.js" />
2730if (!window.Core) {
2731	window.Core = new CoreNamespace();
2732}
2733
2734function AJAX(url, type, json, callBack, showLoadingMessage, contentType, forceCallBack, suppressErrorMessage) {
2735	contentType = contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
2736	showLoadingMessage = showLoadingMessage == null ? true : showLoadingMessage;
2737	forceCallBack = forceCallBack == null ? false : forceCallBack;
2738	if (typeof (suppressErrorMessage) === 'undefined') suppressErrorMessage = false;
2739	$.ajax({
2740		url: url,
2741		type: type,
2742		contentType: contentType,
2743		data: json,
2744		success: function (response) {
2745			if (response.ErrorMessage && !forceCallBack) {
2746				if (response.ErrorMessage.indexOf('You do not have permission to perform this action.') != -1 && !isUserLoggedIn()) { // 079B4F43 
2747					alert('You are not logged in. Please login to continue.');
2748					location.href = '/myaccount?from=url&url=' + window.location.pathname;
2749				} else {
2750					alert(response.ErrorMessage);
2751				}
2752			}
2753			else if (response.RedirectURL && !forceCallBack)
2754				window.location.href = response.RedirectURL;
2755			else if (callBack)
2756				callBack(response);
2757		},
2758		beforeSend: function () {
2759			if (showLoadingMessage) {
2760				ajaxPostBackStart('Loading');
2761			}
2762		},
2763		complete: function () {
2764			if (showLoadingMessage) {
2765				ajaxPostBackEnd();
2766			}
2767		},
2768		error: function (xhr, textStatus, exception) {
2769			if (!suppressErrorMessage) {
2770				alert('Error: ' + xhr.statusText + '\nStatus: ' + xhr.status);
2771			}
2772		}
2773	});
2774}
2775
2776function isUserLoggedIn() {
2777	var result = true; // if there is an error lets not show the login message.
2778	$.ajaxSetup({ async: false, ignoreEditor: true });
2779	$.post('/Utility/IsUserLoggedIn', function (data) {
2780		result = data;
2781	});
2782	$.ajaxSetup({ async: true, ignoreEditor: false });
2783	return result;
2784}
2785
2786///Method to pause a javascript execution for x seconds, works like sleep(). VB
2787function sleep(seconds) {
2788	var max_sec = new Date().getTime();
2789	while (new Date() < max_sec + seconds * 1000) { }
2790	return true;
2791}
2792
2793if (!String.prototype.format) {
2794	String.prototype.format = function () {
2795		var args = arguments;
2796		return this.replace(/{(\d+)}/g, function (match, number) {
2797			return typeof args[number] != 'undefined'
2798				? args[number]
2799				: match
2800				;
2801		});
2802	};
2803}
2804
2805if (!String.prototype.isNullOrWhiteSpace) {
2806	String.prototype.isNullOrWhiteSpace = function () {
2807		return this == null || this.trim() == '';
2808	};
2809}
2810
2811function isValidMoney(value) {
2812	var isValid = false;
2813	if (value && value != '')
2814		isValid = /^\$?\s*\d+(,\d{3})*(\.\d{1,2})?$/.test(value);
2815	return isValid;
2816};
2817
2818if (typeof String.prototype.startsWith != 'function') {
2819	String.prototype.startsWith = function (str) {
2820		return this.slice(0, str.length) == str;
2821	};
2822}
2823
2824String.prototype.format = String.prototype.f = function () {
2825	var s = this,
2826		i = arguments.length;
2827
2828	while (i--) {
2829		s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
2830	}
2831	return s;
2832};
2833
2834//Creates a javascript namespace, if one already exists, just returns that namespace.
2835function createNamespace(namespaceString) {
2836	var parts = namespaceString.split('.'),
2837		parent = window,
2838		currentPart = '',
2839		nsLength = parts.length;
2840
2841	for (var i = 0, length = nsLength; i < length; i++) {
2842		currentPart = parts[i];
2843		parent[currentPart] = parent[currentPart] || {};
2844		parent = parent[currentPart];
2845	}
2846	return parent;
2847}
2848$(function () {
2849
2850	// Ensures a dependency exists. If it doesn't acquire it.
2851	function ensure(dependencyExists, dependencyUrl, onceItExistsCallback) {
2852		if (dependencyExists) {
2853			onceItExistsCallback();
2854			return;
2855		}
2856		$.getScript(dependencyUrl, onceItExistsCallback);
2857	}
2858
2859	var ajaxControlToolkit = window.AjaxControlToolkit;
2860	// This is hack override in order to fix problems with Ajax Toolkit Drag and Drop in newer browsers. It substitutes in jQuery Draggable if it is available.
2861	// A more proper fix is ideal, but extremely expensive as it would require replacing over a hundred instances of invocations of the old modal.
2862	// There isn't a clean way to integrate in the new modal system. JE
2863	// https://system.netsuite.com/app/crm/support/issuedb/issue.nl?id=3809568&l=T
2864	if (ajaxControlToolkit && ajaxControlToolkit.ModalPopupBehavior) {
2865		ajaxControlToolkit.ModalPopupBehavior.prototype._attachPopup = function () {
2866			/// <summary>
2867			/// Attach the event handlers for the popup
2868			/// </summary>
2869
2870			if (this._DropShadow && !this._dropShadowBehavior) {
2871				this._dropShadowBehavior = $create(ajaxControlToolkit.DropShadowBehavior, {}, null, null, this._popupElement);
2872			}
2873
2874			var _this = this;
2875			// Drag and Drop Replacement. Acquire any dependencies on the fly.
2876			ensure($.ui, "/Common/Controls/jquery-ui-1.14.2/jquery-ui.min.js", function () {
2877				$("#" + _this._PopupControlID).draggable({ handle: '#' + _this._PopupDragHandleControlID });
2878				$("#" + _this._PopupDragHandleControlID).css('cursor', 'move');
2879			});
2880
2881			$addHandler(window, 'resize', this._resizeHandler);
2882			$addHandler(window, 'scroll', this._scrollHandler);
2883			this._windowHandlersAttached = true;
2884		}
2885	}
2886});
2887
2888String.prototype.replaceAll = function (search, replacement) {
2889	var target = this;
2890	return target.replace(new RegExp(search, 'g'), replacement);
2891};
2892
2893function executeViewMapPostClickActions($element) {
2894	//Hide the view map element post click(to avoid clicking repeatedly)
2895	$element.hide('fast');
2896
2897	//Collect analytics around map clicks
2898	var url = '/CollectGoogleMapClicks/Execute';
2899	var moduleId = $element.data('moduleid');
2900	$.ajax({
2901		url: url,
2902		type: 'POST',
2903		data: {
2904			url: window.location.href,
2905			moduleId: moduleId
2906		},
2907		success: function (json) {
2908			//send data to telemetry
2909			appInsights.trackEvent("googlemapclicked", json);
2910		},
2911		error: function (xhr, textStatus, exception) {
2912			alert("Error: " + xhr.statusText + "\nStatus: " + xhr.status);
2913		}
2914	});
2915}
2916
2917function importModal(options) {
2918	if (window.ImportModalInstance === undefined) {
2919		var script = document.createElement("script");
2920		script.onload = function () {
2921			window.ImportModalInstance.init(options);
2922		};
2923		script.src = "/Assets/Scripts/ImportModal.js";
2924		document.head.appendChild(script);
2925	}
2926	else
2927		window.ImportModalInstance.init(options);
2928}
2929
2930function exportModal(options) {
2931	if (window.ExportModalInstance === undefined) {
2932		var script = document.createElement("script");
2933		script.onload = function () {
2934			window.ExportModalInstance.init(options);
2935		};
2936		script.src = "/Assets/Scripts/ExportModal.js";
2937		document.head.appendChild(script);
2938	}
2939	else
2940		window.ExportModalInstance.init(options);
2941}
2942
2943document.addEventListener("DOMContentLoaded", function () {
2944	var modal = document.querySelector(".importModal");
2945	if (modal !== null) {
2946		try {
2947			if (!modal.classList.contains("processed")) {
2948				var options = modal.dataset.importconfig;
2949				if (options) {
2950					modal.addEventListener("click",
2951						function (e) {
2952							e.preventDefault();
2953							importModal(JSON.parse(options));
2954						});
2955					//Avoid further processing if the event gets triggered multiple times during page load
2956					modal.classList.add("processed");
2957				}
2958			}
2959		} catch (err) {
2960			console.error("Unable to initialize import modal");
2961		}
2962	}
2963	var modalExport = document.querySelector(".exportModal");
2964	if (modalExport !== null) {
2965		try {
2966			if (!modalExport.classList.contains("processed")) {
2967				var options = modalExport.dataset.exportconfig;
2968				if (options) {
2969					modalExport.addEventListener("click",
2970						function (e) {
2971							e.preventDefault();
2972							exportModal(JSON.parse(options));
2973						});
2974					//Avoid further processing if the event gets triggered multiple times during page load
2975					modalExport.classList.add("processed");
2976				}
2977			}
2978		} catch (err) {
2979			console.error("Unable to initialize export modal");
2980		}
2981	}
2982});
2983function FeatureTogglesClass() {
2984	this.features = null;
2985	this.callCount = 0;
2986
2987	this.GetFromLocalStorage = function (key, delegate, expire) {
2988		var cached = null;
2989
2990		// account for the case when cache is corrupt
2991		try {
2992			cached = JSON.parse(localStorage.getItem(key));
2993		} catch (error) {
2994			console.error("Cache is corrupt for", key);
2995			console.error(error);
2996		}
2997
2998		try {
2999			// try retrieving the values, either if it expired, missing or not an object.
3000			if (!cached || !cached.value || typeof cached.value !== "object" || expire(cached.timestamp)) {
3001				var value = delegate();
3002				// we expect object, so do not cache, if it is not an object or if it is empty
3003				if (value && typeof value === "object" && Object.keys(value).length > 0 && value.constructor === Object) {
3004					var toCache = JSON.stringify({
3005						value: value,
3006						timestamp: Date.now()
3007					});
3008					localStorage.setItem(key, toCache);
3009					return value;
3010				}
3011			}
3012			if (cached && cached.value && typeof cached.value === "object") {
3013				return cached.value;
3014			}
3015		} catch (err) {
3016			console.error("Unable to retrieve value for", key);
3017			console.error(err);
3018		}
3019		return null;
3020	}
3021
3022	this.getJsonSync = function () {
3023		var xhr = new XMLHttpRequest();
3024		xhr.open('GET', '/Toggle', false);
3025		xhr.send(null);
3026		return JSON.parse(xhr.responseText);
3027	};
3028
3029	// Expire method.
3030	this.expire = function (timestamp) {
3031		return !timestamp || timestamp < new Date().setHours(0, 0, 0, 0);
3032	}
3033
3034	this.isActive = function (featureName) {
3035		// If /toggle is failing and we do not have cached value, retry at most 4 times or bail out. 
3036		if (this.features === null && this.callCount < 4) {
3037			this.features = this.GetFromLocalStorage("FeatureToggles", this.getJsonSync, this.expire);
3038			this.callCount += 1;
3039		}
3040		return this.features !== null && !!this.features[featureName];
3041	};
3042}
3043
3044if (!window.FeatureToggles) {
3045	window.FeatureToggles = new FeatureTogglesClass();
3046};
3047function attrOrProps($element, key, value)
3048{
3049		//value can be null or undefined hence "=="
3050		if (value == null )
3051			return $element.prop(key);
3052		else
3053			$element.prop(key, value);
3054	}		
3055
3056function onOrLive($element, callback, event)
3057{	
3058	//jQuery 2.2.4 does not seem to fire correctly with the .on('load') syntax. .load() works instead. This will work up to jQuery3.0 (https://api.jquery.com/load-event/).
3059	//TODO: With next upgrade, we need to remove this if statment so that it goes back to using .on('load') syntax.
3060	if (event === 'load') {
3061		return $element.load(callback);
3062	}
3063
3064		return $element.off(event).on(event, callback);
3065}
3066		
3067function isResolvedOrState(element)
3068{
3069		return element.state() === "resolved";
3070}
3071
3072function removeAttrOrProps(element, key) {
3073		if (isNativeElementProperty(key))
3074			element.prop(key, false);
3075
3076		return element.removeProp(key);
3077	}
3078
3079function isNativeElementProperty(key)
3080{
3081	if (key === "checked" || key === "selected" || key === "disabled") //any native property of an element
3082		return true;
3083	return false;
3084}
3085
3086function cookieGet(key) {
3087		return Cookies.get(key);
3088	}
3089
3090function delegateOrOn($element,selector , event , handler) {
3091		 $element.on(event,selector,handler);
3092};
3093(function () {
3094
3095	var initDateTimePickers = function (dateTimePickers) {
3096		$(dateTimePickers).each(function (index, item) {
3097			var options = item.getAttribute("data-cp-datetimepicker");
3098
3099			options = options && JSON.parse(options) || {};
3100
3101			if (!options.timePicker) {
3102				//Item is date picker
3103				if (!options.overrideDayBeforeMonth && !options.format) {
3104					options.format = getDateFormat().toLowerCase()
3105				}
3106				else {
3107					options.format = 'mm/dd/yyyy';
3108				}
3109				if (options.rootContainer) {
3110					options.container = '#root-picker-outlet';
3111				}
3112				cp.datetimepicker?.createDatePicker('#' + item.id, options);
3113			}
3114			else {
3115				//Item is time picker
3116				options.format = 'h:i A';
3117				options.editable = true;
3118				cp.datetimepicker?.createTimePicker('#' + item.id, options);
3119			}
3120
3121		})
3122	};
3123
3124	var init = function () {
3125		var dateTimePickers = document.querySelectorAll('input[data-cp-datetimepicker]');
3126		if (dateTimePickers.length === 0 || window.cpDateTimePickerInitLock) {
3127			return;
3128		}
3129
3130		// Prevent script reinitialization, in case it is included multiple times
3131		if (window.cpDateTimePickerInit) {
3132			initDateTimePickers(dateTimePickers, true);
3133			return;
3134		}
3135		window.cpDateTimePickerInitLock = true;
3136		window.cpDateTimePickerInit = true;
3137
3138		var stylesheets = [
3139			"/Assets/AdminRefresh/DateTimePicker/dateTimePicker.css",
3140			"/Assets/Styles/DateTimePicker/cp.datetimepicker.css",
3141		];
3142		stylesheets.forEach(function (stylesheet) {
3143			var link = document.createElement("link");
3144			link.rel = "stylesheet";
3145			link.type = "text/css";
3146			link.href = stylesheet;
3147			document.head.appendChild(link);
3148		});
3149
3150		var javascripts = [
3151			"/Assets/Scripts/Flyout.js",
3152			"/Assets/Scripts/DateTimePicker/picker.min.js",
3153			"/Assets/Scripts/DateTimePicker/picker.date.min.js",
3154			"/Assets/Scripts/DateTimePicker/picker.time.min.js"
3155		];
3156		javascripts.forEach(function (ref) {
3157			var script = document.createElement("script");
3158			script.type = "text/javascript";
3159			script.src = ref;
3160			script.async = false;
3161			document.head.appendChild(script);
3162		});
3163		var script = document.createElement("script");
3164		script.onload = function () {
3165			initDateTimePickers(dateTimePickers);
3166			window.cpDateTimePickerInitLock = false;
3167		};
3168		script.src = "/Assets/Scripts/DateTimePicker/cp.datetimepicker.js";
3169		script.async = false;
3170		document.head.appendChild(script);
3171	};
3172
3173	window.initDateTimePickers = init;
3174
3175	init();
3176	document.addEventListener("DOMContentLoaded", init);
3177})();
3178;
3179var htmx=function(){"use strict";const Q={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){const n=cn(e,t||"post");return n.values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null,disableInheritance:false,responseHandling:[{code:"204",swap:false},{code:"[23]..",swap:true},{code:"[45]..",swap:false,error:true}],allowNestedOobSwaps:true},parseInterval:null,_:null,version:"2.0.4"};Q.onLoad=j;Q.process=kt;Q.on=ye;Q.off=be;Q.trigger=he;Q.ajax=Rn;Q.find=u;Q.findAll=x;Q.closest=g;Q.remove=z;Q.addClass=K;Q.removeClass=G;Q.toggleClass=W;Q.takeClass=Z;Q.swap=$e;Q.defineExtension=Fn;Q.removeExtension=Bn;Q.logAll=V;Q.logNone=_;Q.parseInterval=d;Q._=e;const n={addTriggerHandler:St,bodyContains:le,canAccessLocalStorage:B,findThisElement:Se,filterValues:hn,swap:$e,hasAttribute:s,getAttributeValue:te,getClosestAttributeValue:re,getClosestMatch:o,getExpressionVars:En,getHeaders:fn,getInputValues:cn,getInternalData:ie,getSwapSpecification:gn,getTriggerSpecs:st,getTarget:Ee,makeFragment:P,mergeObjects:ce,makeSettleInfo:xn,oobSwap:He,querySelectorExt:ae,settleImmediately:Kt,shouldCancel:ht,triggerEvent:he,triggerErrorEvent:fe,withExtensions:Ft};const r=["get","post","put","delete","patch"];const H=r.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e instanceof Element&&e.getAttribute(t)}function s(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function te(e,t){return ee(e,t)||ee(e,"data-"+t)}function c(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function ne(){return document}function m(e,t){return e.getRootNode?e.getRootNode({composed:t}):ne()}function o(e,t){while(e&&!t(e)){e=c(e)}return e||null}function i(e,t,n){const r=te(t,n);const o=te(t,"hx-disinherit");var i=te(t,"hx-inherit");if(e!==t){if(Q.config.disableInheritance){if(i&&(i==="*"||i.split(" ").indexOf(n)>=0)){return r}else{return null}}if(o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return"unset"}}return r}function re(t,n){let r=null;o(t,function(e){return!!(r=i(t,ue(e),n))});if(r!=="unset"){return r}}function h(e,t){const n=e instanceof Element&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function T(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else{return""}}function q(e){const t=new DOMParser;return t.parseFromString(e,"text/html")}function L(e,t){while(t.childNodes.length>0){e.append(t.childNodes[0])}}function A(e){const t=ne().createElement("script");se(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}return t}function N(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}
vendor: 6,136 bytes, line 3179
3179function I(e){Array.from(e.querySelectorAll("script")).forEach(e=>{if(N(e)){const t=A(e);const n=e.parentNode;try{n.insertBefore(t,e)}catch(e){O(e)}finally{e.remove()}}})}function P(e){const t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,"");const n=T(t);let r;if(n==="html"){r=new DocumentFragment;const i=q(e);L(r,i.body);r.title=i.title}else if(n==="body"){r=new DocumentFragment;const i=q(t);L(r,i.body);r.title=i.title}else{const i=q('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content;r.title=i.title;var o=r.querySelector("title");if(o&&o.parentNode===r){o.remove();r.title=o.innerText}}if(r){if(Q.config.allowScriptTags){I(r)}else{r.querySelectorAll("script").forEach(e=>e.remove())}}return r}function oe(e){if(e){e()}}function t(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function k(e){return typeof e==="function"}function D(e){return t(e,"Object")}function ie(e){const t="htmx-internal-data";let n=e[t];if(!n){n=e[t]={}}return n}function M(t){const n=[];if(t){for(let e=0;e<t.length;e++){n.push(t[e])}}return n}function se(t,n){if(t){for(let e=0;e<t.length;e++){n(t[e])}}}function X(e){const t=e.getBoundingClientRect();const n=t.top;const r=t.bottom;return n<window.innerHeight&&r>=0}function le(e){return e.getRootNode({composed:true})===document}function F(e){return e.trim().split(/\s+/)}function ce(e,t){for(const n in t){if(t.hasOwnProperty(n)){e[n]=t[n]}}return e}function S(e){try{return JSON.parse(e)}catch(e){O(e);return null}}function B(){const e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function U(t){try{const e=new URL(t);if(e){t=e.pathname+e.search}if(!/^\/$/.test(t)){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return vn(ne().body,function(){return eval(e)})}function j(t){const e=Q.on("htmx:load",function(e){t(e.detail.elt)});return e}function V(){Q.logger=function(e,t,n){if(console){console.log(t,e,n)}}}function _(){Q.logger=null}function u(e,t){if(typeof e!=="string"){return e.querySelector(t)}else{return u(ne(),e)}}function x(e,t){if(typeof e!=="string"){return e.querySelectorAll(t)}else{return x(ne(),e)}}function E(){return window}function z(e,t){e=y(e);if(t){E().setTimeout(function(){z(e);e=null},t)}else{c(e).removeChild(e)}}function ue(e){return e instanceof Element?e:null}function $(e){return e instanceof HTMLElement?e:null}function J(e){return typeof e==="string"?e:null}function f(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function K(e,t,n){e=ue(y(e));if(!e){return}if(n){E().setTimeout(function(){K(e,t);e=null},n)}else{e.classList&&e.classList.add(t)}}function G(e,t,n){let r=ue(y(e));if(!r){return}if(n){E().setTimeout(function(){G(r,t);r=null},n)}else{if(r.classList){r.classList.remove(t);if(r.classList.length===0){r.removeAttribute("class")}}}}function W(e,t){e=y(e);e.classList.toggle(t)}function Z(e,t){e=y(e);se(e.parentElement.children,function(e){G(e,t)});K(ue(e),t)}function g(e,t){e=ue(y(e));if(e&&e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&ue(c(e)));return null}}function l(e,t){return e.substring(0,t.length)===t}function Y(e,t){return e.substring(e.length-t.length)===t}function ge(e){const t=e.trim();if(l(t,"<")&&Y(t,"/>")){return t.substring(1,t.length-2)}else{return t}}function p(t,r,n){if(r.indexOf("global ")===0){return p(t,r.slice(7),true)}t=y(t);const o=[];{let t=0;let n=0;for(let e=0;e<r.length;e++){const l=r[e];if(l===","&&t===0){o.push(r.substring(n,e));n=e+1;continue}if(l==="<"){t++}else if(l==="/"&&e<r.length-1&&r[e+1]===">"){t--}}if(n<r.length){o.push(r.substring(n))}}const i=[];const s=[];while(o.length>0){const r=ge(o.shift());let e;if(r.indexOf("closest ")===0){e=g(ue(t),ge(r.substr(8)))}else if(r.indexOf("find ")===0){e=u(f(t),ge(r.substr(5)))}else if(r==="next"||r==="nextElementSibling"){e=ue(t).nextElementSibling}else if(r.indexOf("next ")===0){e=pe(t,ge(r.substr(5)),!!n)}else if(r==="previous"||r==="previousElementSibling"){e=ue(t).previousElementSibling}else if(r.indexOf("previous ")===0){e=me(t,ge(r.substr(9)),!!n)}else if(r==="document"){e=document}else if(r==="window"){e=window}else if(r==="body"){e=document.body}else if(r==="root"){e=m(t,!!n)}else if(r==="host"){e=t.getRootNode().host}else{s.push(r)}if(e){i.push(e)}}if(s.length>0){const e=s.join(",");const c=f(m(t,!!n));i.push(...M(c.querySelectorAll(e)))}return i}var pe=function(t,e,n){const r=f(m(t,n)).querySelectorAll(e);for(let e=0;e<r.length;e++){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_PRECEDING){return o}}};var me=function(t,e,n){const r=f(m(t,n)).querySelectorAll(e);for(let e=r.length-1;e>=0;e--){const o=r[e];if(o.compareDocumentPosition(t)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}};function ae(e,t){if(typeof e!=="string"){return p(e,t)[0]}else{return p(ne().body,e)[0]}}function y(e,t){if(typeof e==="string"){return u(f(t)||document,e)}else{return e}}function xe(e,t,n,r){if(k(t)){return{target:ne().body,event:J(e),listener:t,options:n}}else{return{target:y(e),event:J(t),listener:n,options:r}}}function ye(t,n,r,o){Vn(function(){const e=xe(t,n,r,o);e.target.addEventListener(e.event,e.listener,e.options)});const e=k(n);return e?n:r}function be(t,n,r){Vn(function(){const e=xe(t,n,r);e.target.removeEventListener(e.event,e.listener)});return k(n)?n:r}const ve=ne().createElement("output");function we(e,t){const n=re(e,t);if(n){if(n==="this"){return[Se(e,t)]}else{const r=p(e,n);if(r.length===0){O('The selector "'+n+'" on '+t+" returned no matches!");return[ve]}else{return r}}}}function Se(e,t){return ue(o(e,function(e){return te(ue(e),t)!=null}))}function Ee(e){const t=re(e,"hx-target");if(t){if(t==="this"){return Se(e,"hx-target")}else{return ae(e,t)}}else{const n=ie(e);if(n.boosted){return ne().body}else{return e}}}function Ce(t){const n=Q.config.attributesToSettle;for(let e=0;e<n.length;e++){if(t===n[e]){return true}}return false}function Oe(t,n){se(t.attributes,function(e){if(!n.hasAttribute(e.name)&&Ce(e.name)){t.removeAttribute(e.name)}
3179});se(n.attributes,function(e){if(Ce(e.name)){t.setAttribute(e.name,e.value)}})}function Re(t,e){const n=Un(e);for(let e=0;e<n.length;e++){const r=n[e];try{if(r.isInlineSwap(t)){return true}}catch(e){O(e)}}return t==="outerHTML"}function He(e,o,i,t){t=t||ne();let n="#"+ee(o,"id");let s="outerHTML";if(e==="true"){}else if(e.indexOf(":")>0){s=e.substring(0,e.indexOf(":"));n=e.substring(e.indexOf(":")+1)}else{s=e}o.removeAttribute("hx-swap-oob");o.removeAttribute("data-hx-swap-oob");const r=p(t,n,false);if(r){se(r,function(e){let t;const n=o.cloneNode(true);t=ne().createDocumentFragment();t.appendChild(n);if(!Re(s,e)){t=f(n)}const r={shouldSwap:true,target:e,fragment:t};if(!he(e,"htmx:oobBeforeSwap",r))return;e=r.target;if(r.shouldSwap){qe(t);_e(s,e,e,t,i);Te()}se(i.elts,function(e){he(e,"htmx:oobAfterSwap",r)})});o.parentNode.removeChild(o)}else{o.parentNode.removeChild(o);fe(ne().body,"htmx:oobErrorNoTarget",{content:o})}return e}function Te(){const e=u("#--htmx-preserve-pantry--");if(e){for(const t of[...e.children]){const n=u("#"+t.id);n.parentNode.moveBefore(t,n);n.remove()}e.remove()}}function qe(e){se(x(e,"[hx-preserve], [data-hx-preserve]"),function(e){const t=te(e,"id");const n=ne().getElementById(t);if(n!=null){if(e.moveBefore){let e=u("#--htmx-preserve-pantry--");if(e==null){ne().body.insertAdjacentHTML("afterend","<div id='--htmx-preserve-pantry--'></div>");e=u("#--htmx-preserve-pantry--")}e.moveBefore(n,null)}else{e.parentNode.replaceChild(n,e)}}})}function Le(l,e,c){se(e.querySelectorAll("[id]"),function(t){const n=ee(t,"id");if(n&&n.length>0){const r=n.replace("'","\\'");const o=t.tagName.replace(":","\\:");const e=f(l);const i=e&&e.querySelector(o+"[id='"+r+"']");if(i&&i!==e){const s=t.cloneNode();Oe(t,i);c.tasks.push(function(){Oe(t,s)})}}})}function Ae(e){return function(){G(e,Q.config.addedClass);kt(ue(e));Ne(f(e));he(e,"htmx:load")}}function Ne(e){const t="[autofocus]";const n=$(h(e,t)?e:e.querySelector(t));if(n!=null){n.focus()}}function a(e,t,n,r){Le(e,n,r);while(n.childNodes.length>0){const o=n.firstChild;K(ue(o),Q.config.addedClass);e.insertBefore(o,t);if(o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE){r.tasks.push(Ae(o))}}}function Ie(e,t){let n=0;while(n<e.length){t=(t<<5)-t+e.charCodeAt(n++)|0}return t}function Pe(t){let n=0;if(t.attributes){for(let e=0;e<t.attributes.length;e++){const r=t.attributes[e];if(r.value){n=Ie(r.name,n);n=Ie(r.value,n)}}}return n}function ke(t){const n=ie(t);if(n.onHandlers){for(let e=0;e<n.onHandlers.length;e++){const r=n.onHandlers[e];be(t,r.event,r.listener)}delete n.onHandlers}}function De(e){const t=ie(e);if(t.timeout){clearTimeout(t.timeout)}if(t.listenerInfos){se(t.listenerInfos,function(e){if(e.on){be(e.on,e.trigger,e.listener)}})}ke(e);se(Object.keys(t),function(e){if(e!=="firstInitCompleted")delete t[e]})}function b(e){he(e,"htmx:beforeCleanupElement");De(e);if(e.children){se(e.children,function(e){b(e)})}}function Me(t,e,n){if(t instanceof Element&&t.tagName==="BODY"){return Ve(t,e,n)}let r;const o=t.previousSibling;const i=c(t);if(!i){return}a(i,t,e,n);if(o==null){r=i.firstChild}else{r=o.nextSibling}n.elts=n.elts.filter(function(e){return e!==t});while(r&&r!==t){if(r instanceof Element){n.elts.push(r)}r=r.nextSibling}b(t);if(t instanceof Element){t.remove()}else{t.parentNode.removeChild(t)}}function Xe(e,t,n){return a(e,e.firstChild,t,n)}function Fe(e,t,n){return a(c(e),e,t,n)}function Be(e,t,n){return a(e,null,t,n)}function Ue(e,t,n){return a(c(e),e.nextSibling,t,n)}function je(e){b(e);const t=c(e);if(t){return t.removeChild(e)}}function Ve(e,t,n){const r=e.firstChild;a(e,r,t,n);if(r){while(r.nextSibling){b(r.nextSibling);e.removeChild(r.nextSibling)}b(r);e.removeChild(r)}}function _e(t,e,n,r,o){switch(t){case"none":return;case"outerHTML":Me(n,r,o);return;case"afterbegin":Xe(n,r,o);return;case"beforebegin":Fe(n,r,o);return;case"beforeend":Be(n,r,o);return;case"afterend":Ue(n,r,o);return;case"delete":je(n);return;default:var i=Un(e);for(let e=0;e<i.length;e++){const s=i[e];try{const l=s.handleSwap(t,n,r,o);if(l){if(Array.isArray(l)){for(let e=0;e<l.length;e++){const c=l[e];
vendor: 11,988 bytes, line 3179
3179if(c.nodeType!==Node.TEXT_NODE&&c.nodeType!==Node.COMMENT_NODE){o.tasks.push(Ae(c))}}}return}}catch(e){O(e)}}if(t==="innerHTML"){Ve(n,r,o)}else{_e(Q.config.defaultSwapStyle,e,n,r,o)}}}function ze(e,n,r){var t=x(e,"[hx-swap-oob], [data-hx-swap-oob]");se(t,function(e){if(Q.config.allowNestedOobSwaps||e.parentElement===null){const t=te(e,"hx-swap-oob");if(t!=null){He(t,e,n,r)}}else{e.removeAttribute("hx-swap-oob");e.removeAttribute("data-hx-swap-oob")}});return t.length>0}function $e(e,t,r,o){if(!o){o={}}e=y(e);const i=o.contextElement?m(o.contextElement,false):ne();const n=document.activeElement;let s={};try{s={elt:n,start:n?n.selectionStart:null,end:n?n.selectionEnd:null}}catch(e){}const l=xn(e);if(r.swapStyle==="textContent"){e.textContent=t}else{let n=P(t);l.title=n.title;if(o.selectOOB){const u=o.selectOOB.split(",");for(let t=0;t<u.length;t++){const a=u[t].split(":",2);let e=a[0].trim();if(e.indexOf("#")===0){e=e.substring(1)}const f=a[1]||"true";const h=n.querySelector("#"+e);if(h){He(f,h,l,i)}}}ze(n,l,i);se(x(n,"template"),function(e){if(e.content&&ze(e.content,l,i)){e.remove()}});if(o.select){const d=ne().createDocumentFragment();se(n.querySelectorAll(o.select),function(e){d.appendChild(e)});n=d}qe(n);_e(r.swapStyle,o.contextElement,e,n,l);Te()}if(s.elt&&!le(s.elt)&&ee(s.elt,"id")){const g=document.getElementById(ee(s.elt,"id"));const p={preventScroll:r.focusScroll!==undefined?!r.focusScroll:!Q.config.defaultFocusScroll};if(g){if(s.start&&g.setSelectionRange){try{g.setSelectionRange(s.start,s.end)}catch(e){}}g.focus(p)}}e.classList.remove(Q.config.swappingClass);se(l.elts,function(e){if(e.classList){e.classList.add(Q.config.settlingClass)}he(e,"htmx:afterSwap",o.eventInfo)});if(o.afterSwapCallback){o.afterSwapCallback()}if(!r.ignoreTitle){kn(l.title)}const c=function(){se(l.tasks,function(e){e.call()});se(l.elts,function(e){if(e.classList){e.classList.remove(Q.config.settlingClass)}he(e,"htmx:afterSettle",o.eventInfo)});if(o.anchor){const e=ue(y("#"+o.anchor));if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}yn(l.elts,r);if(o.afterSettleCallback){o.afterSettleCallback()}};if(r.settleDelay>0){E().setTimeout(c,r.settleDelay)}else{c()}}function Je(e,t,n){const r=e.getResponseHeader(t);if(r.indexOf("{")===0){const o=S(r);for(const i in o){if(o.hasOwnProperty(i)){let e=o[i];if(D(e)){n=e.target!==undefined?e.target:n}else{e={value:e}}he(n,i,e)}}}else{const s=r.split(",");for(let e=0;e<s.length;e++){he(n,s[e].trim(),[])}}}const Ke=/\s/;const v=/[\s,]/;const Ge=/[_$a-zA-Z]/;const We=/[_$a-zA-Z0-9]/;const Ze=['"',"'","/"];const w=/[^\s]/;const Ye=/[{(]/;const Qe=/[})]/;function et(e){const t=[];let n=0;while(n<e.length){if(Ge.exec(e.charAt(n))){var r=n;while(We.exec(e.charAt(n+1))){n++}t.push(e.substring(r,n+1))}else if(Ze.indexOf(e.charAt(n))!==-1){const o=e.charAt(n);var r=n;n++;while(n<e.length&&e.charAt(n)!==o){if(e.charAt(n)==="\\"){n++}n++}t.push(e.substring(r,n+1))}else{const i=e.charAt(n);t.push(i)}n++}return t}function tt(e,t,n){return Ge.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function nt(r,o,i){if(o[0]==="["){o.shift();let e=1;let t=" return (function("+i+"){ return (";let n=null;while(o.length>0){const s=o[0];if(s==="]"){e--;if(e===0){if(n===null){t=t+"true"}o.shift();t+=")})";try{const l=vn(r,function(){return Function(t)()},function(){return true});l.source=t;return l}catch(e){fe(ne().body,"htmx:syntax:error",{error:e,source:t});return null}}}else if(s==="["){e++}if(tt(s,n,i)){t+="(("+i+"."+s+") ? ("+i+"."+s+") : (window."+s+"))"}else{t=t+s}n=o.shift()}}}function C(e,t){let n="";while(e.length>0&&!t.test(e[0])){n+=e.shift()}return n}function rt(e){let t;if(e.length>0&&Ye.test(e[0])){e.shift();t=C(e,Qe).trim();e.shift()}else{t=C(e,v)}return t}const ot="input, textarea, select";function it(e,t,n){const r=[];const o=et(t);do{C(o,w);const l=o.length;const c=C(o,/[,\[\s]/);if(c!==""){if(c==="every"){const u={trigger:"every"};C(o,w);u.pollInterval=d(C(o,/[,\[\s]/));C(o,w);var i=nt(e,o,"event");if(i){u.eventFilter=i}r.push(u)}else{const a={trigger:c};var i=nt(e,o,"event");if(i){a.eventFilter=i}C(o,w);while(o.length>0&&o[0]!==","){const f=o.shift();if(f==="changed"){a.changed=true}else if(f==="once"){a.once=true}else if(f==="consume"){a.consume=true}else if(f==="delay"&&o[0]===":"){o.shift();a.delay=d(C(o,v))}else if(f==="from"&&o[0]===":"){o.shift();if(Ye.test(o[0])){var s=rt(o)}else{var s=C(o,v);if(s==="closest"||s==="find"||s==="next"||s==="previous"){o.shift();const h=rt(o);if(h.length>0){s+=" "+h}}}a.from=s}else if(f==="target"&&o[0]===":"){o.shift();a.target=rt(o)}else if(f==="throttle"&&o[0]===":"){o.shift();a.throttle=d(C(o,v))}else if(f==="queue"&&o[0]===":"){o.shift();a.queue=C(o,v)}else if(f==="root"&&o[0]===":"){o.shift();a[f]=rt(o)}else if(f==="threshold"&&o[0]===":"){o.shift();a[f]=C(o,v)}else{fe(e,"htmx:syntax:error",{token:o.shift()})}C(o,w)}r.push(a)}}if(o.length===l){fe(e,"htmx:syntax:error",{token:o.shift()})}C(o,w)}while(o[0]===","&&o.shift());if(n){n[t]=r}return r}function st(e){const t=te(e,"hx-trigger");let n=[];if(t){const r=Q.config.triggerSpecsCache;n=r&&r[t]||it(e,t,r)}if(n.length>0){return n}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,ot)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function lt(e){ie(e).cancelled=true}function ct(e,t,n){const r=ie(e);r.timeout=E().setTimeout(function(){if(le(e)&&r.cancelled!==true){if(!gt(n,e,Mt("hx:poll:trigger",{triggerSpec:n,target:e}))){t(e)}ct(e,t,n)}},n.pollInterval)}function ut(e){return location.hostname===e.hostname&&ee(e,"href")&&ee(e,"href").indexOf("#")!==0}function at(e){return g(e,Q.config.disableSelector)}function ft(t,n,e){if(t instanceof HTMLAnchorElement&&ut(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"&&String(ee(t,"method")).toLowerCase()!=="dialog"){n.boosted=true;let r,o;if(t.tagName==="A"){r="get";o=ee(t,"href")}else{const i=ee(t,"method");r=i?i.toLowerCase():"get";o=ee(t,"action");if(o==null||o===""){o=ne().location.href}if(r==="get"&&o.includes("?")){o=o.replace(/\?[^#]+/,"")}}e.forEach(function(e){pt(t,function(e,t){const n=ue(e);if(at(n)){b(n);return}de(r,o,n,t)},n,e,true)})}}function ht(e,t){const n=ue(t);if(!n){return false}if(e.type==="submit"||e.type==="click"){if(n.tagName==="FORM"){return true}if(h(n,'input[type="submit"], button')&&(h(n,"[form]")||g(n,"form")!==null)){return true}if(n instanceof HTMLAnchorElement&&n.href&&(n.getAttribute("href")==="#"||n.getAttribute("href").indexOf("#")!==0)){return true}}return false}function dt(e,t){return ie(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function gt(e,t,n){const r=e.eventFilter;if(r){try{return r.call(t,n)!==true}catch(e){const o=r.source;fe(ne().body,"htmx:eventFilter:error",{error:e,source:o});return true}}return false}function pt(l,c,e,u,a){const f=ie(l);let t;if(u.from){t=p(l,u.from)}else{t=[l]}if(u.changed){if(!("lastValue"in f)){f.lastValue=new WeakMap}t.forEach(function(e){if(!f.lastValue.has(u)){f.lastValue.set(u,new WeakMap)}f.lastValue.get(u).set(e,e.value)})}se(t,function(i){const s=function(e){if(!le(l)){i.removeEventListener(u.trigger,s);return}if(dt(l,e)){return}if(a||ht(e,l)){e.preventDefault()}if(gt(u,l,e)){return}const t=ie(e);t.triggerSpec=u;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(l)<0){t.handledFor.push(l);if(u.consume){e.stopPropagation()}if(u.target&&e.target){if(!h(ue(e.target),u.target)){return}}if(u.once){if(f.triggeredOnce){return}else{f.triggeredOnce=true}}if(u.changed){const n=event.target;const r=n.value;const o=f.lastValue.get(u);if(o.has(n)&&o.get(n)===r){return}o.set(n,r)}if(f.delayed){clearTimeout(f.delayed)}if(f.throttle){return}if(u.throttle>0){if(!f.throttle){he(l,"htmx:trigger");c(l,e);f.throttle=E().setTimeout(function(){f.throttle=null},u.throttle)}}else if(u.delay>0){f.delayed=E().setTimeout(function(){he(l,"htmx:trigger");c(l,e)},u.delay)}else{he(l,"htmx:trigger");c(l,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:u.trigger,listener:s,on:i});i.addEventListener(u.trigger,s)})}let mt=false;let xt=null;function yt(){if(!xt){xt=function(){mt=true};window.addEventListener("scroll",xt);window.addEventListener("resize",xt);setInterval(function(){if(mt){mt=false;se(ne().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){bt(e)})}},200)}}function bt(e){if(!s(e,"data-hx-revealed")&&X(e)){e.setAttribute("data-hx-revealed","true");const t=ie(e);if(t.initHash){he(e,"revealed")}else{e.addEventListener("htmx:afterProcessNode",function(){he(e,"revealed")},{once:true})}}}function vt(e,t,n,r){const o=function(){if(!n.loaded){n.loaded=true;he(e,"htmx:trigger");t(e)}};if(r>0){E().setTimeout(o,r)}else{o()}}function wt(t,n,e){let i=false;se(r,function(r){if(s(t,"hx-"+r)){const o=te(t,"hx-"+r);i=true;n.path=o;n.verb=r;e.forEach(function(e){St(t,e,n,function(e,t){const n=ue(e);if(g(n,Q.config.disableSelector)){b(n);return}de(r,o,n,t)})})}});return i}function St(r,e,t,n){if(e.trigger==="revealed"){yt();pt(r,n,t,e);bt(ue(r))}else if(e.trigger==="intersect"){const o={};if(e.root){o.root=ae(r,e.root)}if(e.threshold){o.threshold=parseFloat(e.threshold)}const i=new IntersectionObserver(function(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.isIntersecting){he(r,"intersect");break}}},o);i.observe(ue(r));pt(ue(r),n,t,e)}else if(!t.firstInitCompleted&&e.trigger==="load"){if(!gt(e,r,Mt("load",{elt:r}))){vt(ue(r),n,t,e.delay)}}else if(e.pollInterval>0){t.polling=true;ct(ue(r),n,e)}else{pt(r,n,t,e)}}function Et(e){const t=ue(e);if(!t){return false}const n=t.attributes;for(let e=0;e<n.length;e++){const r=n[e].name;if(l(r,"hx-on:")||l(r,"data-hx-on:")||l(r,"hx-on-")||l(r,"data-hx-on-")){return true}}return false}const Ct=(new XPathEvaluator).createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or'+' starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function Ot(e,t){if(Et(e)){t.push(ue(e))}const n=Ct.evaluate(e);let r=null;while(r=n.iterateNext())t.push(ue(r))}function Rt(e){const t=[];if(e instanceof DocumentFragment){for(const n of e.childNodes){Ot(n,t)}}else{Ot(e,t)}return t}function Ht(e){if(e.querySelectorAll){const n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]";const r=[];for(const i in Mn){const s=Mn[i];if(s.getSelectors){var t=s.getSelectors();if(t){r.push(t)}}}const o=e.querySelectorAll(H+n+", form, [type='submit'],"+" [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(e=>", "+e).join(""));return o}else{return[]}}function Tt(e){const t=g(ue(e.target),"button, input[type='submit']");const n=Lt(e);if(n){n.lastButtonClicked=t}}function qt(e){const t=Lt(e);if(t){t.lastButtonClicked=null}}function Lt(e){const t=g(ue(e.target),"button, input[type='submit']");if(!t){return}const n=y("#"+ee(t,"form"),t.getRootNode())||g(t,"form");if(!n){return}return ie(n)}function At(e){e.addEventListener("click",Tt);e.addEventListener("focusin",Tt);e.addEventListener("focusout",qt)}function Nt(t,e,n){const r=ie(t);if(!Array.isArray(r.onHandlers)){r.onHandlers=[]}let o;const i=function(e){vn(t,function(){if(at(t)){return}if(!o){o=new Function("event",n)}o.call(t,e)})};t.addEventListener(e,i);r.onHandlers.push({event:e,listener:i})}function It(t){ke(t);for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;const r=t.attributes[e].value;if(l(n,"hx-on")||l(n,"data-hx-on")){const o=n.indexOf("-on")+3;const i=n.slice(o,o+1);if(i==="-"||i===":"){let e=n.slice(o+1);if(l(e,":")){e="htmx"+e}else if(l(e,"-")){e="htmx:"+e.slice(1)}else if(l(e,"htmx-")){e="htmx:"+e.slice(5)}Nt(t,e,r)}}}}function Pt(t){if(g(t,Q.config.disableSelector)){b(t);return}const n=ie(t);const e=Pe(t);if(n.initHash!==e){De(t);n.initHash=e;he(t,"htmx:beforeProcessNode");const r=st(t);const o=wt(t,n,r);if(!o){if(re(t,"hx-boost")==="true"){ft(t,n,r)}
3179else if(s(t,"hx-trigger")){r.forEach(function(e){St(t,e,n,function(){})})}}if(t.tagName==="FORM"||ee(t,"type")==="submit"&&s(t,"form")){At(t)}n.firstInitCompleted=true;he(t,"htmx:afterProcessNode")}}function kt(e){e=y(e);if(g(e,Q.config.disableSelector)){b(e);return}Pt(e);se(Ht(e),function(e){Pt(e)});se(Rt(e),It)}function Dt(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Mt(e,t){let n;if(window.CustomEvent&&typeof window.CustomEvent==="function"){n=new CustomEvent(e,{bubbles:true,cancelable:true,composed:true,detail:t})}else{n=ne().createEvent("CustomEvent");n.initCustomEvent(e,true,true,t)}return n}function fe(e,t,n){he(e,t,ce({error:t},n))}function Xt(e){return e==="htmx:afterProcessNode"}function Ft(e,t){se(Un(e),function(e){try{t(e)}catch(e){O(e)}})}function O(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function he(e,t,n){e=y(e);if(n==null){n={}}n.elt=e;const r=Mt(t,n);if(Q.logger&&!Xt(t)){Q.logger(e,t,n)}if(n.error){O(n.error);he(e,"htmx:error",{errorInfo:n})}let o=e.dispatchEvent(r);const i=Dt(t);if(o&&i!==t){const s=Mt(i,r.detail);o=o&&e.dispatchEvent(s)}Ft(ue(e),function(e){o=o&&(e.onEvent(t,r)!==false&&!r.defaultPrevented)});return o}let Bt=location.pathname+location.search;function Ut(){const e=ne().querySelector("[hx-history-elt],[data-hx-history-elt]");return e||ne().body}function jt(t,e){if(!B()){return}const n=_t(e);const r=ne().title;const o=window.scrollY;if(Q.config.historyCacheSize<=0){localStorage.removeItem("htmx-history-cache");return}t=U(t);const i=S(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<i.length;e++){if(i[e].url===t){i.splice(e,1);break}}const s={url:t,content:n,title:r,scroll:o};he(ne().body,"htmx:historyItemCreated",{item:s,cache:i});i.push(s);while(i.length>Q.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){fe(ne().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Vt(t){if(!B()){return null}t=U(t);const n=S(localStorage.getItem("htmx-history-cache"))||[];for(let e=0;e<n.length;e++){if(n[e].url===t){return n[e]}}return null}function _t(e){const t=Q.config.requestClass;const n=e.cloneNode(true);se(x(n,"."+t),function(e){G(e,t)});se(x(n,"[data-disabled-by-htmx]"),function(e){e.removeAttribute("disabled")});return n.innerHTML}function zt(){const e=Ut();const t=Bt||location.pathname+location.search;let n;try{n=ne().querySelector('[hx-history="false" i],[data-hx-history="false" i]')}catch(e){n=ne().querySelector('[hx-history="false"],[data-hx-history="false"]')}if(!n){he(ne().body,"htmx:beforeHistorySave",{path:t,historyElt:e});jt(t,e)}if(Q.config.historyEnabled)history.replaceState({htmx:true},ne().title,window.location.href)}function $t(e){if(Q.config.getCacheBusterParam){e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,"");if(Y(e,"&")||Y(e,"?")){e=e.slice(0,-1)}}if(Q.config.historyEnabled){history.pushState({htmx:true},"",e)}Bt=e}function Jt(e){if(Q.config.historyEnabled)history.replaceState({htmx:true},"",e);Bt=e}function Kt(e){se(e,function(e){e.call(undefined)})}function Gt(o){const e=new XMLHttpRequest;const i={path:o,xhr:e};he(ne().body,"htmx:historyCacheMiss",i);e.open("GET",o,true);e.setRequestHeader("HX-Request","true");e.setRequestHeader("HX-History-Restore-Request","true");e.setRequestHeader("HX-Current-URL",ne().location.href);e.onload=function(){if(this.status>=200&&this.status<400){he(ne().body,"htmx:historyCacheMissLoad",i);const e=P(this.response);const t=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;const n=Ut();const r=xn(n);kn(e.title);qe(e);Ve(n,t,r);Te();Kt(r.tasks);Bt=o;he(ne().body,"htmx:historyRestore",{path:o,cacheMiss:true,serverResponse:this.response})}else{fe(ne().body,"htmx:historyCacheMissLoadError",i)}};e.send()}function Wt(e){zt();e=e||location.pathname+location.search;const t=Vt(e);if(t){const n=P(t.content);const r=Ut();const o=xn(r);kn(t.title);qe(n);Ve(r,n,o);Te();Kt(o.tasks);E().setTimeout(function(){window.scrollTo(0,t.scroll)},0);Bt=e;he(ne().body,"htmx:historyRestore",{path:e,item:t})}else{if(Q.config.refreshOnHistoryMiss){window.location.reload(true)}else{Gt(e)}}}function Zt(e){let t=we(e,"hx-indicator");if(t==null){t=[e]}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.classList.add.call(e.classList,Q.config.requestClass)});return t}function Yt(e){let t=we(e,"hx-disabled-elt");if(t==null){t=[]}se(t,function(e){const t=ie(e);t.requestCount=(t.requestCount||0)+1;e.setAttribute("disabled","");e.setAttribute("data-disabled-by-htmx","")});return t}function Qt(e,t){se(e.concat(t),function(e){const t=ie(e);t.requestCount=(t.requestCount||1)-1});se(e,function(e){const t=ie(e);if(t.requestCount===0){e.classList.remove.call(e.classList,Q.config.requestClass)}});se(t,function(e){const t=ie(e);if(t.requestCount===0){e.removeAttribute("disabled");e.removeAttribute("data-disabled-by-htmx")}})}function en(t,n){for(let e=0;e<t.length;e++){const r=t[e];if(r.isSameNode(n)){return true}}return false}function tn(e){const t=e;if(t.name===""||t.name==null||t.disabled||g(t,"fieldset[disabled]")){return false}if(t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"){return false}if(t.type==="checkbox"||t.type==="radio"){return t.checked}return true}function nn(t,e,n){if(t!=null&&e!=null){if(Array.isArray(e)){e.forEach(function(e){n.append(t,e)})}else{n.append(t,e)}}}function rn(t,n,r){if(t!=null&&n!=null){let e=r.getAll(t);if(Array.isArray(n)){e=e.filter(e=>n.indexOf(e)<0)}else{e=e.filter(e=>e!==n)}r.delete(t);se(e,e=>r.append(t,e))}}
vendor: 4,315 bytes, line 3179
3179function on(t,n,r,o,i){if(o==null||en(t,o)){return}else{t.push(o)}if(tn(o)){const s=ee(o,"name");let e=o.value;if(o instanceof HTMLSelectElement&&o.multiple){e=M(o.querySelectorAll("option:checked")).map(function(e){return e.value})}if(o instanceof HTMLInputElement&&o.files){e=M(o.files)}nn(s,e,n);if(i){sn(o,r)}}if(o instanceof HTMLFormElement){se(o.elements,function(e){if(t.indexOf(e)>=0){rn(e.name,e.value,n)}else{t.push(e)}if(i){sn(e,r)}});new FormData(o).forEach(function(e,t){if(e instanceof File&&e.name===""){return}nn(t,e,n)})}}function sn(e,t){const n=e;if(n.willValidate){he(n,"htmx:validation:validate");if(!n.checkValidity()){t.push({elt:n,message:n.validationMessage,validity:n.validity});he(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})}}}function ln(n,e){for(const t of e.keys()){n.delete(t)}e.forEach(function(e,t){n.append(t,e)});return n}function cn(e,t){const n=[];const r=new FormData;const o=new FormData;const i=[];const s=ie(e);if(s.lastButtonClicked&&!le(s.lastButtonClicked)){s.lastButtonClicked=null}let l=e instanceof HTMLFormElement&&e.noValidate!==true||te(e,"hx-validate")==="true";if(s.lastButtonClicked){l=l&&s.lastButtonClicked.formNoValidate!==true}if(t!=="get"){on(n,o,i,g(e,"form"),l)}on(n,r,i,e,l);if(s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&ee(e,"type")==="submit"){const u=s.lastButtonClicked||e;const a=ee(u,"name");nn(a,u.value,o)}const c=we(e,"hx-include");se(c,function(e){on(n,r,i,ue(e),l);if(!h(e,"form")){se(f(e).querySelectorAll(ot),function(e){on(n,r,i,e,l)})}});ln(r,o);return{errors:i,formData:r,values:An(r)}}function un(e,t,n){if(e!==""){e+="&"}if(String(n)==="[object Object]"){n=JSON.stringify(n)}const r=encodeURIComponent(n);e+=encodeURIComponent(t)+"="+r;return e}function an(e){e=qn(e);let n="";e.forEach(function(e,t){n=un(n,t,e)});return n}function fn(e,t,n){const r={"HX-Request":"true","HX-Trigger":ee(e,"id"),"HX-Trigger-Name":ee(e,"name"),"HX-Target":te(t,"id"),"HX-Current-URL":ne().location.href};bn(e,"hx-headers",false,r);if(n!==undefined){r["HX-Prompt"]=n}if(ie(e).boosted){r["HX-Boosted"]="true"}return r}function hn(n,e){const t=re(e,"hx-params");if(t){if(t==="none"){return new FormData}else if(t==="*"){return n}else if(t.indexOf("not ")===0){se(t.slice(4).split(","),function(e){e=e.trim();n.delete(e)});return n}else{const r=new FormData;se(t.split(","),function(t){t=t.trim();if(n.has(t)){n.getAll(t).forEach(function(e){r.append(t,e)})}});return r}}else{return n}}function dn(e){return!!ee(e,"href")&&ee(e,"href").indexOf("#")>=0}function gn(e,t){const n=t||re(e,"hx-swap");const r={swapStyle:ie(e).boosted?"innerHTML":Q.config.defaultSwapStyle,swapDelay:Q.config.defaultSwapDelay,settleDelay:Q.config.defaultSettleDelay};if(Q.config.scrollIntoViewOnBoost&&ie(e).boosted&&!dn(e)){r.show="top"}if(n){const s=F(n);if(s.length>0){for(let e=0;e<s.length;e++){const l=s[e];if(l.indexOf("swap:")===0){r.swapDelay=d(l.slice(5))}else if(l.indexOf("settle:")===0){r.settleDelay=d(l.slice(7))}else if(l.indexOf("transition:")===0){r.transition=l.slice(11)==="true"}else if(l.indexOf("ignoreTitle:")===0){r.ignoreTitle=l.slice(12)==="true"}else if(l.indexOf("scroll:")===0){const c=l.slice(7);var o=c.split(":");const u=o.pop();var i=o.length>0?o.join(":"):null;r.scroll=u;r.scrollTarget=i}else if(l.indexOf("show:")===0){const a=l.slice(5);var o=a.split(":");const f=o.pop();var i=o.length>0?o.join(":"):null;r.show=f;r.showTarget=i}else if(l.indexOf("focus-scroll:")===0){const h=l.slice("focus-scroll:".length);r.focusScroll=h=="true"}else if(e==0){r.swapStyle=l}else{O("Unknown modifier in hx-swap: "+l)}}}}return r}function pn(e){return re(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&ee(e,"enctype")==="multipart/form-data"}function mn(t,n,r){let o=null;Ft(n,function(e){if(o==null){o=e.encodeParameters(t,r,n)}});if(o!=null){return o}else{if(pn(n)){return ln(new FormData,qn(r))}else{return an(r)}}}function xn(e){return{tasks:[],elts:[e]}}function yn(e,t){const n=e[0];const r=e[e.length-1];if(t.scroll){var o=null;if(t.scrollTarget){o=ue(ae(n,t.scrollTarget))}if(t.scroll==="top"&&(n||o)){o=o||n;o.scrollTop=0}if(t.scroll==="bottom"&&(r||o)){o=o||r;o.scrollTop=o.scrollHeight}}if(t.show){var o=null;if(t.showTarget){let e=t.showTarget;if(t.showTarget==="window"){e="body"}
3179o=ue(ae(n,e))}if(t.show==="top"&&(n||o)){o=o||n;o.scrollIntoView({block:"start",behavior:Q.config.scrollBehavior})}if(t.show==="bottom"&&(r||o)){o=o||r;o.scrollIntoView({block:"end",behavior:Q.config.scrollBehavior})}}}function bn(r,e,o,i){if(i==null){i={}}if(r==null){return i}const s=te(r,e);if(s){let e=s.trim();let t=o;if(e==="unset"){return null}if(e.indexOf("javascript:")===0){e=e.slice(11);t=true}else if(e.indexOf("js:")===0){e=e.slice(3);t=true}if(e.indexOf("{")!==0){e="{"+e+"}"}let n;if(t){n=vn(r,function(){return Function("return ("+e+")")()},{})}else{n=S(e)}for(const l in n){if(n.hasOwnProperty(l)){if(i[l]==null){i[l]=n[l]}}}}return bn(ue(c(r)),e,o,i)}function vn(e,t,n){if(Q.config.allowEval){return t()}else{fe(e,"htmx:evalDisallowedError");return n}}function wn(e,t){return bn(e,"hx-vars",true,t)}function Sn(e,t){return bn(e,"hx-vals",false,t)}function En(e){return ce(wn(e),Sn(e))}function Cn(t,n,r){if(r!==null){try{t.setRequestHeader(n,r)}catch(e){t.setRequestHeader(n,encodeURIComponent(r));t.setRequestHeader(n+"-URI-AutoEncoded","true")}}}function On(t){if(t.responseURL&&typeof URL!=="undefined"){try{const e=new URL(t.responseURL);return e.pathname+e.search}catch(e){fe(ne().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function R(e,t){return t.test(e.getAllResponseHeaders())}function Rn(t,n,r){t=t.toLowerCase();if(r){if(r instanceof Element||typeof r==="string"){return de(t,n,null,null,{targetOverride:y(r)||ve,returnPromise:true})}else{let e=y(r.target);if(r.target&&!e||r.source&&!e&&!y(r.source)){e=ve}return de(t,n,y(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:e,swapOverride:r.swap,select:r.select,returnPromise:true})}}else{return de(t,n,null,null,{returnPromise:true})}}function Hn(e){const t=[];while(e){t.push(e);e=e.parentElement}return t}function Tn(e,t,n){let r;let o;if(typeof URL==="function"){o=new URL(t,document.location.href);const i=document.location.origin;r=i===o.origin}else{o=t;r=l(t,document.location.origin)}if(Q.config.selfRequestsOnly){if(!r){return false}}return he(e,"htmx:validateUrl",ce({url:o,sameHost:r},n))}function qn(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e){if(e.hasOwnProperty(n)){if(e[n]&&typeof e[n].forEach==="function"){e[n].forEach(function(e){t.append(n,e)})}else if(typeof e[n]==="object"&&!(e[n]instanceof Blob)){t.append(n,JSON.stringify(e[n]))}else{t.append(n,e[n])}}}return t}function Ln(r,o,e){return new Proxy(e,{get:function(t,e){if(typeof e==="number")return t[e];if(e==="length")return t.length;if(e==="push"){return function(e){t.push(e);r.append(o,e)}}if(typeof t[e]==="function"){return function(){t[e].apply(t,arguments);r.delete(o);t.forEach(function(e){r.append(o,e)})}}if(t[e]&&t[e].length===1){return t[e][0]}else{return t[e]}},set:function(e,t,n){e[t]=n;r.delete(o);e.forEach(function(e){r.append(o,e)});return true}})}function An(o){return new Proxy(o,{get:function(e,t){if(typeof t==="symbol"){const r=Reflect.get(e,t);if(typeof r==="function"){return function(){return r.apply(o,arguments)}}else{return r}}if(t==="toJSON"){return()=>Object.fromEntries(o)}if(t in e){if(typeof e[t]==="function"){return function(){return o[t].apply(o,arguments)}}else{return e[t]}}const n=o.getAll(t);if(n.length===0){return undefined}else if(n.length===1){return n[0]}else{return Ln(e,t,n)}},set:function(t,n,e){if(typeof n!=="string"){return false}t.delete(n);if(e&&typeof e.forEach==="function"){e.forEach(function(e){t.append(n,e)})}else if(typeof e==="object"&&!(e instanceof Blob)){t.append(n,JSON.stringify(e))}else{t.append(n,e)}return true},deleteProperty:function(e,t){if(typeof t==="string"){e.delete(t)}return true},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function de(t,n,r,o,i,D){let s=null;let l=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var e=new Promise(function(e,t){s=e;l=t})}if(r==null){r=ne().body}const M=i.handler||Dn;const X=i.select||null;if(!le(r)){oe(s);return e}const c=i.targetOverride||ue(Ee(r));if(c==null||c==ve){fe(r,"htmx:targetError",{target:te(r,"hx-target")});oe(l);return e}let u=ie(r);const a=u.lastButtonClicked;if(a){const L=ee(a,"formaction");if(L!=null){n=L}const A=ee(a,"formmethod");if(A!=null){if(A.toLowerCase()!=="dialog"){t=A}}}const f=re(r,"hx-confirm");if(D===undefined){const K=function(e){return de(t,n,r,o,i,!!e)};const G={target:c,elt:r,path:n,verb:t,triggeringEvent:o,etc:i,issueRequest:K,question:f};if(he(r,"htmx:confirm",G)===false){oe(s);return e}}let h=r;let d=re(r,"hx-sync");let g=null;let F=false;
3179if(d){const N=d.split(":");const I=N[0].trim();if(I==="this"){h=Se(r,"hx-sync")}else{h=ue(ae(r,I))}d=(N[1]||"drop").trim();u=ie(h);if(d==="drop"&&u.xhr&&u.abortable!==true){oe(s);return e}else if(d==="abort"){if(u.xhr){oe(s);return e}else{F=true}}else if(d==="replace"){he(h,"htmx:abort")}else if(d.indexOf("queue")===0){const W=d.split(" ");g=(W[1]||"last").trim()}}if(u.xhr){if(u.abortable){he(h,"htmx:abort")}else{if(g==null){if(o){const P=ie(o);if(P&&P.triggerSpec&&P.triggerSpec.queue){g=P.triggerSpec.queue}}if(g==null){g="last"}}if(u.queuedRequests==null){u.queuedRequests=[]}if(g==="first"&&u.queuedRequests.length===0){u.queuedRequests.push(function(){de(t,n,r,o,i)})}else if(g==="all"){u.queuedRequests.push(function(){de(t,n,r,o,i)})}else if(g==="last"){u.queuedRequests=[];u.queuedRequests.push(function(){de(t,n,r,o,i)})}oe(s);return e}}const p=new XMLHttpRequest;u.xhr=p;u.abortable=F;const m=function(){u.xhr=null;u.abortable=false;if(u.queuedRequests!=null&&u.queuedRequests.length>0){const e=u.queuedRequests.shift();e()}};const B=re(r,"hx-prompt");if(B){var x=prompt(B);if(x===null||!he(r,"htmx:prompt",{prompt:x,target:c})){oe(s);m();return e}}if(f&&!D){if(!confirm(f)){oe(s);m();return e}}let y=fn(r,c,x);if(t!=="get"&&!pn(r)){y["Content-Type"]="application/x-www-form-urlencoded"}if(i.headers){y=ce(y,i.headers)}const U=cn(r,t);let b=U.errors;const j=U.formData;if(i.values){ln(j,qn(i.values))}const V=qn(En(r));const v=ln(j,V);let w=hn(v,r);if(Q.config.getCacheBusterParam&&t==="get"){w.set("org.htmx.cache-buster",ee(c,"id")||"true")}if(n==null||n===""){n=ne().location.href}const S=bn(r,"hx-request");const _=ie(r).boosted;let E=Q.config.methodsThatUseUrlParams.indexOf(t)>=0;const C={boosted:_,useUrlParams:E,formData:w,parameters:An(w),unfilteredFormData:v,unfilteredParameters:An(v),headers:y,target:c,verb:t,errors:b,withCredentials:i.credentials||S.credentials||Q.config.withCredentials,timeout:i.timeout||S.timeout||Q.config.timeout,path:n,triggeringEvent:o};if(!he(r,"htmx:configRequest",C)){oe(s);m();return e}n=C.path;t=C.verb;y=C.headers;w=qn(C.parameters);b=C.errors;E=C.useUrlParams;if(b&&b.length>0){he(r,"htmx:validation:halted",C);oe(s);m();return e}const z=n.split("#");const $=z[0];const O=z[1];let R=n;if(E){R=$;const Z=!w.keys().next().done;if(Z){if(R.indexOf("?")<0){R+="?"}else{R+="&"}R+=an(w);if(O){R+="#"+O}}}if(!Tn(r,R,C)){fe(r,"htmx:invalidPath",C);oe(l);return e}p.open(t.toUpperCase(),R,true);p.overrideMimeType("text/html");p.withCredentials=C.withCredentials;p.timeout=C.timeout;if(S.noHeaders){}else{for(const k in y){if(y.hasOwnProperty(k)){const Y=y[k];Cn(p,k,Y)}}}const H={xhr:p,target:c,requestConfig:C,etc:i,boosted:_,select:X,pathInfo:{requestPath:n,finalRequestPath:R,responsePath:null,anchor:O}};p.onload=function(){try{const t=Hn(r);H.pathInfo.responsePath=On(p);M(r,H);if(H.keepIndicators!==true){Qt(T,q)}he(r,"htmx:afterRequest",H);he(r,"htmx:afterOnLoad",H);if(!le(r)){let e=null;while(t.length>0&&e==null){const n=t.shift();if(le(n)){e=n}}if(e){he(e,"htmx:afterRequest",H);he(e,"htmx:afterOnLoad",H)}}oe(s);m()}catch(e){fe(r,"htmx:onLoadError",ce({error:e},H));throw e}};p.onerror=function(){Qt(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:sendError",H);oe(l);m()};p.onabort=function(){Qt(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:sendAbort",H);oe(l);m()};p.ontimeout=function(){Qt(T,q);fe(r,"htmx:afterRequest",H);fe(r,"htmx:timeout",H);oe(l);m()};if(!he(r,"htmx:beforeRequest",H)){oe(s);m();return e}var T=Zt(r);var q=Yt(r);se(["loadstart","loadend","progress","abort"],function(t){se([p,p.upload],function(e){e.addEventListener(t,function(e){he(r,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});he(r,"htmx:beforeSend",H);const J=E?null:mn(p,r,w);p.send(J);return e}function Nn(e,t){const n=t.xhr;let r=null;let o=null;if(R(n,/HX-Push:/i)){r=n.getResponseHeader("HX-Push");o="push"}else if(R(n,/HX-Push-Url:/i)){r=n.getResponseHeader("HX-Push-Url");o="push"}else if(R(n,/HX-Replace-Url:/i)){r=n.getResponseHeader("HX-Replace-Url");o="replace"}if(r){if(r==="false"){return{}}else{return{type:o,path:r}}}const i=t.pathInfo.finalRequestPath;const s=t.pathInfo.responsePath;const l=re(e,"hx-push-url");const c=re(e,"hx-replace-url");const u=ie(e).boosted;let a=null;let f=null;if(l){a="push";f=l}else if(c){a="replace";f=c}else if(u){a="push";f=s||i}if(f){if(f==="false"){return{}}if(f==="true"){f=s||i}
3179if(t.pathInfo.anchor&&f.indexOf("#")===-1){f=f+"#"+t.pathInfo.anchor}return{type:a,path:f}}else{return{}}}function In(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function Pn(e){for(var t=0;t<Q.config.responseHandling.length;t++){var n=Q.config.responseHandling[t];if(In(n,e.status)){return n}}return{swap:false}}function kn(e){if(e){const t=u("title");if(t){t.innerHTML=e}else{window.document.title=e}}}function Dn(o,i){const s=i.xhr;let l=i.target;const e=i.etc;const c=i.select;if(!he(o,"htmx:beforeOnLoad",i))return;if(R(s,/HX-Trigger:/i)){Je(s,"HX-Trigger",o)}if(R(s,/HX-Location:/i)){zt();let e=s.getResponseHeader("HX-Location");var t;if(e.indexOf("{")===0){t=S(e);e=t.path;delete t.path}Rn("get",e,t).then(function(){$t(e)});return}const n=R(s,/HX-Refresh:/i)&&s.getResponseHeader("HX-Refresh")==="true";if(R(s,/HX-Redirect:/i)){i.keepIndicators=true;location.href=s.getResponseHeader("HX-Redirect");n&&location.reload();return}if(n){i.keepIndicators=true;location.reload();return}if(R(s,/HX-Retarget:/i)){if(s.getResponseHeader("HX-Retarget")==="this"){i.target=o}else{i.target=ue(ae(o,s.getResponseHeader("HX-Retarget")))}}const u=Nn(o,i);const r=Pn(s);const a=r.swap;let f=!!r.error;let h=Q.config.ignoreTitle||r.ignoreTitle;let d=r.select;if(r.target){i.target=ue(ae(o,r.target))}var g=e.swapOverride;if(g==null&&r.swapOverride){g=r.swapOverride}if(R(s,/HX-Retarget:/i)){if(s.getResponseHeader("HX-Retarget")==="this"){i.target=o}else{i.target=ue(ae(o,s.getResponseHeader("HX-Retarget")))}}if(R(s,/HX-Reswap:/i)){g=s.getResponseHeader("HX-Reswap")}var p=s.response;var m=ce({shouldSwap:a,serverResponse:p,isError:f,ignoreTitle:h,selectOverride:d,swapOverride:g},i);if(r.event&&!he(l,r.event,m))return;if(!he(l,"htmx:beforeSwap",m))return;l=m.target;p=m.serverResponse;f=m.isError;h=m.ignoreTitle;d=m.selectOverride;g=m.swapOverride;i.target=l;i.failed=f;i.successful=!f;if(m.shouldSwap){if(s.status===286){lt(o)}Ft(o,function(e){p=e.transformResponse(p,s,o)});if(u.type){zt()}var x=gn(o,g);if(!x.hasOwnProperty("ignoreTitle")){x.ignoreTitle=h}l.classList.add(Q.config.swappingClass);let n=null;let r=null;if(c){d=c}if(R(s,/HX-Reselect:/i)){d=s.getResponseHeader("HX-Reselect")}const y=re(o,"hx-select-oob");const b=re(o,"hx-select");let e=function(){try{if(u.type){he(ne().body,"htmx:beforeHistoryUpdate",ce({history:u},i));if(u.type==="push"){$t(u.path);he(ne().body,"htmx:pushedIntoHistory",{path:u.path})}else{Jt(u.path);he(ne().body,"htmx:replacedInHistory",{path:u.path})}}$e(l,p,x,{select:d||b,selectOOB:y,eventInfo:i,anchor:i.pathInfo.anchor,contextElement:o,afterSwapCallback:function(){if(R(s,/HX-Trigger-After-Swap:/i)){let e=o;if(!le(o)){e=ne().body}Je(s,"HX-Trigger-After-Swap",e)}},afterSettleCallback:function(){if(R(s,/HX-Trigger-After-Settle:/i)){let e=o;if(!le(o)){e=ne().body}Je(s,"HX-Trigger-After-Settle",e)}oe(n)}})}catch(e){fe(o,"htmx:swapError",i);oe(r);throw e}};let t=Q.config.globalViewTransitions;if(x.hasOwnProperty("transition")){t=x.transition}if(t&&he(o,"htmx:beforeTransition",i)&&typeof Promise!=="undefined"&&document.startViewTransition){const v=new Promise(function(e,t){n=e;r=t});const w=e;e=function(){document.startViewTransition(function(){w();return v})}}if(x.swapDelay>0){E().setTimeout(e,x.swapDelay)}else{e()}}if(f){fe(o,"htmx:responseError",ce({error:"Response Status Error Code "+s.status+" from "+i.pathInfo.requestPath},i))}}const Mn={};function Xn(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,n,r){return false},encodeParameters:function(e,t,n){return null}}}function Fn(e,t){if(t.init){t.init(n)}Mn[e]=ce(Xn(),t)}function Bn(e){delete Mn[e]}function Un(e,n,r){if(n==undefined){n=[]}if(e==undefined){return n}if(r==undefined){r=[]}const t=te(e,"hx-ext");if(t){se(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){r.push(e.slice(7));return}if(r.indexOf(e)<0){const t=Mn[e];if(t&&n.indexOf(t)<0){n.push(t)}}})}return Un(ue(c(e)),n,r)}var jn=false;ne().addEventListener("DOMContentLoaded",function(){jn=true});function Vn(e){if(jn||ne().readyState==="complete"){e()}else{ne().addEventListener("DOMContentLoaded",e)}}function _n(){if(Q.config.includeIndicatorStyles!==false){const e=Q.c
3179onfig.inlineStyleNonce?` nonce="${Q.config.inlineStyleNonce}"`:"";ne().head.insertAdjacentHTML("beforeend","<style"+e+">      ."+Q.config.indicatorClass+"{opacity:0}      ."+Q.config.requestClass+" ."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;}      ."+Q.config.requestClass+"."+Q.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;}      </style>")}}function zn(){const e=ne().querySelector('meta[name="htmx-config"]');if(e){return S(e.content)}else{return null}}function $n(){const e=zn();if(e){Q.config=ce(Q.config,e)}}Vn(function(){$n();_n();let e=ne().body;kt(e);const t=ne().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){const t=e.target;const n=ie(t);if(n&&n.xhr){n.xhr.abort()}});const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){if(e.state&&e.state.htmx){Wt();se(t,function(e){he(e,"htmx:restored",{document:ne(),triggerEvent:he})})}else{if(n){n(e)}}};E().setTimeout(function(){he(e,"htmx:load",{});e=null},0)});return Q}();
3180var ApplicationConfiguration = (function () {
3181	requestWebFonts();
3182
3183	return {
3184		accordionPanelDelay: 400
3185	};
3186})();
3187
3188WebFontConfig = {
3189	google: {
3190		families: ['Muli:300,400,400i,700']
3191	},
3192	/* Called when all of the web fonts have either finished loading or failed to load, as long as at least one loaded successfully. */
3193	active: function () {
3194		// do something
3195		$('html').addClass('has-webFonts');
3196
3197		setCookie("CP_HasWebFonts", "true", 30);
3198	}
3199};
3200
3201function requestWebFonts() {
3202	var wf = document.createElement('script');
3203	wf.src = '/Assets/Mystique/Shared/Scripts/webfontloader/webfont.js';
3204	wf.type = 'text/javascript';
3205	wf.async = 'true';
3206	var s = document.getElementsByTagName('script')[0];
3207	s.parentNode.insertBefore(wf, s);
3208};
3209
3210function setCookie(cname, cvalue, exdays) {
3211	var d = new Date();
3212	d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
3213	var expires = "expires=" + d.toUTCString();
3214	document.cookie = cname + "=" + cvalue + "; " + expires;
3215}
3216
3217function getCookie(cname) {
3218	var name = cname + "=";
3219	var ca = document.cookie.split(';');
3220	for (var i = 0; i < ca.length; i++) {
3221		var c = ca[i];
3222		while (c.charAt(0) == ' ') c = c.substring(1);
3223		if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
3224	}
3225	return "";
3226};
3227function loadScript(url, callback) {
3228    var script = document.createElement('script');
3229    script.src = url;
3230    script.async = false;
3231    script.defer = true;
3232    script.onload = callback;
3233    document.head.appendChild(script);
3234}
3235
3236function initSwitcher(accessToken, endpoint, orgId) {
3237    if (!accessToken || !orgId) {
3238        return;
3239    }
3240
3241    function execSwitcher(CivicPlusSwitchers) {
3242        CivicPlusSwitchers.init({
3243            orgService: {
3244                accessToken: accessToken,
3245                endpoint: endpoint,
3246            },
3247            initialOrg: orgId,
3248            specificity: 3,
3249            cssReset: true,
3250            product: "engageCentral"
3251        });
3252    }
3253
3254    if (typeof CivicPlusSwitchers === "object") {
3255        execSwitcher(CivicPlusSwitchers);
3256        return;
3257    }
3258
3259    if (typeof require === "function") {
3260        require(["CivicPlusSwitchers"], execSwitcher);
3261        return;
3262    }
3263
3264    console.error("CivicPlusSwitchers is undefined");
3265}
3266
3267function fetchSwitcherParams() {
3268    var xhr = new XMLHttpRequest();
3269    xhr.open('GET', '/Admin/Toolbar/Menu/AppSwitcherParams', true);
3270    xhr.setRequestHeader('ShowLoading', 'false');
3271    xhr.setRequestHeader('Cache-Control', 'no-cache');
3272
3273    xhr.onload = function () {
3274        if (xhr.status >= 200 && xhr.status < 300) {
3275            var data = JSON.parse(xhr.responseText);
3276            var url = "https://civicplussharedstorageqa.azureedge.net/preamble/CivicPlusSwitchers.js"
3277            if (!window.FeatureToggles.isActive("CMS.Site.NewAppSwitcher")) {
3278                url = "https://civicplussharedstorageqa.blob.core.windows.net/preamble/CivicPlusSwitchers.js";
3279            }
3280            loadScript(url, function () {
3281                initSwitcher(data.Token, data.Endpoint, data.OrganizationId);
3282            });
3283        } else {
3284            console.error('Failed to fetch switcher params');
3285        }
3286    };
3287
3288    xhr.onerror = function () {
3289        console.error('Request error');
3290    };
3291
3292    xhr.send();
3293}
3294;
3295// session-timeout.js — improved and defensive version
3296// Test hook for shortening client-side timings without changing server defaults.
3297const sessionTimeoutConfig = window.CP_SESSION_TIMEOUT_CONFIG || {};
3298
3299// How long before true expiry we warn the user and start the countdown modal.
3300const sessionTimeoutWarning = Number(sessionTimeoutConfig.warningMs) > 0
3301	? Number(sessionTimeoutConfig.warningMs)
3302	: 60 * 1000;
3303
3304// Delay after popup refresh closes so updated auth cookies can propagate back to the opener tab.
3305const refreshRestartDelayMs = Number(sessionTimeoutConfig.refreshRestartDelayMs) > 0
3306	? Number(sessionTimeoutConfig.refreshRestartDelayMs)
3307	: 1500;
3308
3309// Small grace period for transient login-cookie loss before treating the session as truly gone.
3310const missingLoggedInGraceMs = Number(sessionTimeoutConfig.missingLoggedInGraceMs) > 0
3311	? Number(sessionTimeoutConfig.missingLoggedInGraceMs)
3312	: 3000;
3313
3314// How often to poll the refresh popup for closure when unload hooks are unreliable.
3315const popupPollIntervalMs = Number(sessionTimeoutConfig.popupPollIntervalMs) > 0
3316	? Number(sessionTimeoutConfig.popupPollIntervalMs)
3317	: 500;
3318
3319// Shared localStorage key used to notify sibling tabs that the session was refreshed.
3320const SESSION_REFRESH_SIGNAL_KEY = "cp:sessionRefresh";
3321
3322// Stable id for the session-timeout modal rendered by this script.
3323const SESSION_TIMEOUT_MODAL_ID = "cp-session-timeout-modal";
3324
3325// Active one-second countdown interval for the warning modal.
3326let countdownTimer = null;
3327
3328// Timer that waits until it is time to show the warning modal.
3329let popupTimer = null;
3330
3331// Prevent duplicate timeout popups from opening in the same tab.
3332let popupOpen = false;
3333
3334// --- Helper to replace AuthState.js dependency ---
3335function seedSessionTimeout(callback) {
3336	try {
3337		var xhr = new XMLHttpRequest();
3338		xhr.open('POST', '/MyAccount/SessionTimeout/GetAndResetServerTimeout', true);
3339		xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
3340		xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
3341		xhr.onreadystatechange = function() {
3342			if (xhr.readyState !== 4) {
3343				return;
3344			}
3345
3346			if (xhr.status < 200 || xhr.status >= 300) {
3347				callback(false);
3348				return;
3349			}
3350
3351			try {
3352				var response = JSON.parse(xhr.responseText);
3353				var timeoutSeconds = Number(response && response.Timeout);
3354				if (!timeoutSeconds) {
3355					callback(false);
3356					return;
3357				}
3358
3359				const expirationTimestamp = Date.now() + (timeoutSeconds * 1000);
3360				const expirationDate = new Date(expirationTimestamp).toUTCString();
3361				document.cookie = `sessionExpiry=${expirationTimestamp}; expires=${expirationDate}; path=/; SameSite=Strict;`;
3362				callback(true);
3363			} catch (e) {
3364				callback(false);
3365			}
3366		};
3367		xhr.send('_=' + Date.now());
3368	} catch (e) {
3369		callback(false);
3370	}
3371}
3372
3373function verifyServerSession(callback) {
3374	// Simple XHR to avoid jQuery dependencies or race conditions
3375	try {
3376		var xhr = new XMLHttpRequest();
3377		xhr.open('GET', '/Authentication/IsLoggedIn?_=' + Date.now(), true);
3378		xhr.onreadystatechange = function() {
3379			if (xhr.readyState === 4) {
3380				if (xhr.status >= 200 && xhr.status < 300) {
3381					try {
3382						var r = JSON.parse(xhr.responseText);
3383						callback(!!(r && r.loggedIn));
3384					} catch (e) {
3385						callback(false);
3386					}
3387				} else {
3388					callback(false);
3389				}
3390			}
3391		};
3392		xhr.send();
3393	} catch (e) {
3394		callback(false);
3395	}
3396}
3397// -------------------------------------------------
3398
3399function getPopupDelay(forceFresh) {
3400	// If forceFresh is true, we ignore the current SessionExpiry cookie (which might be stale/deleted)
3401	// and treat it as a brand new session start.
3402	const expiry = forceFresh ? null : readCookie("sessionExpiry");
3403	if (expiry) {
3404		const expiryTimestamp = Number(expiry);
3405		return Math.max(1, expiryTimestamp - Date.now() - sessionTimeoutWarning);
3406	}
3407
3408	const timeoutCookie = readCookie("sessionTimeoutMinutes");
3409	const timeoutMinutes = Number(timeoutCookie);
3410
3411	if (!timeoutMinutes) {
3412		console.warn("sessionTimeoutMinutes cookie missing or invalid! session timer disabled.");
3413		return 0;
3414	}
3415
3416	const sessionTimeout = Math.max(1, timeoutMinutes) * 60; // seconds
3417	let expiresAfter = sessionTimeout * 1000;
3418
3419	const expirationTimestamp = Date.now() + expiresAfter;
3420
3421	const expirationDate = new Date(expirationTimestamp).toUTCString();
3422
3423	document.cookie = `sessionExpiry=${expirationTimestamp}; expires=${expirationDate}; path=/; SameSite=Strict;`;
3424
3425	return Math.max(1, expiresAfter - sessionTimeoutWarning);
3426}
3427
3428
3429function startSessionTimer(forceFresh) {
3430	// clear any existing timers (safe re-entry)
3431	if (popupTimer) {
3432		clearTimeout(popupTimer);
3433		popupTimer = null;
3434	}
3435	stopCountdown();
3436
3437	const loggedInCookie = readCookie("isLoggedIn");
3438	if (!loggedInCookie || loggedInCookie.toLowerCase() !== "true") {
3439		document.cookie = `sessionExpiry=; expires=${new Date(0)}; path=/;`;
3440		return;
3441	} // not logged in — no timers needed
3442
3443	if (!forceFresh && !readCookie("sessionExpiry") && !readCookie("sessionTimeoutMinutes")) {
3444		seedSessionTimeout(function(success) {
3445			if (!success) {
3446				console.warn("Unable to seed session timeout; session timer disabled.");
3447				return;
3448			}
3449
3450			startSessionTimer(false);
3451		});
3452		return;
3453	}
3454
3455	const delayMilliseconds = getPopupDelay(forceFresh);
3456	if (!delayMilliseconds) {
3457		return;
3458	}
3459	popupTimer = setTimeout(showSessionTimeoutPopup, delayMilliseconds);
3460}
3461
3462function stopCountdown() {
3463	if (countdownTimer) {
3464		clearInterval(countdownTimer);
3465		countdownTimer = null;
3466	}
3467}
3468
3469function readCookie(name) {
3470	// Escape cookie name for regex usage
3471	const match = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/([.$?*|{}()\[\]\\\/])/g, '\\$1') + '=([^;]*)'));
3472	return match ? decodeURIComponent(match[1]) : null;
3473}
3474
3475function broadcastSessionRefreshed() {
3476	// localStorage 'storage' event fires in *other* tabs.
3477	try {
3478		localStorage.setItem(SESSION_REFRESH_SIGNAL_KEY, String(Date.now()));
3479	} catch (e) {
3480		// ignore (storage disabled)
3481	}
3482}
3483
3484function handleExternalSessionRefresh() {
3485	// Another tab refreshed the session; close popup and restart timers.
3486	stopCountdown();
3487	if (popupTimer) {
3488		clearTimeout(popupTimer);
3489		popupTimer = null;
3490	}
3491	popupOpen = false;
3492	closeSessionTimeoutModal();
3493	startSessionTimer(true);
3494}
3495
3496function closeSessionTimeoutModal(event) {
3497	const sessionTimeoutModal = document.getElementById(SESSION_TIMEOUT_MODAL_ID);
3498	if (sessionTimeoutModal && sessionTimeoutModal.parentNode) {
3499		sessionTimeoutModal.parentNode.removeChild(sessionTimeoutModal);
3500	}
3501}
3502
3503function renderSessionTimeoutModal(onRefresh, onLogout) {
3504	closeSessionTimeoutModal();
3505
3506	const sessionTimeoutModal = document.createElement('div');
3507	sessionTimeoutModal.id = SESSION_TIMEOUT_MODAL_ID;
3508	sessionTimeoutModal.innerHTML = `
3509		<div style="position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:2147483646;"></div>
3510		<div style="position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); width:min(480px, calc(100vw - 32px)); background:#fff; color:#111; z-index:2147483647; border-radius:4px; box-shadow:0 8px 32px rgba(0,0,0,0.3); font-family:Arial, sans-serif;">
3511			<div style="padding:20px 24px 12px; font-size:24px; font-weight:600;">Session Timeout</div>
3512			<div style="padding:0 24px 16px; font-size:16px; line-height:1.5;">
3513				<p>Your session will expire in <span id="countdown"></span> seconds.</p>
3514			</div>
3515			<div style="display:flex; justify-content:flex-end; gap:12px; padding:0 24px 20px;">
3516				<button type="button" data-session-timeout-action="logout" style="min-width:120px; padding:10px 16px; border:1px solid #666; background:#fff; color:#222; cursor:pointer;">Log Out</button>
3517				<button type="button" data-session-timeout-action="refresh" style="min-width:140px; padding:10px 16px; border:1px solid #0057a8; background:#0057a8; color:#fff; cursor:pointer;">Refresh Session</button>
3518			</div>
3519		</div>`;
3520
3521	document.body.appendChild(sessionTimeoutModal);
3522
3523	const refreshButton = sessionTimeoutModal.querySelector('[data-session-timeout-action="refresh"]');
3524	const logoutButton = sessionTimeoutModal.querySelector('[data-session-timeout-action="logout"]');
3525
3526	if (refreshButton) {
3527		refreshButton.addEventListener('click', onRefresh);
3528	}
3529
3530	if (logoutButton) {
3531		logoutButton.addEventListener('click', onLogout);
3532	}
3533}
3534
3535function freezeSessionTimeoutModalAtZero() {
3536	stopCountdown();
3537	const countdownEl = document.getElementById("countdown");
3538	if (countdownEl) {
3539		countdownEl.innerText = 0;
3540	}
3541}
3542
3543function showSessionTimeoutPopup() {
3544	if (popupOpen) return; // already shown
3545
3546	popupOpen = true;
3547	// When another tab is refreshing auth, the isLoggedIn cookie can briefly disappear.
3548	// Add a small grace window + server-backed check before forcing SignOut.
3549	let missingLoggedInSince = null;
3550
3551	function handleRefreshSession(event) {
3552		// open a blank tab/window immediately on the user gesture
3553		const authWindow = window.open("/MyAccount/SessionTimeout/RefreshWindow", "Refresh Session", "status=1, height=600, width=500, resizable=0");
3554		if (!authWindow) {
3555			alert("Popup was blocked. Please allow popups for this site to open the page in a new tab, or try the action again.");
3556		} else {
3557			// Stop the countdown immediately so we don't logout while the user is refreshing
3558			stopCountdown();
3559			popupOpen = false;
3560
3561			closeSessionTimeoutModal(event);
3562
3563			authWindow.focus();
3564
3565			// onbeforeunload/onunload do not work reliably after returning from the refresh redirect flow.
3566			// Instead, poll for popup closure.
3567			var authWindowPollInterval = setInterval(function () {
3568				if (authWindow.closed) {
3569					clearInterval(authWindowPollInterval);
3570					// Small delay to let the browser propagate cookies from the popup.
3571					setTimeout(function () {
3572						broadcastSessionRefreshed();
3573						startSessionTimer(true);
3574					}, refreshRestartDelayMs);
3575				}
3576			}, popupPollIntervalMs);
3577		}
3578	}
3579
3580	function handleLogoutSession(event) {
3581		stopCountdown();
3582		popupOpen = false;
3583		explicitLogout();
3584		closeSessionTimeoutModal(event);
3585	}
3586
3587	renderSessionTimeoutModal(handleRefreshSession, handleLogoutSession);
3588
3589	let secondsRemaining = sessionTimeoutWarning / 1000;
3590	const countdownEl = document.getElementById("countdown");
3591	if (countdownEl) countdownEl.innerText = secondsRemaining;
3592
3593	// ensure previous countdown cleared
3594	stopCountdown();
3595
3596	countdownTimer = setInterval(function() {
3597		const expiry = readCookie("sessionExpiry");
3598		const loggedIn = readCookie("isLoggedIn");
3599
3600		// Case 1: User logged out in another tab
3601		if (!loggedIn || loggedIn.toLowerCase() !== "true") {
3602			if (!missingLoggedInSince) missingLoggedInSince = Date.now();
3603
3604			// Use our internal vanilla JS helper instead of window.AuthState
3605			verifyServerSession(function(isActuallyLoggedIn) {
3606				if (isActuallyLoggedIn) {
3607					missingLoggedInSince = null;
3608					return; // Session valid
3609				}
3610
3611				if (Date.now() - missingLoggedInSince >= missingLoggedInGraceMs) {
3612					stopCountdown();
3613					popupOpen = false;
3614					expireLocalSession();
3615				}
3616			});
3617			return; // Pause execution for this tick while waiting for async response
3618		}
3619
3620		missingLoggedInSince = null;
3621
3622		const expiryTimestamp = Number(expiry);
3623
3624		// Case 2: Session reached expiry while the warning modal is already open.
3625		// Leave the warning visible at zero and let the server-side session expire naturally.
3626		if (!expiry || !expiryTimestamp || expiryTimestamp <= Date.now()) {
3627			freezeSessionTimeoutModalAtZero();
3628			return;
3629		}
3630
3631		// Case 3: Session refreshed
3632		if (expiryTimestamp - Date.now() > sessionTimeoutWarning + 1000) {
3633			stopCountdown();
3634			popupOpen = false;
3635			closeSessionTimeoutModal();
3636			startSessionTimer(false); // Can be false here as we likely see the new cookie
3637			return;
3638		}
3639
3640		secondsRemaining--;
3641		const el = document.getElementById("countdown");
3642		if (el) el.innerText = secondsRemaining;
3643
3644		if (secondsRemaining <= 0) {
3645			freezeSessionTimeoutModalAtZero();
3646		}
3647	}, 1000);
3648}
3649
3650function expireLocalSession() {
3651	window.location.href = '/MyAccount/SessionTimeout/Expire?txtRedirect=' + encodeURIComponent(window.location.pathname + window.location.search);
3652}
3653
3654function explicitLogout() {
3655	window.location.href = '/publiclogin.aspx?out=true&txtRedirect=' + window.location.pathname.substring(1) + window.location.search;
3656}
3657
3658// Prefer DOMContentLoaded if you only need the DOM (faster than load)
3659if (document.readyState === "complete" || document.readyState === "interactive") {
3660	// page already loaded — start immediately
3661	try { startSessionTimer(false); } catch (e) { console.error(e); }
3662} else {
3663	window.addEventListener("load", function () {
3664		try { startSessionTimer(false); } catch (e) { console.error(e); }
3665	});
3666}
3667
3668// Cross-tab listener: another tab refreshed session.
3669// Note: the storage event only fires in other tabs, not the tab that called setItem.
3670window.addEventListener('storage', function (e) {
3671	if (!e) return;
3672	if (e.key !== SESSION_REFRESH_SIGNAL_KEY) return;
3673	handleExternalSessionRefresh();
3674});
3675;
3676var popOverModal = {
3677    open: function (title, bodyHtml, actions, options) {
3678        var model = {
3679            Open: true,
3680            Title: title,
3681            Body: {
3682                Html: bodyHtml
3683            },
3684            Actions: actions || [],
3685            ExtraClasses: options.ExtraClasses || {}
3686        };
3687
3688        this.render(model);
3689    },
3690    close: function (event) {
3691        if (event) {
3692            event.preventDefault();
3693        }
3694        document.getElementById('popoverModal').style.display = 'none';
3695        document.body.classList.remove('has-modalOpen');
3696    },
3697    render: function (model) {
3698        var modal = document.getElementById('popoverModal');
3699        modal.querySelector('.cp-PopOver-title').innerText = model.Title;
3700        modal.querySelector('.cp-PopOver-body').innerHTML = model.Body.Html;
3701        document.body.classList.add('has-modalOpen');
3702        modal.style.display = 'block';
3703
3704        var actionButtonsContainer = document.getElementById('actionButtons');
3705        actionButtonsContainer.innerHTML = '';
3706        model.Actions.forEach(function (actionButton) {
3707            var button = document.createElement('button');
3708            button.className = 'cp-Btn ' + actionButton.ExtraClasses;
3709            button.innerText = actionButton.Title;
3710            button.onclick = function (event) {
3711                if (window[actionButton.fnClick]) {
3712                    window[actionButton.fnClick](event);
3713                } else {
3714                    actionButton.fnClick(event);
3715                }
3716            };
3717            button.disabled = actionButton.Disabled;
3718            actionButtonsContainer.appendChild(button);
3719        });
3720    }
3721};
3722
3723function closePopOverModal(event) {
3724    popOverModal.close(event);
3725}
3726;
3727

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.