@formio/offline-plugin 5.0.0-rc.18
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.
- package/README.md +228 -0
- package/lib/FormioOfflinePlugin.d.ts +318 -0
- package/lib/embed.d.ts +3 -0
- package/lib/formio.embed.d.ts +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/licenseCheck/index.d.ts +2 -0
- package/lib/licenseCheck/licenseCheck.d.ts +2 -0
- package/lib/licenseCheck/licenseCheckMock.d.ts +2 -0
- package/offlinePlugin.js +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# @formio/offline-plugin
|
|
2
|
+
|
|
3
|
+
A formio.js plugin that provides an offline mode for a single project. Offline requests will automatically kick in when a request fails due to a network error and serve data cached offline, if available. You may also create/edit/delete submissions while offline, and the requests will be queued to be sent when the app goes back online.
|
|
4
|
+
|
|
5
|
+
## Browser support
|
|
6
|
+
|
|
7
|
+
The offline plugin uses IndexedDB to store records so the browser must support it to be able to use offline mode. In addition, files are stored as Blobs in IndexedDB but will fall back to Base64 storage if not supported.
|
|
8
|
+
|
|
9
|
+
### Browser Minimums:
|
|
10
|
+
|
|
11
|
+
Offline mode is using features supported in the following browsers and later:
|
|
12
|
+
|
|
13
|
+
- Chrome v38
|
|
14
|
+
- Safari 7.1
|
|
15
|
+
- IE 11
|
|
16
|
+
- Firefox 13
|
|
17
|
+
|
|
18
|
+
## Installing the plugin
|
|
19
|
+
Before you can use this plugin, you must first setup an account with the Form.io Enterprise Repository called https://pkg.form.io. This comes
|
|
20
|
+
with any Enterprise Account holder and allows you to use the premium components as well as this offline mode plugin. Once your Form.io Account
|
|
21
|
+
has been activated, you can navigate to https://pkg.form.io/-/web/detail/@formio/instructions to follow the instructions on how to initialize this
|
|
22
|
+
project with PKG. You will need to execute the following commands.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm adduser --registry https://pkg.form.io
|
|
26
|
+
npm install @formio/offline-plugin --registry https://pkg.form.io
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Using the offline mode module in your project
|
|
30
|
+
To use this module, you will use the same process described @ https://help.form.io/developers/modules#using-a-module but for this module. This will
|
|
31
|
+
look like the following in your application.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import { Formio } from '@formio/js';
|
|
35
|
+
import { OfflinePlugin } from '@formio/offline-plugin';
|
|
36
|
+
Formio.use(OfflinePlugin(
|
|
37
|
+
'myproject-offline', // The name of this offline instance.
|
|
38
|
+
'https://myproject.form.io', // Your project URL
|
|
39
|
+
'path/to/project.json' // OPTIONAL: the exported project.json file.
|
|
40
|
+
));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The arguments that you provide to the ```OfflinePlugin``` method are found below in the SDK section.
|
|
44
|
+
|
|
45
|
+
If you are using any of the Angular or React, wrappers, you may need to import the ```Formio``` instance from those modules instead as follows.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { Formio } from '@formio/angular';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Accessing the module
|
|
52
|
+
Once the module has been intialized, you can access the instance of this plugin anywhere in your application using the ```getPlugin``` API as follows.
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
const OfflinePlugin = Formio.getPlugin('myproject-offline');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Embedding
|
|
59
|
+
This plugin can be embedded within a website where it renders a form with offline mode enabled. This can be done with the following syntax.
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<script src="https://cdn.form.io/js/formio.form.min.js"></script>
|
|
63
|
+
<script src="https://yourdomain.com/assets/offline/formio.offline.min.js"></script>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Once you do this, the offline module will introduce a new global called ```FormioOfflinePlugin```, which you can now register the OfflinePlugin as you did above using the following script.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<script type="application/javascript">
|
|
70
|
+
Formio.use(FormioOfflinePlugin.OfflinePlugin('myproject-offline', 'https://myproject.form.io', 'path/to/project.json'));
|
|
71
|
+
</script>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You can now embed your form as you normally would and it will use the offline mode system.
|
|
75
|
+
|
|
76
|
+
#### Deployed Servers
|
|
77
|
+
Deployed installations may also need to provide baseUrl and projectUrl. These tell the renderer the Base URL as well as the project URL being used when embedding the offline script.
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<script type="application/javascript">
|
|
81
|
+
Formio.setBaseUrl('https://forms.yourdomain.com');
|
|
82
|
+
Formio.setProjectUrl('https://forms.yourdomain.com/yourproject');
|
|
83
|
+
Formio.use(FormioOfflinePlugin.OfflinePlugin('myproject-offline', 'https://forms.yourdomain.com/yourproject', 'path/to/project.json'));
|
|
84
|
+
</script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## SDK
|
|
88
|
+
|
|
89
|
+
### OfflinePlugin(name, projectUrl, [projectJsonPath], [options])
|
|
90
|
+
Factory method that returns a Form.io Module which contains a new instance of the FormioOfflinePlugin class, which controls the offline mode for this project.
|
|
91
|
+
|
|
92
|
+
- **name**: This is a name you come up with to contexualize your offline mode for this project.
|
|
93
|
+
- **projectUrl**: This is the URL of the project this offline mode plugin is attached to.
|
|
94
|
+
- **projectJson** (optional): Providing this will provide the default project.json of your project. You can get this by exporting your project. If you do not provide this, then your application will need to request the Form online before it will cache that form to be used offline. By providing the url to this file, the offline mode will use the offline form by default and not have to send a request to the api.
|
|
95
|
+
- **options** (optional): Optional configurations to control how the offline module plugin behaves. The following options are allowed.
|
|
96
|
+
- **dequeueOnReconnect** - Set to true if you wish for the plugin to automatically dequeue the saved offline submissions as soon as an internet connection has been made.
|
|
97
|
+
- **queryFiltersTypes** - Default query arguments to add to the search queries for the submission index for caching purposes.
|
|
98
|
+
- **notToShowDeletedOfflineSubmissions** - Set to true if you do not wish to show deleted offline submissions in the submission index.
|
|
99
|
+
- **deleteErrorSubmissions** - Set to true if you wish to automatically delete submission errors.
|
|
100
|
+
|
|
101
|
+
### new FormioOfflinePlugin(projectUrl, [projectJsonPath])
|
|
102
|
+
Creates a new offline module instance for a project.
|
|
103
|
+
|
|
104
|
+
- **projectUrl**: This is the URL of the project this offline mode plugin is attached to.
|
|
105
|
+
- **projectJson** (optional): Providing this will provide the default project.json of your project. You can get this by exporting your project. If you do not provide this, then your application will need to request the Form online before it will cache that form to be used offline. By providing the url to this file, the offline mode will use the offline form by default and not have to send a request to the api.
|
|
106
|
+
|
|
107
|
+
## Saving forms and submissions offline
|
|
108
|
+
Once you register a plugin for a particular project, all load requests for forms and submissions in that project will automatically save and update in an offline browser data store.
|
|
109
|
+
|
|
110
|
+
For example, you can have all submissions for a form available offline if you call `formio.loadSubmissions()` at some point in your app while online.
|
|
111
|
+
|
|
112
|
+
## Loading forms and submissions offline
|
|
113
|
+
When your app goes offline, requests to load a form or submission will automatically return the data cached offline, if available.
|
|
114
|
+
|
|
115
|
+
## Submitting forms offline
|
|
116
|
+
Form submissions work a little bit differently when this plugin is registered. All form submissions, submission edits, and submission deletions are added to a queue. If the app is online, the queue will be emptied immediately and behave like normal. But when the app is offline, the submissions stay in the queue until the app goes back online. Until then, Formio.js will behave as if the submission was successful.
|
|
117
|
+
|
|
118
|
+
The queue will automatically start to empty when a submission is successfully made online, or you may [manually start](#plugindequeuesubmissions) it.
|
|
119
|
+
|
|
120
|
+
## Deleting submissions offline
|
|
121
|
+
When you delete a submission offline, this won't be deleted from the local DB, it will be just marked as '_deleted'. The submission will be deleted from the local DB only in online, when the 'DELETE' request is sent. You can prevent showing deleted submissions in offline by setting the 'notToShowDeletedOfflineSubmissions' flag in the plugin's config to 'true'.
|
|
122
|
+
|
|
123
|
+
## Handling submission queue errors
|
|
124
|
+
Some queued submissions may fail when they are sent online (ex: unique validation fails on the server). In the event a queued submission fails, the queue is stopped and events are triggered to allow your app to resolve the bad submission before continuing. It's up to your app to decide how to handle these errors. Your app may decide to prompt the user to [fix the form submission](#pluginsetnextqueuedsubmissionrequest) or simply [ignore the submission](#pluginskipnextqueuedsubmission), and [restart the queue](#plugindequeuesubmissions).
|
|
125
|
+
|
|
126
|
+
## Plugin methods
|
|
127
|
+
|
|
128
|
+
### plugin.forceOffline(offline)
|
|
129
|
+
|
|
130
|
+
Forces all requests for this plugin's project into offline mode, even when a connection is available.
|
|
131
|
+
|
|
132
|
+
### plugin.isForcedOffline()
|
|
133
|
+
|
|
134
|
+
Returns true if this plugin is currently forced offline.
|
|
135
|
+
|
|
136
|
+
### plugin.clearOfflineData()
|
|
137
|
+
|
|
138
|
+
Clears all offline data. This includes offline cached forms and submissions, as well as submissions waiting in the offline queue.
|
|
139
|
+
|
|
140
|
+
### plugin.dequeueSubmissions()
|
|
141
|
+
|
|
142
|
+
Starts to process the submission queue. All requests in the offline submission queue will be sent in the order they were made. Successful requests will either resolve their original promise or trigger the [`offline.formSubmission`](#offlineformsubmission) event from `Formio.events`. A failed request will stop processing the queue and trigger the [`offline.formError`](#offlineformerror) event. The app must handle this event to resolve the failing requests and restart the queue.
|
|
143
|
+
|
|
144
|
+
### plugin.submissionQueueLength()
|
|
145
|
+
|
|
146
|
+
Returns the number of submission requests currently in the offline queue.
|
|
147
|
+
|
|
148
|
+
### plugin.getNextQueuedSubmission()
|
|
149
|
+
|
|
150
|
+
Returns the next request in the submission queue.
|
|
151
|
+
|
|
152
|
+
### plugin.setNextQueuedSubmission(request)
|
|
153
|
+
|
|
154
|
+
Sets the next request in the submission queue to `request`.
|
|
155
|
+
|
|
156
|
+
You can use this to fix a failed submission and then call [`dequeueSubmissions()`](#plugindequeuesubmissions) to resubmit and continue the queue.
|
|
157
|
+
|
|
158
|
+
### plugin.skipNextQueuedSubmission()
|
|
159
|
+
|
|
160
|
+
Discards the next request in the submission queue.
|
|
161
|
+
|
|
162
|
+
You can use this to ignore a failed submission and then call [`dequeueSubmissions()`](#plugindequeuesubmissions) to continue to the next queued request.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## Events
|
|
166
|
+
|
|
167
|
+
You can listen for these events by adding listeners to the `Formio.events` EventEmitter.
|
|
168
|
+
|
|
169
|
+
NOTE: if you are using the Angular ngFormio library, you can listen for these events in the Angular scope by adding `formio.` before each event name.
|
|
170
|
+
|
|
171
|
+
### offline.queue
|
|
172
|
+
|
|
173
|
+
Triggered when a submission is added to the submission queue.
|
|
174
|
+
|
|
175
|
+
### offline.dequeue
|
|
176
|
+
|
|
177
|
+
Triggered when the submission queue starts to process a submission.
|
|
178
|
+
|
|
179
|
+
### offline.requeue
|
|
180
|
+
|
|
181
|
+
Triggered when a submission fails and is added back to the front of the submission queue.
|
|
182
|
+
|
|
183
|
+
### offline.formSubmission
|
|
184
|
+
|
|
185
|
+
Triggered when a queued submission is successfully submitted. This is not called if the original promise of the request can be resolved (in which case it behaves like a normal online submission).
|
|
186
|
+
|
|
187
|
+
### offline.formError
|
|
188
|
+
|
|
189
|
+
Triggered when a queued submission returns an error. This means the app needs to either fix the submission or skip it, and restart the queue.
|
|
190
|
+
|
|
191
|
+
### offline.queueEmpty
|
|
192
|
+
|
|
193
|
+
Triggered when the queue becomes empty after dequeuing.
|
|
194
|
+
|
|
195
|
+
## Request Options
|
|
196
|
+
|
|
197
|
+
### skipQueue
|
|
198
|
+
|
|
199
|
+
You may set `skipQueue` to save a submission immediately, skipping the queue. This will disable offline queuing for that submission. For example:
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
formio.saveSubmission(submission, {skipQueue: true});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
If you are using the Angular ngFormio library, you can set the skipQueue option with formio-options:
|
|
206
|
+
|
|
207
|
+
```html
|
|
208
|
+
<formio src="userLoginForm" formio-options="{skipQueue: true}"></formio>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Build Commands
|
|
212
|
+
|
|
213
|
+
* `npm run build` - build for production
|
|
214
|
+
* `npm run watch` - automatically recompile during development
|
|
215
|
+
|
|
216
|
+
## FAQs
|
|
217
|
+
|
|
218
|
+
### Where is the form/submission data stored offline?
|
|
219
|
+
|
|
220
|
+
This plugin uses IndexedDB to store data.
|
|
221
|
+
|
|
222
|
+
### How can I tell if my requests were loaded from the offline cache?
|
|
223
|
+
|
|
224
|
+
Requests that return data stored offline will have the `offline` property set to true.
|
|
225
|
+
|
|
226
|
+
### Can I login while offline?
|
|
227
|
+
|
|
228
|
+
Unfortunately, authentication will not work in offline mode. It is highly recommended to use the [skipQueue](#skipqueue) option when submitting authentication forms.
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import 'whatwg-fetch';
|
|
2
|
+
import 'webcrypto-shim';
|
|
3
|
+
export declare class FormioOfflinePlugin {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
static _instance: any;
|
|
6
|
+
static Formio: any;
|
|
7
|
+
/**
|
|
8
|
+
* Factory to create a new offline plugin.
|
|
9
|
+
*
|
|
10
|
+
* @param name
|
|
11
|
+
* @param url
|
|
12
|
+
* @param project
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
static OfflinePlugin(name: string, url: string, project?: string, options?: any): {
|
|
16
|
+
fetch: {};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @param url The project url
|
|
20
|
+
* @param path Path to project.json with initial forms definition (optional)
|
|
21
|
+
* @return {[type]} [description]
|
|
22
|
+
*/
|
|
23
|
+
constructor(url: string, path?: string, options?: any);
|
|
24
|
+
static getInstance(url: any, path: any, options: any): any;
|
|
25
|
+
statusIndicator(element: any, passive: any): void;
|
|
26
|
+
connectionCheck(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Determine if this plugin is ready for use.
|
|
29
|
+
*
|
|
30
|
+
* @returns {Promise}
|
|
31
|
+
* A promise to resolve when the offline mode plugin is ready for external use.
|
|
32
|
+
*/
|
|
33
|
+
get ready(): any;
|
|
34
|
+
get isOnline(): any;
|
|
35
|
+
set isOnline(val: any);
|
|
36
|
+
/******************* Plugin Functions *******************/
|
|
37
|
+
/**
|
|
38
|
+
* Initialize the offline mode plugin. Called externally by Formiojs#registerPlugin();
|
|
39
|
+
*
|
|
40
|
+
* @param {Formio} Formio
|
|
41
|
+
* An instance of Formiojs.
|
|
42
|
+
*/
|
|
43
|
+
init(Formio: any): void;
|
|
44
|
+
preRequest(): any;
|
|
45
|
+
beforeRequest(middlware: any, options: any): void;
|
|
46
|
+
request(request: any): void | Promise<any>;
|
|
47
|
+
requestResponse(response: any, Formio: any, requestData: any): any;
|
|
48
|
+
staticRequest(): any;
|
|
49
|
+
fileRequest(request: any): any;
|
|
50
|
+
fromIdbToUri(fileName: any): any;
|
|
51
|
+
wrapRequestPromise(promise: any, { formio, type, url, method, opts, data }: {
|
|
52
|
+
formio: any;
|
|
53
|
+
type: any;
|
|
54
|
+
url: any;
|
|
55
|
+
method: any;
|
|
56
|
+
opts: any;
|
|
57
|
+
data: any;
|
|
58
|
+
}): any;
|
|
59
|
+
wrapStaticRequestPromise(promise: any, { url, method, opts }: {
|
|
60
|
+
url: any;
|
|
61
|
+
method: any;
|
|
62
|
+
opts: any;
|
|
63
|
+
}): any;
|
|
64
|
+
wrapFileRequestPromise(promise: any, request: any): any;
|
|
65
|
+
wrapFetchRequestPromise(promise: any, { url, method, opts, data }: {
|
|
66
|
+
url: any;
|
|
67
|
+
method: any;
|
|
68
|
+
opts: any;
|
|
69
|
+
data: any;
|
|
70
|
+
}): any;
|
|
71
|
+
/******************* Public Functions *******************/
|
|
72
|
+
/**
|
|
73
|
+
* Set the forcedOffline property, used for simulating no network access.
|
|
74
|
+
*
|
|
75
|
+
* @param {Boolean} offline
|
|
76
|
+
* The desired offline state to set.
|
|
77
|
+
*/
|
|
78
|
+
forceOffline(offline: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* Determine if the plugin is being forced to simulate offline access or not.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Boolean}
|
|
83
|
+
* Whether or not the plugin is in forced offline mode.
|
|
84
|
+
*/
|
|
85
|
+
isForcedOffline(): boolean;
|
|
86
|
+
_executeHooks(req: any): Promise<void>;
|
|
87
|
+
_processHookResult(res: any): void;
|
|
88
|
+
/**
|
|
89
|
+
* Returns the index of the item in the submission queue.
|
|
90
|
+
*
|
|
91
|
+
* @param submission
|
|
92
|
+
* @return {number}
|
|
93
|
+
*/
|
|
94
|
+
getSubmissionQueueIndex(submission: any): number;
|
|
95
|
+
/**
|
|
96
|
+
* Get the length of the current submission queue.
|
|
97
|
+
*
|
|
98
|
+
* @returns {Number}
|
|
99
|
+
* The length of the submission queue.
|
|
100
|
+
*/
|
|
101
|
+
submissionQueueLength(): any;
|
|
102
|
+
/**
|
|
103
|
+
* Returns an item in the submission queue.
|
|
104
|
+
*
|
|
105
|
+
* @param form
|
|
106
|
+
* @param _id
|
|
107
|
+
* @return {null}
|
|
108
|
+
*/
|
|
109
|
+
getSubmissionQueueSubmission(form: any, _id: any): any;
|
|
110
|
+
/**
|
|
111
|
+
* Empty the submission queue.
|
|
112
|
+
*
|
|
113
|
+
* @return {Promise}
|
|
114
|
+
*/
|
|
115
|
+
emptySubmissionQueue(): any;
|
|
116
|
+
/**
|
|
117
|
+
* Removes an item in the submission queue.
|
|
118
|
+
*
|
|
119
|
+
* @param submission
|
|
120
|
+
* @return {*}
|
|
121
|
+
*/
|
|
122
|
+
removeSubmissionQueueSubmission(submission: any): any;
|
|
123
|
+
/**
|
|
124
|
+
* Updates an item in the submission queue.
|
|
125
|
+
*
|
|
126
|
+
* @param submission
|
|
127
|
+
* @return {*}
|
|
128
|
+
*/
|
|
129
|
+
updateSubmissionQueueSubmission(submission: any): any;
|
|
130
|
+
/**
|
|
131
|
+
* Get the next request in the submission queue.
|
|
132
|
+
*
|
|
133
|
+
* @returns {Object}
|
|
134
|
+
* The first request in the queue, or undefined if the current queue is empty.
|
|
135
|
+
*/
|
|
136
|
+
getNextQueuedSubmission(): any;
|
|
137
|
+
/**
|
|
138
|
+
* Modify the first request in the submission queue and persist the queue changes.
|
|
139
|
+
*
|
|
140
|
+
* @param {Object} request
|
|
141
|
+
* The request to persist for the first element in the submission queue.
|
|
142
|
+
*
|
|
143
|
+
* @returns {Promise}
|
|
144
|
+
* A promise for when the operation is complete.
|
|
145
|
+
*/
|
|
146
|
+
setNextQueuedSubmission(request: any): any;
|
|
147
|
+
/**
|
|
148
|
+
* Skip the next request in the queue and persist the queue changes.
|
|
149
|
+
*
|
|
150
|
+
* @returns {Promise}
|
|
151
|
+
* A promise for when the operation is complete.
|
|
152
|
+
*/
|
|
153
|
+
skipNextQueuedSubmission(): any;
|
|
154
|
+
clearOfflineSubmissions(): any;
|
|
155
|
+
/**
|
|
156
|
+
* Clear all offline mode data.
|
|
157
|
+
*
|
|
158
|
+
* @returns {Promise}
|
|
159
|
+
* Thenable once db has been cleared.
|
|
160
|
+
*/
|
|
161
|
+
clearOfflineData(): any;
|
|
162
|
+
sendRequest(request: any): any;
|
|
163
|
+
dequeueSubmissions(skipError?: boolean, fromIndex?: number, forceDequeue?: boolean, predicate?: any): any;
|
|
164
|
+
/**
|
|
165
|
+
* Public wrapper around db.setItem
|
|
166
|
+
*
|
|
167
|
+
* @param storage
|
|
168
|
+
* @param key
|
|
169
|
+
* @param value
|
|
170
|
+
* @returns {*}
|
|
171
|
+
*/
|
|
172
|
+
setItem(storage: any, key: any, value: any): any;
|
|
173
|
+
/**
|
|
174
|
+
* Public wrapper around db.setItems
|
|
175
|
+
*
|
|
176
|
+
* @param storage
|
|
177
|
+
* @param key
|
|
178
|
+
* @param value
|
|
179
|
+
* @returns {*}
|
|
180
|
+
*/
|
|
181
|
+
setItems(storage: any, items: any, prefix: any): any;
|
|
182
|
+
/**
|
|
183
|
+
* Public wrapper around db.getItem
|
|
184
|
+
*
|
|
185
|
+
* @param storage
|
|
186
|
+
* @param key
|
|
187
|
+
* @returns {*}
|
|
188
|
+
*/
|
|
189
|
+
getItem(storage: any, key: any): any;
|
|
190
|
+
clearAll(): any;
|
|
191
|
+
/******************* Internal Functions *******************/
|
|
192
|
+
_throwOfflineError(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Saves the submissionQueue to db
|
|
195
|
+
* @return Promise for the save operation.
|
|
196
|
+
*/
|
|
197
|
+
_saveQueue(): any;
|
|
198
|
+
/**
|
|
199
|
+
* Removes duplicate forms from offline cached project.
|
|
200
|
+
* Duplicates can occur if form is renamed (old and new
|
|
201
|
+
* stored under different names but have same id/path).
|
|
202
|
+
* NOTE: modifies the given object
|
|
203
|
+
*
|
|
204
|
+
* @param projectCache Project cache object
|
|
205
|
+
*/
|
|
206
|
+
_removeCacheDuplicates(projectCache: any): void;
|
|
207
|
+
/**
|
|
208
|
+
* @param formPath Path to form
|
|
209
|
+
* @return true if form is part of a project that has been cached offline
|
|
210
|
+
*/
|
|
211
|
+
_isFormOffline(formPath: any): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Returns an object with form _id and path
|
|
214
|
+
* @param formId The form's _id or path
|
|
215
|
+
* @return An object with both the formId and formPath
|
|
216
|
+
*/
|
|
217
|
+
_resolveFormId(formId: any): {
|
|
218
|
+
_id: any;
|
|
219
|
+
path: any;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Find a form in the offline project by path
|
|
223
|
+
*/
|
|
224
|
+
_getFormByPath(pathOrId: any): any;
|
|
225
|
+
/**
|
|
226
|
+
* Finds all files stored in offline mode, syncs them up and replaces the files with online versions.
|
|
227
|
+
* @param form The form name
|
|
228
|
+
* @param form The form url
|
|
229
|
+
* @param submission The submission object
|
|
230
|
+
* @return Promise when complete
|
|
231
|
+
*/
|
|
232
|
+
_resolveFiles(formPath: any, formUrl: any, submission: any): any;
|
|
233
|
+
/**
|
|
234
|
+
* Save a submission to retrieve in GET requests while offline.
|
|
235
|
+
* @param formId ID or path of submission's form
|
|
236
|
+
* @param submission Submission to save
|
|
237
|
+
* @return Promise for the save operation
|
|
238
|
+
*/
|
|
239
|
+
_saveOfflineSubmission(formId: any, submission: any): any;
|
|
240
|
+
/**
|
|
241
|
+
* Attempts to find and return an offline cached submission.
|
|
242
|
+
* @param formId The _id or path of the submission's form
|
|
243
|
+
* @param submissionId The _id of the submission
|
|
244
|
+
* @param ignoreQueuedRequest Optional queuedRequest that you want to ignore
|
|
245
|
+
* @return Submission if available offline, otherwise null
|
|
246
|
+
*/
|
|
247
|
+
_getOfflineSubmission(formId: any, submissionId: any, ignoreQueuedRequest?: any): any;
|
|
248
|
+
/**
|
|
249
|
+
* Deletes a submission from the offline data
|
|
250
|
+
* @param formId _id or path of submission's form
|
|
251
|
+
* @param submissionId _id of the submission
|
|
252
|
+
* @return Promise of delete operation
|
|
253
|
+
*/
|
|
254
|
+
_deleteOfflineSubmission(formId: any, submissionId: any, isOnline?: boolean): any;
|
|
255
|
+
/**
|
|
256
|
+
* A unique filter to be used with Array.prototype.filter
|
|
257
|
+
*/
|
|
258
|
+
_uniqueFilter(value: any, index: any, self: any): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Save authentication info internally until it confirmed by emitting 'formio.user' event
|
|
261
|
+
* @param authInfo: {
|
|
262
|
+
* email,
|
|
263
|
+
* passwordHash,
|
|
264
|
+
* ecodedToken,
|
|
265
|
+
* response,
|
|
266
|
+
* }
|
|
267
|
+
* @private
|
|
268
|
+
*/
|
|
269
|
+
_setUserAuthInfo(authInfo: any): void;
|
|
270
|
+
/**
|
|
271
|
+
* Confirm internally saved auth info and save user o the local DB
|
|
272
|
+
* @param user
|
|
273
|
+
* @private
|
|
274
|
+
*/
|
|
275
|
+
_saveUser(user: any): void;
|
|
276
|
+
_hashData(data: any, salt: any, algo: any): Promise<ArrayBuffer>;
|
|
277
|
+
_encodeData(data: any, key: any): any;
|
|
278
|
+
_decodeData(encoded: any, key: any): any;
|
|
279
|
+
/**
|
|
280
|
+
* Fing and load saved user from the local DB
|
|
281
|
+
* @param email
|
|
282
|
+
* @param url
|
|
283
|
+
* @returns {*|PromiseLike<any>|Promise<any>}
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
_getSavedUser({ email }: {
|
|
287
|
+
email: any;
|
|
288
|
+
}, url: any): any;
|
|
289
|
+
/**
|
|
290
|
+
* Get hex string from the hash ArrayBuffer
|
|
291
|
+
* @param hashBuffer
|
|
292
|
+
* @returns {string}
|
|
293
|
+
* @private
|
|
294
|
+
*/
|
|
295
|
+
_digestToHex(hashBuffer: any): string;
|
|
296
|
+
/**
|
|
297
|
+
* Compare password from offline auth request with it's hashed version from the local DB
|
|
298
|
+
* @param email
|
|
299
|
+
* @param password
|
|
300
|
+
* @param authInfo
|
|
301
|
+
* @returns {PromiseLike<boolean>}
|
|
302
|
+
* @private
|
|
303
|
+
*/
|
|
304
|
+
_checkPassword(email: any, password: any, authInfo: any): Promise<boolean>;
|
|
305
|
+
_authenticateOffline(requestData: any, url: any): any;
|
|
306
|
+
_mapHeaders(fakeResponse: any, response: any): void;
|
|
307
|
+
_shouldSkipQueue({ formio, type, url, method, data, opts }: {
|
|
308
|
+
formio: any;
|
|
309
|
+
type: any;
|
|
310
|
+
url: any;
|
|
311
|
+
method: any;
|
|
312
|
+
data: any;
|
|
313
|
+
opts: any;
|
|
314
|
+
}): any;
|
|
315
|
+
_ping(isUp: any, isDown: any): void;
|
|
316
|
+
static _isAuthResponse(requestData: any, response: any): boolean;
|
|
317
|
+
static _getRequestData(requestData: any): any;
|
|
318
|
+
}
|
package/lib/embed.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.d.ts
ADDED
package/offlinePlugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(_0x35a4cd,_0x3d0f47){'object'==typeof exports&&'object'==typeof module?module['exports']=_0x3d0f47():'function'==typeof define&&define['amd']?define([],_0x3d0f47):'object'==typeof exports?exports['offlinePlugin']=_0x3d0f47():_0x35a4cd['offlinePlugin']=_0x3d0f47();}(self,function(){return(function(){'use strict';var _0x3d2583={0xf4:function(_0x1a6db4,_0x20808c,_0x296ad2){var _0x488659=this&&this['__awaiter']||function(_0x2f7bb8,_0x4402a5,_0x2d7462,_0x5335e6){return new(_0x2d7462||(_0x2d7462=Promise))(function(_0x227f55,_0x21761c){function _0x57ca84(_0x4344ce){try{_0x9ad551(_0x5335e6['next'](_0x4344ce));}catch(_0xf681fc){_0x21761c(_0xf681fc);}}function _0x4e0300(_0x25e2fe){try{_0x9ad551(_0x5335e6['throw'](_0x25e2fe));}catch(_0x1d8384){_0x21761c(_0x1d8384);}}function _0x9ad551(_0x20785a){var _0x100acf;_0x20785a['done']?_0x227f55(_0x20785a['value']):(_0x100acf=_0x20785a['value'],_0x100acf instanceof _0x2d7462?_0x100acf:new _0x2d7462(function(_0x41e762){_0x41e762(_0x100acf);}))['then'](_0x57ca84,_0x4e0300);}_0x9ad551((_0x5335e6=_0x5335e6['apply'](_0x2f7bb8,_0x4402a5||[]))['next']());});};Object['defineProperty'](_0x20808c,'__esModule',{'value':!0x0}),_0x20808c['OfflineLibraryLicense']=void 0x0;const {CompactSign:_0x2c26ff,importPKCS8:_0x422f93,compactVerify:_0x15726e,importSPKI:_0x3aac2f}=_0x296ad2(0x265),{capitalize:_0x1c1df0}=_0x296ad2(0x339),_0x2fc1c6=_0x296ad2(0x24d);class _0x312657 extends Error{constructor(_0x347ab2){super(_0x347ab2?_0x312657['errorMessagePrefix']+'\x0a'+_0x347ab2:_0x312657['errorMessagePrefix']+'\x0aUnexpected\x20error\x20occurred.');}}_0x312657['errorMessagePrefix']='Library\x20License\x20check\x20error:',_0x20808c['OfflineLibraryLicense']=class{constructor(_0x548304,_0x107cc6){this['libraryName']=_0x548304,this['injectedPublicKey']=_0x107cc6,this['publicKey']='-----BEGIN\x20PUBLIC\x20KEY-----\x0aMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA18xeGY0UiaVCjhkJeb68\x0aIHs/MkytZSeZwL75gySrVnVF6VI36CrEZe1hSZwXgufGVSLm2+Ec3KXeLLNtGFYP\x0aHzx66kPl6jRc1/7RnZdEQYeANDNg/BhlG+54Eu4dczp17agImfehsAyEIctvlL63\x0ayRAGqnoBWt1Khxfa5ocqtbZaep+3PI9yTgbyiYw/9rBYI5U8NiTPti9xt/jw/phe\x0aborJ64CeCQB/ipCFYgRj+WlnskDkL1/0TMi+4Hsu4eZSTZP7Mx6+qmjAGF9ahQmL\x0aIR7SEwFmVZK8aBe4knBKkL9IjOFl60Pjx4LoLvbpjIKCoM91pz2lMOoMHJIxhhwp\x0akQIDAQAB\x0a-----END\x20PUBLIC\x20KEY-----\x0a';}['isAllowedUrl'](_0x218886=[],_0x5b2417){return _0x218886['some'](_0x41436f=>new RegExp('^'+_0x41436f['split']('*')['join']('(\x5cS+)')+'$','i')['test'](_0x5b2417));}['checkTerms'](){var _0x4daaa2,_0x405afd;if(this['libraryName']&&!(null===(_0x405afd=null===(_0x4daaa2=this['parsedLicenseKey'])||void 0x0===_0x4daaa2?void 0x0:_0x4daaa2['terms'])||void 0x0===_0x405afd?void 0x0:_0x405afd[this['libraryName']]))throw new _0x312657(_0x1c1df0(this['libraryName'])+'\x20is\x20disabled\x20in\x20your\x20license.');}['checkExpiration'](){const {exp:_0x2eebc4}=this['parsedLicenseKey'];if(!_0x2eebc4)return;let _0x362768=!0x1;const _0x164b93=Date['now']()/0x3e8;switch(typeof _0x2eebc4){case'string':_0x362768=_0x2fc1c6['dateStringToMilliseconds'](_0x2eebc4)<_0x164b93;break;case'number':case'object':_0x362768=_0x2eebc4<_0x164b93;break;default:throw new _0x312657('Invalid\x20expiration\x20date\x20provided.');}if(_0x362768)throw new _0x312657('License\x20is\x20expired.');}['checkAllowedHostnames'](){const {hostnames:_0x44c795}=this['parsedLicenseKey']['terms'],_0x3ae308=window['location']['protocol']+'//'+window['location']['hostname'];if(!this['isAllowedUrl'](_0x44c795,_0x3ae308))throw new _0x312657('Current\x20hostname\x20('+_0x3ae308+')\x20is\x20not\x20allowed.');}['checkAllowedEndpoints'](_0x392e61,_0x1bfc1e){return _0x488659(this,void 0x0,void 0x0,function*(){if(!this['parsedLicenseKey']){if(!_0x1bfc1e)throw new _0x312657('License\x20Key\x20should\x20be\x20provided\x20to\x20verify\x20allowed\x20endpoints.');yield this['parseKey'](_0x1bfc1e);}const {endpoints:_0x188ee7}=this['parsedLicenseKey']['terms'];if(!this['isAllowedUrl'](_0x188ee7,_0x392e61))throw new _0x312657('Current\x20endpoint\x20('+_0x392e61+')\x20is\x20not\x20allowed.');});}['parseKey'](_0x2b607d){return _0x488659(this,void 0x0,void 0x0,function*(){try{const {payload:_0x377696}=yield _0x15726e(_0x2b607d,yield _0x3aac2f(this['injectedPublicKey']||this['publicKey'],'PS256'));this['parsedLicenseKey']=JSON['parse'](new TextDecoder('utf-8')['decode'](_0x377696));}catch(_0x525fc2){throw console['error']('Error\x20parsing\x20Library\x20License\x20key:\x20'+_0x525fc2['message']),new _0x312657('Invalid\x20key\x20provided.');}});}['verify'](_0x21a731){return _0x488659(this,void 0x0,void 0x0,function*(){if(!_0x21a731)throw new _0x312657('License\x20key\x20not\x20provided.');try{yield this['parseKey'](_0x21a731),this['checkTerms'](),this['checkExpiration'](),this['checkAllowedHostnames']();}catch(_0x49c876){throw _0x49c876 instanceof _0x312657?_0x49c876:(console['error']('Unexpected\x20Library\x20License\x20verify\x20error:\x20'+_0x49c876['message']),new _0x312657());}});}['generate'](_0x54aa70,_0x2eefc7){return _0x488659(this,void 0x0,void 0x0,function*(){const _0x5285df=yield _0x422f93(_0x2eefc7,'PS256');return yield new _0x2c26ff(new TextEncoder()['encode'](JSON['stringify'](_0x54aa70)))['setProtectedHeader']({'alg':'PS256'})['sign'](_0x5285df);});}};},0x24d:function(_0x45bb64,_0x51c28c){Object['defineProperty'](_0x51c28c,'__esModule',{'value':!0x0});const _0x26cf2b={'isValidDate':function(_0x4dfb4d){return!Number['isNaN'](Date['parse'](_0x4dfb4d));},'dateStringToMilliseconds':function(_0x1bc54c){if(!this['isValidDate'](_0x1bc54c))throw new Error('Provided\x20invalid\x20date\x20string.');return new Date(_0x1bc54c)['getTime']();}};_0x45bb64['exports']=_0x26cf2b;},0x339:function(_0x2c95ae){_0x2c95ae['exports']=require('lodash');},0x2d:function(_0x56b082){_0x56b082['exports']=require('querystring');},0x265:function(_0x45167f,_0x5788a6,_0x5e99e0){_0x5e99e0['r'](_0x5788a6),_0x5e99e0['d'](_0x5788a6,{'CompactEncrypt':function(){return _0x56f3b7;},'CompactSign':function(){return _0x24afe3;},'EmbeddedJWK':function(){return _0x191649;},'EncryptJWT':function(){return _0x406eaa;},'FlattenedEncrypt':function(){return _0x24b5fc;},'FlattenedSign':function(){return _0x53f870;},'GeneralEncrypt':function(){return _0x15e0d2;},'GeneralSign':function(){return _0x4ff54a;},'SignJWT':function(){return _0x4d762b;},'UnsecuredJWT':function(){return _0x1918c2;},'base64url':function(){return _0x279efe;},'calculateJwkThumbprint':function(){return _0x4a3439;},'calculateJwkThumbprintUri':function(){return _0x1eee3e;},'compactDecrypt':function(){return _0x238b13;},'compactVerify':function(){return _0x48b602;},'createLocalJWKSet':function(){return _0x410b54;},'createRemoteJWKSet':function(){return _0x32dab6;},'cryptoRuntime':function(){return _0x24455a;},'decodeJwt':function(){return _0x180203;},'decodeProtectedHeader':function(){return _0x25a8b2;},'errors':function(){return _0x5e774d;},'exportJWK':function(){return _0x510a24;},'exportPKCS8':function(){return _0x444dc3;},'exportSPKI':function(){return _0x528fb2;},'flattenedDecrypt':function(){return _0x3e2b24;},'flattenedVerify':function(){return _0x5679fa;},'generalDecrypt':function(){return _0xff1779;},'generalVerify':function(){return _0x3df2c6;},'generateKeyPair':function(){return _0x2a3ab6;},'generateSecret':function(){return _0x145a51;},'importJWK':function(){return _0x28f7a6;},'importPKCS8':function(){return _0x1b5562;},'importSPKI':function(){return _0x57144f;},'importX509':function(){return _0x17823f;},'jwtDecrypt':function(){return _0x3c0b0c;},'jwtVerify':function(){return _0x24d544;}});var _0x5e774d={};_0x5e99e0['r'](_0x5e774d),_0x5e99e0['d'](_0x5e774d,{'JOSEAlgNotAllowed':function(){return _0x14032b;},'JOSEError':function(){return _0x122966;},'JOSENotSupported':function(){return _0x43357e;},'JWEDecompressionFailed':function(){return _0x4efe54;},'JWEDecryptionFailed':function(){return _0x48eb1d;},'JWEInvalid':function(){return _0x20a9c5;},'JWKInvalid':function(){return _0x3bf453;},'JWKSInvalid':function(){return _0x31c0ee;},'JWKSMultipleMatchingKeys':function(){return _0x14a3bc;},'JWKSNoMatchingKey':function(){return _0x49f0c5;},'JWKSTimeout':function(){return _0x20586e;},'JWSInvalid':function(){return _0x43db8a;},'JWSSignatureVerificationFailed':function(){return _0x16e931;},'JWTClaimValidationFailed':function(){return _0x233f4f;},'JWTExpired':function(){return _0x49149a;},'JWTInvalid':function(){return _0x4c6a3d;}});var _0x279efe={};_0x5e99e0['r'](_0x279efe),_0x5e99e0['d'](_0x279efe,{'decode':function(){return _0x397e43;},'encode':function(){return _0x32ed3b;}});var _0x298964=crypto;const _0x1b49a2=_0x42881f=>_0x42881f instanceof CryptoKey;var _0x3015b8=async(_0x167504,_0x2144ee)=>{const _0x3f11b7='SHA-'+_0x167504['slice'](-0x3);return new Uint8Array(await _0x298964['subtle']['digest'](_0x3f11b7,_0x2144ee));};const _0x2ffac3=new TextEncoder(),_0x181173=new TextDecoder(),_0x4ebb1f=0x2**0x20;function _0x1896d1(..._0x2e49d1){const _0x20d4ae=_0x2e49d1['reduce']((_0x4da7c0,{length:_0x14c170})=>_0x4da7c0+_0x14c170,0x0),_0x132a22=new Uint8Array(_0x20d4ae);let _0x320845=0x0;return _0x2e49d1['forEach'](_0x1d9895=>{_0x132a22['set'](_0x1d9895,_0x320845),_0x320845+=_0x1d9895['length'];}),_0x132a22;}function _0x20edfe(_0x502365,_0x599641,_0x1d35e4){if(_0x599641<0x0||_0x599641>=_0x4ebb1f)throw new RangeError('value\x20must\x20be\x20>=\x200\x20and\x20<=\x20'+(_0x4ebb1f-0x1)+'.\x20Received\x20'+_0x599641);_0x502365['set']([_0x599641>>>0x18,_0x599641>>>0x10,_0x599641>>>0x8,0xff&_0x599641],_0x1d35e4);}function _0x476dc0(_0x566b04){const _0x1f5338=Math['floor'](_0x566b04/_0x4ebb1f),_0x396bcc=_0x566b04%_0x4ebb1f,_0x53b1b0=new Uint8Array(0x8);return _0x20edfe(_0x53b1b0,_0x1f5338,0x0),_0x20edfe(_0x53b1b0,_0x396bcc,0x4),_0x53b1b0;}function _0x5d393c(_0x405885){const _0x5da2a9=new Uint8Array(0x4);return _0x20edfe(_0x5da2a9,_0x405885),_0x5da2a9;}function _0x442903(_0x5438b5){return _0x1896d1(_0x5d393c(_0x5438b5['length']),_0x5438b5);}const _0x2ef2e1=_0xd2b39a=>{let _0x1c7bc6=_0xd2b39a;'string'==typeof _0x1c7bc6&&(_0x1c7bc6=_0x2ffac3['encode'](_0x1c7bc6));const _0x3b3eca=[];for(let _0x20207d=0x0;_0x20207d<_0x1c7bc6['length'];_0x20207d+=0x8000)_0x3b3eca['push'](String['fromCharCode']['apply'](null,_0x1c7bc6['subarray'](_0x20207d,_0x20207d+0x8000)));return btoa(_0x3b3eca['join'](''));},_0x40aa3c=_0x1463ab=>_0x2ef2e1(_0x1463ab)['replace'](/=/g,'')['replace'](/\+/g,'-')['replace'](/\//g,'_'),_0x1cfcce=_0x1a9fd3=>{const _0x2b0bf8=atob(_0x1a9fd3),_0x64c167=new Uint8Array(_0x2b0bf8['length']);for(let _0x2d1678=0x0;_0x2d1678<_0x2b0bf8['length'];_0x2d1678++)_0x64c167[_0x2d1678]=_0x2b0bf8['charCodeAt'](_0x2d1678);return _0x64c167;},_0x14a576=_0x401359=>{let _0x45a0eb=_0x401359;_0x45a0eb instanceof Uint8Array&&(_0x45a0eb=_0x181173['decode'](_0x45a0eb)),_0x45a0eb=_0x45a0eb['replace'](/-/g,'+')['replace'](/_/g,'/')['replace'](/\s/g,'');try{return _0x1cfcce(_0x45a0eb);}catch(_0x212fde){throw new TypeError('The\x20input\x20to\x20be\x20decoded\x20is\x20not\x20correctly\x20encoded.');}};class _0x122966 extends Error{static get['code'](){return'ERR_JOSE_GENERIC';}constructor(_0x1599fd){var _0x3dd9cb;super(_0x1599fd),this['code']='ERR_JOSE_GENERIC',this['name']=this['constructor']['name'],null===(_0x3dd9cb=Error['captureStackTrace'])||void 0x0===_0x3dd9cb||_0x3dd9cb['call'](Error,this,this['constructor']);}}class _0x233f4f extends _0x122966{static get['code'](){return'ERR_JWT_CLAIM_VALIDATION_FAILED';}constructor(_0x5a537e,_0x3d673f='unspecified',_0x5ab267='unspecified'){super(_0x5a537e),this['code']='ERR_JWT_CLAIM_VALIDATION_FAILED',this['claim']=_0x3d673f,this['reason']=_0x5ab267;}}class _0x49149a extends _0x122966{static get['code'](){return'ERR_JWT_EXPIRED';}constructor(_0x401729,_0x5ce2fa='unspecified',_0x623047='unspecified'){super(_0x401729),this['code']='ERR_JWT_EXPIRED',this['claim']=_0x5ce2fa,this['reason']=_0x623047;}}class _0x14032b extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JOSE_ALG_NOT_ALLOWED';}static get['code'](){return'ERR_JOSE_ALG_NOT_ALLOWED';}}class _0x43357e extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JOSE_NOT_SUPPORTED';}static get['code'](){return'ERR_JOSE_NOT_SUPPORTED';}}class _0x48eb1d extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWE_DECRYPTION_FAILED',this['message']='decryption\x20operation\x20failed';}static get['code'](){return'ERR_JWE_DECRYPTION_FAILED';}}class _0x4efe54 extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWE_DECOMPRESSION_FAILED',this['message']='decompression\x20operation\x20failed';}static get['code'](){return'ERR_JWE_DECOMPRESSION_FAILED';}}class _0x20a9c5 extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWE_INVALID';}static get['code'](){return'ERR_JWE_INVALID';}}class _0x43db8a extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWS_INVALID';}static get['code'](){return'ERR_JWS_INVALID';}}class _0x4c6a3d extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWT_INVALID';}static get['code'](){return'ERR_JWT_INVALID';}}class _0x3bf453 extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWK_INVALID';}static get['code'](){return'ERR_JWK_INVALID';}}class _0x31c0ee extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWKS_INVALID';}static get['code'](){return'ERR_JWKS_INVALID';}}class _0x49f0c5 extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWKS_NO_MATCHING_KEY',this['message']='no\x20applicable\x20key\x20found\x20in\x20the\x20JSON\x20Web\x20Key\x20Set';}static get['code'](){return'ERR_JWKS_NO_MATCHING_KEY';}}class _0x14a3bc extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWKS_MULTIPLE_MATCHING_KEYS',this['message']='multiple\x20matching\x20keys\x20found\x20in\x20the\x20JSON\x20Web\x20Key\x20Set';}static get['code'](){return'ERR_JWKS_MULTIPLE_MATCHING_KEYS';}}Symbol['asyncIterator'];class _0x20586e extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWKS_TIMEOUT',this['message']='request\x20timed\x20out';}static get['code'](){return'ERR_JWKS_TIMEOUT';}}class _0x16e931 extends _0x122966{constructor(){super(...arguments),this['code']='ERR_JWS_SIGNATURE_VERIFICATION_FAILED',this['message']='signature\x20verification\x20failed';}static get['code'](){return'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';}}var _0xc75a16=_0x298964['getRandomValues']['bind'](_0x298964);function _0x280be7(_0x2fbff1){switch(_0x2fbff1){case'A128GCM':case'A128GCMKW':case'A192GCM':case'A192GCMKW':case'A256GCM':case'A256GCMKW':return 0x60;case'A128CBC-HS256':case'A192CBC-HS384':case'A256CBC-HS512':return 0x80;default:throw new _0x43357e('Unsupported\x20JWE\x20Algorithm:\x20'+_0x2fbff1);}}var _0x484091=_0x277abd=>_0xc75a16(new Uint8Array(_0x280be7(_0x277abd)>>0x3)),_0x4889ec=(_0x7b4ebf,_0xa3033)=>{if(_0xa3033['length']<<0x3!==_0x280be7(_0x7b4ebf))throw new _0x20a9c5('Invalid\x20Initialization\x20Vector\x20length');},_0x53e3eb=(_0x5b500a,_0x2fab72)=>{const _0x58dbff=_0x5b500a['byteLength']<<0x3;if(_0x58dbff!==_0x2fab72)throw new _0x20a9c5('Invalid\x20Content\x20Encryption\x20Key\x20length.\x20Expected\x20'+_0x2fab72+'\x20bits,\x20got\x20'+_0x58dbff+'\x20bits');};function _0x33917b(_0x48a6c5,_0x2b3360='algorithm.name'){return new TypeError('CryptoKey\x20does\x20not\x20support\x20this\x20operation,\x20its\x20'+_0x2b3360+'\x20must\x20be\x20'+_0x48a6c5);}function _0x595915(_0x7b689e,_0x5515d9){return _0x7b689e['name']===_0x5515d9;}function _0x2cbeff(_0x585aed){return parseInt(_0x585aed['name']['slice'](0x4),0xa);}function _0x7fa827(_0x5bba2b,_0x2d5ccd){if(_0x2d5ccd['length']&&!_0x2d5ccd['some'](_0x351e7d=>_0x5bba2b['usages']['includes'](_0x351e7d))){let _0x339d38='CryptoKey\x20does\x20not\x20support\x20this\x20operation,\x20its\x20usages\x20must\x20include\x20';if(_0x2d5ccd['length']>0x2){const _0x41e9d0=_0x2d5ccd['pop']();_0x339d38+='one\x20of\x20'+_0x2d5ccd['join'](',\x20')+',\x20or\x20'+_0x41e9d0+'.';}else 0x2===_0x2d5ccd['length']?_0x339d38+='one\x20of\x20'+_0x2d5ccd[0x0]+'\x20or\x20'+_0x2d5ccd[0x1]+'.':_0x339d38+=_0x2d5ccd[0x0]+'.';throw new TypeError(_0x339d38);}}function _0x3e811d(_0x31f195,_0x32afa9,..._0x527a8f){switch(_0x32afa9){case'A128GCM':case'A192GCM':case'A256GCM':{if(!_0x595915(_0x31f195['algorithm'],'AES-GCM'))throw _0x33917b('AES-GCM');const _0x50a8fd=parseInt(_0x32afa9['slice'](0x1,0x4),0xa);if(_0x31f195['algorithm']['length']!==_0x50a8fd)throw _0x33917b(_0x50a8fd,'algorithm.length');break;}case'A128KW':case'A192KW':case'A256KW':{if(!_0x595915(_0x31f195['algorithm'],'AES-KW'))throw _0x33917b('AES-KW');const _0x52f264=parseInt(_0x32afa9['slice'](0x1,0x4),0xa);if(_0x31f195['algorithm']['length']!==_0x52f264)throw _0x33917b(_0x52f264,'algorithm.length');break;}case'ECDH':switch(_0x31f195['algorithm']['name']){case'ECDH':case'X25519':case'X448':break;default:throw _0x33917b('ECDH,\x20X25519,\x20or\x20X448');}break;case'PBES2-HS256+A128KW':case'PBES2-HS384+A192KW':case'PBES2-HS512+A256KW':if(!_0x595915(_0x31f195['algorithm'],'PBKDF2'))throw _0x33917b('PBKDF2');break;case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':{if(!_0x595915(_0x31f195['algorithm'],'RSA-OAEP'))throw _0x33917b('RSA-OAEP');const _0x400858=parseInt(_0x32afa9['slice'](0x9),0xa)||0x1;if(_0x2cbeff(_0x31f195['algorithm']['hash'])!==_0x400858)throw _0x33917b('SHA-'+_0x400858,'algorithm.hash');break;}default:throw new TypeError('CryptoKey\x20does\x20not\x20support\x20this\x20operation');}_0x7fa827(_0x31f195,_0x527a8f);}function _0x3e42a3(_0x4cc900,_0x3fabe9,..._0x215d9b){if(_0x215d9b['length']>0x2){const _0x328d87=_0x215d9b['pop']();_0x4cc900+='one\x20of\x20type\x20'+_0x215d9b['join'](',\x20')+',\x20or\x20'+_0x328d87+'.';}else 0x2===_0x215d9b['length']?_0x4cc900+='one\x20of\x20type\x20'+_0x215d9b[0x0]+'\x20or\x20'+_0x215d9b[0x1]+'.':_0x4cc900+='of\x20type\x20'+_0x215d9b[0x0]+'.';return null==_0x3fabe9?_0x4cc900+='\x20Received\x20'+_0x3fabe9:'function'==typeof _0x3fabe9&&_0x3fabe9['name']?_0x4cc900+='\x20Received\x20function\x20'+_0x3fabe9['name']:'object'==typeof _0x3fabe9&&null!=_0x3fabe9&&_0x3fabe9['constructor']&&_0x3fabe9['constructor']['name']&&(_0x4cc900+='\x20Received\x20an\x20instance\x20of\x20'+_0x3fabe9['constructor']['name']),_0x4cc900;}var _0x3689c5=(_0x9d6c3a,..._0x1d1787)=>_0x3e42a3('Key\x20must\x20be\x20',_0x9d6c3a,..._0x1d1787);function _0x50a6d5(_0xfbc80f,_0x45426a,..._0x2b34b8){return _0x3e42a3('Key\x20for\x20the\x20'+_0xfbc80f+'\x20algorithm\x20must\x20be\x20',_0x45426a,..._0x2b34b8);}var _0x58ec8a=_0xebe64b=>_0x1b49a2(_0xebe64b);const _0x21a08d=['CryptoKey'];var _0x2a52d6=async(_0x133662,_0x30aab0,_0x129234,_0x415f22,_0x10f204,_0x54e9c9)=>{if(!(_0x1b49a2(_0x30aab0)||_0x30aab0 instanceof Uint8Array))throw new TypeError(_0x3689c5(_0x30aab0,..._0x21a08d,'Uint8Array'));switch(_0x4889ec(_0x133662,_0x415f22),_0x133662){case'A128CBC-HS256':case'A192CBC-HS384':case'A256CBC-HS512':return _0x30aab0 instanceof Uint8Array&&_0x53e3eb(_0x30aab0,parseInt(_0x133662['slice'](-0x3),0xa)),async function(_0x31ce12,_0x1bdfd6,_0x200890,_0x1c61aa,_0x1c19a8,_0x4be5cc){if(!(_0x1bdfd6 instanceof Uint8Array))throw new TypeError(_0x3689c5(_0x1bdfd6,'Uint8Array'));const _0x2715d9=parseInt(_0x31ce12['slice'](0x1,0x4),0xa),_0xdb2506=await _0x298964['subtle']['importKey']('raw',_0x1bdfd6['subarray'](_0x2715d9>>0x3),'AES-CBC',!0x1,['decrypt']),_0x3fe2ea=await _0x298964['subtle']['importKey']('raw',_0x1bdfd6['subarray'](0x0,_0x2715d9>>0x3),{'hash':'SHA-'+(_0x2715d9<<0x1),'name':'HMAC'},!0x1,['sign']),_0x20e99f=_0x1896d1(_0x4be5cc,_0x1c61aa,_0x200890,_0x476dc0(_0x4be5cc['length']<<0x3)),_0x57fceb=new Uint8Array((await _0x298964['subtle']['sign']('HMAC',_0x3fe2ea,_0x20e99f))['slice'](0x0,_0x2715d9>>0x3));let _0x56500a,_0x24ab18;try{_0x56500a=((_0x22c141,_0x21151f)=>{if(!(_0x22c141 instanceof Uint8Array))throw new TypeError('First\x20argument\x20must\x20be\x20a\x20buffer');if(!(_0x21151f instanceof Uint8Array))throw new TypeError('Second\x20argument\x20must\x20be\x20a\x20buffer');if(_0x22c141['length']!==_0x21151f['length'])throw new TypeError('Input\x20buffers\x20must\x20have\x20the\x20same\x20length');const _0xbff1d0=_0x22c141['length'];let _0x49a0ca=0x0,_0x15bcaa=-0x1;for(;++_0x15bcaa<_0xbff1d0;)_0x49a0ca|=_0x22c141[_0x15bcaa]^_0x21151f[_0x15bcaa];return 0x0===_0x49a0ca;})(_0x1c19a8,_0x57fceb);}catch(_0x3ffc6b){}if(!_0x56500a)throw new _0x48eb1d();try{_0x24ab18=new Uint8Array(await _0x298964['subtle']['decrypt']({'iv':_0x1c61aa,'name':'AES-CBC'},_0xdb2506,_0x200890));}catch(_0x5d6017){}if(!_0x24ab18)throw new _0x48eb1d();return _0x24ab18;}(_0x133662,_0x30aab0,_0x129234,_0x415f22,_0x10f204,_0x54e9c9);case'A128GCM':case'A192GCM':case'A256GCM':return _0x30aab0 instanceof Uint8Array&&_0x53e3eb(_0x30aab0,parseInt(_0x133662['slice'](0x1,0x4),0xa)),async function(_0x404509,_0x1f17d,_0x1ac62d,_0x52aee8,_0x5cae1f,_0xdeb734){let _0x916a99;_0x1f17d instanceof Uint8Array?_0x916a99=await _0x298964['subtle']['importKey']('raw',_0x1f17d,'AES-GCM',!0x1,['decrypt']):(_0x3e811d(_0x1f17d,_0x404509,'decrypt'),_0x916a99=_0x1f17d);try{return new Uint8Array(await _0x298964['subtle']['decrypt']({'additionalData':_0xdeb734,'iv':_0x52aee8,'name':'AES-GCM','tagLength':0x80},_0x916a99,_0x1896d1(_0x1ac62d,_0x5cae1f)));}catch(_0x164da6){throw new _0x48eb1d();}}(_0x133662,_0x30aab0,_0x129234,_0x415f22,_0x10f204,_0x54e9c9);default:throw new _0x43357e('Unsupported\x20JWE\x20Content\x20Encryption\x20Algorithm');}};const _0x103b4f=async()=>{throw new _0x43357e('JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20Parameter\x20is\x20not\x20supported\x20by\x20your\x20javascript\x20runtime.\x20You\x20need\x20to\x20use\x20the\x20`inflateRaw`\x20decrypt\x20option\x20to\x20provide\x20Inflate\x20Raw\x20implementation.');},_0x485a5f=async()=>{throw new _0x43357e('JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20Parameter\x20is\x20not\x20supported\x20by\x20your\x20javascript\x20runtime.\x20You\x20need\x20to\x20use\x20the\x20`deflateRaw`\x20encrypt\x20option\x20to\x20provide\x20Deflate\x20Raw\x20implementation.');};var _0x962264=(..._0x5dc609)=>{const _0xaffdf8=_0x5dc609['filter'](Boolean);if(0x0===_0xaffdf8['length']||0x1===_0xaffdf8['length'])return!0x0;let _0x5ba5ab;for(const _0x2ea1d6 of _0xaffdf8){const _0x59dcf6=Object['keys'](_0x2ea1d6);if(_0x5ba5ab&&0x0!==_0x5ba5ab['size'])for(const _0x7675c2 of _0x59dcf6){if(_0x5ba5ab['has'](_0x7675c2))return!0x1;_0x5ba5ab['add'](_0x7675c2);}else _0x5ba5ab=new Set(_0x59dcf6);}return!0x0;};function _0x2df98d(_0x13ed05){if('object'!=typeof(_0x44cbc1=_0x13ed05)||null===_0x44cbc1||'[object\x20Object]'!==Object['prototype']['toString']['call'](_0x13ed05))return!0x1;var _0x44cbc1;if(null===Object['getPrototypeOf'](_0x13ed05))return!0x0;let _0x3b2581=_0x13ed05;for(;null!==Object['getPrototypeOf'](_0x3b2581);)_0x3b2581=Object['getPrototypeOf'](_0x3b2581);return Object['getPrototypeOf'](_0x13ed05)===_0x3b2581;}var _0x4a3d7f=[{'hash':'SHA-256','name':'HMAC'},!0x0,['sign']];function _0x339c69(_0x1e26da,_0x950add){if(_0x1e26da['algorithm']['length']!==parseInt(_0x950add['slice'](0x1,0x4),0xa))throw new TypeError('Invalid\x20key\x20size\x20for\x20alg:\x20'+_0x950add);}function _0x28d91f(_0x3f3fd7,_0x779cf2,_0xa78685){if(_0x1b49a2(_0x3f3fd7))return _0x3e811d(_0x3f3fd7,_0x779cf2,_0xa78685),_0x3f3fd7;if(_0x3f3fd7 instanceof Uint8Array)return _0x298964['subtle']['importKey']('raw',_0x3f3fd7,'AES-KW',!0x0,[_0xa78685]);throw new TypeError(_0x3689c5(_0x3f3fd7,..._0x21a08d,'Uint8Array'));}const _0x32461f=async(_0x11ec42,_0x91db1d,_0x185556)=>{const _0x11d881=await _0x28d91f(_0x91db1d,_0x11ec42,'wrapKey');_0x339c69(_0x11d881,_0x11ec42);const _0x479cd9=await _0x298964['subtle']['importKey']('raw',_0x185556,..._0x4a3d7f);return new Uint8Array(await _0x298964['subtle']['wrapKey']('raw',_0x479cd9,_0x11d881,'AES-KW'));},_0x305482=async(_0x333ae6,_0x4f2b25,_0x270fc7)=>{const _0x174c40=await _0x28d91f(_0x4f2b25,_0x333ae6,'unwrapKey');_0x339c69(_0x174c40,_0x333ae6);const _0x23acb8=await _0x298964['subtle']['unwrapKey']('raw',_0x270fc7,_0x174c40,'AES-KW',..._0x4a3d7f);return new Uint8Array(await _0x298964['subtle']['exportKey']('raw',_0x23acb8));};async function _0x58b90e(_0xc10b2d,_0x4eab55,_0x8d763a,_0x43123e,_0x46f0aa=new Uint8Array(0x0),_0x1cd18b=new Uint8Array(0x0)){if(!_0x1b49a2(_0xc10b2d))throw new TypeError(_0x3689c5(_0xc10b2d,..._0x21a08d));if(_0x3e811d(_0xc10b2d,'ECDH'),!_0x1b49a2(_0x4eab55))throw new TypeError(_0x3689c5(_0x4eab55,..._0x21a08d));_0x3e811d(_0x4eab55,'ECDH','deriveBits');const _0x55768d=_0x1896d1(_0x442903(_0x2ffac3['encode'](_0x8d763a)),_0x442903(_0x46f0aa),_0x442903(_0x1cd18b),_0x5d393c(_0x43123e));let _0x4085ea;return _0x4085ea='X25519'===_0xc10b2d['algorithm']['name']?0x100:'X448'===_0xc10b2d['algorithm']['name']?0x1c0:Math['ceil'](parseInt(_0xc10b2d['algorithm']['namedCurve']['substr'](-0x3),0xa)/0x8)<<0x3,async function(_0x3fc629,_0x28cd08,_0x28af99){const _0x1e22f1=Math['ceil']((_0x28cd08>>0x3)/0x20),_0x4855fa=new Uint8Array(0x20*_0x1e22f1);for(let _0x7cd680=0x0;_0x7cd680<_0x1e22f1;_0x7cd680++){const _0x3750ea=new Uint8Array(0x4+_0x3fc629['length']+_0x28af99['length']);_0x3750ea['set'](_0x5d393c(_0x7cd680+0x1)),_0x3750ea['set'](_0x3fc629,0x4),_0x3750ea['set'](_0x28af99,0x4+_0x3fc629['length']),_0x4855fa['set'](await _0x3015b8('sha256',_0x3750ea),0x20*_0x7cd680);}return _0x4855fa['slice'](0x0,_0x28cd08>>0x3);}(new Uint8Array(await _0x298964['subtle']['deriveBits']({'name':_0xc10b2d['algorithm']['name'],'public':_0xc10b2d},_0x4eab55,_0x4085ea)),_0x43123e,_0x55768d);}function _0x2d7b6d(_0x3d4594){if(!_0x1b49a2(_0x3d4594))throw new TypeError(_0x3689c5(_0x3d4594,..._0x21a08d));return['P-256','P-384','P-521']['includes'](_0x3d4594['algorithm']['namedCurve'])||'X25519'===_0x3d4594['algorithm']['name']||'X448'===_0x3d4594['algorithm']['name'];}async function _0x275b39(_0x5b9116,_0x30ed42,_0x75448c,_0xa6a57f){!function(_0x5cfe3a){if(!(_0x5cfe3a instanceof Uint8Array)||_0x5cfe3a['length']<0x8)throw new _0x20a9c5('PBES2\x20Salt\x20Input\x20must\x20be\x208\x20or\x20more\x20octets');}(_0x5b9116);const _0x3223b4=function(_0x5bcf1b,_0x1167bf){return _0x1896d1(_0x2ffac3['encode'](_0x5bcf1b),new Uint8Array([0x0]),_0x1167bf);}(_0x30ed42,_0x5b9116),_0x34ddb4=parseInt(_0x30ed42['slice'](0xd,0x10),0xa),_0xfd7979={'hash':'SHA-'+_0x30ed42['slice'](0x8,0xb),'iterations':_0x75448c,'name':'PBKDF2','salt':_0x3223b4},_0x322eee={'length':_0x34ddb4,'name':'AES-KW'},_0x331715=await function(_0x59c506,_0x22bd89){if(_0x59c506 instanceof Uint8Array)return _0x298964['subtle']['importKey']('raw',_0x59c506,'PBKDF2',!0x1,['deriveBits']);if(_0x1b49a2(_0x59c506))return _0x3e811d(_0x59c506,_0x22bd89,'deriveBits','deriveKey'),_0x59c506;throw new TypeError(_0x3689c5(_0x59c506,..._0x21a08d,'Uint8Array'));}(_0xa6a57f,_0x30ed42);if(_0x331715['usages']['includes']('deriveBits'))return new Uint8Array(await _0x298964['subtle']['deriveBits'](_0xfd7979,_0x331715,_0x34ddb4));if(_0x331715['usages']['includes']('deriveKey'))return _0x298964['subtle']['deriveKey'](_0xfd7979,_0x331715,_0x322eee,!0x1,['wrapKey','unwrapKey']);throw new TypeError('PBKDF2\x20key\x20\x22usages\x22\x20must\x20include\x20\x22deriveBits\x22\x20or\x20\x22deriveKey\x22');}function _0x3db9b8(_0x45602a){switch(_0x45602a){case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':return'RSA-OAEP';default:throw new _0x43357e('alg\x20'+_0x45602a+'\x20is\x20not\x20supported\x20either\x20by\x20JOSE\x20or\x20your\x20javascript\x20runtime');}}var _0x4bb262=(_0x2c0f2d,_0x2623d8)=>{if(_0x2c0f2d['startsWith']('RS')||_0x2c0f2d['startsWith']('PS')){const {modulusLength:_0x400fba}=_0x2623d8['algorithm'];if('number'!=typeof _0x400fba||_0x400fba<0x800)throw new TypeError(_0x2c0f2d+'\x20requires\x20key\x20modulusLength\x20to\x20be\x202048\x20bits\x20or\x20larger');}};function _0x50278b(_0x497b73){switch(_0x497b73){case'A128GCM':return 0x80;case'A192GCM':return 0xc0;case'A256GCM':case'A128CBC-HS256':return 0x100;case'A192CBC-HS384':return 0x180;case'A256CBC-HS512':return 0x200;default:throw new _0x43357e('Unsupported\x20JWE\x20Algorithm:\x20'+_0x497b73);}}var _0x4fa806=_0x4ecf55=>_0xc75a16(new Uint8Array(_0x50278b(_0x4ecf55)>>0x3)),_0x527853=(_0x117ec9,_0x334454)=>'-----BEGIN\x20'+_0x334454+'-----\x0a'+(_0x117ec9['match'](/.{1,64}/g)||[])['join']('\x0a')+'\x0a-----END\x20'+_0x334454+'-----';const _0x53e796=async(_0x55f682,_0x3ec910,_0x19cd45)=>{if(!_0x1b49a2(_0x19cd45))throw new TypeError(_0x3689c5(_0x19cd45,..._0x21a08d));if(!_0x19cd45['extractable'])throw new TypeError('CryptoKey\x20is\x20not\x20extractable');if(_0x19cd45['type']!==_0x55f682)throw new TypeError('key\x20is\x20not\x20a\x20'+_0x55f682+'\x20key');return _0x527853(_0x2ef2e1(new Uint8Array(await _0x298964['subtle']['exportKey'](_0x3ec910,_0x19cd45))),_0x55f682['toUpperCase']()+'\x20KEY');},_0x46b07a=_0x3f4c2b=>_0x53e796('public','spki',_0x3f4c2b),_0x414f90=_0x2401a7=>_0x53e796('private','pkcs8',_0x2401a7),_0xaa4e95=(_0x349503,_0xfb2c4b,_0x117809=0x0)=>{0x0===_0x117809&&(_0xfb2c4b['unshift'](_0xfb2c4b['length']),_0xfb2c4b['unshift'](0x6));let _0x35a421=_0x349503['indexOf'](_0xfb2c4b[0x0],_0x117809);if(-0x1===_0x35a421)return!0x1;const _0x52a1ac=_0x349503['subarray'](_0x35a421,_0x35a421+_0xfb2c4b['length']);return _0x52a1ac['length']===_0xfb2c4b['length']&&(_0x52a1ac['every']((_0x21f631,_0x2adbe8)=>_0x21f631===_0xfb2c4b[_0x2adbe8])||_0xaa4e95(_0x349503,_0xfb2c4b,_0x35a421+0x1));},_0x50cca6=_0x1e346f=>{switch(!0x0){case _0xaa4e95(_0x1e346f,[0x2a,0x86,0x48,0xce,0x3d,0x3,0x1,0x7]):return'P-256';case _0xaa4e95(_0x1e346f,[0x2b,0x81,0x4,0x0,0x22]):return'P-384';case _0xaa4e95(_0x1e346f,[0x2b,0x81,0x4,0x0,0x23]):return'P-521';case _0xaa4e95(_0x1e346f,[0x2b,0x65,0x6e]):return'X25519';case _0xaa4e95(_0x1e346f,[0x2b,0x65,0x6f]):return'X448';case _0xaa4e95(_0x1e346f,[0x2b,0x65,0x70]):return'Ed25519';case _0xaa4e95(_0x1e346f,[0x2b,0x65,0x71]):return'Ed448';default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20EC\x20Key\x20Curve\x20or\x20OKP\x20Key\x20Sub\x20Type');}},_0x2bc9d1=async(_0x2ac77a,_0x32fdea,_0x340035,_0x49ceee,_0x28e3c1)=>{var _0x96d7f9;let _0x4fb7da,_0x2d4242;const _0x25f0d6=new Uint8Array(atob(_0x340035['replace'](_0x2ac77a,''))['split']('')['map'](_0x316d9d=>_0x316d9d['charCodeAt'](0x0))),_0x18dcd8='spki'===_0x32fdea;switch(_0x49ceee){case'PS256':case'PS384':case'PS512':_0x4fb7da={'name':'RSA-PSS','hash':'SHA-'+_0x49ceee['slice'](-0x3)},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;case'RS256':case'RS384':case'RS512':_0x4fb7da={'name':'RSASSA-PKCS1-v1_5','hash':'SHA-'+_0x49ceee['slice'](-0x3)},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':_0x4fb7da={'name':'RSA-OAEP','hash':'SHA-'+(parseInt(_0x49ceee['slice'](-0x3),0xa)||0x1)},_0x2d4242=_0x18dcd8?['encrypt','wrapKey']:['decrypt','unwrapKey'];break;case'ES256':_0x4fb7da={'name':'ECDSA','namedCurve':'P-256'},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;case'ES384':_0x4fb7da={'name':'ECDSA','namedCurve':'P-384'},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;case'ES512':_0x4fb7da={'name':'ECDSA','namedCurve':'P-521'},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;case'ECDH-ES':case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':{const _0x16e28f=_0x50cca6(_0x25f0d6);_0x4fb7da=_0x16e28f['startsWith']('P-')?{'name':'ECDH','namedCurve':_0x16e28f}:{'name':_0x16e28f},_0x2d4242=_0x18dcd8?[]:['deriveBits'];break;}case'EdDSA':_0x4fb7da={'name':_0x50cca6(_0x25f0d6)},_0x2d4242=_0x18dcd8?['verify']:['sign'];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20\x22alg\x22\x20(Algorithm)\x20value');}return _0x298964['subtle']['importKey'](_0x32fdea,_0x25f0d6,_0x4fb7da,null!==(_0x96d7f9=null==_0x28e3c1?void 0x0:_0x28e3c1['extractable'])&&void 0x0!==_0x96d7f9&&_0x96d7f9,_0x2d4242);},_0x4f3b9b=(_0xea7b3f,_0x70e5a8,_0x4c4d33)=>_0x2bc9d1(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,'pkcs8',_0xea7b3f,_0x70e5a8,_0x4c4d33),_0x5624eb=(_0x2ce280,_0x9bc16,_0x4a3858)=>_0x2bc9d1(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,'spki',_0x2ce280,_0x9bc16,_0x4a3858);function _0x67a886(_0x2224e7){let _0x83ad23=[],_0x4ebd91=0x0;for(;_0x4ebd91<_0x2224e7['length'];){let _0x163a42=_0x4a5b13(_0x2224e7['subarray'](_0x4ebd91));_0x83ad23['push'](_0x163a42),_0x4ebd91+=_0x163a42['byteLength'];}return _0x83ad23;}function _0x4a5b13(_0x5e797d){let _0x4813fb=0x0,_0x296b19=0x1f&_0x5e797d[0x0];if(_0x4813fb++,0x1f===_0x296b19){for(_0x296b19=0x0;_0x5e797d[_0x4813fb]>=0x80;)_0x296b19=0x80*_0x296b19+_0x5e797d[_0x4813fb]-0x80,_0x4813fb++;_0x296b19=0x80*_0x296b19+_0x5e797d[_0x4813fb]-0x80,_0x4813fb++;}let _0xdf57cf=0x0;if(_0x5e797d[_0x4813fb]<0x80)_0xdf57cf=_0x5e797d[_0x4813fb],_0x4813fb++;else{if(0x80===_0xdf57cf){for(_0xdf57cf=0x0;0x0!==_0x5e797d[_0x4813fb+_0xdf57cf]||0x0!==_0x5e797d[_0x4813fb+_0xdf57cf+0x1];){if(_0xdf57cf>_0x5e797d['byteLength'])throw new TypeError('invalid\x20indefinite\x20form\x20length');_0xdf57cf++;}const _0xccda11=_0x4813fb+_0xdf57cf+0x2;return{'byteLength':_0xccda11,'contents':_0x5e797d['subarray'](_0x4813fb,_0x4813fb+_0xdf57cf),'raw':_0x5e797d['subarray'](0x0,_0xccda11)};}{let _0x241113=0x7f&_0x5e797d[_0x4813fb];_0x4813fb++,_0xdf57cf=0x0;for(let _0x11828a=0x0;_0x11828a<_0x241113;_0x11828a++)_0xdf57cf=0x100*_0xdf57cf+_0x5e797d[_0x4813fb],_0x4813fb++;}}const _0x133dcd=_0x4813fb+_0xdf57cf;return{'byteLength':_0x133dcd,'contents':_0x5e797d['subarray'](_0x4813fb,_0x133dcd),'raw':_0x5e797d['subarray'](0x0,_0x133dcd)};}const _0x3362f2=(_0x3375d5,_0x446b7d,_0x360421)=>{let _0x5bb0a3;try{_0x5bb0a3=function(_0x22d20e){const _0x1a9e5d=_0x22d20e['replace'](/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,''),_0x4ef5b9=_0x1cfcce(_0x1a9e5d);return _0x527853(function(_0x1c9a7e){const _0x4a13ad=_0x67a886(_0x67a886(_0x4a5b13(_0x1c9a7e)['contents'])[0x0]['contents']);return _0x2ef2e1(_0x4a13ad[0xa0===_0x4a13ad[0x0]['raw'][0x0]?0x6:0x5]['raw']);}(_0x4ef5b9),'PUBLIC\x20KEY');}(_0x3375d5);}catch(_0x3fd3e6){throw new TypeError('Failed\x20to\x20parse\x20the\x20X.509\x20certificate',{'cause':_0x3fd3e6});}return _0x5624eb(_0x5bb0a3,_0x446b7d,_0x360421);};var _0x380879=async _0x255d9e=>{var _0x2d291a,_0x17049f;if(!_0x255d9e['alg'])throw new TypeError('\x22alg\x22\x20argument\x20is\x20required\x20when\x20\x22jwk.alg\x22\x20is\x20not\x20present');const {algorithm:_0xf2810f,keyUsages:_0x437e14}=function(_0x382a66){let _0x30fc78,_0x49c6e2;switch(_0x382a66['kty']){case'oct':switch(_0x382a66['alg']){case'HS256':case'HS384':case'HS512':_0x30fc78={'name':'HMAC','hash':'SHA-'+_0x382a66['alg']['slice'](-0x3)},_0x49c6e2=['sign','verify'];break;case'A128CBC-HS256':case'A192CBC-HS384':case'A256CBC-HS512':throw new _0x43357e(_0x382a66['alg']+'\x20keys\x20cannot\x20be\x20imported\x20as\x20CryptoKey\x20instances');case'A128GCM':case'A192GCM':case'A256GCM':case'A128GCMKW':case'A192GCMKW':case'A256GCMKW':_0x30fc78={'name':'AES-GCM'},_0x49c6e2=['encrypt','decrypt'];break;case'A128KW':case'A192KW':case'A256KW':_0x30fc78={'name':'AES-KW'},_0x49c6e2=['wrapKey','unwrapKey'];break;case'PBES2-HS256+A128KW':case'PBES2-HS384+A192KW':case'PBES2-HS512+A256KW':_0x30fc78={'name':'PBKDF2'},_0x49c6e2=['deriveBits'];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}break;case'RSA':switch(_0x382a66['alg']){case'PS256':case'PS384':case'PS512':_0x30fc78={'name':'RSA-PSS','hash':'SHA-'+_0x382a66['alg']['slice'](-0x3)},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'RS256':case'RS384':case'RS512':_0x30fc78={'name':'RSASSA-PKCS1-v1_5','hash':'SHA-'+_0x382a66['alg']['slice'](-0x3)},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':_0x30fc78={'name':'RSA-OAEP','hash':'SHA-'+(parseInt(_0x382a66['alg']['slice'](-0x3),0xa)||0x1)},_0x49c6e2=_0x382a66['d']?['decrypt','unwrapKey']:['encrypt','wrapKey'];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}break;case'EC':switch(_0x382a66['alg']){case'ES256':_0x30fc78={'name':'ECDSA','namedCurve':'P-256'},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'ES384':_0x30fc78={'name':'ECDSA','namedCurve':'P-384'},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'ES512':_0x30fc78={'name':'ECDSA','namedCurve':'P-521'},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'ECDH-ES':case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':_0x30fc78={'name':'ECDH','namedCurve':_0x382a66['crv']},_0x49c6e2=_0x382a66['d']?['deriveBits']:[];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}break;case'OKP':switch(_0x382a66['alg']){case'EdDSA':_0x30fc78={'name':_0x382a66['crv']},_0x49c6e2=_0x382a66['d']?['sign']:['verify'];break;case'ECDH-ES':case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':_0x30fc78={'name':_0x382a66['crv']},_0x49c6e2=_0x382a66['d']?['deriveBits']:[];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22kty\x22\x20(Key\x20Type)\x20Parameter\x20value');}return{'algorithm':_0x30fc78,'keyUsages':_0x49c6e2};}(_0x255d9e),_0x407268=[_0xf2810f,null!==(_0x2d291a=_0x255d9e['ext'])&&void 0x0!==_0x2d291a&&_0x2d291a,null!==(_0x17049f=_0x255d9e['key_ops'])&&void 0x0!==_0x17049f?_0x17049f:_0x437e14];if('PBKDF2'===_0xf2810f['name'])return _0x298964['subtle']['importKey']('raw',_0x14a576(_0x255d9e['k']),..._0x407268);const _0xc3424b={..._0x255d9e};return delete _0xc3424b['alg'],delete _0xc3424b['use'],_0x298964['subtle']['importKey']('jwk',_0xc3424b,..._0x407268);};async function _0x57144f(_0x335ca1,_0x27e058,_0x93f00d){if('string'!=typeof _0x335ca1||0x0!==_0x335ca1['indexOf']('-----BEGIN\x20PUBLIC\x20KEY-----'))throw new TypeError('\x22spki\x22\x20must\x20be\x20SPKI\x20formatted\x20string');return _0x5624eb(_0x335ca1,_0x27e058,_0x93f00d);}async function _0x17823f(_0x1ab603,_0x13d591,_0x2644f1){if('string'!=typeof _0x1ab603||0x0!==_0x1ab603['indexOf']('-----BEGIN\x20CERTIFICATE-----'))throw new TypeError('\x22x509\x22\x20must\x20be\x20X.509\x20formatted\x20string');return _0x3362f2(_0x1ab603,_0x13d591,_0x2644f1);}async function _0x1b5562(_0x3340ff,_0x29390c,_0x45cb77){if('string'!=typeof _0x3340ff||0x0!==_0x3340ff['indexOf']('-----BEGIN\x20PRIVATE\x20KEY-----'))throw new TypeError('\x22pkcs8\x22\x20must\x20be\x20PKCS#8\x20formatted\x20string');return _0x4f3b9b(_0x3340ff,_0x29390c,_0x45cb77);}async function _0x28f7a6(_0x40037d,_0x5374e2,_0xfb5741){var _0x2de1dd;if(!_0x2df98d(_0x40037d))throw new TypeError('JWK\x20must\x20be\x20an\x20object');switch(_0x5374e2||(_0x5374e2=_0x40037d['alg']),_0x40037d['kty']){case'oct':if('string'!=typeof _0x40037d['k']||!_0x40037d['k'])throw new TypeError('missing\x20\x22k\x22\x20(Key\x20Value)\x20Parameter\x20value');return null!=_0xfb5741||(_0xfb5741=!0x0!==_0x40037d['ext']),_0xfb5741?_0x380879({..._0x40037d,'alg':_0x5374e2,'ext':null!==(_0x2de1dd=_0x40037d['ext'])&&void 0x0!==_0x2de1dd&&_0x2de1dd}):_0x14a576(_0x40037d['k']);case'RSA':if(void 0x0!==_0x40037d['oth'])throw new _0x43357e('RSA\x20JWK\x20\x22oth\x22\x20(Other\x20Primes\x20Info)\x20Parameter\x20value\x20is\x20not\x20supported');case'EC':case'OKP':return _0x380879({..._0x40037d,'alg':_0x5374e2});default:throw new _0x43357e('Unsupported\x20\x22kty\x22\x20(Key\x20Type)\x20Parameter\x20value');}}var _0x2c2829=(_0x22d50e,_0x44edd8,_0x40a3e1)=>{_0x22d50e['startsWith']('HS')||'dir'===_0x22d50e||_0x22d50e['startsWith']('PBES2')||/^A\d{3}(?:GCM)?KW$/['test'](_0x22d50e)?((_0x696160,_0x59a2ba)=>{if(!(_0x59a2ba instanceof Uint8Array)){if(!_0x58ec8a(_0x59a2ba))throw new TypeError(_0x50a6d5(_0x696160,_0x59a2ba,..._0x21a08d,'Uint8Array'));if('secret'!==_0x59a2ba['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20symmetric\x20algorithms\x20must\x20be\x20of\x20type\x20\x22secret\x22');}})(_0x22d50e,_0x44edd8):((_0x3240da,_0x4a4617,_0x1bec73)=>{if(!_0x58ec8a(_0x4a4617))throw new TypeError(_0x50a6d5(_0x3240da,_0x4a4617,..._0x21a08d));if('secret'===_0x4a4617['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20asymmetric\x20algorithms\x20must\x20not\x20be\x20of\x20type\x20\x22secret\x22');if('sign'===_0x1bec73&&'public'===_0x4a4617['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20asymmetric\x20algorithm\x20signing\x20must\x20be\x20of\x20type\x20\x22private\x22');if('decrypt'===_0x1bec73&&'public'===_0x4a4617['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20asymmetric\x20algorithm\x20decryption\x20must\x20be\x20of\x20type\x20\x22private\x22');if(_0x4a4617['algorithm']&&'verify'===_0x1bec73&&'private'===_0x4a4617['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20asymmetric\x20algorithm\x20verifying\x20must\x20be\x20of\x20type\x20\x22public\x22');if(_0x4a4617['algorithm']&&'encrypt'===_0x1bec73&&'private'===_0x4a4617['type'])throw new TypeError(_0x21a08d['join']('\x20or\x20')+'\x20instances\x20for\x20asymmetric\x20algorithm\x20encryption\x20must\x20be\x20of\x20type\x20\x22public\x22');})(_0x22d50e,_0x44edd8,_0x40a3e1);},_0x4626a6=async(_0x11cebb,_0x54a97c,_0x4baf4d,_0x1faea0,_0x48db02)=>{if(!(_0x1b49a2(_0x4baf4d)||_0x4baf4d instanceof Uint8Array))throw new TypeError(_0x3689c5(_0x4baf4d,..._0x21a08d,'Uint8Array'));switch(_0x4889ec(_0x11cebb,_0x1faea0),_0x11cebb){case'A128CBC-HS256':case'A192CBC-HS384':case'A256CBC-HS512':return _0x4baf4d instanceof Uint8Array&&_0x53e3eb(_0x4baf4d,parseInt(_0x11cebb['slice'](-0x3),0xa)),async function(_0x59bf7c,_0x53738b,_0x4652f1,_0xea9741,_0x4e3bff){if(!(_0x4652f1 instanceof Uint8Array))throw new TypeError(_0x3689c5(_0x4652f1,'Uint8Array'));const _0x4ed8d5=parseInt(_0x59bf7c['slice'](0x1,0x4),0xa),_0x16f40d=await _0x298964['subtle']['importKey']('raw',_0x4652f1['subarray'](_0x4ed8d5>>0x3),'AES-CBC',!0x1,['encrypt']),_0x36594b=await _0x298964['subtle']['importKey']('raw',_0x4652f1['subarray'](0x0,_0x4ed8d5>>0x3),{'hash':'SHA-'+(_0x4ed8d5<<0x1),'name':'HMAC'},!0x1,['sign']),_0x4cdcd7=new Uint8Array(await _0x298964['subtle']['encrypt']({'iv':_0xea9741,'name':'AES-CBC'},_0x16f40d,_0x53738b)),_0x131a2e=_0x1896d1(_0x4e3bff,_0xea9741,_0x4cdcd7,_0x476dc0(_0x4e3bff['length']<<0x3));return{'ciphertext':_0x4cdcd7,'tag':new Uint8Array((await _0x298964['subtle']['sign']('HMAC',_0x36594b,_0x131a2e))['slice'](0x0,_0x4ed8d5>>0x3))};}(_0x11cebb,_0x54a97c,_0x4baf4d,_0x1faea0,_0x48db02);case'A128GCM':case'A192GCM':case'A256GCM':return _0x4baf4d instanceof Uint8Array&&_0x53e3eb(_0x4baf4d,parseInt(_0x11cebb['slice'](0x1,0x4),0xa)),async function(_0x416097,_0x4b9b70,_0x5cbe29,_0x4eef92,_0x3268f6){let _0x155fc5;_0x5cbe29 instanceof Uint8Array?_0x155fc5=await _0x298964['subtle']['importKey']('raw',_0x5cbe29,'AES-GCM',!0x1,['encrypt']):(_0x3e811d(_0x5cbe29,_0x416097,'encrypt'),_0x155fc5=_0x5cbe29);const _0x4cb0ab=new Uint8Array(await _0x298964['subtle']['encrypt']({'additionalData':_0x3268f6,'iv':_0x4eef92,'name':'AES-GCM','tagLength':0x80},_0x155fc5,_0x4b9b70)),_0x4b8547=_0x4cb0ab['slice'](-0x10);return{'ciphertext':_0x4cb0ab['slice'](0x0,-0x10),'tag':_0x4b8547};}(_0x11cebb,_0x54a97c,_0x4baf4d,_0x1faea0,_0x48db02);default:throw new _0x43357e('Unsupported\x20JWE\x20Content\x20Encryption\x20Algorithm');}},_0x420d8a=async function(_0x5386d1,_0x2f48af,_0x4c5119,_0x308170,_0x725d5b){switch(_0x2c2829(_0x5386d1,_0x2f48af,'decrypt'),_0x5386d1){case'dir':if(void 0x0!==_0x4c5119)throw new _0x20a9c5('Encountered\x20unexpected\x20JWE\x20Encrypted\x20Key');return _0x2f48af;case'ECDH-ES':if(void 0x0!==_0x4c5119)throw new _0x20a9c5('Encountered\x20unexpected\x20JWE\x20Encrypted\x20Key');case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':{if(!_0x2df98d(_0x308170['epk']))throw new _0x20a9c5('JOSE\x20Header\x20\x22epk\x22\x20(Ephemeral\x20Public\x20Key)\x20missing\x20or\x20invalid');if(!_0x2d7b6d(_0x2f48af))throw new _0x43357e('ECDH\x20with\x20the\x20provided\x20key\x20is\x20not\x20allowed\x20or\x20not\x20supported\x20by\x20your\x20javascript\x20runtime');const _0x4f5d17=await _0x28f7a6(_0x308170['epk'],_0x5386d1);let _0x1d70dc,_0x78e2e0;if(void 0x0!==_0x308170['apu']){if('string'!=typeof _0x308170['apu'])throw new _0x20a9c5('JOSE\x20Header\x20\x22apu\x22\x20(Agreement\x20PartyUInfo)\x20invalid');try{_0x1d70dc=_0x14a576(_0x308170['apu']);}catch(_0x202a8f){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20apu');}}if(void 0x0!==_0x308170['apv']){if('string'!=typeof _0x308170['apv'])throw new _0x20a9c5('JOSE\x20Header\x20\x22apv\x22\x20(Agreement\x20PartyVInfo)\x20invalid');try{_0x78e2e0=_0x14a576(_0x308170['apv']);}catch(_0x415a8b){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20apv');}}const _0x8d2ff4=await _0x58b90e(_0x4f5d17,_0x2f48af,'ECDH-ES'===_0x5386d1?_0x308170['enc']:_0x5386d1,'ECDH-ES'===_0x5386d1?_0x50278b(_0x308170['enc']):parseInt(_0x5386d1['slice'](-0x5,-0x2),0xa),_0x1d70dc,_0x78e2e0);if('ECDH-ES'===_0x5386d1)return _0x8d2ff4;if(void 0x0===_0x4c5119)throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20missing');return _0x305482(_0x5386d1['slice'](-0x6),_0x8d2ff4,_0x4c5119);}case'RSA1_5':case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':if(void 0x0===_0x4c5119)throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20missing');return(async(_0x21ad8e,_0x400963,_0x1d9155)=>{if(!_0x1b49a2(_0x400963))throw new TypeError(_0x3689c5(_0x400963,..._0x21a08d));if(_0x3e811d(_0x400963,_0x21ad8e,'decrypt','unwrapKey'),_0x4bb262(_0x21ad8e,_0x400963),_0x400963['usages']['includes']('decrypt'))return new Uint8Array(await _0x298964['subtle']['decrypt'](_0x3db9b8(_0x21ad8e),_0x400963,_0x1d9155));if(_0x400963['usages']['includes']('unwrapKey')){const _0x72f1a3=await _0x298964['subtle']['unwrapKey']('raw',_0x1d9155,_0x400963,_0x3db9b8(_0x21ad8e),..._0x4a3d7f);return new Uint8Array(await _0x298964['subtle']['exportKey']('raw',_0x72f1a3));}throw new TypeError('RSA-OAEP\x20key\x20\x22usages\x22\x20must\x20include\x20\x22decrypt\x22\x20or\x20\x22unwrapKey\x22\x20for\x20this\x20operation');})(_0x5386d1,_0x2f48af,_0x4c5119);case'PBES2-HS256+A128KW':case'PBES2-HS384+A192KW':case'PBES2-HS512+A256KW':{if(void 0x0===_0x4c5119)throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20missing');if('number'!=typeof _0x308170['p2c'])throw new _0x20a9c5('JOSE\x20Header\x20\x22p2c\x22\x20(PBES2\x20Count)\x20missing\x20or\x20invalid');const _0x4b60d6=(null==_0x725d5b?void 0x0:_0x725d5b['maxPBES2Count'])||0x2710;if(_0x308170['p2c']>_0x4b60d6)throw new _0x20a9c5('JOSE\x20Header\x20\x22p2c\x22\x20(PBES2\x20Count)\x20out\x20is\x20of\x20acceptable\x20bounds');if('string'!=typeof _0x308170['p2s'])throw new _0x20a9c5('JOSE\x20Header\x20\x22p2s\x22\x20(PBES2\x20Salt)\x20missing\x20or\x20invalid');let _0x51f74d;try{_0x51f74d=_0x14a576(_0x308170['p2s']);}catch(_0x9b20c3){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20p2s');}return(async(_0x426286,_0x178c82,_0x4dec72,_0x236484,_0x198ff5)=>{const _0x1f13b3=await _0x275b39(_0x198ff5,_0x426286,_0x236484,_0x178c82);return _0x305482(_0x426286['slice'](-0x6),_0x1f13b3,_0x4dec72);})(_0x5386d1,_0x2f48af,_0x4c5119,_0x308170['p2c'],_0x51f74d);}case'A128KW':case'A192KW':case'A256KW':if(void 0x0===_0x4c5119)throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20missing');return _0x305482(_0x5386d1,_0x2f48af,_0x4c5119);case'A128GCMKW':case'A192GCMKW':case'A256GCMKW':{if(void 0x0===_0x4c5119)throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20missing');if('string'!=typeof _0x308170['iv'])throw new _0x20a9c5('JOSE\x20Header\x20\x22iv\x22\x20(Initialization\x20Vector)\x20missing\x20or\x20invalid');if('string'!=typeof _0x308170['tag'])throw new _0x20a9c5('JOSE\x20Header\x20\x22tag\x22\x20(Authentication\x20Tag)\x20missing\x20or\x20invalid');let _0x2e81ae,_0x357251;try{_0x2e81ae=_0x14a576(_0x308170['iv']);}catch(_0x3cf8e8){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20iv');}try{_0x357251=_0x14a576(_0x308170['tag']);}catch(_0x5eb783){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20tag');}return async function(_0x4f492e,_0x4ddd3c,_0x322488,_0x294c61,_0x43646e){const _0x1e3cfd=_0x4f492e['slice'](0x0,0x7);return _0x2a52d6(_0x1e3cfd,_0x4ddd3c,_0x322488,_0x294c61,_0x43646e,new Uint8Array(0x0));}(_0x5386d1,_0x2f48af,_0x4c5119,_0x2e81ae,_0x357251);}default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20\x22alg\x22\x20(JWE\x20Algorithm)\x20header\x20value');}},_0x4d166e=function(_0x2d6464,_0x2c6293,_0x1301e8,_0x692e39,_0x155634){if(void 0x0!==_0x155634['crit']&&void 0x0===_0x692e39['crit'])throw new _0x2d6464('\x22crit\x22\x20(Critical)\x20Header\x20Parameter\x20MUST\x20be\x20integrity\x20protected');if(!_0x692e39||void 0x0===_0x692e39['crit'])return new Set();if(!Array['isArray'](_0x692e39['crit'])||0x0===_0x692e39['crit']['length']||_0x692e39['crit']['some'](_0x42ab91=>'string'!=typeof _0x42ab91||0x0===_0x42ab91['length']))throw new _0x2d6464('\x22crit\x22\x20(Critical)\x20Header\x20Parameter\x20MUST\x20be\x20an\x20array\x20of\x20non-empty\x20strings\x20when\x20present');let _0xddb154;_0xddb154=void 0x0!==_0x1301e8?new Map([...Object['entries'](_0x1301e8),..._0x2c6293['entries']()]):_0x2c6293;for(const _0x211856 of _0x692e39['crit']){if(!_0xddb154['has'](_0x211856))throw new _0x43357e('Extension\x20Header\x20Parameter\x20\x22'+_0x211856+'\x22\x20is\x20not\x20recognized');if(void 0x0===_0x155634[_0x211856])throw new _0x2d6464('Extension\x20Header\x20Parameter\x20\x22'+_0x211856+'\x22\x20is\x20missing');if(_0xddb154['get'](_0x211856)&&void 0x0===_0x692e39[_0x211856])throw new _0x2d6464('Extension\x20Header\x20Parameter\x20\x22'+_0x211856+'\x22\x20MUST\x20be\x20integrity\x20protected');}return new Set(_0x692e39['crit']);},_0xf4fbee=(_0x45b8a0,_0x3152d1)=>{if(void 0x0!==_0x3152d1&&(!Array['isArray'](_0x3152d1)||_0x3152d1['some'](_0xc8e4a5=>'string'!=typeof _0xc8e4a5)))throw new TypeError('\x22'+_0x45b8a0+'\x22\x20option\x20must\x20be\x20an\x20array\x20of\x20strings');if(_0x3152d1)return new Set(_0x3152d1);};async function _0x3e2b24(_0xaa0b3f,_0x5c2957,_0x389bf6){var _0x10c3ee;if(!_0x2df98d(_0xaa0b3f))throw new _0x20a9c5('Flattened\x20JWE\x20must\x20be\x20an\x20object');if(void 0x0===_0xaa0b3f['protected']&&void 0x0===_0xaa0b3f['header']&&void 0x0===_0xaa0b3f['unprotected'])throw new _0x20a9c5('JOSE\x20Header\x20missing');if('string'!=typeof _0xaa0b3f['iv'])throw new _0x20a9c5('JWE\x20Initialization\x20Vector\x20missing\x20or\x20incorrect\x20type');if('string'!=typeof _0xaa0b3f['ciphertext'])throw new _0x20a9c5('JWE\x20Ciphertext\x20missing\x20or\x20incorrect\x20type');if('string'!=typeof _0xaa0b3f['tag'])throw new _0x20a9c5('JWE\x20Authentication\x20Tag\x20missing\x20or\x20incorrect\x20type');if(void 0x0!==_0xaa0b3f['protected']&&'string'!=typeof _0xaa0b3f['protected'])throw new _0x20a9c5('JWE\x20Protected\x20Header\x20incorrect\x20type');if(void 0x0!==_0xaa0b3f['encrypted_key']&&'string'!=typeof _0xaa0b3f['encrypted_key'])throw new _0x20a9c5('JWE\x20Encrypted\x20Key\x20incorrect\x20type');if(void 0x0!==_0xaa0b3f['aad']&&'string'!=typeof _0xaa0b3f['aad'])throw new _0x20a9c5('JWE\x20AAD\x20incorrect\x20type');if(void 0x0!==_0xaa0b3f['header']&&!_0x2df98d(_0xaa0b3f['header']))throw new _0x20a9c5('JWE\x20Shared\x20Unprotected\x20Header\x20incorrect\x20type');if(void 0x0!==_0xaa0b3f['unprotected']&&!_0x2df98d(_0xaa0b3f['unprotected']))throw new _0x20a9c5('JWE\x20Per-Recipient\x20Unprotected\x20Header\x20incorrect\x20type');let _0x28d6fb;if(_0xaa0b3f['protected'])try{const _0x2c5897=_0x14a576(_0xaa0b3f['protected']);_0x28d6fb=JSON['parse'](_0x181173['decode'](_0x2c5897));}catch(_0x64a7f9){throw new _0x20a9c5('JWE\x20Protected\x20Header\x20is\x20invalid');}if(!_0x962264(_0x28d6fb,_0xaa0b3f['header'],_0xaa0b3f['unprotected']))throw new _0x20a9c5('JWE\x20Protected,\x20JWE\x20Unprotected\x20Header,\x20and\x20JWE\x20Per-Recipient\x20Unprotected\x20Header\x20Parameter\x20names\x20must\x20be\x20disjoint');const _0x552769={..._0x28d6fb,..._0xaa0b3f['header'],..._0xaa0b3f['unprotected']};if(_0x4d166e(_0x20a9c5,new Map(),null==_0x389bf6?void 0x0:_0x389bf6['crit'],_0x28d6fb,_0x552769),void 0x0!==_0x552769['zip']){if(!_0x28d6fb||!_0x28d6fb['zip'])throw new _0x20a9c5('JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20MUST\x20be\x20integrity\x20protected');if('DEF'!==_0x552769['zip'])throw new _0x43357e('Unsupported\x20JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20Parameter\x20value');}const {alg:_0x493c2a,enc:_0x214629}=_0x552769;if('string'!=typeof _0x493c2a||!_0x493c2a)throw new _0x20a9c5('missing\x20JWE\x20Algorithm\x20(alg)\x20in\x20JWE\x20Header');if('string'!=typeof _0x214629||!_0x214629)throw new _0x20a9c5('missing\x20JWE\x20Encryption\x20Algorithm\x20(enc)\x20in\x20JWE\x20Header');const _0x4b97ca=_0x389bf6&&_0xf4fbee('keyManagementAlgorithms',_0x389bf6['keyManagementAlgorithms']),_0x4a8988=_0x389bf6&&_0xf4fbee('contentEncryptionAlgorithms',_0x389bf6['contentEncryptionAlgorithms']);if(_0x4b97ca&&!_0x4b97ca['has'](_0x493c2a))throw new _0x14032b('\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20not\x20allowed');if(_0x4a8988&&!_0x4a8988['has'](_0x214629))throw new _0x14032b('\x22enc\x22\x20(Encryption\x20Algorithm)\x20Header\x20Parameter\x20not\x20allowed');let _0x4a10a1;if(void 0x0!==_0xaa0b3f['encrypted_key'])try{_0x4a10a1=_0x14a576(_0xaa0b3f['encrypted_key']);}catch(_0x5c53d1){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20encrypted_key');}let _0x417829,_0x55549e,_0x587dfa,_0x3ae090=!0x1;'function'==typeof _0x5c2957&&(_0x5c2957=await _0x5c2957(_0x28d6fb,_0xaa0b3f),_0x3ae090=!0x0);try{_0x417829=await _0x420d8a(_0x493c2a,_0x5c2957,_0x4a10a1,_0x552769,_0x389bf6);}catch(_0x11a092){if(_0x11a092 instanceof TypeError||_0x11a092 instanceof _0x20a9c5||_0x11a092 instanceof _0x43357e)throw _0x11a092;_0x417829=_0x4fa806(_0x214629);}try{_0x55549e=_0x14a576(_0xaa0b3f['iv']);}catch(_0x4aab94){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20iv');}try{_0x587dfa=_0x14a576(_0xaa0b3f['tag']);}catch(_0x257885){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20tag');}const _0x286178=_0x2ffac3['encode'](null!==(_0x10c3ee=_0xaa0b3f['protected'])&&void 0x0!==_0x10c3ee?_0x10c3ee:'');let _0x1ca713,_0xc49093;_0x1ca713=void 0x0!==_0xaa0b3f['aad']?_0x1896d1(_0x286178,_0x2ffac3['encode']('.'),_0x2ffac3['encode'](_0xaa0b3f['aad'])):_0x286178;try{_0xc49093=_0x14a576(_0xaa0b3f['ciphertext']);}catch(_0x5336fa){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20ciphertext');}let _0x36462f=await _0x2a52d6(_0x214629,_0x417829,_0xc49093,_0x55549e,_0x587dfa,_0x1ca713);'DEF'===_0x552769['zip']&&(_0x36462f=await((null==_0x389bf6?void 0x0:_0x389bf6['inflateRaw'])||_0x103b4f)(_0x36462f));const _0x5e22f3={'plaintext':_0x36462f};if(void 0x0!==_0xaa0b3f['protected']&&(_0x5e22f3['protectedHeader']=_0x28d6fb),void 0x0!==_0xaa0b3f['aad'])try{_0x5e22f3['additionalAuthenticatedData']=_0x14a576(_0xaa0b3f['aad']);}catch(_0x48ca8f){throw new _0x20a9c5('Failed\x20to\x20base64url\x20decode\x20the\x20aad');}return void 0x0!==_0xaa0b3f['unprotected']&&(_0x5e22f3['sharedUnprotectedHeader']=_0xaa0b3f['unprotected']),void 0x0!==_0xaa0b3f['header']&&(_0x5e22f3['unprotectedHeader']=_0xaa0b3f['header']),_0x3ae090?{..._0x5e22f3,'key':_0x5c2957}:_0x5e22f3;}async function _0x238b13(_0x15771c,_0x591735,_0x3240b3){if(_0x15771c instanceof Uint8Array&&(_0x15771c=_0x181173['decode'](_0x15771c)),'string'!=typeof _0x15771c)throw new _0x20a9c5('Compact\x20JWE\x20must\x20be\x20a\x20string\x20or\x20Uint8Array');const {0x0:_0x33a5f0,0x1:_0x6d1ace,0x2:_0x56ffa2,0x3:_0x71542a,0x4:_0x4cd6ba,length:_0x4cc403}=_0x15771c['split']('.');if(0x5!==_0x4cc403)throw new _0x20a9c5('Invalid\x20Compact\x20JWE');const _0x3af73b=await _0x3e2b24({'ciphertext':_0x71542a,'iv':_0x56ffa2||void 0x0,'protected':_0x33a5f0||void 0x0,'tag':_0x4cd6ba||void 0x0,'encrypted_key':_0x6d1ace||void 0x0},_0x591735,_0x3240b3),_0x30cfa6={'plaintext':_0x3af73b['plaintext'],'protectedHeader':_0x3af73b['protectedHeader']};return'function'==typeof _0x591735?{..._0x30cfa6,'key':_0x3af73b['key']}:_0x30cfa6;}async function _0xff1779(_0x339a4f,_0x4a1c89,_0x41d5b4){if(!_0x2df98d(_0x339a4f))throw new _0x20a9c5('General\x20JWE\x20must\x20be\x20an\x20object');if(!Array['isArray'](_0x339a4f['recipients'])||!_0x339a4f['recipients']['every'](_0x2df98d))throw new _0x20a9c5('JWE\x20Recipients\x20missing\x20or\x20incorrect\x20type');if(!_0x339a4f['recipients']['length'])throw new _0x20a9c5('JWE\x20Recipients\x20has\x20no\x20members');for(const _0x89f7e3 of _0x339a4f['recipients'])try{return await _0x3e2b24({'aad':_0x339a4f['aad'],'ciphertext':_0x339a4f['ciphertext'],'encrypted_key':_0x89f7e3['encrypted_key'],'header':_0x89f7e3['header'],'iv':_0x339a4f['iv'],'protected':_0x339a4f['protected'],'tag':_0x339a4f['tag'],'unprotected':_0x339a4f['unprotected']},_0x4a1c89,_0x41d5b4);}catch(_0x5e8c32){}throw new _0x48eb1d();}var _0xbc8197=async _0x245dbc=>{if(_0x245dbc instanceof Uint8Array)return{'kty':'oct','k':_0x40aa3c(_0x245dbc)};if(!_0x1b49a2(_0x245dbc))throw new TypeError(_0x3689c5(_0x245dbc,..._0x21a08d,'Uint8Array'));if(!_0x245dbc['extractable'])throw new TypeError('non-extractable\x20CryptoKey\x20cannot\x20be\x20exported\x20as\x20a\x20JWK');const {ext:_0x2a240c,key_ops:_0xe72f03,alg:_0x2486ad,use:_0x4041d4,..._0x5d8164}=await _0x298964['subtle']['exportKey']('jwk',_0x245dbc);return _0x5d8164;};async function _0x528fb2(_0x2570e1){return _0x46b07a(_0x2570e1);}async function _0x444dc3(_0x176d49){return _0x414f90(_0x176d49);}async function _0x510a24(_0x4dbdca){return _0xbc8197(_0x4dbdca);}var _0x26c926=async function(_0x12a504,_0x237c7c,_0xca32b7,_0x334fe8,_0x4622c4={}){let _0x421ab9,_0x1a8628,_0x5df316;switch(_0x2c2829(_0x12a504,_0xca32b7,'encrypt'),_0x12a504){case'dir':_0x5df316=_0xca32b7;break;case'ECDH-ES':case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':{if(!_0x2d7b6d(_0xca32b7))throw new _0x43357e('ECDH\x20with\x20the\x20provided\x20key\x20is\x20not\x20allowed\x20or\x20not\x20supported\x20by\x20your\x20javascript\x20runtime');const {apu:_0x16a1c2,apv:_0x2c733f}=_0x4622c4;let {epk:_0x3a45bd}=_0x4622c4;_0x3a45bd||(_0x3a45bd=(await async function(_0x5ba19d){if(!_0x1b49a2(_0x5ba19d))throw new TypeError(_0x3689c5(_0x5ba19d,..._0x21a08d));return _0x298964['subtle']['generateKey'](_0x5ba19d['algorithm'],!0x0,['deriveBits']);}(_0xca32b7))['privateKey']);const {x:_0x712bcc,y:_0x44076a,crv:_0x382fdd,kty:_0x39aca7}=await _0x510a24(_0x3a45bd),_0x2a797b=await _0x58b90e(_0xca32b7,_0x3a45bd,'ECDH-ES'===_0x12a504?_0x237c7c:_0x12a504,'ECDH-ES'===_0x12a504?_0x50278b(_0x237c7c):parseInt(_0x12a504['slice'](-0x5,-0x2),0xa),_0x16a1c2,_0x2c733f);if(_0x1a8628={'epk':{'x':_0x712bcc,'crv':_0x382fdd,'kty':_0x39aca7}},'EC'===_0x39aca7&&(_0x1a8628['epk']['y']=_0x44076a),_0x16a1c2&&(_0x1a8628['apu']=_0x40aa3c(_0x16a1c2)),_0x2c733f&&(_0x1a8628['apv']=_0x40aa3c(_0x2c733f)),'ECDH-ES'===_0x12a504){_0x5df316=_0x2a797b;break;}_0x5df316=_0x334fe8||_0x4fa806(_0x237c7c);const _0x4d0432=_0x12a504['slice'](-0x6);_0x421ab9=await _0x32461f(_0x4d0432,_0x2a797b,_0x5df316);break;}case'RSA1_5':case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':_0x5df316=_0x334fe8||_0x4fa806(_0x237c7c),_0x421ab9=await(async(_0x3e889f,_0x3b42b0,_0x13674e)=>{if(!_0x1b49a2(_0x3b42b0))throw new TypeError(_0x3689c5(_0x3b42b0,..._0x21a08d));if(_0x3e811d(_0x3b42b0,_0x3e889f,'encrypt','wrapKey'),_0x4bb262(_0x3e889f,_0x3b42b0),_0x3b42b0['usages']['includes']('encrypt'))return new Uint8Array(await _0x298964['subtle']['encrypt'](_0x3db9b8(_0x3e889f),_0x3b42b0,_0x13674e));if(_0x3b42b0['usages']['includes']('wrapKey')){const _0x5beff4=await _0x298964['subtle']['importKey']('raw',_0x13674e,..._0x4a3d7f);return new Uint8Array(await _0x298964['subtle']['wrapKey']('raw',_0x5beff4,_0x3b42b0,_0x3db9b8(_0x3e889f)));}throw new TypeError('RSA-OAEP\x20key\x20\x22usages\x22\x20must\x20include\x20\x22encrypt\x22\x20or\x20\x22wrapKey\x22\x20for\x20this\x20operation');})(_0x12a504,_0xca32b7,_0x5df316);break;case'PBES2-HS256+A128KW':case'PBES2-HS384+A192KW':case'PBES2-HS512+A256KW':{_0x5df316=_0x334fe8||_0x4fa806(_0x237c7c);const {p2c:_0x3ba929,p2s:_0x346ec2}=_0x4622c4;({encryptedKey:_0x421ab9,..._0x1a8628}=await(async(_0x47d378,_0x1e53db,_0x337f9a,_0x438009=0x800,_0x247009=_0xc75a16(new Uint8Array(0x10)))=>{const _0x1e00e7=await _0x275b39(_0x247009,_0x47d378,_0x438009,_0x1e53db);return{'encryptedKey':await _0x32461f(_0x47d378['slice'](-0x6),_0x1e00e7,_0x337f9a),'p2c':_0x438009,'p2s':_0x40aa3c(_0x247009)};})(_0x12a504,_0xca32b7,_0x5df316,_0x3ba929,_0x346ec2));break;}case'A128KW':case'A192KW':case'A256KW':_0x5df316=_0x334fe8||_0x4fa806(_0x237c7c),_0x421ab9=await _0x32461f(_0x12a504,_0xca32b7,_0x5df316);break;case'A128GCMKW':case'A192GCMKW':case'A256GCMKW':{_0x5df316=_0x334fe8||_0x4fa806(_0x237c7c);const {iv:_0x3a2cd3}=_0x4622c4;({encryptedKey:_0x421ab9,..._0x1a8628}=await async function(_0x1c7a7d,_0x18aaef,_0x5c1727,_0x59b688){const _0x4ae1e5=_0x1c7a7d['slice'](0x0,0x7);_0x59b688||(_0x59b688=_0x484091(_0x4ae1e5));const {ciphertext:_0x56fe21,tag:_0x2c2bb9}=await _0x4626a6(_0x4ae1e5,_0x5c1727,_0x18aaef,_0x59b688,new Uint8Array(0x0));return{'encryptedKey':_0x56fe21,'iv':_0x40aa3c(_0x59b688),'tag':_0x40aa3c(_0x2c2bb9)};}(_0x12a504,_0xca32b7,_0x5df316,_0x3a2cd3));break;}default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20\x22alg\x22\x20(JWE\x20Algorithm)\x20header\x20value');}return{'cek':_0x5df316,'encryptedKey':_0x421ab9,'parameters':_0x1a8628};};const _0x125731=Symbol();class _0x24b5fc{constructor(_0x8b36ff){if(!(_0x8b36ff instanceof Uint8Array))throw new TypeError('plaintext\x20must\x20be\x20an\x20instance\x20of\x20Uint8Array');this['_plaintext']=_0x8b36ff;}['setKeyManagementParameters'](_0x4c04b1){if(this['_keyManagementParameters'])throw new TypeError('setKeyManagementParameters\x20can\x20only\x20be\x20called\x20once');return this['_keyManagementParameters']=_0x4c04b1,this;}['setProtectedHeader'](_0x4792db){if(this['_protectedHeader'])throw new TypeError('setProtectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_protectedHeader']=_0x4792db,this;}['setSharedUnprotectedHeader'](_0x5ef105){if(this['_sharedUnprotectedHeader'])throw new TypeError('setSharedUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_sharedUnprotectedHeader']=_0x5ef105,this;}['setUnprotectedHeader'](_0x2fdc39){if(this['_unprotectedHeader'])throw new TypeError('setUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_unprotectedHeader']=_0x2fdc39,this;}['setAdditionalAuthenticatedData'](_0x38698d){return this['_aad']=_0x38698d,this;}['setContentEncryptionKey'](_0x250627){if(this['_cek'])throw new TypeError('setContentEncryptionKey\x20can\x20only\x20be\x20called\x20once');return this['_cek']=_0x250627,this;}['setInitializationVector'](_0x2511e0){if(this['_iv'])throw new TypeError('setInitializationVector\x20can\x20only\x20be\x20called\x20once');return this['_iv']=_0x2511e0,this;}async['encrypt'](_0x50c878,_0xd62be8){if(!this['_protectedHeader']&&!this['_unprotectedHeader']&&!this['_sharedUnprotectedHeader'])throw new _0x20a9c5('either\x20setProtectedHeader,\x20setUnprotectedHeader,\x20or\x20sharedUnprotectedHeader\x20must\x20be\x20called\x20before\x20#encrypt()');if(!_0x962264(this['_protectedHeader'],this['_unprotectedHeader'],this['_sharedUnprotectedHeader']))throw new _0x20a9c5('JWE\x20Protected,\x20JWE\x20Shared\x20Unprotected\x20and\x20JWE\x20Per-Recipient\x20Header\x20Parameter\x20names\x20must\x20be\x20disjoint');const _0xe1cd19={...this['_protectedHeader'],...this['_unprotectedHeader'],...this['_sharedUnprotectedHeader']};if(_0x4d166e(_0x20a9c5,new Map(),null==_0xd62be8?void 0x0:_0xd62be8['crit'],this['_protectedHeader'],_0xe1cd19),void 0x0!==_0xe1cd19['zip']){if(!this['_protectedHeader']||!this['_protectedHeader']['zip'])throw new _0x20a9c5('JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20MUST\x20be\x20integrity\x20protected');if('DEF'!==_0xe1cd19['zip'])throw new _0x43357e('Unsupported\x20JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20Parameter\x20value');}const {alg:_0x24dfc5,enc:_0x55ae86}=_0xe1cd19;if('string'!=typeof _0x24dfc5||!_0x24dfc5)throw new _0x20a9c5('JWE\x20\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');if('string'!=typeof _0x55ae86||!_0x55ae86)throw new _0x20a9c5('JWE\x20\x22enc\x22\x20(Encryption\x20Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');let _0xc86b7e,_0x16cc47,_0x4f16f0,_0x305c71,_0x597c6b,_0x301143,_0xe0e174;if('dir'===_0x24dfc5){if(this['_cek'])throw new TypeError('setContentEncryptionKey\x20cannot\x20be\x20called\x20when\x20using\x20Direct\x20Encryption');}else{if('ECDH-ES'===_0x24dfc5&&this['_cek'])throw new TypeError('setContentEncryptionKey\x20cannot\x20be\x20called\x20when\x20using\x20Direct\x20Key\x20Agreement');}{let _0x2e63eb;({cek:_0x16cc47,encryptedKey:_0xc86b7e,parameters:_0x2e63eb}=await _0x26c926(_0x24dfc5,_0x55ae86,_0x50c878,this['_cek'],this['_keyManagementParameters']),_0x2e63eb&&(_0xd62be8&&_0x125731 in _0xd62be8?this['_unprotectedHeader']?this['_unprotectedHeader']={...this['_unprotectedHeader'],..._0x2e63eb}:this['setUnprotectedHeader'](_0x2e63eb):this['_protectedHeader']?this['_protectedHeader']={...this['_protectedHeader'],..._0x2e63eb}:this['setProtectedHeader'](_0x2e63eb)));}if(this['_iv']||(this['_iv']=_0x484091(_0x55ae86)),_0x305c71=this['_protectedHeader']?_0x2ffac3['encode'](_0x40aa3c(JSON['stringify'](this['_protectedHeader']))):_0x2ffac3['encode'](''),this['_aad']?(_0x597c6b=_0x40aa3c(this['_aad']),_0x4f16f0=_0x1896d1(_0x305c71,_0x2ffac3['encode']('.'),_0x2ffac3['encode'](_0x597c6b))):_0x4f16f0=_0x305c71,'DEF'===_0xe1cd19['zip']){const _0x399380=await((null==_0xd62be8?void 0x0:_0xd62be8['deflateRaw'])||_0x485a5f)(this['_plaintext']);({ciphertext:_0x301143,tag:_0xe0e174}=await _0x4626a6(_0x55ae86,_0x399380,_0x16cc47,this['_iv'],_0x4f16f0));}else({ciphertext:_0x301143,tag:_0xe0e174}=await _0x4626a6(_0x55ae86,this['_plaintext'],_0x16cc47,this['_iv'],_0x4f16f0));const _0x1319fc={'ciphertext':_0x40aa3c(_0x301143),'iv':_0x40aa3c(this['_iv']),'tag':_0x40aa3c(_0xe0e174)};return _0xc86b7e&&(_0x1319fc['encrypted_key']=_0x40aa3c(_0xc86b7e)),_0x597c6b&&(_0x1319fc['aad']=_0x597c6b),this['_protectedHeader']&&(_0x1319fc['protected']=_0x181173['decode'](_0x305c71)),this['_sharedUnprotectedHeader']&&(_0x1319fc['unprotected']=this['_sharedUnprotectedHeader']),this['_unprotectedHeader']&&(_0x1319fc['header']=this['_unprotectedHeader']),_0x1319fc;}}class _0x1d1032{constructor(_0x496cd4,_0x4c81ec,_0x4425bb){this['parent']=_0x496cd4,this['key']=_0x4c81ec,this['options']=_0x4425bb;}['setUnprotectedHeader'](_0x4e4b89){if(this['unprotectedHeader'])throw new TypeError('setUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['unprotectedHeader']=_0x4e4b89,this;}['addRecipient'](..._0x1629de){return this['parent']['addRecipient'](..._0x1629de);}['encrypt'](..._0x24fe0d){return this['parent']['encrypt'](..._0x24fe0d);}['done'](){return this['parent'];}}class _0x15e0d2{constructor(_0x153182){this['_recipients']=[],this['_plaintext']=_0x153182;}['addRecipient'](_0x1c54e3,_0x2a8bbc){const _0x235185=new _0x1d1032(this,_0x1c54e3,{'crit':null==_0x2a8bbc?void 0x0:_0x2a8bbc['crit']});return this['_recipients']['push'](_0x235185),_0x235185;}['setProtectedHeader'](_0x42bce8){if(this['_protectedHeader'])throw new TypeError('setProtectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_protectedHeader']=_0x42bce8,this;}['setSharedUnprotectedHeader'](_0x191ffd){if(this['_unprotectedHeader'])throw new TypeError('setSharedUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_unprotectedHeader']=_0x191ffd,this;}['setAdditionalAuthenticatedData'](_0xda5f36){return this['_aad']=_0xda5f36,this;}async['encrypt'](_0x402bb5){var _0x3379ad,_0x1ec501,_0x2b5730;if(!this['_recipients']['length'])throw new _0x20a9c5('at\x20least\x20one\x20recipient\x20must\x20be\x20added');if(_0x402bb5={'deflateRaw':null==_0x402bb5?void 0x0:_0x402bb5['deflateRaw']},0x1===this['_recipients']['length']){const [_0x1242bc]=this['_recipients'],_0x4eba42=await new _0x24b5fc(this['_plaintext'])['setAdditionalAuthenticatedData'](this['_aad'])['setProtectedHeader'](this['_protectedHeader'])['setSharedUnprotectedHeader'](this['_unprotectedHeader'])['setUnprotectedHeader'](_0x1242bc['unprotectedHeader'])['encrypt'](_0x1242bc['key'],{..._0x1242bc['options'],..._0x402bb5});let _0x145244={'ciphertext':_0x4eba42['ciphertext'],'iv':_0x4eba42['iv'],'recipients':[{}],'tag':_0x4eba42['tag']};return _0x4eba42['aad']&&(_0x145244['aad']=_0x4eba42['aad']),_0x4eba42['protected']&&(_0x145244['protected']=_0x4eba42['protected']),_0x4eba42['unprotected']&&(_0x145244['unprotected']=_0x4eba42['unprotected']),_0x4eba42['encrypted_key']&&(_0x145244['recipients'][0x0]['encrypted_key']=_0x4eba42['encrypted_key']),_0x4eba42['header']&&(_0x145244['recipients'][0x0]['header']=_0x4eba42['header']),_0x145244;}let _0x3f3510;for(let _0x275f71=0x0;_0x275f71<this['_recipients']['length'];_0x275f71++){const _0x4d85dd=this['_recipients'][_0x275f71];if(!_0x962264(this['_protectedHeader'],this['_unprotectedHeader'],_0x4d85dd['unprotectedHeader']))throw new _0x20a9c5('JWE\x20Protected,\x20JWE\x20Shared\x20Unprotected\x20and\x20JWE\x20Per-Recipient\x20Header\x20Parameter\x20names\x20must\x20be\x20disjoint');const _0x42fdfd={...this['_protectedHeader'],...this['_unprotectedHeader'],..._0x4d85dd['unprotectedHeader']},{alg:_0x51bf61}=_0x42fdfd;if('string'!=typeof _0x51bf61||!_0x51bf61)throw new _0x20a9c5('JWE\x20\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');if('dir'===_0x51bf61||'ECDH-ES'===_0x51bf61)throw new _0x20a9c5('\x22dir\x22\x20and\x20\x22ECDH-ES\x22\x20alg\x20may\x20only\x20be\x20used\x20with\x20a\x20single\x20recipient');if('string'!=typeof _0x42fdfd['enc']||!_0x42fdfd['enc'])throw new _0x20a9c5('JWE\x20\x22enc\x22\x20(Encryption\x20Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');if(_0x3f3510){if(_0x3f3510!==_0x42fdfd['enc'])throw new _0x20a9c5('JWE\x20\x22enc\x22\x20(Encryption\x20Algorithm)\x20Header\x20Parameter\x20must\x20be\x20the\x20same\x20for\x20all\x20recipients');}else _0x3f3510=_0x42fdfd['enc'];if(_0x4d166e(_0x20a9c5,new Map(),_0x4d85dd['options']['crit'],this['_protectedHeader'],_0x42fdfd),!(void 0x0===_0x42fdfd['zip']||this['_protectedHeader']&&this['_protectedHeader']['zip']))throw new _0x20a9c5('JWE\x20\x22zip\x22\x20(Compression\x20Algorithm)\x20Header\x20MUST\x20be\x20integrity\x20protected');}const _0x9a21f8=_0x4fa806(_0x3f3510);let _0x54b910={'ciphertext':'','iv':'','recipients':[],'tag':''};for(let _0x546447=0x0;_0x546447<this['_recipients']['length'];_0x546447++){const _0x1f559b=this['_recipients'][_0x546447],_0x2700d3={};_0x54b910['recipients']['push'](_0x2700d3);const _0x4ff4cd={...this['_protectedHeader'],...this['_unprotectedHeader'],..._0x1f559b['unprotectedHeader']}['alg']['startsWith']('PBES2')?0x800+_0x546447:void 0x0;if(0x0===_0x546447){const _0x7f6763=await new _0x24b5fc(this['_plaintext'])['setAdditionalAuthenticatedData'](this['_aad'])['setContentEncryptionKey'](_0x9a21f8)['setProtectedHeader'](this['_protectedHeader'])['setSharedUnprotectedHeader'](this['_unprotectedHeader'])['setUnprotectedHeader'](_0x1f559b['unprotectedHeader'])['setKeyManagementParameters']({'p2c':_0x4ff4cd})['encrypt'](_0x1f559b['key'],{..._0x1f559b['options'],..._0x402bb5,[_0x125731]:!0x0});_0x54b910['ciphertext']=_0x7f6763['ciphertext'],_0x54b910['iv']=_0x7f6763['iv'],_0x54b910['tag']=_0x7f6763['tag'],_0x7f6763['aad']&&(_0x54b910['aad']=_0x7f6763['aad']),_0x7f6763['protected']&&(_0x54b910['protected']=_0x7f6763['protected']),_0x7f6763['unprotected']&&(_0x54b910['unprotected']=_0x7f6763['unprotected']),_0x2700d3['encrypted_key']=_0x7f6763['encrypted_key'],_0x7f6763['header']&&(_0x2700d3['header']=_0x7f6763['header']);continue;}const {encryptedKey:_0x18f990,parameters:_0x503461}=await _0x26c926((null===(_0x3379ad=_0x1f559b['unprotectedHeader'])||void 0x0===_0x3379ad?void 0x0:_0x3379ad['alg'])||(null===(_0x1ec501=this['_protectedHeader'])||void 0x0===_0x1ec501?void 0x0:_0x1ec501['alg'])||(null===(_0x2b5730=this['_unprotectedHeader'])||void 0x0===_0x2b5730?void 0x0:_0x2b5730['alg']),_0x3f3510,_0x1f559b['key'],_0x9a21f8,{'p2c':_0x4ff4cd});_0x2700d3['encrypted_key']=_0x40aa3c(_0x18f990),(_0x1f559b['unprotectedHeader']||_0x503461)&&(_0x2700d3['header']={..._0x1f559b['unprotectedHeader'],..._0x503461});}return _0x54b910;}}function _0x6bb767(_0x3bf507,_0x54df98){const _0x9dca34='SHA-'+_0x3bf507['slice'](-0x3);switch(_0x3bf507){case'HS256':case'HS384':case'HS512':return{'hash':_0x9dca34,'name':'HMAC'};case'PS256':case'PS384':case'PS512':return{'hash':_0x9dca34,'name':'RSA-PSS','saltLength':_0x3bf507['slice'](-0x3)>>0x3};case'RS256':case'RS384':case'RS512':return{'hash':_0x9dca34,'name':'RSASSA-PKCS1-v1_5'};case'ES256':case'ES384':case'ES512':return{'hash':_0x9dca34,'name':'ECDSA','namedCurve':_0x54df98['namedCurve']};case'EdDSA':return{'name':_0x54df98['name']};default:throw new _0x43357e('alg\x20'+_0x3bf507+'\x20is\x20not\x20supported\x20either\x20by\x20JOSE\x20or\x20your\x20javascript\x20runtime');}}function _0x2da7b3(_0x503750,_0x2e52d9,_0x24b556){if(_0x1b49a2(_0x2e52d9))return function(_0x3c973e,_0x54c5c7,..._0x56a00e){switch(_0x54c5c7){case'HS256':case'HS384':case'HS512':{if(!_0x595915(_0x3c973e['algorithm'],'HMAC'))throw _0x33917b('HMAC');const _0x47e1f1=parseInt(_0x54c5c7['slice'](0x2),0xa);if(_0x2cbeff(_0x3c973e['algorithm']['hash'])!==_0x47e1f1)throw _0x33917b('SHA-'+_0x47e1f1,'algorithm.hash');break;}case'RS256':case'RS384':case'RS512':{if(!_0x595915(_0x3c973e['algorithm'],'RSASSA-PKCS1-v1_5'))throw _0x33917b('RSASSA-PKCS1-v1_5');const _0x103d45=parseInt(_0x54c5c7['slice'](0x2),0xa);if(_0x2cbeff(_0x3c973e['algorithm']['hash'])!==_0x103d45)throw _0x33917b('SHA-'+_0x103d45,'algorithm.hash');break;}case'PS256':case'PS384':case'PS512':{if(!_0x595915(_0x3c973e['algorithm'],'RSA-PSS'))throw _0x33917b('RSA-PSS');const _0x382e1b=parseInt(_0x54c5c7['slice'](0x2),0xa);if(_0x2cbeff(_0x3c973e['algorithm']['hash'])!==_0x382e1b)throw _0x33917b('SHA-'+_0x382e1b,'algorithm.hash');break;}case'EdDSA':if('Ed25519'!==_0x3c973e['algorithm']['name']&&'Ed448'!==_0x3c973e['algorithm']['name'])throw _0x33917b('Ed25519\x20or\x20Ed448');break;case'ES256':case'ES384':case'ES512':{if(!_0x595915(_0x3c973e['algorithm'],'ECDSA'))throw _0x33917b('ECDSA');const _0x5059cc=function(_0x231cdb){switch(_0x231cdb){case'ES256':return'P-256';case'ES384':return'P-384';case'ES512':return'P-521';default:throw new Error('unreachable');}}(_0x54c5c7);if(_0x3c973e['algorithm']['namedCurve']!==_0x5059cc)throw _0x33917b(_0x5059cc,'algorithm.namedCurve');break;}default:throw new TypeError('CryptoKey\x20does\x20not\x20support\x20this\x20operation');}_0x7fa827(_0x3c973e,_0x56a00e);}(_0x2e52d9,_0x503750,_0x24b556),_0x2e52d9;if(_0x2e52d9 instanceof Uint8Array){if(!_0x503750['startsWith']('HS'))throw new TypeError(_0x3689c5(_0x2e52d9,..._0x21a08d));return _0x298964['subtle']['importKey']('raw',_0x2e52d9,{'hash':'SHA-'+_0x503750['slice'](-0x3),'name':'HMAC'},!0x1,[_0x24b556]);}throw new TypeError(_0x3689c5(_0x2e52d9,..._0x21a08d,'Uint8Array'));}var _0x18cf17=async(_0x49dd27,_0x7dd3d5,_0x4ccbec,_0x366436)=>{const _0x521c3d=await _0x2da7b3(_0x49dd27,_0x7dd3d5,'verify');_0x4bb262(_0x49dd27,_0x521c3d);const _0x4dea05=_0x6bb767(_0x49dd27,_0x521c3d['algorithm']);try{return await _0x298964['subtle']['verify'](_0x4dea05,_0x521c3d,_0x4ccbec,_0x366436);}catch(_0x2d4fdf){return!0x1;}};async function _0x5679fa(_0x497b10,_0x444273,_0x176753){var _0x5b263e;if(!_0x2df98d(_0x497b10))throw new _0x43db8a('Flattened\x20JWS\x20must\x20be\x20an\x20object');if(void 0x0===_0x497b10['protected']&&void 0x0===_0x497b10['header'])throw new _0x43db8a('Flattened\x20JWS\x20must\x20have\x20either\x20of\x20the\x20\x22protected\x22\x20or\x20\x22header\x22\x20members');if(void 0x0!==_0x497b10['protected']&&'string'!=typeof _0x497b10['protected'])throw new _0x43db8a('JWS\x20Protected\x20Header\x20incorrect\x20type');if(void 0x0===_0x497b10['payload'])throw new _0x43db8a('JWS\x20Payload\x20missing');if('string'!=typeof _0x497b10['signature'])throw new _0x43db8a('JWS\x20Signature\x20missing\x20or\x20incorrect\x20type');if(void 0x0!==_0x497b10['header']&&!_0x2df98d(_0x497b10['header']))throw new _0x43db8a('JWS\x20Unprotected\x20Header\x20incorrect\x20type');let _0x466c84={};if(_0x497b10['protected'])try{const _0x353e7c=_0x14a576(_0x497b10['protected']);_0x466c84=JSON['parse'](_0x181173['decode'](_0x353e7c));}catch(_0x458b09){throw new _0x43db8a('JWS\x20Protected\x20Header\x20is\x20invalid');}if(!_0x962264(_0x466c84,_0x497b10['header']))throw new _0x43db8a('JWS\x20Protected\x20and\x20JWS\x20Unprotected\x20Header\x20Parameter\x20names\x20must\x20be\x20disjoint');const _0x496b3d={..._0x466c84,..._0x497b10['header']};let _0x54af95=!0x0;if(_0x4d166e(_0x43db8a,new Map([['b64',!0x0]]),null==_0x176753?void 0x0:_0x176753['crit'],_0x466c84,_0x496b3d)['has']('b64')&&(_0x54af95=_0x466c84['b64'],'boolean'!=typeof _0x54af95))throw new _0x43db8a('The\x20\x22b64\x22\x20(base64url-encode\x20payload)\x20Header\x20Parameter\x20must\x20be\x20a\x20boolean');const {alg:_0x586767}=_0x496b3d;if('string'!=typeof _0x586767||!_0x586767)throw new _0x43db8a('JWS\x20\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');const _0x14b7c2=_0x176753&&_0xf4fbee('algorithms',_0x176753['algorithms']);if(_0x14b7c2&&!_0x14b7c2['has'](_0x586767))throw new _0x14032b('\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20not\x20allowed');if(_0x54af95){if('string'!=typeof _0x497b10['payload'])throw new _0x43db8a('JWS\x20Payload\x20must\x20be\x20a\x20string');}else{if('string'!=typeof _0x497b10['payload']&&!(_0x497b10['payload']instanceof Uint8Array))throw new _0x43db8a('JWS\x20Payload\x20must\x20be\x20a\x20string\x20or\x20an\x20Uint8Array\x20instance');}let _0x586163=!0x1;'function'==typeof _0x444273&&(_0x444273=await _0x444273(_0x466c84,_0x497b10),_0x586163=!0x0),_0x2c2829(_0x586767,_0x444273,'verify');const _0x51c2c6=_0x1896d1(_0x2ffac3['encode'](null!==(_0x5b263e=_0x497b10['protected'])&&void 0x0!==_0x5b263e?_0x5b263e:''),_0x2ffac3['encode']('.'),'string'==typeof _0x497b10['payload']?_0x2ffac3['encode'](_0x497b10['payload']):_0x497b10['payload']);let _0x2ceaab,_0xf1fa36;try{_0x2ceaab=_0x14a576(_0x497b10['signature']);}catch(_0x112d4){throw new _0x43db8a('Failed\x20to\x20base64url\x20decode\x20the\x20signature');}if(!await _0x18cf17(_0x586767,_0x444273,_0x2ceaab,_0x51c2c6))throw new _0x16e931();if(_0x54af95)try{_0xf1fa36=_0x14a576(_0x497b10['payload']);}catch(_0x5cf574){throw new _0x43db8a('Failed\x20to\x20base64url\x20decode\x20the\x20payload');}else _0xf1fa36='string'==typeof _0x497b10['payload']?_0x2ffac3['encode'](_0x497b10['payload']):_0x497b10['payload'];const _0x500495={'payload':_0xf1fa36};return void 0x0!==_0x497b10['protected']&&(_0x500495['protectedHeader']=_0x466c84),void 0x0!==_0x497b10['header']&&(_0x500495['unprotectedHeader']=_0x497b10['header']),_0x586163?{..._0x500495,'key':_0x444273}:_0x500495;}async function _0x48b602(_0x4cbdb2,_0x48dbb7,_0x3346c5){if(_0x4cbdb2 instanceof Uint8Array&&(_0x4cbdb2=_0x181173['decode'](_0x4cbdb2)),'string'!=typeof _0x4cbdb2)throw new _0x43db8a('Compact\x20JWS\x20must\x20be\x20a\x20string\x20or\x20Uint8Array');const {0x0:_0x151999,0x1:_0x460bb8,0x2:_0x33b589,length:_0xa4342d}=_0x4cbdb2['split']('.');if(0x3!==_0xa4342d)throw new _0x43db8a('Invalid\x20Compact\x20JWS');const _0x5b8ac5=await _0x5679fa({'payload':_0x460bb8,'protected':_0x151999,'signature':_0x33b589},_0x48dbb7,_0x3346c5),_0x54b590={'payload':_0x5b8ac5['payload'],'protectedHeader':_0x5b8ac5['protectedHeader']};return'function'==typeof _0x48dbb7?{..._0x54b590,'key':_0x5b8ac5['key']}:_0x54b590;}async function _0x3df2c6(_0x1f9c47,_0x5cf5bd,_0x518fd0){if(!_0x2df98d(_0x1f9c47))throw new _0x43db8a('General\x20JWS\x20must\x20be\x20an\x20object');if(!Array['isArray'](_0x1f9c47['signatures'])||!_0x1f9c47['signatures']['every'](_0x2df98d))throw new _0x43db8a('JWS\x20Signatures\x20missing\x20or\x20incorrect\x20type');for(const _0x3d6b57 of _0x1f9c47['signatures'])try{return await _0x5679fa({'header':_0x3d6b57['header'],'payload':_0x1f9c47['payload'],'protected':_0x3d6b57['protected'],'signature':_0x3d6b57['signature']},_0x5cf5bd,_0x518fd0);}catch(_0x536a2b){}throw new _0x16e931();}var _0x1d9d0e=_0x5916d7=>Math['floor'](_0x5916d7['getTime']()/0x3e8);const _0x5b1657=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;var _0x59186e=_0x19e294=>{const _0x1f2faa=_0x5b1657['exec'](_0x19e294);if(!_0x1f2faa)throw new TypeError('Invalid\x20time\x20period\x20format');const _0xce510d=parseFloat(_0x1f2faa[0x1]);switch(_0x1f2faa[0x2]['toLowerCase']()){case'sec':case'secs':case'second':case'seconds':case's':return Math['round'](_0xce510d);case'minute':case'minutes':case'min':case'mins':case'm':return Math['round'](0x3c*_0xce510d);case'hour':case'hours':case'hr':case'hrs':case'h':return Math['round'](0xe10*_0xce510d);case'day':case'days':case'd':return Math['round'](0x15180*_0xce510d);case'week':case'weeks':case'w':return Math['round'](0x93a80*_0xce510d);default:return Math['round'](0x1e187e0*_0xce510d);}};const _0x45c5cc=_0x11fb54=>_0x11fb54['toLowerCase']()['replace'](/^application\//,'');var _0xc430d9=(_0x5d1200,_0x491297,_0x2d5ffe={})=>{const {typ:_0x14204e}=_0x2d5ffe;if(_0x14204e&&('string'!=typeof _0x5d1200['typ']||_0x45c5cc(_0x5d1200['typ'])!==_0x45c5cc(_0x14204e)))throw new _0x233f4f('unexpected\x20\x22typ\x22\x20JWT\x20header\x20value','typ','check_failed');let _0x5a563f;try{_0x5a563f=JSON['parse'](_0x181173['decode'](_0x491297));}catch(_0x17f44a){}if(!_0x2df98d(_0x5a563f))throw new _0x4c6a3d('JWT\x20Claims\x20Set\x20must\x20be\x20a\x20top-level\x20JSON\x20object');const {requiredClaims:_0x2cddd9=[],issuer:_0x5929d0,subject:_0x93d3c8,audience:_0xd0d63a,maxTokenAge:_0x4b71dc}=_0x2d5ffe;void 0x0!==_0x4b71dc&&_0x2cddd9['push']('iat'),void 0x0!==_0xd0d63a&&_0x2cddd9['push']('aud'),void 0x0!==_0x93d3c8&&_0x2cddd9['push']('sub'),void 0x0!==_0x5929d0&&_0x2cddd9['push']('iss');for(const _0x1ab33f of new Set(_0x2cddd9['reverse']()))if(!(_0x1ab33f in _0x5a563f))throw new _0x233f4f('missing\x20required\x20\x22'+_0x1ab33f+'\x22\x20claim',_0x1ab33f,'missing');if(_0x5929d0&&!(Array['isArray'](_0x5929d0)?_0x5929d0:[_0x5929d0])['includes'](_0x5a563f['iss']))throw new _0x233f4f('unexpected\x20\x22iss\x22\x20claim\x20value','iss','check_failed');if(_0x93d3c8&&_0x5a563f['sub']!==_0x93d3c8)throw new _0x233f4f('unexpected\x20\x22sub\x22\x20claim\x20value','sub','check_failed');if(_0xd0d63a&&(_0x4d8f54='string'==typeof _0xd0d63a?[_0xd0d63a]:_0xd0d63a,!('string'==typeof(_0x1aa8d2=_0x5a563f['aud'])?_0x4d8f54['includes'](_0x1aa8d2):Array['isArray'](_0x1aa8d2)&&_0x4d8f54['some'](Set['prototype']['has']['bind'](new Set(_0x1aa8d2))))))throw new _0x233f4f('unexpected\x20\x22aud\x22\x20claim\x20value','aud','check_failed');var _0x1aa8d2,_0x4d8f54;let _0x3d9846;switch(typeof _0x2d5ffe['clockTolerance']){case'string':_0x3d9846=_0x59186e(_0x2d5ffe['clockTolerance']);break;case'number':_0x3d9846=_0x2d5ffe['clockTolerance'];break;case'undefined':_0x3d9846=0x0;break;default:throw new TypeError('Invalid\x20clockTolerance\x20option\x20type');}const {currentDate:_0x2d0752}=_0x2d5ffe,_0x576b0e=_0x1d9d0e(_0x2d0752||new Date());if((void 0x0!==_0x5a563f['iat']||_0x4b71dc)&&'number'!=typeof _0x5a563f['iat'])throw new _0x233f4f('\x22iat\x22\x20claim\x20must\x20be\x20a\x20number','iat','invalid');if(void 0x0!==_0x5a563f['nbf']){if('number'!=typeof _0x5a563f['nbf'])throw new _0x233f4f('\x22nbf\x22\x20claim\x20must\x20be\x20a\x20number','nbf','invalid');if(_0x5a563f['nbf']>_0x576b0e+_0x3d9846)throw new _0x233f4f('\x22nbf\x22\x20claim\x20timestamp\x20check\x20failed','nbf','check_failed');}if(void 0x0!==_0x5a563f['exp']){if('number'!=typeof _0x5a563f['exp'])throw new _0x233f4f('\x22exp\x22\x20claim\x20must\x20be\x20a\x20number','exp','invalid');if(_0x5a563f['exp']<=_0x576b0e-_0x3d9846)throw new _0x49149a('\x22exp\x22\x20claim\x20timestamp\x20check\x20failed','exp','check_failed');}if(_0x4b71dc){const _0x58bd59=_0x576b0e-_0x5a563f['iat'];if(_0x58bd59-_0x3d9846>('number'==typeof _0x4b71dc?_0x4b71dc:_0x59186e(_0x4b71dc)))throw new _0x49149a('\x22iat\x22\x20claim\x20timestamp\x20check\x20failed\x20(too\x20far\x20in\x20the\x20past)','iat','check_failed');if(_0x58bd59<0x0-_0x3d9846)throw new _0x233f4f('\x22iat\x22\x20claim\x20timestamp\x20check\x20failed\x20(it\x20should\x20be\x20in\x20the\x20past)','iat','check_failed');}return _0x5a563f;};async function _0x24d544(_0x3f10b1,_0x185bb3,_0x3a1f9a){var _0x2c5ea8;const _0x92a5=await _0x48b602(_0x3f10b1,_0x185bb3,_0x3a1f9a);if((null===(_0x2c5ea8=_0x92a5['protectedHeader']['crit'])||void 0x0===_0x2c5ea8?void 0x0:_0x2c5ea8['includes']('b64'))&&!0x1===_0x92a5['protectedHeader']['b64'])throw new _0x4c6a3d('JWTs\x20MUST\x20NOT\x20use\x20unencoded\x20payload');const _0x47e91d={'payload':_0xc430d9(_0x92a5['protectedHeader'],_0x92a5['payload'],_0x3a1f9a),'protectedHeader':_0x92a5['protectedHeader']};return'function'==typeof _0x185bb3?{..._0x47e91d,'key':_0x92a5['key']}:_0x47e91d;}async function _0x3c0b0c(_0x3ddf72,_0x10e920,_0x3a7b82){const _0x4f5a00=await _0x238b13(_0x3ddf72,_0x10e920,_0x3a7b82),_0x22ac63=_0xc430d9(_0x4f5a00['protectedHeader'],_0x4f5a00['plaintext'],_0x3a7b82),{protectedHeader:_0x268d76}=_0x4f5a00;if(void 0x0!==_0x268d76['iss']&&_0x268d76['iss']!==_0x22ac63['iss'])throw new _0x233f4f('replicated\x20\x22iss\x22\x20claim\x20header\x20parameter\x20mismatch','iss','mismatch');if(void 0x0!==_0x268d76['sub']&&_0x268d76['sub']!==_0x22ac63['sub'])throw new _0x233f4f('replicated\x20\x22sub\x22\x20claim\x20header\x20parameter\x20mismatch','sub','mismatch');if(void 0x0!==_0x268d76['aud']&&JSON['stringify'](_0x268d76['aud'])!==JSON['stringify'](_0x22ac63['aud']))throw new _0x233f4f('replicated\x20\x22aud\x22\x20claim\x20header\x20parameter\x20mismatch','aud','mismatch');const _0x55d6d7={'payload':_0x22ac63,'protectedHeader':_0x268d76};return'function'==typeof _0x10e920?{..._0x55d6d7,'key':_0x4f5a00['key']}:_0x55d6d7;}class _0x56f3b7{constructor(_0x40c04e){this['_flattened']=new _0x24b5fc(_0x40c04e);}['setContentEncryptionKey'](_0x54c10f){return this['_flattened']['setContentEncryptionKey'](_0x54c10f),this;}['setInitializationVector'](_0xd5df3d){return this['_flattened']['setInitializationVector'](_0xd5df3d),this;}['setProtectedHeader'](_0x5d0a5e){return this['_flattened']['setProtectedHeader'](_0x5d0a5e),this;}['setKeyManagementParameters'](_0x47fe40){return this['_flattened']['setKeyManagementParameters'](_0x47fe40),this;}async['encrypt'](_0x4bd377,_0xdf4f0){const _0x474684=await this['_flattened']['encrypt'](_0x4bd377,_0xdf4f0);return[_0x474684['protected'],_0x474684['encrypted_key'],_0x474684['iv'],_0x474684['ciphertext'],_0x474684['tag']]['join']('.');}}class _0x53f870{constructor(_0x312b9e){if(!(_0x312b9e instanceof Uint8Array))throw new TypeError('payload\x20must\x20be\x20an\x20instance\x20of\x20Uint8Array');this['_payload']=_0x312b9e;}['setProtectedHeader'](_0x32f03a){if(this['_protectedHeader'])throw new TypeError('setProtectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_protectedHeader']=_0x32f03a,this;}['setUnprotectedHeader'](_0x49e1da){if(this['_unprotectedHeader'])throw new TypeError('setUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_unprotectedHeader']=_0x49e1da,this;}async['sign'](_0x35a762,_0x5d0715){if(!this['_protectedHeader']&&!this['_unprotectedHeader'])throw new _0x43db8a('either\x20setProtectedHeader\x20or\x20setUnprotectedHeader\x20must\x20be\x20called\x20before\x20#sign()');if(!_0x962264(this['_protectedHeader'],this['_unprotectedHeader']))throw new _0x43db8a('JWS\x20Protected\x20and\x20JWS\x20Unprotected\x20Header\x20Parameter\x20names\x20must\x20be\x20disjoint');const _0x2d7538={...this['_protectedHeader'],...this['_unprotectedHeader']};let _0x533f2a=!0x0;if(_0x4d166e(_0x43db8a,new Map([['b64',!0x0]]),null==_0x5d0715?void 0x0:_0x5d0715['crit'],this['_protectedHeader'],_0x2d7538)['has']('b64')&&(_0x533f2a=this['_protectedHeader']['b64'],'boolean'!=typeof _0x533f2a))throw new _0x43db8a('The\x20\x22b64\x22\x20(base64url-encode\x20payload)\x20Header\x20Parameter\x20must\x20be\x20a\x20boolean');const {alg:_0x307e4e}=_0x2d7538;if('string'!=typeof _0x307e4e||!_0x307e4e)throw new _0x43db8a('JWS\x20\x22alg\x22\x20(Algorithm)\x20Header\x20Parameter\x20missing\x20or\x20invalid');_0x2c2829(_0x307e4e,_0x35a762,'sign');let _0x9f1c8d,_0x5c4d1a=this['_payload'];_0x533f2a&&(_0x5c4d1a=_0x2ffac3['encode'](_0x40aa3c(_0x5c4d1a))),_0x9f1c8d=this['_protectedHeader']?_0x2ffac3['encode'](_0x40aa3c(JSON['stringify'](this['_protectedHeader']))):_0x2ffac3['encode']('');const _0x37abf2=_0x1896d1(_0x9f1c8d,_0x2ffac3['encode']('.'),_0x5c4d1a),_0x2311bd=await(async(_0x163a9a,_0x3417a6,_0x5e664c)=>{const _0xe2dd52=await _0x2da7b3(_0x163a9a,_0x3417a6,'sign');_0x4bb262(_0x163a9a,_0xe2dd52);const _0x19795f=await _0x298964['subtle']['sign'](_0x6bb767(_0x163a9a,_0xe2dd52['algorithm']),_0xe2dd52,_0x5e664c);return new Uint8Array(_0x19795f);})(_0x307e4e,_0x35a762,_0x37abf2),_0x3883d1={'signature':_0x40aa3c(_0x2311bd),'payload':''};return _0x533f2a&&(_0x3883d1['payload']=_0x181173['decode'](_0x5c4d1a)),this['_unprotectedHeader']&&(_0x3883d1['header']=this['_unprotectedHeader']),this['_protectedHeader']&&(_0x3883d1['protected']=_0x181173['decode'](_0x9f1c8d)),_0x3883d1;}}class _0x24afe3{constructor(_0x5a23c1){this['_flattened']=new _0x53f870(_0x5a23c1);}['setProtectedHeader'](_0x139da2){return this['_flattened']['setProtectedHeader'](_0x139da2),this;}async['sign'](_0x39b128,_0x59af94){const _0x1c1ee5=await this['_flattened']['sign'](_0x39b128,_0x59af94);if(void 0x0===_0x1c1ee5['payload'])throw new TypeError('use\x20the\x20flattened\x20module\x20for\x20creating\x20JWS\x20with\x20b64:\x20false');return _0x1c1ee5['protected']+'.'+_0x1c1ee5['payload']+'.'+_0x1c1ee5['signature'];}}class _0x4b9d70{constructor(_0x2e8356,_0x578a11,_0x26556b){this['parent']=_0x2e8356,this['key']=_0x578a11,this['options']=_0x26556b;}['setProtectedHeader'](_0x46b85e){if(this['protectedHeader'])throw new TypeError('setProtectedHeader\x20can\x20only\x20be\x20called\x20once');return this['protectedHeader']=_0x46b85e,this;}['setUnprotectedHeader'](_0x5d390b){if(this['unprotectedHeader'])throw new TypeError('setUnprotectedHeader\x20can\x20only\x20be\x20called\x20once');return this['unprotectedHeader']=_0x5d390b,this;}['addSignature'](..._0x362e35){return this['parent']['addSignature'](..._0x362e35);}['sign'](..._0x405602){return this['parent']['sign'](..._0x405602);}['done'](){return this['parent'];}}class _0x4ff54a{constructor(_0x446b18){this['_signatures']=[],this['_payload']=_0x446b18;}['addSignature'](_0x4d9a01,_0x556361){const _0x39f14d=new _0x4b9d70(this,_0x4d9a01,_0x556361);return this['_signatures']['push'](_0x39f14d),_0x39f14d;}async['sign'](){if(!this['_signatures']['length'])throw new _0x43db8a('at\x20least\x20one\x20signature\x20must\x20be\x20added');const _0x4dc658={'signatures':[],'payload':''};for(let _0x2f03d2=0x0;_0x2f03d2<this['_signatures']['length'];_0x2f03d2++){const _0x3e24f9=this['_signatures'][_0x2f03d2],_0x2acb5e=new _0x53f870(this['_payload']);_0x2acb5e['setProtectedHeader'](_0x3e24f9['protectedHeader']),_0x2acb5e['setUnprotectedHeader'](_0x3e24f9['unprotectedHeader']);const {payload:_0x3500f1,..._0x13bfda}=await _0x2acb5e['sign'](_0x3e24f9['key'],_0x3e24f9['options']);if(0x0===_0x2f03d2)_0x4dc658['payload']=_0x3500f1;else{if(_0x4dc658['payload']!==_0x3500f1)throw new _0x43db8a('inconsistent\x20use\x20of\x20JWS\x20Unencoded\x20Payload\x20(RFC7797)');}_0x4dc658['signatures']['push'](_0x13bfda);}return _0x4dc658;}}class _0x1cbf8f{constructor(_0x2fa5ce){if(!_0x2df98d(_0x2fa5ce))throw new TypeError('JWT\x20Claims\x20Set\x20MUST\x20be\x20an\x20object');this['_payload']=_0x2fa5ce;}['setIssuer'](_0x1f574b){return this['_payload']={...this['_payload'],'iss':_0x1f574b},this;}['setSubject'](_0x4b8c94){return this['_payload']={...this['_payload'],'sub':_0x4b8c94},this;}['setAudience'](_0x224a88){return this['_payload']={...this['_payload'],'aud':_0x224a88},this;}['setJti'](_0x3802a1){return this['_payload']={...this['_payload'],'jti':_0x3802a1},this;}['setNotBefore'](_0x379981){return this['_payload']='number'==typeof _0x379981?{...this['_payload'],'nbf':_0x379981}:{...this['_payload'],'nbf':_0x1d9d0e(new Date())+_0x59186e(_0x379981)},this;}['setExpirationTime'](_0x529e9c){return this['_payload']='number'==typeof _0x529e9c?{...this['_payload'],'exp':_0x529e9c}:{...this['_payload'],'exp':_0x1d9d0e(new Date())+_0x59186e(_0x529e9c)},this;}['setIssuedAt'](_0x2b222a){return this['_payload']=void 0x0===_0x2b222a?{...this['_payload'],'iat':_0x1d9d0e(new Date())}:{...this['_payload'],'iat':_0x2b222a},this;}}class _0x4d762b extends _0x1cbf8f{['setProtectedHeader'](_0x191e64){return this['_protectedHeader']=_0x191e64,this;}async['sign'](_0x127de0,_0x823af){var _0x41b7d9;const _0x8914b2=new _0x24afe3(_0x2ffac3['encode'](JSON['stringify'](this['_payload'])));if(_0x8914b2['setProtectedHeader'](this['_protectedHeader']),Array['isArray'](null===(_0x41b7d9=this['_protectedHeader'])||void 0x0===_0x41b7d9?void 0x0:_0x41b7d9['crit'])&&this['_protectedHeader']['crit']['includes']('b64')&&!0x1===this['_protectedHeader']['b64'])throw new _0x4c6a3d('JWTs\x20MUST\x20NOT\x20use\x20unencoded\x20payload');return _0x8914b2['sign'](_0x127de0,_0x823af);}}class _0x406eaa extends _0x1cbf8f{['setProtectedHeader'](_0x770683){if(this['_protectedHeader'])throw new TypeError('setProtectedHeader\x20can\x20only\x20be\x20called\x20once');return this['_protectedHeader']=_0x770683,this;}['setKeyManagementParameters'](_0x536e0b){if(this['_keyManagementParameters'])throw new TypeError('setKeyManagementParameters\x20can\x20only\x20be\x20called\x20once');return this['_keyManagementParameters']=_0x536e0b,this;}['setContentEncryptionKey'](_0xc99ab9){if(this['_cek'])throw new TypeError('setContentEncryptionKey\x20can\x20only\x20be\x20called\x20once');return this['_cek']=_0xc99ab9,this;}['setInitializationVector'](_0x4e910e){if(this['_iv'])throw new TypeError('setInitializationVector\x20can\x20only\x20be\x20called\x20once');return this['_iv']=_0x4e910e,this;}['replicateIssuerAsHeader'](){return this['_replicateIssuerAsHeader']=!0x0,this;}['replicateSubjectAsHeader'](){return this['_replicateSubjectAsHeader']=!0x0,this;}['replicateAudienceAsHeader'](){return this['_replicateAudienceAsHeader']=!0x0,this;}async['encrypt'](_0x53c0ae,_0xe8eeed){const _0x571c1f=new _0x56f3b7(_0x2ffac3['encode'](JSON['stringify'](this['_payload'])));return this['_replicateIssuerAsHeader']&&(this['_protectedHeader']={...this['_protectedHeader'],'iss':this['_payload']['iss']}),this['_replicateSubjectAsHeader']&&(this['_protectedHeader']={...this['_protectedHeader'],'sub':this['_payload']['sub']}),this['_replicateAudienceAsHeader']&&(this['_protectedHeader']={...this['_protectedHeader'],'aud':this['_payload']['aud']}),_0x571c1f['setProtectedHeader'](this['_protectedHeader']),this['_iv']&&_0x571c1f['setInitializationVector'](this['_iv']),this['_cek']&&_0x571c1f['setContentEncryptionKey'](this['_cek']),this['_keyManagementParameters']&&_0x571c1f['setKeyManagementParameters'](this['_keyManagementParameters']),_0x571c1f['encrypt'](_0x53c0ae,_0xe8eeed);}}const _0x2c6d7b=(_0x3fd837,_0x4c4966)=>{if('string'!=typeof _0x3fd837||!_0x3fd837)throw new _0x3bf453(_0x4c4966+'\x20missing\x20or\x20invalid');};async function _0x4a3439(_0x54831f,_0x4430f4){if(!_0x2df98d(_0x54831f))throw new TypeError('JWK\x20must\x20be\x20an\x20object');if(null!=_0x4430f4||(_0x4430f4='sha256'),'sha256'!==_0x4430f4&&'sha384'!==_0x4430f4&&'sha512'!==_0x4430f4)throw new TypeError('digestAlgorithm\x20must\x20one\x20of\x20\x22sha256\x22,\x20\x22sha384\x22,\x20or\x20\x22sha512\x22');let _0x11fd7b;switch(_0x54831f['kty']){case'EC':_0x2c6d7b(_0x54831f['crv'],'\x22crv\x22\x20(Curve)\x20Parameter'),_0x2c6d7b(_0x54831f['x'],'\x22x\x22\x20(X\x20Coordinate)\x20Parameter'),_0x2c6d7b(_0x54831f['y'],'\x22y\x22\x20(Y\x20Coordinate)\x20Parameter'),_0x11fd7b={'crv':_0x54831f['crv'],'kty':_0x54831f['kty'],'x':_0x54831f['x'],'y':_0x54831f['y']};break;case'OKP':_0x2c6d7b(_0x54831f['crv'],'\x22crv\x22\x20(Subtype\x20of\x20Key\x20Pair)\x20Parameter'),_0x2c6d7b(_0x54831f['x'],'\x22x\x22\x20(Public\x20Key)\x20Parameter'),_0x11fd7b={'crv':_0x54831f['crv'],'kty':_0x54831f['kty'],'x':_0x54831f['x']};break;case'RSA':_0x2c6d7b(_0x54831f['e'],'\x22e\x22\x20(Exponent)\x20Parameter'),_0x2c6d7b(_0x54831f['n'],'\x22n\x22\x20(Modulus)\x20Parameter'),_0x11fd7b={'e':_0x54831f['e'],'kty':_0x54831f['kty'],'n':_0x54831f['n']};break;case'oct':_0x2c6d7b(_0x54831f['k'],'\x22k\x22\x20(Key\x20Value)\x20Parameter'),_0x11fd7b={'k':_0x54831f['k'],'kty':_0x54831f['kty']};break;default:throw new _0x43357e('\x22kty\x22\x20(Key\x20Type)\x20Parameter\x20missing\x20or\x20unsupported');}const _0x378458=_0x2ffac3['encode'](JSON['stringify'](_0x11fd7b));return _0x40aa3c(await _0x3015b8(_0x4430f4,_0x378458));}async function _0x1eee3e(_0x8f5271,_0x19eb6f){null!=_0x19eb6f||(_0x19eb6f='sha256');const _0x3bec9c=await _0x4a3439(_0x8f5271,_0x19eb6f);return'urn:ietf:params:oauth:jwk-thumbprint:sha-'+_0x19eb6f['slice'](-0x3)+':'+_0x3bec9c;}async function _0x191649(_0x24e482,_0x5ca1b5){const _0x3e176a={..._0x24e482,...null==_0x5ca1b5?void 0x0:_0x5ca1b5['header']};if(!_0x2df98d(_0x3e176a['jwk']))throw new _0x43db8a('\x22jwk\x22\x20(JSON\x20Web\x20Key)\x20Header\x20Parameter\x20must\x20be\x20a\x20JSON\x20object');const _0x53cd87=await _0x28f7a6({..._0x3e176a['jwk'],'ext':!0x0},_0x3e176a['alg'],!0x0);if(_0x53cd87 instanceof Uint8Array||'public'!==_0x53cd87['type'])throw new _0x43db8a('\x22jwk\x22\x20(JSON\x20Web\x20Key)\x20Header\x20Parameter\x20must\x20be\x20a\x20public\x20key');return _0x53cd87;}function _0x25f170(_0x22b047){return _0x22b047&&'object'==typeof _0x22b047&&Array['isArray'](_0x22b047['keys'])&&_0x22b047['keys']['every'](_0x41b875);}function _0x41b875(_0x3d73df){return _0x2df98d(_0x3d73df);}class _0x2a6591{constructor(_0x3363c6){if(this['_cached']=new WeakMap(),!_0x25f170(_0x3363c6))throw new _0x31c0ee('JSON\x20Web\x20Key\x20Set\x20malformed');var _0x3be2a0;this['_jwks']=(_0x3be2a0=_0x3363c6,'function'==typeof structuredClone?structuredClone(_0x3be2a0):JSON['parse'](JSON['stringify'](_0x3be2a0)));}async['getKey'](_0x5cf8a2,_0x1b18b2){const {alg:_0x15b7f1,kid:_0x448790}={..._0x5cf8a2,...null==_0x1b18b2?void 0x0:_0x1b18b2['header']},_0x328b60=function(_0x24cbb6){switch('string'==typeof _0x24cbb6&&_0x24cbb6['slice'](0x0,0x2)){case'RS':case'PS':return'RSA';case'ES':return'EC';case'Ed':return'OKP';default:throw new _0x43357e('Unsupported\x20\x22alg\x22\x20value\x20for\x20a\x20JSON\x20Web\x20Key\x20Set');}}(_0x15b7f1),_0x405e33=this['_jwks']['keys']['filter'](_0x3afe06=>{let _0x4ffacc=_0x328b60===_0x3afe06['kty'];if(_0x4ffacc&&'string'==typeof _0x448790&&(_0x4ffacc=_0x448790===_0x3afe06['kid']),_0x4ffacc&&'string'==typeof _0x3afe06['alg']&&(_0x4ffacc=_0x15b7f1===_0x3afe06['alg']),_0x4ffacc&&'string'==typeof _0x3afe06['use']&&(_0x4ffacc='sig'===_0x3afe06['use']),_0x4ffacc&&Array['isArray'](_0x3afe06['key_ops'])&&(_0x4ffacc=_0x3afe06['key_ops']['includes']('verify')),_0x4ffacc&&'EdDSA'===_0x15b7f1&&(_0x4ffacc='Ed25519'===_0x3afe06['crv']||'Ed448'===_0x3afe06['crv']),_0x4ffacc)switch(_0x15b7f1){case'ES256':_0x4ffacc='P-256'===_0x3afe06['crv'];break;case'ES256K':_0x4ffacc='secp256k1'===_0x3afe06['crv'];break;case'ES384':_0x4ffacc='P-384'===_0x3afe06['crv'];break;case'ES512':_0x4ffacc='P-521'===_0x3afe06['crv'];}return _0x4ffacc;}),{0x0:_0x5a66fd,length:_0x573ade}=_0x405e33;if(0x0===_0x573ade)throw new _0x49f0c5();if(0x1!==_0x573ade){const _0x446b8b=new _0x14a3bc(),{_cached:_0x3999db}=this;throw _0x446b8b[Symbol['asyncIterator']]=async function*(){for(const _0x147441 of _0x405e33)try{yield await _0x2774f0(_0x3999db,_0x147441,_0x15b7f1);}catch(_0x364cb8){continue;}},_0x446b8b;}return _0x2774f0(this['_cached'],_0x5a66fd,_0x15b7f1);}}async function _0x2774f0(_0x2c088e,_0x5f4b5b,_0x176930){const _0x29891e=_0x2c088e['get'](_0x5f4b5b)||_0x2c088e['set'](_0x5f4b5b,{})['get'](_0x5f4b5b);if(void 0x0===_0x29891e[_0x176930]){const _0x307efa=await _0x28f7a6({..._0x5f4b5b,'ext':!0x0},_0x176930);if(_0x307efa instanceof Uint8Array||'public'!==_0x307efa['type'])throw new _0x31c0ee('JSON\x20Web\x20Key\x20Set\x20members\x20must\x20be\x20public\x20keys');_0x29891e[_0x176930]=_0x307efa;}return _0x29891e[_0x176930];}function _0x410b54(_0x3d4f32){const _0x1bcfe3=new _0x2a6591(_0x3d4f32);return async function(_0x5cfdc2,_0xcca1f0){return _0x1bcfe3['getKey'](_0x5cfdc2,_0xcca1f0);};}class _0x4b7d3c extends _0x2a6591{constructor(_0x5e9d92,_0x4547be){if(super({'keys':[]}),this['_jwks']=void 0x0,!(_0x5e9d92 instanceof URL))throw new TypeError('url\x20must\x20be\x20an\x20instance\x20of\x20URL');this['_url']=new URL(_0x5e9d92['href']),this['_options']={'agent':null==_0x4547be?void 0x0:_0x4547be['agent'],'headers':null==_0x4547be?void 0x0:_0x4547be['headers']},this['_timeoutDuration']='number'==typeof(null==_0x4547be?void 0x0:_0x4547be['timeoutDuration'])?null==_0x4547be?void 0x0:_0x4547be['timeoutDuration']:0x1388,this['_cooldownDuration']='number'==typeof(null==_0x4547be?void 0x0:_0x4547be['cooldownDuration'])?null==_0x4547be?void 0x0:_0x4547be['cooldownDuration']:0x7530,this['_cacheMaxAge']='number'==typeof(null==_0x4547be?void 0x0:_0x4547be['cacheMaxAge'])?null==_0x4547be?void 0x0:_0x4547be['cacheMaxAge']:0x927c0;}['coolingDown'](){return'number'==typeof this['_jwksTimestamp']&&Date['now']()<this['_jwksTimestamp']+this['_cooldownDuration'];}['fresh'](){return'number'==typeof this['_jwksTimestamp']&&Date['now']()<this['_jwksTimestamp']+this['_cacheMaxAge'];}async['getKey'](_0x398404,_0x9d4042){this['_jwks']&&this['fresh']()||await this['reload']();try{return await super['getKey'](_0x398404,_0x9d4042);}catch(_0x2c479d){if(_0x2c479d instanceof _0x49f0c5&&!0x1===this['coolingDown']())return await this['reload'](),super['getKey'](_0x398404,_0x9d4042);throw _0x2c479d;}}async['reload'](){this['_pendingFetch']&&('undefined'!=typeof WebSocketPair||'undefined'!=typeof navigator&&'Cloudflare-Workers'===navigator['userAgent']||'undefined'!=typeof EdgeRuntime&&'vercel'===EdgeRuntime)&&(this['_pendingFetch']=void 0x0),this['_pendingFetch']||(this['_pendingFetch']=(async(_0xc4e1c1,_0x54a663,_0x1f38e3)=>{let _0x51502f,_0x3c0551,_0x575514=!0x1;'function'==typeof AbortController&&(_0x51502f=new AbortController(),_0x3c0551=setTimeout(()=>{_0x575514=!0x0,_0x51502f['abort']();},_0x54a663));const _0x2db1c3=await fetch(_0xc4e1c1['href'],{'signal':_0x51502f?_0x51502f['signal']:void 0x0,'redirect':'manual','headers':_0x1f38e3['headers']})['catch'](_0x2f4070=>{if(_0x575514)throw new _0x20586e();throw _0x2f4070;});if(void 0x0!==_0x3c0551&&clearTimeout(_0x3c0551),0xc8!==_0x2db1c3['status'])throw new _0x122966('Expected\x20200\x20OK\x20from\x20the\x20JSON\x20Web\x20Key\x20Set\x20HTTP\x20response');try{return await _0x2db1c3['json']();}catch(_0xe3f97){throw new _0x122966('Failed\x20to\x20parse\x20the\x20JSON\x20Web\x20Key\x20Set\x20HTTP\x20response\x20as\x20JSON');}})(this['_url'],this['_timeoutDuration'],this['_options'])['then'](_0x5c9f7d=>{if(!_0x25f170(_0x5c9f7d))throw new _0x31c0ee('JSON\x20Web\x20Key\x20Set\x20malformed');this['_jwks']={'keys':_0x5c9f7d['keys']},this['_jwksTimestamp']=Date['now'](),this['_pendingFetch']=void 0x0;})['catch'](_0x1d1fb4=>{throw this['_pendingFetch']=void 0x0,_0x1d1fb4;})),await this['_pendingFetch'];}}function _0x32dab6(_0x778f7,_0x1fb30f){const _0x124392=new _0x4b7d3c(_0x778f7,_0x1fb30f);return async function(_0x33813a,_0x300c1b){return _0x124392['getKey'](_0x33813a,_0x300c1b);};}class _0x1918c2 extends _0x1cbf8f{['encode'](){return _0x40aa3c(JSON['stringify']({'alg':'none'}))+'.'+_0x40aa3c(JSON['stringify'](this['_payload']))+'.';}static['decode'](_0x4f2667,_0x360b9a){if('string'!=typeof _0x4f2667)throw new _0x4c6a3d('Unsecured\x20JWT\x20must\x20be\x20a\x20string');const {0x0:_0x55bd58,0x1:_0x3fa55c,0x2:_0x4b0e5f,length:_0x421fd1}=_0x4f2667['split']('.');if(0x3!==_0x421fd1||''!==_0x4b0e5f)throw new _0x4c6a3d('Invalid\x20Unsecured\x20JWT');let _0x1cc38c;try{if(_0x1cc38c=JSON['parse'](_0x181173['decode'](_0x14a576(_0x55bd58))),'none'!==_0x1cc38c['alg'])throw new Error();}catch(_0x2c776d){throw new _0x4c6a3d('Invalid\x20Unsecured\x20JWT');}return{'payload':_0xc430d9(_0x1cc38c,_0x14a576(_0x3fa55c),_0x360b9a),'header':_0x1cc38c};}}const _0x32ed3b=_0x40aa3c,_0x397e43=_0x14a576;function _0x25a8b2(_0x2cab9d){let _0x5dcd4c;if('string'==typeof _0x2cab9d){const _0x3af85e=_0x2cab9d['split']('.');0x3!==_0x3af85e['length']&&0x5!==_0x3af85e['length']||([_0x5dcd4c]=_0x3af85e);}else{if('object'==typeof _0x2cab9d&&_0x2cab9d){if(!('protected'in _0x2cab9d))throw new TypeError('Token\x20does\x20not\x20contain\x20a\x20Protected\x20Header');_0x5dcd4c=_0x2cab9d['protected'];}}try{if('string'!=typeof _0x5dcd4c||!_0x5dcd4c)throw new Error();const _0x200edd=JSON['parse'](_0x181173['decode'](_0x397e43(_0x5dcd4c)));if(!_0x2df98d(_0x200edd))throw new Error();return _0x200edd;}catch(_0x581648){throw new TypeError('Invalid\x20Token\x20or\x20Protected\x20Header\x20formatting');}}function _0x180203(_0x594f14){if('string'!=typeof _0x594f14)throw new _0x4c6a3d('JWTs\x20must\x20use\x20Compact\x20JWS\x20serialization,\x20JWT\x20must\x20be\x20a\x20string');const {0x1:_0x2adfe3,length:_0x224479}=_0x594f14['split']('.');if(0x5===_0x224479)throw new _0x4c6a3d('Only\x20JWTs\x20using\x20Compact\x20JWS\x20serialization\x20can\x20be\x20decoded');if(0x3!==_0x224479)throw new _0x4c6a3d('Invalid\x20JWT');if(!_0x2adfe3)throw new _0x4c6a3d('JWTs\x20must\x20contain\x20a\x20payload');let _0x3004d6,_0x1473d0;try{_0x3004d6=_0x397e43(_0x2adfe3);}catch(_0x42e4bd){throw new _0x4c6a3d('Failed\x20to\x20base64url\x20decode\x20the\x20payload');}try{_0x1473d0=JSON['parse'](_0x181173['decode'](_0x3004d6));}catch(_0x596349){throw new _0x4c6a3d('Failed\x20to\x20parse\x20the\x20decoded\x20payload\x20as\x20JSON');}if(!_0x2df98d(_0x1473d0))throw new _0x4c6a3d('Invalid\x20JWT\x20Claims\x20Set');return _0x1473d0;}function _0x11fe42(_0x21d202){var _0x206817;const _0x400bd0=null!==(_0x206817=null==_0x21d202?void 0x0:_0x21d202['modulusLength'])&&void 0x0!==_0x206817?_0x206817:0x800;if('number'!=typeof _0x400bd0||_0x400bd0<0x800)throw new _0x43357e('Invalid\x20or\x20unsupported\x20modulusLength\x20option\x20provided,\x202048\x20bits\x20or\x20larger\x20keys\x20must\x20be\x20used');return _0x400bd0;}async function _0x2a3ab6(_0x20aa74,_0x182202){return async function(_0x53a1d3,_0xf1125a){var _0x5b0721,_0x18f07b,_0x2568eb;let _0x5ae3c1,_0xd4c032;switch(_0x53a1d3){case'PS256':case'PS384':case'PS512':_0x5ae3c1={'name':'RSA-PSS','hash':'SHA-'+_0x53a1d3['slice'](-0x3),'publicExponent':new Uint8Array([0x1,0x0,0x1]),'modulusLength':_0x11fe42(_0xf1125a)},_0xd4c032=['sign','verify'];break;case'RS256':case'RS384':case'RS512':_0x5ae3c1={'name':'RSASSA-PKCS1-v1_5','hash':'SHA-'+_0x53a1d3['slice'](-0x3),'publicExponent':new Uint8Array([0x1,0x0,0x1]),'modulusLength':_0x11fe42(_0xf1125a)},_0xd4c032=['sign','verify'];break;case'RSA-OAEP':case'RSA-OAEP-256':case'RSA-OAEP-384':case'RSA-OAEP-512':_0x5ae3c1={'name':'RSA-OAEP','hash':'SHA-'+(parseInt(_0x53a1d3['slice'](-0x3),0xa)||0x1),'publicExponent':new Uint8Array([0x1,0x0,0x1]),'modulusLength':_0x11fe42(_0xf1125a)},_0xd4c032=['decrypt','unwrapKey','encrypt','wrapKey'];break;case'ES256':_0x5ae3c1={'name':'ECDSA','namedCurve':'P-256'},_0xd4c032=['sign','verify'];break;case'ES384':_0x5ae3c1={'name':'ECDSA','namedCurve':'P-384'},_0xd4c032=['sign','verify'];break;case'ES512':_0x5ae3c1={'name':'ECDSA','namedCurve':'P-521'},_0xd4c032=['sign','verify'];break;case'EdDSA':_0xd4c032=['sign','verify'];const _0xb5cc9=null!==(_0x5b0721=null==_0xf1125a?void 0x0:_0xf1125a['crv'])&&void 0x0!==_0x5b0721?_0x5b0721:'Ed25519';switch(_0xb5cc9){case'Ed25519':case'Ed448':_0x5ae3c1={'name':_0xb5cc9};break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20crv\x20option\x20provided');}break;case'ECDH-ES':case'ECDH-ES+A128KW':case'ECDH-ES+A192KW':case'ECDH-ES+A256KW':{_0xd4c032=['deriveKey','deriveBits'];const _0x20bf49=null!==(_0x18f07b=null==_0xf1125a?void 0x0:_0xf1125a['crv'])&&void 0x0!==_0x18f07b?_0x18f07b:'P-256';switch(_0x20bf49){case'P-256':case'P-384':case'P-521':_0x5ae3c1={'name':'ECDH','namedCurve':_0x20bf49};break;case'X25519':case'X448':_0x5ae3c1={'name':_0x20bf49};break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20crv\x20option\x20provided,\x20supported\x20values\x20are\x20P-256,\x20P-384,\x20P-521,\x20X25519,\x20and\x20X448');}break;}default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}return _0x298964['subtle']['generateKey'](_0x5ae3c1,null!==(_0x2568eb=null==_0xf1125a?void 0x0:_0xf1125a['extractable'])&&void 0x0!==_0x2568eb&&_0x2568eb,_0xd4c032);}(_0x20aa74,_0x182202);}async function _0x145a51(_0x5b60e8,_0x5b2d5e){return async function(_0x3e07d6,_0x479838){var _0x398980;let _0x7cdb79,_0x2291f5,_0x22138a;switch(_0x3e07d6){case'HS256':case'HS384':case'HS512':_0x7cdb79=parseInt(_0x3e07d6['slice'](-0x3),0xa),_0x2291f5={'name':'HMAC','hash':'SHA-'+_0x7cdb79,'length':_0x7cdb79},_0x22138a=['sign','verify'];break;case'A128CBC-HS256':case'A192CBC-HS384':case'A256CBC-HS512':return _0x7cdb79=parseInt(_0x3e07d6['slice'](-0x3),0xa),_0xc75a16(new Uint8Array(_0x7cdb79>>0x3));case'A128KW':case'A192KW':case'A256KW':_0x7cdb79=parseInt(_0x3e07d6['slice'](0x1,0x4),0xa),_0x2291f5={'name':'AES-KW','length':_0x7cdb79},_0x22138a=['wrapKey','unwrapKey'];break;case'A128GCMKW':case'A192GCMKW':case'A256GCMKW':case'A128GCM':case'A192GCM':case'A256GCM':_0x7cdb79=parseInt(_0x3e07d6['slice'](0x1,0x4),0xa),_0x2291f5={'name':'AES-GCM','length':_0x7cdb79},_0x22138a=['encrypt','decrypt'];break;default:throw new _0x43357e('Invalid\x20or\x20unsupported\x20JWK\x20\x22alg\x22\x20(Algorithm)\x20Parameter\x20value');}return _0x298964['subtle']['generateKey'](_0x2291f5,null!==(_0x398980=null==_0x479838?void 0x0:_0x479838['extractable'])&&void 0x0!==_0x398980&&_0x398980,_0x22138a);}(_0x5b60e8,_0x5b2d5e);}var _0x24455a='WebCryptoAPI';}},_0xb50f93={};function _0x2e1ff0(_0x5877ec){var _0x2bf936=_0xb50f93[_0x5877ec];if(void 0x0!==_0x2bf936)return _0x2bf936['exports'];var _0x3619f4=_0xb50f93[_0x5877ec]={'exports':{}};return _0x3d2583[_0x5877ec]['call'](_0x3619f4['exports'],_0x3619f4,_0x3619f4['exports'],_0x2e1ff0),_0x3619f4['exports'];}_0x2e1ff0['n']=function(_0x318796){var _0x189e07=_0x318796&&_0x318796['__esModule']?function(){return _0x318796['default'];}:function(){return _0x318796;};return _0x2e1ff0['d'](_0x189e07,{'a':_0x189e07}),_0x189e07;},_0x2e1ff0['d']=function(_0x3d2f2e,_0x2d7b73){for(var _0x2dd0e9 in _0x2d7b73)_0x2e1ff0['o'](_0x2d7b73,_0x2dd0e9)&&!_0x2e1ff0['o'](_0x3d2f2e,_0x2dd0e9)&&Object['defineProperty'](_0x3d2f2e,_0x2dd0e9,{'enumerable':!0x0,'get':_0x2d7b73[_0x2dd0e9]});},_0x2e1ff0['o']=function(_0x358a7a,_0x361fd0){return Object['prototype']['hasOwnProperty']['call'](_0x358a7a,_0x361fd0);},_0x2e1ff0['r']=function(_0x373ff3){'undefined'!=typeof Symbol&&Symbol['toStringTag']&&Object['defineProperty'](_0x373ff3,Symbol['toStringTag'],{'value':'Module'}),Object['defineProperty'](_0x373ff3,'__esModule',{'value':!0x0});};var _0x7db48d={};return(function(){_0x2e1ff0['d'](_0x7db48d,{'default':function(){return _0x10593f;}});var _0x45d490=require('bson-objectid'),_0x3a7a1a=_0x2e1ff0['n'](_0x45d490),_0x623a8b=(require('whatwg-fetch'),require('pouchdb-browser')),_0x1ddf4d=_0x2e1ff0['n'](_0x623a8b),_0x1b5599=require('pouchdb-find'),_0x344be3=_0x2e1ff0['n'](_0x1b5599),_0x13145a=require('pouchdb-erase'),_0x38b205=_0x2e1ff0['n'](_0x13145a),_0x4e53f5=require('crypto-js/aes'),_0x4dcb57=_0x2e1ff0['n'](_0x4e53f5),_0x3ccc76=(require('webcrypto-shim'),require('text-encoding-shim')),_0x7484be=_0x2e1ff0(0xf4);const _0x7cc9d0=new _0x7484be['OfflineLibraryLicense']('offline');let _0x528b1f=!0x1;var _0x25b755=_0x3ebb83=>{return _0x417bff=void 0x0,_0xe567d6=void 0x0,_0x57669c=function*(){var _0x421594;if(!(null===(_0x421594=null===window||void 0x0===window?void 0x0:window['Formio'])||void 0x0===_0x421594?void 0x0:_0x421594['license']))return alert('You\x20need\x20to\x20set\x20the\x20license\x20key\x20in\x20order\x20to\x20use\x20the\x20\x27@formio/offline-plugin\x27\x20library.\x20\x0a\x20You\x20can\x20do\x20it\x20this\x20way:\x20Formio.license\x20=\x20\x22YourLicenseKey\x22;'),Promise['reject']();try{return _0x528b1f||(yield _0x7cc9d0['verify'](window['Formio']['license']),_0x528b1f=!0x0),yield _0x7cc9d0['checkAllowedEndpoints'](_0x3ebb83,window['Formio']['license']),Promise['resolve']();}catch(_0x5360b8){return _0x5360b8 instanceof Error&&alert(_0x5360b8['message']),Promise['reject']();}},new((_0x1a5133=void 0x0)||(_0x1a5133=Promise))(function(_0x2e7484,_0x32c7ed){function _0x452cbe(_0x54d666){try{_0x3633f0(_0x57669c['next'](_0x54d666));}catch(_0x2ebae4){_0x32c7ed(_0x2ebae4);}}function _0x31ac03(_0x346ed2){try{_0x3633f0(_0x57669c['throw'](_0x346ed2));}catch(_0x6e6a4a){_0x32c7ed(_0x6e6a4a);}}function _0x3633f0(_0x110250){var _0x82bcc9;_0x110250['done']?_0x2e7484(_0x110250['value']):(_0x82bcc9=_0x110250['value'],_0x82bcc9 instanceof _0x1a5133?_0x82bcc9:new _0x1a5133(function(_0x3b99c1){_0x3b99c1(_0x82bcc9);}))['then'](_0x452cbe,_0x31ac03);}_0x3633f0((_0x57669c=_0x57669c['apply'](_0x417bff,_0xe567d6||[]))['next']());});var _0x417bff,_0xe567d6,_0x1a5133,_0x57669c;};const _0xd878e=_0x2e1ff0(0x2d),_0x253fce=()=>{};_0x1ddf4d()['plugin'](_0x344be3()),_0x1ddf4d()['plugin'](_0x38b205());const _0x5b1832='projectCache',_0x186fa7='submissionCache',_0x39ad9f='staticCache',_0x412fe9='usersCache',_0x4c4fc3='offlineQueue',_0x4f3cd6='fileQueue',_0x5ac9e5={'auto_compaction':!0x0},_0x51ca4d=_0x24797f=>JSON['parse'](JSON['stringify'](_0x24797f));class _0x56bbf8{constructor(_0x5d846b){this['state']='pending',this['promise']=new _0x5d846b['Promise']((_0x4e45f7,_0x48904a)=>{this['resolve']=(..._0x26e027)=>{this['state']='fulfilled',_0x4e45f7(..._0x26e027);},this['reject']=(..._0x276708)=>{this['state']='rejected',_0x48904a(..._0x276708);};});}}class _0x253745{static['OfflinePlugin'](_0x182265,_0x1b8a1f,_0x31d901,_0x5d03ed){const _0x29eba7={'fetch':{}};return _0x29eba7['fetch'][_0x182265]=new _0x253745(_0x1b8a1f,_0x31d901,_0x5d03ed),_0x29eba7;}constructor(_0x414a8e,_0x2e9138,_0x153b5c){if(_0x253745['_instance']&&_0x414a8e&&_0x253745['_instance']['projectUrl']===_0x414a8e)return _0x253745['_instance'];if(this['priority']=0x64,this['readyQueue']=[],this['errorQueue']=[],this['blobSupport']=!0x0,this['skipQueue']=!0x1,this['_beforeRequestHooks']=[],this['noAutomaticDequeue']=_0x153b5c&&_0x153b5c['noAutomaticDequeue']||!0x1,this['dequeueOnReconnect']=_0x153b5c&&_0x153b5c['dequeueOnReconnect']||!0x1,this['queryFiltersTypes']=_0x153b5c&&_0x153b5c['queryFiltersTypes']||null,this['notToShowDeletedOfflineSubmissions']=_0x153b5c&&_0x153b5c['notToShowDeletedOfflineSubmissions']||!0x1,this['deleteErrorSubmissions']=_0x153b5c&&_0x153b5c['deleteErrorSubmissions']||null,!_0x414a8e)throw new Error('No\x20project\x20url\x20provided.');this['projectUrl']=_0x414a8e,this['projectJsonPath']=_0x2e9138,this['db']={'database':'','dbs':{},'dbPromise':null,'queryFiltersTypes':this['queryFiltersTypes'],'toPouch'(_0x363090){return _0x363090?(Object['keys'](_0x363090)['forEach'](_0x3185d1=>{!['_id','_rev','_deleted']['includes'](_0x3185d1)&&_0x3185d1['startsWith']('_')&&(_0x363090['$'+_0x3185d1]=_0x363090[_0x363090],delete _0x363090[_0x3185d1]);}),_0x363090):null;},'fromPouch'(_0x2e4325){if(!_0x2e4325)return null;Object['keys'](_0x2e4325)['forEach'](_0x4cd2f4=>{!['_id','_rev','_deleted']['includes'](_0x4cd2f4)&&_0x4cd2f4['startsWith']('$')&&(_0x2e4325[_0x4cd2f4['substring'](0x1)]=_0x2e4325[_0x4cd2f4],delete _0x2e4325[_0x4cd2f4]);});const _0x4ab379=_0x2e4325['_id']['split']('-');return _0x2e4325['_id']=_0x4ab379[_0x4ab379['length']-0x1],_0x2e4325;},'init'(_0x4b6352){return this['dbs'][_0x5b1832]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x5b1832,_0x5ac9e5),this['dbs'][_0x186fa7]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x186fa7,_0x5ac9e5),this['dbs'][_0x39ad9f]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x39ad9f,_0x5ac9e5),this['dbs'][_0x412fe9]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x412fe9,_0x5ac9e5),this['dbs'][_0x4c4fc3]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x4c4fc3,_0x5ac9e5),this['dbs'][_0x4f3cd6]=new(_0x1ddf4d())(_0x4b6352+'-'+_0x4f3cd6,_0x5ac9e5),this['database']=_0x4b6352,_0x253745['Formio']['Promise']['resolve'](this);},'getItem'(_0x27ce22,_0x1a79e9){return this['dbs'][_0x27ce22]['get'](_0x1a79e9)['then'](this['fromPouch'])['catch'](_0x2754fa=>null);},'setItem'(_0x31f162,_0x493a31,_0x4a9c88){if(!_0x493a31||!_0x4a9c88||'object'!=typeof _0x4a9c88)return _0x253745['Formio']['Promise']['resolve'](null);let _0x1ebbd9=Object['assign']({},_0x4a9c88);return _0x1ebbd9['_id']=_0x493a31,_0x1ebbd9=this['toPouch'](_0x1ebbd9),this['dbs'][_0x31f162]['get'](_0x493a31)['then'](_0x5f3caf=>(_0x1ebbd9['_rev']=_0x5f3caf['_rev'],_0x1ebbd9))['catch'](_0x15f63a=>(delete _0x1ebbd9['_rev'],_0x1ebbd9))['then'](_0x77edf9=>this['dbs'][_0x31f162]['put'](_0x77edf9))['then'](()=>this['dbs'][_0x31f162]['get'](_0x493a31))['catch'](_0x55e4cb=>{console['warn']('Error\x20setting\x20item:\x20',_0x55e4cb);});},'setItems'(_0x101ab4,_0x1ac26a,_0x21062a=''){return this['dbs'][_0x101ab4]['allDocs']()['then'](_0x122e3c=>{const _0x1db349=_0x122e3c['rows']['reduce']((_0xd52185,_0x209233)=>(_0x209233['hasOwnProperty']('id')&&_0x209233['value']&&_0x209233['value']['rev']?_0xd52185[_0x209233['id']]=_0x209233['value']['rev']:_0xd52185[_0x209233['_id']]=_0x209233['_rev'],_0xd52185),{});return _0x1ac26a=_0x1ac26a['map'](_0x275234=>{let _0x3f395a=Object['assign']({},_0x275234);return _0x3f395a['_id']=_0x21062a+_0x275234['_id'],_0x3f395a=this['toPouch'](_0x3f395a),_0x1db349['hasOwnProperty'](_0x3f395a['_id'])?_0x3f395a['_rev']=_0x1db349[_0x3f395a['_id']]:delete _0x3f395a['_rev'],_0x3f395a;}),this['dbs'][_0x101ab4]['bulkDocs'](_0x1ac26a);})['catch'](_0x5d4531=>{console['warn']('Error\x20settint\x20items:\x20',_0x5d4531);});},'removeItem'(_0x62f717,_0x2f54d2){return this['dbs'][_0x62f717]['get'](_0x2f54d2)['then'](_0x17ffa3=>this['dbs'][_0x62f717]['remove'](_0x17ffa3));},'search'(_0x1b2362,_0x4ce5ec,_0x37d599){const _0x4ab1f5=_0x44eebd=>{const _0x522019={},_0x887066=(_0x1ae7ad=_0x44eebd,_0x17e4f7=['limit','skip','select','sort','populate'],Object['keys'](_0x1ae7ad)['reduce']((_0x2a59c7,_0x4f01ff,_0x493747)=>(_0x17e4f7['includes'](_0x4f01ff)||(_0x2a59c7=Object['assign'](_0x2a59c7,{[_0x4f01ff]:_0x1ae7ad[_0x4f01ff]})),_0x2a59c7),{}));var _0x1ae7ad,_0x17e4f7;return Object['entries'](_0x887066)['forEach'](([_0x2568e3,_0x485b5c])=>{const _0x5df3b2=(_0x1f5fe9=_0x2568e3['split']('__'),['name','selector']['reduce']((_0x4f15c3,_0x50b976,_0x34a3c1)=>Object['assign'](_0x4f15c3,{[_0x50b976]:_0x1f5fe9[_0x34a3c1]}),{}));var _0x1f5fe9;if(_0x5df3b2['selector']){if('regex'===_0x5df3b2['selector']){const _0x58a54a=_0x485b5c['match'](/\/?([^/]+)\/?([^/]+)?/);let _0x104318=null;try{_0x104318=new RegExp(_0x58a54a[0x1],_0x58a54a[0x2]||'i');}catch(_0x480726){_0x104318=null;}return void(_0x104318&&(_0x522019[_0x5df3b2['name']]={'$regex':_0x104318}));}return _0x522019['hasOwnProperty'](_0x5df3b2['name'])||(_0x522019[_0x5df3b2['name']]={}),'exists'===_0x5df3b2['selector']?_0x485b5c=!!(_0x485b5c='false'!==(_0x485b5c='true'===_0x485b5c||'1'===_0x485b5c||_0x485b5c)&&'0'!==_0x485b5c&&_0x485b5c):['in','nin']['includes'](_0x5df3b2['selector'])&&(_0x485b5c=Array['isArray'](_0x485b5c)?_0x485b5c:_0x485b5c['split'](',')),void(_0x522019[_0x5df3b2['name']]['$'+_0x5df3b2['selector']]=_0x485b5c);}this['queryFiltersTypes']&&this['queryFiltersTypes'][_0x5df3b2['name']]&&(_0x485b5c=((_0x404c98,_0xb69a71)=>{switch(_0xb69a71){case'number':return Number(_0x404c98);case'boolean':return'true'===_0x404c98;case'[number]':return _0x404c98['split'](',')['map'](_0x2057ec=>Number(_0x2057ec));default:return _0x404c98;}})(_0x485b5c,this['queryFiltersTypes'][_0x5df3b2['name']])),_0x522019[_0x5df3b2['name']]=_0x485b5c;}),_0x522019;},_0x92af28={'selector':_0x4ab1f5(_0x37d599)};if(['skip','limit','sort']['forEach'](_0xd7db43=>{_0x37d599['hasOwnProperty'](_0xd7db43)&&(_0x92af28[_0xd7db43]=_0x37d599[_0xd7db43]);}),_0x92af28['hasOwnProperty']('sort')&&!Array['isArray'](_0x92af28['sort'])&&(_0x92af28['sort']=[_0x92af28['sort']]),_0x92af28['sort']){const _0x1da312=[];_0x92af28['sort']=_0x92af28['sort']['map'](_0x7ea31f=>{if('string'!=typeof _0x7ea31f)return _0x7ea31f;let _0x33a89b=_0x7ea31f,_0x4ae7d5='asc';return 0x0===_0x7ea31f['indexOf']('-')&&(_0x33a89b=_0x7ea31f['slice'](0x1,_0x7ea31f['length']),_0x4ae7d5='desc'),_0x1da312['push'](_0x33a89b),{[_0x33a89b]:_0x4ae7d5};}),_0x92af28['selector']=_0x92af28['selector']||{},_0x92af28['selector']['$and']=[..._0x92af28['selector']['$and']||[],..._0x1da312['map'](_0x57bd2a=>({[_0x57bd2a]:{'$exists':!0x0}})),_0x4ab1f5(_0x37d599)];}return(_0x92af28['sort']?this['dbs'][_0x1b2362]['createIndex']({'index':{'fields':_0x92af28['sort']}}):_0x253745['Formio']['Promise']['resolve']())['then'](()=>this['dbs'][_0x1b2362]['find'](_0x92af28))['then'](_0x50e938=>_0x50e938['docs']['map'](this['fromPouch']));},'clear'(_0x2ec87d){return this['dbs'][_0x2ec87d]['erase']();},'clearAll'(){return _0x253745['Formio']['Promise']['all']([this['clear'](_0x5b1832),this['clear'](_0x186fa7),this['clear'](_0x412fe9),this['clear'](_0x39ad9f),this['clear'](_0x4c4fc3),this['clear'](_0x4f3cd6)]);}},this['encodeFile']=function(_0x3a9b2f){return this['blobSupport']?_0x253745['Formio']['Promise']['resolve'](_0x3a9b2f):this['fileToDataUri'](_0x3a9b2f);},this['fileToDataUri']=_0x394866=>new _0x253745['Formio']['Promise']((_0x10f5bd,_0x412c7e)=>{const _0x47a9bc=new FileReader();_0x47a9bc['onload']=()=>{_0x10f5bd(_0x47a9bc['result']);},_0x47a9bc['onerror']=_0x3077c6=>{_0x412c7e(_0x3077c6);},_0x47a9bc['readAsDataURL'](_0x394866);}),this['ifEncodeFile']=this['encodeFile'],this['decodeFile']=function(_0x42d4b5){return this['blobSupport']?_0x253745['Formio']['Promise']['resolve'](_0x42d4b5):new _0x253745['Formio']['Promise']((_0x1617d3,_0x26db23)=>{try{let _0x3b564a;_0x3b564a=_0x42d4b5['split'](',')[0x0]['indexOf']('base64')>=0x0?atob(_0x42d4b5['split'](',')[0x1]):unescape(_0x42d4b5['split'](',')[0x1]);const _0x24418e=_0x42d4b5['split'](',')[0x0]['split'](':')[0x1]['split'](';')[0x0],_0x38abf6=new Uint8Array(_0x3b564a['length']);for(let _0x20d7f9=0x0;_0x20d7f9<_0x3b564a['length'];_0x20d7f9++)_0x38abf6[_0x20d7f9]=_0x3b564a['charCodeAt'](_0x20d7f9);_0x1617d3(new Blob([_0x38abf6],{'type':_0x24418e}));}catch(_0x6840e){_0x26db23(_0x6840e);}});},this['ifDecodeFile']=this['decodeFile'],_0x253745['_instance']=this;}static['getInstance'](_0x1c9e84,_0x1c6b81,_0x59509d){return _0x253745['_instance']&&_0x253745['_instance']['projectUrl']===_0x1c9e84||(_0x253745['_instance']=new _0x253745(_0x1c9e84,_0x1c6b81,_0x59509d)),_0x253745['_instance'];}['statusIndicator'](_0x346356,_0x39aaa6){let _0x53cd6f=0x0,_0x7aa71f=null;const _0xc5a33e=function(){this['ready']['then'](()=>{const _0x569155=this['isOnline'],_0x3fdfa3=this['submissionQueueLength']();if(_0x569155!==_0x7aa71f||_0x3fdfa3!==_0x53cd6f&&!_0x569155||_0x3fdfa3<_0x53cd6f){for(;_0x346356['firstChild'];)_0x346356['removeChild'](_0x346356['firstChild']);if(_0x3fdfa3){const _0x34c5cb=document['createElement']('span');_0x34c5cb['setAttribute']('class','badge\x20badge-pill\x20badge-warning\x20text-bg-warning\x20bg-warning'),_0x34c5cb['setAttribute']('style','cursor:pointer;'),_0x3fdfa3&&_0x34c5cb['appendChild'](document['createTextNode'](_0x3fdfa3+'\x20offline\x20tasks')),_0x346356['appendChild'](_0x34c5cb);}else{const _0xe474a0=document['createElement']('a');_0xe474a0['setAttribute']('data-toggle','tooltip'),_0xe474a0['setAttribute']('data-placement','bottom'),_0xe474a0['setAttribute']('title',_0x569155?'Online':'Offline'),_0xe474a0['setAttribute']('alt',_0x569155?'Online':'Offline'),_0xe474a0['setAttribute']('class','fa\x20fa-signal\x20bi\x20bi-reception-4\x20glyphicon\x20glyphicon-signal\x20'+(_0x569155?'text-success':'text-warning')),_0x346356['appendChild'](_0xe474a0);}_0x53cd6f=_0x3fdfa3,_0x7aa71f=_0x569155;}});}['bind'](this);this['Formio']['events']['on']('offline.saveQueue',()=>_0xc5a33e()),this['Formio']['events']['on']('offline.queue',()=>_0xc5a33e()),this['Formio']['events']['on']('offline.queueEmpty',()=>_0xc5a33e),this['Formio']['events']['on']('offline.statusChanged',()=>_0xc5a33e()),_0x39aaa6||_0x346356['addEventListener']('click',()=>this['dequeueSubmissions'](!0x1,0x0,!0x0)),_0xc5a33e();}['connectionCheck'](){this['isOnline']=navigator['onLine'],window['addEventListener']('offline',()=>{this['isOnline']=!0x1;}),window['addEventListener']('online',()=>{this['isOnline']=!0x0;});const _0x2d89dd=setInterval(()=>{navigator['onLine']&&this['_ping'](()=>{this['isOnline']=!0x0,clearInterval(_0x2d89dd);},()=>{this['isOnline']=!0x1;});},0x3e8);}get['ready'](){return _0x253745['Formio']['Promise']['all'](this['readyQueue']);}get['isOnline'](){return this['_isOnline'];}set['isOnline'](_0x3166e8){this['_isOnline']!==_0x3166e8&&(this['_isOnline']=_0x3166e8,this['Formio']['events']['emit']('offline.statusChanged',_0x3166e8),this['dequeueOnReconnect']&&_0x3166e8&&this['ready']['then'](()=>{this['submissionQueueLength']()&&this['_isOnline']&&this['dequeueSubmissions'](!0x1,0x0,!0x0);}));}['init'](_0x5f0465){if(_0x253745['Formio']=_0x5f0465,this['Formio']=_0x5f0465,this['projectId']=new _0x5f0465(this['projectUrl'])['projectId']||'formio',this['offlineProject']={'forms':{}},this['submissionQueue']=[],this['dequeuing']=!0x1,this['forcedOffline']=!0x1,this['offline']=!0x1,this['cacheError']=!0x1,this['_usersData']={},this['_currentUser']=null,this['debugBroadcast']=function(_0x40b85b){this['event'];},this['Formio']['events']['on']('offline.saveQueue',this['debugBroadcast']),this['Formio']['events']['on']('offline.queue',this['debugBroadcast']),this['Formio']['events']['on']('offline.queueEmpty',this['debugBroadcast']),this['Formio']['events']['on']('offline.dequeue',this['debugBroadcast']),this['Formio']['events']['on']('offline.formError',this['debugBroadcast']),this['Formio']['events']['on']('offline.formSubmission',this['debugBroadcast']),this['Formio']['events']['on']('offline.requeue',this['debugBroadcast']),this['Formio']['events']['on']('formio.user',this['_saveUser']['bind'](this)),this['onError']=_0x11e8db=>{console['error']('Error:\x20',_0x11e8db);},!window['indexedDB'])return this['enabled']=!0x1,void console['error']('Form.io\x20Offline\x20Plugin\x20not\x20available,\x20because\x20indexedDB\x20is\x20not\x20available\x20in\x20this\x20Browser.');this['enabled']=!0x0,this['dbPromise']=this['db']['init']('formio'+this['projectId']),this['readyQueue']['push'](this['dbPromise']),this['readyQueue']['push'](this['getItem'](_0x5b1832,this['projectId'])['then'](_0x2d1134=>_0x2d1134||(this['projectJsonPath']?_0x253745['Formio']['fetch'](this['projectJsonPath'])['then'](_0x24c398=>_0x24c398['json']())['then'](_0x4931f6=>(_0x4931f6['forms']=_0x4931f6['forms']||{},Object['keys'](_0x4931f6['resources']||{})['forEach'](_0x53f379=>{_0x4931f6['forms'][_0x53f379]=_0x4931f6['resources'][_0x53f379];}),delete _0x4931f6['resources'],Object['keys'](_0x4931f6['forms'])['forEach'](_0x4edf94=>{_0x4931f6['forms'][_0x4edf94]['created']=new Date(0x0)['toISOString'](),_0x4931f6['forms'][_0x4edf94]['modified']=new Date(0x0)['toISOString'](),_0x4931f6['forms'][_0x4edf94]['offline']=!0x0;}),_0x4931f6)):{'forms':{}}))['then'](_0x254ced=>(this['offlineProject']=_0x254ced,this['setItem'](_0x5b1832,this['projectId'],_0x254ced)))['catch'](_0xce6a8=>{console['error']('Error\x20caching\x20offline\x20storage:\x20',_0xce6a8);})),this['readyQueue']['push'](this['getItem'](_0x4c4fc3,'queue')['then'](_0x846c1=>{_0x846c1=_0x846c1||{},this['submissionQueue']=_0x846c1['queue']||[];})['catch'](_0x17368c=>{console['error']('Error\x20restoring\x20offline\x20submission\x20queue:\x20',_0x17368c);})),this['ready']['then'](()=>{this['connectionCheck']();}),this['forceOffline']=this['forceOffline']['bind'](this),this['isForcedOffline']=this['isForcedOffline']['bind'](this),this['clearOfflineData']=this['clearOfflineData']['bind'](this),this['dequeueSubmissions']=this['dequeueSubmissions']['bind'](this),this['submissionQueueLength']=this['submissionQueueLength']['bind'](this),this['getNextQueuedSubmission']=this['getNextQueuedSubmission']['bind'](this),this['setNextQueuedSubmission']=this['setNextQueuedSubmission']['bind'](this),this['skipNextQueuedSubmission']=this['skipNextQueuedSubmission']['bind'](this),this['preRequest']=this['preRequest']['bind'](this),this['request']=this['request']['bind'](this),this['requestResponse']=this['requestResponse']['bind'](this),this['staticRequest']=this['staticRequest']['bind'](this),this['fileRequest']=this['fileRequest']['bind'](this),this['wrapRequestPromise']=this['wrapRequestPromise']['bind'](this),this['wrapStaticRequestPromise']=this['wrapStaticRequestPromise']['bind'](this),this['wrapFileRequestPromise']=this['wrapFileRequestPromise']['bind'](this),this['wrapFetchRequestPromise']=this['wrapFetchRequestPromise']['bind'](this),this['sendRequest']=this['sendRequest']['bind'](this),this['setItem']=this['setItem']['bind'](this),this['setItems']=this['setItems']['bind'](this),this['getItem']=this['getItem']['bind'](this);}['preRequest'](){return this['ready'];}['beforeRequest'](_0x48604f,_0x1755e0){_0x1755e0=_0x1755e0||{},-0x1===this['_beforeRequestHooks']['findIndex'](_0x48604f)&&'function'==typeof _0x48604f&&this['_beforeRequestHooks']['push']({'hook':_0x48604f,'options':_0x1755e0});}['request'](_0x4e23bd){const {formio:_0x295cce,type:_0x100441,url:_0x37bf06,method:_0x1a81ce,data:_0x5e190a}=_0x4e23bd;let {opts:_0x5f5b29}=_0x4e23bd;return _0x5f5b29=_0x5f5b29||{},this['enabled']&&'GET'===_0x1a81ce&&(_0x5f5b29['ignoreCache']=!0x0),this['_shouldSkipQueue'](_0x4e23bd)?this['isForcedOffline']()?this['_throwOfflineError']():void 0x0:_0x25b755(_0x37bf06)['then'](()=>this['getItem'](_0x4c4fc3,'queue')['then'](_0x321b46=>{_0x321b46=_0x321b46||{},'GET'===_0x1a81ce||this['queueSet']||(this['submissionQueue']=_0x321b46['queue']||[],this['queueSet']=!0x0);})['catch'](_0x45ef72=>{console['error']('Error\x20restoring\x20offline\x20submission\x20queue:\x20',_0x45ef72);}))['then'](()=>{const _0x2b4f55=new(_0x3a7a1a())(),_0x1a51cd={'request':{'_id':_0x295cce['submissionId']||_0x5e190a['_id']||_0x2b4f55['toHexString'](),'type':_0x100441,'url':_0x37bf06,'method':_0x1a81ce,'data':null,'created':new Date()['toISOString'](),'form':_0x295cce['formId'],'formUrl':_0x295cce['formUrl']}};if(_0x5e190a){const _0x459816=_0x51ca4d({'owner':_0x5e190a['owner'],'data':_0x5e190a['data'],'oauth':_0x5e190a['oauth'],'metadata':_0x5e190a['metadata'],'state':_0x5e190a['state']}),_0x4a5c68=this['Formio']['getUser']();_0x1a51cd['request']['data']={'_id':_0x1a51cd['request']['_id'],'owner':'PUT'===_0x1a81ce&&_0x459816['owner']||(_0x4a5c68?_0x4a5c68['_id']:null),'form':_0x295cce['formId'],'data':_0x459816['data'],'metadata':_0x459816['metadata'],'state':_0x459816['state'],'created':_0x1a51cd['request']['created'],'modified':_0x1a51cd['request']['created'],'externalIds':[],'roles':[]},_0x459816['oauth']&&(_0x1a51cd['request']['data']['oauth']=_0x459816['oauth']);}return Object['defineProperty'](_0x1a51cd,'deferred',{'enumerable':!0x1,'value':new _0x56bbf8(_0x253745['Formio'])}),_0x1a51cd['attempts']=this['attempts']||0x3,new _0x253745['Formio']['Promise'](_0xef3969=>{setTimeout(()=>{_0xef3969();},0x0);})['then'](()=>(this['submissionQueue']['push'](_0x1a51cd),this['_saveQueue']()['then'](()=>(this['queueSet']=!0x1,this['Formio']['events']['emit']('offline.queue',_0x1a51cd['request']),this['dequeueSubmissions'](),_0x1a51cd['deferred']['promise']))['catch'](_0x277a87=>console['warn'](_0x277a87))));});}['requestResponse'](_0x1bf10d,_0x4e1606,_0x6e67b9){if(!(_0x1bf10d instanceof Error)&&!this['offline']&&_0x253745['_isAuthResponse'](_0x6e67b9,_0x1bf10d)){const {email:_0x4d1937,password:_0x5d8c2d}=_0x253745['_getRequestData'](_0x6e67b9),_0x200099=_0x1bf10d['headers']['get']('x-jwt-token');this['_hashData'](_0x5d8c2d,_0x4d1937,'SHA-512')['then'](_0x59bcf9=>{const _0x410b10=this['_encodeData'](_0x200099,_0x5d8c2d)['toString'](),_0x4ecdf8=_0x1bf10d['clone']();_0x4ecdf8['headers']['delete']('x-jwt-token');const _0x202b14=this['_digestToHex'](_0x59bcf9);this['_setUserAuthInfo']({'email':_0x4d1937,'password':_0x202b14,'response':_0x4ecdf8,'token':_0x410b10});});}return _0x1bf10d;}['staticRequest'](){if(this['isForcedOffline']())return _0x253745['Formio']['Promise']['resolve']()['then'](()=>this['_throwOfflineError']());}['fileRequest'](_0x4baf57){if('download'===_0x4baf57['method']&&'offline'===_0x4baf57['file']['storage'])return this['db']['getItem'](_0x4f3cd6,_0x4baf57['file']['name'])['then'](_0x4527bf=>_0x4527bf?this['encodeFile'](_0x4527bf['file'])['then'](_0x3045a9=>(_0x3045a9 instanceof Blob?_0x4527bf['file']['url']=URL['createObjectURL'](_0x3045a9):'string'!=typeof _0x3045a9?_0x3045a9['localURL']&&(_0x4527bf['file']['url']=_0x3045a9['localURL']):_0x4527bf['file']['url']=_0x3045a9,_0x4527bf['file'])):_0x253745['Formio']['Promise']['resolve']());if(this['forcedOffline']){const _0x2de806=new Error('Formio\x20is\x20forced\x20into\x20offline\x20mode.');return _0x2de806['networkError']=!0x0,_0x253745['Formio']['Promise']['reject'](_0x2de806);}return _0x253745['Formio']['Promise']['resolve']();}['fromIdbToUri'](_0x57b21c){return this['db']['getItem'](_0x4f3cd6,_0x57b21c)['then'](_0x4085fa=>_0x4085fa&&_0x4085fa['file']?this['fileToDataUri'](_0x4085fa['file']):_0x253745['Formio']['Promise']['resolve'](_0x57b21c));}['wrapRequestPromise'](_0x56ef47,{formio:_0x4ab3e8,type:_0x26cc6b,url:_0x338183,method:_0x2a9052,opts:_0x4418ab,data:_0x14cf4d}){return _0x56ef47['then'](_0x50aece=>_0x50aece['offline']?(this['offline']=!0x0,_0x50aece):(this['offline']=!0x1,_0x50aece))['catch'](_0x22a0ad=>{if(!_0x22a0ad['networkError'])throw _0x22a0ad;if(!this['enabled'])throw _0x22a0ad;this['offline']=!0x0;const _0x4caf4f=this['offlineProject'];if('form'===_0x26cc6b&&'GET'===_0x2a9052){if(!_0x4caf4f||!_0x4caf4f['forms'])throw _0x22a0ad;const _0x45b631=Object['keys'](_0x4caf4f['forms'])['reduce']((_0x336067,_0x548440)=>{if(_0x336067)return _0x336067;const _0x4ba653=_0x4caf4f['forms'][_0x548440];return _0x4ba653['_id']===_0x4ab3e8['formId']||_0x4ba653['path']===_0x4ab3e8['formId']?_0x4ba653:void 0x0;},null);if(!_0x45b631)throw _0x22a0ad['message']+='\x20(No\x20offline\x20cached\x20data\x20found)',_0x22a0ad;return this['currentFormId']=_0x45b631['_id'],_0x45b631;}if('forms'===_0x26cc6b&&'GET'===_0x2a9052){if(!_0x4caf4f||!_0x4caf4f['forms'])throw _0x22a0ad;let _0x41286c=[];for(const _0x5e90cf in _0x4caf4f['forms'])_0x4caf4f['forms']['hasOwnProperty'](_0x5e90cf)&&_0x41286c['push'](_0x4caf4f['forms'][_0x5e90cf]);const _0x2ae3ef=_0xd878e['parse'](_0x338183['split']('?')[0x1]||'');if(_0x2ae3ef['type']&&(_0x41286c=_0x41286c['filter'](_0x29d430=>_0x29d430['type']===_0x2ae3ef['type'])),_0x2ae3ef['tags']){const _0xe9299e=_0x2ae3ef['tags']['split'](',');_0x41286c=_0x41286c['filter'](_0x33cfa0=>{for(const _0x1ab1ab of _0xe9299e)if(_0x33cfa0['tags']&&-0x1!==_0x33cfa0['tags']['indexOf'](_0x1ab1ab))return!0x0;return!0x1;});}return _0x41286c;}if('submission'===_0x26cc6b&&'GET'===_0x2a9052)return this['_getOfflineSubmission'](_0x4ab3e8['formId'],_0x4ab3e8['submissionId'])['then'](_0x3deaf7=>{if(!_0x3deaf7)throw _0x22a0ad;return _0x3deaf7;});if('submissions'===_0x26cc6b&&'GET'===_0x2a9052){const _0xe0fd05=_0xd878e['parse'](_0x338183['split']('?')[0x1]||''),{_id:_0x18610c,path:_0xad4b42}=this['_resolveFormId'](_0x4ab3e8['formId']);return _0xe0fd05['form']={'$in':[_0x18610c,_0xad4b42]},this['notToShowDeletedOfflineSubmissions']&&(_0xe0fd05['$and']=[..._0xe0fd05['$and']||[],{'$_deleted':{'$ne':!0x0}}]),this['db']['search'](_0x186fa7,_0x4ab3e8['formId'],_0xe0fd05)['then'](_0x3dd666=>{const _0x1372ac=Number(_0xe0fd05['limit'])||0xa,_0x454be2=Number(_0xe0fd05['skip'])||0x0;return _0x3dd666['limit']=_0x1372ac,_0x3dd666['skip']=_0x454be2,_0x3dd666['serverCount']=_0x3dd666['length']||0x0,_0x3dd666;});}throw _0x22a0ad;})['then'](_0x448d8d=>{if(_0x4418ab&&(_0x4418ab['skipQueue']||this['skipQueue']))return _0x448d8d;const _0x127156=this['offlineProject'];if(!_0x127156)return _0x448d8d;if('form'===_0x26cc6b&&'DELETE'!==_0x2a9052){if(_0x127156['forms'][_0x448d8d['name']]&&new Date(_0x127156['forms'][_0x448d8d['name']]['modified'])>=new Date(_0x448d8d['modified']))return _0x448d8d;const _0x204443=_0x51ca4d(_0x448d8d);_0x204443['offline']=!0x0,_0x127156['forms'][_0x448d8d['name']]=_0x204443;}else{if('form'===_0x26cc6b&&'DELETE'===_0x2a9052){const {_id:_0x12edcb,path:_0x19fe63}=this['_resolveFormId'](_0x4ab3e8['formId']);let _0x1ed0af='';_0x127156['forms']&&(Object['values'](_0x127156['forms'])['forEach'](_0x2006c4=>{_0x2006c4['path']!==_0x19fe63&&_0x2006c4['_id']!==_0x12edcb||(_0x1ed0af=_0x2006c4['path']);}),delete _0x127156['forms'][_0x1ed0af]);}else{if('forms'!==_0x26cc6b||'GET'!==_0x2a9052){if('submission'!==_0x26cc6b||'DELETE'===_0x2a9052||_0x448d8d['offline']){if('submission'===_0x26cc6b&&'DELETE'===_0x2a9052)return this['_deleteOfflineSubmission'](_0x4ab3e8['formId'],_0x4ab3e8['submissionId'],!_0x448d8d['offline'])['catch'](_0x253fce),_0x448d8d;if('submissions'===_0x26cc6b&&'GET'===_0x2a9052){if(!_0x448d8d['length']||_0x448d8d['every'](_0x130e3e=>_0x130e3e['offline']))return _0x448d8d;try{const {_id:_0x19262e,path:_0x240b90}=this['_resolveFormId'](_0x4ab3e8['formId']);this['setItems'](_0x186fa7,_0x448d8d,(_0x19262e||_0x240b90)+'-');}catch(_0x212799){console['warn']('Error\x20storing\x20offline\x20submissions:',_0x212799);}return _0x448d8d;}return _0x448d8d;}return this['_saveOfflineSubmission'](_0x4ab3e8['formId'],_0x448d8d)['catch'](_0x253fce),_0x448d8d;}if(_0x448d8d['length']&&_0x448d8d[0x0]['offline'])return _0x448d8d;_0x448d8d['forEach'](_0x4a2cff=>{const _0x337286=_0x51ca4d(_0x4a2cff);_0x337286['offline']=!0x0,_0x127156['forms'][_0x4a2cff['name']]=_0x337286;});}}this['_removeCacheDuplicates'](_0x127156);try{this['readyQueue']['push'](this['setItem'](_0x5b1832,this['projectId'],_0x127156));}catch(_0x2bfbfe){console['warn']('Error\x20updating\x20project\x20cache:',_0x2bfbfe);}return _0x448d8d;});}['wrapStaticRequestPromise'](_0x1c59bb,{url:_0x584278,method:_0x2d67bf,opts:_0x18b500}){return _0x1c59bb['then'](_0x4a0a1e=>(this['offline']=!0x1,_0x4a0a1e))['catch'](_0x68cef3=>{if(!_0x68cef3['networkError'])throw _0x68cef3;if(!this['enabled'])throw _0x68cef3;return this['getItem'](_0x39ad9f,_0x2d67bf+'-'+_0x584278)['then'](_0x256f45=>{if(!_0x256f45){const _0x4ada69=_0xd878e['parse'](_0x584278['split']('?')[0x1]||'');return _0x4ada69['_id']={'$regex':'^'+_0x2d67bf+'-'+_0x584278['split']('?')[0x0]},this['db']['search'](_0x39ad9f,null,_0x4ada69)['then'](_0x1c0360=>{const _0x2f299a=Number(_0x4ada69['limit'])||0xa,_0x5d9d90=Number(_0x4ada69['skip'])||0x0;return _0x1c0360['limit']=_0x2f299a,_0x1c0360['skip']=_0x5d9d90,_0x1c0360['serverCount']=_0x1c0360['length']||0x0,'GET'===_0x2d67bf&&Array['isArray'](_0x1c0360)&&this['currentFormId']?_0x1c0360['filter'](_0x21acee=>_0x21acee['form']===this['currentFormId']):_0x1c0360;});}return _0x256f45['offline']=!0x0,_0x256f45;});})['then'](_0x238fbd=>{if(_0x18b500&&(_0x18b500['skipQueue']||this['skipQueue']))return _0x238fbd;if(_0x238fbd&&!_0x238fbd['offline'])try{Array['isArray'](_0x238fbd)?this['setItems'](_0x39ad9f,_0x238fbd,_0x2d67bf+'-'+_0x584278['split']('?')[0x0]+'-'):this['setItem'](_0x39ad9f,_0x2d67bf+'-'+_0x584278,_0x238fbd);}catch(_0x206397){console['warn']('Error\x20caching\x20static\x20request:',_0x206397);}return _0x238fbd;});}['wrapFileRequestPromise'](_0x1a6c47,_0x1c0a55){return _0x1c0a55['method'],_0x1c0a55['type'],_0x1c0a55['url'],_0x1a6c47['then'](_0x5020ca=>(this['offline']=!0x1,_0x5020ca))['catch'](_0x36f813=>{if(!_0x36f813['networkError'])throw _0x36f813;if(!this['enabled'])throw _0x36f813;if('upload'===_0x1c0a55['method'])return this['encodeFile'](_0x1c0a55['file'])['then'](_0x47ab1f=>(_0x1c0a55['file']=_0x47ab1f,this['db']['setItem'](_0x4f3cd6,_0x1c0a55['fileName'],_0x1c0a55)['then'](()=>({'storage':'offline','name':_0x1c0a55['fileName'],'size':_0x1c0a55['file']['size'],'type':_0x1c0a55['file']['type']}))));throw _0x36f813;});}['wrapFetchRequestPromise'](_0x49aa95,{url:_0x428b8c,method:_0x53ff65,opts:_0x4e1ea0,data:_0x4f83cf}){return _0x49aa95['then'](_0xb03699=>_0xb03699)['catch'](_0x1705f5=>{if(!this['enabled'])throw _0x1705f5;const {email:_0x313271,password:_0x37f87d}=_0x253745['_getRequestData'](_0x4f83cf);if('POST'===_0x53ff65&&_0x313271&&_0x37f87d)return this['_authenticateOffline'](_0x4f83cf,_0x428b8c);throw _0x1705f5;});}['forceOffline'](_0x76da17){this['forcedOffline']=!0x0===_0x76da17;}['isForcedOffline'](){return!0x0===this['forcedOffline'];}['_executeHooks'](_0x4fd4c3){return _0x2d7e8a=this,_0x54b2ce=void 0x0,_0x29eadc=function*(){for(const {hook:_0x5909a3,options:_0x7bebe}of this['_beforeRequestHooks'])if(!_0x7bebe['fromOffline']||_0x7bebe['fromOffline']&&(_0x4fd4c3['data']&&_0x4fd4c3['data']['offline']||_0x4fd4c3['offline'])){const _0x1d88e5=yield _0x5909a3(_0x4fd4c3);return this['_processHookResult'](_0x1d88e5);}},new((_0x15f76e=void 0x0)||(_0x15f76e=Promise))(function(_0x123483,_0x37801c){function _0x248f09(_0x54e70a){try{_0x18d4fd(_0x29eadc['next'](_0x54e70a));}catch(_0x181ef0){_0x37801c(_0x181ef0);}}function _0x4c6b4a(_0x10b9c4){try{_0x18d4fd(_0x29eadc['throw'](_0x10b9c4));}catch(_0x4db33d){_0x37801c(_0x4db33d);}}function _0x18d4fd(_0x451bdb){var _0x266195;_0x451bdb['done']?_0x123483(_0x451bdb['value']):(_0x266195=_0x451bdb['value'],_0x266195 instanceof _0x15f76e?_0x266195:new _0x15f76e(function(_0x1b2e5b){_0x1b2e5b(_0x266195);}))['then'](_0x248f09,_0x4c6b4a);}_0x18d4fd((_0x29eadc=_0x29eadc['apply'](_0x2d7e8a,_0x54b2ce||[]))['next']());});var _0x2d7e8a,_0x54b2ce,_0x15f76e,_0x29eadc;}['_processHookResult'](_0x486a98){if(!0x0!==_0x486a98){const {result:_0x2d0b09,options:_0x3ded3c}=_0x486a98;let _0x3005ca;throw _0x3005ca=_0x2d0b09 instanceof Error?_0x2d0b09:'string'==typeof _0x2d0b09?new Error(_0x2d0b09):new Error('Hook\x20failed,\x20request\x20won\x27t\x20be\x20sent'),_0x3ded3c&&_0x3ded3c['delete']&&(_0x3005ca['deleteFromQueue']=!0x0),_0x3005ca;}}['getSubmissionQueueIndex'](_0x4729cb){let _0x430e9e=-0x1;if(_0x4729cb['_id']&&_0x4729cb['form']){for(let _0x4dbc92=0x0;_0x4dbc92<this['submissionQueue']['length'];_0x4dbc92++)if(this['submissionQueue'][_0x4dbc92]['request']&&this['submissionQueue'][_0x4dbc92]['request']['form']===_0x4729cb['form']&&this['submissionQueue'][_0x4dbc92]['request']['_id']===_0x4729cb['_id']){_0x430e9e=_0x4dbc92;break;}}return _0x430e9e;}['submissionQueueLength'](){return(this['submissionQueue']||[])['length'];}['getSubmissionQueueSubmission'](_0x1ef631,_0x13c009){const _0x18dba1=this['getSubmissionQueueIndex']({'form':_0x1ef631,'_id':_0x13c009});return-0x1===_0x18dba1?null:_0x51ca4d(this['submissionQueue'][_0x18dba1]);}['emptySubmissionQueue'](){return this['submissionQueue']=[],this['ready']['then'](()=>this['_saveQueue']())['then'](()=>this['db']['clear'](_0x4c4fc3));}['removeSubmissionQueueSubmission'](_0xb34bde){const _0x80aff3=this['getSubmissionQueueIndex'](_0xb34bde);return-0x1!==_0x80aff3?(this['submissionQueue']['splice'](_0x80aff3,0x1),this['_saveQueue']()):_0x253745['Formio']['Promise']['resolve']();}['updateSubmissionQueueSubmission'](_0x51baa9){const _0x2f072c=this['getSubmissionQueueIndex'](_0x51baa9);return-0x1!==_0x2f072c?(this['_saveOfflineSubmission'](this['submissionQueue'][_0x2f072c]['request']['form'],_0x51baa9),this['submissionQueue'][_0x2f072c]['request']['data']=_0x51ca4d(_0x51baa9),this['_saveQueue']()):_0x253745['Formio']['Promise']['resolve']();}['getNextQueuedSubmission'](){if(0x0!==this['submissionQueueLength']())return this['submissionQueue'][0x0]['request'];}['setNextQueuedSubmission'](_0x9f5c0a){return 0x0===this['submissionQueueLength']()?_0x253745['Formio']['Promise']['reject']('The\x20submissionQueue\x20is\x20empty.'):(this['submissionQueue'][0x0]['request']=_0x9f5c0a,this['_saveQueue']());}['skipNextQueuedSubmission'](){return this['submissionQueue']['shift'](),this['_saveQueue']();}['clearOfflineSubmissions'](){return this['ready']['then'](()=>this['db']['clear'](_0x186fa7))['catch'](_0x532583=>{console['warn']('Error\x20deleting\x20offline\x20submissions:',_0x532583);});}['clearOfflineData'](){return this['offlineProject']={'forms':{}},this['submissionQueue']=[],this['ready']['then'](()=>this['db']['clear'](_0x4c4fc3))['then'](()=>this['db']['clear'](_0x5b1832))['then'](()=>this['db']['clear'](_0x186fa7))['then'](()=>this['db']['clear'](_0x412fe9))['then'](()=>this['db']['clear'](_0x39ad9f));}['sendRequest'](_0x35f75f){return this['Formio']['request'](_0x35f75f['url'],_0x35f75f['method'],_0x35f75f['data']);}['dequeueSubmissions'](_0x5ea670=!0x1,_0x51743c=0x0,_0x12e8d0=!0x1,_0x2f6249){const _0x48bd30=_0xcfaca1=>{const _0x3c9a1c=this['submissionQueue']['splice'](_0x51743c,0x1)['pop']();if(this['_saveQueue'](),'POST'===_0x3c9a1c['request']['method']&&_0xcfaca1['_id']!==_0x3c9a1c['request']['data']['_id']){const _0x19e272=_0x3c9a1c['request']['data']['_id'];this['submissionQueue']['forEach'](_0x1ea596=>{(_0x1ea596['request']['_id']||_0x1ea596['request']['data']['_id'])===_0x19e272&&['PUT','DELETE']['includes'](_0x1ea596['request']['method'])&&(_0x1ea596['request']['_id']=_0xcfaca1['_id'],_0x1ea596['request']['data']&&(_0x1ea596['request']['data']['_id']=_0xcfaca1['_id']),_0x1ea596['request']['url']=_0x1ea596['request']['url']['replace'](_0x19e272,_0xcfaca1['_id']),this['_saveQueue']());});}return this['_deleteOfflineSubmission'](_0x3c9a1c['request']['form'],_0x3c9a1c['request']['_id'],!0x0)['then'](()=>{if('DELETE'!==_0x3c9a1c['request']['method'])return this['_saveOfflineSubmission'](_0x3c9a1c['request']['form'],_0xcfaca1)['catch'](_0x253fce);})['catch'](_0x253fce),_0x3c9a1c['deferred']&&'pending'===_0x3c9a1c['deferred']['state']?_0x3c9a1c['deferred']['resolve'](_0xcfaca1):'DELETE'!==_0x3c9a1c['request']['method']&&this['Formio']['events']['emit']('offline.formSubmission',_0xcfaca1,_0x3c9a1c),this['dequeuing']=!0x1,this['dequeueSubmissions'](_0x5ea670,0x0,_0x12e8d0,_0x2f6249);},_0x587c41=_0xd983dd=>{this['dequeuing']=null;const _0x272bb5=this['submissionQueue'][_0x51743c];if(!_0xd983dd['networkError'])return this['Formio']['events']['emit']('offline.formError',_0xd983dd,_0x272bb5),this['dequeuing']=!0x1,this['submissionQueue'][_0x51743c]['attempts']--,(_0xd983dd['deleteFromQueue']||this['submissionQueue'][_0x51743c]['attempts']<=0x0||this['deleteErrorSubmissions'])&&(this['submissionQueue']['splice'](_0x51743c,0x1),_0x5ea670)?this['dequeueSubmissions'](_0x5ea670,0x0,_0x12e8d0,_0x2f6249):_0x5ea670?(this['errorQueue']['push'](...this['submissionQueue']['splice'](_0x51743c,0x1)),this['dequeueSubmissions'](_0x5ea670,0x0,_0x12e8d0,_0x2f6249)):void((_0x272bb5['deferred']&&'pending'===_0x272bb5['deferred']['state']||_0x272bb5['attempts']<=0x0)&&(this['submissionQueue']['splice'](_0x51743c,0x1),this['_saveQueue'](),_0x272bb5['deferred']['reject'](_0xd983dd)));_0x272bb5===this['submissionQueue'][_0x51743c]&&this['Formio']['events']['emit']('offline.requeue',_0x272bb5);const _0x633ae7=this['submissionQueue']['filter'](_0x464aa0=>_0x464aa0['deferred']&&'pending'===_0x464aa0['deferred']['state']);_0x633ae7['filter'](_0x499626=>'POST'===_0x499626['request']['method'])['forEach'](_0x2be68b=>{const _0x482b44=this['Formio']['getUser']();Object['assign'](_0x2be68b['request']['data'],{'offline':!0x0,'owner':_0x482b44?_0x482b44['_id']:null,'created':new Date()['toISOString'](),'modified':new Date()['toISOString']()}),this['_saveOfflineSubmission'](_0x2be68b['request']['form'],_0x2be68b['request']['data'])['catch'](_0x253fce),_0x2be68b['deferred']['resolve'](_0x2be68b['request']['data']);}),_0x633ae7['filter'](_0x1114ea=>'PUT'===_0x1114ea['request']['method'])['forEach'](_0x333978=>{this['_getOfflineSubmission'](_0x333978['request']['form'],_0x333978['request']['_id'],_0x333978)['then'](_0x1af32b=>{Object['assign'](_0x1af32b,_0x333978['request']['data']),_0x1af32b['modified']=new Date()['toISOString'](),_0x333978['request']['data']=_0x1af32b,this['_saveOfflineSubmission'](_0x1af32b['form'],_0x1af32b)['catch'](_0x253fce),_0x333978['deferred']['resolve'](_0x1af32b);})['catch'](_0x253fce);}),_0x633ae7['filter'](_0x541df5=>'DELETE'===_0x541df5['request']['method'])['forEach'](_0x3f2bf2=>{_0x3f2bf2['deferred']['resolve']({'offline':!0x0});}),this['_saveQueue'](),this['cacheError']&&this['onError'](this['cacheError']);};return this['ready']['then'](()=>{if(this['dequeuing'])return;if(!this['submissionQueue']['length'])return void(_0x5ea670&&(this['submissionQueue']['push'](...this['errorQueue']),this['_saveQueue'](),this['errorQueue']=[]));if(_0x2f6249&&'function'==typeof _0x2f6249)for(let _0x161bcf=_0x51743c;_0x161bcf<this['submissionQueueLength']();_0x161bcf++){const _0x2a66b5=this['submissionQueue'][_0x161bcf]['request'];if((!this['noAutomaticDequeue']||!(_0x2a66b5['data']&&_0x2a66b5['data']['offline']||_0x2a66b5['offline'])||_0x12e8d0)&&_0x2f6249(_0x2a66b5)){_0x51743c=_0x161bcf;break;}_0x161bcf===this['submissionQueueLength']()-0x1&&(_0x51743c=-0x1);}if(!this['submissionQueue'][_0x51743c])return _0x253745['Formio']['Promise']['resolve']();const {request:_0x17f53e}=this['submissionQueue'][_0x51743c];return this['dequeuing']=!0x0,this['Formio']['events']['emit']('offline.dequeue',_0x17f53e),_0x253745['Formio']['Promise']['resolve']()['then'](()=>this['isForcedOffline']()?this['_throwOfflineError']():['PUT','POST']['includes'](_0x17f53e['method'])?this['_resolveFiles'](_0x17f53e['form'],_0x17f53e['formUrl'],_0x17f53e['data']):void 0x0)['then'](()=>this['_beforeRequestHooks']['length']?this['_executeHooks'](_0x17f53e)['then'](()=>this['sendRequest'](_0x17f53e)):this['sendRequest'](_0x17f53e))['then'](_0x48bd30)['catch'](_0x587c41);});}['setItem'](_0x1848d6,_0x13da59,_0x36507f){if(!this['enabled'])return _0x253745['Formio']['Promise']['resolve']();try{return this['db']['setItem'](_0x1848d6,_0x13da59,_0x36507f);}catch(_0xf1f233){throw this['cacheError']=_0xf1f233,_0xf1f233;}}['setItems'](_0x3f2850,_0x2f5f26,_0x5ae1b5){if(!this['enabled'])return _0x253745['Formio']['Promise']['resolve']();try{return this['db']['setItems'](_0x3f2850,_0x2f5f26,_0x5ae1b5);}catch(_0x501ffa){throw this['cacheError']=_0x501ffa,_0x501ffa;}}['getItem'](_0x5d8bb8,_0x388d4d){return this['db']['getItem'](_0x5d8bb8,_0x388d4d);}['clearAll'](){return this['db']['clearAll']();}['_throwOfflineError'](){const _0x180dd6=new Error('Formio\x20is\x20forced\x20into\x20offline\x20mode.');throw _0x180dd6['networkError']=!0x0,_0x180dd6;}['_saveQueue'](){this['submissionQueue']['length']||this['Formio']['events']['emit']('offline.queueEmpty');const _0xb21a54=this['setItem'](_0x4c4fc3,'queue',{'queue':this['submissionQueue']})['then'](()=>{this['Formio']['events']['emit']('offline.saveQueue',this['submissionQueue']['length']);})['catch'](_0x29f744=>(console['warn']('Error\x20persisting\x20submission\x20queue:',_0x29f744),_0x253745['Formio']['Promise']['resolve']()));return this['readyQueue']['push'](_0xb21a54),_0xb21a54;}['_removeCacheDuplicates'](_0x42fb7d){Object['keys'](_0x42fb7d['forms'])['forEach'](_0x13b1d8=>{const _0x14b5c1=_0x42fb7d['forms'][_0x13b1d8];_0x14b5c1&&Object['keys'](_0x42fb7d['forms'])['forEach'](_0xff278b=>{const _0x7d87a4=_0x42fb7d['forms'][_0xff278b];(_0x14b5c1['_id']===_0x7d87a4['_id']||_0x14b5c1['path']===_0x7d87a4['path'])&&new Date(_0x7d87a4['modified'])<new Date(_0x14b5c1['modified'])&&delete _0x42fb7d['forms'][_0xff278b];});});}['_isFormOffline'](_0x5b08f4){if(this['offlineProject']['forms'][_0x5b08f4])return!0x0;for(const _0x9bd434 of Object['keys'](this['offlineProject']['forms']))if(this['offlineProject']['forms'][_0x9bd434]['path']===_0x5b08f4||this['offlineProject']['forms'][_0x9bd434]['_id']===_0x5b08f4)return!0x0;return!0x1;}['_resolveFormId'](_0x495d2f){const _0x2cdbfd={'_id':null,'path':null};if(_0x3a7a1a()['isValid'](_0x495d2f))_0x2cdbfd['_id']=_0x495d2f,Object['keys'](this['offlineProject']['forms'])['forEach'](_0x4acf13=>{this['offlineProject']['forms'][_0x4acf13]['_id']===_0x495d2f&&(_0x2cdbfd['path']=_0x4acf13);});else{_0x2cdbfd['path']=_0x495d2f;const {forms:_0xcc243d}=this['offlineProject'],_0x25cfd1=_0xcc243d[_0x495d2f]||Object['values'](_0xcc243d)['find'](_0x438c66=>_0x438c66['path']===_0x495d2f);_0x25cfd1&&(_0x2cdbfd['_id']=_0x25cfd1['_id']);}return _0x2cdbfd;}['_getFormByPath'](_0x53314e){for(const _0x462dda in this['offlineProject']['forms'])if(this['offlineProject']['forms']['hasOwnProperty'](_0x462dda)&&(this['offlineProject']['forms'][_0x462dda]['path']===_0x53314e||this['offlineProject']['forms'][_0x462dda]['_id']===_0x53314e))return _0x253745['Formio']['Utils']['fastCloneDeep'](this['offlineProject']['forms'][_0x462dda]);}['_resolveFiles'](_0x4122b3,_0x599ee2,_0x399a16){const _0xda2769=[];if(!_0x399a16)return _0x253745['Formio']['Promise']['resolve']();const _0x51d15c=this['_getFormByPath'](_0x4122b3);return void 0x0===_0x51d15c?_0x253745['Formio']['Promise']['reject']('No\x20form\x20found'):(_0x51d15c['components']=_0x51d15c['components']||[],_0x253745['Formio']['Utils']['eachComponent'](_0x51d15c['components'],_0x2a09b1=>{if('file'!==_0x2a09b1['type'])return;const _0x3d66bb=_0x253745['Formio']['Utils']['getValue'](_0x399a16,_0x2a09b1['key']);null!=_0x3d66bb&&_0x3d66bb instanceof Array&&_0x3d66bb['forEach']((_0x39dedc,_0x407959)=>{'offline'===_0x39dedc['storage']&&_0xda2769['push'](this['db']['getItem'](_0x4f3cd6,_0x39dedc['name'])['then'](_0x3228e7=>_0x3228e7?this['decodeFile'](_0x3228e7['file'])['then'](_0x111572=>new this['Formio'](_0x599ee2)['uploadFile'](_0x3228e7['provider'],_0x111572,_0x3228e7['fileName'],_0x3228e7['dir'])):_0x253745['Formio']['Promise']['reject']('Cannot\x20resolve\x20file\x20'+_0x39dedc['name']+'\x20since\x20it\x20was\x20deleted\x20before\x20processing'))['then'](_0x71f75c=>{if('offline'===_0x71f75c['storage']){const _0x2165e=new Error('Could\x20not\x20resolve\x20online\x20file.');throw _0x2165e['networkError']=!0x0,_0x2165e;}return _0x3d66bb[_0x407959]=_0x71f75c,this['db']['removeItem'](_0x4f3cd6,_0x39dedc['name'])['catch'](_0x139b19=>{console['warn']('Error\x20removing\x20file\x20from\x20offline\x20files\x20storage',_0x139b19);});}));});}),_0x253745['Formio']['Promise']['all'](_0xda2769));}['_saveOfflineSubmission'](_0x5ca831,_0x4289e9){const {_id:_0x7a064b,path:_0x555557}=this['_resolveFormId'](_0x5ca831);if(!this['_isFormOffline'](_0x555557))return _0x253745['Formio']['Promise']['resolve']();_0x5ca831=_0x7a064b||_0x555557;const _0x78ea8a=_0x51ca4d(_0x4289e9);return _0x78ea8a['offline']=!0x0,this['setItem'](_0x186fa7,_0x5ca831+'-'+_0x4289e9['_id'],_0x78ea8a)['catch'](_0x1ae1a0=>{throw console['warn']('Failed\x20to\x20save\x20offline\x20submission:',_0x1ae1a0),_0x1ae1a0;});}['_getOfflineSubmission'](_0x4f06c8,_0x353462,_0x1df133){const {_id:_0x2f4ad0,path:_0x155f42}=this['_resolveFormId'](_0x4f06c8);return this['getItem'](_0x186fa7,_0x155f42+'-'+_0x353462)['then'](_0x20e336=>_0x20e336||this['getItem'](_0x186fa7,_0x2f4ad0+'-'+_0x353462))['then'](_0x14b568=>_0x14b568||this['submissionQueue']['reduce']((_0xaad648,_0x285203)=>{if((_0x285203['request']['_id']||_0x285203['request']['data']['_id'])!==_0x353462||_0x285203===_0x1df133)return _0xaad648;if('POST'===_0x285203['request']['method'])return _0x51ca4d(_0x285203['request']['data']);if('PUT'===_0x285203['request']['method']){const _0x2e1640=_0x51ca4d(_0xaad648);return _0x2e1640['data']=_0x285203['request']['data']['data'],_0x2e1640['modified']=new Date()['toISOString'](),_0x2e1640;}return'DELETE'===_0x285203['request']['method']?null:void 0x0;},_0x14b568))['catch'](_0x5ef018=>{throw console['warn']('Error\x20retrieving\x20offline\x20submission:',_0x5ef018),_0x5ef018;});}['_deleteOfflineSubmission'](_0x595152,_0x1dcabe,_0x1424e6=!0x1){const {_id:_0x14a161,path:_0x5401a9}=this['_resolveFormId'](_0x595152);let _0x2752c0=null;return[_0x5401a9+'-'+_0x1dcabe,_0x14a161+'-'+_0x1dcabe]['reduce']((_0x5154dc,_0x50a679)=>_0x5154dc['then'](()=>this['getItem'](_0x186fa7,_0x50a679)['then'](_0x484257=>_0x484257&&!_0x1424e6?(_0x484257['$_deleted']=!0x0,this['setItem'](_0x186fa7,_0x50a679,_0x484257)['catch'](_0x474ae5=>{_0x2752c0=_0x474ae5;})):this['db']['removeItem'](_0x186fa7,_0x50a679)['catch'](_0xdd6847=>{_0x2752c0=_0xdd6847;}))),_0x253745['Formio']['Promise']['resolve']())['catch'](_0xef314c=>{throw console['warn']('Error\x20deleting\x20offline\x20submission:',_0xef314c),_0xef314c;})['then'](()=>{if(_0x2752c0)throw console['warn']('Error\x20deleting\x20offline\x20submission:',_0x2752c0),_0x2752c0;});}['_uniqueFilter'](_0x3ccff6,_0x2e2707,_0x518369){return _0x518369['indexOf'](_0x3ccff6)===_0x2e2707;}['_setUserAuthInfo'](_0x163fb7){this['_usersData'][_0x163fb7['email']]=_0x163fb7;}['_saveUser'](_0x4ee51f){if(this['_currentUser']=_0x4ee51f,!_0x4ee51f||!this['_usersData'][_0x4ee51f['data']['email']])return;const _0x2943a8=Object['assign']({},this['_usersData'][_0x4ee51f['data']['email']]),_0x67738a={'auth':_0x2943a8,'user':_0x4ee51f};this['setItem'](_0x412fe9,_0x2943a8['response']['url']+'-'+_0x4ee51f['data']['email'],_0x67738a)['then'](()=>{delete this['_usersData'][_0x4ee51f['data']['email']];})['catch'](_0x32957d=>{this['_currentUser']=null,console['warn']('Cannot\x20save\x20user\x20data:\x20',_0x32957d);});}['_hashData'](_0x280e1d,_0xb152b2,_0x3d82f2){const _0x3eee95=new _0x3ccc76['TextEncoder']();return crypto['subtle']['digest'](_0x3d82f2,_0x3eee95['encode'](''+_0x280e1d+_0xb152b2));}['_encodeData'](_0x180982,_0x1ae025){return _0x4dcb57()['encrypt'](_0x180982,_0x1ae025);}['_decodeData'](_0x528559,_0x1eeee8){return _0x4dcb57()['decrypt'](_0x528559,_0x1eeee8);}['_getSavedUser']({email:_0x362a79},_0x3acaab){return this['getItem'](_0x412fe9,_0x3acaab+'-'+_0x362a79)['then'](_0x33c846=>_0x33c846||new Error('User\x20or\x20password\x20was\x20incorrect'));}['_digestToHex'](_0x232e87){return Array['from'](new Uint8Array(_0x232e87))['map'](_0x50633d=>_0x50633d['toString'](0x10)['padStart'](0x2,'0'))['join']('');}['_checkPassword'](_0x34cdbc,_0x20eed4,_0x5bb94d){return this['_hashData'](_0x20eed4,_0x34cdbc,'SHA-512')['then'](_0x1275e8=>this['_digestToHex'](_0x1275e8)===_0x5bb94d['password']);}['_authenticateOffline'](_0x5802fb,_0x4f305b){return this['_getSavedUser'](_0x5802fb['data'],_0x4f305b)['then'](({auth:_0x91dc75,user:_0x4b503e})=>{const {email:_0x1f4f95,password:_0x35f95c}=_0x253745['_getRequestData'](_0x5802fb);return this['_checkPassword'](_0x1f4f95,_0x35f95c,_0x91dc75)['then'](_0x425322=>{const _0x3a9e33=_0x91dc75['response'];if(_0x425322){const _0x5f1a80=this['_decodeData'](_0x91dc75['token'],_0x35f95c)['toString']();_0x3a9e33['headers']['map']['x-jwt-token']=_0x5f1a80;const _0x2e181e={'status':0xc8,'statusText':'OK'},_0x24d481=new Response(_0x3a9e33['_bodyBlob'],_0x2e181e);return this['_mapHeaders'](_0x3a9e33,_0x24d481),_0x24d481['offline']=!0x0,_0x24d481;}{const _0x4e02a8={'status':0x191,'statusText':'Unauthorized','headers':{'Content-Type':'text/html','Cache-Control':'no-cache,max-age=0'}},_0x2a0e69=new Blob(['User\x20or\x20password\x20was\x20incorrect'],{'type':'text/html'}),_0x2df216=new Response(_0x2a0e69,_0x4e02a8);return _0x2df216['offline']=!0x0,_0x2df216;}});})['catch'](_0x5e1466=>_0x5e1466);}['_mapHeaders'](_0x596e69,_0x44b56){Object['entries'](_0x596e69['headers']['map'])['forEach'](([_0x153a2a,_0x4fd60f])=>{_0x44b56['headers']['set'](_0x153a2a,_0x4fd60f);});}['_shouldSkipQueue']({formio:_0x3219f9,type:_0x176be5,url:_0x554f36,method:_0x3366ed,data:_0xf7d560,opts:_0x36aa49}){const {email:_0x291e10,password:_0x268c31}=_0x253745['_getRequestData'](_0xf7d560);return _0x36aa49&&_0x36aa49['skipQueue']||this['skipQueue']||'submission'!==_0x176be5||!['POST','PUT','DELETE']['includes'](_0x3366ed)||_0x291e10&&_0x268c31&&'POST'===_0x3366ed;}['_ping'](_0x2add90,_0xaa76b9){let _0x3f0cd1=!0x0;this['Formio']['fetch'](this['Formio']['getBaseUrl']())['then'](()=>{_0x3f0cd1=!0x1,_0x2add90();})['catch'](()=>{_0x3f0cd1=!0x1,_0xaa76b9();}),setTimeout(()=>{_0x3f0cd1&&(_0x3f0cd1=!0x1,_0xaa76b9());},0xbb8);}static['_isAuthResponse'](_0x5db0d7,_0x34c910){const _0x23f337=_0x34c910['headers']['get']('x-jwt-token');if(_0x34c910['status']>=0xc8&&_0x34c910['status']<0x12c&&_0x23f337&&''!==_0x23f337){const {email:_0x475ea4,password:_0xde1a92}=_0x253745['_getRequestData'](_0x5db0d7);if(_0x475ea4&&_0xde1a92)return!0x0;}return!0x1;}static['_getRequestData'](_0x212d8b){return _0x212d8b&&_0x212d8b['data']?_0x212d8b['data']:{};}}_0x253745['Formio']=null;var _0x10593f=_0x253745;_0x253745['OfflinePlugin'];}()),_0x7db48d['default'];}());});
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formio/offline-plugin",
|
|
3
|
+
"main": "offlinePlugin.js",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "yarn build:pkg && yarn build:portal",
|
|
6
|
+
"build:portal": "rm -rf dist && rm -rf lib && node setLicense --mockLicense && tsc && webpack --config config/webpack.prod.js && webpack --config config/webpack.embed.js",
|
|
7
|
+
"build:pkg": "rm -rf build && rm -rf lib && node setLicense && tsc && webpack --config config/webpack.dist.js",
|
|
8
|
+
"watch": "tsc --watch",
|
|
9
|
+
"lint": "eslint index.js",
|
|
10
|
+
"test": "node test/run.js",
|
|
11
|
+
"test:debug": "mocha-puppeteer ./test/test.js --devtools -t 0",
|
|
12
|
+
"circle": "./node_modules/phantomjs-prebuilt/bin/phantomjs --debug=true --web-security=false ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html",
|
|
13
|
+
"release": "yarn build && yarn publish ./build --access public"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"chai": "^4.3.4",
|
|
17
|
+
"chalk": "4",
|
|
18
|
+
"express": "^4.19.2",
|
|
19
|
+
"fake-indexeddb": "^5.0.2",
|
|
20
|
+
"http-server": "^14.1.1",
|
|
21
|
+
"javascript-obfuscator": "^4.1.0",
|
|
22
|
+
"jsdom": "^24.1.0",
|
|
23
|
+
"jsdom-global": "^3.0.2",
|
|
24
|
+
"mocha": "^10.4.0",
|
|
25
|
+
"mock-local-storage": "^1.1.24",
|
|
26
|
+
"puppeteer": "^22.10.0",
|
|
27
|
+
"ts-node": "^10.9.2",
|
|
28
|
+
"ts-sinon": "^2.0.2",
|
|
29
|
+
"tslint": "^6.1.2",
|
|
30
|
+
"typescript": "^5.4.5",
|
|
31
|
+
"webpack": "^5.91.0",
|
|
32
|
+
"webpack-cli": "^5.1.4",
|
|
33
|
+
"webpack-obfuscator": "^3.5.1",
|
|
34
|
+
"ws": "^8.17.0",
|
|
35
|
+
"@formio/license": "^2.0.0-rc.1",
|
|
36
|
+
"webpack-node-externals": "^3.0.0",
|
|
37
|
+
"copy-webpack-plugin": "^12.0.2"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@formio/js": "5.0.0-rc.81",
|
|
41
|
+
"bson-objectid": "^2.0.1",
|
|
42
|
+
"crypto-js": "^4.2.0",
|
|
43
|
+
"pouchdb-browser": "^8.0.1",
|
|
44
|
+
"pouchdb-erase": "^1.0.2",
|
|
45
|
+
"pouchdb-find": "^8.0.1",
|
|
46
|
+
"promise-polyfill": "^8.3.0",
|
|
47
|
+
"querystring": "^0.2.1",
|
|
48
|
+
"text-encoding-shim": "^1.0.5",
|
|
49
|
+
"webcrypto-shim": "^0.1.7",
|
|
50
|
+
"whatwg-fetch": "^3.6.20"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {},
|
|
53
|
+
"version": "5.0.0-rc.18",
|
|
54
|
+
"files": [
|
|
55
|
+
"*"
|
|
56
|
+
]
|
|
57
|
+
}
|