@ironcorelabs/ironweb 3.3.3 → 4.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,10 +2,12 @@ var __extends = (this && this.__extends) || (function () {
2
2
  var extendStatics = function (d, b) {
3
3
  extendStatics = Object.setPrototypeOf ||
4
4
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
6
  return extendStatics(d, b);
7
7
  };
8
8
  return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
9
11
  extendStatics(d, b);
10
12
  function __() { this.constructor = d; }
11
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -1,4 +1,3 @@
1
- import { Promise } from "es6-promise";
2
1
  import Future from "futurejs";
3
2
  import { ErrorCodes, Frame, Versions } from "../Constants";
4
3
  import SDKError from "../lib/SDKError";
@@ -85,7 +84,7 @@ frame.style.display = "none";
85
84
  frame.style.position = "absolute";
86
85
  frame.style.top = "-999px";
87
86
  frame.style.left = "-999px";
88
- frame.src = "" + Frame.FRAME_DOMAIN + Frame.FRAME_PATH + "?version=" + Versions.SDK_VERSION;
87
+ frame.src = "".concat(Frame.FRAME_DOMAIN).concat(Frame.FRAME_PATH, "?version=").concat(Versions.SDK_VERSION);
89
88
  window.document.body.appendChild(frame);
90
89
  /**
91
90
  * Return a simple Future wrapper around existing frame load Promise so that we wait until the iFrame has loaded before we post any messages to it. We
@@ -20,7 +20,7 @@ function getJWT(jwtCallback) {
20
20
  if (typeof jwt === "string" && jwt.length > 0) {
21
21
  return Future.of(jwt);
22
22
  }
23
- return Future.reject(new SDKError(new Error("JWT should be a non-zero length string, but instead got '" + jwt + "'"), ErrorCodes.JWT_RETRIEVAL_FAILURE));
23
+ return Future.reject(new SDKError(new Error("JWT should be a non-zero length string, but instead got '".concat(jwt, "'")), ErrorCodes.JWT_RETRIEVAL_FAILURE));
24
24
  });
25
25
  }
26
26
  /**
@@ -40,7 +40,7 @@ function invokePasscodeCallback(passcodeCallback, doesUserExist) {
40
40
  if (typeof passcode === "string" && passcode.length > 0) {
41
41
  return Future.of(passcode);
42
42
  }
43
- return Future.reject(new SDKError(new Error("User provided passcode should be a non-zero length string, but instead got '" + passcode + "'"), ErrorCodes.PASSCODE_RETRIEVAL_FAILURE));
43
+ return Future.reject(new SDKError(new Error("User provided passcode should be a non-zero length string, but instead got '".concat(passcode, "'")), ErrorCodes.PASSCODE_RETRIEVAL_FAILURE));
44
44
  });
45
45
  }
46
46
  /**
package/es/shim/SDK.js CHANGED
@@ -1,10 +1,12 @@
1
+ import * as CodecSDK from "./sdk/CodecSDK";
1
2
  import * as DocumentSDK from "./sdk/DocumentSDK";
2
3
  import * as GroupSDK from "./sdk/GroupSDK";
4
+ import * as SearchSDK from "./sdk/SearchSDK";
3
5
  import * as UserSDK from "./sdk/UserSDK";
4
- import * as CodecSDK from "./sdk/CodecSDK";
5
6
  // https://github.com/Microsoft/TypeScript/issues/420
6
7
  // whenever this lands in TS we can get stronger compiler checking of our API <-> API Interface definition.
7
8
  export var document = DocumentSDK;
8
9
  export var user = UserSDK;
9
10
  export var group = GroupSDK;
11
+ export var search = SearchSDK;
10
12
  export var codec = CodecSDK;
@@ -5,7 +5,7 @@ var hasInitializedSDK = false;
5
5
  * Generate parent window storage key that we'll use to store/retrieve the users symmetric key to decrypt their device/signing keys
6
6
  */
7
7
  function generateParentStorageKey() {
8
- return SECRET_KEY_LOCAL_STORAGE_VERSION + "-icldassk";
8
+ return "".concat(SECRET_KEY_LOCAL_STORAGE_VERSION, "-icldassk");
9
9
  }
10
10
  /**
11
11
  * Mark SDK initialization as complete to allow SDK methods to be run
@@ -93,10 +93,10 @@ export function validateOwnership(addAsAdmin, maybeOwner) {
93
93
  */
94
94
  export function validateID(id) {
95
95
  if (typeof id !== "string" || !id.length) {
96
- throw new Error("Invalid ID provided. Expected a non-zero length string but got " + id);
96
+ throw new Error("Invalid ID provided. Expected a non-zero length string but got ".concat(id));
97
97
  }
98
98
  if (!ALLOWED_ID_CHAR_REGEX.test(id)) {
99
- throw new Error("Invalid ID provided. Provided value includes invalid characters: '" + id + "'.");
99
+ throw new Error("Invalid ID provided. Provided value includes invalid characters: '".concat(id, "'."));
100
100
  }
101
101
  }
102
102
  /**
package/es/shim/index.js CHANGED
@@ -6,7 +6,7 @@ import { checkSDKInitialized } from "./ShimUtils";
6
6
  * Checks bowser functionality to ensure random number generation is supported.
7
7
  */
8
8
  function supportsRandomNumGen() {
9
- var nativeCrypto = window.msCrypto || window.crypto;
9
+ var nativeCrypto = window.crypto;
10
10
  return typeof nativeCrypto === "object" && typeof nativeCrypto.getRandomValues === "function";
11
11
  }
12
12
  /**
@@ -1,3 +1,19 @@
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
1
17
  import Future from "futurejs";
2
18
  import { ErrorCodes, HEADER_META_LENGTH_LENGTH, VERSION_HEADER_LENGTH } from "../../Constants";
3
19
  import SDKError from "../../lib/SDKError";
@@ -12,8 +28,8 @@ var MAX_DOCUMENT_SIZE = 1024 * 2 * 1000; //2MB
12
28
  */
13
29
  function calculateDocumentCreateOptionsDefault(options) {
14
30
  //Generate a random ID for the document if the user didn't provide one
15
- var randomBytes = (window.msCrypto || window.crypto).getRandomValues(new Uint8Array(16));
16
- var hexID = Array.prototype.map.call(randomBytes, function (byte) { return ("00" + byte.toString(16)).slice(-2); }).join("");
31
+ var randomBytes = window.crypto.getRandomValues(new Uint8Array(16));
32
+ var hexID = Array.prototype.map.call(randomBytes, function (byte) { return "00".concat(byte.toString(16)).slice(-2); }).join("");
17
33
  if (!options) {
18
34
  return { documentID: hexID, documentName: "", accessList: { users: [], groups: [], grantToAuthor: true } };
19
35
  }
@@ -86,10 +102,12 @@ export function getDocumentIDFromBytes(documentData) {
86
102
  }
87
103
  }
88
104
  /**
105
+ * @deprecated Use `decrypt` instead.
89
106
  * Retrieve and decrypt a document from the document store. Returns a Promise which will be resolved once the document has been retrieved and decrypted.
90
107
  * @param {string} documentID ID of the document to retrieve
91
108
  */
92
109
  export function decryptFromStore(documentID) {
110
+ console.warn("decryptFromStore is deprecated. Use decrypt instead.");
93
111
  ShimUtils.checkSDKInitialized();
94
112
  ShimUtils.validateID(documentID);
95
113
  var payload = {
@@ -129,6 +147,7 @@ export function decrypt(documentID, documentData) {
129
147
  .toPromise();
130
148
  }
131
149
  /**
150
+ * @deprecated Use `encrypt` instead and manage storage of the result yourself.
132
151
  * Creates a new encrypted document within the store. Returns a Promise which will be resolved once the data has been fully encrypted and saved.
133
152
  * @param {Uint8Array} documentData Data to save for document
134
153
  * @param {DocumentCreateOptions} options Document create options. Includes:
@@ -141,16 +160,17 @@ export function decrypt(documentID, documentData) {
141
160
  * grantToAuthor: boolean - Should the create grant access to the logged in user. Defaults to true.
142
161
  */
143
162
  export function encryptToStore(documentData, options) {
163
+ console.warn("encryptToStore is deprecated. Use encrypt instead and manage storage of the result yourself.");
144
164
  ShimUtils.checkSDKInitialized();
145
165
  ShimUtils.validateDocumentData(documentData);
146
166
  if (documentData.length > MAX_DOCUMENT_SIZE) {
147
- return Promise.reject(new SDKError(new Error("Document of length " + documentData.length + " exceeds maximum allowed byte size of " + MAX_DOCUMENT_SIZE), ErrorCodes.DOCUMENT_MAX_SIZE_EXCEEDED));
167
+ return Promise.reject(new SDKError(new Error("Document of length ".concat(documentData.length, " exceeds maximum allowed byte size of ").concat(MAX_DOCUMENT_SIZE)), ErrorCodes.DOCUMENT_MAX_SIZE_EXCEEDED));
148
168
  }
149
169
  var encryptOptions = calculateDocumentCreateOptionsDefault(options);
150
170
  if (encryptOptions.documentID) {
151
171
  ShimUtils.validateID(encryptOptions.documentID);
152
172
  }
153
- var _a = ShimUtils.dedupeAccessLists(encryptOptions.accessList), userGrants = _a[0], groupGrants = _a[1];
173
+ var _a = __read(ShimUtils.dedupeAccessLists(encryptOptions.accessList), 2), userGrants = _a[0], groupGrants = _a[1];
154
174
  var payload = {
155
175
  type: "DOCUMENT_STORE_ENCRYPT",
156
176
  message: {
@@ -190,7 +210,7 @@ export function encrypt(documentData, options) {
190
210
  if (encryptOptions.documentID) {
191
211
  ShimUtils.validateID(encryptOptions.documentID);
192
212
  }
193
- var _a = ShimUtils.dedupeAccessLists(encryptOptions.accessList), userGrants = _a[0], groupGrants = _a[1];
213
+ var _a = __read(ShimUtils.dedupeAccessLists(encryptOptions.accessList), 2), userGrants = _a[0], groupGrants = _a[1];
194
214
  var payload = {
195
215
  type: "DOCUMENT_ENCRYPT",
196
216
  message: {
@@ -220,7 +240,7 @@ export function updateEncryptedDataInStore(documentID, newDocumentData) {
220
240
  ShimUtils.validateID(documentID);
221
241
  ShimUtils.validateDocumentData(newDocumentData);
222
242
  if (newDocumentData.length > MAX_DOCUMENT_SIZE) {
223
- return Promise.reject(new SDKError(new Error("Document of length " + newDocumentData.length + " exceeds maximum allowed byte size of " + MAX_DOCUMENT_SIZE), ErrorCodes.DOCUMENT_MAX_SIZE_EXCEEDED));
243
+ return Promise.reject(new SDKError(new Error("Document of length ".concat(newDocumentData.length, " exceeds maximum allowed byte size of ").concat(MAX_DOCUMENT_SIZE)), ErrorCodes.DOCUMENT_MAX_SIZE_EXCEEDED));
224
244
  }
225
245
  var payload = {
226
246
  type: "DOCUMENT_STORE_UPDATE_DATA",
@@ -291,7 +311,7 @@ export function grantAccess(documentID, grantList) {
291
311
  ShimUtils.checkSDKInitialized();
292
312
  ShimUtils.validateID(documentID);
293
313
  ShimUtils.validateAccessList(grantList);
294
- var _a = ShimUtils.dedupeAccessLists(grantList), userGrants = _a[0], groupGrants = _a[1];
314
+ var _a = __read(ShimUtils.dedupeAccessLists(grantList), 2), userGrants = _a[0], groupGrants = _a[1];
295
315
  var payload = {
296
316
  type: "DOCUMENT_GRANT",
297
317
  message: {
@@ -317,7 +337,7 @@ export function revokeAccess(documentID, revokeList) {
317
337
  ShimUtils.checkSDKInitialized();
318
338
  ShimUtils.validateID(documentID);
319
339
  ShimUtils.validateAccessList(revokeList);
320
- var _a = ShimUtils.dedupeAccessLists(revokeList), userRevocations = _a[0], groupRevocations = _a[1];
340
+ var _a = __read(ShimUtils.dedupeAccessLists(revokeList), 2), userRevocations = _a[0], groupRevocations = _a[1];
321
341
  var payload = {
322
342
  type: "DOCUMENT_REVOKE",
323
343
  message: {
@@ -381,7 +401,7 @@ export var advanced = {
381
401
  if (encryptOptions.documentID) {
382
402
  ShimUtils.validateID(encryptOptions.documentID);
383
403
  }
384
- var _a = ShimUtils.dedupeAccessLists(encryptOptions.accessList), userGrants = _a[0], groupGrants = _a[1];
404
+ var _a = __read(ShimUtils.dedupeAccessLists(encryptOptions.accessList), 2), userGrants = _a[0], groupGrants = _a[1];
385
405
  var payload = {
386
406
  type: "DOCUMENT_UNMANAGED_ENCRYPT",
387
407
  message: {
@@ -0,0 +1,93 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as FrameMediator from "../FrameMediator";
13
+ import * as ShimUtils from "../ShimUtils";
14
+ /**
15
+ * Class that is used to represent an initialized search index. Holds the search index ID (which is just a random ID used in the
16
+ * frames decrypted salt in-memory cache) so it can pass that down to the frame when tokenizing data.
17
+ */
18
+ var InitializedSearchIndex = /** @class */ (function () {
19
+ function InitializedSearchIndex(searchIndexId) {
20
+ this.searchIndexId = searchIndexId;
21
+ }
22
+ InitializedSearchIndex.prototype.tokenizeData = function (data, partitionId) {
23
+ return FrameMediator.sendMessage({
24
+ type: "BLIND_SEARCH_INDEX_TOKENIZE_DATA",
25
+ message: {
26
+ data: data,
27
+ partitionId: partitionId,
28
+ searchIndexId: this.searchIndexId,
29
+ },
30
+ })
31
+ .map(function (_a) {
32
+ var message = _a.message;
33
+ return message;
34
+ })
35
+ .toPromise();
36
+ };
37
+ InitializedSearchIndex.prototype.tokenizeQuery = function (query, partitionId) {
38
+ return FrameMediator.sendMessage({
39
+ type: "BLIND_SEARCH_INDEX_TOKENIZE_QUERY",
40
+ message: {
41
+ query: query,
42
+ partitionId: partitionId,
43
+ searchIndexId: this.searchIndexId,
44
+ },
45
+ })
46
+ .map(function (_a) {
47
+ var message = _a.message;
48
+ return message;
49
+ })
50
+ .toPromise();
51
+ };
52
+ return InitializedSearchIndex;
53
+ }());
54
+ /**
55
+ * Create a new blind search index and allow it to be decryptable by the provided group members. Creates and encrypts a new unmanaged
56
+ * document which is returned to the caller to store.
57
+ */
58
+ export var createBlindSearchIndex = function (groupId) {
59
+ ShimUtils.checkSDKInitialized();
60
+ ShimUtils.validateID(groupId);
61
+ return FrameMediator.sendMessage({ type: "BLIND_SEARCH_INDEX_CREATE", message: { groupId: groupId } })
62
+ .map(function (_a) {
63
+ var message = _a.message;
64
+ return message;
65
+ })
66
+ .toPromise();
67
+ };
68
+ /**
69
+ * Initialize a blind search index using the fields returned from the createBlindSearchIndex method. Resolves with an instance of the
70
+ * InitializedSearchIndex class which
71
+ */
72
+ export var initializeBlindSearchIndex = function (index) {
73
+ ShimUtils.checkSDKInitialized();
74
+ ShimUtils.validateDocumentData(index.searchIndexEncryptedSalt);
75
+ ShimUtils.validateDocumentData(index.searchIndexEdeks);
76
+ return FrameMediator.sendMessage({ type: "BLIND_SEARCH_INDEX_INIT", message: __assign({}, index) })
77
+ .map(function (_a) {
78
+ var message = _a.message;
79
+ return new InitializedSearchIndex(message.searchIndexId);
80
+ })
81
+ .toPromise();
82
+ };
83
+ /**
84
+ * Transliterate the provided string by latinizing each character and removing all special characters.
85
+ */
86
+ export var transliterateString = function (string) {
87
+ return FrameMediator.sendMessage({ type: "SEARCH_TRANSLITERATE_STRING", message: string })
88
+ .map(function (_a) {
89
+ var message = _a.message;
90
+ return message;
91
+ })
92
+ .toPromise();
93
+ };
package/ironweb.d.ts CHANGED
@@ -148,11 +148,18 @@ export interface DeviceKeys {
148
148
  created: RFC3339Timestamp;
149
149
  name?: string;
150
150
  }
151
-
152
151
  export interface UserCreateOptions {
153
152
  needsRotation?: boolean;
154
153
  }
155
154
 
155
+ /**
156
+ * Search SDK response types
157
+ */
158
+ export interface BlindSearchIndex {
159
+ searchIndexEncryptedSalt: Uint8Array;
160
+ searchIndexEdeks: Uint8Array;
161
+ }
162
+
156
163
  /**
157
164
  * SDK Namespaces
158
165
  */
@@ -195,6 +202,16 @@ export interface Group {
195
202
  rotatePrivateKey(groupID: string): Promise<{needsRotation: boolean}>;
196
203
  }
197
204
 
205
+ export interface Search {
206
+ createBlindSearchIndex(groupId: string): Promise<BlindSearchIndex>;
207
+ initializeBlindSearchIndex(index: BlindSearchIndex): Promise<InitializedSearchIndex>;
208
+ transliterateString(string: string): Promise<string>;
209
+ }
210
+ export interface InitializedSearchIndex {
211
+ tokenizeData(data: string, partitionId?: string): Promise<Uint32Array>;
212
+ tokenizeQuery(query: string, partitionId?: string): Promise<Uint32Array>;
213
+ }
214
+
198
215
  export interface Codec {
199
216
  utf8: {
200
217
  toBytes(utf8String: string): Uint8Array;
@@ -283,6 +300,11 @@ export interface ErrorCodes {
283
300
  GROUP_UPDATE_KEY_REQUEST_FAILURE: 417;
284
301
  GROUP_ROTATE_PRIVATE_KEY_NOT_ADMIN_FAILURE: 418;
285
302
  REQUEST_RATE_LIMITED: 500;
303
+ POLICY_APPLY_REQUEST_FAILURE: 600;
304
+ SEARCH_CREATE_INDEX_FAILURE: 700;
305
+ SEARCH_INIT_INDEX_FAILURE: 701;
306
+ SEARCH_TOKENIZE_DATA_FAILURE: 702;
307
+ SEARCH_TOKENIZE_QUERY_FAILURE: 703;
286
308
  }
287
309
 
288
310
  export const ErrorCodes: ErrorCodes;
package/ironweb.min.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! For license information please see ironweb.min.js.LICENSE */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ironweb=t():e.ironweb=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){"use strict";t.__esModule=!0;var n=function(){function e(e){this.action=e}return e.prototype.engage=function(e,t){try{this.action(e,t)}catch(t){e(t)}},e.prototype.toPromise=function(){var e=this;return new Promise((function(t,r){return e.engage(r,t)}))},e.prototype.map=function(t){return this.flatMap((function(r){return e.of(t(r))}))},e.prototype.flatMap=function(t){var r=this;return new e((function(e,n){r.engage(e,(function(r){return t(r).engage(e,n)}))}))},e.prototype.handleWith=function(t){var r=this;return new e((function(e,n){r.engage((function(r){t(r).engage(e,n)}),n)}))},e.prototype.errorMap=function(t){var r=this;return new e((function(e,n){r.engage((function(r){return e(t(r))}),n)}))},e.tryF=function(t){return new e((function(e,r){var n;try{n=t()}catch(t){return e(t)}r(n)}))},e.tryP=function(t){return new e((function(e,r){var n;try{n=t()}catch(t){return e(t)}n.then(r).catch(e)}))},e.of=function(t){return new e((function(e,r){r(t)}))},e.reject=function(t){return new e((function(e){e(t)}))},e.encase=function(t,r){return new e((function(e,n){var o;try{o=t(r)}catch(t){return e(t)}n(o)}))},e.gather2=function(t,r){return new e((function(e,n){var o=[],i=0,u=!1;t.engage((function(t){u||(u=!0,e(t))}),(function(e){o[0]=e,2==++i&&n(o)})),r.engage((function(t){u||(u=!0,e(t))}),(function(e){o[1]=e,2==++i&&n(o)}))}))},e.gather3=function(e,t,r){var n=this.gather2(e,t);return this.gather2(n,r).map((function(e){var t=e[0];return[t[0],t[1],e[1]]}))},e.gather4=function(e,t,r,n){var o=this.gather2(e,t),i=this.gather2(r,n);return this.gather2(o,i).map((function(e){var t=e[0],r=t[0],n=t[1],o=e[1];return[r,n,o[0],o[1]]}))},e.all=function(e){return Array.isArray(e)?this.allArray(e):this.allObject(e)},e.allArray=function(t){return new e((function(e,r){var n=[],o=0,i=!1;t.forEach((function(u,s){u.engage((function(t){i||(i=!0,e(t))}),(function(e){n[s]=e,(o+=1)===t.length&&r(n)}))}))}))},e.allObject=function(e){var t=Object.keys(e),r=t.map((function(t){return e[t]}));return this.allArray(r).map((function(e){return t.reduce((function(t,r,n){return t[r]=e[n],t}),{})}))},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="utf8: invalid string",o="utf8: invalid source encoding";function i(e){for(var t=0,r=0;r<e.length;r++){var o=e.charCodeAt(r);if(o<128)t+=1;else if(o<2048)t+=2;else if(o<55296)t+=3;else{if(!(o<=57343))throw new Error(n);if(r>=e.length-1)throw new Error(n);r++,t+=4}}return t}t.encode=function(e){for(var t=new Uint8Array(i(e)),r=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=192|o>>6,t[r++]=128|63&o):o<55296?(t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o):(n++,o=(1023&o)<<10,o|=1023&e.charCodeAt(n),o+=65536,t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o)}return t},t.encodedLength=i,t.decode=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if(128&n){var i=void 0;if(n<224){if(r>=e.length)throw new Error(o);if(128!=(192&(u=e[++r])))throw new Error(o);n=(31&n)<<6|63&u,i=128}else if(n<240){if(r>=e.length-1)throw new Error(o);var u=e[++r],s=e[++r];if(128!=(192&u)||128!=(192&s))throw new Error(o);n=(15&n)<<12|(63&u)<<6|63&s,i=2048}else{if(!(n<248))throw new Error(o);if(r>=e.length-2)throw new Error(o);u=e[++r],s=e[++r];var a=e[++r];if(128!=(192&u)||128!=(192&s)||128!=(192&a))throw new Error(o);n=(15&n)<<18|(63&u)<<12|(63&s)<<6|63&a,i=65536}if(n<i||n>=55296&&n<=57343)throw new Error(o);if(n>=65536){if(n>1114111)throw new Error(o);n-=65536,t.push(String.fromCharCode(55296|n>>10)),n=56320|1023&n}}t.push(String.fromCharCode(n))}return t.join("")}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),u=n[0],s=n[1],a=new i(function(e,t,r){return 3*(t+r)/4-r}(0,u,s)),E=0,_=s>0?u-4:u;for(r=0;r<_;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],a[E++]=t>>16&255,a[E++]=t>>8&255,a[E++]=255&t;2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,a[E++]=255&t);1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,a[E++]=t>>8&255,a[E++]=255&t);return a},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],u=0,s=r-o;u<s;u+=16383)i.push(E(e,u,u+16383>s?s:u+16383));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=u.length;s<a;++s)n[s]=u[s],o[u.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function E(e,t,r){for(var o,i,u=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t,r){(function(t,r){var n;n=function(){"use strict";function e(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,u=void 0,s=function(e,t){d[o]=e,d[o+1]=t,2===(o+=2)&&(u?u(A):h())},a="undefined"!=typeof window?window:void 0,c=a||{},E=c.MutationObserver||c.WebKitMutationObserver,_="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function R(){var e=setTimeout;return function(){return e(A,1)}}var d=new Array(1e3);function A(){for(var e=0;e<o;e+=2)(0,d[e])(d[e+1]),d[e]=void 0,d[e+1]=void 0;o=0}var m,l,p,U,h=void 0;function T(e,t){var r=this,n=new this.constructor(y);void 0===n[g]&&G(n);var o=r._state;if(o){var i=arguments[o-1];s((function(){return F(o,n,i,r._result)}))}else N(r,n,e,t);return n}function I(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(y);return L(t,e),t}_?h=function(){return t.nextTick(A)}:E?(l=0,p=new E(A),U=document.createTextNode(""),p.observe(U,{characterData:!0}),h=function(){U.data=l=++l%2}):f?((m=new MessageChannel).port1.onmessage=A,h=function(){return m.port2.postMessage(0)}):h=void 0===a?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(A)}:R()}catch(e){return R()}}():R();var g=Math.random().toString(36).substring(2);function y(){}var D=void 0,S=1,O=2;function v(t,r,n){r.constructor===t.constructor&&n===T&&r.constructor.resolve===I?function(e,t){t._state===S?P(e,t._result):t._state===O?M(e,t._result):N(t,void 0,(function(t){return L(e,t)}),(function(t){return M(e,t)}))}(t,r):void 0===n?P(t,r):e(n)?function(e,t,r){s((function(e){var n=!1,o=function(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}(r,t,(function(r){n||(n=!0,t!==r?L(e,r):P(e,r))}),(function(t){n||(n=!0,M(e,t))}),e._label);!n&&o&&(n=!0,M(e,o))}),e)}(t,r,n):P(t,r)}function L(e,t){if(e===t)M(e,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(n=t),null===n||"object"!==o&&"function"!==o)P(e,t);else{var r=void 0;try{r=t.then}catch(t){return void M(e,t)}v(e,t,r)}var n,o}function w(e){e._onerror&&e._onerror(e._result),C(e)}function P(e,t){e._state===D&&(e._result=t,e._state=S,0!==e._subscribers.length&&s(C,e))}function M(e,t){e._state===D&&(e._state=O,e._result=t,s(w,e))}function N(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+S]=r,o[i+O]=n,0===i&&e._state&&s(C,e)}function C(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,u=0;u<t.length;u+=3)n=t[u],o=t[u+r],n?F(r,n,o,i):o(i);e._subscribers.length=0}}function F(t,r,n,o){var i=e(n),u=void 0,s=void 0,a=!0;if(i){try{u=n(o)}catch(e){a=!1,s=e}if(r===u)return void M(r,new TypeError("A promises callback cannot return that same promise."))}else u=o;r._state!==D||(i&&a?L(r,u):!1===a?M(r,s):t===S?P(r,u):t===O&&M(r,u))}var b=0;function G(e){e[g]=b++,e._state=void 0,e._result=void 0,e._subscribers=[]}var Y=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(y),this.promise[g]||G(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&P(this.promise,this._result))):M(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===D&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===I){var o=void 0,i=void 0,u=!1;try{o=e.then}catch(e){u=!0,i=e}if(o===T&&e._state!==D)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===Q){var s=new r(y);u?M(s,i):v(s,e,o),this._willSettleAt(s,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===D&&(this._remaining--,e===O?M(n,r):this._result[t]=r),0===this._remaining&&P(n,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;N(e,void 0,(function(e){return r._settledAt(S,t,e)}),(function(e){return r._settledAt(O,t,e)}))},e}(),Q=function(){function t(e){this[g]=b++,this._result=this._state=void 0,this._subscribers=[],y!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){L(e,t)}),(function(t){M(e,t)}))}catch(t){M(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var r=this.constructor;return e(t)?this.then((function(e){return r.resolve(t()).then((function(){return e}))}),(function(e){return r.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return Q.prototype.then=T,Q.all=function(e){return new Y(this,e).promise},Q.race=function(e){var t=this;return n(e)?new t((function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},Q.resolve=I,Q.reject=function(e){var t=new this(y);return M(t,e),t},Q._setScheduler=function(e){u=e},Q._setAsap=function(e){s=e},Q._asap=s,Q.polyfill=function(){var e=void 0;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=Q},Q.Promise=Q,Q},e.exports=n()}).call(this,r(4),r(5))},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(e){n=u}}();var a,c=[],E=!1,_=-1;function f(){E&&a&&(E=!1,a.length?c=a.concat(c):_=-1,c.length&&R())}function R(){if(!E){var e=s(f);E=!0;for(var t=c.length;t;){for(a=c,c=[];++_<t;)a&&a[_].run();_=-1,t=c.length}a=null,E=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===u||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function A(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||E||s(R)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=A,o.addListener=A,o.once=A,o.off=A,o.removeListener=A,o.removeAllListeners=A,o.emit=A,o.prependListener=A,o.prependOnceListener=A,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"utf8",(function(){return k})),r.d(n,"base64",(function(){return H}));var o={};r.r(o),r.d(o,"list",(function(){return X})),r.d(o,"getMetadata",(function(){return Z})),r.d(o,"getDocumentIDFromBytes",(function(){return q})),r.d(o,"decryptFromStore",(function(){return $})),r.d(o,"decrypt",(function(){return ee})),r.d(o,"encryptToStore",(function(){return te})),r.d(o,"encrypt",(function(){return re})),r.d(o,"updateEncryptedDataInStore",(function(){return ne})),r.d(o,"updateEncryptedData",(function(){return oe})),r.d(o,"updateName",(function(){return ie})),r.d(o,"grantAccess",(function(){return ue})),r.d(o,"revokeAccess",(function(){return se})),r.d(o,"advanced",(function(){return ae}));var i={};r.r(i),r.d(i,"list",(function(){return ce})),r.d(i,"get",(function(){return Ee})),r.d(i,"create",(function(){return _e})),r.d(i,"rotatePrivateKey",(function(){return fe})),r.d(i,"update",(function(){return Re})),r.d(i,"addAdmins",(function(){return de})),r.d(i,"removeAdmins",(function(){return Ae})),r.d(i,"addMembers",(function(){return me})),r.d(i,"removeMembers",(function(){return le})),r.d(i,"removeSelfAsMember",(function(){return pe})),r.d(i,"deleteGroup",(function(){return Ue}));var u={};r.r(u),r.d(u,"changePasscode",(function(){return he})),r.d(u,"rotateMasterKey",(function(){return Te})),r.d(u,"deauthorizeDevice",(function(){return Ie}));var s,a=1,c=2,E=/^[a-zA-Z0-9_.$#|@/:;=+'-]{1,100}$/,_={VERSION_HEADER_LENGTH:1,IV_LENGTH:12,SALT_LENGTH:32,AES_SYMMETRIC_KEY_LENGTH:32,PBKDF2_ITERATIONS:function(){return 25e4},NATIVE_DECRYPT_FAILURE_ERROR:"OperationError"};!function(e){e[e.JWT_FORMAT_FAILURE=100]="JWT_FORMAT_FAILURE",e[e.JWT_RETRIEVAL_FAILURE=101]="JWT_RETRIEVAL_FAILURE",e[e.VERIFY_API_REQUEST_FAILURE=102]="VERIFY_API_REQUEST_FAILURE",e[e.BROWSER_FRAME_MESSAGE_FAILURE=103]="BROWSER_FRAME_MESSAGE_FAILURE",e[e.RANDOM_NUMBER_GENERATION_FAILURE=104]="RANDOM_NUMBER_GENERATION_FAILURE",e[e.PASSCODE_FORMAT_FAILURE=105]="PASSCODE_FORMAT_FAILURE",e[e.PASSCODE_RETRIEVAL_FAILURE=106]="PASSCODE_RETRIEVAL_FAILURE",e[e.SIGNATURE_GENERATION_FAILURE=107]="SIGNATURE_GENERATION_FAILURE",e[e.USER_NOT_SYNCED_FAILURE=108]="USER_NOT_SYNCED_FAILURE",e[e.WEBASSEMBLY_SUPPORT_FAILURE=109]="WEBASSEMBLY_SUPPORT_FAILURE",e[e.FRAME_LOAD_FAILURE=110]="FRAME_LOAD_FAILURE",e[e.USER_VERIFY_API_REQUEST_FAILURE=200]="USER_VERIFY_API_REQUEST_FAILURE",e[e.USER_CREATE_REQUEST_FAILURE=201]="USER_CREATE_REQUEST_FAILURE",e[e.USER_UPDATE_REQUEST_FAILURE=202]="USER_UPDATE_REQUEST_FAILURE",e[e.USER_PASSCODE_INCORRECT=203]="USER_PASSCODE_INCORRECT",e[e.USER_KEY_LIST_REQUEST_FAILURE=204]="USER_KEY_LIST_REQUEST_FAILURE",e[e.USER_DEVICE_ADD_REQUEST_FAILURE=205]="USER_DEVICE_ADD_REQUEST_FAILURE",e[e.USER_MASTER_KEY_GENERATION_FAILURE=206]="USER_MASTER_KEY_GENERATION_FAILURE",e[e.USER_DEVICE_KEY_GENERATION_FAILURE=207]="USER_DEVICE_KEY_GENERATION_FAILURE",e[e.USER_DEVICE_KEY_DECRYPTION_FAILURE=208]="USER_DEVICE_KEY_DECRYPTION_FAILURE",e[e.USER_PASSCODE_CHANGE_FAILURE=209]="USER_PASSCODE_CHANGE_FAILURE",e[e.USER_DEVICE_DELETE_REQUEST_FAILURE=210]="USER_DEVICE_DELETE_REQUEST_FAILURE",e[e.USER_UPDATE_KEY_REQUEST_FAILURE=211]="USER_UPDATE_KEY_REQUEST_FAILURE",e[e.USER_PRIVATE_KEY_ROTATION_FAILURE=212]="USER_PRIVATE_KEY_ROTATION_FAILURE",e[e.DOCUMENT_LIST_REQUEST_FAILURE=300]="DOCUMENT_LIST_REQUEST_FAILURE",e[e.DOCUMENT_GET_REQUEST_FAILURE=301]="DOCUMENT_GET_REQUEST_FAILURE",e[e.DOCUMENT_CREATE_REQUEST_FAILURE=302]="DOCUMENT_CREATE_REQUEST_FAILURE",e[e.DOCUMENT_UPDATE_REQUEST_FAILURE=303]="DOCUMENT_UPDATE_REQUEST_FAILURE",e[e.DOCUMENT_GRANT_ACCESS_REQUEST_FAILURE=304]="DOCUMENT_GRANT_ACCESS_REQUEST_FAILURE",e[e.DOCUMENT_REVOKE_ACCESS_REQUEST_FAILURE=305]="DOCUMENT_REVOKE_ACCESS_REQUEST_FAILURE",e[e.DOCUMENT_DECRYPT_FAILURE=306]="DOCUMENT_DECRYPT_FAILURE",e[e.DOCUMENT_ENCRYPT_FAILURE=307]="DOCUMENT_ENCRYPT_FAILURE",e[e.DOCUMENT_REENCRYPT_FAILURE=308]="DOCUMENT_REENCRYPT_FAILURE",e[e.DOCUMENT_GRANT_ACCESS_FAILURE=309]="DOCUMENT_GRANT_ACCESS_FAILURE",e[e.DOCUMENT_MAX_SIZE_EXCEEDED=310]="DOCUMENT_MAX_SIZE_EXCEEDED",e[e.DOCUMENT_CREATE_WITH_ACCESS_FAILURE=311]="DOCUMENT_CREATE_WITH_ACCESS_FAILURE",e[e.DOCUMENT_HEADER_PARSE_FAILURE=312]="DOCUMENT_HEADER_PARSE_FAILURE",e[e.DOCUMENT_TRANSFORM_REQUEST_FAILURE=313]="DOCUMENT_TRANSFORM_REQUEST_FAILURE",e[e.GROUP_LIST_REQUEST_FAILURE=400]="GROUP_LIST_REQUEST_FAILURE",e[e.GROUP_GET_REQUEST_FAILURE=401]="GROUP_GET_REQUEST_FAILURE",e[e.GROUP_CREATE_REQUEST_FAILURE=402]="GROUP_CREATE_REQUEST_FAILURE",e[e.GROUP_ADD_MEMBERS_REQUEST_FAILURE=403]="GROUP_ADD_MEMBERS_REQUEST_FAILURE",e[e.GROUP_ADD_MEMBER_NOT_ADMIN_FAILURE=404]="GROUP_ADD_MEMBER_NOT_ADMIN_FAILURE",e[e.GROUP_REMOVE_MEMBERS_REQUEST_FAILURE=405]="GROUP_REMOVE_MEMBERS_REQUEST_FAILURE",e[e.GROUP_REMOVE_SELF_REQUEST_FAILURE=406]="GROUP_REMOVE_SELF_REQUEST_FAILURE",e[e.GROUP_KEY_GENERATION_FAILURE=407]="GROUP_KEY_GENERATION_FAILURE",e[e.GROUP_MEMBER_KEY_ENCRYPTION_FAILURE=408]="GROUP_MEMBER_KEY_ENCRYPTION_FAILURE",e[e.GROUP_ADD_ADMINS_NOT_ADMIN_FAILURE=409]="GROUP_ADD_ADMINS_NOT_ADMIN_FAILURE",e[e.GROUP_ADD_ADMINS_REQUEST_FAILURE=410]="GROUP_ADD_ADMINS_REQUEST_FAILURE",e[e.GROUP_KEY_DECRYPTION_FAILURE=411]="GROUP_KEY_DECRYPTION_FAILURE",e[e.GROUP_REMOVE_ADMINS_REQUEST_FAILURE=412]="GROUP_REMOVE_ADMINS_REQUEST_FAILURE",e[e.GROUP_UPDATE_REQUEST_FAILURE=413]="GROUP_UPDATE_REQUEST_FAILURE",e[e.GROUP_DELETE_REQUEST_FAILURE=414]="GROUP_DELETE_REQUEST_FAILURE",e[e.GROUP_CREATE_WITH_MEMBERS_OR_ADMINS_FAILURE=415]="GROUP_CREATE_WITH_MEMBERS_OR_ADMINS_FAILURE",e[e.GROUP_PRIVATE_KEY_ROTATION_FAILURE=416]="GROUP_PRIVATE_KEY_ROTATION_FAILURE",e[e.GROUP_UPDATE_KEY_REQUEST_FAILURE=417]="GROUP_UPDATE_KEY_REQUEST_FAILURE",e[e.GROUP_ROTATE_PRIVATE_KEY_NOT_ADMIN_FAILURE=418]="GROUP_ROTATE_PRIVATE_KEY_NOT_ADMIN_FAILURE",e[e.REQUEST_RATE_LIMITED=500]="REQUEST_RATE_LIMITED",e[e.POLICY_APPLY_REQUEST_FAILURE=600]="POLICY_APPLY_REQUEST_FAILURE"}(s||(s={}));var f={FRAME_DOMAIN:"https://api.ironcorelabs.com",FRAME_PATH:"/ironweb-frame"};"string"==typeof _ICL_FRAME_DOMAIN_REPLACEMENT_&&_ICL_FRAME_DOMAIN_REPLACEMENT_.length&&(f.FRAME_DOMAIN=_ICL_FRAME_DOMAIN_REPLACEMENT_);var R,d="3.3.3",A=(R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});var m=function(e){function t(r,n){var o=e.call(this,r.message)||this;return!function(e){return"number"==typeof e.code&&e.name!==_.NATIVE_DECRYPT_FAILURE_ERROR}(r)?(o.code=n,o.rawError=r):(o.code=r.code,o.rawError=r.rawError),Object.setPrototypeOf(o,t.prototype),o}return A(t,e),t}(Error),l=r(0),p=r.n(l),U=r(3),h=function(){function e(e){var t=this;this.callbackCount=0,this.callbacks={},this.processMessageIntoShim=function(e){var r=e.data,n=r.data,o=r.replyID,i=t.callbacks[o];i&&(delete t.callbacks[o],i(n))};var r=new MessageChannel;r.port1.start(),r.port1.addEventListener("message",this.processMessageIntoShim),this.messagePort=r.port1,e.addEventListener("load",(function(){e.contentWindow.postMessage("MESSAGE_PORT_INIT",f.FRAME_DOMAIN,[r.port2])}))}return e.prototype.postMessageToFrame=function(e,t){var r=this;void 0===t&&(t=[]);var n={replyID:this.callbackCount++,data:e};try{return this.messagePort.postMessage(n,t.map((function(e){return e.buffer}))),new p.a((function(e,t){r.callbacks[n.replyID]=t}))}catch(e){return p.a.reject(new m(new Error("Failure occurred when passing message due to the lack of browser support."),s.BROWSER_FRAME_MESSAGE_FAILURE))}},e}(),T=window.document.createElement("iframe"),I=new h(T),g=new U.Promise((function(e,t){T.addEventListener("load",(function(){var r=setTimeout((function(){t(new m(new Error("Failed to load IronWeb frame."),s.FRAME_LOAD_FAILURE))}),1e3);I.postMessageToFrame({type:"FRAME_LOADED_CHECK"}).engage(t,(function(){clearTimeout(r),e()}))}))}));function y(e,t){return p.a.tryP((function(){return g})).flatMap((function(){return I.postMessageToFrame(e,t)})).flatMap((function(e){return function(e){return"ERROR_RESPONSE"===e.type}(e)?p.a.reject(new m(new Error(e.message.text),e.message.code)):p.a.of(e)}))}T.height="0",T.width="0",T.style.display="none",T.style.position="absolute",T.style.top="-999px",T.style.left="-999px",T.src=""+f.FRAME_DOMAIN+f.FRAME_PATH+"?version="+d,window.document.body.appendChild(T);var D,S="1",O=!1;function v(){return S+"-icldassk"}function L(){O=!0}function w(){if(!O)throw new Error('SDK "initialize()" method has not yet been called or completed execution. SDK methods cannot be used until initialization is complete.')}function P(e){if(e)try{localStorage.setItem(v(),e)}catch(e){}}function M(){try{return localStorage.getItem(v())||void 0}catch(e){return}}function N(e,t){void 0===t&&(t=!1);var r={};return e.filter((function(e){return!(r[e]||t&&!e.length)&&(r[e]=!0,!0)}))}function C(e){if("string"!=typeof e||!e.length)throw new Error("Invalid ID provided. Expected a non-zero length string but got "+e);if(!E.test(e))throw new Error("Invalid ID provided. Provided value includes invalid characters: '"+e+"'.")}function F(e){if(!(e instanceof Uint8Array&&e.length))throw new Error("Invalid document data format provided. Expected a Uint8Array.")}function b(e){if(!(e instanceof Uint8Array))throw new Error("Invalid encrypted document content. Content should be a Uint8Array.");if(e.byteLength<_.IV_LENGTH+1)throw new Error("Invalid encrypted document content. Length of content does not meet minimum requirements.")}function G(e){var t=e&&Array.isArray(e.users)&&e.users.length,r=e&&Array.isArray(e.groups)&&e.groups.length;if(!t&&!r)throw new Error("You must provide a list of users or groups with which to change document access.")}function Y(e){if(!Array.isArray(e)||!e.length)throw new Error("You must provide a list of users to perform this operation.")}function Q(e){var t=[],r=[];return e.users&&e.users.length&&(t=N(e.users.map((function(e){return e.id})),!0)),e.groups&&e.groups.length&&(r=N(e.groups.map((function(e){return e.id})),!0)),[t,r]}function j(e){return p.a.tryP((function(){var t=e();if(t&&"function"==typeof t.then)return t;throw new m(new Error("JWT callback did not return a Promise."),s.JWT_FORMAT_FAILURE)})).flatMap((function(e){return"string"==typeof e&&e.length>0?p.a.of(e):p.a.reject(new m(new Error("JWT should be a non-zero length string, but instead got '"+e+"'"),s.JWT_RETRIEVAL_FAILURE))}))}var V=function(e,t,r){return void 0===r&&(r=!1),j(e).flatMap((function(e){return y({type:"CREATE_USER",message:{passcode:t,jwtToken:e,needsRotation:r}})})).map((function(e){var t=e.message;return{accountID:t.id,segmentID:t.segmentId,needsRotation:t.needsRotation,status:t.status,userMasterPublicKey:t.userMasterPublicKey}})).toPromise()},K=function(e,t){return j(e).flatMap((function(e){return y({type:"CREATE_DETATCHED_USER_DEVICE",message:{passcode:t,jwtToken:e}})})).map((function(e){return e.message})).toPromise()};function B(e,t){return D=e,j(e).flatMap((function(e){return y({type:"INIT_SDK",message:{jwtToken:e,symmetricKey:M()}})})).flatMap((function(e){return"INIT_PASSCODE_REQUIRED"===e.type?function(e,t){return p.a.tryP((function(){var r=e(t);if(r&&"function"==typeof r.then)return r;throw new m(new Error("Passcode callback did not return a Promise."),s.PASSCODE_FORMAT_FAILURE)})).flatMap((function(e){return"string"==typeof e&&e.length>0?p.a.of(e):p.a.reject(new m(new Error("User provided passcode should be a non-zero length string, but instead got '"+e+"'"),s.PASSCODE_RETRIEVAL_FAILURE))}))}(t,e.message.doesUserExist).flatMap((function(t){return function(e,t){return j(D).flatMap((function(r){return y({type:e?"GEN_DEVICE_KEYS":"CREATE_USER_AND_DEVICE",message:{passcode:t,jwtToken:r}})})).map((function(e){return P(e.message.symmetricKey),L(),{user:e.message.user,groupsNeedingRotation:e.message.groupsNeedingRotation}}))}(e.message.doesUserExist,t)})):(P(e.message.symmetricKey),L(),p.a.of({user:e.message.user,groupsNeedingRotation:e.message.groupsNeedingRotation}))})).toPromise()}var W=r(1),x=r(2),k={fromBytes:function(e){return Object(W.decode)(e)},toBytes:function(e){return Object(W.encode)(e)}},H={fromBytes:function(e){return Object(x.fromByteArray)(e)},toBytes:function(e){return Object(x.toByteArray)(e)}},z=2048e3;function J(e){var t=(window.msCrypto||window.crypto).getRandomValues(new Uint8Array(16)),r=Array.prototype.map.call(t,(function(e){return("00"+e.toString(16)).slice(-2)})).join("");return e?{documentID:e.documentID||r,documentName:e.documentName||"",accessList:{users:e.accessList&&e.accessList.users?e.accessList.users:[],groups:e.accessList&&e.accessList.groups?e.accessList.groups:[],grantToAuthor:!1!==e.grantToAuthor},policy:e.policy}:{documentID:r,documentName:"",accessList:{users:[],groups:[],grantToAuthor:!0}}}function X(){return w(),y({type:"DOCUMENT_LIST"}).map((function(e){return e.message})).toPromise()}function Z(e){return w(),C(e),y({type:"DOCUMENT_META_GET",message:{documentID:e}}).map((function(e){return e.message})).toPromise()}function q(e){if(w(),b(e),1===e[0])return Promise.resolve(null);if(2!==e[0])return Promise.reject(new m(new Error("Provided encrypted document doesn't appear to be valid. Invalid version."),s.DOCUMENT_HEADER_PARSE_FAILURE));var t=new DataView(e.buffer).getUint16(e.byteOffset+a,!1),r=e.slice(a+c,a+c+t);try{var n=JSON.parse(k.fromBytes(r));return Promise.resolve(n._did_)}catch(e){return Promise.reject(new m(new Error("Unable to parse document header. Header value is corrupted."),s.DOCUMENT_HEADER_PARSE_FAILURE))}}function $(e){return w(),C(e),y({type:"DOCUMENT_STORE_DECRYPT",message:{documentID:e}}).map((function(e){return e.message})).toPromise()}function ee(e,t){w(),C(e),b(t);var r={type:"DOCUMENT_DECRYPT",message:{documentID:e,documentData:t.slice()}};return y(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function te(e,t){if(w(),F(e),e.length>z)return Promise.reject(new m(new Error("Document of length "+e.length+" exceeds maximum allowed byte size of "+z),s.DOCUMENT_MAX_SIZE_EXCEEDED));var r=J(t);r.documentID&&C(r.documentID);var n=Q(r.accessList),o=n[0],i=n[1],u={type:"DOCUMENT_STORE_ENCRYPT",message:{documentID:r.documentID,documentData:e.slice(),documentName:r.documentName,userGrants:o,groupGrants:i,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return y(u,[u.message.documentData]).map((function(e){return e.message})).toPromise()}function re(e,t){w(),F(e);var r=J(t);r.documentID&&C(r.documentID);var n=Q(r.accessList),o=n[0],i=n[1],u={type:"DOCUMENT_ENCRYPT",message:{documentData:e.slice(),documentID:r.documentID,documentName:r.documentName,userGrants:o,groupGrants:i,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return y(u,[u.message.documentData]).map((function(e){return e.message})).toPromise()}function ne(e,t){if(w(),C(e),F(t),t.length>z)return Promise.reject(new m(new Error("Document of length "+t.length+" exceeds maximum allowed byte size of "+z),s.DOCUMENT_MAX_SIZE_EXCEEDED));var r={type:"DOCUMENT_STORE_UPDATE_DATA",message:{documentID:e,documentData:t.slice()}};return y(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function oe(e,t){w(),C(e),F(t);var r={type:"DOCUMENT_UPDATE_DATA",message:{documentID:e,documentData:t.slice()}};return y(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function ie(e,t){return w(),C(e),y({type:"DOCUMENT_UPDATE_NAME",message:{documentID:e,name:""===t?null:t}}).map((function(e){return e.message})).toPromise()}function ue(e,t){w(),C(e),G(t);var r=Q(t);return y({type:"DOCUMENT_GRANT",message:{documentID:e,userGrants:r[0],groupGrants:r[1]}}).map((function(e){return e.message})).toPromise()}function se(e,t){w(),C(e),G(t);var r=Q(t);return y({type:"DOCUMENT_REVOKE",message:{documentID:e,userRevocations:r[0],groupRevocations:r[1]}}).map((function(e){return e.message})).toPromise()}var ae={decryptUnmanaged:function(e,t){return w(),function(e){if(!(e instanceof Uint8Array))throw new Error("Invalid encrypted deks. Edeks should be a Uint8Array.");if(e.byteLength<=0)throw new Error("Invalid encrypted deks. Length does not meet minimum requirements.")}(t),b(e),p.a.tryP((function(){return q(e)})).flatMap((function(r){var n={type:"DOCUMENT_UNMANAGED_DECRYPT",message:{edeks:t,documentData:e.slice()}};return y(n,[n.message.documentData]).map((function(e){var t=e.message;return{data:t.data,documentID:r,accessVia:t.accessVia}}))})).toPromise()},encryptUnmanaged:function(e,t){w(),F(e);var r=J(t);r.documentID&&C(r.documentID);var n=Q(r.accessList),o=n[0],i=n[1],u={type:"DOCUMENT_UNMANAGED_ENCRYPT",message:{documentData:e.slice(),documentID:r.documentID,userGrants:o,groupGrants:i,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return y(u,[u.message.documentData]).map((function(e){return e.message})).toPromise()}};function ce(){return w(),y({type:"GROUP_LIST"}).map((function(e){return e.message})).toPromise()}function Ee(e){return w(),C(e),y({type:"GROUP_GET",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}function _e(e){return void 0===e&&(e={groupName:"",addAsMember:!0,addAsAdmin:!0,needsRotation:!1}),w(),function(e,t){if(!t&&!1===e)throw new Error("Failed to create group because group ownership must be held by a group administrator")}(e.addAsAdmin,e.ownerUserId),e.groupID&&C(e.groupID),y({type:"GROUP_CREATE",message:{groupID:e.groupID||"",groupName:e.groupName||"",ownerUserId:e.ownerUserId,addAsMember:!1!==e.addAsMember,addAsAdmin:!1!==e.addAsAdmin,needsRotation:!0===e.needsRotation,userLists:{memberList:e.memberList?N(e.memberList,!0):[],adminList:e.adminList?N(e.adminList,!0):[]}}}).map((function(e){return e.message})).toPromise()}function fe(e){return w(),C(e),y({type:"ROTATE_GROUP_PRIVATE_KEY",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}function Re(e,t){if(w(),C(e),null===t.groupName||"string"==typeof t.groupName&&t.groupName.length)return y({type:"GROUP_UPDATE",message:{groupID:e,groupName:t.groupName}}).map((function(e){return e.message})).toPromise();throw new Error("Group update must provide a new name which is either a non-zero length string or null.")}function de(e,t){return w(),C(e),Y(t),y({type:"GROUP_ADD_ADMINS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function Ae(e,t){return w(),C(e),Y(t),y({type:"GROUP_REMOVE_ADMINS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function me(e,t){return w(),C(e),Y(t),y({type:"GROUP_ADD_MEMBERS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function le(e,t){return w(),C(e),Y(t),y({type:"GROUP_REMOVE_MEMBERS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function pe(e){return w(),C(e),y({type:"GROUP_REMOVE_SELF_AS_MEMBER",message:{groupID:e}}).map((function(){})).toPromise()}function Ue(e){return w(),C(e),y({type:"GROUP_DELETE",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}function he(e,t){return w(),y({type:"CHANGE_USER_PASSCODE",message:{currentPasscode:e,newPasscode:t}}).map((function(){})).toPromise()}function Te(e){return w(),y({type:"ROTATE_USER_PRIVATE_KEY",message:{passcode:e}}).map((function(){})).toPromise()}function Ie(){w();return function(){try{localStorage.removeItem(v())}catch(e){}}(),y({type:"DEAUTHORIZE_DEVICE",message:null}).map((function(e){var t=e.message;return O=!1,{transformKeyDeleted:t}})).toPromise()}var ge=o,ye=u,De=i,Se=n;function Oe(){var e=window.msCrypto||window.crypto;return"object"==typeof e&&"function"==typeof e.getRandomValues}function ve(){return"object"==typeof WebAssembly&&WebAssembly&&"function"==typeof WebAssembly.instantiate}r.d(t,"createNewUser",(function(){return Pe})),r.d(t,"createNewDeviceKeys",(function(){return Me})),r.d(t,"initialize",(function(){return Ne})),r.d(t,"isInitialized",(function(){return Ce})),r.d(t,"ErrorCodes",(function(){return s})),r.d(t,"SDKError",(function(){return m})),r.d(t,"document",(function(){return ge})),r.d(t,"user",(function(){return ye})),r.d(t,"group",(function(){return De})),r.d(t,"codec",(function(){return Se}));var Le=function(){return Promise.reject(new m(new Error("Request failed due to a lack of browser support for WebAssembly."),s.WEBASSEMBLY_SUPPORT_FAILURE))},we=function(){return Promise.reject(new m(new Error("Request failed due to a lack of browser support for random number generation."),s.RANDOM_NUMBER_GENERATION_FAILURE))};function Pe(e,t,r){if(void 0===r&&(r={needsRotation:!1}),!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.createNewUser'.");return Oe()?ve()?V(e,t,r.needsRotation||!1):Le():we()}function Me(e,t){if(!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.createNewUser'.");return Oe()?ve()?K(e,t):Le():we()}function Ne(e,t){if(!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.initialize'.");if(!t||"function"!=typeof t)throw new Error("You must provide a function which will generate the users escrow passcode as the second parameter to 'IronWeb.initialize'.");return Oe()?ve()?B(e,t):Le():we()}function Ce(){try{return w(),!0}catch(e){return!1}}}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ironweb=t():e.ironweb=t()}(self,(()=>(()=>{"use strict";var e={249:(e,t)=>{var r="utf8: invalid string",n="utf8: invalid source encoding";function o(e){for(var t=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);if(o<128)t+=1;else if(o<2048)t+=2;else if(o<55296)t+=3;else{if(!(o<=57343))throw new Error(r);if(n>=e.length-1)throw new Error(r);n++,t+=4}}return t}t.cv=function(e){for(var t=new Uint8Array(o(e)),r=0,n=0;n<e.length;n++){var E=e.charCodeAt(n);E<128?t[r++]=E:E<2048?(t[r++]=192|E>>6,t[r++]=128|63&E):E<55296?(t[r++]=224|E>>12,t[r++]=128|E>>6&63,t[r++]=128|63&E):(n++,E=(1023&E)<<10,E|=1023&e.charCodeAt(n),E+=65536,t[r++]=240|E>>18,t[r++]=128|E>>12&63,t[r++]=128|E>>6&63,t[r++]=128|63&E)}return t},t.Jx=function(e){for(var t=[],r=0;r<e.length;r++){var o=e[r];if(128&o){var E=void 0;if(o<224){if(r>=e.length)throw new Error(n);if(128!=(192&(a=e[++r])))throw new Error(n);o=(31&o)<<6|63&a,E=128}else if(o<240){if(r>=e.length-1)throw new Error(n);var a=e[++r],s=e[++r];if(128!=(192&a)||128!=(192&s))throw new Error(n);o=(15&o)<<12|(63&a)<<6|63&s,E=2048}else{if(!(o<248))throw new Error(n);if(r>=e.length-2)throw new Error(n);a=e[++r],s=e[++r];var i=e[++r];if(128!=(192&a)||128!=(192&s)||128!=(192&i))throw new Error(n);o=(15&o)<<18|(63&a)<<12|(63&s)<<6|63&i,E=65536}if(o<E||o>=55296&&o<=57343)throw new Error(n);if(o>=65536){if(o>1114111)throw new Error(n);o-=65536,t.push(String.fromCharCode(55296|o>>10)),o=56320|1023&o}}t.push(String.fromCharCode(o))}return t.join("")}},742:(e,t)=>{t.b$=function(e){var t,r,E=i(e),a=E[0],s=E[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),c=0,_=s>0?a-4:a;for(r=0;r<_;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},t.JQ=function(e){for(var t,n=e.length,o=n%3,E=[],a=16383,s=0,i=n-o;s<i;s+=a)E.push(u(e,s,s+a>i?i:s+a));1===o?(t=e[n-1],E.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],E.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return E.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=E.length;a<s;++a)r[a]=E[a],n[E.charCodeAt(a)]=a;function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var o,E,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(E=o)>>18&63]+r[E>>12&63]+r[E>>6&63]+r[63&E]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},670:(e,t)=>{var r=function(){function e(e){this.action=e}return e.prototype.engage=function(e,t){try{this.action(e,t)}catch(t){e(t)}},e.prototype.then=function(e,t){return this.toPromise().then(e,t)},e.prototype.toPromise=function(){var e=this;return new Promise((function(t,r){return e.engage(r,t)}))},e.prototype.map=function(t){return this.flatMap((function(r){return e.of(t(r))}))},e.prototype.flatMap=function(t){var r=this;return new e((function(e,n){r.engage(e,(function(r){return t(r).engage(e,n)}))}))},e.prototype.handleWith=function(t){var r=this;return new e((function(e,n){r.engage((function(r){t(r).engage(e,n)}),n)}))},e.prototype.errorMap=function(t){var r=this;return new e((function(e,n){r.engage((function(r){return e(t(r))}),n)}))},e.tryF=function(t){return new e((function(e,r){var n;try{n=t()}catch(t){return e(t)}r(n)}))},e.tryP=function(t){return new e((function(e,r){var n;try{n=t()}catch(t){return e(t)}n.then(r).catch(e)}))},e.of=function(t){return new e((function(e,r){r(t)}))},e.reject=function(t){return new e((function(e){e(t)}))},e.encase=function(t,r){return new e((function(e,n){var o;try{o=t(r)}catch(t){return e(t)}n(o)}))},e.gather2=function(t,r){return new e((function(e,n){var o=[],E=0,a=!1;t.engage((function(t){a||(a=!0,e(t))}),(function(e){o[0]=e,2==++E&&n(o)})),r.engage((function(t){a||(a=!0,e(t))}),(function(e){o[1]=e,2==++E&&n(o)}))}))},e.gather3=function(e,t,r){var n=this.gather2(e,t);return this.gather2(n,r).map((function(e){var t=e[0];return[t[0],t[1],e[1]]}))},e.gather4=function(e,t,r,n){var o=this.gather2(e,t),E=this.gather2(r,n);return this.gather2(o,E).map((function(e){var t=e[0],r=t[0],n=t[1],o=e[1];return[r,n,o[0],o[1]]}))},e.all=function(e){return Array.isArray(e)?this.allArray(e):this.allObject(e)},e.allArray=function(t){return new e((function(e,r){var n=[],o=0;0===t.length&&r(n),t.forEach((function(E,a){E.engage((function(t){e(t)}),(function(e){n[a]=e,(o+=1)===t.length&&r(n)}))}))}))},e.allObject=function(e){var t=Object.keys(e),r=t.map((function(t){return e[t]}));return this.allArray(r).map((function(e){return t.reduce((function(t,r,n){return t[r]=e[n],t}),{})}))},e}();t.Z=r}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var E=t[n]={exports:{}};return e[n](E,E.exports,r),E.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{ErrorCodes:()=>s,SDKError:()=>m,codec:()=>Le,createNewDeviceKeys:()=>Fe,createNewUser:()=>Ce,document:()=>le,group:()=>Oe,initialize:()=>we,isInitialized:()=>ve,search:()=>he,user:()=>Se});var e={};r.r(e),r.d(e,{base64:()=>V,utf8:()=>K});var t={};r.r(t),r.d(t,{advanced:()=>ne,decrypt:()=>z,decryptFromStore:()=>k,encrypt:()=>X,encryptToStore:()=>J,getDocumentIDFromBytes:()=>Z,getMetadata:()=>H,grantAccess:()=>te,list:()=>W,revokeAccess:()=>re,updateEncryptedData:()=>$,updateEncryptedDataInStore:()=>q,updateName:()=>ee});var o={};r.r(o),r.d(o,{addAdmins:()=>ue,addMembers:()=>_e,create:()=>ae,deleteGroup:()=>fe,get:()=>Ee,list:()=>oe,removeAdmins:()=>ce,removeMembers:()=>Re,removeSelfAsMember:()=>Ae,rotatePrivateKey:()=>se,update:()=>ie});var E={};r.r(E),r.d(E,{createBlindSearchIndex:()=>Ie,initializeBlindSearchIndex:()=>de,transliterateString:()=>pe});var a={};r.r(a),r.d(a,{changePasscode:()=>Te,deauthorizeDevice:()=>De,rotateMasterKey:()=>ge});var s,i=/^[a-zA-Z0-9_.$#|@/:;=+'-]{1,100}$/,u=12,c="OperationError";!function(e){e[e.JWT_FORMAT_FAILURE=100]="JWT_FORMAT_FAILURE",e[e.JWT_RETRIEVAL_FAILURE=101]="JWT_RETRIEVAL_FAILURE",e[e.VERIFY_API_REQUEST_FAILURE=102]="VERIFY_API_REQUEST_FAILURE",e[e.BROWSER_FRAME_MESSAGE_FAILURE=103]="BROWSER_FRAME_MESSAGE_FAILURE",e[e.RANDOM_NUMBER_GENERATION_FAILURE=104]="RANDOM_NUMBER_GENERATION_FAILURE",e[e.PASSCODE_FORMAT_FAILURE=105]="PASSCODE_FORMAT_FAILURE",e[e.PASSCODE_RETRIEVAL_FAILURE=106]="PASSCODE_RETRIEVAL_FAILURE",e[e.SIGNATURE_GENERATION_FAILURE=107]="SIGNATURE_GENERATION_FAILURE",e[e.USER_NOT_SYNCED_FAILURE=108]="USER_NOT_SYNCED_FAILURE",e[e.WEBASSEMBLY_SUPPORT_FAILURE=109]="WEBASSEMBLY_SUPPORT_FAILURE",e[e.FRAME_LOAD_FAILURE=110]="FRAME_LOAD_FAILURE",e[e.USER_VERIFY_API_REQUEST_FAILURE=200]="USER_VERIFY_API_REQUEST_FAILURE",e[e.USER_CREATE_REQUEST_FAILURE=201]="USER_CREATE_REQUEST_FAILURE",e[e.USER_UPDATE_REQUEST_FAILURE=202]="USER_UPDATE_REQUEST_FAILURE",e[e.USER_PASSCODE_INCORRECT=203]="USER_PASSCODE_INCORRECT",e[e.USER_KEY_LIST_REQUEST_FAILURE=204]="USER_KEY_LIST_REQUEST_FAILURE",e[e.USER_DEVICE_ADD_REQUEST_FAILURE=205]="USER_DEVICE_ADD_REQUEST_FAILURE",e[e.USER_MASTER_KEY_GENERATION_FAILURE=206]="USER_MASTER_KEY_GENERATION_FAILURE",e[e.USER_DEVICE_KEY_GENERATION_FAILURE=207]="USER_DEVICE_KEY_GENERATION_FAILURE",e[e.USER_DEVICE_KEY_DECRYPTION_FAILURE=208]="USER_DEVICE_KEY_DECRYPTION_FAILURE",e[e.USER_PASSCODE_CHANGE_FAILURE=209]="USER_PASSCODE_CHANGE_FAILURE",e[e.USER_DEVICE_DELETE_REQUEST_FAILURE=210]="USER_DEVICE_DELETE_REQUEST_FAILURE",e[e.USER_UPDATE_KEY_REQUEST_FAILURE=211]="USER_UPDATE_KEY_REQUEST_FAILURE",e[e.USER_PRIVATE_KEY_ROTATION_FAILURE=212]="USER_PRIVATE_KEY_ROTATION_FAILURE",e[e.DOCUMENT_LIST_REQUEST_FAILURE=300]="DOCUMENT_LIST_REQUEST_FAILURE",e[e.DOCUMENT_GET_REQUEST_FAILURE=301]="DOCUMENT_GET_REQUEST_FAILURE",e[e.DOCUMENT_CREATE_REQUEST_FAILURE=302]="DOCUMENT_CREATE_REQUEST_FAILURE",e[e.DOCUMENT_UPDATE_REQUEST_FAILURE=303]="DOCUMENT_UPDATE_REQUEST_FAILURE",e[e.DOCUMENT_GRANT_ACCESS_REQUEST_FAILURE=304]="DOCUMENT_GRANT_ACCESS_REQUEST_FAILURE",e[e.DOCUMENT_REVOKE_ACCESS_REQUEST_FAILURE=305]="DOCUMENT_REVOKE_ACCESS_REQUEST_FAILURE",e[e.DOCUMENT_DECRYPT_FAILURE=306]="DOCUMENT_DECRYPT_FAILURE",e[e.DOCUMENT_ENCRYPT_FAILURE=307]="DOCUMENT_ENCRYPT_FAILURE",e[e.DOCUMENT_REENCRYPT_FAILURE=308]="DOCUMENT_REENCRYPT_FAILURE",e[e.DOCUMENT_GRANT_ACCESS_FAILURE=309]="DOCUMENT_GRANT_ACCESS_FAILURE",e[e.DOCUMENT_MAX_SIZE_EXCEEDED=310]="DOCUMENT_MAX_SIZE_EXCEEDED",e[e.DOCUMENT_CREATE_WITH_ACCESS_FAILURE=311]="DOCUMENT_CREATE_WITH_ACCESS_FAILURE",e[e.DOCUMENT_HEADER_PARSE_FAILURE=312]="DOCUMENT_HEADER_PARSE_FAILURE",e[e.DOCUMENT_TRANSFORM_REQUEST_FAILURE=313]="DOCUMENT_TRANSFORM_REQUEST_FAILURE",e[e.GROUP_LIST_REQUEST_FAILURE=400]="GROUP_LIST_REQUEST_FAILURE",e[e.GROUP_GET_REQUEST_FAILURE=401]="GROUP_GET_REQUEST_FAILURE",e[e.GROUP_CREATE_REQUEST_FAILURE=402]="GROUP_CREATE_REQUEST_FAILURE",e[e.GROUP_ADD_MEMBERS_REQUEST_FAILURE=403]="GROUP_ADD_MEMBERS_REQUEST_FAILURE",e[e.GROUP_ADD_MEMBER_NOT_ADMIN_FAILURE=404]="GROUP_ADD_MEMBER_NOT_ADMIN_FAILURE",e[e.GROUP_REMOVE_MEMBERS_REQUEST_FAILURE=405]="GROUP_REMOVE_MEMBERS_REQUEST_FAILURE",e[e.GROUP_REMOVE_SELF_REQUEST_FAILURE=406]="GROUP_REMOVE_SELF_REQUEST_FAILURE",e[e.GROUP_KEY_GENERATION_FAILURE=407]="GROUP_KEY_GENERATION_FAILURE",e[e.GROUP_MEMBER_KEY_ENCRYPTION_FAILURE=408]="GROUP_MEMBER_KEY_ENCRYPTION_FAILURE",e[e.GROUP_ADD_ADMINS_NOT_ADMIN_FAILURE=409]="GROUP_ADD_ADMINS_NOT_ADMIN_FAILURE",e[e.GROUP_ADD_ADMINS_REQUEST_FAILURE=410]="GROUP_ADD_ADMINS_REQUEST_FAILURE",e[e.GROUP_KEY_DECRYPTION_FAILURE=411]="GROUP_KEY_DECRYPTION_FAILURE",e[e.GROUP_REMOVE_ADMINS_REQUEST_FAILURE=412]="GROUP_REMOVE_ADMINS_REQUEST_FAILURE",e[e.GROUP_UPDATE_REQUEST_FAILURE=413]="GROUP_UPDATE_REQUEST_FAILURE",e[e.GROUP_DELETE_REQUEST_FAILURE=414]="GROUP_DELETE_REQUEST_FAILURE",e[e.GROUP_CREATE_WITH_MEMBERS_OR_ADMINS_FAILURE=415]="GROUP_CREATE_WITH_MEMBERS_OR_ADMINS_FAILURE",e[e.GROUP_PRIVATE_KEY_ROTATION_FAILURE=416]="GROUP_PRIVATE_KEY_ROTATION_FAILURE",e[e.GROUP_UPDATE_KEY_REQUEST_FAILURE=417]="GROUP_UPDATE_KEY_REQUEST_FAILURE",e[e.GROUP_ROTATE_PRIVATE_KEY_NOT_ADMIN_FAILURE=418]="GROUP_ROTATE_PRIVATE_KEY_NOT_ADMIN_FAILURE",e[e.REQUEST_RATE_LIMITED=500]="REQUEST_RATE_LIMITED",e[e.POLICY_APPLY_REQUEST_FAILURE=600]="POLICY_APPLY_REQUEST_FAILURE",e[e.SEARCH_CREATE_INDEX_FAILURE=700]="SEARCH_CREATE_INDEX_FAILURE",e[e.SEARCH_INIT_INDEX_FAILURE=701]="SEARCH_INIT_INDEX_FAILURE",e[e.SEARCH_TOKENIZE_DATA_FAILURE=702]="SEARCH_TOKENIZE_DATA_FAILURE",e[e.SEARCH_TOKENIZE_QUERY_FAILURE=703]="SEARCH_TOKENIZE_QUERY_FAILURE"}(s||(s={}));var _={FRAME_DOMAIN:"https://api.ironcorelabs.com",FRAME_PATH:"/ironweb-frame"};"string"==typeof _ICL_FRAME_DOMAIN_REPLACEMENT_&&_ICL_FRAME_DOMAIN_REPLACEMENT_.length&&(_.FRAME_DOMAIN=_ICL_FRAME_DOMAIN_REPLACEMENT_);var R,A={SDK_VERSION:"4.0.19"},f=(R=function(e,t){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},R(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});const m=function(e){function t(r,n){var o=e.call(this,r.message)||this;return!function(e){return"number"==typeof e.code&&e.name!==c}(r)?(o.code=n,o.rawError=r):(o.code=r.code,o.rawError=r.rawError),Object.setPrototypeOf(o,t.prototype),o}return f(t,e),t}(Error);var U=r(670),I=function(){function e(e){var t=this;this.callbackCount=0,this.callbacks={},this.processMessageIntoShim=function(e){var r=e.data,n=r.data,o=r.replyID,E=t.callbacks[o];E&&(delete t.callbacks[o],E(n))};var r=new MessageChannel;r.port1.start(),r.port1.addEventListener("message",this.processMessageIntoShim),this.messagePort=r.port1,e.addEventListener("load",(function(){e.contentWindow.postMessage("MESSAGE_PORT_INIT",_.FRAME_DOMAIN,[r.port2])}))}return e.prototype.postMessageToFrame=function(e,t){var r=this;void 0===t&&(t=[]);var n={replyID:this.callbackCount++,data:e};try{return this.messagePort.postMessage(n,t.map((function(e){return e.buffer}))),new U.Z((function(e,t){r.callbacks[n.replyID]=t}))}catch(e){return U.Z.reject(new m(new Error("Failure occurred when passing message due to the lack of browser support."),s.BROWSER_FRAME_MESSAGE_FAILURE))}},e}(),d=window.document.createElement("iframe"),p=new I(d),T=new Promise((function(e,t){d.addEventListener("load",(function(){var r=setTimeout((function(){t(new m(new Error("Failed to load IronWeb frame."),s.FRAME_LOAD_FAILURE))}),1e3);p.postMessageToFrame({type:"FRAME_LOADED_CHECK"}).engage(t,(function(){clearTimeout(r),e()}))}))}));function g(e,t){return U.Z.tryP((function(){return T})).flatMap((function(){return p.postMessageToFrame(e,t)})).flatMap((function(e){return function(e){return"ERROR_RESPONSE"===e.type}(e)?U.Z.reject(new m(new Error(e.message.text),e.message.code)):U.Z.of(e)}))}d.height="0",d.width="0",d.style.display="none",d.style.position="absolute",d.style.top="-999px",d.style.left="-999px",d.src="".concat(_.FRAME_DOMAIN).concat(_.FRAME_PATH,"?version=").concat(A.SDK_VERSION),window.document.body.appendChild(d);var D,l=!1;function S(){return"".concat("1","-icldassk")}function O(){l=!0}function h(){if(!l)throw new Error('SDK "initialize()" method has not yet been called or completed execution. SDK methods cannot be used until initialization is complete.')}function L(e){if(e)try{localStorage.setItem(S(),e)}catch(e){}}function y(){try{return localStorage.getItem(S())||void 0}catch(e){return}}function N(e,t){void 0===t&&(t=!1);var r={};return e.filter((function(e){return!(r[e]||t&&!e.length)&&(r[e]=!0,!0)}))}function P(e){if("string"!=typeof e||!e.length)throw new Error("Invalid ID provided. Expected a non-zero length string but got ".concat(e));if(!i.test(e))throw new Error("Invalid ID provided. Provided value includes invalid characters: '".concat(e,"'."))}function M(e){if(!(e instanceof Uint8Array&&e.length))throw new Error("Invalid document data format provided. Expected a Uint8Array.")}function C(e){if(!(e instanceof Uint8Array))throw new Error("Invalid encrypted document content. Content should be a Uint8Array.");if(e.byteLength<u+1)throw new Error("Invalid encrypted document content. Length of content does not meet minimum requirements.")}function F(e){var t=e&&Array.isArray(e.users)&&e.users.length,r=e&&Array.isArray(e.groups)&&e.groups.length;if(!t&&!r)throw new Error("You must provide a list of users or groups with which to change document access.")}function w(e){if(!Array.isArray(e)||!e.length)throw new Error("You must provide a list of users to perform this operation.")}function v(e){var t=[],r=[];return e.users&&e.users.length&&(t=N(e.users.map((function(e){return e.id})),!0)),e.groups&&e.groups.length&&(r=N(e.groups.map((function(e){return e.id})),!0)),[t,r]}function G(e){return U.Z.tryP((function(){var t=e();if(t&&"function"==typeof t.then)return t;throw new m(new Error("JWT callback did not return a Promise."),s.JWT_FORMAT_FAILURE)})).flatMap((function(e){return"string"==typeof e&&e.length>0?U.Z.of(e):U.Z.reject(new m(new Error("JWT should be a non-zero length string, but instead got '".concat(e,"'")),s.JWT_RETRIEVAL_FAILURE))}))}function b(e,t){return D=e,G(e).flatMap((function(e){return g({type:"INIT_SDK",message:{jwtToken:e,symmetricKey:y()}})})).flatMap((function(e){return"INIT_PASSCODE_REQUIRED"===e.type?function(e,t){return U.Z.tryP((function(){var r=e(t);if(r&&"function"==typeof r.then)return r;throw new m(new Error("Passcode callback did not return a Promise."),s.PASSCODE_FORMAT_FAILURE)})).flatMap((function(e){return"string"==typeof e&&e.length>0?U.Z.of(e):U.Z.reject(new m(new Error("User provided passcode should be a non-zero length string, but instead got '".concat(e,"'")),s.PASSCODE_RETRIEVAL_FAILURE))}))}(t,e.message.doesUserExist).flatMap((function(t){return function(e,t){return G(D).flatMap((function(r){return g({type:e?"GEN_DEVICE_KEYS":"CREATE_USER_AND_DEVICE",message:{passcode:t,jwtToken:r}})})).map((function(e){return L(e.message.symmetricKey),O(),{user:e.message.user,groupsNeedingRotation:e.message.groupsNeedingRotation}}))}(e.message.doesUserExist,t)})):(L(e.message.symmetricKey),O(),U.Z.of({user:e.message.user,groupsNeedingRotation:e.message.groupsNeedingRotation}))})).toPromise()}var Y=r(249),Q=r(742),K={fromBytes:function(e){return(0,Y.Jx)(e)},toBytes:function(e){return(0,Y.cv)(e)}},V={fromBytes:function(e){return(0,Q.JQ)(e)},toBytes:function(e){return(0,Q.b$)(e)}},j=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,E=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=E.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=E.return)&&r.call(E)}finally{if(o)throw o.error}}return a},B=2048e3;function x(e){var t=window.crypto.getRandomValues(new Uint8Array(16)),r=Array.prototype.map.call(t,(function(e){return"00".concat(e.toString(16)).slice(-2)})).join("");return e?{documentID:e.documentID||r,documentName:e.documentName||"",accessList:{users:e.accessList&&e.accessList.users?e.accessList.users:[],groups:e.accessList&&e.accessList.groups?e.accessList.groups:[],grantToAuthor:!1!==e.grantToAuthor},policy:e.policy}:{documentID:r,documentName:"",accessList:{users:[],groups:[],grantToAuthor:!0}}}function W(){return h(),g({type:"DOCUMENT_LIST"}).map((function(e){return e.message})).toPromise()}function H(e){return h(),P(e),g({type:"DOCUMENT_META_GET",message:{documentID:e}}).map((function(e){return e.message})).toPromise()}function Z(e){if(h(),C(e),1===e[0])return Promise.resolve(null);if(2!==e[0])return Promise.reject(new m(new Error("Provided encrypted document doesn't appear to be valid. Invalid version."),s.DOCUMENT_HEADER_PARSE_FAILURE));var t=new DataView(e.buffer).getUint16(e.byteOffset+1,!1),r=e.slice(3,3+t);try{var n=JSON.parse(K.fromBytes(r));return Promise.resolve(n._did_)}catch(e){return Promise.reject(new m(new Error("Unable to parse document header. Header value is corrupted."),s.DOCUMENT_HEADER_PARSE_FAILURE))}}function k(e){return console.warn("decryptFromStore is deprecated. Use decrypt instead."),h(),P(e),g({type:"DOCUMENT_STORE_DECRYPT",message:{documentID:e}}).map((function(e){return e.message})).toPromise()}function z(e,t){h(),P(e),C(t);var r={type:"DOCUMENT_DECRYPT",message:{documentID:e,documentData:t.slice()}};return g(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function J(e,t){if(console.warn("encryptToStore is deprecated. Use encrypt instead and manage storage of the result yourself."),h(),M(e),e.length>B)return Promise.reject(new m(new Error("Document of length ".concat(e.length," exceeds maximum allowed byte size of ").concat(B)),s.DOCUMENT_MAX_SIZE_EXCEEDED));var r=x(t);r.documentID&&P(r.documentID);var n=j(v(r.accessList),2),o=n[0],E=n[1],a={type:"DOCUMENT_STORE_ENCRYPT",message:{documentID:r.documentID,documentData:e.slice(),documentName:r.documentName,userGrants:o,groupGrants:E,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return g(a,[a.message.documentData]).map((function(e){return e.message})).toPromise()}function X(e,t){h(),M(e);var r=x(t);r.documentID&&P(r.documentID);var n=j(v(r.accessList),2),o=n[0],E=n[1],a={type:"DOCUMENT_ENCRYPT",message:{documentData:e.slice(),documentID:r.documentID,documentName:r.documentName,userGrants:o,groupGrants:E,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return g(a,[a.message.documentData]).map((function(e){return e.message})).toPromise()}function q(e,t){if(h(),P(e),M(t),t.length>B)return Promise.reject(new m(new Error("Document of length ".concat(t.length," exceeds maximum allowed byte size of ").concat(B)),s.DOCUMENT_MAX_SIZE_EXCEEDED));var r={type:"DOCUMENT_STORE_UPDATE_DATA",message:{documentID:e,documentData:t.slice()}};return g(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function $(e,t){h(),P(e),M(t);var r={type:"DOCUMENT_UPDATE_DATA",message:{documentID:e,documentData:t.slice()}};return g(r,[r.message.documentData]).map((function(e){return e.message})).toPromise()}function ee(e,t){return h(),P(e),g({type:"DOCUMENT_UPDATE_NAME",message:{documentID:e,name:""===t?null:t}}).map((function(e){return e.message})).toPromise()}function te(e,t){h(),P(e),F(t);var r=j(v(t),2);return g({type:"DOCUMENT_GRANT",message:{documentID:e,userGrants:r[0],groupGrants:r[1]}}).map((function(e){return e.message})).toPromise()}function re(e,t){h(),P(e),F(t);var r=j(v(t),2);return g({type:"DOCUMENT_REVOKE",message:{documentID:e,userRevocations:r[0],groupRevocations:r[1]}}).map((function(e){return e.message})).toPromise()}var ne={decryptUnmanaged:function(e,t){return h(),function(e){if(!(e instanceof Uint8Array))throw new Error("Invalid encrypted deks. Edeks should be a Uint8Array.");if(e.byteLength<=0)throw new Error("Invalid encrypted deks. Length does not meet minimum requirements.")}(t),C(e),U.Z.tryP((function(){return Z(e)})).flatMap((function(r){var n={type:"DOCUMENT_UNMANAGED_DECRYPT",message:{edeks:t,documentData:e.slice()}};return g(n,[n.message.documentData]).map((function(e){var t=e.message;return{data:t.data,documentID:r,accessVia:t.accessVia}}))})).toPromise()},encryptUnmanaged:function(e,t){h(),M(e);var r=x(t);r.documentID&&P(r.documentID);var n=j(v(r.accessList),2),o=n[0],E=n[1],a={type:"DOCUMENT_UNMANAGED_ENCRYPT",message:{documentData:e.slice(),documentID:r.documentID,userGrants:o,groupGrants:E,grantToAuthor:r.accessList.grantToAuthor,policy:r.policy}};return g(a,[a.message.documentData]).map((function(e){return e.message})).toPromise()}};function oe(){return h(),g({type:"GROUP_LIST"}).map((function(e){return e.message})).toPromise()}function Ee(e){return h(),P(e),g({type:"GROUP_GET",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}function ae(e){return void 0===e&&(e={groupName:"",addAsMember:!0,addAsAdmin:!0,needsRotation:!1}),h(),function(e,t){if(!t&&!1===e)throw new Error("Failed to create group because group ownership must be held by a group administrator")}(e.addAsAdmin,e.ownerUserId),e.groupID&&P(e.groupID),g({type:"GROUP_CREATE",message:{groupID:e.groupID||"",groupName:e.groupName||"",ownerUserId:e.ownerUserId,addAsMember:!1!==e.addAsMember,addAsAdmin:!1!==e.addAsAdmin,needsRotation:!0===e.needsRotation,userLists:{memberList:e.memberList?N(e.memberList,!0):[],adminList:e.adminList?N(e.adminList,!0):[]}}}).map((function(e){return e.message})).toPromise()}function se(e){return h(),P(e),g({type:"ROTATE_GROUP_PRIVATE_KEY",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}function ie(e,t){if(h(),P(e),null===t.groupName||"string"==typeof t.groupName&&t.groupName.length)return g({type:"GROUP_UPDATE",message:{groupID:e,groupName:t.groupName}}).map((function(e){return e.message})).toPromise();throw new Error("Group update must provide a new name which is either a non-zero length string or null.")}function ue(e,t){return h(),P(e),w(t),g({type:"GROUP_ADD_ADMINS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function ce(e,t){return h(),P(e),w(t),g({type:"GROUP_REMOVE_ADMINS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function _e(e,t){return h(),P(e),w(t),g({type:"GROUP_ADD_MEMBERS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function Re(e,t){return h(),P(e),w(t),g({type:"GROUP_REMOVE_MEMBERS",message:{groupID:e,userList:N(t,!0)}}).map((function(e){return e.message})).toPromise()}function Ae(e){return h(),P(e),g({type:"GROUP_REMOVE_SELF_AS_MEMBER",message:{groupID:e}}).map((function(){})).toPromise()}function fe(e){return h(),P(e),g({type:"GROUP_DELETE",message:{groupID:e}}).map((function(e){return e.message})).toPromise()}var me=function(){return me=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},me.apply(this,arguments)},Ue=function(){function e(e){this.searchIndexId=e}return e.prototype.tokenizeData=function(e,t){return g({type:"BLIND_SEARCH_INDEX_TOKENIZE_DATA",message:{data:e,partitionId:t,searchIndexId:this.searchIndexId}}).map((function(e){return e.message})).toPromise()},e.prototype.tokenizeQuery=function(e,t){return g({type:"BLIND_SEARCH_INDEX_TOKENIZE_QUERY",message:{query:e,partitionId:t,searchIndexId:this.searchIndexId}}).map((function(e){return e.message})).toPromise()},e}(),Ie=function(e){return h(),P(e),g({type:"BLIND_SEARCH_INDEX_CREATE",message:{groupId:e}}).map((function(e){return e.message})).toPromise()},de=function(e){return h(),M(e.searchIndexEncryptedSalt),M(e.searchIndexEdeks),g({type:"BLIND_SEARCH_INDEX_INIT",message:me({},e)}).map((function(e){var t=e.message;return new Ue(t.searchIndexId)})).toPromise()},pe=function(e){return g({type:"SEARCH_TRANSLITERATE_STRING",message:e}).map((function(e){return e.message})).toPromise()};function Te(e,t){return h(),g({type:"CHANGE_USER_PASSCODE",message:{currentPasscode:e,newPasscode:t}}).map((function(){})).toPromise()}function ge(e){return h(),g({type:"ROTATE_USER_PRIVATE_KEY",message:{passcode:e}}).map((function(){})).toPromise()}function De(){h();return function(){try{localStorage.removeItem(S())}catch(e){}}(),g({type:"DEAUTHORIZE_DEVICE",message:null}).map((function(e){var t=e.message;return l=!1,{transformKeyDeleted:t}})).toPromise()}var le=t,Se=a,Oe=o,he=E,Le=e;function ye(){var e=window.crypto;return"object"==typeof e&&"function"==typeof e.getRandomValues}function Ne(){return"object"==typeof WebAssembly&&WebAssembly&&"function"==typeof WebAssembly.instantiate}var Pe=function(){return Promise.reject(new m(new Error("Request failed due to a lack of browser support for WebAssembly."),s.WEBASSEMBLY_SUPPORT_FAILURE))},Me=function(){return Promise.reject(new m(new Error("Request failed due to a lack of browser support for random number generation."),s.RANDOM_NUMBER_GENERATION_FAILURE))};function Ce(e,t,r){if(void 0===r&&(r={needsRotation:!1}),!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.createNewUser'.");return ye()?Ne()?function(e,t,r){return void 0===r&&(r=!1),G(e).flatMap((function(e){return g({type:"CREATE_USER",message:{passcode:t,jwtToken:e,needsRotation:r}})})).map((function(e){var t=e.message;return{accountID:t.id,segmentID:t.segmentId,needsRotation:t.needsRotation,status:t.status,userMasterPublicKey:t.userMasterPublicKey}})).toPromise()}(e,t,r.needsRotation||!1):Pe():Me()}function Fe(e,t){if(!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.createNewUser'.");return ye()?Ne()?function(e,t){return G(e).flatMap((function(e){return g({type:"CREATE_DETATCHED_USER_DEVICE",message:{passcode:t,jwtToken:e}})})).map((function(e){return e.message})).toPromise()}(e,t):Pe():Me()}function we(e,t){if(!e||"function"!=typeof e)throw new Error("You must provide a function which will generate a JWT as the first parameter to 'IronWeb.initialize'.");if(!t||"function"!=typeof t)throw new Error("You must provide a function which will generate the users escrow passcode as the second parameter to 'IronWeb.initialize'.");return ye()?Ne()?b(e,t):Pe():Me()}function ve(){try{return h(),!0}catch(e){return!1}}})(),n})()));
2
+ //# sourceMappingURL=ironweb.min.js.map