!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Enumerator={})}(this,(function(e){"use strict";const t={}.toString,r=(e,r,n)=>(o,i=n)=>{if(e(o))return o;const l=null===o?"null":typeof o,a="object"===l?t.call(o).slice(8,-1):l,f=new TypeError(`Invalid ${i}: expected ${r}, got: ${a}`);throw Object.assign(f,{value:o})},n=r(Array.isArray,"Array","alphabet"),o=r(Number.isSafeInteger,"integer","length");function*i(e,t=-1){let r,i;if(o(t)<0?(t=n(e,"alphabets").length,i=e.map(e=>n(e)[0]),r=t=>e[t]):(i=Array(t).fill(n(e)[0]),r=()=>e),0===t)return void(yield[]);const l=t-1,a=Array(t).fill(0);for(;;){yield i.slice();for(let e=l;e>=0;--e){const t=r(e);let n=++a[e];if(n>=t.length){if(0===e)return;a[e]=n=0}if(i[e]=t[n],n)break}}}function l(e,t=-1){return Array.from(i(e,t))}e.enumerate=l,e.enumerator=i,e.generate=l,e.generator=i,e.unfold=e=>Object.entries(e).map(([e,t])=>[].concat(t).map(t=>[e,t])),Object.defineProperty(e,"__esModule",{value:!0})}));
