Module 567243

7,571 characters · in 25868.bd058c114912c1de.js
Dependencies
Lazily required by (0)none
Requires (2)
Lazily requires (0)none
Source Raw
function(e,t,r){"use strict";var n=r(89738);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["'"].concat(["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","	"])),u=["%","/","?",";","#"].concat(l),c=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},h={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(591560);function v(e,t,r){if(e&&"object"==typeof e&&e instanceof i)return e;var n=new i;return n.parse(e,t,r),n}i.prototype.parse=function(e,t,r){if("string"!=typeof e)throw TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),a=-1!==i&&i<e.indexOf("#")?"?":"#",v=e.split(a);v[0]=v[0].replace(/\\/g,"/");var y=e=v.join(a);if(y=y.trim(),!r&&1===e.split("#").length){var b=s.exec(y);if(b)return this.path=y,this.href=y,this.pathname=b[1],b[2]?(this.search=b[2],t?this.query=g.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=o.exec(y);if(_){var w=(_=_[0]).toLowerCase();this.protocol=w,y=y.substr(_.length)}if(r||_||y.match(/^\/\/[^@/]+@[^@/]+/)){var x="//"===y.substr(0,2);x&&!(_&&h[_])&&(y=y.substr(2),this.slashes=!0)}if(!h[_]&&(x||_&&!m[_])){for(var E,S,k=-1,T=0;T<c.length;T++){var C=y.indexOf(c[T]);-1!==C&&(-1===k||C<k)&&(k=C)}-1!==(S=-1===k?y.lastIndexOf("@"):y.lastIndexOf("@",k))&&(E=y.slice(0,S),y=y.slice(S+1),this.auth=decodeURIComponent(E)),k=-1;for(var T=0;T<u.length;T++){var C=y.indexOf(u[T]);-1!==C&&(-1===k||C<k)&&(k=C)}-1===k&&(k=y.length),this.host=y.slice(0,k),y=y.slice(k),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var P=this.hostname.split(/\./),T=0,M=P.length;T<M;T++){var O=P[T];if(O&&!O.match(d)){for(var R="",I=0,L=O.length;I<L;I++)O.charCodeAt(I)>127?R+="x":R+=O[I];if(!R.match(d)){var D=P.slice(0,T),F=P.slice(T+1),N=O.match(f);N&&(D.push(N[1]),F.unshift(N[2])),F.length&&(y="/"+F.join(".")+y),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=n.toASCII(this.hostname));var V=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+V,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!p[w])for(var T=0,M=l.length;T<M;T++){var B=l[T];if(-1!==y.indexOf(B)){var U=encodeURIComponent(B);U===B&&(U=escape(B)),y=y.split(B).join(U)}}var K=y.indexOf("#");-1!==K&&(this.hash=y.substr(K),y=y.slice(0,K));var $=y.indexOf("?");if(-1!==$?(this.search=y.substr($),this.query=y.substr($+1),t&&(this.query=g.parse(this.query)),y=y.slice(0,$)):t&&(this.search="",this.query={}),y&&(this.pathname=y),m[w]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var V=this.pathname||"",z=this.search||"";this.path=V+z}return this.href=this.format(),this},i.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":")+"@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(o=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||m[t])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+i+(r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(a=a.replace("#","%23"))+n},i.prototype.resolve=function(e){return this.resolveObject(v(e,!1,!0)).format()},i.prototype.resolveObject=function(e){if("string"==typeof e){var t=new i;t.parse(e,!1,!0),e=t}for(var r=new i,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),l=0;l<s.length;l++){var u=s[l];"protocol"!==u&&(r[u]=e[u])}return m[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!m[e.protocol]){for(var c=Object.keys(e),d=0;d<c.length;d++){var f=c[d];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||h[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var g=r.pathname||"",v=r.search||"";r.path=g+v}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var y=r.pathname&&"/"===r.pathname.charAt(0),b=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=b||y||r.host&&e.pathname,w=_,x=r.pathname&&r.pathname.split("/")||[],p=e.pathname&&e.pathname.split("/")||[],E=r.protocol&&!m[r.protocol];if(E&&(r.hostname="",r.port=null,r.host&&(""===x[0]?x[0]=r.host:x.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),_=_&&(""===p[0]||""===x[0])),b)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,x=p;else if(p.length)x||(x=[]),x.pop(),x=x.concat(p),r.search=e.search,r.query=e.query;else if(null!=e.search){if(E){r.host=x.shift(),r.hostname=r.host;var S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");S&&(r.auth=S.shift(),r.hostname=S.shift(),r.host=r.hostname)}return r.search=e.search,r.query=e.query,(null!==r.pathname||null!==r.search)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=x.slice(-1)[0],T=(r.host||e.host||x.length>1)&&("."===k||".."===k)||""===k,C=0,A=x.length;A>=0;A--)"."===(k=x[A])?x.splice(A,1):".."===k?(x.splice(A,1),C++):C&&(x.splice(A,1),C--);if(!_&&!w)for(;C--;)x.unshift("..");_&&""!==x[0]&&(!x[0]||"/"!==x[0].charAt(0))&&x.unshift(""),T&&"/"!==x.join("/").substr(-1)&&x.push("");var P=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(E){r.hostname=P?"":x.length?x.shift():"",r.host=r.hostname;var S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");S&&(r.auth=S.shift(),r.hostname=S.shift(),r.host=r.hostname)}return(_=_||r.host&&x.length)&&!P&&x.unshift(""),x.length>0?r.pathname=x.join("/"):(r.pathname=null,r.path=null),(null!==r.pathname||null!==r.search)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},i.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},t.parse=v,t.resolve=function(e,t){return v(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},t.format=function(e){return("string"==typeof e&&(e=v(e)),e instanceof i)?e.format():i.prototype.format.call(e)},t.Url=i}