if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;}
Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;}
return'\\u'+('0000'+
(+(a.charCodeAt(0))).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
return{stringify:function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});},parse:function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+
(+(a.charCodeAt(0))).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').
replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');}};}();}
$(document).ready(function(){if($.cookie("schriftgroesse")!=""){textSize($.cookie("schriftgroesse"));}
$('.gem-stats').bind('click',function(e){e.preventDefault();var speedItemOpen=300,speedPageScroll=500;var that=$(this);if(that.hasClass('closed')){location.hash=that.next('.stats').attr('id');that.removeClass('closed');that.next('.stats').stop(false,true).slideDown(speedItemOpen,function(){$('html, body').animate({scrollTop:$(this).prev('.gem-stats').offset().top-10},speedPageScroll);});}else{that.addClass('closed');that.next('.stats').stop(false,true).slideUp(speedItemOpen);}});});$(document).ajaxError(function(xhr,ajaxOptions,thrownError){ajaxError=xhr;});function textSize(size){$("#body").removeClass('normal large verylarge');$("#body").addClass(size);$.cookie("schriftgroesse",size,{expires:7,path:'/'});}
function kontrast(size){$("#body").removeClass('normal kontrast');$("#body").addClass(size);$.cookie("kontrast",size,{expires:7,path:'/'});}
function setDefaults(){if($('#q').length){var bla="";bla=bla+"q="+$('#q').val();bla=bla+"&userid="+$('#userid').val();bla=bla+"&quality="+$('#quality:checked').val();if(typeof($.cookie("defaults"))=="undefined"){bla=bla+"&checkboxes=1,2,3,4,5,6,7,8,9,10,11,12,13,999";}else{bla=bla+"&checkboxes="+$('input:checkbox:checked').map(function(){return this.value;}).get().join(',');}
$.cookie("defaults",bla,{expires:7,path:'/'});}
return 1;}
function wdwAjax(selector,uri,params,onload){$('.tipsy').hide();$.post(uri,params,function(data){switch(data){case"wdw-nochange":break;case"wdw-fadeout":$(selector).fadeOut(1000,function(){$(selector).remove();});break;case"wdw-slideup":$(selector).slideUp(1000,function(){$(selector).remove();});break;case"wdw-remove":$(selector).remove();break;default:$(selector).replaceWith(data);if(onload)onload();}});return 0;}
function wdwDoubleAjax(selector1,uri1,params1,selector2,uri2,params2){wdwAjax(selector1,uri1,params1);wdwAjax(selector2,uri2,params2);}
function setDisabled(elem,val){if(val){elem.attr('disabled','1');}else{elem.removeAttr('disabled');}}
function wdwOpenDialog(src,params){$.facebox.settings.opacity=0.2;$.facebox.settings.loadingImage='/static/img/ui/facebox/loading.gif';jQuery.facebox(function(){jQuery.post(src,params,function(data){jQuery.facebox(data);wdwAfterAjax("#facebox");})})}
function wdwCloseDialog(){$(document).trigger('close.facebox')}
function isValidEmailAddress(emailAddress){var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);return pattern.test(emailAddress);}
function wdwValidateJobFilter(selector,uri,parameters,onload){var params=parameters;var pattern=/^[0-9]+$/;if($('#frm-filter_widget-jobid').val()){if(!pattern.test($('#frm-filter_widget-jobid').val())){$('#frm-filter_widget-jobid-div').addClass('error');$('#frm-filter_widget-jobid-error').css('display','block');}else{$('#frm-filter_widget-jobid-div').removeClass('error');$('#frm-filter_widget-jobid-error').css('display','none');$('#frm-filter_widget-customer-div').removeClass('error');$('#frm-filter_widget-customer').val('');$('#frm-filter_widget-jobtype').val('all');$('#frm-filter_widget-state').val('all');params.jobid=$('#frm-filter_widget-jobid').val();return wdwAjax(selector,uri,params,onload);}}else{$('#frm-filter_widget-jobid-div').removeClass('error');$('#frm-filter_widget-jobid-error').css('display','none');}
pattern=/^[0-9*?]+$/;if($('#frm-filter_widget-customer').val()&&!pattern.test($('#frm-filter_widget-customer').val())){$('#frm-filter_widget-customer-div').addClass('error');$('#frm-filter_widget-customer-error').css('display','block');}else{$('#frm-filter_widget-customer-div').removeClass('error');$('#frm-filter_widget-customer-error').css('display','none');params.customer=$('#frm-filter_widget-customer').val();}
params.jobtype=$('#frm-filter_widget-jobtype').val();params.state=$('#frm-filter_widget-state').val();return wdwAjax(selector,uri,params,onload);}
function wdwValidateResponseFilter(selector,uri,parameters,onload){var params=parameters;var pattern=/^[0-9]+$/;params.feepaid=$('#frm-filter_widget-feepaid').val();params.state=$('#frm-filter_widget-state').val();return wdwAjax(selector,uri,params,onload);}
function toggle(control)
{var elem=document.getElementById(control);if(elem.style.display=="none"){elem.style.display="";$('#plussymbol-'+control.substr(6)).html('- '+control.substr(6));}else{$('#plussymbol-'+control.substr(6)).html('+ '+control.substr(6));elem.style.display="none";}}
function markAllRows(){$(".kategoriecheckbox").attr("checked","checked");return true;}
function unMarkAllRows(){$(".kategoriecheckbox").removeAttr("checked");return true;}
function updatecat(){var id_hauptkategorie=$("#frm-create-poi-obercat").children('option:selected').val();$("#frm-create-poi-cat").load("/poi/catvalues",{value:id_hauptkategorie});}/**
 * jQuery.ScrollTo
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 *
 * @projectDescription Easy element scrolling using jQuery.
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
 *
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * @id jQuery.scrollTo
 * @id jQuery.fn.scrollTo
 * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
 *	  The different options for target are:
 *		- A number position (will be applied to all axes).
 *		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
 *		- A jQuery/DOM element ( logically, child of the element to scroll )
 *		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
 *		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
*		- A percentage of the container's dimension/s, for example: 50% to go to the middle.
 *		- The string 'max' for go-to-end. 
 * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
 * @param {Object,Function} settings Optional set of settings or the onAfter callback.
 *	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
 *	 @option {Number} duration The OVERALL length of the animation.
 *	 @option {String} easing The easing method for the animation.
 *	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
 *	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
 *	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
 *	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
 *	 @option {Function} onAfter Function to be called after the scrolling ends. 
 *	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
 * @return {jQuery} Returns the same jQuery object, for chaining.
 *
 * @desc Scroll to a fixed position
 * @example $('div').scrollTo( 340 );
 *
 * @desc Scroll relatively to the actual position
 * @example $('div').scrollTo( '+=340px', { axis:'y' } );
 *
 * @dec Scroll using a selector (relative to the scrolled element)
 * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
 *
 * @ Scroll to a DOM element (same for jQuery object)
 * @example var second_child = document.getElementById('container').firstChild.nextSibling;
 *			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
 *				alert('scrolled!!');																   
 *			}});
 *
 * @desc Scroll on both axes, to different values
 * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
 */;(function($){var $scrollTo=$.scrollTo=function(target,duration,settings){$(window).scrollTo(target,duration,settings);};$scrollTo.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};$scrollTo.window=function(scope){return $(window)._scrollable();};$.fn._scrollable=function(){return this.map(function(){var elem=this,isWin=!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return elem;var doc=(elem.contentWindow||elem).document||elem.ownerDocument||elem;return $.browser.safari||doc.compatMode=='BackCompat'?doc.body:doc.documentElement;});};$.fn.scrollTo=function(target,duration,settings){if(typeof duration=='object'){settings=duration;duration=0;}if(typeof settings=='function')settings={onAfter:settings};if(target=='max')target=9e9;settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.speed||settings.duration;settings.queue=settings.queue&&settings.axis.length>1;if(settings.queue)duration/=2;settings.offset=both(settings.offset);settings.over=both(settings.over);return this._scrollable().each(function(){var elem=this,$elem=$(elem),targ=target,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break;}targ=$(targ,this);case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset();}$.each(settings.axis.split(''),function(i,axis){var Pos=axis=='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,old=elem[key],max=$scrollTo.max(elem,axis);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css('margin'+Pos))||0;attr[key]-=parseInt(targ.css('border'+Pos+'Width'))||0;}attr[key]+=settings.offset[pos]||0;if(settings.over[pos])attr[key]+=targ[axis=='x'?'width':'height']()*settings.over[pos];}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)=='%'?parseFloat(val)/100*max:val;}if(/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&settings.queue){if(old!=attr[key])animate(settings.onAfterFirst);delete attr[key];}});animate(settings.onAfter);function animate(callback){$elem.animate(attr,duration,settings.easing,callback&&function(){callback.call(this,target,settings);});};}).end();};$scrollTo.max=function(elem,axis){var Dim=axis=='x'?'Width':'Height',scroll='scroll'+Dim;if(!$(elem).is('html,body'))return elem[scroll]-$(elem)[Dim.toLowerCase()]();var size='client'+Dim,html=elem.ownerDocument.documentElement,body=elem.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[size],body[size]);};function both(val){return typeof val=='object'?val:{top:val,left:val};};})(jQuery);(function($){var i=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()};$.fn.checkbox=function(f){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}var g={cls:'jquery-checkbox',empty:'empty.png'};g=$.extend(g,f||{});var h=function(a){var b=a.checked;var c=a.disabled;var d=$(a);if(a.stateInterval)clearInterval(a.stateInterval);a.stateInterval=setInterval(function(){if(a.disabled!=c)d.trigger((c=!!a.disabled)?'disable':'enable');if(a.checked!=b)d.trigger((b=!!a.checked)?'check':'uncheck')},10);return d};return this.each(function(){var a=this;var b=h(a);if(a.wrapper)a.wrapper.remove();a.wrapper=$('<span class="'+g.cls+'"><span class="mark"><img src="'+g.empty+'" /></span></span>');a.wrapperInner=a.wrapper.children('span:eq(0)');a.wrapper.hover(function(e){a.wrapperInner.addClass(g.cls+'-hover');i(e)},function(e){a.wrapperInner.removeClass(g.cls+'-hover');i(e)});b.css({position:'absolute',zIndex:-1,visibility:'hidden'}).after(a.wrapper);var c=false;if(b.attr('id')){c=$('label[for='+b.attr('id')+']');if(!c.length)c=false}if(!c){c=b.closest?b.closest('label'):b.parents('label:eq(0)');if(!c.length)c=false}if(c){c.hover(function(e){a.wrapper.trigger('mouseover',[e])},function(e){a.wrapper.trigger('mouseout',[e])});c.click(function(e){b.trigger('click',[e]);i(e);return false})}a.wrapper.click(function(e){b.trigger('click',[e]);i(e);return false});b.click(function(e){i(e)});b.bind('disable',function(){a.wrapperInner.addClass(g.cls+'-disabled')}).bind('enable',function(){a.wrapperInner.removeClass(g.cls+'-disabled')});b.bind('check',function(){a.wrapper.addClass(g.cls+'-checked')}).bind('uncheck',function(){a.wrapper.removeClass(g.cls+'-checked')});$('img',a.wrapper).bind('dragstart',function(){return false}).bind('mousedown',function(){return false});if(window.getSelection)a.wrapper.css('MozUserSelect','none');if(a.checked)a.wrapper.addClass(g.cls+'-checked');if(a.disabled)a.wrapperInner.addClass(g.cls+'-disabled')})}})(jQuery);/*
* jQuery RTE plugin 0.5.1 - create a rich text form for Mozilla, Opera, Safari and Internet Explorer
*
* Copyright (c) 2009 Batiste Bieler
* Distributed under the GPL Licenses.
* Distributed under the MIT License.
*/
(function($){if(typeof $.fn.rte==="undefined"){var defaults={media_url:"",content_css_url:wdw_domain_staticUri+"/css/rte.css",dot_net_button_class:null,max_height:350};$.fn.rte=function(options){$.fn.rte.html=function(iframe){return iframe.contentWindow.document.getElementsByTagName("body")[0].innerHTML;};var opts=$.extend(defaults,options);return this.each(function(){var textarea=$(this);var iframe;var element_id=textarea.attr("id");function enableDesignMode(){var content=textarea.val();if($.trim(content)==''){content='<br/>';}
if(iframe){console.log("already created");textarea.hide();$(iframe).contents().find("body").html(content);$(iframe).show();$("#toolbar-"+element_id).remove();textarea.before(toolbar());return true;}
iframe=document.createElement("iframe");iframe.frameBorder=0;iframe.frameMargin=0;iframe.framePadding=0;iframe.height=200;if(textarea.attr('class'))
iframe.className=textarea.attr('class');if(textarea.attr('id'))
iframe.id=element_id;if(textarea.attr('name'))
iframe.title=textarea.attr('name');textarea.after(iframe);var css="";if(opts.content_css_url){css="<link type='text/css' rel='stylesheet' href='"+opts.content_css_url+"' />";}
var doc="<html><head>"+css+"</head><body class='frameBody'>"+content+"</body></html>";tryEnableDesignMode(doc,function(){$("#toolbar-"+element_id).remove();textarea.before(toolbar());textarea.hide();});}
function tryEnableDesignMode(doc,callback){if(!iframe){return false;}
try{iframe.contentWindow.document.open();iframe.contentWindow.document.write(doc);iframe.contentWindow.document.close();}catch(error){}
if(document.contentEditable){iframe.contentWindow.document.designMode="On";callback();return true;}
else if(document.designMode!=null){try{iframe.contentWindow.document.designMode="on";callback();return true;}catch(error){}}
setTimeout(function(){tryEnableDesignMode(doc,callback)},500);return false;}
function disableDesignMode(submit){var content=$(iframe).contents().find("body").html();if($(iframe).is(":visible")){textarea.val(content);}
if(submit!==true){textarea.show();$(iframe).hide();}}
function toolbar(){var tb=$("<div class='rte-toolbar' id='toolbar-"+element_id+"'><div>\
                    <a href='#' class='wdw-button wdw-tooltip bold' title='fett'><div class='wdw-button-symbol wdw-icon-bold'><div class='wdw-button-highlight'></div></div></a>\
                    <a href='#' class='wdw-button wdw-tooltip italic' title='kursiv'><div class='wdw-button-symbol wdw-icon-italic'><div class='wdw-button-highlight'></div></div></a></a>\
                    <a href='#' class='wdw-button wdw-tooltip unorderedlist' title='Liste'><div class='wdw-button-symbol wdw-icon-list'><div class='wdw-button-highlight'></div></div></a>\
                </div></div>");$('.bold',tb).click(function(){formatText('bold');return false;});$('.italic',tb).click(function(){formatText('italic');return false;});$('.unorderedlist',tb).click(function(){formatText('insertunorderedlist');return false;});if(opts.dot_net_button_class){var dot_net_button=$(iframe).parents('form').find(opts.dot_net_button_class);dot_net_button.click(function(){disableDesignMode(true);});}else{$(iframe).parents('form').submit(function(){disableDesignMode(true);});}
var iframeDoc=$(iframe.contentWindow.document);var select=$('select',tb)[0];iframeDoc.mouseup(function(){setSelectedType(getSelectionElement(),select);return true;});iframeDoc.keyup(function(){setSelectedType(getSelectionElement(),select);var body=$('body',iframeDoc);if(body.scrollTop()>0){var iframe_height=parseInt(iframe.style['height'])
if(isNaN(iframe_height))
iframe_height=0;var h=Math.min(opts.max_height,iframe_height+body.scrollTop())+'px';iframe.style['height']=h;alert(iframeDoc.getElementsByTagName("body")[0].innerHTML);$("#"+element_id).val(iframeDoc.getElementsByTagName("body")[0].innerHTML);}
return true;});return tb;};function formatText(command,option){iframe.contentWindow.focus();try{iframe.contentWindow.document.execCommand('styleWithCSS',false,false);iframe.contentWindow.document.execCommand(command,false,option);}catch(e){}
iframe.contentWindow.focus();};function setSelectedType(node,select){if(select){while(node.parentNode){var nName=node.nodeName.toLowerCase();for(var i=0;i<select.options.length;i++){if(nName==select.options[i].value){select.selectedIndex=i;return true;}}
node=node.parentNode;}
select.selectedIndex=0;return true;}else{return false;}};function getSelectionElement(){if(iframe.contentWindow.document.selection){selection=iframe.contentWindow.document.selection;range=selection.createRange();try{node=range.parentElement();}
catch(e){return false;}}else{try{selection=iframe.contentWindow.getSelection();range=selection.getRangeAt(0);}
catch(e){return false;}
node=range.commonAncestorContainer;}
return node;};enableDesignMode();});};}})(jQuery);/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4259 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */
(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())
+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')
+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);/*
 * jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 JÃ¶rn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";})
.mouseover(save)
.mouseout(hide)
.click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')
$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)
return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>')
.appendTo(document.body)
.hide();if($.fn.bgiframe)
helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}
function settings(element){return $.data(element,"tooltip");}
function handle(event){if(settings(this).delay)
tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}
function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))
return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}
helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)
helper.body.append("<br/>");helper.body.append(part);}
helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}
if(settings(this).showURL&&$(this).url())
helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)
helper.parent.fixPNG();handle.apply(this,arguments);}
function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))
helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}
update();}
function update(event){if($.tooltip.blocked)
return;if(event&&event.target.tagName=="OPTION"){return;}
if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}
if(current==null){$(document.body).unbind('mousemove',update);return;}
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}
helper.parent.css({left:left,right:right,top:top});}
var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}
if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}
function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}
function hide(event){if($.tooltip.blocked)
return;if(tID)
clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}
if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))
helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)
helper.parent.unfixPNG();}})(jQuery);(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c(i).data(q);Y();if(a.rel&&a.rel!=="nofollow"){g=c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa);a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=!c.support.opacity,O=x&&!window.XMLHttpRequest,aa="cbox_open",H="cbox_load",S="cbox_complete",T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n,slideshow:false,slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("<a/>");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('<div id="cbox'+d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F);c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()===a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+(a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")});m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('<div id="cboxLoadedContent"/>').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition==="fade"&&k.fadeTo(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c(i).data(q);Y();c.event.trigger(H);a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())});f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+"off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows");m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery);/*!
 * jQuery Cookie Plugin v1.3.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else{factory(jQuery);}}(function($){var pluses=/\+/g;function raw(s){return s;}
function decoded(s){return decodeURIComponent(s.replace(pluses,' '));}
function converted(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}
try{return config.json?JSON.parse(s):s;}catch(er){}}
var config=$.cookie=function(key,value,options){if(value!==undefined){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}
value=config.json?JSON.stringify(value):String(value);return(document.cookie=[config.raw?key:encodeURIComponent(key),'=',config.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
var decode=config.raw?raw:decoded;var cookies=document.cookie.split('; ');var result=key?undefined:{};for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=decode(parts.join('='));if(key&&key===name){result=converted(cookie);break;}
if(!key){result[name]=converted(cookie);}}
return result;};config.defaults={path:'/'};$.removeCookie=function(key,options){if($.cookie(key)!==undefined){$.cookie(key,'',$.extend({},options,{expires:-1}));return true;}
return false;};}));(function(e,g){"object"===typeof exports?module.exports=g():"function"===typeof define&&define.amd?define(g):e.IPv6=g()})(this,function(){return{best:function(e){e=e.toLowerCase().split(":");var g=e.length,h=8;""===e[0]&&""===e[1]&&""===e[2]?(e.shift(),e.shift()):""===e[0]&&""===e[1]?e.shift():""===e[g-1]&&""===e[g-2]&&e.pop();g=e.length;-1!==e[g-1].indexOf(".")&&(h=7);var c;for(c=0;c<g&&""!==e[c];c++);if(c<h)for(e.splice(c,1,"0000");e.length<h;)e.splice(c,0,"0000");for(c=0;c<h;c++){for(var g=e[c].split(""),l=0;3>l;l++)if("0"===g[0]&&1<g.length)g.splice(0,1);else break;e[c]=g.join("")}var g=-1,r=l=0,s=-1,t=!1;for(c=0;c<h;c++)t?"0"===e[c]?r+=1:(t=!1,r>l&&(g=s,l=r)):"0"==e[c]&&(t=!0,s=c,r=1);r>l&&(g=s,l=r);1<l&&e.splice(g,l,"");g=e.length;h="";""===e[0]&&(beststr=":");for(c=0;c<g;c++){h+=e[c];if(c===g-1)break;h+=":"}""===e[g-1]&&(h+=":");return h}}});(function(e){function g(a){throw RangeError(n[a]);}function h(a,b){for(var d=a.length;d--;)a[d]=b(a[d]);return a}function c(a){for(var b=[],d=0,c=a.length,q,n;d<c;)q=a.charCodeAt(d++),55296==(q&63488)&&d<c?(n=a.charCodeAt(d++),56320==(n&64512)?b.push(((q&1023)<<10)+(n&1023)+65536):b.push(q,n)):b.push(q);return b}function l(a){return h(a,function(a){var b="";65535<a&&(a-=65536,b+=D(a>>>10&1023|55296),a=56320|a&1023);return b+=D(a)}).join("")}function r(a,b,d){var c=0;a=d?z(a/C):a>>1;for(a+=z(a/b);a>v*w>>1;c+=p)a=z(a/v);return z(c+(v+1)*a/(a+A))}function s(d){var c=[],q=d.length,n,k=0,f=a,s=B,e,t,v,h,x;e=d.lastIndexOf(b);0>e&&(e=0);for(t=0;t<e;++t)128<=d.charCodeAt(t)&&g("not-basic"),c.push(d.charCodeAt(t));for(e=0<e?e+1:0;e<q;){t=k;n=1;for(v=p;;v+=p){e>=q&&g("invalid-input");h=d.charCodeAt(e++);h=10>h-48?h-22:26>h-65?h-65:26>h-97?h-97:p;(h>=p||h>z((m-k)/n))&&g("overflow");k+=h*n;x=v<=s?u:v>=s+w?w:v-s;if(h<x)break;h=p-x;n>z(m/h)&&g("overflow");n*=h}n=c.length+1;s=r(k-t,n,0==t);z(k/n)>m-f&&g("overflow");f+=z(k/n);k%=n;c.splice(k++,0,f)}return l(c)}function t(d){var q,n,k,e,f,s,t,h,v,x=[],y,l,A;d=c(d);y=d.length;q=a;n=0;f=B;for(s=0;s<y;++s)v=d[s],128>v&&x.push(D(v));for((k=e=x.length)&&x.push(b);k<y;){t=m;for(s=0;s<y;++s)v=d[s],v>=q&&v<t&&(t=v);l=k+1;t-q>z((m-n)/l)&&g("overflow");n+=(t-q)*l;q=t;for(s=0;s<y;++s)if(v=d[s],v<q&&++n>m&&g("overflow"),v==q){h=n;for(t=p;;t+=p){v=t<=f?u:t>=f+w?w:t-f;if(h<v)break;A=h-v;h=p-v;x.push(D(v+A%h+22+75*(26>v+A%h)-0));h=z(A/h)}x.push(D(h+22+75*(26>h)-0));f=r(n,l,k==e);n=0;++k}++n;++q}return x.join("")}var x,y="function"==typeof define&&"object"==typeof define.amd&&define.amd&&define,f="object"==typeof exports&&exports,k="object"==typeof module&&module,m=2147483647,p=36,u=1,w=26,A=38,C=700,B=72,a=128,b="-",d=/[^ -~]/,q=/^xn--/,n={overflow:"Overflow: input needs wider integers to process.","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=p-u,z=Math.floor,D=String.fromCharCode,E;x={version:"1.1.1",ucs2:{decode:c,encode:l},decode:s,encode:t,toASCII:function(a){return h(a.split("."),function(a){return d.test(a)?"xn--"+t(a):a}).join(".")},toUnicode:function(a){return h(a.split("."),function(a){return q.test(a)?s(a.slice(4).toLowerCase()):a}).join(".")}};if(f)if(k&&k.exports==f)k.exports=x;else for(E in x)x.hasOwnProperty(E)&&(f[E]=x[E]);else y?define("punycode",x):e.punycode=x})(this);(function(e,g){"object"===typeof exports?module.exports=g():"function"===typeof define&&define.amd?define(g):e.SecondLevelDomains=g()})(this,function(){var e=Object.prototype.hasOwnProperty,g={list:{ac:"com|gov|mil|net|org",ae:"ac|co|gov|mil|name|net|org|pro|sch",af:"com|edu|gov|net|org",al:"com|edu|gov|mil|net|org",ao:"co|ed|gv|it|og|pb",ar:"com|edu|gob|gov|int|mil|net|org|tur",at:"ac|co|gv|or",au:"asn|com|csiro|edu|gov|id|net|org",ba:"co|com|edu|gov|mil|net|org|rs|unbi|unmo|unsa|untz|unze",bb:"biz|co|com|edu|gov|info|net|org|store|tv",bh:"biz|cc|com|edu|gov|info|net|org",bn:"com|edu|gov|net|org",bo:"com|edu|gob|gov|int|mil|net|org|tv",br:"adm|adv|agr|am|arq|art|ato|b|bio|blog|bmd|cim|cng|cnt|com|coop|ecn|edu|eng|esp|etc|eti|far|flog|fm|fnd|fot|fst|g12|ggf|gov|imb|ind|inf|jor|jus|lel|mat|med|mil|mus|net|nom|not|ntr|odo|org|ppg|pro|psc|psi|qsl|rec|slg|srv|tmp|trd|tur|tv|vet|vlog|wiki|zlg",bs:"com|edu|gov|net|org",bz:"du|et|om|ov|rg",ca:"ab|bc|mb|nb|nf|nl|ns|nt|nu|on|pe|qc|sk|yk",ck:"biz|co|edu|gen|gov|info|net|org",cn:"ac|ah|bj|com|cq|edu|fj|gd|gov|gs|gx|gz|ha|hb|he|hi|hl|hn|jl|js|jx|ln|mil|net|nm|nx|org|qh|sc|sd|sh|sn|sx|tj|tw|xj|xz|yn|zj",co:"com|edu|gov|mil|net|nom|org",cr:"ac|c|co|ed|fi|go|or|sa",cy:"ac|biz|com|ekloges|gov|ltd|name|net|org|parliament|press|pro|tm","do":"art|com|edu|gob|gov|mil|net|org|sld|web",dz:"art|asso|com|edu|gov|net|org|pol",ec:"com|edu|fin|gov|info|med|mil|net|org|pro",eg:"com|edu|eun|gov|mil|name|net|org|sci",er:"com|edu|gov|ind|mil|net|org|rochest|w",es:"com|edu|gob|nom|org",et:"biz|com|edu|gov|info|name|net|org",fj:"ac|biz|com|info|mil|name|net|org|pro",fk:"ac|co|gov|net|nom|org",fr:"asso|com|f|gouv|nom|prd|presse|tm",gg:"co|net|org",gh:"com|edu|gov|mil|org",gn:"ac|com|gov|net|org",gr:"com|edu|gov|mil|net|org",gt:"com|edu|gob|ind|mil|net|org",gu:"com|edu|gov|net|org",hk:"com|edu|gov|idv|net|org",id:"ac|co|go|mil|net|or|sch|web",il:"ac|co|gov|idf|k12|muni|net|org","in":"ac|co|edu|ernet|firm|gen|gov|i|ind|mil|net|nic|org|res",iq:"com|edu|gov|i|mil|net|org",ir:"ac|co|dnssec|gov|i|id|net|org|sch",it:"edu|gov",je:"co|net|org",jo:"com|edu|gov|mil|name|net|org|sch",jp:"ac|ad|co|ed|go|gr|lg|ne|or",ke:"ac|co|go|info|me|mobi|ne|or|sc",kh:"com|edu|gov|mil|net|org|per",ki:"biz|com|de|edu|gov|info|mob|net|org|tel",km:"asso|com|coop|edu|gouv|k|medecin|mil|nom|notaires|pharmaciens|presse|tm|veterinaire",kn:"edu|gov|net|org",kr:"ac|busan|chungbuk|chungnam|co|daegu|daejeon|es|gangwon|go|gwangju|gyeongbuk|gyeonggi|gyeongnam|hs|incheon|jeju|jeonbuk|jeonnam|k|kg|mil|ms|ne|or|pe|re|sc|seoul|ulsan",kw:"com|edu|gov|net|org",ky:"com|edu|gov|net|org",kz:"com|edu|gov|mil|net|org",lb:"com|edu|gov|net|org",lk:"assn|com|edu|gov|grp|hotel|int|ltd|net|ngo|org|sch|soc|web",lr:"com|edu|gov|net|org",lv:"asn|com|conf|edu|gov|id|mil|net|org",ly:"com|edu|gov|id|med|net|org|plc|sch",ma:"ac|co|gov|m|net|org|press",mc:"asso|tm",me:"ac|co|edu|gov|its|net|org|priv",mg:"com|edu|gov|mil|nom|org|prd|tm",mk:"com|edu|gov|inf|name|net|org|pro",ml:"com|edu|gov|net|org|presse",mn:"edu|gov|org",mo:"com|edu|gov|net|org",mt:"com|edu|gov|net|org",mv:"aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro",mw:"ac|co|com|coop|edu|gov|int|museum|net|org",mx:"com|edu|gob|net|org",my:"com|edu|gov|mil|name|net|org|sch",nf:"arts|com|firm|info|net|other|per|rec|store|web",ng:"biz|com|edu|gov|mil|mobi|name|net|org|sch",ni:"ac|co|com|edu|gob|mil|net|nom|org",np:"com|edu|gov|mil|net|org",nr:"biz|com|edu|gov|info|net|org",om:"ac|biz|co|com|edu|gov|med|mil|museum|net|org|pro|sch",pe:"com|edu|gob|mil|net|nom|org|sld",ph:"com|edu|gov|i|mil|net|ngo|org",pk:"biz|com|edu|fam|gob|gok|gon|gop|gos|gov|net|org|web",pl:"art|bialystok|biz|com|edu|gda|gdansk|gorzow|gov|info|katowice|krakow|lodz|lublin|mil|net|ngo|olsztyn|org|poznan|pwr|radom|slupsk|szczecin|torun|warszawa|waw|wroc|wroclaw|zgora",pr:"ac|biz|com|edu|est|gov|info|isla|name|net|org|pro|prof",ps:"com|edu|gov|net|org|plo|sec",pw:"belau|co|ed|go|ne|or",ro:"arts|com|firm|info|nom|nt|org|rec|store|tm|www",rs:"ac|co|edu|gov|in|org",sb:"com|edu|gov|net|org",sc:"com|edu|gov|net|org",sh:"co|com|edu|gov|net|nom|org",sl:"com|edu|gov|net|org",st:"co|com|consulado|edu|embaixada|gov|mil|net|org|principe|saotome|store",sv:"com|edu|gob|org|red",sz:"ac|co|org",tr:"av|bbs|bel|biz|com|dr|edu|gen|gov|info|k12|name|net|org|pol|tel|tsk|tv|web",tt:"aero|biz|cat|co|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel",tw:"club|com|ebiz|edu|game|gov|idv|mil|net|org",mu:"ac|co|com|gov|net|or|org",mz:"ac|co|edu|gov|org",na:"co|com",nz:"ac|co|cri|geek|gen|govt|health|iwi|maori|mil|net|org|parliament|school",pa:"abo|ac|com|edu|gob|ing|med|net|nom|org|sld",pt:"com|edu|gov|int|net|nome|org|publ",py:"com|edu|gov|mil|net|org",qa:"com|edu|gov|mil|net|org",re:"asso|com|nom",ru:"ac|adygeya|altai|amur|arkhangelsk|astrakhan|bashkiria|belgorod|bir|bryansk|buryatia|cbg|chel|chelyabinsk|chita|chukotka|chuvashia|com|dagestan|e-burg|edu|gov|grozny|int|irkutsk|ivanovo|izhevsk|jar|joshkar-ola|kalmykia|kaluga|kamchatka|karelia|kazan|kchr|kemerovo|khabarovsk|khakassia|khv|kirov|koenig|komi|kostroma|kranoyarsk|kuban|kurgan|kursk|lipetsk|magadan|mari|mari-el|marine|mil|mordovia|mosreg|msk|murmansk|nalchik|net|nnov|nov|novosibirsk|nsk|omsk|orenburg|org|oryol|penza|perm|pp|pskov|ptz|rnd|ryazan|sakhalin|samara|saratov|simbirsk|smolensk|spb|stavropol|stv|surgut|tambov|tatarstan|tom|tomsk|tsaritsyn|tsk|tula|tuva|tver|tyumen|udm|udmurtia|ulan-ude|vladikavkaz|vladimir|vladivostok|volgograd|vologda|voronezh|vrn|vyatka|yakutia|yamal|yekaterinburg|yuzhno-sakhalinsk",rw:"ac|co|com|edu|gouv|gov|int|mil|net",sa:"com|edu|gov|med|net|org|pub|sch",sd:"com|edu|gov|info|med|net|org|tv",se:"a|ac|b|bd|c|d|e|f|g|h|i|k|l|m|n|o|org|p|parti|pp|press|r|s|t|tm|u|w|x|y|z",sg:"com|edu|gov|idn|net|org|per",sn:"art|com|edu|gouv|org|perso|univ",sy:"com|edu|gov|mil|net|news|org",th:"ac|co|go|in|mi|net|or",tj:"ac|biz|co|com|edu|go|gov|info|int|mil|name|net|nic|org|test|web",tn:"agrinet|com|defense|edunet|ens|fin|gov|ind|info|intl|mincom|nat|net|org|perso|rnrt|rns|rnu|tourism",tz:"ac|co|go|ne|or",ua:"biz|cherkassy|chernigov|chernovtsy|ck|cn|co|com|crimea|cv|dn|dnepropetrovsk|donetsk|dp|edu|gov|if|in|ivano-frankivsk|kh|kharkov|kherson|khmelnitskiy|kiev|kirovograd|km|kr|ks|kv|lg|lugansk|lutsk|lviv|me|mk|net|nikolaev|od|odessa|org|pl|poltava|pp|rovno|rv|sebastopol|sumy|te|ternopil|uzhgorod|vinnica|vn|zaporizhzhe|zhitomir|zp|zt",ug:"ac|co|go|ne|or|org|sc",uk:"ac|bl|british-library|co|cym|gov|govt|icnet|jet|lea|ltd|me|mil|mod|national-library-scotland|nel|net|nhs|nic|nls|org|orgn|parliament|plc|police|sch|scot|soc",us:"dni|fed|isa|kids|nsn",uy:"com|edu|gub|mil|net|org",ve:"co|com|edu|gob|info|mil|net|org|web",vi:"co|com|k12|net|org",vn:"ac|biz|com|edu|gov|health|info|int|name|net|org|pro",ye:"co|com|gov|ltd|me|net|org|plc",yu:"ac|co|edu|gov|org",za:"ac|agric|alt|bourse|city|co|cybernet|db|edu|gov|grondar|iaccess|imt|inca|landesign|law|mil|net|ngo|nis|nom|olivetti|org|pix|school|tm|web",zm:"ac|co|com|edu|gov|net|org|sch"},has_expression:null,is_expression:null,has:function(e){return!!e.match(g.has_expression)},is:function(e){return!!e.match(g.is_expression)},get:function(e){return(e=e.match(g.has_expression))&&e[1]||null},init:function(){var h="",c;for(c in g.list)e.call(g.list,c)&&(h+="|("+("("+g.list[c]+")."+c)+")");g.has_expression=RegExp("\\.("+h.substr(1)+")$","i");g.is_expression=RegExp("^("+h.substr(1)+")$","i")}};g.init();return g});(function(e,g){"object"===typeof exports?module.exports=g(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],g):e.URI=g(e.punycode,e.IPv6,e.SecondLevelDomains)})(this,function(e,g,h){function c(a,b){if(!(this instanceof c))return new c(a,b);void 0===a&&(a="undefined"!==typeof location?location.href+"":"");this.href(a);return void 0!==b?this.absoluteTo(b):this}function l(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function r(a){return String(Object.prototype.toString.call(a)).slice(8,-1)}function s(a){return"Array"===r(a)}function t(a,b){var d,c;if(s(b)){d=0;for(c=b.length;d<c;d++)if(!t(a,b[d]))return!1;return!0}var n=r(b);d=0;for(c=a.length;d<c;d++)if("RegExp"===n){if("string"===typeof a[d]&&a[d].match(b))return!0}else if(a[d]===b)return!0;return!1}function x(a,b){if(!s(a)||!s(b)||a.length!==b.length)return!1;a.sort();b.sort();for(var d=0,c=a.length;d<c;d++)if(a[d]!==b[d])return!1;return!0}function y(a){return encodeURIComponent(a).replace(/[!'()*]/g,escape).replace(/\*/g,"%2A")}var f=c.prototype,k=Object.prototype.hasOwnProperty;c._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:c.duplicateQueryParameters}};c.duplicateQueryParameters=!1;c.protocol_expression=/^[a-z][a-z0-9-+-]*$/i;c.idn_expression=/[^a-z0-9\.-]/i;c.punycode_expression=/(xn--)/i;c.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;c.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;c.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/ig;c.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};c.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/;c.encode=y;c.decode=decodeURIComponent;c.iso8859=function(){c.encode=escape;c.decode=unescape};c.unicode=function(){c.encode=y;c.decode=decodeURIComponent};c.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}};c.encodeQuery=function(a){return c.encode(a+"").replace(/%20/g,"+")};c.decodeQuery=function(a){return c.decode((a+"").replace(/\+/g,"%20"))};c.recodePath=function(a){a=(a+"").split("/");for(var b=0,d=a.length;b<d;b++)a[b]=c.encodePathSegment(c.decode(a[b]));return a.join("/")};c.decodePath=function(a){a=(a+"").split("/");for(var b=0,d=a.length;b<d;b++)a[b]=c.decodePathSegment(a[b]);return a.join("/")};var m={encode:"encode",decode:"decode"},p,u=function(a,b){return function(d){return c[b](d+
"").replace(c.characters[a][b].expression,function(d){return c.characters[a][b].map[d]})}};for(p in m)c[p+"PathSegment"]=u("pathname",m[p]);c.encodeReserved=u("reserved","encode");c.parse=function(a,b){var d;b||(b={});d=a.indexOf("#");-1<d&&(b.fragment=a.substring(d+1)||null,a=a.substring(0,d));d=a.indexOf("?");-1<d&&(b.query=a.substring(d+1)||null,a=a.substring(0,d));"//"===a.substring(0,2)?(b.protocol="",a=a.substring(2),a=c.parseAuthority(a,b)):(d=a.indexOf(":"),-1<d&&(b.protocol=a.substring(0,d),b.protocol&&!b.protocol.match(c.protocol_expression)?b.protocol=void 0:"file"===b.protocol?a=a.substring(d+3):"//"===a.substring(d+1,d+3)?(a=a.substring(d+3),a=c.parseAuthority(a,b)):(a=a.substring(d+1),b.urn=!0)));b.path=a;return b};c.parseHost=function(a,b){var d=a.indexOf("/"),c;-1===d&&(d=a.length);"["===a.charAt(0)?(c=a.indexOf("]"),b.hostname=a.substring(1,c)||null,b.port=a.substring(c+2,d)||null):a.indexOf(":")!==a.lastIndexOf(":")?(b.hostname=a.substring(0,d)||null,b.port=null):(c=a.substring(0,d).split(":"),b.hostname=c[0]||null,b.port=c[1]||null);b.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a);return a.substring(d)||"/"};c.parseAuthority=function(a,b){a=c.parseUserinfo(a,b);return c.parseHost(a,b)};c.parseUserinfo=function(a,b){var d=a.indexOf("@"),q=a.indexOf("/");-1<d&&(-1===q||d<q)?(q=a.substring(0,d).split(":"),b.username=q[0]?c.decode(q[0]):null,q.shift(),b.password=q[0]?c.decode(q.join(":")):null,a=a.substring(d+1)):(b.username=null,b.password=null);return a};c.parseQuery=function(a){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!a)return{};var b={};a=a.split("&");for(var d=a.length,q,n,k=0;k<d;k++)q=a[k].split("="),n=c.decodeQuery(q.shift()),q=q.length?c.decodeQuery(q.join("=")):null,b[n]?("string"===typeof b[n]&&(b[n]=[b[n]]),b[n].push(q)):b[n]=q;return b};c.build=function(a){var b="";a.protocol&&(b+=a.protocol+":");a.urn||!b&&!a.hostname||(b+="//");b+=c.buildAuthority(a)||"";"string"===typeof a.path&&("/"!==a.path.charAt(0)&&"string"===typeof a.hostname&&(b+="/"),b+=a.path);"string"===typeof a.query&&a.query&&(b+="?"+a.query);"string"===typeof a.fragment&&a.fragment&&(b+="#"+a.fragment);return b};c.buildHost=function(a){var b="";if(a.hostname)c.ip6_expression.test(a.hostname)?b=a.port?b+("["+a.hostname+"]:"+a.port):b+a.hostname:(b+=a.hostname,a.port&&(b+=":"+a.port));else return"";return b};c.buildAuthority=function(a){return c.buildUserinfo(a)+c.buildHost(a)};c.buildUserinfo=function(a){var b="";a.username&&(b+=c.encode(a.username),a.password&&(b+=":"+c.encode(a.password)),b+="@");return b};c.buildQuery=function(a,b){var d="",q,n,e,f;for(n in a)if(k.call(a,n)&&n)if(s(a[n]))for(q={},e=0,f=a[n].length;e<f;e++)void 0!==a[n][e]&&void 0===q[a[n][e]+""]&&(d+="&"+c.buildQueryParameter(n,a[n][e]),!0!==b&&(q[a[n][e]+""]=!0));else void 0!==a[n]&&(d+="&"+c.buildQueryParameter(n,a[n]));return d.substring(1)};c.buildQueryParameter=function(a,b){return c.encodeQuery(a)+(null!==b?"="+c.encodeQuery(b):"")};c.addQuery=function(a,b,d){if("object"===typeof b)for(var q in b)k.call(b,q)&&c.addQuery(a,q,b[q]);else if("string"===typeof b)void 0===a[b]?a[b]=d:("string"===typeof a[b]&&(a[b]=[a[b]]),s(d)||(d=[d]),a[b]=a[b].concat(d));else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");};c.removeQuery=function(a,b,d){var q;if(s(b))for(d=0,q=b.length;d<q;d++)a[b[d]]=void 0;else if("object"===typeof b)for(q in b)k.call(b,q)&&c.removeQuery(a,q,b[q]);else if("string"===typeof b)if(void 0!==d)if(a[b]===d)a[b]=void 0;else{if(s(a[b])){q=a[b];var n={},e,f;if(s(d))for(e=0,f=d.length;e<f;e++)n[d[e]]=!0;else n[d]=!0;e=0;for(f=q.length;e<f;e++)void 0!==n[q[e]]&&(q.splice(e,1),f--,e--);a[b]=q}}else a[b]=void 0;else throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");};c.hasQuery=function(a,b,d,q){if("object"===typeof b){for(var e in b)if(k.call(b,e)&&!c.hasQuery(a,e,b[e]))return!1;return!0}if("string"!==typeof b)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(r(d)){case"Undefined":return b in
a;case"Boolean":return a=Boolean(s(a[b])?a[b].length:a[b]),d===a;case"Function":return!!d(a[b],b,a);case"Array":return s(a[b])?(q?t:x)(a[b],d):!1;case"RegExp":return s(a[b])?q?t(a[b],d):!1:Boolean(a[b]&&a[b].match(d));case"Number":d=String(d);case"String":return s(a[b])?q?t(a[b],d):!1:a[b]===d;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");}};c.commonPath=function(a,b){var d=Math.min(a.length,b.length),c;for(c=0;c<d;c++)if(a.charAt(c)!==b.charAt(c)){c--;break}if(1>c)return a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(c)||"/"!==b.charAt(c))c=a.substring(0,c).lastIndexOf("/");return a.substring(0,c+1)};c.withinString=function(a,b){return a.replace(c.find_uri_expression,b)};c.ensureValidHostname=function(a){if(a.match(c.invalid_hostname_characters)){if(!e)throw new TypeError("Hostname '"+a+"' contains characters other than [A-Z0-9.-] and Punycode.js is not available");if(e.toASCII(a).match(c.invalid_hostname_characters))throw new TypeError("Hostname '"+
a+"' contains characters other than [A-Z0-9.-]");}};f.build=function(a){if(!0===a)this._deferred_build=!0;else if(void 0===a||this._deferred_build)this._string=c.build(this._parts),this._deferred_build=!1;return this};f.clone=function(){return new c(this)};f.valueOf=f.toString=function(){return this.build(!1)._string};m={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"};u=function(a){return function(b,d){if(void 0===b)return this._parts[a]||"";this._parts[a]=b;this.build(!d);return this}};for(p in m)f[p]=u(m[p]);m={query:"?",fragment:"#"};u=function(a,b){return function(d,c){if(void 0===d)return this._parts[a]||"";null!==d&&(d+="",d.charAt(0)===b&&(d=d.substring(1)));this._parts[a]=d;this.build(!c);return this}};for(p in m)f[p]=u(p,m[p]);m={search:["?","query"],hash:["#","fragment"]};u=function(a,b){return function(d,c){var e=this[a](d,c);return"string"===typeof e&&e.length?b+e:e}};for(p in m)f[p]=u(m[p][1],m[p][0]);f.pathname=function(a,b){if(void 0===a||!0===a){var d=this._parts.path||(this._parts.urn?"":"/");return a?c.decodePath(d):d}this._parts.path=a?c.recodePath(a):"/";this.build(!b);return this};f.path=f.pathname;f.href=function(a,b){var d;if(void 0===a)return this.toString();this._string="";this._parts=c._parts();var e=a instanceof c,n="object"===typeof a&&(a.hostname||a.path);!e&&(n&&void 0!==a.pathname)&&(a=a.toString());if("string"===typeof a)this._parts=c.parse(a,this._parts);else if(e||n)for(d in e=e?a._parts:a,e)k.call(this._parts,d)&&(this._parts[d]=e[d]);else throw new TypeError("invalid input");this.build(!b);return this};f.is=function(a){var b=!1,d=!1,e=!1,n=!1,k=!1,f=!1,s=!1,m=!this._parts.urn;this._parts.hostname&&(m=!1,d=c.ip4_expression.test(this._parts.hostname),e=c.ip6_expression.test(this._parts.hostname),b=d||e,k=(n=!b)&&h&&h.has(this._parts.hostname),f=n&&c.idn_expression.test(this._parts.hostname),s=n&&c.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case"relative":return m;case"absolute":return!m;case"domain":case"name":return n;case"sld":return k;case"ip":return b;case"ip4":case"ipv4":case"inet4":return d;case"ip6":case"ipv6":case"inet6":return e;case"idn":return f;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return s}return null};var w=f.protocol,A=f.port,C=f.hostname;f.protocol=function(a,b){if(void 0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),a.match(/[^a-zA-z0-9\.+-]/)))throw new TypeError("Protocol '"+a+"' contains characters other than [A-Z0-9.+-]");return w.call(this,a,b)};f.scheme=f.protocol;f.port=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a&&(0===a&&(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),a.match(/[^0-9]/))))throw new TypeError("Port '"+a+"' contains characters other than [0-9]");return A.call(this,a,b)};f.hostname=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var d={};c.parseHost(a,d);a=d.hostname}return C.call(this,a,b)};f.host=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?c.buildHost(this._parts):"";c.parseHost(a,this._parts);this.build(!b);return this};f.authority=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?c.buildAuthority(this._parts):"";c.parseAuthority(a,this._parts);this.build(!b);return this};f.userinfo=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.username)return"";var d=c.buildUserinfo(this._parts);return d.substring(0,d.length-1)}"@"!==a[a.length-1]&&(a+="@");c.parseUserinfo(a,this._parts);this.build(!b);return this};f.resource=function(a,b){var d;if(void 0===a)return this.path()+this.search()+this.hash();d=c.parse(a);this._parts.path=d.path;this._parts.query=d.query;this._parts.fragment=d.fragment;this.build(!b);return this};f.subdomain=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.length-this.domain().length-
1;return this._parts.hostname.substring(0,d)||""}d=this._parts.hostname.length-this.domain().length;d=this._parts.hostname.substring(0,d);d=RegExp("^"+l(d));a&&"."!==a.charAt(a.length-1)&&(a+=".");a&&c.ensureValidHostname(a);this._parts.hostname=this._parts.hostname.replace(d,a);this.build(!b);return this};f.domain=function(a,b){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.match(/\./g);if(d&&2>d.length)return this._parts.hostname;d=this._parts.hostname.length-this.tld(b).length-1;d=this._parts.hostname.lastIndexOf(".",d-1)+1;return this._parts.hostname.substring(d)||""}if(!a)throw new TypeError("cannot set domain empty");c.ensureValidHostname(a);!this._parts.hostname||this.is("IP")?this._parts.hostname=a:(d=RegExp(l(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a));this.build(!b);return this};f.tld=function(a,b){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.lastIndexOf("."),d=this._parts.hostname.substring(d+1);return!0!==b&&h&&h.list[d.toLowerCase()]?h.get(this._parts.hostname)||d:d}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(h&&h.is(a))d=RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a);else throw new TypeError("TLD '"+a+"' contains characters other than [A-Z0-9]");else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");d=RegExp(l(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(d,a)}else throw new TypeError("cannot set TLD empty");this.build(!b);return this};f.directory=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var d=this._parts.path.length-this.filename().length-1,d=this._parts.path.substring(0,d)||(this._parts.hostname?"/":"");return a?c.decodePath(d):d}d=this._parts.path.length-this.filename().length;d=this._parts.path.substring(0,d);d=RegExp("^"+l(d));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=c.recodePath(a);this._parts.path=this._parts.path.replace(d,a);this.build(!b);return this};f.filename=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this._parts.path.lastIndexOf("/"),d=this._parts.path.substring(d+1);return a?c.decodePathSegment(d):d}d=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\.?\//)&&(d=!0);var e=RegExp(l(this.filename())+"$");a=c.recodePath(a);this._parts.path=this._parts.path.replace(e,a);d?this.normalizePath(b):this.build(!b);return this};f.suffix=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this.filename(),e=d.lastIndexOf(".");if(-1===e)return"";d=d.substring(e+1);d=/^[a-z0-9%]+$/i.test(d)?d:"";return a?c.decodePathSegment(d):d}"."===a.charAt(0)&&(a=a.substring(1));if(d=this.suffix())e=a?RegExp(l(d)+"$"):RegExp(l("."+d)+"$");else{if(!a)return this;this._parts.path+="."+c.recodePath(a)}e&&(a=c.recodePath(a),this._parts.path=this._parts.path.replace(e,a));this.build(!b);return this};f.segment=function(a,b,d){var c=this._parts.urn?":":"/",e=this.path(),k="/"===e.substring(0,1),e=e.split(c);"number"!==typeof a&&(d=b,b=a,a=void 0);if(void 0!==a&&"number"!==typeof a)throw Error("Bad segment '"+a+"', must be 0-based integer");k&&e.shift();0>a&&(a=Math.max(e.length+a,0));if(void 0===b)return void 0===a?e:e[a];if(null===a||void 0===e[a])if(s(b))e=b;else{if(b||"string"===typeof b&&b.length)""===e[e.length-1]?e[e.length-1]=b:e.push(b)}else b||"string"===typeof b&&b.length?e[a]=b:e.splice(a,1);k&&e.unshift("");return this.path(e.join(c),d)};var B=f.query;f.query=function(a,b){if(!0===a)return c.parseQuery(this._parts.query);if("function"===typeof a){var d=c.parseQuery(this._parts.query),e=a.call(this,d);this._parts.query=c.buildQuery(e||d,this._parts.duplicateQueryParameters);this.build(!b);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=c.buildQuery(a,this._parts.duplicateQueryParameters),this.build(!b),this):B.call(this,a,b)};f.setQuery=function(a,b,d){var e=c.parseQuery(this._parts.query);if("object"===typeof a)for(var f in a)k.call(a,f)&&(e[f]=a[f]);else if("string"===typeof a)e[a]=void 0!==b?b:null;else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters);"string"!==typeof a&&(d=b);this.build(!d);return this};f.addQuery=function(a,b,d){var e=c.parseQuery(this._parts.query);c.addQuery(e,a,void 0===b?null:b);this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters);"string"!==typeof a&&(d=b);this.build(!d);return this};f.removeQuery=function(a,b,d){var e=c.parseQuery(this._parts.query);c.removeQuery(e,a,b);this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters);"string"!==typeof a&&(d=b);this.build(!d);return this};f.hasQuery=function(a,b,d){var e=c.parseQuery(this._parts.query);return c.hasQuery(e,a,b,d)};f.setSearch=f.setQuery;f.addSearch=f.addQuery;f.removeSearch=f.removeQuery;f.hasSearch=f.hasQuery;f.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()};f.normalizeProtocol=function(a){"string"===typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!a));return this};f.normalizeHostname=function(a){this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&g&&(this._parts.hostname=g.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!a));return this};f.normalizePort=function(a){"string"===typeof this._parts.protocol&&this._parts.port===c.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a));return this};f.normalizePath=function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)return this;var b,d=this._parts.path,e,k;"/"!==d.charAt(0)&&("."===d.charAt(0)&&d.substring(0,d.indexOf("/")),b=!0,d="/"+d);for(d=d.replace(/(\/(\.\/)+)|\/{2,}/g,"/");;){e=d.indexOf("/../");if(-1===e)break;else if(0===e){d=d.substring(3);break}k=d.substring(0,e).lastIndexOf("/");-1===k&&(k=e);d=d.substring(0,k)+d.substring(e+3)}b&&this.is("relative")&&(d=d.substring(1));d=c.recodePath(d);this._parts.path=d;this.build(!a);return this};f.normalizePathname=f.normalizePath;f.normalizeQuery=function(a){"string"===typeof this._parts.query&&(this._parts.query.length?this.query(c.parseQuery(this._parts.query)):this._parts.query=null,this.build(!a));return this};f.normalizeFragment=function(a){this._parts.fragment||(this._parts.fragment=null,this.build(!a));return this};f.normalizeSearch=f.normalizeQuery;f.normalizeHash=f.normalizeFragment;f.iso8859=function(){var a=c.encode,b=c.decode;c.encode=escape;c.decode=decodeURIComponent;this.normalize();c.encode=a;c.decode=b;return this};f.unicode=function(){var a=c.encode,b=c.decode;c.encode=y;c.decode=unescape;this.normalize();c.encode=a;c.decode=b;return this};f.readable=function(){var a=this.clone();a.username("").password("").normalize();var b="";a._parts.protocol&&(b+=a._parts.protocol+"://");a._parts.hostname&&(a.is("punycode")&&e?(b+=e.toUnicode(a._parts.hostname),a._parts.port&&(b+=":"+a._parts.port)):b+=a.host());a._parts.hostname&&(a._parts.path&&"/"!==a._parts.path.charAt(0))&&(b+="/");b+=a.path(!0);if(a._parts.query){for(var d="",k=0,f=a._parts.query.split("&"),s=f.length;k<s;k++){var m=(f[k]||"").split("="),d=d+("&"+c.decodeQuery(m[0]).replace(/&/g,"%26"));void 0!==m[1]&&(d+="="+c.decodeQuery(m[1]).replace(/&/g,"%26"))}b+="?"+d.substring(1)}return b+=a.hash()};f.absoluteTo=function(a){var b=this.clone(),d=["protocol","username","password","hostname","port"],e,k;if(this._parts.urn)throw Error("URNs do not have any generally defined hierachical components");a instanceof c||(a=new c(a));b._parts.protocol||(b._parts.protocol=a._parts.protocol);if(this._parts.hostname)return b;e=0;for(k;k=d[e];e++)b._parts[k]=a._parts[k];d=["query","path"];e=0;for(k;k=d[e];e++)!b._parts[k]&&a._parts[k]&&(b._parts[k]=a._parts[k]);"/"!==b.path().charAt(0)&&(a=a.directory(),b._parts.path=(a?a+"/":"")+b._parts.path,b.normalizePath());b.build();return b};f.relativeTo=function(a){var b=this.clone(),d=["protocol","username","password","hostname","port"],e;if(b._parts.urn)throw Error("URNs do not have any generally defined hierachical components");a instanceof c||(a=new c(a));if("/"!==b.path().charAt(0)||"/"!==a.path().charAt(0))throw Error("Cannot calculate common path from non-relative URLs");e=c.commonPath(b.path(),a.path());for(var k=0,f;f=d[k];k++)b._parts[f]=null;if("/"===e)return b;if(!e)return this.clone();a=a.directory();d=b.directory();if(a===d)return b._parts.path=b.filename(),b.build();a.substring(e.length);d=d.substring(e.length);if(a+"/"===e)return d&&(d+="/"),b._parts.path=d+b.filename(),b.build();d="../";e=RegExp("^"+l(e));for(a=a.replace(e,"/").match(/\//g).length-1;a--;)d+="../";b._parts.path=b._parts.path.replace(e,d);return b.build()};f.equals=function(a){var b=this.clone();a=new c(a);var d={},e={},f={},m;b.normalize();a.normalize();if(b.toString()===a.toString())return!0;d=b.query();e=a.query();b.query("");a.query("");if(b.toString()!==a.toString()||d.length!==e.length)return!1;d=c.parseQuery(d);e=c.parseQuery(e);for(m in d)if(k.call(d,m)){if(!s(d[m])){if(d[m]!==e[m])return!1}else if(!x(d[m],e[m]))return!1;f[m]=!0}for(m in e)if(k.call(e,m)&&!f[m])return!1;return!0};f.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=!!a;return this};return c});(function(e,g){"object"===typeof exports?module.exports=g(require("./URI")):"function"===typeof define&&define.amd?define(["./URI"],g):e.URITemplate=g(e.URI)})(this,function(e){function g(c){if(g._cache[c])return g._cache[c];if(!(this instanceof g))return new g(c);this.expression=c;g._cache[c]=this;return this}function h(c){this.data=c;this.cache={}}var c=Object.prototype.hasOwnProperty,l=g.prototype,r={"":{prefix:"",separator:",",named:!1,empty_name_separator:!1,encode:"encode"},"+":{prefix:"",separator:",",named:!1,empty_name_separator:!1,encode:"encodeReserved"},"#":{prefix:"#",separator:",",named:!1,empty_name_separator:!1,encode:"encodeReserved"},".":{prefix:".",separator:".",named:!1,empty_name_separator:!1,encode:"encode"},"/":{prefix:"/",separator:"/",named:!1,empty_name_separator:!1,encode:"encode"},";":{prefix:";",separator:";",named:!0,empty_name_separator:!1,encode:"encode"},"?":{prefix:"?",separator:"&",named:!0,empty_name_separator:!0,encode:"encode"},"&":{prefix:"&",separator:"&",named:!0,empty_name_separator:!0,encode:"encode"}};g._cache={};g.EXPRESSION_PATTERN=/\{([^a-zA-Z0-9%_]?)([^\}]+)(\}|$)/g;g.VARIABLE_PATTERN=/^([^*:]+)((\*)|:(\d+))?$/;g.VARIABLE_NAME_PATTERN=/[^a-zA-Z0-9%_]/;g.expand=function(c,e){var h=r[c.operator],y=h.named?"Named":"Unnamed",f=c.variables,k=[],m,p,u;for(u=0;p=f[u];u++)m=e.get(p.name),m.val.length?k.push(g["expand"+y](m,h,p.explode,p.explode&&h.separator||",",p.maxlength,p.name)):m.type&&k.push("");return k.length?h.prefix+k.join(h.separator):""};g.expandNamed=function(c,g,h,y,f,k){var m="",p=g.encode;g=g.empty_name_separator;var u=!c[p].length,w=2===c.type?"":e[p](k),l,r,B;r=0;for(B=c.val.length;r<B;r++)f?(l=e[p](c.val[r][1].substring(0,f)),2===c.type&&(w=e[p](c.val[r][0].substring(0,f)))):u?(l=e[p](c.val[r][1]),2===c.type?(w=e[p](c.val[r][0]),c[p].push([w,l])):c[p].push([void 0,l])):(l=c[p][r][1],2===c.type&&(w=c[p][r][0])),m&&(m+=y),h?m+=w+(g||l?"=":"")+l:(r||(m+=e[p](k)+(g||l?"=":"")),2===c.type&&(m+=w+","),m+=l);return m};g.expandUnnamed=function(c,g,h,l,f,k){k="";var m=g.encode;g=g.empty_name_separator;var p=!c[m].length,u,w,r,C;r=0;for(C=c.val.length;r<C;r++)f?w=e[m](c.val[r][1].substring(0,f)):p?(w=e[m](c.val[r][1]),c[m].push([2===c.type?e[m](c.val[r][0]):void 0,w])):w=c[m][r][1],k&&(k+=l),2===c.type&&(u=f?e[m](c.val[r][0].substring(0,f)):c[m][r][0],k+=u,k=h?k+(g||w?"=":""):k+","),k+=w;return k};l.expand=function(c){var e="";this.parts&&this.parts.length||this.parse();c instanceof h||(c=new h(c));for(var l=0,r=this.parts.length;l<r;l++)e+="string"===typeof this.parts[l]?this.parts[l]:g.expand(this.parts[l],c);return e};l.parse=function(){var c=this.expression,e=g.EXPRESSION_PATTERN,h=g.VARIABLE_PATTERN,l=g.VARIABLE_NAME_PATTERN,f=[],k=0,m,p,u;for(e.lastIndex=0;;){p=e.exec(c);if(null===p){f.push(c.substring(k));break}else f.push(c.substring(k,p.index)),k=p.index+p[0].length;if(!r[p[1]])throw Error('Unknown Operator "'+p[1]+'" in "'+p[0]+'"');if(!p[3])throw Error('Unclosed Expression "'+p[0]+'"');m=p[2].split(",");for(var w=0,A=m.length;w<A;w++){u=m[w].match(h);if(null===u)throw Error('Invalid Variable "'+m[w]+'" in "'+p[0]+'"');if(u[1].match(l))throw Error('Invalid Variable Name "'+u[1]+'" in "'+p[0]+'"');m[w]={name:u[1],explode:!!u[3],maxlength:u[4]&&parseInt(u[4],10)}}if(!m.length)throw Error('Expression Missing Variable(s) "'+p[0]+'"');f.push({expression:p[0],operator:p[1],variables:m})}f.length||f.push(c);this.parts=f;return this};h.prototype.get=function(e){var g=this.data,h={type:0,val:[],encode:[],encodeReserved:[]},l;if(void 0!==this.cache[e])return this.cache[e];this.cache[e]=h;g="[object Function]"===String(Object.prototype.toString.call(g))?g(e):"[object Function]"===String(Object.prototype.toString.call(g[e]))?g[e](e):g[e];if(void 0!==g&&null!==g)if("[object Array]"===String(Object.prototype.toString.call(g))){l=0;for(e=g.length;l<e;l++)void 0!==g[l]&&null!==g[l]&&h.val.push([void 0,String(g[l])]);h.val.length&&(h.type=3)}else if("[object Object]"===String(Object.prototype.toString.call(g))){for(l in g)c.call(g,l)&&(void 0!==g[l]&&null!==g[l])&&h.val.push([l,String(g[l])]);h.val.length&&(h.type=2)}else h.type=1,h.val.push([void 0,String(g)]);return h};e.expand=function(c,h){var l=(new g(c)).expand(h);return new e(l)};return g});(function(e,g){"object"===typeof exports?module.exports=g(require("jquery","./URI")):"function"===typeof define&&define.amd?define(["jquery","./URI"],g):g(e.jQuery,e.URI)})(this,function(e,g){function h(c){return c.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function c(c){var f;e.each(["src","href","action"],function(e,g){return g in c?(f=g,!1):!0});return"input"===c.nodeName.toLowerCase()&&"image"!==c.type?void 0:f?f:"src"}function l(c){return{get:function(f){return e(f).uri()[c]()},set:function(f,g){e(f).uri()[c](g);return g}}}function r(k,g){var h,l,r;if(!c(k)||!g)return!1;h=g.match(f);if(!h||!h[5]&&":"!==h[2]&&!t[h[2]])return!1;r=e(k).uri();if(h[5])return r.is(h[5]);if(":"===h[2])return l=h[1].toLowerCase()+":",t[l]?t[l](r,h[4]):!1;l=h[1].toLowerCase();return s[l]?t[h[2]](r[l](),h[4],l):!1}var s={},t={"=":function(c,e){return c===e},"^=":function(c,e,f){return!!(c+"").match(RegExp("^"+h(e),"i"))},"$=":function(c,e,f){return!!(c+"").match(RegExp(h(e)+"$","i"))},"*=":function(c,e,f){"directory"==f&&(c+="/");return!!(c+"").match(RegExp(h(e),"i"))},"equals:":function(c,e){return c.equals(e)},"is:":function(c,e){return c.is(e)}};e.each("authority directory domain filename fragment hash host hostname href password path pathname port protocol query resource scheme search subdomain suffix tld username".split(" "),function(c,f){s[f]=!0;e.attrHooks["uri:"+f]=l(f)});var x=function(c,f){return e(c).uri().href(f).toString()};e.each(["src","href","action","uri"],function(c,f){e.attrHooks[f]={set:x}});e.attrHooks.uri.get=function(c){return e(c).uri()};e.fn.uri=function(e){var f=this.first(),h=f.get(0),l=c(h);if(!l)throw Error('Element "'+h.nodeName+'" does not have either property: href, src, action');if(void 0!==e){var r=f.data("uri");if(r)return r.href(e);e instanceof g||(e=g(e))}else{if(e=f.data("uri"))return e;e=g(f.attr(l))}e._dom_element=h;e._dom_attribute=l;e.normalize();f.data("uri",e);return e};g.prototype.build=function(c){if(this._dom_element)this._string=g.build(this._parts),this._deferred_build=!1,this._dom_element.setAttribute(this._dom_attribute,this._string),this._dom_element[this._dom_attribute]=this._string;else if(!0===c)this._deferred_build=!0;else if(void 0===c||this._deferred_build)this._string=g.build(this._parts),this._deferred_build=!1;return this};var y,f=/^([a-zA-Z]+)\s*([\^\$*]?=|:)\s*(['"]?)(.+)\3|^\s*([a-zA-Z0-9]+)\s*$/;y=e.expr.createPseudo?e.expr.createPseudo(function(c){return function(e){return r(e,c)}}):function(c,e,f){return r(c,f[3])};e.expr[":"].uri=y;return{}});(function($){function Tipsy(element,options){this.$element=$(element);this.options=options;this.enabled=true;this.fixTitle();}
Tipsy.prototype={show:function(){var title=this.getTitle();if(title&&this.enabled){var $tip=this.tip();$tip.find('.tipsy-inner')[this.options.html?'html':'text'](title);$tip[0].className='tipsy';$tip.remove().css({top:0,left:0,visibility:'hidden',display:'block'}).appendTo(document.body);var pos=$.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var actualWidth=$tip[0].offsetWidth,actualHeight=$tip[0].offsetHeight;var gravity=(typeof this.options.gravity=='function')?this.options.gravity.call(this.$element[0],pos,actualWidth,actualHeight):this.options.gravity;var tp;switch(gravity.charAt(0)){case'n':tp={top:pos.top+pos.height+this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case's':tp={top:pos.top-actualHeight-this.options.offset,left:pos.left+pos.width/2-actualWidth/2};break;case'e':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth-this.options.offset};break;case'w':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width+this.options.offset};break;}
if(gravity.length==2){if(gravity.charAt(1)=='w'){tp.left=pos.left+pos.width/2-15;}else{tp.left=pos.left+pos.width/2-actualWidth+15;}}
$tip.css(tp).addClass('tipsy-'+gravity);if(this.options.fade){$tip.stop().css({opacity:0,display:'block',visibility:'visible'}).animate({opacity:this.options.opacity});}else{$tip.css({visibility:'visible',opacity:this.options.opacity});}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){$(this).remove();});}else{this.tip().remove();}},fixTitle:function(){var $e=this.$element;if($e.attr('title')){$e.attr('original-title',$e.attr('title')||'').removeAttr('title');}},getTitle:function(){var title,$e=this.$element,o=this.options;this.fixTitle();var title,o=this.options;if(typeof o.title=='string'){title=$e.attr(o.title=='title'?'original-title':o.title);}else if(typeof o.title=='function'){title=o.title.call($e[0]);}
title=(''+title).replace(/(^\s*|\s*$)/,"");return title||o.fallback;},tip:function(){if(!this.$tip){this.$tip=$('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');}
return this.$tip;},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null;}},enable:function(){this.enabled=true;},disable:function(){this.enabled=false;},toggleEnabled:function(){this.enabled=!this.enabled;}};$.fn.tipsy=function(options){if(options===true){return this.data('tipsy');}else if(typeof options=='string'){var tipsy=this.data('tipsy');if(tipsy)tipsy[options]();return this;}
options=$.extend({},$.fn.tipsy.defaults,options);function get(ele){var tipsy=$.data(ele,'tipsy');if(!tipsy){tipsy=new Tipsy(ele,$.fn.tipsy.elementOptions(ele,options));$.data(ele,'tipsy',tipsy);}
return tipsy;}
function enter(){var tipsy=get(this);tipsy.hoverState='in';if(options.delayIn==0){tipsy.show();}else{tipsy.fixTitle();setTimeout(function(){if(tipsy.hoverState=='in')tipsy.show();},options.delayIn);}
return false;};function leave(){var tipsy=get(this);tipsy.hoverState='out';if(options.delayOut==0){tipsy.hide();}else{setTimeout(function(){if(tipsy.hoverState=='out')tipsy.hide();},options.delayOut);}
return false;};if(!options.live)this.each(function(){get(this);});if(options.trigger!='manual'){var binder=options.live?'live':'bind',eventIn=options.trigger=='hover'?'mouseenter':'focus',eventOut=options.trigger=='hover'?'mouseleave':'blur';this[binder](eventIn,enter)[binder](eventOut,leave);}
return this;};$.fn.tipsy.defaults={delayIn:0,delayOut:0,fade:false,fallback:'',gravity:'n',html:false,live:false,offset:0,opacity:0.8,title:'title',trigger:'hover'};$.fn.tipsy.elementOptions=function(ele,options){return $.metadata?$.extend({},options,$(ele).metadata()):options;};$.fn.tipsy.autoNS=function(){return $(this).offset().top>($(document).scrollTop()+$(window).height()/2)?'s':'n';};$.fn.tipsy.autoWE=function(){return $(this).offset().left>($(document).scrollLeft()+$(window).width()/2)?'e':'w';};$.fn.tipsy.autoNSWE=function(){var NS=$(this).offset().top-($(document).scrollTop()+$(window).height()/2);var WE=$(this).offset().left-($(document).scrollLeft()+$(window).width()/2);if(Math.abs(NS)>Math.abs(WE)){return NS>0?'s':'n';}else{return WE>0?'e':'w';}}
$.fn.tipsy.autoNSfix=function(pos,width,height){if(pos.top>$(document).scrollTop()+$(window).height()/2){if(pos.left+pos.width/2-width/2<$(document).scrollLeft()){return'sw';}else if(pos.left+pos.width/2+width/2>$(document).scrollLeft()+$(window).width()){return'se';}else{return's';}}else{if(pos.left+pos.width/2-width/2<$(document).scrollLeft()){return'nw';}else if(pos.left+pos.width/2+width/2>$(document).scrollLeft()+$(window).width()){return'ne';}else{return'n';}}}})(jQuery);