UNPKG

bloom-layout

Version:
1 lines 4.79 kB
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).URLParse=e()}}(function(){return function e(t,o,r){function n(a,i){if(!o[a]){if(!t[a]){var p="function"==typeof require&&require;if(!i&&p)return p(a,!0);if(s)return s(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=o[a]={exports:{}};t[a][0].call(f.exports,function(e){var o=t[a][1][e];return n(o||e)},f,f.exports,e,t,o,r)}return o[a].exports}for(var s="function"==typeof require&&require,a=0;a<r.length;a++)n(r[a]);return n}({1:[function(e,t,o){(function(o){"use strict";function r(e){var t,r={},n=typeof(e=e||o.location||{});if("blob:"===e.protocol)r=new a(unescape(e.pathname),{});else if("string"===n){r=new a(e,{});for(t in u)delete r[t]}else if("object"===n){for(t in e)t in u||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=f.test(e.href))}return r}function n(e){var t=c.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function s(e,t){for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,n=o[r-1],s=!1,a=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),a++):a&&(0===r&&(s=!0),o.splice(r,1),a--);return s&&o.unshift(""),"."!==n&&".."!==n||o.push(""),o.join("/")}function a(e,t,o){if(!(this instanceof a))return new a(e,t,o);var c,f,u,h,d,y,m=l.slice(),g=typeof t,w=this,v=0;for("object"!==g&&"string"!==g&&(o=t,t=null),o&&"function"!=typeof o&&(o=p.parse),t=r(t),c=!(f=n(e||"")).protocol&&!f.slashes,w.slashes=f.slashes||c&&t.slashes,w.protocol=f.protocol||t.protocol||"",e=f.rest,f.slashes||(m[2]=[/(.*)/,"pathname"]);v<m.length;v++)u=(h=m[v])[0],y=h[1],u!=u?w[y]=e:"string"==typeof u?~(d=e.indexOf(u))&&("number"==typeof h[2]?(w[y]=e.slice(0,d),e=e.slice(d+h[2])):(w[y]=e.slice(d),e=e.slice(0,d))):(d=u.exec(e))&&(w[y]=d[1],e=e.slice(0,d.index)),w[y]=w[y]||(c&&h[3]?t[y]||"":""),h[4]&&(w[y]=w[y].toLowerCase());o&&(w.query=o(w.query)),c&&t.slashes&&"/"!==w.pathname.charAt(0)&&(""!==w.pathname||""!==t.pathname)&&(w.pathname=s(w.pathname,t.pathname)),i(w.port,w.protocol)||(w.host=w.hostname,w.port=""),w.username=w.password="",w.auth&&(h=w.auth.split(":"),w.username=h[0]||"",w.password=h[1]||""),w.origin=w.protocol&&w.host&&"file:"!==w.protocol?w.protocol+"//"+w.host:"null",w.href=w.toString()}var i=e("requires-port"),p=e("querystringify"),c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,f=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],u={hash:1,query:1};a.prototype={set:function(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||p.parse)(t)),r[e]=t;break;case"port":r[e]=t,i(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var n="pathname"===e?"/":"#";r[e]=t.charAt(0)!==n?n+t:t}else r[e]=t;break;default:r[e]=t}for(var s=0;s<l.length;s++){var a=l[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=p.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var n=r+(o.slashes?"//":"");return o.username&&(n+=o.username,o.password&&(n+=":"+o.password),n+="@"),n+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(n+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(n+=o.hash),n}},a.extractProtocol=n,a.location=r,a.qs=p,t.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:2,"requires-port":3}],2:[function(e,t,o){"use strict";function r(e){return decodeURIComponent(e.replace(/\+/g," "))}var n=Object.prototype.hasOwnProperty;o.stringify=function(e,t){var o=[];"string"!=typeof(t=t||"")&&(t="?");for(var r in e)n.call(e,r)&&o.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return o.length?t+o.join("&"):""},o.parse=function(e){for(var t,o=/([^=?&]+)=?([^&]*)/g,n={};t=o.exec(e);n[r(t[1])]=r(t[2]));return n}},{}],3:[function(e,t,o){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}]},{},[1])(1)});