uri-js-rails 1.11.2 → 1.14.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,84 @@
1
+ /*! URI.js v1.14.1 http://medialize.github.io/URI.js/ */
2
+ /* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URITemplate.js */
3
+ (function(f,l){"object"===typeof exports?module.exports=l():"function"===typeof define&&define.amd?define(l):f.IPv6=l(f)})(this,function(f){var l=f&&f.IPv6;return{best:function(g){g=g.toLowerCase().split(":");var m=g.length,b=8;""===g[0]&&""===g[1]&&""===g[2]?(g.shift(),g.shift()):""===g[0]&&""===g[1]?g.shift():""===g[m-1]&&""===g[m-2]&&g.pop();m=g.length;-1!==g[m-1].indexOf(".")&&(b=7);var k;for(k=0;k<m&&""!==g[k];k++);if(k<b)for(g.splice(k,1,"0000");g.length<b;)g.splice(k,0,"0000");for(k=0;k<b;k++){for(var m=
4
+ g[k].split(""),f=0;3>f;f++)if("0"===m[0]&&1<m.length)m.splice(0,1);else break;g[k]=m.join("")}var m=-1,l=f=0,h=-1,r=!1;for(k=0;k<b;k++)r?"0"===g[k]?l+=1:(r=!1,l>f&&(m=h,f=l)):"0"===g[k]&&(r=!0,h=k,l=1);l>f&&(m=h,f=l);1<f&&g.splice(m,f,"");m=g.length;b="";""===g[0]&&(b=":");for(k=0;k<m;k++){b+=g[k];if(k===m-1)break;b+=":"}""===g[m-1]&&(b+=":");return b},noConflict:function(){f.IPv6===this&&(f.IPv6=l);return this}}});
5
+ (function(f){function l(b){throw RangeError(v[b]);}function g(b,e){for(var h=b.length;h--;)b[h]=e(b[h]);return b}function m(b,e){return g(b.split(u),e).join(".")}function b(b){for(var e=[],h=0,a=b.length,c,d;h<a;)c=b.charCodeAt(h++),55296<=c&&56319>=c&&h<a?(d=b.charCodeAt(h++),56320==(d&64512)?e.push(((c&1023)<<10)+(d&1023)+65536):(e.push(c),h--)):e.push(c);return e}function k(b){return g(b,function(b){var e="";65535<b&&(b-=65536,e+=A(b>>>10&1023|55296),b=56320|b&1023);return e+=A(b)}).join("")}function y(b,
6
+ e){return b+22+75*(26>b)-((0!=e)<<5)}function p(b,e,h){var a=0;b=h?q(b/700):b>>1;for(b+=q(b/e);455<b;a+=36)b=q(b/35);return q(a+36*b/(b+38))}function h(b){var e=[],h=b.length,a,c=0,d=128,t=72,w,x,g,f,m;w=b.lastIndexOf("-");0>w&&(w=0);for(x=0;x<w;++x)128<=b.charCodeAt(x)&&l("not-basic"),e.push(b.charCodeAt(x));for(w=0<w?w+1:0;w<h;){x=c;a=1;for(g=36;;g+=36){w>=h&&l("invalid-input");f=b.charCodeAt(w++);f=10>f-48?f-22:26>f-65?f-65:26>f-97?f-97:36;(36<=f||f>q((2147483647-c)/a))&&l("overflow");c+=f*a;m=
7
+ g<=t?1:g>=t+26?26:g-t;if(f<m)break;f=36-m;a>q(2147483647/f)&&l("overflow");a*=f}a=e.length+1;t=p(c-x,a,0==x);q(c/a)>2147483647-d&&l("overflow");d+=q(c/a);c%=a;e.splice(c++,0,d)}return k(e)}function r(e){var h,g,a,c,d,t,w,x,f,m=[],r,k,n;e=b(e);r=e.length;h=128;g=0;d=72;for(t=0;t<r;++t)f=e[t],128>f&&m.push(A(f));for((a=c=m.length)&&m.push("-");a<r;){w=2147483647;for(t=0;t<r;++t)f=e[t],f>=h&&f<w&&(w=f);k=a+1;w-h>q((2147483647-g)/k)&&l("overflow");g+=(w-h)*k;h=w;for(t=0;t<r;++t)if(f=e[t],f<h&&2147483647<
8
+ ++g&&l("overflow"),f==h){x=g;for(w=36;;w+=36){f=w<=d?1:w>=d+26?26:w-d;if(x<f)break;n=x-f;x=36-f;m.push(A(y(f+n%x,0)));x=q(n/x)}m.push(A(y(x,0)));d=p(g,k,a==c);g=0;++a}++g;++h}return m.join("")}var B="object"==typeof exports&&exports,C="object"==typeof module&&module&&module.exports==B&&module,z="object"==typeof global&&global;if(z.global===z||z.window===z)f=z;var s,n=/^xn--/,e=/[^ -~]/,u=/\x2E|\u3002|\uFF0E|\uFF61/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)",
9
+ "invalid-input":"Invalid input"},q=Math.floor,A=String.fromCharCode,D;s={version:"1.2.3",ucs2:{decode:b,encode:k},decode:h,encode:r,toASCII:function(b){return m(b,function(b){return e.test(b)?"xn--"+r(b):b})},toUnicode:function(b){return m(b,function(b){return n.test(b)?h(b.slice(4).toLowerCase()):b})}};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return s});else if(B&&!B.nodeType)if(C)C.exports=s;else for(D in s)s.hasOwnProperty(D)&&(B[D]=s[D]);else f.punycode=
10
+ s})(this);
11
+ (function(f,l){"object"===typeof exports?module.exports=l():"function"===typeof define&&define.amd?define(l):f.SecondLevelDomains=l(f)})(this,function(f){var l=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 ",
12
+ 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 ",
13
+ 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 ",
14
+ 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 ",
15
+ 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 ",
16
+ 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 ",
17
+ 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 ",
18
+ 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 ",
19
+ 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 ",
20
+ 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 ",
21
+ 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 ",
22
+ 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 ",
23
+ 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(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1)return!1;
24
+ var k=f.lastIndexOf(".",b-1);if(0>=k||k>=b-1)return!1;var l=g.list[f.slice(b+1)];return l?0<=l.indexOf(" "+f.slice(k+1,b)+" "):!1},is:function(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1||0<=f.lastIndexOf(".",b-1))return!1;var k=g.list[f.slice(b+1)];return k?0<=k.indexOf(" "+f.slice(0,b)+" "):!1},get:function(f){var b=f.lastIndexOf(".");if(0>=b||b>=f.length-1)return null;var k=f.lastIndexOf(".",b-1);if(0>=k||k>=b-1)return null;var l=g.list[f.slice(b+1)];return!l||0>l.indexOf(" "+f.slice(k+
25
+ 1,b)+" ")?null:f.slice(k+1)},noConflict:function(){f.SecondLevelDomains===this&&(f.SecondLevelDomains=l);return this}};return g});
26
+ (function(f,l){"object"===typeof exports?module.exports=l(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],l):f.URI=l(f.punycode,f.IPv6,f.SecondLevelDomains,f)})(this,function(f,l,g,m){function b(a,c){if(!(this instanceof b))return new b(a,c);void 0===a&&(a="undefined"!==typeof location?location.href+"":"");this.href(a);return void 0!==c?this.absoluteTo(c):this}function k(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,
27
+ "\\$1")}function y(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function p(a){return"Array"===y(a)}function h(a,c){var d,b;if(p(c)){d=0;for(b=c.length;d<b;d++)if(!h(a,c[d]))return!1;return!0}var e=y(c);d=0;for(b=a.length;d<b;d++)if("RegExp"===e){if("string"===typeof a[d]&&a[d].match(c))return!0}else if(a[d]===c)return!0;return!1}function r(a,c){if(!p(a)||!p(c)||a.length!==c.length)return!1;a.sort();c.sort();for(var d=0,b=a.length;d<b;d++)if(a[d]!==c[d])return!1;
28
+ return!0}function B(a){return escape(a)}function C(a){return encodeURIComponent(a).replace(/[!'()*]/g,B).replace(/\*/g,"%2A")}function z(a){return function(c,d){if(void 0===c)return this._parts[a]||"";this._parts[a]=c||null;this.build(!d);return this}}function s(a,c){return function(d,b){if(void 0===d)return this._parts[a]||"";null!==d&&(d+="",d.charAt(0)===c&&(d=d.substring(1)));this._parts[a]=d;this.build(!b);return this}}var n=m&&m.URI;b.version="1.14.1";var e=b.prototype,u=Object.prototype.hasOwnProperty;
29
+ b._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:b.duplicateQueryParameters,escapeQuerySpace:b.escapeQuerySpace}};b.duplicateQueryParameters=!1;b.escapeQuerySpace=!0;b.protocol_expression=/^[a-z][a-z0-9.+-]*$/i;b.idn_expression=/[^a-z0-9\.-]/i;b.punycode_expression=/(xn--)/i;b.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;b.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*$/;
30
+ b.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;b.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/};b.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};b.invalid_hostname_characters=
31
+ /[^a-zA-Z0-9\.-]/;b.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"};b.getDomAttribute=function(a){if(a&&a.nodeName){var c=a.nodeName.toLowerCase();return"input"===c&&"image"!==a.type?void 0:b.domAttributes[c]}};b.encode=C;b.decode=decodeURIComponent;b.iso8859=function(){b.encode=escape;b.decode=unescape};b.unicode=function(){b.encode=C;b.decode=
32
+ decodeURIComponent};b.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":",",
33
+ "%3B":";","%3D":"="}}}};b.encodeQuery=function(a,c){var d=b.encode(a+"");void 0===c&&(c=b.escapeQuerySpace);return c?d.replace(/%20/g,"+"):d};b.decodeQuery=function(a,c){a+="";void 0===c&&(c=b.escapeQuerySpace);try{return b.decode(c?a.replace(/\+/g,"%20"):a)}catch(d){return a}};b.recodePath=function(a){a=(a+"").split("/");for(var c=0,d=a.length;c<d;c++)a[c]=b.encodePathSegment(b.decode(a[c]));return a.join("/")};b.decodePath=function(a){a=(a+"").split("/");for(var c=0,d=a.length;c<d;c++)a[c]=b.decodePathSegment(a[c]);
34
+ return a.join("/")};var v={encode:"encode",decode:"decode"},q,A=function(a,c){return function(d){try{return b[c](d+"").replace(b.characters[a][c].expression,function(d){return b.characters[a][c].map[d]})}catch(t){return d}}};for(q in v)b[q+"PathSegment"]=A("pathname",v[q]);b.encodeReserved=A("reserved","encode");b.parse=function(a,c){var d;c||(c={});d=a.indexOf("#");-1<d&&(c.fragment=a.substring(d+1)||null,a=a.substring(0,d));d=a.indexOf("?");-1<d&&(c.query=a.substring(d+1)||null,a=a.substring(0,
35
+ d));"//"===a.substring(0,2)?(c.protocol=null,a=a.substring(2),a=b.parseAuthority(a,c)):(d=a.indexOf(":"),-1<d&&(c.protocol=a.substring(0,d)||null,c.protocol&&!c.protocol.match(b.protocol_expression)?c.protocol=void 0:"//"===a.substring(d+1,d+3)?(a=a.substring(d+3),a=b.parseAuthority(a,c)):(a=a.substring(d+1),c.urn=!0)));c.path=a;return c};b.parseHost=function(a,c){var d=a.indexOf("/"),b;-1===d&&(d=a.length);"["===a.charAt(0)?(b=a.indexOf("]"),c.hostname=a.substring(1,b)||null,c.port=a.substring(b+
36
+ 2,d)||null,"/"===c.port&&(c.port=null)):a.indexOf(":")!==a.lastIndexOf(":")?(c.hostname=a.substring(0,d)||null,c.port=null):(b=a.substring(0,d).split(":"),c.hostname=b[0]||null,c.port=b[1]||null);c.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a);return a.substring(d)||"/"};b.parseAuthority=function(a,c){a=b.parseUserinfo(a,c);return b.parseHost(a,c)};b.parseUserinfo=function(a,c){var d=a.indexOf("/"),t=a.lastIndexOf("@",-1<d?d:a.length-1);-1<t&&(-1===d||t<d)?(d=a.substring(0,t).split(":"),
37
+ c.username=d[0]?b.decode(d[0]):null,d.shift(),c.password=d[0]?b.decode(d.join(":")):null,a=a.substring(t+1)):(c.username=null,c.password=null);return a};b.parseQuery=function(a,c){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!a)return{};for(var d={},t=a.split("&"),e=t.length,f,h,g=0;g<e;g++)f=t[g].split("="),h=b.decodeQuery(f.shift(),c),f=f.length?b.decodeQuery(f.join("="),c):null,u.call(d,h)?("string"===typeof d[h]&&(d[h]=[d[h]]),d[h].push(f)):d[h]=f;return d};b.build=function(a){var c=
38
+ "";a.protocol&&(c+=a.protocol+":");a.urn||!c&&!a.hostname||(c+="//");c+=b.buildAuthority(a)||"";"string"===typeof a.path&&("/"!==a.path.charAt(0)&&"string"===typeof a.hostname&&(c+="/"),c+=a.path);"string"===typeof a.query&&a.query&&(c+="?"+a.query);"string"===typeof a.fragment&&a.fragment&&(c+="#"+a.fragment);return c};b.buildHost=function(a){var c="";if(a.hostname)c=b.ip6_expression.test(a.hostname)?c+("["+a.hostname+"]"):c+a.hostname;else return"";a.port&&(c+=":"+a.port);return c};b.buildAuthority=
39
+ function(a){return b.buildUserinfo(a)+b.buildHost(a)};b.buildUserinfo=function(a){var c="";a.username&&(c+=b.encode(a.username),a.password&&(c+=":"+b.encode(a.password)),c+="@");return c};b.buildQuery=function(a,c,d){var t="",e,f,h,g;for(f in a)if(u.call(a,f)&&f)if(p(a[f]))for(e={},h=0,g=a[f].length;h<g;h++)void 0!==a[f][h]&&void 0===e[a[f][h]+""]&&(t+="&"+b.buildQueryParameter(f,a[f][h],d),!0!==c&&(e[a[f][h]+""]=!0));else void 0!==a[f]&&(t+="&"+b.buildQueryParameter(f,a[f],d));return t.substring(1)};
40
+ b.buildQueryParameter=function(a,c,d){return b.encodeQuery(a,d)+(null!==c?"="+b.encodeQuery(c,d):"")};b.addQuery=function(a,c,d){if("object"===typeof c)for(var e in c)u.call(c,e)&&b.addQuery(a,e,c[e]);else if("string"===typeof c)void 0===a[c]?a[c]=d:("string"===typeof a[c]&&(a[c]=[a[c]]),p(d)||(d=[d]),a[c]=(a[c]||[]).concat(d));else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");};b.removeQuery=function(a,c,d){var e;if(p(c))for(d=0,e=c.length;d<e;d++)a[c[d]]=
41
+ void 0;else if("object"===typeof c)for(e in c)u.call(c,e)&&b.removeQuery(a,e,c[e]);else if("string"===typeof c)if(void 0!==d)if(a[c]===d)a[c]=void 0;else{if(p(a[c])){e=a[c];var f={},h,g;if(p(d))for(h=0,g=d.length;h<g;h++)f[d[h]]=!0;else f[d]=!0;h=0;for(g=e.length;h<g;h++)void 0!==f[e[h]]&&(e.splice(h,1),g--,h--);a[c]=e}}else a[c]=void 0;else throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");};b.hasQuery=function(a,c,d,e){if("object"===typeof c){for(var f in c)if(u.call(c,
42
+ f)&&!b.hasQuery(a,f,c[f]))return!1;return!0}if("string"!==typeof c)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(y(d)){case "Undefined":return c in a;case "Boolean":return a=Boolean(p(a[c])?a[c].length:a[c]),d===a;case "Function":return!!d(a[c],c,a);case "Array":return p(a[c])?(e?h:r)(a[c],d):!1;case "RegExp":return p(a[c])?e?h(a[c],d):!1:Boolean(a[c]&&a[c].match(d));case "Number":d=String(d);case "String":return p(a[c])?e?h(a[c],d):!1:a[c]===d;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
43
+ }};b.commonPath=function(a,c){var d=Math.min(a.length,c.length),b;for(b=0;b<d;b++)if(a.charAt(b)!==c.charAt(b)){b--;break}if(1>b)return a.charAt(0)===c.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(b)||"/"!==c.charAt(b))b=a.substring(0,b).lastIndexOf("/");return a.substring(0,b+1)};b.withinString=function(a,c,d){d||(d={});var e=d.start||b.findUri.start,f=d.end||b.findUri.end,h=d.trim||b.findUri.trim,g=/[a-z0-9-]=["']?$/i;for(e.lastIndex=0;;){var r=e.exec(a);if(!r)break;r=r.index;if(d.ignoreHtml){var k=
44
+ a.slice(Math.max(r-3,0),r);if(k&&g.test(k))continue}var k=r+a.slice(r).search(f),m=a.slice(r,k).replace(h,"");d.ignore&&d.ignore.test(m)||(k=r+m.length,m=c(m,r,k,a),a=a.slice(0,r)+m+a.slice(k),e.lastIndex=r+m.length)}e.lastIndex=0;return a};b.ensureValidHostname=function(a){if(a.match(b.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(b.invalid_hostname_characters))throw new TypeError('Hostname "'+
45
+ a+'" contains characters other than [A-Z0-9.-]');}};b.noConflict=function(a){if(a)return a={URI:this.noConflict()},m.URITemplate&&"function"===typeof m.URITemplate.noConflict&&(a.URITemplate=m.URITemplate.noConflict()),m.IPv6&&"function"===typeof m.IPv6.noConflict&&(a.IPv6=m.IPv6.noConflict()),m.SecondLevelDomains&&"function"===typeof m.SecondLevelDomains.noConflict&&(a.SecondLevelDomains=m.SecondLevelDomains.noConflict()),a;m.URI===this&&(m.URI=n);return this};e.build=function(a){if(!0===a)this._deferred_build=
46
+ !0;else if(void 0===a||this._deferred_build)this._string=b.build(this._parts),this._deferred_build=!1;return this};e.clone=function(){return new b(this)};e.valueOf=e.toString=function(){return this.build(!1)._string};e.protocol=z("protocol");e.username=z("username");e.password=z("password");e.hostname=z("hostname");e.port=z("port");e.query=s("query","?");e.fragment=s("fragment","#");e.search=function(a,c){var d=this.query(a,c);return"string"===typeof d&&d.length?"?"+d:d};e.hash=function(a,c){var d=
47
+ this.fragment(a,c);return"string"===typeof d&&d.length?"#"+d:d};e.pathname=function(a,c){if(void 0===a||!0===a){var d=this._parts.path||(this._parts.hostname?"/":"");return a?b.decodePath(d):d}this._parts.path=a?b.recodePath(a):"/";this.build(!c);return this};e.path=e.pathname;e.href=function(a,c){var d;if(void 0===a)return this.toString();this._string="";this._parts=b._parts();var e=a instanceof b,f="object"===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(f=b.getDomAttribute(a),a=a[f]||
48
+ "",f=!1);!e&&f&&void 0!==a.pathname&&(a=a.toString());if("string"===typeof a||a instanceof String)this._parts=b.parse(String(a),this._parts);else if(e||f)for(d in e=e?a._parts:a,e)u.call(this._parts,d)&&(this._parts[d]=e[d]);else throw new TypeError("invalid input");this.build(!c);return this};e.is=function(a){var c=!1,d=!1,e=!1,f=!1,h=!1,r=!1,k=!1,m=!this._parts.urn;this._parts.hostname&&(m=!1,d=b.ip4_expression.test(this._parts.hostname),e=b.ip6_expression.test(this._parts.hostname),c=d||e,h=(f=
49
+ !c)&&g&&g.has(this._parts.hostname),r=f&&b.idn_expression.test(this._parts.hostname),k=f&&b.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case "relative":return m;case "absolute":return!m;case "domain":case "name":return f;case "sld":return h;case "ip":return c;case "ip4":case "ipv4":case "inet4":return d;case "ip6":case "ipv6":case "inet6":return e;case "idn":return r;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return k}return null};
50
+ var D=e.protocol,E=e.port,F=e.hostname;e.protocol=function(a,c){if(void 0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(b.protocol_expression)))throw new TypeError('Protocol "'+a+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return D.call(this,a,c)};e.scheme=e.protocol;e.port=function(a,c){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]');
51
+ return E.call(this,a,c)};e.hostname=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var d={};b.parseHost(a,d);a=d.hostname}return F.call(this,a,c)};e.host=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?b.buildHost(this._parts):"";b.parseHost(a,this._parts);this.build(!c);return this};e.authority=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?b.buildAuthority(this._parts):
52
+ "";b.parseAuthority(a,this._parts);this.build(!c);return this};e.userinfo=function(a,c){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.username)return"";var d=b.buildUserinfo(this._parts);return d.substring(0,d.length-1)}"@"!==a[a.length-1]&&(a+="@");b.parseUserinfo(a,this._parts);this.build(!c);return this};e.resource=function(a,c){var d;if(void 0===a)return this.path()+this.search()+this.hash();d=b.parse(a);this._parts.path=d.path;this._parts.query=d.query;this._parts.fragment=
53
+ d.fragment;this.build(!c);return this};e.subdomain=function(a,c){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("^"+k(d));a&&"."!==a.charAt(a.length-1)&&(a+=".");a&&b.ensureValidHostname(a);this._parts.hostname=this._parts.hostname.replace(d,
54
+ a);this.build(!c);return this};e.domain=function(a,c){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(c=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(c).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");b.ensureValidHostname(a);
55
+ !this._parts.hostname||this.is("IP")?this._parts.hostname=a:(d=new RegExp(k(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a));this.build(!c);return this};e.tld=function(a,c){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(c=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!==c&&g&&g.list[d.toLowerCase()]?g.get(this._parts.hostname)||d:d}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(g&&
56
+ g.is(a))d=new RegExp(k(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(k(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(d,a)}else throw new TypeError("cannot set TLD empty");this.build(!c);return this};e.directory=function(a,c){if(this._parts.urn)return void 0===
57
+ 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?b.decodePath(d):d}d=this._parts.path.length-this.filename().length;d=this._parts.path.substring(0,d);d=new RegExp("^"+k(d));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=b.recodePath(a);this._parts.path=
58
+ this._parts.path.replace(d,a);this.build(!c);return this};e.filename=function(a,c){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?b.decodePathSegment(d):d}d=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\.?\//)&&(d=!0);var e=new RegExp(k(this.filename())+"$");a=b.recodePath(a);this._parts.path=this._parts.path.replace(e,a);d?this.normalizePath(c):
59
+ this.build(!c);return this};e.suffix=function(a,c){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?b.decodePathSegment(d):d}"."===a.charAt(0)&&(a=a.substring(1));if(d=this.suffix())e=a?new RegExp(k(d)+"$"):new RegExp(k("."+d)+"$");else{if(!a)return this;this._parts.path+="."+b.recodePath(a)}e&&(a=b.recodePath(a),
60
+ this._parts.path=this._parts.path.replace(e,a));this.build(!c);return this};e.segment=function(a,c,d){var b=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(b);void 0!==a&&"number"!==typeof a&&(d=c,c=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===c)return void 0===a?e:e[a];if(null===a||void 0===e[a])if(p(c)){e=[];a=0;for(var h=c.length;a<h;a++)if(c[a].length||
61
+ e.length&&e[e.length-1].length)e.length&&!e[e.length-1].length&&e.pop(),e.push(c[a])}else{if(c||"string"===typeof c)""===e[e.length-1]?e[e.length-1]=c:e.push(c)}else c?e[a]=c:e.splice(a,1);f&&e.unshift("");return this.path(e.join(b),d)};e.segmentCoded=function(a,c,d){var e,f;"number"!==typeof a&&(d=c,c=a,a=void 0);if(void 0===c){a=this.segment(a,c,d);if(p(a))for(e=0,f=a.length;e<f;e++)a[e]=b.decode(a[e]);else a=void 0!==a?b.decode(a):void 0;return a}if(p(c))for(e=0,f=c.length;e<f;e++)c[e]=b.decode(c[e]);
62
+ else c="string"===typeof c||c instanceof String?b.encode(c):c;return this.segment(a,c,d)};var G=e.query;e.query=function(a,c){if(!0===a)return b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"===typeof a){var d=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace),e=a.call(this,d);this._parts.query=b.buildQuery(e||d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);this.build(!c);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=
63
+ b.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!c),this):G.call(this,a,c)};e.setQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"===typeof a||a instanceof String)e[a]=void 0!==c?c:null;else if("object"===typeof a)for(var f in a)u.call(a,f)&&(e[f]=a[f]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");this._parts.query=b.buildQuery(e,this._parts.duplicateQueryParameters,
64
+ this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.addQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);b.addQuery(e,a,void 0===c?null:c);this._parts.query=b.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.removeQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);b.removeQuery(e,a,c);this._parts.query=
65
+ b.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=c);this.build(!d);return this};e.hasQuery=function(a,c,d){var e=b.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return b.hasQuery(e,a,c,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()};
66
+ 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")&&l&&(this._parts.hostname=l.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&&
67
+ this._parts.port===b.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 c,d=this._parts.path,e="",f,h;"/"!==d.charAt(0)&&(c=!0,d="/"+d);d=d.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/");c&&(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}h=d.substring(0,f).lastIndexOf("/");
68
+ -1===h&&(h=f);d=d.substring(0,h)+d.substring(f+3)}c&&this.is("relative")&&(d=e+d.substring(1));d=b.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(b.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));
69
+ return this};e.normalizeSearch=e.normalizeQuery;e.normalizeHash=e.normalizeFragment;e.iso8859=function(){var a=b.encode,c=b.decode;b.encode=escape;b.decode=decodeURIComponent;this.normalize();b.encode=a;b.decode=c;return this};e.unicode=function(){var a=b.encode,c=b.decode;b.encode=C;b.decode=unescape;this.normalize();b.encode=a;b.decode=c;return this};e.readable=function(){var a=this.clone();a.username("").password("").normalize();var c="";a._parts.protocol&&(c+=a._parts.protocol+"://");a._parts.hostname&&
70
+ (a.is("punycode")&&f?(c+=f.toUnicode(a._parts.hostname),a._parts.port&&(c+=":"+a._parts.port)):c+=a.host());a._parts.hostname&&a._parts.path&&"/"!==a._parts.path.charAt(0)&&(c+="/");c+=a.path(!0);if(a._parts.query){for(var d="",e=0,h=a._parts.query.split("&"),g=h.length;e<g;e++){var r=(h[e]||"").split("="),d=d+("&"+b.decodeQuery(r[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void 0!==r[1]&&(d+="="+b.decodeQuery(r[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}c+="?"+d.substring(1)}return c+=
71
+ b.decodeQuery(a.hash(),!0)};e.absoluteTo=function(a){var c=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 b||(a=new b(a));c._parts.protocol||(c._parts.protocol=a._parts.protocol);if(this._parts.hostname)return c;for(e=0;f=d[e];e++)c._parts[f]=a._parts[f];c._parts.path?".."===c._parts.path.substring(-2)&&(c._parts.path+="/"):(c._parts.path=a._parts.path,c._parts.query||
72
+ (c._parts.query=a._parts.query));"/"!==c.path().charAt(0)&&(a=a.directory(),c._parts.path=(a?a+"/":"")+c._parts.path,c.normalizePath());c.build();return c};e.relativeTo=function(a){var c=this.clone().normalize(),d,e,f,h;if(c._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a=(new b(a)).normalize();d=c._parts;e=a._parts;f=c.path();h=a.path();if("/"!==f.charAt(0))throw Error("URI is already relative");if("/"!==h.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");
73
+ 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 c.build();if(f===h)return d.path="",c.build();a=b.commonPath(c.path(),a.path());if(!a)return c.build();e=e.path.substring(a.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");d.path=e+d.path.substring(a.length);return c.build()};e.equals=function(a){var c=this.clone();
74
+ a=new b(a);var d={},e={},f={},h;c.normalize();a.normalize();if(c.toString()===a.toString())return!0;d=c.query();e=a.query();c.query("");a.query("");if(c.toString()!==a.toString()||d.length!==e.length)return!1;d=b.parseQuery(d,this._parts.escapeQuerySpace);e=b.parseQuery(e,this._parts.escapeQuerySpace);for(h in d)if(u.call(d,h)){if(!p(d[h])){if(d[h]!==e[h])return!1}else if(!r(d[h],e[h]))return!1;f[h]=!0}for(h in e)if(u.call(e,h)&&!f[h])return!1;return!0};e.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=
75
+ !!a;return this};e.escapeQuerySpace=function(a){this._parts.escapeQuerySpace=!!a;return this};return b});
76
+ (function(f,l){"object"===typeof exports?module.exports=l(require("./URI")):"function"===typeof define&&define.amd?define(["./URI"],l):f.URITemplate=l(f.URI,f)})(this,function(f,l){function g(b){if(g._cache[b])return g._cache[b];if(!(this instanceof g))return new g(b);this.expression=b;g._cache[b]=this;return this}function m(b){this.data=b;this.cache={}}var b=l&&l.URITemplate,k=Object.prototype.hasOwnProperty,y=g.prototype,p={"":{prefix:"",separator:",",named:!1,empty_name_separator:!1,encode:"encode"},
77
+ "+":{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:"&",
78
+ 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(b,f){var k=p[b.operator],m=k.named?"Named":"Unnamed",l=b.variables,s=[],n,e,u;for(u=0;e=l[u];u++)n=f.get(e.name),n.val.length?s.push(g["expand"+m](n,k,e.explode,e.explode&&k.separator||",",e.maxlength,e.name)):n.type&&s.push("");return s.length?k.prefix+s.join(k.separator):
79
+ ""};g.expandNamed=function(b,g,k,m,l,s){var n="",e=g.encode;g=g.empty_name_separator;var u=!b[e].length,v=2===b.type?"":f[e](s),q,p,y;p=0;for(y=b.val.length;p<y;p++)l?(q=f[e](b.val[p][1].substring(0,l)),2===b.type&&(v=f[e](b.val[p][0].substring(0,l)))):u?(q=f[e](b.val[p][1]),2===b.type?(v=f[e](b.val[p][0]),b[e].push([v,q])):b[e].push([void 0,q])):(q=b[e][p][1],2===b.type&&(v=b[e][p][0])),n&&(n+=m),k?n+=v+(g||q?"=":"")+q:(p||(n+=f[e](s)+(g||q?"=":"")),2===b.type&&(n+=v+","),n+=q);return n};g.expandUnnamed=
80
+ function(b,g,k,m,l){var s="",n=g.encode;g=g.empty_name_separator;var e=!b[n].length,p,v,q,y;q=0;for(y=b.val.length;q<y;q++)l?v=f[n](b.val[q][1].substring(0,l)):e?(v=f[n](b.val[q][1]),b[n].push([2===b.type?f[n](b.val[q][0]):void 0,v])):v=b[n][q][1],s&&(s+=m),2===b.type&&(p=l?f[n](b.val[q][0].substring(0,l)):b[n][q][0],s+=p,s=k?s+(g||v?"=":""):s+","),s+=v;return s};g.noConflict=function(){l.URITemplate===g&&(l.URITemplate=b);return g};y.expand=function(b){var f="";this.parts&&this.parts.length||this.parse();
81
+ b instanceof m||(b=new m(b));for(var k=0,l=this.parts.length;k<l;k++)f+="string"===typeof this.parts[k]?this.parts[k]:g.expand(this.parts[k],b);return f};y.parse=function(){var b=this.expression,f=g.EXPRESSION_PATTERN,k=g.VARIABLE_PATTERN,m=g.VARIABLE_NAME_PATTERN,l=[],s=0,n,e,u;for(f.lastIndex=0;;){e=f.exec(b);if(null===e){l.push(b.substring(s));break}else l.push(b.substring(s,e.index)),s=e.index+e[0].length;if(!p[e[1]])throw Error('Unknown Operator "'+e[1]+'" in "'+e[0]+'"');if(!e[3])throw Error('Unclosed Expression "'+
82
+ e[0]+'"');n=e[2].split(",");for(var v=0,q=n.length;v<q;v++){u=n[v].match(k);if(null===u)throw Error('Invalid Variable "'+n[v]+'" in "'+e[0]+'"');if(u[1].match(m))throw Error('Invalid Variable Name "'+u[1]+'" in "'+e[0]+'"');n[v]={name:u[1],explode:!!u[3],maxlength:u[4]&&parseInt(u[4],10)}}if(!n.length)throw Error('Expression Missing Variable(s) "'+e[0]+'"');l.push({expression:e[0],operator:e[1],variables:n})}l.length||l.push(b);this.parts=l;return this};m.prototype.get=function(b){var f=this.data,
83
+ g={type:0,val:[],encode:[],encodeReserved:[]},l;if(void 0!==this.cache[b])return this.cache[b];this.cache[b]=g;f="[object Function]"===String(Object.prototype.toString.call(f))?f(b):"[object Function]"===String(Object.prototype.toString.call(f[b]))?f[b](b):f[b];if(void 0!==f&&null!==f)if("[object Array]"===String(Object.prototype.toString.call(f))){l=0;for(b=f.length;l<b;l++)void 0!==f[l]&&null!==f[l]&&g.val.push([void 0,String(f[l])]);g.val.length&&(g.type=3)}else if("[object Object]"===String(Object.prototype.toString.call(f))){for(l in f)k.call(f,
84
+ l)&&void 0!==f[l]&&null!==f[l]&&g.val.push([l,String(f[l])]);g.val.length&&(g.type=2)}else g.type=1,g.val.push([void 0,String(f)]);return g};f.expand=function(b,k){var l=(new g(b)).expand(k);return new f(l)};return g});
@@ -0,0 +1,499 @@
1
+ /*!
2
+ * URI.js - Mutating URLs
3
+ * URI Template Support - http://tools.ietf.org/html/rfc6570
4
+ *
5
+ * Version: 1.14.1
6
+ *
7
+ * Author: Rodney Rehm
8
+ * Web: http://medialize.github.io/URI.js/
9
+ *
10
+ * Licensed under
11
+ * MIT License http://www.opensource.org/licenses/mit-license
12
+ * GPL v3 http://opensource.org/licenses/GPL-3.0
13
+ *
14
+ */
15
+ (function (root, factory) {
16
+ 'use strict';
17
+ // https://github.com/umdjs/umd/blob/master/returnExports.js
18
+ if (typeof exports === 'object') {
19
+ // Node
20
+ module.exports = factory(require('./URI'));
21
+ } else if (typeof define === 'function' && define.amd) {
22
+ // AMD. Register as an anonymous module.
23
+ define(['./URI'], factory);
24
+ } else {
25
+ // Browser globals (root is window)
26
+ root.URITemplate = factory(root.URI, root);
27
+ }
28
+ }(this, function (URI, root) {
29
+ 'use strict';
30
+ // FIXME: v2.0.0 renamce non-camelCase properties to uppercase
31
+ /*jshint camelcase: false */
32
+
33
+ // save current URITemplate variable, if any
34
+ var _URITemplate = root && root.URITemplate;
35
+
36
+ var hasOwn = Object.prototype.hasOwnProperty;
37
+ function URITemplate(expression) {
38
+ // serve from cache where possible
39
+ if (URITemplate._cache[expression]) {
40
+ return URITemplate._cache[expression];
41
+ }
42
+
43
+ // Allow instantiation without the 'new' keyword
44
+ if (!(this instanceof URITemplate)) {
45
+ return new URITemplate(expression);
46
+ }
47
+
48
+ this.expression = expression;
49
+ URITemplate._cache[expression] = this;
50
+ return this;
51
+ }
52
+
53
+ function Data(data) {
54
+ this.data = data;
55
+ this.cache = {};
56
+ }
57
+
58
+ var p = URITemplate.prototype;
59
+ // list of operators and their defined options
60
+ var operators = {
61
+ // Simple string expansion
62
+ '' : {
63
+ prefix: '',
64
+ separator: ',',
65
+ named: false,
66
+ empty_name_separator: false,
67
+ encode : 'encode'
68
+ },
69
+ // Reserved character strings
70
+ '+' : {
71
+ prefix: '',
72
+ separator: ',',
73
+ named: false,
74
+ empty_name_separator: false,
75
+ encode : 'encodeReserved'
76
+ },
77
+ // Fragment identifiers prefixed by '#'
78
+ '#' : {
79
+ prefix: '#',
80
+ separator: ',',
81
+ named: false,
82
+ empty_name_separator: false,
83
+ encode : 'encodeReserved'
84
+ },
85
+ // Name labels or extensions prefixed by '.'
86
+ '.' : {
87
+ prefix: '.',
88
+ separator: '.',
89
+ named: false,
90
+ empty_name_separator: false,
91
+ encode : 'encode'
92
+ },
93
+ // Path segments prefixed by '/'
94
+ '/' : {
95
+ prefix: '/',
96
+ separator: '/',
97
+ named: false,
98
+ empty_name_separator: false,
99
+ encode : 'encode'
100
+ },
101
+ // Path parameter name or name=value pairs prefixed by ';'
102
+ ';' : {
103
+ prefix: ';',
104
+ separator: ';',
105
+ named: true,
106
+ empty_name_separator: false,
107
+ encode : 'encode'
108
+ },
109
+ // Query component beginning with '?' and consisting
110
+ // of name=value pairs separated by '&'; an
111
+ '?' : {
112
+ prefix: '?',
113
+ separator: '&',
114
+ named: true,
115
+ empty_name_separator: true,
116
+ encode : 'encode'
117
+ },
118
+ // Continuation of query-style &name=value pairs
119
+ // within a literal query component.
120
+ '&' : {
121
+ prefix: '&',
122
+ separator: '&',
123
+ named: true,
124
+ empty_name_separator: true,
125
+ encode : 'encode'
126
+ }
127
+
128
+ // The operator characters equals ("="), comma (","), exclamation ("!"),
129
+ // at sign ("@"), and pipe ("|") are reserved for future extensions.
130
+ };
131
+
132
+ // storage for already parsed templates
133
+ URITemplate._cache = {};
134
+ // pattern to identify expressions [operator, variable-list] in template
135
+ URITemplate.EXPRESSION_PATTERN = /\{([^a-zA-Z0-9%_]?)([^\}]+)(\}|$)/g;
136
+ // pattern to identify variables [name, explode, maxlength] in variable-list
137
+ URITemplate.VARIABLE_PATTERN = /^([^*:]+)((\*)|:(\d+))?$/;
138
+ // pattern to verify variable name integrity
139
+ URITemplate.VARIABLE_NAME_PATTERN = /[^a-zA-Z0-9%_]/;
140
+
141
+ // expand parsed expression (expression, not template!)
142
+ URITemplate.expand = function(expression, data) {
143
+ // container for defined options for the given operator
144
+ var options = operators[expression.operator];
145
+ // expansion type (include keys or not)
146
+ var type = options.named ? 'Named' : 'Unnamed';
147
+ // list of variables within the expression
148
+ var variables = expression.variables;
149
+ // result buffer for evaluating the expression
150
+ var buffer = [];
151
+ var d, variable, i;
152
+
153
+ for (i = 0; (variable = variables[i]); i++) {
154
+ // fetch simplified data source
155
+ d = data.get(variable.name);
156
+ if (!d.val.length) {
157
+ if (d.type) {
158
+ // empty variables (empty string)
159
+ // still lead to a separator being appended!
160
+ buffer.push('');
161
+ }
162
+ // no data, no action
163
+ continue;
164
+ }
165
+
166
+ // expand the given variable
167
+ buffer.push(URITemplate['expand' + type](
168
+ d,
169
+ options,
170
+ variable.explode,
171
+ variable.explode && options.separator || ',',
172
+ variable.maxlength,
173
+ variable.name
174
+ ));
175
+ }
176
+
177
+ if (buffer.length) {
178
+ return options.prefix + buffer.join(options.separator);
179
+ } else {
180
+ // prefix is not prepended for empty expressions
181
+ return '';
182
+ }
183
+ };
184
+ // expand a named variable
185
+ URITemplate.expandNamed = function(d, options, explode, separator, length, name) {
186
+ // variable result buffer
187
+ var result = '';
188
+ // peformance crap
189
+ var encode = options.encode;
190
+ var empty_name_separator = options.empty_name_separator;
191
+ // flag noting if values are already encoded
192
+ var _encode = !d[encode].length;
193
+ // key for named expansion
194
+ var _name = d.type === 2 ? '': URI[encode](name);
195
+ var _value, i, l;
196
+
197
+ // for each found value
198
+ for (i = 0, l = d.val.length; i < l; i++) {
199
+ if (length) {
200
+ // maxlength must be determined before encoding can happen
201
+ _value = URI[encode](d.val[i][1].substring(0, length));
202
+ if (d.type === 2) {
203
+ // apply maxlength to keys of objects as well
204
+ _name = URI[encode](d.val[i][0].substring(0, length));
205
+ }
206
+ } else if (_encode) {
207
+ // encode value
208
+ _value = URI[encode](d.val[i][1]);
209
+ if (d.type === 2) {
210
+ // encode name and cache encoded value
211
+ _name = URI[encode](d.val[i][0]);
212
+ d[encode].push([_name, _value]);
213
+ } else {
214
+ // cache encoded value
215
+ d[encode].push([undefined, _value]);
216
+ }
217
+ } else {
218
+ // values are already encoded and can be pulled from cache
219
+ _value = d[encode][i][1];
220
+ if (d.type === 2) {
221
+ _name = d[encode][i][0];
222
+ }
223
+ }
224
+
225
+ if (result) {
226
+ // unless we're the first value, prepend the separator
227
+ result += separator;
228
+ }
229
+
230
+ if (!explode) {
231
+ if (!i) {
232
+ // first element, so prepend variable name
233
+ result += URI[encode](name) + (empty_name_separator || _value ? '=' : '');
234
+ }
235
+
236
+ if (d.type === 2) {
237
+ // without explode-modifier, keys of objects are returned comma-separated
238
+ result += _name + ',';
239
+ }
240
+
241
+ result += _value;
242
+ } else {
243
+ // only add the = if it is either default (?&) or there actually is a value (;)
244
+ result += _name + (empty_name_separator || _value ? '=' : '') + _value;
245
+ }
246
+ }
247
+
248
+ return result;
249
+ };
250
+ // expand an unnamed variable
251
+ URITemplate.expandUnnamed = function(d, options, explode, separator, length) {
252
+ // variable result buffer
253
+ var result = '';
254
+ // performance crap
255
+ var encode = options.encode;
256
+ var empty_name_separator = options.empty_name_separator;
257
+ // flag noting if values are already encoded
258
+ var _encode = !d[encode].length;
259
+ var _name, _value, i, l;
260
+
261
+ // for each found value
262
+ for (i = 0, l = d.val.length; i < l; i++) {
263
+ if (length) {
264
+ // maxlength must be determined before encoding can happen
265
+ _value = URI[encode](d.val[i][1].substring(0, length));
266
+ } else if (_encode) {
267
+ // encode and cache value
268
+ _value = URI[encode](d.val[i][1]);
269
+ d[encode].push([
270
+ d.type === 2 ? URI[encode](d.val[i][0]) : undefined,
271
+ _value
272
+ ]);
273
+ } else {
274
+ // value already encoded, pull from cache
275
+ _value = d[encode][i][1];
276
+ }
277
+
278
+ if (result) {
279
+ // unless we're the first value, prepend the separator
280
+ result += separator;
281
+ }
282
+
283
+ if (d.type === 2) {
284
+ if (length) {
285
+ // maxlength also applies to keys of objects
286
+ _name = URI[encode](d.val[i][0].substring(0, length));
287
+ } else {
288
+ // at this point the name must already be encoded
289
+ _name = d[encode][i][0];
290
+ }
291
+
292
+ result += _name;
293
+ if (explode) {
294
+ // explode-modifier separates name and value by "="
295
+ result += (empty_name_separator || _value ? '=' : '');
296
+ } else {
297
+ // no explode-modifier separates name and value by ","
298
+ result += ',';
299
+ }
300
+ }
301
+
302
+ result += _value;
303
+ }
304
+
305
+ return result;
306
+ };
307
+
308
+ URITemplate.noConflict = function() {
309
+ if (root.URITemplate === URITemplate) {
310
+ root.URITemplate = _URITemplate;
311
+ }
312
+
313
+ return URITemplate;
314
+ };
315
+
316
+ // expand template through given data map
317
+ p.expand = function(data) {
318
+ var result = '';
319
+
320
+ if (!this.parts || !this.parts.length) {
321
+ // lazilyy parse the template
322
+ this.parse();
323
+ }
324
+
325
+ if (!(data instanceof Data)) {
326
+ // make given data available through the
327
+ // optimized data handling thingie
328
+ data = new Data(data);
329
+ }
330
+
331
+ for (var i = 0, l = this.parts.length; i < l; i++) {
332
+ /*jshint laxbreak: true */
333
+ result += typeof this.parts[i] === 'string'
334
+ // literal string
335
+ ? this.parts[i]
336
+ // expression
337
+ : URITemplate.expand(this.parts[i], data);
338
+ /*jshint laxbreak: false */
339
+ }
340
+
341
+ return result;
342
+ };
343
+ // parse template into action tokens
344
+ p.parse = function() {
345
+ // performance crap
346
+ var expression = this.expression;
347
+ var ePattern = URITemplate.EXPRESSION_PATTERN;
348
+ var vPattern = URITemplate.VARIABLE_PATTERN;
349
+ var nPattern = URITemplate.VARIABLE_NAME_PATTERN;
350
+ // token result buffer
351
+ var parts = [];
352
+ // position within source template
353
+ var pos = 0;
354
+ var variables, eMatch, vMatch;
355
+
356
+ // RegExp is shared accross all templates,
357
+ // which requires a manual reset
358
+ ePattern.lastIndex = 0;
359
+ // I don't like while(foo = bar()) loops,
360
+ // to make things simpler I go while(true) and break when required
361
+ while (true) {
362
+ eMatch = ePattern.exec(expression);
363
+ if (eMatch === null) {
364
+ // push trailing literal
365
+ parts.push(expression.substring(pos));
366
+ break;
367
+ } else {
368
+ // push leading literal
369
+ parts.push(expression.substring(pos, eMatch.index));
370
+ pos = eMatch.index + eMatch[0].length;
371
+ }
372
+
373
+ if (!operators[eMatch[1]]) {
374
+ throw new Error('Unknown Operator "' + eMatch[1] + '" in "' + eMatch[0] + '"');
375
+ } else if (!eMatch[3]) {
376
+ throw new Error('Unclosed Expression "' + eMatch[0] + '"');
377
+ }
378
+
379
+ // parse variable-list
380
+ variables = eMatch[2].split(',');
381
+ for (var i = 0, l = variables.length; i < l; i++) {
382
+ vMatch = variables[i].match(vPattern);
383
+ if (vMatch === null) {
384
+ throw new Error('Invalid Variable "' + variables[i] + '" in "' + eMatch[0] + '"');
385
+ } else if (vMatch[1].match(nPattern)) {
386
+ throw new Error('Invalid Variable Name "' + vMatch[1] + '" in "' + eMatch[0] + '"');
387
+ }
388
+
389
+ variables[i] = {
390
+ name: vMatch[1],
391
+ explode: !!vMatch[3],
392
+ maxlength: vMatch[4] && parseInt(vMatch[4], 10)
393
+ };
394
+ }
395
+
396
+ if (!variables.length) {
397
+ throw new Error('Expression Missing Variable(s) "' + eMatch[0] + '"');
398
+ }
399
+
400
+ parts.push({
401
+ expression: eMatch[0],
402
+ operator: eMatch[1],
403
+ variables: variables
404
+ });
405
+ }
406
+
407
+ if (!parts.length) {
408
+ // template doesn't contain any expressions
409
+ // so it is a simple literal string
410
+ // this probably should fire a warning or something?
411
+ parts.push(expression);
412
+ }
413
+
414
+ this.parts = parts;
415
+ return this;
416
+ };
417
+
418
+ // simplify data structures
419
+ Data.prototype.get = function(key) {
420
+ // performance crap
421
+ var data = this.data;
422
+ // cache for processed data-point
423
+ var d = {
424
+ // type of data 0: undefined/null, 1: string, 2: object, 3: array
425
+ type: 0,
426
+ // original values (except undefined/null)
427
+ val: [],
428
+ // cache for encoded values (only for non-maxlength expansion)
429
+ encode: [],
430
+ encodeReserved: []
431
+ };
432
+ var i, l, value;
433
+
434
+ if (this.cache[key] !== undefined) {
435
+ // we've already processed this key
436
+ return this.cache[key];
437
+ }
438
+
439
+ this.cache[key] = d;
440
+
441
+ if (String(Object.prototype.toString.call(data)) === '[object Function]') {
442
+ // data itself is a callback (global callback)
443
+ value = data(key);
444
+ } else if (String(Object.prototype.toString.call(data[key])) === '[object Function]') {
445
+ // data is a map of callbacks (local callback)
446
+ value = data[key](key);
447
+ } else {
448
+ // data is a map of data
449
+ value = data[key];
450
+ }
451
+
452
+ // generalize input into [ [name1, value1], [name2, value2], … ]
453
+ // so expansion has to deal with a single data structure only
454
+ if (value === undefined || value === null) {
455
+ // undefined and null values are to be ignored completely
456
+ return d;
457
+ } else if (String(Object.prototype.toString.call(value)) === '[object Array]') {
458
+ for (i = 0, l = value.length; i < l; i++) {
459
+ if (value[i] !== undefined && value[i] !== null) {
460
+ // arrays don't have names
461
+ d.val.push([undefined, String(value[i])]);
462
+ }
463
+ }
464
+
465
+ if (d.val.length) {
466
+ // only treat non-empty arrays as arrays
467
+ d.type = 3; // array
468
+ }
469
+ } else if (String(Object.prototype.toString.call(value)) === '[object Object]') {
470
+ for (i in value) {
471
+ if (hasOwn.call(value, i) && value[i] !== undefined && value[i] !== null) {
472
+ // objects have keys, remember them for named expansion
473
+ d.val.push([i, String(value[i])]);
474
+ }
475
+ }
476
+
477
+ if (d.val.length) {
478
+ // only treat non-empty objects as objects
479
+ d.type = 2; // object
480
+ }
481
+ } else {
482
+ d.type = 1; // primitive string (could've been string, number, boolean and objects with a toString())
483
+ // arrays don't have names
484
+ d.val.push([undefined, String(value)]);
485
+ }
486
+
487
+ return d;
488
+ };
489
+
490
+ // hook into URI for fluid access
491
+ URI.expand = function(expression, data) {
492
+ var template = new URITemplate(expression);
493
+ var expansion = template.expand(data);
494
+
495
+ return new URI(expansion);
496
+ };
497
+
498
+ return URITemplate;
499
+ }));