var N=(n,f)=>()=>(f||n((f={exports:{}}).exports,f),f.exports);var B=N((R,$)=>{$.exports=A;A.flatten=A;A.unflatten=S;function F(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function K(n){return n}function A(n,f){f=f||{};let t=f.delimiter||".",d=f.maxDepth,v=f.transformKey||K,l={};function _(p,u,O){O=O||1,Object.keys(p).forEach(function(c){let i=p[c],e=f.safe&&Array.isArray(i),a=Object.prototype.toString.call(i),o=F(i),m=a==="[object Object]"||a==="[object Array]",b=u?u+t+v(c):v(c);if(!e&&!o&&m&&Object.keys(i).length&&(!f.maxDepth||O<d))return _(i,b,O+1);l[b]=i})}return _(n),l}function S(n,f){f=f||{};let t=f.delimiter||".",d=f.overwrite||!1,v=f.transformKey||K,l={};if(F(n)||Object.prototype.toString.call(n)!=="[object Object]")return n;function p(c){let i=Number(c);return isNaN(i)||c.indexOf(".")!==-1||f.object?c:i}function u(c,i,e){return Object.keys(e).reduce(function(a,o){return a[c+t+o]=e[o],a},i)}function O(c){let i=Object.prototype.toString.call(c),e=i==="[object Array]",a=i==="[object Object]";if(c){if(e)return!c.length;if(a)return!Object.keys(c).length}else return!0}return n=Object.keys(n).reduce(function(c,i){let e=Object.prototype.toString.call(n[i]);return!(e==="[object Object]"||e==="[object Array]")||O(n[i])?(c[i]=n[i],c):u(i,c,A(n[i],f))},{}),Object.keys(n).forEach(function(c){let i=c.split(t).map(v),e=p(i.shift()),a=p(i[0]),o=l;for(;a!==void 0;){if(e==="__proto__")return;let m=Object.prototype.toString.call(o[e]),b=m==="[object Object]"||m==="[object Array]";if(!d&&!b&&typeof o[e]<"u")return;(d&&!b||!d&&o[e]==null)&&(o[e]=typeof a=="number"&&!f.object?[]:{}),o=o[e],i.length>0&&(e=p(i.shift()),a=p(i[0]))}o[e]=S(n[c],f)}),l}});var q=N((T,x)=>{function Z(n){if(typeof n=="number")return!0;if(/^0x[0-9a-f]+$/i.test(n))try{return Number(n)<=Number.MAX_SAFE_INTEGER}catch{return!1}return/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(n)}x.exports={isNumber:Z}});var D=B().unflatten,G=B(),{isNumber:I}=q();module.exports=function(n,f){f||(f={});var t={bools:{},strings:{},array:{},aliases:{},unknownFn:null};typeof f.unknown=="function"&&(t.unknownFn=f.unknown),typeof f.boolean=="boolean"&&f.boolean?t.allBools=!0:[].concat(f.boolean).filter(Boolean).forEach(function(r){t.bools[r]=!0});var d=t.aliases;Object.keys(f.alias||{}).forEach(function(r){d[r]=[].concat(f.alias[r]),d[r].forEach(function(s){d[s]=[r].concat(d[r].filter(function(E){return s!==E}))})}),[].concat(f.string).filter(Boolean).forEach(function(r){t.strings[r]=!0,t.aliases[r]&&(t.strings[t.aliases[r]]=!0)}),[].concat(f.array).filter(Boolean).forEach(function(r){t.array[r]=!0,t.aliases[r]&&(t.array[t.aliases[r]]=!0)});var v=G(f.default||{}),l={_:[]};Object.keys(t.bools).forEach(function(r){u(r,v[r]===void 0?!1:v[r])});var _=[];!f.stopEarly&&n.indexOf("--")!==-1&&(_=n.slice(n.indexOf("--")+1),n=n.slice(0,n.indexOf("--")));function p(r,s){return t.allBools&&/^--[^=]+$/.test(s)||t.strings[r]||t.bools[r]||t.array[r]||t.aliases[r]}function u(r,s,E){if(!(E&&t.unknownFn&&!p(r,E)&&t.unknownFn(E)===!1)){var j=!t.strings[r]&&I(s)?Number(s):s;O(l,r,j),(d[r]||[]).forEach(function(z){O(l,z,j)})}}function O(r,s,E){var j=r;s!=="__proto__"&&(j[s]===void 0?j[s]=t.array[s]?[E]:E:t.bools[s]||typeof j[s]=="boolean"?j[s]=E:Array.isArray(j[s])?j[s].push(E):j[s]=[j[s],E])}function c(r){return d[r].some(function(s){return t.bools[s]})}for(var i=0;i<n.length;i++){var e=n[i];if(/^--.+=/.test(e)){var a=e.match(/^--([^=]+)=([\s\S]*)$/),o=a[1],m=a[2];t.bools[o]&&(m=m!=="false"),u(o,m,e)}else if(/^--.+:/.test(e)){var a=e.match(/^--([^=]+):([\s\S]*)$/),o=a[1],m=a[2];t.array[o]===void 0&&(t.array[o]=!0,t.aliases[o]&&(t.array[t.aliases[o]]=!0)),t.bools[o]&&(m=m!=="false"),u(o,m,e)}else if(/^--no-.+/.test(e)){var o=e.match(/^--no-(.+)/)[1];u(o,!1,e)}else if(/^--.+/.test(e)){var o=e.match(/^--(.+)/)[1],b=n[i+1];b!==void 0&&!/^-/.test(b)&&!t.bools[o]&&!t.allBools&&(d[o]?!c(o):!0)?(u(o,b,e),i++):/^(true|false)$/.test(b)?(u(o,b==="true",e),i++):u(o,t.strings[o]?"":!0,e)}else if(/^-[^-]+/.test(e)){for(var y=e.slice(1,-1).split(""),w=!1,h=0;h<y.length;h++){var b=e.slice(h+2);if(b==="-"){u(y[h],b,e);continue}if(/[A-Za-z]/.test(y[h])&&/=/.test(b)){u(y[h],b.split("=")[1],e),w=!0;break}if(/-?\d+(\.\d*)?(e-?\d+)?$/.test(b)&&/[A-Za-z]/.test(y[h])){u(y[h],b,e),w=!0;break}if(y[h+1]&&y[h+1].match(/\W/)){u(y[h],e.slice(h+2),e),w=!0;break}else u(y[h],t.strings[y[h]]?"":!0,e)}var o=e.slice(-1)[0];!w&&o!=="-"&&(n[i+1]&&!/^(-|--)[^-]/.test(n[i+1])&&!t.bools[o]&&(d[o]?!c(o):!0)?(u(o,n[i+1],e),i++):n[i+1]&&/^(true|false)$/.test(n[i+1])?(u(o,n[i+1]==="true",e),i++):u(o,t.strings[o]?"":!0,e))}else if((!t.unknownFn||t.unknownFn(e)!==!1)&&l._.push(t.strings._||!I(e)?e:Number(e)),f.stopEarly){l._.push.apply(l._,n.slice(i+1));break}}return Object.keys(v).forEach(function(r){r in l||(O(l,r,v[r]),(d[r]||[]).forEach(function(s){O(l,s,v[r])}))}),f["--"]?(l["--"]=new Array,_.forEach(function(r){l["--"].push(r)})):_.forEach(function(r){l._.push(r)}),D(l)};
//# sourceMappingURL=index.js.map
