declare const SignatureSaveMode: { readonly ALWAYS: "ALWAYS"; readonly NEVER: "NEVER"; readonly USING_UI: "USING_UI"; }; type ISignatureSaveMode = (typeof SignatureSaveMode)[keyof typeof SignatureSaveMode]; /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Immutable data encourages pure functions (data-in, data-out) and lends itself * to much simpler application development and enabling techniques from * functional programming such as lazy evaluation. * * While designed to bring these powerful functional concepts to JavaScript, it * presents an Object-Oriented API familiar to Javascript engineers and closely * mirroring that of Array, Map, and Set. It is easy and efficient to convert to * and from plain Javascript types. * * ## How to read these docs * * In order to better explain what kinds of values the Immutable.js API expects * and produces, this documentation is presented in a statically typed dialect of * JavaScript (like [Flow][] or [TypeScript][]). You *don't need* to use these * type checking tools in order to use Immutable.js, however becoming familiar * with their syntax will help you get a deeper understanding of this API. * * **A few examples and how to read them.** * * All methods describe the kinds of data they accept and the kinds of data * they return. For example a function which accepts two numbers and returns * a number would look like this: * * ```js * sum(first: number, second: number): number * ``` * * Sometimes, methods can accept different kinds of data or return different * kinds of data, and this is described with a *type variable*, which is * typically in all-caps. For example, a function which always returns the same * kind of data it was provided would look like this: * * ```js * identity(value: T): T * ``` * * Type variables are defined with classes and referred to in methods. For * example, a class that holds onto a value for you might look like this: * * ```js * class Box { * constructor(value: T) * getValue(): T * } * ``` * * In order to manipulate Immutable data, methods that we're used to affecting * a Collection instead return a new Collection of the same type. The type * `this` refers to the same kind of class. For example, a List which returns * new Lists when you `push` a value onto it might look like: * * ```js * class List { * push(value: T): this * } * ``` * * Many methods in Immutable.js accept values which implement the JavaScript * [Iterable][] protocol, and might appear like `Iterable` for something * which represents sequence of strings. Typically in JavaScript we use plain * Arrays (`[]`) when an Iterable is expected, but also all of the Immutable.js * collections are iterable themselves! * * For example, to get a value deep within a structure of data, we might use * `getIn` which expects an `Iterable` path: * * ``` * getIn(path: Iterable): any * ``` * * To use this method, we could pass an array: `data.getIn([ "key", 2 ])`. * * * Note: All examples are presented in the modern [ES2015][] version of * JavaScript. Use tools like Babel to support older browsers. * * For example: * * ```js * // ES2015 * const mappedFoo = foo.map(x => x * x); * // ES5 * var mappedFoo = foo.map(function (x) { return x * x; }); * ``` * * [ES2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla * [TypeScript]: http://www.typescriptlang.org/ * [Flow]: https://flowtype.org/ * [Iterable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols */ /** * Lists are ordered indexed dense collections, much like a JavaScript * Array. * * Lists are immutable and fully persistent with O(log32 N) gets and sets, * and O(1) push and pop. * * Lists implement Deque, with efficient addition and removal from both the * end (`push`, `pop`) and beginning (`unshift`, `shift`). * * Unlike a JavaScript Array, there is no distinction between an * "unset" index and an index set to `undefined`. `List#forEach` visits all * indices from 0 to size, regardless of whether they were explicitly defined. */ declare module List { /** * True if the provided value is a List * * * ```js * const { List } = require('immutable'); * List.isList([]); // false * List.isList(List()); // true * ``` */ function isList(maybeList: any): maybeList is List; /** * Creates a new List containing `values`. * * * ```js * const { List } = require('immutable'); * List.of(1, 2, 3, 4) * // List [ 1, 2, 3, 4 ] * ``` * * Note: Values are not altered or converted in any way. * * * ```js * const { List } = require('immutable'); * List.of({x:1}, 2, [3], 4) * // List [ { x: 1 }, 2, [ 3 ], 4 ] * ``` */ function of(...values: Array): List; } /** * Create a new immutable List containing the values of the provided * collection-like. * * Note: `List` is a factory function and not a class, and does not use the * `new` keyword during construction. * * * ```js * const { List, Set } = require('immutable') * * const emptyList = List() * // List [] * * const plainArray = [ 1, 2, 3, 4 ] * const listFromPlainArray = List(plainArray) * // List [ 1, 2, 3, 4 ] * * const plainSet = Set([ 1, 2, 3, 4 ]) * const listFromPlainSet = List(plainSet) * // List [ 1, 2, 3, 4 ] * * const arrayIterator = plainArray[Symbol.iterator]() * const listFromCollectionArray = List(arrayIterator) * // List [ 1, 2, 3, 4 ] * * listFromPlainArray.equals(listFromCollectionArray) // true * listFromPlainSet.equals(listFromCollectionArray) // true * listFromPlainSet.equals(listFromPlainArray) // true * ``` */ declare function List(): List; declare function List(): List; declare function List(collection: Iterable): List; interface List extends Collection.Indexed { /** * The number of items in this List. */ readonly size: number; // Persistent changes /** * Returns a new List which includes `value` at `index`. If `index` already * exists in this List, it will be replaced. * * `index` may be a negative number, which indexes back from the end of the * List. `v.set(-1, "value")` sets the last item in the List. * * If `index` larger than `size`, the returned List's `size` will be large * enough to include the `index`. * * * ```js * const originalList = List([ 0 ]); * // List [ 0 ] * originalList.set(1, 1); * // List [ 0, 1 ] * originalList.set(0, 'overwritten'); * // List [ "overwritten" ] * originalList.set(2, 2); * // List [ 0, undefined, 2 ] * * List().set(50000, 'value').size; * // 50001 * ``` * * Note: `set` can be used in `withMutations`. */ set(index: number, value: T): List; /** * Returns a new List which excludes this `index` and with a size 1 less * than this List. Values at indices above `index` are shifted down by 1 to * fill the position. * * This is synonymous with `list.splice(index, 1)`. * * `index` may be a negative number, which indexes back from the end of the * List. `v.delete(-1)` deletes the last item in the List. * * Note: `delete` cannot be safely used in IE8 * * * ```js * List([ 0, 1, 2, 3, 4 ]).delete(0); * // List [ 1, 2, 3, 4 ] * ``` * * Since `delete()` re-indexes values, it produces a complete copy, which * has `O(N)` complexity. * * Note: `delete` *cannot* be used in `withMutations`. * * @alias remove */ delete(index: number): List; remove(index: number): List; /** * Returns a new List with `value` at `index` with a size 1 more than this * List. Values at indices above `index` are shifted over by 1. * * This is synonymous with `list.splice(index, 0, value)`. * * * ```js * List([ 0, 1, 2, 3, 4 ]).insert(6, 5) * // List [ 0, 1, 2, 3, 4, 5 ] * ``` * * Since `insert()` re-indexes values, it produces a complete copy, which * has `O(N)` complexity. * * Note: `insert` *cannot* be used in `withMutations`. */ insert(index: number, value: T): List; /** * Returns a new List with 0 size and no values in constant time. * * * ```js * List([ 1, 2, 3, 4 ]).clear() * // List [] * ``` * * Note: `clear` can be used in `withMutations`. */ clear(): List; /** * Returns a new List with the provided `values` appended, starting at this * List's `size`. * * * ```js * List([ 1, 2, 3, 4 ]).push(5) * // List [ 1, 2, 3, 4, 5 ] * ``` * * Note: `push` can be used in `withMutations`. */ push(...values: Array): List; /** * Returns a new List with a size ones less than this List, excluding * the last index in this List. * * Note: this differs from `Array#pop` because it returns a new * List rather than the removed value. Use `last()` to get the last value * in this List. * * ```js * List([ 1, 2, 3, 4 ]).pop() * // List[ 1, 2, 3 ] * ``` * * Note: `pop` can be used in `withMutations`. */ pop(): List; /** * Returns a new List with the provided `values` prepended, shifting other * values ahead to higher indices. * * * ```js * List([ 2, 3, 4]).unshift(1); * // List [ 1, 2, 3, 4 ] * ``` * * Note: `unshift` can be used in `withMutations`. */ unshift(...values: Array): List; /** * Returns a new List with a size ones less than this List, excluding * the first index in this List, shifting all other values to a lower index. * * Note: this differs from `Array#shift` because it returns a new * List rather than the removed value. Use `first()` to get the first * value in this List. * * * ```js * List([ 0, 1, 2, 3, 4 ]).shift(); * // List [ 1, 2, 3, 4 ] * ``` * * Note: `shift` can be used in `withMutations`. */ shift(): List; /** * Returns a new List with an updated value at `index` with the return * value of calling `updater` with the existing value, or `notSetValue` if * `index` was not set. If called with a single argument, `updater` is * called with the List itself. * * `index` may be a negative number, which indexes back from the end of the * List. `v.update(-1)` updates the last item in the List. * * * ```js * const list = List([ 'a', 'b', 'c' ]) * const result = list.update(2, val => val.toUpperCase()) * // List [ "a", "b", "C" ] * ``` * * This can be very useful as a way to "chain" a normal function into a * sequence of methods. RxJS calls this "let" and lodash calls it "thru". * * For example, to sum a List after mapping and filtering: * * * ```js * function sum(collection) { * return collection.reduce((sum, x) => sum + x, 0) * } * * List([ 1, 2, 3 ]) * .map(x => x + 1) * .filter(x => x % 2 === 0) * .update(sum) * // 6 * ``` * * Note: `update(index)` can be used in `withMutations`. * * @see `Map#update` */ update(index: number, notSetValue: T, updater: (value: T) => T): this; update(index: number, updater: (value: T) => T): this; update(updater: (value: this) => R): R; /** * Returns a new List with size `size`. If `size` is less than this * List's size, the new List will exclude values at the higher indices. * If `size` is greater than this List's size, the new List will have * undefined values for the newly available indices. * * When building a new List and the final size is known up front, `setSize` * used in conjunction with `withMutations` may result in the more * performant construction. */ setSize(size: number): List; // Deep persistent changes /** * Returns a new List having set `value` at this `keyPath`. If any keys in * `keyPath` do not exist, a new immutable Map will be created at that key. * * Index numbers are used as keys to determine the path to follow in * the List. * * * ```js * const { List } = require('immutable') * const list = List([ 0, 1, 2, List([ 3, 4 ])]) * list.setIn([3, 0], 999); * // List [ 0, 1, 2, List [ 999, 4 ] ] * ``` * * Plain JavaScript Object or Arrays may be nested within an Immutable.js * Collection, and setIn() can update those values as well, treating them * immutably by creating new copies of those values with the changes applied. * * * ```js * const { List } = require('immutable') * const list = List([ 0, 1, 2, { plain: 'object' }]) * list.setIn([3, 'plain'], 'value'); * // List([ 0, 1, 2, { plain: 'value' }]) * ``` * * Note: `setIn` can be used in `withMutations`. */ setIn(keyPath: Iterable, value: any): this; /** * Returns a new List having removed the value at this `keyPath`. If any * keys in `keyPath` do not exist, no change will occur. * * * ```js * const { List } = require('immutable') * const list = List([ 0, 1, 2, List([ 3, 4 ])]) * list.deleteIn([3, 0]); * // List [ 0, 1, 2, List [ 4 ] ] * ``` * * Plain JavaScript Object or Arrays may be nested within an Immutable.js * Collection, and removeIn() can update those values as well, treating them * immutably by creating new copies of those values with the changes applied. * * * ```js * const { List } = require('immutable') * const list = List([ 0, 1, 2, { plain: 'object' }]) * list.removeIn([3, 'plain']); * // List([ 0, 1, 2, {}]) * ``` * * Note: `deleteIn` *cannot* be safely used in `withMutations`. * * @alias removeIn */ deleteIn(keyPath: Iterable): this; removeIn(keyPath: Iterable): this; /** * Note: `updateIn` can be used in `withMutations`. * * @see `Map#updateIn` */ updateIn(keyPath: Iterable, notSetValue: any, updater: (value: any) => any): this; updateIn(keyPath: Iterable, updater: (value: any) => any): this; /** * Note: `mergeIn` can be used in `withMutations`. * * @see `Map#mergeIn` */ mergeIn(keyPath: Iterable, ...collections: Array): this; /** * Note: `mergeDeepIn` can be used in `withMutations`. * * @see `Map#mergeDeepIn` */ mergeDeepIn(keyPath: Iterable, ...collections: Array): this; // Transient changes /** * Note: Not all methods can be safely used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * allows being used in `withMutations`. * * @see `Map#withMutations` */ withMutations(mutator: (mutable: this) => any): this; /** * An alternative API for withMutations() * * Note: Not all methods can be safely used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * allows being used in `withMutations`. * * @see `Map#asMutable` */ asMutable(): this; /** * @see `Map#wasAltered` */ wasAltered(): boolean; /** * @see `Map#asImmutable` */ asImmutable(): this; // Sequence algorithms /** * Returns a new List with other values or collections concatenated to this one. * * Note: `concat` can be used in `withMutations`. * * @alias merge */ concat(...valuesOrCollections: Array | C>): List; merge(...collections: Array>): List; /** * Returns a new List with values passed through a * `mapper` function. * * * ```js * List([ 1, 2 ]).map(x => 10 * x) * // List [ 10, 20 ] * ``` */ map( mapper: (value: T, key: number, iter: this) => M, context?: any ): List; /** * Flat-maps the List, returning a new List. * * Similar to `list.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: number, iter: this) => Iterable, context?: any ): List; /** * Returns a new List with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, index: number, iter: this) => value is F, context?: any ): List; filter( predicate: (value: T, index: number, iter: this) => any, context?: any ): this; /** * Returns a List "zipped" with the provided collection. * * Like `zipWith`, but using the default `zipper`: creating an `Array`. * * * ```js * const a = List([ 1, 2, 3 ]); * const b = List([ 4, 5, 6 ]); * const c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] * ``` */ zip(other: Collection): List<[T, U]>; zip(other: Collection, other2: Collection): List<[T, U, V]>; zip(...collections: Array>): List; /** * Returns a List "zipped" with the provided collections. * * Unlike `zip`, `zipAll` continues zipping until the longest collection is * exhausted. Missing values from shorter collections are filled with `undefined`. * * * ```js * const a = List([ 1, 2 ]); * const b = List([ 3, 4, 5 ]); * const c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] * ``` * * Note: Since zipAll will return a collection as large as the largest * input, some results may contain undefined values. TypeScript cannot * account for these without cases (as of v2.5). */ zipAll(other: Collection): List<[T, U]>; zipAll(other: Collection, other2: Collection): List<[T, U, V]>; zipAll(...collections: Array>): List; /** * Returns a List "zipped" with the provided collections by using a * custom `zipper` function. * * * ```js * const a = List([ 1, 2, 3 ]); * const b = List([ 4, 5, 6 ]); * const c = a.zipWith((a, b) => a + b, b); * // List [ 5, 7, 9 ] * ``` */ zipWith( zipper: (value: T, otherValue: U) => Z, otherCollection: Collection ): List; zipWith( zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection ): List; zipWith( zipper: (...any: Array) => Z, ...collections: Array> ): List; } /** * Immutable Map is an unordered Collection.Keyed of (key, value) pairs with * `O(log32 N)` gets and `O(log32 N)` persistent sets. * * Iteration order of a Map is undefined, however is stable. Multiple * iterations of the same Map will iterate in the same order. * * Map's keys can be of any type, and use `Immutable.is` to determine key * equality. This allows the use of any value (including NaN) as a key. * * Because `Immutable.is` returns equality based on value semantics, and * Immutable collections are treated as values, any Immutable collection may * be used as a key. * * * ```js * const { Map, List } = require('immutable'); * Map().set(List([ 1 ]), 'listofone').get(List([ 1 ])); * // 'listofone' * ``` * * Any JavaScript object may be used as a key, however strict identity is used * to evaluate key equality. Two similar looking objects will represent two * different keys. * * Implemented by a hash-array mapped trie. */ declare module Map { /** * True if the provided value is a Map * * * ```js * const { Map } = require('immutable') * Map.isMap({}) // false * Map.isMap(Map()) // true * ``` */ function isMap(maybeMap: any): maybeMap is Map; /** * Creates a new Map from alternating keys and values * * * ```js * const { Map } = require('immutable') * Map.of( * 'key', 'value', * 'numerical value', 3, * 0, 'numerical key' * ) * // Map { 0: "numerical key", "key": "value", "numerical value": 3 } * ``` * * @deprecated Use Map([ [ 'k', 'v' ] ]) or Map({ k: 'v' }) */ function of(...keyValues: Array): Map; } /** * Creates a new Immutable Map. * * Created with the same key value pairs as the provided Collection.Keyed or * JavaScript Object or expects a Collection of [K, V] tuple entries. * * Note: `Map` is a factory function and not a class, and does not use the * `new` keyword during construction. * * * ```js * const { Map } = require('immutable') * Map({ key: "value" }) * Map([ [ "key", "value" ] ]) * ``` * * Keep in mind, when using JS objects to construct Immutable Maps, that * JavaScript Object properties are always strings, even if written in a * quote-less shorthand, while Immutable Maps accept keys of any type. * * * ```js * let obj = { 1: "one" } * Object.keys(obj) // [ "1" ] * assert.equal(obj["1"], obj[1]) // "one" === "one" * * let map = Map(obj) * assert.notEqual(map.get("1"), map.get(1)) // "one" !== undefined * ``` * * Property access for JavaScript Objects first converts the key to a string, * but since Immutable Map keys can be of any type the argument to `get()` is * not altered. */ declare function Map(collection: Iterable<[K, V]>): Map; declare function Map(collection: Iterable>): Map; declare function Map(obj: { [key: string]: V }): Map; declare function Map(): Map; declare function Map(): Map; interface Map extends Collection.Keyed { /** * The number of entries in this Map. */ readonly size: number; // Persistent changes /** * Returns a new Map also containing the new key, value pair. If an equivalent * key already exists in this Map, it will be replaced. * * * ```js * const { Map } = require('immutable') * const originalMap = Map() * const newerMap = originalMap.set('key', 'value') * const newestMap = newerMap.set('key', 'newer value') * * originalMap * // Map {} * newerMap * // Map { "key": "value" } * newestMap * // Map { "key": "newer value" } * ``` * * Note: `set` can be used in `withMutations`. */ set(key: K, value: V): this; /** * Returns a new Map which excludes this `key`. * * Note: `delete` cannot be safely used in IE8, but is provided to mirror * the ES6 collection API. * * * ```js * const { Map } = require('immutable') * const originalMap = Map({ * key: 'value', * otherKey: 'other value' * }) * // Map { "key": "value", "otherKey": "other value" } * originalMap.delete('otherKey') * // Map { "key": "value" } * ``` * * Note: `delete` can be used in `withMutations`. * * @alias remove */ delete(key: K): this; remove(key: K): this; /** * Returns a new Map which excludes the provided `keys`. * * * ```js * const { Map } = require('immutable') * const names = Map({ a: "Aaron", b: "Barry", c: "Connor" }) * names.deleteAll([ 'a', 'c' ]) * // Map { "b": "Barry" } * ``` * * Note: `deleteAll` can be used in `withMutations`. * * @alias removeAll */ deleteAll(keys: Iterable): this; removeAll(keys: Iterable): this; /** * Returns a new Map containing no keys or values. * * * ```js * const { Map } = require('immutable') * Map({ key: 'value' }).clear() * // Map {} * ``` * * Note: `clear` can be used in `withMutations`. */ clear(): this; /** * Returns a new Map having updated the value at this `key` with the return * value of calling `updater` with the existing value. * * Similar to: `map.set(key, updater(map.get(key)))`. * * * ```js * const { Map } = require('immutable') * const aMap = Map({ key: 'value' }) * const newMap = aMap.update('key', value => value + value) * // Map { "key": "valuevalue" } * ``` * * This is most commonly used to call methods on collections within a * structure of data. For example, in order to `.push()` onto a nested `List`, * `update` and `push` can be used together: * * * ```js * const aMap = Map({ nestedList: List([ 1, 2, 3 ]) }) * const newMap = aMap.update('nestedList', list => list.push(4)) * // Map { "nestedList": List [ 1, 2, 3, 4 ] } * ``` * * When a `notSetValue` is provided, it is provided to the `updater` * function when the value at the key does not exist in the Map. * * * ```js * const aMap = Map({ key: 'value' }) * const newMap = aMap.update('noKey', 'no value', value => value + value) * // Map { "key": "value", "noKey": "no valueno value" } * ``` * * However, if the `updater` function returns the same value it was called * with, then no change will occur. This is still true if `notSetValue` * is provided. * * * ```js * const aMap = Map({ apples: 10 }) * const newMap = aMap.update('oranges', 0, val => val) * // Map { "apples": 10 } * assert.strictEqual(newMap, map); * ``` * * For code using ES2015 or later, using `notSetValue` is discourged in * favor of function parameter default values. This helps to avoid any * potential confusion with identify functions as described above. * * The previous example behaves differently when written with default values: * * * ```js * const aMap = Map({ apples: 10 }) * const newMap = aMap.update('oranges', (val = 0) => val) * // Map { "apples": 10, "oranges": 0 } * ``` * * If no key is provided, then the `updater` function return value is * returned as well. * * * ```js * const aMap = Map({ key: 'value' }) * const result = aMap.update(aMap => aMap.get('key')) * // "value" * ``` * * This can be very useful as a way to "chain" a normal function into a * sequence of methods. RxJS calls this "let" and lodash calls it "thru". * * For example, to sum the values in a Map * * * ```js * function sum(collection) { * return collection.reduce((sum, x) => sum + x, 0) * } * * Map({ x: 1, y: 2, z: 3 }) * .map(x => x + 1) * .filter(x => x % 2 === 0) * .update(sum) * // 6 * ``` * * Note: `update(key)` can be used in `withMutations`. */ update(key: K, notSetValue: V, updater: (value: V) => V): this; update(key: K, updater: (value: V) => V): this; update(updater: (value: this) => R): R; /** * Returns a new Map resulting from merging the provided Collections * (or JS objects) into this Map. In other words, this takes each entry of * each collection and sets it on this Map. * * Note: Values provided to `merge` are shallowly converted before being * merged. No nested values are altered. * * * ```js * const { Map } = require('immutable') * const one = Map({ a: 10, b: 20, c: 30 }) * const two = Map({ b: 40, a: 50, d: 60 }) * one.merge(two) // Map { "a": 50, "b": 40, "c": 30, "d": 60 } * two.merge(one) // Map { "b": 20, "a": 10, "d": 60, "c": 30 } * ``` * * Note: `merge` can be used in `withMutations`. * * @alias concat */ merge(...collections: Array>): Map; merge(...collections: Array<{ [key: string]: C }>): Map; concat(...collections: Array>): Map; concat(...collections: Array<{ [key: string]: C }>): Map; /** * Like `merge()`, `mergeWith()` returns a new Map resulting from merging * the provided Collections (or JS objects) into this Map, but uses the * `merger` function for dealing with conflicts. * * * ```js * const { Map } = require('immutable') * const one = Map({ a: 10, b: 20, c: 30 }) * const two = Map({ b: 40, a: 50, d: 60 }) * one.mergeWith((oldVal, newVal) => oldVal / newVal, two) * // { "a": 0.2, "b": 0.5, "c": 30, "d": 60 } * two.mergeWith((oldVal, newVal) => oldVal / newVal, one) * // { "b": 2, "a": 5, "d": 60, "c": 30 } * ``` * * Note: `mergeWith` can be used in `withMutations`. */ mergeWith( merger: (oldVal: V, newVal: V, key: K) => V, ...collections: Array | { [key: string]: V }> ): this; /** * Like `merge()`, but when two Collections conflict, it merges them as well, * recursing deeply through the nested data. * * Note: Values provided to `merge` are shallowly converted before being * merged. No nested values are altered unless they will also be merged at * a deeper level. * * * ```js * const { Map } = require('immutable') * const one = Map({ a: Map({ x: 10, y: 10 }), b: Map({ x: 20, y: 50 }) }) * const two = Map({ a: Map({ x: 2 }), b: Map({ y: 5 }), c: Map({ z: 3 }) }) * one.mergeDeep(two) * // Map { * // "a": Map { "x": 2, "y": 10 }, * // "b": Map { "x": 20, "y": 5 }, * // "c": Map { "z": 3 } * // } * ``` * * Note: `mergeDeep` can be used in `withMutations`. */ mergeDeep(...collections: Array | { [key: string]: V }>): this; /** * Like `mergeDeep()`, but when two non-Collections conflict, it uses the * `merger` function to determine the resulting value. * * * ```js * const { Map } = require('immutable') * const one = Map({ a: Map({ x: 10, y: 10 }), b: Map({ x: 20, y: 50 }) }) * const two = Map({ a: Map({ x: 2 }), b: Map({ y: 5 }), c: Map({ z: 3 }) }) * one.mergeDeepWith((oldVal, newVal) => oldVal / newVal, two) * // Map { * // "a": Map { "x": 5, "y": 10 }, * // "b": Map { "x": 20, "y": 10 }, * // "c": Map { "z": 3 } * // } * ``` * Note: `mergeDeepWith` can be used in `withMutations`. */ mergeDeepWith( merger: (oldVal: any, newVal: any, key: any) => any, ...collections: Array | { [key: string]: V }> ): this; // Deep persistent changes /** * Returns a new Map having set `value` at this `keyPath`. If any keys in * `keyPath` do not exist, a new immutable Map will be created at that key. * * * ```js * const { Map } = require('immutable') * const originalMap = Map({ * subObject: Map({ * subKey: 'subvalue', * subSubObject: Map({ * subSubKey: 'subSubValue' * }) * }) * }) * * const newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!') * // Map { * // "subObject": Map { * // "subKey": "ha ha!", * // "subSubObject": Map { "subSubKey": "subSubValue" } * // } * // } * * const newerMap = originalMap.setIn( * ['subObject', 'subSubObject', 'subSubKey'], * 'ha ha ha!' * ) * // Map { * // "subObject": Map { * // "subKey": "subvalue", * // "subSubObject": Map { "subSubKey": "ha ha ha!" } * // } * // } * ``` * * Plain JavaScript Object or Arrays may be nested within an Immutable.js * Collection, and setIn() can update those values as well, treating them * immutably by creating new copies of those values with the changes applied. * * * ```js * const { Map } = require('immutable') * const originalMap = Map({ * subObject: { * subKey: 'subvalue', * subSubObject: { * subSubKey: 'subSubValue' * } * } * }) * * originalMap.setIn(['subObject', 'subKey'], 'ha ha!') * // Map { * // "subObject": { * // subKey: "ha ha!", * // subSubObject: { subSubKey: "subSubValue" } * // } * // } * ``` * * If any key in the path exists but cannot be updated (such as a primitive * like number or a custom Object like Date), an error will be thrown. * * Note: `setIn` can be used in `withMutations`. */ setIn(keyPath: Iterable, value: any): this; /** * Returns a new Map having removed the value at this `keyPath`. If any keys * in `keyPath` do not exist, no change will occur. * * Note: `deleteIn` can be used in `withMutations`. * * @alias removeIn */ deleteIn(keyPath: Iterable): this; removeIn(keyPath: Iterable): this; /** * Returns a new Map having applied the `updater` to the entry found at the * keyPath. * * This is most commonly used to call methods on collections nested within a * structure of data. For example, in order to `.push()` onto a nested `List`, * `updateIn` and `push` can be used together: * * * ```js * const { Map, List } = require('immutable') * const map = Map({ inMap: Map({ inList: List([ 1, 2, 3 ]) }) }) * const newMap = map.updateIn(['inMap', 'inList'], list => list.push(4)) * // Map { "inMap": Map { "inList": List [ 1, 2, 3, 4 ] } } * ``` * * If any keys in `keyPath` do not exist, new Immutable `Map`s will * be created at those keys. If the `keyPath` does not already contain a * value, the `updater` function will be called with `notSetValue`, if * provided, otherwise `undefined`. * * * ```js * const map = Map({ a: Map({ b: Map({ c: 10 }) }) }) * const newMap = map.updateIn(['a', 'b', 'c'], val => val * 2) * // Map { "a": Map { "b": Map { "c": 20 } } } * ``` * * If the `updater` function returns the same value it was called with, then * no change will occur. This is still true if `notSetValue` is provided. * * * ```js * const map = Map({ a: Map({ b: Map({ c: 10 }) }) }) * const newMap = map.updateIn(['a', 'b', 'x'], 100, val => val) * // Map { "a": Map { "b": Map { "c": 10 } } } * assert.strictEqual(newMap, aMap) * ``` * * For code using ES2015 or later, using `notSetValue` is discourged in * favor of function parameter default values. This helps to avoid any * potential confusion with identify functions as described above. * * The previous example behaves differently when written with default values: * * * ```js * const map = Map({ a: Map({ b: Map({ c: 10 }) }) }) * const newMap = map.updateIn(['a', 'b', 'x'], (val = 100) => val) * // Map { "a": Map { "b": Map { "c": 10, "x": 100 } } } * ``` * * Plain JavaScript Object or Arrays may be nested within an Immutable.js * Collection, and updateIn() can update those values as well, treating them * immutably by creating new copies of those values with the changes applied. * * * ```js * const map = Map({ a: { b: { c: 10 } } }) * const newMap = map.updateIn(['a', 'b', 'c'], val => val * 2) * // Map { "a": { b: { c: 20 } } } * ``` * * If any key in the path exists but cannot be updated (such as a primitive * like number or a custom Object like Date), an error will be thrown. * * Note: `updateIn` can be used in `withMutations`. */ updateIn(keyPath: Iterable, notSetValue: any, updater: (value: any) => any): this; updateIn(keyPath: Iterable, updater: (value: any) => any): this; /** * A combination of `updateIn` and `merge`, returning a new Map, but * performing the merge at a point arrived at by following the keyPath. * In other words, these two lines are equivalent: * * ```js * map.updateIn(['a', 'b', 'c'], abc => abc.merge(y)) * map.mergeIn(['a', 'b', 'c'], y) * ``` * * Note: `mergeIn` can be used in `withMutations`. */ mergeIn(keyPath: Iterable, ...collections: Array): this; /** * A combination of `updateIn` and `mergeDeep`, returning a new Map, but * performing the deep merge at a point arrived at by following the keyPath. * In other words, these two lines are equivalent: * * ```js * map.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)) * map.mergeDeepIn(['a', 'b', 'c'], y) * ``` * * Note: `mergeDeepIn` can be used in `withMutations`. */ mergeDeepIn(keyPath: Iterable, ...collections: Array): this; // Transient changes /** * Every time you call one of the above functions, a new immutable Map is * created. If a pure function calls a number of these to produce a final * return value, then a penalty on performance and memory has been paid by * creating all of the intermediate immutable Maps. * * If you need to apply a series of mutations to produce a new immutable * Map, `withMutations()` creates a temporary mutable copy of the Map which * can apply mutations in a highly performant manner. In fact, this is * exactly how complex mutations like `merge` are done. * * As an example, this results in the creation of 2, not 4, new Maps: * * * ```js * const { Map } = require('immutable') * const map1 = Map() * const map2 = map1.withMutations(map => { * map.set('a', 1).set('b', 2).set('c', 3) * }) * assert.equal(map1.size, 0) * assert.equal(map2.size, 3) * ``` * * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Read the documentation for each method to see if it * is safe to use in `withMutations`. */ withMutations(mutator: (mutable: this) => any): this; /** * Another way to avoid creation of intermediate Immutable maps is to create * a mutable copy of this collection. Mutable copies *always* return `this`, * and thus shouldn't be used for equality. Your function should never return * a mutable copy of a collection, only use it internally to create a new * collection. * * If possible, use `withMutations` to work with temporary mutable copies as * it provides an easier to use API and considers many common optimizations. * * Note: if the collection is already mutable, `asMutable` returns itself. * * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Read the documentation for each method to see if it * is safe to use in `withMutations`. * * @see `Map#asImmutable` */ asMutable(): this; /** * Returns true if this is a mutable copy (see `asMutable()`) and mutative * alterations have been applied. * * @see `Map#asMutable` */ wasAltered(): boolean; /** * The yin to `asMutable`'s yang. Because it applies to mutable collections, * this operation is *mutable* and may return itself (though may not * return itself, i.e. if the result is an empty collection). Once * performed, the original mutable copy must no longer be mutated since it * may be the immutable result. * * If possible, use `withMutations` to work with temporary mutable copies as * it provides an easier to use API and considers many common optimizations. * * @see `Map#asMutable` */ asImmutable(): this; // Sequence algorithms /** * Returns a new Map with values passed through a * `mapper` function. * * Map({ a: 1, b: 2 }).map(x => 10 * x) * // Map { a: 10, b: 20 } */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Map; /** * @see Collection.Keyed.mapKeys */ mapKeys( mapper: (key: K, value: V, iter: this) => M, context?: any ): Map; /** * @see Collection.Keyed.mapEntries */ mapEntries( mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], context?: any ): Map; /** * Flat-maps the Map, returning a new Map. * * Similar to `data.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: any ): Map; /** * Returns a new Map with only the entries for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): Map; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; /** * @see Collection.Keyed.flip */ flip(): Map; } /** * A type of Map that has the additional guarantee that the iteration order of * entries will be the order in which they were set(). * * The iteration behavior of OrderedMap is the same as native ES6 Map and * JavaScript Object. * * Note that `OrderedMap` are more expensive than non-ordered `Map` and may * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not * stable. */ declare module OrderedMap { /** * True if the provided value is an OrderedMap. */ function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap; } /** * Creates a new Immutable OrderedMap. * * Created with the same key value pairs as the provided Collection.Keyed or * JavaScript Object or expects a Collection of [K, V] tuple entries. * * The iteration order of key-value pairs provided to this constructor will * be preserved in the OrderedMap. * * let newOrderedMap = OrderedMap({key: "value"}) * let newOrderedMap = OrderedMap([["key", "value"]]) * * Note: `OrderedMap` is a factory function and not a class, and does not use * the `new` keyword during construction. */ declare function OrderedMap(collection: Iterable<[K, V]>): OrderedMap; declare function OrderedMap(collection: Iterable>): OrderedMap; declare function OrderedMap(obj: { [key: string]: V }): OrderedMap; declare function OrderedMap(): OrderedMap; declare function OrderedMap(): OrderedMap; interface OrderedMap extends Map { /** * The number of entries in this OrderedMap. */ readonly size: number; /** * Returns a new OrderedMap also containing the new key, value pair. If an * equivalent key already exists in this OrderedMap, it will be replaced * while maintaining the existing order. * * * ```js * const { OrderedMap } = require('immutable') * const originalMap = OrderedMap({a:1, b:1, c:1}) * const updatedMap = originalMap.set('b', 2) * * originalMap * // OrderedMap {a: 1, b: 1, c: 1} * updatedMap * // OrderedMap {a: 1, b: 2, c: 1} * ``` * * Note: `set` can be used in `withMutations`. */ set(key: K, value: V): this; /** * Returns a new OrderedMap resulting from merging the provided Collections * (or JS objects) into this OrderedMap. In other words, this takes each * entry of each collection and sets it on this OrderedMap. * * Note: Values provided to `merge` are shallowly converted before being * merged. No nested values are altered. * * * ```js * const { OrderedMap } = require('immutable') * const one = OrderedMap({ a: 10, b: 20, c: 30 }) * const two = OrderedMap({ b: 40, a: 50, d: 60 }) * one.merge(two) // OrderedMap { "a": 50, "b": 40, "c": 30, "d": 60 } * two.merge(one) // OrderedMap { "b": 20, "a": 10, "d": 60, "c": 30 } * ``` * * Note: `merge` can be used in `withMutations`. * * @alias concat */ merge(...collections: Array>): OrderedMap; merge(...collections: Array<{ [key: string]: C }>): OrderedMap; concat(...collections: Array>): OrderedMap; concat(...collections: Array<{ [key: string]: C }>): OrderedMap; // Sequence algorithms /** * Returns a new OrderedMap with values passed through a * `mapper` function. * * OrderedMap({ a: 1, b: 2 }).map(x => 10 * x) * // OrderedMap { "a": 10, "b": 20 } * * Note: `map()` always returns a new instance, even if it produced the same * value at every step. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): OrderedMap; /** * @see Collection.Keyed.mapKeys */ mapKeys( mapper: (key: K, value: V, iter: this) => M, context?: any ): OrderedMap; /** * @see Collection.Keyed.mapEntries */ mapEntries( mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], context?: any ): OrderedMap; /** * Flat-maps the OrderedMap, returning a new OrderedMap. * * Similar to `data.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: any ): OrderedMap; /** * Returns a new OrderedMap with only the entries for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): OrderedMap; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; /** * @see Collection.Keyed.flip */ flip(): OrderedMap; } /** * A Collection of unique values with `O(log32 N)` adds and has. * * When iterating a Set, the entries will be (value, value) pairs. Iteration * order of a Set is undefined, however is stable. Multiple iterations of the * same Set will iterate in the same order. * * Set values, like Map keys, may be of any type. Equality is determined using * `Immutable.is`, enabling Sets to uniquely include other Immutable * collections, custom value types, and NaN. */ declare module Set { /** * True if the provided value is a Set */ function isSet(maybeSet: any): maybeSet is Set; /** * Creates a new Set containing `values`. */ function of(...values: Array): Set; /** * `Set.fromKeys()` creates a new immutable Set containing the keys from * this Collection or JavaScript Object. */ function fromKeys(iter: Collection): Set; function fromKeys(obj: { [key: string]: any }): Set; /** * `Set.intersect()` creates a new immutable Set that is the intersection of * a collection of other sets. * * ```js * const { Set } = require('immutable') * const intersected = Set.intersect([ * Set([ 'a', 'b', 'c' ]) * Set([ 'c', 'a', 't' ]) * ]) * // Set [ "a", "c"" ] * ``` */ function intersect(sets: Iterable>): Set; /** * `Set.union()` creates a new immutable Set that is the union of a * collection of other sets. * * ```js * const { Set } = require('immutable') * const unioned = Set.union([ * Set([ 'a', 'b', 'c' ]) * Set([ 'c', 'a', 't' ]) * ]) * // Set [ "a", "b", "c", "t"" ] * ``` */ function union(sets: Iterable>): Set; } /** * Create a new immutable Set containing the values of the provided * collection-like. * * Note: `Set` is a factory function and not a class, and does not use the * `new` keyword during construction. */ declare function Set(): Set; declare function Set(): Set; declare function Set(collection: Iterable): Set; interface Set extends Collection.Set { /** * The number of items in this Set. */ readonly size: number; // Persistent changes /** * Returns a new Set which also includes this value. * * Note: `add` can be used in `withMutations`. */ add(value: T): this; /** * Returns a new Set which excludes this value. * * Note: `delete` can be used in `withMutations`. * * Note: `delete` **cannot** be safely used in IE8, use `remove` if * supporting old browsers. * * @alias remove */ delete(value: T): this; remove(value: T): this; /** * Returns a new Set containing no values. * * Note: `clear` can be used in `withMutations`. */ clear(): this; /** * Returns a Set including any value from `collections` that does not already * exist in this Set. * * Note: `union` can be used in `withMutations`. * @alias merge * @alias concat */ union(...collections: Array>): Set; merge(...collections: Array>): Set; concat(...collections: Array>): Set; /** * Returns a Set which has removed any values not also contained * within `collections`. * * Note: `intersect` can be used in `withMutations`. */ intersect(...collections: Array>): this; /** * Returns a Set excluding any values contained within `collections`. * * * ```js * const { OrderedSet } = require('immutable') * OrderedSet([ 1, 2, 3 ]).subtract([1, 3]) * // OrderedSet [2] * ``` * * Note: `subtract` can be used in `withMutations`. */ subtract(...collections: Array>): this; // Transient changes /** * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * mentions being safe to use in `withMutations`. * * @see `Map#withMutations` */ withMutations(mutator: (mutable: this) => any): this; /** * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * mentions being safe to use in `withMutations`. * * @see `Map#asMutable` */ asMutable(): this; /** * @see `Map#wasAltered` */ wasAltered(): boolean; /** * @see `Map#asImmutable` */ asImmutable(): this; // Sequence algorithms /** * Returns a new Set with values passed through a * `mapper` function. * * Set([1,2]).map(x => 10 * x) * // Set [10,20] */ map( mapper: (value: T, key: T, iter: this) => M, context?: any ): Set; /** * Flat-maps the Set, returning a new Set. * * Similar to `set.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: T, iter: this) => Iterable, context?: any ): Set; /** * Returns a new Set with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, key: T, iter: this) => value is F, context?: any ): Set; filter( predicate: (value: T, key: T, iter: this) => any, context?: any ): this; } /** * A type of Set that has the additional guarantee that the iteration order of * values will be the order in which they were `add`ed. * * The iteration behavior of OrderedSet is the same as native ES6 Set. * * Note that `OrderedSet` are more expensive than non-ordered `Set` and may * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not * stable. */ declare module OrderedSet { /** * True if the provided value is an OrderedSet. */ function isOrderedSet(maybeOrderedSet: any): boolean; /** * Creates a new OrderedSet containing `values`. */ function of(...values: Array): OrderedSet; /** * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing * the keys from this Collection or JavaScript Object. */ function fromKeys(iter: Collection): OrderedSet; function fromKeys(obj: { [key: string]: any }): OrderedSet; } /** * Create a new immutable OrderedSet containing the values of the provided * collection-like. * * Note: `OrderedSet` is a factory function and not a class, and does not use * the `new` keyword during construction. */ declare function OrderedSet(): OrderedSet; declare function OrderedSet(): OrderedSet; declare function OrderedSet(collection: Iterable): OrderedSet; interface OrderedSet extends Set { /** * The number of items in this OrderedSet. */ readonly size: number; /** * Returns an OrderedSet including any value from `collections` that does * not already exist in this OrderedSet. * * Note: `union` can be used in `withMutations`. * @alias merge * @alias concat */ union(...collections: Array>): OrderedSet; merge(...collections: Array>): OrderedSet; concat(...collections: Array>): OrderedSet; // Sequence algorithms /** * Returns a new Set with values passed through a * `mapper` function. * * OrderedSet([ 1, 2 ]).map(x => 10 * x) * // OrderedSet [10, 20] */ map( mapper: (value: T, key: T, iter: this) => M, context?: any ): OrderedSet; /** * Flat-maps the OrderedSet, returning a new OrderedSet. * * Similar to `set.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: T, iter: this) => Iterable, context?: any ): OrderedSet; /** * Returns a new OrderedSet with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, key: T, iter: this) => value is F, context?: any ): OrderedSet; filter( predicate: (value: T, key: T, iter: this) => any, context?: any ): this; /** * Returns an OrderedSet of the same type "zipped" with the provided * collections. * * Like `zipWith`, but using the default `zipper`: creating an `Array`. * * ```js * const a = OrderedSet([ 1, 2, 3 ]) * const b = OrderedSet([ 4, 5, 6 ]) * const c = a.zip(b) * // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] * ``` */ zip(other: Collection): OrderedSet<[T, U]>; zip(other1: Collection, other2: Collection): OrderedSet<[T, U, V]>; zip(...collections: Array>): OrderedSet; /** * Returns a OrderedSet of the same type "zipped" with the provided * collections. * * Unlike `zip`, `zipAll` continues zipping until the longest collection is * exhausted. Missing values from shorter collections are filled with `undefined`. * * ```js * const a = OrderedSet([ 1, 2 ]); * const b = OrderedSet([ 3, 4, 5 ]); * const c = a.zipAll(b); // OrderedSet [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] * ``` * * Note: Since zipAll will return a collection as large as the largest * input, some results may contain undefined values. TypeScript cannot * account for these without cases (as of v2.5). */ zipAll(other: Collection): OrderedSet<[T, U]>; zipAll(other1: Collection, other2: Collection): OrderedSet<[T, U, V]>; zipAll(...collections: Array>): OrderedSet; /** * Returns an OrderedSet of the same type "zipped" with the provided * collections by using a custom `zipper` function. * * @see Seq.Indexed.zipWith */ zipWith( zipper: (value: T, otherValue: U) => Z, otherCollection: Collection ): OrderedSet; zipWith( zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection ): OrderedSet; zipWith( zipper: (...any: Array) => Z, ...collections: Array> ): OrderedSet; } /** * Stacks are indexed collections which support very efficient O(1) addition * and removal from the front using `unshift(v)` and `shift()`. * * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but * be aware that they also operate on the front of the list, unlike List or * a JavaScript Array. * * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, * `lastIndexOf`, etc.) is not efficient with a Stack. * * Stack is implemented with a Single-Linked List. */ declare module Stack { /** * True if the provided value is a Stack */ function isStack(maybeStack: any): maybeStack is Stack; /** * Creates a new Stack containing `values`. */ function of(...values: Array): Stack; } /** * Create a new immutable Stack containing the values of the provided * collection-like. * * The iteration order of the provided collection is preserved in the * resulting `Stack`. * * Note: `Stack` is a factory function and not a class, and does not use the * `new` keyword during construction. */ declare function Stack(): Stack; declare function Stack(): Stack; declare function Stack(collection: Iterable): Stack; interface Stack extends Collection.Indexed { /** * The number of items in this Stack. */ readonly size: number; // Reading values /** * Alias for `Stack.first()`. */ peek(): T | undefined; // Persistent changes /** * Returns a new Stack with 0 size and no values. * * Note: `clear` can be used in `withMutations`. */ clear(): Stack; /** * Returns a new Stack with the provided `values` prepended, shifting other * values ahead to higher indices. * * This is very efficient for Stack. * * Note: `unshift` can be used in `withMutations`. */ unshift(...values: Array): Stack; /** * Like `Stack#unshift`, but accepts a collection rather than varargs. * * Note: `unshiftAll` can be used in `withMutations`. */ unshiftAll(iter: Iterable): Stack; /** * Returns a new Stack with a size ones less than this Stack, excluding * the first item in this Stack, shifting all other values to a lower index. * * Note: this differs from `Array#shift` because it returns a new * Stack rather than the removed value. Use `first()` or `peek()` to get the * first value in this Stack. * * Note: `shift` can be used in `withMutations`. */ shift(): Stack; /** * Alias for `Stack#unshift` and is not equivalent to `List#push`. */ push(...values: Array): Stack; /** * Alias for `Stack#unshiftAll`. */ pushAll(iter: Iterable): Stack; /** * Alias for `Stack#shift` and is not equivalent to `List#pop`. */ pop(): Stack; // Transient changes /** * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * mentions being safe to use in `withMutations`. * * @see `Map#withMutations` */ withMutations(mutator: (mutable: this) => any): this; /** * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Check the documentation for each method to see if it * mentions being safe to use in `withMutations`. * * @see `Map#asMutable` */ asMutable(): this; /** * @see `Map#wasAltered` */ wasAltered(): boolean; /** * @see `Map#asImmutable` */ asImmutable(): this; // Sequence algorithms /** * Returns a new Stack with other collections concatenated to this one. */ concat(...valuesOrCollections: Array | C>): Stack; /** * Returns a new Stack with values passed through a * `mapper` function. * * Stack([ 1, 2 ]).map(x => 10 * x) * // Stack [ 10, 20 ] * * Note: `map()` always returns a new instance, even if it produced the same * value at every step. */ map( mapper: (value: T, key: number, iter: this) => M, context?: any ): Stack; /** * Flat-maps the Stack, returning a new Stack. * * Similar to `stack.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: number, iter: this) => Iterable, context?: any ): Stack; /** * Returns a new Set with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, index: number, iter: this) => value is F, context?: any ): Set; filter( predicate: (value: T, index: number, iter: this) => any, context?: any ): this; /** * Returns a Stack "zipped" with the provided collections. * * Like `zipWith`, but using the default `zipper`: creating an `Array`. * * ```js * const a = Stack([ 1, 2, 3 ]); * const b = Stack([ 4, 5, 6 ]); * const c = a.zip(b); // Stack [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] * ``` */ zip(other: Collection): Stack<[T, U]>; zip(other: Collection, other2: Collection): Stack<[T, U, V]>; zip(...collections: Array>): Stack; /** * Returns a Stack "zipped" with the provided collections. * * Unlike `zip`, `zipAll` continues zipping until the longest collection is * exhausted. Missing values from shorter collections are filled with `undefined`. * * ```js * const a = Stack([ 1, 2 ]); * const b = Stack([ 3, 4, 5 ]); * const c = a.zipAll(b); // Stack [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] * ``` * * Note: Since zipAll will return a collection as large as the largest * input, some results may contain undefined values. TypeScript cannot * account for these without cases (as of v2.5). */ zipAll(other: Collection): Stack<[T, U]>; zipAll(other: Collection, other2: Collection): Stack<[T, U, V]>; zipAll(...collections: Array>): Stack; /** * Returns a Stack "zipped" with the provided collections by using a * custom `zipper` function. * * ```js * const a = Stack([ 1, 2, 3 ]); * const b = Stack([ 4, 5, 6 ]); * const c = a.zipWith((a, b) => a + b, b); * // Stack [ 5, 7, 9 ] * ``` */ zipWith( zipper: (value: T, otherValue: U) => Z, otherCollection: Collection ): Stack; zipWith( zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection ): Stack; zipWith( zipper: (...any: Array) => Z, ...collections: Array> ): Stack; } /** * A record is similar to a JS object, but enforces a specific set of allowed * string keys, and has default values. * * The `Record()` function produces new Record Factories, which when called * create Record instances. * * ```js * const { Record } = require('immutable') * const ABRecord = Record({ a: 1, b: 2 }) * const myRecord = ABRecord({ b: 3 }) * ``` * * Records always have a value for the keys they define. `remove`ing a key * from a record simply resets it to the default value for that key. * * ```js * myRecord.size // 2 * myRecord.get('a') // 1 * myRecord.get('b') // 3 * const myRecordWithoutB = myRecord.remove('b') * myRecordWithoutB.get('b') // 2 * myRecordWithoutB.size // 2 * ``` * * Values provided to the constructor not found in the Record type will * be ignored. For example, in this case, ABRecord is provided a key "x" even * though only "a" and "b" have been defined. The value for "x" will be * ignored for this record. * * ```js * const myRecord = ABRecord({ b: 3, x: 10 }) * myRecord.get('x') // undefined * ``` * * Because Records have a known set of string keys, property get access works * as expected, however property sets will throw an Error. * * Note: IE8 does not support property access. Only use `get()` when * supporting IE8. * * ```js * myRecord.b // 3 * myRecord.b = 5 // throws Error * ``` * * Record Types can be extended as well, allowing for custom methods on your * Record. This is not a common pattern in functional environments, but is in * many JS programs. * * However Record Types are more restricted than typical JavaScript classes. * They do not use a class constructor, which also means they cannot use * class properties (since those are technically part of a constructor). * * While Record Types can be syntactically created with the JavaScript `class` * form, the resulting Record function is actually a factory function, not a * class constructor. Even though Record Types are not classes, JavaScript * currently requires the use of `new` when creating new Record instances if * they are defined as a `class`. * * ``` * class ABRecord extends Record({ a: 1, b: 2 }) { * getAB() { * return this.a + this.b; * } * } * * var myRecord = new ABRecord({b: 3}) * myRecord.getAB() // 4 * ``` * * * **Flow Typing Records:** * * Immutable.js exports two Flow types designed to make it easier to use * Records with flow typed code, `RecordOf` and `RecordFactory`. * * When defining a new kind of Record factory function, use a flow type that * describes the values the record contains along with `RecordFactory`. * To type instances of the Record (which the factory function returns), * use `RecordOf`. * * Typically, new Record definitions will export both the Record factory * function as well as the Record instance type for use in other code. * * ```js * import type { RecordFactory, RecordOf } from 'immutable'; * * // Use RecordFactory for defining new Record factory functions. * type Point3DProps = { x: number, y: number, z: number }; * const defaultValues: Point3DProps = { x: 0, y: 0, z: 0 }; * const makePoint3D: RecordFactory = Record(defaultValues); * export makePoint3D; * * // Use RecordOf for defining new instances of that Record. * export type Point3D = RecordOf; * const some3DPoint: Point3D = makePoint3D({ x: 10, y: 20, z: 30 }); * ``` * * **Flow Typing Record Subclasses:** * * Records can be subclassed as a means to add additional methods to Record * instances. This is generally discouraged in favor of a more functional API, * since Subclasses have some minor overhead. However the ability to create * a rich API on Record types can be quite valuable. * * When using Flow to type Subclasses, do not use `RecordFactory`, * instead apply the props type when subclassing: * * ```js * type PersonProps = {name: string, age: number}; * const defaultValues: PersonProps = {name: 'Aristotle', age: 2400}; * const PersonRecord = Record(defaultValues); * class Person extends PersonRecord { * getName(): string { * return this.get('name') * } * * setName(name: string): this { * return this.set('name', name); * } * } * ``` * * **Choosing Records vs plain JavaScript objects** * * Records offer a persistently immutable alternative to plain JavaScript * objects, however they're not required to be used within Immutable.js * collections. In fact, the deep-access and deep-updating functions * like `getIn()` and `setIn()` work with plain JavaScript Objects as well. * * Deciding to use Records or Objects in your application should be informed * by the tradeoffs and relative benefits of each: * * - *Runtime immutability*: plain JS objects may be carefully treated as * immutable, however Record instances will *throw* if attempted to be * mutated directly. Records provide this additional guarantee, however at * some marginal runtime cost. While JS objects are mutable by nature, the * use of type-checking tools like [Flow](https://medium.com/@gcanti/immutability-with-flow-faa050a1aef4) * can help gain confidence in code written to favor immutability. * * - *Value equality*: Records use value equality when compared with `is()` * or `record.equals()`. That is, two Records with the same keys and values * are equal. Plain objects use *reference equality*. Two objects with the * same keys and values are not equal since they are different objects. * This is important to consider when using objects as keys in a `Map` or * values in a `Set`, which use equality when retrieving values. * * - *API methods*: Records have a full featured API, with methods like * `.getIn()`, and `.equals()`. These can make working with these values * easier, but comes at the cost of not allowing keys with those names. * * - *Default values*: Records provide default values for every key, which * can be useful when constructing Records with often unchanging values. * However default values can make using Flow and TypeScript more laborious. * * - *Serialization*: Records use a custom internal representation to * efficiently store and update their values. Converting to and from this * form isn't free. If converting Records to plain objects is common, * consider sticking with plain objects to begin with. */ declare module Record$1 { /** * True if `maybeRecord` is an instance of a Record. */ export function isRecord(maybeRecord: any): maybeRecord is Record$1; /** * Records allow passing a second parameter to supply a descriptive name * that appears when converting a Record to a string or in any error * messages. A descriptive name for any record can be accessed by using this * method. If one was not provided, the string "Record" is returned. * * ```js * const { Record } = require('immutable') * const Person = Record({ * name: null * }, 'Person') * * var me = Person({ name: 'My Name' }) * me.toString() // "Person { "name": "My Name" }" * Record.getDescriptiveName(me) // "Person" * ``` */ export function getDescriptiveName(record: Record$1): string; /** * A Record.Factory is created by the `Record()` function. Record instances * are created by passing it some of the accepted values for that Record * type: * * * ```js * // makePerson is a Record Factory function * const makePerson = Record({ name: null, favoriteColor: 'unknown' }); * * // alan is a Record instance * const alan = makePerson({ name: 'Alan' }); * ``` * * Note that Record Factories return `Record & Readonly`, * this allows use of both the Record instance API, and direct property * access on the resulting instances: * * * ```js * // Use the Record API * console.log('Record API: ' + alan.get('name')) * * // Or direct property access (Readonly) * console.log('property access: ' + alan.name) * ``` * * **Flow Typing Records:** * * Use the `RecordFactory` Flow type to get high quality type checking of * Records: * * ```js * import type { RecordFactory, RecordOf } from 'immutable'; * * // Use RecordFactory for defining new Record factory functions. * type PersonProps = { name: ?string, favoriteColor: string }; * const makePerson: RecordFactory = Record({ name: null, favoriteColor: 'unknown' }); * * // Use RecordOf for defining new instances of that Record. * type Person = RecordOf; * const alan: Person = makePerson({ name: 'Alan' }); * ``` */ export module Factory { } export interface Factory { (values?: Partial | Iterable<[string, any]>): Record$1 & Readonly; new(values?: Partial | Iterable<[string, any]>): Record$1 & Readonly; } export function Factory(values?: Partial | Iterable<[string, any]>): Record$1 & Readonly; } /** * Unlike other types in Immutable.js, the `Record()` function creates a new * Record Factory, which is a function that creates Record instances. * * See above for examples of using `Record()`. * * Note: `Record` is a factory function and not a class, and does not use the * `new` keyword during construction. */ declare function Record$1(defaultValues: TProps, name?: string): Record$1.Factory; interface Record$1 { // Reading values has(key: string): key is keyof TProps & string; /** * Returns the value associated with the provided key, which may be the * default value defined when creating the Record factory function. * * If the requested key is not defined by this Record type, then * notSetValue will be returned if provided. Note that this scenario would * produce an error when using Flow or TypeScript. */ get(key: K, notSetValue?: any): TProps[K]; get(key: string, notSetValue: T): T; // Reading deep values hasIn(keyPath: Iterable): boolean; getIn(keyPath: Iterable): any; // Value equality equals(other: any): boolean; hashCode(): number; // Persistent changes set(key: K, value: TProps[K]): this; update(key: K, updater: (value: TProps[K]) => TProps[K]): this; merge(...collections: Array | Iterable<[string, any]>>): this; mergeDeep(...collections: Array | Iterable<[string, any]>>): this; mergeWith( merger: (oldVal: any, newVal: any, key: keyof TProps) => any, ...collections: Array | Iterable<[string, any]>> ): this; mergeDeepWith( merger: (oldVal: any, newVal: any, key: any) => any, ...collections: Array | Iterable<[string, any]>> ): this; /** * Returns a new instance of this Record type with the value for the * specific key set to its default value. * * @alias remove */ delete(key: K): this; remove(key: K): this; /** * Returns a new instance of this Record type with all values set * to their default values. */ clear(): this; // Deep persistent changes setIn(keyPath: Iterable, value: any): this; updateIn(keyPath: Iterable, updater: (value: any) => any): this; mergeIn(keyPath: Iterable, ...collections: Array): this; mergeDeepIn(keyPath: Iterable, ...collections: Array): this; /** * @alias removeIn */ deleteIn(keyPath: Iterable): this; removeIn(keyPath: Iterable): this; // Conversion to JavaScript types /** * Deeply converts this Record to equivalent native JavaScript Object. * * Note: This method may not be overridden. Objects with custom * serialization to plain JS may override toJSON() instead. */ toJS(): { [K in keyof TProps]: any }; /** * Shallowly converts this Record to equivalent native JavaScript Object. */ toJSON(): TProps; /** * Shallowly converts this Record to equivalent JavaScript Object. */ toObject(): TProps; // Transient changes /** * Note: Not all methods can be used on a mutable collection or within * `withMutations`! Only `set` may be used mutatively. * * @see `Map#withMutations` */ withMutations(mutator: (mutable: this) => any): this; /** * @see `Map#asMutable` */ asMutable(): this; /** * @see `Map#wasAltered` */ wasAltered(): boolean; /** * @see `Map#asImmutable` */ asImmutable(): this; // Sequence algorithms toSeq(): Seq.Keyed; [Symbol.iterator](): IterableIterator<[keyof TProps, TProps[keyof TProps]]>; } /** * `Seq` describes a lazy operation, allowing them to efficiently chain * use of all the higher-order collection methods (such as `map` and `filter`) * by not creating intermediate collections. * * **Seq is immutable** — Once a Seq is created, it cannot be * changed, appended to, rearranged or otherwise modified. Instead, any * mutative method called on a `Seq` will return a new `Seq`. * * **Seq is lazy** — `Seq` does as little work as necessary to respond to any * method call. Values are often created during iteration, including implicit * iteration when reducing or converting to a concrete data structure such as * a `List` or JavaScript `Array`. * * For example, the following performs no work, because the resulting * `Seq`'s values are never iterated: * * ```js * const { Seq } = require('immutable') * const oddSquares = Seq([ 1, 2, 3, 4, 5, 6, 7, 8 ]) * .filter(x => x % 2 !== 0) * .map(x => x * x) * ``` * * Once the `Seq` is used, it performs only the work necessary. In this * example, no intermediate arrays are ever created, filter is called three * times, and map is only called once: * * ```js * oddSquares.get(1); // 9 * ``` * * Any collection can be converted to a lazy Seq with `Seq()`. * * * ```js * const { Map } = require('immutable') * const map = Map({ a: 1, b: 2, c: 3 } * const lazySeq = Seq(map) * ``` * * `Seq` allows for the efficient chaining of operations, allowing for the * expression of logic that can otherwise be very tedious: * * ```js * lazySeq * .flip() * .map(key => key.toUpperCase()) * .flip() * // Seq { A: 1, B: 1, C: 1 } * ``` * * As well as expressing logic that would otherwise seem memory or time * limited, for example `Range` is a special kind of Lazy sequence. * * * ```js * const { Range } = require('immutable') * Range(1, Infinity) * .skip(1000) * .map(n => -n) * .filter(n => n % 2 === 0) * .take(2) * .reduce((r, n) => r * n, 1) * // 1006008 * ``` * * Seq is often used to provide a rich collection API to JavaScript Object. * * ```js * Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); * // { x: 0, y: 2, z: 4 } * ``` */ declare module Seq { /** * True if `maybeSeq` is a Seq, it is not backed by a concrete * structure such as Map, List, or Set. */ function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed | Seq.Set; /** * `Seq` which represents key-value pairs. */ export module Keyed { } /** * Always returns a Seq.Keyed, if input is not keyed, expects an * collection of [K, V] tuples. * * Note: `Seq.Keyed` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ export function Keyed(collection: Iterable<[K, V]>): Seq.Keyed; export function Keyed(obj: { [key: string]: V }): Seq.Keyed; export function Keyed(): Seq.Keyed; export function Keyed(): Seq.Keyed; export interface Keyed extends Seq, Collection.Keyed { /** * Deeply converts this Keyed Seq to equivalent native JavaScript Object. * * Converts keys to Strings. */ toJS(): Object; /** * Shallowly converts this Keyed Seq to equivalent native JavaScript Object. * * Converts keys to Strings. */ toJSON(): { [key: string]: V }; /** * Shallowly converts this collection to an Array. */ toArray(): Array<[K, V]>; /** * Returns itself */ toSeq(): this; /** * Returns a new Seq with other collections concatenated to this one. * * All entries will be present in the resulting Seq, even if they * have the same key. */ concat(...collections: Array>): Seq.Keyed; concat(...collections: Array<{ [key: string]: C }>): Seq.Keyed; /** * Returns a new Seq.Keyed with values passed through a * `mapper` function. * * ```js * const { Seq } = require('immutable') * Seq.Keyed({ a: 1, b: 2 }).map(x => 10 * x) * // Seq { "a": 10, "b": 20 } * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Seq.Keyed; /** * @see Collection.Keyed.mapKeys */ mapKeys( mapper: (key: K, value: V, iter: this) => M, context?: any ): Seq.Keyed; /** * @see Collection.Keyed.mapEntries */ mapEntries( mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], context?: any ): Seq.Keyed; /** * Flat-maps the Seq, returning a Seq of the same type. * * Similar to `seq.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: any ): Seq.Keyed; /** * Returns a new Seq with only the entries for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): Seq.Keyed; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; /** * @see Collection.Keyed.flip */ flip(): Seq.Keyed; } /** * `Seq` which represents an ordered indexed list of values. */ module Indexed { /** * Provides an Seq.Indexed of the values provided. */ function of(...values: Array): Seq.Indexed; } /** * Always returns Seq.Indexed, discarding associated keys and * supplying incrementing indices. * * Note: `Seq.Indexed` is a conversion function and not a class, and does * not use the `new` keyword during construction. */ export function Indexed(): Seq.Indexed; export function Indexed(): Seq.Indexed; export function Indexed(collection: Iterable): Seq.Indexed; export interface Indexed extends Seq, Collection.Indexed { /** * Deeply converts this Indexed Seq to equivalent native JavaScript Array. */ toJS(): Array; /** * Shallowly converts this Indexed Seq to equivalent native JavaScript Array. */ toJSON(): Array; /** * Shallowly converts this collection to an Array. */ toArray(): Array; /** * Returns itself */ toSeq(): this /** * Returns a new Seq with other collections concatenated to this one. */ concat(...valuesOrCollections: Array | C>): Seq.Indexed; /** * Returns a new Seq.Indexed with values passed through a * `mapper` function. * * ```js * const { Seq } = require('immutable') * Seq.Indexed([ 1, 2 ]).map(x => 10 * x) * // Seq [ 10, 20 ] * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: T, key: number, iter: this) => M, context?: any ): Seq.Indexed; /** * Flat-maps the Seq, returning a a Seq of the same type. * * Similar to `seq.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: number, iter: this) => Iterable, context?: any ): Seq.Indexed; /** * Returns a new Seq with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, index: number, iter: this) => value is F, context?: any ): Seq.Indexed; filter( predicate: (value: T, index: number, iter: this) => any, context?: any ): this; /** * Returns a Seq "zipped" with the provided collections. * * Like `zipWith`, but using the default `zipper`: creating an `Array`. * * ```js * const a = Seq([ 1, 2, 3 ]); * const b = Seq([ 4, 5, 6 ]); * const c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] * ``` */ zip(other: Collection): Seq.Indexed<[T, U]>; zip(other: Collection, other2: Collection): Seq.Indexed<[T, U, V]>; zip(...collections: Array>): Seq.Indexed; /** * Returns a Seq "zipped" with the provided collections. * * Unlike `zip`, `zipAll` continues zipping until the longest collection is * exhausted. Missing values from shorter collections are filled with `undefined`. * * ```js * const a = Seq([ 1, 2 ]); * const b = Seq([ 3, 4, 5 ]); * const c = a.zipAll(b); // Seq [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] * ``` */ zipAll(other: Collection): Seq.Indexed<[T, U]>; zipAll(other: Collection, other2: Collection): Seq.Indexed<[T, U, V]>; zipAll(...collections: Array>): Seq.Indexed; /** * Returns a Seq "zipped" with the provided collections by using a * custom `zipper` function. * * ```js * const a = Seq([ 1, 2, 3 ]); * const b = Seq([ 4, 5, 6 ]); * const c = a.zipWith((a, b) => a + b, b); * // Seq [ 5, 7, 9 ] * ``` */ zipWith( zipper: (value: T, otherValue: U) => Z, otherCollection: Collection ): Seq.Indexed; zipWith( zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection ): Seq.Indexed; zipWith( zipper: (...any: Array) => Z, ...collections: Array> ): Seq.Indexed; } /** * `Seq` which represents a set of values. * * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee * of value uniqueness as the concrete `Set`. */ export module Set { /** * Returns a Seq.Set of the provided values */ function of(...values: Array): Seq.Set; } /** * Always returns a Seq.Set, discarding associated indices or keys. * * Note: `Seq.Set` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ export function Set(): Seq.Set; export function Set(): Seq.Set; export function Set(collection: Iterable): Seq.Set; export interface Set extends Seq, Collection.Set { /** * Deeply converts this Set Seq to equivalent native JavaScript Array. */ toJS(): Array; /** * Shallowly converts this Set Seq to equivalent native JavaScript Array. */ toJSON(): Array; /** * Shallowly converts this collection to an Array. */ toArray(): Array; /** * Returns itself */ toSeq(): this /** * Returns a new Seq with other collections concatenated to this one. * * All entries will be present in the resulting Seq, even if they * are duplicates. */ concat(...collections: Array>): Seq.Set; /** * Returns a new Seq.Set with values passed through a * `mapper` function. * * ```js * Seq.Set([ 1, 2 ]).map(x => 10 * x) * // Seq { 10, 20 } * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: T, key: T, iter: this) => M, context?: any ): Seq.Set; /** * Flat-maps the Seq, returning a Seq of the same type. * * Similar to `seq.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: T, iter: this) => Iterable, context?: any ): Seq.Set; /** * Returns a new Seq with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, key: T, iter: this) => value is F, context?: any ): Seq.Set; filter( predicate: (value: T, key: T, iter: this) => any, context?: any ): this; } } /** * Creates a Seq. * * Returns a particular kind of `Seq` based on the input. * * * If a `Seq`, that same `Seq`. * * If an `Collection`, a `Seq` of the same kind (Keyed, Indexed, or Set). * * If an Array-like, an `Seq.Indexed`. * * If an Iterable Object, an `Seq.Indexed`. * * If an Object, a `Seq.Keyed`. * * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, * which is usually not what you want. You should turn your Iterator Object into * an iterable object by defining a Symbol.iterator (or @@iterator) method which * returns `this`. * * Note: `Seq` is a conversion function and not a class, and does not use the * `new` keyword during construction. */ declare function Seq>(seq: S): S; declare function Seq(collection: Collection.Keyed): Seq.Keyed; declare function Seq(collection: Collection.Indexed): Seq.Indexed; declare function Seq(collection: Collection.Set): Seq.Set; declare function Seq(collection: Iterable): Seq.Indexed; declare function Seq(obj: { [key: string]: V }): Seq.Keyed; declare function Seq(): Seq; interface Seq extends Collection { /** * Some Seqs can describe their size lazily. When this is the case, * size will be an integer. Otherwise it will be undefined. * * For example, Seqs returned from `map()` or `reverse()` * preserve the size of the original `Seq` while `filter()` does not. * * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will * always have a size. */ readonly size: number | undefined; // Force evaluation /** * Because Sequences are lazy and designed to be chained together, they do * not cache their results. For example, this map function is called a total * of 6 times, as each `join` iterates the Seq of three values. * * var squares = Seq([ 1, 2, 3 ]).map(x => x * x) * squares.join() + squares.join() * * If you know a `Seq` will be used multiple times, it may be more * efficient to first cache it in memory. Here, the map function is called * only 3 times. * * var squares = Seq([ 1, 2, 3 ]).map(x => x * x).cacheResult() * squares.join() + squares.join() * * Use this method judiciously, as it must fully evaluate a Seq which can be * a burden on memory and possibly performance. * * Note: after calling `cacheResult`, a Seq will always have a `size`. */ cacheResult(): this; // Sequence algorithms /** * Returns a new Seq with values passed through a * `mapper` function. * * ```js * const { Seq } = require('immutable') * Seq([ 1, 2 ]).map(x => 10 * x) * // Seq [ 10, 20 ] * ``` * * Note: `map()` always returns a new instance, even if it produced the same * value at every step. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Seq; /** * Returns a new Seq with values passed through a * `mapper` function. * * ```js * const { Seq } = require('immutable') * Seq([ 1, 2 ]).map(x => 10 * x) * // Seq [ 10, 20 ] * ``` * * Note: `map()` always returns a new instance, even if it produced the same * value at every step. * Note: used only for sets. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Seq; /** * Flat-maps the Seq, returning a Seq of the same type. * * Similar to `seq.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable, context?: any ): Seq; /** * Flat-maps the Seq, returning a Seq of the same type. * * Similar to `seq.map(...).flatten(true)`. * Note: Used only for sets. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable, context?: any ): Seq; /** * Returns a new Seq with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): Seq; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; } /** * The `Collection` is a set of (key, value) entries which can be iterated, and * is the base class for all collections in `immutable`, allowing them to * make use of all the Collection methods (such as `map` and `filter`). * * Note: A collection is always iterated in the same order, however that order * may not always be well defined, as is the case for the `Map` and `Set`. * * Collection is the abstract base class for concrete data structures. It * cannot be constructed directly. * * Implementations should extend one of the subclasses, `Collection.Keyed`, * `Collection.Indexed`, or `Collection.Set`. */ declare module Collection { /** * @deprecated use `const { isKeyed } = require('immutable')` */ function isKeyed(maybeKeyed: any): maybeKeyed is Collection.Keyed; /** * @deprecated use `const { isIndexed } = require('immutable')` */ function isIndexed(maybeIndexed: any): maybeIndexed is Collection.Indexed; /** * @deprecated use `const { isAssociative } = require('immutable')` */ function isAssociative(maybeAssociative: any): maybeAssociative is Collection.Keyed | Collection.Indexed; /** * @deprecated use `const { isOrdered } = require('immutable')` */ function isOrdered(maybeOrdered: any): boolean; /** * Keyed Collections have discrete keys tied to each value. * * When iterating `Collection.Keyed`, each iteration will yield a `[K, V]` * tuple, in other words, `Collection#entries` is the default iterator for * Keyed Collections. */ export module Keyed { } /** * Creates a Collection.Keyed * * Similar to `Collection()`, however it expects collection-likes of [K, V] * tuples if not constructed from a Collection.Keyed or JS Object. * * Note: `Collection.Keyed` is a conversion function and not a class, and * does not use the `new` keyword during construction. */ export function Keyed(collection: Iterable<[K, V]>): Collection.Keyed; export function Keyed(obj: { [key: string]: V }): Collection.Keyed; export interface Keyed extends Collection { /** * Deeply converts this Keyed collection to equivalent native JavaScript Object. * * Converts keys to Strings. */ toJS(): Object; /** * Shallowly converts this Keyed collection to equivalent native JavaScript Object. * * Converts keys to Strings. */ toJSON(): { [key: string]: V }; /** * Shallowly converts this collection to an Array. */ toArray(): Array<[K, V]>; /** * Returns Seq.Keyed. * @override */ toSeq(): Seq.Keyed; // Sequence functions /** * Returns a new Collection.Keyed of the same type where the keys and values * have been flipped. * * * ```js * const { Map } = require('immutable') * Map({ a: 'z', b: 'y' }).flip() * // Map { "z": "a", "y": "b" } * ``` */ flip(): Collection.Keyed; /** * Returns a new Collection with other collections concatenated to this one. */ concat(...collections: Array>): Collection.Keyed; concat(...collections: Array<{ [key: string]: C }>): Collection.Keyed; /** * Returns a new Collection.Keyed with values passed through a * `mapper` function. * * ```js * const { Collection } = require('immutable') * Collection.Keyed({ a: 1, b: 2 }).map(x => 10 * x) * // Seq { "a": 10, "b": 20 } * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Collection.Keyed; /** * Returns a new Collection.Keyed of the same type with keys passed through * a `mapper` function. * * * ```js * const { Map } = require('immutable') * Map({ a: 1, b: 2 }).mapKeys(x => x.toUpperCase()) * // Map { "A": 1, "B": 2 } * ``` * * Note: `mapKeys()` always returns a new instance, even if it produced * the same key at every step. */ mapKeys( mapper: (key: K, value: V, iter: this) => M, context?: any ): Collection.Keyed; /** * Returns a new Collection.Keyed of the same type with entries * ([key, value] tuples) passed through a `mapper` function. * * * ```js * const { Map } = require('immutable') * Map({ a: 1, b: 2 }) * .mapEntries(([ k, v ]) => [ k.toUpperCase(), v * 2 ]) * // Map { "A": 2, "B": 4 } * ``` * * Note: `mapEntries()` always returns a new instance, even if it produced * the same entry at every step. */ mapEntries( mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], context?: any ): Collection.Keyed; /** * Flat-maps the Collection, returning a Collection of the same type. * * Similar to `collection.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: any ): Collection.Keyed; /** * Returns a new Collection with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): Collection.Keyed; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; [Symbol.iterator](): IterableIterator<[K, V]>; } /** * Indexed Collections have incrementing numeric keys. They exhibit * slightly different behavior than `Collection.Keyed` for some methods in order * to better mirror the behavior of JavaScript's `Array`, and add methods * which do not make sense on non-indexed Collections such as `indexOf`. * * Unlike JavaScript arrays, `Collection.Indexed`s are always dense. "Unset" * indices and `undefined` indices are indistinguishable, and all indices from * 0 to `size` are visited when iterated. * * All Collection.Indexed methods return re-indexed Collections. In other words, * indices always start at 0 and increment until size. If you wish to * preserve indices, using them as keys, convert to a Collection.Keyed by * calling `toKeyedSeq`. */ export module Indexed { } /** * Creates a new Collection.Indexed. * * Note: `Collection.Indexed` is a conversion function and not a class, and * does not use the `new` keyword during construction. */ export function Indexed(collection: Iterable): Collection.Indexed; export interface Indexed extends Collection { /** * Deeply converts this Indexed collection to equivalent native JavaScript Array. */ toJS(): Array; /** * Shallowly converts this Indexed collection to equivalent native JavaScript Array. */ toJSON(): Array; /** * Shallowly converts this collection to an Array. */ toArray(): Array; // Reading values /** * Returns the value associated with the provided index, or notSetValue if * the index is beyond the bounds of the Collection. * * `index` may be a negative number, which indexes back from the end of the * Collection. `s.get(-1)` gets the last item in the Collection. */ get(index: number, notSetValue: NSV): T | NSV; get(index: number): T | undefined; // Conversion to Seq /** * Returns Seq.Indexed. * @override */ toSeq(): Seq.Indexed; /** * If this is a collection of [key, value] entry tuples, it will return a * Seq.Keyed of those entries. */ fromEntrySeq(): Seq.Keyed; // Combination /** * Returns a Collection of the same type with `separator` between each item * in this Collection. */ interpose(separator: T): this; /** * Returns a Collection of the same type with the provided `collections` * interleaved into this collection. * * The resulting Collection includes the first item from each, then the * second from each, etc. * * * ```js * const { List } = require('immutable') * List([ 1, 2, 3 ]).interleave(List([ 'A', 'B', 'C' ])) * // List [ 1, "A", 2, "B", 3, "C"" ] * ``` * * The shortest Collection stops interleave. * * * ```js * List([ 1, 2, 3 ]).interleave( * List([ 'A', 'B' ]), * List([ 'X', 'Y', 'Z' ]) * ) * // List [ 1, "A", "X", 2, "B", "Y"" ] * ``` * * Since `interleave()` re-indexes values, it produces a complete copy, * which has `O(N)` complexity. * * Note: `interleave` *cannot* be used in `withMutations`. */ interleave(...collections: Array>): this; /** * Splice returns a new indexed Collection by replacing a region of this * Collection with new values. If values are not provided, it only skips the * region to be removed. * * `index` may be a negative number, which indexes back from the end of the * Collection. `s.splice(-2)` splices after the second to last item. * * * ```js * const { List } = require('immutable') * List([ 'a', 'b', 'c', 'd' ]).splice(1, 2, 'q', 'r', 's') * // List [ "a", "q", "r", "s", "d" ] * ``` * * Since `splice()` re-indexes values, it produces a complete copy, which * has `O(N)` complexity. * * Note: `splice` *cannot* be used in `withMutations`. */ splice( index: number, removeNum: number, ...values: Array ): this; /** * Returns a Collection of the same type "zipped" with the provided * collections. * * Like `zipWith`, but using the default `zipper`: creating an `Array`. * * * * ```js * const a = List([ 1, 2, 3 ]); * const b = List([ 4, 5, 6 ]); * const c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] * ``` */ zip(other: Collection): Collection.Indexed<[T, U]>; zip(other: Collection, other2: Collection): Collection.Indexed<[T, U, V]>; zip(...collections: Array>): Collection.Indexed; /** * Returns a Collection "zipped" with the provided collections. * * Unlike `zip`, `zipAll` continues zipping until the longest collection is * exhausted. Missing values from shorter collections are filled with `undefined`. * * ```js * const a = List([ 1, 2 ]); * const b = List([ 3, 4, 5 ]); * const c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] * ``` */ zipAll(other: Collection): Collection.Indexed<[T, U]>; zipAll(other: Collection, other2: Collection): Collection.Indexed<[T, U, V]>; zipAll(...collections: Array>): Collection.Indexed; /** * Returns a Collection of the same type "zipped" with the provided * collections by using a custom `zipper` function. * * * ```js * const a = List([ 1, 2, 3 ]); * const b = List([ 4, 5, 6 ]); * const c = a.zipWith((a, b) => a + b, b); * // List [ 5, 7, 9 ] * ``` */ zipWith( zipper: (value: T, otherValue: U) => Z, otherCollection: Collection ): Collection.Indexed; zipWith( zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection ): Collection.Indexed; zipWith( zipper: (...any: Array) => Z, ...collections: Array> ): Collection.Indexed; // Search for value /** * Returns the first index at which a given value can be found in the * Collection, or -1 if it is not present. */ indexOf(searchValue: T): number; /** * Returns the last index at which a given value can be found in the * Collection, or -1 if it is not present. */ lastIndexOf(searchValue: T): number; /** * Returns the first index in the Collection where a value satisfies the * provided predicate function. Otherwise -1 is returned. */ findIndex( predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; /** * Returns the last index in the Collection where a value satisfies the * provided predicate function. Otherwise -1 is returned. */ findLastIndex( predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; // Sequence algorithms /** * Returns a new Collection with other collections concatenated to this one. */ concat(...valuesOrCollections: Array | C>): Collection.Indexed; /** * Returns a new Collection.Indexed with values passed through a * `mapper` function. * * ```js * const { Collection } = require('immutable') * Collection.Indexed([1,2]).map(x => 10 * x) * // Seq [ 1, 2 ] * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: T, key: number, iter: this) => M, context?: any ): Collection.Indexed; /** * Flat-maps the Collection, returning a Collection of the same type. * * Similar to `collection.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: number, iter: this) => Iterable, context?: any ): Collection.Indexed; /** * Returns a new Collection with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, index: number, iter: this) => value is F, context?: any ): Collection.Indexed; filter( predicate: (value: T, index: number, iter: this) => any, context?: any ): this; [Symbol.iterator](): IterableIterator; } /** * Set Collections only represent values. They have no associated keys or * indices. Duplicate values are possible in the lazy `Seq.Set`s, however * the concrete `Set` Collection does not allow duplicate values. * * Collection methods on Collection.Set such as `map` and `forEach` will provide * the value as both the first and second arguments to the provided function. * * ```js * const { Collection } = require('immutable') * const seq = Collection.Set([ 'A', 'B', 'C' ]) * // Seq { "A", "B", "C" } * seq.forEach((v, k) => * assert.equal(v, k) * ) * ``` */ export module Set { } /** * Similar to `Collection()`, but always returns a Collection.Set. * * Note: `Collection.Set` is a factory function and not a class, and does * not use the `new` keyword during construction. */ export function Set(collection: Iterable): Collection.Set; export interface Set extends Collection { /** * Deeply converts this Set collection to equivalent native JavaScript Array. */ toJS(): Array; /** * Shallowly converts this Set collection to equivalent native JavaScript Array. */ toJSON(): Array; /** * Shallowly converts this collection to an Array. */ toArray(): Array; /** * Returns Seq.Set. * @override */ toSeq(): Seq.Set; // Sequence algorithms /** * Returns a new Collection with other collections concatenated to this one. */ concat(...collections: Array>): Collection.Set; /** * Returns a new Collection.Set with values passed through a * `mapper` function. * * ``` * Collection.Set([ 1, 2 ]).map(x => 10 * x) * // Seq { 1, 2 } * ``` * * Note: `map()` always returns a new instance, even if it produced the * same value at every step. */ map( mapper: (value: T, key: T, iter: this) => M, context?: any ): Collection.Set; /** * Flat-maps the Collection, returning a Collection of the same type. * * Similar to `collection.map(...).flatten(true)`. */ flatMap( mapper: (value: T, key: T, iter: this) => Iterable, context?: any ): Collection.Set; /** * Returns a new Collection with only the values for which the `predicate` * function returns true. * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: T, key: T, iter: this) => value is F, context?: any ): Collection.Set; filter( predicate: (value: T, key: T, iter: this) => any, context?: any ): this; [Symbol.iterator](): IterableIterator; } } /** * Creates a Collection. * * The type of Collection created is based on the input. * * * If an `Collection`, that same `Collection`. * * If an Array-like, an `Collection.Indexed`. * * If an Object with an Iterator defined, an `Collection.Indexed`. * * If an Object, an `Collection.Keyed`. * * This methods forces the conversion of Objects and Strings to Collections. * If you want to ensure that a Collection of one item is returned, use * `Seq.of`. * * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, * which is usually not what you want. You should turn your Iterator Object into * an iterable object by defining a Symbol.iterator (or @@iterator) method which * returns `this`. * * Note: `Collection` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ declare function Collection>(collection: I): I; declare function Collection(collection: Iterable): Collection.Indexed; declare function Collection(obj: { [key: string]: V }): Collection.Keyed; interface Collection extends ValueObject { // Value equality /** * True if this and the other Collection have value equality, as defined * by `Immutable.is()`. * * Note: This is equivalent to `Immutable.is(this, other)`, but provided to * allow for chained expressions. */ equals(other: any): boolean; /** * Computes and returns the hashed identity for this Collection. * * The `hashCode` of a Collection is used to determine potential equality, * and is used when adding this to a `Set` or as a key in a `Map`, enabling * lookup via a different instance. * * * ```js * const a = List([ 1, 2, 3 ]); * const b = List([ 1, 2, 3 ]); * assert.notStrictEqual(a, b); // different instances * const set = Set([ a ]); * assert.equal(set.has(b), true); * ``` * * If two values have the same `hashCode`, they are [not guaranteed * to be equal][Hash Collision]. If two values have different `hashCode`s, * they must not be equal. * * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) */ hashCode(): number; // Reading values /** * Returns the value associated with the provided key, or notSetValue if * the Collection does not contain this key. * * Note: it is possible a key may be associated with an `undefined` value, * so if `notSetValue` is not provided and this method returns `undefined`, * that does not guarantee the key was not found. */ get(key: K, notSetValue: NSV): V | NSV; get(key: K): V | undefined; /** * True if a key exists within this `Collection`, using `Immutable.is` * to determine equality */ has(key: K): boolean; /** * True if a value exists within this `Collection`, using `Immutable.is` * to determine equality * @alias contains */ includes(value: V): boolean; contains(value: V): boolean; /** * In case the `Collection` is not empty returns the first element of the * `Collection`. * In case the `Collection` is empty returns the optional default * value if provided, if no default value is provided returns undefined. */ first(notSetValue?: NSV): V | NSV; /** * In case the `Collection` is not empty returns the last element of the * `Collection`. * In case the `Collection` is empty returns the optional default * value if provided, if no default value is provided returns undefined. */ last(notSetValue?: NSV): V | NSV; // Reading deep values /** * Returns the value found by following a path of keys or indices through * nested Collections. * * * ```js * const { Map, List } = require('immutable') * const deepData = Map({ x: List([ Map({ y: 123 }) ]) }); * deepData.getIn(['x', 0, 'y']) // 123 * ``` * * Plain JavaScript Object or Arrays may be nested within an Immutable.js * Collection, and getIn() can access those values as well: * * * ```js * const { Map, List } = require('immutable') * const deepData = Map({ x: [ { y: 123 } ] }); * deepData.getIn(['x', 0, 'y']) // 123 * ``` */ getIn(searchKeyPath: Iterable, notSetValue?: any): any; /** * True if the result of following a path of keys or indices through nested * Collections results in a set value. */ hasIn(searchKeyPath: Iterable): boolean; // Persistent changes /** * This can be very useful as a way to "chain" a normal function into a * sequence of methods. RxJS calls this "let" and lodash calls it "thru". * * For example, to sum a Seq after mapping and filtering: * * * ```js * const { Seq } = require('immutable') * * function sum(collection) { * return collection.reduce((sum, x) => sum + x, 0) * } * * Seq([ 1, 2, 3 ]) * .map(x => x + 1) * .filter(x => x % 2 === 0) * .update(sum) * // 6 * ``` */ update(updater: (value: this) => R): R; // Conversion to JavaScript types /** * Deeply converts this Collection to equivalent native JavaScript Array or Object. * * `Collection.Indexed`, and `Collection.Set` become `Array`, while * `Collection.Keyed` become `Object`, converting keys to Strings. */ toJS(): Array | { [key: string]: any }; /** * Shallowly converts this Collection to equivalent native JavaScript Array or Object. * * `Collection.Indexed`, and `Collection.Set` become `Array`, while * `Collection.Keyed` become `Object`, converting keys to Strings. */ toJSON(): Array | { [key: string]: V }; /** * Shallowly converts this collection to an Array. * * `Collection.Indexed`, and `Collection.Set` produce an Array of values. * `Collection.Keyed` produce an Array of [key, value] tuples. */ toArray(): Array | Array<[K, V]>; /** * Shallowly converts this Collection to an Object. * * Converts keys to Strings. */ toObject(): { [key: string]: V }; // Conversion to Collections /** * Converts this Collection to a Map, Throws if keys are not hashable. * * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided * for convenience and to allow for chained expressions. */ toMap(): Map; /** * Converts this Collection to a Map, maintaining the order of iteration. * * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but * provided for convenience and to allow for chained expressions. */ toOrderedMap(): OrderedMap; /** * Converts this Collection to a Set, discarding keys. Throws if values * are not hashable. * * Note: This is equivalent to `Set(this)`, but provided to allow for * chained expressions. */ toSet(): Set; /** * Converts this Collection to a Set, maintaining the order of iteration and * discarding keys. * * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided * for convenience and to allow for chained expressions. */ toOrderedSet(): OrderedSet; /** * Converts this Collection to a List, discarding keys. * * This is similar to `List(collection)`, but provided to allow for chained * expressions. However, when called on `Map` or other keyed collections, * `collection.toList()` discards the keys and creates a list of only the * values, whereas `List(collection)` creates a list of entry tuples. * * * ```js * const { Map, List } = require('immutable') * var myMap = Map({ a: 'Apple', b: 'Banana' }) * List(myMap) // List [ [ "a", "Apple" ], [ "b", "Banana" ] ] * myMap.toList() // List [ "Apple", "Banana" ] * ``` */ toList(): List; /** * Converts this Collection to a Stack, discarding keys. Throws if values * are not hashable. * * Note: This is equivalent to `Stack(this)`, but provided to allow for * chained expressions. */ toStack(): Stack; // Conversion to Seq /** * Converts this Collection to a Seq of the same kind (indexed, * keyed, or set). */ toSeq(): Seq; /** * Returns a Seq.Keyed from this Collection where indices are treated as keys. * * This is useful if you want to operate on an * Collection.Indexed and preserve the [index, value] pairs. * * The returned Seq will have identical iteration order as * this Collection. * * * ```js * const { Seq } = require('immutable') * const indexedSeq = Seq([ 'A', 'B', 'C' ]) * // Seq [ "A", "B", "C" ] * indexedSeq.filter(v => v === 'B') * // Seq [ "B" ] * const keyedSeq = indexedSeq.toKeyedSeq() * // Seq { 0: "A", 1: "B", 2: "C" } * keyedSeq.filter(v => v === 'B') * // Seq { 1: "B" } * ``` */ toKeyedSeq(): Seq.Keyed; /** * Returns an Seq.Indexed of the values of this Collection, discarding keys. */ toIndexedSeq(): Seq.Indexed; /** * Returns a Seq.Set of the values of this Collection, discarding keys. */ toSetSeq(): Seq.Set; // Iterators /** * An iterator of this `Collection`'s keys. * * Note: this will return an ES6 iterator which does not support * Immutable.js sequence algorithms. Use `keySeq` instead, if this is * what you want. */ keys(): IterableIterator; /** * An iterator of this `Collection`'s values. * * Note: this will return an ES6 iterator which does not support * Immutable.js sequence algorithms. Use `valueSeq` instead, if this is * what you want. */ values(): IterableIterator; /** * An iterator of this `Collection`'s entries as `[ key, value ]` tuples. * * Note: this will return an ES6 iterator which does not support * Immutable.js sequence algorithms. Use `entrySeq` instead, if this is * what you want. */ entries(): IterableIterator<[K, V]>; // Collections (Seq) /** * Returns a new Seq.Indexed of the keys of this Collection, * discarding values. */ keySeq(): Seq.Indexed; /** * Returns an Seq.Indexed of the values of this Collection, discarding keys. */ valueSeq(): Seq.Indexed; /** * Returns a new Seq.Indexed of [key, value] tuples. */ entrySeq(): Seq.Indexed<[K, V]>; // Sequence algorithms /** * Returns a new Collection of the same type with values passed through a * `mapper` function. * * * ```js * const { Collection } = require('immutable') * Collection({ a: 1, b: 2 }).map(x => 10 * x) * // Seq { "a": 10, "b": 20 } * ``` * * Note: `map()` always returns a new instance, even if it produced the same * value at every step. */ map( mapper: (value: V, key: K, iter: this) => M, context?: any ): Collection; /** * Note: used only for sets, which return Collection but are otherwise * identical to normal `map()`. * * @ignore */ map(...args: never[]): any; /** * Returns a new Collection of the same type with only the entries for which * the `predicate` function returns true. * * * ```js * const { Map } = require('immutable') * Map({ a: 1, b: 2, c: 3, d: 4}).filter(x => x % 2 === 0) * // Map { "b": 2, "d": 4 } * ``` * * Note: `filter()` always returns a new instance, even if it results in * not filtering out any values. */ filter( predicate: (value: V, key: K, iter: this) => value is F, context?: any ): Collection; filter( predicate: (value: V, key: K, iter: this) => any, context?: any ): this; /** * Returns a new Collection of the same type with only the entries for which * the `predicate` function returns false. * * * ```js * const { Map } = require('immutable') * Map({ a: 1, b: 2, c: 3, d: 4}).filterNot(x => x % 2 === 0) * // Map { "a": 1, "c": 3 } * ``` * * Note: `filterNot()` always returns a new instance, even if it results in * not filtering out any values. */ filterNot( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; /** * Returns a new Collection of the same type in reverse order. */ reverse(): this; /** * Returns a new Collection of the same type which includes the same entries, * stably sorted by using a `comparator`. * * If a `comparator` is not provided, a default comparator uses `<` and `>`. * * `comparator(valueA, valueB)`: * * * Returns `0` if the elements should not be swapped. * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` * * Returns `1` (or any positive number) if `valueA` comes after `valueB` * * Is pure, i.e. it must always return the same value for the same pair * of values. * * When sorting collections which have no defined order, their ordered * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. * * * ```js * const { Map } = require('immutable') * Map({ "c": 3, "a": 1, "b": 2 }).sort((a, b) => { * if (a < b) { return -1; } * if (a > b) { return 1; } * if (a === b) { return 0; } * }); * // OrderedMap { "a": 1, "b": 2, "c": 3 } * ``` * * Note: `sort()` Always returns a new instance, even if the original was * already sorted. * * Note: This is always an eager operation. */ sort(comparator?: (valueA: V, valueB: V) => number): this; /** * Like `sort`, but also accepts a `comparatorValueMapper` which allows for * sorting by more sophisticated means: * * hitters.sortBy(hitter => hitter.avgHits) * * Note: `sortBy()` Always returns a new instance, even if the original was * already sorted. * * Note: This is always an eager operation. */ sortBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): this; /** * Returns a `Collection.Keyed` of `Collection.Keyeds`, grouped by the return * value of the `grouper` function. * * Note: This is always an eager operation. * * * ```js * const { List, Map } = require('immutable') * const listOfMaps = List([ * Map({ v: 0 }), * Map({ v: 1 }), * Map({ v: 1 }), * Map({ v: 0 }), * Map({ v: 2 }) * ]) * const groupsOfMaps = listOfMaps.groupBy(x => x.get('v')) * // Map { * // 0: List [ Map{ "v": 0 }, Map { "v": 0 } ], * // 1: List [ Map{ "v": 1 }, Map { "v": 1 } ], * // 2: List [ Map{ "v": 2 } ], * // } * ``` */ groupBy( grouper: (value: V, key: K, iter: this) => G, context?: any ): /*Map*/Seq.Keyed>; // Side effects /** * The `sideEffect` is executed for every entry in the Collection. * * Unlike `Array#forEach`, if any call of `sideEffect` returns * `false`, the iteration will stop. Returns the number of entries iterated * (including the last iteration which returned false). */ forEach( sideEffect: (value: V, key: K, iter: this) => any, context?: any ): number; // Creating subsets /** * Returns a new Collection of the same type representing a portion of this * Collection from start up to but not including end. * * If begin is negative, it is offset from the end of the Collection. e.g. * `slice(-2)` returns a Collection of the last two entries. If it is not * provided the new Collection will begin at the beginning of this Collection. * * If end is negative, it is offset from the end of the Collection. e.g. * `slice(0, -1)` returns a Collection of everything but the last entry. If * it is not provided, the new Collection will continue through the end of * this Collection. * * If the requested slice is equivalent to the current Collection, then it * will return itself. */ slice(begin?: number, end?: number): this; /** * Returns a new Collection of the same type containing all entries except * the first. */ rest(): this; /** * Returns a new Collection of the same type containing all entries except * the last. */ butLast(): this; /** * Returns a new Collection of the same type which excludes the first `amount` * entries from this Collection. */ skip(amount: number): this; /** * Returns a new Collection of the same type which excludes the last `amount` * entries from this Collection. */ skipLast(amount: number): this; /** * Returns a new Collection of the same type which includes entries starting * from when `predicate` first returns false. * * * ```js * const { List } = require('immutable') * List([ 'dog', 'frog', 'cat', 'hat', 'god' ]) * .skipWhile(x => x.match(/g/)) * // List [ "cat", "hat", "god"" ] * ``` */ skipWhile( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; /** * Returns a new Collection of the same type which includes entries starting * from when `predicate` first returns true. * * * ```js * const { List } = require('immutable') * List([ 'dog', 'frog', 'cat', 'hat', 'god' ]) * .skipUntil(x => x.match(/hat/)) * // List [ "hat", "god"" ] * ``` */ skipUntil( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; /** * Returns a new Collection of the same type which includes the first `amount` * entries from this Collection. */ take(amount: number): this; /** * Returns a new Collection of the same type which includes the last `amount` * entries from this Collection. */ takeLast(amount: number): this; /** * Returns a new Collection of the same type which includes entries from this * Collection as long as the `predicate` returns true. * * * ```js * const { List } = require('immutable') * List([ 'dog', 'frog', 'cat', 'hat', 'god' ]) * .takeWhile(x => x.match(/o/)) * // List [ "dog", "frog" ] * ``` */ takeWhile( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; /** * Returns a new Collection of the same type which includes entries from this * Collection as long as the `predicate` returns false. * * * ```js * const { List } = require('immutable') * List([ 'dog', 'frog', 'cat', 'hat', 'god' ]) * .takeUntil(x => x.match(/at/)) * // List [ "dog", "frog" ] * ``` */ takeUntil( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; // Combination /** * Returns a new Collection of the same type with other values and * collection-like concatenated to this one. * * For Seqs, all entries will be present in the resulting Seq, even if they * have the same key. */ concat(...valuesOrCollections: Array): Collection; /** * Flattens nested Collections. * * Will deeply flatten the Collection by default, returning a Collection of the * same type, but a `depth` can be provided in the form of a number or * boolean (where true means to shallowly flatten one level). A depth of 0 * (or shallow: false) will deeply flatten. * * Flattens only others Collection, not Arrays or Objects. * * Note: `flatten(true)` operates on Collection> and * returns Collection */ flatten(depth?: number): Collection; flatten(shallow?: boolean): Collection; /** * Flat-maps the Collection, returning a Collection of the same type. * * Similar to `collection.map(...).flatten(true)`. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable, context?: any ): Collection; /** * Flat-maps the Collection, returning a Collection of the same type. * * Similar to `collection.map(...).flatten(true)`. * Used for Dictionaries only. */ flatMap( mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: any ): Collection; // Reducing a value /** * Reduces the Collection to a value by calling the `reducer` for every entry * in the Collection and passing along the reduced value. * * If `initialReduction` is not provided, the first item in the * Collection will be used. * * @see `Array#reduce`. */ reduce( reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: any ): R; reduce( reducer: (reduction: V | R, value: V, key: K, iter: this) => R ): R; /** * Reduces the Collection in reverse (from the right side). * * Note: Similar to this.reverse().reduce(), and provided for parity * with `Array#reduceRight`. */ reduceRight( reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: any ): R; reduceRight( reducer: (reduction: V | R, value: V, key: K, iter: this) => R ): R; /** * True if `predicate` returns true for all entries in the Collection. */ every( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; /** * True if `predicate` returns true for any entry in the Collection. */ some( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; /** * Joins values together as a string, inserting a separator between each. * The default separator is `","`. */ join(separator?: string): string; /** * Returns true if this Collection includes no values. * * For some lazy `Seq`, `isEmpty` might need to iterate to determine * emptiness. At most one iteration will occur. */ isEmpty(): boolean; /** * Returns the size of this Collection. * * Regardless of if this Collection can describe its size lazily (some Seqs * cannot), this method will always return the correct size. E.g. it * evaluates a lazy `Seq` if necessary. * * If `predicate` is provided, then this returns the count of entries in the * Collection for which the `predicate` returns true. */ count(): number; count( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): number; /** * Returns a `Seq.Keyed` of counts, grouped by the return value of * the `grouper` function. * * Note: This is not a lazy operation. */ countBy( grouper: (value: V, key: K, iter: this) => G, context?: any ): Map; // Search for value /** * Returns the first value for which the `predicate` returns true. */ find( predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): V | undefined; /** * Returns the last value for which the `predicate` returns true. * * Note: `predicate` will be called for each entry in reverse. */ findLast( predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): V | undefined; /** * Returns the first [key, value] entry for which the `predicate` returns true. */ findEntry( predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): [K, V] | undefined; /** * Returns the last [key, value] entry for which the `predicate` * returns true. * * Note: `predicate` will be called for each entry in reverse. */ findLastEntry( predicate: (value: V, key: K, iter: this) => boolean, context?: any, notSetValue?: V ): [K, V] | undefined; /** * Returns the key for which the `predicate` returns true. */ findKey( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): K | undefined; /** * Returns the last key for which the `predicate` returns true. * * Note: `predicate` will be called for each entry in reverse. */ findLastKey( predicate: (value: V, key: K, iter: this) => boolean, context?: any ): K | undefined; /** * Returns the key associated with the search value, or undefined. */ keyOf(searchValue: V): K | undefined; /** * Returns the last key associated with the search value, or undefined. */ lastKeyOf(searchValue: V): K | undefined; /** * Returns the maximum value in this collection. If any values are * comparatively equivalent, the first one found will be returned. * * The `comparator` is used in the same way as `Collection#sort`. If it is not * provided, the default comparator is `>`. * * When two values are considered equivalent, the first encountered will be * returned. Otherwise, `max` will operate independent of the order of input * as long as the comparator is commutative. The default comparator `>` is * commutative *only* when types do not differ. * * If `comparator` returns 0 and either value is NaN, undefined, or null, * that value will be returned. */ max(comparator?: (valueA: V, valueB: V) => number): V | undefined; /** * Like `max`, but also accepts a `comparatorValueMapper` which allows for * comparing by more sophisticated means: * * hitters.maxBy(hitter => hitter.avgHits); * */ maxBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): V | undefined; /** * Returns the minimum value in this collection. If any values are * comparatively equivalent, the first one found will be returned. * * The `comparator` is used in the same way as `Collection#sort`. If it is not * provided, the default comparator is `<`. * * When two values are considered equivalent, the first encountered will be * returned. Otherwise, `min` will operate independent of the order of input * as long as the comparator is commutative. The default comparator `<` is * commutative *only* when types do not differ. * * If `comparator` returns 0 and either value is NaN, undefined, or null, * that value will be returned. */ min(comparator?: (valueA: V, valueB: V) => number): V | undefined; /** * Like `min`, but also accepts a `comparatorValueMapper` which allows for * comparing by more sophisticated means: * * hitters.minBy(hitter => hitter.avgHits); * */ minBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): V | undefined; // Comparison /** * True if `iter` includes every value in this Collection. */ isSubset(iter: Iterable): boolean; /** * True if this Collection includes every value in `iter`. */ isSuperset(iter: Iterable): boolean; } /** * The interface to fulfill to qualify as a Value Object. */ interface ValueObject { /** * True if this and the other Collection have value equality, as defined * by `Immutable.is()`. * * Note: This is equivalent to `Immutable.is(this, other)`, but provided to * allow for chained expressions. */ equals(other: any): boolean; /** * Computes and returns the hashed identity for this Collection. * * The `hashCode` of a Collection is used to determine potential equality, * and is used when adding this to a `Set` or as a key in a `Map`, enabling * lookup via a different instance. * * * ```js * const { List, Set } = require('immutable'); * const a = List([ 1, 2, 3 ]); * const b = List([ 1, 2, 3 ]); * assert.notStrictEqual(a, b); // different instances * const set = Set([ a ]); * assert.equal(set.has(b), true); * ``` * * Note: hashCode() MUST return a Uint32 number. The easiest way to * guarantee this is to return `myHash | 0` from a custom implementation. * * If two values have the same `hashCode`, they are [not guaranteed * to be equal][Hash Collision]. If two values have different `hashCode`s, * they must not be equal. * * Note: `hashCode()` is not guaranteed to always be called before * `equals()`. Most but not all Immutable.js collections use hash codes to * organize their internal data structures, while all Immutable.js * collections use equality during lookups. * * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) */ hashCode(): number; } type IFunction = (...args: Array) => T; type IObject = Record; type Without = { [P in Exclude]?: never; }; type XOR = T | U extends object ? (Without & U) | (Without & T) : T | U; type Class = new (...args: Array) => T; declare const TransformationMatrix_base: Record$1.Factory<{ a: number; b: number; c: number; d: number; e: number; f: number; }>; declare class TransformationMatrix extends TransformationMatrix_base { a: number; b: number; c: number; d: number; e: number; f: number; static defaultValues: IObject; static IDENTITY: TransformationMatrix; translate({ x: tx, y: ty }: { x: number; y: number; }): TransformationMatrix; translateX(tx: number): TransformationMatrix; translateY(ty: number): TransformationMatrix; scale(sx: number, sy?: number): TransformationMatrix; transform(a2: number, b2: number, c2: number, d2: number, e2: number, f2: number): TransformationMatrix; rotate(degCW: number): TransformationMatrix; rotateRad(a: number): TransformationMatrix; inverse(): TransformationMatrix; toCssValue(): string; applyToPoint([x, y]: [number, number]): [number, number]; applyToVector([x, y]: [number, number]): [number, number]; } interface PointCtorProps { x?: number; y?: number; [k: string]: unknown; } declare const Point_base: Record$1.Factory; declare class Point extends Point_base { x: number; y: number; static defaultValues: IObject; constructor(options?: PointCtorProps); scale(sx: number, sy?: number): this; translate({ x: tx, y: ty }: { x: number; y: number; }): this; translateX(tx: number): this; translateY(ty: number): this; distance(other: this): number; rotate(deg: number): this; apply(matrix: TransformationMatrix): this; } interface IDrawingPoint extends PointCtorProps { intensity?: number; } declare class DrawingPoint extends Point { intensity: number; static defaultValues: IObject; constructor(options?: IDrawingPoint); } interface ISize { width: number; height: number; } declare const Size_base: Record$1.Factory; declare class Size extends Size_base { scale(factor: number): Size; ceil(): Size; floor(): Size; swapDimensions(): Size; apply(matrix: TransformationMatrix): Size; } interface IRect { left?: number; top?: number; width?: number; height?: number; } declare const Rect_base: Record$1.Factory; declare class Rect extends Rect_base { left: number; top: number; width: number; height: number; static defaultValues: IObject; constructor(options?: IRect); get right(): number; get bottom(): number; static fromClientRect({ top, left, width, height }: ClientRect): Rect; static union(rects: List): Rect; static getCenteredRect(inner: Size, outer: Size): Rect; static fromInset(inset: Inset): Rect; static fromPoints(...points: Point[]): Rect; expandToIncludePoints(...points: Point[]): Rect; static areRectsCloserThan(a: Rect, b: Rect, distance: number): boolean; translate({ x: tx, y: ty }: Point): Rect; translateX(tx: number): Rect; translateY(ty: number): Rect; scale(sx: number, sy?: number): Rect; grow(growth: number): Rect; getLocation(): Point; getSize(): Size; getCenter(): Point; setLocation(location: Point): Rect; roundOverlap(): Rect; round(): Rect; isPointInside(point: Point): boolean; isRectInside(other: Rect): boolean; isRectOverlapping(other: Rect): boolean; normalize(): Rect; apply(matrix: TransformationMatrix): Rect; } interface IInset { left: number; top: number; right: number; bottom: number; } declare const Inset_base: Record$1.Factory; declare class Inset extends Inset_base { static applyToRect(inset: Inset, rect: Rect): Rect; static fromRect(rect: Rect): Inset; static fromValue(insetValue: number): Inset; apply(matrix: TransformationMatrix): Inset; setScale(scale: number): Inset; } type InsetJSON = [left: number, top: number, right: number, bottom: number]; type ActionCtorProps = { subActions?: List | null; }; declare abstract class Action extends InheritableImmutableRecord { subActions?: List | null | undefined; protected constructor(args?: ActionCtorProps); } type ActionTriggerEventType = 'onPointerEnter' | 'onPointerLeave' | 'onPointerDown' | 'onPointerUp' | 'onPageOpen' | 'onPageClose' | 'onPageVisible' | 'onPageHidden'; interface IGoToAction extends ActionCtorProps { pageIndex?: number; } declare class GoToAction extends Action { pageIndex: number; static defaultValues: IObject; constructor(args?: IGoToAction); } interface IGoToEmbeddedAction extends ActionCtorProps { newWindow?: boolean; relativePath?: string; targetType?: 'parent' | 'child'; } declare class GoToEmbeddedAction extends Action { newWindow: boolean; relativePath: string; targetType: 'parent' | 'child'; static defaultValues: IObject; constructor(args?: IGoToEmbeddedAction); } interface IGoToRemoteAction extends ActionCtorProps { relativePath?: string; namedDestination?: string; } declare class GoToRemoteAction extends Action { relativePath: string; namedDestination: string; static defaultValues: IObject; constructor(args?: IGoToRemoteAction); } type AnnotationReference = { fieldName: string; } | { pdfObjectId: number; }; interface IHideAction extends ActionCtorProps { hide?: boolean; annotationReferences?: List; } declare class HideAction extends Action { hide: boolean; annotationReferences: List; static defaultValues: IObject; constructor(args?: IHideAction); } interface IJavaScriptAction extends ActionCtorProps { script?: string; } declare class JavaScriptAction extends Action { script: string; static defaultValues: IObject; constructor(args?: IJavaScriptAction); } interface ILaunchAction extends ActionCtorProps { filePath?: string; } declare class LaunchAction extends Action { filePath: string; static defaultValues: IObject; constructor(args?: ILaunchAction); } interface INamedAction extends ActionCtorProps { action?: string; } declare class NamedAction extends Action { action: string; static defaultValues: IObject; constructor(args?: INamedAction); } interface IResetFormAction extends ActionCtorProps { fields?: List | null | undefined; includeExclude?: boolean; } declare class ResetFormAction extends Action { fields: List | null | undefined; includeExclude: boolean; static defaultValues: IObject; constructor(args?: IResetFormAction); } interface ISubmitFormAction extends ActionCtorProps { uri?: string; fields?: List; includeExclude?: boolean; includeNoValueFields?: boolean; exportFormat?: boolean; getMethod?: boolean; submitCoordinated?: boolean; xfdf?: boolean; includeAppendSaves?: boolean; includeAnnotations?: boolean; submitPDF?: boolean; canonicalFormat?: boolean; excludeNonUserAnnotations?: boolean; excludeFKey?: boolean; embedForm?: boolean; } declare class SubmitFormAction extends Action { uri: string; fields: List | null | undefined; includeExclude: boolean; includeNoValueFields: boolean; exportFormat: boolean; getMethod: boolean; submitCoordinated: boolean; xfdf: boolean; includeAppendSaves: boolean; includeAnnotations: boolean; submitPDF: boolean; canonicalFormat: boolean; excludeNonUserAnnotations: boolean; excludeFKey: boolean; embedForm: boolean; static defaultValues: IObject; constructor(args?: ISubmitFormAction); } interface IURIAction extends ActionCtorProps { uri?: string; } declare class URIAction extends Action { uri: string; static defaultValues: IObject; constructor(args?: IURIAction); } declare const Color_base: Record$1.Factory<{ r: number; g: number; b: number; transparent: boolean; }>; declare class Color extends Color_base { static BLACK: Color; static GREY: Color; static WHITE: Color; static DARK_BLUE: Color; static RED: Color; static PURPLE: Color; static PINK: Color; static GREEN: Color; static ORANGE: Color; static YELLOW: Color; static LIGHT_BLUE: Color; static LIGHT_RED: Color; static LIGHT_GREEN: Color; static LIGHT_YELLOW: Color; static BLUE: Color; static LIGHT_ORANGE: Color; static LIGHT_GREY: Color; static DARK_GREY: Color; static MAUVE: Color; static TRANSPARENT: Color; static fromHex: (hexColor: string) => Color; constructor(args: { r?: number; g?: number; b?: number; transparent?: boolean; }); lighter(percent: number): Color; darker(percent: number): Color; equals(color: Color | { r: number; g: number; b: number; transparent: boolean; }): boolean; saturate(percent: number): Color; sRGBToRGBComponent(RGBComponent: number): number; relativeLuminance(): number; contrastRatio(color: Color): number; toCSSValue(): string; toHex(): string; } declare const BlendMode: { readonly normal: "normal"; readonly multiply: "multiply"; readonly screen: "screen"; readonly overlay: "overlay"; readonly darken: "darken"; readonly lighten: "lighten"; readonly colorDodge: "colorDodge"; readonly colorBurn: "colorBurn"; readonly hardLight: "hardLight"; readonly softLight: "softLight"; readonly difference: "difference"; readonly exclusion: "exclusion"; }; type IBlendMode = (typeof BlendMode)[keyof typeof BlendMode]; interface ITextMarkupAnnotation extends AnnotationProperties { rects: List; color: Color; blendMode: IBlendMode; } declare class TextMarkupAnnotation extends Annotation { rects: List; color: Color; blendMode: IBlendMode; static defaultValues: IObject; static readableName: string; } interface IHighlightAnnotation extends ITextMarkupAnnotation { color: Color; blendMode: IBlendMode | 'multiply'; } declare class HighlightAnnotation extends TextMarkupAnnotation { blendMode: IBlendMode; static className: string; static readableName: string; static defaultValues: IObject; } interface IImageAnnotation extends AnnotationProperties { description: string | null; fileName: string | null; contentType: string | null; imageAttachmentId: string | null; isSignature: boolean; xfdfAppearanceStream: string | null; } declare class ImageAnnotation extends Annotation { description: null | string; fileName: null | string; contentType: string; imageAttachmentId: string; isSignature: boolean; xfdfAppearanceStream: null | string; static defaultValues: IObject; static readableName: string; } interface IInkAnnotation extends AnnotationProperties { lines: List>; lineWidth: number | null; strokeColor: Color | null; backgroundColor: Color | null; isDrawnNaturally: boolean; isSignature: boolean; } declare class InkAnnotation extends Annotation { lines: List>; lineWidth: number; strokeColor: Color | null; backgroundColor: Color | null; isDrawnNaturally: boolean; isSignature: boolean; static defaultValues: IObject; static readableName: string; } declare const MeasurementPrecision: { readonly WHOLE: "whole"; readonly ONE: "oneDp"; readonly TWO: "twoDp"; readonly THREE: "threeDp"; readonly FOUR: "fourDp"; readonly HALVES: "1/2"; readonly QUARTERS: "1/4"; readonly EIGHTHS: "1/8"; readonly SIXTEENTHS: "1/16"; }; type IMeasurementPrecision = (typeof MeasurementPrecision)[keyof typeof MeasurementPrecision]; declare const MeasurementScaleUnitFrom: { readonly INCHES: "in"; readonly MILLIMETERS: "mm"; readonly CENTIMETERS: "cm"; readonly POINTS: "pt"; }; type IMeasurementScaleUnitFrom = (typeof MeasurementScaleUnitFrom)[keyof typeof MeasurementScaleUnitFrom]; declare const MeasurementScaleUnitTo: { readonly INCHES: "in"; readonly MILLIMETERS: "mm"; readonly CENTIMETERS: "cm"; readonly POINTS: "pt"; readonly FEET: "ft"; readonly METERS: "m"; readonly YARDS: "yd"; readonly KILOMETERS: "km"; readonly MILES: "mi"; }; type IMeasurementScaleUnitTo = (typeof MeasurementScaleUnitTo)[keyof typeof MeasurementScaleUnitTo]; interface IMeasurementScale { unitFrom: IMeasurementScaleUnitFrom; unitTo: IMeasurementScaleUnitTo; fromValue: number; toValue: number; } declare const MeasurementScale_base: Record$1.Factory; declare class MeasurementScale extends MeasurementScale_base { } interface IShapeAnnotation extends AnnotationProperties { strokeDashArray: [number, number] | null; strokeWidth: number | null; strokeColor: Color | null; fillColor: Color | null; measurementScale: MeasurementScale | null; measurementPrecision: IMeasurementPrecision | null; } declare abstract class ShapeAnnotation extends Annotation { strokeDashArray: null | [number, number]; strokeWidth: number; strokeColor: null | Color; fillColor: null | Color; measurementPrecision: null | IMeasurementPrecision; measurementScale: null | MeasurementScale; static readableName: string; static defaultValues: IObject; isMeasurement(): boolean; getMeasurementDetails: () => { value: number; label: string; }; } declare const LineCap: { readonly square: "square"; readonly circle: "circle"; readonly diamond: "diamond"; readonly openArrow: "openArrow"; readonly closedArrow: "closedArrow"; readonly butt: "butt"; readonly reverseOpenArrow: "reverseOpenArrow"; readonly reverseClosedArrow: "reverseClosedArrow"; readonly slash: "slash"; }; type ILineCap = (typeof LineCap)[keyof typeof LineCap]; type LineCapsType = { start?: ILineCap | null; end?: ILineCap | null; }; interface ILineAnnotation extends IShapeAnnotation { startPoint: Point | null; endPoint: Point | null; lineCaps: LineCapsType | null; points: List | null; } declare class LineAnnotation extends ShapeAnnotation { startPoint: Point; endPoint: Point; lineCaps: LineCapsType | null; points: List | null; static defaultValues: IObject; static readableName: string; } interface IRectangleAnnotation extends IShapeAnnotation { cloudyBorderIntensity?: number | null; cloudyBorderInset?: Inset | null; } declare class RectangleAnnotation extends ShapeAnnotation { cloudyBorderIntensity: null | number; cloudyBorderInset: null | Inset; measurementBBox: null | Rect; static defaultValues: IObject; static readableName: string; constructor(options?: Partial); } interface IEllipseAnnotation extends IShapeAnnotation { cloudyBorderIntensity?: number | null; cloudyBorderInset?: Inset | null; } declare class EllipseAnnotation extends ShapeAnnotation { cloudyBorderIntensity: null | number; cloudyBorderInset: null | Inset; measurementBBox: null | Rect; static defaultValues: IObject; static readableName: string; constructor(options?: Partial); } interface IPolygonAnnotation extends IShapeAnnotation { points: List | null; cloudyBorderIntensity: number | null; } declare class PolygonAnnotation extends ShapeAnnotation { points: List; cloudyBorderIntensity: null | number; static defaultValues: IObject; static readableName: string; } interface IPolyLineAnnotation extends IShapeAnnotation { points: List | null; lineCaps: LineCapsType | null; } declare class PolylineAnnotation extends ShapeAnnotation { points: List; lineCaps: null | LineCapsType; static defaultValues: IObject; static readableName: string; } declare const BorderStyle: { readonly solid: "solid"; readonly dashed: "dashed"; readonly beveled: "beveled"; readonly inset: "inset"; readonly underline: "underline"; }; type IBorderStyle = (typeof BorderStyle)[keyof typeof BorderStyle]; interface ILinkAnnotation extends AnnotationProperties { action: Action | null; borderColor: Color | null; borderStyle: IBorderStyle | null; borderWidth: number | null; } declare class LinkAnnotation extends Annotation { action: Action; borderColor: null | Color; borderStyle: null | IBorderStyle; borderWidth: null | number; static readableName: string; static defaultValues: IObject; } declare const NoteIcon: { readonly COMMENT: "COMMENT"; readonly RIGHT_POINTER: "RIGHT_POINTER"; readonly RIGHT_ARROW: "RIGHT_ARROW"; readonly CHECK: "CHECK"; readonly CIRCLE: "CIRCLE"; readonly CROSS: "CROSS"; readonly INSERT: "INSERT"; readonly NEW_PARAGRAPH: "NEW_PARAGRAPH"; readonly NOTE: "NOTE"; readonly PARAGRAPH: "PARAGRAPH"; readonly HELP: "HELP"; readonly STAR: "STAR"; readonly KEY: "KEY"; }; type INoteIcon = (typeof NoteIcon)[keyof typeof NoteIcon]; interface INoteAnnotation extends AnnotationProperties { text: { format: 'plain'; value: string; }; icon: string | INoteIcon; color: Color; } declare class NoteAnnotation extends Annotation { text: { format: 'plain'; value: string; }; icon: INoteIcon; color: Color; static isEditable: boolean; static readableName: string; static defaultValues: IObject; } interface ISquiggleAnnotation extends ITextMarkupAnnotation { color: Color; } declare class SquiggleAnnotation extends TextMarkupAnnotation { static className: string; static readableName: string; static defaultValues: IObject; } interface IStrikeOutAnnotation extends ITextMarkupAnnotation { color: Color; } declare class StrikeOutAnnotation extends TextMarkupAnnotation { static className: string; static readableName: string; static defaultValues: IObject; } type ICallout = { start: Point | null; knee: Point | null; end: Point | null; cap: ILineCap | null; innerRectInset: Inset | null; }; declare class Callout extends InheritableImmutableRecord { start: Point | null; knee: Point | null; end: Point | null; cap: ILineCap | null; innerRectInset: Inset | null; static defaultValues: { start: null; knee: null; end: null; cap: null; innerRectInset: null; }; } interface ITextAnnotation extends AnnotationProperties { text: { format: 'plain' | 'xhtml'; value: string | null; }; fontColor: Color | null; backgroundColor: Color | null; font: string; fontSize: number | null; isBold: boolean | null; isItalic: boolean | null; horizontalAlign: 'left' | 'center' | 'right'; verticalAlign: 'top' | 'center' | 'bottom'; callout: Callout | null; borderStyle: IBorderStyle | null; borderWidth: number | null; borderColor: Color | null; isFitting: boolean; lineHeightFactor: number | null; } declare class TextAnnotation extends Annotation { text: { format: 'plain' | 'xhtml'; value: string; }; fontColor: null | Color; backgroundColor: null | Color; font: string; fontSize: number; isBold: boolean; isItalic: boolean; horizontalAlign: 'left' | 'center' | 'right'; verticalAlign: 'top' | 'center' | 'bottom'; isFitting: boolean; callout: null | Callout; borderStyle: null | IBorderStyle; borderWidth: null | number; borderColor: Color | null; lineHeightFactor: null | number; static defaultValues: IObject; static readonly isEditable = true; static readonly readableName = "Text"; static readonly fontSizePresets: readonly number[]; } interface IUnderlineAnnotation extends ITextMarkupAnnotation { color: Color; } declare class UnderlineAnnotation extends TextMarkupAnnotation { static className: string; static readableName: string; static defaultValues: IObject; } declare class UnknownAnnotation extends Annotation { } type FontSize = 'auto' | number; type WidgetActionTriggerEventType = ActionTriggerEventType | 'onFocus' | 'onBlur'; type WidgetAnnotationAdditionalActionsType = { onFocus?: JavaScriptAction; onBlur?: JavaScriptAction; onChange?: JavaScriptAction; onFormat?: JavaScriptAction; onInput?: JavaScriptAction; onPointerDown?: Action; onPointerUp?: Action; onPointerEnter?: Action; onPointerLeave?: Action; }; interface IWidgetAnnotation extends AnnotationProperties { formFieldName: string | null; borderColor: Color | null; borderStyle: IBorderStyle | null; borderDashArray: number[] | null; borderWidth: number | null; backgroundColor: Color | null; fontSize: FontSize | null; font: string | null; fontColor: Color | null; isBold: boolean | null; isItalic: boolean | null; horizontalAlign: 'left' | 'center' | 'right' | null; verticalAlign: 'top' | 'center' | 'bottom' | null; additionalActions: WidgetAnnotationAdditionalActionsType | null; rotation: number; lineHeightFactor: number | null; } declare class WidgetAnnotation extends Annotation { formFieldName: string; borderColor: null | Color; borderStyle: null | IBorderStyle; borderDashArray: null | number[]; borderWidth: null | number; backgroundColor: null | Color; fontSize: null | FontSize; font: null | string; fontColor: null | Color; isBold: boolean; isItalic: boolean; horizontalAlign: 'left' | 'center' | 'right' | null; verticalAlign: 'top' | 'center' | 'bottom' | null; additionalActions: null | WidgetAnnotationAdditionalActionsType; rotation: number; lineHeightFactor: null | number; action: null | Action; static defaultValues: IObject; static readableName: string; } declare class CommentMarkerAnnotation extends Annotation { static readableName: string; } interface IRedactionAnnotation extends ITextMarkupAnnotation { color: Color; fillColor: null | Color; overlayText: null | string; repeatOverlayText: null | boolean; outlineColor: null | Color; } declare class RedactionAnnotation extends TextMarkupAnnotation { fillColor: null | Color; overlayText: null | string; repeatOverlayText: null | boolean; outlineColor: null | Color; color: Color; static readableName: string; static defaultValues: IObject; } interface IMediaAnnotation extends AnnotationProperties { description: null | string; fileName: null | string; contentType: string | null; mediaAttachmentId: string | null; } declare class MediaAnnotation extends Annotation { description: null | string; fileName: null | string; contentType: string | null; mediaAttachmentId: string | null; static defaultValues: IObject; static readableName: string; } type SignatureInfo = { type: 'pspdfkit/signature-info'; signatureType: SignatureTypeType | null | undefined; signerName: string | null | undefined; creationDate: Date | null | undefined; signatureReason: string | null | undefined; signatureLocation: string | null | undefined; documentIntegrityStatus: DocumentIntegrityStatusType; certificateChainValidationStatus: CertificateChainValidationStatusType; signatureValidationStatus: SignatureValidationStatusType; isTrusted: boolean; isSelfSigned: boolean; isExpired: boolean; documentModifiedSinceSignature: boolean; signatureFormFQN: string; }; declare const DocumentIntegrityStatus: { readonly ok: "ok"; readonly tampered_document: "tampered_document"; readonly failed_to_retrieve_signature_contents: "failed_to_retrieve_signature_contents"; readonly failed_to_retrieve_byterange: "failed_to_retrieve_byterange"; readonly failed_to_compute_digest: "failed_to_compute_digest"; readonly failed_retrieve_signing_certificate: "failed_retrieve_signing_certificate"; readonly failed_retrieve_public_key: "failed_retrieve_public_key"; readonly failed_encryption_padding: "failed_encryption_padding"; readonly general_failure: "general_failure"; }; type DocumentIntegrityStatusType = (typeof DocumentIntegrityStatus)[keyof typeof DocumentIntegrityStatus]; declare const CertificateChainValidationStatus: { readonly ok: "ok"; readonly ok_but_self_signed: "ok_but_self_signed"; readonly untrusted: "untrusted"; readonly expired: "expired"; readonly not_yet_valid: "not_yet_valid"; readonly invalid: "invalid"; readonly revoked: "revoked"; readonly failed_to_retrieve_signature_contents: "failed_to_retrieve_signature_contents"; readonly general_validation_problem: "general_validation_problem"; }; type CertificateChainValidationStatusType = (typeof CertificateChainValidationStatus)[keyof typeof CertificateChainValidationStatus]; declare const SignatureValidationStatus: { readonly valid: "valid"; readonly warning: "warning"; readonly error: "error"; }; type SignatureValidationStatusType = (typeof SignatureValidationStatus)[keyof typeof SignatureValidationStatus]; declare const SignatureType: { CMS: string; CAdES: string; }; type SignatureTypeType = (typeof SignatureType)[keyof typeof SignatureType]; type SignaturesInfo = { status: DocumentValidationStatusType; checkedAt: Date; signatures?: Array; documentModifiedSinceSignature?: boolean; }; declare const DocumentValidationStatus: { valid: string; warning: string; error: string; not_signed: string; }; type DocumentValidationStatusType = keyof typeof DocumentValidationStatus; type MeasurementValueConfiguration = { name?: string; scale: IMeasurementScale; precision: IMeasurementPrecision; selected?: boolean; }; type MeasurementValueConfigurationCallback = (configuration: MeasurementValueConfiguration[]) => MeasurementValueConfiguration[]; type IAnnotationJSON = Omit; declare class AnnotationSerializer { static VERSION: number; annotation: AnnotationsUnion; constructor(annotation: AnnotationsUnion); toJSON(): Omit; static fromJSON(id: ID | null, json: IAnnotationJSON, options?: ICollaboratorPermissionsOptions): { group?: string | null | undefined; canSetGroup?: boolean | undefined; isEditable?: boolean | undefined; isDeletable?: boolean | undefined; blendMode?: IBlendMode | undefined; id: string | null; name: string | null; subject: string | null; pdfObjectId: number | null; pageIndex: number; opacity: number; boundingBox: Rect; noPrint: boolean; noZoom: boolean; noRotate: boolean; noView: boolean; hidden: boolean; locked: boolean; lockedContents: boolean; readOnly: boolean; action: Action | null | undefined; note: string | null; createdAt: Date; updatedAt: Date; creatorName: string | null; customData: Record | null; isCommentThreadRoot: boolean; }; static blendModeObjectForAnnotation(json: IAnnotationJSON): { blendMode: IBlendMode; } | null; serializeFlags(): ("noView" | "noPrint" | "locked" | "lockedContents" | "readOnly" | "hidden" | "noZoom" | "noRotate")[] | null; } declare class InkAnnotationSerializer extends AnnotationSerializer { annotation: InkAnnotation; constructor(annotation: InkAnnotation); toJSON(): InkAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): InkAnnotation; _linesToJSON(): { points: [number, number][][]; intensities: number[][]; }; static _JSONToLines(linesJSON: { points: Array>; intensities: Array>; }): List>; } declare abstract class ShapeAnnotationSerializer extends AnnotationSerializer { annotation: ShapeAnnotationsUnion; toJSON(): ShapeAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): { strokeWidth: number | null; strokeColor: Color | null; fillColor: Color | null; strokeDashArray: [number, number] | null | undefined; measurementPrecision: IMeasurementPrecision | null | undefined; measurementScale: MeasurementScale | null; group?: string | null | undefined; canSetGroup?: boolean | undefined; isEditable?: boolean | undefined; isDeletable?: boolean | undefined; blendMode?: IBlendMode | undefined; id: string | null; name: string | null; subject: string | null; pdfObjectId: number | null; pageIndex: number; opacity: number; boundingBox: Rect; noPrint: boolean; noZoom: boolean; noRotate: boolean; noView: boolean; hidden: boolean; locked: boolean; lockedContents: boolean; readOnly: boolean; action: Action | null | undefined; note: string | null; createdAt: Date; updatedAt: Date; creatorName: string | null; customData: Record | null; isCommentThreadRoot: boolean; }; _pointsToJSON(): Array<[number, number]>; static _JSONToPoints(pointsJSON: Array<[number, number]>): List; static _JSONLinesToPoints(linesJSON: { points: Array>; intensities: Array>; }): List; } type MeasurementScaleJSON = { unitFrom: IMeasurementScaleUnitFrom; unitTo: IMeasurementScaleUnitTo; from: number; to: number; }; declare class LineAnnotationSerializer extends ShapeAnnotationSerializer { annotation: LineAnnotation; toJSON(): LineAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): LineAnnotation; } declare class RectangleAnnotationSerializer extends ShapeAnnotationSerializer { annotation: RectangleAnnotation; toJSON(): RectangleAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): RectangleAnnotation; } declare class EllipseAnnotationSerializer extends ShapeAnnotationSerializer { annotation: EllipseAnnotation; toJSON(): EllipseAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): EllipseAnnotation; } declare class PolygonAnnotationSerializer extends ShapeAnnotationSerializer { annotation: PolygonAnnotation; toJSON(): PolygonAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: IObject): PolygonAnnotation; } declare class PolylineAnnotationSerializer extends ShapeAnnotationSerializer { annotation: PolylineAnnotation; toJSON(): PolylineAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): PolylineAnnotation; } declare class LinkAnnotationSerializer extends AnnotationSerializer { annotation: LinkAnnotation; constructor(annotation: LinkAnnotation); toJSON(): LinkAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): LinkAnnotation; } declare abstract class BaseTextMarkupSerializer extends AnnotationSerializer { annotation: RedactionAnnotation | TextMarkupAnnotation; constructor(annotation: RedactionAnnotation | TextMarkupAnnotation); toJSON(): BaseTextMarkupAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): { rects: List; group?: string | null | undefined; canSetGroup?: boolean | undefined; isEditable?: boolean | undefined; isDeletable?: boolean | undefined; blendMode?: IBlendMode | undefined; id: string | null; name: string | null; subject: string | null; pdfObjectId: number | null; pageIndex: number; opacity: number; boundingBox: Rect; noPrint: boolean; noZoom: boolean; noRotate: boolean; noView: boolean; hidden: boolean; locked: boolean; lockedContents: boolean; readOnly: boolean; action: Action | null | undefined; note: string | null; createdAt: Date; updatedAt: Date; creatorName: string | null; customData: Record | null; isCommentThreadRoot: boolean; }; } declare class TextMarkupAnnotationSerializer extends BaseTextMarkupSerializer { annotation: TextMarkupAnnotationsUnion; constructor(annotation: TextMarkupAnnotationsUnion); toJSON(): TextMarkupAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): TextMarkupAnnotationsUnion; typeForAnnotation(): "pspdfkit/markup/highlight" | "pspdfkit/markup/squiggly" | "pspdfkit/markup/strikeout" | "pspdfkit/markup/underline" | "pspdfkit/markup/redaction"; } declare class RedactionAnnotationSerializer extends BaseTextMarkupSerializer { annotation: RedactionAnnotation; constructor(annotation: RedactionAnnotation); toJSON(): RedactionAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): RedactionAnnotation; } declare class TextAnnotationSerializer extends AnnotationSerializer { annotation: TextAnnotation; constructor(annotation: TextAnnotation); toJSON(): TextAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): TextAnnotation; _calloutToJSON(): { start: [number, number]; knee: [number, number] | null; end: [number, number]; cap: ILineCap | null; innerRectInset: InsetJSON | null; } | null; static _JSONToCallout(calloutJSON: TextAnnotationJSON['callout']): Callout | null | undefined; } declare class NoteAnnotationSerializer extends AnnotationSerializer { annotation: NoteAnnotation; constructor(annotation: NoteAnnotation); toJSON(): NoteAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): NoteAnnotation; } declare class ImageAnnotationSerializer extends AnnotationSerializer { annotation: ImageAnnotation; constructor(annotation: ImageAnnotation); toJSON(): ImageAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): ImageAnnotation; } declare class StampAnnotationSerializer extends AnnotationSerializer { annotation: StampAnnotation; constructor(annotation: StampAnnotation); toJSON(): StampAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): StampAnnotation; } declare class WidgetAnnotationSerializer extends AnnotationSerializer { annotation: WidgetAnnotation; constructor(annotation: WidgetAnnotation); toJSON(): WidgetAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): WidgetAnnotation; } type InstantID = string; declare function generateInstantId(): InstantID; declare class CommentMarkerAnnotationSerializer extends AnnotationSerializer { annotation: CommentMarkerAnnotation; constructor(annotation: CommentMarkerAnnotation); toJSON(): CommentMarkerAnnotationJSON; static fromJSON(id: InstantID | null, json: Omit, options?: ICollaboratorPermissionsOptions): CommentMarkerAnnotation; } declare class UnknownAnnotationSerializer extends AnnotationSerializer { annotation: UnknownAnnotation; constructor(annotation: UnknownAnnotation); toJSON(): UnknownAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): UnknownAnnotation; } declare class MediaAnnotationSerializer extends AnnotationSerializer { annotation: MediaAnnotation; constructor(annotation: MediaAnnotation); toJSON(): MediaAnnotationJSON; static fromJSON(id: ID | null, json: Omit, options?: ICollaboratorPermissionsOptions): MediaAnnotation; } type AnnotationSerializerTypeMap = { 'pspdfkit/ink': { serializer: InkAnnotationSerializer; annotation: InkAnnotation; json: InkAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/shape/line': { serializer: LineAnnotationSerializer; annotation: LineAnnotation; json: LineAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/shape/rectangle': { serializer: RectangleAnnotationSerializer; annotation: RectangleAnnotation; json: RectangleAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/shape/ellipse': { serializer: EllipseAnnotationSerializer; annotation: EllipseAnnotation; json: EllipseAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/shape/polygon': { serializer: PolygonAnnotationSerializer; annotation: PolygonAnnotation; json: PolygonAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/shape/polyline': { serializer: PolylineAnnotationSerializer; annotation: PolylineAnnotation; json: PolylineAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/link': { serializer: LinkAnnotationSerializer; annotation: LinkAnnotation; json: LinkAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/markup/highlight': { serializer: TextMarkupAnnotationSerializer; annotation: HighlightAnnotation; json: TextMarkupAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/markup/squiggly': { serializer: TextMarkupAnnotationSerializer; annotation: SquiggleAnnotation; json: TextMarkupAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/markup/strikeout': { serializer: TextMarkupAnnotationSerializer; annotation: StrikeOutAnnotation; json: TextMarkupAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/markup/underline': { serializer: TextMarkupAnnotationSerializer; annotation: UnderlineAnnotation; json: TextMarkupAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/markup/redaction': { serializer: RedactionAnnotationSerializer; annotation: RedactionAnnotation; json: RedactionAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/text': { serializer: TextAnnotationSerializer; annotation: TextAnnotation; json: TextAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/note': { serializer: NoteAnnotationSerializer; annotation: NoteAnnotation; json: NoteAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/image': { serializer: ImageAnnotationSerializer; annotation: ImageAnnotation; json: ImageAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/stamp': { serializer: StampAnnotationSerializer; annotation: StampAnnotation; json: StampAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/widget': { serializer: WidgetAnnotationSerializer; annotation: WidgetAnnotation; json: WidgetAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/comment-marker': { serializer: CommentMarkerAnnotationSerializer; annotation: CommentMarkerAnnotation; json: CommentMarkerAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/unknown': { serializer: UnknownAnnotationSerializer; annotation: UnknownAnnotation; json: UnknownAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; 'pspdfkit/media': { serializer: MediaAnnotationSerializer; annotation: MediaAnnotation; json: MediaAnnotationJSON; jsonForBackend: AnnotationBackendJSON; }; }; type GetTypeFromAnnotationJSON = T extends { type: infer U; } ? U : never; type AnnotationJSONToAnnotation = AnnotationSerializerTypeMap[GetTypeFromAnnotationJSON]['annotation']; type Intersection = T extends U ? T : never; type BackendRequiredKeys = 'id' | 'v' | 'pageIndex' | 'type' | 'bbox'; type AnnotationBackendJSON = { [P in keyof K]?: NonNullable; } & { [P in Intersection]-?: Exclude, undefined>; }; type AnnotationsUnion = { [K in keyof AnnotationSerializerTypeMap]: AnnotationSerializerTypeMap[K]['annotation']; }[keyof AnnotationSerializerTypeMap]; type AnnotationsUnionClass = { [K in keyof AnnotationSerializerTypeMap]: Class; }[keyof AnnotationSerializerTypeMap]; type ShapeAnnotationsUnion = PolylineAnnotation | PolygonAnnotation | LineAnnotation | RectangleAnnotation | EllipseAnnotation; type AnnotationsBackendJSONUnion = { [K in keyof AnnotationSerializerTypeMap]: AnnotationSerializerTypeMap[K]['jsonForBackend']; }[keyof AnnotationSerializerTypeMap]; type TextMarkupAnnotationsUnion = HighlightAnnotation | UnderlineAnnotation | StrikeOutAnnotation | SquiggleAnnotation | RedactionAnnotation; type CommentProps = { id: InstantID | null; rootId: InstantID | null; pageIndex: null | number; pdfObjectId: number | null; creatorName: string | null; createdAt: Date; updatedAt: Date; text: { format: 'plain' | 'xhtml'; value: string | null; }; customData: Record | null; group?: string | null; isEditable?: boolean; isDeletable?: boolean; canSetGroup?: boolean; isAnonymous?: boolean | null; }; declare const Comment_base: Record$1.Factory; declare class Comment extends Comment_base { getMentionedUserIds(): Set; } type MentionableUser = { id: string; name: string; avatarUrl?: string; displayName: string; description?: string; }; type IGroup = string | null | undefined; type IPermissions = { edit: boolean; delete: boolean; setGroup: boolean; fill?: boolean; reply?: boolean; }; type ICollaboratorPermissionsOptions = { group?: IGroup; permissions?: IPermissions; }; type SerializedAdditionalActionsType = { [key in ActionTriggerEventType | FormFieldEventTriggerType | FormFieldInputEventTriggerType | WidgetActionTriggerEventType]?: { type: string; [key: string]: unknown; }; }; type IRectJSON = [left: number, top: number, width: number, height: number]; type BaseAnnotationJSON = { v: number; type?: 'pspdfkit/ink' | 'pspdfkit/shape/line' | 'pspdfkit/shape/rectangle' | 'pspdfkit/shape/ellipse' | 'pspdfkit/shape/polygon' | 'pspdfkit/shape/polyline' | 'pspdfkit/link' | 'pspdfkit/markup/highlight' | 'pspdfkit/markup/squiggly' | 'pspdfkit/markup/strikeout' | 'pspdfkit/markup/underline' | 'pspdfkit/markup/redaction' | 'pspdfkit/stamp' | 'pspdfkit/text' | 'pspdfkit/note' | 'pspdfkit/image' | 'pspdfkit/media' | 'pspdfkit/widget' | 'pspdfkit/comment-marker' | 'pspdfkit/unknown'; name?: string | null; id: string; subject?: string | null; pdfObjectId?: number | null; pageIndex: number; bbox: IRectJSON; opacity?: number; flags?: ('noPrint' | 'noZoom' | 'noRotate' | 'noView' | 'hidden' | 'locked' | 'lockedContents' | 'readOnly')[] | null; action?: ActionJSON | null; note?: string | null; createdAt?: string | Date; updatedAt?: string | Date; creatorName?: string | null; customData?: Record | null; isCommentThreadRoot?: boolean; APStreamCache?: { cache: string; } | { attach: string; }; blendMode?: IBlendMode | null; } & ICollaboratorPermissionsOptions; type ImageAnnotationJSON = Omit & { type: 'pspdfkit/image'; description?: string | null; fileName?: string | null; contentType: string; imageAttachmentId: string; rotation: number; isSignature?: boolean; xfdfAppearanceStream?: string; }; type ShapeAnnotationJSON = Omit & { strokeWidth: number; strokeColor: string | null; fillColor: string | null; strokeDashArray?: [number, number] | null; measurementPrecision?: IMeasurementPrecision | null; measurementScale?: MeasurementScaleJSON | null; lineWidth?: number | null; }; type EllipseAnnotationJSON = ShapeAnnotationJSON & { type: 'pspdfkit/shape/ellipse'; cloudyBorderIntensity: number | null; cloudyBorderInset: InsetJSON | null; measurementBBox: IRectJSON | null; }; type LineAnnotationJSON = ShapeAnnotationJSON & { type: 'pspdfkit/shape/line'; startPoint: [number, number]; endPoint: [number, number]; lineCaps?: LineCapsType | null; lines?: { points: [number, number][][]; intensities: number[][]; }; }; type PolygonAnnotationJSON = ShapeAnnotationJSON & { type: 'pspdfkit/shape/polygon'; points: [number, number][]; cloudyBorderIntensity: number | null; lines?: { points: [number, number][][]; intensities: number[][]; }; }; type PolylineAnnotationJSON = ShapeAnnotationJSON & { type: 'pspdfkit/shape/polyline'; points: [number, number][]; lineCaps?: LineCapsType | null; lines?: { points: [number, number][][]; intensities: number[][]; }; }; type RectangleAnnotationJSON = ShapeAnnotationJSON & { type: 'pspdfkit/shape/rectangle'; cloudyBorderIntensity: number | null; cloudyBorderInset?: InsetJSON | null; measurementBBox: IRectJSON | null; }; type InkAnnotationJSON = BaseAnnotationJSON & { type: 'pspdfkit/ink'; lines: { points: [number, number][][]; intensities: number[][]; }; lineWidth: number; strokeColor: string | null; backgroundColor: string | null; isDrawnNaturally: boolean; isSignature: boolean; }; type LinkAnnotationJSON = BaseAnnotationJSON & { type: 'pspdfkit/link'; borderColor?: string | null; borderWidth?: number | null; borderStyle?: IBorderStyle | null; }; type NoteAnnotationJSON = Omit & { type: 'pspdfkit/note'; text?: { format: 'plain'; value: string; }; icon?: string; color?: string; }; type MediaAnnotationJSON = Omit & { type: 'pspdfkit/media'; description: string | null; fileName: string | null; contentType: string | null; mediaAttachmentId: string | null; }; type BaseTextMarkupAnnotationJSON = Omit & { rects: [number, number, number, number][]; }; type TextMarkupAnnotationJSON = BaseTextMarkupAnnotationJSON & { type: 'pspdfkit/markup/highlight' | 'pspdfkit/markup/squiggly' | 'pspdfkit/markup/strikeout' | 'pspdfkit/markup/underline' | 'pspdfkit/markup/redaction'; color: string | null; }; type RedactionAnnotationJSON = BaseTextMarkupAnnotationJSON & { type: 'pspdfkit/markup/redaction'; fillColor?: string | null; outlineColor?: string | null; overlayText?: string | null; repeatOverlayText?: boolean | null; rotation?: number; color?: string | null; }; type StampAnnotationJSON = Omit & { type: 'pspdfkit/stamp'; stampType: StampKind; title: string | null; color?: string | null; subTitle?: string | null; subtitle: string | null; rotation: number | null; xfdfAppearanceStream?: string; kind?: StampKind; }; type TextAnnotationJSON = Omit & { type: 'pspdfkit/text'; text: { format: 'xhtml' | 'plain'; value: string; }; fontColor?: string | null; backgroundColor?: string | null; font?: string | null; rotation?: number | null; fontSize?: number | null; fontStyle?: string[] | null; horizontalAlign?: 'left' | 'center' | 'right'; verticalAlign?: 'top' | 'center' | 'bottom'; callout?: { start: [number, number]; knee?: [number, number] | null; end: [number, number]; cap?: ILineCap | null; innerRectInset?: InsetJSON | null; } | null; borderStyle?: IBorderStyle | null; borderWidth?: number | null; borderColor?: string | null; isFitting?: boolean; lineHeightFactor?: number | null; }; type UnknownAnnotationJSON = Omit & { type: 'pspdfkit/unknown'; }; type WidgetAnnotationJSON = Omit & { type: 'pspdfkit/widget'; formFieldName: string; borderColor?: string | null; borderStyle?: IBorderStyle | null; borderDashArray?: number[] | null; borderWidth?: number | null; font?: string | null; fontSize?: 'auto' | number | null; fontColor?: string | null; backgroundColor?: string | null; horizontalAlign?: 'left' | 'center' | 'right' | null; verticalAlign?: 'top' | 'center' | 'bottom' | null; fontStyle?: string[] | null | undefined; rotation?: number; additionalActions?: SerializedAdditionalActionsType | null; lineHeightFactor?: number | null; }; type CommentMarkerAnnotationJSON = Omit & { type: 'pspdfkit/comment-marker'; }; type AnnotationJSONUnion = TextMarkupAnnotationJSON | TextAnnotationJSON | WidgetAnnotationJSON | RedactionAnnotationJSON | StampAnnotationJSON | NoteAnnotationJSON | LinkAnnotationJSON | InkAnnotationJSON | RectangleAnnotationJSON | PolylineAnnotationJSON | PolygonAnnotationJSON | LineAnnotationJSON | EllipseAnnotationJSON | ImageAnnotationJSON | UnknownAnnotationJSON | MediaAnnotationJSON | CommentMarkerAnnotationJSON; type BaseFormFieldJSON = { v: 1; pdfObjectId?: number | null; annotationIds: Array; name: string; label: string; flags?: FormFieldFlags; id: string; additionalActions?: SerializedAdditionalActionsType; group?: IGroup; permissions?: IPermissions; }; type ChoiceFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/listbox' | 'pspdfkit/form-field/combobox'; options: Array; multiSelect: boolean; commitOnChange: boolean; defaultValues: Array; }; type ListBoxFormFieldJSON = ChoiceFormFieldJSON & { type: 'pspdfkit/form-field/listbox'; }; type DoNotSpellCheckPropertyPair = XOR, Record<'doNotSpellcheck', boolean>>; type ComboBoxFormFieldJSON = ChoiceFormFieldJSON & { type: 'pspdfkit/form-field/combobox'; edit: boolean; } & DoNotSpellCheckPropertyPair; type CheckBoxFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/checkbox'; options: Array; defaultValues: Array; }; type RadioButtonFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/radio'; options: Array; noToggleToOff: boolean; radiosInUnison: boolean; defaultValue: string; }; type TextFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/text'; password: boolean; maxLength?: number | null; doNotScroll: boolean; multiLine: boolean; defaultValue: string; comb: boolean; } & DoNotSpellCheckPropertyPair; type ButtonFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/button'; buttonLabel: string | null; }; type SignatureFormFieldJSON = BaseFormFieldJSON & { type: 'pspdfkit/form-field/signature'; }; type FormFieldJSON = ListBoxFormFieldJSON | ComboBoxFormFieldJSON | RadioButtonFormFieldJSON | CheckBoxFormFieldJSON | TextFormFieldJSON | ButtonFormFieldJSON | SignatureFormFieldJSON; type SerializedJSON = { skippedPdfObjectIds?: number[]; annotations?: AnnotationJSONUnion[]; formFields?: FormFieldJSON[]; skippedPdfFormFieldIds?: number[]; formFieldValues?: Record[]; attachments?: Record; skippedPdfBookmarkIds?: string[]; bookmarks?: BookmarkJSON[]; }; type InstantJSON = SerializedJSON & { format: 'https://pspdfkit.com/instant-json/v1'; pdfId?: { permanent: string; changing: string; }; }; type Rotation$1 = 0 | 90 | 180 | 270; type AddPageConfiguration = { backgroundColor: Color; pageWidth: number; pageHeight: number; rotateBy: Rotation$1; insets?: Rect; }; type OperationAttachment = string | File | Blob; type min = number; type max = number; type Range = [min, max]; type ImportPageIndex = Array; type DocumentMetadata = { title?: string; author?: string; }; type NonSerializableDocumentOperations = { type: 'removePages'; pageIndexes: Array; } | { type: 'duplicatePages'; pageIndexes: Array; } | { type: 'movePages'; pageIndexes: Array; afterPageIndex: number; } | { type: 'movePages'; pageIndexes: Array; beforePageIndex: number; } | { type: 'rotatePages'; pageIndexes: Array; rotateBy: Rotation$1; } | { type: 'keepPages'; pageIndexes: Array; } | { type: 'importDocument'; afterPageIndex: number; treatImportedDocumentAsOnePage?: boolean; document: OperationAttachment; importedPageIndexes?: ImportPageIndex; } | { type: 'importDocument'; beforePageIndex: number; treatImportedDocumentAsOnePage?: boolean; document: OperationAttachment; importedPageIndexes?: ImportPageIndex; } | { type: 'applyInstantJson'; instantJson: Record; dataFilePath: OperationAttachment; } | { type: 'applyXfdf'; xfdf: string; dataFilePath: OperationAttachment; } | { type: 'flattenAnnotations'; pageIndexes?: Array; annotationIds?: string[]; } | { type: 'setPageLabel'; pageIndexes?: Array; pageLabel?: string; } | { type: 'performOcr'; pageIndexes?: Array | 'all'; language: string; } | { type: 'applyRedactions'; } | { type: 'updateMetadata'; metadata: DocumentMetadata; }; type DocumentOperation = (AddPageConfiguration & { type: 'addPage'; afterPageIndex: number; }) | (AddPageConfiguration & { type: 'addPage'; beforePageIndex: number; }) | { type: 'cropPages'; pageIndexes?: Array; cropBox: Rect; } | NonSerializableDocumentOperations; declare function toJSON(bookmark: Bookmark): BookmarkJSON; type ID$1 = string; type BookmarkProps = { id: ID$1 | null; pdfBookmarkId: ID$1 | null; name: string | null; sortKey: number | null; action: Action | null; }; declare const Bookmark_base: Record$1.Factory; declare class Bookmark extends Bookmark_base { id: ID$1; action: Action; static toSerializableObject: typeof toJSON; static fromSerializableObject: (bookmark: BookmarkJSON) => Bookmark; } declare const SearchPattern: { readonly CREDIT_CARD_NUMBER: "credit_card_number"; readonly DATE: "date"; readonly TIME: "time"; readonly EMAIL_ADDRESS: "email_address"; readonly INTERNATIONAL_PHONE_NUMBER: "international_phone_number"; readonly IP_V4: "ipv4"; readonly IP_V6: "ipv6"; readonly MAC_ADDRESS: "mac_address"; readonly NORTH_AMERICAN_PHONE_NUMBER: "north_american_phone_number"; readonly SOCIAL_SECURITY_NUMBER: "social_security_number"; readonly URL: "url"; readonly US_ZIP_CODE: "us_zip_code"; readonly VIN: "vin"; }; type ISearchPattern = (typeof SearchPattern)[keyof typeof SearchPattern]; declare const SearchType: { readonly TEXT: "text"; readonly PRESET: "preset"; readonly REGEX: "regex"; }; type ISearchType = (typeof SearchType)[keyof typeof SearchType]; declare const ProductId: { SharePoint: string; Salesforce: string; Maui_Android: string; Maui_iOS: string; Maui_MacCatalyst: string; Maui_Windows: string; }; type IProductId = (typeof ProductId)[keyof typeof ProductId]; type SignatureMetadata = { signerName?: string; signatureReason?: string; signatureLocation?: string; }; declare const DocumentPermissionsProps: { annotationsAndForms: boolean; assemble: boolean; extract: boolean; extractAccessibility: boolean; fillForms: boolean; modification: boolean; printHighQuality: boolean; printing: boolean; }; type IDocumentPermissions = keyof typeof DocumentPermissionsProps; type SignaturePosition = { pageIndex: number; boundingBox: Rect; }; declare const SignatureAppearanceMode: { readonly signatureOnly: "signatureOnly"; readonly signatureAndDescription: "signatureAndDescription"; readonly descriptionOnly: "descriptionOnly"; }; type ISignatureAppearanceMode = (typeof SignatureAppearanceMode)[keyof typeof SignatureAppearanceMode]; type SignatureAppearance = { mode?: ISignatureAppearanceMode; showSigner?: boolean; showSignDate?: boolean; showReason?: boolean; showLocation?: boolean; showWatermark?: boolean; watermarkImage?: Blob | File; }; type Glyph = { c: string; rect: Rect; }; declare const TextLineElementKind: { P: string; TH: string; TD: string; H1: string; H2: string; H3: string; H4: string; H5: string; H6: string; Figure: string; Link: string; }; type ITextLineElementKind = (typeof TextLineElementKind)[keyof typeof TextLineElementKind]; type ActionFlags = 'includeExclude' | 'includeNoValueFields' | 'exportFormat' | 'getMethod' | 'submitCoordinated' | 'xfdf' | 'includeAppendSaves' | 'includeAnnotations' | 'submitPDF' | 'canonicalFormat' | 'excludeNonUserAnnotations' | 'excludeFKey' | 'embedForm'; type ActionJSON = { type: 'uri'; uri: string; subactions?: Array; } | { type: 'goTo'; pageIndex: number; subactions?: Array; } | { type: 'goToEmbedded'; newWindow: boolean; relativePath: string; targetType: 'parent' | 'child'; subactions?: Array; } | { type: 'goToRemote'; relativePath: string; namedDestination: string; subactions?: Array; } | { type: 'hide'; hide: boolean; annotationReferences: Array; subactions?: Array; } | { type: 'resetForm'; fields: Array | null; flags: string | null; subactions?: Array; } | { type: 'submitForm'; uri: string; fields: Array | null; flags: Array | null; subactions?: Array; } | { type: 'launch'; filePath: string; subactions?: Array; } | { type: 'named'; action: string; subactions?: Array; } | { type: 'javaScript'; script: string; subactions?: Array; }; type BookmarkJSON = { v: 1; type: 'pspdfkit/bookmark'; id: string; name: string | null; sortKey: number | null; action: ActionJSON; pdfBookmarkId: string | null; }; type RawPdfBoxes = { bleedBox: null | IRectJSON; cropBox: null | IRectJSON; mediaBox: null | IRectJSON; trimBox: null | IRectJSON; }; type ContentTreeElementMetadata = { pdfua_type: ITextLineElementKind | null; type: string | null; alt: string | null; }; declare const DocumentComparisonSourceType: { readonly USE_OPEN_DOCUMENT: "USE_OPEN_DOCUMENT"; readonly USE_FILE_DIALOG: "USE_FILE_DIALOG"; }; type IDocumentComparisonSourceType = (typeof DocumentComparisonSourceType)[keyof typeof DocumentComparisonSourceType]; type DocumentComparisonSource = { source: IDocumentComparisonSourceType | string | ArrayBuffer | Promise; pageIndex?: number; }; type DocumentComparisonStrokeColors = { documentA?: Color; documentB?: Color; }; type DocumentComparisonConfiguration = { documentA: DocumentComparisonSource; documentB: DocumentComparisonSource; strokeColors?: DocumentComparisonStrokeColors; blendMode?: IBlendMode; autoCompare: boolean; }; declare const LayoutMode: { readonly SINGLE: "SINGLE"; readonly DOUBLE: "DOUBLE"; readonly AUTO: "AUTO"; }; type ILayoutMode = (typeof LayoutMode)[keyof typeof LayoutMode]; declare const ScrollMode: { readonly CONTINUOUS: "CONTINUOUS"; readonly PER_SPREAD: "PER_SPREAD"; readonly DISABLED: "DISABLED"; }; type IScrollMode = (typeof ScrollMode)[keyof typeof ScrollMode]; declare const ZoomMode: { readonly AUTO: "AUTO"; readonly FIT_TO_WIDTH: "FIT_TO_WIDTH"; readonly FIT_TO_VIEWPORT: "FIT_TO_VIEWPORT"; readonly CUSTOM: "CUSTOM"; }; type IZoomMode = (typeof ZoomMode)[keyof typeof ZoomMode]; declare const SearchResult_base: Record$1.Factory<{ pageIndex: number | null; previewText: string; locationInPreview: number | null; lengthInPreview: number | null; rectsOnPage: List; isAnnotation: boolean | null; annotationRect?: Rect | null | undefined; }>; declare class SearchResult extends SearchResult_base { } declare const SearchState_base: Record$1.Factory; declare class SearchState extends SearchState_base { } interface ISearchState { isFocused: boolean; isLoading: boolean; term: string; focusedResultIndex: number; results: List; minSearchQueryLength: number; } type OnCommentCreationStartCallback = (comment: Comment) => Comment; declare const AutoSaveMode: { readonly IMMEDIATE: "IMMEDIATE"; readonly INTELLIGENT: "INTELLIGENT"; readonly DISABLED: "DISABLED"; }; type IAutoSaveMode = (typeof AutoSaveMode)[keyof typeof AutoSaveMode]; declare const PrintMode: { readonly DOM: "DOM"; readonly EXPORT_PDF: "EXPORT_PDF"; }; type IPrintMode = (typeof PrintMode)[keyof typeof PrintMode]; declare const PrintQuality: { readonly LOW: "LOW"; readonly MEDIUM: "MEDIUM"; readonly HIGH: "HIGH"; }; type IPrintQuality = (typeof PrintQuality)[keyof typeof PrintQuality]; declare const SidebarPlacement: { readonly START: "START"; readonly END: "END"; }; type ISidebarPlacement = (typeof SidebarPlacement)[keyof typeof SidebarPlacement]; declare const ToolbarPlacement: { readonly TOP: "TOP"; readonly BOTTOM: "BOTTOM"; }; type IToolbarPlacement = (typeof ToolbarPlacement)[keyof typeof ToolbarPlacement]; declare const ShowSignatureValidationStatusMode: { readonly IF_SIGNED: "IF_SIGNED"; readonly HAS_WARNINGS: "HAS_WARNINGS"; readonly HAS_ERRORS: "HAS_ERRORS"; readonly NEVER: "NEVER"; }; type IShowSignatureValidationStatusMode = (typeof ShowSignatureValidationStatusMode)[keyof typeof ShowSignatureValidationStatusMode]; interface AnnotationNoteProps extends INoteAnnotation { parentAnnotation: AnnotationsUnion | null; position: Point; notePosition?: Point; } declare class AnnotationNote extends NoteAnnotation { parentAnnotation?: AnnotationsUnion; position: Point; notePosition?: Point; static defaultValues: IObject; } declare const ModificationType: { readonly CREATED: "CREATED"; readonly UPDATED: "UPDATED"; readonly DELETED: "DELETED"; }; type IModificationType = (typeof ModificationType)[keyof typeof ModificationType]; type SaveErrorReason = { error: any; object: any; modificationType: IModificationType; }; declare function PSPDFKitSaveError(messageOrError: string | Error, reason: Array): Error; declare namespace PSPDFKitSaveError { var prototype: any; } type AnnotationPreset$1 = Record; type AnnotationPresetID$1 = string; type ToolItemType = 'custom'; type ToolItem = { type: ToolItemType; node?: Node; id?: string; title?: string; className?: string; icon?: string; onPress?: IFunction; selected?: boolean; disabled?: boolean; }; type AnnotationTooltipCallback = (annotation: AnnotationsUnion) => Array; declare global { interface SymbolConstructor { readonly observable: symbol } } type RendererConfiguration = { node: Node; append?: boolean | null; noZoom?: boolean | null; onDisappear?: ((arg0: Node | null) => void) | null; }; type CustomRenderers = { Annotation?: (arg0: { annotation: AnnotationsUnion; }) => RendererConfiguration | null | undefined; CommentAvatar?: (arg0: { comment: Comment; }) => RendererConfiguration | null | undefined; }; declare const SidebarMode: { readonly ANNOTATIONS: "ANNOTATIONS"; readonly BOOKMARKS: "BOOKMARKS"; readonly DOCUMENT_OUTLINE: "DOCUMENT_OUTLINE"; readonly THUMBNAILS: "THUMBNAILS"; readonly CUSTOM: "CUSTOM"; }; type ISidebarMode = (typeof SidebarMode)[keyof typeof SidebarMode]; declare const UIElement: { readonly Sidebar: "Sidebar"; }; type IUIElement = (typeof UIElement)[keyof typeof UIElement]; type RendererProps = { containerNode: Node; items?: List | null; }; type ItemRendererProps = { itemContainerNode: Node; item: any; }; type ItemCustomRenderer = (itemRendererProps: ItemRendererProps) => void; type UIRendererConfiguration = { node: Node; onRenderItem?: ItemCustomRenderer; }; type Renderer = (rendererProps: RendererProps) => UIRendererConfiguration; type CustomUISidebarConfiguration = Partial<{ [K in ISidebarMode]: Renderer; }>; type CustomUIElementConfiguration = CustomUISidebarConfiguration; type CustomUI = Partial>; declare const FormFieldValue_base: Record$1.Factory<{ name?: string | undefined; value?: string | number | List | null | undefined; optionIndexes?: List | undefined; isFitting?: boolean | undefined; }>; declare class FormFieldValue extends FormFieldValue_base { name: string; value: string | List | null; optionIndexes?: List; isFitting?: boolean; static defaultValues: IObject; constructor(args?: IObject); } type Change = AnnotationsUnion | Bookmark | FormField | FormFieldValue | Comment; type IsEditableAnnotationCallback = (annotation: AnnotationsUnion) => boolean; type RenderPageCallback = (context: CanvasRenderingContext2D, pageIndex: number, pageSize: Size) => unknown; type CustomOverlayItemID = string; interface ICustomOverlayItem { disableAutoZoom?: boolean; id: CustomOverlayItemID | null; node: Node | null; noRotate?: boolean; pageIndex: number; position: Point; onAppear?: null | ((...args: Array) => any); onDisappear?: null | ((...args: Array) => any); } declare const CustomOverlayItem_base: Record$1.Factory; declare class CustomOverlayItem extends CustomOverlayItem_base { disableAutoZoom: boolean; id: CustomOverlayItemID; node: Node; noRotate: boolean; pageIndex: number; position: Point; onAppear?: ((...args: Array) => any) | null; onDisappear?: ((...args: Array) => any) | null; constructor(args: ICustomOverlayItem); } type ColorPreset = { color: Color | null; localization: { id: string; defaultMessage?: string; description?: string; }; }; interface ITextLine { id: number | null; pageIndex: number | null; boundingBox: Rect; contents: string; contentTreeElementMetadata: ContentTreeElementMetadata | null; } declare const TextLine_base: Record$1.Factory; declare class TextLine extends TextLine_base { } type FontCallback = (arg0: string) => Promise; interface IFont { name: string | null; callback: FontCallback | null; } declare const Font_base: Record$1.Factory; declare class Font extends Font_base { constructor(args: { name: string; callback?: FontCallback; }); } interface ITextRange { startNode: Text | null; startOffset: number | null; endNode: Text | null; endOffset: number | null; } declare const TextRange_base: Record$1.Factory; declare class TextRange extends TextRange_base { startNode: Text; startOffset: number; endNode: Text; endOffset: number; startAndEndIds(): { startTextLineId: number; endTextLineId: number; startPageIndex: number; endPageIndex: number; }; } interface ITextSelection$1 { textRange: TextRange | null; startTextLineId: number | null; endTextLineId: number | null; startPageIndex: number | null; endPageIndex: number | null; } declare const TextSelection_base: Record$1.Factory; declare class TextSelection extends TextSelection_base { } type IsEditableCommentCallback = (comment: Comment) => boolean; declare const ElectronicSignatureCreationMode: { readonly DRAW: "DRAW"; readonly IMAGE: "IMAGE"; readonly TYPE: "TYPE"; }; type IElectronicSignatureCreationMode = (typeof ElectronicSignatureCreationMode)[keyof typeof ElectronicSignatureCreationMode]; type BuiltInDocumentEditorFooterItem = 'cancel' | 'spacer' | 'save-as' | 'save' | 'selected-pages' | 'loading-indicator'; type DocumentEditorFooterItem = { type: BuiltInDocumentEditorFooterItem | 'custom'; node?: Node; className?: string; id?: string; onPress?: (e: MouseEvent, id?: string) => void; }; type BuiltInDocumentEditorToolbarItem = 'add' | 'remove' | 'duplicate' | 'rotate-left' | 'rotate-right' | 'move' | 'move-left' | 'move-right' | 'import-document' | 'spacer' | 'undo' | 'redo' | 'select-all' | 'select-none'; type DocumentEditorToolbarItem = Omit & { type: BuiltInDocumentEditorToolbarItem | 'custom'; }; type AnnotationsResizeEvent = { annotation: AnnotationsUnion; isShiftPressed: boolean; resizeAnchor: ResizeAnchor; }; type ResizeAnchor = 'TOP' | 'BOTTOM' | 'LEFT' | 'RIGHT' | 'TOP_LEFT' | 'TOP_RIGHT' | 'BOTTOM_RIGHT' | 'BOTTOM_LEFT'; type AnnotationResizeStartCallbackConfiguration = { maintainAspectRatio?: boolean; minWidth?: number | undefined; minHeight?: number | undefined; maxWidth?: number | undefined; maxHeight?: number | undefined; }; type AnnotationResizeStartCallback = (event: AnnotationsResizeEvent) => AnnotationResizeStartCallbackConfiguration; declare const InteractionMode: { readonly TEXT_HIGHLIGHTER: "TEXT_HIGHLIGHTER"; readonly INK: "INK"; readonly INK_SIGNATURE: "INK_SIGNATURE"; readonly SIGNATURE: "SIGNATURE"; readonly STAMP_PICKER: "STAMP_PICKER"; readonly STAMP_CUSTOM: "STAMP_CUSTOM"; readonly SHAPE_LINE: "SHAPE_LINE"; readonly SHAPE_RECTANGLE: "SHAPE_RECTANGLE"; readonly SHAPE_ELLIPSE: "SHAPE_ELLIPSE"; readonly SHAPE_POLYGON: "SHAPE_POLYGON"; readonly SHAPE_POLYLINE: "SHAPE_POLYLINE"; readonly INK_ERASER: "INK_ERASER"; readonly NOTE: "NOTE"; readonly COMMENT_MARKER: "COMMENT_MARKER"; readonly TEXT: "TEXT"; readonly CALLOUT: "CALLOUT"; readonly PAN: "PAN"; readonly SEARCH: "SEARCH"; readonly DOCUMENT_EDITOR: "DOCUMENT_EDITOR"; readonly MARQUEE_ZOOM: "MARQUEE_ZOOM"; readonly REDACT_TEXT_HIGHLIGHTER: "REDACT_TEXT_HIGHLIGHTER"; readonly REDACT_SHAPE_RECTANGLE: "REDACT_SHAPE_RECTANGLE"; readonly DOCUMENT_CROP: "DOCUMENT_CROP"; readonly BUTTON_WIDGET: "BUTTON_WIDGET"; readonly TEXT_WIDGET: "TEXT_WIDGET"; readonly RADIO_BUTTON_WIDGET: "RADIO_BUTTON_WIDGET"; readonly CHECKBOX_WIDGET: "CHECKBOX_WIDGET"; readonly COMBO_BOX_WIDGET: "COMBO_BOX_WIDGET"; readonly LIST_BOX_WIDGET: "LIST_BOX_WIDGET"; readonly SIGNATURE_WIDGET: "SIGNATURE_WIDGET"; readonly DATE_WIDGET: "DATE_WIDGET"; readonly FORM_CREATOR: "FORM_CREATOR"; readonly LINK: "LINK"; readonly DISTANCE: "DISTANCE"; readonly PERIMETER: "PERIMETER"; readonly RECTANGLE_AREA: "RECTANGLE_AREA"; readonly ELLIPSE_AREA: "ELLIPSE_AREA"; readonly POLYGON_AREA: "POLYGON_AREA"; readonly CONTENT_EDITOR: "CONTENT_EDITOR"; readonly MULTI_ANNOTATIONS_SELECTION: "MULTI_ANNOTATIONS_SELECTION"; readonly MEASUREMENT: "MEASUREMENT"; readonly MEASUREMENT_SETTINGS: "MEASUREMENT_SETTINGS"; }; type IInteractionMode = (typeof InteractionMode)[keyof typeof InteractionMode]; type OnOpenUriCallback = (uri: string, isUserInitiated: boolean) => boolean; declare class PageInfo { index: number; label: string; height: number; width: number; rotation: number; rawPdfBoxes: RawPdfBoxes; } declare const ViewportPadding_base: Record$1.Factory<{ horizontal: number; vertical: number; }>; declare class ViewportPadding extends ViewportPadding_base { } type SidebarOptions = { [SidebarMode.ANNOTATIONS]: AnnotationsSidebarOptions; }; type AnnotationsSidebarOptions = { includeContent: Array>; }; type Rotation = 0 | 90 | 180 | 270; interface IViewState { allowPrinting: boolean; allowExport: boolean; currentPageIndex: number; instance: Instance | null; interactionMode: IInteractionMode | null; keepFirstSpreadAsSinglePage: boolean; layoutMode: ILayoutMode; pageSpacing: number; pagesRotation: Rotation; readOnly: boolean; scrollMode: IScrollMode; showAnnotations: boolean; showComments: boolean; showAnnotationNotes: boolean; showToolbar: boolean; enableAnnotationToolbar: boolean; sidebarMode: ISidebarMode | null | undefined; sidebarOptions: SidebarOptions; sidebarPlacement: ISidebarPlacement; spreadSpacing: number; viewportPadding: ViewportPadding; zoom: IZoomMode | number; zoomStep: number; formDesignMode: boolean; showSignatureValidationStatus: IShowSignatureValidationStatusMode; previewRedactionMode: boolean; canScrollWhileDrawing: boolean; keepSelectedTool: boolean; resolvedLayoutMode: ILayoutMode; sidebarWidth: number; } declare const ViewState_base: Record$1.Factory; declare class ViewState extends ViewState_base { zoomIn(): ViewState; zoomOut(): ViewState; rotateLeft(): ViewState; rotateRight(): ViewState; goToNextPage(): ViewState; goToPreviousPage(): ViewState; } declare class InstantClient { clientId: string; userId: string | null | undefined; } declare const allowedToolbarTypes: ("distance" | "note" | "comment" | "text" | "zoom-in" | "zoom-out" | "link" | "search" | "ellipse" | "image" | "line" | "polygon" | "polyline" | "spacer" | "arrow" | "highlighter" | "undo" | "redo" | "callout" | "custom" | "print" | "rectangle" | "ink" | "stamp" | "cloudy-rectangle" | "dashed-rectangle" | "cloudy-ellipse" | "dashed-ellipse" | "cloudy-polygon" | "dashed-polygon" | "text-highlighter" | "perimeter" | "ellipse-area" | "rectangle-area" | "polygon-area" | "sidebar-thumbnails" | "sidebar-document-outline" | "sidebar-annotations" | "sidebar-bookmarks" | "pager" | "multi-annotations-selection" | "pan" | "zoom-mode" | "annotate" | "ink-eraser" | "signature" | "document-editor" | "document-crop" | "export-pdf" | "debug" | "layout-config" | "marquee-zoom" | "responsive-group" | "redact-text-highlighter" | "redact-rectangle" | "document-comparison" | "measure" | "form-creator" | "content-editor")[]; type ToolbarItemType = ToolItemType | (typeof allowedToolbarTypes)[number]; type ToolbarItem = Omit & { type: ToolbarItemType; mediaQueries?: string[]; responsiveGroup?: string; dropdownGroup?: string; preset?: AnnotationPresetID$1; onKeyPress?: (...args: Array) => any; }; type OutlineElementProps = { children: List; title: string; color: Color | null; isBold: boolean; isItalic: boolean; isExpanded: boolean; action: Action | null; }; declare const OutlineElement_base: Record$1.Factory; declare class OutlineElement extends OutlineElement_base { } type TwoStepSignatureCallback = (arg0: { hash: string; fileContents: ArrayBuffer | null; dataToBeSigned: ArrayBuffer; }) => Promise; type SignatureContainerType = 'raw' | 'pkcs7'; type SigningData = { certificates?: ArrayBuffer[] | string[]; signatureType: SignatureTypeType; privateKey?: string; signatureContainer?: SignatureContainerType; }; type SignaturePreparationData = { placeholderSize?: number; flatten?: boolean; formFieldName?: string; position?: SignaturePosition; appearance?: SignatureAppearance; }; type SignatureCreationData = SignaturePreparationData & { signatureMetadata?: SignatureMetadata; } & { signingData?: SigningData; }; type SigningServiceData = { signingToken: string; }; type RedactionAnnotationPreset = { fillColor?: Color; overlayText?: string; repeatOverlayText?: boolean; color?: Color; outlineColor?: Color; creatorName?: string; }; type AnnotationsPressEvent = { annotation: AnnotationsUnion; nativeEvent: Event; preventDefault?: () => void; selected: boolean; }; declare enum AnnotationsWillChangeReason { DRAW_START = "DRAW_START", DRAW_END = "DRAW_END", TEXT_EDIT_START = "TEXT_EDIT_START", TEXT_EDIT_END = "TEXT_EDIT_END", SELECT_START = "SELECT_START", SELECT_END = "SELECT_END", MOVE_START = "MOVE_START", MOVE_END = "MOVE_END", RESIZE_START = "RESIZE_START", RESIZE_END = "RESIZE_END", ROTATE_START = "ROTATE_START", ROTATE_END = "ROTATE_END", DELETE_START = "DELETE_START", DELETE_END = "DELETE_END", PROPERTY_CHANGE = "PROPERTY_CHANGE" } type PagePressEvent = { pageIndex: number; point: Point; nativeEvent: Event; }; type AnnotationPresetsUpdateEvent = { preventDefault: () => boolean; currentPreset: AnnotationPresetID; currentPresetProperties: AnnotationPreset; newPresetProperties: AnnotationPreset; }; type AnnotationsFocusEvent = { annotation: AnnotationsUnion; nativeEvent: FocusEvent; }; type AnnotationsBlurEvent = { annotation: AnnotationsUnion; nativeEvent: FocusEvent; }; type SaveStateChangeEvent = { hasUnsavedChanges: boolean; }; type SearchTermChangeEvent = { term: string; preventDefault: () => void; }; type TextLinePressEvent = { textLine: TextLine; point: Point; nativeEvent: Event; }; type CropAreaChangeStartEvent = { cropBox: Rect; pageIndex: number; }; type CropAreaChangeStopEvent = { cropBox: Rect; pageIndex: number; }; type AnnotationsTransformEvent = { annotation: AnnotationsUnion; }; type AnnotationsCopyEvent = { annotation: AnnotationsUnion; }; type AnnotationsCutEvent = { annotation: AnnotationsUnion; }; type AnnotationsPasteEvent = { annotation: AnnotationsUnion; formField?: FormField; previousAction: 'COPY' | 'CUT'; originalAnnotation: AnnotationsUnion; originalFormField?: FormField; }; type AnnotationsDuplicateEvent = { annotation: AnnotationsUnion; formField?: FormField; originalAnnotation: AnnotationsUnion; originalFormField?: FormField; }; interface ITextSelection { startTextLineId: number | null; startPageIndex: number | null; startNode: Text | null; startOffset: number | null; endTextLineId: number | null; endPageIndex: number | null; endNode: Text | null; endOffset: number | null; getText: (() => Promise) | null; getSelectedTextLines: (() => Promise>) | null; getBoundingClientRect: (() => Promise) | null; getSelectedRectsPerPage: (() => Promise; }>>) | null; } declare const PublicTextSelection_base: Record$1.Factory; declare class PublicTextSelection extends PublicTextSelection_base { startTextLineId: number; startPageIndex: number; startNode: Text; startOffset: number; endTextLineId: number; endPageIndex: number; endNode: Text; endOffset: number; getText: () => Promise; getSelectedTextLines: () => Promise>; getBoundingClientRect: () => Promise; getSelectedRectsPerPage: () => Promise; }>>; } type AnnotationNotePressEvent = { preventDefault: () => boolean; annotationNote?: AnnotationNote | null; }; type AnnotationNoteHoverEvent = { preventDefault: () => boolean; annotationNote?: AnnotationNote | null; }; type DocumentComparisonUIStartEvent = DocumentComparisonConfiguration; type CommentsMentionEvent = { comment: Comment; modifications: List<{ userId: string; action: 'ADDED' | 'REMOVED'; }>; }; type Signature = InkAnnotation | ImageAnnotation; interface HistoryEvent { action: T; before: AnnotationsUnion; after: AnnotationsUnion; } interface EventMap { 'viewState.change': (viewState: ViewState, previousViewState: ViewState) => void; 'viewState.currentPageIndex.change': (pageIndex: number) => void; 'viewState.zoom.change': (zoom: number) => void; 'annotationPresets.update': (event: AnnotationPresetsUpdateEvent) => void; 'annotations.blur': (event: AnnotationsBlurEvent) => void; 'annotations.change': () => void; 'annotations.create': (annotations: List) => void; 'annotations.delete': (annotations: List) => void; 'annotations.didSave': () => void; 'annotations.focus': (event: AnnotationsFocusEvent) => void; 'annotations.load': (annotations: List) => void; 'annotations.press': (event: AnnotationsPressEvent) => void; 'annotations.update': (annotations: List) => void; 'annotations.willChange': (event: { reason: AnnotationsWillChangeReason; annotations: List; }) => void; 'annotations.willSave': () => void; 'annotationSelection.change': (annotation?: AnnotationsUnion) => void; 'annotations.transform': (event: AnnotationsTransformEvent) => void; 'annotations.copy': (event: AnnotationsCopyEvent) => void; 'annotations.cut': (event: AnnotationsCutEvent) => void; 'annotations.paste': (event: AnnotationsPasteEvent) => void; 'annotations.duplicate': (event: AnnotationsDuplicateEvent) => void; 'bookmarks.change': () => void; 'bookmarks.create': (bookmarks: List) => void; 'bookmarks.update': (bookmarks: List) => void; 'bookmarks.delete': (bookmarks: List) => void; 'bookmarks.load': (bookmarks: List) => void; 'bookmarks.didSave': () => void; 'bookmarks.willSave': () => void; 'comments.change': () => void; 'comments.create': (comments: List) => void; 'comments.delete': (comments: List) => void; 'comments.update': (comments: List) => void; 'comments.load': () => void; 'comments.willSave': () => void; 'comments.didSave': () => void; 'instant.connectedClients.change': (clients: Map) => void; 'document.change': (operations: DocumentOperation[]) => void; 'document.saveStateChange': (event: SaveStateChangeEvent) => void; 'formFieldValues.update': (formFields: List) => void; 'formFieldValues.willSave': () => void; 'formFieldValues.didSave': (res: { response: Response; error: Error; }) => void; 'forms.willSubmit': (event: { preventDefault: () => void; }) => void; 'forms.didSubmit': (event: { preventDefault: () => void; }) => void; 'formFields.change': () => void; 'formFields.create': (formFields: List) => void; 'formFields.delete': (formFields: List) => void; 'formFields.didSave': () => void; 'formFields.load': (formFields: List) => void; 'formFields.update': (formFields: List) => void; 'formFields.willSave': () => void; 'search.stateChange': (searchState: SearchState) => void; 'search.termChange': (event: SearchTermChangeEvent) => void; 'storedSignatures.change': () => void; 'storedSignatures.create': (signature: Signature) => void; 'storedSignatures.delete': (signature: Signature) => void; 'storedSignatures.update': (signatures: List) => void; 'textLine.press': (event: TextLinePressEvent) => void; 'textSelection.change': (selection: PublicTextSelection | null) => void; 'history.change': (event: HistoryEvent<'undo' | 'redo'>) => void; 'history.willChange': (event: { type: 'create' | 'update' | 'delete'; annotation: Annotation; preventDefault: () => void; }) => void; 'history.clear': () => void; 'history.redo': (event: HistoryEvent<'redo'>) => void; 'history.undo': (event: HistoryEvent<'undo'>) => void; 'page.press': (event: PagePressEvent) => void; 'inkSignatures.create': (signature: Signature) => void; 'inkSignatures.delete': (signature: Signature) => void; 'inkSignatures.update': (signatures: Signature[]) => void; 'inkSignatures.change': () => void; 'cropArea.changeStart': (opts: CropAreaChangeStartEvent) => void; 'cropArea.changeStop': (opts: CropAreaChangeStopEvent) => void; 'documentComparisonUI.start': (opts: DocumentComparisonUIStartEvent) => void; 'documentComparisonUI.end': () => void; 'annotationNote.press': (event: AnnotationNotePressEvent) => void; 'annotationNote.hover': (event: AnnotationNoteHoverEvent) => void; 'comments.mention': (event: CommentsMentionEvent) => void; } interface IEmbeddedFile { id: ID; attachmentId: string; description: null | string; fileName: null | string; fileSize: null | number; updatedAt: null | Date; } declare const EmbeddedFile_base: Record$1.Factory; declare class EmbeddedFile extends EmbeddedFile_base { } type IAnnotationToolbarType = 'stroke-color' | 'fill-color' | 'background-color' | 'opacity' | 'line-width' | 'blend-mode' | 'spacer' | 'delete' | 'annotation-note' | 'border-color' | 'border-width' | 'border-style' | 'color' | 'linecaps-dasharray' | 'line-style' | 'font' | 'overlay-text' | 'outline-color' | 'apply-redactions' | 'measurementType' | 'measurementScale' | 'back'; type BuiltInAnnotationToolbarItem = { type: IAnnotationToolbarType; }; type Shared = Omit & { onPress?: (nativeEvent: MouseEvent, id?: string) => void; iconClassName?: string; onIconPress?: (nativeEvent: MouseEvent, id?: string) => void; }; type AnnotationToolbarItem = (Omit & { type: IAnnotationToolbarType; }) | (Omit & { id: string; type: 'custom'; icon?: string | Node; node?: Node; }); type AnnotationToolbarItemsCallback = (annotation: AnnotationsUnion, options: { defaultAnnotationToolbarItems: BuiltInAnnotationToolbarItem[]; hasDesktopLayout: boolean; }) => AnnotationToolbarItem[]; type OnWidgetAnnotationCreationStartCallback = (annotation: WidgetAnnotation, formField: FormField) => { annotation?: WidgetAnnotation; formField?: FormField; }; declare const builtInItems: readonly ["highlight", "strikeout", "underline", "squiggle", "redact-text-highlighter", "comment"]; type InlineToolbarType = (typeof builtInItems)[number]; type InlineTextSelectionToolbarItem = Omit & { type: InlineToolbarType | 'custom'; }; type InlineTextSelectionToolbarItemsCallback = (options: { defaultItems: InlineTextSelectionToolbarItem[]; hasDesktopLayout: boolean; }, selection: TextSelection) => InlineTextSelectionToolbarItem[]; type ViewStateSetter = (currentState: ViewState) => ViewState; type ToolbarItemsSetter = (currentState: ToolbarItem[]) => ToolbarItem[]; type StoredSignaturesSetter = (annotations: List) => List; type SearchStateSetter = (currentState: SearchState) => SearchState; type AnnotationPresetsSetter = (currentState: Record) => Record; type StampAnnotationTemplatesSetter = (currentState: Array) => Array; type SetDocumentEditorFooterFunction = (currentState: DocumentEditorFooterItem[]) => DocumentEditorFooterItem[]; type SetDocumentEditorToolbarFunction = (currentState: DocumentEditorToolbarItem[]) => DocumentEditorToolbarItem[]; declare class Instance { totalPageCount: number; pageInfoForIndex: (pageIndex: number) => PageInfo | null | undefined; textLinesForPageIndex: (pageIndex: number) => Promise>; getMarkupAnnotationText: (annotation: TextMarkupAnnotationsUnion) => Promise; getTextFromRects: (pageIndex: number, rects: List) => Promise; currentZoomLevel: number; maximumZoomLevel: number; minimumZoomLevel: number; zoomStep: number; connectedClients: Map; addEventListener: (action: K, listener: EventMap[K]) => void; removeEventListener: (action: K, listener: EventMap[K]) => void; jumpToRect: (pageIndex: number, rect: Rect) => void; jumpAndZoomToRect: (pageIndex: number, rect: Rect) => void; transformContentClientToPageSpace: (rectOrPoint: Rect | Point, pageIndex: number) => Rect | Point; transformContentPageToClientSpace: (rectOrPoint: Rect | Point, pageIndex: number) => Rect | Point; transformClientToPageSpace: (rectOrPoint: Rect | Point, pageIndex: number) => Rect | Point; transformPageToClientSpace: (rectOrPoint: Rect | Point, pageIndex: number) => Rect | Point; transformRawToPageSpace: (rawInset: InsetJSON | Inset, pageIndex: number) => Rect; transformPageToRawSpace: (rect: Rect, pageIndex: number) => Inset; exportPDF: (flags?: ExportPDFFlags) => Promise; exportXFDF: () => Promise; exportInstantJSON: (version?: number) => Promise; renderPageAsArrayBuffer: (options: { width: number; } | { height: number; }, pageIndex: number) => Promise; renderPageAsImageURL: (options: { width: number; } | { height: number; }, pageIndex: number) => Promise; print: (printMode?: IPrintMode | { mode?: IPrintMode; excludeAnnotations?: boolean; }) => void; abortPrint: () => void; setCustomRenderers: (customRenderers: CustomRenderers) => void; setCustomUIConfiguration: (customUIConfigurationOrConfigurationSetter: CustomUI | ((customUI: CustomUI | null) => CustomUI)) => void; getDocumentOutline: () => Promise>; getPageGlyphs: (pageIndex: number) => Promise>; setAnnotationCreatorName: (annotationCreatorName?: string | null) => void; setOnWidgetAnnotationCreationStart: (callback: OnWidgetAnnotationCreationStartCallback) => void; setOnCommentCreationStart: (callback: OnCommentCreationStartCallback) => void; contentWindow: Window; contentDocument: Document; readonly viewState: ViewState; setViewState: (stateOrFunction: ViewStateSetter | ViewState) => void; readonly toolbarItems: ToolbarItem[]; setToolbarItems: (stateOrFunction: ToolbarItemsSetter | ToolbarItem[]) => void; setAnnotationToolbarItems: (annotationToolbarItemsCallback: AnnotationToolbarItemsCallback) => void; setInlineTextSelectionToolbarItems: (InlineTextSelectionToolbarItemsCallback: InlineTextSelectionToolbarItemsCallback) => void; annotationPresets: Record; setAnnotationPresets: (stateOrFunction: AnnotationPresetsSetter | Record) => void; setCurrentAnnotationPreset: (annotationPresetID?: string | null) => void; readonly currentAnnotationPreset: string | null | undefined; readonly stampAnnotationTemplates: Array; setStampAnnotationTemplates: (stateOrFunction: StampAnnotationTemplatesSetter | Array) => void; getAnnotations: (pageIndex: number) => Promise>; createAttachment: (file: Blob) => Promise; getAttachment: (attachmentId: string) => Promise; calculateFittingTextAnnotationBoundingBox: (annotation: TextAnnotation) => TextAnnotation; setOnAnnotationResizeStart: (callback: AnnotationResizeStartCallback) => void; getBookmarks: () => Promise>; getFormFields: () => Promise>; getFormFieldValues: () => Record>; setFormFieldValues: (formFieldValues: Record>) => void; getTextSelection: () => Record | null | undefined; getSelectedAnnotation: () => AnnotationsUnion | null | undefined; getSelectedAnnotations: () => List | null | undefined; getAnnotationsGroups: () => Map; }> | null | undefined; setSelectedAnnotation: (annotationOrAnnotationId?: (AnnotationsUnion | ID) | null) => void; setSelectedAnnotations: (annotationsOrAnnotationsId?: List | null) => void; groupAnnotations: (annotationsOrAnnotationsId?: List) => void; deleteAnnotationsGroup: (annotationGroupId?: string) => void; setEditingAnnotation: (annotationOrAnnotationId?: (AnnotationsUnion | ID) | null, autoSelectText?: boolean | null) => void; setCustomOverlayItem: (item: CustomOverlayItem) => void; removeCustomOverlayItem: (id: CustomOverlayItemID) => void; readonly locale: string; setLocale: (arg0: string) => Promise; getInkSignatures: () => Promise>; getStoredSignatures: () => Promise>; setInkSignatures: (stateOrFunction: StoredSignaturesSetter | List) => Promise; setStoredSignatures: (stateOrFunction: StoredSignaturesSetter | List) => Promise; search: (term: string, options?: { startPageIndex?: number; endPageIndex?: number; searchType?: ISearchType; searchInAnnotations?: boolean; caseSensitive?: boolean; }) => Promise>; startUISearch: (term: string) => void; readonly searchState: SearchState; setSearchState: (stateOrFunction: SearchStateSetter | SearchState) => void; readonly editableAnnotationTypes: Array>; setEditableAnnotationTypes: (arg0: Array>) => void; setIsEditableAnnotation: (arg0: IsEditableAnnotationCallback) => void; setIsEditableComment: (arg0: IsEditableCommentCallback) => void; setGroup: (group: string) => void; resetGroup: () => void; setMentionableUsers: (users: MentionableUser[]) => void; setMaxMentionSuggestions: (maxSuggestions: number) => void; getComments: () => Promise>; setDocumentEditorFooterItems: (stateOrFunction: DocumentEditorFooterItem[] | SetDocumentEditorFooterFunction) => void; setDocumentEditorToolbarItems: (stateOrFunction: DocumentEditorToolbarItem[] | SetDocumentEditorToolbarFunction) => void; getSignaturesInfo: () => Promise; signDocument: (arg0: SignatureCreationData | null | undefined, arg1: TwoStepSignatureCallback | SigningServiceData | undefined) => Promise; applyOperations: (operations: Array) => Promise; exportPDFWithOperations: (arg0: Array) => Promise; applyRedactions: () => Promise; save: () => Promise; hasUnsavedChanges: () => boolean; ensureChangesSaved: (changes: Change | Array) => Promise>; create: (changes: Change | Array | List) => Promise>; update: (changes: Change | Array | List) => Promise>; delete: (ids: InstantID | Change | Array | List) => Promise>; toggleClipboardActions: (enable: boolean) => void; setMeasurementSnapping: (enable: boolean) => void; setMeasurementPrecision: (precision: IMeasurementPrecision) => void; setMeasurementScale: (scale: MeasurementScale) => void; setMeasurementValueConfiguration: (configurationCallback: MeasurementValueConfigurationCallback) => void; createRedactionsBySearch: (term: string | ISearchPattern, options?: { searchType?: ISearchType; searchInAnnotations?: boolean; caseSensitive?: boolean; annotationPreset?: RedactionAnnotationPreset; }) => Promise>; history: { undo: () => Promise; redo: () => Promise; clear: () => void; enable: () => void; disable: () => void; canUndo: () => boolean; canRedo: () => boolean; }; setDocumentComparisonMode: (documentComparisonConfiguration: DocumentComparisonConfiguration | null) => void; getEmbeddedFiles: () => Promise>; } declare const UIDateTimeElement: { readonly COMMENT_THREAD: "COMMENT_THREAD"; readonly ANNOTATIONS_SIDEBAR: "ANNOTATIONS_SIDEBAR"; }; type IUIDateTimeElement = (typeof UIDateTimeElement)[keyof typeof UIDateTimeElement]; type DateTimeStringCallback = (args: { dateTime: Date; element: IUIDateTimeElement; object: AnnotationsUnion | Comment; }) => string; declare const InkEraserMode: { readonly POINT: "POINT"; readonly STROKE: "STROKE"; }; type IInkEraserMode = (typeof InkEraserMode)[keyof typeof InkEraserMode]; type BuiltInColorProperty = 'color' | 'stroke-color' | 'fill-color' | 'background-color' | 'font-color' | 'outline-color'; type AnnotationToolbarColorPresetConfig = { presets: ColorPreset[]; showColorPicker?: boolean; }; type AnnotationToolbarColorPresetsCallback = (options: { propertyName: BuiltInColorProperty; defaultAnnotationToolbarColorPresets: ColorPreset[]; }) => AnnotationToolbarColorPresetConfig | undefined; type EnableRichTextCallback = (annotation: TextAnnotation) => boolean; type TrustedCAsCallback = () => Promise>; type ElectronicSignaturesConfiguration = { creationModes?: Readonly; fonts?: Readonly; unstable_colorPresets?: Readonly; }; declare const Theme: { readonly LIGHT: "LIGHT"; readonly DARK: "DARK"; readonly AUTO: "AUTO"; }; type ITheme = (typeof Theme)[keyof typeof Theme]; type SharedConfiguration = { container: string | HTMLElement; initialViewState?: ViewState; baseUrl?: string; serverUrl?: string; styleSheets?: Array; toolbarItems?: Array; annotationPresets?: Record; stampAnnotationTemplates?: Array; autoSaveMode?: IAutoSaveMode; disableHighQualityPrinting?: boolean; printMode?: IPrintMode; printOptions?: { mode?: IPrintMode; quality?: IPrintQuality; }; disableTextSelection?: boolean; disableForms?: boolean; headless?: boolean; locale?: string; populateInkSignatures?: () => Promise>; populateStoredSignatures?: () => Promise>; formFieldsNotSavingSignatures?: Array; password?: string; disableOpenParameters?: boolean; maxPasswordRetries?: number; enableServiceWorkerSupport?: boolean; preventTextCopy?: boolean; renderPageCallback?: RenderPageCallback; annotationTooltipCallback?: AnnotationTooltipCallback; editableAnnotationTypes?: Array>; isEditableAnnotation?: IsEditableAnnotationCallback; onAnnotationResizeStart?: AnnotationResizeStartCallback; customRenderers?: CustomRenderers; customUI?: CustomUI; theme?: ITheme; toolbarPlacement?: IToolbarPlacement; minDefaultZoomLevel?: number; maxDefaultZoomLevel?: number; isEditableComment?: IsEditableCommentCallback; restrictAnnotationToPageBounds?: boolean; electronicSignatures?: ElectronicSignaturesConfiguration; documentEditorFooterItems?: DocumentEditorFooterItem[]; documentEditorToolbarItems?: DocumentEditorToolbarItem[]; enableHistory?: boolean; onOpenURI?: OnOpenUriCallback; dateTimeString?: DateTimeStringCallback; annotationToolbarColorPresets?: AnnotationToolbarColorPresetsCallback; annotationToolbarItems?: AnnotationToolbarItemsCallback; enableClipboardActions?: boolean; renderPagePreview?: boolean; unstable_inkEraserMode?: IInkEraserMode; onWidgetAnnotationCreationStart?: OnWidgetAnnotationCreationStartCallback; inlineTextSelectionToolbarItems?: InlineTextSelectionToolbarItemsCallback; measurementSnapping?: boolean; measurementPrecision?: IMeasurementPrecision; measurementScale?: MeasurementScale; measurementValueConfiguration?: MeasurementValueConfigurationCallback; enableRichText?: EnableRichTextCallback; disableMultiSelection?: boolean; autoCloseThreshold?: number; onCommentCreationStart?: OnCommentCreationStartCallback; }; type Instant = { public: boolean; }; type ServerConfiguration = SharedConfiguration & { documentId: string; authPayload: { jwt: string; }; instant: Instant[keyof Instant]; anonymousComments?: boolean; mentionableUsers?: Array; maxMentionSuggestions?: number; }; type StandaloneConfiguration = SharedConfiguration & { document: string | ArrayBuffer; baseCoreUrl?: string; licenseKey?: string; instantJSON?: InstantJSON; XFDF?: string; XFDFKeepCurrentAnnotations?: boolean; disableWebAssemblyStreaming?: boolean; disableIndexedDBCaching?: boolean; enableAutomaticLinkExtraction?: boolean; standaloneInstancesPoolSize?: number; overrideMemoryLimit?: number; trustedCAsCallback?: TrustedCAsCallback; customFonts?: Array; electronAppName?: string; appName?: string; isSharePoint?: boolean; isSalesforce?: boolean; productId?: IProductId; }; type Configuration = ServerConfiguration | StandaloneConfiguration; declare const Conformance: { readonly PDFA_1A: "pdfa-1a"; readonly PDFA_1B: "pdfa-1b"; readonly PDFA_2A: "pdfa-2a"; readonly PDFA_2U: "pdfa-2u"; readonly PDFA_2B: "pdfa-2b"; readonly PDFA_3A: "pdfa-3a"; readonly PDFA_3U: "pdfa-3u"; readonly PDFA_3B: "pdfa-3b"; readonly PDFA_4: "pdfa-4"; readonly PDFA_4E: "pdfa-4e"; readonly PDFA_4F: "pdfa-4f"; }; type IConformance = (typeof Conformance)[keyof typeof Conformance]; type FormFieldFlags = Array<'readOnly' | 'required' | 'noExport'>; type FormOptionJSON = { label: string; value: string; }; type ExportPDFFlags = { flatten?: boolean; incremental?: boolean; includeComments?: boolean; saveForPrinting?: boolean; excludeAnnotations?: boolean; permissions?: { userPassword: string; ownerPassword: string; documentPermissions: Array; }; outputFormat?: boolean | PDFAFlags; optimize?: boolean | OptimizationFlags; }; type PDFAFlags = { conformance?: IConformance; vectorization?: boolean; rasterization?: boolean; }; type OptimizationFlags = { documentFormat?: 'pdf' | 'pdfa'; grayscaleText?: boolean; grayscaleGraphics?: boolean; grayscaleFormFields?: boolean; grayscaleAnnotations?: boolean; grayscaleImages?: boolean; disableImages?: boolean; mrcCompression?: boolean; imageOptimizationQuality?: 1 | 2 | 3 | 4; linearize?: boolean; }; type FormFieldAdditionalActionsType = { onChange?: Action; onCalculate?: Action; }; type FormFieldEventTriggerType = keyof FormFieldAdditionalActionsType; type FormFieldInputAdditionalActionsType = FormFieldAdditionalActionsType & { onInput?: Action; onFormat?: Action; }; type FormFieldInputEventTriggerType = keyof FormFieldInputAdditionalActionsType; type FormFieldName = string; interface IFormField { id?: ID; pdfObjectId?: number | null; annotationIds?: List; name?: FormFieldName; label?: string; readOnly?: boolean; required?: boolean; noExport?: boolean; additionalActions?: any; group?: string | null; isEditable?: boolean; isFillable?: boolean; isDeletable?: boolean; canSetGroup?: boolean; [key: string]: any; } declare const FormField_base: Record$1.Factory; declare class FormField extends FormField_base { id: ID; name: FormFieldName; pdfObjectId: number; annotationIds: List; label: string; readOnly: boolean; required: boolean; noExport: boolean; additionalActions: any; group?: string | null; isEditable?: boolean; isFillable?: boolean; isDeletable?: boolean; canSetGroup?: boolean; static defaultValues: IObject; constructor(args?: IFormField); } declare class ButtonFormField extends FormField { buttonLabel: string | null; static defaultValues: IObject; } declare const FormOption_base: Record$1.Factory<{ label: string; value: string; }>; declare class FormOption extends FormOption_base { } declare class CheckBoxFormField extends FormField { values: List; defaultValues: List; options: List; optionIndexes?: List; static defaultValues: IObject; } declare class ChoiceFormField extends FormField { options: List; values: List; defaultValues: List; multiSelect: boolean; commitOnChange: boolean; static defaultValues: IObject; } declare class ComboBoxFormField extends ChoiceFormField { edit: boolean; doNotSpellCheck: boolean; static defaultValues: IObject; } declare class ListBoxFormField extends ChoiceFormField { additionalActions: FormFieldInputAdditionalActionsType | null | undefined; } declare class RadioButtonFormField extends FormField { noToggleToOff: boolean; radiosInUnison: boolean; value: string; defaultValue: string; options: List; optionIndexes?: List; static defaultValues: IObject; } declare class TextFormField extends FormField { value: string; defaultValue: string; password: boolean; maxLength?: number | null; doNotSpellCheck: boolean; doNotScroll: boolean; multiLine: boolean; comb: boolean; additionalActions: FormFieldInputAdditionalActionsType | null | undefined; static defaultValues: IObject; } declare class SignatureFormField extends FormField { } type AnnotationPreset = AnnotationPreset$1; type AnnotationPresetID = AnnotationPresetID$1; declare class __dangerousImmutableRecordFactory> { has(key: unknown): boolean; get(key: K): TProps[K]; set(key: K, value: TProps[K]): this; delete(key: K): this; clear(): this; update(key: K, updater: (value: TProps[K]) => TProps[K]): this; merge(...collections: Array>): this; mergeWith(merger: (previous?: unknown, next?: unknown, key?: string) => unknown, ...collections: Array | Iterable<[string, unknown]>>): this; mergeDeep(...collections: Array | Iterable<[string, unknown]>>): this; mergeDeepWith(merger: (previous?: unknown, next?: unknown, key?: string) => unknown, ...collections: Array | Iterable<[string, unknown]>>): this; setIn(keyPath: Iterable, value: unknown): this; deleteIn(keyPath: Iterable): this; removeIn(keyPath: Iterable): this; updateIn(keyPath: Iterable, notSetValue: unknown, updater: (value: unknown) => unknown): this; updateIn(keyPath: Iterable, updater: (value: unknown) => unknown): this; mergeIn(keyPath: Iterable, ...collections: Array | Iterable<[string, unknown]>>): this; mergeDeepIn(keyPath: Iterable, ...collections: Array | Iterable<[string, unknown]>>): this; withMutations(mutator: (mutable: this) => unknown): this; asMutable(): this; asImmutable(): this; getIn(keyPath: Iterable, notSetValue?: unknown): unknown; toJS(): TProps; toJSON(): TProps; equals(other: unknown): boolean; toSeq(): Seq.Keyed; } declare const InheritableImmutableRecord_base: any; declare class InheritableImmutableRecord> extends InheritableImmutableRecord_base { constructor(values?: Partial | Iterable<[string, unknown]>); } interface InheritableImmutableRecord> extends __dangerousImmutableRecordFactory { } type ID = string; type AnnotationProperties = { id: string | null; name: string | null; subject: string | null; pdfObjectId: number | null; pageIndex: number | null; boundingBox: Rect | null; opacity: number | null; note: string | null; creatorName: string | null; createdAt: Date | null; updatedAt: Date | null; customData: Record | null; noView: boolean | null; noPrint: boolean | null; locked: boolean | null; lockedContents: boolean | null; readOnly: boolean | null; hidden: boolean | null; group: string | null | undefined; isEditable: boolean | undefined; isDeletable: boolean | undefined; canSetGroup: boolean | undefined; canReply: boolean | undefined; rotation: number; additionalActions: any; noZoom: boolean; noRotate: boolean; isCommentThreadRoot: boolean; APStreamCache: { cache: string; } | { attach: string; } | undefined; blendMode: IBlendMode; action: any; [key: string]: unknown; }; declare class Annotation extends InheritableImmutableRecord { id: ID; name: null | string; subject: null | string; pdfObjectId: null | number; pageIndex: number; boundingBox: Rect; opacity: number; note: null | string; creatorName: null | string; createdAt: Date; updatedAt: Date; noView: boolean; noPrint: boolean; locked: boolean; lockedContents: boolean; readOnly: boolean; hidden: boolean; customData: null | Record; noZoom: boolean; noRotate: boolean; additionalActions: any; rotation: number; blendMode: IBlendMode; isCommentThreadRoot: boolean; group?: string | null; isEditable?: boolean; isDeletable?: boolean; canSetGroup?: boolean; canReply?: boolean; APStreamCache?: { cache: string; } | { attach: string; }; action: any; static defaultValues: IObject; constructor(record?: Partial); } type StampKind = 'Approved' | 'NotApproved' | 'Draft' | 'Final' | 'Completed' | 'Confidential' | 'ForPublicRelease' | 'NotForPublicRelease' | 'ForComment' | 'Void' | 'PreliminaryResults' | 'InformationOnly' | 'Rejected' | 'Accepted' | 'InitialHere' | 'SignHere' | 'Witness' | 'AsIs' | 'Departmental' | 'Experimental' | 'Expired' | 'Sold' | 'TopSecret' | 'Revised' | 'RejectedWithText' | 'Custom'; interface IStampAnnotation extends AnnotationProperties { stampType: string | StampKind | null; title: string | null; subtitle: string | null; color: Color | null; xfdfAppearanceStream: string | null; } declare class StampAnnotation extends Annotation { stampType: StampKind; title: null | string; subtitle: null | string; color: null | Color; xfdfAppearanceStream: null | string; static defaultValues: IObject; static readableName: string; } declare function preloadWorker(configuration: StandaloneConfiguration): Promise; declare function load(configuration: Configuration): Promise; declare function convertToPDF(configuration: StandaloneConfiguration, conformance?: IConformance): Promise; declare function serializeAnnotation(annotation: InkAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: LineAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: RectangleAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: EllipseAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: PolygonAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: PolylineAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: TextAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: NoteAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: StampAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: ImageAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: MediaAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: LinkAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: WidgetAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: TextMarkupAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: RedactionAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: CommentMarkerAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: UnknownAnnotation): AnnotationBackendJSON; declare function serializeAnnotation(annotation: AnnotationsUnion): AnnotationsBackendJSONUnion; declare function serializeFormField(formField: FormField): FormFieldJSON; declare function serializePreset(preset: AnnotationPreset$1): Record; declare function unserializePreset(presetJSON: Record): AnnotationPreset$1; type TargetType = string | HTMLElement | Instance | null; declare function unload(target: TargetType): boolean; declare function viewStateFromOpenParameters(viewState: ViewState, hash?: string | null | undefined): ViewState; type RotatableAnnotation = TextAnnotation | StampAnnotation; declare const PSPDFKit: { Immutable: { List: typeof List; }; version: string; Geometry: { Point: typeof Point; DrawingPoint: typeof DrawingPoint; Rect: typeof Rect; Size: typeof Size; Inset: typeof Inset; }; Actions: { Action: typeof Action; GoToAction: typeof GoToAction; GoToEmbeddedAction: typeof GoToEmbeddedAction; GoToRemoteAction: typeof GoToRemoteAction; HideAction: typeof HideAction; JavaScriptAction: typeof JavaScriptAction; LaunchAction: typeof LaunchAction; NamedAction: typeof NamedAction; ResetFormAction: typeof ResetFormAction; SubmitFormAction: typeof SubmitFormAction; URIAction: typeof URIAction; }; Annotations: { Annotation: typeof Annotation; CommentMarkerAnnotation: typeof CommentMarkerAnnotation; HighlightAnnotation: typeof HighlightAnnotation; InkAnnotation: typeof InkAnnotation; ShapeAnnotation: typeof ShapeAnnotation; LineAnnotation: typeof LineAnnotation; RectangleAnnotation: typeof RectangleAnnotation; EllipseAnnotation: typeof EllipseAnnotation; PolygonAnnotation: typeof PolygonAnnotation; PolylineAnnotation: typeof PolylineAnnotation; LinkAnnotation: typeof LinkAnnotation; NoteAnnotation: typeof NoteAnnotation; MarkupAnnotation: typeof TextMarkupAnnotation; RedactionAnnotation: typeof RedactionAnnotation; SquiggleAnnotation: typeof SquiggleAnnotation; StampAnnotation: typeof StampAnnotation; StrikeOutAnnotation: typeof StrikeOutAnnotation; TextAnnotation: typeof TextAnnotation; UnderlineAnnotation: typeof UnderlineAnnotation; ImageAnnotation: typeof ImageAnnotation; UnknownAnnotation: typeof UnknownAnnotation; WidgetAnnotation: typeof WidgetAnnotation; MediaAnnotation: typeof MediaAnnotation; toSerializableObject: typeof serializeAnnotation; fromSerializableObject: (annotation: K) => AnnotationJSONToAnnotation; rotate: (annotation: RotatableAnnotation, rotation: number, contentSize?: Size) => RotatableAnnotation; }; AnnotationPresets: { toSerializableObject: typeof serializePreset; fromSerializableObject: typeof unserializePreset; }; Comment: typeof Comment; Bookmark: typeof Bookmark; CustomOverlayItem: typeof CustomOverlayItem; FormFields: { FormField: typeof FormField; ButtonFormField: typeof ButtonFormField; CheckBoxFormField: typeof CheckBoxFormField; ChoiceFormField: typeof ChoiceFormField; ComboBoxFormField: typeof ComboBoxFormField; ListBoxFormField: typeof ListBoxFormField; RadioButtonFormField: typeof RadioButtonFormField; TextFormField: typeof TextFormField; SignatureFormField: typeof SignatureFormField; toSerializableObject: typeof serializeFormField; fromSerializableObject: (formField: FormFieldJSON) => FormField; }; FormFieldValue: typeof FormFieldValue; FormOption: typeof FormOption; Color: typeof Color; Instance: typeof Instance; preloadWorker: typeof preloadWorker; load: typeof load; unload: typeof unload; convertToPDF: typeof convertToPDF; Error: any; SaveError: typeof PSPDFKitSaveError; ViewState: typeof ViewState; PageInfo: typeof PageInfo; TextLine: typeof TextLine; InstantClient: typeof InstantClient; TextSelection: typeof PublicTextSelection; SearchResult: typeof SearchResult; SearchState: typeof SearchState; AutoSaveMode: { readonly IMMEDIATE: "IMMEDIATE"; readonly INTELLIGENT: "INTELLIGENT"; readonly DISABLED: "DISABLED"; }; SignatureSaveMode: { readonly ALWAYS: "ALWAYS"; readonly NEVER: "NEVER"; readonly USING_UI: "USING_UI"; }; LayoutMode: { readonly SINGLE: "SINGLE"; readonly DOUBLE: "DOUBLE"; readonly AUTO: "AUTO"; }; PrintMode: { readonly DOM: "DOM"; readonly EXPORT_PDF: "EXPORT_PDF"; }; PrintQuality: { readonly LOW: "LOW"; readonly MEDIUM: "MEDIUM"; readonly HIGH: "HIGH"; }; ScrollMode: { readonly CONTINUOUS: "CONTINUOUS"; readonly PER_SPREAD: "PER_SPREAD"; readonly DISABLED: "DISABLED"; }; ZoomMode: { readonly AUTO: "AUTO"; readonly FIT_TO_WIDTH: "FIT_TO_WIDTH"; readonly FIT_TO_VIEWPORT: "FIT_TO_VIEWPORT"; readonly CUSTOM: "CUSTOM"; }; InteractionMode: { readonly TEXT_HIGHLIGHTER: "TEXT_HIGHLIGHTER"; readonly INK: "INK"; readonly INK_SIGNATURE: "INK_SIGNATURE"; readonly SIGNATURE: "SIGNATURE"; readonly STAMP_PICKER: "STAMP_PICKER"; readonly STAMP_CUSTOM: "STAMP_CUSTOM"; readonly SHAPE_LINE: "SHAPE_LINE"; readonly SHAPE_RECTANGLE: "SHAPE_RECTANGLE"; readonly SHAPE_ELLIPSE: "SHAPE_ELLIPSE"; readonly SHAPE_POLYGON: "SHAPE_POLYGON"; readonly SHAPE_POLYLINE: "SHAPE_POLYLINE"; readonly INK_ERASER: "INK_ERASER"; readonly NOTE: "NOTE"; readonly COMMENT_MARKER: "COMMENT_MARKER"; readonly TEXT: "TEXT"; readonly CALLOUT: "CALLOUT"; readonly PAN: "PAN"; readonly SEARCH: "SEARCH"; readonly DOCUMENT_EDITOR: "DOCUMENT_EDITOR"; readonly MARQUEE_ZOOM: "MARQUEE_ZOOM"; readonly REDACT_TEXT_HIGHLIGHTER: "REDACT_TEXT_HIGHLIGHTER"; readonly REDACT_SHAPE_RECTANGLE: "REDACT_SHAPE_RECTANGLE"; readonly DOCUMENT_CROP: "DOCUMENT_CROP"; readonly BUTTON_WIDGET: "BUTTON_WIDGET"; readonly TEXT_WIDGET: "TEXT_WIDGET"; readonly RADIO_BUTTON_WIDGET: "RADIO_BUTTON_WIDGET"; readonly CHECKBOX_WIDGET: "CHECKBOX_WIDGET"; readonly COMBO_BOX_WIDGET: "COMBO_BOX_WIDGET"; readonly LIST_BOX_WIDGET: "LIST_BOX_WIDGET"; readonly SIGNATURE_WIDGET: "SIGNATURE_WIDGET"; readonly DATE_WIDGET: "DATE_WIDGET"; readonly FORM_CREATOR: "FORM_CREATOR"; readonly LINK: "LINK"; readonly DISTANCE: "DISTANCE"; readonly PERIMETER: "PERIMETER"; readonly RECTANGLE_AREA: "RECTANGLE_AREA"; readonly ELLIPSE_AREA: "ELLIPSE_AREA"; readonly POLYGON_AREA: "POLYGON_AREA"; readonly CONTENT_EDITOR: "CONTENT_EDITOR"; readonly MULTI_ANNOTATIONS_SELECTION: "MULTI_ANNOTATIONS_SELECTION"; readonly MEASUREMENT: "MEASUREMENT"; readonly MEASUREMENT_SETTINGS: "MEASUREMENT_SETTINGS"; }; unstable_InkEraserMode: { readonly POINT: "POINT"; readonly STROKE: "STROKE"; }; SidebarMode: { readonly ANNOTATIONS: "ANNOTATIONS"; readonly BOOKMARKS: "BOOKMARKS"; readonly DOCUMENT_OUTLINE: "DOCUMENT_OUTLINE"; readonly THUMBNAILS: "THUMBNAILS"; readonly CUSTOM: "CUSTOM"; }; UIElement: { readonly Sidebar: "Sidebar"; }; BlendMode: { readonly normal: "normal"; readonly multiply: "multiply"; readonly screen: "screen"; readonly overlay: "overlay"; readonly darken: "darken"; readonly lighten: "lighten"; readonly colorDodge: "colorDodge"; readonly colorBurn: "colorBurn"; readonly hardLight: "hardLight"; readonly softLight: "softLight"; readonly difference: "difference"; readonly exclusion: "exclusion"; }; BorderStyle: { readonly solid: "solid"; readonly dashed: "dashed"; readonly beveled: "beveled"; readonly inset: "inset"; readonly underline: "underline"; }; LineCap: { readonly square: "square"; readonly circle: "circle"; readonly diamond: "diamond"; readonly openArrow: "openArrow"; readonly closedArrow: "closedArrow"; readonly butt: "butt"; readonly reverseOpenArrow: "reverseOpenArrow"; readonly reverseClosedArrow: "reverseClosedArrow"; readonly slash: "slash"; }; SidebarPlacement: { readonly START: "START"; readonly END: "END"; }; SignatureAppearanceMode: { readonly signatureOnly: "signatureOnly"; readonly signatureAndDescription: "signatureAndDescription"; readonly descriptionOnly: "descriptionOnly"; }; ShowSignatureValidationStatusMode: { readonly IF_SIGNED: "IF_SIGNED"; readonly HAS_WARNINGS: "HAS_WARNINGS"; readonly HAS_ERRORS: "HAS_ERRORS"; readonly NEVER: "NEVER"; }; NoteIcon: { readonly COMMENT: "COMMENT"; readonly RIGHT_POINTER: "RIGHT_POINTER"; readonly RIGHT_ARROW: "RIGHT_ARROW"; readonly CHECK: "CHECK"; readonly CIRCLE: "CIRCLE"; readonly CROSS: "CROSS"; readonly INSERT: "INSERT"; readonly NEW_PARAGRAPH: "NEW_PARAGRAPH"; readonly NOTE: "NOTE"; readonly PARAGRAPH: "PARAGRAPH"; readonly HELP: "HELP"; readonly STAR: "STAR"; readonly KEY: "KEY"; }; Theme: { readonly LIGHT: "LIGHT"; readonly DARK: "DARK"; readonly AUTO: "AUTO"; }; ToolbarPlacement: { readonly TOP: "TOP"; readonly BOTTOM: "BOTTOM"; }; ElectronicSignatureCreationMode: { readonly DRAW: "DRAW"; readonly IMAGE: "IMAGE"; readonly TYPE: "TYPE"; }; I18n: { locales: any; messages: {}; preloadLocalizationData: (locale: string, options?: { baseUrl?: string | undefined; }) => Promise; }; baseUrl: string | undefined; DocumentIntegrityStatus: { readonly ok: "ok"; readonly tampered_document: "tampered_document"; readonly failed_to_retrieve_signature_contents: "failed_to_retrieve_signature_contents"; readonly failed_to_retrieve_byterange: "failed_to_retrieve_byterange"; readonly failed_to_compute_digest: "failed_to_compute_digest"; readonly failed_retrieve_signing_certificate: "failed_retrieve_signing_certificate"; readonly failed_retrieve_public_key: "failed_retrieve_public_key"; readonly failed_encryption_padding: "failed_encryption_padding"; readonly general_failure: "general_failure"; }; SignatureValidationStatus: { readonly valid: "valid"; readonly warning: "warning"; readonly error: "error"; }; SignatureType: { CMS: string; CAdES: string; }; SignatureContainerType: { raw: string; pkcs7: string; }; CertificateChainValidationStatus: { readonly ok: "ok"; readonly ok_but_self_signed: "ok_but_self_signed"; readonly untrusted: "untrusted"; readonly expired: "expired"; readonly not_yet_valid: "not_yet_valid"; readonly invalid: "invalid"; readonly revoked: "revoked"; readonly failed_to_retrieve_signature_contents: "failed_to_retrieve_signature_contents"; readonly general_validation_problem: "general_validation_problem"; }; AnnotationsWillChangeReason: typeof AnnotationsWillChangeReason; DocumentComparisonSourceType: { readonly USE_OPEN_DOCUMENT: "USE_OPEN_DOCUMENT"; readonly USE_FILE_DIALOG: "USE_FILE_DIALOG"; }; MeasurementScaleUnitFrom: { readonly INCHES: "in"; readonly MILLIMETERS: "mm"; readonly CENTIMETERS: "cm"; readonly POINTS: "pt"; }; MeasurementScaleUnitTo: { readonly INCHES: "in"; readonly MILLIMETERS: "mm"; readonly CENTIMETERS: "cm"; readonly POINTS: "pt"; readonly FEET: "ft"; readonly METERS: "m"; readonly YARDS: "yd"; readonly KILOMETERS: "km"; readonly MILES: "mi"; }; MeasurementPrecision: { readonly WHOLE: "whole"; readonly ONE: "oneDp"; readonly TWO: "twoDp"; readonly THREE: "threeDp"; readonly FOUR: "fourDp"; readonly HALVES: "1/2"; readonly QUARTERS: "1/4"; readonly EIGHTHS: "1/8"; readonly SIXTEENTHS: "1/16"; }; MeasurementScale: typeof MeasurementScale; ProductId: { SharePoint: string; Salesforce: string; Maui_Android: string; Maui_iOS: string; Maui_MacCatalyst: string; Maui_Windows: string; }; Conformance: { readonly PDFA_1A: "pdfa-1a"; readonly PDFA_1B: "pdfa-1b"; readonly PDFA_2A: "pdfa-2a"; readonly PDFA_2U: "pdfa-2u"; readonly PDFA_2B: "pdfa-2b"; readonly PDFA_3A: "pdfa-3a"; readonly PDFA_3U: "pdfa-3u"; readonly PDFA_3B: "pdfa-3b"; readonly PDFA_4: "pdfa-4"; readonly PDFA_4E: "pdfa-4e"; readonly PDFA_4F: "pdfa-4f"; }; DocumentPermissions: Record<"annotationsAndForms" | "assemble" | "extract" | "extractAccessibility" | "fillForms" | "modification" | "printHighQuality" | "printing", "annotationsAndForms" | "assemble" | "extract" | "extractAccessibility" | "fillForms" | "modification" | "printHighQuality" | "printing">; viewStateFromOpenParameters: typeof viewStateFromOpenParameters; readonly unstable_defaultElectronicSignatureColorPresets: ColorPreset[]; readonly defaultToolbarItems: readonly [{ readonly type: "sidebar-thumbnails"; }, { readonly type: "sidebar-document-outline"; }, { readonly type: "sidebar-annotations"; }, { readonly type: "sidebar-bookmarks"; }, { readonly type: "pager"; }, { readonly type: "multi-annotations-selection"; }, { readonly type: "pan"; }, { readonly type: "zoom-out"; }, { readonly type: "zoom-in"; }, { readonly type: "zoom-mode"; }, { readonly type: "spacer"; }, { readonly type: "annotate"; }, { readonly type: "ink"; }, { readonly type: "highlighter"; }, { readonly type: "text-highlighter"; }, { readonly type: "ink-eraser"; }, { readonly type: "signature"; }, { readonly type: "image"; }, { readonly type: "stamp"; }, { readonly type: "note"; }, { readonly type: "text"; }, { readonly type: "callout"; }, { readonly type: "line"; }, { readonly type: "link"; }, { readonly type: "arrow"; }, { readonly type: "rectangle"; }, { readonly type: "ellipse"; }, { readonly type: "polygon"; }, { readonly type: "cloudy-polygon"; }, { readonly type: "polyline"; }, { readonly type: "print"; }, { readonly type: "document-editor"; }, { readonly type: "document-crop"; }, { readonly type: "search"; }, { readonly type: "export-pdf"; }, { readonly type: "debug"; }]; readonly defaultDocumentEditorFooterItems: { type: BuiltInDocumentEditorFooterItem; }[]; readonly defaultDocumentEditorToolbarItems: { type: BuiltInDocumentEditorToolbarItem; }[]; readonly defaultAnnotationPresets: { [key: string]: Record; }; readonly defaultStampAnnotationTemplates: StampAnnotation[]; readonly defaultAnnotationsSidebarContent: readonly [typeof EllipseAnnotation, typeof HighlightAnnotation, typeof ImageAnnotation, typeof InkAnnotation, typeof LineAnnotation, typeof NoteAnnotation, typeof PolygonAnnotation, typeof PolylineAnnotation, typeof RectangleAnnotation, typeof SquiggleAnnotation, typeof StampAnnotation, typeof StrikeOutAnnotation, typeof TextAnnotation, typeof UnderlineAnnotation, typeof WidgetAnnotation]; defaultEditableAnnotationTypes: readonly (typeof TextAnnotation | typeof CommentMarkerAnnotation)[]; defaultElectronicSignatureCreationModes: readonly ("DRAW" | "IMAGE" | "TYPE")[]; defaultSigningFonts: readonly Font[]; Options: { MIN_TEXT_ANNOTATION_SIZE: number; MIN_INK_ANNOTATION_SIZE: number; MIN_SHAPE_ANNOTATION_SIZE: number; MIN_IMAGE_ANNOTATION_SIZE: number; MIN_STAMP_ANNOTATION_SIZE: number; MIN_WIDGET_ANNOTATION_SIZE: number; ENABLE_INK_SMOOTH_LINES: boolean; INK_EPSILON_RANGE_OPTIMIZATION: number; SIGNATURE_SAVE_MODE: ISignatureSaveMode; INITIAL_DESKTOP_SIDEBAR_WIDTH: number; IGNORE_DOCUMENT_PERMISSIONS: boolean; SELECTION_OUTLINE_PADDING: (viewportSize: Size) => number; RESIZE_ANCHOR_RADIUS: (viewportSize: Size) => number; SELECTION_STROKE_WIDTH: number; TEXT_ANNOTATION_AUTOFIT_TEXT_ON_EXPORT: boolean; TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT: boolean; DISABLE_KEYBOARD_SHORTCUTS: boolean; DEFAULT_INK_ERASER_CURSOR_WIDTH: number; COLOR_PRESETS: ColorPreset[]; LINE_CAP_PRESETS: string[]; LINE_WIDTH_PRESETS: number[] | null | undefined; HIGHLIGHT_COLOR_PRESETS: ColorPreset[]; TEXT_MARKUP_COLOR_PRESETS: ColorPreset[]; NOTE_COLOR_PRESETS: ColorPreset[]; PDF_JAVASCRIPT: boolean; BREAKPOINT_MD_TOOLBAR: number; BREAKPOINT_SM_TOOLBAR: number; }; SearchPattern: { readonly CREDIT_CARD_NUMBER: "credit_card_number"; readonly DATE: "date"; readonly TIME: "time"; readonly EMAIL_ADDRESS: "email_address"; readonly INTERNATIONAL_PHONE_NUMBER: "international_phone_number"; readonly IP_V4: "ipv4"; readonly IP_V6: "ipv6"; readonly MAC_ADDRESS: "mac_address"; readonly NORTH_AMERICAN_PHONE_NUMBER: "north_american_phone_number"; readonly SOCIAL_SECURITY_NUMBER: "social_security_number"; readonly URL: "url"; readonly US_ZIP_CODE: "us_zip_code"; readonly VIN: "vin"; }; SearchType: { readonly TEXT: "text"; readonly PRESET: "preset"; readonly REGEX: "regex"; }; UIDateTimeElement: { readonly COMMENT_THREAD: "COMMENT_THREAD"; readonly ANNOTATIONS_SIDEBAR: "ANNOTATIONS_SIDEBAR"; }; generateInstantId: typeof generateInstantId; Font: typeof Font; }; export { Action, Annotation, AnnotationToolbarItem, AnnotationsUnion, AnnotationsWillChangeReason, Bookmark, ButtonFormField, CheckBoxFormField, ChoiceFormField, Color, ComboBoxFormField, Comment, CommentMarkerAnnotation, Configuration, Conformance, CustomOverlayItem, DocumentEditorFooterItem, DocumentEditorToolbarItem, DrawingPoint, EllipseAnnotation, EllipseAnnotationJSON, Font, FormField, FormFieldValue, FormOption, GoToAction, GoToEmbeddedAction, GoToRemoteAction, HideAction, HighlightAnnotation, ImageAnnotation, ImageAnnotationJSON, InkAnnotation, InkAnnotationJSON, Inset, Instance, InstantClient, JavaScriptAction, LaunchAction, LineAnnotation, LineAnnotationJSON, LinkAnnotation, List, ListBoxFormField, MentionableUser, NamedAction, NoteAnnotation, NoteAnnotationJSON, PageInfo, Point, PolygonAnnotation, PolygonAnnotationJSON, PolylineAnnotation, PolylineAnnotationJSON, RadioButtonFormField, Rect, RectangleAnnotation, RectangleAnnotationJSON, RedactionAnnotation, RedactionAnnotationJSON, ResetFormAction, SearchResult, SearchState, ServerConfiguration, ShapeAnnotation, ShapeAnnotationsUnion, SignatureFormField, Size, SquiggleAnnotation, StampAnnotation, StampAnnotationJSON, StandaloneConfiguration, StrikeOutAnnotation, SubmitFormAction, TextAnnotation, TextAnnotationJSON, TextFormField, TextLine, TextMarkupAnnotation, TextMarkupAnnotationJSON, TextMarkupAnnotationsUnion, PublicTextSelection as TextSelection, ToolbarItem, URIAction, UnderlineAnnotation, UnknownAnnotation, UnknownAnnotationJSON, ViewState, WidgetAnnotation, WidgetAnnotationJSON, PSPDFKit as default };