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,GAC7B,OAAO,SAAU9G,GACb,OAAOA,EAAGC,OAAO6G,EAAEnH,OACvB,CACJ,EAkEW4I,EAAc,SAAUzB,GAC/B,IAAIiC,EAAajJ,EAAUgH,GAC3B,OAAO,SAAU2B,GAAU,OAAOO,EAAAA,EAAAA,IArqBb,SAAUP,GAC/B,OAAO,SAAUzI,GACb,IAAIiJ,EAAO5H,EAAKrB,GAChB,OAAOiB,EAAWgI,IAAQpG,EAAAA,EAAAA,IAAKoG,EAtBf,SAAUR,GAC9B,OAAO,SAAUzI,GAEb,IADA,IAAIwC,EAAM,CAACiG,EAAQzI,EAAG,IACbW,EAAI,EAAGA,EAAIX,EAAGS,OAAQE,IAC3B6B,EAAIC,KAAKgG,EAAQzI,EAAGW,IAExB,OAAO6B,CACX,CACJ,CAc6C0G,CAAWT,GAASnH,EAAQF,EAAKpB,KAAQA,CAClF,CACJ,CAgqB2CmJ,CAAYV,GAASM,EAAa,CAC7E,EA+CO,SAASpG,EAAKvB,EAAMC,GACvB,YAAgBuB,IAATvB,EAAqBC,EAAQF,IAAQyB,EAAAA,EAAAA,IAAKxB,EAAMC,EAAQF,GACnE,CAQO,IAAI2B,EAAO,SAAUtB,EAAMD,GAAO,OAAOqB,EAAAA,EAAAA,IAAKpB,GA92B9B4F,EA82B2C,CAAC7F,GA72BxD4H,EAAI/B,EAAE1H,OAAOyJ,GAAK,SAAUA,GAAK,OAAOA,EAAEzJ,OAAO0H,EAAI,IADzD,IAAgBA,EAAG+B,CA82BiD,C","sources":["../node_modules/fp-ts/es6/Magma.js","../node_modules/fp-ts/es6/NonEmptyArray.js","../node_modules/fp-ts/es6/Option.js","../node_modules/fp-ts/es6/Ord.js","../node_modules/fp-ts/es6/Predicate.js","../node_modules/fp-ts/es6/ReadonlyArray.js","../node_modules/fp-ts/es6/ReadonlyNonEmptyArray.js"],"sourcesContent":["/**\n * A `Magma` is a pair `(A, concat)` in which `A` is a non-empty set and `concat` is a binary operation on `A`\n *\n * See [Semigroup](https://gcanti.github.io/fp-ts/modules/Semigroup.ts.html) for some instances.\n *\n * @since 2.0.0\n */\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * The dual of a `Magma`, obtained by swapping the arguments of `concat`.\n *\n * @example\n * import { reverse, concatAll } from 'fp-ts/Magma'\n * import * as N from 'fp-ts/number'\n *\n * const subAll = concatAll(reverse(N.MagmaSub))(0)\n *\n * assert.deepStrictEqual(subAll([1, 2, 3]), 2)\n *\n * @since 2.11.0\n */\nexport var reverse = function (M) { return ({\n concat: function (first, second) { return M.concat(second, first); }\n}); };\n/**\n * @since 2.11.0\n */\nexport var filterFirst = function (predicate) {\n return function (M) { return ({\n concat: function (first, second) { return (predicate(first) ? M.concat(first, second) : second); }\n }); };\n};\n/**\n * @since 2.11.0\n */\nexport var filterSecond = function (predicate) {\n return function (M) { return ({\n concat: function (first, second) { return (predicate(second) ? M.concat(first, second) : first); }\n }); };\n};\n/**\n * @since 2.11.0\n */\nexport var endo = function (f) {\n return function (M) { return ({\n concat: function (first, second) { return M.concat(f(first), f(second)); }\n }); };\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * Given a sequence of `as`, concat them and return the total.\n *\n * If `as` is empty, return the provided `startWith` value.\n *\n * @example\n * import { concatAll } from 'fp-ts/Magma'\n * import * as N from 'fp-ts/number'\n *\n * const subAll = concatAll(N.MagmaSub)(0)\n *\n * assert.deepStrictEqual(subAll([1, 2, 3]), -6)\n *\n * @since 2.11.0\n */\nexport var concatAll = function (M) {\n return function (startWith) {\n return function (as) {\n return as.reduce(function (a, acc) { return M.concat(a, acc); }, startWith);\n };\n };\n};\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_ } from './Apply';\nimport { bind as bind_, chainFirst as chainFirst_ } from './Chain';\nimport { dual, identity, pipe } from './function';\nimport { bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { getMonoid } from './Ord';\nimport * as RNEA from './ReadonlyNonEmptyArray';\n// -------------------------------------------------------------------------------------\n// internal\n// -------------------------------------------------------------------------------------\n/**\n * @internal\n */\nexport var isNonEmpty = function (as) { return as.length > 0; };\n/**\n * @internal\n */\nexport var isOutOfBound = function (i, as) { return i < 0 || i >= as.length; };\n/**\n * @internal\n */\nexport var prependW = function (head) {\n return function (tail) {\n return __spreadArray([head], tail, true);\n };\n};\n/**\n * @internal\n */\nexport var prepend = prependW;\n/**\n * @internal\n */\nexport var appendW = function (end) {\n return function (init) {\n return __spreadArray(__spreadArray([], init, true), [end], false);\n };\n};\n/**\n * @internal\n */\nexport var append = appendW;\n/**\n * @internal\n */\nexport var unsafeInsertAt = function (i, a, as) {\n if (isNonEmpty(as)) {\n var xs = fromReadonlyNonEmptyArray(as);\n xs.splice(i, 0, a);\n return xs;\n }\n return [a];\n};\n/**\n * @internal\n */\nexport var unsafeUpdateAt = function (i, a, as) {\n var xs = fromReadonlyNonEmptyArray(as);\n xs[i] = a;\n return xs;\n};\n/**\n * Remove duplicates from a `NonEmptyArray`, keeping the first occurrence of an element.\n *\n * @example\n * import { uniq } from 'fp-ts/NonEmptyArray'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])\n *\n * @since 2.11.0\n */\nexport var uniq = function (E) {\n return function (as) {\n if (as.length === 1) {\n return copy(as);\n }\n var out = [head(as)];\n var rest = tail(as);\n var _loop_1 = function (a) {\n if (out.every(function (o) { return !E.equals(o, a); })) {\n out.push(a);\n }\n };\n for (var _i = 0, rest_1 = rest; _i < rest_1.length; _i++) {\n var a = rest_1[_i];\n _loop_1(a);\n }\n return out;\n };\n};\n/**\n * Sort the elements of a `NonEmptyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,\n * etc...\n *\n * @example\n * import * as NEA from 'fp-ts/NonEmptyArray'\n * import { contramap } from 'fp-ts/Ord'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Person {\n * name: string\n * age: number\n * }\n *\n * const byName = pipe(S.Ord, contramap((p: Person) => p.name))\n *\n * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))\n *\n * const sortByNameByAge = NEA.sortBy([byName, byAge])\n *\n * const persons: NEA.NonEmptyArray = [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 },\n * { name: 'b', age: 2 }\n * ]\n *\n * assert.deepStrictEqual(sortByNameByAge(persons), [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 2 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 }\n * ])\n *\n * @since 2.11.0\n */\nexport var sortBy = function (ords) {\n if (isNonEmpty(ords)) {\n var M = getMonoid();\n return sort(ords.reduce(M.concat, M.empty));\n }\n return copy;\n};\n/**\n * @since 2.11.0\n */\nexport var union = function (E) {\n var uniqE = uniq(E);\n return function (second) { return function (first) { return uniqE(pipe(first, concat(second))); }; };\n};\n/**\n * Rotate a `NonEmptyArray` by `n` steps.\n *\n * @example\n * import { rotate } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])\n * assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])\n *\n * @since 2.11.0\n */\nexport var rotate = function (n) {\n return function (as) {\n var len = as.length;\n var m = Math.round(n) % len;\n if (isOutOfBound(Math.abs(m), as) || m === 0) {\n return copy(as);\n }\n if (m < 0) {\n var _a = splitAt(-m)(as), f = _a[0], s = _a[1];\n return pipe(s, concat(f));\n }\n else {\n return rotate(m - len)(as);\n }\n };\n};\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * @category conversions\n * @since 2.10.0\n */\nexport var fromReadonlyNonEmptyArray = _.fromReadonlyNonEmptyArray;\n/**\n * Builds a `NonEmptyArray` from an `Array` returning `none` if `as` is an empty array\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromArray = function (as) { return (isNonEmpty(as) ? _.some(as) : _.none); };\n/**\n * Return a `NonEmptyArray` of length `n` with element `i` initialized with `f(i)`.\n *\n * **Note**. `n` is normalized to a natural number.\n *\n * @example\n * import { makeBy } from 'fp-ts/NonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const double = (n: number): number => n * 2\n * assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var makeBy = function (f) {\n return function (n) {\n var j = Math.max(0, Math.floor(n));\n var out = [f(0)];\n for (var i = 1; i < j; i++) {\n out.push(f(i));\n }\n return out;\n };\n};\n/**\n * Create a `NonEmptyArray` containing a value repeated the specified number of times.\n *\n * **Note**. `n` is normalized to a natural number.\n *\n * @example\n * import { replicate } from 'fp-ts/NonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var replicate = function (a) { return makeBy(function () { return a; }); };\n/**\n * Create a `NonEmptyArray` containing a range of integers, including both endpoints.\n *\n * @example\n * import { range } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var range = function (start, end) {\n return start <= end ? makeBy(function (i) { return start + i; })(end - start + 1) : [start];\n};\n/**\n * Return the tuple of the `head` and the `tail`.\n *\n * @example\n * import { unprepend } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(unprepend([1, 2, 3]), [1, [2, 3]])\n *\n * @since 2.9.0\n */\nexport var unprepend = function (as) { return [head(as), tail(as)]; };\n/**\n * Return the tuple of the `init` and the `last`.\n *\n * @example\n * import { unappend } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(unappend([1, 2, 3, 4]), [[1, 2, 3], 4])\n *\n * @since 2.9.0\n */\nexport var unappend = function (as) { return [init(as), last(as)]; };\nexport function concatW(second) {\n return function (first) { return first.concat(second); };\n}\nexport function concat(x, y) {\n return y ? x.concat(y) : function (y) { return y.concat(x); };\n}\n/**\n * @since 2.0.0\n */\nexport var reverse = function (as) { return __spreadArray([last(as)], as.slice(0, -1).reverse(), true); };\nexport function group(E) {\n return function (as) {\n var len = as.length;\n if (len === 0) {\n return [];\n }\n var out = [];\n var head = as[0];\n var nea = [head];\n for (var i = 1; i < len; i++) {\n var a = as[i];\n if (E.equals(a, head)) {\n nea.push(a);\n }\n else {\n out.push(nea);\n head = a;\n nea = [head];\n }\n }\n out.push(nea);\n return out;\n };\n}\n/**\n * Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning\n * function on each element, and grouping the results according to values returned\n *\n * @example\n * import { groupBy } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(groupBy((s: string) => String(s.length))(['a', 'b', 'ab']), {\n * '1': ['a', 'b'],\n * '2': ['ab']\n * })\n *\n * @since 2.0.0\n */\nexport var groupBy = function (f) {\n return function (as) {\n var out = {};\n for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {\n var a = as_1[_i];\n var k = f(a);\n if (_.has.call(out, k)) {\n out[k].push(a);\n }\n else {\n out[k] = [a];\n }\n }\n return out;\n };\n};\n/**\n * @since 2.0.0\n */\nexport var sort = function (O) {\n return function (as) {\n return as.slice().sort(O.compare);\n };\n};\n/**\n * @since 2.0.0\n */\nexport var insertAt = function (i, a) {\n return function (as) {\n return i < 0 || i > as.length ? _.none : _.some(unsafeInsertAt(i, a, as));\n };\n};\n/**\n * @since 2.0.0\n */\nexport var updateAt = function (i, a) {\n return modifyAt(i, function () { return a; });\n};\n/**\n * @since 2.0.0\n */\nexport var modifyAt = function (i, f) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeUpdateAt(i, f(as[i]), as));\n };\n};\n/**\n * @since 2.0.0\n */\nexport var copy = fromReadonlyNonEmptyArray;\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var of = function (a) { return [a]; };\n/**\n * @since 2.5.1\n */\nexport var zipWith = function (as, bs, f) {\n var cs = [f(as[0], bs[0])];\n var len = Math.min(as.length, bs.length);\n for (var i = 1; i < len; i++) {\n cs[i] = f(as[i], bs[i]);\n }\n return cs;\n};\nexport function zip(as, bs) {\n if (bs === undefined) {\n return function (bs) { return zip(bs, as); };\n }\n return zipWith(as, bs, function (a, b) { return [a, b]; });\n}\n/**\n * @since 2.5.1\n */\nexport var unzip = function (abs) {\n var fa = [abs[0][0]];\n var fb = [abs[0][1]];\n for (var i = 1; i < abs.length; i++) {\n fa[i] = abs[i][0];\n fb[i] = abs[i][1];\n }\n return [fa, fb];\n};\n/**\n * Prepend an element to every member of an array\n *\n * @example\n * import { prependAll } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.10.0\n */\nexport var prependAll = function (middle) {\n return function (as) {\n var out = [middle, as[0]];\n for (var i = 1; i < as.length; i++) {\n out.push(middle, as[i]);\n }\n return out;\n };\n};\n/**\n * Places an element in between members of an array\n *\n * @example\n * import { intersperse } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.9.0\n */\nexport var intersperse = function (middle) {\n return function (as) {\n var rest = tail(as);\n return isNonEmpty(rest) ? pipe(rest, prependAll(middle), prepend(head(as))) : copy(as);\n };\n};\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var foldMapWithIndex = RNEA.foldMapWithIndex;\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = RNEA.foldMap;\n/**\n * @category sequencing\n * @since 2.10.0\n */\nexport var chainWithIndex = function (f) {\n return function (as) {\n var out = fromReadonlyNonEmptyArray(f(0, head(as)));\n for (var i = 1; i < as.length; i++) {\n out.push.apply(out, f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * @since 2.10.0\n */\nexport var chop = function (f) {\n return function (as) {\n var _a = f(as), b = _a[0], rest = _a[1];\n var out = [b];\n var next = rest;\n while (isNonEmpty(next)) {\n var _b = f(next), b_1 = _b[0], rest_2 = _b[1];\n out.push(b_1);\n next = rest_2;\n }\n return out;\n };\n};\n/**\n * Splits a `NonEmptyArray` into two pieces, the first piece has max `n` elements.\n *\n * @since 2.10.0\n */\nexport var splitAt = function (n) {\n return function (as) {\n var m = Math.max(1, n);\n return m >= as.length ? [copy(as), []] : [pipe(as.slice(1, m), prepend(head(as))), as.slice(m)];\n };\n};\n/**\n * @since 2.10.0\n */\nexport var chunksOf = function (n) { return chop(splitAt(n)); };\n/* istanbul ignore next */\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\n/* istanbul ignore next */\nvar _mapWithIndex = function (fa, f) { return pipe(fa, mapWithIndex(f)); };\n/* istanbul ignore next */\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\n/* istanbul ignore next */\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\n/* istanbul ignore next */\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\n/* istanbul ignore next */\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\n/* istanbul ignore next */\nvar _reduceWithIndex = function (fa, b, f) {\n return pipe(fa, reduceWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _foldMapWithIndex = function (M) {\n var foldMapWithIndexM = foldMapWithIndex(M);\n return function (fa, f) { return pipe(fa, foldMapWithIndexM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRightWithIndex = function (fa, b, f) {\n return pipe(fa, reduceRightWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _traverseWithIndex = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (ta, f) { return pipe(ta, traverseWithIndexF(f)); };\n};\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @example\n * import * as NEA from 'fp-ts/NonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3] as NEA.NonEmptyArray,\n * NEA.altW(() => ['a', 'b'])\n * ),\n * [1, 2, 3, 'a', 'b']\n * )\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) {\n return function (as) {\n return pipe(as, concatW(that()));\n };\n};\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `NonEmptyArray` concatenates the inputs into a single array.\n *\n * @example\n * import * as NEA from 'fp-ts/NonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * NEA.alt(() => [4, 5])\n * ),\n * [1, 2, 3, 4, 5]\n * )\n *\n * @category error handling\n * @since 2.6.2\n */\nexport var alt = altW;\n/**\n * Apply a function to an argument under a type constructor.\n *\n * @since 2.0.0\n */\nexport var ap = function (as) {\n return flatMap(function (f) { return pipe(as, map(f)); });\n};\n/**\n * @example\n * import * as NEA from 'fp-ts/NonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * NEA.flatMap((n) => [`a${n}`, `b${n}`])\n * ),\n * ['a1', 'b1', 'a2', 'b2', 'a3', 'b3']\n * )\n *\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) {\n return pipe(ma, chainWithIndex(function (i, a) { return f(a, i); }));\n});\n/**\n * @since 2.0.0\n */\nexport var extend = function (f) {\n return function (as) {\n var next = tail(as);\n var out = [f(as)];\n while (isNonEmpty(next)) {\n out.push(f(next));\n next = tail(next);\n }\n return out;\n };\n};\n/**\n * @since 2.5.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * @category sequencing\n * @since 2.5.0\n */\nexport var flatten = /*#__PURE__*/ flatMap(identity);\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types\n * use the type constructor `F` to represent some computational context.\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return mapWithIndex(function (_, a) { return f(a); }); };\n/**\n * @category mapping\n * @since 2.0.0\n */\nexport var mapWithIndex = function (f) {\n return function (as) {\n var out = [f(0, head(as))];\n for (var i = 1; i < as.length; i++) {\n out.push(f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = RNEA.reduce;\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduceWithIndex = RNEA.reduceWithIndex;\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = RNEA.reduceRight;\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRightWithIndex = RNEA.reduceRightWithIndex;\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) { return traverseWithIndex(F)(function (_, a) { return a; }); };\n/**\n * @category sequencing\n * @since 2.6.3\n */\nexport var traverseWithIndex = function (F) {\n return function (f) {\n return function (as) {\n var out = F.map(f(0, head(as)), of);\n for (var i = 1; i < as.length; i++) {\n out = F.ap(F.map(out, function (bs) { return function (b) { return pipe(bs, append(b)); }; }), f(i, as[i]));\n }\n return out;\n };\n };\n};\n/**\n * @since 2.7.0\n */\nexport var extract = RNEA.head;\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'NonEmptyArray';\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = RNEA.getShow;\n/**\n * Builds a `Semigroup` instance for `NonEmptyArray`\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getSemigroup = function () { return ({\n concat: concat\n}); };\n/**\n * @example\n * import { getEq } from 'fp-ts/NonEmptyArray'\n * import * as N from 'fp-ts/number'\n *\n * const E = getEq(N.Eq)\n * assert.strictEqual(E.equals([1, 2], [1, 2]), true)\n * assert.strictEqual(E.equals([1, 2], [1, 3]), false)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = RNEA.getEq;\n/**\n * @since 2.11.0\n */\nexport var getUnionSemigroup = function (E) {\n var unionE = union(E);\n return {\n concat: function (first, second) { return unionE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FunctorWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.5.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.5.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category sequencing\n * @since 2.5.0\n */\nexport var chainFirst = \n/*#__PURE__*/ chainFirst_(Chain);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FoldableWithIndex = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var TraversableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Comonad = {\n URI: URI,\n map: _map,\n extend: _extend,\n extract: extract\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ bind_(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.0.0\n */\nexport var head = RNEA.head;\n/**\n * @since 2.0.0\n */\nexport var tail = function (as) { return as.slice(1); };\n/**\n * @since 2.0.0\n */\nexport var last = RNEA.last;\n/**\n * Get all but the last element of a non empty array, creating a new array.\n *\n * @example\n * import { init } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(init([1, 2, 3]), [1, 2])\n * assert.deepStrictEqual(init([1]), [])\n *\n * @since 2.2.0\n */\nexport var init = function (as) { return as.slice(0, -1); };\n/**\n * @since 2.0.0\n */\nexport var min = RNEA.min;\n/**\n * @since 2.0.0\n */\nexport var max = RNEA.max;\n/**\n * @since 2.10.0\n */\nexport var concatAll = function (S) {\n return function (as) {\n return as.reduce(S.concat);\n };\n};\n/**\n * Break an `Array` into its first element and remaining elements.\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchLeft = function (f) {\n return function (as) {\n return f(head(as), tail(as));\n };\n};\n/**\n * Break an `Array` into its initial elements and the last element.\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchRight = function (f) {\n return function (as) {\n return f(init(as), last(as));\n };\n};\n/**\n * Apply a function to the head, creating a new `NonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var modifyHead = function (f) {\n return function (as) {\n return __spreadArray([f(head(as))], tail(as), true);\n };\n};\n/**\n * Change the head, creating a new `NonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var updateHead = function (a) { return modifyHead(function () { return a; }); };\n/**\n * Apply a function to the last element, creating a new `NonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var modifyLast = function (f) {\n return function (as) {\n return pipe(init(as), append(f(last(as))));\n };\n};\n/**\n * Change the last element, creating a new `NonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var updateLast = function (a) { return modifyLast(function () { return a; }); };\n/**\n * Places an element in between members of a `NonEmptyArray`, then folds the results using the provided `Semigroup`.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { intercalate } from 'fp-ts/NonEmptyArray'\n *\n * assert.deepStrictEqual(intercalate(S.Semigroup)('-')(['a', 'b', 'c']), 'a-b-c')\n *\n * @since 2.12.0\n */\nexport var intercalate = RNEA.intercalate;\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\nexport function groupSort(O) {\n var sortO = sort(O);\n var groupO = group(O);\n return function (as) { return (isNonEmpty(as) ? groupO(sortO(as)) : []); };\n}\nexport function filter(predicate) {\n return filterWithIndex(function (_, a) { return predicate(a); });\n}\n/**\n * Use [`filterWithIndex`](./Array.ts.html#filterwithindex) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var filterWithIndex = function (predicate) {\n return function (as) {\n return fromArray(as.filter(function (a, i) { return predicate(i, a); }));\n };\n};\n/**\n * Use [`unprepend`](#unprepend) instead.\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var uncons = unprepend;\n/**\n * Use [`unappend`](#unappend) instead.\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var unsnoc = unappend;\nexport function cons(head, tail) {\n return tail === undefined ? prepend(head) : pipe(tail, prepend(head));\n}\n/**\n * Use [`append`](./Array.ts.html#append) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var snoc = function (init, end) { return pipe(init, append(end)); };\n/**\n * Use [`prependAll`](#prependall) instead.\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var prependToAll = prependAll;\n/**\n * Use [`concatAll`](#concatall) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var fold = RNEA.concatAll;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `NEA.Functor` instead of `NEA.nonEmptyArray`\n * (where `NEA` is from `import NEA from 'fp-ts/NonEmptyArray'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var nonEmptyArray = {\n URI: URI,\n of: of,\n map: _map,\n mapWithIndex: _mapWithIndex,\n ap: _ap,\n chain: flatMap,\n extend: _extend,\n extract: extract,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex,\n alt: _alt\n};\n","import { getApplicativeMonoid } from './Applicative';\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { chainEitherK as chainEitherK_, fromEitherK as fromEitherK_, tapEither as tapEither_ } from './FromEither';\nimport { constNull, constUndefined, dual, flow, identity, pipe } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { not } from './Predicate';\nimport { first, last } from './Semigroup';\nimport { separated } from './Separated';\nimport { wiltDefault, witherDefault } from './Witherable';\nimport { guard as guard_ } from './Zero';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var none = _.none;\n/**\n * Constructs a `Some`. Represents an optional value that exists.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var some = _.some;\nexport function fromPredicate(predicate) {\n return function (a) { return (predicate(a) ? some(a) : none); };\n}\n/**\n * Returns the `Left` value of an `Either` if possible.\n *\n * @example\n * import { getLeft, none, some } from 'fp-ts/Option'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(getLeft(right(1)), none)\n * assert.deepStrictEqual(getLeft(left('a')), some('a'))\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var getLeft = function (ma) { return (ma._tag === 'Right' ? none : some(ma.left)); };\n/**\n * Returns the `Right` value of an `Either` if possible.\n *\n * @example\n * import { getRight, none, some } from 'fp-ts/Option'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(getRight(right(1)), some(1))\n * assert.deepStrictEqual(getRight(left('a')), none)\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var getRight = function (ma) { return (ma._tag === 'Left' ? none : some(ma.right)); };\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\nvar _filter = function (fa, predicate) { return pipe(fa, filter(predicate)); };\n/* istanbul ignore next */\nvar _filterMap = function (fa, f) { return pipe(fa, filterMap(f)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\n/* istanbul ignore next */\nvar _partition = function (fa, predicate) {\n return pipe(fa, partition(predicate));\n};\n/* istanbul ignore next */\nvar _partitionMap = function (fa, f) { return pipe(fa, partitionMap(f)); };\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Option';\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = function (S) { return ({\n show: function (ma) { return (isNone(ma) ? 'none' : \"some(\".concat(S.show(ma.value), \")\")); }\n}); };\n/**\n * @example\n * import { none, some, getEq } from 'fp-ts/Option'\n * import * as N from 'fp-ts/number'\n *\n * const E = getEq(N.Eq)\n * assert.strictEqual(E.equals(none, none), true)\n * assert.strictEqual(E.equals(none, some(1)), false)\n * assert.strictEqual(E.equals(some(1), none), false)\n * assert.strictEqual(E.equals(some(1), some(2)), false)\n * assert.strictEqual(E.equals(some(1), some(1)), true)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = function (E) { return ({\n equals: function (x, y) { return x === y || (isNone(x) ? isNone(y) : isNone(y) ? false : E.equals(x.value, y.value)); }\n}); };\n/**\n * The `Ord` instance allows `Option` values to be compared with\n * `compare`, whenever there is an `Ord` instance for\n * the type the `Option` contains.\n *\n * `None` is considered to be less than any `Some` value.\n *\n *\n * @example\n * import { none, some, getOrd } from 'fp-ts/Option'\n * import * as N from 'fp-ts/number'\n *\n * const O = getOrd(N.Ord)\n * assert.strictEqual(O.compare(none, none), 0)\n * assert.strictEqual(O.compare(none, some(1)), -1)\n * assert.strictEqual(O.compare(some(1), none), 1)\n * assert.strictEqual(O.compare(some(1), some(2)), -1)\n * assert.strictEqual(O.compare(some(1), some(1)), 0)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getOrd = function (O) { return ({\n equals: getEq(O).equals,\n compare: function (x, y) { return (x === y ? 0 : isSome(x) ? (isSome(y) ? O.compare(x.value, y.value) : 1) : -1); }\n}); };\n/**\n * Monoid returning the left-most non-`None` value. If both operands are `Some`s then the inner values are\n * concatenated using the provided `Semigroup`\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(concat(a, b)) |\n *\n * @example\n * import { getMonoid, some, none } from 'fp-ts/Option'\n * import { SemigroupSum } from 'fp-ts/number'\n *\n * const M = getMonoid(SemigroupSum)\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(1)), some(1))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(3))\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getMonoid = function (S) { return ({\n concat: function (x, y) { return (isNone(x) ? y : isNone(y) ? x : some(S.concat(x.value, y.value))); },\n empty: none\n}); };\n/**\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) {\n return isNone(fa) ? none : some(f(fa.value));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the `Some` value of this `Option` to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the `Some` value of this `Option` to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category constructors\n * @since 2.7.0\n */\nexport var of = some;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @since 2.0.0\n */\nexport var ap = function (fa) { return function (fab) {\n return isNone(fab) ? none : isNone(fa) ? none : some(fab.value(fa.value));\n}; };\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) { return (isNone(ma) ? none : f(ma.value)); });\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = function (b, f) { return function (fa) {\n return isNone(fa) ? b : f(b, fa.value);\n}; };\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = function (M) { return function (f) { return function (fa) {\n return isNone(fa) ? M.empty : f(fa.value);\n}; }; };\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = function (b, f) { return function (fa) {\n return isNone(fa) ? b : f(fa.value, b);\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.\n *\n * @param self - The first `Option` to be checked.\n * @param that - The `Option` to return if `self` is `None`.\n *\n * @example\n * import * as O from \"fp-ts/Option\"\n *\n * assert.deepStrictEqual(O.orElse(O.none, () => O.none), O.none)\n * assert.deepStrictEqual(O.orElse(O.some(1), () => O.none), O.some(1))\n * assert.deepStrictEqual(O.orElse(O.none, () => O.some('b')), O.some('b'))\n * assert.deepStrictEqual(O.orElse(O.some(1), () => O.some('b')), O.some(1))\n *\n * @category error handling\n * @since 2.16.0\n */\nexport var orElse = dual(2, function (self, that) { return (isNone(self) ? that() : self); });\n/**\n * Alias of `orElse`.\n *\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var altW = orElse;\n/**\n * Alias of `orElse`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var alt = orElse;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @since 2.7.0\n */\nexport var zero = function () { return none; };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var Zero = {\n URI: URI,\n zero: zero\n};\n/**\n * @category do notation\n * @since 2.11.0\n */\nexport var guard = /*#__PURE__*/ guard_(Zero, Pointed);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alternative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n alt: _alt,\n zero: zero\n};\n/**\n * @since 2.0.0\n */\nexport var extend = function (f) { return function (wa) {\n return isNone(wa) ? none : some(f(wa));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var compact = /*#__PURE__*/ flatMap(identity);\nvar defaultSeparated = /*#__PURE__*/ separated(none, none);\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var separate = function (ma) {\n return isNone(ma) ? defaultSeparated : separated(getLeft(ma.value), getRight(ma.value));\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Compactable = {\n URI: URI,\n compact: compact,\n separate: separate\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var filter = function (predicate) {\n return function (fa) {\n return isNone(fa) ? none : predicate(fa.value) ? fa : none;\n };\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var filterMap = function (f) { return function (fa) {\n return isNone(fa) ? none : f(fa.value);\n}; };\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var partition = function (predicate) {\n return function (fa) {\n return separated(_filter(fa, not(predicate)), _filter(fa, predicate));\n };\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var partitionMap = function (f) { return flow(map(f), separate); };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Filterable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n return function (f) {\n return function (ta) {\n return isNone(ta) ? F.of(none) : F.map(f(ta.value), some);\n };\n };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ta) {\n return isNone(ta) ? F.of(none) : F.map(ta.value, some);\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\nvar _wither = /*#__PURE__*/ witherDefault(Traversable, Compactable);\nvar _wilt = /*#__PURE__*/ wiltDefault(Traversable, Compactable);\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wither = function (F) {\n var _witherF = _wither(F);\n return function (f) { return function (fa) { return _witherF(fa, f); }; };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wilt = function (F) {\n var _wiltF = _wilt(F);\n return function (f) { return function (fa) { return _wiltF(fa, f); }; };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Witherable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n wither: _wither,\n wilt: _wilt\n};\n/**\n * @since 2.7.0\n */\nexport var throwError = function () { return none; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var MonadThrow = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n throwError: throwError\n};\n/**\n * Transforms an `Either` to an `Option` discarding the error.\n *\n * Alias of [getRight](#getright)\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromEither = getRight;\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: fromEither\n};\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Returns `true` if the option is an instance of `Some`, `false` otherwise.\n *\n * @example\n * import { some, none, isSome } from 'fp-ts/Option'\n *\n * assert.strictEqual(isSome(some(1)), true)\n * assert.strictEqual(isSome(none), false)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isSome = _.isSome;\n/**\n * Returns `true` if the option is `None`, `false` otherwise.\n *\n * @example\n * import { some, none, isNone } from 'fp-ts/Option'\n *\n * assert.strictEqual(isNone(some(1)), false)\n * assert.strictEqual(isNone(none), true)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isNone = function (fa) { return fa._tag === 'None'; };\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchW = function (onNone, onSome) {\n return function (ma) {\n return isNone(ma) ? onNone() : onSome(ma.value);\n };\n};\n/**\n * Alias of [`matchW`](#matchw).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var foldW = matchW;\n/**\n * Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is\n * returned, otherwise the function is applied to the value inside the `Some` and the result is returned.\n *\n * @example\n * import { some, none, match } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * match(() => 'a none', a => `a some containing ${a}`)\n * ),\n * 'a some containing 1'\n * )\n *\n * assert.strictEqual(\n * pipe(\n * none,\n * match(() => 'a none', a => `a some containing ${a}`)\n * ),\n * 'a none'\n * )\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var match = matchW;\n/**\n * Alias of [`match`](#match).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var fold = match;\n/**\n * Less strict version of [`getOrElse`](#getorelse).\n *\n * The `W` suffix (short for **W**idening) means that the handler return type will be merged.\n *\n * @category error handling\n * @since 2.6.0\n */\nexport var getOrElseW = function (onNone) {\n return function (ma) {\n return isNone(ma) ? onNone() : ma.value;\n };\n};\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns the given default value\n *\n * @example\n * import { some, none, getOrElse } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * getOrElse(() => 0)\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * getOrElse(() => 0)\n * ),\n * 0\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var getOrElse = getOrElseW;\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = compact;\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as O from 'fp-ts/Option'\n * import * as E from 'fp-ts/Either'\n *\n * const compute = (value: number) => pipe(\n * O.of(value),\n * O.tapEither((value) => value > 0 ? E.right('ok') : E.left('error')),\n * )\n *\n * assert.deepStrictEqual(compute(1), O.of(1))\n * assert.deepStrictEqual(compute(-42), O.none)\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapEither = /*#__PURE__*/ dual(2, tapEither_(FromEither, Chain));\n/**\n * @since 2.0.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromEitherK = /*#__PURE__*/ fromEitherK_(FromEither);\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainEitherK = \n/*#__PURE__*/ chainEitherK_(FromEither, Chain);\n/**\n * Alias of `tapEither`.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var chainFirstEitherK = tapEither;\n/**\n * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise\n * returns the value wrapped in a `Some`.\n *\n * @example\n * import { none, some, fromNullable } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(fromNullable(undefined), none)\n * assert.deepStrictEqual(fromNullable(null), none)\n * assert.deepStrictEqual(fromNullable(1), some(1))\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromNullable = function (a) { return (a == null ? none : some(a)); };\n/**\n * Transforms an exception into an `Option`. If `f` throws, returns `None`, otherwise returns the output wrapped in a\n * `Some`.\n *\n * See also [`tryCatchK`](#trycatchk).\n *\n * @example\n * import { none, some, tryCatch } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * tryCatch(() => {\n * throw new Error()\n * }),\n * none\n * )\n * assert.deepStrictEqual(tryCatch(() => 1), some(1))\n *\n * @category interop\n * @since 2.0.0\n */\nexport var tryCatch = function (f) {\n try {\n return some(f());\n }\n catch (e) {\n return none;\n }\n};\n/**\n * Converts a function that may throw to one returning a `Option`.\n *\n * @category interop\n * @since 2.10.0\n */\nexport var tryCatchK = function (f) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return tryCatch(function () { return f.apply(void 0, a); });\n };\n};\n/**\n * Returns a *smart constructor* from a function that returns a nullable value.\n *\n * @example\n * import { fromNullableK, none, some } from 'fp-ts/Option'\n *\n * const f = (s: string): number | undefined => {\n * const n = parseFloat(s)\n * return isNaN(n) ? undefined : n\n * }\n *\n * const g = fromNullableK(f)\n *\n * assert.deepStrictEqual(g('1'), some(1))\n * assert.deepStrictEqual(g('a'), none)\n *\n * @category lifting\n * @since 2.9.0\n */\nexport var fromNullableK = function (f) { return flow(f, fromNullable); };\n/**\n * This is `chain` + `fromNullable`, useful when working with optional values.\n *\n * @example\n * import { some, none, fromNullable, chainNullableK } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Employee {\n * readonly company?: {\n * readonly address?: {\n * readonly street?: {\n * readonly name?: string\n * }\n * }\n * }\n * }\n *\n * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }\n *\n * assert.deepStrictEqual(\n * pipe(\n * fromNullable(employee1.company),\n * chainNullableK(company => company.address),\n * chainNullableK(address => address.street),\n * chainNullableK(street => street.name)\n * ),\n * some('high street')\n * )\n *\n * const employee2: Employee = { company: { address: { street: {} } } }\n *\n * assert.deepStrictEqual(\n * pipe(\n * fromNullable(employee2.company),\n * chainNullableK(company => company.address),\n * chainNullableK(address => address.street),\n * chainNullableK(street => street.name)\n * ),\n * none\n * )\n *\n * @category sequencing\n * @since 2.9.0\n */\nexport var chainNullableK = function (f) {\n return function (ma) {\n return isNone(ma) ? none : fromNullable(f(ma.value));\n };\n};\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns `null`.\n *\n * @example\n * import { some, none, toNullable } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * toNullable\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * toNullable\n * ),\n * null\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var toNullable = /*#__PURE__*/ match(constNull, identity);\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.\n *\n * @example\n * import { some, none, toUndefined } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * toUndefined\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * toUndefined\n * ),\n * undefined\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var toUndefined = /*#__PURE__*/ match(constUndefined, identity);\nexport function elem(E) {\n return function (a, ma) {\n if (ma === undefined) {\n var elemE_1 = elem(E);\n return function (ma) { return elemE_1(a, ma); };\n }\n return isNone(ma) ? false : E.equals(a, ma.value);\n };\n}\n/**\n * Returns `true` if the predicate is satisfied by the wrapped value\n *\n * @example\n * import { some, none, exists } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * exists(n => n > 0)\n * ),\n * true\n * )\n * assert.strictEqual(\n * pipe(\n * some(1),\n * exists(n => n > 1)\n * ),\n * false\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * exists(n => n > 0)\n * ),\n * false\n * )\n *\n * @since 2.0.0\n */\nexport var exists = function (predicate) {\n return function (ma) {\n return isNone(ma) ? false : predicate(ma.value);\n };\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return function (as) {\n var o = f(0, _.head(as));\n if (isNone(o)) {\n return none;\n }\n var out = [o.value];\n for (var i = 1; i < as.length; i++) {\n var o_1 = f(i, as[i]);\n if (isNone(o_1)) {\n return none;\n }\n out.push(o_1.value);\n }\n return some(out);\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) {\n return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); });\n};\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use `Refinement` module instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function getRefinement(getOption) {\n return function (a) { return isSome(getOption(a)); };\n}\n/**\n * Use [`chainNullableK`](#chainnullablek) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var mapNullable = chainNullableK;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `O.Functor` instead of `O.option`\n * (where `O` is from `import O from 'fp-ts/Option'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var option = {\n URI: URI,\n map: _map,\n of: of,\n ap: _ap,\n chain: flatMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n zero: zero,\n alt: _alt,\n extend: _extend,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n wither: _wither,\n wilt: _wilt,\n throwError: throwError\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplySemigroup = /*#__PURE__*/ getApplySemigroup_(Apply);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplyMonoid = /*#__PURE__*/ getApplicativeMonoid(Applicative);\n/**\n * Use\n *\n * ```ts\n * import { first } from 'fp-ts/Semigroup'\n * import { getMonoid } from 'fp-ts/Option'\n *\n * getMonoid(first())\n * ```\n *\n * instead.\n *\n * Monoid returning the left-most non-`None` value\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(a) |\n *\n * @example\n * import { getFirstMonoid, some, none } from 'fp-ts/Option'\n *\n * const M = getFirstMonoid()\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(2)), some(2))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(1))\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getFirstMonoid = function () { return getMonoid(first()); };\n/**\n * Use\n *\n * ```ts\n * import { last } from 'fp-ts/Semigroup'\n * import { getMonoid } from 'fp-ts/Option'\n *\n * getMonoid(last())\n * ```\n *\n * instead.\n *\n * Monoid returning the right-most non-`None` value\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(b) |\n *\n * @example\n * import { getLastMonoid, some, none } from 'fp-ts/Option'\n *\n * const M = getLastMonoid()\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(2)), some(2))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(2))\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getLastMonoid = function () { return getMonoid(last()); };\n","import { eqStrict } from './Eq';\nimport { constant, constTrue, pipe } from './function';\n// -------------------------------------------------------------------------------------\n// defaults\n// -------------------------------------------------------------------------------------\n/**\n * @category defaults\n * @since 2.10.0\n */\nexport var equalsDefault = function (compare) {\n return function (first, second) {\n return first === second || compare(first, second) === 0;\n };\n};\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var fromCompare = function (compare) { return ({\n equals: equalsDefault(compare),\n compare: function (first, second) { return (first === second ? 0 : compare(first, second)); }\n}); };\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Given a tuple of `Ord`s returns an `Ord` for the tuple.\n *\n * @example\n * import { tuple } from 'fp-ts/Ord'\n * import * as B from 'fp-ts/boolean'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n *\n * const O = tuple(S.Ord, N.Ord, B.Ord)\n * assert.strictEqual(O.compare(['a', 1, true], ['b', 2, true]), -1)\n * assert.strictEqual(O.compare(['a', 1, true], ['a', 2, true]), -1)\n * assert.strictEqual(O.compare(['a', 1, true], ['a', 1, false]), 1)\n *\n * @since 2.10.0\n */\nexport var tuple = function () {\n var ords = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n ords[_i] = arguments[_i];\n }\n return fromCompare(function (first, second) {\n var i = 0;\n for (; i < ords.length - 1; i++) {\n var r = ords[i].compare(first[i], second[i]);\n if (r !== 0) {\n return r;\n }\n }\n return ords[i].compare(first[i], second[i]);\n });\n};\n/**\n * @since 2.10.0\n */\nexport var reverse = function (O) { return fromCompare(function (first, second) { return O.compare(second, first); }); };\n/* istanbul ignore next */\nvar contramap_ = function (fa, f) { return pipe(fa, contramap(f)); };\n/**\n * A typical use case for `contramap` would be like, given some `User` type, to construct an `Ord`.\n *\n * We can do so with a function from `User -> X` where `X` is some value that we know how to compare\n * for ordering (meaning we have an `Ord`)\n *\n * For example, given the following `User` type, there are lots of possible choices for `X`,\n * but let's say we want to sort a list of users by `lastName`.\n *\n * If we have a way of comparing `lastName`s for ordering (`ordLastName: Ord`) and we know how to go from `User -> string`,\n * using `contramap` we can do this\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import { contramap, Ord } from 'fp-ts/Ord'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as S from 'fp-ts/string'\n *\n * interface User {\n * readonly firstName: string\n * readonly lastName: string\n * }\n *\n * const ordLastName: Ord = S.Ord\n *\n * const ordByLastName: Ord = pipe(\n * ordLastName,\n * contramap((user) => user.lastName)\n * )\n *\n * assert.deepStrictEqual(\n * RA.sort(ordByLastName)([\n * { firstName: 'a', lastName: 'd' },\n * { firstName: 'c', lastName: 'b' }\n * ]),\n * [\n * { firstName: 'c', lastName: 'b' },\n * { firstName: 'a', lastName: 'd' }\n * ]\n * )\n *\n * @since 2.0.0\n */\nexport var contramap = function (f) { return function (fa) {\n return fromCompare(function (first, second) { return fa.compare(f(first), f(second)); });\n}; };\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Ord';\n/**\n * A typical use case for the `Semigroup` instance of `Ord` is merging two or more orderings.\n *\n * For example the following snippet builds an `Ord` for a type `User` which\n * sorts by `created` date descending, and **then** `lastName`\n *\n * @example\n * import * as D from 'fp-ts/Date'\n * import { pipe } from 'fp-ts/function'\n * import { contramap, getSemigroup, Ord, reverse } from 'fp-ts/Ord'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as S from 'fp-ts/string'\n *\n * interface User {\n * readonly id: string\n * readonly lastName: string\n * readonly created: Date\n * }\n *\n * const ordByLastName: Ord = pipe(\n * S.Ord,\n * contramap((user) => user.lastName)\n * )\n *\n * const ordByCreated: Ord = pipe(\n * D.Ord,\n * contramap((user) => user.created)\n * )\n *\n * const ordUserByCreatedDescThenLastName = getSemigroup().concat(\n * reverse(ordByCreated),\n * ordByLastName\n * )\n *\n * assert.deepStrictEqual(\n * RA.sort(ordUserByCreatedDescThenLastName)([\n * { id: 'c', lastName: 'd', created: new Date(1973, 10, 30) },\n * { id: 'a', lastName: 'b', created: new Date(1973, 10, 30) },\n * { id: 'e', lastName: 'f', created: new Date(1980, 10, 30) }\n * ]),\n * [\n * { id: 'e', lastName: 'f', created: new Date(1980, 10, 30) },\n * { id: 'a', lastName: 'b', created: new Date(1973, 10, 30) },\n * { id: 'c', lastName: 'd', created: new Date(1973, 10, 30) }\n * ]\n * )\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getSemigroup = function () { return ({\n concat: function (first, second) {\n return fromCompare(function (a, b) {\n var ox = first.compare(a, b);\n return ox !== 0 ? ox : second.compare(a, b);\n });\n }\n}); };\n/**\n * Returns a `Monoid` such that:\n *\n * - its `concat(ord1, ord2)` operation will order first by `ord1`, and then by `ord2`\n * - its `empty` value is an `Ord` that always considers compared elements equal\n *\n * @example\n * import { sort } from 'fp-ts/Array'\n * import { contramap, reverse, getMonoid } from 'fp-ts/Ord'\n * import * as S from 'fp-ts/string'\n * import * as B from 'fp-ts/boolean'\n * import { pipe } from 'fp-ts/function'\n * import { concatAll } from 'fp-ts/Monoid'\n * import * as N from 'fp-ts/number'\n *\n * interface User {\n * readonly id: number\n * readonly name: string\n * readonly age: number\n * readonly rememberMe: boolean\n * }\n *\n * const byName = pipe(\n * S.Ord,\n * contramap((p: User) => p.name)\n * )\n *\n * const byAge = pipe(\n * N.Ord,\n * contramap((p: User) => p.age)\n * )\n *\n * const byRememberMe = pipe(\n * B.Ord,\n * contramap((p: User) => p.rememberMe)\n * )\n *\n * const M = getMonoid()\n *\n * const users: Array = [\n * { id: 1, name: 'Guido', age: 47, rememberMe: false },\n * { id: 2, name: 'Guido', age: 46, rememberMe: true },\n * { id: 3, name: 'Giulio', age: 44, rememberMe: false },\n * { id: 4, name: 'Giulio', age: 44, rememberMe: true }\n * ]\n *\n * // sort by name, then by age, then by `rememberMe`\n * const O1 = concatAll(M)([byName, byAge, byRememberMe])\n * assert.deepStrictEqual(sort(O1)(users), [\n * { id: 3, name: 'Giulio', age: 44, rememberMe: false },\n * { id: 4, name: 'Giulio', age: 44, rememberMe: true },\n * { id: 2, name: 'Guido', age: 46, rememberMe: true },\n * { id: 1, name: 'Guido', age: 47, rememberMe: false }\n * ])\n *\n * // now `rememberMe = true` first, then by name, then by age\n * const O2 = concatAll(M)([reverse(byRememberMe), byName, byAge])\n * assert.deepStrictEqual(sort(O2)(users), [\n * { id: 4, name: 'Giulio', age: 44, rememberMe: true },\n * { id: 2, name: 'Guido', age: 46, rememberMe: true },\n * { id: 3, name: 'Giulio', age: 44, rememberMe: false },\n * { id: 1, name: 'Guido', age: 47, rememberMe: false }\n * ])\n *\n * @category instances\n * @since 2.4.0\n */\nexport var getMonoid = function () { return ({\n concat: getSemigroup().concat,\n empty: fromCompare(function () { return 0; })\n}); };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Contravariant = {\n URI: URI,\n contramap: contramap_\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.11.0\n */\nexport var trivial = {\n equals: constTrue,\n compare: /*#__PURE__*/ constant(0)\n};\n/**\n * @since 2.11.0\n */\nexport var equals = function (O) {\n return function (second) {\n return function (first) {\n return first === second || O.compare(first, second) === 0;\n };\n };\n};\n// TODO: curry in v3\n/**\n * Test whether one value is _strictly less than_ another\n *\n * @since 2.0.0\n */\nexport var lt = function (O) {\n return function (first, second) {\n return O.compare(first, second) === -1;\n };\n};\n// TODO: curry in v3\n/**\n * Test whether one value is _strictly greater than_ another\n *\n * @since 2.0.0\n */\nexport var gt = function (O) {\n return function (first, second) {\n return O.compare(first, second) === 1;\n };\n};\n// TODO: curry in v3\n/**\n * Test whether one value is _non-strictly less than_ another\n *\n * @since 2.0.0\n */\nexport var leq = function (O) {\n return function (first, second) {\n return O.compare(first, second) !== 1;\n };\n};\n// TODO: curry in v3\n/**\n * Test whether one value is _non-strictly greater than_ another\n *\n * @since 2.0.0\n */\nexport var geq = function (O) {\n return function (first, second) {\n return O.compare(first, second) !== -1;\n };\n};\n// TODO: curry in v3\n/**\n * Take the minimum of two values. If they are considered equal, the first argument is chosen\n *\n * @since 2.0.0\n */\nexport var min = function (O) {\n return function (first, second) {\n return first === second || O.compare(first, second) < 1 ? first : second;\n };\n};\n// TODO: curry in v3\n/**\n * Take the maximum of two values. If they are considered equal, the first argument is chosen\n *\n * @since 2.0.0\n */\nexport var max = function (O) {\n return function (first, second) {\n return first === second || O.compare(first, second) > -1 ? first : second;\n };\n};\n/**\n * Clamp a value between a minimum and a maximum\n *\n * @since 2.0.0\n */\nexport var clamp = function (O) {\n var minO = min(O);\n var maxO = max(O);\n return function (low, hi) { return function (a) { return maxO(minO(a, hi), low); }; };\n};\n/**\n * Test whether a value is between a minimum and a maximum (inclusive)\n *\n * @since 2.0.0\n */\nexport var between = function (O) {\n var ltO = lt(O);\n var gtO = gt(O);\n return function (low, hi) { return function (a) { return ltO(a, low) || gtO(a, hi) ? false : true; }; };\n};\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use [`tuple`](#tuple) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getTupleOrd = tuple;\n/**\n * Use [`reverse`](#reverse) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getDualOrd = reverse;\n/**\n * Use [`Contravariant`](#contravariant) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var ord = Contravariant;\n// default compare for primitive types\nfunction compare(first, second) {\n return first < second ? -1 : first > second ? 1 : 0;\n}\nvar strictOrd = {\n equals: eqStrict.equals,\n compare: compare\n};\n/**\n * Use [`Ord`](./boolean.ts.html#ord) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var ordBoolean = strictOrd;\n/**\n * Use [`Ord`](./string.ts.html#ord) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var ordString = strictOrd;\n/**\n * Use [`Ord`](./number.ts.html#ord) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var ordNumber = strictOrd;\n/**\n * Use [`Ord`](./Date.ts.html#ord) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var ordDate = /*#__PURE__*/ pipe(ordNumber, \n/*#__PURE__*/\ncontramap(function (date) { return date.valueOf(); }));\n","import { constFalse, constTrue, flow, pipe } from './function';\nvar contramap_ = function (predicate, f) { return pipe(predicate, contramap(f)); };\n/**\n * @since 2.11.0\n */\nexport var contramap = function (f) {\n return function (predicate) {\n return flow(f, predicate);\n };\n};\n/**\n * @category type lambdas\n * @since 2.11.0\n */\nexport var URI = 'Predicate';\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getSemigroupAny = function () { return ({\n concat: function (first, second) { return pipe(first, or(second)); }\n}); };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getMonoidAny = function () { return ({\n concat: getSemigroupAny().concat,\n empty: constFalse\n}); };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getSemigroupAll = function () { return ({\n concat: function (first, second) { return pipe(first, and(second)); }\n}); };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getMonoidAll = function () { return ({\n concat: getSemigroupAll().concat,\n empty: constTrue\n}); };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var Contravariant = {\n URI: URI,\n contramap: contramap_\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.11.0\n */\nexport var not = function (predicate) {\n return function (a) {\n return !predicate(a);\n };\n};\n/**\n * @since 2.11.0\n */\nexport var or = function (second) {\n return function (first) {\n return function (a) {\n return first(a) || second(a);\n };\n };\n};\n/**\n * @since 2.11.0\n */\nexport var and = function (second) {\n return function (first) {\n return function (a) {\n return first(a) && second(a);\n };\n };\n};\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_ } from './Apply';\nimport { bind as bind_, chainFirst as chainFirst_ } from './Chain';\nimport { fromEquals } from './Eq';\nimport { fromEitherK as fromEitherK_ } from './FromEither';\nimport { dual, identity, pipe } from './function';\nimport { bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport * as N from './number';\nimport { fromCompare } from './Ord';\nimport * as RNEA from './ReadonlyNonEmptyArray';\nimport { separated } from './Separated';\nimport { filterE as filterE_, wiltDefault, witherDefault } from './Witherable';\nimport { guard as guard_ } from './Zero';\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Test whether a `ReadonlyArray` is empty.\n *\n * @example\n * import { isEmpty } from 'fp-ts/ReadonlyArray'\n *\n * assert.strictEqual(isEmpty([]), true)\n *\n * @category refinements\n * @since 2.5.0\n */\nexport var isEmpty = function (as) { return as.length === 0; };\n/**\n * Test whether a `ReadonlyArray` is non empty.\n *\n * @category refinements\n * @since 2.5.0\n */\nexport var isNonEmpty = RNEA.isNonEmpty;\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Prepend an element to the front of a `ReadonlyArray`, creating a new `ReadonlyNonEmptyArray`.\n *\n * @example\n * import { prepend } from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([2, 3, 4], prepend(1)), [1, 2, 3, 4])\n *\n * @since 2.10.0\n */\nexport var prepend = RNEA.prepend;\n/**\n * Less strict version of [`prepend`](#prepend).\n *\n * @since 2.11.0\n */\nexport var prependW = RNEA.prependW;\n/**\n * Append an element to the end of a `ReadonlyArray`, creating a new `ReadonlyNonEmptyArray`.\n *\n * @example\n * import { append } from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe([1, 2, 3], append(4)), [1, 2, 3, 4])\n *\n * @since 2.10.0\n */\nexport var append = RNEA.append;\n/**\n * Less strict version of [`append`](#append).\n *\n * @since 2.11.0\n */\nexport var appendW = RNEA.appendW;\n/**\n * Return a `ReadonlyArray` of length `n` with element `i` initialized with `f(i)`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { makeBy } from 'fp-ts/ReadonlyArray'\n *\n * const double = (n: number): number => n * 2\n * assert.deepStrictEqual(makeBy(5, double), [0, 2, 4, 6, 8])\n *\n * @category constructors\n * @since 2.5.0\n */\nexport var makeBy = function (n, f) { return (n <= 0 ? empty : RNEA.makeBy(f)(n)); };\n/**\n * Create a `ReadonlyArray` containing a value repeated the specified number of times.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import { replicate } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(replicate(3, 'a'), ['a', 'a', 'a'])\n *\n * @category constructors\n * @since 2.5.0\n */\nexport var replicate = function (n, a) { return makeBy(n, function () { return a; }); };\nexport function fromPredicate(predicate) {\n return function (a) { return (predicate(a) ? [a] : empty); };\n}\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * @category conversions\n * @since 2.11.0\n */\nexport var fromOption = function (ma) { return (_.isNone(ma) ? empty : [ma.value]); };\n/**\n * Transforms an `Either` to a `ReadonlyArray`.\n *\n * @category conversions\n * @since 2.11.0\n */\nexport var fromEither = function (e) { return (_.isLeft(e) ? empty : [e.right]); };\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(as) : onEmpty();\n };\n};\n/**\n * @category pattern matching\n * @since 2.11.0\n */\nexport var match = matchW;\n/**\n * Less strict version of [`matchLeft`](#matchleft).\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchLeftW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(RNEA.head(as), RNEA.tail(as)) : onEmpty();\n };\n};\n/**\n * Break a `ReadonlyArray` into its first element and remaining elements.\n *\n * @example\n * import { matchLeft } from 'fp-ts/ReadonlyArray'\n *\n * const len: (as: ReadonlyArray) => number = matchLeft(() => 0, (_, tail) => 1 + len(tail))\n * assert.strictEqual(len([1, 2, 3]), 3)\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchLeft = matchLeftW;\n/**\n * Alias of [`matchLeft`](#matchleft).\n *\n * @category pattern matching\n * @since 2.5.0\n */\nexport var foldLeft = matchLeft;\n/**\n * Less strict version of [`matchRight`](#matchright).\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchRightW = function (onEmpty, onNonEmpty) {\n return function (as) {\n return isNonEmpty(as) ? onNonEmpty(RNEA.init(as), RNEA.last(as)) : onEmpty();\n };\n};\n/**\n * Break a `ReadonlyArray` into its initial elements and the last element.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchRight = matchRightW;\n/**\n * Alias of [`matchRight`](#matchright).\n *\n * @category pattern matching\n * @since 2.5.0\n */\nexport var foldRight = matchRight;\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * @category sequencing\n * @since 2.7.0\n */\nexport var chainWithIndex = function (f) {\n return function (as) {\n if (isEmpty(as)) {\n return empty;\n }\n var out = [];\n for (var i = 0; i < as.length; i++) {\n out.push.apply(out, f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * Same as `reduce` but it carries over the intermediate steps.\n *\n * @example\n * import { scanLeft } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(scanLeft(10, (b, a: number) => b - a)([1, 2, 3]), [10, 9, 7, 4])\n *\n * @since 2.5.0\n */\nexport var scanLeft = function (b, f) {\n return function (as) {\n var len = as.length;\n var out = new Array(len + 1);\n out[0] = b;\n for (var i = 0; i < len; i++) {\n out[i + 1] = f(out[i], as[i]);\n }\n return out;\n };\n};\n/**\n * Fold an array from the right, keeping all intermediate results instead of only the final result\n *\n * @example\n * import { scanRight } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(scanRight(10, (a: number, b) => b - a)([1, 2, 3]), [4, 5, 7, 10])\n *\n * @since 2.5.0\n */\nexport var scanRight = function (b, f) {\n return function (as) {\n var len = as.length;\n var out = new Array(len + 1);\n out[len] = b;\n for (var i = len - 1; i >= 0; i--) {\n out[i] = f(as[i], out[i + 1]);\n }\n return out;\n };\n};\n/**\n * Calculate the number of elements in a `ReadonlyArray`.\n *\n * @since 2.10.0\n */\nexport var size = function (as) { return as.length; };\n/**\n * Test whether an array contains a particular index\n *\n * @since 2.5.0\n */\nexport var isOutOfBound = RNEA.isOutOfBound;\nexport function lookup(i, as) {\n return as === undefined ? function (as) { return lookup(i, as); } : isOutOfBound(i, as) ? _.none : _.some(as[i]);\n}\n/**\n * Get the first element in an array, or `None` if the array is empty\n *\n * @example\n * import { head } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(head([1, 2, 3]), some(1))\n * assert.deepStrictEqual(head([]), none)\n *\n * @since 2.5.0\n */\nexport var head = function (as) { return (isNonEmpty(as) ? _.some(RNEA.head(as)) : _.none); };\n/**\n * Get the last element in an array, or `None` if the array is empty\n *\n * @example\n * import { last } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(last([1, 2, 3]), some(3))\n * assert.deepStrictEqual(last([]), none)\n *\n * @since 2.5.0\n */\nexport var last = function (as) { return (isNonEmpty(as) ? _.some(RNEA.last(as)) : _.none); };\n/**\n * Get all but the first element of an array, creating a new array, or `None` if the array is empty\n *\n * @example\n * import { tail } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(tail([1, 2, 3]), some([2, 3]))\n * assert.deepStrictEqual(tail([]), none)\n *\n * @since 2.5.0\n */\nexport var tail = function (as) {\n return isNonEmpty(as) ? _.some(RNEA.tail(as)) : _.none;\n};\n/**\n * Get all but the last element of an array, creating a new array, or `None` if the array is empty\n *\n * @example\n * import { init } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(init([1, 2, 3]), some([1, 2]))\n * assert.deepStrictEqual(init([]), none)\n *\n * @since 2.5.0\n */\nexport var init = function (as) {\n return isNonEmpty(as) ? _.some(RNEA.init(as)) : _.none;\n};\n/**\n * Keep only a max number of elements from the start of an `ReadonlyArray`, creating a new `ReadonlyArray`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const input: ReadonlyArray = [1, 2, 3]\n * assert.deepStrictEqual(pipe(input, RA.takeLeft(2)), [1, 2])\n *\n * // out of bounds\n * assert.strictEqual(pipe(input, RA.takeLeft(4)), input)\n * assert.strictEqual(pipe(input, RA.takeLeft(-1)), input)\n *\n * @since 2.5.0\n */\nexport var takeLeft = function (n) {\n return function (as) {\n return isOutOfBound(n, as) ? as : n === 0 ? empty : as.slice(0, n);\n };\n};\n/**\n * Keep only a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const input: ReadonlyArray = [1, 2, 3]\n * assert.deepStrictEqual(pipe(input, RA.takeRight(2)), [2, 3])\n *\n * // out of bounds\n * assert.strictEqual(pipe(input, RA.takeRight(4)), input)\n * assert.strictEqual(pipe(input, RA.takeRight(-1)), input)\n *\n * @since 2.5.0\n */\nexport var takeRight = function (n) {\n return function (as) {\n return isOutOfBound(n, as) ? as : n === 0 ? empty : as.slice(-n);\n };\n};\nexport function takeLeftWhile(predicate) {\n return function (as) {\n var out = [];\n for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {\n var a = as_1[_i];\n if (!predicate(a)) {\n break;\n }\n out.push(a);\n }\n var len = out.length;\n return len === as.length ? as : len === 0 ? empty : out;\n };\n}\nvar spanLeftIndex = function (as, predicate) {\n var l = as.length;\n var i = 0;\n for (; i < l; i++) {\n if (!predicate(as[i])) {\n break;\n }\n }\n return i;\n};\nexport function spanLeft(predicate) {\n return function (as) {\n var _a = splitAt(spanLeftIndex(as, predicate))(as), init = _a[0], rest = _a[1];\n return { init: init, rest: rest };\n };\n}\n/**\n * Drop a max number of elements from the start of an `ReadonlyArray`, creating a new `ReadonlyArray`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const input: ReadonlyArray = [1, 2, 3]\n * assert.deepStrictEqual(pipe(input, RA.dropLeft(2)), [3])\n * assert.strictEqual(pipe(input, RA.dropLeft(0)), input)\n * assert.strictEqual(pipe(input, RA.dropLeft(-1)), input)\n *\n * @since 2.5.0\n */\nexport var dropLeft = function (n) {\n return function (as) {\n return n <= 0 || isEmpty(as) ? as : n >= as.length ? empty : as.slice(n, as.length);\n };\n};\n/**\n * Drop a max number of elements from the end of an `ReadonlyArray`, creating a new `ReadonlyArray`.\n *\n * **Note**. `n` is normalized to a non negative integer.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const input: ReadonlyArray = [1, 2, 3]\n * assert.deepStrictEqual(pipe(input, RA.dropRight(2)), [1])\n * assert.strictEqual(pipe(input, RA.dropRight(0)), input)\n * assert.strictEqual(pipe(input, RA.dropRight(-1)), input)\n *\n * @since 2.5.0\n */\nexport var dropRight = function (n) {\n return function (as) {\n return n <= 0 || isEmpty(as) ? as : n >= as.length ? empty : as.slice(0, as.length - n);\n };\n};\nexport function dropLeftWhile(predicate) {\n return function (as) {\n var i = spanLeftIndex(as, predicate);\n return i === 0 ? as : i === as.length ? empty : as.slice(i);\n };\n}\n/**\n * Find the first index for which a predicate holds\n *\n * @example\n * import { findIndex } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(findIndex((n: number) => n === 2)([1, 2, 3]), some(1))\n * assert.deepStrictEqual(findIndex((n: number) => n === 2)([]), none)\n *\n * @since 2.5.0\n */\nexport var findIndex = function (predicate) {\n return function (as) {\n for (var i = 0; i < as.length; i++) {\n if (predicate(as[i])) {\n return _.some(i);\n }\n }\n return _.none;\n };\n};\nexport function findFirst(predicate) {\n return function (as) {\n for (var i = 0; i < as.length; i++) {\n if (predicate(as[i])) {\n return _.some(as[i]);\n }\n }\n return _.none;\n };\n}\n/**\n * Find the first element returned by an option based selector function\n *\n * @example\n * import { findFirstMap } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface Person {\n * readonly name: string\n * readonly age?: number\n * }\n *\n * const persons: ReadonlyArray = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]\n *\n * // returns the name of the first person that has an age\n * assert.deepStrictEqual(findFirstMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Mary'))\n *\n * @since 2.5.0\n */\nexport var findFirstMap = function (f) {\n return function (as) {\n for (var i = 0; i < as.length; i++) {\n var out = f(as[i]);\n if (_.isSome(out)) {\n return out;\n }\n }\n return _.none;\n };\n};\nexport function findLast(predicate) {\n return function (as) {\n for (var i = as.length - 1; i >= 0; i--) {\n if (predicate(as[i])) {\n return _.some(as[i]);\n }\n }\n return _.none;\n };\n}\n/**\n * Find the last element returned by an option based selector function\n *\n * @example\n * import { findLastMap } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface Person {\n * readonly name: string\n * readonly age?: number\n * }\n *\n * const persons: ReadonlyArray = [{ name: 'John' }, { name: 'Mary', age: 45 }, { name: 'Joey', age: 28 }]\n *\n * // returns the name of the last person that has an age\n * assert.deepStrictEqual(findLastMap((p: Person) => (p.age === undefined ? none : some(p.name)))(persons), some('Joey'))\n *\n * @since 2.5.0\n */\nexport var findLastMap = function (f) {\n return function (as) {\n for (var i = as.length - 1; i >= 0; i--) {\n var out = f(as[i]);\n if (_.isSome(out)) {\n return out;\n }\n }\n return _.none;\n };\n};\n/**\n * Returns the index of the last element of the list which matches the predicate\n *\n * @example\n * import { findLastIndex } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * interface X {\n * readonly a: number\n * readonly b: number\n * }\n * const xs: ReadonlyArray = [{ a: 1, b: 0 }, { a: 1, b: 1 }]\n * assert.deepStrictEqual(findLastIndex((x: { readonly a: number }) => x.a === 1)(xs), some(1))\n * assert.deepStrictEqual(findLastIndex((x: { readonly a: number }) => x.a === 4)(xs), none)\n *\n *\n * @since 2.5.0\n */\nexport var findLastIndex = function (predicate) {\n return function (as) {\n for (var i = as.length - 1; i >= 0; i--) {\n if (predicate(as[i])) {\n return _.some(i);\n }\n }\n return _.none;\n };\n};\n/**\n * Insert an element at the specified index, creating a new array, or returning `None` if the index is out of bounds\n *\n * @example\n * import { insertAt } from 'fp-ts/ReadonlyArray'\n * import { some } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(insertAt(2, 5)([1, 2, 3, 4]), some([1, 2, 5, 3, 4]))\n *\n * @since 2.5.0\n */\nexport var insertAt = function (i, a) {\n return function (as) {\n return i < 0 || i > as.length ? _.none : _.some(RNEA.unsafeInsertAt(i, a, as));\n };\n};\n/**\n * Change the element at the specified index, creating a new array, or returning `None` if the index is out of bounds\n *\n * @example\n * import { updateAt } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(updateAt(1, 1)([1, 2, 3]), some([1, 1, 3]))\n * assert.deepStrictEqual(updateAt(1, 1)([]), none)\n *\n * @since 2.5.0\n */\nexport var updateAt = function (i, a) {\n return modifyAt(i, function () { return a; });\n};\n/**\n * Delete the element at the specified index, creating a new array, or returning `None` if the index is out of bounds\n *\n * @example\n * import { deleteAt } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(deleteAt(0)([1, 2, 3]), some([2, 3]))\n * assert.deepStrictEqual(deleteAt(1)([]), none)\n *\n * @since 2.5.0\n */\nexport var deleteAt = function (i) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeDeleteAt(i, as));\n };\n};\n/**\n * Apply a function to the element at the specified index, creating a new array, or returning `None` if the index is out\n * of bounds\n *\n * @example\n * import { modifyAt } from 'fp-ts/ReadonlyArray'\n * import { some, none } from 'fp-ts/Option'\n *\n * const double = (x: number): number => x * 2\n * assert.deepStrictEqual(modifyAt(1, double)([1, 2, 3]), some([1, 4, 3]))\n * assert.deepStrictEqual(modifyAt(1, double)([]), none)\n *\n * @since 2.5.0\n */\nexport var modifyAt = function (i, f) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeUpdateAt(i, f(as[i]), as));\n };\n};\n/**\n * Reverse an array, creating a new array\n *\n * @example\n * import { reverse } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(reverse([1, 2, 3]), [3, 2, 1])\n *\n * @since 2.5.0\n */\nexport var reverse = function (as) { return (as.length <= 1 ? as : as.slice().reverse()); };\n/**\n * Extracts from an array of `Either` all the `Right` elements. All the `Right` elements are extracted in order\n *\n * @example\n * import { rights } from 'fp-ts/ReadonlyArray'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(rights([right(1), left('foo'), right(2)]), [1, 2])\n *\n * @since 2.5.0\n */\nexport var rights = function (as) {\n var r = [];\n for (var i = 0; i < as.length; i++) {\n var a = as[i];\n if (a._tag === 'Right') {\n r.push(a.right);\n }\n }\n return r;\n};\n/**\n * Extracts from an array of `Either` all the `Left` elements. All the `Left` elements are extracted in order\n *\n * @example\n * import { lefts } from 'fp-ts/ReadonlyArray'\n * import { left, right } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(lefts([right(1), left('foo'), right(2)]), ['foo'])\n *\n * @since 2.5.0\n */\nexport var lefts = function (as) {\n var r = [];\n for (var i = 0; i < as.length; i++) {\n var a = as[i];\n if (a._tag === 'Left') {\n r.push(a.left);\n }\n }\n return r;\n};\n/**\n * Sort the elements of an array in increasing order, creating a new array\n *\n * @example\n * import { sort } from 'fp-ts/ReadonlyArray'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(sort(N.Ord)([3, 2, 1]), [1, 2, 3])\n *\n * @since 2.5.0\n */\nexport var sort = function (O) {\n return function (as) {\n return as.length <= 1 ? as : as.slice().sort(O.compare);\n };\n};\n// TODO: curry and make data-last in v3\n/**\n * Apply a function to pairs of elements at the same index in two arrays, collecting the results in a new array. If one\n * input array is short, excess elements of the longer array are discarded.\n *\n * @example\n * import { zipWith } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(zipWith([1, 2, 3], ['a', 'b', 'c', 'd'], (n, s) => s + n), ['a1', 'b2', 'c3'])\n *\n * @since 2.5.0\n */\nexport var zipWith = function (fa, fb, f) {\n var fc = [];\n var len = Math.min(fa.length, fb.length);\n for (var i = 0; i < len; i++) {\n fc[i] = f(fa[i], fb[i]);\n }\n return fc;\n};\nexport function zip(as, bs) {\n if (bs === undefined) {\n return function (bs) { return zip(bs, as); };\n }\n return zipWith(as, bs, function (a, b) { return [a, b]; });\n}\n/**\n * The function is reverse of `zip`. Takes an array of pairs and return two corresponding arrays\n *\n * @example\n * import { unzip } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(unzip([[1, 'a'], [2, 'b'], [3, 'c']]), [[1, 2, 3], ['a', 'b', 'c']])\n *\n * @since 2.5.0\n */\nexport var unzip = function (as) {\n var fa = [];\n var fb = [];\n for (var i = 0; i < as.length; i++) {\n fa[i] = as[i][0];\n fb[i] = as[i][1];\n }\n return [fa, fb];\n};\n/**\n * Prepend an element to every member of an array\n *\n * @example\n * import { prependAll } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.10.0\n */\nexport var prependAll = function (middle) {\n var f = RNEA.prependAll(middle);\n return function (as) { return (isNonEmpty(as) ? f(as) : as); };\n};\n/**\n * Places an element in between members of an array\n *\n * @example\n * import { intersperse } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.9.0\n */\nexport var intersperse = function (middle) {\n var f = RNEA.intersperse(middle);\n return function (as) { return (isNonEmpty(as) ? f(as) : as); };\n};\n/**\n * Rotate a `ReadonlyArray` by `n` steps.\n *\n * @example\n * import { rotate } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])\n *\n * @since 2.5.0\n */\nexport var rotate = function (n) {\n var f = RNEA.rotate(n);\n return function (as) { return (isNonEmpty(as) ? f(as) : as); };\n};\nexport function elem(E) {\n return function (a, as) {\n if (as === undefined) {\n var elemE_1 = elem(E);\n return function (as) { return elemE_1(a, as); };\n }\n var predicate = function (element) { return E.equals(element, a); };\n var i = 0;\n for (; i < as.length; i++) {\n if (predicate(as[i])) {\n return true;\n }\n }\n return false;\n };\n}\n/**\n * Remove duplicates from an array, keeping the first occurrence of an element.\n *\n * @example\n * import { uniq } from 'fp-ts/ReadonlyArray'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])\n *\n * @since 2.5.0\n */\nexport var uniq = function (E) {\n var f = RNEA.uniq(E);\n return function (as) { return (isNonEmpty(as) ? f(as) : as); };\n};\n/**\n * Sort the elements of an array in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,\n * etc...\n *\n * @example\n * import { sortBy } from 'fp-ts/ReadonlyArray'\n * import { contramap } from 'fp-ts/Ord'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Person {\n * readonly name: string\n * readonly age: number\n * }\n * const byName = pipe(S.Ord, contramap((p: Person) => p.name))\n * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))\n *\n * const sortByNameByAge = sortBy([byName, byAge])\n *\n * const persons = [{ name: 'a', age: 1 }, { name: 'b', age: 3 }, { name: 'c', age: 2 }, { name: 'b', age: 2 }]\n * assert.deepStrictEqual(sortByNameByAge(persons), [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 2 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 }\n * ])\n *\n * @since 2.5.0\n */\nexport var sortBy = function (ords) {\n var f = RNEA.sortBy(ords);\n return function (as) { return (isNonEmpty(as) ? f(as) : as); };\n};\n/**\n * A useful recursion pattern for processing a `ReadonlyArray` to produce a new `ReadonlyArray`, often used for \"chopping\" up the input\n * `ReadonlyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `ReadonlyArray` and produce a\n * value and the tail of the `ReadonlyArray`.\n *\n * @example\n * import { Eq } from 'fp-ts/Eq'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * const group = (S: Eq): ((as: ReadonlyArray) => ReadonlyArray>) => {\n * return RA.chop(as => {\n * const { init, rest } = pipe(as, RA.spanLeft((a: A) => S.equals(a, as[0])))\n * return [init, rest]\n * })\n * }\n * assert.deepStrictEqual(group(N.Eq)([1, 1, 2, 3, 3, 4]), [[1, 1], [2], [3, 3], [4]])\n *\n * @since 2.5.0\n */\nexport var chop = function (f) {\n var g = RNEA.chop(f);\n return function (as) { return (isNonEmpty(as) ? g(as) : empty); };\n};\n/**\n * Splits a `ReadonlyArray` into two pieces, the first piece has max `n` elements.\n *\n * @example\n * import { splitAt } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(splitAt(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4, 5]])\n *\n * @since 2.5.0\n */\nexport var splitAt = function (n) {\n return function (as) {\n return n >= 1 && isNonEmpty(as) ? RNEA.splitAt(n)(as) : isEmpty(as) ? [as, empty] : [empty, as];\n };\n};\n/**\n * Splits a `ReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of\n * the `ReadonlyArray`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive\n * definition of `chunksOf`; it satisfies the property that:\n *\n * ```ts\n * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))\n * ```\n *\n * whenever `n` evenly divides the length of `as`.\n *\n * @example\n * import { chunksOf } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(chunksOf(2)([1, 2, 3, 4, 5]), [[1, 2], [3, 4], [5]])\n *\n * @since 2.5.0\n */\nexport var chunksOf = function (n) {\n var f = RNEA.chunksOf(n);\n return function (as) { return (isNonEmpty(as) ? f(as) : empty); };\n};\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromOptionK = function (f) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return fromOption(f.apply(void 0, a));\n };\n};\nexport function comprehension(input, f, g) {\n if (g === void 0) { g = function () { return true; }; }\n var go = function (scope, input) {\n return isNonEmpty(input)\n ? flatMap(RNEA.head(input), function (a) { return go(pipe(scope, append(a)), RNEA.tail(input)); })\n : g.apply(void 0, scope) ? [f.apply(void 0, scope)]\n : empty;\n };\n return go(empty, input);\n}\n/**\n * @since 2.11.0\n */\nexport var concatW = function (second) {\n return function (first) {\n return isEmpty(first) ? second : isEmpty(second) ? first : first.concat(second);\n };\n};\n/**\n * @since 2.11.0\n */\nexport var concat = concatW;\nexport function union(E) {\n var unionE = RNEA.union(E);\n return function (first, second) {\n if (second === undefined) {\n var unionE_1 = union(E);\n return function (second) { return unionE_1(second, first); };\n }\n return isNonEmpty(first) && isNonEmpty(second) ? unionE(second)(first) : isNonEmpty(first) ? first : second;\n };\n}\nexport function intersection(E) {\n var elemE = elem(E);\n return function (xs, ys) {\n if (ys === undefined) {\n var intersectionE_1 = intersection(E);\n return function (ys) { return intersectionE_1(ys, xs); };\n }\n return xs.filter(function (a) { return elemE(a, ys); });\n };\n}\nexport function difference(E) {\n var elemE = elem(E);\n return function (xs, ys) {\n if (ys === undefined) {\n var differenceE_1 = difference(E);\n return function (ys) { return differenceE_1(ys, xs); };\n }\n return xs.filter(function (a) { return !elemE(a, ys); });\n };\n}\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _mapWithIndex = function (fa, f) { return pipe(fa, mapWithIndex(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\nvar _filter = function (fa, predicate) {\n return pipe(fa, filter(predicate));\n};\nvar _filterMap = function (fa, f) { return pipe(fa, filterMap(f)); };\nvar _partition = function (fa, predicate) {\n return pipe(fa, partition(predicate));\n};\nvar _partitionMap = function (fa, f) { return pipe(fa, partitionMap(f)); };\nvar _partitionWithIndex = function (fa, predicateWithIndex) { return pipe(fa, partitionWithIndex(predicateWithIndex)); };\nvar _partitionMapWithIndex = function (fa, f) { return pipe(fa, partitionMapWithIndex(f)); };\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\nvar _reduceWithIndex = function (fa, b, f) {\n return pipe(fa, reduceWithIndex(b, f));\n};\nvar _foldMapWithIndex = function (M) {\n var foldMapWithIndexM = foldMapWithIndex(M);\n return function (fa, f) { return pipe(fa, foldMapWithIndexM(f)); };\n};\nvar _reduceRightWithIndex = function (fa, b, f) {\n return pipe(fa, reduceRightWithIndex(b, f));\n};\nvar _filterMapWithIndex = function (fa, f) { return pipe(fa, filterMapWithIndex(f)); };\nvar _filterWithIndex = function (fa, predicateWithIndex) { return pipe(fa, filterWithIndex(predicateWithIndex)); };\nvar _extend = function (fa, f) { return pipe(fa, extend(f)); };\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _traverseWithIndex = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (ta, f) { return pipe(ta, traverseWithIndexF(f)); };\n};\n/** @internal */\nexport var _chainRecDepthFirst = function (a, f) { return pipe(a, chainRecDepthFirst(f)); };\n/** @internal */\nexport var _chainRecBreadthFirst = function (a, f) { return pipe(a, chainRecBreadthFirst(f)); };\n/**\n * @category constructors\n * @since 2.5.0\n */\nexport var of = RNEA.of;\n/**\n * @since 2.7.0\n */\nexport var zero = function () { return empty; };\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.altW(() => ['a', 'b'])\n * ),\n * [1, 2, 3, 'a', 'b']\n * )\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) {\n return function (fa) {\n return fa.concat(that());\n };\n};\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `ReadonlyArray` concatenates the inputs into a single array.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.alt(() => [4, 5])\n * ),\n * [1, 2, 3, 4, 5]\n * )\n *\n * @category error handling\n * @since 2.5.0\n */\nexport var alt = altW;\n/**\n * @since 2.5.0\n */\nexport var ap = function (fa) {\n return flatMap(function (f) { return pipe(fa, map(f)); });\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.flatMap((n) => [`a${n}`, `b${n}`])\n * ),\n * ['a1', 'b1', 'a2', 'b2', 'a3', 'b3']\n * )\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.flatMap(() => [])\n * ),\n * []\n * )\n *\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) {\n return pipe(ma, chainWithIndex(function (i, a) { return f(a, i); }));\n});\n/**\n * @category sequencing\n * @since 2.5.0\n */\nexport var flatten = /*#__PURE__*/ flatMap(identity);\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types\n * use the type constructor `F` to represent some computational context.\n *\n * @category mapping\n * @since 2.5.0\n */\nexport var map = function (f) { return function (fa) {\n return fa.map(function (a) { return f(a); });\n}; };\n/**\n * @category mapping\n * @since 2.5.0\n */\nexport var mapWithIndex = function (f) { return function (fa) {\n return fa.map(function (a, i) { return f(i, a); });\n}; };\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var separate = function (fa) {\n var left = [];\n var right = [];\n for (var _i = 0, fa_1 = fa; _i < fa_1.length; _i++) {\n var e = fa_1[_i];\n if (e._tag === 'Left') {\n left.push(e.left);\n }\n else {\n right.push(e.right);\n }\n }\n return separated(left, right);\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var filter = function (predicate) {\n return function (as) {\n return as.filter(predicate);\n };\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var filterMapWithIndex = function (f) {\n return function (fa) {\n var out = [];\n for (var i = 0; i < fa.length; i++) {\n var optionB = f(i, fa[i]);\n if (_.isSome(optionB)) {\n out.push(optionB.value);\n }\n }\n return out;\n };\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var filterMap = function (f) {\n return filterMapWithIndex(function (_, a) { return f(a); });\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var compact = /*#__PURE__*/ filterMap(identity);\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var partition = function (predicate) {\n return partitionWithIndex(function (_, a) { return predicate(a); });\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var partitionWithIndex = function (predicateWithIndex) {\n return function (as) {\n var left = [];\n var right = [];\n for (var i = 0; i < as.length; i++) {\n var a = as[i];\n if (predicateWithIndex(i, a)) {\n right.push(a);\n }\n else {\n left.push(a);\n }\n }\n return separated(left, right);\n };\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var partitionMap = function (f) {\n return partitionMapWithIndex(function (_, a) { return f(a); });\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var partitionMapWithIndex = function (f) {\n return function (fa) {\n var left = [];\n var right = [];\n for (var i = 0; i < fa.length; i++) {\n var e = f(i, fa[i]);\n if (e._tag === 'Left') {\n left.push(e.left);\n }\n else {\n right.push(e.right);\n }\n }\n return separated(left, right);\n };\n};\n/**\n * @category filtering\n * @since 2.5.0\n */\nexport var filterWithIndex = function (predicateWithIndex) {\n return function (as) {\n return as.filter(function (a, i) { return predicateWithIndex(i, a); });\n };\n};\n/**\n * @since 2.5.0\n */\nexport var extend = function (f) { return function (wa) {\n return wa.map(function (_, i) { return f(wa.slice(i)); });\n}; };\n/**\n * @since 2.5.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var foldMapWithIndex = function (M) {\n return function (f) {\n return function (fa) {\n return fa.reduce(function (b, a, i) { return M.concat(b, f(i, a)); }, M.empty);\n };\n };\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduce = function (b, f) {\n return reduceWithIndex(b, function (_, b, a) { return f(b, a); });\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var foldMap = function (M) {\n var foldMapWithIndexM = foldMapWithIndex(M);\n return function (f) { return foldMapWithIndexM(function (_, a) { return f(a); }); };\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceWithIndex = function (b, f) { return function (fa) {\n var len = fa.length;\n var out = b;\n for (var i = 0; i < len; i++) {\n out = f(i, out, fa[i]);\n }\n return out;\n}; };\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceRight = function (b, f) {\n return reduceRightWithIndex(b, function (_, a, b) { return f(a, b); });\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceRightWithIndex = function (b, f) { return function (fa) {\n return fa.reduceRight(function (b, a, i) { return f(i, a, b); }, b);\n}; };\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ta) {\n return _reduce(ta, F.of(zero()), function (fas, fa) {\n return F.ap(F.map(fas, function (as) { return function (a) { return pipe(as, append(a)); }; }), fa);\n });\n };\n};\n/**\n * @category sequencing\n * @since 2.6.3\n */\nexport var traverseWithIndex = function (F) {\n return function (f) {\n return reduceWithIndex(F.of(zero()), function (i, fbs, a) {\n return F.ap(F.map(fbs, function (bs) { return function (b) { return pipe(bs, append(b)); }; }), f(i, a));\n });\n };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wither = function (F) {\n var _witherF = _wither(F);\n return function (f) { return function (fa) { return _witherF(fa, f); }; };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wilt = function (F) {\n var _wiltF = _wilt(F);\n return function (f) { return function (fa) { return _wiltF(fa, f); }; };\n};\n/**\n * @since 2.6.6\n */\nexport var unfold = function (b, f) {\n var out = [];\n var bb = b;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var mt = f(bb);\n if (_.isSome(mt)) {\n var _a = mt.value, a = _a[0], b_1 = _a[1];\n out.push(a);\n bb = b_1;\n }\n else {\n break;\n }\n }\n return out;\n};\n/**\n * @category type lambdas\n * @since 2.5.0\n */\nexport var URI = 'ReadonlyArray';\n/**\n * @category instances\n * @since 2.5.0\n */\nexport var getShow = function (S) { return ({\n show: function (as) { return \"[\".concat(as.map(S.show).join(', '), \"]\"); }\n}); };\n/**\n * @category instances\n * @since 2.5.0\n */\nexport var getSemigroup = function () { return ({\n concat: function (first, second) { return (isEmpty(first) ? second : isEmpty(second) ? first : first.concat(second)); }\n}); };\n/**\n * Returns a `Monoid` for `ReadonlyArray`.\n *\n * @example\n * import { getMonoid } from 'fp-ts/ReadonlyArray'\n *\n * const M = getMonoid()\n * assert.deepStrictEqual(M.concat([1, 2], [3, 4]), [1, 2, 3, 4])\n *\n * @category instances\n * @since 2.5.0\n */\nexport var getMonoid = function () { return ({\n concat: getSemigroup().concat,\n empty: empty\n}); };\n/**\n * Derives an `Eq` over the `ReadonlyArray` of a given element type from the `Eq` of that type. The derived `Eq` defines two\n * arrays as equal if all elements of both arrays are compared equal pairwise with the given `E`. In case of arrays of\n * different lengths, the result is non equality.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { getEq } from 'fp-ts/ReadonlyArray'\n *\n * const E = getEq(S.Eq)\n * assert.strictEqual(E.equals(['a', 'b'], ['a', 'b']), true)\n * assert.strictEqual(E.equals(['a'], []), false)\n *\n * @category instances\n * @since 2.5.0\n */\nexport var getEq = function (E) {\n return fromEquals(function (xs, ys) { return xs.length === ys.length && xs.every(function (x, i) { return E.equals(x, ys[i]); }); });\n};\n/**\n * Derives an `Ord` over the `ReadonlyArray` of a given element type from the `Ord` of that type. The ordering between two such\n * arrays is equal to: the first non equal comparison of each arrays elements taken pairwise in increasing order, in\n * case of equality over all the pairwise elements; the longest array is considered the greatest, if both arrays have\n * the same length, the result is equality.\n *\n * @example\n * import { getOrd } from 'fp-ts/ReadonlyArray'\n * import * as S from 'fp-ts/string'\n *\n * const O = getOrd(S.Ord)\n * assert.strictEqual(O.compare(['b'], ['a']), 1)\n * assert.strictEqual(O.compare(['a'], ['a']), 0)\n * assert.strictEqual(O.compare(['a'], ['b']), -1)\n *\n *\n * @category instances\n * @since 2.5.0\n */\nexport var getOrd = function (O) {\n return fromCompare(function (a, b) {\n var aLen = a.length;\n var bLen = b.length;\n var len = Math.min(aLen, bLen);\n for (var i = 0; i < len; i++) {\n var ordering = O.compare(a[i], b[i]);\n if (ordering !== 0) {\n return ordering;\n }\n }\n return N.Ord.compare(aLen, bLen);\n });\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getUnionSemigroup = function (E) {\n var unionE = union(E);\n return {\n concat: function (first, second) { return unionE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getUnionMonoid = function (E) { return ({\n concat: getUnionSemigroup(E).concat,\n empty: empty\n}); };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getIntersectionSemigroup = function (E) {\n var intersectionE = intersection(E);\n return {\n concat: function (first, second) { return intersectionE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var getDifferenceMagma = function (E) {\n var differenceE = difference(E);\n return {\n concat: function (first, second) { return differenceE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FunctorWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.5.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.5.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.chainFirst(() => ['a', 'b'])\n * ),\n * [1, 1, 2, 2, 3, 3]\n * )\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.chainFirst(() => [])\n * ),\n * []\n * )\n *\n * @category sequencing\n * @since 2.5.0\n */\nexport var chainFirst = \n/*#__PURE__*/ chainFirst_(Chain);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Unfoldable = {\n URI: URI,\n unfold: unfold\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var Zero = {\n URI: URI,\n zero: zero\n};\n/**\n * @category do notation\n * @since 2.11.0\n */\nexport var guard = /*#__PURE__*/ guard_(Zero, Pointed);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alternative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n alt: _alt,\n zero: zero\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Compactable = {\n URI: URI,\n compact: compact,\n separate: separate\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Filterable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FilterableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n partitionMapWithIndex: _partitionMapWithIndex,\n partitionWithIndex: _partitionWithIndex,\n filterMapWithIndex: _filterMapWithIndex,\n filterWithIndex: _filterWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FoldableWithIndex = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var TraversableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverse: _traverse,\n sequence: sequence,\n traverseWithIndex: _traverseWithIndex\n};\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainRecDepthFirst = function (f) {\n return function (a) {\n var todo = __spreadArray([], f(a), true);\n var out = [];\n while (todo.length > 0) {\n var e = todo.shift();\n if (_.isLeft(e)) {\n todo.unshift.apply(todo, f(e.left));\n }\n else {\n out.push(e.right);\n }\n }\n return out;\n };\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var ChainRecDepthFirst = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRecDepthFirst\n};\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainRecBreadthFirst = function (f) {\n return function (a) {\n var initial = f(a);\n var todo = [];\n var out = [];\n function go(e) {\n if (_.isLeft(e)) {\n f(e.left).forEach(function (v) { return todo.push(v); });\n }\n else {\n out.push(e.right);\n }\n }\n for (var _i = 0, initial_1 = initial; _i < initial_1.length; _i++) {\n var e = initial_1[_i];\n go(e);\n }\n while (todo.length > 0) {\n go(todo.shift());\n }\n return out;\n };\n};\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var ChainRecBreadthFirst = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRecBreadthFirst\n};\nvar _wither = /*#__PURE__*/ witherDefault(Traversable, Compactable);\nvar _wilt = /*#__PURE__*/ wiltDefault(Traversable, Compactable);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Witherable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n wither: _wither,\n wilt: _wilt\n};\n/**\n * Filter values inside a context.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as T from 'fp-ts/Task'\n *\n * const filterE = RA.filterE(T.ApplicativePar)\n * async function test() {\n * assert.deepStrictEqual(\n * await pipe(\n * [-1, 2, 3],\n * filterE((n) => T.of(n > 0))\n * )(),\n * [2, 3]\n * )\n * }\n * test()\n *\n * @since 2.11.0\n */\nexport var filterE = /*#__PURE__*/ filterE_(Witherable);\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: fromEither\n};\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromEitherK = /*#__PURE__*/ fromEitherK_(FromEither);\n// -------------------------------------------------------------------------------------\n// unsafe\n// -------------------------------------------------------------------------------------\n/**\n * @category unsafe\n * @since 2.5.0\n */\nexport var unsafeInsertAt = RNEA.unsafeInsertAt;\n/**\n * @category unsafe\n * @since 2.5.0\n */\nexport var unsafeUpdateAt = function (i, a, as) {\n return isNonEmpty(as) ? RNEA.unsafeUpdateAt(i, a, as) : as;\n};\n/**\n * @category unsafe\n * @since 2.5.0\n */\nexport var unsafeDeleteAt = function (i, as) {\n var xs = as.slice();\n xs.splice(i, 1);\n return xs;\n};\n/**\n * @category conversions\n * @since 2.5.0\n */\nexport var toArray = function (as) { return as.slice(); };\n/**\n * @category conversions\n * @since 2.5.0\n */\nexport var fromArray = function (as) { return (isEmpty(as) ? empty : as.slice()); };\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * An empty array\n *\n * @since 2.5.0\n */\nexport var empty = RNEA.empty;\nexport function every(predicate) {\n return function (as) { return as.every(predicate); };\n}\n/**\n * Check if a predicate holds true for any array member.\n *\n * @example\n * import { some } from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const isPositive = (n: number): boolean => n > 0\n *\n * assert.deepStrictEqual(pipe([-1, -2, 3], some(isPositive)), true)\n * assert.deepStrictEqual(pipe([-1, -2, -3], some(isPositive)), false)\n *\n * @since 2.9.0\n */\nexport var some = function (predicate) {\n return function (as) {\n return as.some(predicate);\n };\n};\n/**\n * Alias of [`some`](#some)\n *\n * @since 2.11.0\n */\nexport var exists = some;\n/**\n * Places an element in between members of a `ReadonlyArray`, then folds the results using the provided `Monoid`.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { intercalate } from 'fp-ts/ReadonlyArray'\n *\n * assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c')\n *\n * @since 2.12.0\n */\nexport var intercalate = function (M) {\n var intercalateM = RNEA.intercalate(M);\n return function (middle) { return match(function () { return M.empty; }, intercalateM(middle)); };\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ bind_(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.5.0\n */\nexport var chain = flatMap;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use `ReadonlyNonEmptyArray` module instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var range = RNEA.range;\n/**\n * Use [`prepend`](#prepend) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var cons = RNEA.cons;\n/**\n * Use [`append`](#append) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var snoc = RNEA.snoc;\n/**\n * Use [`prependAll`](#prependall) instead.\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var prependToAll = prependAll;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `RA.Functor` instead of `RA.readonlyArray`\n * (where `RA` is from `import RA from 'fp-ts/ReadonlyArray'`)\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var readonlyArray = {\n URI: URI,\n compact: compact,\n separate: separate,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n mapWithIndex: _mapWithIndex,\n partitionMapWithIndex: _partitionMapWithIndex,\n partitionWithIndex: _partitionWithIndex,\n filterMapWithIndex: _filterMapWithIndex,\n filterWithIndex: _filterWithIndex,\n alt: _alt,\n zero: zero,\n unfold: unfold,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex,\n extend: _extend,\n wither: _wither,\n wilt: _wilt\n};\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_ } from './Apply';\nimport { bind as bind_, chainFirst as chainFirst_ } from './Chain';\nimport { fromEquals } from './Eq';\nimport { dual, flow, identity, pipe, SK } from './function';\nimport { bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { getMonoid } from './Ord';\nimport * as Se from './Semigroup';\n// -------------------------------------------------------------------------------------\n// internal\n// -------------------------------------------------------------------------------------\n/**\n * @internal\n */\nexport var empty = _.emptyReadonlyArray;\n/**\n * @internal\n */\nexport var isNonEmpty = _.isNonEmpty;\n/**\n * @internal\n */\nexport var isOutOfBound = function (i, as) { return i < 0 || i >= as.length; };\n/**\n * @internal\n */\nexport var prependW = function (head) {\n return function (tail) {\n return __spreadArray([head], tail, true);\n };\n};\n/**\n * @internal\n */\nexport var prepend = prependW;\n/**\n * @internal\n */\nexport var appendW = function (end) {\n return function (init) {\n return __spreadArray(__spreadArray([], init, true), [end], false);\n };\n};\n/**\n * @internal\n */\nexport var append = appendW;\n/**\n * @internal\n */\nexport var unsafeInsertAt = function (i, a, as) {\n if (isNonEmpty(as)) {\n var xs = _.fromReadonlyNonEmptyArray(as);\n xs.splice(i, 0, a);\n return xs;\n }\n return [a];\n};\n/**\n * @internal\n */\nexport var unsafeUpdateAt = function (i, a, as) {\n if (as[i] === a) {\n return as;\n }\n else {\n var xs = _.fromReadonlyNonEmptyArray(as);\n xs[i] = a;\n return xs;\n }\n};\n/**\n * Remove duplicates from a `ReadonlyNonEmptyArray`, keeping the first occurrence of an element.\n *\n * @example\n * import { uniq } from 'fp-ts/ReadonlyNonEmptyArray'\n * import * as N from 'fp-ts/number'\n *\n * assert.deepStrictEqual(uniq(N.Eq)([1, 2, 1]), [1, 2])\n *\n * @since 2.11.0\n */\nexport var uniq = function (E) {\n return function (as) {\n if (as.length === 1) {\n return as;\n }\n var out = [head(as)];\n var rest = tail(as);\n var _loop_1 = function (a) {\n if (out.every(function (o) { return !E.equals(o, a); })) {\n out.push(a);\n }\n };\n for (var _i = 0, rest_1 = rest; _i < rest_1.length; _i++) {\n var a = rest_1[_i];\n _loop_1(a);\n }\n return out;\n };\n};\n/**\n * Sort the elements of a `ReadonlyNonEmptyArray` in increasing order, where elements are compared using first `ords[0]`, then `ords[1]`,\n * etc...\n *\n * @example\n * import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'\n * import { contramap } from 'fp-ts/Ord'\n * import * as S from 'fp-ts/string'\n * import * as N from 'fp-ts/number'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Person {\n * name: string\n * age: number\n * }\n *\n * const byName = pipe(S.Ord, contramap((p: Person) => p.name))\n *\n * const byAge = pipe(N.Ord, contramap((p: Person) => p.age))\n *\n * const sortByNameByAge = RNEA.sortBy([byName, byAge])\n *\n * const persons: RNEA.ReadonlyNonEmptyArray = [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 },\n * { name: 'b', age: 2 }\n * ]\n *\n * assert.deepStrictEqual(sortByNameByAge(persons), [\n * { name: 'a', age: 1 },\n * { name: 'b', age: 2 },\n * { name: 'b', age: 3 },\n * { name: 'c', age: 2 }\n * ])\n *\n * @since 2.11.0\n */\nexport var sortBy = function (ords) {\n if (isNonEmpty(ords)) {\n var M = getMonoid();\n return sort(ords.reduce(M.concat, M.empty));\n }\n return identity;\n};\n/**\n * @since 2.11.0\n */\nexport var union = function (E) {\n var uniqE = uniq(E);\n return function (second) { return function (first) { return uniqE(pipe(first, concat(second))); }; };\n};\n/**\n * Rotate a `ReadonlyNonEmptyArray` by `n` steps.\n *\n * @example\n * import { rotate } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(rotate(2)([1, 2, 3, 4, 5]), [4, 5, 1, 2, 3])\n * assert.deepStrictEqual(rotate(-2)([1, 2, 3, 4, 5]), [3, 4, 5, 1, 2])\n *\n * @since 2.11.0\n */\nexport var rotate = function (n) {\n return function (as) {\n var len = as.length;\n var m = Math.round(n) % len;\n if (isOutOfBound(Math.abs(m), as) || m === 0) {\n return as;\n }\n if (m < 0) {\n var _a = splitAt(-m)(as), f = _a[0], s = _a[1];\n return pipe(s, concat(f));\n }\n else {\n return rotate(m - len)(as);\n }\n };\n};\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Return a `ReadonlyNonEmptyArray` from a `ReadonlyArray` returning `none` if the input is empty.\n *\n * @category conversions\n * @since 2.5.0\n */\nexport var fromReadonlyArray = function (as) {\n return isNonEmpty(as) ? _.some(as) : _.none;\n};\n/**\n * Return a `ReadonlyNonEmptyArray` of length `n` with element `i` initialized with `f(i)`.\n *\n * **Note**. `n` is normalized to a natural number.\n *\n * @example\n * import { makeBy } from 'fp-ts/ReadonlyNonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * const double = (n: number): number => n * 2\n * assert.deepStrictEqual(pipe(5, makeBy(double)), [0, 2, 4, 6, 8])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var makeBy = function (f) {\n return function (n) {\n var j = Math.max(0, Math.floor(n));\n var out = [f(0)];\n for (var i = 1; i < j; i++) {\n out.push(f(i));\n }\n return out;\n };\n};\n/**\n * Create a `ReadonlyNonEmptyArray` containing a value repeated the specified number of times.\n *\n * **Note**. `n` is normalized to a natural number.\n *\n * @example\n * import { replicate } from 'fp-ts/ReadonlyNonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe(3, replicate('a')), ['a', 'a', 'a'])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var replicate = function (a) { return makeBy(function () { return a; }); };\n/**\n * Create a `ReadonlyNonEmptyArray` containing a range of integers, including both endpoints.\n *\n * @example\n * import { range } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(range(1, 5), [1, 2, 3, 4, 5])\n *\n * @category constructors\n * @since 2.11.0\n */\nexport var range = function (start, end) {\n return start <= end ? makeBy(function (i) { return start + i; })(end - start + 1) : [start];\n};\n/**\n * Return the tuple of the `head` and the `tail`.\n *\n * @example\n * import { unprepend } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(unprepend([1, 2, 3, 4]), [1, [2, 3, 4]])\n *\n * @since 2.9.0\n */\nexport var unprepend = function (as) { return [head(as), tail(as)]; };\n/**\n * Return the tuple of the `init` and the `last`.\n *\n * @example\n * import { unappend } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(unappend([1, 2, 3, 4]), [[1, 2, 3], 4])\n *\n * @since 2.9.0\n */\nexport var unappend = function (as) { return [init(as), last(as)]; };\n/**\n * @category conversions\n * @since 2.5.0\n */\nexport var fromArray = function (as) { return fromReadonlyArray(as.slice()); };\nexport function concatW(second) {\n return function (first) { return first.concat(second); };\n}\nexport function concat(x, y) {\n return y ? x.concat(y) : function (y) { return y.concat(x); };\n}\n/**\n * @since 2.5.0\n */\nexport var reverse = function (as) {\n return as.length === 1 ? as : __spreadArray([last(as)], as.slice(0, -1).reverse(), true);\n};\nexport function group(E) {\n return function (as) {\n var len = as.length;\n if (len === 0) {\n return empty;\n }\n var out = [];\n var head = as[0];\n var nea = [head];\n for (var i = 1; i < len; i++) {\n var a = as[i];\n if (E.equals(a, head)) {\n nea.push(a);\n }\n else {\n out.push(nea);\n head = a;\n nea = [head];\n }\n }\n out.push(nea);\n return out;\n };\n}\n/**\n * Splits an array into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning\n * function on each element, and grouping the results according to values returned\n *\n * @example\n * import { groupBy } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(groupBy((s: string) => String(s.length))(['a', 'b', 'ab']), {\n * '1': ['a', 'b'],\n * '2': ['ab']\n * })\n *\n * @since 2.5.0\n */\nexport var groupBy = function (f) {\n return function (as) {\n var out = {};\n for (var _i = 0, as_1 = as; _i < as_1.length; _i++) {\n var a = as_1[_i];\n var k = f(a);\n if (_.has.call(out, k)) {\n out[k].push(a);\n }\n else {\n out[k] = [a];\n }\n }\n return out;\n };\n};\n/**\n * @since 2.5.0\n */\nexport var sort = function (O) {\n return function (as) {\n return as.length === 1 ? as : as.slice().sort(O.compare);\n };\n};\n/**\n * @since 2.5.0\n */\nexport var updateAt = function (i, a) {\n return modifyAt(i, function () { return a; });\n};\n/**\n * @since 2.5.0\n */\nexport var modifyAt = function (i, f) {\n return function (as) {\n return isOutOfBound(i, as) ? _.none : _.some(unsafeUpdateAt(i, f(as[i]), as));\n };\n};\n/**\n * @since 2.5.1\n */\nexport var zipWith = function (as, bs, f) {\n var cs = [f(as[0], bs[0])];\n var len = Math.min(as.length, bs.length);\n for (var i = 1; i < len; i++) {\n cs[i] = f(as[i], bs[i]);\n }\n return cs;\n};\nexport function zip(as, bs) {\n if (bs === undefined) {\n return function (bs) { return zip(bs, as); };\n }\n return zipWith(as, bs, function (a, b) { return [a, b]; });\n}\n/**\n * @since 2.5.1\n */\nexport var unzip = function (abs) {\n var fa = [abs[0][0]];\n var fb = [abs[0][1]];\n for (var i = 1; i < abs.length; i++) {\n fa[i] = abs[i][0];\n fb[i] = abs[i][1];\n }\n return [fa, fb];\n};\n/**\n * Prepend an element to every member of a `ReadonlyNonEmptyArray`.\n *\n * @example\n * import { prependAll } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(prependAll(9)([1, 2, 3, 4]), [9, 1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.10.0\n */\nexport var prependAll = function (middle) {\n return function (as) {\n var out = [middle, as[0]];\n for (var i = 1; i < as.length; i++) {\n out.push(middle, as[i]);\n }\n return out;\n };\n};\n/**\n * Places an element in between members of a `ReadonlyNonEmptyArray`.\n *\n * @example\n * import { intersperse } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(intersperse(9)([1, 2, 3, 4]), [1, 9, 2, 9, 3, 9, 4])\n *\n * @since 2.9.0\n */\nexport var intersperse = function (middle) {\n return function (as) {\n var rest = tail(as);\n return isNonEmpty(rest) ? pipe(rest, prependAll(middle), prepend(head(as))) : as;\n };\n};\n/**\n * @category sequencing\n * @since 2.10.0\n */\nexport var chainWithIndex = function (f) {\n return function (as) {\n var out = _.fromReadonlyNonEmptyArray(f(0, head(as)));\n for (var i = 1; i < as.length; i++) {\n out.push.apply(out, f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * A useful recursion pattern for processing a `ReadonlyNonEmptyArray` to produce a new `ReadonlyNonEmptyArray`, often used for \"chopping\" up the input\n * `ReadonlyNonEmptyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `ReadonlyNonEmptyArray` and produce a\n * value and the tail of the `ReadonlyNonEmptyArray`.\n *\n * @since 2.10.0\n */\nexport var chop = function (f) {\n return function (as) {\n var _a = f(as), b = _a[0], rest = _a[1];\n var out = [b];\n var next = rest;\n while (isNonEmpty(next)) {\n var _b = f(next), b_1 = _b[0], rest_2 = _b[1];\n out.push(b_1);\n next = rest_2;\n }\n return out;\n };\n};\n/**\n * Splits a `ReadonlyNonEmptyArray` into two pieces, the first piece has max `n` elements.\n *\n * @since 2.10.0\n */\nexport var splitAt = function (n) {\n return function (as) {\n var m = Math.max(1, n);\n return m >= as.length ? [as, empty] : [pipe(as.slice(1, m), prepend(head(as))), as.slice(m)];\n };\n};\n/**\n * Splits a `ReadonlyNonEmptyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of\n * the `ReadonlyNonEmptyArray`.\n *\n * @since 2.10.0\n */\nexport var chunksOf = function (n) { return chop(splitAt(n)); };\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\n/* istanbul ignore next */\nvar _mapWithIndex = function (fa, f) { return pipe(fa, mapWithIndex(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\n/* istanbul ignore next */\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\n/* istanbul ignore next */\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\n/* istanbul ignore next */\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\n/* istanbul ignore next */\nvar _reduceWithIndex = function (fa, b, f) {\n return pipe(fa, reduceWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _foldMapWithIndex = function (M) {\n var foldMapWithIndexM = foldMapWithIndex(M);\n return function (fa, f) { return pipe(fa, foldMapWithIndexM(f)); };\n};\n/* istanbul ignore next */\nvar _reduceRightWithIndex = function (fa, b, f) {\n return pipe(fa, reduceRightWithIndex(b, f));\n};\n/* istanbul ignore next */\nvar _traverseWithIndex = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (ta, f) { return pipe(ta, traverseWithIndexF(f)); };\n};\n/**\n * @category constructors\n * @since 2.5.0\n */\nexport var of = _.singleton;\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @example\n * import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3] as RNEA.ReadonlyNonEmptyArray,\n * RNEA.altW(() => ['a', 'b'])\n * ),\n * [1, 2, 3, 'a', 'b']\n * )\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) {\n return function (as) {\n return pipe(as, concatW(that()));\n };\n};\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `ReadonlyNonEmptyArray` concatenates the inputs into a single array.\n *\n * @example\n * import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RNEA.alt(() => [4, 5])\n * ),\n * [1, 2, 3, 4, 5]\n * )\n *\n * @category error handling\n * @since 2.6.2\n */\nexport var alt = altW;\n/**\n * @since 2.5.0\n */\nexport var ap = function (as) { return flatMap(function (f) { return pipe(as, map(f)); }); };\n/**\n * @example\n * import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RNEA.flatMap((n) => [`a${n}`, `b${n}`])\n * ),\n * ['a1', 'b1', 'a2', 'b2', 'a3', 'b3']\n * )\n *\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) {\n return pipe(ma, chainWithIndex(function (i, a) { return f(a, i); }));\n});\n/**\n * @since 2.5.0\n */\nexport var extend = function (f) {\n return function (as) {\n var next = tail(as);\n var out = [f(as)];\n while (isNonEmpty(next)) {\n out.push(f(next));\n next = tail(next);\n }\n return out;\n };\n};\n/**\n * @since 2.5.0\n */\nexport var duplicate = \n/*#__PURE__*/ extend(identity);\n/**\n * @category sequencing\n * @since 2.5.0\n */\nexport var flatten = \n/*#__PURE__*/ flatMap(identity);\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types\n * use the type constructor `F` to represent some computational context.\n *\n * @category mapping\n * @since 2.5.0\n */\nexport var map = function (f) {\n return mapWithIndex(function (_, a) { return f(a); });\n};\n/**\n * @category mapping\n * @since 2.5.0\n */\nexport var mapWithIndex = function (f) {\n return function (as) {\n var out = [f(0, head(as))];\n for (var i = 1; i < as.length; i++) {\n out.push(f(i, as[i]));\n }\n return out;\n };\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduce = function (b, f) {\n return reduceWithIndex(b, function (_, b, a) { return f(b, a); });\n};\n/**\n * **Note**. The constraint is relaxed: a `Semigroup` instead of a `Monoid`.\n *\n * @category folding\n * @since 2.5.0\n */\nexport var foldMap = function (S) {\n return function (f) {\n return function (as) {\n return as.slice(1).reduce(function (s, a) { return S.concat(s, f(a)); }, f(as[0]));\n };\n };\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceRight = function (b, f) {\n return reduceRightWithIndex(b, function (_, b, a) { return f(b, a); });\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceWithIndex = function (b, f) {\n return function (as) {\n return as.reduce(function (b, a, i) { return f(i, b, a); }, b);\n };\n};\n/**\n * **Note**. The constraint is relaxed: a `Semigroup` instead of a `Monoid`.\n *\n * @category folding\n * @since 2.5.0\n */\nexport var foldMapWithIndex = function (S) {\n return function (f) {\n return function (as) {\n return as.slice(1).reduce(function (s, a, i) { return S.concat(s, f(i + 1, a)); }, f(0, as[0]));\n };\n };\n};\n/**\n * @category folding\n * @since 2.5.0\n */\nexport var reduceRightWithIndex = function (b, f) {\n return function (as) {\n return as.reduceRight(function (b, a, i) { return f(i, a, b); }, b);\n };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n var traverseWithIndexF = traverseWithIndex(F);\n return function (f) { return traverseWithIndexF(function (_, a) { return f(a); }); };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) { return traverseWithIndex(F)(SK); };\n/**\n * @category sequencing\n * @since 2.6.3\n */\nexport var traverseWithIndex = function (F) {\n return function (f) {\n return function (as) {\n var out = F.map(f(0, head(as)), of);\n for (var i = 1; i < as.length; i++) {\n out = F.ap(F.map(out, function (bs) { return function (b) { return pipe(bs, append(b)); }; }), f(i, as[i]));\n }\n return out;\n };\n };\n};\n/**\n * @category Comonad\n * @since 2.6.3\n */\nexport var extract = _.head;\n/**\n * @category type lambdas\n * @since 2.5.0\n */\nexport var URI = 'ReadonlyNonEmptyArray';\n/**\n * @category instances\n * @since 2.5.0\n */\nexport var getShow = function (S) { return ({\n show: function (as) { return \"[\".concat(as.map(S.show).join(', '), \"]\"); }\n}); };\n/**\n * Builds a `Semigroup` instance for `ReadonlyNonEmptyArray`\n *\n * @category instances\n * @since 2.5.0\n */\nexport var getSemigroup = function () { return ({\n concat: concat\n}); };\n/**\n * @example\n * import { getEq } from 'fp-ts/ReadonlyNonEmptyArray'\n * import * as N from 'fp-ts/number'\n *\n * const E = getEq(N.Eq)\n * assert.strictEqual(E.equals([1, 2], [1, 2]), true)\n * assert.strictEqual(E.equals([1, 2], [1, 3]), false)\n *\n * @category instances\n * @since 2.5.0\n */\nexport var getEq = function (E) {\n return fromEquals(function (xs, ys) { return xs.length === ys.length && xs.every(function (x, i) { return E.equals(x, ys[i]); }); });\n};\n/**\n * @since 2.11.0\n */\nexport var getUnionSemigroup = function (E) {\n var unionE = union(E);\n return {\n concat: function (first, second) { return unionE(second)(first); }\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FunctorWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.5.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.5.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * [1, 2, 3],\n * RA.chainFirst(() => ['a', 'b'])\n * ),\n * [1, 1, 2, 2, 3, 3]\n * )\n *\n * @category sequencing\n * @since 2.5.0\n */\nexport var chainFirst = /*#__PURE__*/ chainFirst_(Chain);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var FoldableWithIndex = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var TraversableWithIndex = {\n URI: URI,\n map: _map,\n mapWithIndex: _mapWithIndex,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Comonad = {\n URI: URI,\n map: _map,\n extend: _extend,\n extract: extract\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ bind_(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.5.0\n */\nexport var head = extract;\n/**\n * @since 2.5.0\n */\nexport var tail = _.tail;\n/**\n * @since 2.5.0\n */\nexport var last = function (as) { return as[as.length - 1]; };\n/**\n * Get all but the last element of a non empty array, creating a new array.\n *\n * @example\n * import { init } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(init([1, 2, 3]), [1, 2])\n * assert.deepStrictEqual(init([1]), [])\n *\n * @since 2.5.0\n */\nexport var init = function (as) { return as.slice(0, -1); };\n/**\n * @since 2.5.0\n */\nexport var min = function (O) {\n var S = Se.min(O);\n return function (as) { return as.reduce(S.concat); };\n};\n/**\n * @since 2.5.0\n */\nexport var max = function (O) {\n var S = Se.max(O);\n return function (as) { return as.reduce(S.concat); };\n};\n/**\n * @since 2.10.0\n */\nexport var concatAll = function (S) {\n return function (as) {\n return as.reduce(S.concat);\n };\n};\n/**\n * Break a `ReadonlyArray` into its first element and remaining elements.\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchLeft = function (f) {\n return function (as) {\n return f(head(as), tail(as));\n };\n};\n/**\n * Break a `ReadonlyArray` into its initial elements and the last element.\n *\n * @category pattern matching\n * @since 2.11.0\n */\nexport var matchRight = function (f) {\n return function (as) {\n return f(init(as), last(as));\n };\n};\n/**\n * Apply a function to the head, creating a new `ReadonlyNonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var modifyHead = function (f) {\n return function (as) {\n return __spreadArray([f(head(as))], tail(as), true);\n };\n};\n/**\n * Change the head, creating a new `ReadonlyNonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var updateHead = function (a) { return modifyHead(function () { return a; }); };\n/**\n * Apply a function to the last element, creating a new `ReadonlyNonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var modifyLast = function (f) {\n return function (as) {\n return pipe(init(as), append(f(last(as))));\n };\n};\n/**\n * Change the last element, creating a new `ReadonlyNonEmptyArray`.\n *\n * @since 2.11.0\n */\nexport var updateLast = function (a) { return modifyLast(function () { return a; }); };\n/**\n * Places an element in between members of a `ReadonlyNonEmptyArray`, then folds the results using the provided `Semigroup`.\n *\n * @example\n * import * as S from 'fp-ts/string'\n * import { intercalate } from 'fp-ts/ReadonlyNonEmptyArray'\n *\n * assert.deepStrictEqual(intercalate(S.Semigroup)('-')(['a', 'b', 'c']), 'a-b-c')\n *\n * @since 2.12.0\n */\nexport var intercalate = function (S) {\n var concatAllS = concatAll(S);\n return function (middle) { return flow(intersperse(middle), concatAllS); };\n};\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.5.0\n */\nexport var chain = flatMap;\nexport function groupSort(O) {\n var sortO = sort(O);\n var groupO = group(O);\n return function (as) { return (isNonEmpty(as) ? groupO(sortO(as)) : empty); };\n}\nexport function filter(predicate) {\n return filterWithIndex(function (_, a) { return predicate(a); });\n}\n/**\n * Use [`filterWithIndex`](./ReadonlyArray.ts.html#filterwithindex) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var filterWithIndex = function (predicate) {\n return function (as) {\n return fromReadonlyArray(as.filter(function (a, i) { return predicate(i, a); }));\n };\n};\n/**\n * Use [`unprepend`](#unprepend) instead.\n *\n * @category zone of death\n * @since 2.10.0\n * @deprecated\n */\nexport var uncons = unprepend;\n/**\n * Use [`unappend`](#unappend) instead.\n *\n * @category zone of death\n * @since 2.10.0\n * @deprecated\n */\nexport var unsnoc = unappend;\nexport function cons(head, tail) {\n return tail === undefined ? prepend(head) : pipe(tail, prepend(head));\n}\n/**\n * Use [`append`](./ReadonlyArray.ts.html#append) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var snoc = function (init, end) { return pipe(init, concat([end])); };\n/**\n * Use [`insertAt`](./ReadonlyArray.ts.html#insertat) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var insertAt = function (i, a) {\n return function (as) {\n return i < 0 || i > as.length ? _.none : _.some(unsafeInsertAt(i, a, as));\n };\n};\n/**\n * Use [`prependAll`](#prependall) instead.\n *\n * @category zone of death\n * @since 2.9.0\n * @deprecated\n */\nexport var prependToAll = prependAll;\n/**\n * Use [`concatAll`](#concatall) instead.\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var fold = concatAll;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `RNEA.Functor` instead of `RNEA.readonlyNonEmptyArray`\n * (where `RNEA` is from `import RNEA from 'fp-ts/ReadonlyNonEmptyArray'`)\n *\n * @category zone of death\n * @since 2.5.0\n * @deprecated\n */\nexport var readonlyNonEmptyArray = {\n URI: URI,\n of: of,\n map: _map,\n mapWithIndex: _mapWithIndex,\n ap: _ap,\n chain: flatMap,\n extend: _extend,\n extract: extract,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n reduceWithIndex: _reduceWithIndex,\n foldMapWithIndex: _foldMapWithIndex,\n reduceRightWithIndex: _reduceRightWithIndex,\n traverseWithIndex: _traverseWithIndex,\n alt: _alt\n};\n"],"names":["reverse","M","concat","first","second","concatAll","startWith","as","reduce","a","acc","__spreadArray","to","from","pack","arguments","length","ar","i","l","Array","prototype","slice","call","isNonEmpty","isOutOfBound","prependW","head","tail","prepend","appendW","end","init","append","unsafeInsertAt","xs","fromReadonlyNonEmptyArray","splice","_","range","start","f","n","j","Math","max","floor","out","push","of","cons","undefined","pipe","RNEA","snoc","none","some","_map","fa","map","URI","isNone","value","Functor","ap","dual","as_","asUnit_","fab","Chain","chain","ma","FromEither","self","that","identity","fromEither","_tag","right","isSome","fromNullable","chainable","tapEither_","equalsDefault","compare","fromCompare","equals","min","constTrue","O","eqStrict","not","predicate","lookup","last","findIndex","findFirstMap","findLastMap","findLastIndex","elem","E","elemE_1","element","_chainRecDepthFirst","chainRecDepthFirst","_chainRecBreadthFirst","chainRecBreadthFirst","foldMapWithIndex","b","empty","reduceWithIndex","foldMap","foldMapWithIndexM","len","reduceRight","reduceRightWithIndex","getShow","S","show","join","getEq","fromEquals","ys","every","x","getOrd","aLen","bLen","ordering","N","todo","e","shift","unshift","apply","left","initial","go","forEach","v","_i","initial_1","intercalate","intercalateM","middle","onEmpty","onNonEmpty","s","extract","Se","concatAllS","flow","rest","prependAll","intersperse","y"],"sourceRoot":""}