1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
!function(){function e(t,r,n){function o(i,s){if(!r[i]){if(!t[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var h=r[i]={exports:{}};t[i][0].call(h.exports,function(e){var r=t[i][1][e];return o(r||e)},h,h.exports,e,t,r,n)}return r[i].exports}for(var a="function"==typeof require&&require,i=0;i<n.length;i++)o(n[i]);return o}return e}()({1:[function(e,t,r){function n(){window.location.reload(!0)}var o=e("reload-css"),a=e("./error-popup");t.exports=function(){function e(){return m&&v?void console.warn("[budo] LiveReload disconnected. You may need to generate and trust a self-signed certificate, see here:\nhttps://github.com/mattdesl/budo/blob/master/docs/command-line-usage.md#ssl-on-ios"):v?void console.warn("[budo] LiveReload disconnected. Please reload the page to retry."):c>=u?void console.warn("[budo] LiveReload disconnected, exceeded retry count. Please reload the page to retry."):(h||(h=!0,console.warn("[budo] LiveReload disconnected, retrying...")),c++,clearTimeout(i),void(i=setTimeout(t,s)))}function t(){g&&(g.onclose=function(){},g.close()),g=r()}function r(){var t=v?"wss://":"ws://",r=t+d+"/livereload",i=new window.WebSocket(r);return i.onmessage=function(e){var t;try{t=JSON.parse(e.data)}catch(t){return void console.warn("Error parsing LiveReload server data: "+e.data)}"reload"===t.event?/^\.?css$/i.test(t.ext)?o(t.url):n():"error-popup"===t.event&&(t.message?a.show(t.message):a.hide()),b.forEach(function(e){e(t)})},i.onclose=function(t){1e3!==t.code&&1001!==t.code&&e()},i.onopen=function(){h&&(h=!1,c=0,console.warn("[budo] LiveReload reconnected.")),y.length&&1===i.readyState&&(y.forEach(function(e){i.send(e)}),y.length=0)},i.onerror=function(){return!1},i}var i,s=1e3,u=50,c=0,h=!1,l=document.location.protocol,f=document.location.hostname,p=document.location.port,d=f+":"+p,m=/(iOS|iPhone|iPad|iPod)/i.test(navigator.userAgent),v=/^https:/i.test(l),y=[],g=r(),b=[];return{send:function(e){e=JSON.stringify(e),g&&1===g.readyState?g.send(e):y.push(e)},listen:function(e){if("function"!=typeof e)throw new TypeError("cb must be a function!");b.push(e)},removeListener:function(e){var t=b.indexOf(e);-1!==t&&b.splice(t,1)},showError:function(e){a.show(e)},clearError:function(){a.hide()},reloadPage:n,reloadCSS:o}}(),window["budo-livereload"]=t.exports},{"./error-popup":2,"reload-css":7}],2:[function(e,t,r){function n(){var e=document.querySelector(".budo-error-handler-legacy-popup-element");e&&e.parentElement&&e.parentElement.removeChild(e)}function o(){s&&s.parentNode&&s.parentNode.removeChild(s),u&&u.parentNode&&u.parentNode.removeChild(u),s=null,u=null;var e=document.querySelector(".budo-error-handler-popup-element");e&&e.parentElement&&e.parentElement.removeChild(e),n()}function a(e){o();var t=document.createElement("div");t.className="budo-error-handler-popup-element";var r=document.createElement("pre");r.textContent=e,i(t,{position:"fixed",top:"0",left:"0",width:"100%",zIndex:"100000000",padding:"0",margin:"0","box-sizing":"border-box",background:"transparent",display:"block",overflow:"initial"}),i(r,{padding:"20px",overflow:"initial",zIndex:"100000000","box-sizing":"border-box",background:"#fff",display:"block","font-size":"12px","font-weight":"normal","font-family":"monospace","word-wrap":"break-word","white-space":"pre-wrap",color:"#ff0000",margin:"10px",border:"1px dashed hsla(0, 0%, 50%, 0.25)",borderRadius:"5px",boxShadow:"0px 10px 20px rgba(0, 0, 0, 0.2)"}),t.appendChild(r),document.body.appendChild(t),u=r,s=t}function i(e,t){for(var r in t)t.hasOwnProperty(r)&&(e.style[r]=t[r]);return t}var s,u;t.exports.hide=o,t.exports.show=a},{}],3:[function(e,t,r){(function(e){!function(n){function o(e){throw new RangeError(U[e])}function a(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function i(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(k,"."),n+a(e.split("."),t).join(".")}function s(e){for(var t,r,n=[],o=0,a=e.length;o<a;)t=e.charCodeAt(o++),t>=55296&&t<=56319&&o<a?(r=e.charCodeAt(o++),56320==(64512&r)?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--)):n.push(t);return n}function u(e){return a(e,function(e){var t="";return e>65535&&(e-=65536,t+=F(e>>>10&1023|55296),e=56320|1023&e),t+=F(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:j}function h(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function l(e,t,r){var n=0;for(e=r?P(e/q):e>>1,e+=P(e/t);e>L*C>>1;n+=j)e=P(e/L);return P(n+(L+1)*e/(e+A))}function f(e){var t,r,n,a,i,s,h,f,p,d,m=[],v=e.length,y=0,g=S,b=I;for(r=e.lastIndexOf(N),r<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&o("not-basic"),m.push(e.charCodeAt(n));for(a=r>0?r+1:0;a<v;){for(i=y,s=1,h=j;a>=v&&o("invalid-input"),f=c(e.charCodeAt(a++)),(f>=j||f>P((x-y)/s))&&o("overflow"),y+=f*s,p=h<=b?O:h>=b+C?C:h-b,!(f<p);h+=j)d=j-p,s>P(x/d)&&o("overflow"),s*=d;t=m.length+1,b=l(y-i,t,0==i),P(y/t)>x-g&&o("overflow"),g+=P(y/t),y%=t,m.splice(y++,0,g)}return u(m)}function p(e){var t,r,n,a,i,u,c,f,p,d,m,v,y,g,b,w=[];for(e=s(e),v=e.length,t=S,r=0,i=I,u=0;u<v;++u)(m=e[u])<128&&w.push(F(m));for(n=a=w.length,a&&w.push(N);n<v;){for(c=x,u=0;u<v;++u)(m=e[u])>=t&&m<c&&(c=m);for(y=n+1,c-t>P((x-r)/y)&&o("overflow"),r+=(c-t)*y,t=c,u=0;u<v;++u)if(m=e[u],m<t&&++r>x&&o("overflow"),m==t){for(f=r,p=j;d=p<=i?O:p>=i+C?C:p-i,!(f<d);p+=j)b=f-d,g=j-d,w.push(F(h(d+b%g,0))),f=P(b/g);w.push(F(h(f,0))),i=l(r,y,n==a),r=0,++n}++r,++t}return w.join("")}function d(e){return i(e,function(e){return E.test(e)?f(e.slice(4).toLowerCase()):e})}function m(e){return i(e,function(e){return R.test(e)?"xn--"+p(e):e})}var v="object"==typeof r&&r&&!r.nodeType&&r,y="object"==typeof t&&t&&!t.nodeType&&t,g="object"==typeof e&&e;g.global!==g&&g.window!==g&&g.self!==g||(n=g);var b,w,x=2147483647,j=36,O=1,C=26,A=38,q=700,I=72,S=128,N="-",E=/^xn--/,R=/[^\x20-\x7E]/,k=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=j-O,P=Math.floor,F=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:s,encode:u},decode:f,encode:p,toASCII:m,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(v&&y)if(t.exports==v)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,a){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var s=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var h=0;h<c;++h){var l,f,p,d,m=e[h].replace(s,"%20"),v=m.indexOf(r);v>=0?(l=m.substr(0,v),f=m.substr(v+1)):(l=m,f=""),p=decodeURIComponent(l),d=decodeURIComponent(f),n(i,p)?o(i[p])?i[p].push(d):i[p]=[i[p],d]:i[p]=d}return i};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],5:[function(e,t,r){"use strict";function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var o=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,s){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?n(i(e),function(i){var s=encodeURIComponent(o(i))+r;return a(e[i])?n(e[i],function(e){return s+encodeURIComponent(o(e))}).join(t):s+encodeURIComponent(o(e[i]))}).join(t):s?encodeURIComponent(o(s))+r+encodeURIComponent(o(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],6:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":4,"./encode":5}],7:[function(e,t,r){function n(e){return e.busted||(e.rule=h(e.rule,e.index)),e.busted=!0,e}function o(e,t){var r=e.getAttribute("href"),n=e.cloneNode(!1);n.href=p(r);var o=e.parentNode;return o.lastChild===e?o.appendChild(n):o.insertBefore(n,e.nextSibling),n.onload=function(){e.parentNode&&e.parentNode.removeChild(e),t&&t()},n}function a(e,t){if(u(e))return!1;if("LINK"===e.tagName){if(!e.getAttribute("href"))return!1;if(t&&!i(e))return!1}return!0}function i(e){var t=e.getAttribute("href");if(!t||"stylesheet"!==e.getAttribute("rel"))return!1;var r=m.parse(t);return(!r.protocol||r.protocol===window.document.location.protocol)&&(!r.host||v.indexOf(r.host.toLowerCase())>=0)}function s(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function u(e){return"print"===e.getAttribute("media")}function c(e){return Array.prototype.slice.call(document.getElementsByTagName(e))}function h(e,t){var r=e.parentStyleSheet,n=p(e.href),o="";try{o=e.media.length?Array.prototype.join.call(e.media,", "):""}catch(e){}var a='@import url("'+n+'") '+o+";";return r.insertRule(a,t),r.deleteRule(t+1),r.cssRules[t]}function l(e){for(var t=e;t.parentImport;)t=t.parentImport;return t}function f(e,t,r,n,o){if(t){var a;try{a=t.cssRules}catch(e){}if(a&&0!==a.length)for(var i=0;i<a.length;i++){var s=a[i];if(s.type===window.CSSRule.IMPORT_RULE){var u=s.parentStyleSheet.href||document.location.href,c=m.resolve(u,s.href),h=m.key(c,n),l={index:i,rule:s,parentImport:o,key:h,href:s.href};r.push(l),f(e,s.styleSheet,r,n,l)}}}}function p(e){var t=m.parse(e),r=d.parse(t.search);return r._livereload=String(Date.now()),t.query=void 0,t.search=d.stringify(r),m.format(t)}var d=e("query-string"),m=e("./lib/url"),v=function(){var e=["localhost","127.0.0.1"].map(function(e){return e+":"+window.document.location.port});return"localhost"!==window.document.location.hostname&&(e=e.concat([window.document.location.host])),e.map(function(e){return e.toLowerCase()})}();t.exports=function(e,t){var r=!0;t&&!1===t.local&&(r=!1);var i=document.location.pathname,u=document.querySelector("base");if(u){i=u.getAttribute("href");var h=m.parse(i);h.pathname="/",h.hash=null,h.query=null,h.search=null,i=m.format(h)}var p=["link","style"].map(c).reduce(function(e,t){return e.concat(t)},[]).filter(function(e){return a(e,r)}).map(function(e){var t={element:e},r=e.getAttribute("href");return"LINK"===e.tagName&&r&&(t.key=m.key(r,i)),t}),d=[];p.forEach(function(e){f(e,e.element.sheet,d,i)});var v=e?m.key(e,i):null,y=d;v&&(y=y.filter(function(e){return e.key===v})),y=y.map(l),y=s(y).reverse(),y.forEach(n),p.filter(function(e){var t=!v||e.key===v;return"LINK"===e.element.tagName&&t}).forEach(function(e){e.element=o(e.element)})}},{"./lib/url":8,"query-string":10}],8:[function(e,t,r){var n=e("url");t.exports.resolve=n.resolve.bind(n),t.exports.format=n.format.bind(n),t.exports.parse=function(e){return 0===e.indexOf("//")&&(e=document.location.protocol+e),n.parse(e)},t.exports.key=function(e,t){var r=n.parse(e);return e=n.format({pathname:(r.pathname||"").replace(/\/+$/,"/")}),n.resolve(t||document.location.pathname,e)}},{url:12}],9:[function(e,t,r){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,u=n(e),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var h in r)a.call(r,h)&&(u[h]=r[h]);if(o){s=o(r);for(var l=0;l<s.length;l++)i.call(r,s[l])&&(u[s[l]]=r[s[l]])}}return u}},{}],10:[function(e,t,r){"use strict";function n(e){switch(e.arrayFormat){case"index":return function(t,r,n){return null===r?[a(t,e),"[",n,"]"].join(""):[a(t,e),"[",a(n,e),"]=",a(r,e)].join("")};case"bracket":return function(t,r){return null===r?a(t,e):[a(t,e),"[]=",a(r,e)].join("")};default:return function(t,r){return null===r?a(t,e):[a(t,e),"=",a(r,e)].join("")}}}function o(e){var t;switch(e.arrayFormat){case"index":return function(e,r,n){if(t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),!t)return void(n[e]=r);void 0===n[e]&&(n[e]={}),n[e][t[1]]=r};case"bracket":return function(e,r,n){return t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0===n[e]?void(n[e]=[r]):void(n[e]=[].concat(n[e],r)):void(n[e]=r)};default:return function(e,t,r){if(void 0===r[e])return void(r[e]=t);r[e]=[].concat(r[e],t)}}}function a(e,t){return t.encode?t.strict?s(e):encodeURIComponent(e):e}function i(e){return Array.isArray(e)?e.sort():"object"==typeof e?i(Object.keys(e)).sort(function(e,t){return Number(e)-Number(t)}).map(function(t){return e[t]}):e}var s=e("strict-uri-encode"),u=e("object-assign");r.extract=function(e){return e.split("?")[1]||""},r.parse=function(e,t){t=u({arrayFormat:"none"},t);var r=o(t),n=Object.create(null);return"string"!=typeof e?n:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var t=e.replace(/\+/g," ").split("="),o=t.shift(),a=t.length>0?t.join("="):void 0;a=void 0===a?null:decodeURIComponent(a),r(decodeURIComponent(o),a,n)}),Object.keys(n).sort().reduce(function(e,t){var r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=i(r):e[t]=r,e},Object.create(null))):n},r.stringify=function(e,t){t=u({encode:!0,strict:!0,arrayFormat:"none"},t);var r=n(t);return e?Object.keys(e).sort().map(function(n){var o=e[n];if(void 0===o)return"";if(null===o)return a(n,t);if(Array.isArray(o)){var i=[];return o.slice().forEach(function(e){void 0!==e&&i.push(r(n,e,i.length))}),i.join("&")}return a(n,t)+"="+a(o,t)}).filter(function(e){return e.length>0}).join("&"):""}},{"object-assign":9,"strict-uri-encode":11}],11:[function(e,t,r){"use strict";t.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},{}],12:[function(e,t,r){"use strict";function n(){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}function o(e,t,r){if(e&&c.isObject(e)&&e instanceof n)return e;var o=new n;return o.parse(e,t,r),o}function a(e){return c.isString(e)&&(e=o(e)),e instanceof n?e.format():n.prototype.format.call(e)}function i(e,t){return o(e,!1,!0).resolve(t)}function s(e,t){return e?o(e,!1,!0).resolveObject(t):t}var u=e("punycode"),c=e("./util");r.parse=o,r.resolve=i,r.resolveObject=s,r.format=a,r.Url=n;var h=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(d),v=["%","/","?",";","#"].concat(m),y=["/","?","#"],g=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},O=e("querystring");n.prototype.parse=function(e,t,r){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",a=e.split(o),i=/\\/g;a[0]=a[0].replace(i,"/"),e=a.join(o);var s=e;if(s=s.trim(),!r&&1===e.split("#").length){var l=f.exec(s);if(l)return this.path=s,this.href=s,this.pathname=l[1],l[2]?(this.search=l[2],this.query=t?O.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var p=h.exec(s);if(p){p=p[0];var d=p.toLowerCase();this.protocol=d,s=s.substr(p.length)}if(r||p||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var C="//"===s.substr(0,2);!C||p&&x[p]||(s=s.substr(2),this.slashes=!0)}if(!x[p]&&(C||p&&!j[p])){for(var A=-1,q=0;q<y.length;q++){var I=s.indexOf(y[q]);-1!==I&&(-1===A||I<A)&&(A=I)}var S,N;N=-1===A?s.lastIndexOf("@"):s.lastIndexOf("@",A),-1!==N&&(S=s.slice(0,N),s=s.slice(N+1),this.auth=decodeURIComponent(S)),A=-1;for(var q=0;q<v.length;q++){var I=s.indexOf(v[q]);-1!==I&&(-1===A||I<A)&&(A=I)}-1===A&&(A=s.length),this.host=s.slice(0,A),s=s.slice(A),this.parseHost(),this.hostname=this.hostname||"";var E="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!E)for(var R=this.hostname.split(/\./),q=0,k=R.length;q<k;q++){var U=R[q];if(U&&!U.match(g)){for(var L="",P=0,F=U.length;P<F;P++)U.charCodeAt(P)>127?L+="x":L+=U[P];if(!L.match(g)){var T=R.slice(0,q),$=R.slice(q+1),z=U.match(b);z&&(T.push(z[1]),$.unshift(z[2])),$.length&&(s="/"+$.join(".")+s),this.hostname=T.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=u.toASCII(this.hostname));var _=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+_,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!w[d])for(var q=0,k=m.length;q<k;q++){var B=m[q];if(-1!==s.indexOf(B)){var D=encodeURIComponent(B);D===B&&(D=escape(B)),s=s.split(B).join(D)}}var M=s.indexOf("#");-1!==M&&(this.hash=s.substr(M),s=s.slice(0,M));var H=s.indexOf("?");if(-1!==H?(this.search=s.substr(H),this.query=s.substr(H+1),t&&(this.query=O.parse(this.query)),s=s.slice(0,H)):t&&(this.search="",this.query={}),s&&(this.pathname=s),j[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var _=this.pathname||"",J=this.search||"";this.path=_+J}return this.href=this.format(),this},n.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(a=O.stringify(this.query));var i=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||j[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),i&&"?"!==i.charAt(0)&&(i="?"+i),r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),i=i.replace("#","%23"),t+o+r+i+n},n.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if(c.isString(e)){var t=new n;t.parse(e,!1,!0),e=t}for(var r=new n,o=Object.keys(this),a=0;a<o.length;a++){var i=o[a];r[i]=this[i]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),u=0;u<s.length;u++){var h=s[u];"protocol"!==h&&(r[h]=e[h])}return j[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!j[e.protocol]){for(var l=Object.keys(e),f=0;f<l.length;f++){var p=l[f];r[p]=e[p]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||x[e.protocol])r.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.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 m=r.pathname||"",v=r.search||"";r.path=m+v}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var y=r.pathname&&"/"===r.pathname.charAt(0),g=e.host||e.pathname&&"/"===e.pathname.charAt(0),b=g||y||r.host&&e.pathname,w=b,O=r.pathname&&r.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],C=r.protocol&&!j[r.protocol];if(C&&(r.hostname="",r.port=null,r.host&&(""===O[0]?O[0]=r.host:O.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),b=b&&(""===d[0]||""===O[0])),g)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,O=d;else if(d.length)O||(O=[]),O.pop(),O=O.concat(d),r.search=e.search,r.query=e.query;else if(!c.isNullOrUndefined(e.search)){if(C){r.hostname=r.host=O.shift();var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return r.search=e.search,r.query=e.query,c.isNull(r.pathname)&&c.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!O.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var q=O.slice(-1)[0],I=(r.host||e.host||O.length>1)&&("."===q||".."===q)||""===q,S=0,N=O.length;N>=0;N--)q=O[N],"."===q?O.splice(N,1):".."===q?(O.splice(N,1),S++):S&&(O.splice(N,1),S--);if(!b&&!w)for(;S--;S)O.unshift("..");!b||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),I&&"/"!==O.join("/").substr(-1)&&O.push("");var E=""===O[0]||O[0]&&"/"===O[0].charAt(0);if(C){r.hostname=r.host=E?"":O.length?O.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return b=b||r.host&&O.length,b&&!E&&O.unshift(""),O.length?r.pathname=O.join("/"):(r.pathname=null,r.path=null),c.isNull(r.pathname)&&c.isNull(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},n.prototype.parseHost=function(){var e=this.host,t=l.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":13,punycode:3,querystring:6}],13:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}]},{},[1]); |