Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
/*! URI.js v1.14.0 http://medialize.github.io/URI.js/ */
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URITemplate.js */
(function(f,m){"object"===typeof exports?module.exports=m():"function"===typeof define&&define.amd?define(m):f.IPv6=m(f)})(this,function(f){var m=f&&f.IPv6;return{best:function(g){g=g.toLowerCase().split(":");var h=g.length,c=8;""===g[0]&&""===g[1]&&""===g[2]?(g.shift(),g.shift()):""===g[0]&&""===g[1]?g.shift():""===g[h-1]&&""===g[h-2]&&g.pop();h=g.length;-1!==g[h-1].indexOf(".")&&(c=7);var l;for(l=0;l<h&&""!==g[l];l++);if(l<c)for(g.splice(l,1,"0000");g.length<c;)g.splice(l,0,"0000");for(l=0;l<c;l++){for(var h=
g[l].split(""),f=0;3>f;f++)if("0"===h[0]&&1<h.length)h.splice(0,1);else break;g[l]=h.join("")}var h=-1,m=f=0,k=-1,u=!1;for(l=0;l<c;l++)u?"0"===g[l]?m+=1:(u=!1,m>f&&(h=k,f=m)):"0"===g[l]&&(u=!0,k=l,m=1);m>f&&(h=k,f=m);1<f&&g.splice(h,f,"");h=g.length;c="";""===g[0]&&(c=":");for(l=0;l<h;l++){c+=g[l];if(l===h-1)break;c+=":"}""===g[h-1]&&(c+=":");return c},noConflict:function(){f.IPv6===this&&(f.IPv6=m);return this}}});
(function(f){function m(c){throw RangeError(v[c]);}function g(c,a){for(var b=c.length;b--;)c[b]=a(c[b]);return c}function h(c,a){return g(c.split(s),a).join(".")}function c(c){for(var a=[],b=0,d=c.length,p,x;b<d;)p=c.charCodeAt(b++),55296<=p&&56319>=p&&b<d?(x=c.charCodeAt(b++),56320==(x&64512)?a.push(((p&1023)<<10)+(x&1023)+65536):(a.push(p),b--)):a.push(p);return a}function l(c){return g(c,function(a){var b="";65535<a&&(a-=65536,b+=y(a>>>10&1023|55296),a=56320|a&1023);return b+=y(a)}).join("")}function w(c,
a){return c+22+75*(26>c)-((0!=a)<<5)}function r(c,a,b){var d=0;c=b?t(c/700):c>>1;for(c+=t(c/a);455<c;d+=36)c=t(c/35);return t(d+36*c/(c+38))}function k(c){var a=[],b=c.length,d,p=0,x=128,e=72,k,g,f,h,u;k=c.lastIndexOf("-");0>k&&(k=0);for(g=0;g<k;++g)128<=c.charCodeAt(g)&&m("not-basic"),a.push(c.charCodeAt(g));for(k=0<k?k+1:0;k<b;){g=p;d=1;for(f=36;;f+=36){k>=b&&m("invalid-input");h=c.charCodeAt(k++);h=10>h-48?h-22:26>h-65?h-65:26>h-97?h-97:36;(36<=h||h>t((2147483647-p)/d))&&m("overflow");p+=h*d;u=
f<=e?1:f>=e+26?26:f-e;if(h<u)break;h=36-u;d>t(2147483647/h)&&m("overflow");d*=h}d=a.length+1;e=r(p-g,d,0==g);t(p/d)>2147483647-x&&m("overflow");x+=t(p/d);p%=d;a.splice(p++,0,x)}return l(a)}function u(e){var a,b,d,p,x,k,g,h,f,u=[],n,l,q;e=c(e);n=e.length;a=128;b=0;x=72;for(k=0;k<n;++k)f=e[k],128>f&&u.push(y(f));for((d=p=u.length)&&u.push("-");d<n;){g=2147483647;for(k=0;k<n;++k)f=e[k],f>=a&&f<g&&(g=f);l=d+1;g-a>t((2147483647-b)/l)&&m("overflow");b+=(g-a)*l;a=g;for(k=0;k<n;++k)if(f=e[k],f<a&&2147483647<
++b&&m("overflow"),f==a){h=b;for(g=36;;g+=36){f=g<=x?1:g>=x+26?26:g-x;if(h<f)break;q=h-f;h=36-f;u.push(y(w(f+q%h,0)));h=t(q/h)}u.push(y(w(h,0)));x=r(b,l,d==p);b=0;++d}++b;++a}return u.join("")}var A="object"==typeof exports&&exports,B="object"==typeof module&&module&&module.exports==A&&module,z="object"==typeof global&&global;if(z.global===z||z.window===z)f=z;var e,q=/^xn--/,n=/[^ -~]/,s=/\x2E|\u3002|\uFF0E|\uFF61/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)",
"invalid-input":"Invalid input"},t=Math.floor,y=String.fromCharCode,C;e={version:"1.2.3",ucs2:{decode:c,encode:l},decode:k,encode:u,toASCII:function(c){return h(c,function(a){return n.test(a)?"xn--"+u(a):a})},toUnicode:function(c){return h(c,function(a){return q.test(a)?k(a.slice(4).toLowerCase()):a})}};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return e});else if(A&&!A.nodeType)if(B)B.exports=e;else for(C in e)e.hasOwnProperty(C)&&(A[C]=e[C]);else f.punycode=
e})(this);
(function(f,m){"object"===typeof exports?module.exports=m():"function"===typeof define&&define.amd?define(m):f.SecondLevelDomains=m(f)})(this,function(f){var m=f&&f.SecondLevelDomains,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 ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
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:function(h){var c=h.lastIndexOf(".");if(0>=c||c>=h.length-1)return!1;
var f=h.lastIndexOf(".",c-1);if(0>=f||f>=c-1)return!1;var m=g.list[h.slice(c+1)];return m?0<=m.indexOf(" "+h.slice(f+1,c)+" "):!1},is:function(f){var c=f.lastIndexOf(".");if(0>=c||c>=f.length-1||0<=f.lastIndexOf(".",c-1))return!1;var l=g.list[f.slice(c+1)];return l?0<=l.indexOf(" "+f.slice(0,c)+" "):!1},get:function(f){var c=f.lastIndexOf(".");if(0>=c||c>=f.length-1)return null;var l=f.lastIndexOf(".",c-1);if(0>=l||l>=c-1)return null;var m=g.list[f.slice(c+1)];return!m||0>m.indexOf(" "+f.slice(l+
1,c)+" ")?null:f.slice(l+1)},noConflict:function(){f.SecondLevelDomains===this&&(f.SecondLevelDomains=m);return this}};return g});
(function(f,m){"object"===typeof exports?module.exports=m(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],m):f.URI=m(f.punycode,f.IPv6,f.SecondLevelDomains,f)})(this,function(f,m,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 w(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function r(a){return"Array"===w(a)}function k(a,b){var d,c;if(r(b)){d=0;for(c=b.length;d<c;d++)if(!k(a,b[d]))return!1;return!0}var e=w(b);d=0;for(c=a.length;d<c;d++)if("RegExp"===e){if("string"===typeof a[d]&&a[d].match(b))return!0}else if(a[d]===b)return!0;return!1}function u(a,b){if(!r(a)||!r(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 A(a){return escape(a)}function B(a){return encodeURIComponent(a).replace(/[!'()*]/g,A).replace(/\*/g,"%2A")}var z=h&&h.URI;c.version="1.14.0";var e=c.prototype,q=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,escapeQuerySpace:c.escapeQuerySpace}};c.duplicateQueryParameters=!1;c.escapeQuerySpace=!0;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.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/};c.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};c.invalid_hostname_characters=
/[^a-zA-Z0-9\.-]/;c.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"};c.getDomAttribute=function(a){if(a&&a.nodeName){var b=a.nodeName.toLowerCase();return"input"===b&&"image"!==a.type?void 0:c.domAttributes[b]}};c.encode=B;c.decode=decodeURIComponent;c.iso8859=function(){c.encode=escape;c.decode=unescape};c.unicode=function(){c.encode=B;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,b){var d=c.encode(a+"");void 0===b&&(b=c.escapeQuerySpace);return b?d.replace(/%20/g,"+"):d};c.decodeQuery=function(a,b){a+="";void 0===b&&(b=c.escapeQuerySpace);try{return c.decode(b?a.replace(/\+/g,"%20"):a)}catch(d){return a}};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 n={encode:"encode",decode:"decode"},s,v=function(a,b){return function(d){try{return c[b](d+"").replace(c.characters[a][b].expression,function(d){return c.characters[a][b].map[d]})}catch(p){return d}}};for(s in n)c[s+"PathSegment"]=v("pathname",n[s]);c.encodeReserved=v("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=null,a=a.substring(2),a=c.parseAuthority(a,b)):(d=a.indexOf(":"),-1<d&&(b.protocol=a.substring(0,d)||null,b.protocol&&!b.protocol.match(c.protocol_expression)?b.protocol=void 0:"//"===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,"/"===b.port&&(b.port=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("/"),p=a.lastIndexOf("@",-1<d?d:a.length-1);-1<p&&(-1===d||p<d)?(d=a.substring(0,p).split(":"),
b.username=d[0]?c.decode(d[0]):null,d.shift(),b.password=d[0]?c.decode(d.join(":")):null,a=a.substring(p+1)):(b.username=null,b.password=null);return a};c.parseQuery=function(a,b){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!a)return{};for(var d={},p=a.split("&"),e=p.length,f,k,g=0;g<e;g++)f=p[g].split("="),k=c.decodeQuery(f.shift(),b),f=f.length?c.decodeQuery(f.join("="),b):null,d[k]?("string"===typeof d[k]&&(d[k]=[d[k]]),d[k].push(f)):d[k]=f;return d};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)b=c.ip6_expression.test(a.hostname)?b+("["+a.hostname+"]"):b+a.hostname;else return"";a.port&&(b+=":"+a.port);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,d){var p="",e,f,k,g;for(f in a)if(q.call(a,f)&&f)if(r(a[f]))for(e={},k=0,g=a[f].length;k<g;k++)void 0!==a[f][k]&&void 0===e[a[f][k]+""]&&(p+="&"+c.buildQueryParameter(f,a[f][k],d),!0!==b&&(e[a[f][k]+""]=!0));else void 0!==a[f]&&(p+="&"+c.buildQueryParameter(f,a[f],d));return p.substring(1)};
c.buildQueryParameter=function(a,b,d){return c.encodeQuery(a,d)+(null!==b?"="+c.encodeQuery(b,d):"")};c.addQuery=function(a,b,d){if("object"===typeof b)for(var p in b)q.call(b,p)&&c.addQuery(a,p,b[p]);else if("string"===typeof b)void 0===a[b]?a[b]=d:("string"===typeof a[b]&&(a[b]=[a[b]]),r(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 p;if(r(b))for(d=0,p=b.length;d<p;d++)a[b[d]]=void 0;
else if("object"===typeof b)for(p in b)q.call(b,p)&&c.removeQuery(a,p,b[p]);else if("string"===typeof b)if(void 0!==d)if(a[b]===d)a[b]=void 0;else{if(r(a[b])){p=a[b];var f={},e,k;if(r(d))for(e=0,k=d.length;e<k;e++)f[d[e]]=!0;else f[d]=!0;e=0;for(k=p.length;e<k;e++)void 0!==f[p[e]]&&(p.splice(e,1),k--,e--);a[b]=p}}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,p){if("object"===typeof b){for(var e in b)if(q.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(w(d)){case "Undefined":return b in a;case "Boolean":return a=Boolean(r(a[b])?a[b].length:a[b]),d===a;case "Function":return!!d(a[b],b,a);case "Array":return r(a[b])?(p?k:u)(a[b],d):!1;case "RegExp":return r(a[b])?p?k(a[b],d):!1:Boolean(a[b]&&a[b].match(d));case "Number":d=String(d);case "String":return r(a[b])?p?k(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,d){d||(d={});var p=d.start||c.findUri.start,e=d.end||c.findUri.end,f=d.trim||c.findUri.trim,k=/[a-z0-9-]=["']?$/i;for(p.lastIndex=0;;){var g=p.exec(a);if(!g)break;g=g.index;if(d.ignoreHtml){var h=
a.slice(Math.max(g-3,0),g);if(h&&k.test(h))continue}var h=g+a.slice(g).search(e),u=a.slice(g,h).replace(f,"");d.ignore&&d.ignore.test(u)||(h=g+u.length,u=b(u,g,h,a),a=a.slice(0,g)+u+a.slice(h),p.lastIndex=g+u.length)}p.lastIndex=0;return a};c.ensureValidHostname=function(a){if(a.match(c.invalid_hostname_characters)){if(!f)throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-] and Punycode.js is not available');if(f.toASCII(a).match(c.invalid_hostname_characters))throw new TypeError('Hostname "'+
a+'" contains characters other than [A-Z0-9.-]');}};c.noConflict=function(a){if(a)return a={URI:this.noConflict()},h.URITemplate&&"function"===typeof h.URITemplate.noConflict&&(a.URITemplate=h.URITemplate.noConflict()),h.IPv6&&"function"===typeof h.IPv6.noConflict&&(a.IPv6=h.IPv6.noConflict()),h.SecondLevelDomains&&"function"===typeof h.SecondLevelDomains.noConflict&&(a.SecondLevelDomains=h.SecondLevelDomains.noConflict()),a;h.URI===this&&(h.URI=z);return this};e.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};e.clone=function(){return new c(this)};e.valueOf=e.toString=function(){return this.build(!1)._string};n={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"};v=function(a){return function(b,d){if(void 0===b)return this._parts[a]||"";this._parts[a]=b||null;this.build(!d);return this}};for(s in n)e[s]=v(n[s]);n={query:"?",fragment:"#"};v=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(s in n)e[s]=v(s,n[s]);n={search:["?","query"],hash:["#","fragment"]};v=function(a,b){return function(d,c){var e=this[a](d,c);return"string"===typeof e&&e.length?b+e:e}};for(s in n)e[s]=v(n[s][1],n[s][0]);e.pathname=function(a,b){if(void 0===a||!0===a){var d=this._parts.path||(this._parts.hostname?"/":"");return a?c.decodePath(d):d}this._parts.path=
a?c.recodePath(a):"/";this.build(!b);return this};e.path=e.pathname;e.href=function(a,b){var d;if(void 0===a)return this.toString();this._string="";this._parts=c._parts();var e=a instanceof c,f="object"===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(f=c.getDomAttribute(a),a=a[f]||"",f=!1);!e&&f&&void 0!==a.pathname&&(a=a.toString());if("string"===typeof a)this._parts=c.parse(a,this._parts);else if(e||f)for(d in e=e?a._parts:a,e)q.call(this._parts,d)&&(this._parts[d]=e[d]);else throw new TypeError("invalid input");
this.build(!b);return this};e.is=function(a){var b=!1,d=!1,e=!1,f=!1,k=!1,h=!1,u=!1,n=!this._parts.urn;this._parts.hostname&&(n=!1,d=c.ip4_expression.test(this._parts.hostname),e=c.ip6_expression.test(this._parts.hostname),b=d||e,k=(f=!b)&&g&&g.has(this._parts.hostname),h=f&&c.idn_expression.test(this._parts.hostname),u=f&&c.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case "relative":return n;case "absolute":return!n;case "domain":case "name":return f;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 h;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return u}return null};var t=e.protocol,y=e.port,C=e.hostname;e.protocol=function(a,b){if(void 0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(c.protocol_expression)))throw new TypeError('Protocol "'+a+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return t.call(this,
a,b)};e.scheme=e.protocol;e.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 y.call(this,a,b)};e.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)};e.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};e.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};e.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};e.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};e.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=new 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};e.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=new RegExp(l(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a));this.build(!b);return this};e.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&&g&&g.list[d.toLowerCase()]?g.get(this._parts.hostname)||d:d}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(g&&g.is(a))d=new 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=new 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};e.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=new 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};e.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=new 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};e.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?new RegExp(l(d)+"$"):new 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};e.segment=function(a,b,d){var c=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(c);void 0!==
a&&"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');f&&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(r(b)){e=[];a=0;for(var k=b.length;a<k;a++)if(b[a].length||e.length&&e[e.length-1].length)e.length&&!e[e.length-1].length&&e.pop(),e.push(b[a])}else{if(b||"string"===typeof b)""===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);f&&e.unshift("");return this.path(e.join(c),d)};e.segmentCoded=function(a,b,d){var e,f;"number"!==typeof a&&(d=b,b=a,a=void 0);if(void 0===b){a=this.segment(a,b,d);if(r(a))for(e=0,f=a.length;e<f;e++)a[e]=c.decode(a[e]);else a=void 0!==a?c.decode(a):void 0;return a}if(r(b))for(e=0,f=b.length;e<f;e++)b[e]=c.decode(b[e]);else b="string"===typeof b?c.encode(b):b;return this.segment(a,b,d)};var D=e.query;e.query=function(a,b){if(!0===a)return c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);
if("function"===typeof a){var d=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace),e=a.call(this,d);this._parts.query=c.buildQuery(e||d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);this.build(!b);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=c.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):D.call(this,a,b)};e.setQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);
if("object"===typeof a)for(var f in a)q.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,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=b);this.build(!d);return this};e.addQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);c.addQuery(e,a,void 0===b?null:b);this._parts.query=
c.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=b);this.build(!d);return this};e.removeQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);c.removeQuery(e,a,b);this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=b);this.build(!d);return this};e.hasQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);
return c.hasQuery(e,a,b,d)};e.setSearch=e.setQuery;e.addSearch=e.addQuery;e.removeSearch=e.removeQuery;e.hasSearch=e.hasQuery;e.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()};e.normalizeProtocol=function(a){"string"===typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),
this.build(!a));return this};e.normalizeHostname=function(a){this._parts.hostname&&(this.is("IDN")&&f?this._parts.hostname=f.toASCII(this._parts.hostname):this.is("IPv6")&&m&&(this._parts.hostname=m.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!a));return this};e.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};e.normalizePath=
function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)return this;var b,d=this._parts.path,e="",f,k;"/"!==d.charAt(0)&&(b=!0,d="/"+d);d=d.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/");b&&(e=d.substring(1).match(/^(\.\.\/)+/)||"")&&(e=e[0]);for(;;){f=d.indexOf("/..");if(-1===f)break;else if(0===f){d=d.substring(3);continue}k=d.substring(0,f).lastIndexOf("/");-1===k&&(k=f);d=d.substring(0,k)+d.substring(f+3)}b&&this.is("relative")&&(d=e+d.substring(1));d=c.recodePath(d);
this._parts.path=d;this.build(!a);return this};e.normalizePathname=e.normalizePath;e.normalizeQuery=function(a){"string"===typeof this._parts.query&&(this._parts.query.length?this.query(c.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!a));return this};e.normalizeFragment=function(a){this._parts.fragment||(this._parts.fragment=null,this.build(!a));return this};e.normalizeSearch=e.normalizeQuery;e.normalizeHash=e.normalizeFragment;e.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};e.unicode=function(){var a=c.encode,b=c.decode;c.encode=B;c.decode=unescape;this.normalize();c.encode=a;c.decode=b;return this};e.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")&&f?(b+=f.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="",e=0,k=a._parts.query.split("&"),g=k.length;e<g;e++){var h=(k[e]||"").split("="),d=d+("&"+c.decodeQuery(h[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void 0!==h[1]&&(d+="="+c.decodeQuery(h[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}b+="?"+d.substring(1)}return b+=c.decodeQuery(a.hash(),!0)};e.absoluteTo=function(a){var b=this.clone(),d=["protocol","username",
"password","hostname","port"],e,f;if(this._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a instanceof c||(a=new c(a));b._parts.protocol||(b._parts.protocol=a._parts.protocol);if(this._parts.hostname)return b;for(e=0;f=d[e];e++)b._parts[f]=a._parts[f];b._parts.path?".."===b._parts.path.substring(-2)&&(b._parts.path+="/"):(b._parts.path=a._parts.path,b._parts.query||(b._parts.query=a._parts.query));"/"!==b.path().charAt(0)&&(a=a.directory(),b._parts.path=(a?
a+"/":"")+b._parts.path,b.normalizePath());b.build();return b};e.relativeTo=function(a){var b=this.clone().normalize(),d,e,f,k;if(b._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a=(new c(a)).normalize();d=b._parts;e=a._parts;f=b.path();k=a.path();if("/"!==f.charAt(0))throw Error("URI is already relative");if("/"!==k.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");d.protocol===e.protocol&&(d.protocol=null);if(d.username===
e.username&&d.password===e.password&&null===d.protocol&&null===d.username&&null===d.password&&d.hostname===e.hostname&&d.port===e.port)d.hostname=null,d.port=null;else return b.build();if(f===k)return d.path="",b.build();a=c.commonPath(b.path(),a.path());if(!a)return b.build();e=e.path.substring(a.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");d.path=e+d.path.substring(a.length);return b.build()};e.equals=function(a){var b=this.clone();a=new c(a);var d={},e={},f={},k;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,this._parts.escapeQuerySpace);e=c.parseQuery(e,this._parts.escapeQuerySpace);for(k in d)if(q.call(d,k)){if(!r(d[k])){if(d[k]!==e[k])return!1}else if(!u(d[k],e[k]))return!1;f[k]=!0}for(k in e)if(q.call(e,k)&&!f[k])return!1;return!0};e.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=!!a;return this};e.escapeQuerySpace=
function(a){this._parts.escapeQuerySpace=!!a;return this};return c});
(function(f,m){"object"===typeof exports?module.exports=m(require("./URI")):"function"===typeof define&&define.amd?define(["./URI"],m):f.URITemplate=m(f.URI,f)})(this,function(f,m){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=m&&m.URITemplate,l=Object.prototype.hasOwnProperty,w=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,f){var h=r[c.operator],l=h.named?"Named":"Unnamed",m=c.variables,e=[],q,n,s;for(s=0;n=m[s];s++)q=f.get(n.name),q.val.length?e.push(g["expand"+l](q,h,n.explode,n.explode&&h.separator||",",n.maxlength,n.name)):q.type&&e.push("");return e.length?h.prefix+e.join(h.separator):
""};g.expandNamed=function(c,g,h,l,m,e){var q="",n=g.encode;g=g.empty_name_separator;var s=!c[n].length,v=2===c.type?"":f[n](e),t,r,w;r=0;for(w=c.val.length;r<w;r++)m?(t=f[n](c.val[r][1].substring(0,m)),2===c.type&&(v=f[n](c.val[r][0].substring(0,m)))):s?(t=f[n](c.val[r][1]),2===c.type?(v=f[n](c.val[r][0]),c[n].push([v,t])):c[n].push([void 0,t])):(t=c[n][r][1],2===c.type&&(v=c[n][r][0])),q&&(q+=l),h?q+=v+(g||t?"=":"")+t:(r||(q+=f[n](e)+(g||t?"=":"")),2===c.type&&(q+=v+","),q+=t);return q};g.expandUnnamed=
function(c,g,h,m,l){var e="",q=g.encode;g=g.empty_name_separator;var n=!c[q].length,s,r,t,w;t=0;for(w=c.val.length;t<w;t++)l?r=f[q](c.val[t][1].substring(0,l)):n?(r=f[q](c.val[t][1]),c[q].push([2===c.type?f[q](c.val[t][0]):void 0,r])):r=c[q][t][1],e&&(e+=m),2===c.type&&(s=l?f[q](c.val[t][0].substring(0,l)):c[q][t][0],e+=s,e=h?e+(g||r?"=":""):e+","),e+=r;return e};g.noConflict=function(){m.URITemplate===g&&(m.URITemplate=c);return g};w.expand=function(c){var f="";this.parts&&this.parts.length||this.parse();
c instanceof h||(c=new h(c));for(var l=0,m=this.parts.length;l<m;l++)f+="string"===typeof this.parts[l]?this.parts[l]:g.expand(this.parts[l],c);return f};w.parse=function(){var c=this.expression,f=g.EXPRESSION_PATTERN,h=g.VARIABLE_PATTERN,l=g.VARIABLE_NAME_PATTERN,m=[],e=0,q,n,s;for(f.lastIndex=0;;){n=f.exec(c);if(null===n){m.push(c.substring(e));break}else m.push(c.substring(e,n.index)),e=n.index+n[0].length;if(!r[n[1]])throw Error('Unknown Operator "'+n[1]+'" in "'+n[0]+'"');if(!n[3])throw Error('Unclosed Expression "'+
n[0]+'"');q=n[2].split(",");for(var v=0,t=q.length;v<t;v++){s=q[v].match(h);if(null===s)throw Error('Invalid Variable "'+q[v]+'" in "'+n[0]+'"');if(s[1].match(l))throw Error('Invalid Variable Name "'+s[1]+'" in "'+n[0]+'"');q[v]={name:s[1],explode:!!s[3],maxlength:s[4]&&parseInt(s[4],10)}}if(!q.length)throw Error('Expression Missing Variable(s) "'+n[0]+'"');m.push({expression:n[0],operator:n[1],variables:q})}m.length||m.push(c);this.parts=m;return this};h.prototype.get=function(c){var f=this.data,
g={type:0,val:[],encode:[],encodeReserved:[]},h;if(void 0!==this.cache[c])return this.cache[c];this.cache[c]=g;f="[object Function]"===String(Object.prototype.toString.call(f))?f(c):"[object Function]"===String(Object.prototype.toString.call(f[c]))?f[c](c):f[c];if(void 0!==f&&null!==f)if("[object Array]"===String(Object.prototype.toString.call(f))){h=0;for(c=f.length;h<c;h++)void 0!==f[h]&&null!==f[h]&&g.val.push([void 0,String(f[h])]);g.val.length&&(g.type=3)}else if("[object Object]"===String(Object.prototype.toString.call(f))){for(h in f)l.call(f,
h)&&void 0!==f[h]&&null!==f[h]&&g.val.push([h,String(f[h])]);g.val.length&&(g.type=2)}else g.type=1,g.val.push([void 0,String(f)]);return g};f.expand=function(c,h){var l=(new g(c)).expand(h);return new f(l)};return g});
New to GrepCode? Check out our FAQ X