!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).implausible={})}(this,(function(n){"use strict";function t(n,t){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.push.apply(r,e)}return r}function r(n){for(var r=1;r=0||(u[r]=n[r]);return u}(n,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(e=0;e=0||Object.prototype.propertyIsEnumerable.call(n,r)&&(u[r]=n[r])}return u}function o(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var r=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==r)return;var e,u,o=[],i=!0,c=!1;try{for(r=r.call(n);!(i=(e=r.next()).done)&&(o.push(e.value),!t||o.length!==t);i=!0);}catch(n){c=!0,u=n}finally{try{i||null==r.return||r.return()}finally{if(c)throw u}}return o}(n,t)||c(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(n){return function(n){if(Array.isArray(n))return a(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||c(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(n,t){if(n){if("string"==typeof n)return a(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(n,t):void 0}}function a(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r=arguments.length)?c=t[i]:(c=arguments[u],u+=1),e[i]=c,f(c)||(o-=1),i+=1}return o<=0?r.apply(this,e):y(o,h(n,e,r))}}var d=l((function(n,t){return 1===n?s(t):y(n,h(n,[],t))}));function v(n){return function t(r,e,u){switch(arguments.length){case 0:return t;case 1:return f(r)?t:l((function(t,e){return n(r,t,e)}));case 2:return f(r)&&f(e)?t:f(r)?l((function(t,r){return n(t,e,r)})):f(e)?l((function(t,e){return n(r,t,e)})):s((function(t){return n(r,e,t)}));default:return f(r)&&f(e)&&f(u)?t:f(r)&&f(e)?l((function(t,r){return n(t,r,u)})):f(r)&&f(u)?l((function(t,r){return n(t,e,r)})):f(e)&&f(u)?l((function(t,e){return n(r,t,e)})):f(r)?s((function(t){return n(t,e,u)})):f(e)?s((function(t){return n(r,t,u)})):f(u)?s((function(t){return n(r,e,t)})):n(r,e,u)}}}var g=Array.isArray||function(n){return null!=n&&n.length>=0&&"[object Array]"===Object.prototype.toString.call(n)};function b(n){return null!=n&&"function"==typeof n["@@transducer/step"]}function x(n,t,r){return function(){if(0===arguments.length)return r();var e=Array.prototype.slice.call(arguments,0),u=e.pop();if(!g(u)){for(var o=0;on?t:n}));function j(n){return"[object String]"===Object.prototype.toString.call(n)}var A=s((function(n){return!!g(n)||!!n&&("object"==typeof n&&(!j(n)&&(1===n.nodeType?!!n.length:0===n.length||n.length>0&&(n.hasOwnProperty(0)&&n.hasOwnProperty(n.length-1)))))})),S=function(){function n(n){this.f=n}return n.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},n.prototype["@@transducer/result"]=function(n){return n},n.prototype["@@transducer/step"]=function(n,t){return this.f(n,t)},n}();var k=l((function(n,t){return y(n.length,(function(){return n.apply(t,arguments)}))}));function P(n,t,r){for(var e=r.next();!e.done;){if((t=n["@@transducer/step"](t,e.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}e=r.next()}return n["@@transducer/result"](t)}function q(n,t,r,e){return n["@@transducer/result"](r[e](k(n["@@transducer/step"],n),t))}var C="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function E(n,t,r){if("function"==typeof n&&(n=function(n){return new S(n)}(n)),A(r))return function(n,t,r){for(var e=0,u=r.length;e=0;)I(t=M[r],n)&&!F(e,t)&&(e[e.length]=t),r-=1;return e})):s((function(n){return Object(n)!==n?[]:Object.keys(n)})),X=l(x(["fantasy-land/map","map"],D,(function(n,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return d(t.length,(function(){return n.call(this,t.apply(this,arguments))}));case"[object Object]":return E((function(r,e){return r[e]=n(t[e]),r}),{},U(t));default:return function(n,t){for(var r=0,e=t.length,u=Array(e);r=0;){if(r[c]===n)return e[c]===t;c-=1}switch(i){case"Map":return n.size===t.size&&yn(n.entries(),t.entries(),r.concat([n]),e.concat([t]));case"Set":return n.size===t.size&&yn(n.values(),t.values(),r.concat([n]),e.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=U(n);if(a.length!==U(t).length)return!1;var f=r.concat([n]),s=e.concat([t]);for(c=a.length-1;c>=0;){var l=a[c];if(!I(l,t)||!hn(t[l],n[l],f,s))return!1;c-=1}return!0}var dn=l((function(n,t){return hn(n,t,[],[])})),vn=function(){function n(n,t,r,e){this.valueFn=n,this.valueAcc=t,this.keyFn=r,this.xf=e,this.inputs={}}return n.prototype["@@transducer/init"]=m,n.prototype["@@transducer/result"]=function(n){var t;for(t in this.inputs)if(I(t,this.inputs)&&(n=this.xf["@@transducer/step"](n,this.inputs[t]))["@@transducer/reduced"]){n=n["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](n)},n.prototype["@@transducer/step"]=function(n,t){var r=this.keyFn(t);return this.inputs[r]=this.inputs[r]||[r,this.valueAcc],this.inputs[r][1]=this.valueFn(this.inputs[r][1],t),n},n}(),gn=h(4,[],x([],h(4,[],(function(n,t,r,e){return new vn(n,t,r,e)})),(function(n,t,r,e){return E((function(e,u){var o=r(u);return e[o]=n(I(o,e)?e[o]:tn(t,[],[],!1),u),e}),{},e)})))((function(n,t){return n+1}),0),bn=l((function(n,t){return null==t||t!=t?n:t})),xn=v((function(n,t,r){var e=n(t),u=n(r);return e>u?-1:e>>0,t=(e*=t)>>>0,t+=4294967296*(e-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var n=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=n-(r.c=0|n)},r.c=1,r.s0=e(" "),r.s1=e(" "),r.s2=e(" "),r.s0-=e(n),r.s0<0&&(r.s0+=1),r.s1-=e(n),r.s1<0&&(r.s1+=1),r.s2-=e(n),r.s2<0&&(r.s2+=1),e=null}function u(n,t){return t.c=n.c,t.s0=n.s0,t.s1=n.s1,t.s2=n.s2,t}function o(n,t){var r=new e(n),o=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,o&&("object"==typeof o&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.alea=o}(0,n,!1)}(Xn);var Rn={exports:{}};!function(n){!function(n,t,r){function e(n){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var n=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^n^n>>>8},n===(0|n)?t.x=n:r+=n;for(var e=0;e>>0)/4294967296};return i.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=r.next,i.quick=i,o&&("object"==typeof o&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xor128=o}(0,n,!1)}(Rn);var Gn={exports:{}};!function(n){!function(n,t,r){function e(n){var t=this,r="";t.next=function(){var n=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^n^n<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,n===(0|n)?t.x=n:r+=n;for(var e=0;e>>4),t.next()}function u(n,t){return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t.v=n.v,t.d=n.d,t}function o(n,t){var r=new e(n),o=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=r.next,i.quick=i,o&&("object"==typeof o&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xorwow=o}(0,n,!1)}(Gn);var Vn={exports:{}};!function(n){!function(n,t,r){function e(n){var t=this;t.next=function(){var n,r,e=t.x,u=t.i;return n=e[u],r=(n^=n>>>7)^n<<24,r^=(n=e[u+1&7])^n>>>10,r^=(n=e[u+3&7])^n>>>3,r^=(n=e[u+4&7])^n<<7,n=e[u+7&7],r^=(n^=n<<13)^n<<9,e[u]=r,t.i=u+1&7,r},function(n,t){var r,e=[];if(t===(0|t))e[0]=t;else for(t=""+t,r=0;r0;--r)n.next()}(t,n)}function u(n,t){return t.x=n.x.slice(),t.i=n.i,t}function o(n,t){null==n&&(n=+new Date);var r=new e(n),o=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=r.next,i.quick=i,o&&(o.x&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xorshift7=o}(0,n,!1)}(Vn);var Wn={exports:{}};!function(n){!function(n,t,r){function e(n){var t=this;t.next=function(){var n,r,e=t.w,u=t.X,o=t.i;return t.w=e=e+1640531527|0,r=u[o+34&127],n=u[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,r=u[o]=r^n,t.i=o,r+(e^e>>>16)|0},function(n,t){var r,e,u,o,i,c=[],a=128;for(t===(0|t)?(e=t,t=null):(t+="\0",e=0,a=Math.max(a,t.length)),u=0,o=-32;o>>15,e^=e<<4,e^=e>>>13,o>=0&&(i=i+1640531527|0,u=0==(r=c[127&o]^=e+i)?u+1:0);for(u>=128&&(c[127&(t&&t.length||0)]=-1),u=127,o=512;o>0;--o)e=c[u+34&127],r=c[u=u+1&127],e^=e<<13,r^=r<<17,e^=e>>>15,r^=r>>>12,c[u]=e^r;n.w=i,n.X=c,n.i=u}(t,n)}function u(n,t){return t.i=n.i,t.w=n.w,t.X=n.X.slice(),t}function o(n,t){null==n&&(n=+new Date);var r=new e(n),o=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=r.next,i.quick=i,o&&(o.X&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.xor4096=o}(0,n,!1)}(Wn);var Ln={exports:{}};!function(n){!function(n,t,r){function e(n){var t=this,r="";t.next=function(){var n=t.b,r=t.c,e=t.d,u=t.a;return n=n<<25^n>>>7^r,r=r-e|0,e=e<<24^e>>>8^u,u=u-n|0,t.b=n=n<<20^n>>>12^r,t.c=r=r-e|0,t.d=e<<16^r>>>16^u,t.a=u-n|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,n===Math.floor(n)?(t.a=n/4294967296|0,t.b=0|n):r+=n;for(var e=0;e>>0)/4294967296};return i.double=function(){do{var n=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},i.int32=r.next,i.quick=i,o&&("object"==typeof o&&u(o,r),i.state=function(){return u(r,{})}),i}t&&t.exports?t.exports=o:r&&r.amd?r((function(){return o})):this.tychei=o}(0,n,!1)}(Ln);var $n={exports:{}},Hn=Un(Object.freeze({__proto__:null,default:{}}));!function(n){!function(t,r,e){var u,o=256,i=e.pow(o,6),c=e.pow(2,52),a=2*c,f=255;function s(n,f,s){var v=[],g=h(y((f=1==f?{entropy:!0}:f||{}).entropy?[n,d(r)]:null==n?function(){try{var n;return u&&(n=u.randomBytes)?n=n(o):(n=new Uint8Array(o),(t.crypto||t.msCrypto).getRandomValues(n)),d(n)}catch(n){var e=t.navigator,i=e&&e.plugins;return[+new Date,t,i,t.screen,d(r)]}}():n,3),v),b=new l(v),x=function(){for(var n=b.g(6),t=i,r=0;n=a;)n/=2,t/=2,r>>>=1;return(n+r)/t};return x.int32=function(){return 0|b.g(4)},x.quick=function(){return b.g(4)/4294967296},x.double=x,h(d(b.S),r),(f.pass||s||function(n,t,r,u){return u&&(u.S&&p(u,b),n.state=function(){return p(b,{})}),r?(e.random=n,t):n})(x,g,"global"in f?f.global:this==e,f.state)}function l(n){var t,r=n.length,e=this,u=0,i=e.i=e.j=0,c=e.S=[];for(r||(n=[r++]);u0&&void 0!==arguments[0]?arguments[0]:{};return r({},n)}),(function(n){var t=n.name,e=void 0===t?"arc4":t;return r(r({},u(n,at)),{},{name:e})}),ct,(function(n){return(0,n.algorithm)(n.seed)()})),st=function(n){return jn(on(L("ceiling"),qn(n)))},lt=["name","seed"],pt=["generated"],yt=on((function(n){var t=n.name,e=n.seed;return r(r({},u(n,lt)),{},{generated:ft({name:t,seed:e})})}),(function(n){var t=n.generated;return r(r({},u(n,pt)),{},{findCeilingGreaterThanGenerated:st(t)})}),(function(n){var t=n.ceilings;return(0,n.findCeilingGreaterThanGenerated)(t)}),L("name")),ht=An(mn),dt=on(K,Cn,ht),vt=on(L,xn,_n),gt=Y({divideBySumOfValues:dt,namesByDescendingWeight:on(Bn,X((function(n){var t=o(n,2);return{name:t[0],weight:t[1]}})),vt("weight"))}),bt=on(wn,In(0,"ceiling")),xt=function(n){return H((function(t,r){var e=r.name,u=r.weight;return[].concat(i(t),[{name:e,ceiling:p(bt(t),n(u))}])}),[])},mt=["collection"],wt=Dn(Array)("collection"),Ot=gn(fn),jt=Nn(wt,(function(n){var t=n.collection;return r(r({},u(n,mt)),{},{collection:Ot(t)})})),At=["count"],St=["generated"],kt=["collection"],Pt=["divideBySumOfValues"],qt=["namesByDescendingWeight","weightsToCeilings"],Ct=["generated"],Et=["name","seed"],zt=Mn((function(n){var t=n.count,r=n.generated;return dn(t,Pn(r))})),Dt=on((function(n){var t=n.generated,e=u(n,Ct);return r(r({},e),{},{generated:[].concat(i(t),[yt(r({},e))])})}),(function(n){var t=n.name,e=n.seed;return r(r({},u(n,Et)),{},{name:t,seed:ft({name:t,seed:e})})})),It=on(jt,(function(n){var t=n.count,e=void 0===t?1:t;return r(r({},u(n,At)),{},{count:e})}),(function(n){var t=n.generated,e=void 0===t?[]:t;return r(r({},u(n,St)),{},{generated:e})}),(function(n){var t=n.collection;return r(r({},u(n,kt)),gt(t))}),(function(n){var t=n.divideBySumOfValues;return r(r({},u(n,Pt)),{},{weightsToCeilings:xt(t)})}),(function(n){var t=n.namesByDescendingWeight,e=n.weightsToCeilings;return r(r({},u(n,qt)),{},{ceilings:e(t)})}),zt(Dt),L("generated")),Tt=on(It,cn);n.prng=ft,n.sample=Tt,n.samples=It,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=implausible.cjs.map