function hasKey(t,e){var s=t;return e.slice(0,-1).forEach(function(t){s=s[t]||{}}),e[e.length-1]in s}function setKey(t,e,s){var n=t;e.slice(0,-1).forEach(function(t){void 0===n[t]&&(n[t]={}),n=n[t]});var o=e[e.length-1];void 0===n[o]||"boolean"==typeof n[o]?n[o]=s:Array.isArray(n[o])?n[o].push(s):n[o]=[n[o],s]}function isNumber(t){return"number"==typeof t||(!!/^0x[0-9a-f]+$/i.test(t)||/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t))}function longest(t){return Math.max.apply(null,t.map(function(t){return t.length}))}module.exports=function(t,e){e||(e={});var s={bools:{},strings:{}};[].concat(e.boolean).filter(Boolean).forEach(function(t){s.bools[t]=!0}),[].concat(e.string).filter(Boolean).forEach(function(t){s.strings[t]=!0});var n={};Object.keys(e.alias||{}).forEach(function(t){n[t]=[].concat(e.alias[t]),n[t].forEach(function(e){n[e]=[t].concat(n[t].filter(function(t){return e!==t}))})});var o=e.default||{},r={_:[]};Object.keys(s.bools).forEach(function(t){a(t,void 0!==o[t]&&o[t])});var i=[];function a(t,e){var o=!s.strings[t]&&isNumber(e)?Number(e):e;setKey(r,t.split("."),o),(n[t]||[]).forEach(function(t){setKey(r,t.split("."),o)})}-1!==t.indexOf("--")&&(i=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var c=0;c<t.length;c++){var f=t[c];if(/^--.+=/.test(f)){var l=f.match(/^--([^=]+)=([\s\S]*)$/);a(l[1],l[2])}else if(/^--no-.+/.test(f)){a(u=f.match(/^--no-(.+)/)[1],!1)}else if(/^--.+/.test(f)){var u=f.match(/^--(.+)/)[1];void 0===(d=t[c+1])||/^-/.test(d)||s.bools[u]||n[u]&&s.bools[n[u]]?/^(true|false)$/.test(d)?(a(u,"true"===d),c++):a(u,!s.strings[u]||""):(a(u,d),c++)}else if(/^-[^-]+/.test(f)){for(var h=f.slice(1,-1).split(""),b=!1,v=0;v<h.length;v++){var d;if("-"!==(d=f.slice(v+2))){if(/[A-Za-z]/.test(h[v])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(d)){a(h[v],d),b=!0;break}if(h[v+1]&&h[v+1].match(/\W/)){a(h[v],f.slice(v+2)),b=!0;break}a(h[v],!s.strings[h[v]]||"")}else a(h[v],d)}u=f.slice(-1)[0];b||"-"===u||(!t[c+1]||/^(-|--)[^-]/.test(t[c+1])||s.bools[u]||n[u]&&s.bools[n[u]]?t[c+1]&&/true|false/.test(t[c+1])?(a(u,"true"===t[c+1]),c++):a(u,!s.strings[u]||""):(a(u,t[c+1]),c++))}else r._.push(s.strings._||!isNumber(f)?f:Number(f))}return Object.keys(o).forEach(function(t){hasKey(r,t.split("."))||(setKey(r,t.split("."),o[t]),(n[t]||[]).forEach(function(e){setKey(r,e.split("."),o[t])}))}),i.forEach(function(t){r._.push(t)}),r};