1 /*! Copyright (c) 2013 Index Data ApS. http://indexdata.com
2 created at: Thu Dec 19 15:38:43 GMT 2013
3 mkws.js GIT id: 54b1dadf3e529bd323661138eaf255192706ef50
4 pz2.js GIT id: fcae86df04ab28f83b889ca873275f68551928df
6 /*! jQuery v1.10.0 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
9 (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.0",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=lt(),k=lt(),E=lt(),S=!1,A=function(){return 0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=bt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+xt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return At(e.replace(z,"$1"),t,n,i)}function st(e){return K.test(e+"")}function lt(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function ut(e){return e[b]=!0,e}function ct(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function pt(e,t,n){e=e.split("|");var r,i=e.length,a=n?null:t;while(i--)(r=o.attrHandle[e[i]])&&r!==t||(o.attrHandle[e[i]]=a)}function ft(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}function dt(e,t){return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function ht(e){return"input"===e.nodeName.toLowerCase()?e.defaultValue:t}function gt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function mt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function yt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function vt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),r.attributes=ct(function(e){return e.innerHTML="<a href='#'></a>",pt("type|href|height|width",dt,"#"===e.firstChild.getAttribute("href")),pt(B,ft,null==e.getAttribute("disabled")),e.className="i",!e.getAttribute("className")}),r.input=ct(function(e){return e.innerHTML="<input>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}),pt("value",ht,r.attributes&&r.input),r.getElementsByTagName=ct(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ct(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ct(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=st(n.querySelectorAll))&&(ct(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ct(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=st(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ct(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=st(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},r.sortDetached=ct(function(e){return 1&e.compareDocumentPosition(n.createElement("div"))}),A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return gt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?gt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:ut,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=bt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ut(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?ut(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ut(function(e){return function(t){return at(e,t).length>0}}),contains:ut(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:ut(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:vt(function(){return[0]}),last:vt(function(e,t){return[t-1]}),eq:vt(function(e,t,n){return[0>n?n+t:n]}),even:vt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:vt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:vt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:vt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=mt(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=yt(n);function bt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function xt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function wt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function Tt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ct(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function Nt(e,t,n,r,i,o){return r&&!r[b]&&(r=Nt(r)),i&&!i[b]&&(i=Nt(i,o)),ut(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||St(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:Ct(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=Ct(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=Ct(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function kt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=wt(function(e){return e===t},s,!0),p=wt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[wt(Tt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return Nt(l>1&&Tt(f),l>1&&xt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&kt(e.slice(l,r)),i>r&&kt(e=e.slice(r)),i>r&&xt(e))}f.push(n)}return Tt(f)}function Et(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=Ct(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?ut(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=bt(e)),n=t.length;while(n--)o=kt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Et(i,r))}return o};function St(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function At(e,t,n,i){var a,s,u,c,p,f=bt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&xt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}o.pseudos.nth=o.pseudos.eq;function jt(){}jt.prototype=o.filters=o.pseudos,o.setFilters=new jt,r.sortStable=b.split("").sort(A).join("")===b,p(),[0,0].sort(A),r.detectDuplicates=S,x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||i&&!u||(n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;
10 if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=x(this),l=t,u=e.match(T)||[];while(o=u[a++])l=r?l:!s.hasClass(o),s[l?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})
11 }}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(n.unit=o,n.start=+a||+r||0,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);a.finish=function(){t.stop(!0)},(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
13 * jQuery JSON plugin 2.4.0
15 * @author Brantley Harris, 2009-2011
16 * @author Timo Tijhof, 2011-2012
17 * @source This plugin is heavily influenced by MochiKit's serializeJSON, which is
18 * copyrighted 2005 by Bob Ippolito.
19 * @source Brantley Harris wrote this plugin. It is based somewhat on the JSON.org
20 * website's http://www.json.org/json2.js, which proclaims:
21 * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
23 * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
28 var escape = /["\\\x00-\x1f\x7f-\x9f]/g,
38 hasOwn = Object.prototype.hasOwnProperty;
42 * Converts the given argument into a JSON representation.
44 * @param o {Mixed} The json-serializable *thing* to be converted
46 * If an object has a toJSON prototype, that will be used to get the representation.
47 * Non-integer/string keys are skipped in the object, as are keys that point to a
51 $.toJSON = typeof JSON === 'object' && JSON.stringify ? JSON.stringify : function (o) {
56 var pairs, k, name, val,
59 if (type === 'undefined') {
63 // Also covers instantiated Number and Boolean objects,
64 // which are typeof 'object' but thanks to $.type, we
65 // catch them here. I don't know whether it is right
66 // or wrong that instantiated primitives are not
67 // exported to JSON as an {"object":..}.
68 // We choose this path because that's what the browsers did.
69 if (type === 'number' || type === 'boolean') {
72 if (type === 'string') {
73 return $.quoteString(o);
75 if (typeof o.toJSON === 'function') {
76 return $.toJSON(o.toJSON());
78 if (type === 'date') {
79 var month = o.getUTCMonth() + 1,
81 year = o.getUTCFullYear(),
82 hours = o.getUTCHours(),
83 minutes = o.getUTCMinutes(),
84 seconds = o.getUTCSeconds(),
85 milli = o.getUTCMilliseconds();
97 minutes = '0' + minutes;
100 seconds = '0' + seconds;
108 return '"' + year + '-' + month + '-' + day + 'T' +
109 hours + ':' + minutes + ':' + seconds +
116 for (k = 0; k < o.length; k++) {
117 pairs.push($.toJSON(o[k]) || 'null');
119 return '[' + pairs.join(',') + ']';
122 // Any other object (plain object, RegExp, ..)
123 // Need to do typeof instead of $.type, because we also
124 // want to catch non-plain objects.
125 if (typeof o === 'object') {
127 // Only include own properties,
128 // Filter out inherited prototypes
129 if (hasOwn.call(o, k)) {
130 // Keys must be numerical or string. Skip others
132 if (type === 'number') {
133 name = '"' + k + '"';
134 } else if (type === 'string') {
135 name = $.quoteString(k);
141 // Invalid values like these return undefined
142 // from toJSON, however those object members
143 // shouldn't be included in the JSON string at all.
144 if (type !== 'function' && type !== 'undefined') {
145 val = $.toJSON(o[k]);
146 pairs.push(name + ':' + val);
150 return '{' + pairs.join(',') + '}';
156 * Evaluates a given json string.
158 * @param str {String}
160 $.evalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
161 /*jshint evil: true */
162 return eval('(' + str + ')');
166 * jQuery.secureEvalJSON
167 * Evals JSON in a way that is *more* secure.
169 * @param str {String}
171 $.secureEvalJSON = typeof JSON === 'object' && JSON.parse ? JSON.parse : function (str) {
174 .replace(/\\["\\\/bfnrtu]/g, '@')
175 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
176 .replace(/(?:^|:|,)(?:\s*\[)+/g, '');
178 if (/^[\],:{}\s]*$/.test(filtered)) {
179 /*jshint evil: true */
180 return eval('(' + str + ')');
182 throw new SyntaxError('Error parsing JSON, source is not valid.');
187 * Returns a string-repr of a string, escaping quotes intelligently.
188 * Mostly a support function for toJSON.
190 * >>> jQuery.quoteString('apple')
193 * >>> jQuery.quoteString('"Where are we going?", she asked.')
194 * "\"Where are we going?\", she asked."
196 $.quoteString = function (str) {
197 if (str.match(escape)) {
198 return '"' + str.replace(escape, function (a) {
200 if (typeof c === 'string') {
204 return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
207 return '"' + str + '"';
215 Copyright (C) 2011 by Yehuda Katz
217 Permission is hereby granted, free of charge, to any person obtaining a copy
218 of this software and associated documentation files (the "Software"), to deal
219 in the Software without restriction, including without limitation the rights
220 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
221 copies of the Software, and to permit persons to whom the Software is
222 furnished to do so, subject to the following conditions:
224 The above copyright notice and this permission notice shall be included in
225 all copies or substantial portions of the Software.
227 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
228 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
229 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
230 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
231 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
232 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
237 var Handlebars = (function() {
238 // handlebars/safe-string.js
239 var __module4__ = (function() {
242 // Build out our basic SafeString type
243 function SafeString(string) {
244 this.string = string;
247 SafeString.prototype.toString = function() {
248 return "" + this.string;
251 __exports__ = SafeString;
255 // handlebars/utils.js
256 var __module3__ = (function(__dependency1__) {
258 var __exports__ = {};
259 var SafeString = __dependency1__;
270 var badChars = /[&<>"'`]/g;
271 var possible = /[&<>"'`]/;
273 function escapeChar(chr) {
274 return escape[chr] || "&";
277 function extend(obj, value) {
278 for(var key in value) {
279 if(value.hasOwnProperty(key)) {
280 obj[key] = value[key];
285 __exports__.extend = extend;var toString = Object.prototype.toString;
286 __exports__.toString = toString;
287 // Sourced from lodash
288 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
289 var isFunction = function(value) {
290 return typeof value === 'function';
292 // fallback for older versions of Chrome and Safari
293 if (isFunction(/x/)) {
294 isFunction = function(value) {
295 return typeof value === 'function' && toString.call(value) === '[object Function]';
299 __exports__.isFunction = isFunction;
300 var isArray = Array.isArray || function(value) {
301 return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
303 __exports__.isArray = isArray;
305 function escapeExpression(string) {
306 // don't escape SafeStrings, since they're already safe
307 if (string instanceof SafeString) {
308 return string.toString();
309 } else if (!string && string !== 0) {
313 // Force a string conversion as this will be done by the append regardless and
314 // the regex test will do this transparently behind the scenes, causing issues if
315 // an object's to string has escaped characters in it.
316 string = "" + string;
318 if(!possible.test(string)) { return string; }
319 return string.replace(badChars, escapeChar);
322 __exports__.escapeExpression = escapeExpression;function isEmpty(value) {
323 if (!value && value !== 0) {
325 } else if (isArray(value) && value.length === 0) {
332 __exports__.isEmpty = isEmpty;
336 // handlebars/exception.js
337 var __module5__ = (function() {
341 var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
343 function Exception(/* message */) {
344 var tmp = Error.prototype.constructor.apply(this, arguments);
346 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
347 for (var idx = 0; idx < errorProps.length; idx++) {
348 this[errorProps[idx]] = tmp[errorProps[idx]];
352 Exception.prototype = new Error();
354 __exports__ = Exception;
358 // handlebars/base.js
359 var __module2__ = (function(__dependency1__, __dependency2__) {
361 var __exports__ = {};
362 /*globals Exception, Utils */
363 var Utils = __dependency1__;
364 var Exception = __dependency2__;
366 var VERSION = "1.1.2";
367 __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
368 __exports__.COMPILER_REVISION = COMPILER_REVISION;
369 var REVISION_CHANGES = {
370 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
375 __exports__.REVISION_CHANGES = REVISION_CHANGES;
376 var isArray = Utils.isArray,
377 isFunction = Utils.isFunction,
378 toString = Utils.toString,
379 objectType = '[object Object]';
381 function HandlebarsEnvironment(helpers, partials) {
382 this.helpers = helpers || {};
383 this.partials = partials || {};
385 registerDefaultHelpers(this);
388 __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
389 constructor: HandlebarsEnvironment,
394 registerHelper: function(name, fn, inverse) {
395 if (toString.call(name) === objectType) {
396 if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
397 Utils.extend(this.helpers, name);
399 if (inverse) { fn.not = inverse; }
400 this.helpers[name] = fn;
404 registerPartial: function(name, str) {
405 if (toString.call(name) === objectType) {
406 Utils.extend(this.partials, name);
408 this.partials[name] = str;
413 function registerDefaultHelpers(instance) {
414 instance.registerHelper('helperMissing', function(arg) {
415 if(arguments.length === 2) {
418 throw new Error("Missing helper: '" + arg + "'");
422 instance.registerHelper('blockHelperMissing', function(context, options) {
423 var inverse = options.inverse || function() {}, fn = options.fn;
425 if (isFunction(context)) { context = context.call(this); }
427 if(context === true) {
429 } else if(context === false || context == null) {
430 return inverse(this);
431 } else if (isArray(context)) {
432 if(context.length > 0) {
433 return instance.helpers.each(context, options);
435 return inverse(this);
442 instance.registerHelper('each', function(context, options) {
443 var fn = options.fn, inverse = options.inverse;
444 var i = 0, ret = "", data;
446 if (isFunction(context)) { context = context.call(this); }
449 data = createFrame(options.data);
452 if(context && typeof context === 'object') {
453 if (isArray(context)) {
454 for(var j = context.length; i<j; i++) {
457 data.first = (i === 0)
458 data.last = (i === (context.length-1));
460 ret = ret + fn(context[i], { data: data });
463 for(var key in context) {
464 if(context.hasOwnProperty(key)) {
465 if(data) { data.key = key; }
466 ret = ret + fn(context[key], {data: data});
480 instance.registerHelper('if', function(conditional, options) {
481 if (isFunction(conditional)) { conditional = conditional.call(this); }
483 // Default behavior is to render the positive path if the value is truthy and not empty.
484 // The `includeZero` option may be set to treat the condtional as purely not empty based on the
485 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
486 if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
487 return options.inverse(this);
489 return options.fn(this);
493 instance.registerHelper('unless', function(conditional, options) {
494 return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
497 instance.registerHelper('with', function(context, options) {
498 if (isFunction(context)) { context = context.call(this); }
500 if (!Utils.isEmpty(context)) return options.fn(context);
503 instance.registerHelper('log', function(context, options) {
504 var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
505 instance.log(level, context);
510 methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
519 // can be overridden in the host environment
520 log: function(level, obj) {
521 if (logger.level <= level) {
522 var method = logger.methodMap[level];
523 if (typeof console !== 'undefined' && console[method]) {
524 console[method].call(console, obj);
529 __exports__.logger = logger;
530 function log(level, obj) { logger.log(level, obj); }
532 __exports__.log = log;var createFrame = function(object) {
534 Utils.extend(obj, object);
537 __exports__.createFrame = createFrame;
539 })(__module3__, __module5__);
541 // handlebars/runtime.js
542 var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
544 var __exports__ = {};
546 var Utils = __dependency1__;
547 var Exception = __dependency2__;
548 var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
549 var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
551 function checkRevision(compilerInfo) {
552 var compilerRevision = compilerInfo && compilerInfo[0] || 1,
553 currentRevision = COMPILER_REVISION;
555 if (compilerRevision !== currentRevision) {
556 if (compilerRevision < currentRevision) {
557 var runtimeVersions = REVISION_CHANGES[currentRevision],
558 compilerVersions = REVISION_CHANGES[compilerRevision];
559 throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+
560 "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
562 // Use the embedded version info since the runtime doesn't know about this revision yet
563 throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. "+
564 "Please update your runtime to a newer version ("+compilerInfo[1]+").");
569 // TODO: Remove this line and break up compilePartial
571 function template(templateSpec, env) {
573 throw new Error("No environment passed to template");
576 var invokePartialWrapper;
578 invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
579 // TODO : Check this for all inputs and the options handling (partial flag, etc). This feels
580 // like there should be a common exec path
581 var result = invokePartial.apply(this, arguments);
582 if (result) { return result; }
584 var options = { helpers: helpers, partials: partials, data: data };
585 partials[name] = env.compile(partial, { data: data !== undefined }, env);
586 return partials[name](context, options);
589 invokePartialWrapper = function(partial, name /* , context, helpers, partials, data */) {
590 var result = invokePartial.apply(this, arguments);
591 if (result) { return result; }
592 throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
598 escapeExpression: Utils.escapeExpression,
599 invokePartial: invokePartialWrapper,
601 program: function(i, fn, data) {
602 var programWrapper = this.programs[i];
604 programWrapper = program(i, fn, data);
605 } else if (!programWrapper) {
606 programWrapper = this.programs[i] = program(i, fn);
608 return programWrapper;
610 merge: function(param, common) {
611 var ret = param || common;
613 if (param && common && (param !== common)) {
615 Utils.extend(ret, common);
616 Utils.extend(ret, param);
620 programWithDepth: programWithDepth,
625 return function(context, options) {
626 options = options || {};
627 var namespace = options.partial ? options : env,
631 if (!options.partial) {
632 helpers = options.helpers;
633 partials = options.partials;
635 var result = templateSpec.call(
642 if (!options.partial) {
643 checkRevision(container.compilerInfo);
650 __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) {
651 var args = Array.prototype.slice.call(arguments, 3);
653 var prog = function(context, options) {
654 options = options || {};
656 return fn.apply(this, [context, options.data || data].concat(args));
659 prog.depth = args.length;
663 __exports__.programWithDepth = programWithDepth;function program(i, fn, data) {
664 var prog = function(context, options) {
665 options = options || {};
667 return fn(context, options.data || data);
674 __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
675 var options = { partial: true, helpers: helpers, partials: partials, data: data };
677 if(partial === undefined) {
678 throw new Exception("The partial " + name + " could not be found");
679 } else if(partial instanceof Function) {
680 return partial(context, options);
684 __exports__.invokePartial = invokePartial;function noop() { return ""; }
686 __exports__.noop = noop;
688 })(__module3__, __module5__, __module2__);
690 // handlebars.runtime.js
691 var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
694 var base = __dependency1__;
696 // Each of these augment the Handlebars object. No need to setup here.
697 // (This is done to easily share code between commonjs and browse envs)
698 var SafeString = __dependency2__;
699 var Exception = __dependency3__;
700 var Utils = __dependency4__;
701 var runtime = __dependency5__;
703 // For compatibility and usage outside of module systems, make the Handlebars object a namespace
704 var create = function() {
705 var hb = new base.HandlebarsEnvironment();
707 Utils.extend(hb, base);
708 hb.SafeString = SafeString;
709 hb.Exception = Exception;
713 hb.template = function(spec) {
714 return runtime.template(spec, hb);
720 var Handlebars = create();
721 Handlebars.create = create;
723 __exports__ = Handlebars;
725 })(__module2__, __module4__, __module5__, __module3__, __module6__);
727 // handlebars/compiler/ast.js
728 var __module7__ = (function(__dependency1__) {
730 var __exports__ = {};
731 var Exception = __dependency1__;
733 function ProgramNode(statements, inverseStrip, inverse) {
734 this.type = "program";
735 this.statements = statements;
739 this.inverse = new ProgramNode(inverse, inverseStrip);
740 this.strip.right = inverseStrip.left;
741 } else if (inverseStrip) {
742 this.strip.left = inverseStrip.right;
746 __exports__.ProgramNode = ProgramNode;function MustacheNode(rawParams, hash, open, strip) {
747 this.type = "mustache";
751 var escapeFlag = open[3] || open[2];
752 this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
754 var id = this.id = rawParams[0];
755 var params = this.params = rawParams.slice(1);
757 // a mustache is an eligible helper if:
758 // * its id is simple (a single part, not `this` or `..`)
759 var eligibleHelper = this.eligibleHelper = id.isSimple;
761 // a mustache is definitely a helper if:
762 // * it is an eligible helper, and
763 // * it has at least one parameter or hash segment
764 this.isHelper = eligibleHelper && (params.length || hash);
766 // if a mustache is an eligible helper but not a definite
767 // helper, it is ambiguous, and will be resolved in a later
768 // pass or at runtime.
771 __exports__.MustacheNode = MustacheNode;function PartialNode(partialName, context, strip) {
772 this.type = "partial";
773 this.partialName = partialName;
774 this.context = context;
778 __exports__.PartialNode = PartialNode;function BlockNode(mustache, program, inverse, close) {
779 if(mustache.id.original !== close.path.original) {
780 throw new Exception(mustache.id.original + " doesn't match " + close.path.original);
784 this.mustache = mustache;
785 this.program = program;
786 this.inverse = inverse;
789 left: mustache.strip.left,
790 right: close.strip.right
793 (program || inverse).strip.left = mustache.strip.right;
794 (inverse || program).strip.right = close.strip.left;
796 if (inverse && !program) {
797 this.isInverse = true;
801 __exports__.BlockNode = BlockNode;function ContentNode(string) {
802 this.type = "content";
803 this.string = string;
806 __exports__.ContentNode = ContentNode;function HashNode(pairs) {
811 __exports__.HashNode = HashNode;function IdNode(parts) {
818 for(var i=0,l=parts.length; i<l; i++) {
819 var part = parts[i].part;
820 original += (parts[i].separator || '') + part;
822 if (part === ".." || part === "." || part === "this") {
823 if (dig.length > 0) { throw new Exception("Invalid path: " + original); }
824 else if (part === "..") { depth++; }
825 else { this.isScoped = true; }
827 else { dig.push(part); }
830 this.original = original;
832 this.string = dig.join('.');
835 // an ID is simple if it only has one part, and that part is not
837 this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
839 this.stringModeValue = this.string;
842 __exports__.IdNode = IdNode;function PartialNameNode(name) {
843 this.type = "PARTIAL_NAME";
844 this.name = name.original;
847 __exports__.PartialNameNode = PartialNameNode;function DataNode(id) {
852 __exports__.DataNode = DataNode;function StringNode(string) {
853 this.type = "STRING";
856 this.stringModeValue = string;
859 __exports__.StringNode = StringNode;function IntegerNode(integer) {
860 this.type = "INTEGER";
862 this.integer = integer;
863 this.stringModeValue = Number(integer);
866 __exports__.IntegerNode = IntegerNode;function BooleanNode(bool) {
867 this.type = "BOOLEAN";
869 this.stringModeValue = bool === "true";
872 __exports__.BooleanNode = BooleanNode;function CommentNode(comment) {
873 this.type = "comment";
874 this.comment = comment;
877 __exports__.CommentNode = CommentNode;
881 // handlebars/compiler/parser.js
882 var __module9__ = (function() {
885 /* Jison generated parser */
886 var handlebars = (function(){
887 var parser = {trace: function trace() { },
889 symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1},
890 terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"},
891 productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]],
892 performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
894 var $0 = $$.length - 1;
896 case 1: return new yy.ProgramNode($$[$0-1]);
898 case 2: return new yy.ProgramNode([]);
900 case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0]);
902 case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0]);
904 case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], []);
906 case 6:this.$ = new yy.ProgramNode($$[$0]);
908 case 7:this.$ = new yy.ProgramNode([]);
910 case 8:this.$ = new yy.ProgramNode([]);
912 case 9:this.$ = [$$[$0]];
914 case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
916 case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
918 case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
920 case 13:this.$ = $$[$0];
922 case 14:this.$ = $$[$0];
924 case 15:this.$ = new yy.ContentNode($$[$0]);
926 case 16:this.$ = new yy.CommentNode($$[$0]);
928 case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
930 case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
932 case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])};
934 case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
936 case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0]));
938 case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]));
940 case 23:this.$ = stripFlags($$[$0-1], $$[$0]);
942 case 24:this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
944 case 25:this.$ = [[$$[$0]], null];
946 case 26:this.$ = $$[$0];
948 case 27:this.$ = new yy.StringNode($$[$0]);
950 case 28:this.$ = new yy.IntegerNode($$[$0]);
952 case 29:this.$ = new yy.BooleanNode($$[$0]);
954 case 30:this.$ = $$[$0];
956 case 31:this.$ = new yy.HashNode($$[$0]);
958 case 32:this.$ = [$$[$0-2], $$[$0]];
960 case 33:this.$ = new yy.PartialNameNode($$[$0]);
962 case 34:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0]));
964 case 35:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0]));
966 case 36:this.$ = new yy.DataNode($$[$0]);
968 case 37:this.$ = new yy.IdNode($$[$0]);
970 case 38: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
972 case 39:this.$ = [{part: $$[$0]}];
976 case 43:$$[$0-1].push($$[$0]);
978 case 46:this.$ = [$$[$0]];
980 case 47:$$[$0-1].push($$[$0]);
984 table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}],
985 defaultActions: {3:[2,2],16:[2,1],50:[2,41]},
986 parseError: function parseError(str, hash) {
987 throw new Error(str);
989 parse: function parse(input) {
990 var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
991 this.lexer.setInput(input);
992 this.lexer.yy = this.yy;
993 this.yy.lexer = this.lexer;
994 this.yy.parser = this;
995 if (typeof this.lexer.yylloc == "undefined")
996 this.lexer.yylloc = {};
997 var yyloc = this.lexer.yylloc;
999 var ranges = this.lexer.options && this.lexer.options.ranges;
1000 if (typeof this.yy.parseError === "function")
1001 this.parseError = this.yy.parseError;
1002 function popStack(n) {
1003 stack.length = stack.length - 2 * n;
1004 vstack.length = vstack.length - n;
1005 lstack.length = lstack.length - n;
1009 token = self.lexer.lex() || 1;
1010 if (typeof token !== "number") {
1011 token = self.symbols_[token] || token;
1015 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
1017 state = stack[stack.length - 1];
1018 if (this.defaultActions[state]) {
1019 action = this.defaultActions[state];
1021 if (symbol === null || typeof symbol == "undefined") {
1024 action = table[state] && table[state][symbol];
1026 if (typeof action === "undefined" || !action.length || !action[0]) {
1030 for (p in table[state])
1031 if (this.terminals_[p] && p > 2) {
1032 expected.push("'" + this.terminals_[p] + "'");
1034 if (this.lexer.showPosition) {
1035 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
1037 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
1039 this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
1042 if (action[0] instanceof Array && action.length > 1) {
1043 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
1045 switch (action[0]) {
1048 vstack.push(this.lexer.yytext);
1049 lstack.push(this.lexer.yylloc);
1050 stack.push(action[1]);
1052 if (!preErrorSymbol) {
1053 yyleng = this.lexer.yyleng;
1054 yytext = this.lexer.yytext;
1055 yylineno = this.lexer.yylineno;
1056 yyloc = this.lexer.yylloc;
1060 symbol = preErrorSymbol;
1061 preErrorSymbol = null;
1065 len = this.productions_[action[1]][1];
1066 yyval.$ = vstack[vstack.length - len];
1067 yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
1069 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
1071 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
1072 if (typeof r !== "undefined") {
1076 stack = stack.slice(0, -1 * len * 2);
1077 vstack = vstack.slice(0, -1 * len);
1078 lstack = lstack.slice(0, -1 * len);
1080 stack.push(this.productions_[action[1]][0]);
1081 vstack.push(yyval.$);
1082 lstack.push(yyval._$);
1083 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1084 stack.push(newState);
1095 function stripFlags(open, close) {
1097 left: open[2] === '~',
1098 right: close[0] === '~' || close[1] === '~'
1102 /* Jison generated lexer */
1103 var lexer = (function(){
1104 var lexer = ({EOF:1,
1105 parseError:function parseError(str, hash) {
1106 if (this.yy.parser) {
1107 this.yy.parser.parseError(str, hash);
1109 throw new Error(str);
1112 setInput:function (input) {
1113 this._input = input;
1114 this._more = this._less = this.done = false;
1115 this.yylineno = this.yyleng = 0;
1116 this.yytext = this.matched = this.match = '';
1117 this.conditionStack = ['INITIAL'];
1118 this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
1119 if (this.options.ranges) this.yylloc.range = [0,0];
1124 var ch = this._input[0];
1130 var lines = ch.match(/(?:\r\n?|\n).*/g);
1133 this.yylloc.last_line++;
1135 this.yylloc.last_column++;
1137 if (this.options.ranges) this.yylloc.range[1]++;
1139 this._input = this._input.slice(1);
1142 unput:function (ch) {
1143 var len = ch.length;
1144 var lines = ch.split(/(?:\r\n?|\n)/g);
1146 this._input = ch + this._input;
1147 this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
1148 //this.yyleng -= len;
1150 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1151 this.match = this.match.substr(0, this.match.length-1);
1152 this.matched = this.matched.substr(0, this.matched.length-1);
1154 if (lines.length-1) this.yylineno -= lines.length-1;
1155 var r = this.yylloc.range;
1157 this.yylloc = {first_line: this.yylloc.first_line,
1158 last_line: this.yylineno+1,
1159 first_column: this.yylloc.first_column,
1160 last_column: lines ?
1161 (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
1162 this.yylloc.first_column - len
1165 if (this.options.ranges) {
1166 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1175 this.unput(this.match.slice(n));
1177 pastInput:function () {
1178 var past = this.matched.substr(0, this.matched.length - this.match.length);
1179 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
1181 upcomingInput:function () {
1182 var next = this.match;
1183 if (next.length < 20) {
1184 next += this._input.substr(0, 20-next.length);
1186 return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
1188 showPosition:function () {
1189 var pre = this.pastInput();
1190 var c = new Array(pre.length + 1).join("-");
1191 return pre + this.upcomingInput() + "\n" + c+"^";
1197 if (!this._input) this.done = true;
1209 var rules = this._currentRules();
1210 for (var i=0;i < rules.length; i++) {
1211 tempMatch = this._input.match(this.rules[rules[i]]);
1212 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1215 if (!this.options.flex) break;
1219 lines = match[0].match(/(?:\r\n?|\n).*/g);
1220 if (lines) this.yylineno += lines.length;
1221 this.yylloc = {first_line: this.yylloc.last_line,
1222 last_line: this.yylineno+1,
1223 first_column: this.yylloc.last_column,
1224 last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
1225 this.yytext += match[0];
1226 this.match += match[0];
1227 this.matches = match;
1228 this.yyleng = this.yytext.length;
1229 if (this.options.ranges) {
1230 this.yylloc.range = [this.offset, this.offset += this.yyleng];
1233 this._input = this._input.slice(match[0].length);
1234 this.matched += match[0];
1235 token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
1236 if (this.done && this._input) this.done = false;
1237 if (token) return token;
1240 if (this._input === "") {
1243 return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
1244 {text: "", token: null, line: this.yylineno});
1247 lex:function lex() {
1248 var r = this.next();
1249 if (typeof r !== 'undefined') {
1255 begin:function begin(condition) {
1256 this.conditionStack.push(condition);
1258 popState:function popState() {
1259 return this.conditionStack.pop();
1261 _currentRules:function _currentRules() {
1262 return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
1264 topState:function () {
1265 return this.conditionStack[this.conditionStack.length-2];
1267 pushState:function begin(condition) {
1268 this.begin(condition);
1271 lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
1274 function strip(start, end) {
1275 return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
1279 var YYSTATE=YY_START
1280 switch($avoiding_name_collisions) {
1282 if(yy_.yytext.slice(-2) === "\\\\") {
1285 } else if(yy_.yytext.slice(-1) === "\\") {
1291 if(yy_.yytext) return 14;
1297 if(yy_.yytext.slice(-1) !== "\\") this.popState();
1298 if(yy_.yytext.slice(-1) === "\\") strip(0,1);
1302 case 3:strip(0,4); this.popState(); return 15;
1318 case 11:this.popState(); this.begin('com');
1320 case 12:strip(3,5); this.popState(); return 15;
1332 case 18:/*ignore whitespace*/
1334 case 19:this.popState(); return 24;
1336 case 20:this.popState(); return 18;
1338 case 21:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32;
1340 case 22:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32;
1352 case 28:yy_.yytext = strip(1,2); return 38;
1354 case 29:return 'INVALID';
1360 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1361 lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}};
1363 parser.lexer = lexer;
1364 function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
1366 })();__exports__ = handlebars;
1370 // handlebars/compiler/base.js
1371 var __module8__ = (function(__dependency1__, __dependency2__) {
1373 var __exports__ = {};
1374 var parser = __dependency1__;
1375 var AST = __dependency2__;
1377 __exports__.parser = parser;
1379 function parse(input) {
1380 // Just return if an already-compile AST was passed in.
1381 if(input.constructor === AST.ProgramNode) { return input; }
1384 return parser.parse(input);
1387 __exports__.parse = parse;
1389 })(__module9__, __module7__);
1391 // handlebars/compiler/javascript-compiler.js
1392 var __module11__ = (function(__dependency1__) {
1395 var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
1396 var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
1397 var log = __dependency1__.log;
1399 function Literal(value) {
1403 function JavaScriptCompiler() {}
1405 JavaScriptCompiler.prototype = {
1406 // PUBLIC API: You can override these methods in a subclass to provide
1407 // alternative compiled forms for name lookup and buffering semantics
1408 nameLookup: function(parent, name /* , type*/) {
1411 if (parent.indexOf('depth') === 0) {
1415 if (/^[0-9]+$/.test(name)) {
1416 ret = parent + "[" + name + "]";
1417 } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
1418 ret = parent + "." + name;
1421 ret = parent + "['" + name + "']";
1425 return '(' + parent + ' && ' + ret + ')';
1431 appendToBuffer: function(string) {
1432 if (this.environment.isSimple) {
1433 return "return " + string + ";";
1436 appendToBuffer: true,
1438 toString: function() { return "buffer += " + string + ";"; }
1443 initializeBuffer: function() {
1444 return this.quotedString("");
1447 namespace: "Handlebars",
1450 compile: function(environment, options, context, asObject) {
1451 this.environment = environment;
1452 this.options = options || {};
1454 log('debug', this.environment.disassemble() + "\n\n");
1456 this.name = this.environment.name;
1457 this.isChild = !!context;
1458 this.context = context || {
1467 this.stackVars = [];
1468 this.registers = { list: [] };
1469 this.compileStack = [];
1470 this.inlineStack = [];
1472 this.compileChildren(environment, options);
1474 var opcodes = environment.opcodes, opcode;
1478 for(var l=opcodes.length; this.i<l; this.i++) {
1479 opcode = opcodes[this.i];
1481 if(opcode.opcode === 'DECLARE') {
1482 this[opcode.name] = opcode.value;
1484 this[opcode.opcode].apply(this, opcode.args);
1487 // Reset the stripNext flag if it was not set by this operation.
1488 if (opcode.opcode !== this.stripNext) {
1489 this.stripNext = false;
1493 // Flush any trailing content that might be pending.
1494 this.pushSource('');
1496 return this.createFunctionContext(asObject);
1499 preamble: function() {
1502 if (!this.isChild) {
1503 var namespace = this.namespace;
1505 var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);";
1506 if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; }
1507 if (this.options.data) { copies = copies + " data = data || {};"; }
1513 if (!this.environment.isSimple) {
1514 out.push(", buffer = " + this.initializeBuffer());
1519 // track the last context pushed into place to allow skipping the
1520 // getContext opcode when it would be a noop
1521 this.lastContext = 0;
1525 createFunctionContext: function(asObject) {
1526 var locals = this.stackVars.concat(this.registers.list);
1528 if(locals.length > 0) {
1529 this.source[1] = this.source[1] + ", " + locals.join(", ");
1532 // Generate minimizer alias mappings
1533 if (!this.isChild) {
1534 for (var alias in this.context.aliases) {
1535 if (this.context.aliases.hasOwnProperty(alias)) {
1536 this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
1541 if (this.source[1]) {
1542 this.source[1] = "var " + this.source[1].substring(2) + ";";
1546 if (!this.isChild) {
1547 this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
1550 if (!this.environment.isSimple) {
1551 this.pushSource("return buffer;");
1554 var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
1556 for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
1557 params.push("depth" + this.environment.depths.list[i]);
1560 // Perform a second pass over the output to merge content when possible
1561 var source = this.mergeSource();
1563 if (!this.isChild) {
1564 var revision = COMPILER_REVISION,
1565 versions = REVISION_CHANGES[revision];
1566 source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source;
1570 params.push(source);
1572 return Function.apply(this, params);
1574 var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}';
1575 log('debug', functionSource + "\n\n");
1576 return functionSource;
1579 mergeSource: function() {
1580 // WARN: We are not handling the case where buffer is still populated as the source should
1581 // not have buffer append operations as their final action.
1584 for (var i = 0, len = this.source.length; i < len; i++) {
1585 var line = this.source[i];
1586 if (line.appendToBuffer) {
1588 buffer = buffer + '\n + ' + line.content;
1590 buffer = line.content;
1594 source += 'buffer += ' + buffer + ';\n ';
1597 source += line + '\n ';
1605 // On stack, before: hash, inverse, program, value
1606 // On stack, after: return value of blockHelperMissing
1608 // The purpose of this opcode is to take a block of the form
1609 // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and
1610 // replace it on the stack with the result of properly
1611 // invoking blockHelperMissing.
1612 blockValue: function() {
1613 this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1615 var params = ["depth0"];
1616 this.setupParams(0, params);
1618 this.replaceStack(function(current) {
1619 params.splice(1, 0, current);
1620 return "blockHelperMissing.call(" + params.join(", ") + ")";
1624 // [ambiguousBlockValue]
1626 // On stack, before: hash, inverse, program, value
1627 // Compiler value, before: lastHelper=value of last found helper, if any
1628 // On stack, after, if no lastHelper: same as [blockValue]
1629 // On stack, after, if lastHelper: value
1630 ambiguousBlockValue: function() {
1631 this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
1633 var params = ["depth0"];
1634 this.setupParams(0, params);
1636 var current = this.topStack();
1637 params.splice(1, 0, current);
1639 // Use the options value generated from the invocation
1640 params[params.length-1] = 'options';
1642 this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
1647 // On stack, before: ...
1648 // On stack, after: ...
1650 // Appends the string value of `content` to the current buffer
1651 appendContent: function(content) {
1652 if (this.pendingContent) {
1653 content = this.pendingContent + content;
1655 if (this.stripNext) {
1656 content = content.replace(/^\s+/, '');
1659 this.pendingContent = content;
1664 // On stack, before: ...
1665 // On stack, after: ...
1667 // Removes any trailing whitespace from the prior content node and flags
1668 // the next operation for stripping if it is a content node.
1670 if (this.pendingContent) {
1671 this.pendingContent = this.pendingContent.replace(/\s+$/, '');
1673 this.stripNext = 'strip';
1678 // On stack, before: value, ...
1679 // On stack, after: ...
1681 // Coerces `value` to a String and appends it to the current buffer.
1683 // If `value` is truthy, or 0, it is coerced into a string and appended
1684 // Otherwise, the empty string is appended
1685 append: function() {
1686 // Force anything that is inlined onto the stack so we don't have duplication
1687 // when we examine local
1689 var local = this.popStack();
1690 this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
1691 if (this.environment.isSimple) {
1692 this.pushSource("else { " + this.appendToBuffer("''") + " }");
1698 // On stack, before: value, ...
1699 // On stack, after: ...
1701 // Escape `value` and append it to the buffer
1702 appendEscaped: function() {
1703 this.context.aliases.escapeExpression = 'this.escapeExpression';
1705 this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")"));
1710 // On stack, before: ...
1711 // On stack, after: ...
1712 // Compiler value, after: lastContext=depth
1714 // Set the value of the `lastContext` compiler value to the depth
1715 getContext: function(depth) {
1716 if(this.lastContext !== depth) {
1717 this.lastContext = depth;
1721 // [lookupOnContext]
1723 // On stack, before: ...
1724 // On stack, after: currentContext[name], ...
1726 // Looks up the value of `name` on the current context and pushes
1727 // it onto the stack.
1728 lookupOnContext: function(name) {
1729 this.push(this.nameLookup('depth' + this.lastContext, name, 'context'));
1734 // On stack, before: ...
1735 // On stack, after: currentContext, ...
1737 // Pushes the value of the current context onto the stack.
1738 pushContext: function() {
1739 this.pushStackLiteral('depth' + this.lastContext);
1742 // [resolvePossibleLambda]
1744 // On stack, before: value, ...
1745 // On stack, after: resolved value, ...
1747 // If the `value` is a lambda, replace it on the stack by
1748 // the return value of the lambda
1749 resolvePossibleLambda: function() {
1750 this.context.aliases.functionType = '"function"';
1752 this.replaceStack(function(current) {
1753 return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current;
1759 // On stack, before: value, ...
1760 // On stack, after: value[name], ...
1762 // Replace the value on the stack with the result of looking
1763 // up `name` on `value`
1764 lookup: function(name) {
1765 this.replaceStack(function(current) {
1766 return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context');
1772 // On stack, before: ...
1773 // On stack, after: data, ...
1775 // Push the data lookup operator
1776 lookupData: function() {
1780 // [pushStringParam]
1782 // On stack, before: ...
1783 // On stack, after: string, currentContext, ...
1785 // This opcode is designed for use in string mode, which
1786 // provides the string value of a parameter along with its
1787 // depth rather than resolving it immediately.
1788 pushStringParam: function(string, type) {
1789 this.pushStackLiteral('depth' + this.lastContext);
1791 this.pushString(type);
1793 if (typeof string === 'string') {
1794 this.pushString(string);
1796 this.pushStackLiteral(string);
1800 emptyHash: function() {
1801 this.pushStackLiteral('{}');
1803 if (this.options.stringParams) {
1804 this.register('hashTypes', '{}');
1805 this.register('hashContexts', '{}');
1808 pushHash: function() {
1809 this.hash = {values: [], types: [], contexts: []};
1811 popHash: function() {
1812 var hash = this.hash;
1813 this.hash = undefined;
1815 if (this.options.stringParams) {
1816 this.register('hashContexts', '{' + hash.contexts.join(',') + '}');
1817 this.register('hashTypes', '{' + hash.types.join(',') + '}');
1819 this.push('{\n ' + hash.values.join(',\n ') + '\n }');
1824 // On stack, before: ...
1825 // On stack, after: quotedString(string), ...
1827 // Push a quoted version of `string` onto the stack
1828 pushString: function(string) {
1829 this.pushStackLiteral(this.quotedString(string));
1834 // On stack, before: ...
1835 // On stack, after: expr, ...
1837 // Push an expression onto the stack
1838 push: function(expr) {
1839 this.inlineStack.push(expr);
1845 // On stack, before: ...
1846 // On stack, after: value, ...
1848 // Pushes a value onto the stack. This operation prevents
1849 // the compiler from creating a temporary variable to hold
1851 pushLiteral: function(value) {
1852 this.pushStackLiteral(value);
1857 // On stack, before: ...
1858 // On stack, after: program(guid), ...
1860 // Push a program expression onto the stack. This takes
1861 // a compile-time guid and converts it into a runtime-accessible
1863 pushProgram: function(guid) {
1865 this.pushStackLiteral(this.programExpression(guid));
1867 this.pushStackLiteral(null);
1873 // On stack, before: hash, inverse, program, params..., ...
1874 // On stack, after: result of helper invocation
1876 // Pops off the helper's parameters, invokes the helper,
1877 // and pushes the helper's return value onto the stack.
1879 // If the helper is not found, `helperMissing` is called.
1880 invokeHelper: function(paramSize, name) {
1881 this.context.aliases.helperMissing = 'helpers.helperMissing';
1883 var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
1884 var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
1886 this.push(helper.name + ' || ' + nonHelper);
1887 this.replaceStack(function(name) {
1888 return name + ' ? ' + name + '.call(' +
1889 helper.callParams + ") " + ": helperMissing.call(" +
1890 helper.helperMissingParams + ")";
1894 // [invokeKnownHelper]
1896 // On stack, before: hash, inverse, program, params..., ...
1897 // On stack, after: result of helper invocation
1899 // This operation is used when the helper is known to exist,
1900 // so a `helperMissing` fallback is not required.
1901 invokeKnownHelper: function(paramSize, name) {
1902 var helper = this.setupHelper(paramSize, name);
1903 this.push(helper.name + ".call(" + helper.callParams + ")");
1906 // [invokeAmbiguous]
1908 // On stack, before: hash, inverse, program, params..., ...
1909 // On stack, after: result of disambiguation
1911 // This operation is used when an expression like `{{foo}}`
1912 // is provided, but we don't know at compile-time whether it
1913 // is a helper or a path.
1915 // This operation emits more code than the other options,
1916 // and can be avoided by passing the `knownHelpers` and
1917 // `knownHelpersOnly` flags at compile-time.
1918 invokeAmbiguous: function(name, helperCall) {
1919 this.context.aliases.functionType = '"function"';
1921 this.pushStackLiteral('{}'); // Hash value
1922 var helper = this.setupHelper(0, name, helperCall);
1924 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
1926 var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
1927 var nextStack = this.nextStack();
1929 this.pushSource('if (' + nextStack + ' = ' + helperName + ') { ' + nextStack + ' = ' + nextStack + '.call(' + helper.callParams + '); }');
1930 this.pushSource('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.call(' + helper.callParams + ') : ' + nextStack + '; }');
1935 // On stack, before: context, ...
1936 // On stack after: result of partial invocation
1938 // This operation pops off a context, invokes a partial with that context,
1939 // and pushes the result of the invocation back.
1940 invokePartial: function(name) {
1941 var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"];
1943 if (this.options.data) {
1944 params.push("data");
1947 this.context.aliases.self = "this";
1948 this.push("self.invokePartial(" + params.join(", ") + ")");
1953 // On stack, before: value, hash, ...
1954 // On stack, after: hash, ...
1956 // Pops a value and hash off the stack, assigns `hash[key] = value`
1957 // and pushes the hash back onto the stack.
1958 assignToHash: function(key) {
1959 var value = this.popStack(),
1963 if (this.options.stringParams) {
1964 type = this.popStack();
1965 context = this.popStack();
1968 var hash = this.hash;
1970 hash.contexts.push("'" + key + "': " + context);
1973 hash.types.push("'" + key + "': " + type);
1975 hash.values.push("'" + key + "': (" + value + ")");
1980 compiler: JavaScriptCompiler,
1982 compileChildren: function(environment, options) {
1983 var children = environment.children, child, compiler;
1985 for(var i=0, l=children.length; i<l; i++) {
1986 child = children[i];
1987 compiler = new this.compiler();
1989 var index = this.matchExistingProgram(child);
1991 if (index == null) {
1992 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
1993 index = this.context.programs.length;
1994 child.index = index;
1995 child.name = 'program' + index;
1996 this.context.programs[index] = compiler.compile(child, options, this.context);
1997 this.context.environments[index] = child;
1999 child.index = index;
2000 child.name = 'program' + index;
2004 matchExistingProgram: function(child) {
2005 for (var i = 0, len = this.context.environments.length; i < len; i++) {
2006 var environment = this.context.environments[i];
2007 if (environment && environment.equals(child)) {
2013 programExpression: function(guid) {
2014 this.context.aliases.self = "this";
2020 var child = this.environment.children[guid],
2021 depths = child.depths.list, depth;
2023 var programParams = [child.index, child.name, "data"];
2025 for(var i=0, l = depths.length; i<l; i++) {
2028 if(depth === 1) { programParams.push("depth0"); }
2029 else { programParams.push("depth" + (depth - 1)); }
2032 return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")";
2035 register: function(name, val) {
2036 this.useRegister(name);
2037 this.pushSource(name + " = " + val + ";");
2040 useRegister: function(name) {
2041 if(!this.registers[name]) {
2042 this.registers[name] = true;
2043 this.registers.list.push(name);
2047 pushStackLiteral: function(item) {
2048 return this.push(new Literal(item));
2051 pushSource: function(source) {
2052 if (this.pendingContent) {
2053 this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));
2054 this.pendingContent = undefined;
2058 this.source.push(source);
2062 pushStack: function(item) {
2065 var stack = this.incrStack();
2067 this.pushSource(stack + " = " + item + ";");
2069 this.compileStack.push(stack);
2073 replaceStack: function(callback) {
2075 inline = this.isInline(),
2078 // If we are currently inline then we want to merge the inline statement into the
2079 // replacement statement via ','
2081 var top = this.popStack(true);
2083 if (top instanceof Literal) {
2084 // Literals do not need to be inlined
2087 // Get or create the current stack name for use by the inline
2088 var name = this.stackSlot ? this.topStackName() : this.incrStack();
2090 prefix = '(' + this.push(name) + ' = ' + top + '),';
2091 stack = this.topStack();
2094 stack = this.topStack();
2097 var item = callback.call(this, stack);
2100 if (this.inlineStack.length || this.compileStack.length) {
2103 this.push('(' + prefix + item + ')');
2105 // Prevent modification of the context depth variable. Through replaceStack
2106 if (!/^stack/.test(stack)) {
2107 stack = this.nextStack();
2110 this.pushSource(stack + " = (" + prefix + item + ");");
2115 nextStack: function() {
2116 return this.pushStack();
2119 incrStack: function() {
2121 if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
2122 return this.topStackName();
2124 topStackName: function() {
2125 return "stack" + this.stackSlot;
2127 flushInline: function() {
2128 var inlineStack = this.inlineStack;
2129 if (inlineStack.length) {
2130 this.inlineStack = [];
2131 for (var i = 0, len = inlineStack.length; i < len; i++) {
2132 var entry = inlineStack[i];
2133 if (entry instanceof Literal) {
2134 this.compileStack.push(entry);
2136 this.pushStack(entry);
2141 isInline: function() {
2142 return this.inlineStack.length;
2145 popStack: function(wrapped) {
2146 var inline = this.isInline(),
2147 item = (inline ? this.inlineStack : this.compileStack).pop();
2149 if (!wrapped && (item instanceof Literal)) {
2159 topStack: function(wrapped) {
2160 var stack = (this.isInline() ? this.inlineStack : this.compileStack),
2161 item = stack[stack.length - 1];
2163 if (!wrapped && (item instanceof Literal)) {
2170 quotedString: function(str) {
2172 .replace(/\\/g, '\\\\')
2173 .replace(/"/g, '\\"')
2174 .replace(/\n/g, '\\n')
2175 .replace(/\r/g, '\\r')
2176 .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
2177 .replace(/\u2029/g, '\\u2029') + '"';
2180 setupHelper: function(paramSize, name, missingParams) {
2182 this.setupParams(paramSize, params, missingParams);
2183 var foundHelper = this.nameLookup('helpers', name, 'helper');
2188 callParams: ["depth0"].concat(params).join(", "),
2189 helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ")
2193 // the params and contexts arguments are passed in arrays
2195 setupParams: function(paramSize, params, useRegister) {
2196 var options = [], contexts = [], types = [], param, inverse, program;
2198 options.push("hash:" + this.popStack());
2200 inverse = this.popStack();
2201 program = this.popStack();
2203 // Avoid setting fn and inverse if neither are set. This allows
2204 // helpers to do a check for `if (options.fn)`
2205 if (program || inverse) {
2207 this.context.aliases.self = "this";
2208 program = "self.noop";
2212 this.context.aliases.self = "this";
2213 inverse = "self.noop";
2216 options.push("inverse:" + inverse);
2217 options.push("fn:" + program);
2220 for(var i=0; i<paramSize; i++) {
2221 param = this.popStack();
2224 if(this.options.stringParams) {
2225 types.push(this.popStack());
2226 contexts.push(this.popStack());
2230 if (this.options.stringParams) {
2231 options.push("contexts:[" + contexts.join(",") + "]");
2232 options.push("types:[" + types.join(",") + "]");
2233 options.push("hashContexts:hashContexts");
2234 options.push("hashTypes:hashTypes");
2237 if(this.options.data) {
2238 options.push("data:data");
2241 options = "{" + options.join(",") + "}";
2243 this.register('options', options);
2244 params.push('options');
2246 params.push(options);
2248 return params.join(", ");
2252 var reservedWords = (
2253 "break else new var" +
2254 " case finally return void" +
2255 " catch for switch while" +
2256 " continue function this with" +
2257 " default if throw" +
2259 " do instanceof typeof" +
2260 " abstract enum int short" +
2261 " boolean export interface static" +
2262 " byte extends long super" +
2263 " char final native synchronized" +
2264 " class float package throws" +
2265 " const goto private transient" +
2266 " debugger implements protected volatile" +
2267 " double import public let yield"
2270 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
2272 for(var i=0, l=reservedWords.length; i<l; i++) {
2273 compilerWords[reservedWords[i]] = true;
2276 JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
2277 if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
2283 __exports__ = JavaScriptCompiler;
2287 // handlebars/compiler/compiler.js
2288 var __module10__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
2290 var __exports__ = {};
2291 var Exception = __dependency1__;
2292 var parse = __dependency2__.parse;
2293 var JavaScriptCompiler = __dependency3__;
2294 var AST = __dependency4__;
2296 function Compiler() {}
2298 __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
2299 // function in a context. This is necessary for mustache compatibility, which
2300 // requires that context functions in blocks are evaluated by blockHelperMissing,
2301 // and then proceed as if the resulting value was provided to blockHelperMissing.
2303 Compiler.prototype = {
2306 disassemble: function() {
2307 var opcodes = this.opcodes, opcode, out = [], params, param;
2309 for (var i=0, l=opcodes.length; i<l; i++) {
2310 opcode = opcodes[i];
2312 if (opcode.opcode === 'DECLARE') {
2313 out.push("DECLARE " + opcode.name + "=" + opcode.value);
2316 for (var j=0; j<opcode.args.length; j++) {
2317 param = opcode.args[j];
2318 if (typeof param === "string") {
2319 param = "\"" + param.replace("\n", "\\n") + "\"";
2323 out.push(opcode.opcode + " " + params.join(" "));
2327 return out.join("\n");
2330 equals: function(other) {
2331 var len = this.opcodes.length;
2332 if (other.opcodes.length !== len) {
2336 for (var i = 0; i < len; i++) {
2337 var opcode = this.opcodes[i],
2338 otherOpcode = other.opcodes[i];
2339 if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) {
2342 for (var j = 0; j < opcode.args.length; j++) {
2343 if (opcode.args[j] !== otherOpcode.args[j]) {
2349 len = this.children.length;
2350 if (other.children.length !== len) {
2353 for (i = 0; i < len; i++) {
2354 if (!this.children[i].equals(other.children[i])) {
2364 compile: function(program, options) {
2367 this.depths = {list: []};
2368 this.options = options;
2370 // These changes will propagate to the other compiler components
2371 var knownHelpers = this.options.knownHelpers;
2372 this.options.knownHelpers = {
2373 'helperMissing': true,
2374 'blockHelperMissing': true,
2382 for (var name in knownHelpers) {
2383 this.options.knownHelpers[name] = knownHelpers[name];
2387 return this.accept(program);
2390 accept: function(node) {
2391 var strip = node.strip || {},
2394 this.opcode('strip');
2397 ret = this[node.type](node);
2400 this.opcode('strip');
2406 program: function(program) {
2407 var statements = program.statements;
2409 for(var i=0, l=statements.length; i<l; i++) {
2410 this.accept(statements[i]);
2412 this.isSimple = l === 1;
2414 this.depths.list = this.depths.list.sort(function(a, b) {
2421 compileProgram: function(program) {
2422 var result = new this.compiler().compile(program, this.options);
2423 var guid = this.guid++, depth;
2425 this.usePartial = this.usePartial || result.usePartial;
2427 this.children[guid] = result;
2429 for(var i=0, l=result.depths.list.length; i<l; i++) {
2430 depth = result.depths.list[i];
2432 if(depth < 2) { continue; }
2433 else { this.addDepth(depth - 1); }
2439 block: function(block) {
2440 var mustache = block.mustache,
2441 program = block.program,
2442 inverse = block.inverse;
2445 program = this.compileProgram(program);
2449 inverse = this.compileProgram(inverse);
2452 var type = this.classifyMustache(mustache);
2454 if (type === "helper") {
2455 this.helperMustache(mustache, program, inverse);
2456 } else if (type === "simple") {
2457 this.simpleMustache(mustache);
2459 // now that the simple mustache is resolved, we need to
2460 // evaluate it by executing `blockHelperMissing`
2461 this.opcode('pushProgram', program);
2462 this.opcode('pushProgram', inverse);
2463 this.opcode('emptyHash');
2464 this.opcode('blockValue');
2466 this.ambiguousMustache(mustache, program, inverse);
2468 // now that the simple mustache is resolved, we need to
2469 // evaluate it by executing `blockHelperMissing`
2470 this.opcode('pushProgram', program);
2471 this.opcode('pushProgram', inverse);
2472 this.opcode('emptyHash');
2473 this.opcode('ambiguousBlockValue');
2476 this.opcode('append');
2479 hash: function(hash) {
2480 var pairs = hash.pairs, pair, val;
2482 this.opcode('pushHash');
2484 for(var i=0, l=pairs.length; i<l; i++) {
2488 if (this.options.stringParams) {
2490 this.addDepth(val.depth);
2492 this.opcode('getContext', val.depth || 0);
2493 this.opcode('pushStringParam', val.stringModeValue, val.type);
2498 this.opcode('assignToHash', pair[0]);
2500 this.opcode('popHash');
2503 partial: function(partial) {
2504 var partialName = partial.partialName;
2505 this.usePartial = true;
2507 if(partial.context) {
2508 this.ID(partial.context);
2510 this.opcode('push', 'depth0');
2513 this.opcode('invokePartial', partialName.name);
2514 this.opcode('append');
2517 content: function(content) {
2518 this.opcode('appendContent', content.string);
2521 mustache: function(mustache) {
2522 var options = this.options;
2523 var type = this.classifyMustache(mustache);
2525 if (type === "simple") {
2526 this.simpleMustache(mustache);
2527 } else if (type === "helper") {
2528 this.helperMustache(mustache);
2530 this.ambiguousMustache(mustache);
2533 if(mustache.escaped && !options.noEscape) {
2534 this.opcode('appendEscaped');
2536 this.opcode('append');
2540 ambiguousMustache: function(mustache, program, inverse) {
2541 var id = mustache.id,
2543 isBlock = program != null || inverse != null;
2545 this.opcode('getContext', id.depth);
2547 this.opcode('pushProgram', program);
2548 this.opcode('pushProgram', inverse);
2550 this.opcode('invokeAmbiguous', name, isBlock);
2553 simpleMustache: function(mustache) {
2554 var id = mustache.id;
2556 if (id.type === 'DATA') {
2558 } else if (id.parts.length) {
2561 // Simplified ID for `this`
2562 this.addDepth(id.depth);
2563 this.opcode('getContext', id.depth);
2564 this.opcode('pushContext');
2567 this.opcode('resolvePossibleLambda');
2570 helperMustache: function(mustache, program, inverse) {
2571 var params = this.setupFullMustacheParams(mustache, program, inverse),
2572 name = mustache.id.parts[0];
2574 if (this.options.knownHelpers[name]) {
2575 this.opcode('invokeKnownHelper', params.length, name);
2576 } else if (this.options.knownHelpersOnly) {
2577 throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name);
2579 this.opcode('invokeHelper', params.length, name);
2584 this.addDepth(id.depth);
2585 this.opcode('getContext', id.depth);
2587 var name = id.parts[0];
2589 this.opcode('pushContext');
2591 this.opcode('lookupOnContext', id.parts[0]);
2594 for(var i=1, l=id.parts.length; i<l; i++) {
2595 this.opcode('lookup', id.parts[i]);
2599 DATA: function(data) {
2600 this.options.data = true;
2601 if (data.id.isScoped || data.id.depth) {
2602 throw new Exception('Scoped data references are not supported: ' + data.original);
2605 this.opcode('lookupData');
2606 var parts = data.id.parts;
2607 for(var i=0, l=parts.length; i<l; i++) {
2608 this.opcode('lookup', parts[i]);
2612 STRING: function(string) {
2613 this.opcode('pushString', string.string);
2616 INTEGER: function(integer) {
2617 this.opcode('pushLiteral', integer.integer);
2620 BOOLEAN: function(bool) {
2621 this.opcode('pushLiteral', bool.bool);
2624 comment: function() {},
2627 opcode: function(name) {
2628 this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) });
2631 declare: function(name, value) {
2632 this.opcodes.push({ opcode: 'DECLARE', name: name, value: value });
2635 addDepth: function(depth) {
2636 if(isNaN(depth)) { throw new Error("EWOT"); }
2637 if(depth === 0) { return; }
2639 if(!this.depths[depth]) {
2640 this.depths[depth] = true;
2641 this.depths.list.push(depth);
2645 classifyMustache: function(mustache) {
2646 var isHelper = mustache.isHelper;
2647 var isEligible = mustache.eligibleHelper;
2648 var options = this.options;
2650 // if ambiguous, we can possibly resolve the ambiguity now
2651 if (isEligible && !isHelper) {
2652 var name = mustache.id.parts[0];
2654 if (options.knownHelpers[name]) {
2656 } else if (options.knownHelpersOnly) {
2661 if (isHelper) { return "helper"; }
2662 else if (isEligible) { return "ambiguous"; }
2663 else { return "simple"; }
2666 pushParams: function(params) {
2667 var i = params.length, param;
2672 if(this.options.stringParams) {
2674 this.addDepth(param.depth);
2677 this.opcode('getContext', param.depth || 0);
2678 this.opcode('pushStringParam', param.stringModeValue, param.type);
2680 this[param.type](param);
2685 setupMustacheParams: function(mustache) {
2686 var params = mustache.params;
2687 this.pushParams(params);
2690 this.hash(mustache.hash);
2692 this.opcode('emptyHash');
2698 // this will replace setupMustacheParams when we're done
2699 setupFullMustacheParams: function(mustache, program, inverse) {
2700 var params = mustache.params;
2701 this.pushParams(params);
2703 this.opcode('pushProgram', program);
2704 this.opcode('pushProgram', inverse);
2707 this.hash(mustache.hash);
2709 this.opcode('emptyHash');
2716 function precompile(input, options) {
2717 if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) {
2718 throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
2721 options = options || {};
2722 if (!('data' in options)) {
2723 options.data = true;
2726 var ast = parse(input);
2727 var environment = new Compiler().compile(ast, options);
2728 return new JavaScriptCompiler().compile(environment, options);
2731 __exports__.precompile = precompile;function compile(input, options, env) {
2732 if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) {
2733 throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
2736 options = options || {};
2738 if (!('data' in options)) {
2739 options.data = true;
2744 function compileInput() {
2745 var ast = parse(input);
2746 var environment = new Compiler().compile(ast, options);
2747 var templateSpec = new JavaScriptCompiler().compile(environment, options, undefined, true);
2748 return env.template(templateSpec);
2751 // Template is only compiled on first use and cached after that point.
2752 return function(context, options) {
2754 compiled = compileInput();
2756 return compiled.call(this, context, options);
2760 __exports__.compile = compile;
2762 })(__module5__, __module8__, __module11__, __module7__);
2765 var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
2768 var Handlebars = __dependency1__;
2771 var AST = __dependency2__;
2772 var Parser = __dependency3__.parser;
2773 var parse = __dependency3__.parse;
2774 var Compiler = __dependency4__.Compiler;
2775 var compile = __dependency4__.compile;
2776 var precompile = __dependency4__.precompile;
2777 var JavaScriptCompiler = __dependency5__;
2779 var _create = Handlebars.create;
2780 var create = function() {
2783 hb.compile = function(input, options) {
2784 return compile(input, options, hb);
2786 hb.precompile = precompile;
2789 hb.Compiler = Compiler;
2790 hb.JavaScriptCompiler = JavaScriptCompiler;
2797 Handlebars = create();
2798 Handlebars.create = create;
2800 __exports__ = Handlebars;
2802 })(__module1__, __module7__, __module8__, __module10__, __module11__);
2807 * $Id: a0afe3a785d7a77c3f5baff605db92f5b9c484d4 $
2808 ** pz2.js - pazpar2's javascript client library.
2811 //since explorer is flawed
2812 if (!window['Node']) {
2813 window.Node = new Object();
2814 Node.ELEMENT_NODE = 1;
2815 Node.ATTRIBUTE_NODE = 2;
2817 Node.CDATA_SECTION_NODE = 4;
2818 Node.ENTITY_REFERENCE_NODE = 5;
2819 Node.ENTITY_NODE = 6;
2820 Node.PROCESSING_INSTRUCTION_NODE = 7;
2821 Node.COMMENT_NODE = 8;
2822 Node.DOCUMENT_NODE = 9;
2823 Node.DOCUMENT_TYPE_NODE = 10;
2824 Node.DOCUMENT_FRAGMENT_NODE = 11;
2825 Node.NOTATION_NODE = 12;
2828 // prevent execution of more than once
2829 if(typeof window.pz2 == "undefined") {
2830 window.undefined = window.undefined;
2832 var pz2 = function ( paramArray )
2835 // at least one callback required
2837 throw new Error("Pz2.js: Array with parameters has to be supplied.");
2839 //supported pazpar2's protocol version
2840 this.suppProtoVer = '1';
2841 if (typeof paramArray.pazpar2path != "undefined")
2842 this.pz2String = paramArray.pazpar2path;
2844 this.pz2String = "/pazpar2/search.pz2";
2845 this.useSessions = true;
2847 this.stylesheet = paramArray.detailstylesheet || null;
2848 //load stylesheet if required in async mode
2849 if( this.stylesheet ) {
2851 var request = new pzHttpRequest( this.stylesheet );
2852 request.get( {}, function ( doc ) { context.xslDoc = doc; } );
2855 this.errorHandler = paramArray.errorhandler || null;
2856 this.showResponseType = paramArray.showResponseType || "xml";
2858 // function callbacks
2859 this.initCallback = paramArray.oninit || null;
2860 this.statCallback = paramArray.onstat || null;
2861 this.showCallback = paramArray.onshow || null;
2862 this.termlistCallback = paramArray.onterm || null;
2863 this.recordCallback = paramArray.onrecord || null;
2864 this.bytargetCallback = paramArray.onbytarget || null;
2865 this.resetCallback = paramArray.onreset || null;
2868 this.termKeys = paramArray.termlist || "subject";
2870 // some configurational stuff
2871 this.keepAlive = 50000;
2873 if ( paramArray.keepAlive < this.keepAlive )
2874 this.keepAlive = paramArray.keepAlive;
2876 this.sessionID = null;
2877 this.serviceId = paramArray.serviceId || null;
2878 this.initStatusOK = false;
2879 this.pingStatusOK = false;
2880 this.searchStatusOK = false;
2881 this.mergekey = paramArray.mergekey || null;
2882 this.rank = paramArray.rank || null;
2885 this.currentSort = "relevance";
2888 this.currentStart = 0;
2889 // currentNum can be overwritten in show
2890 this.currentNum = 20;
2892 // last full record retrieved
2893 this.currRecID = null;
2896 this.currQuery = null;
2898 //current raw record offset
2899 this.currRecOffset = null;
2902 this.pingTimer = null;
2903 this.statTime = paramArray.stattime || 1000;
2904 this.statTimer = null;
2905 this.termTime = paramArray.termtime || 1000;
2906 this.termTimer = null;
2907 this.showTime = paramArray.showtime || 1000;
2908 this.showTimer = null;
2909 this.showFastCount = 4;
2910 this.bytargetTime = paramArray.bytargettime || 1000;
2911 this.bytargetTimer = null;
2912 this.recordTime = paramArray.recordtime || 500;
2913 this.recordTimer = null;
2915 // counters for each command and applied delay
2916 this.dumpFactor = 500;
2917 this.showCounter = 0;
2918 this.termCounter = 0;
2919 this.statCounter = 0;
2920 this.bytargetCounter = 0;
2921 this.recordCounter = 0;
2923 // active clients, updated by stat and show
2924 // might be an issue since bytarget will poll accordingly
2925 this.activeClients = 1;
2927 // if in proxy mode no need to init
2928 if (paramArray.usesessions != undefined) {
2929 this.useSessions = paramArray.usesessions;
2930 this.initStatusOK = true;
2932 // else, auto init session or wait for a user init?
2933 if (this.useSessions && paramArray.autoInit !== false) {
2934 this.init(this.sessionID, this.serviceId);
2936 // Version parameter
2937 this.version = paramArray.version || null;
2942 //error handler for async error throws
2943 throwError: function (errMsg, errCode)
2945 var err = new Error(errMsg);
2946 if (errCode) err.code = errCode;
2948 if (this.errorHandler) {
2949 this.errorHandler(err);
2956 // stop activity by clearing tiemouts
2959 clearTimeout(this.statTimer);
2960 clearTimeout(this.showTimer);
2961 clearTimeout(this.termTimer);
2962 clearTimeout(this.bytargetTimer);
2965 // reset status variables
2968 if ( this.useSessions ) {
2969 this.sessionID = null;
2970 this.initStatusOK = false;
2971 this.pingStatusOK = false;
2972 clearTimeout(this.pingTimer);
2974 this.searchStatusOK = false;
2977 if ( this.resetCallback )
2978 this.resetCallback();
2981 init: function (sessionId, serviceId)
2985 // session id as a param
2986 if (sessionId && this.useSessions ) {
2987 this.initStatusOK = true;
2988 this.sessionID = sessionId;
2990 // old school direct pazpar2 init
2991 } else if (this.useSessions) {
2993 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
2994 var opts = {'command' : 'init'};
2995 if (serviceId) opts.service = serviceId;
2999 if ( data.getElementsByTagName("status")[0]
3000 .childNodes[0].nodeValue == "OK" ) {
3001 if ( data.getElementsByTagName("protocol")[0]
3002 .childNodes[0].nodeValue
3003 != context.suppProtoVer )
3005 "Server's protocol not supported by the client"
3007 context.initStatusOK = true;
3009 data.getElementsByTagName("session")[0]
3010 .childNodes[0].nodeValue;
3011 if (data.getElementsByTagName("keepAlive").length > 0) {
3012 context.keepAlive = data.getElementsByTagName("keepAlive")[0].childNodes[0].nodeValue;
3021 if ( context.initCallback )
3022 context.initCallback();
3025 context.throwError('Init failed. Malformed WS resonse.',
3029 // when through proxy no need to init
3031 this.initStatusOK = true;
3034 // no need to ping explicitly
3037 // pinging only makes sense when using pazpar2 directly
3038 if( !this.initStatusOK || !this.useSessions )
3040 'Pz2.js: Ping not allowed (proxy mode) or session not initialized.'
3044 clearTimeout(context.pingTimer);
3046 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3048 { "command": "ping", "session": this.sessionID, "windowid" : window.name },
3050 if ( data.getElementsByTagName("status")[0]
3051 .childNodes[0].nodeValue == "OK" ) {
3052 context.pingStatusOK = true;
3062 context.throwError('Ping failed. Malformed WS resonse.',
3067 search: function (query, num, sort, filter, showfrom, addParamsArr)
3069 clearTimeout(this.statTimer);
3070 clearTimeout(this.showTimer);
3071 clearTimeout(this.termTimer);
3072 clearTimeout(this.bytargetTimer);
3074 this.showCounter = 0;
3075 this.termCounter = 0;
3076 this.bytargetCounter = 0;
3077 this.statCounter = 0;
3078 this.activeClients = 1;
3081 if( !this.initStatusOK )
3082 throw new Error('Pz2.js: session not initialized.');
3084 if( query !== undefined )
3085 this.currQuery = query;
3087 throw new Error("Pz2.js: no query supplied to the search command.");
3089 if ( showfrom !== undefined )
3090 var start = showfrom;
3094 var searchParams = {
3095 "command": "search",
3096 "query": this.currQuery,
3097 "session": this.sessionID,
3098 "windowid" : window.name
3101 if( sort !== undefined ) {
3102 this.currentSort = sort;
3103 searchParams["sort"] = sort;
3105 if (filter !== undefined) searchParams["filter"] = filter;
3106 if (this.mergekey) searchParams["mergekey"] = this.mergekey;
3107 if (this.rank) searchParams["rank"] = this.rank;
3109 // copy additional parmeters, do not overwrite
3110 if (addParamsArr != undefined) {
3111 for (var prop in addParamsArr) {
3112 if (!searchParams.hasOwnProperty(prop))
3113 searchParams[prop] = addParamsArr[prop];
3118 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3122 if ( data.getElementsByTagName("status")[0]
3123 .childNodes[0].nodeValue == "OK" ) {
3124 context.searchStatusOK = true;
3126 context.show(start, num, sort);
3127 if (context.statCallback)
3129 if (context.termlistCallback)
3131 if (context.bytargetCallback)
3135 context.throwError('Search failed. Malformed WS resonse.',
3142 if( !this.initStatusOK )
3143 throw new Error('Pz2.js: session not initialized.');
3145 // if called explicitly takes precedence
3146 clearTimeout(this.statTimer);
3149 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3151 { "command": "stat", "session": this.sessionID, "windowid" : window.name },
3153 if ( data.getElementsByTagName("stat") ) {
3155 Number( data.getElementsByTagName("activeclients")[0]
3156 .childNodes[0].nodeValue );
3157 context.activeClients = activeClients;
3159 var stat = Element_parseChildNodes(data.documentElement);
3161 context.statCounter++;
3162 var delay = context.statTime
3163 + context.statCounter * context.dumpFactor;
3165 if ( activeClients > 0 )
3173 context.statCallback(stat);
3176 context.throwError('Stat failed. Malformed WS resonse.',
3181 show: function(start, num, sort, query_state)
3183 if( !this.searchStatusOK && this.useSessions )
3185 'Pz2.js: show command has to be preceded with a search command.'
3188 // if called explicitly takes precedence
3189 clearTimeout(this.showTimer);
3191 if( sort !== undefined )
3192 this.currentSort = sort;
3193 if( start !== undefined )
3194 this.currentStart = Number( start );
3195 if( num !== undefined )
3196 this.currentNum = Number( num );
3199 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3200 var requestParameters =
3203 "session": this.sessionID,
3204 "start": this.currentStart,
3205 "num": this.currentNum,
3206 "sort": this.currentSort,
3208 "type": this.showResponseType,
3209 "windowid" : window.name
3212 requestParameters["query-state"] = query_state;
3213 if (this.version && this.version > 0)
3214 requestParameters["version"] = this.version;
3217 function(data, type) {
3219 var activeClients = 0;
3220 if (type === "json") {
3222 activeClients = Number(data.activeclients[0]);
3223 show.activeclients = activeClients;
3224 show.merged = Number(data.merged[0]);
3225 show.total = Number(data.total[0]);
3226 show.start = Number(data.start[0]);
3227 show.num = Number(data.num[0]);
3228 show.hits = data.hit;
3229 } else if (data.getElementsByTagName("status")[0]
3230 .childNodes[0].nodeValue == "OK") {
3231 // first parse the status data send along with records
3232 // this is strictly bound to the format
3234 Number(data.getElementsByTagName("activeclients")[0]
3235 .childNodes[0].nodeValue);
3237 "activeclients": activeClients,
3239 Number( data.getElementsByTagName("merged")[0]
3240 .childNodes[0].nodeValue ),
3242 Number( data.getElementsByTagName("total")[0]
3243 .childNodes[0].nodeValue ),
3245 Number( data.getElementsByTagName("start")[0]
3246 .childNodes[0].nodeValue ),
3248 Number( data.getElementsByTagName("num")[0]
3249 .childNodes[0].nodeValue ),
3252 // parse all the first-level nodes for all <hit> tags
3253 var hits = data.getElementsByTagName("hit");
3254 for (i = 0; i < hits.length; i++)
3255 show.hits[i] = Element_parseChildNodes(hits[i]);
3257 context.throwError('Show failed. Malformed WS resonse.',
3261 var approxNode = data.getElementsByTagName("approximation");
3262 if (approxNode && approxNode[0] && approxNode[0].childNodes[0] && approxNode[0].childNodes[0].nodeValue)
3263 show['approximation'] =
3264 Number( approxNode[0].childNodes[0].nodeValue);
3267 data.getElementsByTagName("")
3268 context.activeClients = activeClients;
3269 context.showCounter++;
3270 var delay = context.showTime;
3271 if (context.showCounter > context.showFastCount)
3272 delay += context.showCounter * context.dumpFactor;
3273 if ( activeClients > 0 )
3274 context.showTimer = setTimeout(
3279 context.showCallback(show);
3283 record: function(id, offset, syntax, handler)
3285 // we may call record with no previous search if in proxy mode
3286 if(!this.searchStatusOK && this.useSessions)
3288 'Pz2.js: record command has to be preceded with a search command.'
3291 if( id !== undefined )
3292 this.currRecID = id;
3294 var recordParams = {
3295 "command": "record",
3296 "session": this.sessionID,
3297 "id": this.currRecID,
3298 "windowid" : window.name
3301 this.currRecOffset = null;
3302 if (offset != undefined) {
3303 recordParams["offset"] = offset;
3304 this.currRecOffset = offset;
3307 if (syntax != undefined)
3308 recordParams['syntax'] = syntax;
3310 //overwrite default callback id needed
3311 var callback = this.recordCallback;
3312 var args = undefined;
3313 if (handler != undefined) {
3314 callback = handler['callback'];
3315 args = handler['args'];
3319 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3327 if (context.currRecOffset !== null) {
3328 record = new Array();
3329 record['xmlDoc'] = data;
3330 record['offset'] = context.currRecOffset;
3331 callback(record, args);
3333 } else if ( recordNode =
3334 data.getElementsByTagName("record")[0] ) {
3335 // if stylesheet was fetched do not parse the response
3336 if ( context.xslDoc ) {
3337 record = new Array();
3338 record['xmlDoc'] = data;
3339 record['xslDoc'] = context.xslDoc;
3341 recordNode.getElementsByTagName("recid")[0]
3342 .firstChild.nodeValue;
3345 record = Element_parseChildNodes(recordNode);
3348 Number( data.getElementsByTagName("activeclients")[0]
3349 .childNodes[0].nodeValue );
3350 context.activeClients = activeClients;
3351 context.recordCounter++;
3352 var delay = context.recordTime + context.recordCounter * context.dumpFactor;
3353 if ( activeClients > 0 )
3354 context.recordTimer =
3357 context.record(id, offset, syntax, handler);
3361 callback(record, args);
3364 context.throwError('Record failed. Malformed WS resonse.',
3370 termlist: function()
3372 if( !this.searchStatusOK && this.useSessions )
3374 'Pz2.js: termlist command has to be preceded with a search command.'
3377 // if called explicitly takes precedence
3378 clearTimeout(this.termTimer);
3381 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3384 "command": "termlist",
3385 "session": this.sessionID,
3386 "name": this.termKeys,
3387 "windowid" : window.name,
3388 "version" : this.version
3392 if ( data.getElementsByTagName("termlist") ) {
3394 Number( data.getElementsByTagName("activeclients")[0]
3395 .childNodes[0].nodeValue );
3396 context.activeClients = activeClients;
3397 var termList = { "activeclients": activeClients };
3398 var termLists = data.getElementsByTagName("list");
3400 for (i = 0; i < termLists.length; i++) {
3401 var listName = termLists[i].getAttribute('name');
3402 termList[listName] = new Array();
3403 var terms = termLists[i].getElementsByTagName('term');
3404 //for each term in the list
3405 for (j = 0; j < terms.length; j++) {
3408 (terms[j].getElementsByTagName("name")[0]
3410 ? terms[j].getElementsByTagName("name")[0]
3411 .childNodes[0].nodeValue
3415 .getElementsByTagName("frequency")[0]
3416 .childNodes[0].nodeValue || 'ERROR'
3419 // Only for xtargets: id, records, filtered
3421 terms[j].getElementsByTagName("id");
3422 if(terms[j].getElementsByTagName("id").length)
3424 termIdNode[0].childNodes[0].nodeValue;
3425 termList[listName][j] = term;
3427 var recordsNode = terms[j].getElementsByTagName("records");
3428 if (recordsNode && recordsNode.length)
3429 term["records"] = recordsNode[0].childNodes[0].nodeValue;
3431 var filteredNode = terms[j].getElementsByTagName("filtered");
3432 if (filteredNode && filteredNode.length)
3433 term["filtered"] = filteredNode[0].childNodes[0].nodeValue;
3438 context.termCounter++;
3439 var delay = context.termTime
3440 + context.termCounter * context.dumpFactor;
3441 if ( activeClients > 0 )
3450 context.termlistCallback(termList);
3453 context.throwError('Termlist failed. Malformed WS resonse.',
3459 bytarget: function()
3461 if( !this.initStatusOK && this.useSessions )
3463 'Pz2.js: bytarget command has to be preceded with a search command.'
3466 // no need to continue
3467 if( !this.searchStatusOK )
3470 // if called explicitly takes precedence
3471 clearTimeout(this.bytargetTimer);
3474 var request = new pzHttpRequest(this.pz2String, this.errorHandler);
3477 "command": "bytarget",
3478 "session": this.sessionID,
3480 "windowid" : window.name,
3481 "version" : this.version
3484 if ( data.getElementsByTagName("status")[0]
3485 .childNodes[0].nodeValue == "OK" ) {
3486 var targetNodes = data.getElementsByTagName("target");
3487 var bytarget = new Array();
3488 for ( i = 0; i < targetNodes.length; i++) {
3489 bytarget[i] = new Array();
3490 for( j = 0; j < targetNodes[i].childNodes.length; j++ ) {
3491 if ( targetNodes[i].childNodes[j].nodeType
3492 == Node.ELEMENT_NODE ) {
3494 targetNodes[i].childNodes[j].nodeName;
3495 if (targetNodes[i].childNodes[j].firstChild != null)
3497 var nodeText = targetNodes[i].childNodes[j]
3498 .firstChild.nodeValue;
3499 bytarget[i][nodeName] = nodeText;
3502 bytarget[i][nodeName] = "";
3508 if (bytarget[i]["state"]=="Client_Disconnected") {
3509 bytarget[i]["hits"] = "Error";
3510 } else if (bytarget[i]["state"]=="Client_Error") {
3511 bytarget[i]["hits"] = "Error";
3512 } else if (bytarget[i]["state"]=="Client_Working") {
3513 bytarget[i]["hits"] = "...";
3515 if (bytarget[i].diagnostic == "1") {
3516 bytarget[i].diagnostic = "Permanent system error";
3517 } else if (bytarget[i].diagnostic == "2") {
3518 bytarget[i].diagnostic = "Temporary system error";
3520 var targetsSuggestions = targetNodes[i].getElementsByTagName("suggestions");
3521 if (targetsSuggestions != undefined && targetsSuggestions.length>0) {
3522 var suggestions = targetsSuggestions[0];
3523 bytarget[i]["suggestions"] = Element_parseChildNodes(suggestions);
3527 context.bytargetCounter++;
3528 var delay = context.bytargetTime
3529 + context.bytargetCounter * context.dumpFactor;
3530 if ( context.activeClients > 0 )
3531 context.bytargetTimer =
3539 context.bytargetCallback(bytarget);
3542 context.throwError('Bytarget failed. Malformed WS resonse.',
3548 // just for testing, probably shouldn't be here
3549 showNext: function(page)
3551 var step = page || 1;
3552 this.show( ( step * this.currentNum ) + this.currentStart );
3555 showPrev: function(page)
3557 if (this.currentStart == 0 )
3559 var step = page || 1;
3560 var newStart = this.currentStart - (step * this.currentNum );
3561 this.show( newStart > 0 ? newStart : 0 );
3564 showPage: function(pageNum)
3566 //var page = pageNum || 1;
3567 this.show(pageNum * this.currentNum);
3572 ********************************************************************************
3573 ** AJAX HELPER CLASS ***********************************************************
3574 ********************************************************************************
3576 var pzHttpRequest = function (url, errorHandler, cookieDomain) {
3577 this.maxUrlLength = 2048;
3578 this.request = null;
3580 this.errorHandler = errorHandler || null;
3582 this.requestHeaders = {};
3583 this.isXDomain = false;
3584 this.domainRegex = /https?:\/\/([^:/]+).*/;
3585 this.cookieDomain = cookieDomain || null;
3587 var xhr = new XMLHttpRequest();
3588 if ("withCredentials" in xhr) {
3589 // XHR for Chrome/Firefox/Opera/Safari.
3590 } else if (typeof XDomainRequest != "undefined") {
3591 // XDomainRequest for IE.
3592 xhr = new XDomainRequest();
3593 this.isXDomain = true;
3595 // CORS not supported.
3601 pzHttpRequest.prototype =
3603 safeGet: function ( params, callback )
3605 var encodedParams = this.encodeParams(params);
3606 var url = this._urlAppendParams(encodedParams);
3607 if (url.length >= this.maxUrlLength) {
3608 this.requestHeaders["Content-Type"]
3609 = "application/x-www-form-urlencoded";
3610 this._send( 'POST', this.url, encodedParams, callback );
3612 this._send( 'GET', url, '', callback );
3616 get: function ( params, callback )
3618 this._send( 'GET', this._urlAppendParams(this.encodeParams(params)),
3622 post: function ( params, data, callback )
3624 this._send( 'POST', this._urlAppendParams(this.encodeParams(params)),
3631 this.request.open( 'GET', this.url, this.async );
3632 this.request.send('');
3633 if ( this.request.status == 200 )
3634 return this.request.responseXML;
3637 encodeParams: function (params)
3641 for (var key in params) {
3642 if (params[key] != null) {
3643 encoded += sep + key + '=' + encodeURIComponent(params[key]);
3650 _getDomainFromUrl: function (url)
3652 if (this.cookieDomain) return this.cookieDomain; //explicit cookie domain
3653 var m = this.domainRegex.exec(url);
3654 return (m && m.length > 1) ? m[1] : null;
3657 _strEndsWith: function (str, suffix)
3659 return str.indexOf(suffix, str.length - suffix.length) !== -1;
3662 _isCrossDomain: function (domain)
3664 if (this.cookieDomain) return true; //assume xdomain is cookie domain set
3665 return !this._strEndsWith(domain, document.domain);
3668 getCookie: function (sKey) {
3669 return decodeURI(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"
3670 + encodeURI(sKey).replace(/[\-\.\+\*]/g, "\\$&")
3671 + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
3674 setCookie: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
3675 if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
3680 switch (vEnd.constructor) {
3682 sExpires = vEnd === Infinity
3683 ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT"
3684 : "; max-age=" + vEnd;
3687 sExpires = "; expires=" + vEnd;
3690 sExpires = "; expires=" + vEnd.toGMTString();
3694 document.cookie = encodeURI(sKey) + "=" + encodeURI(sValue)
3696 + (sDomain ? "; domain=" + sDomain : "")
3697 + (sPath ? "; path=" + sPath : "")
3698 + (bSecure ? "; secure" : "");
3702 _send: function ( type, url, data, callback)
3705 this.callback = callback;
3707 //we never do withCredentials, so if it's CORS and we have
3708 //session cookie, resend it
3709 var domain = this._getDomainFromUrl(url);
3710 if (domain && this._isCrossDomain(domain) &&
3711 this.getCookie(domain+":SESSID")) {
3713 var sessparam = ';jsessionid=' + this.getCookie(domain+":SESSID");
3714 var q = url.indexOf('?');
3718 url = url.substring(0, q) + sessparam + url.substring(q);
3721 this.request.open( type, url, this.async );
3722 if (!this.isXDomain) {
3723 //setting headers is only allowed with XHR
3724 for (var key in this.requestHeaders)
3725 this.request.setRequestHeader(key, this.requestHeaders[key]);
3727 if (this.isXDomain) {
3728 this.request.onload = function () {
3730 context.request.status = 200;
3731 context.request.readyState = 4;
3733 context._handleResponse(url);
3735 this.request.onerror = function () {
3737 context.request.status = 417; //not really, but what can we do
3738 context.request.readyState = 4;
3740 context._handleResponse(url);
3743 this.request.onreadystatechange = function () {
3744 context._handleResponse(url); /// url used ONLY for error reporting
3747 this.request.send(data);
3750 _urlAppendParams: function (encodedParams)
3753 return this.url + "?" + encodedParams;
3758 _handleResponse: function (requestUrl)
3760 if ( this.request.readyState == 4 ) {
3761 // pick up appplication errors first
3763 // xdomainreq does not have responseXML
3764 if (this.isXDomain) {
3765 if (this.request.contentType.match(/\/xml/)){
3766 var dom = new ActiveXObject('Microsoft.XMLDOM');
3768 dom.loadXML(this.request.responseText);
3769 this.request.responseXML = dom;
3771 this.request.responseXML = null;
3774 if (this.request.responseXML &&
3775 (errNode = this.request.responseXML.documentElement)
3776 && errNode.nodeName == 'error') {
3777 var errMsg = errNode.getAttribute("msg");
3778 var errCode = errNode.getAttribute("code");
3779 var errAddInfo = '';
3780 if (errNode.childNodes.length)
3781 errAddInfo = ': ' + errNode.childNodes[0].nodeValue;
3783 var err = new Error(errMsg + errAddInfo);
3786 if (this.errorHandler) {
3787 this.errorHandler(err);
3793 else if (this.request.status == 200 &&
3794 this.request.responseXML === null) {
3795 if (this.request.responseText !== null) {
3798 var text = this.request.responseText;
3799 if (typeof window.JSON == "undefined") {
3800 json = eval("(" + text + ")");
3803 json = JSON.parse(text);
3807 this.callback(json, "json");
3809 var err = new Error("XML/Text response is empty but no error " +
3810 "for " + requestUrl);
3812 if (this.errorHandler) {
3813 this.errorHandler(err);
3818 } else if (this.request.status == 200) {
3819 //set cookie manually only if cross-domain
3820 var domain = this._getDomainFromUrl(requestUrl);
3821 if (domain && this._isCrossDomain(domain)) {
3822 var jsessionId = this.request.responseXML
3823 .documentElement.getAttribute('jsessionId');
3825 this.setCookie(domain+":SESSID", jsessionId);
3827 this.callback(this.request.responseXML);
3829 var err = new Error("HTTP response not OK: "
3830 + this.request.status + " - "
3831 + this.request.statusText );
3832 err.code = '00' + this.request.status;
3833 if (this.errorHandler) {
3834 this.errorHandler(err);
3845 ********************************************************************************
3846 ** XML HELPER FUNCTIONS ********************************************************
3847 ********************************************************************************
3852 if ( window.ActiveXObject) {
3853 var DOMDoc = document;
3855 var DOMDoc = Document.prototype;
3858 DOMDoc.newXmlDoc = function ( root )
3862 if (document.implementation && document.implementation.createDocument) {
3863 doc = document.implementation.createDocument('', root, null);
3864 } else if ( window.ActiveXObject ) {
3865 doc = new ActiveXObject("MSXML2.DOMDocument");
3866 doc.loadXML('<' + root + '/>');
3868 throw new Error ('No XML support in this browser');
3875 DOMDoc.parseXmlFromString = function ( xmlString )
3879 if ( window.DOMParser ) {
3880 var parser = new DOMParser();
3881 doc = parser.parseFromString( xmlString, "text/xml");
3882 } else if ( window.ActiveXObject ) {
3883 doc = new ActiveXObject("MSXML2.DOMDocument");
3884 doc.loadXML( xmlString );
3886 throw new Error ("No XML parsing support in this browser.");
3892 DOMDoc.transformToDoc = function (xmlDoc, xslDoc)
3894 if ( window.XSLTProcessor ) {
3895 var proc = new XSLTProcessor();
3896 proc.importStylesheet( xslDoc );
3897 return proc.transformToDocument(xmlDoc);
3898 } else if ( window.ActiveXObject ) {
3899 return document.parseXmlFromString(xmlDoc.transformNode(xslDoc));
3901 alert( 'Unable to perform XSLT transformation in this browser' );
3907 Element_removeFromDoc = function (DOM_Element)
3909 DOM_Element.parentNode.removeChild(DOM_Element);
3912 Element_emptyChildren = function (DOM_Element)
3914 while( DOM_Element.firstChild ) {
3915 DOM_Element.removeChild( DOM_Element.firstChild )
3919 Element_appendTransformResult = function ( DOM_Element, xmlDoc, xslDoc )
3921 if ( window.XSLTProcessor ) {
3922 var proc = new XSLTProcessor();
3923 proc.importStylesheet( xslDoc );
3924 var docFrag = false;
3925 docFrag = proc.transformToFragment( xmlDoc, DOM_Element.ownerDocument );
3926 DOM_Element.appendChild(docFrag);
3927 } else if ( window.ActiveXObject ) {
3928 DOM_Element.innerHTML = xmlDoc.transformNode( xslDoc );
3930 alert( 'Unable to perform XSLT transformation in this browser' );
3934 Element_appendTextNode = function (DOM_Element, tagName, textContent )
3936 var node = DOM_Element.ownerDocument.createElement(tagName);
3937 var text = DOM_Element.ownerDocument.createTextNode(textContent);
3939 DOM_Element.appendChild(node);
3940 node.appendChild(text);
3945 Element_setTextContent = function ( DOM_Element, textContent )
3947 if (typeof DOM_Element.textContent !== "undefined") {
3948 DOM_Element.textContent = textContent;
3949 } else if (typeof DOM_Element.innerText !== "undefined" ) {
3950 DOM_Element.innerText = textContent;
3952 throw new Error("Cannot set text content of the node, no such method.");
3956 Element_getTextContent = function (DOM_Element)
3958 if ( typeof DOM_Element.textContent != 'undefined' ) {
3959 return DOM_Element.textContent;
3960 } else if (typeof DOM_Element.text != 'undefined') {
3961 return DOM_Element.text;
3963 throw new Error("Cannot get text content of the node, no such method.");
3967 Element_parseChildNodes = function (node)
3970 var hasChildElems = false;
3971 var textContent = '';
3973 if (node.hasChildNodes()) {
3974 var children = node.childNodes;
3975 for (var i = 0; i < children.length; i++) {
3976 var child = children[i];
3977 switch (child.nodeType) {
3978 case Node.ELEMENT_NODE:
3979 hasChildElems = true;
3980 var nodeName = child.nodeName;
3981 if (!(nodeName in parsed))
3982 parsed[nodeName] = [];
3983 parsed[nodeName].push(Element_parseChildNodes(child));
3985 case Node.TEXT_NODE:
3986 textContent += child.nodeValue;
3988 case Node.CDATA_SECTION_NODE:
3989 textContent += child.nodeValue;
3995 var attrs = node.attributes;
3996 for (var i = 0; i < attrs.length; i++) {
3997 hasChildElems = true;
3998 var attrName = '@' + attrs[i].nodeName;
3999 var attrValue = attrs[i].nodeValue;
4000 parsed[attrName] = attrValue;
4003 // if no nested elements/attrs set value to text
4005 parsed['#text'] = textContent;
4007 parsed = textContent;
4012 /* do not remove trailing bracket */
4014 /*! MKWS, the MasterKey Widget Set. Copyright (C) 2013, Index Data */
4016 "use strict"; // HTML5: disable for debug_level >= 2
4018 // Set up namespace and some state.
4021 authenticated: false,
4026 * global config object: mkws_config
4028 * Needs to be defined in the HTML header before including this JS file.
4029 * Define empty mkws_config for simple applications that don't define it.
4032 var mkws_config = {};
4034 // Wrapper for jQuery
4037 mkws.locale_lang = {
4039 "Authors": "Autoren",
4040 "Subjects": "Schlagwörter",
4041 "Sources": "Daten und Quellen",
4042 "Termlists": "Termlisten",
4044 "Prev": "Zurück",
4046 "Sort by": "Sortieren nach",
4047 "and show": "und zeige",
4048 "per page": "pro Seite",
4049 "Displaying": "Zeige",
4052 "found": "gefunden",
4056 "Subject": "Schlagwort",
4058 // ### to add: Records, Targets
4064 "Authors": "Forfattere",
4065 "Subjects": "Emner",
4066 "Sources": "Kilder",
4067 "Termlists": "Termlists",
4068 "Next": "Næste",
4070 "Search": "Søg",
4071 "Sort by": "Sorter efter",
4072 "and show": "og vis",
4073 "per page": "per side",
4074 "Displaying": "Viser",
4079 "Author": "Forfatter",
4081 "Subject": "Emneord",
4082 "Location": "Lokation",
4083 // ### to add: Records, Targets
4089 // keep time state for debugging
4095 mkws.debug_function = function (string) {
4096 if (!mkws.debug_level)
4099 if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */
4104 var timestamp = ((now - mkws.debug_time.start)/1000).toFixed(3) + " (+" + ((now - mkws.debug_time.last)/1000).toFixed(3) + ") "
4105 mkws.debug_time.last = now;
4107 // you need to disable use strict at the top of the file!!!
4108 if (mkws.debug_level >= 3) {
4109 console.log(timestamp + arguments.callee.caller);
4110 } else if (mkws.debug_level >= 2) {
4111 console.log(timestamp + ">>> called from function " + arguments.callee.caller.name + ' <<<');
4113 console.log(timestamp + string);
4115 var debug = mkws.debug_function; // local alias
4118 Handlebars.registerHelper('json', function(obj) {
4119 return $.toJSON(obj);
4123 // We need {{attr '@name'}} because Handlebars can't parse {{@name}}
4124 Handlebars.registerHelper('attr', function(attrName) {
4125 return this[attrName];
4130 * Use as follows: {{#if-any NAME1 having="NAME2"}}
4131 * Applicable when NAME1 is the name of an array
4132 * The guarded code runs only if at least one element of the NAME1
4133 * array has a subelement called NAME2.
4135 Handlebars.registerHelper('if-any', function(items, options) {
4136 var having = options.hash.having;
4137 for (var i in items) {
4139 if (!having || item[having]) {
4140 return options.fn(this);
4147 Handlebars.registerHelper('first', function(items, options) {
4148 var having = options.hash.having;
4149 for (var i in items) {
4151 if (!having || item[having]) {
4152 return options.fn(item);
4159 Handlebars.registerHelper('commaList', function(items, options) {
4162 for (var i in items) {
4163 if (i > 0) out += ", ";
4164 out += options.fn(items[i])
4172 /* default mkws config */
4173 var config_default = {
4174 use_service_proxy: true,
4175 pazpar2_url: "http://mkws.indexdata.com/service-proxy/",
4176 service_proxy_auth: "http://mkws.indexdata.com/service-proxy-auth",
4178 sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]],
4179 perpage_options: [10, 20, 30, 50],
4180 sort_default: "relevance",
4181 perpage_default: 20,
4183 show_lang: true, /* show/hide language menu */
4184 show_sort: true, /* show/hide sort menu */
4185 show_perpage: true, /* show/hide perpage menu */
4186 lang_options: [], /* display languages links for given languages, [] for all */
4187 facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
4188 responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
4189 debug_level: 1, /* debug level for development: 0..2 */
4194 /* set global debug_level flag early */
4195 if (typeof mkws_config.debug_level !== 'undefined') {
4196 mkws.debug_level = mkws_config.debug_level;
4197 } else if (typeof config_default.debug_level !== 'undefined') {
4198 mkws.debug_level = config_default.debug_level;
4201 /* override standard config values by function parameters */
4202 for (var k in config_default) {
4203 if (typeof mkws_config[k] === 'undefined')
4204 mkws_config[k] = config_default[k];
4205 debug("Set config: " + k + ' => ' + mkws_config[k]);
4209 mkws.sort = mkws_config.sort_default;
4210 debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to mkws.sort");
4212 mkws.usesessions = mkws_config.use_service_proxy ? false : true;
4214 if (mkws_config.query_width < 5 || mkws_config.query_width > 150) {
4215 debug("Reset query width: " + mkws_config.query_width);
4216 mkws_config.query_width = 50;
4219 for (var key in mkws_config) {
4220 if (mkws_config.hasOwnProperty(key)) {
4221 if (key.match(/^language_/)) {
4222 var lang = key.replace(/^language_/, "");
4223 // Copy custom languages into list
4224 mkws.locale_lang[lang] = mkws_config[key];
4225 debug("Added locally configured language '" + lang + "'");
4231 // create a parameters array and pass it to the pz2's constructor
4232 // then register the form submit event with the pz2.search function
4233 // autoInit is set to true on default
4234 var my_paz = new pz2( { "onshow": my_onshow,
4235 "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way
4236 "pazpar2path": mkws_config.pazpar2_url,
4237 "oninit": my_oninit,
4238 "onstat": my_onstat,
4239 "onterm": my_onterm,
4240 "termlist": "xtargets,subject,author",
4241 "onbytarget": my_onbytarget,
4242 "usesessions" : mkws.usesessions,
4243 "showResponseType": '', // or "json" (for debugging?)
4244 "onrecord": my_onrecord } );
4246 mkws.my_paz = my_paz; // export
4250 var recPerPage = 20;
4252 var curDetRecId = '';
4253 var curDetRecData = null;
4254 var submitted = false;
4256 var SubjectMax = 10;
4260 // pz2.js event handlers:
4262 function my_oninit() {
4267 function my_onshow(data) {
4268 totalRec = data.merged;
4270 var pager = document.getElementById("mkwsPager");
4272 pager.innerHTML = "";
4273 pager.innerHTML +='<div style="float: right">' + M('Displaying') + ': '
4274 + (data.start + 1) + ' ' + M('to') + ' ' + (data.start + data.num) +
4275 ' ' + M('of') + ' ' + data.merged + ' (' + M('found') + ': '
4276 + data.total + ')</div>';
4281 var results = document.getElementById("mkwsRecords");
4284 for (var i = 0; i < data.hits.length; i++) {
4285 var hit = data.hits[i];
4286 html.push('<div class="record" id="mkwsRecdiv_' + hit.recid + '" >',
4289 if (hit.recid == curDetRecId) {
4290 html.push(renderDetails(curDetRecData));
4293 replaceHtml(results, html.join(''));
4297 function renderSummary(hit)
4299 if (mkws.templateSummary === undefined) {
4300 loadTemplate("Summary");
4303 hit._id = "mkwsRec_" + hit.recid;
4304 hit._onclick = "mkws.showDetails(this.id);return false;"
4305 return mkws.templateSummary(hit);
4309 function my_onstat(data) {
4310 var stat = document.getElementById("mkwsStat");
4314 stat.innerHTML = '<span class="head">' + M('Status info') + '</span>' +
4316 '<span class="clients">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
4318 '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>';
4321 function my_onterm(data) {
4323 if (!mkws_config.facets || mkws_config.facets.length == 0) {
4324 $("#mkwsTermlists").hide();
4328 // display if we first got results
4329 $("#mkwsTermlists").show();
4332 acc.push('<div class="title">' + M('Termlists') + '</div>');
4333 var facets = mkws_config.facets;
4335 for(var i = 0; i < facets.length; i++) {
4336 if (facets[i] == "sources") {
4337 add_single_facet(acc, "Sources", data.xtargets, SourceMax, null);
4338 } else if (facets[i] == "subjects") {
4339 add_single_facet(acc, "Subjects", data.subject, SubjectMax, "subject");
4340 } else if (facets[i] == "authors") {
4341 add_single_facet(acc, "Authors", data.author, AuthorMax, "author");
4343 alert("bad facet configuration: '" + facets[i] + "'");
4347 var termlist = document.getElementById("mkwsTermlists");
4349 replaceHtml(termlist, acc.join(''));
4352 function add_single_facet(acc, caption, data, max, pzIndex) {
4353 acc.push('<div class="facet" id="mkwsFacet' + caption + '">');
4354 acc.push('<div class="termtitle">' + M(caption) + '</div>');
4355 for (var i = 0; i < data.length && i < max; i++ ) {
4356 acc.push('<div class="term">');
4357 acc.push('<a href="#" ');
4360 // Special case: target selection
4361 acc.push('target_id='+data[i].id+' ');
4362 action = 'mkws.limitTarget(this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
4364 action = 'mkws.limitQuery(\'' + pzIndex + '\', this.firstChild.nodeValue)';
4366 acc.push('onclick="' + action + ';return false;">' + data[i].name + '</a>'
4367 + ' <span>' + data[i].freq + '</span>');
4373 function my_onrecord(data) {
4374 // FIXME: record is async!!
4375 clearTimeout(my_paz.recordTimer);
4376 // in case on_show was faster to redraw element
4377 var detRecordDiv = document.getElementById('mkwsDet_'+data.recid);
4378 if (detRecordDiv) return;
4379 curDetRecData = data;
4380 var recordDiv = document.getElementById('mkwsRecdiv_'+curDetRecData.recid);
4381 var html = renderDetails(curDetRecData);
4382 recordDiv.innerHTML += html;
4385 function my_onbytarget(data) {
4386 var targetDiv = document.getElementById("mkwsBytarget");
4388 // No mkwsTargets div.
4392 var table ='<table><thead><tr>' +
4393 '<td>' + M('Target ID') + '</td>' +
4394 '<td>' + M('Hits') + '</td>' +
4395 '<td>' + M('Diags') + '</td>' +
4396 '<td>' + M('Records') + '</td>' +
4397 '<td>' + M('State') + '</td>' +
4398 '</tr></thead><tbody>';
4400 for (var i = 0; i < data.length; i++ ) {
4401 table += "<tr><td>" + data[i].id +
4402 "</td><td>" + data[i].hits +
4403 "</td><td>" + data[i].diagnostic +
4404 "</td><td>" + data[i].records +
4405 "</td><td>" + data[i].state + "</td></tr>";
4408 table += '</tbody></table>';
4409 targetDiv.innerHTML = table;
4412 ////////////////////////////////////////////////////////////////////////////////
4413 ////////////////////////////////////////////////////////////////////////////////
4415 // wait until the DOM is ready
4416 function domReady ()
4418 document.mkwsSearchForm.onsubmit = onFormSubmitEventHandler;
4419 document.mkwsSearchForm.mkwsQuery.value = '';
4420 if (document.mkwsSelect) {
4421 if (document.mkwsSelect.mkwsSort)
4422 document.mkwsSelect.mkwsSort.onchange = onSelectDdChange;
4423 if (document.mkwsSelect.mkwsPerpage)
4424 document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange;
4428 // when search button pressed
4429 function onFormSubmitEventHandler()
4431 newSearch(document.mkwsSearchForm.mkwsQuery.value);
4435 function newSearch(query, sort, targets)
4437 debug("newSearch: " + query);
4439 if (mkws_config.use_service_proxy && !mkws.authenticated) {
4440 alert("searching before authentication");
4448 triggerSearch(query, sort, targets);
4449 mkws.switchView('records'); // In case it's configured to start off as hidden
4453 function onSelectDdChange()
4455 if (!submitted) return false;
4458 my_paz.show(0, recPerPage, mkws.sort);
4462 function resetPage()
4468 function triggerSearch (query, sort, targets)
4473 // Re-use previous query/sort if new ones are not specified
4481 // ### should support multiple |-separated targets
4482 mkws.filters.push({ id: targets, name: targets });
4485 for (var i in mkws.filters) {
4486 var filter = mkws.filters[i];
4490 if (filter.id.match(/^[a-z:]+[=~]/)) {
4491 debug("filter '" + filter.id + "' already begins with SETTING OP");
4493 filter.id = 'pz:id=' + filter.id;
4495 pp2filter += filter.id;
4499 pp2limit += filter.field + "=" + filter.value.replace(/[\\|,]/g, '\\$&');
4503 debug("triggerSearch(" + mkws.query + "): filters = " + $.toJSON(mkws.filters) + ", pp2filter = " + pp2filter + ", pp2limit = " + pp2limit);
4504 my_paz.search(mkws.query, recPerPage, mkws.sort, pp2filter, undefined, { limit: pp2limit });
4507 function loadSelect ()
4509 if (document.mkwsSelect) {
4510 if (document.mkwsSelect.mkwsSort)
4511 mkws.sort = document.mkwsSelect.mkwsSort.value;
4512 if (document.mkwsSelect.mkwsPerpage)
4513 recPerPage = document.mkwsSelect.mkwsPerpage.value;
4517 // limit the query after clicking the facet
4518 mkws.limitQuery = function (field, value)
4520 debug("limitQuery(field=" + field + ", value=" + value + ")");
4521 mkws.filters.push({ field: field, value: value });
4529 // limit by target functions
4530 mkws.limitTarget = function (id, name)
4532 debug("limitTarget(id=" + id + ", name=" + name + ")");
4533 mkws.filters.push({ id: id, name: name });
4541 mkws.delimitQuery = function (field, value)
4543 debug("delimitQuery(field=" + field + ", value=" + value + ")");
4544 var newFilters = [];
4545 for (var i in mkws.filters) {
4546 var filter = mkws.filters[i];
4548 field == filter.field &&
4549 value == filter.value) {
4550 debug("delimitTarget() removing filter " + $.toJSON(filter));
4552 debug("delimitTarget() keeping filter " + $.toJSON(filter));
4553 newFilters.push(filter);
4556 mkws.filters = newFilters;
4566 mkws.delimitTarget = function (id)
4568 debug("delimitTarget(id=" + id + ")");
4569 var newFilters = [];
4570 for (var i in mkws.filters) {
4571 var filter = mkws.filters[i];
4573 debug("delimitTarget() removing filter " + $.toJSON(filter));
4575 debug("delimitTarget() keeping filter " + $.toJSON(filter));
4576 newFilters.push(filter);
4579 mkws.filters = newFilters;
4589 function redraw_navi ()
4591 var navi = document.getElementById('mkwsNavi');
4595 for (var i in mkws.filters) {
4599 var filter = mkws.filters[i];
4601 text += 'Source: <a class="crossout" href="#" onclick="mkws.delimitTarget(' +
4602 "'" + filter.id + "'" + ');return false;">' + filter.name + '</a>';
4604 text += filter.field + ': <a class="crossout" href="#" onclick="mkws.delimitQuery(' +
4605 "'" + filter.field + "', '" + filter.value + "'" +
4606 ');return false;">' + filter.value + '</a>';
4610 navi.innerHTML = text;
4614 function drawPager (pagerDiv)
4616 //client indexes pages from 1 but pz2 from 0
4618 var pages = Math.ceil(totalRec / recPerPage);
4620 var firstClkbl = ( curPage - onsides > 0 )
4624 var lastClkbl = firstClkbl + 2*onsides < pages
4625 ? firstClkbl + 2*onsides
4628 var prev = '<span id="mkwsPrev"><< ' + M('Prev') + '</span><b> | </b>';
4630 prev = '<a href="#" id="mkwsPrev" onclick="mkws.pagerPrev();">'
4631 +'<< ' + M('Prev') + '</a><b> | </b>';
4634 for(var i = firstClkbl; i <= lastClkbl; i++) {
4637 numLabel = '<b>' + i + '</b>';
4639 middle += '<a href="#" onclick="mkws.showPage(' + i + ')"> '
4640 + numLabel + ' </a>';
4643 var next = '<b> | </b><span id="mkwsNext">' + M('Next') + ' >></span>';
4644 if (pages - curPage > 0)
4645 next = '<b> | </b><a href="#" id="mkwsNext" onclick="mkws.pagerNext()">'
4646 + M('Next') + ' >></a>';
4653 if (lastClkbl < pages)
4656 pagerDiv.innerHTML += '<div style="float: clear">'
4657 + prev + predots + middle + postdots + next + '</div>';
4660 mkws.showPage = function (pageNum)
4663 my_paz.showPage( curPage - 1 );
4666 // simple paging functions
4668 mkws.pagerNext = function () {
4669 if ( totalRec - recPerPage*curPage > 0) {
4675 mkws.pagerPrev = function () {
4676 if ( my_paz.showPrev() != false )
4680 // switching view between targets and records
4682 mkws.switchView = function(view) {
4683 debug("switchView: " + view);
4685 var targets = document.getElementById('mkwsTargets');
4686 var results = document.getElementById('mkwsResults') ||
4687 document.getElementById('mkwsRecords');
4688 var blanket = document.getElementById('mkwsBlanket');
4689 var motd = document.getElementById('mkwsMOTD');
4693 if (targets) targets.style.display = "block";
4694 if (results) results.style.display = "none";
4695 if (blanket) blanket.style.display = "none";
4696 if (motd) motd.style.display = "none";
4699 if (targets) targets.style.display = "none";
4700 if (results) results.style.display = "block";
4701 if (blanket) blanket.style.display = "block";
4702 if (motd) motd.style.display = "none";
4705 if (targets) targets.style.display = "none";
4706 if (results) results.style.display = "none";
4707 if (blanket) blanket.style.display = "none";
4708 if (motd) motd.style.display = "none";
4711 alert("Unknown view '" + view + "'");
4715 // detailed record drawing
4716 mkws.showDetails = function (prefixRecId) {
4717 var recId = prefixRecId.replace('mkwsRec_', '');
4718 var oldRecId = curDetRecId;
4719 curDetRecId = recId;
4721 // remove current detailed view if any
4722 var detRecordDiv = document.getElementById('mkwsDet_'+oldRecId);
4725 detRecordDiv.parentNode.removeChild(detRecordDiv);
4727 // if the same clicked, just hide
4728 if (recId == oldRecId) {
4730 curDetRecData = null;
4733 // request the record
4734 my_paz.record(recId);
4737 function replaceHtml(el, html) {
4738 var oldEl = typeof el === "string" ? document.getElementById(el) : el;
4739 /*@cc_on // Pure innerHTML is slightly faster in IE
4740 oldEl.innerHTML = html;
4743 var newEl = oldEl.cloneNode(false);
4744 newEl.innerHTML = html;
4745 oldEl.parentNode.replaceChild(newEl, oldEl);
4746 /* Since we just removed the old element from the DOM, return a reference
4747 to the new element, which can be used to restore variable references. */
4751 function renderDetails(data, marker)
4753 if (mkws.templateRecord === undefined) {
4754 loadTemplate("Record");
4757 var template = mkws.templateRecord;
4758 var details = template(data);
4759 return '<div class="details" id="mkwsDet_' + data.recid + '">' + details + '</div>';
4763 function loadTemplate(name)
4765 var source = $("#mkwsTemplate" + name).html();
4767 source = defaultTemplate(name);
4770 var template = Handlebars.compile(source);
4771 debug("compiled template '" + name + "'");
4772 mkws['template' + name] = template;
4776 function defaultTemplate(name)
4778 if (name === 'Record') {
4785 {{#if md-title-remainder}}\
4786 ({{md-title-remainder}})\
4788 {{#if md-title-responsibility}}\
4789 <i>{{md-title-responsibility}}</i>\
4796 <td>{{md-date}}</td>\
4802 <td>{{md-author}}</td>\
4805 {{#if md-electronic-url}}\
4809 {{#each md-electronic-url}}\
4810 <a href="{{this}}">{{this}}</a><br/>\
4815 {{#if-any location having="md-subject"}}\
4819 {{#first location having="md-subject"}}\
4830 {{#commaList location}}\
4831 {{attr "@name"}}{{/commaList}}\
4836 } else if (name === "Summary") {
4838 <a href="#" id="{{_id}}" onclick="{{_onclick}}">\
4839 <b>{{md-title}}</b>\
4841 {{#if md-title-remainder}}\
4842 <span>{{md-title-remainder}}</span>\
4844 {{#if md-title-responsibility}}\
4845 <span><i>{{md-title-responsibility}}</i></span>\
4850 var s = "There is no default '" + name +"' template!";
4857 * All the HTML stuff to render the search forms and
4860 function mkws_html_all() {
4862 if (mkws_config.show_lang)
4865 // For some reason, doing this programmatically results in
4866 // document.mkwsSearchForm.mkwsQuery being undefined, hence the raw HTML.
4867 debug("HTML search form");
4868 $("#mkwsSearch").html('\
4869 <form name="mkwsSearchForm" action="" >\
4870 <input id="mkwsQuery" type="text" size="' + mkws_config.query_width + '" />\
4871 <input id="mkwsButton" type="submit" value="' + M('Search') + '" />\
4874 debug("HTML records");
4875 // If the application has an #mkwsResults, populate it in the
4876 // usual way. If not, assume that it's a smarter application that
4877 // defines its own subcomponents:
4883 if ($("#mkwsResults").length) {
4884 $("#mkwsResults").html('\
4885 <table width="100%" border="0" cellpadding="6" cellspacing="0">\
4887 <td id="mkwsTermlistContainer1" width="250" valign="top">\
4888 <div id="mkwsTermlists"></div>\
4890 <td id="mkwsMOTDContainer" valign="top">\
4891 <div id="mkwsRanking"></div>\
4892 <div id="mkwsPager"></div>\
4893 <div id="mkwsNavi"></div>\
4894 <div id="mkwsRecords"></div>\
4899 <div id="mkwsTermlistContainer2"></div>\
4905 if ($("#mkwsRanking").length) {
4906 var ranking_data = '';
4907 ranking_data += '<form name="mkwsSelect" id="mkwsSelect" action="" >';
4908 if (mkws_config.show_sort) {
4909 ranking_data += M('Sort by') + ' ' + mkws_html_sort() + ' ';
4911 if (mkws_config.show_perpage) {
4912 ranking_data += M('and show') + ' ' + mkws_html_perpage() + ' ' + M('per page') + '.';
4914 ranking_data += '</form>';
4916 $("#mkwsRanking").html(ranking_data);
4921 if (mkws_config.use_service_proxy) {
4922 mkws_service_proxy_auth(mkws_config.service_proxy_auth,
4923 mkws_config.service_proxy_auth_domain,
4924 mkws_config.pazpar2_url);
4927 run_auto_searches();
4930 if (mkws_config.responsive_design_width) {
4931 // Responsive web design - change layout on the fly based on
4932 // current screen width. Required for mobile devices.
4933 $(window).resize( function(e) { mkws_resize_page() });
4934 // initial check after page load
4935 $(document).ready(function() { mkws_resize_page() });
4940 // on first page, hide the termlist
4941 $(document).ready(function() { $("#mkwsTermlists").hide(); } );
4942 var motd = document.getElementById("mkwsMOTD");
4943 var container = document.getElementById("mkwsMOTDContainer");
4944 if (motd && container) {
4945 // Move the MOTD from the provided element down into the container
4946 motd.parentNode.removeChild(motd);
4947 container.appendChild(motd);
4952 function run_auto_searches() {
4953 debug("run auto searches");
4955 var node = $('#mkwsRecords');
4956 if (node.attr('autosearch')) {
4957 var query = node.attr('autosearch');
4958 var sort = node.attr('sort');
4959 var targets = node.attr('targets');
4960 var s = "running auto search: '" + query + "'";
4961 if (sort) s += " sorted by '" + sort + "'";
4962 if (targets) s += " in targets '" + targets + "'";
4964 newSearch(query, sort, targets);
4969 function mkws_set_lang() {
4970 var lang = $.parseQuerystring().lang || mkws_config.lang;
4971 if (!lang || !mkws.locale_lang[lang]) {
4972 mkws_config.lang = ""
4974 mkws_config.lang = lang;
4977 debug("Locale language: " + (mkws_config.lang ? mkws_config.lang : "none"));
4978 return mkws_config.lang;
4981 function mkws_html_switch() {
4982 debug("HTML switch");
4984 $("#mkwsSwitch").append($('<a href="#" id="mkwsSwitch_records" onclick="mkws.switchView(\'records\')">' + M('Records') + '</a>'));
4985 $("#mkwsSwitch").append($("<span/>", { text: " | " }));
4986 $("#mkwsSwitch").append($('<a href="#" id="mkwsSwitch_targets" onclick="mkws.switchView(\'targets\')">' + M('Targets') + '</a>'));
4988 debug("HTML targets");
4989 $("#mkwsTargets").html('\
4990 <div id="mkwsBytarget">\
4991 No information available yet.\
4993 $("#mkwsTargets").css("display", "none");
4996 function mkws_html_sort() {
4997 debug("HTML sort, mkws.sort = '" + mkws.sort + "'");
4998 var sort_html = '<select name="mkwsSort" id="mkwsSort">';
5000 for(var i = 0; i < mkws_config.sort_options.length; i++) {
5001 var opt = mkws_config.sort_options[i];
5003 var val = opt.length == 1 ? opt[0] : opt[1];
5005 sort_html += '<option value="' + key + '"';
5006 if (mkws.sort == key || mkws.sort == val) {
5007 sort_html += ' selected="selected"';
5009 sort_html += '>' + M(val) + '</option>';
5011 sort_html += '</select>';
5016 function mkws_html_perpage() {
5017 debug("HTML perpage");
5018 var perpage_html = '<select name="mkwsPerpage" id="mkwsPerpage">';
5020 for(var i = 0; i < mkws_config.perpage_options.length; i++) {
5021 var key = mkws_config.perpage_options[i];
5023 perpage_html += '<option value="' + key + '"';
5024 if (key == mkws_config.perpage_default) {
5025 perpage_html += ' selected="selected"';
5027 perpage_html += '>' + key + '</option>';
5029 perpage_html += '</select>';
5031 return perpage_html;
5035 * Run service-proxy authentication in background (after page load).
5036 * The username/password is configured in the apache config file
5039 function mkws_service_proxy_auth(auth_url, auth_domain, pp2_url) {
5040 debug("Run service proxy auth URL: " + auth_url);
5043 auth_domain = pp2_url.replace(/^http:\/\/(.*?)\/.*/, '$1');
5044 debug("guessed auth_domain '" + auth_domain + "' from pp2_url '" + pp2_url + "'");
5047 var request = new pzHttpRequest(auth_url, function(err) {
5048 alert("HTTP call for authentication failed: " + err)
5052 request.get(null, function(data) {
5053 if (!$.isXMLDoc(data)) {
5054 alert("service proxy auth response document is not valid XML document, give up!");
5057 var status = $(data).find("status");
5058 if (status.text() != "OK") {
5059 alert("service proxy auth repsonse status: " + status.text() + ", give up!");
5063 debug("Service proxy auth successfully done");
5064 mkws.authenticated = true;
5065 run_auto_searches();
5069 /* create locale language menu */
5070 function mkws_html_lang() {
5071 var lang_default = "en";
5072 var lang = mkws_config.lang || lang_default;
5075 /* display a list of configured languages, or all */
5076 var lang_options = mkws_config.lang_options || [];
5078 for (var i = 0; i < lang_options.length; i++) {
5079 hash[lang_options[i]] = 1;
5082 for (var k in mkws.locale_lang) {
5083 if (hash[k] == 1 || lang_options.length == 0)
5088 if (lang_options.length == 0 || hash[lang_default] == 1)
5089 list.push(lang_default);
5091 debug("Language menu for: " + list.join(", "));
5095 for(var i = 0; i < list.length; i++) {
5102 data += ' <span>' + l + '</span> ';
5104 data += ' <a href="?lang=' + l + '">' + l + '</a> '
5108 $("#mkwsLang").html(data);
5111 function mkws_resize_page () {
5112 var list = ["mkwsSwitch"];
5114 var width = mkws_config.responsive_design_width;
5115 var parentId = $("#mkwsTermlists").parent().attr('id');
5117 if ($(window).width() <= width &&
5118 parentId === "mkwsTermlistContainer1") {
5119 debug("changing from wide to narrow: " + $(window).width());
5120 $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer2"));
5121 $("#mkwsTermlistContainer1").hide();
5122 $("#mkwsTermlistContainer2").show();
5123 for(var i = 0; i < list.length; i++) {
5124 $("#" + list[i]).hide();
5126 } else if ($(window).width() > width &&
5127 parentId === "mkwsTermlistContainer2") {
5128 debug("changing from narrow to wide: " + $(window).width());
5129 $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer1"));
5130 $("#mkwsTermlistContainer1").show();
5131 $("#mkwsTermlistContainer2").hide();
5132 for(var i = 0; i < list.length; i++) {
5133 $("#" + list[i]).show();
5140 var lang = mkws_config.lang;
5142 if (!lang || !mkws.locale_lang[lang])
5145 return mkws.locale_lang[lang][word] || word;
5149 * implement jQuery plugins
5152 // implement $.parseQuerystring() for parsing URL parameters
5153 parseQuerystring: function() {
5155 var qs = window.location.search.replace('?', '');
5156 var pairs = qs.split('&');
5157 $.each(pairs, function(i, v){
5158 var pair = v.split('=');
5159 nvpair[pair[0]] = pair[1];
5164 debug2: function(string) { // delayed debug, internal variables are set after dom ready
5165 setTimeout(function() { debug(string); }, 500);
5168 // service-proxy or pazpar2
5169 pazpar2: function(config) {
5170 var id_popup = config.id_popup || "#mkwsPopup";
5171 id_popup = id_popup.replace(/^#/, "");
5174 var div = '<div id="mkwsSwitch"></div>\
5175 <div id="mkwsLang"></div>\
5176 <div id="mkwsSearch"></div>\
5177 <div id="mkwsResults"></div>\
5178 <div id="mkwsTargets"></div>\
5179 <div id="mkwsStat"></div>';
5183 <style type="text/css">\
5184 #mkwsTermlists div.facet {\
5194 <table width="100%" border="0">\
5197 <div id="mkwsSwitch"></div>\
5198 <div id="mkwsLang"></div>\
5199 <div id="mkwsSearch"></div>\
5204 <div style="height:500px; overflow: auto">\
5205 <div id="mkwsPager"></div>\
5206 <div id="mkwsNavi"></div>\
5207 <div id="mkwsRecords"></div>\
5208 <div id="mkwsTargets"></div>\
5209 <div id="mkwsRanking"></div>\
5215 <div style="height:300px; overflow: hidden">\
5216 <div id="mkwsTermlists"></div>\
5222 <div id="mkwsStat"></div>\
5228 <div id="mkwsSearch"></div>\
5229 <div id="' + id_popup + '">\
5230 <div id="mkwsSwitch"></div>\
5231 <div id="mkwsLang"></div>\
5232 <div id="mkwsResults"></div>\
5233 <div id="mkwsTargets"></div>\
5234 <div id="mkwsStat"></div>\
5237 if (config && config.layout == 'div') {
5238 this.debug2("jquery plugin layout: div");
5239 document.write(div);
5240 } else if (config && config.layout == 'popup') {
5241 this.debug2("jquery plugin layout: popup with id: " + id_popup);
5242 document.write(popup);
5243 $(document).ready( function() { init_popup(config); } );
5245 this.debug2("jquery plugin layout: table");
5246 document.write(table);
5251 function init_popup(obj) {
5252 var config = obj ? obj : {};
5254 var height = config.height || 760;
5255 var width = config.width || 880;
5256 var id_button = config.id_button || "input#mkwsButton";
5257 var id_popup = config.id_popup || "#mkwsPopup";
5259 debug("popup height: " + height + ", width: " + width);
5261 // make sure that jquery-ui was loaded afte jQuery core lib, e.g.:
5262 // <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
5264 debug("Error: jquery-ui.js is missing, did you included it after jquery core in the HTML file?");
5268 $(id_popup).dialog({
5269 closeOnEscape: true,
5276 Cancel: function() {
5277 $(this).dialog("close");
5280 close: function() { }
5286 $(id_popup).dialog("open");
5294 $(document).ready(function() {
5300 mkws_config.error = e.message;
5301 // alert(e.message);