@mindbowser_inc/ui-feedback-plugin 0.1.0
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 +163 -0
- package/dist/firebase-BGU5KpRU.mjs +15481 -0
- package/dist/firebase-BGU5KpRU.mjs.map +1 -0
- package/dist/html2canvas.esm-d2sM-0Wm.mjs +4871 -0
- package/dist/html2canvas.esm-d2sM-0Wm.mjs.map +1 -0
- package/dist/index-BcqBbswO.mjs +18420 -0
- package/dist/index-BcqBbswO.mjs.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/s3-DkzKoz0A.mjs +32 -0
- package/dist/s3-DkzKoz0A.mjs.map +1 -0
- package/dist/supabase-BUHP2OkK.mjs +128 -0
- package/dist/supabase-BUHP2OkK.mjs.map +1 -0
- package/dist/ui-feedback-plugin.es.js +1382 -0
- package/dist/ui-feedback-plugin.es.js.map +1 -0
- package/dist/ui-feedback-plugin.umd.js +3036 -0
- package/dist/ui-feedback-plugin.umd.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,3036 @@
|
|
|
1
|
+
(function(wt,ze){typeof exports=="object"&&typeof module<"u"?ze(exports):typeof define=="function"&&define.amd?define(["exports"],ze):(wt=typeof globalThis<"u"?globalThis:wt||self,ze(wt.UIFeedbackPlugin={}))})(this,function(wt){"use strict";var jR=Object.defineProperty;var $R=(wt,ze,Et)=>ze in wt?jR(wt,ze,{enumerable:!0,configurable:!0,writable:!0,value:Et}):wt[ze]=Et;var pt=(wt,ze,Et)=>$R(wt,typeof ze!="symbol"?ze+"":ze,Et);const ze=new Set;let Et={active:!1,userName:null,comments:[],replies:new Map,selectedCommentId:null,panelOpen:!1,filter:"open",config:{}};function Jt(){return Et}function ve(A){Et={...Et,...A},ze.forEach(e=>e(Et))}function cu(A){return ze.add(A),()=>ze.delete(A)}function uu(){if(Et.userName)return Et.userName;const A=localStorage.getItem("ufp_user_name");return A?(ve({userName:A}),A):null}function hu(A){localStorage.setItem("ufp_user_name",A),ve({userName:A})}function du(A){try{const e=new URL(A);return e.origin+e.pathname}catch{return A}}function FB(A){return`
|
|
2
|
+
:host {
|
|
3
|
+
--ufp-primary: ${A};
|
|
4
|
+
--ufp-primary-dark: color-mix(in srgb, ${A} 80%, black);
|
|
5
|
+
--ufp-white: #ffffff;
|
|
6
|
+
--ufp-gray-50: #f9fafb;
|
|
7
|
+
--ufp-gray-100: #f3f4f6;
|
|
8
|
+
--ufp-gray-200: #e5e7eb;
|
|
9
|
+
--ufp-gray-300: #d1d5db;
|
|
10
|
+
--ufp-gray-400: #9ca3af;
|
|
11
|
+
--ufp-gray-500: #6b7280;
|
|
12
|
+
--ufp-gray-600: #4b5563;
|
|
13
|
+
--ufp-gray-700: #374151;
|
|
14
|
+
--ufp-gray-800: #1f2937;
|
|
15
|
+
--ufp-gray-900: #111827;
|
|
16
|
+
--ufp-green: #10b981;
|
|
17
|
+
--ufp-red: #ef4444;
|
|
18
|
+
--ufp-shadow: 0 4px 24px rgba(0,0,0,0.18);
|
|
19
|
+
--ufp-radius: 12px;
|
|
20
|
+
--ufp-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
21
|
+
font-family: var(--ufp-font);
|
|
22
|
+
all: initial;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
* { box-sizing: border-box; }
|
|
26
|
+
|
|
27
|
+
/* Trigger */
|
|
28
|
+
.ufp-trigger {
|
|
29
|
+
position: fixed;
|
|
30
|
+
z-index: 2147483646;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
background: var(--ufp-primary);
|
|
35
|
+
color: var(--ufp-white);
|
|
36
|
+
border: none;
|
|
37
|
+
border-radius: 28px;
|
|
38
|
+
padding: 10px 18px 10px 14px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
box-shadow: var(--ufp-shadow);
|
|
41
|
+
font-family: var(--ufp-font);
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
user-select: none;
|
|
45
|
+
transition: background 0.15s, transform 0.1s;
|
|
46
|
+
touch-action: none;
|
|
47
|
+
}
|
|
48
|
+
.ufp-trigger:hover { background: var(--ufp-primary-dark); }
|
|
49
|
+
.ufp-trigger:active { transform: scale(0.97); }
|
|
50
|
+
.ufp-trigger.active { background: var(--ufp-gray-800); }
|
|
51
|
+
.ufp-trigger-icon { width: 20px; height: 20px; flex-shrink: 0; }
|
|
52
|
+
|
|
53
|
+
/* Modal overlay */
|
|
54
|
+
.ufp-modal-backdrop {
|
|
55
|
+
position: fixed;
|
|
56
|
+
inset: 0;
|
|
57
|
+
background: rgba(0,0,0,0.45);
|
|
58
|
+
z-index: 2147483646;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
}
|
|
63
|
+
.ufp-modal {
|
|
64
|
+
background: var(--ufp-white);
|
|
65
|
+
border-radius: var(--ufp-radius);
|
|
66
|
+
padding: 28px;
|
|
67
|
+
width: 360px;
|
|
68
|
+
box-shadow: var(--ufp-shadow);
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 16px;
|
|
72
|
+
}
|
|
73
|
+
.ufp-modal h2 {
|
|
74
|
+
margin: 0;
|
|
75
|
+
font-size: 18px;
|
|
76
|
+
font-weight: 700;
|
|
77
|
+
color: var(--ufp-gray-900);
|
|
78
|
+
font-family: var(--ufp-font);
|
|
79
|
+
}
|
|
80
|
+
.ufp-modal p {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
color: var(--ufp-gray-500);
|
|
84
|
+
font-family: var(--ufp-font);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Form elements */
|
|
88
|
+
.ufp-input {
|
|
89
|
+
width: 100%;
|
|
90
|
+
padding: 10px 14px;
|
|
91
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
92
|
+
border-radius: 8px;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
font-family: var(--ufp-font);
|
|
95
|
+
color: var(--ufp-gray-900);
|
|
96
|
+
outline: none;
|
|
97
|
+
transition: border-color 0.15s;
|
|
98
|
+
}
|
|
99
|
+
.ufp-input:focus { border-color: var(--ufp-primary); }
|
|
100
|
+
.ufp-textarea {
|
|
101
|
+
width: 100%;
|
|
102
|
+
padding: 10px 14px;
|
|
103
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
font-family: var(--ufp-font);
|
|
107
|
+
color: var(--ufp-gray-900);
|
|
108
|
+
outline: none;
|
|
109
|
+
resize: vertical;
|
|
110
|
+
min-height: 80px;
|
|
111
|
+
transition: border-color 0.15s;
|
|
112
|
+
}
|
|
113
|
+
.ufp-textarea:focus { border-color: var(--ufp-primary); }
|
|
114
|
+
|
|
115
|
+
/* Buttons */
|
|
116
|
+
.ufp-btn {
|
|
117
|
+
padding: 9px 18px;
|
|
118
|
+
border-radius: 8px;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
font-family: var(--ufp-font);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
border: none;
|
|
124
|
+
transition: background 0.15s, opacity 0.15s;
|
|
125
|
+
}
|
|
126
|
+
.ufp-btn-primary {
|
|
127
|
+
background: var(--ufp-primary);
|
|
128
|
+
color: var(--ufp-white);
|
|
129
|
+
}
|
|
130
|
+
.ufp-btn-primary:hover { background: var(--ufp-primary-dark); }
|
|
131
|
+
.ufp-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
132
|
+
.ufp-btn-ghost {
|
|
133
|
+
background: transparent;
|
|
134
|
+
color: var(--ufp-gray-600);
|
|
135
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
136
|
+
}
|
|
137
|
+
.ufp-btn-ghost:hover { background: var(--ufp-gray-50); }
|
|
138
|
+
.ufp-btn-danger {
|
|
139
|
+
background: var(--ufp-red);
|
|
140
|
+
color: var(--ufp-white);
|
|
141
|
+
}
|
|
142
|
+
.ufp-btn-icon {
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
width: 32px;
|
|
147
|
+
height: 32px;
|
|
148
|
+
padding: 0;
|
|
149
|
+
border-radius: 6px;
|
|
150
|
+
background: transparent;
|
|
151
|
+
border: none;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
color: var(--ufp-gray-600);
|
|
154
|
+
font-size: 16px;
|
|
155
|
+
transition: background 0.12s, color 0.12s;
|
|
156
|
+
}
|
|
157
|
+
.ufp-btn-icon:hover { background: var(--ufp-gray-100); color: var(--ufp-gray-900); }
|
|
158
|
+
.ufp-btn-icon.active { background: var(--ufp-primary); color: var(--ufp-white); }
|
|
159
|
+
|
|
160
|
+
.ufp-btn-row {
|
|
161
|
+
display: flex;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
justify-content: flex-end;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* Annotation overlay */
|
|
167
|
+
.ufp-overlay {
|
|
168
|
+
position: fixed;
|
|
169
|
+
inset: 0;
|
|
170
|
+
z-index: 2147483645;
|
|
171
|
+
cursor: crosshair;
|
|
172
|
+
background: rgba(99,102,241,0.04);
|
|
173
|
+
}
|
|
174
|
+
.ufp-overlay-svg {
|
|
175
|
+
position: absolute;
|
|
176
|
+
inset: 0;
|
|
177
|
+
width: 100%;
|
|
178
|
+
height: 100%;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Toolbar */
|
|
183
|
+
.ufp-toolbar {
|
|
184
|
+
position: fixed;
|
|
185
|
+
top: 50%;
|
|
186
|
+
left: 50%;
|
|
187
|
+
transform: translate(-50%, -50%);
|
|
188
|
+
z-index: 2147483647;
|
|
189
|
+
background: var(--ufp-white);
|
|
190
|
+
border-radius: 12px;
|
|
191
|
+
box-shadow: var(--ufp-shadow);
|
|
192
|
+
padding: 8px;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: 4px;
|
|
196
|
+
top: 24px;
|
|
197
|
+
left: 50%;
|
|
198
|
+
transform: translateX(-50%);
|
|
199
|
+
}
|
|
200
|
+
.ufp-toolbar-sep {
|
|
201
|
+
width: 1px;
|
|
202
|
+
height: 24px;
|
|
203
|
+
background: var(--ufp-gray-200);
|
|
204
|
+
margin: 0 4px;
|
|
205
|
+
}
|
|
206
|
+
.ufp-toolbar-label {
|
|
207
|
+
font-size: 12px;
|
|
208
|
+
font-family: var(--ufp-font);
|
|
209
|
+
color: var(--ufp-gray-500);
|
|
210
|
+
padding: 0 6px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Comment input popup */
|
|
214
|
+
.ufp-comment-popup {
|
|
215
|
+
position: fixed;
|
|
216
|
+
z-index: 2147483647;
|
|
217
|
+
background: var(--ufp-white);
|
|
218
|
+
border-radius: var(--ufp-radius);
|
|
219
|
+
box-shadow: var(--ufp-shadow);
|
|
220
|
+
padding: 16px;
|
|
221
|
+
width: 320px;
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 12px;
|
|
225
|
+
}
|
|
226
|
+
.ufp-comment-popup h3 {
|
|
227
|
+
margin: 0;
|
|
228
|
+
font-size: 14px;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
color: var(--ufp-gray-800);
|
|
231
|
+
font-family: var(--ufp-font);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Comments panel */
|
|
235
|
+
.ufp-panel {
|
|
236
|
+
position: fixed;
|
|
237
|
+
top: 0;
|
|
238
|
+
right: 0;
|
|
239
|
+
bottom: 0;
|
|
240
|
+
width: 360px;
|
|
241
|
+
z-index: 2147483646;
|
|
242
|
+
background: var(--ufp-white);
|
|
243
|
+
box-shadow: -4px 0 24px rgba(0,0,0,0.12);
|
|
244
|
+
display: flex;
|
|
245
|
+
flex-direction: column;
|
|
246
|
+
transform: translateX(100%);
|
|
247
|
+
transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
|
|
248
|
+
}
|
|
249
|
+
.ufp-panel.open { transform: translateX(0); }
|
|
250
|
+
.ufp-panel-header {
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: space-between;
|
|
254
|
+
padding: 16px 20px;
|
|
255
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
256
|
+
flex-shrink: 0;
|
|
257
|
+
}
|
|
258
|
+
.ufp-panel-title {
|
|
259
|
+
font-size: 16px;
|
|
260
|
+
font-weight: 700;
|
|
261
|
+
color: var(--ufp-gray-900);
|
|
262
|
+
font-family: var(--ufp-font);
|
|
263
|
+
}
|
|
264
|
+
.ufp-filter-tabs {
|
|
265
|
+
display: flex;
|
|
266
|
+
gap: 4px;
|
|
267
|
+
padding: 8px 12px;
|
|
268
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
269
|
+
flex-shrink: 0;
|
|
270
|
+
}
|
|
271
|
+
.ufp-filter-tab {
|
|
272
|
+
padding: 6px 14px;
|
|
273
|
+
border-radius: 20px;
|
|
274
|
+
font-size: 13px;
|
|
275
|
+
font-family: var(--ufp-font);
|
|
276
|
+
font-weight: 500;
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
border: none;
|
|
279
|
+
background: transparent;
|
|
280
|
+
color: var(--ufp-gray-500);
|
|
281
|
+
transition: background 0.12s, color 0.12s;
|
|
282
|
+
}
|
|
283
|
+
.ufp-filter-tab.active {
|
|
284
|
+
background: var(--ufp-primary);
|
|
285
|
+
color: var(--ufp-white);
|
|
286
|
+
}
|
|
287
|
+
.ufp-panel-list {
|
|
288
|
+
flex: 1;
|
|
289
|
+
overflow-y: auto;
|
|
290
|
+
padding: 8px 0;
|
|
291
|
+
}
|
|
292
|
+
.ufp-panel-empty {
|
|
293
|
+
display: flex;
|
|
294
|
+
flex-direction: column;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
height: 200px;
|
|
298
|
+
color: var(--ufp-gray-400);
|
|
299
|
+
font-size: 14px;
|
|
300
|
+
font-family: var(--ufp-font);
|
|
301
|
+
gap: 8px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* Comment card */
|
|
305
|
+
.ufp-comment-card {
|
|
306
|
+
padding: 12px 16px;
|
|
307
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
308
|
+
cursor: pointer;
|
|
309
|
+
transition: background 0.12s;
|
|
310
|
+
display: flex;
|
|
311
|
+
flex-direction: column;
|
|
312
|
+
gap: 8px;
|
|
313
|
+
}
|
|
314
|
+
.ufp-comment-card:hover { background: var(--ufp-gray-50); }
|
|
315
|
+
.ufp-comment-card.selected { background: #eef2ff; }
|
|
316
|
+
.ufp-comment-card-header {
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: flex-start;
|
|
319
|
+
justify-content: space-between;
|
|
320
|
+
gap: 8px;
|
|
321
|
+
}
|
|
322
|
+
.ufp-comment-meta {
|
|
323
|
+
display: flex;
|
|
324
|
+
align-items: center;
|
|
325
|
+
gap: 6px;
|
|
326
|
+
}
|
|
327
|
+
.ufp-avatar {
|
|
328
|
+
width: 26px;
|
|
329
|
+
height: 26px;
|
|
330
|
+
border-radius: 50%;
|
|
331
|
+
background: var(--ufp-primary);
|
|
332
|
+
color: var(--ufp-white);
|
|
333
|
+
font-size: 11px;
|
|
334
|
+
font-weight: 700;
|
|
335
|
+
font-family: var(--ufp-font);
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
justify-content: center;
|
|
339
|
+
flex-shrink: 0;
|
|
340
|
+
}
|
|
341
|
+
.ufp-comment-author {
|
|
342
|
+
font-size: 13px;
|
|
343
|
+
font-weight: 600;
|
|
344
|
+
color: var(--ufp-gray-800);
|
|
345
|
+
font-family: var(--ufp-font);
|
|
346
|
+
}
|
|
347
|
+
.ufp-comment-time {
|
|
348
|
+
font-size: 11px;
|
|
349
|
+
color: var(--ufp-gray-400);
|
|
350
|
+
font-family: var(--ufp-font);
|
|
351
|
+
}
|
|
352
|
+
.ufp-comment-text {
|
|
353
|
+
font-size: 13px;
|
|
354
|
+
color: var(--ufp-gray-700);
|
|
355
|
+
font-family: var(--ufp-font);
|
|
356
|
+
line-height: 1.5;
|
|
357
|
+
overflow: hidden;
|
|
358
|
+
display: -webkit-box;
|
|
359
|
+
-webkit-line-clamp: 2;
|
|
360
|
+
-webkit-box-orient: vertical;
|
|
361
|
+
}
|
|
362
|
+
.ufp-comment-thumbnail {
|
|
363
|
+
width: 100%;
|
|
364
|
+
height: 80px;
|
|
365
|
+
object-fit: cover;
|
|
366
|
+
object-position: top left;
|
|
367
|
+
border-radius: 6px;
|
|
368
|
+
border: 1px solid var(--ufp-gray-200);
|
|
369
|
+
}
|
|
370
|
+
.ufp-comment-footer {
|
|
371
|
+
display: flex;
|
|
372
|
+
align-items: center;
|
|
373
|
+
justify-content: space-between;
|
|
374
|
+
}
|
|
375
|
+
.ufp-reply-count {
|
|
376
|
+
font-size: 12px;
|
|
377
|
+
color: var(--ufp-gray-400);
|
|
378
|
+
font-family: var(--ufp-font);
|
|
379
|
+
}
|
|
380
|
+
.ufp-resolved-badge {
|
|
381
|
+
font-size: 11px;
|
|
382
|
+
font-weight: 600;
|
|
383
|
+
font-family: var(--ufp-font);
|
|
384
|
+
padding: 2px 8px;
|
|
385
|
+
border-radius: 12px;
|
|
386
|
+
background: #d1fae5;
|
|
387
|
+
color: #065f46;
|
|
388
|
+
}
|
|
389
|
+
.ufp-card-actions {
|
|
390
|
+
display: flex;
|
|
391
|
+
gap: 4px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* Detail view */
|
|
395
|
+
.ufp-detail {
|
|
396
|
+
position: fixed;
|
|
397
|
+
inset: 0;
|
|
398
|
+
z-index: 2147483647;
|
|
399
|
+
background: rgba(0,0,0,0.75);
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: stretch;
|
|
402
|
+
}
|
|
403
|
+
.ufp-detail-image-area {
|
|
404
|
+
flex: 1;
|
|
405
|
+
overflow: auto;
|
|
406
|
+
display: flex;
|
|
407
|
+
align-items: flex-start;
|
|
408
|
+
justify-content: center;
|
|
409
|
+
padding: 24px;
|
|
410
|
+
position: relative;
|
|
411
|
+
}
|
|
412
|
+
.ufp-detail-image-wrap {
|
|
413
|
+
position: relative;
|
|
414
|
+
display: inline-block;
|
|
415
|
+
}
|
|
416
|
+
.ufp-detail-screenshot {
|
|
417
|
+
max-width: 100%;
|
|
418
|
+
display: block;
|
|
419
|
+
border-radius: 8px;
|
|
420
|
+
}
|
|
421
|
+
.ufp-detail-annotation-svg {
|
|
422
|
+
position: absolute;
|
|
423
|
+
top: 0;
|
|
424
|
+
left: 0;
|
|
425
|
+
width: 100%;
|
|
426
|
+
height: 100%;
|
|
427
|
+
pointer-events: none;
|
|
428
|
+
}
|
|
429
|
+
.ufp-detail-sidebar {
|
|
430
|
+
width: 340px;
|
|
431
|
+
background: var(--ufp-white);
|
|
432
|
+
display: flex;
|
|
433
|
+
flex-direction: column;
|
|
434
|
+
flex-shrink: 0;
|
|
435
|
+
}
|
|
436
|
+
.ufp-detail-header {
|
|
437
|
+
display: flex;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: space-between;
|
|
440
|
+
padding: 16px 20px;
|
|
441
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
442
|
+
flex-shrink: 0;
|
|
443
|
+
}
|
|
444
|
+
.ufp-detail-body {
|
|
445
|
+
flex: 1;
|
|
446
|
+
overflow-y: auto;
|
|
447
|
+
padding: 16px 20px;
|
|
448
|
+
display: flex;
|
|
449
|
+
flex-direction: column;
|
|
450
|
+
gap: 16px;
|
|
451
|
+
}
|
|
452
|
+
.ufp-detail-comment {
|
|
453
|
+
display: flex;
|
|
454
|
+
flex-direction: column;
|
|
455
|
+
gap: 8px;
|
|
456
|
+
}
|
|
457
|
+
.ufp-detail-comment-text {
|
|
458
|
+
font-size: 14px;
|
|
459
|
+
color: var(--ufp-gray-800);
|
|
460
|
+
font-family: var(--ufp-font);
|
|
461
|
+
line-height: 1.6;
|
|
462
|
+
}
|
|
463
|
+
.ufp-detail-actions {
|
|
464
|
+
display: flex;
|
|
465
|
+
gap: 8px;
|
|
466
|
+
flex-wrap: wrap;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/* Reply thread */
|
|
470
|
+
.ufp-replies {
|
|
471
|
+
display: flex;
|
|
472
|
+
flex-direction: column;
|
|
473
|
+
gap: 12px;
|
|
474
|
+
border-top: 1px solid var(--ufp-gray-100);
|
|
475
|
+
padding-top: 12px;
|
|
476
|
+
}
|
|
477
|
+
.ufp-replies-title {
|
|
478
|
+
font-size: 12px;
|
|
479
|
+
font-weight: 600;
|
|
480
|
+
color: var(--ufp-gray-500);
|
|
481
|
+
font-family: var(--ufp-font);
|
|
482
|
+
text-transform: uppercase;
|
|
483
|
+
letter-spacing: 0.05em;
|
|
484
|
+
}
|
|
485
|
+
.ufp-reply {
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
gap: 4px;
|
|
489
|
+
}
|
|
490
|
+
.ufp-reply-meta {
|
|
491
|
+
display: flex;
|
|
492
|
+
align-items: center;
|
|
493
|
+
gap: 6px;
|
|
494
|
+
}
|
|
495
|
+
.ufp-reply-author {
|
|
496
|
+
font-size: 12px;
|
|
497
|
+
font-weight: 600;
|
|
498
|
+
color: var(--ufp-gray-700);
|
|
499
|
+
font-family: var(--ufp-font);
|
|
500
|
+
}
|
|
501
|
+
.ufp-reply-time {
|
|
502
|
+
font-size: 11px;
|
|
503
|
+
color: var(--ufp-gray-400);
|
|
504
|
+
font-family: var(--ufp-font);
|
|
505
|
+
}
|
|
506
|
+
.ufp-reply-text {
|
|
507
|
+
font-size: 13px;
|
|
508
|
+
color: var(--ufp-gray-700);
|
|
509
|
+
font-family: var(--ufp-font);
|
|
510
|
+
line-height: 1.5;
|
|
511
|
+
padding-left: 32px;
|
|
512
|
+
}
|
|
513
|
+
.ufp-reply-input-area {
|
|
514
|
+
display: flex;
|
|
515
|
+
flex-direction: column;
|
|
516
|
+
gap: 8px;
|
|
517
|
+
border-top: 1px solid var(--ufp-gray-100);
|
|
518
|
+
padding-top: 12px;
|
|
519
|
+
}
|
|
520
|
+
.ufp-reply-name-row {
|
|
521
|
+
display: flex;
|
|
522
|
+
gap: 8px;
|
|
523
|
+
align-items: center;
|
|
524
|
+
}
|
|
525
|
+
.ufp-reply-name-label {
|
|
526
|
+
font-size: 12px;
|
|
527
|
+
color: var(--ufp-gray-500);
|
|
528
|
+
font-family: var(--ufp-font);
|
|
529
|
+
white-space: nowrap;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* Loading spinner */
|
|
533
|
+
.ufp-spinner {
|
|
534
|
+
width: 20px;
|
|
535
|
+
height: 20px;
|
|
536
|
+
border: 2px solid var(--ufp-gray-200);
|
|
537
|
+
border-top-color: var(--ufp-primary);
|
|
538
|
+
border-radius: 50%;
|
|
539
|
+
animation: ufp-spin 0.7s linear infinite;
|
|
540
|
+
}
|
|
541
|
+
@keyframes ufp-spin { to { transform: rotate(360deg); } }
|
|
542
|
+
|
|
543
|
+
/* Scrollbar */
|
|
544
|
+
.ufp-panel-list::-webkit-scrollbar,
|
|
545
|
+
.ufp-detail-body::-webkit-scrollbar,
|
|
546
|
+
.ufp-detail-image-area::-webkit-scrollbar { width: 4px; }
|
|
547
|
+
.ufp-panel-list::-webkit-scrollbar-thumb,
|
|
548
|
+
.ufp-detail-body::-webkit-scrollbar-thumb,
|
|
549
|
+
.ufp-detail-image-area::-webkit-scrollbar-thumb {
|
|
550
|
+
background: var(--ufp-gray-300);
|
|
551
|
+
border-radius: 2px;
|
|
552
|
+
}
|
|
553
|
+
`}const TB={"bottom-right":{bottom:"24px",right:"24px"},"bottom-left":{bottom:"24px",left:"24px"},"top-right":{top:"24px",right:"24px"},"top-left":{top:"24px",left:"24px"}},tn="#6366f1",fu="#4f46e5",gu="#4338ca";function SB(A,e,t,r){const n=document.createElement("div");Object.assign(n.style,{position:"fixed",zIndex:"2147483647",display:"flex",alignItems:"stretch",borderRadius:"28px",boxShadow:"0 4px 20px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.16)",overflow:"hidden",userSelect:"none",...TB[e]});const s=document.createElement("button");s.id="ufp-btn-annotate",s.title="Add feedback annotation",pu(s),s.style.padding="10px 16px 10px 14px",s.innerHTML=`
|
|
554
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="flex-shrink:0">
|
|
555
|
+
<path d="M12 20h9"/>
|
|
556
|
+
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
557
|
+
</svg>
|
|
558
|
+
<span id="ufp-annotate-label" style="font-size:14px;font-weight:600;">Feedback</span>
|
|
559
|
+
`;const i=document.createElement("div");i.style.cssText="width:1px;background:rgba(255,255,255,0.3);flex-shrink:0;";const o=document.createElement("button");o.id="ufp-btn-panel",o.title="View all comments",pu(o),o.style.padding="10px 14px",o.innerHTML=`
|
|
560
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="flex-shrink:0">
|
|
561
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
562
|
+
</svg>
|
|
563
|
+
<span id="ufp-panel-count" style="font-size:13px;font-weight:600;min-width:8px;text-align:center;"></span>
|
|
564
|
+
`,n.appendChild(s),n.appendChild(i),n.appendChild(o),A.appendChild(n);const l=n.querySelector("#ufp-annotate-label"),c=n.querySelector("#ufp-panel-count");return s.addEventListener("click",u=>{if(u.stopPropagation(),n._dragged)return;const d=Jt();d.active||(d.panelOpen?(r(),setTimeout(t,220)):t())}),o.addEventListener("click",u=>{u.stopPropagation(),!n._dragged&&(Jt().active||r())}),wu(s,()=>(Jt().panelOpen,tn),fu),wu(o,()=>Jt().panelOpen?gu:tn,fu),cu(u=>{const d=u.comments.filter(g=>!g.resolved).length;c.textContent=d>0?String(d):"",u.active?(l.textContent="Drawing…",s.style.opacity="0.65",o.style.opacity="0.65",s.style.pointerEvents="none",o.style.pointerEvents="none"):(l.textContent="Feedback",s.style.opacity="1",o.style.opacity="1",s.style.pointerEvents="auto",o.style.pointerEvents="auto"),o.style.background=u.panelOpen?gu:tn}),RB(n),n}function pu(A){Object.assign(A.style,{display:"flex",alignItems:"center",gap:"7px",background:tn,color:"#ffffff",border:"none",cursor:"pointer",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',lineHeight:"1",transition:"background 0.12s"})}function wu(A,e,t){A.addEventListener("mouseenter",()=>{A.style.background=t}),A.addEventListener("mouseleave",()=>{A.style.background=e()})}function RB(A){let e=0,t=0,r=0,n=0;A.addEventListener("pointerdown",s=>{if(s.button!==0)return;e=s.clientX,t=s.clientY;const i=A.getBoundingClientRect();r=i.left,n=i.top,A._dragged=!1;const o=c=>{const u=c.clientX-e,d=c.clientY-t;!A._dragged&&Math.sqrt(u*u+d*d)<5||(A._dragged=!0,A.style.left=`${Math.max(0,Math.min(window.innerWidth-A.offsetWidth,r+u))}px`,A.style.top=`${Math.max(0,Math.min(window.innerHeight-A.offsetHeight,n+d))}px`,A.style.right="auto",A.style.bottom="auto")},l=()=>{document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",l),requestAnimationFrame(()=>{A._dragged=!1})};document.addEventListener("pointermove",o),document.addEventListener("pointerup",l)})}function xB(A){return new Promise(e=>{const t=document.createElement("div");t.className="ufp-modal-backdrop",t.innerHTML=`
|
|
565
|
+
<div class="ufp-modal" role="dialog" aria-modal="true" aria-labelledby="ufp-modal-title">
|
|
566
|
+
<h2 id="ufp-modal-title">Welcome to Feedback Mode</h2>
|
|
567
|
+
<p>Enter your name so others can see who left the comment.</p>
|
|
568
|
+
<input
|
|
569
|
+
class="ufp-input"
|
|
570
|
+
id="ufp-name-input"
|
|
571
|
+
type="text"
|
|
572
|
+
placeholder="Your name"
|
|
573
|
+
maxlength="60"
|
|
574
|
+
autocomplete="off"
|
|
575
|
+
/>
|
|
576
|
+
<div class="ufp-btn-row">
|
|
577
|
+
<button class="ufp-btn ufp-btn-primary" id="ufp-name-submit" disabled>Continue</button>
|
|
578
|
+
</div>
|
|
579
|
+
</div>
|
|
580
|
+
`,A.appendChild(t);const r=t.querySelector("#ufp-name-input"),n=t.querySelector("#ufp-name-submit");r.addEventListener("input",()=>{n.disabled=r.value.trim().length===0});const s=()=>{const i=r.value.trim();i&&(hu(i),t.remove(),e(i))};n.addEventListener("click",s),r.addEventListener("keydown",i=>{i.key==="Enter"&&s()}),requestAnimationFrame(()=>r.focus())})}const Dt="#6366f1",uA=3;function hr(A,e=1,t=1){switch(A.type){case"pen":{const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",HB(A.points,e,t)),r.setAttribute("stroke",A.color),r.setAttribute("stroke-width",String(A.width*Math.min(e,t))),r.setAttribute("fill","none"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r}case"rect":{const r=document.createElementNS("http://www.w3.org/2000/svg","rect");return r.setAttribute("x",String(A.x*e)),r.setAttribute("y",String(A.y*t)),r.setAttribute("width",String(A.width*e)),r.setAttribute("height",String(A.height*t)),r.setAttribute("stroke",A.color),r.setAttribute("stroke-width",String(A.strokeWidth*Math.min(e,t))),r.setAttribute("fill","none"),r.setAttribute("rx","3"),r}case"circle":{const r=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return r.setAttribute("cx",String(A.cx*e)),r.setAttribute("cy",String(A.cy*t)),r.setAttribute("rx",String(A.rx*e)),r.setAttribute("ry",String(A.ry*t)),r.setAttribute("stroke",A.color),r.setAttribute("stroke-width",String(A.strokeWidth*Math.min(e,t))),r.setAttribute("fill","none"),r}case"arrow":{const r=document.createElementNS("http://www.w3.org/2000/svg","g"),n=document.createElementNS("http://www.w3.org/2000/svg","line");return n.setAttribute("x1",String(A.x1*e)),n.setAttribute("y1",String(A.y1*t)),n.setAttribute("x2",String(A.x2*e)),n.setAttribute("y2",String(A.y2*t)),n.setAttribute("stroke",A.color),n.setAttribute("stroke-width",String(A.width*Math.min(e,t))),n.setAttribute("marker-end","url(#ufp-arrowhead)"),r.appendChild(n),r}}}function kB(A,e,t,r){const n=t/e.pageWidth,s=r/e.pageHeight;A.innerHTML="";const i=document.createElementNS("http://www.w3.org/2000/svg","defs");i.innerHTML=`
|
|
581
|
+
<marker id="ufp-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
582
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${Dt}" />
|
|
583
|
+
</marker>
|
|
584
|
+
`,A.appendChild(i),e.shapes.forEach(o=>{A.appendChild(hr(o,n,s))})}function HB(A,e,t){if(A.length===0)return"";if(A.length===1){const n=A[0];return`M ${n.x*e} ${n.y*t}`}let r=`M ${A[0].x*e} ${A[0].y*t}`;for(let n=1;n<A.length;n++)r+=` L ${A[n].x*e} ${A[n].y*t}`;return r}function LB(A){return new Promise(e=>{let t="pen";const r=[];let n=!1,s=0,i=0,o=[],l=null,c=null;const u=document.createElement("div");u.style.cssText="position:fixed;inset:0;z-index:2147483645;cursor:crosshair;background:rgba(99,102,241,0.04);";const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.style.cssText="position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;",d.innerHTML=`
|
|
585
|
+
<defs>
|
|
586
|
+
<marker id="ufp-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
587
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${Dt}" />
|
|
588
|
+
</marker>
|
|
589
|
+
</defs>
|
|
590
|
+
`,u.appendChild(d);function g(){u.remove(),I.remove(),c==null||c.remove()}function p(){const Q=d.querySelector("defs");d.innerHTML="",d.appendChild(Q),r.forEach(S=>d.appendChild(hr(S)))}function B(){let Q=0,S=0,k=0;return r.forEach(H=>{if(H.type==="pen"&&H.points.length){const R=H.points[H.points.length-1];Q+=R.x,S+=R.y,k++}else H.type==="rect"?(Q+=H.x+H.width,S+=H.y+H.height,k++):H.type==="circle"?(Q+=H.cx,S+=H.cy,k++):H.type==="arrow"&&(Q+=H.x2,S+=H.y2,k++)}),{anchorX:k>0?Q/k-window.scrollX:window.innerWidth/2,anchorY:k>0?S/k-window.scrollY:window.innerHeight/2}}function C(){u.style.pointerEvents="none",I.style.pointerEvents="none",E()}function E(){c&&c.remove();const{anchorX:Q,anchorY:S}=B(),k=300,H=12;let R=Q+H,_=S+H;R+k>window.innerWidth-H&&(R=Q-k-H),R<H&&(R=H),_+210>window.innerHeight-H&&(_=window.innerHeight-210-H),_<H&&(_=H),c=document.createElement("div"),c.style.cssText=`
|
|
591
|
+
position:fixed;left:${R}px;top:${_}px;z-index:2147483647;
|
|
592
|
+
background:#fff;border-radius:12px;padding:16px;width:${k}px;
|
|
593
|
+
box-shadow:0 4px 24px rgba(0,0,0,0.18);
|
|
594
|
+
display:flex;flex-direction:column;gap:10px;
|
|
595
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
596
|
+
`,c.innerHTML=`
|
|
597
|
+
<div style="font-size:13px;font-weight:600;color:#374151;">Add your comment</div>
|
|
598
|
+
<textarea id="ufp-inline-text" placeholder="Describe your feedback…" rows="3"
|
|
599
|
+
style="width:100%;padding:9px 12px;border:1.5px solid #e5e7eb;border-radius:8px;
|
|
600
|
+
font-size:13px;font-family:inherit;color:#111827;resize:none;
|
|
601
|
+
min-height:72px;outline:none;box-sizing:border-box;"></textarea>
|
|
602
|
+
<div style="display:flex;gap:6px;justify-content:flex-end;align-items:center;">
|
|
603
|
+
<button id="ufp-popup-cancel"
|
|
604
|
+
style="padding:7px 12px;border-radius:8px;font-size:13px;font-weight:500;
|
|
605
|
+
font-family:inherit;cursor:pointer;background:transparent;
|
|
606
|
+
border:1.5px solid #e5e7eb;color:#6b7280;">Cancel</button>
|
|
607
|
+
<button id="ufp-popup-submit" disabled
|
|
608
|
+
style="padding:7px 14px;border-radius:8px;font-size:13px;font-weight:600;
|
|
609
|
+
font-family:inherit;cursor:pointer;background:#6366f1;border:none;
|
|
610
|
+
color:#fff;opacity:0.45;transition:opacity 0.15s;">Submit</button>
|
|
611
|
+
</div>
|
|
612
|
+
`,A.appendChild(c);const m=c.querySelector("#ufp-inline-text"),y=c.querySelector("#ufp-popup-submit"),b=c.querySelector("#ufp-popup-cancel");m.addEventListener("input",()=>{const U=m.value.trim().length>0;y.disabled=!U,y.style.opacity=U?"1":"0.45"}),y.addEventListener("click",()=>{const U=m.value.trim();if(!U)return;const F=B();g(),e({shapes:[...r],text:U,...F})}),b.addEventListener("click",()=>{g(),e(null)}),requestAnimationFrame(()=>m.focus())}const I=DB(A,Q=>{t=Q},()=>{g(),e(null)},()=>{r.length!==0&&(c&&(c.remove(),c=null,u.style.pointerEvents="auto",I.style.pointerEvents="auto"),r.pop(),p())});A.appendChild(u),u.addEventListener("pointerdown",Q=>{Q.button===0&&(u.setPointerCapture(Q.pointerId),n=!0,s=Q.clientX+window.scrollX,i=Q.clientY+window.scrollY,t==="pen"&&(o=[{x:s,y:i}]))}),u.addEventListener("pointermove",Q=>{if(!n)return;const S=Q.clientX+window.scrollX,k=Q.clientY+window.scrollY;if(l&&l.remove(),t==="pen")o.push({x:S,y:k}),l=hr({type:"pen",points:[...o],color:Dt,width:uA});else if(t==="rect"){const H={type:"rect",x:Math.min(s,S),y:Math.min(i,k),width:Math.abs(S-s),height:Math.abs(k-i),color:Dt,strokeWidth:uA};l=hr(H)}else if(t==="circle"){const H=Math.abs(S-s)/2,R=Math.abs(k-i)/2,_={type:"circle",cx:Math.min(s,S)+H,cy:Math.min(i,k)+R,rx:H,ry:R,color:Dt,strokeWidth:uA};l=hr(_)}else t==="arrow"&&(l=hr({type:"arrow",x1:s,y1:i,x2:S,y2:k,color:Dt,width:uA}));l&&d.appendChild(l)}),u.addEventListener("pointerup",Q=>{if(!n)return;n=!1,l&&(l.remove(),l=null);const S=Q.clientX+window.scrollX,k=Q.clientY+window.scrollY;let H=!1;if(t==="pen"&&o.length>1)r.push({type:"pen",points:[...o],color:Dt,width:uA}),o=[],H=!0;else if(t==="rect"){const R=Math.abs(S-s),_=Math.abs(k-i);R>4&&_>4&&(r.push({type:"rect",x:Math.min(s,S),y:Math.min(i,k),width:R,height:_,color:Dt,strokeWidth:uA}),H=!0)}else if(t==="circle"){const R=Math.abs(S-s)/2,_=Math.abs(k-i)/2;R>4&&_>4&&(r.push({type:"circle",cx:Math.min(s,S)+R,cy:Math.min(i,k)+_,rx:R,ry:_,color:Dt,strokeWidth:uA}),H=!0)}else t==="arrow"&&Math.sqrt((S-s)**2+(k-i)**2)>10&&(r.push({type:"arrow",x1:s,y1:i,x2:S,y2:k,color:Dt,width:uA}),H=!0);H&&(p(),C())})})}function DB(A,e,t,r){const n=document.createElement("div");return n.className="ufp-toolbar",n.innerHTML=`
|
|
613
|
+
<span class="ufp-toolbar-label">Draw to annotate</span>
|
|
614
|
+
<div class="ufp-toolbar-sep"></div>
|
|
615
|
+
<button class="ufp-btn-icon active" data-tool="pen" title="Pen">
|
|
616
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
617
|
+
<path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
618
|
+
</svg>
|
|
619
|
+
</button>
|
|
620
|
+
<button class="ufp-btn-icon" data-tool="rect" title="Rectangle">
|
|
621
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>
|
|
622
|
+
</button>
|
|
623
|
+
<button class="ufp-btn-icon" data-tool="circle" title="Circle">
|
|
624
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>
|
|
625
|
+
</button>
|
|
626
|
+
<button class="ufp-btn-icon" data-tool="arrow" title="Arrow">
|
|
627
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
628
|
+
<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>
|
|
629
|
+
</svg>
|
|
630
|
+
</button>
|
|
631
|
+
<div class="ufp-toolbar-sep"></div>
|
|
632
|
+
<button class="ufp-btn-icon" id="ufp-undo-btn" title="Undo last stroke">
|
|
633
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
634
|
+
<polyline points="9 14 4 9 9 4"/><path d="M20 20v-7a4 4 0 0 0-4-4H4"/>
|
|
635
|
+
</svg>
|
|
636
|
+
</button>
|
|
637
|
+
<div class="ufp-toolbar-sep"></div>
|
|
638
|
+
<button class="ufp-btn ufp-btn-ghost" id="ufp-cancel-btn">Cancel</button>
|
|
639
|
+
`,n.querySelectorAll("[data-tool]").forEach(s=>{s.addEventListener("click",()=>{n.querySelectorAll("[data-tool]").forEach(i=>i.classList.remove("active")),s.classList.add("active"),e(s.dataset.tool)})}),n.querySelector("#ufp-undo-btn").addEventListener("click",r),n.querySelector("#ufp-cancel-btn").addEventListener("click",t),A.appendChild(n),n}function jo(A){const e=Date.now()-A,t=Math.floor(e/1e3);if(t<60)return"just now";const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);if(n<24)return`${n}h ago`;const s=Math.floor(n/24);return s<7?`${s}d ago`:new Date(A).toLocaleDateString()}function $o(A){return A.split(" ").filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join("")}function DA(A){return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function OB(A,e,t,r){let n=[...e];const s=document.createElement("div");s.className="ufp-replies";const i=p=>{const B=s.querySelector(".ufp-replies-list");B&&B.remove();const C=document.createElement("div");if(C.className="ufp-replies-list",C.style.cssText="display:flex;flex-direction:column;gap:12px;",p.length>0){const E=document.createElement("div");E.className="ufp-replies-title",E.textContent=`${p.length} ${p.length===1?"Reply":"Replies"}`,C.appendChild(E),p.forEach(I=>{const Q=document.createElement("div");Q.className="ufp-reply",Q.innerHTML=`
|
|
640
|
+
<div class="ufp-reply-meta">
|
|
641
|
+
<div class="ufp-avatar" style="width:22px;height:22px;font-size:10px;">${$o(I.authorName)}</div>
|
|
642
|
+
<span class="ufp-reply-author">${DA(I.authorName)}</span>
|
|
643
|
+
<span class="ufp-reply-time">${jo(I.createdAt)}</span>
|
|
644
|
+
</div>
|
|
645
|
+
<div class="ufp-reply-text">${DA(I.text)}</div>
|
|
646
|
+
`,C.appendChild(Q)})}s.insertBefore(C,s.querySelector(".ufp-reply-input-area"))},o=document.createElement("div");o.className="ufp-reply-input-area";const l=uu();o.innerHTML=`
|
|
647
|
+
<div class="ufp-reply-name-row">
|
|
648
|
+
<span class="ufp-reply-name-label">Replying as:</span>
|
|
649
|
+
<input
|
|
650
|
+
class="ufp-input"
|
|
651
|
+
id="ufp-reply-name"
|
|
652
|
+
type="text"
|
|
653
|
+
placeholder="Your name"
|
|
654
|
+
value="${DA(l??"")}"
|
|
655
|
+
style="flex:1;"
|
|
656
|
+
/>
|
|
657
|
+
</div>
|
|
658
|
+
<textarea
|
|
659
|
+
class="ufp-textarea"
|
|
660
|
+
id="ufp-reply-text"
|
|
661
|
+
placeholder="Write a reply…"
|
|
662
|
+
rows="2"
|
|
663
|
+
style="min-height:60px;"
|
|
664
|
+
></textarea>
|
|
665
|
+
<div class="ufp-btn-row">
|
|
666
|
+
<button class="ufp-btn ufp-btn-primary" id="ufp-reply-submit" disabled style="font-size:13px;padding:7px 14px;">Reply</button>
|
|
667
|
+
</div>
|
|
668
|
+
`;const c=o.querySelector("#ufp-reply-name"),u=o.querySelector("#ufp-reply-text"),d=o.querySelector("#ufp-reply-submit"),g=()=>{d.disabled=c.value.trim().length===0||u.value.trim().length===0};return c.addEventListener("input",g),u.addEventListener("input",g),d.addEventListener("click",async()=>{const p=c.value.trim(),B=u.value.trim();if(!p||!B)return;d.disabled=!0,d.textContent="Sending…",hu(p);const C={commentId:A,authorName:p,text:B,createdAt:Date.now()};try{const I={id:await t.addReply(C),...C};u.value="",d.textContent="Reply",d.disabled=!0,n=[...n,I],i(n),r(I)}catch(E){console.error("[ui-feedback-plugin] Failed to save reply:",E),d.disabled=!1,d.textContent="Reply"}}),s.appendChild(o),i(n),s.addReply=p=>{n=[...n,p],i(n)},s}function PB(A,e,t,r,n,s,i,o){const l=document.createElement("div");l.className="ufp-detail",l.innerHTML=`
|
|
669
|
+
<div class="ufp-detail-image-area">
|
|
670
|
+
<div class="ufp-detail-image-wrap">
|
|
671
|
+
<img class="ufp-detail-screenshot" src="${e.screenshotUrl}" alt="Page screenshot" />
|
|
672
|
+
<svg class="ufp-detail-annotation-svg" xmlns="http://www.w3.org/2000/svg">
|
|
673
|
+
<defs>
|
|
674
|
+
<marker id="ufp-detail-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
675
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="#6366f1" />
|
|
676
|
+
</marker>
|
|
677
|
+
</defs>
|
|
678
|
+
</svg>
|
|
679
|
+
</div>
|
|
680
|
+
</div>
|
|
681
|
+
<div class="ufp-detail-sidebar">
|
|
682
|
+
<div class="ufp-detail-header">
|
|
683
|
+
<button id="ufp-detail-back" style="
|
|
684
|
+
display:flex;align-items:center;gap:6px;
|
|
685
|
+
background:none;border:none;cursor:pointer;
|
|
686
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
687
|
+
font-size:13px;font-weight:600;color:#6b7280;padding:4px 0;
|
|
688
|
+
">
|
|
689
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
690
|
+
<polyline points="15 18 9 12 15 6"/>
|
|
691
|
+
</svg>
|
|
692
|
+
Back to comments
|
|
693
|
+
</button>
|
|
694
|
+
${e.resolved?'<span class="ufp-resolved-badge">Resolved</span>':""}
|
|
695
|
+
</div>
|
|
696
|
+
<div class="ufp-detail-body">
|
|
697
|
+
<div class="ufp-detail-comment">
|
|
698
|
+
<div class="ufp-comment-meta">
|
|
699
|
+
<div class="ufp-avatar">${$o(e.authorName)}</div>
|
|
700
|
+
<div>
|
|
701
|
+
<div class="ufp-comment-author">${DA(e.authorName)}</div>
|
|
702
|
+
<div class="ufp-comment-time">${jo(e.createdAt)}</div>
|
|
703
|
+
</div>
|
|
704
|
+
</div>
|
|
705
|
+
<div class="ufp-detail-comment-text">${DA(e.text)}</div>
|
|
706
|
+
<div class="ufp-detail-actions" id="ufp-detail-actions"></div>
|
|
707
|
+
</div>
|
|
708
|
+
<div id="ufp-detail-replies"></div>
|
|
709
|
+
</div>
|
|
710
|
+
</div>
|
|
711
|
+
`,A.appendChild(l),l.querySelector("#ufp-detail-back").addEventListener("click",()=>{l.remove(),ve({panelOpen:!0})});const c=l.querySelector("#ufp-detail-actions");if(e.resolved){const E=document.createElement("button");E.className="ufp-btn ufp-btn-ghost",E.style.fontSize="13px",E.innerHTML=`
|
|
712
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
|
713
|
+
style="vertical-align:middle;margin-right:4px"><polyline points="9 14 4 9 9 4"/><path d="M20 20v-7a4 4 0 0 0-4-4H4"/></svg>
|
|
714
|
+
Reopen
|
|
715
|
+
`,E.addEventListener("click",async()=>{E.disabled=!0,E.textContent="Reopening…",await r.updateComment(e.id,{resolved:!1}),s(e.id),l.remove(),ve({panelOpen:!0})}),c.appendChild(E)}else{const E=document.createElement("button");E.className="ufp-btn ufp-btn-primary",E.style.fontSize="13px",E.innerHTML=`
|
|
716
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
|
717
|
+
style="vertical-align:middle;margin-right:4px"><polyline points="20 6 9 17 4 12"/></svg>
|
|
718
|
+
Mark Resolved
|
|
719
|
+
`,E.addEventListener("click",async()=>{E.disabled=!0,E.textContent="Resolving…",await r.updateComment(e.id,{resolved:!0}),n(e.id),l.remove(),ve({panelOpen:!0})}),c.appendChild(E)}const u=document.createElement("button");u.className="ufp-btn ufp-btn-ghost",u.style.fontSize="13px",u.textContent="Delete",u.addEventListener("click",async()=>{confirm("Delete this comment and all its replies?")&&(u.disabled=!0,await r.deleteComment(e.id),i(e.id),l.remove(),ve({panelOpen:!0}))}),c.appendChild(u);const d=l.querySelector("#ufp-detail-replies"),g=OB(e.id,t,r,E=>{var I;(I=g.addReply)==null||I.call(g,E),o==null||o(E)});d.appendChild(g);const p=l.querySelector(".ufp-detail-screenshot"),B=l.querySelector(".ufp-detail-annotation-svg"),C=()=>{const E=p.clientWidth,I=p.clientHeight;B.setAttribute("viewBox",`0 0 ${E} ${I}`),kB(B,e.annotation,E,I),B.querySelectorAll("[marker-end]").forEach(Q=>{Q.setAttribute("marker-end","url(#ufp-detail-arrowhead)")})};p.complete&&p.naturalWidth>0?C():p.addEventListener("load",C)}function NB(A,e,t){const r=document.createElement("div");r.className="ufp-panel",r.innerHTML=`
|
|
720
|
+
<div class="ufp-panel-header">
|
|
721
|
+
<span class="ufp-panel-title">Feedback</span>
|
|
722
|
+
<div style="display:flex;gap:8px;align-items:center;">
|
|
723
|
+
<button id="ufp-new-feedback" class="ufp-btn ufp-btn-primary" style="font-size:13px;padding:7px 14px;display:flex;align-items:center;gap:5px;">
|
|
724
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
|
725
|
+
New
|
|
726
|
+
</button>
|
|
727
|
+
<button class="ufp-btn-icon" id="ufp-panel-close" title="Close panel">
|
|
728
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
729
|
+
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
|
730
|
+
</svg>
|
|
731
|
+
</button>
|
|
732
|
+
</div>
|
|
733
|
+
</div>
|
|
734
|
+
<div class="ufp-filter-tabs">
|
|
735
|
+
<button class="ufp-filter-tab active" data-filter="open">Open</button>
|
|
736
|
+
<button class="ufp-filter-tab" data-filter="resolved">Resolved</button>
|
|
737
|
+
</div>
|
|
738
|
+
<div class="ufp-panel-list" id="ufp-comment-list"></div>
|
|
739
|
+
`,A.appendChild(r),r.querySelector("#ufp-panel-close").addEventListener("click",()=>{ve({panelOpen:!1})}),r.querySelector("#ufp-new-feedback").addEventListener("click",()=>{ve({panelOpen:!1}),t()}),r.querySelectorAll(".ufp-filter-tab").forEach(o=>{o.addEventListener("click",()=>{r.querySelectorAll(".ufp-filter-tab").forEach(l=>l.classList.remove("active")),o.classList.add("active"),ve({filter:o.dataset.filter})})});const n=r.querySelector("#ufp-comment-list"),s=new Map,i=async(o,l)=>{const c=o.filter(u=>l==="open"?!u.resolved:u.resolved);if(n.innerHTML="",c.length===0){n.innerHTML=`
|
|
740
|
+
<div class="ufp-panel-empty">
|
|
741
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" opacity="0.4">
|
|
742
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
743
|
+
</svg>
|
|
744
|
+
<span>No ${l} comments yet</span>
|
|
745
|
+
${l==="open"?'<span style="font-size:12px;color:#9ca3af;">Click <strong>New</strong> to add feedback</span>':""}
|
|
746
|
+
</div>
|
|
747
|
+
`;return}for(const u of c){if(!s.has(u.id))try{s.set(u.id,await e.getReplies(u.id))}catch{s.set(u.id,[])}n.appendChild(VB(u,s,A,e))}};return cu(async o=>{r.classList.toggle("open",o.panelOpen),o.panelOpen&&await i(o.comments,o.filter)}),r}function VB(A,e,t,r,n){const s=e.get(A.id)??[],i=document.createElement("div");return i.className="ufp-comment-card",i.dataset.id=A.id,i.innerHTML=`
|
|
748
|
+
<div class="ufp-comment-card-header">
|
|
749
|
+
<div class="ufp-comment-meta">
|
|
750
|
+
<div class="ufp-avatar">${$o(A.authorName)}</div>
|
|
751
|
+
<div>
|
|
752
|
+
<div class="ufp-comment-author">${DA(A.authorName)}</div>
|
|
753
|
+
<div class="ufp-comment-time">${jo(A.createdAt)}</div>
|
|
754
|
+
</div>
|
|
755
|
+
</div>
|
|
756
|
+
${A.resolved?'<span class="ufp-resolved-badge">Resolved</span>':""}
|
|
757
|
+
</div>
|
|
758
|
+
<img class="ufp-comment-thumbnail" src="${A.screenshotUrl}" alt="Screenshot" loading="lazy" />
|
|
759
|
+
<div class="ufp-comment-text">${DA(A.text)}</div>
|
|
760
|
+
<div class="ufp-comment-footer">
|
|
761
|
+
<span class="ufp-reply-count">
|
|
762
|
+
${s.length>0?`${s.length} ${s.length===1?"reply":"replies"}`:"No replies yet — click to reply"}
|
|
763
|
+
</span>
|
|
764
|
+
</div>
|
|
765
|
+
`,i.addEventListener("click",async()=>{let o=e.get(A.id)??[];try{o=await r.getReplies(A.id),e.set(A.id,o)}catch(l){console.error("[ui-feedback-plugin] Failed to fetch replies:",l)}PB(t,A,o,r,l=>{const c=Jt();ve({comments:c.comments.map(u=>u.id===l?{...u,resolved:!0}:u)})},l=>{const c=Jt();ve({comments:c.comments.map(u=>u.id===l?{...u,resolved:!1}:u)})},l=>{const c=Jt();ve({comments:c.comments.filter(u=>u.id!==l)}),e.delete(l)},l=>{const c=e.get(A.id)??[];e.set(A.id,[...c,l]);const u=Jt();ve({comments:[...u.comments]})})}),i}async function MB(){try{const A=await KB();return await GB(A)}catch{return jB()}}async function KB(){return(await Promise.resolve().then(()=>yC)).default}async function GB(A){const e=window.scrollX,t=window.scrollY;window.scrollTo(0,0);try{return(await A(document.body,{allowTaint:!0,useCORS:!0,logging:!1,scale:Math.min(window.devicePixelRatio,2),width:document.documentElement.scrollWidth,height:document.documentElement.scrollHeight,windowWidth:document.documentElement.scrollWidth,windowHeight:document.documentElement.scrollHeight,x:0,y:0,ignoreElements:n=>n.tagName==="UI-FEEDBACK-PLUGIN"})).toDataURL("image/png")}finally{window.scrollTo(e,t)}}function jB(){const A=document.createElement("canvas");A.width=window.innerWidth,A.height=window.innerHeight;const e=A.getContext("2d");return e.fillStyle="#f3f4f6",e.fillRect(0,0,A.width,A.height),e.fillStyle="#9ca3af",e.font="16px -apple-system, sans-serif",e.textAlign="center",e.fillText("Screenshot unavailable",A.width/2,A.height/2),A.toDataURL("image/png")}const Wo="ui-feedback-plugin";async function $B(A){const e=A.database;if(e.provider==="firebase"){const{FirebaseAdapter:t}=await Promise.resolve().then(()=>hF);return new t(e)}if(e.provider==="supabase"){const{SupabaseAdapter:t}=await Promise.resolve().then(()=>BF);return new t(e.url,e.anonKey)}throw new Error("[ui-feedback-plugin] Unknown database provider")}async function WB(A,e){const t=A.screenshots;if(!t)return e;if(t.provider==="s3"){const{S3ScreenshotAdapter:r}=await Promise.resolve().then(()=>yF);return new r(t.uploadEndpoint,t.headers)}if(t.provider==="firebase"){if(A.database.provider!=="firebase")throw new Error('[ui-feedback-plugin] screenshots.provider "firebase" requires database.provider "firebase"');return e}if(t.provider==="supabase"){if(A.database.provider!=="supabase")throw new Error('[ui-feedback-plugin] screenshots.provider "supabase" requires database.provider "supabase"');return e}throw new Error("[ui-feedback-plugin] Unknown screenshot storage provider")}function qB(A){var i;if(customElements.get(Wo))return console.warn("[ui-feedback-plugin] Already initialized."),()=>{};const e=((i=A.theme)==null?void 0:i.primaryColor)??"#6366f1",t=A.projectKey??"default",r=A.position??"bottom-right";ve({config:A});class n extends HTMLElement{constructor(){super();pt(this,"shadow");pt(this,"dbAdapter");pt(this,"screenshotAdapter");pt(this,"unsubscribe",null);this.shadow=this.attachShadow({mode:"open"})}async connectedCallback(){const c=document.createElement("style");c.textContent=FB(e),this.shadow.appendChild(c);try{this.dbAdapter=await $B(A),this.screenshotAdapter=await WB(A,this.dbAdapter)}catch(u){console.error("[ui-feedback-plugin] Failed to initialize adapters:",u);return}this.mount()}disconnectedCallback(){var c;(c=this.unsubscribe)==null||c.call(this)}mount(){const c=du(window.location.href);NB(this.shadow,this.dbAdapter,()=>this.startAnnotation()),SB(this.shadow,r,()=>this.startAnnotation(),()=>ve({panelOpen:!Jt().panelOpen})),this.unsubscribe=this.dbAdapter.subscribeToComments(c,t,u=>{ve({comments:u})})}async startAnnotation(){let c=uu();if(!c&&(c=await xB(this.shadow),!c))return;ve({active:!0,panelOpen:!1});const u=await LB(this.shadow);if(!u){ve({active:!1});return}ve({active:!1}),this.showToast("Saving comment…","info");try{await this.saveComment(c,u.text,u.shapes),this.showToast("Comment saved!","success")}catch(d){console.error("[ui-feedback-plugin] Failed to save comment:",d),this.showToast("Failed to save — check the browser console for details.","error");return}ve({panelOpen:!0})}async saveComment(c,u,d){const g=du(window.location.href),p={shapes:d,pageWidth:document.documentElement.scrollWidth,pageHeight:document.documentElement.scrollHeight};this.style.visibility="hidden";let B;try{B=await MB()}finally{this.style.visibility=""}const C={pageUrl:g,projectKey:t,authorName:c,text:u,screenshotUrl:"",annotation:p,resolved:!1,createdAt:Date.now()},E=await this.dbAdapter.addComment(C),I=await this.screenshotAdapter.uploadScreenshot(E,B);await this.dbAdapter.updateComment(E,{screenshotUrl:I})}showToast(c,u){const d=this.shadow.querySelector(".ufp-toast");d==null||d.remove();const g={info:"#6366f1",success:"#10b981",error:"#ef4444"},p=document.createElement("div");p.className="ufp-toast",p.style.cssText=`
|
|
766
|
+
position:fixed;bottom:80px;left:50%;transform:translateX(-50%);
|
|
767
|
+
background:${g[u]};color:white;padding:10px 20px;border-radius:8px;
|
|
768
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
769
|
+
font-size:13px;font-weight:500;z-index:2147483647;
|
|
770
|
+
box-shadow:0 4px 12px rgba(0,0,0,0.2);pointer-events:none;
|
|
771
|
+
max-width:360px;text-align:center;
|
|
772
|
+
`,p.textContent=c,this.shadow.appendChild(p),setTimeout(()=>p.remove(),u==="error"?6e3:2500)}}customElements.define(Wo,n);const s=document.createElement(Wo);return document.body.appendChild(s),()=>s.remove()}/*!
|
|
773
|
+
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
|
774
|
+
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
775
|
+
* Released under MIT License
|
|
776
|
+
*//*! *****************************************************************************
|
|
777
|
+
Copyright (c) Microsoft Corporation.
|
|
778
|
+
|
|
779
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
780
|
+
purpose with or without fee is hereby granted.
|
|
781
|
+
|
|
782
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
783
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
784
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
785
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
786
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
787
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
788
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
789
|
+
***************************************************************************** */var qo=function(A,e){return qo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},qo(A,e)};function bt(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qo(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Jo=function(){return Jo=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Jo.apply(this,arguments)};function Ye(A,e,t,r){function n(s){return s instanceof t?s:new t(function(i){i(s)})}return new(t||(t=Promise))(function(s,i){function o(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((r=r.apply(A,[])).next())})}function Ne(A,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,i;return i={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function o(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,n&&(s=c[0]&2?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(u){c=[6,u],n=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Fs(A,e,t){if(arguments.length===2)for(var r=0,n=e.length,s;r<n;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return A.concat(s||e)}for(var Xt=function(){function A(e,t,r,n){this.left=e,this.top=t,this.width=r,this.height=n}return A.prototype.add=function(e,t,r,n){return new A(this.left+e,this.top+t,this.width+r,this.height+n)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var r=Array.from(t).find(function(n){return n.width!==0});return r?new A(r.left+e.windowBounds.left,r.top+e.windowBounds.top,r.width,r.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A}(),Ts=function(A,e){return Xt.fromClientRect(A,e.getBoundingClientRect())},JB=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var r=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),n=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new Xt(0,0,r,n)},Ss=function(A){for(var e=[],t=0,r=A.length;t<r;){var n=A.charCodeAt(t++);if(n>=55296&&n<=56319&&t<r){var s=A.charCodeAt(t++);(s&64512)===56320?e.push(((n&1023)<<10)+(s&1023)+65536):(e.push(n),t--)}else e.push(n)}return e},we=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var r=[],n=-1,s="";++n<t;){var i=A[n];i<=65535?r.push(i):(i-=65536,r.push((i>>10)+55296,i%1024+56320)),(n+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},Bu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",XB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Rs=0;Rs<Bu.length;Rs++)XB[Bu.charCodeAt(Rs)]=Rs;for(var mu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",An=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<mu.length;xs++)An[mu.charCodeAt(xs)]=xs;for(var zB=function(A){var e=A.length*.75,t=A.length,r,n=0,s,i,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(r=0;r<t;r+=4)s=An[A.charCodeAt(r)],i=An[A.charCodeAt(r+1)],o=An[A.charCodeAt(r+2)],l=An[A.charCodeAt(r+3)],u[n++]=s<<2|i>>4,u[n++]=(i&15)<<4|o>>2,u[n++]=(o&3)<<6|l&63;return c},YB=function(A){for(var e=A.length,t=[],r=0;r<e;r+=2)t.push(A[r+1]<<8|A[r]);return t},ZB=function(A){for(var e=A.length,t=[],r=0;r<e;r+=4)t.push(A[r+3]<<24|A[r+2]<<16|A[r+1]<<8|A[r]);return t},OA=5,Xo=11,zo=2,em=Xo-OA,yu=65536>>OA,tm=1<<OA,Yo=tm-1,Am=1024>>OA,rm=yu+Am,nm=rm,sm=32,im=nm+sm,om=65536>>Xo,am=1<<em,lm=am-1,vu=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},cm=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},um=function(A,e){var t=zB(A),r=Array.isArray(t)?ZB(t):new Uint32Array(t),n=Array.isArray(t)?YB(t):new Uint16Array(t),s=24,i=vu(n,s/2,r[4]/2),o=r[5]===2?vu(n,(s+r[4])/2):cm(r,Math.ceil((s+r[4])/4));return new hm(r[0],r[1],r[2],r[3],i,o)},hm=function(){function A(e,t,r,n,s,i){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=n,this.index=s,this.data=i}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>OA],t=(t<<zo)+(e&Yo),this.data[t];if(e<=65535)return t=this.index[yu+(e-55296>>OA)],t=(t<<zo)+(e&Yo),this.data[t];if(e<this.highStart)return t=im-om+(e>>Xo),t=this.index[t],t+=e>>OA&lm,t=this.index[t],t=(t<<zo)+(e&Yo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),_u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dm=typeof Uint8Array>"u"?[]:new Uint8Array(256),ks=0;ks<_u.length;ks++)dm[_u.charCodeAt(ks)]=ks;var fm="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Cu=50,gm=1,Eu=2,bu=3,pm=4,wm=5,Uu=7,Qu=8,Iu=9,hA=10,Zo=11,Fu=12,ea=13,Bm=14,rn=15,ta=16,Hs=17,nn=18,mm=19,Tu=20,Aa=21,sn=22,ra=23,dr=24,ct=25,on=26,an=27,fr=28,ym=29,PA=30,vm=31,Ls=32,Ds=33,na=34,sa=35,ia=36,ln=37,oa=38,Os=39,Ps=40,aa=41,Su=42,_m=43,Cm=[9001,65288],Ru="!",X="×",Ns="÷",la=um(fm),zt=[PA,ia],ca=[gm,Eu,bu,wm],xu=[hA,Qu],ku=[an,on],Em=ca.concat(xu),Hu=[oa,Os,Ps,na,sa],bm=[rn,ea],Um=function(A,e){e===void 0&&(e="strict");var t=[],r=[],n=[];return A.forEach(function(s,i){var o=la.get(s);if(o>Cu?(n.push(!0),o-=Cu):n.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(i),t.push(ta);if(o===pm||o===Zo){if(i===0)return r.push(i),t.push(PA);var l=t[i-1];return Em.indexOf(l)===-1?(r.push(r[i-1]),t.push(l)):(r.push(i),t.push(PA))}if(r.push(i),o===vm)return t.push(e==="strict"?Aa:ln);if(o===Su||o===ym)return t.push(PA);if(o===_m)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(ln):t.push(PA);t.push(o)}),[r,t,n]},ua=function(A,e,t,r){var n=r[t];if(Array.isArray(A)?A.indexOf(n)!==-1:A===n)for(var s=t;s<=r.length;){s++;var i=r[s];if(i===e)return!0;if(i!==hA)break}if(n===hA)for(var s=t;s>0;){s--;var o=r[s];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var l=t;l<=r.length;){l++;var i=r[l];if(i===e)return!0;if(i!==hA)break}if(o!==hA)break}return!1},Lu=function(A,e){for(var t=A;t>=0;){var r=e[t];if(r===hA)t--;else return r}return 0},Qm=function(A,e,t,r,n){if(t[r]===0)return X;var s=r-1;if(Array.isArray(n)&&n[s]===!0)return X;var i=s-1,o=s+1,l=e[s],c=i>=0?e[i]:0,u=e[o];if(l===Eu&&u===bu)return X;if(ca.indexOf(l)!==-1)return Ru;if(ca.indexOf(u)!==-1||xu.indexOf(u)!==-1)return X;if(Lu(s,e)===Qu)return Ns;if(la.get(A[s])===Zo||(l===Ls||l===Ds)&&la.get(A[o])===Zo||l===Uu||u===Uu||l===Iu||[hA,ea,rn].indexOf(l)===-1&&u===Iu||[Hs,nn,mm,dr,fr].indexOf(u)!==-1||Lu(s,e)===sn||ua(ra,sn,s,e)||ua([Hs,nn],Aa,s,e)||ua(Fu,Fu,s,e))return X;if(l===hA)return Ns;if(l===ra||u===ra)return X;if(u===ta||l===ta)return Ns;if([ea,rn,Aa].indexOf(u)!==-1||l===Bm||c===ia&&bm.indexOf(l)!==-1||l===fr&&u===ia||u===Tu||zt.indexOf(u)!==-1&&l===ct||zt.indexOf(l)!==-1&&u===ct||l===an&&[ln,Ls,Ds].indexOf(u)!==-1||[ln,Ls,Ds].indexOf(l)!==-1&&u===on||zt.indexOf(l)!==-1&&ku.indexOf(u)!==-1||ku.indexOf(l)!==-1&&zt.indexOf(u)!==-1||[an,on].indexOf(l)!==-1&&(u===ct||[sn,rn].indexOf(u)!==-1&&e[o+1]===ct)||[sn,rn].indexOf(l)!==-1&&u===ct||l===ct&&[ct,fr,dr].indexOf(u)!==-1)return X;if([ct,fr,dr,Hs,nn].indexOf(u)!==-1)for(var d=s;d>=0;){var g=e[d];if(g===ct)return X;if([fr,dr].indexOf(g)!==-1)d--;else break}if([an,on].indexOf(u)!==-1)for(var d=[Hs,nn].indexOf(l)!==-1?i:s;d>=0;){var g=e[d];if(g===ct)return X;if([fr,dr].indexOf(g)!==-1)d--;else break}if(oa===l&&[oa,Os,na,sa].indexOf(u)!==-1||[Os,na].indexOf(l)!==-1&&[Os,Ps].indexOf(u)!==-1||[Ps,sa].indexOf(l)!==-1&&u===Ps||Hu.indexOf(l)!==-1&&[Tu,on].indexOf(u)!==-1||Hu.indexOf(u)!==-1&&l===an||zt.indexOf(l)!==-1&&zt.indexOf(u)!==-1||l===dr&&zt.indexOf(u)!==-1||zt.concat(ct).indexOf(l)!==-1&&u===sn&&Cm.indexOf(A[o])===-1||zt.concat(ct).indexOf(u)!==-1&&l===nn)return X;if(l===aa&&u===aa){for(var p=t[s],B=1;p>0&&(p--,e[p]===aa);)B++;if(B%2!==0)return X}return l===Ls&&u===Ds?X:Ns},Im=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Um(A,e.lineBreak),r=t[0],n=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(n=n.map(function(o){return[ct,PA,Su].indexOf(o)!==-1?ln:o}));var i=e.wordBreak==="keep-all"?s.map(function(o,l){return o&&A[l]>=19968&&A[l]<=40959}):void 0;return[r,n,i]},Fm=function(){function A(e,t,r,n){this.codePoints=e,this.required=t===Ru,this.start=r,this.end=n}return A.prototype.slice=function(){return we.apply(void 0,this.codePoints.slice(this.start,this.end))},A}(),Tm=function(A,e){var t=Ss(A),r=Im(t,e),n=r[0],s=r[1],i=r[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var u=X;c<o&&(u=Qm(t,s,n,++c,i))===X;);if(u!==X||c===o){var d=new Fm(t,u,l,c);return l=c,{value:d,done:!1}}return{done:!0,value:null}}}},Sm=1,Rm=2,cn=4,Du=8,Vs=10,Ou=47,un=92,xm=9,km=32,Ms=34,hn=61,Hm=35,Lm=36,Dm=37,Ks=39,Gs=40,dn=41,Om=95,rt=45,Pm=33,Nm=60,Vm=62,Mm=64,Km=91,Gm=93,jm=61,$m=123,js=63,Wm=125,Pu=124,qm=126,Jm=128,Nu=65533,ha=42,NA=43,Xm=44,zm=58,Ym=59,fn=46,Zm=0,ey=8,ty=11,Ay=14,ry=31,ny=127,Ot=-1,Vu=48,Mu=97,Ku=101,sy=102,iy=117,oy=122,Gu=65,ju=69,$u=70,ay=85,ly=90,Ve=function(A){return A>=Vu&&A<=57},cy=function(A){return A>=55296&&A<=57343},gr=function(A){return Ve(A)||A>=Gu&&A<=$u||A>=Mu&&A<=sy},uy=function(A){return A>=Mu&&A<=oy},hy=function(A){return A>=Gu&&A<=ly},dy=function(A){return uy(A)||hy(A)},fy=function(A){return A>=Jm},$s=function(A){return A===Vs||A===xm||A===km},Ws=function(A){return dy(A)||fy(A)||A===Om},Wu=function(A){return Ws(A)||Ve(A)||A===rt},gy=function(A){return A>=Zm&&A<=ey||A===ty||A>=Ay&&A<=ry||A===ny},dA=function(A,e){return A!==un?!1:e!==Vs},qs=function(A,e,t){return A===rt?Ws(e)||dA(e,t):Ws(A)?!0:!!(A===un&&dA(A,e))},da=function(A,e,t){return A===NA||A===rt?Ve(e)?!0:e===fn&&Ve(t):Ve(A===fn?e:A)},py=function(A){var e=0,t=1;(A[e]===NA||A[e]===rt)&&(A[e]===rt&&(t=-1),e++);for(var r=[];Ve(A[e]);)r.push(A[e++]);var n=r.length?parseInt(we.apply(void 0,r),10):0;A[e]===fn&&e++;for(var s=[];Ve(A[e]);)s.push(A[e++]);var i=s.length,o=i?parseInt(we.apply(void 0,s),10):0;(A[e]===ju||A[e]===Ku)&&e++;var l=1;(A[e]===NA||A[e]===rt)&&(A[e]===rt&&(l=-1),e++);for(var c=[];Ve(A[e]);)c.push(A[e++]);var u=c.length?parseInt(we.apply(void 0,c),10):0;return t*(n+o*Math.pow(10,-i))*Math.pow(10,l*u)},wy={type:2},By={type:3},my={type:4},yy={type:13},vy={type:8},_y={type:21},Cy={type:9},Ey={type:10},by={type:11},Uy={type:12},Qy={type:14},Js={type:23},Iy={type:1},Fy={type:25},Ty={type:24},Sy={type:26},Ry={type:27},xy={type:28},ky={type:29},Hy={type:31},fa={type:32},qu=function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Ss(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==fa;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Ms:return this.consumeStringToken(Ms);case Hm:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),n=this.peekCodePoint(2);if(Wu(t)||dA(r,n)){var s=qs(t,r,n)?Rm:Sm,i=this.consumeName();return{type:5,value:i,flags:s}}break;case Lm:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),yy;break;case Ks:return this.consumeStringToken(Ks);case Gs:return wy;case dn:return By;case ha:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),Qy;break;case NA:if(da(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Xm:return my;case rt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(da(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(qs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===rt&&c===Vm)return this.consumeCodePoint(),this.consumeCodePoint(),Ty;break;case fn:if(da(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ou:if(this.peekCodePoint(0)===ha)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===ha&&(u=this.consumeCodePoint(),u===Ou))return this.consumeToken();if(u===Ot)return this.consumeToken()}break;case zm:return Sy;case Ym:return Ry;case Nm:if(this.peekCodePoint(0)===Pm&&this.peekCodePoint(1)===rt&&this.peekCodePoint(2)===rt)return this.consumeCodePoint(),this.consumeCodePoint(),Fy;break;case Mm:var d=this.peekCodePoint(0),g=this.peekCodePoint(1),p=this.peekCodePoint(2);if(qs(d,g,p)){var i=this.consumeName();return{type:7,value:i}}break;case Km:return xy;case un:if(dA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Gm:return ky;case jm:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),vy;break;case $m:return by;case Wm:return Uy;case iy:case ay:var B=this.peekCodePoint(0),C=this.peekCodePoint(1);return B===NA&&(gr(C)||C===js)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Pu:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),Cy;if(this.peekCodePoint(0)===Pu)return this.consumeCodePoint(),_y;break;case qm:if(this.peekCodePoint(0)===hn)return this.consumeCodePoint(),Ey;break;case Ot:return fa}return $s(e)?(this.consumeWhiteSpace(),Hy):Ve(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Ws(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:we(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();gr(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===js&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var n=parseInt(we.apply(void 0,e.map(function(l){return l===js?Vu:l})),16),s=parseInt(we.apply(void 0,e.map(function(l){return l===js?$u:l})),16);return{type:30,start:n,end:s}}var i=parseInt(we.apply(void 0,e),16);if(this.peekCodePoint(0)===rt&&gr(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];gr(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var s=parseInt(we.apply(void 0,o),16);return{type:30,start:i,end:s}}else return{type:30,start:i,end:i}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Gs?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Gs?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ot)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Ks||t===Ms){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Ot||this.peekCodePoint(0)===dn)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),Js)}for(;;){var n=this.consumeCodePoint();if(n===Ot||n===dn)return{type:22,value:we.apply(void 0,e)};if($s(n))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Ot||this.peekCodePoint(0)===dn?(this.consumeCodePoint(),{type:22,value:we.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Js);if(n===Ms||n===Ks||n===Gs||gy(n))return this.consumeBadUrlRemnants(),Js;if(n===un)if(dA(n,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Js;else e.push(n)}},A.prototype.consumeWhiteSpace=function(){for(;$s(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===dn||e===Ot)return;dA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var n=Math.min(t,e);r+=we.apply(void 0,this._value.splice(0,n)),e-=n}return this._value.shift(),r},A.prototype.consumeStringToken=function(e){var t="",r=0;do{var n=this._value[r];if(n===Ot||n===void 0||n===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(n===Vs)return this._value.splice(0,r),Iy;if(n===un){var s=this._value[r+1];s!==Ot&&s!==void 0&&(s===Vs?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):dA(n,s)&&(t+=this.consumeStringSlice(r),t+=we(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=cn,r=this.peekCodePoint(0);for((r===NA||r===rt)&&e.push(this.consumeCodePoint());Ve(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var n=this.peekCodePoint(1);if(r===fn&&Ve(n))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Du;Ve(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),n=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===ju||r===Ku)&&((n===NA||n===rt)&&Ve(s)||Ve(n)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Du;Ve(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[py(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],n=this.peekCodePoint(0),s=this.peekCodePoint(1),i=this.peekCodePoint(2);if(qs(n,s,i)){var o=this.consumeName();return{type:15,number:t,flags:r,unit:o}}return n===Dm?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(gr(e)){for(var t=we(e);gr(this.peekCodePoint(0))&&t.length<6;)t+=we(this.consumeCodePoint());$s(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||cy(r)||r>1114111?Nu:r}return e===Ot?Nu:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Wu(t))e+=we(t);else if(dA(t,this.peekCodePoint(0)))e+=we(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A}(),Ju=function(){function A(e){this._tokens=e}return A.create=function(e){var t=new qu;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||Dy(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?fa:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A}(),gn=function(A){return A.type===15},pr=function(A){return A.type===17},ne=function(A){return A.type===20},Ly=function(A){return A.type===0},ga=function(A,e){return ne(A)&&A.value===e},Xu=function(A){return A.type!==31},wr=function(A){return A.type!==31&&A.type!==4},Pt=function(A){var e=[],t=[];return A.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},Dy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},fA=function(A){return A.type===17||A.type===15},_e=function(A){return A.type===16||fA(A)},zu=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},xe={type:17,number:0,flags:cn},pa={type:16,number:50,flags:cn},gA={type:16,number:100,flags:cn},pn=function(A,e,t){var r=A[0],n=A[1];return[oe(r,e),oe(typeof n<"u"?n:r,t)]},oe=function(A,e){if(A.type===16)return A.number/100*e;if(gn(A))switch(A.unit){case"rem":case"em":return 16*A.number;case"px":default:return A.number}return A.number},Yu="deg",Zu="grad",eh="rad",th="turn",Xs={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case Yu:return Math.PI*e.number/180;case Zu:return Math.PI/200*e.number;case eh:return e.number;case th:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Ah=function(A){return A.type===15&&(A.unit===Yu||A.unit===Zu||A.unit===eh||A.unit===th)},rh=function(A){var e=A.filter(ne).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[xe,xe];case"to top":case"bottom":return Bt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[xe,gA];case"to right":case"left":return Bt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gA,gA];case"to bottom":case"top":return Bt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gA,xe];case"to left":case"right":return Bt(270)}return 0},Bt=function(A){return Math.PI*A/180},pA={name:"color",parse:function(A,e){if(e.type===18){var t=Oy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(A,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),n=e.value.substring(1,2),s=e.value.substring(2,3);return BA(parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),n=e.value.substring(1,2),s=e.value.substring(2,3),i=e.value.substring(3,4);return BA(parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16),parseInt(i+i,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),n=e.value.substring(2,4),s=e.value.substring(4,6);return BA(parseInt(r,16),parseInt(n,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),n=e.value.substring(2,4),s=e.value.substring(4,6),i=e.value.substring(6,8);return BA(parseInt(r,16),parseInt(n,16),parseInt(s,16),parseInt(i,16)/255)}}if(e.type===20){var o=Yt[e.value.toUpperCase()];if(typeof o<"u")return o}return Yt.TRANSPARENT}},wA=function(A){return(255&A)===0},Se=function(A){var e=255&A,t=255&A>>8,r=255&A>>16,n=255&A>>24;return e<255?"rgba("+n+","+r+","+t+","+e/255+")":"rgb("+n+","+r+","+t+")"},BA=function(A,e,t,r){return(A<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},nh=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},sh=function(A,e){var t=e.filter(wr);if(t.length===3){var r=t.map(nh),n=r[0],s=r[1],i=r[2];return BA(n,s,i,1)}if(t.length===4){var o=t.map(nh),n=o[0],s=o[1],i=o[2],l=o[3];return BA(n,s,i,l)}return 0};function wa(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A}var ih=function(A,e){var t=e.filter(wr),r=t[0],n=t[1],s=t[2],i=t[3],o=(r.type===17?Bt(r.number):Xs.parse(A,r))/(Math.PI*2),l=_e(n)?n.number/100:0,c=_e(s)?s.number/100:0,u=typeof i<"u"&&_e(i)?oe(i,1):1;if(l===0)return BA(c*255,c*255,c*255,1);var d=c<=.5?c*(l+1):c+l-c*l,g=c*2-d,p=wa(g,d,o+1/3),B=wa(g,d,o),C=wa(g,d,o-1/3);return BA(p*255,B*255,C*255,u)},Oy={hsl:ih,hsla:ih,rgb:sh,rgba:sh},wn=function(A,e){return pA.parse(A,Ju.create(e).parseComponentValue())},Yt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Py={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(ne(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ny={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zs=function(A,e){var t=pA.parse(A,e[0]),r=e[1];return r&&_e(r)?{color:t,stop:r}:{color:t,stop:null}},oh=function(A,e){var t=A[0],r=A[A.length-1];t.stop===null&&(t.stop=xe),r.stop===null&&(r.stop=gA);for(var n=[],s=0,i=0;i<A.length;i++){var o=A[i].stop;if(o!==null){var l=oe(o,e);l>s?n.push(l):n.push(s),s=l}else n.push(null)}for(var c=null,i=0;i<n.length;i++){var u=n[i];if(u===null)c===null&&(c=i);else if(c!==null){for(var d=i-c,g=n[c-1],p=(u-g)/(d+1),B=1;B<=d;B++)n[c+B-1]=p*B;c=null}}return A.map(function(C,E){var I=C.color;return{color:I,stop:Math.max(Math.min(1,n[E]/e),0)}})},Vy=function(A,e,t){var r=e/2,n=t/2,s=oe(A[0],e)-r,i=n-oe(A[1],t);return(Math.atan2(i,s)+Math.PI*2)%(Math.PI*2)},My=function(A,e,t){var r=typeof A=="number"?A:Vy(A,e,t),n=Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)),s=e/2,i=t/2,o=n/2,l=Math.sin(r-Math.PI/2)*o,c=Math.cos(r-Math.PI/2)*o;return[n,s-c,s+c,i-l,i+l]},Ut=function(A,e){return Math.sqrt(A*A+e*e)},ah=function(A,e,t,r,n){var s=[[0,0],[0,e],[A,0],[A,e]];return s.reduce(function(i,o){var l=o[0],c=o[1],u=Ut(t-l,r-c);return(n?u<i.optimumDistance:u>i.optimumDistance)?{optimumCorner:o,optimumDistance:u}:i},{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},Ky=function(A,e,t,r,n){var s=0,i=0;switch(A.size){case 0:A.shape===0?s=i=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-n)):A.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),i=Math.min(Math.abs(t),Math.abs(t-n)));break;case 2:if(A.shape===0)s=i=Math.min(Ut(e,t),Ut(e,t-n),Ut(e-r,t),Ut(e-r,t-n));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-n))/Math.min(Math.abs(e),Math.abs(e-r)),l=ah(r,n,e,t,!0),c=l[0],u=l[1];s=Ut(c-e,(u-t)/o),i=o*s}break;case 1:A.shape===0?s=i=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-n)):A.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),i=Math.max(Math.abs(t),Math.abs(t-n)));break;case 3:if(A.shape===0)s=i=Math.max(Ut(e,t),Ut(e,t-n),Ut(e-r,t),Ut(e-r,t-n));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-n))/Math.max(Math.abs(e),Math.abs(e-r)),d=ah(r,n,e,t,!1),c=d[0],u=d[1];s=Ut(c-e,(u-t)/o),i=o*s}break}return Array.isArray(A.size)&&(s=oe(A.size[0],r),i=A.size.length===2?oe(A.size[1],n):s),[s,i]},Gy=function(A,e){var t=Bt(180),r=[];return Pt(e).forEach(function(n,s){if(s===0){var i=n[0];if(i.type===20&&i.value==="to"){t=rh(n);return}else if(Ah(i)){t=Xs.parse(A,i);return}}var o=zs(A,n);r.push(o)}),{angle:t,stops:r,type:1}},Ys=function(A,e){var t=Bt(180),r=[];return Pt(e).forEach(function(n,s){if(s===0){var i=n[0];if(i.type===20&&["top","left","right","bottom"].indexOf(i.value)!==-1){t=rh(n);return}else if(Ah(i)){t=(Xs.parse(A,i)+Bt(270))%Bt(360);return}}var o=zs(A,n);r.push(o)}),{angle:t,stops:r,type:1}},jy=function(A,e){var t=Bt(180),r=[],n=1,s=0,i=3,o=[];return Pt(e).forEach(function(l,c){var u=l[0];if(c===0){if(ne(u)&&u.value==="linear"){n=1;return}else if(ne(u)&&u.value==="radial"){n=2;return}}if(u.type===18){if(u.name==="from"){var d=pA.parse(A,u.values[0]);r.push({stop:xe,color:d})}else if(u.name==="to"){var d=pA.parse(A,u.values[0]);r.push({stop:gA,color:d})}else if(u.name==="color-stop"){var g=u.values.filter(wr);if(g.length===2){var d=pA.parse(A,g[1]),p=g[0];pr(p)&&r.push({stop:{type:16,number:p.number*100,flags:p.flags},color:d})}}}}),n===1?{angle:(t+Bt(180))%Bt(360),stops:r,type:n}:{size:i,shape:s,stops:r,position:o,type:n}},lh="closest-side",ch="farthest-side",uh="closest-corner",hh="farthest-corner",dh="circle",fh="ellipse",gh="cover",ph="contain",$y=function(A,e){var t=0,r=3,n=[],s=[];return Pt(e).forEach(function(i,o){var l=!0;if(o===0){var c=!1;l=i.reduce(function(d,g){if(c)if(ne(g))switch(g.value){case"center":return s.push(pa),d;case"top":case"left":return s.push(xe),d;case"right":case"bottom":return s.push(gA),d}else(_e(g)||fA(g))&&s.push(g);else if(ne(g))switch(g.value){case dh:return t=0,!1;case fh:return t=1,!1;case"at":return c=!0,!1;case lh:return r=0,!1;case gh:case ch:return r=1,!1;case ph:case uh:return r=2,!1;case hh:return r=3,!1}else if(fA(g)||_e(g))return Array.isArray(r)||(r=[]),r.push(g),!1;return d},l)}if(l){var u=zs(A,i);n.push(u)}}),{size:r,shape:t,stops:n,position:s,type:2}},Zs=function(A,e){var t=0,r=3,n=[],s=[];return Pt(e).forEach(function(i,o){var l=!0;if(o===0?l=i.reduce(function(u,d){if(ne(d))switch(d.value){case"center":return s.push(pa),!1;case"top":case"left":return s.push(xe),!1;case"right":case"bottom":return s.push(gA),!1}else if(_e(d)||fA(d))return s.push(d),!1;return u},l):o===1&&(l=i.reduce(function(u,d){if(ne(d))switch(d.value){case dh:return t=0,!1;case fh:return t=1,!1;case ph:case lh:return r=0,!1;case ch:return r=1,!1;case uh:return r=2,!1;case gh:case hh:return r=3,!1}else if(fA(d)||_e(d))return Array.isArray(r)||(r=[]),r.push(d),!1;return u},l)),l){var c=zs(A,i);n.push(c)}}),{size:r,shape:t,stops:n,position:s,type:2}},Wy=function(A){return A.type===1},qy=function(A){return A.type===2},Ba={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var r=wh[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(A,e.values)}throw new Error("Unsupported image type "+e.type)}};function Jy(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!wh[A.name])}var wh={"linear-gradient":Gy,"-moz-linear-gradient":Ys,"-ms-linear-gradient":Ys,"-o-linear-gradient":Ys,"-webkit-linear-gradient":Ys,"radial-gradient":$y,"-moz-radial-gradient":Zs,"-ms-radial-gradient":Zs,"-o-radial-gradient":Zs,"-webkit-radial-gradient":Zs,"-webkit-gradient":jy},Xy={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return wr(r)&&Jy(r)}).map(function(r){return Ba.parse(A,r)})}},zy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(ne(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Yy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return Pt(e).map(function(t){return t.filter(_e)}).map(zu)}},Zy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return Pt(e).map(function(t){return t.filter(ne).map(function(r){return r.value}).join(" ")}).map(ev)}},ev=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Br;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(Br||(Br={}));var tv={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return Pt(e).map(function(t){return t.filter(Av)})}},Av=function(A){return ne(A)||_e(A)},ei=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},rv=ei("top"),nv=ei("right"),sv=ei("bottom"),iv=ei("left"),ti=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return zu(t.filter(_e))}}},ov=ti("top-left"),av=ti("top-right"),lv=ti("bottom-right"),cv=ti("bottom-left"),Ai=function(A){return{name:"border-"+A+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},uv=Ai("top"),hv=Ai("right"),dv=Ai("bottom"),fv=Ai("left"),ri=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return gn(t)?t.number:0}}},gv=ri("top"),pv=ri("right"),wv=ri("bottom"),Bv=ri("left"),mv={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},yv={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},vv={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter(ne).reduce(function(t,r){return t|_v(r.value)},0)}},_v=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Cv={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Ev={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ni;(function(A){A.NORMAL="normal",A.STRICT="strict"})(ni||(ni={}));var bv={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"strict":return ni.STRICT;case"normal":default:return ni.NORMAL}}},Uv={name:"line-height",initialValue:"normal",prefix:!1,type:4},Bh=function(A,e){return ne(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:_e(A)?oe(A,e):e},Qv={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:Ba.parse(A,e)}},Iv={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},ma={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},si=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:4}},Fv=si("top"),Tv=si("right"),Sv=si("bottom"),Rv=si("left"),xv={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter(ne).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},kv={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},ii=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Hv=ii("top"),Lv=ii("right"),Dv=ii("bottom"),Ov=ii("left"),Pv={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Nv={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Vv={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&ga(e[0],"none")?[]:Pt(e).map(function(t){for(var r={color:Yt.TRANSPARENT,offsetX:xe,offsetY:xe,blur:xe},n=0,s=0;s<t.length;s++){var i=t[s];fA(i)?(n===0?r.offsetX=i:n===1?r.offsetY=i:r.blur=i,n++):r.color=pA.parse(A,i)}return r})}},Mv={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Kv={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=$v[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Gv=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},jv=function(A){var e=A.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var n=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var i=e[12],o=e[13];return e[14],e[15],e.length===16?[t,r,n,s,i,o]:null},$v={matrix:Gv,matrix3d:jv},mh={type:16,number:50,flags:cn},Wv=[mh,mh],qv={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(_e);return t.length!==2?Wv:[t[0],t[1]]}},Jv={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},Bn;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(Bn||(Bn={}));for(var Xv={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return Bn.BREAK_ALL;case"keep-all":return Bn.KEEP_ALL;case"normal":default:return Bn.NORMAL}}},zv={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(pr(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},yh={name:"time",parse:function(A,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Yv={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return pr(e)?e.number:1}},Zv={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},e0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter(ne).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},t0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],r=[];return e.forEach(function(n){switch(n.type){case 20:case 0:t.push(n.value);break;case 17:t.push(n.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(n){return n.indexOf(" ")===-1?n:"'"+n+"'"})}},A0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},r0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){if(pr(e))return e.number;if(ne(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},n0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter(ne).map(function(t){return t.value})}},s0={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Ie=function(A,e){return(A&e)!==0},i0={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},o0={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var r=[],n=e.filter(Xu),s=0;s<n.length;s++){var i=n[s],o=n[s+1];if(i.type===20){var l=o&&pr(o)?o.number:1;r.push({counter:i.value,increment:l})}}return r}},a0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],r=e.filter(Xu),n=0;n<r.length;n++){var s=r[n],i=r[n+1];if(ne(s)&&s.value!=="none"){var o=i&&pr(i)?i.number:0;t.push({counter:s.value,reset:o})}}return t}},l0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(gn).map(function(t){return yh.parse(A,t)})}},c0={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var r=[],n=e.filter(Ly);if(n.length%2!==0)return null;for(var s=0;s<n.length;s+=2){var i=n[s].value,o=n[s+1].value;r.push({open:i,close:o})}return r}},vh=function(A,e,t){if(!A)return"";var r=A[Math.min(e,A.length-1)];return r?t?r.open:r.close:""},u0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&ga(e[0],"none")?[]:Pt(e).map(function(t){for(var r={color:255,offsetX:xe,offsetY:xe,blur:xe,spread:xe,inset:!1},n=0,s=0;s<t.length;s++){var i=t[s];ga(i,"inset")?r.inset=!0:fA(i)?(n===0?r.offsetX=i:n===1?r.offsetY=i:n===2?r.blur=i:r.spread=i,n++):r.color=pA.parse(A,i)}return r})}},h0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],r=[];return e.filter(ne).forEach(function(n){switch(n.value){case"stroke":r.push(1);break;case"fill":r.push(0);break;case"markers":r.push(2);break}}),t.forEach(function(n){r.indexOf(n)===-1&&r.push(n)}),r}},d0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},f0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return gn(e)?e.number:0}},g0=function(){function A(e,t){var r,n;this.animationDuration=V(e,l0,t.animationDuration),this.backgroundClip=V(e,Py,t.backgroundClip),this.backgroundColor=V(e,Ny,t.backgroundColor),this.backgroundImage=V(e,Xy,t.backgroundImage),this.backgroundOrigin=V(e,zy,t.backgroundOrigin),this.backgroundPosition=V(e,Yy,t.backgroundPosition),this.backgroundRepeat=V(e,Zy,t.backgroundRepeat),this.backgroundSize=V(e,tv,t.backgroundSize),this.borderTopColor=V(e,rv,t.borderTopColor),this.borderRightColor=V(e,nv,t.borderRightColor),this.borderBottomColor=V(e,sv,t.borderBottomColor),this.borderLeftColor=V(e,iv,t.borderLeftColor),this.borderTopLeftRadius=V(e,ov,t.borderTopLeftRadius),this.borderTopRightRadius=V(e,av,t.borderTopRightRadius),this.borderBottomRightRadius=V(e,lv,t.borderBottomRightRadius),this.borderBottomLeftRadius=V(e,cv,t.borderBottomLeftRadius),this.borderTopStyle=V(e,uv,t.borderTopStyle),this.borderRightStyle=V(e,hv,t.borderRightStyle),this.borderBottomStyle=V(e,dv,t.borderBottomStyle),this.borderLeftStyle=V(e,fv,t.borderLeftStyle),this.borderTopWidth=V(e,gv,t.borderTopWidth),this.borderRightWidth=V(e,pv,t.borderRightWidth),this.borderBottomWidth=V(e,wv,t.borderBottomWidth),this.borderLeftWidth=V(e,Bv,t.borderLeftWidth),this.boxShadow=V(e,u0,t.boxShadow),this.color=V(e,mv,t.color),this.direction=V(e,yv,t.direction),this.display=V(e,vv,t.display),this.float=V(e,Cv,t.cssFloat),this.fontFamily=V(e,t0,t.fontFamily),this.fontSize=V(e,A0,t.fontSize),this.fontStyle=V(e,s0,t.fontStyle),this.fontVariant=V(e,n0,t.fontVariant),this.fontWeight=V(e,r0,t.fontWeight),this.letterSpacing=V(e,Ev,t.letterSpacing),this.lineBreak=V(e,bv,t.lineBreak),this.lineHeight=V(e,Uv,t.lineHeight),this.listStyleImage=V(e,Qv,t.listStyleImage),this.listStylePosition=V(e,Iv,t.listStylePosition),this.listStyleType=V(e,ma,t.listStyleType),this.marginTop=V(e,Fv,t.marginTop),this.marginRight=V(e,Tv,t.marginRight),this.marginBottom=V(e,Sv,t.marginBottom),this.marginLeft=V(e,Rv,t.marginLeft),this.opacity=V(e,Yv,t.opacity);var s=V(e,xv,t.overflow);this.overflowX=s[0],this.overflowY=s[s.length>1?1:0],this.overflowWrap=V(e,kv,t.overflowWrap),this.paddingTop=V(e,Hv,t.paddingTop),this.paddingRight=V(e,Lv,t.paddingRight),this.paddingBottom=V(e,Dv,t.paddingBottom),this.paddingLeft=V(e,Ov,t.paddingLeft),this.paintOrder=V(e,h0,t.paintOrder),this.position=V(e,Nv,t.position),this.textAlign=V(e,Pv,t.textAlign),this.textDecorationColor=V(e,Zv,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=V(e,e0,(n=t.textDecorationLine)!==null&&n!==void 0?n:t.textDecoration),this.textShadow=V(e,Vv,t.textShadow),this.textTransform=V(e,Mv,t.textTransform),this.transform=V(e,Kv,t.transform),this.transformOrigin=V(e,qv,t.transformOrigin),this.visibility=V(e,Jv,t.visibility),this.webkitTextStrokeColor=V(e,d0,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=V(e,f0,t.webkitTextStrokeWidth),this.wordBreak=V(e,Xv,t.wordBreak),this.zIndex=V(e,zv,t.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return wA(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Ie(this.display,4)||Ie(this.display,33554432)||Ie(this.display,268435456)||Ie(this.display,536870912)||Ie(this.display,67108864)||Ie(this.display,134217728)},A}(),p0=function(){function A(e,t){this.content=V(e,i0,t.content),this.quotes=V(e,c0,t.quotes)}return A}(),_h=function(){function A(e,t){this.counterIncrement=V(e,o0,t.counterIncrement),this.counterReset=V(e,a0,t.counterReset)}return A}(),V=function(A,e,t){var r=new qu,n=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(n);var s=new Ju(r.read());switch(e.type){case 2:var i=s.parseComponentValue();return e.parse(A,ne(i)?i.value:e.initialValue);case 0:return e.parse(A,s.parseComponentValue());case 1:return e.parse(A,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return Xs.parse(A,s.parseComponentValue());case"color":return pA.parse(A,s.parseComponentValue());case"image":return Ba.parse(A,s.parseComponentValue());case"length":var o=s.parseComponentValue();return fA(o)?o:xe;case"length-percentage":var l=s.parseComponentValue();return _e(l)?l:xe;case"time":return yh.parse(A,s.parseComponentValue())}break}},w0="data-html2canvas-debug",B0=function(A){var e=A.getAttribute(w0);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},ya=function(A,e){var t=B0(A);return t===1||e===t},Nt=function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,ya(t,3))debugger;this.styles=new g0(e,window.getComputedStyle(t,null)),ka(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Ts(this.context,t),ya(t,4)&&(this.flags|=16)}return A}(),m0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mn=typeof Uint8Array>"u"?[]:new Uint8Array(256),oi=0;oi<Ch.length;oi++)mn[Ch.charCodeAt(oi)]=oi;for(var y0=function(A){var e=A.length*.75,t=A.length,r,n=0,s,i,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),u=Array.isArray(c)?c:new Uint8Array(c);for(r=0;r<t;r+=4)s=mn[A.charCodeAt(r)],i=mn[A.charCodeAt(r+1)],o=mn[A.charCodeAt(r+2)],l=mn[A.charCodeAt(r+3)],u[n++]=s<<2|i>>4,u[n++]=(i&15)<<4|o>>2,u[n++]=(o&3)<<6|l&63;return c},v0=function(A){for(var e=A.length,t=[],r=0;r<e;r+=2)t.push(A[r+1]<<8|A[r]);return t},_0=function(A){for(var e=A.length,t=[],r=0;r<e;r+=4)t.push(A[r+3]<<24|A[r+2]<<16|A[r+1]<<8|A[r]);return t},VA=5,va=11,_a=2,C0=va-VA,Eh=65536>>VA,E0=1<<VA,Ca=E0-1,b0=1024>>VA,U0=Eh+b0,Q0=U0,I0=32,F0=Q0+I0,T0=65536>>va,S0=1<<C0,R0=S0-1,bh=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},x0=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},k0=function(A,e){var t=y0(A),r=Array.isArray(t)?_0(t):new Uint32Array(t),n=Array.isArray(t)?v0(t):new Uint16Array(t),s=24,i=bh(n,s/2,r[4]/2),o=r[5]===2?bh(n,(s+r[4])/2):x0(r,Math.ceil((s+r[4])/4));return new H0(r[0],r[1],r[2],r[3],i,o)},H0=function(){function A(e,t,r,n,s,i){this.initialValue=e,this.errorValue=t,this.highStart=r,this.highValueIndex=n,this.index=s,this.data=i}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>VA],t=(t<<_a)+(e&Ca),this.data[t];if(e<=65535)return t=this.index[Eh+(e-55296>>VA)],t=(t<<_a)+(e&Ca),this.data[t];if(e<this.highStart)return t=F0-T0+(e>>va),t=this.index[t],t+=e>>VA&R0,t=this.index[t],t=(t<<_a)+(e&Ca),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),Uh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L0=typeof Uint8Array>"u"?[]:new Uint8Array(256),ai=0;ai<Uh.length;ai++)L0[Uh.charCodeAt(ai)]=ai;var D0=1,Ea=2,ba=3,Qh=4,Ih=5,O0=7,Fh=8,Ua=9,Qa=10,Th=11,Sh=12,Rh=13,xh=14,Ia=15,P0=function(A){for(var e=[],t=0,r=A.length;t<r;){var n=A.charCodeAt(t++);if(n>=55296&&n<=56319&&t<r){var s=A.charCodeAt(t++);(s&64512)===56320?e.push(((n&1023)<<10)+(s&1023)+65536):(e.push(n),t--)}else e.push(n)}return e},N0=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var r=[],n=-1,s="";++n<t;){var i=A[n];i<=65535?r.push(i):(i-=65536,r.push((i>>10)+55296,i%1024+56320)),(n+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},V0=k0(m0),mt="×",Fa="÷",M0=function(A){return V0.get(A)},K0=function(A,e,t){var r=t-2,n=e[r],s=e[t-1],i=e[t];if(s===Ea&&i===ba)return mt;if(s===Ea||s===ba||s===Qh||i===Ea||i===ba||i===Qh)return Fa;if(s===Fh&&[Fh,Ua,Th,Sh].indexOf(i)!==-1||(s===Th||s===Ua)&&(i===Ua||i===Qa)||(s===Sh||s===Qa)&&i===Qa||i===Rh||i===Ih||i===O0||s===D0)return mt;if(s===Rh&&i===xh){for(;n===Ih;)n=e[--r];if(n===xh)return mt}if(s===Ia&&i===Ia){for(var o=0;n===Ia;)o++,n=e[--r];if(o%2===0)return mt}return Fa},G0=function(A){var e=P0(A),t=e.length,r=0,n=0,s=e.map(M0);return{next:function(){if(r>=t)return{done:!0,value:null};for(var i=mt;r<t&&(i=K0(e,s,++r))===mt;);if(i!==mt||r===t){var o=N0.apply(null,e.slice(n,r));return n=r,{value:o,done:!1}}return{done:!0,value:null}}}},j0=function(A){for(var e=G0(A),t=[],r;!(r=e.next()).done;)r.value&&t.push(r.value.slice());return t},$0=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var r=A.createElement("boundtest");r.style.height=e+"px",r.style.display="block",A.body.appendChild(r),t.selectNode(r);var n=t.getBoundingClientRect(),s=Math.round(n.height);if(A.body.removeChild(r),s===e)return!0}}return!1},W0=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var r=e.firstChild,n=Ss(r.data).map(function(l){return we(l)}),s=0,i={},o=n.every(function(l,c){t.setStart(r,s),t.setEnd(r,s+l.length);var u=t.getBoundingClientRect();s+=l.length;var d=u.x>i.x||u.y>i.y;return i=u,c===0?!0:d});return A.body.removeChild(e),o},q0=function(){return typeof new Image().crossOrigin<"u"},J0=function(){return typeof new XMLHttpRequest().responseType=="string"},X0=function(A){var e=new Image,t=A.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},kh=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},z0=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var n=new Image,s=e.toDataURL();n.src=s;var i=Ta(t,t,0,0,n);return r.fillStyle="red",r.fillRect(0,0,t,t),Hh(i).then(function(o){r.drawImage(o,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url("+s+")",c.style.height=t+"px",kh(l)?Hh(Ta(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return r.drawImage(o,0,0),kh(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ta=function(A,e,t,r,n){var s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return i.setAttributeNS(null,"width",A.toString()),i.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",r.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),i.appendChild(o),o.appendChild(n),i},Hh=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},ke={get SUPPORT_RANGE_BOUNDS(){var A=$0(document);return Object.defineProperty(ke,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=ke.SUPPORT_RANGE_BOUNDS&&W0(document);return Object.defineProperty(ke,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=X0(document);return Object.defineProperty(ke,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?z0(document):Promise.resolve(!1);return Object.defineProperty(ke,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=q0();return Object.defineProperty(ke,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=J0();return Object.defineProperty(ke,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ke,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ke,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},yn=function(){function A(e,t){this.text=e,this.bounds=t}return A}(),Y0=function(A,e,t,r){var n=t_(e,t),s=[],i=0;return n.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(ke.SUPPORT_RANGE_BOUNDS){var l=Lh(r,i,o.length).getClientRects();if(l.length>1){var c=Sa(o),u=0;c.forEach(function(g){s.push(new yn(g,Xt.fromDOMRectList(A,Lh(r,u+i,g.length).getClientRects()))),u+=g.length})}else s.push(new yn(o,Xt.fromDOMRectList(A,l)))}else{var d=r.splitText(o.length);s.push(new yn(o,Z0(A,r))),r=d}else ke.SUPPORT_RANGE_BOUNDS||(r=r.splitText(o.length));i+=o.length}),s},Z0=function(A,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var n=e.parentNode;if(n){n.replaceChild(r,e);var s=Ts(A,r);return r.firstChild&&n.replaceChild(r.firstChild,r),s}}return Xt.EMPTY},Lh=function(A,e,t){var r=A.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(A,e),n.setEnd(A,e+t),n},Sa=function(A){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return j0(A)},e_=function(A,e){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(r){return r.segment})}return r_(A,e)},t_=function(A,e){return e.letterSpacing!==0?Sa(A):e_(A,e)},A_=[32,160,4961,65792,65793,4153,4241],r_=function(A,e){for(var t=Tm(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],n,s=function(){if(n.value){var i=n.value.slice(),o=Ss(i),l="";o.forEach(function(c){A_.indexOf(c)===-1?l+=we(c):(l.length&&r.push(l),r.push(we(c)),l="")}),l.length&&r.push(l)}};!(n=t.next()).done;)s();return r},n_=function(){function A(e,t,r){this.text=s_(t.data,r.textTransform),this.textBounds=Y0(e,this.text,r,t)}return A}(),s_=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(i_,o_);case 2:return A.toUpperCase();default:return A}},i_=/(^|\s|:|-|\(|\))([a-z])/g,o_=function(A,e,t){return A.length>0?e+t.toUpperCase():A},Dh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.src=r.currentSrc||r.src,n.intrinsicWidth=r.naturalWidth,n.intrinsicHeight=r.naturalHeight,n.context.cache.addImage(n.src),n}return e}(Nt),Oh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r,n.intrinsicWidth=r.width,n.intrinsicHeight=r.height,n}return e}(Nt),Ph=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this,s=new XMLSerializer,i=Ts(t,r);return r.setAttribute("width",i.width+"px"),r.setAttribute("height",i.height+"px"),n.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),n.intrinsicWidth=r.width.baseVal.value,n.intrinsicHeight=r.height.baseVal.value,n.context.cache.addImage(n.svg),n}return e}(Nt),Nh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.value=r.value,n}return e}(Nt),Ra=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.start=r.start,n.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,n}return e}(Nt),a_=[{type:15,flags:0,unit:"px",number:3}],l_=[{type:16,flags:0,number:50}],c_=function(A){return A.width>A.height?new Xt(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new Xt(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},u_=function(A){var e=A.type===h_?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},li="checkbox",ci="radio",h_="password",Vh=707406591,xa=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;switch(n.type=r.type.toLowerCase(),n.checked=r.checked,n.value=u_(r),(n.type===li||n.type===ci)&&(n.styles.backgroundColor=3739148031,n.styles.borderTopColor=n.styles.borderRightColor=n.styles.borderBottomColor=n.styles.borderLeftColor=2779096575,n.styles.borderTopWidth=n.styles.borderRightWidth=n.styles.borderBottomWidth=n.styles.borderLeftWidth=1,n.styles.borderTopStyle=n.styles.borderRightStyle=n.styles.borderBottomStyle=n.styles.borderLeftStyle=1,n.styles.backgroundClip=[0],n.styles.backgroundOrigin=[0],n.bounds=c_(n.bounds)),n.type){case li:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=a_;break;case ci:n.styles.borderTopRightRadius=n.styles.borderTopLeftRadius=n.styles.borderBottomRightRadius=n.styles.borderBottomLeftRadius=l_;break}return n}return e}(Nt),Mh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this,s=r.options[r.selectedIndex||0];return n.value=s&&s.text||"",n}return e}(Nt),Kh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.value=r.value,n}return e}(Nt),Gh=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;n.src=r.src,n.width=parseInt(r.width,10)||0,n.height=parseInt(r.height,10)||0,n.backgroundColor=n.styles.backgroundColor;try{if(r.contentWindow&&r.contentWindow.document&&r.contentWindow.document.documentElement){n.tree=$h(t,r.contentWindow.document.documentElement);var s=r.contentWindow.document.documentElement?wn(t,getComputedStyle(r.contentWindow.document.documentElement).backgroundColor):Yt.TRANSPARENT,i=r.contentWindow.document.body?wn(t,getComputedStyle(r.contentWindow.document.body).backgroundColor):Yt.TRANSPARENT;n.backgroundColor=wA(s)?wA(i)?n.styles.backgroundColor:i:s}}catch{}return n}return e}(Nt),d_=["OL","UL","MENU"],ui=function(A,e,t,r){for(var n=e.firstChild,s=void 0;n;n=s)if(s=n.nextSibling,Wh(n)&&n.data.trim().length>0)t.textNodes.push(new n_(A,n,t.styles));else if(mr(n))if(Zh(n)&&n.assignedNodes)n.assignedNodes().forEach(function(o){return ui(A,o,t,r)});else{var i=jh(A,n);i.styles.isVisible()&&(f_(n,i,r)?i.flags|=4:g_(i.styles)&&(i.flags|=2),d_.indexOf(n.tagName)!==-1&&(i.flags|=8),t.elements.push(i),n.slot,n.shadowRoot?ui(A,n.shadowRoot,i,r):!di(n)&&!qh(n)&&!fi(n)&&ui(A,n,i,r))}},jh=function(A,e){return La(e)?new Dh(A,e):Jh(e)?new Oh(A,e):qh(e)?new Ph(A,e):p_(e)?new Nh(A,e):w_(e)?new Ra(A,e):B_(e)?new xa(A,e):fi(e)?new Mh(A,e):di(e)?new Kh(A,e):zh(e)?new Gh(A,e):new Nt(A,e)},$h=function(A,e){var t=jh(A,e);return t.flags|=4,ui(A,e,t,t),t},f_=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ha(A)&&t.styles.isTransparent()},g_=function(A){return A.isPositioned()||A.isFloating()},Wh=function(A){return A.nodeType===Node.TEXT_NODE},mr=function(A){return A.nodeType===Node.ELEMENT_NODE},ka=function(A){return mr(A)&&typeof A.style<"u"&&!hi(A)},hi=function(A){return typeof A.className=="object"},p_=function(A){return A.tagName==="LI"},w_=function(A){return A.tagName==="OL"},B_=function(A){return A.tagName==="INPUT"},m_=function(A){return A.tagName==="HTML"},qh=function(A){return A.tagName==="svg"},Ha=function(A){return A.tagName==="BODY"},Jh=function(A){return A.tagName==="CANVAS"},Xh=function(A){return A.tagName==="VIDEO"},La=function(A){return A.tagName==="IMG"},zh=function(A){return A.tagName==="IFRAME"},Yh=function(A){return A.tagName==="STYLE"},y_=function(A){return A.tagName==="SCRIPT"},di=function(A){return A.tagName==="TEXTAREA"},fi=function(A){return A.tagName==="SELECT"},Zh=function(A){return A.tagName==="SLOT"},ed=function(A){return A.tagName.indexOf("-")>0},v_=function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(r){return t.counters[r].pop()})},A.prototype.parse=function(e){var t=this,r=e.counterIncrement,n=e.counterReset,s=!0;r!==null&&r.forEach(function(o){var l=t.counters[o.counter];l&&o.increment!==0&&(s=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var i=[];return s&&n.forEach(function(o){var l=t.counters[o.counter];i.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),i},A}(),td={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Ad={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},__={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},C_={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},yr=function(A,e,t,r,n,s){return A<e||A>t?_n(A,n,s.length>0):r.integers.reduce(function(i,o,l){for(;A>=o;)A-=o,i+=r.values[l];return i},"")+s},rd=function(A,e,t,r){var n="";do t||A--,n=r(A)+n,A/=e;while(A*e>=e);return n},Be=function(A,e,t,r,n){var s=t-e+1;return(A<0?"-":"")+(rd(Math.abs(A),s,r,function(i){return we(Math.floor(i%s)+e)})+n)},MA=function(A,e,t){t===void 0&&(t=". ");var r=e.length;return rd(Math.abs(A),r,!1,function(n){return e[Math.floor(n%r)]})+t},vr=1,mA=2,yA=4,vn=8,Zt=function(A,e,t,r,n,s){if(A<-9999||A>9999)return _n(A,4,n.length>0);var i=Math.abs(A),o=n;if(i===0)return e[0]+o;for(var l=0;i>0&&l<=4;l++){var c=i%10;c===0&&Ie(s,vr)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Ie(s,mA)||c===1&&l===1&&Ie(s,yA)&&A>100||c===1&&l>1&&Ie(s,vn)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),i=Math.floor(i/10)}return(A<0?r:"")+o},nd="十百千萬",sd="拾佰仟萬",id="マイナス",Da="마이너스",_n=function(A,e,t){var r=t?". ":"",n=t?"、":"",s=t?", ":"",i=t?" ":"";switch(e){case 0:return"•"+i;case 1:return"◦"+i;case 2:return"◾"+i;case 5:var o=Be(A,48,57,!0,r);return o.length<4?"0"+o:o;case 4:return MA(A,"〇一二三四五六七八九",n);case 6:return yr(A,1,3999,td,3,r).toLowerCase();case 7:return yr(A,1,3999,td,3,r);case 8:return Be(A,945,969,!1,r);case 9:return Be(A,97,122,!1,r);case 10:return Be(A,65,90,!1,r);case 11:return Be(A,1632,1641,!0,r);case 12:case 49:return yr(A,1,9999,Ad,3,r);case 35:return yr(A,1,9999,Ad,3,r).toLowerCase();case 13:return Be(A,2534,2543,!0,r);case 14:case 30:return Be(A,6112,6121,!0,r);case 15:return MA(A,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return MA(A,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return Zt(A,"零一二三四五六七八九",nd,"負",n,mA|yA|vn);case 47:return Zt(A,"零壹貳參肆伍陸柒捌玖",sd,"負",n,vr|mA|yA|vn);case 42:return Zt(A,"零一二三四五六七八九",nd,"负",n,mA|yA|vn);case 41:return Zt(A,"零壹贰叁肆伍陆柒捌玖",sd,"负",n,vr|mA|yA|vn);case 26:return Zt(A,"〇一二三四五六七八九","十百千万",id,n,0);case 25:return Zt(A,"零壱弐参四伍六七八九","拾百千万",id,n,vr|mA|yA);case 31:return Zt(A,"영일이삼사오육칠팔구","십백천만",Da,s,vr|mA|yA);case 33:return Zt(A,"零一二三四五六七八九","十百千萬",Da,s,0);case 32:return Zt(A,"零壹貳參四五六七八九","拾百千",Da,s,vr|mA|yA);case 18:return Be(A,2406,2415,!0,r);case 20:return yr(A,1,19999,C_,3,r);case 21:return Be(A,2790,2799,!0,r);case 22:return Be(A,2662,2671,!0,r);case 22:return yr(A,1,10999,__,3,r);case 23:return MA(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return MA(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Be(A,3302,3311,!0,r);case 28:return MA(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return MA(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return Be(A,3792,3801,!0,r);case 37:return Be(A,6160,6169,!0,r);case 38:return Be(A,4160,4169,!0,r);case 39:return Be(A,2918,2927,!0,r);case 40:return Be(A,1776,1785,!0,r);case 43:return Be(A,3046,3055,!0,r);case 44:return Be(A,3174,3183,!0,r);case 45:return Be(A,3664,3673,!0,r);case 46:return Be(A,3872,3881,!0,r);case 3:default:return Be(A,48,57,!0,r)}},od="data-html2canvas-ignore",ad=function(){function A(e,t,r){if(this.context=e,this.options=r,this.scrolledElements=[],this.referenceElement=t,this.counters=new v_,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var r=this,n=E_(e,t);if(!n.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,i=e.defaultView.pageYOffset,o=n.contentWindow,l=o.document,c=Q_(n).then(function(){return Ye(r,void 0,void 0,function(){var u,d;return Ne(this,function(g){switch(g.label){case 0:return this.scrolledElements.forEach(S_),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:g.sent(),g.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,U_(l)]:[3,4];case 3:g.sent(),g.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,d)}).then(function(){return n})]:[2,n]}})})});return l.open(),l.write(F_(document.doctype)+"<html></html>"),T_(this.referenceElement.ownerDocument,s,i),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},A.prototype.createElementClone=function(e){if(ya(e,2))debugger;if(Jh(e))return this.createCanvasClone(e);if(Xh(e))return this.createVideoClone(e);if(Yh(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return La(t)&&(La(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),ed(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Oa(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var r=[].slice.call(t.cssRules,0).reduce(function(s,i){return i&&typeof i.cssText=="string"?s+i.cssText:s},""),n=e.cloneNode(!1);return n.textContent=r,n}}catch(s){if(this.context.logger.error("Unable to access cssRules property",s),s.name!=="SecurityError")throw s}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var r=e.ownerDocument.createElement("img");try{return r.src=e.toDataURL(),r}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var n=e.cloneNode(!1);try{n.width=e.width,n.height=e.height;var s=e.getContext("2d"),i=n.getContext("2d");if(i)if(!this.options.allowTaint&&s)i.putImageData(s.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var l=o.getContextAttributes();(l==null?void 0:l.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}i.drawImage(e,0,0)}return n}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return n},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var r=t.getContext("2d");try{return r&&(r.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||r.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var n=e.ownerDocument.createElement("canvas");return n.width=e.offsetWidth,n.height=e.offsetHeight,n},A.prototype.appendChildNode=function(e,t,r){(!mr(t)||!y_(t)&&!t.hasAttribute(od)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!mr(t)||!Yh(t))&&e.appendChild(this.cloneNode(t,r))},A.prototype.cloneChildNodes=function(e,t,r){for(var n=this,s=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;s;s=s.nextSibling)if(mr(s)&&Zh(s)&&typeof s.assignedNodes=="function"){var i=s.assignedNodes();i.length&&i.forEach(function(o){return n.appendChildNode(t,o,r)})}else this.appendChildNode(t,s,r)},A.prototype.cloneNode=function(e,t){if(Wh(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var r=e.ownerDocument.defaultView;if(r&&mr(e)&&(ka(e)||hi(e))){var n=this.createElementClone(e);n.style.transitionProperty="none";var s=r.getComputedStyle(e),i=r.getComputedStyle(e,":before"),o=r.getComputedStyle(e,":after");this.referenceElement===e&&ka(n)&&(this.clonedReferenceElement=n),Ha(n)&&k_(n);var l=this.counters.parse(new _h(this.context,s)),c=this.resolvePseudoContent(e,n,i,Cn.BEFORE);ed(e)&&(t=!0),Xh(e)||this.cloneChildNodes(e,n,t),c&&n.insertBefore(c,n.firstChild);var u=this.resolvePseudoContent(e,n,o,Cn.AFTER);return u&&n.appendChild(u),this.counters.pop(l),(s&&(this.options.copyStyles||hi(e))&&!zh(e)||t)&&Oa(s,n),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([n,e.scrollLeft,e.scrollTop]),(di(e)||fi(e))&&(di(n)||fi(n))&&(n.value=e.value),n}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,r,n){var s=this;if(r){var i=r.content,o=t.ownerDocument;if(!(!o||!i||i==="none"||i==="-moz-alt-content"||r.display==="none")){this.counters.parse(new _h(this.context,r));var l=new p0(this.context,r),c=o.createElement("html2canvaspseudoelement");Oa(r,c),l.content.forEach(function(d){if(d.type===0)c.appendChild(o.createTextNode(d.value));else if(d.type===22){var g=o.createElement("img");g.src=d.value,g.style.opacity="1",c.appendChild(g)}else if(d.type===18){if(d.name==="attr"){var p=d.values.filter(ne);p.length&&c.appendChild(o.createTextNode(e.getAttribute(p[0].value)||""))}else if(d.name==="counter"){var B=d.values.filter(wr),C=B[0],E=B[1];if(C&&ne(C)){var I=s.counters.getCounterValue(C.value),Q=E&&ne(E)?ma.parse(s.context,E.value):3;c.appendChild(o.createTextNode(_n(I,Q,!1)))}}else if(d.name==="counters"){var S=d.values.filter(wr),C=S[0],k=S[1],E=S[2];if(C&&ne(C)){var H=s.counters.getCounterValues(C.value),R=E&&ne(E)?ma.parse(s.context,E.value):3,_=k&&k.type===0?k.value:"",m=H.map(function(U){return _n(U,R,!1)}).join(_);c.appendChild(o.createTextNode(m))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(o.createTextNode(vh(l.quotes,s.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(vh(l.quotes,--s.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(d.value))}}),c.className=Pa+" "+Na;var u=n===Cn.BEFORE?" "+Pa:" "+Na;return hi(t)?t.className.baseValue+=u:t.className+=u,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A}(),Cn;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Cn||(Cn={}));var E_=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(od,"true"),A.body.appendChild(t),t},b_=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},U_=function(A){return Promise.all([].slice.call(A.images,0).map(b_))},Q_=function(A){return new Promise(function(e,t){var r=A.contentWindow;if(!r)return t("No window assigned for iframe");var n=r.document;r.onload=A.onload=function(){r.onload=A.onload=null;var s=setInterval(function(){n.body.childNodes.length>0&&n.readyState==="complete"&&(clearInterval(s),e(A))},50)}})},I_=["all","d","content"],Oa=function(A,e){for(var t=A.length-1;t>=0;t--){var r=A.item(t);I_.indexOf(r)===-1&&e.style.setProperty(r,A.getPropertyValue(r))}return e},F_=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},T_=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},S_=function(A){var e=A[0],t=A[1],r=A[2];e.scrollLeft=t,e.scrollTop=r},R_=":before",x_=":after",Pa="___html2canvas___pseudoelement_before",Na="___html2canvas___pseudoelement_after",ld=`{
|
|
790
|
+
content: "" !important;
|
|
791
|
+
display: none !important;
|
|
792
|
+
}`,k_=function(A){H_(A,"."+Pa+R_+ld+`
|
|
793
|
+
.`+Na+x_+ld)},H_=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}},cd=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),L_=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Ma(e)||N_(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return Ye(this,void 0,void 0,function(){var t,r,n,s,i=this;return Ne(this,function(o){switch(o.label){case 0:return t=cd.isSameOrigin(e),r=!Va(e)&&this._options.useCORS===!0&&ke.SUPPORT_CORS_IMAGES&&!t,n=!Va(e)&&!t&&!Ma(e)&&typeof this._options.proxy=="string"&&ke.SUPPORT_CORS_XHR&&!r,!t&&this._options.allowTaint===!1&&!Va(e)&&!Ma(e)&&!n&&!r?[2]:(s=e,n?[4,this.proxy(s)]:[3,2]);case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,c){var u=new Image;u.onload=function(){return l(u)},u.onerror=c,(V_(s)||r)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return l(u)},500),i._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,r=this._options.proxy;if(!r)throw new Error("No proxy defined");var n=e.substring(0,256);return new Promise(function(s,i){var o=ke.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")s(l.response);else{var d=new FileReader;d.addEventListener("load",function(){return s(d.result)},!1),d.addEventListener("error",function(g){return i(g)},!1),d.readAsDataURL(l.response)}else i("Failed to proxy resource "+n+" with status code "+l.status)},l.onerror=i;var c=r.indexOf("?")>-1?"&":"?";if(l.open("GET",""+r+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return i("Timed out ("+u+"ms) proxying "+n)}}l.send()})},A}(),D_=/^data:image\/svg\+xml/i,O_=/^data:image\/.*;base64,/i,P_=/^data:image\/.*/i,N_=function(A){return ke.SUPPORT_SVG_DRAWING||!M_(A)},Va=function(A){return P_.test(A)},V_=function(A){return O_.test(A)},Ma=function(A){return A.substr(0,4)==="blob"},M_=function(A){return A.substr(-3).toLowerCase()==="svg"||D_.test(A)},N=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),_r=function(A,e,t){return new N(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},gi=function(){function A(e,t,r,n){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=n}return A.prototype.subdivide=function(e,t){var r=_r(this.start,this.startControl,e),n=_r(this.startControl,this.endControl,e),s=_r(this.endControl,this.end,e),i=_r(r,n,e),o=_r(n,s,e),l=_r(i,o,e);return t?new A(this.start,r,i,l):new A(l,o,s,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),yt=function(A){return A.type===1},K_=function(){function A(e){var t=e.styles,r=e.bounds,n=pn(t.borderTopLeftRadius,r.width,r.height),s=n[0],i=n[1],o=pn(t.borderTopRightRadius,r.width,r.height),l=o[0],c=o[1],u=pn(t.borderBottomRightRadius,r.width,r.height),d=u[0],g=u[1],p=pn(t.borderBottomLeftRadius,r.width,r.height),B=p[0],C=p[1],E=[];E.push((s+l)/r.width),E.push((B+d)/r.width),E.push((i+C)/r.height),E.push((c+g)/r.height);var I=Math.max.apply(Math,E);I>1&&(s/=I,i/=I,l/=I,c/=I,d/=I,g/=I,B/=I,C/=I);var Q=r.width-l,S=r.height-g,k=r.width-d,H=r.height-C,R=t.borderTopWidth,_=t.borderRightWidth,m=t.borderBottomWidth,y=t.borderLeftWidth,b=oe(t.paddingTop,e.bounds.width),U=oe(t.paddingRight,e.bounds.width),F=oe(t.paddingBottom,e.bounds.width),v=oe(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?he(r.left+y/3,r.top+R/3,s-y/3,i-R/3,Ae.TOP_LEFT):new N(r.left+y/3,r.top+R/3),this.topRightBorderDoubleOuterBox=s>0||i>0?he(r.left+Q,r.top+R/3,l-_/3,c-R/3,Ae.TOP_RIGHT):new N(r.left+r.width-_/3,r.top+R/3),this.bottomRightBorderDoubleOuterBox=d>0||g>0?he(r.left+k,r.top+S,d-_/3,g-m/3,Ae.BOTTOM_RIGHT):new N(r.left+r.width-_/3,r.top+r.height-m/3),this.bottomLeftBorderDoubleOuterBox=B>0||C>0?he(r.left+y/3,r.top+H,B-y/3,C-m/3,Ae.BOTTOM_LEFT):new N(r.left+y/3,r.top+r.height-m/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?he(r.left+y*2/3,r.top+R*2/3,s-y*2/3,i-R*2/3,Ae.TOP_LEFT):new N(r.left+y*2/3,r.top+R*2/3),this.topRightBorderDoubleInnerBox=s>0||i>0?he(r.left+Q,r.top+R*2/3,l-_*2/3,c-R*2/3,Ae.TOP_RIGHT):new N(r.left+r.width-_*2/3,r.top+R*2/3),this.bottomRightBorderDoubleInnerBox=d>0||g>0?he(r.left+k,r.top+S,d-_*2/3,g-m*2/3,Ae.BOTTOM_RIGHT):new N(r.left+r.width-_*2/3,r.top+r.height-m*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||C>0?he(r.left+y*2/3,r.top+H,B-y*2/3,C-m*2/3,Ae.BOTTOM_LEFT):new N(r.left+y*2/3,r.top+r.height-m*2/3),this.topLeftBorderStroke=s>0||i>0?he(r.left+y/2,r.top+R/2,s-y/2,i-R/2,Ae.TOP_LEFT):new N(r.left+y/2,r.top+R/2),this.topRightBorderStroke=s>0||i>0?he(r.left+Q,r.top+R/2,l-_/2,c-R/2,Ae.TOP_RIGHT):new N(r.left+r.width-_/2,r.top+R/2),this.bottomRightBorderStroke=d>0||g>0?he(r.left+k,r.top+S,d-_/2,g-m/2,Ae.BOTTOM_RIGHT):new N(r.left+r.width-_/2,r.top+r.height-m/2),this.bottomLeftBorderStroke=B>0||C>0?he(r.left+y/2,r.top+H,B-y/2,C-m/2,Ae.BOTTOM_LEFT):new N(r.left+y/2,r.top+r.height-m/2),this.topLeftBorderBox=s>0||i>0?he(r.left,r.top,s,i,Ae.TOP_LEFT):new N(r.left,r.top),this.topRightBorderBox=l>0||c>0?he(r.left+Q,r.top,l,c,Ae.TOP_RIGHT):new N(r.left+r.width,r.top),this.bottomRightBorderBox=d>0||g>0?he(r.left+k,r.top+S,d,g,Ae.BOTTOM_RIGHT):new N(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=B>0||C>0?he(r.left,r.top+H,B,C,Ae.BOTTOM_LEFT):new N(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||i>0?he(r.left+y,r.top+R,Math.max(0,s-y),Math.max(0,i-R),Ae.TOP_LEFT):new N(r.left+y,r.top+R),this.topRightPaddingBox=l>0||c>0?he(r.left+Math.min(Q,r.width-_),r.top+R,Q>r.width+_?0:Math.max(0,l-_),Math.max(0,c-R),Ae.TOP_RIGHT):new N(r.left+r.width-_,r.top+R),this.bottomRightPaddingBox=d>0||g>0?he(r.left+Math.min(k,r.width-y),r.top+Math.min(S,r.height-m),Math.max(0,d-_),Math.max(0,g-m),Ae.BOTTOM_RIGHT):new N(r.left+r.width-_,r.top+r.height-m),this.bottomLeftPaddingBox=B>0||C>0?he(r.left+y,r.top+Math.min(H,r.height-m),Math.max(0,B-y),Math.max(0,C-m),Ae.BOTTOM_LEFT):new N(r.left+y,r.top+r.height-m),this.topLeftContentBox=s>0||i>0?he(r.left+y+v,r.top+R+b,Math.max(0,s-(y+v)),Math.max(0,i-(R+b)),Ae.TOP_LEFT):new N(r.left+y+v,r.top+R+b),this.topRightContentBox=l>0||c>0?he(r.left+Math.min(Q,r.width+y+v),r.top+R+b,Q>r.width+y+v?0:l-y+v,c-(R+b),Ae.TOP_RIGHT):new N(r.left+r.width-(_+U),r.top+R+b),this.bottomRightContentBox=d>0||g>0?he(r.left+Math.min(k,r.width-(y+v)),r.top+Math.min(S,r.height+R+b),Math.max(0,d-(_+U)),g-(m+F),Ae.BOTTOM_RIGHT):new N(r.left+r.width-(_+U),r.top+r.height-(m+F)),this.bottomLeftContentBox=B>0||C>0?he(r.left+y+v,r.top+H,Math.max(0,B-(y+v)),C-(m+F),Ae.BOTTOM_LEFT):new N(r.left+y+v,r.top+r.height-(m+F))}return A}(),Ae;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Ae||(Ae={}));var he=function(A,e,t,r,n){var s=4*((Math.sqrt(2)-1)/3),i=t*s,o=r*s,l=A+t,c=e+r;switch(n){case Ae.TOP_LEFT:return new gi(new N(A,c),new N(A,c-o),new N(l-i,e),new N(l,e));case Ae.TOP_RIGHT:return new gi(new N(A,e),new N(A+i,e),new N(l,c-o),new N(l,c));case Ae.BOTTOM_RIGHT:return new gi(new N(l,e),new N(l,e+o),new N(A+i,c),new N(A,c));case Ae.BOTTOM_LEFT:default:return new gi(new N(l,c),new N(l-i,c),new N(A,e+o),new N(A,e))}},pi=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},G_=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},wi=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},j_=function(){function A(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return A}(),Bi=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),$_=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),W_=function(A){return A.type===0},ud=function(A){return A.type===1},q_=function(A){return A.type===2},hd=function(A,e){return A.length===e.length?A.some(function(t,r){return t===e[r]}):!1},J_=function(A,e,t,r,n){return A.map(function(s,i){switch(i){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+n);case 3:return s.add(e,t+n)}return s})},dd=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),fd=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new K_(this.container),this.container.styles.opacity<1&&this.effects.push(new $_(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new j_(r,n,s))}if(this.container.styles.overflowX!==0){var i=pi(this.curves),o=wi(this.curves);hd(i,o)?this.effects.push(new Bi(i,6)):(this.effects.push(new Bi(i,2)),this.effects.push(new Bi(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,n=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!ud(l)});if(t||r.container.styles.position!==0||!r.parent){if(n.unshift.apply(n,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var i=pi(r.curves),o=wi(r.curves);hd(i,o)||n.unshift(new Bi(o,6))}}else n.unshift.apply(n,s);r=r.parent}return n.filter(function(l){return Ie(l.target,e)})},A}(),Ka=function(A,e,t,r){A.container.elements.forEach(function(n){var s=Ie(n.flags,4),i=Ie(n.flags,2),o=new fd(n,A);Ie(n.styles.display,2048)&&r.push(o);var l=Ie(n.flags,8)?[]:r;if(s||i){var c=s||n.styles.isPositioned()?t:e,u=new dd(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var d=n.styles.zIndex.order;if(d<0){var g=0;c.negativeZIndex.some(function(B,C){return d>B.element.container.styles.zIndex.order?(g=C,!1):g>0}),c.negativeZIndex.splice(g,0,u)}else if(d>0){var p=0;c.positiveZIndex.some(function(B,C){return d>=B.element.container.styles.zIndex.order?(p=C+1,!1):p>0}),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else n.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Ka(o,u,s?u:t,l)}else n.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Ka(o,e,t,l);Ie(n.flags,8)&&gd(n,l)})},gd=function(A,e){for(var t=A instanceof Ra?A.start:1,r=A instanceof Ra?A.reversed:!1,n=0;n<e.length;n++){var s=e[n];s.container instanceof Nh&&typeof s.container.value=="number"&&s.container.value!==0&&(t=s.container.value),s.listValue=_n(t,s.container.styles.listStyleType,!0),t+=r?-1:1}},X_=function(A){var e=new fd(A,null),t=new dd(e),r=[];return Ka(e,t,t,r),gd(e.container,r),t},pd=function(A,e){switch(e){case 0:return vt(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return vt(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return vt(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return vt(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},z_=function(A,e){switch(e){case 0:return vt(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return vt(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return vt(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return vt(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},Y_=function(A,e){switch(e){case 0:return vt(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return vt(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return vt(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return vt(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},Z_=function(A,e){switch(e){case 0:return mi(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return mi(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return mi(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return mi(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},mi=function(A,e){var t=[];return yt(A)?t.push(A.subdivide(.5,!1)):t.push(A),yt(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},vt=function(A,e,t,r){var n=[];return yt(A)?n.push(A.subdivide(.5,!1)):n.push(A),yt(t)?n.push(t.subdivide(.5,!0)):n.push(t),yt(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),yt(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},wd=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},yi=function(A){var e=A.styles,t=A.bounds,r=oe(e.paddingLeft,t.width),n=oe(e.paddingRight,t.width),s=oe(e.paddingTop,t.width),i=oe(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,s+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+s+i))},eC=function(A,e){return A===0?e.bounds:A===2?yi(e):wd(e)},tC=function(A,e){return A===0?e.bounds:A===2?yi(e):wd(e)},Ga=function(A,e,t){var r=eC(Er(A.styles.backgroundOrigin,e),A),n=tC(Er(A.styles.backgroundClip,e),A),s=AC(Er(A.styles.backgroundSize,e),t,r),i=s[0],o=s[1],l=pn(Er(A.styles.backgroundPosition,e),r.width-i,r.height-o),c=rC(Er(A.styles.backgroundRepeat,e),l,s,r,n),u=Math.round(r.left+l[0]),d=Math.round(r.top+l[1]);return[c,u,d,i,o]},Cr=function(A){return ne(A)&&A.value===Br.AUTO},vi=function(A){return typeof A=="number"},AC=function(A,e,t){var r=e[0],n=e[1],s=e[2],i=A[0],o=A[1];if(!i)return[0,0];if(_e(i)&&o&&_e(o))return[oe(i,t.width),oe(o,t.height)];var l=vi(s);if(ne(i)&&(i.value===Br.CONTAIN||i.value===Br.COVER)){if(vi(s)){var c=t.width/t.height;return c<s!=(i.value===Br.COVER)?[t.width,t.width/s]:[t.height*s,t.height]}return[t.width,t.height]}var u=vi(r),d=vi(n),g=u||d;if(Cr(i)&&(!o||Cr(o))){if(u&&d)return[r,n];if(!l&&!g)return[t.width,t.height];if(g&&l){var p=u?r:n*s,B=d?n:r/s;return[p,B]}var C=u?r:t.width,E=d?n:t.height;return[C,E]}if(l){var I=0,Q=0;return _e(i)?I=oe(i,t.width):_e(o)&&(Q=oe(o,t.height)),Cr(i)?I=Q*s:(!o||Cr(o))&&(Q=I/s),[I,Q]}var S=null,k=null;if(_e(i)?S=oe(i,t.width):o&&_e(o)&&(k=oe(o,t.height)),S!==null&&(!o||Cr(o))&&(k=u&&d?S/r*n:t.height),k!==null&&Cr(i)&&(S=u&&d?k/n*r:t.width),S!==null&&k!==null)return[S,k];throw new Error("Unable to calculate background-size for element")},Er=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},rC=function(A,e,t,r,n){var s=e[0],i=e[1],o=t[0],l=t[1];switch(A){case 2:return[new N(Math.round(r.left),Math.round(r.top+i)),new N(Math.round(r.left+r.width),Math.round(r.top+i)),new N(Math.round(r.left+r.width),Math.round(l+r.top+i)),new N(Math.round(r.left),Math.round(l+r.top+i))];case 3:return[new N(Math.round(r.left+s),Math.round(r.top)),new N(Math.round(r.left+s+o),Math.round(r.top)),new N(Math.round(r.left+s+o),Math.round(r.height+r.top)),new N(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new N(Math.round(r.left+s),Math.round(r.top+i)),new N(Math.round(r.left+s+o),Math.round(r.top+i)),new N(Math.round(r.left+s+o),Math.round(r.top+i+l)),new N(Math.round(r.left+s),Math.round(r.top+i+l))];default:return[new N(Math.round(n.left),Math.round(n.top)),new N(Math.round(n.left+n.width),Math.round(n.top)),new N(Math.round(n.left+n.width),Math.round(n.height+n.top)),new N(Math.round(n.left),Math.round(n.height+n.top))]}},nC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Bd="Hidden Text",sC=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),i=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",i.appendChild(r),n.src=nC,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(Bd)),r.appendChild(s),r.appendChild(n);var o=n.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(Bd)),r.style.lineHeight="normal",n.style.verticalAlign="super";var l=n.offsetTop-r.offsetTop+2;return i.removeChild(r),{baseline:o,middle:l}},A.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},A}(),md=function(){function A(e,t){this.context=e,this.options=t}return A}(),iC=1e4,oC=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n._activeEffects=[],n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),r.canvas||(n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px"),n.fontMetrics=new sC(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),n}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(n){return r.applyEffect(n)})},e.prototype.applyEffect=function(t){this.ctx.save(),q_(t)&&(this.ctx.globalAlpha=t.opacity),W_(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),ud(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Ye(this,void 0,void 0,function(){var r;return Ne(this,function(n){switch(n.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Ye(this,void 0,void 0,function(){return Ne(this,function(r){switch(r.label){case 0:if(Ie(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,n){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n);else{var i=Sa(t.text);i.reduce(function(o,l){return s.ctx.fillText(l,o,t.bounds.top+n),o+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=hC(t.fontFamily).join(", "),s=gn(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,n].join(" "),n,s]},e.prototype.renderTextNode=function(t,r){return Ye(this,void 0,void 0,function(){var n,s,i,o,l,c,u,d,g=this;return Ne(this,function(p){return n=this.createFontStyle(r),s=n[0],i=n[1],o=n[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(i,o),c=l.baseline,u=l.middle,d=r.paintOrder,t.textBounds.forEach(function(B){d.forEach(function(C){switch(C){case 0:g.ctx.fillStyle=Se(r.color),g.renderTextWithLetterSpacing(B,r.letterSpacing,c);var E=r.textShadow;E.length&&B.text.trim().length&&(E.slice(0).reverse().forEach(function(I){g.ctx.shadowColor=Se(I.color),g.ctx.shadowOffsetX=I.offsetX.number*g.options.scale,g.ctx.shadowOffsetY=I.offsetY.number*g.options.scale,g.ctx.shadowBlur=I.blur.number,g.renderTextWithLetterSpacing(B,r.letterSpacing,c)}),g.ctx.shadowColor="",g.ctx.shadowOffsetX=0,g.ctx.shadowOffsetY=0,g.ctx.shadowBlur=0),r.textDecorationLine.length&&(g.ctx.fillStyle=Se(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(I){switch(I){case 1:g.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top+c),B.bounds.width,1);break;case 2:g.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top),B.bounds.width,1);break;case 3:g.ctx.fillRect(B.bounds.left,Math.ceil(B.bounds.top+u),B.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&B.text.trim().length&&(g.ctx.strokeStyle=Se(r.webkitTextStrokeColor),g.ctx.lineWidth=r.webkitTextStrokeWidth,g.ctx.lineJoin=window.chrome?"miter":"round",g.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+c)),g.ctx.strokeStyle="",g.ctx.lineWidth=0,g.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=yi(t),i=wi(r);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Ye(this,void 0,void 0,function(){var r,n,s,i,o,l,Q,Q,c,u,d,g,k,p,B,H,C,E,I,Q,S,k,H;return Ne(this,function(R){switch(R.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,n=t.curves,s=r.styles,i=0,o=r.textNodes,R.label=1;case 1:return i<o.length?(l=o[i],[4,this.renderTextNode(l,s)]):[3,4];case 2:R.sent(),R.label=3;case 3:return i++,[3,1];case 4:if(!(r instanceof Dh))return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,this.context.cache.match(r.src)];case 6:return Q=R.sent(),this.renderReplacedElement(r,n,Q),[3,8];case 7:return R.sent(),this.context.logger.error("Error loading image "+r.src),[3,8];case 8:if(r instanceof Oh&&this.renderReplacedElement(r,n,r.canvas),!(r instanceof Ph))return[3,12];R.label=9;case 9:return R.trys.push([9,11,,12]),[4,this.context.cache.match(r.svg)];case 10:return Q=R.sent(),this.renderReplacedElement(r,n,Q),[3,12];case 11:return R.sent(),this.context.logger.error("Error loading svg "+r.svg.substring(0,255)),[3,12];case 12:return r instanceof Gh&&r.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:r.backgroundColor,x:0,y:0,width:r.width,height:r.height}),[4,c.render(r.tree)]):[3,14];case 13:u=R.sent(),r.width&&r.height&&this.ctx.drawImage(u,0,0,r.width,r.height,r.bounds.left,r.bounds.top,r.bounds.width,r.bounds.height),R.label=14;case 14:if(r instanceof xa&&(d=Math.min(r.bounds.width,r.bounds.height),r.type===li?r.checked&&(this.ctx.save(),this.path([new N(r.bounds.left+d*.39363,r.bounds.top+d*.79),new N(r.bounds.left+d*.16,r.bounds.top+d*.5549),new N(r.bounds.left+d*.27347,r.bounds.top+d*.44071),new N(r.bounds.left+d*.39694,r.bounds.top+d*.5649),new N(r.bounds.left+d*.72983,r.bounds.top+d*.23),new N(r.bounds.left+d*.84,r.bounds.top+d*.34085),new N(r.bounds.left+d*.39363,r.bounds.top+d*.79)]),this.ctx.fillStyle=Se(Vh),this.ctx.fill(),this.ctx.restore()):r.type===ci&&r.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(r.bounds.left+d/2,r.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=Se(Vh),this.ctx.fill(),this.ctx.restore())),aC(r)&&r.value.length){switch(g=this.createFontStyle(s),k=g[0],p=g[1],B=this.fontMetrics.getMetrics(k,p).baseline,this.ctx.font=k,this.ctx.fillStyle=Se(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=cC(r.styles.textAlign),H=yi(r),C=0,r.styles.textAlign){case 1:C+=H.width/2;break;case 2:C+=H.width;break}E=H.add(C,0,0,-H.height/2+1),this.ctx.save(),this.path([new N(H.left,H.top),new N(H.left+H.width,H.top),new N(H.left+H.width,H.top+H.height),new N(H.left,H.top+H.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new yn(r.value,E),s.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ie(r.styles.display,2048))return[3,20];if(r.styles.listStyleImage===null)return[3,19];if(I=r.styles.listStyleImage,I.type!==0)return[3,18];Q=void 0,S=I.url,R.label=15;case 15:return R.trys.push([15,17,,18]),[4,this.context.cache.match(S)];case 16:return Q=R.sent(),this.ctx.drawImage(Q,r.bounds.left-(Q.width+10),r.bounds.top),[3,18];case 17:return R.sent(),this.context.logger.error("Error loading list-style-image "+S),[3,18];case 18:return[3,20];case 19:t.listValue&&r.styles.listStyleType!==-1&&(k=this.createFontStyle(s)[0],this.ctx.font=k,this.ctx.fillStyle=Se(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",H=new Xt(r.bounds.left,r.bounds.top+oe(r.styles.paddingTop,r.bounds.width),r.bounds.width,Bh(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new yn(t.listValue,H),s.letterSpacing,Bh(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),R.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Ye(this,void 0,void 0,function(){var r,n,I,s,i,I,o,l,I,c,u,I,d,g,I,p,B,I,C,E,I;return Ne(this,function(Q){switch(Q.label){case 0:if(Ie(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),r=0,n=t.negativeZIndex,Q.label=2;case 2:return r<n.length?(I=n[r],[4,this.renderStack(I)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return r++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),s=0,i=t.nonInlineLevel,Q.label=7;case 7:return s<i.length?(I=i[s],[4,this.renderNode(I)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return s++,[3,7];case 10:o=0,l=t.nonPositionedFloats,Q.label=11;case 11:return o<l.length?(I=l[o],[4,this.renderStack(I)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<u.length?(I=u[c],[4,this.renderStack(I)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:d=0,g=t.inlineLevel,Q.label=19;case 19:return d<g.length?(I=g[d],[4,this.renderNode(I)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return d++,[3,19];case 22:p=0,B=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return p<B.length?(I=B[p],[4,this.renderStack(I)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return p++,[3,23];case 26:C=0,E=t.positiveZIndex,Q.label=27;case 27:return C<E.length?(I=E[C],[4,this.renderStack(I)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var r=this;t.forEach(function(n,s){var i=yt(n)?n.start:n;s===0?r.ctx.moveTo(i.x,i.y):r.ctx.lineTo(i.x,i.y),yt(n)&&r.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},e.prototype.renderRepeat=function(t,r,n,s){this.path(t),this.ctx.fillStyle=r,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},e.prototype.resizeImage=function(t,r,n){var s;if(t.width===r&&t.height===n)return t;var i=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,o=i.createElement("canvas");o.width=Math.max(1,r),o.height=Math.max(1,n);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,r,n),o},e.prototype.renderBackgroundImage=function(t){return Ye(this,void 0,void 0,function(){var r,n,s,i,o,l;return Ne(this,function(c){switch(c.label){case 0:r=t.styles.backgroundImage.length-1,n=function(u){var d,g,p,b,$e,Qe,v,se,m,B,b,$e,Qe,v,se,C,E,I,Q,S,k,H,R,_,m,y,b,U,F,v,se,at,$e,Qe,ft,lt,Ht,oA,We,le,aA,et;return Ne(this,function(xA){switch(xA.label){case 0:if(u.type!==0)return[3,5];d=void 0,g=u.url,xA.label=1;case 1:return xA.trys.push([1,3,,4]),[4,s.context.cache.match(g)];case 2:return d=xA.sent(),[3,4];case 3:return xA.sent(),s.context.logger.error("Error loading background-image "+g),[3,4];case 4:return d&&(p=Ga(t,r,[d.width,d.height,d.width/d.height]),b=p[0],$e=p[1],Qe=p[2],v=p[3],se=p[4],m=s.ctx.createPattern(s.resizeImage(d,v,se),"repeat"),s.renderRepeat(b,m,$e,Qe)),[3,6];case 5:Wy(u)?(B=Ga(t,r,[null,null,null]),b=B[0],$e=B[1],Qe=B[2],v=B[3],se=B[4],C=My(u.angle,v,se),E=C[0],I=C[1],Q=C[2],S=C[3],k=C[4],H=document.createElement("canvas"),H.width=v,H.height=se,R=H.getContext("2d"),_=R.createLinearGradient(I,S,Q,k),oh(u.stops,E).forEach(function(qt){return _.addColorStop(qt.stop,Se(qt.color))}),R.fillStyle=_,R.fillRect(0,0,v,se),v>0&&se>0&&(m=s.ctx.createPattern(H,"repeat"),s.renderRepeat(b,m,$e,Qe))):qy(u)&&(y=Ga(t,r,[null,null,null]),b=y[0],U=y[1],F=y[2],v=y[3],se=y[4],at=u.position.length===0?[pa]:u.position,$e=oe(at[0],v),Qe=oe(at[at.length-1],se),ft=Ky(u,$e,Qe,v,se),lt=ft[0],Ht=ft[1],lt>0&&Ht>0&&(oA=s.ctx.createRadialGradient(U+$e,F+Qe,0,U+$e,F+Qe,lt),oh(u.stops,lt*2).forEach(function(qt){return oA.addColorStop(qt.stop,Se(qt.color))}),s.path(b),s.ctx.fillStyle=oA,lt!==Ht?(We=t.bounds.left+.5*t.bounds.width,le=t.bounds.top+.5*t.bounds.height,aA=Ht/lt,et=1/aA,s.ctx.save(),s.ctx.translate(We,le),s.ctx.transform(1,0,0,aA,0,0),s.ctx.translate(-We,-le),s.ctx.fillRect(U,et*(F-le)+le,v,se*et),s.ctx.restore()):s.ctx.fill())),xA.label=6;case 6:return r--,[2]}})},s=this,i=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return i<o.length?(l=o[i],[5,n(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,r,n){return Ye(this,void 0,void 0,function(){return Ne(this,function(s){return this.path(pd(n,r)),this.ctx.fillStyle=Se(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,r,n,s){return Ye(this,void 0,void 0,function(){var i,o;return Ne(this,function(l){switch(l.label){case 0:return r<3?[4,this.renderSolidBorder(t,n,s)]:[3,2];case 1:return l.sent(),[2];case 2:return i=z_(s,n),this.path(i),this.ctx.fillStyle=Se(t),this.ctx.fill(),o=Y_(s,n),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Ye(this,void 0,void 0,function(){var r,n,s,i,o,l,c,u,d=this;return Ne(this,function(g){switch(g.label){case 0:return this.applyEffects(t.getEffects(2)),r=t.container.styles,n=!wA(r.backgroundColor)||r.backgroundImage.length,s=[{style:r.borderTopStyle,color:r.borderTopColor,width:r.borderTopWidth},{style:r.borderRightStyle,color:r.borderRightColor,width:r.borderRightWidth},{style:r.borderBottomStyle,color:r.borderBottomColor,width:r.borderBottomWidth},{style:r.borderLeftStyle,color:r.borderLeftColor,width:r.borderLeftWidth}],i=lC(Er(r.backgroundClip,0),t.curves),n||r.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),wA(r.backgroundColor)||(this.ctx.fillStyle=Se(r.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:g.sent(),this.ctx.restore(),r.boxShadow.slice(0).reverse().forEach(function(p){d.ctx.save();var B=pi(t.curves),C=p.inset?0:iC,E=J_(B,-C+(p.inset?1:-1)*p.spread.number,(p.inset?1:-1)*p.spread.number,p.spread.number*(p.inset?-2:2),p.spread.number*(p.inset?-2:2));p.inset?(d.path(B),d.ctx.clip(),d.mask(E)):(d.mask(B),d.ctx.clip(),d.path(E)),d.ctx.shadowOffsetX=p.offsetX.number+C,d.ctx.shadowOffsetY=p.offsetY.number,d.ctx.shadowColor=Se(p.color),d.ctx.shadowBlur=p.blur.number,d.ctx.fillStyle=p.inset?Se(p.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),g.label=2;case 2:o=0,l=0,c=s,g.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!wA(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return g.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return g.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return g.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:g.sent(),g.label=11;case 11:o++,g.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,n,s,i){return Ye(this,void 0,void 0,function(){var o,l,c,u,d,g,p,B,C,E,I,Q,S,k,H,R,H,R;return Ne(this,function(_){return this.ctx.save(),o=Z_(s,n),l=pd(s,n),i===2&&(this.path(l),this.ctx.clip()),yt(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),yt(l[1])?(d=l[1].end.x,g=l[1].end.y):(d=l[1].x,g=l[1].y),n===0||n===2?p=Math.abs(c-d):p=Math.abs(u-g),this.ctx.beginPath(),i===3?this.formatPath(o):this.formatPath(l.slice(0,2)),B=r<3?r*3:r*2,C=r<3?r*2:r,i===3&&(B=r,C=r),E=!0,p<=B*2?E=!1:p<=B*2+C?(I=p/(2*B+C),B*=I,C*=I):(Q=Math.floor((p+C)/(B+C)),S=(p-Q*B)/(Q-1),k=(p-(Q+1)*B)/Q,C=k<=0||Math.abs(C-S)<Math.abs(C-k)?S:k),E&&(i===3?this.ctx.setLineDash([0,B+C]):this.ctx.setLineDash([B,C])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=r):this.ctx.lineWidth=r*2+1.1,this.ctx.strokeStyle=Se(t),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(yt(l[0])&&(H=l[3],R=l[0],this.ctx.beginPath(),this.formatPath([new N(H.end.x,H.end.y),new N(R.start.x,R.start.y)]),this.ctx.stroke()),yt(l[1])&&(H=l[1],R=l[2],this.ctx.beginPath(),this.formatPath([new N(H.end.x,H.end.y),new N(R.start.x,R.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Ye(this,void 0,void 0,function(){var r;return Ne(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Se(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),r=X_(t),[4,this.renderStack(r)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(md),aC=function(A){return A instanceof Kh||A instanceof Mh?!0:A instanceof xa&&A.type!==ci&&A.type!==li},lC=function(A,e){switch(A){case 0:return pi(e);case 2:return G_(e);case 1:default:return wi(e)}},cC=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},uC=["-apple-system","system-ui"],hC=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return uC.indexOf(e)===-1}):A},dC=function(A){bt(e,A);function e(t,r){var n=A.call(this,t,r)||this;return n.canvas=r.canvas?r.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=r,n.canvas.width=Math.floor(r.width*r.scale),n.canvas.height=Math.floor(r.height*r.scale),n.canvas.style.width=r.width+"px",n.canvas.style.height=r.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-r.x,-r.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+r.width+"x"+r.height+" at "+r.x+","+r.y+") with scale "+r.scale),n}return e.prototype.render=function(t){return Ye(this,void 0,void 0,function(){var r,n;return Ne(this,function(s){switch(s.label){case 0:return r=Ta(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,fC(r)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Se(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(md),fC=function(A){return new Promise(function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},gC=function(){function A(e){var t=e.id,r=e.enabled;this.id=t,this.enabled=r,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Fs([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Fs([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Fs([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Fs([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A}(),pC=function(){function A(e,t){var r;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new gC({id:this.instanceName,enabled:e.logging}),this.cache=(r=e.cache)!==null&&r!==void 0?r:new L_(this,e)}return A.instanceCount=1,A}(),wC=function(A,e){return e===void 0&&(e={}),BC(A,e)};typeof window<"u"&&cd.setContext(window);var BC=function(A,e){return Ye(void 0,void 0,void 0,function(){var t,r,n,s,i,o,l,c,u,d,g,p,B,C,E,I,Q,S,k,H,_,R,_,m,y,b,U,F,v,se,at,$e,Qe,ft,lt,Ht,oA,We,le,aA;return Ne(this,function(et){switch(et.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(r=t.defaultView,!r)throw new Error("Document is not attached to a Window");return n={allowTaint:(m=e.allowTaint)!==null&&m!==void 0?m:!1,imageTimeout:(y=e.imageTimeout)!==null&&y!==void 0?y:15e3,proxy:e.proxy,useCORS:(b=e.useCORS)!==null&&b!==void 0?b:!1},s=Jo({logging:(U=e.logging)!==null&&U!==void 0?U:!0,cache:e.cache},n),i={windowWidth:(F=e.windowWidth)!==null&&F!==void 0?F:r.innerWidth,windowHeight:(v=e.windowHeight)!==null&&v!==void 0?v:r.innerHeight,scrollX:(se=e.scrollX)!==null&&se!==void 0?se:r.pageXOffset,scrollY:(at=e.scrollY)!==null&&at!==void 0?at:r.pageYOffset},o=new Xt(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),l=new pC(s,o),c=($e=e.foreignObjectRendering)!==null&&$e!==void 0?$e:!1,u={allowTaint:(Qe=e.allowTaint)!==null&&Qe!==void 0?Qe:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new ad(l,A,u),g=d.clonedReferenceElement,g?[4,d.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return p=et.sent(),B=Ha(g)||m_(g)?JB(g.ownerDocument):Ts(l,g),C=B.width,E=B.height,I=B.left,Q=B.top,S=mC(l,g,e.backgroundColor),k={canvas:e.canvas,backgroundColor:S,scale:(lt=(ft=e.scale)!==null&&ft!==void 0?ft:r.devicePixelRatio)!==null&<!==void 0?lt:1,x:((Ht=e.x)!==null&&Ht!==void 0?Ht:0)+I,y:((oA=e.y)!==null&&oA!==void 0?oA:0)+Q,width:(We=e.width)!==null&&We!==void 0?We:Math.ceil(C),height:(le=e.height)!==null&&le!==void 0?le:Math.ceil(E)},c?(l.logger.debug("Document cloned, using foreign object rendering"),_=new dC(l,k),[4,_.render(g)]):[3,3];case 2:return H=et.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+I+","+Q+" with size "+C+"x"+E+" using computed rendering"),l.logger.debug("Starting DOM parsing"),R=$h(l,g),S===R.styles.backgroundColor&&(R.styles.backgroundColor=Yt.TRANSPARENT),l.logger.debug("Starting renderer for element at "+k.x+","+k.y+" with size "+k.width+"x"+k.height),_=new oC(l,k),[4,_.render(R)];case 4:H=et.sent(),et.label=5;case 5:return(!((aA=e.removeContainer)!==null&&aA!==void 0)||aA)&&(ad.destroy(p)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,H]}})})},mC=function(A,e,t){var r=e.ownerDocument,n=r.documentElement?wn(A,getComputedStyle(r.documentElement).backgroundColor):Yt.TRANSPARENT,s=r.body?wn(A,getComputedStyle(r.body).backgroundColor):Yt.TRANSPARENT,i=typeof t=="string"?wn(A,t):t===null?Yt.TRANSPARENT:4294967295;return e===r.documentElement?wA(n)?wA(s)?i:s:n:i};const yC=Object.freeze(Object.defineProperty({__proto__:null,default:wC},Symbol.toStringTag,{value:"Module"}));/**
|
|
794
|
+
* @license
|
|
795
|
+
* Copyright 2017 Google LLC
|
|
796
|
+
*
|
|
797
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
798
|
+
* you may not use this file except in compliance with the License.
|
|
799
|
+
* You may obtain a copy of the License at
|
|
800
|
+
*
|
|
801
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
802
|
+
*
|
|
803
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
804
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
805
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
806
|
+
* See the License for the specific language governing permissions and
|
|
807
|
+
* limitations under the License.
|
|
808
|
+
*//**
|
|
809
|
+
* @license
|
|
810
|
+
* Copyright 2017 Google LLC
|
|
811
|
+
*
|
|
812
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
813
|
+
* you may not use this file except in compliance with the License.
|
|
814
|
+
* You may obtain a copy of the License at
|
|
815
|
+
*
|
|
816
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
817
|
+
*
|
|
818
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
819
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
820
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
821
|
+
* See the License for the specific language governing permissions and
|
|
822
|
+
* limitations under the License.
|
|
823
|
+
*/const yd=function(A){const e=[];let t=0;for(let r=0;r<A.length;r++){let n=A.charCodeAt(r);n<128?e[t++]=n:n<2048?(e[t++]=n>>6|192,e[t++]=n&63|128):(n&64512)===55296&&r+1<A.length&&(A.charCodeAt(r+1)&64512)===56320?(n=65536+((n&1023)<<10)+(A.charCodeAt(++r)&1023),e[t++]=n>>18|240,e[t++]=n>>12&63|128,e[t++]=n>>6&63|128,e[t++]=n&63|128):(e[t++]=n>>12|224,e[t++]=n>>6&63|128,e[t++]=n&63|128)}return e},vC=function(A){const e=[];let t=0,r=0;for(;t<A.length;){const n=A[t++];if(n<128)e[r++]=String.fromCharCode(n);else if(n>191&&n<224){const s=A[t++];e[r++]=String.fromCharCode((n&31)<<6|s&63)}else if(n>239&&n<365){const s=A[t++],i=A[t++],o=A[t++],l=((n&7)<<18|(s&63)<<12|(i&63)<<6|o&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const s=A[t++],i=A[t++];e[r++]=String.fromCharCode((n&15)<<12|(s&63)<<6|i&63)}}return e.join("")},vd={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(A,e){if(!Array.isArray(A))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let n=0;n<A.length;n+=3){const s=A[n],i=n+1<A.length,o=i?A[n+1]:0,l=n+2<A.length,c=l?A[n+2]:0,u=s>>2,d=(s&3)<<4|o>>4;let g=(o&15)<<2|c>>6,p=c&63;l||(p=64,i||(g=64)),r.push(t[u],t[d],t[g],t[p])}return r.join("")},encodeString(A,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(A):this.encodeByteArray(yd(A),e)},decodeString(A,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(A):vC(this.decodeStringToByteArray(A,e))},decodeStringToByteArray(A,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let n=0;n<A.length;){const s=t[A.charAt(n++)],o=n<A.length?t[A.charAt(n)]:0;++n;const c=n<A.length?t[A.charAt(n)]:64;++n;const d=n<A.length?t[A.charAt(n)]:64;if(++n,s==null||o==null||c==null||d==null)throw new _C;const g=s<<2|o>>4;if(r.push(g),c!==64){const p=o<<4&240|c>>2;if(r.push(p),d!==64){const B=c<<6&192|d;r.push(B)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let A=0;A<this.ENCODED_VALS.length;A++)this.byteToCharMap_[A]=this.ENCODED_VALS.charAt(A),this.charToByteMap_[this.byteToCharMap_[A]]=A,this.byteToCharMapWebSafe_[A]=this.ENCODED_VALS_WEBSAFE.charAt(A),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[A]]=A,A>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(A)]=A,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(A)]=A)}}};class _C extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const CC=function(A){const e=yd(A);return vd.encodeByteArray(e,!0)},_i=function(A){return CC(A).replace(/\./g,"")},EC=function(A){try{return vd.decodeString(A,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
|
824
|
+
* @license
|
|
825
|
+
* Copyright 2022 Google LLC
|
|
826
|
+
*
|
|
827
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
828
|
+
* you may not use this file except in compliance with the License.
|
|
829
|
+
* You may obtain a copy of the License at
|
|
830
|
+
*
|
|
831
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
832
|
+
*
|
|
833
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
834
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
835
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
836
|
+
* See the License for the specific language governing permissions and
|
|
837
|
+
* limitations under the License.
|
|
838
|
+
*/function bC(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
|
839
|
+
* @license
|
|
840
|
+
* Copyright 2022 Google LLC
|
|
841
|
+
*
|
|
842
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
843
|
+
* you may not use this file except in compliance with the License.
|
|
844
|
+
* You may obtain a copy of the License at
|
|
845
|
+
*
|
|
846
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
847
|
+
*
|
|
848
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
849
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
850
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
851
|
+
* See the License for the specific language governing permissions and
|
|
852
|
+
* limitations under the License.
|
|
853
|
+
*/const UC=()=>bC().__FIREBASE_DEFAULTS__,QC=()=>{if(typeof process>"u"||typeof process.env>"u")return;const A=process.env.__FIREBASE_DEFAULTS__;if(A)return JSON.parse(A)},IC=()=>{if(typeof document>"u")return;let A;try{A=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=A&&EC(A[1]);return e&&JSON.parse(e)},ja=()=>{try{return UC()||QC()||IC()}catch(A){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${A}`);return}},FC=A=>{var e,t;return(t=(e=ja())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[A]},_d=A=>{const e=FC(A);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},Cd=()=>{var A;return(A=ja())===null||A===void 0?void 0:A.config};/**
|
|
854
|
+
* @license
|
|
855
|
+
* Copyright 2017 Google LLC
|
|
856
|
+
*
|
|
857
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
858
|
+
* you may not use this file except in compliance with the License.
|
|
859
|
+
* You may obtain a copy of the License at
|
|
860
|
+
*
|
|
861
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
862
|
+
*
|
|
863
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
864
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
865
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
866
|
+
* See the License for the specific language governing permissions and
|
|
867
|
+
* limitations under the License.
|
|
868
|
+
*/let TC=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}};/**
|
|
869
|
+
* @license
|
|
870
|
+
* Copyright 2021 Google LLC
|
|
871
|
+
*
|
|
872
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
873
|
+
* you may not use this file except in compliance with the License.
|
|
874
|
+
* You may obtain a copy of the License at
|
|
875
|
+
*
|
|
876
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
877
|
+
*
|
|
878
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
879
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
880
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
881
|
+
* See the License for the specific language governing permissions and
|
|
882
|
+
* limitations under the License.
|
|
883
|
+
*/function Ed(A,e){if(A.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",n=A.iat||0,s=A.sub||A.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:n,exp:n+3600,auth_time:n,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},A);return[_i(JSON.stringify(t)),_i(JSON.stringify(i)),""].join(".")}/**
|
|
884
|
+
* @license
|
|
885
|
+
* Copyright 2017 Google LLC
|
|
886
|
+
*
|
|
887
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
888
|
+
* you may not use this file except in compliance with the License.
|
|
889
|
+
* You may obtain a copy of the License at
|
|
890
|
+
*
|
|
891
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
892
|
+
*
|
|
893
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
894
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
895
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
896
|
+
* See the License for the specific language governing permissions and
|
|
897
|
+
* limitations under the License.
|
|
898
|
+
*/function SC(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function RC(){var A;const e=(A=ja())===null||A===void 0?void 0:A.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function xC(){return!RC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function kC(){try{return typeof indexedDB=="object"}catch{return!1}}function HC(){return new Promise((A,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",n=self.indexedDB.open(r);n.onsuccess=()=>{n.result.close(),t||self.indexedDB.deleteDatabase(r),A(!0)},n.onupgradeneeded=()=>{t=!1},n.onerror=()=>{var s;e(((s=n.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}/**
|
|
899
|
+
* @license
|
|
900
|
+
* Copyright 2017 Google LLC
|
|
901
|
+
*
|
|
902
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
903
|
+
* you may not use this file except in compliance with the License.
|
|
904
|
+
* You may obtain a copy of the License at
|
|
905
|
+
*
|
|
906
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
907
|
+
*
|
|
908
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
909
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
910
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
911
|
+
* See the License for the specific language governing permissions and
|
|
912
|
+
* limitations under the License.
|
|
913
|
+
*/const LC="FirebaseError";class KA extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=LC,Object.setPrototypeOf(this,KA.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,bd.prototype.create)}}class bd{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,s=this.errors[e],i=s?DC(s,r):"Error",o=`${this.serviceName}: ${i} (${n}).`;return new KA(n,o,r)}}function DC(A,e){return A.replace(OC,(t,r)=>{const n=e[r];return n!=null?String(n):`<${r}?>`})}const OC=/\{\$([^}]+)}/g;function $a(A,e){if(A===e)return!0;const t=Object.keys(A),r=Object.keys(e);for(const n of t){if(!r.includes(n))return!1;const s=A[n],i=e[n];if(Ud(s)&&Ud(i)){if(!$a(s,i))return!1}else if(s!==i)return!1}for(const n of r)if(!t.includes(n))return!1;return!0}function Ud(A){return A!==null&&typeof A=="object"}/**
|
|
914
|
+
* @license
|
|
915
|
+
* Copyright 2021 Google LLC
|
|
916
|
+
*
|
|
917
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
918
|
+
* you may not use this file except in compliance with the License.
|
|
919
|
+
* You may obtain a copy of the License at
|
|
920
|
+
*
|
|
921
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
922
|
+
*
|
|
923
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
924
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
925
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
926
|
+
* See the License for the specific language governing permissions and
|
|
927
|
+
* limitations under the License.
|
|
928
|
+
*/function nt(A){return A&&A._delegate?A._delegate:A}class br{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
|
|
929
|
+
* @license
|
|
930
|
+
* Copyright 2019 Google LLC
|
|
931
|
+
*
|
|
932
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
933
|
+
* you may not use this file except in compliance with the License.
|
|
934
|
+
* You may obtain a copy of the License at
|
|
935
|
+
*
|
|
936
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
937
|
+
*
|
|
938
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
939
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
940
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
941
|
+
* See the License for the specific language governing permissions and
|
|
942
|
+
* limitations under the License.
|
|
943
|
+
*/const GA="[DEFAULT]";/**
|
|
944
|
+
* @license
|
|
945
|
+
* Copyright 2019 Google LLC
|
|
946
|
+
*
|
|
947
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
948
|
+
* you may not use this file except in compliance with the License.
|
|
949
|
+
* You may obtain a copy of the License at
|
|
950
|
+
*
|
|
951
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
952
|
+
*
|
|
953
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
954
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
955
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
956
|
+
* See the License for the specific language governing permissions and
|
|
957
|
+
* limitations under the License.
|
|
958
|
+
*/class PC{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new TC;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&r.resolve(n)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),n=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(n)return null;throw s}else{if(n)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(VC(e))try{this.getOrInitializeService({instanceIdentifier:GA})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:n});r.resolve(s)}catch{}}}}clearInstance(e=GA){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=GA){return this.instances.has(e)}getOptions(e=GA){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[s,i]of this.instancesDeferred.entries()){const o=this.normalizeInstanceIdentifier(s);r===o&&i.resolve(n)}return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),s=(r=this.onInitCallbacks.get(n))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(n,s);const i=this.instances.get(n);return i&&e(i,n),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:NC(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=GA){return this.component?this.component.multipleInstances?e:GA:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function NC(A){return A===GA?void 0:A}function VC(A){return A.instantiationMode==="EAGER"}/**
|
|
959
|
+
* @license
|
|
960
|
+
* Copyright 2019 Google LLC
|
|
961
|
+
*
|
|
962
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
963
|
+
* you may not use this file except in compliance with the License.
|
|
964
|
+
* You may obtain a copy of the License at
|
|
965
|
+
*
|
|
966
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
967
|
+
*
|
|
968
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
969
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
970
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
971
|
+
* See the License for the specific language governing permissions and
|
|
972
|
+
* limitations under the License.
|
|
973
|
+
*/class MC{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new PC(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
|
|
974
|
+
* @license
|
|
975
|
+
* Copyright 2017 Google LLC
|
|
976
|
+
*
|
|
977
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
978
|
+
* you may not use this file except in compliance with the License.
|
|
979
|
+
* You may obtain a copy of the License at
|
|
980
|
+
*
|
|
981
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
982
|
+
*
|
|
983
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
984
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
985
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
986
|
+
* See the License for the specific language governing permissions and
|
|
987
|
+
* limitations under the License.
|
|
988
|
+
*/var Z;(function(A){A[A.DEBUG=0]="DEBUG",A[A.VERBOSE=1]="VERBOSE",A[A.INFO=2]="INFO",A[A.WARN=3]="WARN",A[A.ERROR=4]="ERROR",A[A.SILENT=5]="SILENT"})(Z||(Z={}));const KC={debug:Z.DEBUG,verbose:Z.VERBOSE,info:Z.INFO,warn:Z.WARN,error:Z.ERROR,silent:Z.SILENT},GC=Z.INFO,jC={[Z.DEBUG]:"log",[Z.VERBOSE]:"log",[Z.INFO]:"info",[Z.WARN]:"warn",[Z.ERROR]:"error"},$C=(A,e,...t)=>{if(e<A.logLevel)return;const r=new Date().toISOString(),n=jC[e];if(n)console[n](`[${r}] ${A.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Qd{constructor(e){this.name=e,this._logLevel=GC,this._logHandler=$C,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Z))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?KC[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Z.DEBUG,...e),this._logHandler(this,Z.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Z.VERBOSE,...e),this._logHandler(this,Z.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Z.INFO,...e),this._logHandler(this,Z.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Z.WARN,...e),this._logHandler(this,Z.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Z.ERROR,...e),this._logHandler(this,Z.ERROR,...e)}}const WC=(A,e)=>e.some(t=>A instanceof t);let Id,Fd;function qC(){return Id||(Id=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function JC(){return Fd||(Fd=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Td=new WeakMap,Wa=new WeakMap,Sd=new WeakMap,qa=new WeakMap,Ja=new WeakMap;function XC(A){const e=new Promise((t,r)=>{const n=()=>{A.removeEventListener("success",s),A.removeEventListener("error",i)},s=()=>{t(vA(A.result)),n()},i=()=>{r(A.error),n()};A.addEventListener("success",s),A.addEventListener("error",i)});return e.then(t=>{t instanceof IDBCursor&&Td.set(t,A)}).catch(()=>{}),Ja.set(e,A),e}function zC(A){if(Wa.has(A))return;const e=new Promise((t,r)=>{const n=()=>{A.removeEventListener("complete",s),A.removeEventListener("error",i),A.removeEventListener("abort",i)},s=()=>{t(),n()},i=()=>{r(A.error||new DOMException("AbortError","AbortError")),n()};A.addEventListener("complete",s),A.addEventListener("error",i),A.addEventListener("abort",i)});Wa.set(A,e)}let Xa={get(A,e,t){if(A instanceof IDBTransaction){if(e==="done")return Wa.get(A);if(e==="objectStoreNames")return A.objectStoreNames||Sd.get(A);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return vA(A[e])},set(A,e,t){return A[e]=t,!0},has(A,e){return A instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in A}};function YC(A){Xa=A(Xa)}function ZC(A){return A===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=A.call(za(this),e,...t);return Sd.set(r,e.sort?e.sort():[e]),vA(r)}:JC().includes(A)?function(...e){return A.apply(za(this),e),vA(Td.get(this))}:function(...e){return vA(A.apply(za(this),e))}}function eE(A){return typeof A=="function"?ZC(A):(A instanceof IDBTransaction&&zC(A),WC(A,qC())?new Proxy(A,Xa):A)}function vA(A){if(A instanceof IDBRequest)return XC(A);if(qa.has(A))return qa.get(A);const e=eE(A);return e!==A&&(qa.set(A,e),Ja.set(e,A)),e}const za=A=>Ja.get(A);function tE(A,e,{blocked:t,upgrade:r,blocking:n,terminated:s}={}){const i=indexedDB.open(A,e),o=vA(i);return r&&i.addEventListener("upgradeneeded",l=>{r(vA(i.result),l.oldVersion,l.newVersion,vA(i.transaction),l)}),t&&i.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),o.then(l=>{s&&l.addEventListener("close",()=>s()),n&&l.addEventListener("versionchange",c=>n(c.oldVersion,c.newVersion,c))}).catch(()=>{}),o}const AE=["get","getKey","getAll","getAllKeys","count"],rE=["put","add","delete","clear"],Ya=new Map;function Rd(A,e){if(!(A instanceof IDBDatabase&&!(e in A)&&typeof e=="string"))return;if(Ya.get(e))return Ya.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,n=rE.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(n||AE.includes(t)))return;const s=async function(i,...o){const l=this.transaction(i,n?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(o.shift())),(await Promise.all([c[t](...o),n&&l.done]))[0]};return Ya.set(e,s),s}YC(A=>({...A,get:(e,t,r)=>Rd(e,t)||A.get(e,t,r),has:(e,t)=>!!Rd(e,t)||A.has(e,t)}));/**
|
|
989
|
+
* @license
|
|
990
|
+
* Copyright 2019 Google LLC
|
|
991
|
+
*
|
|
992
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
993
|
+
* you may not use this file except in compliance with the License.
|
|
994
|
+
* You may obtain a copy of the License at
|
|
995
|
+
*
|
|
996
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
997
|
+
*
|
|
998
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
999
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1000
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1001
|
+
* See the License for the specific language governing permissions and
|
|
1002
|
+
* limitations under the License.
|
|
1003
|
+
*/class nE{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(sE(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function sE(A){const e=A.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Za="@firebase/app",xd="0.10.13";/**
|
|
1004
|
+
* @license
|
|
1005
|
+
* Copyright 2019 Google LLC
|
|
1006
|
+
*
|
|
1007
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1008
|
+
* you may not use this file except in compliance with the License.
|
|
1009
|
+
* You may obtain a copy of the License at
|
|
1010
|
+
*
|
|
1011
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1012
|
+
*
|
|
1013
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1014
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1015
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1016
|
+
* See the License for the specific language governing permissions and
|
|
1017
|
+
* limitations under the License.
|
|
1018
|
+
*/const eA=new Qd("@firebase/app"),iE="@firebase/app-compat",oE="@firebase/analytics-compat",aE="@firebase/analytics",lE="@firebase/app-check-compat",cE="@firebase/app-check",uE="@firebase/auth",hE="@firebase/auth-compat",dE="@firebase/database",fE="@firebase/data-connect",gE="@firebase/database-compat",pE="@firebase/functions",wE="@firebase/functions-compat",BE="@firebase/installations",mE="@firebase/installations-compat",yE="@firebase/messaging",vE="@firebase/messaging-compat",_E="@firebase/performance",CE="@firebase/performance-compat",EE="@firebase/remote-config",bE="@firebase/remote-config-compat",UE="@firebase/storage",QE="@firebase/storage-compat",IE="@firebase/firestore",FE="@firebase/vertexai-preview",TE="@firebase/firestore-compat",SE="firebase",RE="10.14.1";/**
|
|
1019
|
+
* @license
|
|
1020
|
+
* Copyright 2019 Google LLC
|
|
1021
|
+
*
|
|
1022
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1023
|
+
* you may not use this file except in compliance with the License.
|
|
1024
|
+
* You may obtain a copy of the License at
|
|
1025
|
+
*
|
|
1026
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1027
|
+
*
|
|
1028
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1029
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1030
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1031
|
+
* See the License for the specific language governing permissions and
|
|
1032
|
+
* limitations under the License.
|
|
1033
|
+
*/const el="[DEFAULT]",xE={[Za]:"fire-core",[iE]:"fire-core-compat",[aE]:"fire-analytics",[oE]:"fire-analytics-compat",[cE]:"fire-app-check",[lE]:"fire-app-check-compat",[uE]:"fire-auth",[hE]:"fire-auth-compat",[dE]:"fire-rtdb",[fE]:"fire-data-connect",[gE]:"fire-rtdb-compat",[pE]:"fire-fn",[wE]:"fire-fn-compat",[BE]:"fire-iid",[mE]:"fire-iid-compat",[yE]:"fire-fcm",[vE]:"fire-fcm-compat",[_E]:"fire-perf",[CE]:"fire-perf-compat",[EE]:"fire-rc",[bE]:"fire-rc-compat",[UE]:"fire-gcs",[QE]:"fire-gcs-compat",[IE]:"fire-fst",[TE]:"fire-fst-compat",[FE]:"fire-vertex","fire-js":"fire-js",[SE]:"fire-js-all"};/**
|
|
1034
|
+
* @license
|
|
1035
|
+
* Copyright 2019 Google LLC
|
|
1036
|
+
*
|
|
1037
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1038
|
+
* you may not use this file except in compliance with the License.
|
|
1039
|
+
* You may obtain a copy of the License at
|
|
1040
|
+
*
|
|
1041
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1042
|
+
*
|
|
1043
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1044
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1045
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1046
|
+
* See the License for the specific language governing permissions and
|
|
1047
|
+
* limitations under the License.
|
|
1048
|
+
*/const En=new Map,kE=new Map,tl=new Map;function kd(A,e){try{A.container.addComponent(e)}catch(t){eA.debug(`Component ${e.name} failed to register with FirebaseApp ${A.name}`,t)}}function bn(A){const e=A.name;if(tl.has(e))return eA.debug(`There were multiple attempts to register component ${e}.`),!1;tl.set(e,A);for(const t of En.values())kd(t,A);for(const t of kE.values())kd(t,A);return!0}function Hd(A,e){const t=A.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),A.container.getProvider(e)}/**
|
|
1049
|
+
* @license
|
|
1050
|
+
* Copyright 2019 Google LLC
|
|
1051
|
+
*
|
|
1052
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1053
|
+
* you may not use this file except in compliance with the License.
|
|
1054
|
+
* You may obtain a copy of the License at
|
|
1055
|
+
*
|
|
1056
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1057
|
+
*
|
|
1058
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1059
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1060
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1061
|
+
* See the License for the specific language governing permissions and
|
|
1062
|
+
* limitations under the License.
|
|
1063
|
+
*/const HE={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},_A=new bd("app","Firebase",HE);/**
|
|
1064
|
+
* @license
|
|
1065
|
+
* Copyright 2019 Google LLC
|
|
1066
|
+
*
|
|
1067
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1068
|
+
* you may not use this file except in compliance with the License.
|
|
1069
|
+
* You may obtain a copy of the License at
|
|
1070
|
+
*
|
|
1071
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1072
|
+
*
|
|
1073
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1074
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1075
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1076
|
+
* See the License for the specific language governing permissions and
|
|
1077
|
+
* limitations under the License.
|
|
1078
|
+
*/class LE{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new br("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw _A.create("app-deleted",{appName:this._name})}}/**
|
|
1079
|
+
* @license
|
|
1080
|
+
* Copyright 2019 Google LLC
|
|
1081
|
+
*
|
|
1082
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1083
|
+
* you may not use this file except in compliance with the License.
|
|
1084
|
+
* You may obtain a copy of the License at
|
|
1085
|
+
*
|
|
1086
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1087
|
+
*
|
|
1088
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1089
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1090
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1091
|
+
* See the License for the specific language governing permissions and
|
|
1092
|
+
* limitations under the License.
|
|
1093
|
+
*/const Ld=RE;function Dd(A,e={}){let t=A;typeof e!="object"&&(e={name:e});const r=Object.assign({name:el,automaticDataCollectionEnabled:!1},e),n=r.name;if(typeof n!="string"||!n)throw _A.create("bad-app-name",{appName:String(n)});if(t||(t=Cd()),!t)throw _A.create("no-options");const s=En.get(n);if(s){if($a(t,s.options)&&$a(r,s.config))return s;throw _A.create("duplicate-app",{appName:n})}const i=new MC(n);for(const l of tl.values())i.addComponent(l);const o=new LE(t,r,i);return En.set(n,o),o}function Od(A=el){const e=En.get(A);if(!e&&A===el&&Cd())return Dd();if(!e)throw _A.create("no-app",{appName:A});return e}function DE(){return Array.from(En.values())}function CA(A,e,t){var r;let n=(r=xE[A])!==null&&r!==void 0?r:A;t&&(n+=`-${t}`);const s=n.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${n}" with version "${e}":`];s&&o.push(`library name "${n}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),eA.warn(o.join(" "));return}bn(new br(`${n}-version`,()=>({library:n,version:e}),"VERSION"))}/**
|
|
1094
|
+
* @license
|
|
1095
|
+
* Copyright 2021 Google LLC
|
|
1096
|
+
*
|
|
1097
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1098
|
+
* you may not use this file except in compliance with the License.
|
|
1099
|
+
* You may obtain a copy of the License at
|
|
1100
|
+
*
|
|
1101
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1102
|
+
*
|
|
1103
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1104
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1105
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1106
|
+
* See the License for the specific language governing permissions and
|
|
1107
|
+
* limitations under the License.
|
|
1108
|
+
*/const OE="firebase-heartbeat-database",PE=1,Un="firebase-heartbeat-store";let Al=null;function Pd(){return Al||(Al=tE(OE,PE,{upgrade:(A,e)=>{switch(e){case 0:try{A.createObjectStore(Un)}catch(t){console.warn(t)}}}}).catch(A=>{throw _A.create("idb-open",{originalErrorMessage:A.message})})),Al}async function NE(A){try{const t=(await Pd()).transaction(Un),r=await t.objectStore(Un).get(Vd(A));return await t.done,r}catch(e){if(e instanceof KA)eA.warn(e.message);else{const t=_A.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});eA.warn(t.message)}}}async function Nd(A,e){try{const r=(await Pd()).transaction(Un,"readwrite");await r.objectStore(Un).put(e,Vd(A)),await r.done}catch(t){if(t instanceof KA)eA.warn(t.message);else{const r=_A.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});eA.warn(r.message)}}}function Vd(A){return`${A.name}!${A.options.appId}`}/**
|
|
1109
|
+
* @license
|
|
1110
|
+
* Copyright 2021 Google LLC
|
|
1111
|
+
*
|
|
1112
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1113
|
+
* you may not use this file except in compliance with the License.
|
|
1114
|
+
* You may obtain a copy of the License at
|
|
1115
|
+
*
|
|
1116
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1117
|
+
*
|
|
1118
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1119
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1120
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1121
|
+
* See the License for the specific language governing permissions and
|
|
1122
|
+
* limitations under the License.
|
|
1123
|
+
*/const VE=1024,ME=30*24*60*60*1e3;class KE{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new jE(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Md();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(i=>i.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const o=new Date(i.date).valueOf();return Date.now()-o<=ME}),this._storage.overwrite(this._heartbeatsCache))}catch(r){eA.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=Md(),{heartbeatsToSend:r,unsentEntries:n}=GE(this._heartbeatsCache.heartbeats),s=_i(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return eA.warn(t),""}}}function Md(){return new Date().toISOString().substring(0,10)}function GE(A,e=VE){const t=[];let r=A.slice();for(const n of A){const s=t.find(i=>i.agent===n.agent);if(s){if(s.dates.push(n.date),Kd(t)>e){s.dates.pop();break}}else if(t.push({agent:n.agent,dates:[n.date]}),Kd(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class jE{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return kC()?HC().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await NE(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Nd(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Nd(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}else return}}function Kd(A){return _i(JSON.stringify({version:2,heartbeats:A})).length}/**
|
|
1124
|
+
* @license
|
|
1125
|
+
* Copyright 2019 Google LLC
|
|
1126
|
+
*
|
|
1127
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1128
|
+
* you may not use this file except in compliance with the License.
|
|
1129
|
+
* You may obtain a copy of the License at
|
|
1130
|
+
*
|
|
1131
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1132
|
+
*
|
|
1133
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1134
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1135
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1136
|
+
* See the License for the specific language governing permissions and
|
|
1137
|
+
* limitations under the License.
|
|
1138
|
+
*/function $E(A){bn(new br("platform-logger",e=>new nE(e),"PRIVATE")),bn(new br("heartbeat",e=>new KE(e),"PRIVATE")),CA(Za,xd,A),CA(Za,xd,"esm2017"),CA("fire-js","")}$E("");var WE="firebase",qE="10.14.1";/**
|
|
1139
|
+
* @license
|
|
1140
|
+
* Copyright 2020 Google LLC
|
|
1141
|
+
*
|
|
1142
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1143
|
+
* you may not use this file except in compliance with the License.
|
|
1144
|
+
* You may obtain a copy of the License at
|
|
1145
|
+
*
|
|
1146
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1147
|
+
*
|
|
1148
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1149
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1150
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1151
|
+
* See the License for the specific language governing permissions and
|
|
1152
|
+
* limitations under the License.
|
|
1153
|
+
*/CA(WE,qE,"app");var Gd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
1154
|
+
Copyright The Closure Library Authors.
|
|
1155
|
+
SPDX-License-Identifier: Apache-2.0
|
|
1156
|
+
*/var jA,jd;(function(){var A;/** @license
|
|
1157
|
+
|
|
1158
|
+
Copyright The Closure Library Authors.
|
|
1159
|
+
SPDX-License-Identifier: Apache-2.0
|
|
1160
|
+
*/function e(_,m){function y(){}y.prototype=m.prototype,_.D=m.prototype,_.prototype=new y,_.prototype.constructor=_,_.C=function(b,U,F){for(var v=Array(arguments.length-2),se=2;se<arguments.length;se++)v[se-2]=arguments[se];return m.prototype[U].apply(b,v)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,t),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function n(_,m,y){y||(y=0);var b=Array(16);if(typeof m=="string")for(var U=0;16>U;++U)b[U]=m.charCodeAt(y++)|m.charCodeAt(y++)<<8|m.charCodeAt(y++)<<16|m.charCodeAt(y++)<<24;else for(U=0;16>U;++U)b[U]=m[y++]|m[y++]<<8|m[y++]<<16|m[y++]<<24;m=_.g[0],y=_.g[1],U=_.g[2];var F=_.g[3],v=m+(F^y&(U^F))+b[0]+3614090360&4294967295;m=y+(v<<7&4294967295|v>>>25),v=F+(U^m&(y^U))+b[1]+3905402710&4294967295,F=m+(v<<12&4294967295|v>>>20),v=U+(y^F&(m^y))+b[2]+606105819&4294967295,U=F+(v<<17&4294967295|v>>>15),v=y+(m^U&(F^m))+b[3]+3250441966&4294967295,y=U+(v<<22&4294967295|v>>>10),v=m+(F^y&(U^F))+b[4]+4118548399&4294967295,m=y+(v<<7&4294967295|v>>>25),v=F+(U^m&(y^U))+b[5]+1200080426&4294967295,F=m+(v<<12&4294967295|v>>>20),v=U+(y^F&(m^y))+b[6]+2821735955&4294967295,U=F+(v<<17&4294967295|v>>>15),v=y+(m^U&(F^m))+b[7]+4249261313&4294967295,y=U+(v<<22&4294967295|v>>>10),v=m+(F^y&(U^F))+b[8]+1770035416&4294967295,m=y+(v<<7&4294967295|v>>>25),v=F+(U^m&(y^U))+b[9]+2336552879&4294967295,F=m+(v<<12&4294967295|v>>>20),v=U+(y^F&(m^y))+b[10]+4294925233&4294967295,U=F+(v<<17&4294967295|v>>>15),v=y+(m^U&(F^m))+b[11]+2304563134&4294967295,y=U+(v<<22&4294967295|v>>>10),v=m+(F^y&(U^F))+b[12]+1804603682&4294967295,m=y+(v<<7&4294967295|v>>>25),v=F+(U^m&(y^U))+b[13]+4254626195&4294967295,F=m+(v<<12&4294967295|v>>>20),v=U+(y^F&(m^y))+b[14]+2792965006&4294967295,U=F+(v<<17&4294967295|v>>>15),v=y+(m^U&(F^m))+b[15]+1236535329&4294967295,y=U+(v<<22&4294967295|v>>>10),v=m+(U^F&(y^U))+b[1]+4129170786&4294967295,m=y+(v<<5&4294967295|v>>>27),v=F+(y^U&(m^y))+b[6]+3225465664&4294967295,F=m+(v<<9&4294967295|v>>>23),v=U+(m^y&(F^m))+b[11]+643717713&4294967295,U=F+(v<<14&4294967295|v>>>18),v=y+(F^m&(U^F))+b[0]+3921069994&4294967295,y=U+(v<<20&4294967295|v>>>12),v=m+(U^F&(y^U))+b[5]+3593408605&4294967295,m=y+(v<<5&4294967295|v>>>27),v=F+(y^U&(m^y))+b[10]+38016083&4294967295,F=m+(v<<9&4294967295|v>>>23),v=U+(m^y&(F^m))+b[15]+3634488961&4294967295,U=F+(v<<14&4294967295|v>>>18),v=y+(F^m&(U^F))+b[4]+3889429448&4294967295,y=U+(v<<20&4294967295|v>>>12),v=m+(U^F&(y^U))+b[9]+568446438&4294967295,m=y+(v<<5&4294967295|v>>>27),v=F+(y^U&(m^y))+b[14]+3275163606&4294967295,F=m+(v<<9&4294967295|v>>>23),v=U+(m^y&(F^m))+b[3]+4107603335&4294967295,U=F+(v<<14&4294967295|v>>>18),v=y+(F^m&(U^F))+b[8]+1163531501&4294967295,y=U+(v<<20&4294967295|v>>>12),v=m+(U^F&(y^U))+b[13]+2850285829&4294967295,m=y+(v<<5&4294967295|v>>>27),v=F+(y^U&(m^y))+b[2]+4243563512&4294967295,F=m+(v<<9&4294967295|v>>>23),v=U+(m^y&(F^m))+b[7]+1735328473&4294967295,U=F+(v<<14&4294967295|v>>>18),v=y+(F^m&(U^F))+b[12]+2368359562&4294967295,y=U+(v<<20&4294967295|v>>>12),v=m+(y^U^F)+b[5]+4294588738&4294967295,m=y+(v<<4&4294967295|v>>>28),v=F+(m^y^U)+b[8]+2272392833&4294967295,F=m+(v<<11&4294967295|v>>>21),v=U+(F^m^y)+b[11]+1839030562&4294967295,U=F+(v<<16&4294967295|v>>>16),v=y+(U^F^m)+b[14]+4259657740&4294967295,y=U+(v<<23&4294967295|v>>>9),v=m+(y^U^F)+b[1]+2763975236&4294967295,m=y+(v<<4&4294967295|v>>>28),v=F+(m^y^U)+b[4]+1272893353&4294967295,F=m+(v<<11&4294967295|v>>>21),v=U+(F^m^y)+b[7]+4139469664&4294967295,U=F+(v<<16&4294967295|v>>>16),v=y+(U^F^m)+b[10]+3200236656&4294967295,y=U+(v<<23&4294967295|v>>>9),v=m+(y^U^F)+b[13]+681279174&4294967295,m=y+(v<<4&4294967295|v>>>28),v=F+(m^y^U)+b[0]+3936430074&4294967295,F=m+(v<<11&4294967295|v>>>21),v=U+(F^m^y)+b[3]+3572445317&4294967295,U=F+(v<<16&4294967295|v>>>16),v=y+(U^F^m)+b[6]+76029189&4294967295,y=U+(v<<23&4294967295|v>>>9),v=m+(y^U^F)+b[9]+3654602809&4294967295,m=y+(v<<4&4294967295|v>>>28),v=F+(m^y^U)+b[12]+3873151461&4294967295,F=m+(v<<11&4294967295|v>>>21),v=U+(F^m^y)+b[15]+530742520&4294967295,U=F+(v<<16&4294967295|v>>>16),v=y+(U^F^m)+b[2]+3299628645&4294967295,y=U+(v<<23&4294967295|v>>>9),v=m+(U^(y|~F))+b[0]+4096336452&4294967295,m=y+(v<<6&4294967295|v>>>26),v=F+(y^(m|~U))+b[7]+1126891415&4294967295,F=m+(v<<10&4294967295|v>>>22),v=U+(m^(F|~y))+b[14]+2878612391&4294967295,U=F+(v<<15&4294967295|v>>>17),v=y+(F^(U|~m))+b[5]+4237533241&4294967295,y=U+(v<<21&4294967295|v>>>11),v=m+(U^(y|~F))+b[12]+1700485571&4294967295,m=y+(v<<6&4294967295|v>>>26),v=F+(y^(m|~U))+b[3]+2399980690&4294967295,F=m+(v<<10&4294967295|v>>>22),v=U+(m^(F|~y))+b[10]+4293915773&4294967295,U=F+(v<<15&4294967295|v>>>17),v=y+(F^(U|~m))+b[1]+2240044497&4294967295,y=U+(v<<21&4294967295|v>>>11),v=m+(U^(y|~F))+b[8]+1873313359&4294967295,m=y+(v<<6&4294967295|v>>>26),v=F+(y^(m|~U))+b[15]+4264355552&4294967295,F=m+(v<<10&4294967295|v>>>22),v=U+(m^(F|~y))+b[6]+2734768916&4294967295,U=F+(v<<15&4294967295|v>>>17),v=y+(F^(U|~m))+b[13]+1309151649&4294967295,y=U+(v<<21&4294967295|v>>>11),v=m+(U^(y|~F))+b[4]+4149444226&4294967295,m=y+(v<<6&4294967295|v>>>26),v=F+(y^(m|~U))+b[11]+3174756917&4294967295,F=m+(v<<10&4294967295|v>>>22),v=U+(m^(F|~y))+b[2]+718787259&4294967295,U=F+(v<<15&4294967295|v>>>17),v=y+(F^(U|~m))+b[9]+3951481745&4294967295,_.g[0]=_.g[0]+m&4294967295,_.g[1]=_.g[1]+(U+(v<<21&4294967295|v>>>11))&4294967295,_.g[2]=_.g[2]+U&4294967295,_.g[3]=_.g[3]+F&4294967295}r.prototype.u=function(_,m){m===void 0&&(m=_.length);for(var y=m-this.blockSize,b=this.B,U=this.h,F=0;F<m;){if(U==0)for(;F<=y;)n(this,_,F),F+=this.blockSize;if(typeof _=="string"){for(;F<m;)if(b[U++]=_.charCodeAt(F++),U==this.blockSize){n(this,b),U=0;break}}else for(;F<m;)if(b[U++]=_[F++],U==this.blockSize){n(this,b),U=0;break}}this.h=U,this.o+=m},r.prototype.v=function(){var _=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);_[0]=128;for(var m=1;m<_.length-8;++m)_[m]=0;var y=8*this.o;for(m=_.length-8;m<_.length;++m)_[m]=y&255,y/=256;for(this.u(_),_=Array(16),m=y=0;4>m;++m)for(var b=0;32>b;b+=8)_[y++]=this.g[m]>>>b&255;return _};function s(_,m){var y=o;return Object.prototype.hasOwnProperty.call(y,_)?y[_]:y[_]=m(_)}function i(_,m){this.h=m;for(var y=[],b=!0,U=_.length-1;0<=U;U--){var F=_[U]|0;b&&F==m||(y[U]=F,b=!1)}this.g=y}var o={};function l(_){return-128<=_&&128>_?s(_,function(m){return new i([m|0],0>m?-1:0)}):new i([_|0],0>_?-1:0)}function c(_){if(isNaN(_)||!isFinite(_))return d;if(0>_)return E(c(-_));for(var m=[],y=1,b=0;_>=y;b++)m[b]=_/y|0,y*=4294967296;return new i(m,0)}function u(_,m){if(_.length==0)throw Error("number format error: empty string");if(m=m||10,2>m||36<m)throw Error("radix out of range: "+m);if(_.charAt(0)=="-")return E(u(_.substring(1),m));if(0<=_.indexOf("-"))throw Error('number format error: interior "-" character');for(var y=c(Math.pow(m,8)),b=d,U=0;U<_.length;U+=8){var F=Math.min(8,_.length-U),v=parseInt(_.substring(U,U+F),m);8>F?(F=c(Math.pow(m,F)),b=b.j(F).add(c(v))):(b=b.j(y),b=b.add(c(v)))}return b}var d=l(0),g=l(1),p=l(16777216);A=i.prototype,A.m=function(){if(C(this))return-E(this).m();for(var _=0,m=1,y=0;y<this.g.length;y++){var b=this.i(y);_+=(0<=b?b:4294967296+b)*m,m*=4294967296}return _},A.toString=function(_){if(_=_||10,2>_||36<_)throw Error("radix out of range: "+_);if(B(this))return"0";if(C(this))return"-"+E(this).toString(_);for(var m=c(Math.pow(_,6)),y=this,b="";;){var U=k(y,m).g;y=I(y,U.j(m));var F=((0<y.g.length?y.g[0]:y.h)>>>0).toString(_);if(y=U,B(y))return F+b;for(;6>F.length;)F="0"+F;b=F+b}},A.i=function(_){return 0>_?0:_<this.g.length?this.g[_]:this.h};function B(_){if(_.h!=0)return!1;for(var m=0;m<_.g.length;m++)if(_.g[m]!=0)return!1;return!0}function C(_){return _.h==-1}A.l=function(_){return _=I(this,_),C(_)?-1:B(_)?0:1};function E(_){for(var m=_.g.length,y=[],b=0;b<m;b++)y[b]=~_.g[b];return new i(y,~_.h).add(g)}A.abs=function(){return C(this)?E(this):this},A.add=function(_){for(var m=Math.max(this.g.length,_.g.length),y=[],b=0,U=0;U<=m;U++){var F=b+(this.i(U)&65535)+(_.i(U)&65535),v=(F>>>16)+(this.i(U)>>>16)+(_.i(U)>>>16);b=v>>>16,F&=65535,v&=65535,y[U]=v<<16|F}return new i(y,y[y.length-1]&-2147483648?-1:0)};function I(_,m){return _.add(E(m))}A.j=function(_){if(B(this)||B(_))return d;if(C(this))return C(_)?E(this).j(E(_)):E(E(this).j(_));if(C(_))return E(this.j(E(_)));if(0>this.l(p)&&0>_.l(p))return c(this.m()*_.m());for(var m=this.g.length+_.g.length,y=[],b=0;b<2*m;b++)y[b]=0;for(b=0;b<this.g.length;b++)for(var U=0;U<_.g.length;U++){var F=this.i(b)>>>16,v=this.i(b)&65535,se=_.i(U)>>>16,at=_.i(U)&65535;y[2*b+2*U]+=v*at,Q(y,2*b+2*U),y[2*b+2*U+1]+=F*at,Q(y,2*b+2*U+1),y[2*b+2*U+1]+=v*se,Q(y,2*b+2*U+1),y[2*b+2*U+2]+=F*se,Q(y,2*b+2*U+2)}for(b=0;b<m;b++)y[b]=y[2*b+1]<<16|y[2*b];for(b=m;b<2*m;b++)y[b]=0;return new i(y,0)};function Q(_,m){for(;(_[m]&65535)!=_[m];)_[m+1]+=_[m]>>>16,_[m]&=65535,m++}function S(_,m){this.g=_,this.h=m}function k(_,m){if(B(m))throw Error("division by zero");if(B(_))return new S(d,d);if(C(_))return m=k(E(_),m),new S(E(m.g),E(m.h));if(C(m))return m=k(_,E(m)),new S(E(m.g),m.h);if(30<_.g.length){if(C(_)||C(m))throw Error("slowDivide_ only works with positive integers.");for(var y=g,b=m;0>=b.l(_);)y=H(y),b=H(b);var U=R(y,1),F=R(b,1);for(b=R(b,2),y=R(y,2);!B(b);){var v=F.add(b);0>=v.l(_)&&(U=U.add(y),F=v),b=R(b,1),y=R(y,1)}return m=I(_,U.j(m)),new S(U,m)}for(U=d;0<=_.l(m);){for(y=Math.max(1,Math.floor(_.m()/m.m())),b=Math.ceil(Math.log(y)/Math.LN2),b=48>=b?1:Math.pow(2,b-48),F=c(y),v=F.j(m);C(v)||0<v.l(_);)y-=b,F=c(y),v=F.j(m);B(F)&&(F=g),U=U.add(F),_=I(_,v)}return new S(U,_)}A.A=function(_){return k(this,_).h},A.and=function(_){for(var m=Math.max(this.g.length,_.g.length),y=[],b=0;b<m;b++)y[b]=this.i(b)&_.i(b);return new i(y,this.h&_.h)},A.or=function(_){for(var m=Math.max(this.g.length,_.g.length),y=[],b=0;b<m;b++)y[b]=this.i(b)|_.i(b);return new i(y,this.h|_.h)},A.xor=function(_){for(var m=Math.max(this.g.length,_.g.length),y=[],b=0;b<m;b++)y[b]=this.i(b)^_.i(b);return new i(y,this.h^_.h)};function H(_){for(var m=_.g.length+1,y=[],b=0;b<m;b++)y[b]=_.i(b)<<1|_.i(b-1)>>>31;return new i(y,_.h)}function R(_,m){var y=m>>5;m%=32;for(var b=_.g.length-y,U=[],F=0;F<b;F++)U[F]=0<m?_.i(F+y)>>>m|_.i(F+y+1)<<32-m:_.i(F+y);return new i(U,_.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,jd=r,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.A,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=c,i.fromString=u,jA=i}).apply(typeof Gd<"u"?Gd:typeof self<"u"?self:typeof window<"u"?window:{});var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
1161
|
+
Copyright The Closure Library Authors.
|
|
1162
|
+
SPDX-License-Identifier: Apache-2.0
|
|
1163
|
+
*/var $d,Qn,Wd,Ei,rl,qd,Jd,Xd;(function(){var A,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(a,h,f){return a==Array.prototype||a==Object.prototype||(a[h]=f.value),a};function t(a){a=[typeof globalThis=="object"&&globalThis,a,typeof window=="object"&&window,typeof self=="object"&&self,typeof Ci=="object"&&Ci];for(var h=0;h<a.length;++h){var f=a[h];if(f&&f.Math==Math)return f}throw Error("Cannot find global object")}var r=t(this);function n(a,h){if(h)e:{var f=r;a=a.split(".");for(var w=0;w<a.length-1;w++){var T=a[w];if(!(T in f))break e;f=f[T]}a=a[a.length-1],w=f[a],h=h(w),h!=w&&h!=null&&e(f,a,{configurable:!0,writable:!0,value:h})}}function s(a,h){a instanceof String&&(a+="");var f=0,w=!1,T={next:function(){if(!w&&f<a.length){var x=f++;return{value:h(x,a[x]),done:!1}}return w=!0,{done:!0,value:void 0}}};return T[Symbol.iterator]=function(){return T},T}n("Array.prototype.values",function(a){return a||function(){return s(this,function(h,f){return f})}});/** @license
|
|
1164
|
+
|
|
1165
|
+
Copyright The Closure Library Authors.
|
|
1166
|
+
SPDX-License-Identifier: Apache-2.0
|
|
1167
|
+
*/var i=i||{},o=this||self;function l(a){var h=typeof a;return h=h!="object"?h:a?Array.isArray(a)?"array":h:"null",h=="array"||h=="object"&&typeof a.length=="number"}function c(a){var h=typeof a;return h=="object"&&a!=null||h=="function"}function u(a,h,f){return a.call.apply(a.bind,arguments)}function d(a,h,f){if(!a)throw Error();if(2<arguments.length){var w=Array.prototype.slice.call(arguments,2);return function(){var T=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(T,w),a.apply(h,T)}}return function(){return a.apply(h,arguments)}}function g(a,h,f){return g=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?u:d,g.apply(null,arguments)}function p(a,h){var f=Array.prototype.slice.call(arguments,1);return function(){var w=f.slice();return w.push.apply(w,arguments),a.apply(this,w)}}function B(a,h){function f(){}f.prototype=h.prototype,a.aa=h.prototype,a.prototype=new f,a.prototype.constructor=a,a.Qb=function(w,T,x){for(var O=Array(arguments.length-2),ie=2;ie<arguments.length;ie++)O[ie-2]=arguments[ie];return h.prototype[T].apply(w,O)}}function C(a){const h=a.length;if(0<h){const f=Array(h);for(let w=0;w<h;w++)f[w]=a[w];return f}return[]}function E(a,h){for(let f=1;f<arguments.length;f++){const w=arguments[f];if(l(w)){const T=a.length||0,x=w.length||0;a.length=T+x;for(let O=0;O<x;O++)a[T+O]=w[O]}else a.push(w)}}class I{constructor(h,f){this.i=h,this.j=f,this.h=0,this.g=null}get(){let h;return 0<this.h?(this.h--,h=this.g,this.g=h.next,h.next=null):h=this.i(),h}}function Q(a){return/^[\s\xa0]*$/.test(a)}function S(){var a=o.navigator;return a&&(a=a.userAgent)?a:""}function k(a){return k[" "](a),a}k[" "]=function(){};var H=S().indexOf("Gecko")!=-1&&!(S().toLowerCase().indexOf("webkit")!=-1&&S().indexOf("Edge")==-1)&&!(S().indexOf("Trident")!=-1||S().indexOf("MSIE")!=-1)&&S().indexOf("Edge")==-1;function R(a,h,f){for(const w in a)h.call(f,a[w],w,a)}function _(a,h){for(const f in a)h.call(void 0,a[f],f,a)}function m(a){const h={};for(const f in a)h[f]=a[f];return h}const y="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function b(a,h){let f,w;for(let T=1;T<arguments.length;T++){w=arguments[T];for(f in w)a[f]=w[f];for(let x=0;x<y.length;x++)f=y[x],Object.prototype.hasOwnProperty.call(w,f)&&(a[f]=w[f])}}function U(a){var h=1;a=a.split(":");const f=[];for(;0<h&&a.length;)f.push(a.shift()),h--;return a.length&&f.push(a.join(":")),f}function F(a){o.setTimeout(()=>{throw a},0)}function v(){var a=lt;let h=null;return a.g&&(h=a.g,a.g=a.g.next,a.g||(a.h=null),h.next=null),h}class se{constructor(){this.h=this.g=null}add(h,f){const w=at.get();w.set(h,f),this.h?this.h.next=w:this.g=w,this.h=w}}var at=new I(()=>new $e,a=>a.reset());class $e{constructor(){this.next=this.g=this.h=null}set(h,f){this.h=h,this.g=f,this.next=null}reset(){this.next=this.g=this.h=null}}let Qe,ft=!1,lt=new se,Ht=()=>{const a=o.Promise.resolve(void 0);Qe=()=>{a.then(oA)}};var oA=()=>{for(var a;a=v();){try{a.h.call(a.g)}catch(f){F(f)}var h=at;h.j(a),100>h.h&&(h.h++,a.next=h.g,h.g=a)}ft=!1};function We(){this.s=this.s,this.C=this.C}We.prototype.s=!1,We.prototype.ma=function(){this.s||(this.s=!0,this.N())},We.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function le(a,h){this.type=a,this.g=this.target=h,this.defaultPrevented=!1}le.prototype.h=function(){this.defaultPrevented=!0};var aA=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var a=!1,h=Object.defineProperty({},"passive",{get:function(){a=!0}});try{const f=()=>{};o.addEventListener("test",f,h),o.removeEventListener("test",f,h)}catch{}return a}();function et(a,h){if(le.call(this,a?a.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,a){var f=this.type=a.type,w=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;if(this.target=a.target||a.srcElement,this.g=h,h=a.relatedTarget){if(H){e:{try{k(h.nodeName);var T=!0;break e}catch{}T=!1}T||(h=null)}}else f=="mouseover"?h=a.fromElement:f=="mouseout"&&(h=a.toElement);this.relatedTarget=h,w?(this.clientX=w.clientX!==void 0?w.clientX:w.pageX,this.clientY=w.clientY!==void 0?w.clientY:w.pageY,this.screenX=w.screenX||0,this.screenY=w.screenY||0):(this.clientX=a.clientX!==void 0?a.clientX:a.pageX,this.clientY=a.clientY!==void 0?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0),this.button=a.button,this.key=a.key||"",this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.pointerId=a.pointerId||0,this.pointerType=typeof a.pointerType=="string"?a.pointerType:xA[a.pointerType]||"",this.state=a.state,this.i=a,a.defaultPrevented&&et.aa.h.call(this)}}B(et,le);var xA={2:"touch",3:"pen",4:"mouse"};et.prototype.h=function(){et.aa.h.call(this);var a=this.i;a.preventDefault?a.preventDefault():a.returnValue=!1};var qt="closure_listenable_"+(1e6*Math.random()|0),fR=0;function gR(a,h,f,w,T){this.listener=a,this.proxy=null,this.src=h,this.type=f,this.capture=!!w,this.ha=T,this.key=++fR,this.da=this.fa=!1}function Qo(a){a.da=!0,a.listener=null,a.proxy=null,a.src=null,a.ha=null}function Io(a){this.src=a,this.g={},this.h=0}Io.prototype.add=function(a,h,f,w,T){var x=a.toString();a=this.g[x],a||(a=this.g[x]=[],this.h++);var O=Mc(a,h,w,T);return-1<O?(h=a[O],f||(h.fa=!1)):(h=new gR(h,this.src,x,!!w,T),h.fa=f,a.push(h)),h};function Vc(a,h){var f=h.type;if(f in a.g){var w=a.g[f],T=Array.prototype.indexOf.call(w,h,void 0),x;(x=0<=T)&&Array.prototype.splice.call(w,T,1),x&&(Qo(h),a.g[f].length==0&&(delete a.g[f],a.h--))}}function Mc(a,h,f,w){for(var T=0;T<a.length;++T){var x=a[T];if(!x.da&&x.listener==h&&x.capture==!!f&&x.ha==w)return T}return-1}var Kc="closure_lm_"+(1e6*Math.random()|0),Gc={};function Iw(a,h,f,w,T){if(Array.isArray(h)){for(var x=0;x<h.length;x++)Iw(a,h[x],f,w,T);return null}return f=Sw(f),a&&a[qt]?a.K(h,f,c(w)?!!w.capture:!1,T):pR(a,h,f,!1,w,T)}function pR(a,h,f,w,T,x){if(!h)throw Error("Invalid event type");var O=c(T)?!!T.capture:!!T,ie=$c(a);if(ie||(a[Kc]=ie=new Io(a)),f=ie.add(h,f,w,O,x),f.proxy)return f;if(w=wR(),f.proxy=w,w.src=a,w.listener=f,a.addEventListener)aA||(T=O),T===void 0&&(T=!1),a.addEventListener(h.toString(),w,T);else if(a.attachEvent)a.attachEvent(Tw(h.toString()),w);else if(a.addListener&&a.removeListener)a.addListener(w);else throw Error("addEventListener and attachEvent are unavailable.");return f}function wR(){function a(f){return h.call(a.src,a.listener,f)}const h=BR;return a}function Fw(a,h,f,w,T){if(Array.isArray(h))for(var x=0;x<h.length;x++)Fw(a,h[x],f,w,T);else w=c(w)?!!w.capture:!!w,f=Sw(f),a&&a[qt]?(a=a.i,h=String(h).toString(),h in a.g&&(x=a.g[h],f=Mc(x,f,w,T),-1<f&&(Qo(x[f]),Array.prototype.splice.call(x,f,1),x.length==0&&(delete a.g[h],a.h--)))):a&&(a=$c(a))&&(h=a.g[h.toString()],a=-1,h&&(a=Mc(h,f,w,T)),(f=-1<a?h[a]:null)&&jc(f))}function jc(a){if(typeof a!="number"&&a&&!a.da){var h=a.src;if(h&&h[qt])Vc(h.i,a);else{var f=a.type,w=a.proxy;h.removeEventListener?h.removeEventListener(f,w,a.capture):h.detachEvent?h.detachEvent(Tw(f),w):h.addListener&&h.removeListener&&h.removeListener(w),(f=$c(h))?(Vc(f,a),f.h==0&&(f.src=null,h[Kc]=null)):Qo(a)}}}function Tw(a){return a in Gc?Gc[a]:Gc[a]="on"+a}function BR(a,h){if(a.da)a=!0;else{h=new et(h,this);var f=a.listener,w=a.ha||a.src;a.fa&&jc(a),a=f.call(w,h)}return a}function $c(a){return a=a[Kc],a instanceof Io?a:null}var Wc="__closure_events_fn_"+(1e9*Math.random()>>>0);function Sw(a){return typeof a=="function"?a:(a[Wc]||(a[Wc]=function(h){return a.handleEvent(h)}),a[Wc])}function qe(){We.call(this),this.i=new Io(this),this.M=this,this.F=null}B(qe,We),qe.prototype[qt]=!0,qe.prototype.removeEventListener=function(a,h,f,w){Fw(this,a,h,f,w)};function tt(a,h){var f,w=a.F;if(w)for(f=[];w;w=w.F)f.push(w);if(a=a.M,w=h.type||h,typeof h=="string")h=new le(h,a);else if(h instanceof le)h.target=h.target||a;else{var T=h;h=new le(w,a),b(h,T)}if(T=!0,f)for(var x=f.length-1;0<=x;x--){var O=h.g=f[x];T=Fo(O,w,!0,h)&&T}if(O=h.g=a,T=Fo(O,w,!0,h)&&T,T=Fo(O,w,!1,h)&&T,f)for(x=0;x<f.length;x++)O=h.g=f[x],T=Fo(O,w,!1,h)&&T}qe.prototype.N=function(){if(qe.aa.N.call(this),this.i){var a=this.i,h;for(h in a.g){for(var f=a.g[h],w=0;w<f.length;w++)Qo(f[w]);delete a.g[h],a.h--}}this.F=null},qe.prototype.K=function(a,h,f,w){return this.i.add(String(a),h,!1,f,w)},qe.prototype.L=function(a,h,f,w){return this.i.add(String(a),h,!0,f,w)};function Fo(a,h,f,w){if(h=a.i.g[String(h)],!h)return!0;h=h.concat();for(var T=!0,x=0;x<h.length;++x){var O=h[x];if(O&&!O.da&&O.capture==f){var ie=O.listener,Pe=O.ha||O.src;O.fa&&Vc(a.i,O),T=ie.call(Pe,w)!==!1&&T}}return T&&!w.defaultPrevented}function Rw(a,h,f){if(typeof a=="function")f&&(a=g(a,f));else if(a&&typeof a.handleEvent=="function")a=g(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(h)?-1:o.setTimeout(a,h||0)}function xw(a){a.g=Rw(()=>{a.g=null,a.i&&(a.i=!1,xw(a))},a.l);const h=a.h;a.h=null,a.m.apply(null,h)}class mR extends We{constructor(h,f){super(),this.m=h,this.l=f,this.h=null,this.i=!1,this.g=null}j(h){this.h=arguments,this.g?this.i=!0:xw(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function gs(a){We.call(this),this.h=a,this.g={}}B(gs,We);var kw=[];function Hw(a){R(a.g,function(h,f){this.g.hasOwnProperty(f)&&jc(h)},a),a.g={}}gs.prototype.N=function(){gs.aa.N.call(this),Hw(this)},gs.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var qc=o.JSON.stringify,yR=o.JSON.parse,vR=class{stringify(a){return o.JSON.stringify(a,void 0)}parse(a){return o.JSON.parse(a,void 0)}};function Jc(){}Jc.prototype.h=null;function Lw(a){return a.h||(a.h=a.i())}function Dw(){}var ps={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Xc(){le.call(this,"d")}B(Xc,le);function zc(){le.call(this,"c")}B(zc,le);var ar={},Ow=null;function To(){return Ow=Ow||new qe}ar.La="serverreachability";function Pw(a){le.call(this,ar.La,a)}B(Pw,le);function ws(a){const h=To();tt(h,new Pw(h))}ar.STAT_EVENT="statevent";function Nw(a,h){le.call(this,ar.STAT_EVENT,a),this.stat=h}B(Nw,le);function At(a){const h=To();tt(h,new Nw(h,a))}ar.Ma="timingevent";function Vw(a,h){le.call(this,ar.Ma,a),this.size=h}B(Vw,le);function Bs(a,h){if(typeof a!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){a()},h)}function ms(){this.g=!0}ms.prototype.xa=function(){this.g=!1};function _R(a,h,f,w,T,x){a.info(function(){if(a.g)if(x)for(var O="",ie=x.split("&"),Pe=0;Pe<ie.length;Pe++){var te=ie[Pe].split("=");if(1<te.length){var Je=te[0];te=te[1];var Xe=Je.split("_");O=2<=Xe.length&&Xe[1]=="type"?O+(Je+"="+te+"&"):O+(Je+"=redacted&")}}else O=null;else O=x;return"XMLHTTP REQ ("+w+") [attempt "+T+"]: "+h+`
|
|
1168
|
+
`+f+`
|
|
1169
|
+
`+O})}function CR(a,h,f,w,T,x,O){a.info(function(){return"XMLHTTP RESP ("+w+") [ attempt "+T+"]: "+h+`
|
|
1170
|
+
`+f+`
|
|
1171
|
+
`+x+" "+O})}function zr(a,h,f,w){a.info(function(){return"XMLHTTP TEXT ("+h+"): "+bR(a,f)+(w?" "+w:"")})}function ER(a,h){a.info(function(){return"TIMEOUT: "+h})}ms.prototype.info=function(){};function bR(a,h){if(!a.g)return h;if(!h)return null;try{var f=JSON.parse(h);if(f){for(a=0;a<f.length;a++)if(Array.isArray(f[a])){var w=f[a];if(!(2>w.length)){var T=w[1];if(Array.isArray(T)&&!(1>T.length)){var x=T[0];if(x!="noop"&&x!="stop"&&x!="close")for(var O=1;O<T.length;O++)T[O]=""}}}}return qc(f)}catch{return h}}var So={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Mw={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Yc;function Ro(){}B(Ro,Jc),Ro.prototype.g=function(){return new XMLHttpRequest},Ro.prototype.i=function(){return{}},Yc=new Ro;function kA(a,h,f,w){this.j=a,this.i=h,this.l=f,this.R=w||1,this.U=new gs(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Kw}function Kw(){this.i=null,this.g="",this.h=!1}var Gw={},Zc={};function eu(a,h,f){a.L=1,a.v=Lo(lA(h)),a.m=f,a.P=!0,jw(a,null)}function jw(a,h){a.F=Date.now(),xo(a),a.A=lA(a.v);var f=a.A,w=a.R;Array.isArray(w)||(w=[String(w)]),sB(f.i,"t",w),a.C=0,f=a.j.J,a.h=new Kw,a.g=CB(a.j,f?h:null,!a.m),0<a.O&&(a.M=new mR(g(a.Y,a,a.g),a.O)),h=a.U,f=a.g,w=a.ca;var T="readystatechange";Array.isArray(T)||(T&&(kw[0]=T.toString()),T=kw);for(var x=0;x<T.length;x++){var O=Iw(f,T[x],w||h.handleEvent,!1,h.h||h);if(!O)break;h.g[O.key]=O}h=a.H?m(a.H):{},a.m?(a.u||(a.u="POST"),h["Content-Type"]="application/x-www-form-urlencoded",a.g.ea(a.A,a.u,a.m,h)):(a.u="GET",a.g.ea(a.A,a.u,null,h)),ws(),_R(a.i,a.u,a.A,a.l,a.R,a.m)}kA.prototype.ca=function(a){a=a.target;const h=this.M;h&&cA(a)==3?h.j():this.Y(a)},kA.prototype.Y=function(a){try{if(a==this.g)e:{const Xe=cA(this.g);var h=this.g.Ba();const en=this.g.Z();if(!(3>Xe)&&(Xe!=3||this.g&&(this.h.h||this.g.oa()||hB(this.g)))){this.J||Xe!=4||h==7||(h==8||0>=en?ws(3):ws(2)),tu(this);var f=this.g.Z();this.X=f;t:if($w(this)){var w=hB(this.g);a="";var T=w.length,x=cA(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){lr(this),ys(this);var O="";break t}this.h.i=new o.TextDecoder}for(h=0;h<T;h++)this.h.h=!0,a+=this.h.i.decode(w[h],{stream:!(x&&h==T-1)});w.length=0,this.h.g+=a,this.C=0,O=this.h.g}else O=this.g.oa();if(this.o=f==200,CR(this.i,this.u,this.A,this.l,this.R,Xe,f),this.o){if(this.T&&!this.K){t:{if(this.g){var ie,Pe=this.g;if((ie=Pe.g?Pe.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Q(ie)){var te=ie;break t}}te=null}if(f=te)zr(this.i,this.l,f,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Au(this,f);else{this.o=!1,this.s=3,At(12),lr(this),ys(this);break e}}if(this.P){f=!0;let Lt;for(;!this.J&&this.C<O.length;)if(Lt=UR(this,O),Lt==Zc){Xe==4&&(this.s=4,At(14),f=!1),zr(this.i,this.l,null,"[Incomplete Response]");break}else if(Lt==Gw){this.s=4,At(15),zr(this.i,this.l,O,"[Invalid Chunk]"),f=!1;break}else zr(this.i,this.l,Lt,null),Au(this,Lt);if($w(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Xe!=4||O.length!=0||this.h.h||(this.s=1,At(16),f=!1),this.o=this.o&&f,!f)zr(this.i,this.l,O,"[Invalid Chunked Response]"),lr(this),ys(this);else if(0<O.length&&!this.W){this.W=!0;var Je=this.j;Je.g==this&&Je.ba&&!Je.M&&(Je.j.info("Great, no buffering proxy detected. Bytes received: "+O.length),au(Je),Je.M=!0,At(11))}}else zr(this.i,this.l,O,null),Au(this,O);Xe==4&&lr(this),this.o&&!this.J&&(Xe==4?mB(this.j,this):(this.o=!1,xo(this)))}else KR(this.g),f==400&&0<O.indexOf("Unknown SID")?(this.s=3,At(12)):(this.s=0,At(13)),lr(this),ys(this)}}}catch{}finally{}};function $w(a){return a.g?a.u=="GET"&&a.L!=2&&a.j.Ca:!1}function UR(a,h){var f=a.C,w=h.indexOf(`
|
|
1172
|
+
`,f);return w==-1?Zc:(f=Number(h.substring(f,w)),isNaN(f)?Gw:(w+=1,w+f>h.length?Zc:(h=h.slice(w,w+f),a.C=w+f,h)))}kA.prototype.cancel=function(){this.J=!0,lr(this)};function xo(a){a.S=Date.now()+a.I,Ww(a,a.I)}function Ww(a,h){if(a.B!=null)throw Error("WatchDog timer not null");a.B=Bs(g(a.ba,a),h)}function tu(a){a.B&&(o.clearTimeout(a.B),a.B=null)}kA.prototype.ba=function(){this.B=null;const a=Date.now();0<=a-this.S?(ER(this.i,this.A),this.L!=2&&(ws(),At(17)),lr(this),this.s=2,ys(this)):Ww(this,this.S-a)};function ys(a){a.j.G==0||a.J||mB(a.j,a)}function lr(a){tu(a);var h=a.M;h&&typeof h.ma=="function"&&h.ma(),a.M=null,Hw(a.U),a.g&&(h=a.g,a.g=null,h.abort(),h.ma())}function Au(a,h){try{var f=a.j;if(f.G!=0&&(f.g==a||ru(f.h,a))){if(!a.K&&ru(f.h,a)&&f.G==3){try{var w=f.Da.g.parse(h)}catch{w=null}if(Array.isArray(w)&&w.length==3){var T=w;if(T[0]==0){e:if(!f.u){if(f.g)if(f.g.F+3e3<a.F)Mo(f),No(f);else break e;ou(f),At(18)}}else f.za=T[1],0<f.za-f.T&&37500>T[2]&&f.F&&f.v==0&&!f.C&&(f.C=Bs(g(f.Za,f),6e3));if(1>=Xw(f.h)&&f.ca){try{f.ca()}catch{}f.ca=void 0}}else ur(f,11)}else if((a.K||f.g==a)&&Mo(f),!Q(h))for(T=f.Da.g.parse(h),h=0;h<T.length;h++){let te=T[h];if(f.T=te[0],te=te[1],f.G==2)if(te[0]=="c"){f.K=te[1],f.ia=te[2];const Je=te[3];Je!=null&&(f.la=Je,f.j.info("VER="+f.la));const Xe=te[4];Xe!=null&&(f.Aa=Xe,f.j.info("SVER="+f.Aa));const en=te[5];en!=null&&typeof en=="number"&&0<en&&(w=1.5*en,f.L=w,f.j.info("backChannelRequestTimeoutMs_="+w)),w=f;const Lt=a.g;if(Lt){const Go=Lt.g?Lt.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Go){var x=w.h;x.g||Go.indexOf("spdy")==-1&&Go.indexOf("quic")==-1&&Go.indexOf("h2")==-1||(x.j=x.l,x.g=new Set,x.h&&(nu(x,x.h),x.h=null))}if(w.D){const lu=Lt.g?Lt.g.getResponseHeader("X-HTTP-Session-Id"):null;lu&&(w.ya=lu,ue(w.I,w.D,lu))}}f.G=3,f.l&&f.l.ua(),f.ba&&(f.R=Date.now()-a.F,f.j.info("Handshake RTT: "+f.R+"ms")),w=f;var O=a;if(w.qa=_B(w,w.J?w.ia:null,w.W),O.K){zw(w.h,O);var ie=O,Pe=w.L;Pe&&(ie.I=Pe),ie.B&&(tu(ie),xo(ie)),w.g=O}else wB(w);0<f.i.length&&Vo(f)}else te[0]!="stop"&&te[0]!="close"||ur(f,7);else f.G==3&&(te[0]=="stop"||te[0]=="close"?te[0]=="stop"?ur(f,7):iu(f):te[0]!="noop"&&f.l&&f.l.ta(te),f.v=0)}}ws(4)}catch{}}var QR=class{constructor(a,h){this.g=a,this.map=h}};function qw(a){this.l=a||10,o.PerformanceNavigationTiming?(a=o.performance.getEntriesByType("navigation"),a=0<a.length&&(a[0].nextHopProtocol=="hq"||a[0].nextHopProtocol=="h2")):a=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=a?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Jw(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function Xw(a){return a.h?1:a.g?a.g.size:0}function ru(a,h){return a.h?a.h==h:a.g?a.g.has(h):!1}function nu(a,h){a.g?a.g.add(h):a.h=h}function zw(a,h){a.h&&a.h==h?a.h=null:a.g&&a.g.has(h)&&a.g.delete(h)}qw.prototype.cancel=function(){if(this.i=Yw(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const a of this.g.values())a.cancel();this.g.clear()}};function Yw(a){if(a.h!=null)return a.i.concat(a.h.D);if(a.g!=null&&a.g.size!==0){let h=a.i;for(const f of a.g.values())h=h.concat(f.D);return h}return C(a.i)}function IR(a){if(a.V&&typeof a.V=="function")return a.V();if(typeof Map<"u"&&a instanceof Map||typeof Set<"u"&&a instanceof Set)return Array.from(a.values());if(typeof a=="string")return a.split("");if(l(a)){for(var h=[],f=a.length,w=0;w<f;w++)h.push(a[w]);return h}h=[],f=0;for(w in a)h[f++]=a[w];return h}function FR(a){if(a.na&&typeof a.na=="function")return a.na();if(!a.V||typeof a.V!="function"){if(typeof Map<"u"&&a instanceof Map)return Array.from(a.keys());if(!(typeof Set<"u"&&a instanceof Set)){if(l(a)||typeof a=="string"){var h=[];a=a.length;for(var f=0;f<a;f++)h.push(f);return h}h=[],f=0;for(const w in a)h[f++]=w;return h}}}function Zw(a,h){if(a.forEach&&typeof a.forEach=="function")a.forEach(h,void 0);else if(l(a)||typeof a=="string")Array.prototype.forEach.call(a,h,void 0);else for(var f=FR(a),w=IR(a),T=w.length,x=0;x<T;x++)h.call(void 0,w[x],f&&f[x],a)}var eB=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function TR(a,h){if(a){a=a.split("&");for(var f=0;f<a.length;f++){var w=a[f].indexOf("="),T=null;if(0<=w){var x=a[f].substring(0,w);T=a[f].substring(w+1)}else x=a[f];h(x,T?decodeURIComponent(T.replace(/\+/g," ")):"")}}}function cr(a){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,a instanceof cr){this.h=a.h,ko(this,a.j),this.o=a.o,this.g=a.g,Ho(this,a.s),this.l=a.l;var h=a.i,f=new Cs;f.i=h.i,h.g&&(f.g=new Map(h.g),f.h=h.h),tB(this,f),this.m=a.m}else a&&(h=String(a).match(eB))?(this.h=!1,ko(this,h[1]||"",!0),this.o=vs(h[2]||""),this.g=vs(h[3]||"",!0),Ho(this,h[4]),this.l=vs(h[5]||"",!0),tB(this,h[6]||"",!0),this.m=vs(h[7]||"")):(this.h=!1,this.i=new Cs(null,this.h))}cr.prototype.toString=function(){var a=[],h=this.j;h&&a.push(_s(h,AB,!0),":");var f=this.g;return(f||h=="file")&&(a.push("//"),(h=this.o)&&a.push(_s(h,AB,!0),"@"),a.push(encodeURIComponent(String(f)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),f=this.s,f!=null&&a.push(":",String(f))),(f=this.l)&&(this.g&&f.charAt(0)!="/"&&a.push("/"),a.push(_s(f,f.charAt(0)=="/"?xR:RR,!0))),(f=this.i.toString())&&a.push("?",f),(f=this.m)&&a.push("#",_s(f,HR)),a.join("")};function lA(a){return new cr(a)}function ko(a,h,f){a.j=f?vs(h,!0):h,a.j&&(a.j=a.j.replace(/:$/,""))}function Ho(a,h){if(h){if(h=Number(h),isNaN(h)||0>h)throw Error("Bad port number "+h);a.s=h}else a.s=null}function tB(a,h,f){h instanceof Cs?(a.i=h,LR(a.i,a.h)):(f||(h=_s(h,kR)),a.i=new Cs(h,a.h))}function ue(a,h,f){a.i.set(h,f)}function Lo(a){return ue(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),a}function vs(a,h){return a?h?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function _s(a,h,f){return typeof a=="string"?(a=encodeURI(a).replace(h,SR),f&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function SR(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var AB=/[#\/\?@]/g,RR=/[#\?:]/g,xR=/[#\?]/g,kR=/[#\?@]/g,HR=/#/g;function Cs(a,h){this.h=this.g=null,this.i=a||null,this.j=!!h}function HA(a){a.g||(a.g=new Map,a.h=0,a.i&&TR(a.i,function(h,f){a.add(decodeURIComponent(h.replace(/\+/g," ")),f)}))}A=Cs.prototype,A.add=function(a,h){HA(this),this.i=null,a=Yr(this,a);var f=this.g.get(a);return f||this.g.set(a,f=[]),f.push(h),this.h+=1,this};function rB(a,h){HA(a),h=Yr(a,h),a.g.has(h)&&(a.i=null,a.h-=a.g.get(h).length,a.g.delete(h))}function nB(a,h){return HA(a),h=Yr(a,h),a.g.has(h)}A.forEach=function(a,h){HA(this),this.g.forEach(function(f,w){f.forEach(function(T){a.call(h,T,w,this)},this)},this)},A.na=function(){HA(this);const a=Array.from(this.g.values()),h=Array.from(this.g.keys()),f=[];for(let w=0;w<h.length;w++){const T=a[w];for(let x=0;x<T.length;x++)f.push(h[w])}return f},A.V=function(a){HA(this);let h=[];if(typeof a=="string")nB(this,a)&&(h=h.concat(this.g.get(Yr(this,a))));else{a=Array.from(this.g.values());for(let f=0;f<a.length;f++)h=h.concat(a[f])}return h},A.set=function(a,h){return HA(this),this.i=null,a=Yr(this,a),nB(this,a)&&(this.h-=this.g.get(a).length),this.g.set(a,[h]),this.h+=1,this},A.get=function(a,h){return a?(a=this.V(a),0<a.length?String(a[0]):h):h};function sB(a,h,f){rB(a,h),0<f.length&&(a.i=null,a.g.set(Yr(a,h),C(f)),a.h+=f.length)}A.toString=function(){if(this.i)return this.i;if(!this.g)return"";const a=[],h=Array.from(this.g.keys());for(var f=0;f<h.length;f++){var w=h[f];const x=encodeURIComponent(String(w)),O=this.V(w);for(w=0;w<O.length;w++){var T=x;O[w]!==""&&(T+="="+encodeURIComponent(String(O[w]))),a.push(T)}}return this.i=a.join("&")};function Yr(a,h){return h=String(h),a.j&&(h=h.toLowerCase()),h}function LR(a,h){h&&!a.j&&(HA(a),a.i=null,a.g.forEach(function(f,w){var T=w.toLowerCase();w!=T&&(rB(this,w),sB(this,T,f))},a)),a.j=h}function DR(a,h){const f=new ms;if(o.Image){const w=new Image;w.onload=p(LA,f,"TestLoadImage: loaded",!0,h,w),w.onerror=p(LA,f,"TestLoadImage: error",!1,h,w),w.onabort=p(LA,f,"TestLoadImage: abort",!1,h,w),w.ontimeout=p(LA,f,"TestLoadImage: timeout",!1,h,w),o.setTimeout(function(){w.ontimeout&&w.ontimeout()},1e4),w.src=a}else h(!1)}function OR(a,h){const f=new ms,w=new AbortController,T=setTimeout(()=>{w.abort(),LA(f,"TestPingServer: timeout",!1,h)},1e4);fetch(a,{signal:w.signal}).then(x=>{clearTimeout(T),x.ok?LA(f,"TestPingServer: ok",!0,h):LA(f,"TestPingServer: server error",!1,h)}).catch(()=>{clearTimeout(T),LA(f,"TestPingServer: error",!1,h)})}function LA(a,h,f,w,T){try{T&&(T.onload=null,T.onerror=null,T.onabort=null,T.ontimeout=null),w(f)}catch{}}function PR(){this.g=new vR}function NR(a,h,f){const w=f||"";try{Zw(a,function(T,x){let O=T;c(T)&&(O=qc(T)),h.push(w+x+"="+encodeURIComponent(O))})}catch(T){throw h.push(w+"type="+encodeURIComponent("_badmap")),T}}function Do(a){this.l=a.Ub||null,this.j=a.eb||!1}B(Do,Jc),Do.prototype.g=function(){return new Oo(this.l,this.j)},Do.prototype.i=function(a){return function(){return a}}({});function Oo(a,h){qe.call(this),this.D=a,this.o=h,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}B(Oo,qe),A=Oo.prototype,A.open=function(a,h){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=a,this.A=h,this.readyState=1,bs(this)},A.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const h={headers:this.u,method:this.B,credentials:this.m,cache:void 0};a&&(h.body=a),(this.D||o).fetch(new Request(this.A,h)).then(this.Sa.bind(this),this.ga.bind(this))},A.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Es(this)),this.readyState=0},A.Sa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,bs(this)),this.g&&(this.readyState=3,bs(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in a){if(this.j=a.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;iB(this)}else a.text().then(this.Ra.bind(this),this.ga.bind(this))};function iB(a){a.j.read().then(a.Pa.bind(a)).catch(a.ga.bind(a))}A.Pa=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var h=a.value?a.value:new Uint8Array(0);(h=this.v.decode(h,{stream:!a.done}))&&(this.response=this.responseText+=h)}a.done?Es(this):bs(this),this.readyState==3&&iB(this)}},A.Ra=function(a){this.g&&(this.response=this.responseText=a,Es(this))},A.Qa=function(a){this.g&&(this.response=a,Es(this))},A.ga=function(){this.g&&Es(this)};function Es(a){a.readyState=4,a.l=null,a.j=null,a.v=null,bs(a)}A.setRequestHeader=function(a,h){this.u.append(a,h)},A.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},A.getAllResponseHeaders=function(){if(!this.h)return"";const a=[],h=this.h.entries();for(var f=h.next();!f.done;)f=f.value,a.push(f[0]+": "+f[1]),f=h.next();return a.join(`\r
|
|
1173
|
+
`)};function bs(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(Oo.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function oB(a){let h="";return R(a,function(f,w){h+=w,h+=":",h+=f,h+=`\r
|
|
1174
|
+
`}),h}function su(a,h,f){e:{for(w in f){var w=!1;break e}w=!0}w||(f=oB(f),typeof a=="string"?f!=null&&encodeURIComponent(String(f)):ue(a,h,f))}function pe(a){qe.call(this),this.headers=new Map,this.o=a||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}B(pe,qe);var VR=/^https?$/i,MR=["POST","PUT"];A=pe.prototype,A.Ha=function(a){this.J=a},A.ea=function(a,h,f,w){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);h=h?h.toUpperCase():"GET",this.D=a,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Yc.g(),this.v=this.o?Lw(this.o):Lw(Yc),this.g.onreadystatechange=g(this.Ea,this);try{this.B=!0,this.g.open(h,String(a),!0),this.B=!1}catch(x){aB(this,x);return}if(a=f||"",f=new Map(this.headers),w)if(Object.getPrototypeOf(w)===Object.prototype)for(var T in w)f.set(T,w[T]);else if(typeof w.keys=="function"&&typeof w.get=="function")for(const x of w.keys())f.set(x,w.get(x));else throw Error("Unknown input type for opt_headers: "+String(w));w=Array.from(f.keys()).find(x=>x.toLowerCase()=="content-type"),T=o.FormData&&a instanceof o.FormData,!(0<=Array.prototype.indexOf.call(MR,h,void 0))||w||T||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[x,O]of f)this.g.setRequestHeader(x,O);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{uB(this),this.u=!0,this.g.send(a),this.u=!1}catch(x){aB(this,x)}};function aB(a,h){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=h,a.m=5,lB(a),Po(a)}function lB(a){a.A||(a.A=!0,tt(a,"complete"),tt(a,"error"))}A.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=a||7,tt(this,"complete"),tt(this,"abort"),Po(this))},A.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Po(this,!0)),pe.aa.N.call(this)},A.Ea=function(){this.s||(this.B||this.u||this.j?cB(this):this.bb())},A.bb=function(){cB(this)};function cB(a){if(a.h&&typeof i<"u"&&(!a.v[1]||cA(a)!=4||a.Z()!=2)){if(a.u&&cA(a)==4)Rw(a.Ea,0,a);else if(tt(a,"readystatechange"),cA(a)==4){a.h=!1;try{const O=a.Z();e:switch(O){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var h=!0;break e;default:h=!1}var f;if(!(f=h)){var w;if(w=O===0){var T=String(a.D).match(eB)[1]||null;!T&&o.self&&o.self.location&&(T=o.self.location.protocol.slice(0,-1)),w=!VR.test(T?T.toLowerCase():"")}f=w}if(f)tt(a,"complete"),tt(a,"success");else{a.m=6;try{var x=2<cA(a)?a.g.statusText:""}catch{x=""}a.l=x+" ["+a.Z()+"]",lB(a)}}finally{Po(a)}}}}function Po(a,h){if(a.g){uB(a);const f=a.g,w=a.v[0]?()=>{}:null;a.g=null,a.v=null,h||tt(a,"ready");try{f.onreadystatechange=w}catch{}}}function uB(a){a.I&&(o.clearTimeout(a.I),a.I=null)}A.isActive=function(){return!!this.g};function cA(a){return a.g?a.g.readyState:0}A.Z=function(){try{return 2<cA(this)?this.g.status:-1}catch{return-1}},A.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},A.Oa=function(a){if(this.g){var h=this.g.responseText;return a&&h.indexOf(a)==0&&(h=h.substring(a.length)),yR(h)}};function hB(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.H){case"":case"text":return a.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch{return null}}function KR(a){const h={};a=(a.g&&2<=cA(a)&&a.g.getAllResponseHeaders()||"").split(`\r
|
|
1175
|
+
`);for(let w=0;w<a.length;w++){if(Q(a[w]))continue;var f=U(a[w]);const T=f[0];if(f=f[1],typeof f!="string")continue;f=f.trim();const x=h[T]||[];h[T]=x,x.push(f)}_(h,function(w){return w.join(", ")})}A.Ba=function(){return this.m},A.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Us(a,h,f){return f&&f.internalChannelParams&&f.internalChannelParams[a]||h}function dB(a){this.Aa=0,this.i=[],this.j=new ms,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Us("failFast",!1,a),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Us("baseRetryDelayMs",5e3,a),this.cb=Us("retryDelaySeedMs",1e4,a),this.Wa=Us("forwardChannelMaxRetries",2,a),this.wa=Us("forwardChannelRequestTimeoutMs",2e4,a),this.pa=a&&a.xmlHttpFactory||void 0,this.Xa=a&&a.Tb||void 0,this.Ca=a&&a.useFetchStreams||!1,this.L=void 0,this.J=a&&a.supportsCrossDomainXhr||!1,this.K="",this.h=new qw(a&&a.concurrentRequestLimit),this.Da=new PR,this.P=a&&a.fastHandshake||!1,this.O=a&&a.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=a&&a.Rb||!1,a&&a.xa&&this.j.xa(),a&&a.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&a&&a.detectBufferingProxy||!1,this.ja=void 0,a&&a.longPollingTimeout&&0<a.longPollingTimeout&&(this.ja=a.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}A=dB.prototype,A.la=8,A.G=1,A.connect=function(a,h,f,w){At(0),this.W=a,this.H=h||{},f&&w!==void 0&&(this.H.OSID=f,this.H.OAID=w),this.F=this.X,this.I=_B(this,null,this.W),Vo(this)};function iu(a){if(fB(a),a.G==3){var h=a.U++,f=lA(a.I);if(ue(f,"SID",a.K),ue(f,"RID",h),ue(f,"TYPE","terminate"),Qs(a,f),h=new kA(a,a.j,h),h.L=2,h.v=Lo(lA(f)),f=!1,o.navigator&&o.navigator.sendBeacon)try{f=o.navigator.sendBeacon(h.v.toString(),"")}catch{}!f&&o.Image&&(new Image().src=h.v,f=!0),f||(h.g=CB(h.j,null),h.g.ea(h.v)),h.F=Date.now(),xo(h)}vB(a)}function No(a){a.g&&(au(a),a.g.cancel(),a.g=null)}function fB(a){No(a),a.u&&(o.clearTimeout(a.u),a.u=null),Mo(a),a.h.cancel(),a.s&&(typeof a.s=="number"&&o.clearTimeout(a.s),a.s=null)}function Vo(a){if(!Jw(a.h)&&!a.s){a.s=!0;var h=a.Ga;Qe||Ht(),ft||(Qe(),ft=!0),lt.add(h,a),a.B=0}}function GR(a,h){return Xw(a.h)>=a.h.j-(a.s?1:0)?!1:a.s?(a.i=h.D.concat(a.i),!0):a.G==1||a.G==2||a.B>=(a.Va?0:a.Wa)?!1:(a.s=Bs(g(a.Ga,a,h),yB(a,a.B)),a.B++,!0)}A.Ga=function(a){if(this.s)if(this.s=null,this.G==1){if(!a){this.U=Math.floor(1e5*Math.random()),a=this.U++;const T=new kA(this,this.j,a);let x=this.o;if(this.S&&(x?(x=m(x),b(x,this.S)):x=this.S),this.m!==null||this.O||(T.H=x,x=null),this.P)e:{for(var h=0,f=0;f<this.i.length;f++){t:{var w=this.i[f];if("__data__"in w.map&&(w=w.map.__data__,typeof w=="string")){w=w.length;break t}w=void 0}if(w===void 0)break;if(h+=w,4096<h){h=f;break e}if(h===4096||f===this.i.length-1){h=f+1;break e}}h=1e3}else h=1e3;h=pB(this,T,h),f=lA(this.I),ue(f,"RID",a),ue(f,"CVER",22),this.D&&ue(f,"X-HTTP-Session-Id",this.D),Qs(this,f),x&&(this.O?h="headers="+encodeURIComponent(String(oB(x)))+"&"+h:this.m&&su(f,this.m,x)),nu(this.h,T),this.Ua&&ue(f,"TYPE","init"),this.P?(ue(f,"$req",h),ue(f,"SID","null"),T.T=!0,eu(T,f,null)):eu(T,f,h),this.G=2}}else this.G==3&&(a?gB(this,a):this.i.length==0||Jw(this.h)||gB(this))};function gB(a,h){var f;h?f=h.l:f=a.U++;const w=lA(a.I);ue(w,"SID",a.K),ue(w,"RID",f),ue(w,"AID",a.T),Qs(a,w),a.m&&a.o&&su(w,a.m,a.o),f=new kA(a,a.j,f,a.B+1),a.m===null&&(f.H=a.o),h&&(a.i=h.D.concat(a.i)),h=pB(a,f,1e3),f.I=Math.round(.5*a.wa)+Math.round(.5*a.wa*Math.random()),nu(a.h,f),eu(f,w,h)}function Qs(a,h){a.H&&R(a.H,function(f,w){ue(h,w,f)}),a.l&&Zw({},function(f,w){ue(h,w,f)})}function pB(a,h,f){f=Math.min(a.i.length,f);var w=a.l?g(a.l.Na,a.l,a):null;e:{var T=a.i;let x=-1;for(;;){const O=["count="+f];x==-1?0<f?(x=T[0].g,O.push("ofs="+x)):x=0:O.push("ofs="+x);let ie=!0;for(let Pe=0;Pe<f;Pe++){let te=T[Pe].g;const Je=T[Pe].map;if(te-=x,0>te)x=Math.max(0,T[Pe].g-100),ie=!1;else try{NR(Je,O,"req"+te+"_")}catch{w&&w(Je)}}if(ie){w=O.join("&");break e}}}return a=a.i.splice(0,f),h.D=a,w}function wB(a){if(!a.g&&!a.u){a.Y=1;var h=a.Fa;Qe||Ht(),ft||(Qe(),ft=!0),lt.add(h,a),a.v=0}}function ou(a){return a.g||a.u||3<=a.v?!1:(a.Y++,a.u=Bs(g(a.Fa,a),yB(a,a.v)),a.v++,!0)}A.Fa=function(){if(this.u=null,BB(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var a=2*this.R;this.j.info("BP detection timer enabled: "+a),this.A=Bs(g(this.ab,this),a)}},A.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,At(10),No(this),BB(this))};function au(a){a.A!=null&&(o.clearTimeout(a.A),a.A=null)}function BB(a){a.g=new kA(a,a.j,"rpc",a.Y),a.m===null&&(a.g.H=a.o),a.g.O=0;var h=lA(a.qa);ue(h,"RID","rpc"),ue(h,"SID",a.K),ue(h,"AID",a.T),ue(h,"CI",a.F?"0":"1"),!a.F&&a.ja&&ue(h,"TO",a.ja),ue(h,"TYPE","xmlhttp"),Qs(a,h),a.m&&a.o&&su(h,a.m,a.o),a.L&&(a.g.I=a.L);var f=a.g;a=a.ia,f.L=1,f.v=Lo(lA(h)),f.m=null,f.P=!0,jw(f,a)}A.Za=function(){this.C!=null&&(this.C=null,No(this),ou(this),At(19))};function Mo(a){a.C!=null&&(o.clearTimeout(a.C),a.C=null)}function mB(a,h){var f=null;if(a.g==h){Mo(a),au(a),a.g=null;var w=2}else if(ru(a.h,h))f=h.D,zw(a.h,h),w=1;else return;if(a.G!=0){if(h.o)if(w==1){f=h.m?h.m.length:0,h=Date.now()-h.F;var T=a.B;w=To(),tt(w,new Vw(w,f)),Vo(a)}else wB(a);else if(T=h.s,T==3||T==0&&0<h.X||!(w==1&&GR(a,h)||w==2&&ou(a)))switch(f&&0<f.length&&(h=a.h,h.i=h.i.concat(f)),T){case 1:ur(a,5);break;case 4:ur(a,10);break;case 3:ur(a,6);break;default:ur(a,2)}}}function yB(a,h){let f=a.Ta+Math.floor(Math.random()*a.cb);return a.isActive()||(f*=2),f*h}function ur(a,h){if(a.j.info("Error code "+h),h==2){var f=g(a.fb,a),w=a.Xa;const T=!w;w=new cr(w||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||ko(w,"https"),Lo(w),T?DR(w.toString(),f):OR(w.toString(),f)}else At(2);a.G=0,a.l&&a.l.sa(h),vB(a),fB(a)}A.fb=function(a){a?(this.j.info("Successfully pinged google.com"),At(2)):(this.j.info("Failed to ping google.com"),At(1))};function vB(a){if(a.G=0,a.ka=[],a.l){const h=Yw(a.h);(h.length!=0||a.i.length!=0)&&(E(a.ka,h),E(a.ka,a.i),a.h.i.length=0,C(a.i),a.i.length=0),a.l.ra()}}function _B(a,h,f){var w=f instanceof cr?lA(f):new cr(f);if(w.g!="")h&&(w.g=h+"."+w.g),Ho(w,w.s);else{var T=o.location;w=T.protocol,h=h?h+"."+T.hostname:T.hostname,T=+T.port;var x=new cr(null);w&&ko(x,w),h&&(x.g=h),T&&Ho(x,T),f&&(x.l=f),w=x}return f=a.D,h=a.ya,f&&h&&ue(w,f,h),ue(w,"VER",a.la),Qs(a,w),w}function CB(a,h,f){if(h&&!a.J)throw Error("Can't create secondary domain capable XhrIo object.");return h=a.Ca&&!a.pa?new pe(new Do({eb:f})):new pe(a.pa),h.Ha(a.J),h}A.isActive=function(){return!!this.l&&this.l.isActive(this)};function EB(){}A=EB.prototype,A.ua=function(){},A.ta=function(){},A.sa=function(){},A.ra=function(){},A.isActive=function(){return!0},A.Na=function(){};function Ko(){}Ko.prototype.g=function(a,h){return new gt(a,h)};function gt(a,h){qe.call(this),this.g=new dB(h),this.l=a,this.h=h&&h.messageUrlParams||null,a=h&&h.messageHeaders||null,h&&h.clientProtocolHeaderRequired&&(a?a["X-Client-Protocol"]="webchannel":a={"X-Client-Protocol":"webchannel"}),this.g.o=a,a=h&&h.initMessageHeaders||null,h&&h.messageContentType&&(a?a["X-WebChannel-Content-Type"]=h.messageContentType:a={"X-WebChannel-Content-Type":h.messageContentType}),h&&h.va&&(a?a["X-WebChannel-Client-Profile"]=h.va:a={"X-WebChannel-Client-Profile":h.va}),this.g.S=a,(a=h&&h.Sb)&&!Q(a)&&(this.g.m=a),this.v=h&&h.supportsCrossDomainXhr||!1,this.u=h&&h.sendRawJson||!1,(h=h&&h.httpSessionIdParam)&&!Q(h)&&(this.g.D=h,a=this.h,a!==null&&h in a&&(a=this.h,h in a&&delete a[h])),this.j=new Zr(this)}B(gt,qe),gt.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},gt.prototype.close=function(){iu(this.g)},gt.prototype.o=function(a){var h=this.g;if(typeof a=="string"){var f={};f.__data__=a,a=f}else this.u&&(f={},f.__data__=qc(a),a=f);h.i.push(new QR(h.Ya++,a)),h.G==3&&Vo(h)},gt.prototype.N=function(){this.g.l=null,delete this.j,iu(this.g),delete this.g,gt.aa.N.call(this)};function bB(a){Xc.call(this),a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var h=a.__sm__;if(h){e:{for(const f in h){a=f;break e}a=void 0}(this.i=a)&&(a=this.i,h=h!==null&&a in h?h[a]:void 0),this.data=h}else this.data=a}B(bB,Xc);function UB(){zc.call(this),this.status=1}B(UB,zc);function Zr(a){this.g=a}B(Zr,EB),Zr.prototype.ua=function(){tt(this.g,"a")},Zr.prototype.ta=function(a){tt(this.g,new bB(a))},Zr.prototype.sa=function(a){tt(this.g,new UB)},Zr.prototype.ra=function(){tt(this.g,"b")},Ko.prototype.createWebChannel=Ko.prototype.g,gt.prototype.send=gt.prototype.o,gt.prototype.open=gt.prototype.m,gt.prototype.close=gt.prototype.close,Xd=function(){return new Ko},Jd=function(){return To()},qd=ar,rl={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},So.NO_ERROR=0,So.TIMEOUT=8,So.HTTP_ERROR=6,Ei=So,Mw.COMPLETE="complete",Wd=Mw,Dw.EventType=ps,ps.OPEN="a",ps.CLOSE="b",ps.ERROR="c",ps.MESSAGE="d",qe.prototype.listen=qe.prototype.K,Qn=Dw,pe.prototype.listenOnce=pe.prototype.L,pe.prototype.getLastError=pe.prototype.Ka,pe.prototype.getLastErrorCode=pe.prototype.Ba,pe.prototype.getStatus=pe.prototype.Z,pe.prototype.getResponseJson=pe.prototype.Oa,pe.prototype.getResponseText=pe.prototype.oa,pe.prototype.send=pe.prototype.ea,pe.prototype.setWithCredentials=pe.prototype.Ha,$d=pe}).apply(typeof Ci<"u"?Ci:typeof self<"u"?self:typeof window<"u"?window:{});const zd="@firebase/firestore";/**
|
|
1176
|
+
* @license
|
|
1177
|
+
* Copyright 2017 Google LLC
|
|
1178
|
+
*
|
|
1179
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1180
|
+
* you may not use this file except in compliance with the License.
|
|
1181
|
+
* You may obtain a copy of the License at
|
|
1182
|
+
*
|
|
1183
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1184
|
+
*
|
|
1185
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1186
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1187
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1188
|
+
* See the License for the specific language governing permissions and
|
|
1189
|
+
* limitations under the License.
|
|
1190
|
+
*/class Me{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Me.UNAUTHENTICATED=new Me(null),Me.GOOGLE_CREDENTIALS=new Me("google-credentials-uid"),Me.FIRST_PARTY=new Me("first-party-uid"),Me.MOCK_USER=new Me("mock-user");/**
|
|
1191
|
+
* @license
|
|
1192
|
+
* Copyright 2017 Google LLC
|
|
1193
|
+
*
|
|
1194
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1195
|
+
* you may not use this file except in compliance with the License.
|
|
1196
|
+
* You may obtain a copy of the License at
|
|
1197
|
+
*
|
|
1198
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1199
|
+
*
|
|
1200
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1201
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1202
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1203
|
+
* See the License for the specific language governing permissions and
|
|
1204
|
+
* limitations under the License.
|
|
1205
|
+
*/let Ur="10.14.0";/**
|
|
1206
|
+
* @license
|
|
1207
|
+
* Copyright 2017 Google LLC
|
|
1208
|
+
*
|
|
1209
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1210
|
+
* you may not use this file except in compliance with the License.
|
|
1211
|
+
* You may obtain a copy of the License at
|
|
1212
|
+
*
|
|
1213
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1214
|
+
*
|
|
1215
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1216
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1217
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1218
|
+
* See the License for the specific language governing permissions and
|
|
1219
|
+
* limitations under the License.
|
|
1220
|
+
*/const $A=new Qd("@firebase/firestore");function In(){return $A.logLevel}function G(A,...e){if($A.logLevel<=Z.DEBUG){const t=e.map(nl);$A.debug(`Firestore (${Ur}): ${A}`,...t)}}function tA(A,...e){if($A.logLevel<=Z.ERROR){const t=e.map(nl);$A.error(`Firestore (${Ur}): ${A}`,...t)}}function Qr(A,...e){if($A.logLevel<=Z.WARN){const t=e.map(nl);$A.warn(`Firestore (${Ur}): ${A}`,...t)}}function nl(A){if(typeof A=="string")return A;try{/**
|
|
1221
|
+
* @license
|
|
1222
|
+
* Copyright 2020 Google LLC
|
|
1223
|
+
*
|
|
1224
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1225
|
+
* you may not use this file except in compliance with the License.
|
|
1226
|
+
* You may obtain a copy of the License at
|
|
1227
|
+
*
|
|
1228
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1229
|
+
*
|
|
1230
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1231
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1232
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1233
|
+
* See the License for the specific language governing permissions and
|
|
1234
|
+
* limitations under the License.
|
|
1235
|
+
*/return function(t){return JSON.stringify(t)}(A)}catch{return A}}/**
|
|
1236
|
+
* @license
|
|
1237
|
+
* Copyright 2017 Google LLC
|
|
1238
|
+
*
|
|
1239
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1240
|
+
* you may not use this file except in compliance with the License.
|
|
1241
|
+
* You may obtain a copy of the License at
|
|
1242
|
+
*
|
|
1243
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1244
|
+
*
|
|
1245
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1246
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1247
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1248
|
+
* See the License for the specific language governing permissions and
|
|
1249
|
+
* limitations under the License.
|
|
1250
|
+
*/function W(A="Unexpected state"){const e=`FIRESTORE (${Ur}) INTERNAL ASSERTION FAILED: `+A;throw tA(e),new Error(e)}function re(A,e){A||W()}function q(A,e){return A}/**
|
|
1251
|
+
* @license
|
|
1252
|
+
* Copyright 2017 Google LLC
|
|
1253
|
+
*
|
|
1254
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1255
|
+
* you may not use this file except in compliance with the License.
|
|
1256
|
+
* You may obtain a copy of the License at
|
|
1257
|
+
*
|
|
1258
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1259
|
+
*
|
|
1260
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1261
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1262
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1263
|
+
* See the License for the specific language governing permissions and
|
|
1264
|
+
* limitations under the License.
|
|
1265
|
+
*/const L={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class M extends KA{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
|
|
1266
|
+
* @license
|
|
1267
|
+
* Copyright 2017 Google LLC
|
|
1268
|
+
*
|
|
1269
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1270
|
+
* you may not use this file except in compliance with the License.
|
|
1271
|
+
* You may obtain a copy of the License at
|
|
1272
|
+
*
|
|
1273
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1274
|
+
*
|
|
1275
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1276
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1277
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1278
|
+
* See the License for the specific language governing permissions and
|
|
1279
|
+
* limitations under the License.
|
|
1280
|
+
*/class EA{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
|
|
1281
|
+
* @license
|
|
1282
|
+
* Copyright 2017 Google LLC
|
|
1283
|
+
*
|
|
1284
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1285
|
+
* you may not use this file except in compliance with the License.
|
|
1286
|
+
* You may obtain a copy of the License at
|
|
1287
|
+
*
|
|
1288
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1289
|
+
*
|
|
1290
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1291
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1292
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1293
|
+
* See the License for the specific language governing permissions and
|
|
1294
|
+
* limitations under the License.
|
|
1295
|
+
*/class Yd{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class JE{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Me.UNAUTHENTICATED))}shutdown(){}}class XE{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class zE{constructor(e){this.t=e,this.currentUser=Me.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){re(this.o===void 0);let r=this.i;const n=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let s=new EA;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new EA,e.enqueueRetryable(()=>n(this.currentUser))};const i=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await n(this.currentUser)})},o=l=>{G("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),i())};this.t.onInit(l=>o(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?o(l):(G("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new EA)}},0),i()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.i!==e?(G("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(re(typeof r.accessToken=="string"),new Yd(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return re(e===null||typeof e=="string"),new Me(e)}}class YE{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=Me.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class ZE{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new YE(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(Me.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class eb{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class tb{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){re(this.o===void 0);const r=s=>{s.error!=null&&G("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const i=s.token!==this.R;return this.R=s.token,G("FirebaseAppCheckTokenProvider",`Received ${i?"new":"existing"} token.`),i?t(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const n=s=>{G("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>n(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?n(s):G("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(re(typeof t.token=="string"),this.R=t.token,new eb(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
|
|
1296
|
+
* @license
|
|
1297
|
+
* Copyright 2020 Google LLC
|
|
1298
|
+
*
|
|
1299
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1300
|
+
* you may not use this file except in compliance with the License.
|
|
1301
|
+
* You may obtain a copy of the License at
|
|
1302
|
+
*
|
|
1303
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1304
|
+
*
|
|
1305
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1306
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1307
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1308
|
+
* See the License for the specific language governing permissions and
|
|
1309
|
+
* limitations under the License.
|
|
1310
|
+
*/function Ab(A){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(A);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<A;r++)t[r]=Math.floor(256*Math.random());return t}/**
|
|
1311
|
+
* @license
|
|
1312
|
+
* Copyright 2017 Google LLC
|
|
1313
|
+
*
|
|
1314
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1315
|
+
* you may not use this file except in compliance with the License.
|
|
1316
|
+
* You may obtain a copy of the License at
|
|
1317
|
+
*
|
|
1318
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1319
|
+
*
|
|
1320
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1321
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1322
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1323
|
+
* See the License for the specific language governing permissions and
|
|
1324
|
+
* limitations under the License.
|
|
1325
|
+
*/class Zd{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const n=Ab(40);for(let s=0;s<n.length;++s)r.length<20&&n[s]<t&&(r+=e.charAt(n[s]%e.length))}return r}}function ee(A,e){return A<e?-1:A>e?1:0}function Ir(A,e,t){return A.length===e.length&&A.every((r,n)=>t(r,e[n]))}/**
|
|
1326
|
+
* @license
|
|
1327
|
+
* Copyright 2017 Google LLC
|
|
1328
|
+
*
|
|
1329
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1330
|
+
* you may not use this file except in compliance with the License.
|
|
1331
|
+
* You may obtain a copy of the License at
|
|
1332
|
+
*
|
|
1333
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1334
|
+
*
|
|
1335
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1336
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1337
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1338
|
+
* See the License for the specific language governing permissions and
|
|
1339
|
+
* limitations under the License.
|
|
1340
|
+
*/class Fe{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new M(L.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new M(L.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new M(L.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new M(L.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Fe.fromMillis(Date.now())}static fromDate(e){return Fe.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new Fe(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?ee(this.nanoseconds,e.nanoseconds):ee(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
|
|
1341
|
+
* @license
|
|
1342
|
+
* Copyright 2017 Google LLC
|
|
1343
|
+
*
|
|
1344
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1345
|
+
* you may not use this file except in compliance with the License.
|
|
1346
|
+
* You may obtain a copy of the License at
|
|
1347
|
+
*
|
|
1348
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1349
|
+
*
|
|
1350
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1351
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1352
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1353
|
+
* See the License for the specific language governing permissions and
|
|
1354
|
+
* limitations under the License.
|
|
1355
|
+
*/class J{constructor(e){this.timestamp=e}static fromTimestamp(e){return new J(e)}static min(){return new J(new Fe(0,0))}static max(){return new J(new Fe(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
|
|
1356
|
+
* @license
|
|
1357
|
+
* Copyright 2017 Google LLC
|
|
1358
|
+
*
|
|
1359
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1360
|
+
* you may not use this file except in compliance with the License.
|
|
1361
|
+
* You may obtain a copy of the License at
|
|
1362
|
+
*
|
|
1363
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1364
|
+
*
|
|
1365
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1366
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1367
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1368
|
+
* See the License for the specific language governing permissions and
|
|
1369
|
+
* limitations under the License.
|
|
1370
|
+
*/class Fn{constructor(e,t,r){t===void 0?t=0:t>e.length&&W(),r===void 0?r=e.length-t:r>e.length-t&&W(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return Fn.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Fn?e.forEach(r=>{t.push(r)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){const s=e.get(n),i=t.get(n);if(s<i)return-1;if(s>i)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ce extends Fn{construct(e,t,r){return new ce(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new M(L.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(n=>n.length>0))}return new ce(t)}static emptyPath(){return new ce([])}}const rb=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class He extends Fn{construct(e,t,r){return new He(e,t,r)}static isValidIdentifier(e){return rb.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),He.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new He(["__name__"])}static fromServerFormat(e){const t=[];let r="",n=0;const s=()=>{if(r.length===0)throw new M(L.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let i=!1;for(;n<e.length;){const o=e[n];if(o==="\\"){if(n+1===e.length)throw new M(L.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[n+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new M(L.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,n+=2}else o==="`"?(i=!i,n++):o!=="."||i?(r+=o,n++):(s(),n++)}if(s(),i)throw new M(L.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new He(t)}static emptyPath(){return new He([])}}/**
|
|
1371
|
+
* @license
|
|
1372
|
+
* Copyright 2017 Google LLC
|
|
1373
|
+
*
|
|
1374
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1375
|
+
* you may not use this file except in compliance with the License.
|
|
1376
|
+
* You may obtain a copy of the License at
|
|
1377
|
+
*
|
|
1378
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1379
|
+
*
|
|
1380
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1381
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1382
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1383
|
+
* See the License for the specific language governing permissions and
|
|
1384
|
+
* limitations under the License.
|
|
1385
|
+
*/class j{constructor(e){this.path=e}static fromPath(e){return new j(ce.fromString(e))}static fromName(e){return new j(ce.fromString(e).popFirst(5))}static empty(){return new j(ce.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&ce.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ce.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new j(new ce(e.slice()))}}function nb(A,e){const t=A.toTimestamp().seconds,r=A.toTimestamp().nanoseconds+1,n=J.fromTimestamp(r===1e9?new Fe(t+1,0):new Fe(t,r));return new bA(n,j.empty(),e)}function sb(A){return new bA(A.readTime,A.key,-1)}class bA{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new bA(J.min(),j.empty(),-1)}static max(){return new bA(J.max(),j.empty(),-1)}}function ib(A,e){let t=A.readTime.compareTo(e.readTime);return t!==0?t:(t=j.comparator(A.documentKey,e.documentKey),t!==0?t:ee(A.largestBatchId,e.largestBatchId))}/**
|
|
1386
|
+
* @license
|
|
1387
|
+
* Copyright 2020 Google LLC
|
|
1388
|
+
*
|
|
1389
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1390
|
+
* you may not use this file except in compliance with the License.
|
|
1391
|
+
* You may obtain a copy of the License at
|
|
1392
|
+
*
|
|
1393
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1394
|
+
*
|
|
1395
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1396
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1397
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1398
|
+
* See the License for the specific language governing permissions and
|
|
1399
|
+
* limitations under the License.
|
|
1400
|
+
*/const ob="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class ab{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
|
|
1401
|
+
* @license
|
|
1402
|
+
* Copyright 2017 Google LLC
|
|
1403
|
+
*
|
|
1404
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1405
|
+
* you may not use this file except in compliance with the License.
|
|
1406
|
+
* You may obtain a copy of the License at
|
|
1407
|
+
*
|
|
1408
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1409
|
+
*
|
|
1410
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1411
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1412
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1413
|
+
* See the License for the specific language governing permissions and
|
|
1414
|
+
* limitations under the License.
|
|
1415
|
+
*/async function Tn(A){if(A.code!==L.FAILED_PRECONDITION||A.message!==ob)throw A;G("LocalStore","Unexpectedly lost primary lease")}/**
|
|
1416
|
+
* @license
|
|
1417
|
+
* Copyright 2017 Google LLC
|
|
1418
|
+
*
|
|
1419
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1420
|
+
* you may not use this file except in compliance with the License.
|
|
1421
|
+
* You may obtain a copy of the License at
|
|
1422
|
+
*
|
|
1423
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1424
|
+
*
|
|
1425
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1426
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1427
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1428
|
+
* See the License for the specific language governing permissions and
|
|
1429
|
+
* limitations under the License.
|
|
1430
|
+
*/class D{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&W(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new D((r,n)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,n)},this.catchCallback=s=>{this.wrapFailure(t,s).next(r,n)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof D?t:D.resolve(t)}catch(t){return D.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):D.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):D.reject(t)}static resolve(e){return new D((t,r)=>{t(e)})}static reject(e){return new D((t,r)=>{r(e)})}static waitFor(e){return new D((t,r)=>{let n=0,s=0,i=!1;e.forEach(o=>{++n,o.next(()=>{++s,i&&s===n&&t()},l=>r(l))}),i=!0,s===n&&t()})}static or(e){let t=D.resolve(!1);for(const r of e)t=t.next(n=>n?D.resolve(n):r());return t}static forEach(e,t){const r=[];return e.forEach((n,s)=>{r.push(t.call(this,n,s))}),this.waitFor(r)}static mapArray(e,t){return new D((r,n)=>{const s=e.length,i=new Array(s);let o=0;for(let l=0;l<s;l++){const c=l;t(e[c]).next(u=>{i[c]=u,++o,o===s&&r(i)},u=>n(u))}})}static doWhile(e,t){return new D((r,n)=>{const s=()=>{e()===!0?t().next(()=>{s()},n):r()};s()})}}function lb(A){const e=A.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Sn(A){return A.name==="IndexedDbTransactionError"}/**
|
|
1431
|
+
* @license
|
|
1432
|
+
* Copyright 2018 Google LLC
|
|
1433
|
+
*
|
|
1434
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1435
|
+
* you may not use this file except in compliance with the License.
|
|
1436
|
+
* You may obtain a copy of the License at
|
|
1437
|
+
*
|
|
1438
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1439
|
+
*
|
|
1440
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1441
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1442
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1443
|
+
* See the License for the specific language governing permissions and
|
|
1444
|
+
* limitations under the License.
|
|
1445
|
+
*/class sl{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.ie(r),this.se=r=>t.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}sl.oe=-1;function bi(A){return A==null}function Ui(A){return A===0&&1/A==-1/0}function cb(A){return typeof A=="number"&&Number.isInteger(A)&&!Ui(A)&&A<=Number.MAX_SAFE_INTEGER&&A>=Number.MIN_SAFE_INTEGER}/**
|
|
1446
|
+
* @license
|
|
1447
|
+
* Copyright 2017 Google LLC
|
|
1448
|
+
*
|
|
1449
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1450
|
+
* you may not use this file except in compliance with the License.
|
|
1451
|
+
* You may obtain a copy of the License at
|
|
1452
|
+
*
|
|
1453
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1454
|
+
*
|
|
1455
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1456
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1457
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1458
|
+
* See the License for the specific language governing permissions and
|
|
1459
|
+
* limitations under the License.
|
|
1460
|
+
*/function ef(A){let e=0;for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&e++;return e}function WA(A,e){for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&e(t,A[t])}function tf(A){for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e))return!1;return!0}/**
|
|
1461
|
+
* @license
|
|
1462
|
+
* Copyright 2017 Google LLC
|
|
1463
|
+
*
|
|
1464
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1465
|
+
* you may not use this file except in compliance with the License.
|
|
1466
|
+
* You may obtain a copy of the License at
|
|
1467
|
+
*
|
|
1468
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1469
|
+
*
|
|
1470
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1471
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1472
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1473
|
+
* See the License for the specific language governing permissions and
|
|
1474
|
+
* limitations under the License.
|
|
1475
|
+
*/class de{constructor(e,t){this.comparator=e,this.root=t||Le.EMPTY}insert(e,t){return new de(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Le.BLACK,null,null))}remove(e){return new de(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Le.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const n=this.comparator(e,r.key);if(n===0)return t+r.left.size;n<0?r=r.left:(t+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){const e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Qi(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Qi(this.root,e,this.comparator,!1)}getReverseIterator(){return new Qi(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Qi(this.root,e,this.comparator,!0)}}class Qi{constructor(e,t,r,n){this.isReverse=n,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?r(e.key,t):1,t&&n&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Le{constructor(e,t,r,n,s){this.key=e,this.value=t,this.color=r??Le.RED,this.left=n??Le.EMPTY,this.right=s??Le.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,n,s){return new Le(e??this.key,t??this.value,r??this.color,n??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,r){let n=this;const s=r(e,n.key);return n=s<0?n.copy(null,null,null,n.left.insert(e,t,r),null):s===0?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(e,t,r)),n.fixUp()}removeMin(){if(this.left.isEmpty())return Le.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let r,n=this;if(t(e,n.key)<0)n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()||(n=n.moveRedLeft()),n=n.copy(null,null,null,n.left.remove(e,t),null);else{if(n.left.isRed()&&(n=n.rotateRight()),n.right.isEmpty()||n.right.isRed()||n.right.left.isRed()||(n=n.moveRedRight()),t(e,n.key)===0){if(n.right.isEmpty())return Le.EMPTY;r=n.right.min(),n=n.copy(r.key,r.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Le.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Le.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw W();const e=this.left.check();if(e!==this.right.check())throw W();return e+(this.isRed()?0:1)}}Le.EMPTY=null,Le.RED=!0,Le.BLACK=!1,Le.EMPTY=new class{constructor(){this.size=0}get key(){throw W()}get value(){throw W()}get color(){throw W()}get left(){throw W()}get right(){throw W()}copy(e,t,r,n,s){return this}insert(e,t,r){return new Le(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
|
|
1476
|
+
* @license
|
|
1477
|
+
* Copyright 2017 Google LLC
|
|
1478
|
+
*
|
|
1479
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1480
|
+
* you may not use this file except in compliance with the License.
|
|
1481
|
+
* You may obtain a copy of the License at
|
|
1482
|
+
*
|
|
1483
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1484
|
+
*
|
|
1485
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1486
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1487
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1488
|
+
* See the License for the specific language governing permissions and
|
|
1489
|
+
* limitations under the License.
|
|
1490
|
+
*/class De{constructor(e){this.comparator=e,this.data=new de(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const n=r.getNext();if(this.comparator(n.key,e[1])>=0)return;t(n.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Af(this.data.getIterator())}getIteratorFrom(e){return new Af(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(r=>{t=t.add(r)}),t}isEqual(e){if(!(e instanceof De)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const n=t.getNext().key,s=r.getNext().key;if(this.comparator(n,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new De(this.comparator);return t.data=e,t}}class Af{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
|
|
1491
|
+
* @license
|
|
1492
|
+
* Copyright 2020 Google LLC
|
|
1493
|
+
*
|
|
1494
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1495
|
+
* you may not use this file except in compliance with the License.
|
|
1496
|
+
* You may obtain a copy of the License at
|
|
1497
|
+
*
|
|
1498
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1499
|
+
*
|
|
1500
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1501
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1502
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1503
|
+
* See the License for the specific language governing permissions and
|
|
1504
|
+
* limitations under the License.
|
|
1505
|
+
*/class ut{constructor(e){this.fields=e,e.sort(He.comparator)}static empty(){return new ut([])}unionWith(e){let t=new De(He.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new ut(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Ir(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
|
|
1506
|
+
* @license
|
|
1507
|
+
* Copyright 2023 Google LLC
|
|
1508
|
+
*
|
|
1509
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1510
|
+
* you may not use this file except in compliance with the License.
|
|
1511
|
+
* You may obtain a copy of the License at
|
|
1512
|
+
*
|
|
1513
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1514
|
+
*
|
|
1515
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1516
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1517
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1518
|
+
* See the License for the specific language governing permissions and
|
|
1519
|
+
* limitations under the License.
|
|
1520
|
+
*/class rf extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
|
|
1521
|
+
* @license
|
|
1522
|
+
* Copyright 2020 Google LLC
|
|
1523
|
+
*
|
|
1524
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1525
|
+
* you may not use this file except in compliance with the License.
|
|
1526
|
+
* You may obtain a copy of the License at
|
|
1527
|
+
*
|
|
1528
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1529
|
+
*
|
|
1530
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1531
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1532
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1533
|
+
* See the License for the specific language governing permissions and
|
|
1534
|
+
* limitations under the License.
|
|
1535
|
+
*/class Oe{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(n){try{return atob(n)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new rf("Invalid base64 string: "+s):s}}(e);return new Oe(t)}static fromUint8Array(e){const t=function(n){let s="";for(let i=0;i<n.length;++i)s+=String.fromCharCode(n[i]);return s}(e);return new Oe(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return ee(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Oe.EMPTY_BYTE_STRING=new Oe("");const ub=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function UA(A){if(re(!!A),typeof A=="string"){let e=0;const t=ub.exec(A);if(re(!!t),t[1]){let n=t[1];n=(n+"000000000").substr(0,9),e=Number(n)}const r=new Date(A);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:me(A.seconds),nanos:me(A.nanos)}}function me(A){return typeof A=="number"?A:typeof A=="string"?Number(A):0}function qA(A){return typeof A=="string"?Oe.fromBase64String(A):Oe.fromUint8Array(A)}/**
|
|
1536
|
+
* @license
|
|
1537
|
+
* Copyright 2020 Google LLC
|
|
1538
|
+
*
|
|
1539
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1540
|
+
* you may not use this file except in compliance with the License.
|
|
1541
|
+
* You may obtain a copy of the License at
|
|
1542
|
+
*
|
|
1543
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1544
|
+
*
|
|
1545
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1546
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1547
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1548
|
+
* See the License for the specific language governing permissions and
|
|
1549
|
+
* limitations under the License.
|
|
1550
|
+
*/function il(A){var e,t;return((t=(((e=A==null?void 0:A.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function ol(A){const e=A.mapValue.fields.__previous_value__;return il(e)?ol(e):e}function Rn(A){const e=UA(A.mapValue.fields.__local_write_time__.timestampValue);return new Fe(e.seconds,e.nanos)}/**
|
|
1551
|
+
* @license
|
|
1552
|
+
* Copyright 2017 Google LLC
|
|
1553
|
+
*
|
|
1554
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1555
|
+
* you may not use this file except in compliance with the License.
|
|
1556
|
+
* You may obtain a copy of the License at
|
|
1557
|
+
*
|
|
1558
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1559
|
+
*
|
|
1560
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1561
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1562
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1563
|
+
* See the License for the specific language governing permissions and
|
|
1564
|
+
* limitations under the License.
|
|
1565
|
+
*/class hb{constructor(e,t,r,n,s,i,o,l,c){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=n,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.longPollingOptions=l,this.useFetchStreams=c}}class xn{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new xn("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof xn&&e.projectId===this.projectId&&e.database===this.database}}/**
|
|
1566
|
+
* @license
|
|
1567
|
+
* Copyright 2020 Google LLC
|
|
1568
|
+
*
|
|
1569
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1570
|
+
* you may not use this file except in compliance with the License.
|
|
1571
|
+
* You may obtain a copy of the License at
|
|
1572
|
+
*
|
|
1573
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1574
|
+
*
|
|
1575
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1576
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1577
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1578
|
+
* See the License for the specific language governing permissions and
|
|
1579
|
+
* limitations under the License.
|
|
1580
|
+
*/const Ii={mapValue:{}};function JA(A){return"nullValue"in A?0:"booleanValue"in A?1:"integerValue"in A||"doubleValue"in A?2:"timestampValue"in A?3:"stringValue"in A?5:"bytesValue"in A?6:"referenceValue"in A?7:"geoPointValue"in A?8:"arrayValue"in A?9:"mapValue"in A?il(A)?4:fb(A)?9007199254740991:db(A)?10:11:W()}function Vt(A,e){if(A===e)return!0;const t=JA(A);if(t!==JA(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return A.booleanValue===e.booleanValue;case 4:return Rn(A).isEqual(Rn(e));case 3:return function(n,s){if(typeof n.timestampValue=="string"&&typeof s.timestampValue=="string"&&n.timestampValue.length===s.timestampValue.length)return n.timestampValue===s.timestampValue;const i=UA(n.timestampValue),o=UA(s.timestampValue);return i.seconds===o.seconds&&i.nanos===o.nanos}(A,e);case 5:return A.stringValue===e.stringValue;case 6:return function(n,s){return qA(n.bytesValue).isEqual(qA(s.bytesValue))}(A,e);case 7:return A.referenceValue===e.referenceValue;case 8:return function(n,s){return me(n.geoPointValue.latitude)===me(s.geoPointValue.latitude)&&me(n.geoPointValue.longitude)===me(s.geoPointValue.longitude)}(A,e);case 2:return function(n,s){if("integerValue"in n&&"integerValue"in s)return me(n.integerValue)===me(s.integerValue);if("doubleValue"in n&&"doubleValue"in s){const i=me(n.doubleValue),o=me(s.doubleValue);return i===o?Ui(i)===Ui(o):isNaN(i)&&isNaN(o)}return!1}(A,e);case 9:return Ir(A.arrayValue.values||[],e.arrayValue.values||[],Vt);case 10:case 11:return function(n,s){const i=n.mapValue.fields||{},o=s.mapValue.fields||{};if(ef(i)!==ef(o))return!1;for(const l in i)if(i.hasOwnProperty(l)&&(o[l]===void 0||!Vt(i[l],o[l])))return!1;return!0}(A,e);default:return W()}}function kn(A,e){return(A.values||[]).find(t=>Vt(t,e))!==void 0}function Fr(A,e){if(A===e)return 0;const t=JA(A),r=JA(e);if(t!==r)return ee(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return ee(A.booleanValue,e.booleanValue);case 2:return function(s,i){const o=me(s.integerValue||s.doubleValue),l=me(i.integerValue||i.doubleValue);return o<l?-1:o>l?1:o===l?0:isNaN(o)?isNaN(l)?0:-1:1}(A,e);case 3:return nf(A.timestampValue,e.timestampValue);case 4:return nf(Rn(A),Rn(e));case 5:return ee(A.stringValue,e.stringValue);case 6:return function(s,i){const o=qA(s),l=qA(i);return o.compareTo(l)}(A.bytesValue,e.bytesValue);case 7:return function(s,i){const o=s.split("/"),l=i.split("/");for(let c=0;c<o.length&&c<l.length;c++){const u=ee(o[c],l[c]);if(u!==0)return u}return ee(o.length,l.length)}(A.referenceValue,e.referenceValue);case 8:return function(s,i){const o=ee(me(s.latitude),me(i.latitude));return o!==0?o:ee(me(s.longitude),me(i.longitude))}(A.geoPointValue,e.geoPointValue);case 9:return sf(A.arrayValue,e.arrayValue);case 10:return function(s,i){var o,l,c,u;const d=s.fields||{},g=i.fields||{},p=(o=d.value)===null||o===void 0?void 0:o.arrayValue,B=(l=g.value)===null||l===void 0?void 0:l.arrayValue,C=ee(((c=p==null?void 0:p.values)===null||c===void 0?void 0:c.length)||0,((u=B==null?void 0:B.values)===null||u===void 0?void 0:u.length)||0);return C!==0?C:sf(p,B)}(A.mapValue,e.mapValue);case 11:return function(s,i){if(s===Ii.mapValue&&i===Ii.mapValue)return 0;if(s===Ii.mapValue)return 1;if(i===Ii.mapValue)return-1;const o=s.fields||{},l=Object.keys(o),c=i.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let d=0;d<l.length&&d<u.length;++d){const g=ee(l[d],u[d]);if(g!==0)return g;const p=Fr(o[l[d]],c[u[d]]);if(p!==0)return p}return ee(l.length,u.length)}(A.mapValue,e.mapValue);default:throw W()}}function nf(A,e){if(typeof A=="string"&&typeof e=="string"&&A.length===e.length)return ee(A,e);const t=UA(A),r=UA(e),n=ee(t.seconds,r.seconds);return n!==0?n:ee(t.nanos,r.nanos)}function sf(A,e){const t=A.values||[],r=e.values||[];for(let n=0;n<t.length&&n<r.length;++n){const s=Fr(t[n],r[n]);if(s)return s}return ee(t.length,r.length)}function Tr(A){return al(A)}function al(A){return"nullValue"in A?"null":"booleanValue"in A?""+A.booleanValue:"integerValue"in A?""+A.integerValue:"doubleValue"in A?""+A.doubleValue:"timestampValue"in A?function(t){const r=UA(t);return`time(${r.seconds},${r.nanos})`}(A.timestampValue):"stringValue"in A?A.stringValue:"bytesValue"in A?function(t){return qA(t).toBase64()}(A.bytesValue):"referenceValue"in A?function(t){return j.fromName(t).toString()}(A.referenceValue):"geoPointValue"in A?function(t){return`geo(${t.latitude},${t.longitude})`}(A.geoPointValue):"arrayValue"in A?function(t){let r="[",n=!0;for(const s of t.values||[])n?n=!1:r+=",",r+=al(s);return r+"]"}(A.arrayValue):"mapValue"in A?function(t){const r=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const i of r)s?s=!1:n+=",",n+=`${i}:${al(t.fields[i])}`;return n+"}"}(A.mapValue):W()}function of(A,e){return{referenceValue:`projects/${A.projectId}/databases/${A.database}/documents/${e.path.canonicalString()}`}}function ll(A){return!!A&&"integerValue"in A}function cl(A){return!!A&&"arrayValue"in A}function af(A){return!!A&&"nullValue"in A}function lf(A){return!!A&&"doubleValue"in A&&isNaN(Number(A.doubleValue))}function Fi(A){return!!A&&"mapValue"in A}function db(A){var e,t;return((t=(((e=A==null?void 0:A.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="__vector__"}function Hn(A){if(A.geoPointValue)return{geoPointValue:Object.assign({},A.geoPointValue)};if(A.timestampValue&&typeof A.timestampValue=="object")return{timestampValue:Object.assign({},A.timestampValue)};if(A.mapValue){const e={mapValue:{fields:{}}};return WA(A.mapValue.fields,(t,r)=>e.mapValue.fields[t]=Hn(r)),e}if(A.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(A.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Hn(A.arrayValue.values[t]);return e}return Object.assign({},A)}function fb(A){return(((A.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
|
|
1581
|
+
* @license
|
|
1582
|
+
* Copyright 2017 Google LLC
|
|
1583
|
+
*
|
|
1584
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1585
|
+
* you may not use this file except in compliance with the License.
|
|
1586
|
+
* You may obtain a copy of the License at
|
|
1587
|
+
*
|
|
1588
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1589
|
+
*
|
|
1590
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1591
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1592
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1593
|
+
* See the License for the specific language governing permissions and
|
|
1594
|
+
* limitations under the License.
|
|
1595
|
+
*/class st{constructor(e){this.value=e}static empty(){return new st({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!Fi(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Hn(t)}setAll(e){let t=He.emptyPath(),r={},n=[];e.forEach((i,o)=>{if(!t.isImmediateParentOf(o)){const l=this.getFieldsMap(t);this.applyChanges(l,r,n),r={},n=[],t=o.popLast()}i?r[o.lastSegment()]=Hn(i):n.push(o.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,r,n)}delete(e){const t=this.field(e.popLast());Fi(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Vt(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let n=t.mapValue.fields[e.get(r)];Fi(n)&&n.mapValue.fields||(n={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=n),t=n}return t.mapValue.fields}applyChanges(e,t,r){WA(t,(n,s)=>e[n]=s);for(const n of r)delete e[n]}clone(){return new st(Hn(this.value))}}function cf(A){const e=[];return WA(A.fields,(t,r)=>{const n=new He([t]);if(Fi(r)){const s=cf(r.mapValue).fields;if(s.length===0)e.push(n);else for(const i of s)e.push(n.child(i))}else e.push(n)}),new ut(e)}/**
|
|
1596
|
+
* @license
|
|
1597
|
+
* Copyright 2017 Google LLC
|
|
1598
|
+
*
|
|
1599
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1600
|
+
* you may not use this file except in compliance with the License.
|
|
1601
|
+
* You may obtain a copy of the License at
|
|
1602
|
+
*
|
|
1603
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1604
|
+
*
|
|
1605
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1606
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1607
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1608
|
+
* See the License for the specific language governing permissions and
|
|
1609
|
+
* limitations under the License.
|
|
1610
|
+
*/class Ke{constructor(e,t,r,n,s,i,o){this.key=e,this.documentType=t,this.version=r,this.readTime=n,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(e){return new Ke(e,0,J.min(),J.min(),J.min(),st.empty(),0)}static newFoundDocument(e,t,r,n){return new Ke(e,1,t,J.min(),r,n,0)}static newNoDocument(e,t){return new Ke(e,2,t,J.min(),J.min(),st.empty(),0)}static newUnknownDocument(e,t){return new Ke(e,3,t,J.min(),J.min(),st.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(J.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=st.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=st.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=J.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Ke&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Ke(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
|
|
1611
|
+
* @license
|
|
1612
|
+
* Copyright 2022 Google LLC
|
|
1613
|
+
*
|
|
1614
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1615
|
+
* you may not use this file except in compliance with the License.
|
|
1616
|
+
* You may obtain a copy of the License at
|
|
1617
|
+
*
|
|
1618
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1619
|
+
*
|
|
1620
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1621
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1622
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1623
|
+
* See the License for the specific language governing permissions and
|
|
1624
|
+
* limitations under the License.
|
|
1625
|
+
*/class Ti{constructor(e,t){this.position=e,this.inclusive=t}}function uf(A,e,t){let r=0;for(let n=0;n<A.position.length;n++){const s=e[n],i=A.position[n];if(s.field.isKeyField()?r=j.comparator(j.fromName(i.referenceValue),t.key):r=Fr(i,t.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function hf(A,e){if(A===null)return e===null;if(e===null||A.inclusive!==e.inclusive||A.position.length!==e.position.length)return!1;for(let t=0;t<A.position.length;t++)if(!Vt(A.position[t],e.position[t]))return!1;return!0}/**
|
|
1626
|
+
* @license
|
|
1627
|
+
* Copyright 2022 Google LLC
|
|
1628
|
+
*
|
|
1629
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1630
|
+
* you may not use this file except in compliance with the License.
|
|
1631
|
+
* You may obtain a copy of the License at
|
|
1632
|
+
*
|
|
1633
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1634
|
+
*
|
|
1635
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1636
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1637
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1638
|
+
* See the License for the specific language governing permissions and
|
|
1639
|
+
* limitations under the License.
|
|
1640
|
+
*/class Si{constructor(e,t="asc"){this.field=e,this.dir=t}}function gb(A,e){return A.dir===e.dir&&A.field.isEqual(e.field)}/**
|
|
1641
|
+
* @license
|
|
1642
|
+
* Copyright 2022 Google LLC
|
|
1643
|
+
*
|
|
1644
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1645
|
+
* you may not use this file except in compliance with the License.
|
|
1646
|
+
* You may obtain a copy of the License at
|
|
1647
|
+
*
|
|
1648
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1649
|
+
*
|
|
1650
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1651
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1652
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1653
|
+
* See the License for the specific language governing permissions and
|
|
1654
|
+
* limitations under the License.
|
|
1655
|
+
*/class df{}class Ce extends df{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new wb(e,t,r):t==="array-contains"?new yb(e,r):t==="in"?new vb(e,r):t==="not-in"?new _b(e,r):t==="array-contains-any"?new Cb(e,r):new Ce(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new Bb(e,r):new mb(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(Fr(t,this.value)):t!==null&&JA(this.value)===JA(t)&&this.matchesComparison(Fr(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return W()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Qt extends df{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new Qt(e,t)}matches(e){return ff(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function ff(A){return A.op==="and"}function gf(A){return pb(A)&&ff(A)}function pb(A){for(const e of A.filters)if(e instanceof Qt)return!1;return!0}function ul(A){if(A instanceof Ce)return A.field.canonicalString()+A.op.toString()+Tr(A.value);if(gf(A))return A.filters.map(e=>ul(e)).join(",");{const e=A.filters.map(t=>ul(t)).join(",");return`${A.op}(${e})`}}function pf(A,e){return A instanceof Ce?function(r,n){return n instanceof Ce&&r.op===n.op&&r.field.isEqual(n.field)&&Vt(r.value,n.value)}(A,e):A instanceof Qt?function(r,n){return n instanceof Qt&&r.op===n.op&&r.filters.length===n.filters.length?r.filters.reduce((s,i,o)=>s&&pf(i,n.filters[o]),!0):!1}(A,e):void W()}function wf(A){return A instanceof Ce?function(t){return`${t.field.canonicalString()} ${t.op} ${Tr(t.value)}`}(A):A instanceof Qt?function(t){return t.op.toString()+" {"+t.getFilters().map(wf).join(" ,")+"}"}(A):"Filter"}class wb extends Ce{constructor(e,t,r){super(e,t,r),this.key=j.fromName(r.referenceValue)}matches(e){const t=j.comparator(e.key,this.key);return this.matchesComparison(t)}}class Bb extends Ce{constructor(e,t){super(e,"in",t),this.keys=Bf("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class mb extends Ce{constructor(e,t){super(e,"not-in",t),this.keys=Bf("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Bf(A,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>j.fromName(r.referenceValue))}class yb extends Ce{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return cl(t)&&kn(t.arrayValue,this.value)}}class vb extends Ce{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&kn(this.value.arrayValue,t)}}class _b extends Ce{constructor(e,t){super(e,"not-in",t)}matches(e){if(kn(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!kn(this.value.arrayValue,t)}}class Cb extends Ce{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!cl(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>kn(this.value.arrayValue,r))}}/**
|
|
1656
|
+
* @license
|
|
1657
|
+
* Copyright 2019 Google LLC
|
|
1658
|
+
*
|
|
1659
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1660
|
+
* you may not use this file except in compliance with the License.
|
|
1661
|
+
* You may obtain a copy of the License at
|
|
1662
|
+
*
|
|
1663
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1664
|
+
*
|
|
1665
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1666
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1667
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1668
|
+
* See the License for the specific language governing permissions and
|
|
1669
|
+
* limitations under the License.
|
|
1670
|
+
*/class Eb{constructor(e,t=null,r=[],n=[],s=null,i=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=n,this.limit=s,this.startAt=i,this.endAt=o,this.ue=null}}function mf(A,e=null,t=[],r=[],n=null,s=null,i=null){return new Eb(A,e,t,r,n,s,i)}function hl(A){const e=q(A);if(e.ue===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>ul(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),bi(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>Tr(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>Tr(r)).join(",")),e.ue=t}return e.ue}function dl(A,e){if(A.limit!==e.limit||A.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<A.orderBy.length;t++)if(!gb(A.orderBy[t],e.orderBy[t]))return!1;if(A.filters.length!==e.filters.length)return!1;for(let t=0;t<A.filters.length;t++)if(!pf(A.filters[t],e.filters[t]))return!1;return A.collectionGroup===e.collectionGroup&&!!A.path.isEqual(e.path)&&!!hf(A.startAt,e.startAt)&&hf(A.endAt,e.endAt)}function fl(A){return j.isDocumentKey(A.path)&&A.collectionGroup===null&&A.filters.length===0}/**
|
|
1671
|
+
* @license
|
|
1672
|
+
* Copyright 2017 Google LLC
|
|
1673
|
+
*
|
|
1674
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1675
|
+
* you may not use this file except in compliance with the License.
|
|
1676
|
+
* You may obtain a copy of the License at
|
|
1677
|
+
*
|
|
1678
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1679
|
+
*
|
|
1680
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1681
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1682
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
|
+
* See the License for the specific language governing permissions and
|
|
1684
|
+
* limitations under the License.
|
|
1685
|
+
*/class Ln{constructor(e,t=null,r=[],n=[],s=null,i="F",o=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=n,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function bb(A,e,t,r,n,s,i,o){return new Ln(A,e,t,r,n,s,i,o)}function gl(A){return new Ln(A)}function yf(A){return A.filters.length===0&&A.limit===null&&A.startAt==null&&A.endAt==null&&(A.explicitOrderBy.length===0||A.explicitOrderBy.length===1&&A.explicitOrderBy[0].field.isKeyField())}function vf(A){return A.collectionGroup!==null}function Dn(A){const e=q(A);if(e.ce===null){e.ce=[];const t=new Set;for(const s of e.explicitOrderBy)e.ce.push(s),t.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(i){let o=new De(He.comparator);return i.filters.forEach(l=>{l.getFlattenedFilters().forEach(c=>{c.isInequality()&&(o=o.add(c.field))})}),o})(e).forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.ce.push(new Si(s,r))}),t.has(He.keyField().canonicalString())||e.ce.push(new Si(He.keyField(),r))}return e.ce}function Mt(A){const e=q(A);return e.le||(e.le=Ub(e,Dn(A))),e.le}function Ub(A,e){if(A.limitType==="F")return mf(A.path,A.collectionGroup,e,A.filters,A.limit,A.startAt,A.endAt);{e=e.map(n=>{const s=n.dir==="desc"?"asc":"desc";return new Si(n.field,s)});const t=A.endAt?new Ti(A.endAt.position,A.endAt.inclusive):null,r=A.startAt?new Ti(A.startAt.position,A.startAt.inclusive):null;return mf(A.path,A.collectionGroup,e,A.filters,A.limit,t,r)}}function pl(A,e){const t=A.filters.concat([e]);return new Ln(A.path,A.collectionGroup,A.explicitOrderBy.slice(),t,A.limit,A.limitType,A.startAt,A.endAt)}function wl(A,e,t){return new Ln(A.path,A.collectionGroup,A.explicitOrderBy.slice(),A.filters.slice(),e,t,A.startAt,A.endAt)}function Ri(A,e){return dl(Mt(A),Mt(e))&&A.limitType===e.limitType}function _f(A){return`${hl(Mt(A))}|lt:${A.limitType}`}function Sr(A){return`Query(target=${function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(n=>wf(n)).join(", ")}]`),bi(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(n=>function(i){return`${i.field.canonicalString()} (${i.dir})`}(n)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(n=>Tr(n)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(n=>Tr(n)).join(",")),`Target(${r})`}(Mt(A))}; limitType=${A.limitType})`}function xi(A,e){return e.isFoundDocument()&&function(r,n){const s=n.key.path;return r.collectionGroup!==null?n.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):j.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(A,e)&&function(r,n){for(const s of Dn(r))if(!s.field.isKeyField()&&n.data.field(s.field)===null)return!1;return!0}(A,e)&&function(r,n){for(const s of r.filters)if(!s.matches(n))return!1;return!0}(A,e)&&function(r,n){return!(r.startAt&&!function(i,o,l){const c=uf(i,o,l);return i.inclusive?c<=0:c<0}(r.startAt,Dn(r),n)||r.endAt&&!function(i,o,l){const c=uf(i,o,l);return i.inclusive?c>=0:c>0}(r.endAt,Dn(r),n))}(A,e)}function Qb(A){return A.collectionGroup||(A.path.length%2==1?A.path.lastSegment():A.path.get(A.path.length-2))}function Cf(A){return(e,t)=>{let r=!1;for(const n of Dn(A)){const s=Ib(n,e,t);if(s!==0)return s;r=r||n.field.isKeyField()}return 0}}function Ib(A,e,t){const r=A.field.isKeyField()?j.comparator(e.key,t.key):function(s,i,o){const l=i.data.field(s),c=o.data.field(s);return l!==null&&c!==null?Fr(l,c):W()}(A.field,e,t);switch(A.dir){case"asc":return r;case"desc":return-1*r;default:return W()}}/**
|
|
1686
|
+
* @license
|
|
1687
|
+
* Copyright 2017 Google LLC
|
|
1688
|
+
*
|
|
1689
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1690
|
+
* you may not use this file except in compliance with the License.
|
|
1691
|
+
* You may obtain a copy of the License at
|
|
1692
|
+
*
|
|
1693
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1694
|
+
*
|
|
1695
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1696
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1697
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1698
|
+
* See the License for the specific language governing permissions and
|
|
1699
|
+
* limitations under the License.
|
|
1700
|
+
*/class Rr{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[n,s]of r)if(this.equalsFn(n,e))return s}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),n=this.inner[r];if(n===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return void(n[s]=[e,t]);n.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return r.length===1?delete this.inner[t]:r.splice(n,1),this.innerSize--,!0;return!1}forEach(e){WA(this.inner,(t,r)=>{for(const[n,s]of r)e(n,s)})}isEmpty(){return tf(this.inner)}size(){return this.innerSize}}/**
|
|
1701
|
+
* @license
|
|
1702
|
+
* Copyright 2017 Google LLC
|
|
1703
|
+
*
|
|
1704
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1705
|
+
* you may not use this file except in compliance with the License.
|
|
1706
|
+
* You may obtain a copy of the License at
|
|
1707
|
+
*
|
|
1708
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1709
|
+
*
|
|
1710
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1711
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1712
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1713
|
+
* See the License for the specific language governing permissions and
|
|
1714
|
+
* limitations under the License.
|
|
1715
|
+
*/const Fb=new de(j.comparator);function AA(){return Fb}const Ef=new de(j.comparator);function On(...A){let e=Ef;for(const t of A)e=e.insert(t.key,t);return e}function bf(A){let e=Ef;return A.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function XA(){return Pn()}function Uf(){return Pn()}function Pn(){return new Rr(A=>A.toString(),(A,e)=>A.isEqual(e))}const Tb=new de(j.comparator),Sb=new De(j.comparator);function z(...A){let e=Sb;for(const t of A)e=e.add(t);return e}const Rb=new De(ee);function xb(){return Rb}/**
|
|
1716
|
+
* @license
|
|
1717
|
+
* Copyright 2020 Google LLC
|
|
1718
|
+
*
|
|
1719
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1720
|
+
* you may not use this file except in compliance with the License.
|
|
1721
|
+
* You may obtain a copy of the License at
|
|
1722
|
+
*
|
|
1723
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1724
|
+
*
|
|
1725
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1726
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1727
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1728
|
+
* See the License for the specific language governing permissions and
|
|
1729
|
+
* limitations under the License.
|
|
1730
|
+
*/function Bl(A,e){if(A.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ui(e)?"-0":e}}function Qf(A){return{integerValue:""+A}}function kb(A,e){return cb(e)?Qf(e):Bl(A,e)}/**
|
|
1731
|
+
* @license
|
|
1732
|
+
* Copyright 2018 Google LLC
|
|
1733
|
+
*
|
|
1734
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1735
|
+
* you may not use this file except in compliance with the License.
|
|
1736
|
+
* You may obtain a copy of the License at
|
|
1737
|
+
*
|
|
1738
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1739
|
+
*
|
|
1740
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1741
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1742
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1743
|
+
* See the License for the specific language governing permissions and
|
|
1744
|
+
* limitations under the License.
|
|
1745
|
+
*/class ki{constructor(){this._=void 0}}function Hb(A,e,t){return A instanceof Hi?function(n,s){const i={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:n.seconds,nanos:n.nanoseconds}}}};return s&&il(s)&&(s=ol(s)),s&&(i.fields.__previous_value__=s),{mapValue:i}}(t,e):A instanceof Nn?Ff(A,e):A instanceof Vn?Tf(A,e):function(n,s){const i=If(n,s),o=Sf(i)+Sf(n.Pe);return ll(i)&&ll(n.Pe)?Qf(o):Bl(n.serializer,o)}(A,e)}function Lb(A,e,t){return A instanceof Nn?Ff(A,e):A instanceof Vn?Tf(A,e):t}function If(A,e){return A instanceof Li?function(r){return ll(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Hi extends ki{}class Nn extends ki{constructor(e){super(),this.elements=e}}function Ff(A,e){const t=Rf(e);for(const r of A.elements)t.some(n=>Vt(n,r))||t.push(r);return{arrayValue:{values:t}}}class Vn extends ki{constructor(e){super(),this.elements=e}}function Tf(A,e){let t=Rf(e);for(const r of A.elements)t=t.filter(n=>!Vt(n,r));return{arrayValue:{values:t}}}class Li extends ki{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function Sf(A){return me(A.integerValue||A.doubleValue)}function Rf(A){return cl(A)&&A.arrayValue.values?A.arrayValue.values.slice():[]}function Db(A,e){return A.field.isEqual(e.field)&&function(r,n){return r instanceof Nn&&n instanceof Nn||r instanceof Vn&&n instanceof Vn?Ir(r.elements,n.elements,Vt):r instanceof Li&&n instanceof Li?Vt(r.Pe,n.Pe):r instanceof Hi&&n instanceof Hi}(A.transform,e.transform)}class Ob{constructor(e,t){this.version=e,this.transformResults=t}}class It{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new It}static exists(e){return new It(void 0,e)}static updateTime(e){return new It(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Di(A,e){return A.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(A.updateTime):A.exists===void 0||A.exists===e.isFoundDocument()}class Oi{}function xf(A,e){if(!A.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return A.isNoDocument()?new ml(A.key,It.none()):new Kn(A.key,A.data,It.none());{const t=A.data,r=st.empty();let n=new De(He.comparator);for(let s of e.fields)if(!n.has(s)){let i=t.field(s);i===null&&s.length>1&&(s=s.popLast(),i=t.field(s)),i===null?r.delete(s):r.set(s,i),n=n.add(s)}return new QA(A.key,r,new ut(n.toArray()),It.none())}}function Pb(A,e,t){A instanceof Kn?function(n,s,i){const o=n.value.clone(),l=Lf(n.fieldTransforms,s,i.transformResults);o.setAll(l),s.convertToFoundDocument(i.version,o).setHasCommittedMutations()}(A,e,t):A instanceof QA?function(n,s,i){if(!Di(n.precondition,s))return void s.convertToUnknownDocument(i.version);const o=Lf(n.fieldTransforms,s,i.transformResults),l=s.data;l.setAll(Hf(n)),l.setAll(o),s.convertToFoundDocument(i.version,l).setHasCommittedMutations()}(A,e,t):function(n,s,i){s.convertToNoDocument(i.version).setHasCommittedMutations()}(0,e,t)}function Mn(A,e,t,r){return A instanceof Kn?function(s,i,o,l){if(!Di(s.precondition,i))return o;const c=s.value.clone(),u=Df(s.fieldTransforms,l,i);return c.setAll(u),i.convertToFoundDocument(i.version,c).setHasLocalMutations(),null}(A,e,t,r):A instanceof QA?function(s,i,o,l){if(!Di(s.precondition,i))return o;const c=Df(s.fieldTransforms,l,i),u=i.data;return u.setAll(Hf(s)),u.setAll(c),i.convertToFoundDocument(i.version,u).setHasLocalMutations(),o===null?null:o.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(d=>d.field))}(A,e,t,r):function(s,i,o){return Di(s.precondition,i)?(i.convertToNoDocument(i.version).setHasLocalMutations(),null):o}(A,e,t)}function Nb(A,e){let t=null;for(const r of A.fieldTransforms){const n=e.data.field(r.field),s=If(r.transform,n||null);s!=null&&(t===null&&(t=st.empty()),t.set(r.field,s))}return t||null}function kf(A,e){return A.type===e.type&&!!A.key.isEqual(e.key)&&!!A.precondition.isEqual(e.precondition)&&!!function(r,n){return r===void 0&&n===void 0||!(!r||!n)&&Ir(r,n,(s,i)=>Db(s,i))}(A.fieldTransforms,e.fieldTransforms)&&(A.type===0?A.value.isEqual(e.value):A.type!==1||A.data.isEqual(e.data)&&A.fieldMask.isEqual(e.fieldMask))}class Kn extends Oi{constructor(e,t,r,n=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}}class QA extends Oi{constructor(e,t,r,n,s=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=n,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Hf(A){const e=new Map;return A.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const r=A.data.field(t);e.set(t,r)}}),e}function Lf(A,e,t){const r=new Map;re(A.length===t.length);for(let n=0;n<t.length;n++){const s=A[n],i=s.transform,o=e.data.field(s.field);r.set(s.field,Lb(i,o,t[n]))}return r}function Df(A,e,t){const r=new Map;for(const n of A){const s=n.transform,i=t.data.field(n.field);r.set(n.field,Hb(s,i,e))}return r}class ml extends Oi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Vb extends Oi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
|
|
1746
|
+
* @license
|
|
1747
|
+
* Copyright 2017 Google LLC
|
|
1748
|
+
*
|
|
1749
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1750
|
+
* you may not use this file except in compliance with the License.
|
|
1751
|
+
* You may obtain a copy of the License at
|
|
1752
|
+
*
|
|
1753
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1754
|
+
*
|
|
1755
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1756
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1757
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1758
|
+
* See the License for the specific language governing permissions and
|
|
1759
|
+
* limitations under the License.
|
|
1760
|
+
*/class Mb{constructor(e,t,r,n){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=n}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let n=0;n<this.mutations.length;n++){const s=this.mutations[n];s.key.isEqual(e.key)&&Pb(s,e,r[n])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=Mn(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=Mn(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Uf();return this.mutations.forEach(n=>{const s=e.get(n.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=t.has(n.key)?null:o;const l=xf(i,o);l!==null&&r.set(n.key,l),i.isValidDocument()||i.convertToNoDocument(J.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),z())}isEqual(e){return this.batchId===e.batchId&&Ir(this.mutations,e.mutations,(t,r)=>kf(t,r))&&Ir(this.baseMutations,e.baseMutations,(t,r)=>kf(t,r))}}class yl{constructor(e,t,r,n){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=n}static from(e,t,r){re(e.mutations.length===r.length);let n=function(){return Tb}();const s=e.mutations;for(let i=0;i<s.length;i++)n=n.insert(s[i].key,r[i].version);return new yl(e,t,r,n)}}/**
|
|
1761
|
+
* @license
|
|
1762
|
+
* Copyright 2022 Google LLC
|
|
1763
|
+
*
|
|
1764
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1765
|
+
* you may not use this file except in compliance with the License.
|
|
1766
|
+
* You may obtain a copy of the License at
|
|
1767
|
+
*
|
|
1768
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1769
|
+
*
|
|
1770
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1771
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1772
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1773
|
+
* See the License for the specific language governing permissions and
|
|
1774
|
+
* limitations under the License.
|
|
1775
|
+
*/class Kb{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
1776
|
+
largestBatchId: ${this.largestBatchId},
|
|
1777
|
+
mutation: ${this.mutation.toString()}
|
|
1778
|
+
}`}}/**
|
|
1779
|
+
* @license
|
|
1780
|
+
* Copyright 2017 Google LLC
|
|
1781
|
+
*
|
|
1782
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1783
|
+
* you may not use this file except in compliance with the License.
|
|
1784
|
+
* You may obtain a copy of the License at
|
|
1785
|
+
*
|
|
1786
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1787
|
+
*
|
|
1788
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1789
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1790
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1791
|
+
* See the License for the specific language governing permissions and
|
|
1792
|
+
* limitations under the License.
|
|
1793
|
+
*/class Gb{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
|
|
1794
|
+
* @license
|
|
1795
|
+
* Copyright 2017 Google LLC
|
|
1796
|
+
*
|
|
1797
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1798
|
+
* you may not use this file except in compliance with the License.
|
|
1799
|
+
* You may obtain a copy of the License at
|
|
1800
|
+
*
|
|
1801
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1802
|
+
*
|
|
1803
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1804
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1805
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1806
|
+
* See the License for the specific language governing permissions and
|
|
1807
|
+
* limitations under the License.
|
|
1808
|
+
*/var Ee,Y;function jb(A){switch(A){default:return W();case L.CANCELLED:case L.UNKNOWN:case L.DEADLINE_EXCEEDED:case L.RESOURCE_EXHAUSTED:case L.INTERNAL:case L.UNAVAILABLE:case L.UNAUTHENTICATED:return!1;case L.INVALID_ARGUMENT:case L.NOT_FOUND:case L.ALREADY_EXISTS:case L.PERMISSION_DENIED:case L.FAILED_PRECONDITION:case L.ABORTED:case L.OUT_OF_RANGE:case L.UNIMPLEMENTED:case L.DATA_LOSS:return!0}}function Of(A){if(A===void 0)return tA("GRPC error has no .code"),L.UNKNOWN;switch(A){case Ee.OK:return L.OK;case Ee.CANCELLED:return L.CANCELLED;case Ee.UNKNOWN:return L.UNKNOWN;case Ee.DEADLINE_EXCEEDED:return L.DEADLINE_EXCEEDED;case Ee.RESOURCE_EXHAUSTED:return L.RESOURCE_EXHAUSTED;case Ee.INTERNAL:return L.INTERNAL;case Ee.UNAVAILABLE:return L.UNAVAILABLE;case Ee.UNAUTHENTICATED:return L.UNAUTHENTICATED;case Ee.INVALID_ARGUMENT:return L.INVALID_ARGUMENT;case Ee.NOT_FOUND:return L.NOT_FOUND;case Ee.ALREADY_EXISTS:return L.ALREADY_EXISTS;case Ee.PERMISSION_DENIED:return L.PERMISSION_DENIED;case Ee.FAILED_PRECONDITION:return L.FAILED_PRECONDITION;case Ee.ABORTED:return L.ABORTED;case Ee.OUT_OF_RANGE:return L.OUT_OF_RANGE;case Ee.UNIMPLEMENTED:return L.UNIMPLEMENTED;case Ee.DATA_LOSS:return L.DATA_LOSS;default:return W()}}(Y=Ee||(Ee={}))[Y.OK=0]="OK",Y[Y.CANCELLED=1]="CANCELLED",Y[Y.UNKNOWN=2]="UNKNOWN",Y[Y.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Y[Y.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Y[Y.NOT_FOUND=5]="NOT_FOUND",Y[Y.ALREADY_EXISTS=6]="ALREADY_EXISTS",Y[Y.PERMISSION_DENIED=7]="PERMISSION_DENIED",Y[Y.UNAUTHENTICATED=16]="UNAUTHENTICATED",Y[Y.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Y[Y.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Y[Y.ABORTED=10]="ABORTED",Y[Y.OUT_OF_RANGE=11]="OUT_OF_RANGE",Y[Y.UNIMPLEMENTED=12]="UNIMPLEMENTED",Y[Y.INTERNAL=13]="INTERNAL",Y[Y.UNAVAILABLE=14]="UNAVAILABLE",Y[Y.DATA_LOSS=15]="DATA_LOSS";/**
|
|
1809
|
+
* @license
|
|
1810
|
+
* Copyright 2023 Google LLC
|
|
1811
|
+
*
|
|
1812
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1813
|
+
* you may not use this file except in compliance with the License.
|
|
1814
|
+
* You may obtain a copy of the License at
|
|
1815
|
+
*
|
|
1816
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1817
|
+
*
|
|
1818
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1819
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1820
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1821
|
+
* See the License for the specific language governing permissions and
|
|
1822
|
+
* limitations under the License.
|
|
1823
|
+
*/function $b(){return new TextEncoder}/**
|
|
1824
|
+
* @license
|
|
1825
|
+
* Copyright 2022 Google LLC
|
|
1826
|
+
*
|
|
1827
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1828
|
+
* you may not use this file except in compliance with the License.
|
|
1829
|
+
* You may obtain a copy of the License at
|
|
1830
|
+
*
|
|
1831
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1832
|
+
*
|
|
1833
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1834
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1835
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1836
|
+
* See the License for the specific language governing permissions and
|
|
1837
|
+
* limitations under the License.
|
|
1838
|
+
*/const Wb=new jA([4294967295,4294967295],0);function Pf(A){const e=$b().encode(A),t=new jd;return t.update(e),new Uint8Array(t.digest())}function Nf(A){const e=new DataView(A.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),n=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new jA([t,r],0),new jA([n,s],0)]}class vl{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new Gn(`Invalid padding: ${t}`);if(r<0)throw new Gn(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Gn(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new Gn(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=jA.fromNumber(this.Ie)}Ee(e,t,r){let n=e.add(t.multiply(jA.fromNumber(r)));return n.compare(Wb)===1&&(n=new jA([n.getBits(0),n.getBits(1)],0)),n.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Ie===0)return!1;const t=Pf(e),[r,n]=Nf(t);for(let s=0;s<this.hashCount;s++){const i=this.Ee(r,n,s);if(!this.de(i))return!1}return!0}static create(e,t,r){const n=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),i=new vl(s,n,t);return r.forEach(o=>i.insert(o)),i}insert(e){if(this.Ie===0)return;const t=Pf(e),[r,n]=Nf(t);for(let s=0;s<this.hashCount;s++){const i=this.Ee(r,n,s);this.Ae(i)}}Ae(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class Gn extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
|
|
1839
|
+
* @license
|
|
1840
|
+
* Copyright 2017 Google LLC
|
|
1841
|
+
*
|
|
1842
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1843
|
+
* you may not use this file except in compliance with the License.
|
|
1844
|
+
* You may obtain a copy of the License at
|
|
1845
|
+
*
|
|
1846
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1847
|
+
*
|
|
1848
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1849
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1850
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1851
|
+
* See the License for the specific language governing permissions and
|
|
1852
|
+
* limitations under the License.
|
|
1853
|
+
*/class Pi{constructor(e,t,r,n,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=n,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const n=new Map;return n.set(e,jn.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new Pi(J.min(),n,new de(ee),AA(),z())}}class jn{constructor(e,t,r,n,s){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=n,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new jn(r,t,z(),z(),z())}}/**
|
|
1854
|
+
* @license
|
|
1855
|
+
* Copyright 2017 Google LLC
|
|
1856
|
+
*
|
|
1857
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1858
|
+
* you may not use this file except in compliance with the License.
|
|
1859
|
+
* You may obtain a copy of the License at
|
|
1860
|
+
*
|
|
1861
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1862
|
+
*
|
|
1863
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1864
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1865
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1866
|
+
* See the License for the specific language governing permissions and
|
|
1867
|
+
* limitations under the License.
|
|
1868
|
+
*/class Ni{constructor(e,t,r,n){this.Re=e,this.removedTargetIds=t,this.key=r,this.Ve=n}}class Vf{constructor(e,t){this.targetId=e,this.me=t}}class Mf{constructor(e,t,r=Oe.EMPTY_BYTE_STRING,n=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=n}}class Kf{constructor(){this.fe=0,this.ge=jf(),this.pe=Oe.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=z(),t=z(),r=z();return this.ge.forEach((n,s)=>{switch(s){case 0:e=e.add(n);break;case 2:t=t.add(n);break;case 1:r=r.add(n);break;default:W()}}),new jn(this.pe,this.ye,e,t,r)}Ce(){this.we=!1,this.ge=jf()}Fe(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,re(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class qb{constructor(e){this.Le=e,this.Be=new Map,this.ke=AA(),this.qe=Gf(),this.Qe=new de(ee)}Ke(e){for(const t of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(t,e.Ve):this.Ue(t,e.key,e.Ve);for(const t of e.removedTargetIds)this.Ue(t,e.key,e.Ve)}We(e){this.forEachTarget(e,t=>{const r=this.Ge(t);switch(e.state){case 0:this.ze(t)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(t);break;case 3:this.ze(t)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(t)&&(this.je(t),r.De(e.resumeToken));break;default:W()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach((r,n)=>{this.ze(n)&&t(n)})}He(e){const t=e.targetId,r=e.me.count,n=this.Je(t);if(n){const s=n.target;if(fl(s))if(r===0){const i=new j(s.path);this.Ue(t,i,Ke.newNoDocument(i,J.min()))}else re(r===1);else{const i=this.Ye(t);if(i!==r){const o=this.Ze(e),l=o?this.Xe(o,e,i):1;if(l!==0){this.je(t);const c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,c)}}}}}Ze(e){const t=e.me.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:n=0},hashCount:s=0}=t;let i,o;try{i=qA(r).toUint8Array()}catch(l){if(l instanceof rf)return Qr("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{o=new vl(i,n,s)}catch(l){return Qr(l instanceof Gn?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return o.Ie===0?null:o}Xe(e,t,r){return t.me.count===r-this.nt(e,t.targetId)?0:2}nt(e,t){const r=this.Le.getRemoteKeysForTarget(t);let n=0;return r.forEach(s=>{const i=this.Le.tt(),o=`projects/${i.projectId}/databases/${i.database}/documents/${s.path.canonicalString()}`;e.mightContain(o)||(this.Ue(t,s,null),n++)}),n}rt(e){const t=new Map;this.Be.forEach((s,i)=>{const o=this.Je(i);if(o){if(s.current&&fl(o.target)){const l=new j(o.target.path);this.ke.get(l)!==null||this.it(i,l)||this.Ue(i,l,Ke.newNoDocument(l,e))}s.be&&(t.set(i,s.ve()),s.Ce())}});let r=z();this.qe.forEach((s,i)=>{let o=!0;i.forEachWhile(l=>{const c=this.Je(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(o=!1,!1)}),o&&(r=r.add(s))}),this.ke.forEach((s,i)=>i.setReadTime(e));const n=new Pi(e,t,this.Qe,this.ke,r);return this.ke=AA(),this.qe=Gf(),this.Qe=new de(ee),n}$e(e,t){if(!this.ze(e))return;const r=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,r),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}Ue(e,t,r){if(!this.ze(e))return;const n=this.Ge(e);this.it(e,t)?n.Fe(t,1):n.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),r&&(this.ke=this.ke.insert(t,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const t=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let t=this.Be.get(e);return t||(t=new Kf,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new De(ee),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||G("WatchChangeAggregator","Detected inactive target",e),t}Je(e){const t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new Kf),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function Gf(){return new de(j.comparator)}function jf(){return new de(j.comparator)}const Jb={asc:"ASCENDING",desc:"DESCENDING"},Xb={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},zb={and:"AND",or:"OR"};class Yb{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function _l(A,e){return A.useProto3Json||bi(e)?e:{value:e}}function Vi(A,e){return A.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function $f(A,e){return A.useProto3Json?e.toBase64():e.toUint8Array()}function Zb(A,e){return Vi(A,e.toTimestamp())}function Kt(A){return re(!!A),J.fromTimestamp(function(t){const r=UA(t);return new Fe(r.seconds,r.nanos)}(A))}function Cl(A,e){return El(A,e).canonicalString()}function El(A,e){const t=function(n){return new ce(["projects",n.projectId,"databases",n.database])}(A).child("documents");return e===void 0?t:t.child(e)}function Wf(A){const e=ce.fromString(A);return re(Zf(e)),e}function bl(A,e){return Cl(A.databaseId,e.path)}function Ul(A,e){const t=Wf(e);if(t.get(1)!==A.databaseId.projectId)throw new M(L.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+A.databaseId.projectId);if(t.get(3)!==A.databaseId.database)throw new M(L.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+A.databaseId.database);return new j(Jf(t))}function qf(A,e){return Cl(A.databaseId,e)}function eU(A){const e=Wf(A);return e.length===4?ce.emptyPath():Jf(e)}function Ql(A){return new ce(["projects",A.databaseId.projectId,"databases",A.databaseId.database]).canonicalString()}function Jf(A){return re(A.length>4&&A.get(4)==="documents"),A.popFirst(5)}function Xf(A,e,t){return{name:bl(A,e),fields:t.value.mapValue.fields}}function tU(A,e){let t;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:W()}(e.targetChange.targetChangeType||"NO_CHANGE"),n=e.targetChange.targetIds||[],s=function(c,u){return c.useProto3Json?(re(u===void 0||typeof u=="string"),Oe.fromBase64String(u||"")):(re(u===void 0||u instanceof Buffer||u instanceof Uint8Array),Oe.fromUint8Array(u||new Uint8Array))}(A,e.targetChange.resumeToken),i=e.targetChange.cause,o=i&&function(c){const u=c.code===void 0?L.UNKNOWN:Of(c.code);return new M(u,c.message||"")}(i);t=new Mf(r,n,s,o||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const n=Ul(A,r.document.name),s=Kt(r.document.updateTime),i=r.document.createTime?Kt(r.document.createTime):J.min(),o=new st({mapValue:{fields:r.document.fields}}),l=Ke.newFoundDocument(n,s,i,o),c=r.targetIds||[],u=r.removedTargetIds||[];t=new Ni(c,u,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const n=Ul(A,r.document),s=r.readTime?Kt(r.readTime):J.min(),i=Ke.newNoDocument(n,s),o=r.removedTargetIds||[];t=new Ni([],o,i.key,i)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const n=Ul(A,r.document),s=r.removedTargetIds||[];t=new Ni([],s,n,null)}else{if(!("filter"in e))return W();{e.filter;const r=e.filter;r.targetId;const{count:n=0,unchangedNames:s}=r,i=new Gb(n,s),o=r.targetId;t=new Vf(o,i)}}return t}function AU(A,e){let t;if(e instanceof Kn)t={update:Xf(A,e.key,e.value)};else if(e instanceof ml)t={delete:bl(A,e.key)};else if(e instanceof QA)t={update:Xf(A,e.key,e.data),updateMask:uU(e.fieldMask)};else{if(!(e instanceof Vb))return W();t={verify:bl(A,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(s,i){const o=i.transform;if(o instanceof Hi)return{fieldPath:i.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(o instanceof Nn)return{fieldPath:i.field.canonicalString(),appendMissingElements:{values:o.elements}};if(o instanceof Vn)return{fieldPath:i.field.canonicalString(),removeAllFromArray:{values:o.elements}};if(o instanceof Li)return{fieldPath:i.field.canonicalString(),increment:o.Pe};throw W()}(0,r))),e.precondition.isNone||(t.currentDocument=function(n,s){return s.updateTime!==void 0?{updateTime:Zb(n,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:W()}(A,e.precondition)),t}function rU(A,e){return A&&A.length>0?(re(e!==void 0),A.map(t=>function(n,s){let i=n.updateTime?Kt(n.updateTime):Kt(s);return i.isEqual(J.min())&&(i=Kt(s)),new Ob(i,n.transformResults||[])}(t,e))):[]}function nU(A,e){return{documents:[qf(A,e.path)]}}function sU(A,e){const t={structuredQuery:{}},r=e.path;let n;e.collectionGroup!==null?(n=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=qf(A,n);const s=function(c){if(c.length!==0)return Yf(Qt.create(c,"and"))}(e.filters);s&&(t.structuredQuery.where=s);const i=function(c){if(c.length!==0)return c.map(u=>function(g){return{field:xr(g.field),direction:aU(g.dir)}}(u))}(e.orderBy);i&&(t.structuredQuery.orderBy=i);const o=_l(A,e.limit);return o!==null&&(t.structuredQuery.limit=o),e.startAt&&(t.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{_t:t,parent:n}}function iU(A){let e=eU(A.parent);const t=A.structuredQuery,r=t.from?t.from.length:0;let n=null;if(r>0){re(r===1);const u=t.from[0];u.allDescendants?n=u.collectionId:e=e.child(u.collectionId)}let s=[];t.where&&(s=function(d){const g=zf(d);return g instanceof Qt&&gf(g)?g.getFilters():[g]}(t.where));let i=[];t.orderBy&&(i=function(d){return d.map(g=>function(B){return new Si(kr(B.field),function(E){switch(E){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(B.direction))}(g))}(t.orderBy));let o=null;t.limit&&(o=function(d){let g;return g=typeof d=="object"?d.value:d,bi(g)?null:g}(t.limit));let l=null;t.startAt&&(l=function(d){const g=!!d.before,p=d.values||[];return new Ti(p,g)}(t.startAt));let c=null;return t.endAt&&(c=function(d){const g=!d.before,p=d.values||[];return new Ti(p,g)}(t.endAt)),bb(e,n,i,s,o,"F",l,c)}function oU(A,e){const t=function(n){switch(n){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return W()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function zf(A){return A.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=kr(t.unaryFilter.field);return Ce.create(r,"==",{doubleValue:NaN});case"IS_NULL":const n=kr(t.unaryFilter.field);return Ce.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=kr(t.unaryFilter.field);return Ce.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=kr(t.unaryFilter.field);return Ce.create(i,"!=",{nullValue:"NULL_VALUE"});default:return W()}}(A):A.fieldFilter!==void 0?function(t){return Ce.create(kr(t.fieldFilter.field),function(n){switch(n){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return W()}}(t.fieldFilter.op),t.fieldFilter.value)}(A):A.compositeFilter!==void 0?function(t){return Qt.create(t.compositeFilter.filters.map(r=>zf(r)),function(n){switch(n){case"AND":return"and";case"OR":return"or";default:return W()}}(t.compositeFilter.op))}(A):W()}function aU(A){return Jb[A]}function lU(A){return Xb[A]}function cU(A){return zb[A]}function xr(A){return{fieldPath:A.canonicalString()}}function kr(A){return He.fromServerFormat(A.fieldPath)}function Yf(A){return A instanceof Ce?function(t){if(t.op==="=="){if(lf(t.value))return{unaryFilter:{field:xr(t.field),op:"IS_NAN"}};if(af(t.value))return{unaryFilter:{field:xr(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(lf(t.value))return{unaryFilter:{field:xr(t.field),op:"IS_NOT_NAN"}};if(af(t.value))return{unaryFilter:{field:xr(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:xr(t.field),op:lU(t.op),value:t.value}}}(A):A instanceof Qt?function(t){const r=t.getFilters().map(n=>Yf(n));return r.length===1?r[0]:{compositeFilter:{op:cU(t.op),filters:r}}}(A):W()}function uU(A){const e=[];return A.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Zf(A){return A.length>=4&&A.get(0)==="projects"&&A.get(2)==="databases"}/**
|
|
1869
|
+
* @license
|
|
1870
|
+
* Copyright 2017 Google LLC
|
|
1871
|
+
*
|
|
1872
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1873
|
+
* you may not use this file except in compliance with the License.
|
|
1874
|
+
* You may obtain a copy of the License at
|
|
1875
|
+
*
|
|
1876
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1877
|
+
*
|
|
1878
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1879
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1880
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1881
|
+
* See the License for the specific language governing permissions and
|
|
1882
|
+
* limitations under the License.
|
|
1883
|
+
*/class IA{constructor(e,t,r,n,s=J.min(),i=J.min(),o=Oe.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=n,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o,this.expectedCount=l}withSequenceNumber(e){return new IA(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new IA(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new IA(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new IA(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
|
|
1884
|
+
* @license
|
|
1885
|
+
* Copyright 2017 Google LLC
|
|
1886
|
+
*
|
|
1887
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1888
|
+
* you may not use this file except in compliance with the License.
|
|
1889
|
+
* You may obtain a copy of the License at
|
|
1890
|
+
*
|
|
1891
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1892
|
+
*
|
|
1893
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1894
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1895
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1896
|
+
* See the License for the specific language governing permissions and
|
|
1897
|
+
* limitations under the License.
|
|
1898
|
+
*/class hU{constructor(e){this.ct=e}}function dU(A){const e=iU({parent:A.parent,structuredQuery:A.structuredQuery});return A.limitType==="LAST"?wl(e,e.limit,"L"):e}/**
|
|
1899
|
+
* @license
|
|
1900
|
+
* Copyright 2019 Google LLC
|
|
1901
|
+
*
|
|
1902
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1903
|
+
* you may not use this file except in compliance with the License.
|
|
1904
|
+
* You may obtain a copy of the License at
|
|
1905
|
+
*
|
|
1906
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1907
|
+
*
|
|
1908
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1909
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1910
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1911
|
+
* See the License for the specific language governing permissions and
|
|
1912
|
+
* limitations under the License.
|
|
1913
|
+
*/class fU{constructor(){this.un=new gU}addToCollectionParentIndex(e,t){return this.un.add(t),D.resolve()}getCollectionParents(e,t){return D.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return D.resolve()}deleteFieldIndex(e,t){return D.resolve()}deleteAllFieldIndexes(e){return D.resolve()}createTargetIndexes(e,t){return D.resolve()}getDocumentsMatchingTarget(e,t){return D.resolve(null)}getIndexType(e,t){return D.resolve(0)}getFieldIndexes(e,t){return D.resolve([])}getNextCollectionGroupToUpdate(e){return D.resolve(null)}getMinOffset(e,t){return D.resolve(bA.min())}getMinOffsetFromCollectionGroup(e,t){return D.resolve(bA.min())}updateCollectionGroup(e,t,r){return D.resolve()}updateIndexEntries(e,t){return D.resolve()}}class gU{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),n=this.index[t]||new De(ce.comparator),s=!n.has(r);return this.index[t]=n.add(r),s}has(e){const t=e.lastSegment(),r=e.popLast(),n=this.index[t];return n&&n.has(r)}getEntries(e){return(this.index[e]||new De(ce.comparator)).toArray()}}/**
|
|
1914
|
+
* @license
|
|
1915
|
+
* Copyright 2017 Google LLC
|
|
1916
|
+
*
|
|
1917
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1918
|
+
* you may not use this file except in compliance with the License.
|
|
1919
|
+
* You may obtain a copy of the License at
|
|
1920
|
+
*
|
|
1921
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1922
|
+
*
|
|
1923
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1924
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1925
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1926
|
+
* See the License for the specific language governing permissions and
|
|
1927
|
+
* limitations under the License.
|
|
1928
|
+
*/class Hr{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new Hr(0)}static kn(){return new Hr(-1)}}/**
|
|
1929
|
+
* @license
|
|
1930
|
+
* Copyright 2017 Google LLC
|
|
1931
|
+
*
|
|
1932
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1933
|
+
* you may not use this file except in compliance with the License.
|
|
1934
|
+
* You may obtain a copy of the License at
|
|
1935
|
+
*
|
|
1936
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1937
|
+
*
|
|
1938
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1939
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1940
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1941
|
+
* See the License for the specific language governing permissions and
|
|
1942
|
+
* limitations under the License.
|
|
1943
|
+
*/class pU{constructor(){this.changes=new Rr(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Ke.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?D.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
|
|
1944
|
+
* @license
|
|
1945
|
+
* Copyright 2017 Google LLC
|
|
1946
|
+
*
|
|
1947
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1948
|
+
* you may not use this file except in compliance with the License.
|
|
1949
|
+
* You may obtain a copy of the License at
|
|
1950
|
+
*
|
|
1951
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1952
|
+
*
|
|
1953
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1954
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1955
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1956
|
+
* See the License for the specific language governing permissions and
|
|
1957
|
+
* limitations under the License.
|
|
1958
|
+
*//**
|
|
1959
|
+
* @license
|
|
1960
|
+
* Copyright 2022 Google LLC
|
|
1961
|
+
*
|
|
1962
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1963
|
+
* you may not use this file except in compliance with the License.
|
|
1964
|
+
* You may obtain a copy of the License at
|
|
1965
|
+
*
|
|
1966
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1967
|
+
*
|
|
1968
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1969
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1970
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1971
|
+
* See the License for the specific language governing permissions and
|
|
1972
|
+
* limitations under the License.
|
|
1973
|
+
*/class wU{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
|
|
1974
|
+
* @license
|
|
1975
|
+
* Copyright 2017 Google LLC
|
|
1976
|
+
*
|
|
1977
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1978
|
+
* you may not use this file except in compliance with the License.
|
|
1979
|
+
* You may obtain a copy of the License at
|
|
1980
|
+
*
|
|
1981
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1982
|
+
*
|
|
1983
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1984
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1985
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1986
|
+
* See the License for the specific language governing permissions and
|
|
1987
|
+
* limitations under the License.
|
|
1988
|
+
*/class BU{constructor(e,t,r,n){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=n}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(n=>(r=n,this.remoteDocumentCache.getEntry(e,t))).next(n=>(r!==null&&Mn(r.mutation,n,ut.empty(),Fe.now()),n))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,z()).next(()=>r))}getLocalViewOfDocuments(e,t,r=z()){const n=XA();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,r).next(s=>{let i=On();return s.forEach((o,l)=>{i=i.insert(o,l.overlayedDocument)}),i}))}getOverlayedDocuments(e,t){const r=XA();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,z()))}populateOverlays(e,t,r){const n=[];return r.forEach(s=>{t.has(s)||n.push(s)}),this.documentOverlayCache.getOverlays(e,n).next(s=>{s.forEach((i,o)=>{t.set(i,o)})})}computeViews(e,t,r,n){let s=AA();const i=Pn(),o=function(){return Pn()}();return t.forEach((l,c)=>{const u=r.get(c.key);n.has(c.key)&&(u===void 0||u.mutation instanceof QA)?s=s.insert(c.key,c):u!==void 0?(i.set(c.key,u.mutation.getFieldMask()),Mn(u.mutation,c,u.mutation.getFieldMask(),Fe.now())):i.set(c.key,ut.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((c,u)=>i.set(c,u)),t.forEach((c,u)=>{var d;return o.set(c,new wU(u,(d=i.get(c))!==null&&d!==void 0?d:null))}),o))}recalculateAndSaveOverlays(e,t){const r=Pn();let n=new de((i,o)=>i-o),s=z();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(i=>{for(const o of i)o.keys().forEach(l=>{const c=t.get(l);if(c===null)return;let u=r.get(l)||ut.empty();u=o.applyToLocalView(c,u),r.set(l,u);const d=(n.get(o.batchId)||z()).add(l);n=n.insert(o.batchId,d)})}).next(()=>{const i=[],o=n.getReverseIterator();for(;o.hasNext();){const l=o.getNext(),c=l.key,u=l.value,d=Uf();u.forEach(g=>{if(!s.has(g)){const p=xf(t.get(g),r.get(g));p!==null&&d.set(g,p),s=s.add(g)}}),i.push(this.documentOverlayCache.saveOverlays(e,c,d))}return D.waitFor(i)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,n){return function(i){return j.isDocumentKey(i.path)&&i.collectionGroup===null&&i.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):vf(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,n):this.getDocumentsMatchingCollectionQuery(e,t,r,n)}getNextDocuments(e,t,r,n){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,n).next(s=>{const i=n-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,n-s.size):D.resolve(XA());let o=-1,l=s;return i.next(c=>D.forEach(c,(u,d)=>(o<d.largestBatchId&&(o=d.largestBatchId),s.get(u)?D.resolve():this.remoteDocumentCache.getEntry(e,u).next(g=>{l=l.insert(u,g)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,l,c,z())).next(u=>({batchId:o,changes:bf(u)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new j(t)).next(r=>{let n=On();return r.isFoundDocument()&&(n=n.insert(r.key,r)),n})}getDocumentsMatchingCollectionGroupQuery(e,t,r,n){const s=t.collectionGroup;let i=On();return this.indexManager.getCollectionParents(e,s).next(o=>D.forEach(o,l=>{const c=function(d,g){return new Ln(g,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)}(t,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,r,n).next(u=>{u.forEach((d,g)=>{i=i.insert(d,g)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,r,n){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,s,n))).next(i=>{s.forEach((l,c)=>{const u=c.getKey();i.get(u)===null&&(i=i.insert(u,Ke.newInvalidDocument(u)))});let o=On();return i.forEach((l,c)=>{const u=s.get(l);u!==void 0&&Mn(u.mutation,c,ut.empty(),Fe.now()),xi(t,c)&&(o=o.insert(l,c))}),o})}}/**
|
|
1989
|
+
* @license
|
|
1990
|
+
* Copyright 2020 Google LLC
|
|
1991
|
+
*
|
|
1992
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1993
|
+
* you may not use this file except in compliance with the License.
|
|
1994
|
+
* You may obtain a copy of the License at
|
|
1995
|
+
*
|
|
1996
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1997
|
+
*
|
|
1998
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1999
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2000
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2001
|
+
* See the License for the specific language governing permissions and
|
|
2002
|
+
* limitations under the License.
|
|
2003
|
+
*/class mU{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return D.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,function(n){return{id:n.id,version:n.version,createTime:Kt(n.createTime)}}(t)),D.resolve()}getNamedQuery(e,t){return D.resolve(this.Pr.get(t))}saveNamedQuery(e,t){return this.Pr.set(t.name,function(n){return{name:n.name,query:dU(n.bundledQuery),readTime:Kt(n.readTime)}}(t)),D.resolve()}}/**
|
|
2004
|
+
* @license
|
|
2005
|
+
* Copyright 2022 Google LLC
|
|
2006
|
+
*
|
|
2007
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2008
|
+
* you may not use this file except in compliance with the License.
|
|
2009
|
+
* You may obtain a copy of the License at
|
|
2010
|
+
*
|
|
2011
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2012
|
+
*
|
|
2013
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2014
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2015
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2016
|
+
* See the License for the specific language governing permissions and
|
|
2017
|
+
* limitations under the License.
|
|
2018
|
+
*/class yU{constructor(){this.overlays=new de(j.comparator),this.Ir=new Map}getOverlay(e,t){return D.resolve(this.overlays.get(t))}getOverlays(e,t){const r=XA();return D.forEach(t,n=>this.getOverlay(e,n).next(s=>{s!==null&&r.set(n,s)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((n,s)=>{this.ht(e,t,s)}),D.resolve()}removeOverlaysForBatchId(e,t,r){const n=this.Ir.get(r);return n!==void 0&&(n.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(r)),D.resolve()}getOverlaysForCollection(e,t,r){const n=XA(),s=t.length+1,i=new j(t.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const l=o.getNext().value,c=l.getKey();if(!t.isPrefixOf(c.path))break;c.path.length===s&&l.largestBatchId>r&&n.set(l.getKey(),l)}return D.resolve(n)}getOverlaysForCollectionGroup(e,t,r,n){let s=new de((c,u)=>c-u);const i=this.overlays.getIterator();for(;i.hasNext();){const c=i.getNext().value;if(c.getKey().getCollectionGroup()===t&&c.largestBatchId>r){let u=s.get(c.largestBatchId);u===null&&(u=XA(),s=s.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}const o=XA(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((c,u)=>o.set(c,u)),!(o.size()>=n)););return D.resolve(o)}ht(e,t,r){const n=this.overlays.get(r.key);if(n!==null){const i=this.Ir.get(n.largestBatchId).delete(r.key);this.Ir.set(n.largestBatchId,i)}this.overlays=this.overlays.insert(r.key,new Kb(t,r));let s=this.Ir.get(t);s===void 0&&(s=z(),this.Ir.set(t,s)),this.Ir.set(t,s.add(r.key))}}/**
|
|
2019
|
+
* @license
|
|
2020
|
+
* Copyright 2024 Google LLC
|
|
2021
|
+
*
|
|
2022
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2023
|
+
* you may not use this file except in compliance with the License.
|
|
2024
|
+
* You may obtain a copy of the License at
|
|
2025
|
+
*
|
|
2026
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2027
|
+
*
|
|
2028
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2029
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2030
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2031
|
+
* See the License for the specific language governing permissions and
|
|
2032
|
+
* limitations under the License.
|
|
2033
|
+
*/class vU{constructor(){this.sessionToken=Oe.EMPTY_BYTE_STRING}getSessionToken(e){return D.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,D.resolve()}}/**
|
|
2034
|
+
* @license
|
|
2035
|
+
* Copyright 2017 Google LLC
|
|
2036
|
+
*
|
|
2037
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2038
|
+
* you may not use this file except in compliance with the License.
|
|
2039
|
+
* You may obtain a copy of the License at
|
|
2040
|
+
*
|
|
2041
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2042
|
+
*
|
|
2043
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2044
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2045
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2046
|
+
* See the License for the specific language governing permissions and
|
|
2047
|
+
* limitations under the License.
|
|
2048
|
+
*/class Il{constructor(){this.Tr=new De(Re.Er),this.dr=new De(Re.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const r=new Re(e,t);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Vr(new Re(e,t))}mr(e,t){e.forEach(r=>this.removeReference(r,t))}gr(e){const t=new j(new ce([])),r=new Re(t,e),n=new Re(t,e+1),s=[];return this.dr.forEachInRange([r,n],i=>{this.Vr(i),s.push(i.key)}),s}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const t=new j(new ce([])),r=new Re(t,e),n=new Re(t,e+1);let s=z();return this.dr.forEachInRange([r,n],i=>{s=s.add(i.key)}),s}containsKey(e){const t=new Re(e,0),r=this.Tr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class Re{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return j.comparator(e.key,t.key)||ee(e.wr,t.wr)}static Ar(e,t){return ee(e.wr,t.wr)||j.comparator(e.key,t.key)}}/**
|
|
2049
|
+
* @license
|
|
2050
|
+
* Copyright 2017 Google LLC
|
|
2051
|
+
*
|
|
2052
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2053
|
+
* you may not use this file except in compliance with the License.
|
|
2054
|
+
* You may obtain a copy of the License at
|
|
2055
|
+
*
|
|
2056
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2057
|
+
*
|
|
2058
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2059
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2060
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2061
|
+
* See the License for the specific language governing permissions and
|
|
2062
|
+
* limitations under the License.
|
|
2063
|
+
*/class _U{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new De(Re.Er)}checkEmpty(e){return D.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,n){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new Mb(s,t,r,n);this.mutationQueue.push(i);for(const o of n)this.br=this.br.add(new Re(o.key,s)),this.indexManager.addToCollectionParentIndex(e,o.key.path.popLast());return D.resolve(i)}lookupMutationBatch(e,t){return D.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,n=this.vr(r),s=n<0?0:n;return D.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return D.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return D.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new Re(t,0),n=new Re(t,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([r,n],i=>{const o=this.Dr(i.wr);s.push(o)}),D.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new De(ee);return t.forEach(n=>{const s=new Re(n,0),i=new Re(n,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,i],o=>{r=r.add(o.wr)})}),D.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,n=r.length+1;let s=r;j.isDocumentKey(s)||(s=s.child(""));const i=new Re(new j(s),0);let o=new De(ee);return this.br.forEachWhile(l=>{const c=l.key.path;return!!r.isPrefixOf(c)&&(c.length===n&&(o=o.add(l.wr)),!0)},i),D.resolve(this.Cr(o))}Cr(e){const t=[];return e.forEach(r=>{const n=this.Dr(r);n!==null&&t.push(n)}),t}removeMutationBatch(e,t){re(this.Fr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return D.forEach(t.mutations,n=>{const s=new Re(n.key,t.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,n.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,t){const r=new Re(t,0),n=this.br.firstAfterOrEqual(r);return D.resolve(t.isEqual(n&&n.key))}performConsistencyCheck(e){return this.mutationQueue.length,D.resolve()}Fr(e,t){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const t=this.vr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
|
|
2064
|
+
* @license
|
|
2065
|
+
* Copyright 2017 Google LLC
|
|
2066
|
+
*
|
|
2067
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2068
|
+
* you may not use this file except in compliance with the License.
|
|
2069
|
+
* You may obtain a copy of the License at
|
|
2070
|
+
*
|
|
2071
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2072
|
+
*
|
|
2073
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2074
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2075
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2076
|
+
* See the License for the specific language governing permissions and
|
|
2077
|
+
* limitations under the License.
|
|
2078
|
+
*/class CU{constructor(e){this.Mr=e,this.docs=function(){return new de(j.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,n=this.docs.get(r),s=n?n.size:0,i=this.Mr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const r=this.docs.get(t);return D.resolve(r?r.document.mutableCopy():Ke.newInvalidDocument(t))}getEntries(e,t){let r=AA();return t.forEach(n=>{const s=this.docs.get(n);r=r.insert(n,s?s.document.mutableCopy():Ke.newInvalidDocument(n))}),D.resolve(r)}getDocumentsMatchingQuery(e,t,r,n){let s=AA();const i=t.path,o=new j(i.child("")),l=this.docs.getIteratorFrom(o);for(;l.hasNext();){const{key:c,value:{document:u}}=l.getNext();if(!i.isPrefixOf(c.path))break;c.path.length>i.length+1||ib(sb(u),r)<=0||(n.has(u.key)||xi(t,u))&&(s=s.insert(u.key,u.mutableCopy()))}return D.resolve(s)}getAllFromCollectionGroup(e,t,r,n){W()}Or(e,t){return D.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new EU(this)}getSize(e){return D.resolve(this.size)}}class EU extends pU{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];return this.changes.forEach((r,n)=>{n.isValidDocument()?t.push(this.cr.addEntry(e,n)):this.cr.removeEntry(r)}),D.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}/**
|
|
2079
|
+
* @license
|
|
2080
|
+
* Copyright 2017 Google LLC
|
|
2081
|
+
*
|
|
2082
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2083
|
+
* you may not use this file except in compliance with the License.
|
|
2084
|
+
* You may obtain a copy of the License at
|
|
2085
|
+
*
|
|
2086
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2087
|
+
*
|
|
2088
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2089
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2090
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2091
|
+
* See the License for the specific language governing permissions and
|
|
2092
|
+
* limitations under the License.
|
|
2093
|
+
*/class bU{constructor(e){this.persistence=e,this.Nr=new Rr(t=>hl(t),dl),this.lastRemoteSnapshotVersion=J.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Il,this.targetCount=0,this.kr=Hr.Bn()}forEachTarget(e,t){return this.Nr.forEach((r,n)=>t(n)),D.resolve()}getLastRemoteSnapshotVersion(e){return D.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return D.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),D.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.Lr&&(this.Lr=t),D.resolve()}Kn(e){this.Nr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.kr=new Hr(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,D.resolve()}updateTargetData(e,t){return this.Kn(t),D.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,D.resolve()}removeTargets(e,t,r){let n=0;const s=[];return this.Nr.forEach((i,o)=>{o.sequenceNumber<=t&&r.get(o.targetId)===null&&(this.Nr.delete(i),s.push(this.removeMatchingKeysForTargetId(e,o.targetId)),n++)}),D.waitFor(s).next(()=>n)}getTargetCount(e){return D.resolve(this.targetCount)}getTargetData(e,t){const r=this.Nr.get(t)||null;return D.resolve(r)}addMatchingKeys(e,t,r){return this.Br.Rr(t,r),D.resolve()}removeMatchingKeys(e,t,r){this.Br.mr(t,r);const n=this.persistence.referenceDelegate,s=[];return n&&t.forEach(i=>{s.push(n.markPotentiallyOrphaned(e,i))}),D.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),D.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Br.yr(t);return D.resolve(r)}containsKey(e,t){return D.resolve(this.Br.containsKey(t))}}/**
|
|
2094
|
+
* @license
|
|
2095
|
+
* Copyright 2017 Google LLC
|
|
2096
|
+
*
|
|
2097
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2098
|
+
* you may not use this file except in compliance with the License.
|
|
2099
|
+
* You may obtain a copy of the License at
|
|
2100
|
+
*
|
|
2101
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2102
|
+
*
|
|
2103
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2104
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2105
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2106
|
+
* See the License for the specific language governing permissions and
|
|
2107
|
+
* limitations under the License.
|
|
2108
|
+
*/class UU{constructor(e,t){this.qr={},this.overlays={},this.Qr=new sl(0),this.Kr=!1,this.Kr=!0,this.$r=new vU,this.referenceDelegate=e(this),this.Ur=new bU(this),this.indexManager=new fU,this.remoteDocumentCache=function(n){return new CU(n)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new hU(t),this.Gr=new mU(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new yU,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.qr[e.toKey()];return r||(r=new _U(t,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,t,r){G("MemoryPersistence","Starting transaction:",e);const n=new QU(this.Qr.next());return this.referenceDelegate.zr(),r(n).next(s=>this.referenceDelegate.jr(n).next(()=>s)).toPromise().then(s=>(n.raiseOnCommittedEvent(),s))}Hr(e,t){return D.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,t)))}}class QU extends ab{constructor(e){super(),this.currentSequenceNumber=e}}class Fl{constructor(e){this.persistence=e,this.Jr=new Il,this.Yr=null}static Zr(e){return new Fl(e)}get Xr(){if(this.Yr)return this.Yr;throw W()}addReference(e,t,r){return this.Jr.addReference(r,t),this.Xr.delete(r.toString()),D.resolve()}removeReference(e,t,r){return this.Jr.removeReference(r,t),this.Xr.add(r.toString()),D.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),D.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(n=>this.Xr.add(n.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(n=>{n.forEach(s=>this.Xr.add(s.toString()))}).next(()=>r.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return D.forEach(this.Xr,r=>{const n=j.fromPath(r);return this.ei(e,n).next(s=>{s||t.removeEntry(n,J.min())})}).next(()=>(this.Yr=null,t.apply(e)))}updateLimboDocument(e,t){return this.ei(e,t).next(r=>{r?this.Xr.delete(t.toString()):this.Xr.add(t.toString())})}Wr(e){return 0}ei(e,t){return D.or([()=>D.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}/**
|
|
2109
|
+
* @license
|
|
2110
|
+
* Copyright 2017 Google LLC
|
|
2111
|
+
*
|
|
2112
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2113
|
+
* you may not use this file except in compliance with the License.
|
|
2114
|
+
* You may obtain a copy of the License at
|
|
2115
|
+
*
|
|
2116
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2117
|
+
*
|
|
2118
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2119
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2120
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2121
|
+
* See the License for the specific language governing permissions and
|
|
2122
|
+
* limitations under the License.
|
|
2123
|
+
*/class Tl{constructor(e,t,r,n){this.targetId=e,this.fromCache=t,this.$i=r,this.Ui=n}static Wi(e,t){let r=z(),n=z();for(const s of t.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:n=n.add(s.doc.key)}return new Tl(e,t.fromCache,r,n)}}/**
|
|
2124
|
+
* @license
|
|
2125
|
+
* Copyright 2023 Google LLC
|
|
2126
|
+
*
|
|
2127
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2128
|
+
* you may not use this file except in compliance with the License.
|
|
2129
|
+
* You may obtain a copy of the License at
|
|
2130
|
+
*
|
|
2131
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2132
|
+
*
|
|
2133
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2134
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2135
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2136
|
+
* See the License for the specific language governing permissions and
|
|
2137
|
+
* limitations under the License.
|
|
2138
|
+
*/class IU{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
|
|
2139
|
+
* @license
|
|
2140
|
+
* Copyright 2019 Google LLC
|
|
2141
|
+
*
|
|
2142
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2143
|
+
* you may not use this file except in compliance with the License.
|
|
2144
|
+
* You may obtain a copy of the License at
|
|
2145
|
+
*
|
|
2146
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2147
|
+
*
|
|
2148
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2149
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2150
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2151
|
+
* See the License for the specific language governing permissions and
|
|
2152
|
+
* limitations under the License.
|
|
2153
|
+
*/class FU{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return xC()?8:lb(SC())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,r,n){const s={result:null};return this.Yi(e,t).next(i=>{s.result=i}).next(()=>{if(!s.result)return this.Zi(e,t,n,r).next(i=>{s.result=i})}).next(()=>{if(s.result)return;const i=new IU;return this.Xi(e,t,i).next(o=>{if(s.result=o,this.zi)return this.es(e,t,i,o.size)})}).next(()=>s.result)}es(e,t,r,n){return r.documentReadCount<this.ji?(In()<=Z.DEBUG&&G("QueryEngine","SDK will not create cache indexes for query:",Sr(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),D.resolve()):(In()<=Z.DEBUG&&G("QueryEngine","Query:",Sr(t),"scans",r.documentReadCount,"local documents and returns",n,"documents as results."),r.documentReadCount>this.Hi*n?(In()<=Z.DEBUG&&G("QueryEngine","The SDK decides to create cache indexes for query:",Sr(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Mt(t))):D.resolve())}Yi(e,t){if(yf(t))return D.resolve(null);let r=Mt(t);return this.indexManager.getIndexType(e,r).next(n=>n===0?null:(t.limit!==null&&n===1&&(t=wl(t,null,"F"),r=Mt(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const i=z(...s);return this.Ji.getDocuments(e,i).next(o=>this.indexManager.getMinOffset(e,r).next(l=>{const c=this.ts(t,o);return this.ns(t,c,i,l.readTime)?this.Yi(e,wl(t,null,"F")):this.rs(e,c,t,l)}))})))}Zi(e,t,r,n){return yf(t)||n.isEqual(J.min())?D.resolve(null):this.Ji.getDocuments(e,r).next(s=>{const i=this.ts(t,s);return this.ns(t,i,r,n)?D.resolve(null):(In()<=Z.DEBUG&&G("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),Sr(t)),this.rs(e,i,t,nb(n,-1)).next(o=>o))})}ts(e,t){let r=new De(Cf(e));return t.forEach((n,s)=>{xi(e,s)&&(r=r.add(s))}),r}ns(e,t,r,n){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const s=e.limitType==="F"?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(n)>0)}Xi(e,t,r){return In()<=Z.DEBUG&&G("QueryEngine","Using full collection scan to execute query:",Sr(t)),this.Ji.getDocumentsMatchingQuery(e,t,bA.min(),r)}rs(e,t,r,n){return this.Ji.getDocumentsMatchingQuery(e,r,n).next(s=>(t.forEach(i=>{s=s.insert(i.key,i)}),s))}}/**
|
|
2154
|
+
* @license
|
|
2155
|
+
* Copyright 2020 Google LLC
|
|
2156
|
+
*
|
|
2157
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2158
|
+
* you may not use this file except in compliance with the License.
|
|
2159
|
+
* You may obtain a copy of the License at
|
|
2160
|
+
*
|
|
2161
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2162
|
+
*
|
|
2163
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2164
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2165
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2166
|
+
* See the License for the specific language governing permissions and
|
|
2167
|
+
* limitations under the License.
|
|
2168
|
+
*/class TU{constructor(e,t,r,n){this.persistence=e,this.ss=t,this.serializer=n,this.os=new de(ee),this._s=new Rr(s=>hl(s),dl),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new BU(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.os))}}function SU(A,e,t,r){return new TU(A,e,t,r)}async function eg(A,e){const t=q(A);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let n;return t.mutationQueue.getAllMutationBatches(r).next(s=>(n=s,t.ls(e),t.mutationQueue.getAllMutationBatches(r))).next(s=>{const i=[],o=[];let l=z();for(const c of n){i.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}for(const c of s){o.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}return t.localDocuments.getDocuments(r,l).next(c=>({hs:c,removedBatchIds:i,addedBatchIds:o}))})})}function RU(A,e){const t=q(A);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const n=e.batch.keys(),s=t.cs.newChangeBuffer({trackRemovals:!0});return function(o,l,c,u){const d=c.batch,g=d.keys();let p=D.resolve();return g.forEach(B=>{p=p.next(()=>u.getEntry(l,B)).next(C=>{const E=c.docVersions.get(B);re(E!==null),C.version.compareTo(E)<0&&(d.applyToRemoteDocument(C,c),C.isValidDocument()&&(C.setReadTime(c.commitVersion),u.addEntry(C)))})}),p.next(()=>o.mutationQueue.removeMutationBatch(l,d))}(t,r,e,s).next(()=>s.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,n,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(o){let l=z();for(let c=0;c<o.mutationResults.length;++c)o.mutationResults[c].transformResults.length>0&&(l=l.add(o.batch.mutations[c].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,n))})}function tg(A){const e=q(A);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function xU(A,e){const t=q(A),r=e.snapshotVersion;let n=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const i=t.cs.newChangeBuffer({trackRemovals:!0});n=t.os;const o=[];e.targetChanges.forEach((u,d)=>{const g=n.get(d);if(!g)return;o.push(t.Ur.removeMatchingKeys(s,u.removedDocuments,d).next(()=>t.Ur.addMatchingKeys(s,u.addedDocuments,d)));let p=g.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(d)!==null?p=p.withResumeToken(Oe.EMPTY_BYTE_STRING,J.min()).withLastLimboFreeSnapshotVersion(J.min()):u.resumeToken.approximateByteSize()>0&&(p=p.withResumeToken(u.resumeToken,r)),n=n.insert(d,p),function(C,E,I){return C.resumeToken.approximateByteSize()===0||E.snapshotVersion.toMicroseconds()-C.snapshotVersion.toMicroseconds()>=3e8?!0:I.addedDocuments.size+I.modifiedDocuments.size+I.removedDocuments.size>0}(g,p,u)&&o.push(t.Ur.updateTargetData(s,p))});let l=AA(),c=z();if(e.documentUpdates.forEach(u=>{e.resolvedLimboDocuments.has(u)&&o.push(t.persistence.referenceDelegate.updateLimboDocument(s,u))}),o.push(kU(s,i,e.documentUpdates).next(u=>{l=u.Ps,c=u.Is})),!r.isEqual(J.min())){const u=t.Ur.getLastRemoteSnapshotVersion(s).next(d=>t.Ur.setTargetsMetadata(s,s.currentSequenceNumber,r));o.push(u)}return D.waitFor(o).next(()=>i.apply(s)).next(()=>t.localDocuments.getLocalViewOfDocuments(s,l,c)).next(()=>l)}).then(s=>(t.os=n,s))}function kU(A,e,t){let r=z(),n=z();return t.forEach(s=>r=r.add(s)),e.getEntries(A,r).next(s=>{let i=AA();return t.forEach((o,l)=>{const c=s.get(o);l.isFoundDocument()!==c.isFoundDocument()&&(n=n.add(o)),l.isNoDocument()&&l.version.isEqual(J.min())?(e.removeEntry(o,l.readTime),i=i.insert(o,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),i=i.insert(o,l)):G("LocalStore","Ignoring outdated watch update for ",o,". Current version:",c.version," Watch version:",l.version)}),{Ps:i,Is:n}})}function HU(A,e){const t=q(A);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function LU(A,e){const t=q(A);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let n;return t.Ur.getTargetData(r,e).next(s=>s?(n=s,D.resolve(n)):t.Ur.allocateTargetId(r).next(i=>(n=new IA(e,i,"TargetPurposeListen",r.currentSequenceNumber),t.Ur.addTargetData(r,n).next(()=>n))))}).then(r=>{const n=t.os.get(r.targetId);return(n===null||r.snapshotVersion.compareTo(n.snapshotVersion)>0)&&(t.os=t.os.insert(r.targetId,r),t._s.set(e,r.targetId)),r})}async function Sl(A,e,t){const r=q(A),n=r.os.get(e),s=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",s,i=>r.persistence.referenceDelegate.removeTarget(i,n))}catch(i){if(!Sn(i))throw i;G("LocalStore",`Failed to update sequence numbers for target ${e}: ${i}`)}r.os=r.os.remove(e),r._s.delete(n.target)}function Ag(A,e,t){const r=q(A);let n=J.min(),s=z();return r.persistence.runTransaction("Execute query","readwrite",i=>function(l,c,u){const d=q(l),g=d._s.get(u);return g!==void 0?D.resolve(d.os.get(g)):d.Ur.getTargetData(c,u)}(r,i,Mt(e)).next(o=>{if(o)return n=o.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(i,o.targetId).next(l=>{s=l})}).next(()=>r.ss.getDocumentsMatchingQuery(i,e,t?n:J.min(),t?s:z())).next(o=>(DU(r,Qb(e),o),{documents:o,Ts:s})))}function DU(A,e,t){let r=A.us.get(e)||J.min();t.forEach((n,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),A.us.set(e,r)}class rg{constructor(){this.activeTargetIds=xb()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class OU{constructor(){this.so=new rg,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,t,r){this.oo[e]=t}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new rg,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
|
|
2169
|
+
* @license
|
|
2170
|
+
* Copyright 2019 Google LLC
|
|
2171
|
+
*
|
|
2172
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2173
|
+
* you may not use this file except in compliance with the License.
|
|
2174
|
+
* You may obtain a copy of the License at
|
|
2175
|
+
*
|
|
2176
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2177
|
+
*
|
|
2178
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2179
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2180
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2181
|
+
* See the License for the specific language governing permissions and
|
|
2182
|
+
* limitations under the License.
|
|
2183
|
+
*/class PU{_o(e){}shutdown(){}}/**
|
|
2184
|
+
* @license
|
|
2185
|
+
* Copyright 2019 Google LLC
|
|
2186
|
+
*
|
|
2187
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2188
|
+
* you may not use this file except in compliance with the License.
|
|
2189
|
+
* You may obtain a copy of the License at
|
|
2190
|
+
*
|
|
2191
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2192
|
+
*
|
|
2193
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2194
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2195
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2196
|
+
* See the License for the specific language governing permissions and
|
|
2197
|
+
* limitations under the License.
|
|
2198
|
+
*/class ng{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){G("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){G("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
|
|
2199
|
+
* @license
|
|
2200
|
+
* Copyright 2023 Google LLC
|
|
2201
|
+
*
|
|
2202
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2203
|
+
* you may not use this file except in compliance with the License.
|
|
2204
|
+
* You may obtain a copy of the License at
|
|
2205
|
+
*
|
|
2206
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2207
|
+
*
|
|
2208
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2209
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2210
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2211
|
+
* See the License for the specific language governing permissions and
|
|
2212
|
+
* limitations under the License.
|
|
2213
|
+
*/let Mi=null;function Rl(){return Mi===null?Mi=function(){return 268435456+Math.round(2147483648*Math.random())}():Mi++,"0x"+Mi.toString(16)}/**
|
|
2214
|
+
* @license
|
|
2215
|
+
* Copyright 2020 Google LLC
|
|
2216
|
+
*
|
|
2217
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2218
|
+
* you may not use this file except in compliance with the License.
|
|
2219
|
+
* You may obtain a copy of the License at
|
|
2220
|
+
*
|
|
2221
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2222
|
+
*
|
|
2223
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2224
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2225
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2226
|
+
* See the License for the specific language governing permissions and
|
|
2227
|
+
* limitations under the License.
|
|
2228
|
+
*/const NU={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
|
|
2229
|
+
* @license
|
|
2230
|
+
* Copyright 2017 Google LLC
|
|
2231
|
+
*
|
|
2232
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2233
|
+
* you may not use this file except in compliance with the License.
|
|
2234
|
+
* You may obtain a copy of the License at
|
|
2235
|
+
*
|
|
2236
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2237
|
+
*
|
|
2238
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2239
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2240
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2241
|
+
* See the License for the specific language governing permissions and
|
|
2242
|
+
* limitations under the License.
|
|
2243
|
+
*/class VU{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
|
|
2244
|
+
* @license
|
|
2245
|
+
* Copyright 2017 Google LLC
|
|
2246
|
+
*
|
|
2247
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2248
|
+
* you may not use this file except in compliance with the License.
|
|
2249
|
+
* You may obtain a copy of the License at
|
|
2250
|
+
*
|
|
2251
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2252
|
+
*
|
|
2253
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2254
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2255
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2256
|
+
* See the License for the specific language governing permissions and
|
|
2257
|
+
* limitations under the License.
|
|
2258
|
+
*/const Ge="WebChannelConnection";class MU extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+t.host,this.vo=`projects/${n}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${n}`:`project_id=${n}&database_id=${s}`}get Fo(){return!1}Mo(t,r,n,s,i){const o=Rl(),l=this.xo(t,r.toUriEncodedString());G("RestConnection",`Sending RPC '${t}' ${o}:`,l,n);const c={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(c,s,i),this.No(t,l,c,n).then(u=>(G("RestConnection",`Received RPC '${t}' ${o}: `,u),u),u=>{throw Qr("RestConnection",`RPC '${t}' ${o} failed with error: `,u,"url: ",l,"request:",n),u})}Lo(t,r,n,s,i,o){return this.Mo(t,r,n,s,i)}Oo(t,r,n){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Ur}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,i)=>t[i]=s),n&&n.headers.forEach((s,i)=>t[i]=s)}xo(t,r){const n=NU[t];return`${this.Do}/v1/${r}:${n}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,t,r,n){const s=Rl();return new Promise((i,o)=>{const l=new $d;l.setWithCredentials(!0),l.listenOnce(Wd.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case Ei.NO_ERROR:const u=l.getResponseJson();G(Ge,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(u)),i(u);break;case Ei.TIMEOUT:G(Ge,`RPC '${e}' ${s} timed out`),o(new M(L.DEADLINE_EXCEEDED,"Request time out"));break;case Ei.HTTP_ERROR:const d=l.getStatus();if(G(Ge,`RPC '${e}' ${s} failed with status:`,d,"response text:",l.getResponseText()),d>0){let g=l.getResponseJson();Array.isArray(g)&&(g=g[0]);const p=g==null?void 0:g.error;if(p&&p.status&&p.message){const B=function(E){const I=E.toLowerCase().replace(/_/g,"-");return Object.values(L).indexOf(I)>=0?I:L.UNKNOWN}(p.status);o(new M(B,p.message))}else o(new M(L.UNKNOWN,"Server responded with status "+l.getStatus()))}else o(new M(L.UNAVAILABLE,"Connection failed."));break;default:W()}}finally{G(Ge,`RPC '${e}' ${s} completed.`)}});const c=JSON.stringify(n);G(Ge,`RPC '${e}' ${s} sending request:`,n),l.send(t,"POST",c,r,15)})}Bo(e,t,r){const n=Rl(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=Xd(),o=Jd(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Oo(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const u=s.join("");G(Ge,`Creating RPC '${e}' stream ${n}: ${u}`,l);const d=i.createWebChannel(u,l);let g=!1,p=!1;const B=new VU({Io:E=>{p?G(Ge,`Not sending because RPC '${e}' stream ${n} is closed:`,E):(g||(G(Ge,`Opening RPC '${e}' stream ${n} transport.`),d.open(),g=!0),G(Ge,`RPC '${e}' stream ${n} sending:`,E),d.send(E))},To:()=>d.close()}),C=(E,I,Q)=>{E.listen(I,S=>{try{Q(S)}catch(k){setTimeout(()=>{throw k},0)}})};return C(d,Qn.EventType.OPEN,()=>{p||(G(Ge,`RPC '${e}' stream ${n} transport opened.`),B.yo())}),C(d,Qn.EventType.CLOSE,()=>{p||(p=!0,G(Ge,`RPC '${e}' stream ${n} transport closed`),B.So())}),C(d,Qn.EventType.ERROR,E=>{p||(p=!0,Qr(Ge,`RPC '${e}' stream ${n} transport errored:`,E),B.So(new M(L.UNAVAILABLE,"The operation could not be completed")))}),C(d,Qn.EventType.MESSAGE,E=>{var I;if(!p){const Q=E.data[0];re(!!Q);const S=Q,k=S.error||((I=S[0])===null||I===void 0?void 0:I.error);if(k){G(Ge,`RPC '${e}' stream ${n} received error:`,k);const H=k.status;let R=function(y){const b=Ee[y];if(b!==void 0)return Of(b)}(H),_=k.message;R===void 0&&(R=L.INTERNAL,_="Unknown error status: "+H+" with message "+k.message),p=!0,B.So(new M(R,_)),d.close()}else G(Ge,`RPC '${e}' stream ${n} received:`,Q),B.bo(Q)}}),C(o,qd.STAT_EVENT,E=>{E.stat===rl.PROXY?G(Ge,`RPC '${e}' stream ${n} detected buffering proxy`):E.stat===rl.NOPROXY&&G(Ge,`RPC '${e}' stream ${n} detected no buffering proxy`)}),setTimeout(()=>{B.wo()},0),B}}function xl(){return typeof document<"u"?document:null}/**
|
|
2259
|
+
* @license
|
|
2260
|
+
* Copyright 2020 Google LLC
|
|
2261
|
+
*
|
|
2262
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2263
|
+
* you may not use this file except in compliance with the License.
|
|
2264
|
+
* You may obtain a copy of the License at
|
|
2265
|
+
*
|
|
2266
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2267
|
+
*
|
|
2268
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2269
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2270
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2271
|
+
* See the License for the specific language governing permissions and
|
|
2272
|
+
* limitations under the License.
|
|
2273
|
+
*/function Ki(A){return new Yb(A,!0)}/**
|
|
2274
|
+
* @license
|
|
2275
|
+
* Copyright 2017 Google LLC
|
|
2276
|
+
*
|
|
2277
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2278
|
+
* you may not use this file except in compliance with the License.
|
|
2279
|
+
* You may obtain a copy of the License at
|
|
2280
|
+
*
|
|
2281
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2282
|
+
*
|
|
2283
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2284
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2285
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2286
|
+
* See the License for the specific language governing permissions and
|
|
2287
|
+
* limitations under the License.
|
|
2288
|
+
*/class sg{constructor(e,t,r=1e3,n=1.5,s=6e4){this.ui=e,this.timerId=t,this.ko=r,this.qo=n,this.Qo=s,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const t=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),n=Math.max(0,t-r);n>0&&G("ExponentialBackoff",`Backing off for ${n} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,n,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
|
|
2289
|
+
* @license
|
|
2290
|
+
* Copyright 2017 Google LLC
|
|
2291
|
+
*
|
|
2292
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2293
|
+
* you may not use this file except in compliance with the License.
|
|
2294
|
+
* You may obtain a copy of the License at
|
|
2295
|
+
*
|
|
2296
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2297
|
+
*
|
|
2298
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2299
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2300
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2301
|
+
* See the License for the specific language governing permissions and
|
|
2302
|
+
* limitations under the License.
|
|
2303
|
+
*/class ig{constructor(e,t,r,n,s,i,o,l){this.ui=e,this.Ho=r,this.Jo=n,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new sg(e,t)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,t){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():t&&t.code===L.RESOURCE_EXHAUSTED?(tA(t.toString()),tA("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===L.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(t)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),t=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,n])=>{this.Yo===t&&this.P_(r,n)},r=>{e(()=>{const n=new M(L.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(n)})})}P_(e,t){const r=this.h_(this.Yo);this.stream=this.T_(e,t),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(n=>{r(()=>this.I_(n))}),this.stream.onMessage(n=>{r(()=>++this.e_==1?this.E_(n):this.onNext(n))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return G("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(G("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class KU extends ig{constructor(e,t,r,n,s,i){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,n,i),this.serializer=s}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=tU(this.serializer,e),r=function(s){if(!("targetChange"in s))return J.min();const i=s.targetChange;return i.targetIds&&i.targetIds.length?J.min():i.readTime?Kt(i.readTime):J.min()}(e);return this.listener.d_(t,r)}A_(e){const t={};t.database=Ql(this.serializer),t.addTarget=function(s,i){let o;const l=i.target;if(o=fl(l)?{documents:nU(s,l)}:{query:sU(s,l)._t},o.targetId=i.targetId,i.resumeToken.approximateByteSize()>0){o.resumeToken=$f(s,i.resumeToken);const c=_l(s,i.expectedCount);c!==null&&(o.expectedCount=c)}else if(i.snapshotVersion.compareTo(J.min())>0){o.readTime=Vi(s,i.snapshotVersion.toTimestamp());const c=_l(s,i.expectedCount);c!==null&&(o.expectedCount=c)}return o}(this.serializer,e);const r=oU(this.serializer,e);r&&(t.labels=r),this.a_(t)}R_(e){const t={};t.database=Ql(this.serializer),t.removeTarget=e,this.a_(t)}}class GU extends ig{constructor(e,t,r,n,s,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,n,i),this.serializer=s}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,t){return this.connection.Bo("Write",e,t)}E_(e){return re(!!e.streamToken),this.lastStreamToken=e.streamToken,re(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){re(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=rU(e.writeResults,e.commitTime),r=Kt(e.commitTime);return this.listener.g_(r,t)}p_(){const e={};e.database=Ql(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>AU(this.serializer,r))};this.a_(t)}}/**
|
|
2304
|
+
* @license
|
|
2305
|
+
* Copyright 2017 Google LLC
|
|
2306
|
+
*
|
|
2307
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2308
|
+
* you may not use this file except in compliance with the License.
|
|
2309
|
+
* You may obtain a copy of the License at
|
|
2310
|
+
*
|
|
2311
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2312
|
+
*
|
|
2313
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2314
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2315
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2316
|
+
* See the License for the specific language governing permissions and
|
|
2317
|
+
* limitations under the License.
|
|
2318
|
+
*/class jU extends class{}{constructor(e,t,r,n){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=n,this.y_=!1}w_(){if(this.y_)throw new M(L.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,r,n){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.Mo(e,El(t,r),n,s,i)).catch(s=>{throw s.name==="FirebaseError"?(s.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new M(L.UNKNOWN,s.toString())})}Lo(e,t,r,n,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Lo(e,El(t,r),n,i,o,s)).catch(i=>{throw i.name==="FirebaseError"?(i.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new M(L.UNKNOWN,i.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class $U{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const t=`Could not reach Cloud Firestore backend. ${e}
|
|
2319
|
+
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(tA(t),this.D_=!1):G("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
|
|
2320
|
+
* @license
|
|
2321
|
+
* Copyright 2017 Google LLC
|
|
2322
|
+
*
|
|
2323
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2324
|
+
* you may not use this file except in compliance with the License.
|
|
2325
|
+
* You may obtain a copy of the License at
|
|
2326
|
+
*
|
|
2327
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2328
|
+
*
|
|
2329
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2330
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2331
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2332
|
+
* See the License for the specific language governing permissions and
|
|
2333
|
+
* limitations under the License.
|
|
2334
|
+
*/class WU{constructor(e,t,r,n,s){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=s,this.k_._o(i=>{r.enqueueAndForget(async()=>{zA(this)&&(G("RemoteStore","Restarting streams for network reachability change."),await async function(l){const c=q(l);c.L_.add(4),await $n(c),c.q_.set("Unknown"),c.L_.delete(4),await Gi(c)}(this))})}),this.q_=new $U(r,n)}}async function Gi(A){if(zA(A))for(const e of A.B_)await e(!0)}async function $n(A){for(const e of A.B_)await e(!1)}function og(A,e){const t=q(A);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),Dl(t)?Ll(t):Lr(t).r_()&&Hl(t,e))}function kl(A,e){const t=q(A),r=Lr(t);t.N_.delete(e),r.r_()&&ag(t,e),t.N_.size===0&&(r.r_()?r.o_():zA(t)&&t.q_.set("Unknown"))}function Hl(A,e){if(A.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(J.min())>0){const t=A.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}Lr(A).A_(e)}function ag(A,e){A.Q_.xe(e),Lr(A).R_(e)}function Ll(A){A.Q_=new qb({getRemoteKeysForTarget:e=>A.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>A.N_.get(e)||null,tt:()=>A.datastore.serializer.databaseId}),Lr(A).start(),A.q_.v_()}function Dl(A){return zA(A)&&!Lr(A).n_()&&A.N_.size>0}function zA(A){return q(A).L_.size===0}function lg(A){A.Q_=void 0}async function qU(A){A.q_.set("Online")}async function JU(A){A.N_.forEach((e,t)=>{Hl(A,e)})}async function XU(A,e){lg(A),Dl(A)?(A.q_.M_(e),Ll(A)):A.q_.set("Unknown")}async function zU(A,e,t){if(A.q_.set("Online"),e instanceof Mf&&e.state===2&&e.cause)try{await async function(n,s){const i=s.cause;for(const o of s.targetIds)n.N_.has(o)&&(await n.remoteSyncer.rejectListen(o,i),n.N_.delete(o),n.Q_.removeTarget(o))}(A,e)}catch(r){G("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await ji(A,r)}else if(e instanceof Ni?A.Q_.Ke(e):e instanceof Vf?A.Q_.He(e):A.Q_.We(e),!t.isEqual(J.min()))try{const r=await tg(A.localStore);t.compareTo(r)>=0&&await function(s,i){const o=s.Q_.rt(i);return o.targetChanges.forEach((l,c)=>{if(l.resumeToken.approximateByteSize()>0){const u=s.N_.get(c);u&&s.N_.set(c,u.withResumeToken(l.resumeToken,i))}}),o.targetMismatches.forEach((l,c)=>{const u=s.N_.get(l);if(!u)return;s.N_.set(l,u.withResumeToken(Oe.EMPTY_BYTE_STRING,u.snapshotVersion)),ag(s,l);const d=new IA(u.target,l,c,u.sequenceNumber);Hl(s,d)}),s.remoteSyncer.applyRemoteEvent(o)}(A,t)}catch(r){G("RemoteStore","Failed to raise snapshot:",r),await ji(A,r)}}async function ji(A,e,t){if(!Sn(e))throw e;A.L_.add(1),await $n(A),A.q_.set("Offline"),t||(t=()=>tg(A.localStore)),A.asyncQueue.enqueueRetryable(async()=>{G("RemoteStore","Retrying IndexedDB access"),await t(),A.L_.delete(1),await Gi(A)})}function cg(A,e){return e().catch(t=>ji(A,t,e))}async function $i(A){const e=q(A),t=FA(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;YU(e);)try{const n=await HU(e.localStore,r);if(n===null){e.O_.length===0&&t.o_();break}r=n.batchId,ZU(e,n)}catch(n){await ji(e,n)}ug(e)&&hg(e)}function YU(A){return zA(A)&&A.O_.length<10}function ZU(A,e){A.O_.push(e);const t=FA(A);t.r_()&&t.V_&&t.m_(e.mutations)}function ug(A){return zA(A)&&!FA(A).n_()&&A.O_.length>0}function hg(A){FA(A).start()}async function eQ(A){FA(A).p_()}async function tQ(A){const e=FA(A);for(const t of A.O_)e.m_(t.mutations)}async function AQ(A,e,t){const r=A.O_.shift(),n=yl.from(r,e,t);await cg(A,()=>A.remoteSyncer.applySuccessfulWrite(n)),await $i(A)}async function rQ(A,e){e&&FA(A).V_&&await async function(r,n){if(function(i){return jb(i)&&i!==L.ABORTED}(n.code)){const s=r.O_.shift();FA(r).s_(),await cg(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,n)),await $i(r)}}(A,e),ug(A)&&hg(A)}async function dg(A,e){const t=q(A);t.asyncQueue.verifyOperationInProgress(),G("RemoteStore","RemoteStore received new credentials");const r=zA(t);t.L_.add(3),await $n(t),r&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await Gi(t)}async function nQ(A,e){const t=q(A);e?(t.L_.delete(2),await Gi(t)):e||(t.L_.add(2),await $n(t),t.q_.set("Unknown"))}function Lr(A){return A.K_||(A.K_=function(t,r,n){const s=q(t);return s.w_(),new KU(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(A.datastore,A.asyncQueue,{Eo:qU.bind(null,A),Ro:JU.bind(null,A),mo:XU.bind(null,A),d_:zU.bind(null,A)}),A.B_.push(async e=>{e?(A.K_.s_(),Dl(A)?Ll(A):A.q_.set("Unknown")):(await A.K_.stop(),lg(A))})),A.K_}function FA(A){return A.U_||(A.U_=function(t,r,n){const s=q(t);return s.w_(),new GU(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(A.datastore,A.asyncQueue,{Eo:()=>Promise.resolve(),Ro:eQ.bind(null,A),mo:rQ.bind(null,A),f_:tQ.bind(null,A),g_:AQ.bind(null,A)}),A.B_.push(async e=>{e?(A.U_.s_(),await $i(A)):(await A.U_.stop(),A.O_.length>0&&(G("RemoteStore",`Stopping write stream with ${A.O_.length} pending writes`),A.O_=[]))})),A.U_}/**
|
|
2335
|
+
* @license
|
|
2336
|
+
* Copyright 2017 Google LLC
|
|
2337
|
+
*
|
|
2338
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2339
|
+
* you may not use this file except in compliance with the License.
|
|
2340
|
+
* You may obtain a copy of the License at
|
|
2341
|
+
*
|
|
2342
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2343
|
+
*
|
|
2344
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2345
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2346
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2347
|
+
* See the License for the specific language governing permissions and
|
|
2348
|
+
* limitations under the License.
|
|
2349
|
+
*/class Ol{constructor(e,t,r,n,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=n,this.removalCallback=s,this.deferred=new EA,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(i=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,n,s){const i=Date.now()+r,o=new Ol(e,t,i,n,s);return o.start(r),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new M(L.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Pl(A,e){if(tA("AsyncQueue",`${e}: ${A}`),Sn(A))return new M(L.UNAVAILABLE,`${e}: ${A}`);throw A}/**
|
|
2350
|
+
* @license
|
|
2351
|
+
* Copyright 2017 Google LLC
|
|
2352
|
+
*
|
|
2353
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2354
|
+
* you may not use this file except in compliance with the License.
|
|
2355
|
+
* You may obtain a copy of the License at
|
|
2356
|
+
*
|
|
2357
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2358
|
+
*
|
|
2359
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2360
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2361
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2362
|
+
* See the License for the specific language governing permissions and
|
|
2363
|
+
* limitations under the License.
|
|
2364
|
+
*/class Dr{constructor(e){this.comparator=e?(t,r)=>e(t,r)||j.comparator(t.key,r.key):(t,r)=>j.comparator(t.key,r.key),this.keyedMap=On(),this.sortedSet=new de(this.comparator)}static emptySet(e){return new Dr(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,r)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Dr)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const n=t.getNext().key,s=r.getNext().key;if(!n.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
|
|
2365
|
+
`+e.join(`
|
|
2366
|
+
`)+`
|
|
2367
|
+
)`}copy(e,t){const r=new Dr;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
|
|
2368
|
+
* @license
|
|
2369
|
+
* Copyright 2017 Google LLC
|
|
2370
|
+
*
|
|
2371
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2372
|
+
* you may not use this file except in compliance with the License.
|
|
2373
|
+
* You may obtain a copy of the License at
|
|
2374
|
+
*
|
|
2375
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2376
|
+
*
|
|
2377
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2378
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2379
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2380
|
+
* See the License for the specific language governing permissions and
|
|
2381
|
+
* limitations under the License.
|
|
2382
|
+
*/class fg{constructor(){this.W_=new de(j.comparator)}track(e){const t=e.doc.key,r=this.W_.get(t);r?e.type!==0&&r.type===3?this.W_=this.W_.insert(t,e):e.type===3&&r.type!==1?this.W_=this.W_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.W_=this.W_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.W_=this.W_.remove(t):e.type===1&&r.type===2?this.W_=this.W_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):W():this.W_=this.W_.insert(t,e)}G_(){const e=[];return this.W_.inorderTraversal((t,r)=>{e.push(r)}),e}}class Or{constructor(e,t,r,n,s,i,o,l,c){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=n,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,t,r,n,s){const i=[];return t.forEach(o=>{i.push({type:0,doc:o})}),new Or(e,t,Dr.emptySet(t),i,r,n,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ri(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n].type!==r[n].type||!t[n].doc.isEqual(r[n].doc))return!1;return!0}}/**
|
|
2383
|
+
* @license
|
|
2384
|
+
* Copyright 2017 Google LLC
|
|
2385
|
+
*
|
|
2386
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2387
|
+
* you may not use this file except in compliance with the License.
|
|
2388
|
+
* You may obtain a copy of the License at
|
|
2389
|
+
*
|
|
2390
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2391
|
+
*
|
|
2392
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2393
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2394
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2395
|
+
* See the License for the specific language governing permissions and
|
|
2396
|
+
* limitations under the License.
|
|
2397
|
+
*/class sQ{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class iQ{constructor(){this.queries=gg(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,r){const n=q(t),s=n.queries;n.queries=gg(),s.forEach((i,o)=>{for(const l of o.j_)l.onError(r)})})(this,new M(L.ABORTED,"Firestore shutting down"))}}function gg(){return new Rr(A=>_f(A),Ri)}async function pg(A,e){const t=q(A);let r=3;const n=e.query;let s=t.queries.get(n);s?!s.H_()&&e.J_()&&(r=2):(s=new sQ,r=e.J_()?0:1);try{switch(r){case 0:s.z_=await t.onListen(n,!0);break;case 1:s.z_=await t.onListen(n,!1);break;case 2:await t.onFirstRemoteStoreListen(n)}}catch(i){const o=Pl(i,`Initialization of query '${Sr(e.query)}' failed`);return void e.onError(o)}t.queries.set(n,s),s.j_.push(e),e.Z_(t.onlineState),s.z_&&e.X_(s.z_)&&Nl(t)}async function wg(A,e){const t=q(A),r=e.query;let n=3;const s=t.queries.get(r);if(s){const i=s.j_.indexOf(e);i>=0&&(s.j_.splice(i,1),s.j_.length===0?n=e.J_()?0:1:!s.H_()&&e.J_()&&(n=2))}switch(n){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function oQ(A,e){const t=q(A);let r=!1;for(const n of e){const s=n.query,i=t.queries.get(s);if(i){for(const o of i.j_)o.X_(n)&&(r=!0);i.z_=n}}r&&Nl(t)}function aQ(A,e,t){const r=q(A),n=r.queries.get(e);if(n)for(const s of n.j_)s.onError(t);r.queries.delete(e)}function Nl(A){A.Y_.forEach(e=>{e.next()})}var Vl,Bg;(Bg=Vl||(Vl={})).ea="default",Bg.Cache="cache";class mg{constructor(e,t,r){this.query=e,this.ta=t,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const n of e.docChanges)n.type!==3&&r.push(n);e=new Or(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.na?this.ia(e)&&(this.ta.next(e),t=!0):this.sa(e,this.onlineState)&&(this.oa(e),t=!0),this.ra=e,t}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let t=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),t=!0),t}sa(e,t){if(!e.fromCache||!this.J_())return!0;const r=t!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const t=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}oa(e){e=Or.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==Vl.Cache}}/**
|
|
2398
|
+
* @license
|
|
2399
|
+
* Copyright 2017 Google LLC
|
|
2400
|
+
*
|
|
2401
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2402
|
+
* you may not use this file except in compliance with the License.
|
|
2403
|
+
* You may obtain a copy of the License at
|
|
2404
|
+
*
|
|
2405
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2406
|
+
*
|
|
2407
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2408
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2409
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2410
|
+
* See the License for the specific language governing permissions and
|
|
2411
|
+
* limitations under the License.
|
|
2412
|
+
*/class yg{constructor(e){this.key=e}}class vg{constructor(e){this.key=e}}class lQ{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=z(),this.mutatedKeys=z(),this.Aa=Cf(e),this.Ra=new Dr(this.Aa)}get Va(){return this.Ta}ma(e,t){const r=t?t.fa:new fg,n=t?t.Ra:this.Ra;let s=t?t.mutatedKeys:this.mutatedKeys,i=n,o=!1;const l=this.query.limitType==="F"&&n.size===this.query.limit?n.last():null,c=this.query.limitType==="L"&&n.size===this.query.limit?n.first():null;if(e.inorderTraversal((u,d)=>{const g=n.get(u),p=xi(this.query,d)?d:null,B=!!g&&this.mutatedKeys.has(g.key),C=!!p&&(p.hasLocalMutations||this.mutatedKeys.has(p.key)&&p.hasCommittedMutations);let E=!1;g&&p?g.data.isEqual(p.data)?B!==C&&(r.track({type:3,doc:p}),E=!0):this.ga(g,p)||(r.track({type:2,doc:p}),E=!0,(l&&this.Aa(p,l)>0||c&&this.Aa(p,c)<0)&&(o=!0)):!g&&p?(r.track({type:0,doc:p}),E=!0):g&&!p&&(r.track({type:1,doc:g}),E=!0,(l||c)&&(o=!0)),E&&(p?(i=i.add(p),s=C?s.add(u):s.delete(u)):(i=i.delete(u),s=s.delete(u)))}),this.query.limit!==null)for(;i.size>this.query.limit;){const u=this.query.limitType==="F"?i.last():i.first();i=i.delete(u.key),s=s.delete(u.key),r.track({type:1,doc:u})}return{Ra:i,fa:r,ns:o,mutatedKeys:s}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,n){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const i=e.fa.G_();i.sort((u,d)=>function(p,B){const C=E=>{switch(E){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return W()}};return C(p)-C(B)}(u.type,d.type)||this.Aa(u.doc,d.doc)),this.pa(r),n=n!=null&&n;const o=t&&!n?this.ya():[],l=this.da.size===0&&this.current&&!n?1:0,c=l!==this.Ea;return this.Ea=l,i.length!==0||c?{snapshot:new Or(this.query,e.Ra,s,i,e.mutatedKeys,l===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:o}:{wa:o}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new fg,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(t=>this.Ta=this.Ta.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ta=this.Ta.delete(t)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=z(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const t=[];return e.forEach(r=>{this.da.has(r)||t.push(new vg(r))}),this.da.forEach(r=>{e.has(r)||t.push(new yg(r))}),t}ba(e){this.Ta=e.Ts,this.da=z();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return Or.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class cQ{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class uQ{constructor(e){this.key=e,this.va=!1}}class hQ{constructor(e,t,r,n,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=n,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.Ca={},this.Fa=new Rr(o=>_f(o),Ri),this.Ma=new Map,this.xa=new Set,this.Oa=new de(j.comparator),this.Na=new Map,this.La=new Il,this.Ba={},this.ka=new Map,this.qa=Hr.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function dQ(A,e,t=!0){const r=Fg(A);let n;const s=r.Fa.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),n=s.view.Da()):n=await _g(r,e,t,!0),n}async function fQ(A,e){const t=Fg(A);await _g(t,e,!0,!1)}async function _g(A,e,t,r){const n=await LU(A.localStore,Mt(e)),s=n.targetId,i=A.sharedClientState.addLocalQueryTarget(s,t);let o;return r&&(o=await gQ(A,e,s,i==="current",n.resumeToken)),A.isPrimaryClient&&t&&og(A.remoteStore,n),o}async function gQ(A,e,t,r,n){A.Ka=(d,g,p)=>async function(C,E,I,Q){let S=E.view.ma(I);S.ns&&(S=await Ag(C.localStore,E.query,!1).then(({documents:_})=>E.view.ma(_,S)));const k=Q&&Q.targetChanges.get(E.targetId),H=Q&&Q.targetMismatches.get(E.targetId)!=null,R=E.view.applyChanges(S,C.isPrimaryClient,k,H);return Ig(C,E.targetId,R.wa),R.snapshot}(A,d,g,p);const s=await Ag(A.localStore,e,!0),i=new lQ(e,s.Ts),o=i.ma(s.documents),l=jn.createSynthesizedTargetChangeForCurrentChange(t,r&&A.onlineState!=="Offline",n),c=i.applyChanges(o,A.isPrimaryClient,l);Ig(A,t,c.wa);const u=new cQ(e,t,i);return A.Fa.set(e,u),A.Ma.has(t)?A.Ma.get(t).push(e):A.Ma.set(t,[e]),c.snapshot}async function pQ(A,e,t){const r=q(A),n=r.Fa.get(e),s=r.Ma.get(n.targetId);if(s.length>1)return r.Ma.set(n.targetId,s.filter(i=>!Ri(i,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(n.targetId),r.sharedClientState.isActiveQueryTarget(n.targetId)||await Sl(r.localStore,n.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(n.targetId),t&&kl(r.remoteStore,n.targetId),Ml(r,n.targetId)}).catch(Tn)):(Ml(r,n.targetId),await Sl(r.localStore,n.targetId,!0))}async function wQ(A,e){const t=q(A),r=t.Fa.get(e),n=t.Ma.get(r.targetId);t.isPrimaryClient&&n.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),kl(t.remoteStore,r.targetId))}async function BQ(A,e,t){const r=bQ(A);try{const n=await function(i,o){const l=q(i),c=Fe.now(),u=o.reduce((p,B)=>p.add(B.key),z());let d,g;return l.persistence.runTransaction("Locally write mutations","readwrite",p=>{let B=AA(),C=z();return l.cs.getEntries(p,u).next(E=>{B=E,B.forEach((I,Q)=>{Q.isValidDocument()||(C=C.add(I))})}).next(()=>l.localDocuments.getOverlayedDocuments(p,B)).next(E=>{d=E;const I=[];for(const Q of o){const S=Nb(Q,d.get(Q.key).overlayedDocument);S!=null&&I.push(new QA(Q.key,S,cf(S.value.mapValue),It.exists(!0)))}return l.mutationQueue.addMutationBatch(p,c,I,o)}).next(E=>{g=E;const I=E.applyToLocalDocumentSet(d,C);return l.documentOverlayCache.saveOverlays(p,E.batchId,I)})}).then(()=>({batchId:g.batchId,changes:bf(d)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(n.batchId),function(i,o,l){let c=i.Ba[i.currentUser.toKey()];c||(c=new de(ee)),c=c.insert(o,l),i.Ba[i.currentUser.toKey()]=c}(r,n.batchId,t),await Wn(r,n.changes),await $i(r.remoteStore)}catch(n){const s=Pl(n,"Failed to persist write");t.reject(s)}}async function Cg(A,e){const t=q(A);try{const r=await xU(t.localStore,e);e.targetChanges.forEach((n,s)=>{const i=t.Na.get(s);i&&(re(n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size<=1),n.addedDocuments.size>0?i.va=!0:n.modifiedDocuments.size>0?re(i.va):n.removedDocuments.size>0&&(re(i.va),i.va=!1))}),await Wn(t,r,e)}catch(r){await Tn(r)}}function Eg(A,e,t){const r=q(A);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const n=[];r.Fa.forEach((s,i)=>{const o=i.view.Z_(e);o.snapshot&&n.push(o.snapshot)}),function(i,o){const l=q(i);l.onlineState=o;let c=!1;l.queries.forEach((u,d)=>{for(const g of d.j_)g.Z_(o)&&(c=!0)}),c&&Nl(l)}(r.eventManager,e),n.length&&r.Ca.d_(n),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function mQ(A,e,t){const r=q(A);r.sharedClientState.updateQueryState(e,"rejected",t);const n=r.Na.get(e),s=n&&n.key;if(s){let i=new de(j.comparator);i=i.insert(s,Ke.newNoDocument(s,J.min()));const o=z().add(s),l=new Pi(J.min(),new Map,new de(ee),i,o);await Cg(r,l),r.Oa=r.Oa.remove(s),r.Na.delete(e),Kl(r)}else await Sl(r.localStore,e,!1).then(()=>Ml(r,e,t)).catch(Tn)}async function yQ(A,e){const t=q(A),r=e.batch.batchId;try{const n=await RU(t.localStore,e);Ug(t,r,null),bg(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Wn(t,n)}catch(n){await Tn(n)}}async function vQ(A,e,t){const r=q(A);try{const n=await function(i,o){const l=q(i);return l.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let u;return l.mutationQueue.lookupMutationBatch(c,o).next(d=>(re(d!==null),u=d.keys(),l.mutationQueue.removeMutationBatch(c,d))).next(()=>l.mutationQueue.performConsistencyCheck(c)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(c,u,o)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,u)).next(()=>l.localDocuments.getDocuments(c,u))})}(r.localStore,e);Ug(r,e,t),bg(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Wn(r,n)}catch(n){await Tn(n)}}function bg(A,e){(A.ka.get(e)||[]).forEach(t=>{t.resolve()}),A.ka.delete(e)}function Ug(A,e,t){const r=q(A);let n=r.Ba[r.currentUser.toKey()];if(n){const s=n.get(e);s&&(t?s.reject(t):s.resolve(),n=n.remove(e)),r.Ba[r.currentUser.toKey()]=n}}function Ml(A,e,t=null){A.sharedClientState.removeLocalQueryTarget(e);for(const r of A.Ma.get(e))A.Fa.delete(r),t&&A.Ca.$a(r,t);A.Ma.delete(e),A.isPrimaryClient&&A.La.gr(e).forEach(r=>{A.La.containsKey(r)||Qg(A,r)})}function Qg(A,e){A.xa.delete(e.path.canonicalString());const t=A.Oa.get(e);t!==null&&(kl(A.remoteStore,t),A.Oa=A.Oa.remove(e),A.Na.delete(t),Kl(A))}function Ig(A,e,t){for(const r of t)r instanceof yg?(A.La.addReference(r.key,e),_Q(A,r)):r instanceof vg?(G("SyncEngine","Document no longer in limbo: "+r.key),A.La.removeReference(r.key,e),A.La.containsKey(r.key)||Qg(A,r.key)):W()}function _Q(A,e){const t=e.key,r=t.path.canonicalString();A.Oa.get(t)||A.xa.has(r)||(G("SyncEngine","New document in limbo: "+t),A.xa.add(r),Kl(A))}function Kl(A){for(;A.xa.size>0&&A.Oa.size<A.maxConcurrentLimboResolutions;){const e=A.xa.values().next().value;A.xa.delete(e);const t=new j(ce.fromString(e)),r=A.qa.next();A.Na.set(r,new uQ(t)),A.Oa=A.Oa.insert(t,r),og(A.remoteStore,new IA(Mt(gl(t.path)),r,"TargetPurposeLimboResolution",sl.oe))}}async function Wn(A,e,t){const r=q(A),n=[],s=[],i=[];r.Fa.isEmpty()||(r.Fa.forEach((o,l)=>{i.push(r.Ka(l,e,t).then(c=>{var u;if((c||t)&&r.isPrimaryClient){const d=c?!c.fromCache:(u=t==null?void 0:t.targetChanges.get(l.targetId))===null||u===void 0?void 0:u.current;r.sharedClientState.updateQueryState(l.targetId,d?"current":"not-current")}if(c){n.push(c);const d=Tl.Wi(l.targetId,c);s.push(d)}}))}),await Promise.all(i),r.Ca.d_(n),await async function(l,c){const u=q(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>D.forEach(c,g=>D.forEach(g.$i,p=>u.persistence.referenceDelegate.addReference(d,g.targetId,p)).next(()=>D.forEach(g.Ui,p=>u.persistence.referenceDelegate.removeReference(d,g.targetId,p)))))}catch(d){if(!Sn(d))throw d;G("LocalStore","Failed to update sequence numbers: "+d)}for(const d of c){const g=d.targetId;if(!d.fromCache){const p=u.os.get(g),B=p.snapshotVersion,C=p.withLastLimboFreeSnapshotVersion(B);u.os=u.os.insert(g,C)}}}(r.localStore,s))}async function CQ(A,e){const t=q(A);if(!t.currentUser.isEqual(e)){G("SyncEngine","User change. New user:",e.toKey());const r=await eg(t.localStore,e);t.currentUser=e,function(s,i){s.ka.forEach(o=>{o.forEach(l=>{l.reject(new M(L.CANCELLED,i))})}),s.ka.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Wn(t,r.hs)}}function EQ(A,e){const t=q(A),r=t.Na.get(e);if(r&&r.va)return z().add(r.key);{let n=z();const s=t.Ma.get(e);if(!s)return n;for(const i of s){const o=t.Fa.get(i);n=n.unionWith(o.view.Va)}return n}}function Fg(A){const e=q(A);return e.remoteStore.remoteSyncer.applyRemoteEvent=Cg.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=EQ.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=mQ.bind(null,e),e.Ca.d_=oQ.bind(null,e.eventManager),e.Ca.$a=aQ.bind(null,e.eventManager),e}function bQ(A){const e=q(A);return e.remoteStore.remoteSyncer.applySuccessfulWrite=yQ.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=vQ.bind(null,e),e}class Wi{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Ki(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,t){return null}Ha(e,t){return null}za(e){return SU(this.persistence,new FU,e.initialUser,this.serializer)}Ga(e){return new UU(Fl.Zr,this.serializer)}Wa(e){return new OU}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Wi.provider={build:()=>new Wi};class Gl{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Eg(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=CQ.bind(null,this.syncEngine),await nQ(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new iQ}()}createDatastore(e){const t=Ki(e.databaseInfo.databaseId),r=function(s){return new MU(s)}(e.databaseInfo);return function(s,i,o,l){return new jU(s,i,o,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,n,s,i,o){return new WU(r,n,s,i,o)}(this.localStore,this.datastore,e.asyncQueue,t=>Eg(this.syncEngine,t,0),function(){return ng.D()?new ng:new PU}())}createSyncEngine(e,t){return function(n,s,i,o,l,c,u){const d=new hQ(n,s,i,o,l,c);return u&&(d.Qa=!0),d}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(n){const s=q(n);G("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await $n(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}Gl.provider={build:()=>new Gl};/**
|
|
2413
|
+
* @license
|
|
2414
|
+
* Copyright 2020 Google LLC
|
|
2415
|
+
*
|
|
2416
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2417
|
+
* you may not use this file except in compliance with the License.
|
|
2418
|
+
* You may obtain a copy of the License at
|
|
2419
|
+
*
|
|
2420
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2421
|
+
*
|
|
2422
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2423
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2424
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2425
|
+
* See the License for the specific language governing permissions and
|
|
2426
|
+
* limitations under the License.
|
|
2427
|
+
*//**
|
|
2428
|
+
* @license
|
|
2429
|
+
* Copyright 2017 Google LLC
|
|
2430
|
+
*
|
|
2431
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2432
|
+
* you may not use this file except in compliance with the License.
|
|
2433
|
+
* You may obtain a copy of the License at
|
|
2434
|
+
*
|
|
2435
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2436
|
+
*
|
|
2437
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2438
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2439
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2440
|
+
* See the License for the specific language governing permissions and
|
|
2441
|
+
* limitations under the License.
|
|
2442
|
+
*/class Tg{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):tA("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
|
|
2443
|
+
* @license
|
|
2444
|
+
* Copyright 2017 Google LLC
|
|
2445
|
+
*
|
|
2446
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2447
|
+
* you may not use this file except in compliance with the License.
|
|
2448
|
+
* You may obtain a copy of the License at
|
|
2449
|
+
*
|
|
2450
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2451
|
+
*
|
|
2452
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2453
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2454
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2455
|
+
* See the License for the specific language governing permissions and
|
|
2456
|
+
* limitations under the License.
|
|
2457
|
+
*/class UQ{constructor(e,t,r,n,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=n,this.user=Me.UNAUTHENTICATED,this.clientId=Zd.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async i=>{G("FirestoreClient","Received user=",i.uid),await this.authCredentialListener(i),this.user=i}),this.appCheckCredentials.start(r,i=>(G("FirestoreClient","Received new app check token=",i),this.appCheckCredentialListener(i,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new EA;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=Pl(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function jl(A,e){A.asyncQueue.verifyOperationInProgress(),G("FirestoreClient","Initializing OfflineComponentProvider");const t=A.configuration;await e.initialize(t);let r=t.initialUser;A.setCredentialChangeListener(async n=>{r.isEqual(n)||(await eg(e.localStore,n),r=n)}),e.persistence.setDatabaseDeletedListener(()=>A.terminate()),A._offlineComponents=e}async function Sg(A,e){A.asyncQueue.verifyOperationInProgress();const t=await QQ(A);G("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,A.configuration),A.setCredentialChangeListener(r=>dg(e.remoteStore,r)),A.setAppCheckTokenChangeListener((r,n)=>dg(e.remoteStore,n)),A._onlineComponents=e}async function QQ(A){if(!A._offlineComponents)if(A._uninitializedComponentsProvider){G("FirestoreClient","Using user provided OfflineComponentProvider");try{await jl(A,A._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(n){return n.name==="FirebaseError"?n.code===L.FAILED_PRECONDITION||n.code===L.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11}(t))throw t;Qr("Error using user provided cache. Falling back to memory cache: "+t),await jl(A,new Wi)}}else G("FirestoreClient","Using default OfflineComponentProvider"),await jl(A,new Wi);return A._offlineComponents}async function Rg(A){return A._onlineComponents||(A._uninitializedComponentsProvider?(G("FirestoreClient","Using user provided OnlineComponentProvider"),await Sg(A,A._uninitializedComponentsProvider._online)):(G("FirestoreClient","Using default OnlineComponentProvider"),await Sg(A,new Gl))),A._onlineComponents}function IQ(A){return Rg(A).then(e=>e.syncEngine)}async function $l(A){const e=await Rg(A),t=e.eventManager;return t.onListen=dQ.bind(null,e.syncEngine),t.onUnlisten=pQ.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=fQ.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=wQ.bind(null,e.syncEngine),t}function FQ(A,e,t={}){const r=new EA;return A.asyncQueue.enqueueAndForget(async()=>function(s,i,o,l,c){const u=new Tg({next:g=>{u.Za(),i.enqueueAndForget(()=>wg(s,d)),g.fromCache&&l.source==="server"?c.reject(new M(L.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(g)},error:g=>c.reject(g)}),d=new mg(o,u,{includeMetadataChanges:!0,_a:!0});return pg(s,d)}(await $l(A),A.asyncQueue,e,t,r)),r.promise}/**
|
|
2458
|
+
* @license
|
|
2459
|
+
* Copyright 2023 Google LLC
|
|
2460
|
+
*
|
|
2461
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2462
|
+
* you may not use this file except in compliance with the License.
|
|
2463
|
+
* You may obtain a copy of the License at
|
|
2464
|
+
*
|
|
2465
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2466
|
+
*
|
|
2467
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2468
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2469
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2470
|
+
* See the License for the specific language governing permissions and
|
|
2471
|
+
* limitations under the License.
|
|
2472
|
+
*/function xg(A){const e={};return A.timeoutSeconds!==void 0&&(e.timeoutSeconds=A.timeoutSeconds),e}/**
|
|
2473
|
+
* @license
|
|
2474
|
+
* Copyright 2020 Google LLC
|
|
2475
|
+
*
|
|
2476
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2477
|
+
* you may not use this file except in compliance with the License.
|
|
2478
|
+
* You may obtain a copy of the License at
|
|
2479
|
+
*
|
|
2480
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2481
|
+
*
|
|
2482
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2483
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2484
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2485
|
+
* See the License for the specific language governing permissions and
|
|
2486
|
+
* limitations under the License.
|
|
2487
|
+
*/const kg=new Map;/**
|
|
2488
|
+
* @license
|
|
2489
|
+
* Copyright 2017 Google LLC
|
|
2490
|
+
*
|
|
2491
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2492
|
+
* you may not use this file except in compliance with the License.
|
|
2493
|
+
* You may obtain a copy of the License at
|
|
2494
|
+
*
|
|
2495
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2496
|
+
*
|
|
2497
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2498
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2499
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2500
|
+
* See the License for the specific language governing permissions and
|
|
2501
|
+
* limitations under the License.
|
|
2502
|
+
*/function Hg(A,e,t){if(!t)throw new M(L.INVALID_ARGUMENT,`Function ${A}() cannot be called with an empty ${e}.`)}function TQ(A,e,t,r){if(e===!0&&r===!0)throw new M(L.INVALID_ARGUMENT,`${A} and ${t} cannot be used together.`)}function Lg(A){if(!j.isDocumentKey(A))throw new M(L.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${A} has ${A.length}.`)}function Dg(A){if(j.isDocumentKey(A))throw new M(L.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${A} has ${A.length}.`)}function qi(A){if(A===void 0)return"undefined";if(A===null)return"null";if(typeof A=="string")return A.length>20&&(A=`${A.substring(0,20)}...`),JSON.stringify(A);if(typeof A=="number"||typeof A=="boolean")return""+A;if(typeof A=="object"){if(A instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(A);return e?`a custom ${e} object`:"an object"}}return typeof A=="function"?"a function":W()}function Gt(A,e){if("_delegate"in A&&(A=A._delegate),!(A instanceof e)){if(e.name===A.constructor.name)throw new M(L.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=qi(A);throw new M(L.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return A}/**
|
|
2503
|
+
* @license
|
|
2504
|
+
* Copyright 2020 Google LLC
|
|
2505
|
+
*
|
|
2506
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2507
|
+
* you may not use this file except in compliance with the License.
|
|
2508
|
+
* You may obtain a copy of the License at
|
|
2509
|
+
*
|
|
2510
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2511
|
+
*
|
|
2512
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2513
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2514
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2515
|
+
* See the License for the specific language governing permissions and
|
|
2516
|
+
* limitations under the License.
|
|
2517
|
+
*/class Og{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new M(L.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new M(L.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}TQ("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=xg((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new M(L.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new M(L.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new M(L.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,n){return r.timeoutSeconds===n.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ji{constructor(e,t,r,n){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Og({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new M(L.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new M(L.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Og(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new JE;switch(r.type){case"firstParty":return new ZE(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new M(L.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=kg.get(t);r&&(G("ComponentProvider","Removing Datastore"),kg.delete(t),r.terminate())}(this),Promise.resolve()}}function SQ(A,e,t,r={}){var n;const s=(A=Gt(A,Ji))._getSettings(),i=`${e}:${t}`;if(s.host!=="firestore.googleapis.com"&&s.host!==i&&Qr("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),A._setSettings(Object.assign(Object.assign({},s),{host:i,ssl:!1})),r.mockUserToken){let o,l;if(typeof r.mockUserToken=="string")o=r.mockUserToken,l=Me.MOCK_USER;else{o=Ed(r.mockUserToken,(n=A._app)===null||n===void 0?void 0:n.options.projectId);const c=r.mockUserToken.sub||r.mockUserToken.user_id;if(!c)throw new M(L.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new Me(c)}A._authCredentials=new XE(new Yd(o,l))}}/**
|
|
2518
|
+
* @license
|
|
2519
|
+
* Copyright 2020 Google LLC
|
|
2520
|
+
*
|
|
2521
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2522
|
+
* you may not use this file except in compliance with the License.
|
|
2523
|
+
* You may obtain a copy of the License at
|
|
2524
|
+
*
|
|
2525
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2526
|
+
*
|
|
2527
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2528
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2529
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2530
|
+
* See the License for the specific language governing permissions and
|
|
2531
|
+
* limitations under the License.
|
|
2532
|
+
*/class YA{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new YA(this.firestore,e,this._query)}}class it{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new TA(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new it(this.firestore,e,this._key)}}class TA extends YA{constructor(e,t,r){super(e,t,gl(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new it(this.firestore,null,new j(e))}withConverter(e){return new TA(this.firestore,e,this._path)}}function qn(A,e,...t){if(A=nt(A),Hg("collection","path",e),A instanceof Ji){const r=ce.fromString(e,...t);return Dg(r),new TA(A,null,r)}{if(!(A instanceof it||A instanceof TA))throw new M(L.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=A._path.child(ce.fromString(e,...t));return Dg(r),new TA(A.firestore,null,r)}}function Wl(A,e,...t){if(A=nt(A),arguments.length===1&&(e=Zd.newId()),Hg("doc","path",e),A instanceof Ji){const r=ce.fromString(e,...t);return Lg(r),new it(A,null,new j(r))}{if(!(A instanceof it||A instanceof TA))throw new M(L.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=A._path.child(ce.fromString(e,...t));return Lg(r),new it(A.firestore,A instanceof TA?A.converter:null,new j(r))}}/**
|
|
2533
|
+
* @license
|
|
2534
|
+
* Copyright 2020 Google LLC
|
|
2535
|
+
*
|
|
2536
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2537
|
+
* you may not use this file except in compliance with the License.
|
|
2538
|
+
* You may obtain a copy of the License at
|
|
2539
|
+
*
|
|
2540
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2541
|
+
*
|
|
2542
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2543
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2544
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2545
|
+
* See the License for the specific language governing permissions and
|
|
2546
|
+
* limitations under the License.
|
|
2547
|
+
*/class Pg{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new sg(this,"async_queue_retry"),this.Vu=()=>{const r=xl();r&&G("AsyncQueue","Visibility state changed to "+r.visibilityState),this.t_.jo()},this.mu=e;const t=xl();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;const t=xl();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const t=new EA;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(this.Pu.length!==0){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!Sn(e))throw e;G("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){const t=this.mu.then(()=>(this.du=!0,e().catch(r=>{this.Eu=r,this.du=!1;const n=function(i){let o=i.message||"";return i.stack&&(o=i.stack.includes(i.message)?i.stack:i.message+`
|
|
2548
|
+
`+i.stack),o}(r);throw tA("INTERNAL UNHANDLED ERROR: ",n),r}).then(r=>(this.du=!1,r))));return this.mu=t,t}enqueueAfterDelay(e,t,r){this.fu(),this.Ru.indexOf(e)>-1&&(t=0);const n=Ol.createAndSchedule(this,e,t,r,s=>this.yu(s));return this.Tu.push(n),n}fu(){this.Eu&&W()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(const t of this.Tu)if(t.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{this.Tu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.Tu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){const t=this.Tu.indexOf(e);this.Tu.splice(t,1)}}function Ng(A){return function(t,r){if(typeof t!="object"||t===null)return!1;const n=t;for(const s of r)if(s in n&&typeof n[s]=="function")return!0;return!1}(A,["next","error","complete"])}class ZA extends Ji{constructor(e,t,r,n){super(e,t,r,n),this.type="firestore",this._queue=new Pg,this._persistenceKey=(n==null?void 0:n.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Pg(e),this._firestoreClient=void 0,await e}}}function RQ(A,e){const t=typeof A=="object"?A:Od(),r=typeof A=="string"?A:"(default)",n=Hd(t,"firestore").getImmediate({identifier:r});if(!n._initialized){const s=_d("firestore");s&&SQ(n,...s)}return n}function ql(A){if(A._terminated)throw new M(L.FAILED_PRECONDITION,"The client has already been terminated.");return A._firestoreClient||xQ(A),A._firestoreClient}function xQ(A){var e,t,r;const n=A._freezeSettings(),s=function(o,l,c,u){return new hb(o,l,c,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,xg(u.experimentalLongPollingOptions),u.useFetchStreams)}(A._databaseId,((e=A._app)===null||e===void 0?void 0:e.options.appId)||"",A._persistenceKey,n);A._componentsProvider||!((t=n.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=n.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(A._componentsProvider={_offline:n.localCache._offlineComponentProvider,_online:n.localCache._onlineComponentProvider}),A._firestoreClient=new UQ(A._authCredentials,A._appCheckCredentials,A._queue,s,A._componentsProvider&&function(o){const l=o==null?void 0:o._online.build();return{_offline:o==null?void 0:o._offline.build(l),_online:l}}(A._componentsProvider))}/**
|
|
2549
|
+
* @license
|
|
2550
|
+
* Copyright 2020 Google LLC
|
|
2551
|
+
*
|
|
2552
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2553
|
+
* you may not use this file except in compliance with the License.
|
|
2554
|
+
* You may obtain a copy of the License at
|
|
2555
|
+
*
|
|
2556
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2557
|
+
*
|
|
2558
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2559
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2560
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2561
|
+
* See the License for the specific language governing permissions and
|
|
2562
|
+
* limitations under the License.
|
|
2563
|
+
*/class Pr{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Pr(Oe.fromBase64String(e))}catch(t){throw new M(L.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new Pr(Oe.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
|
|
2564
|
+
* @license
|
|
2565
|
+
* Copyright 2020 Google LLC
|
|
2566
|
+
*
|
|
2567
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2568
|
+
* you may not use this file except in compliance with the License.
|
|
2569
|
+
* You may obtain a copy of the License at
|
|
2570
|
+
*
|
|
2571
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2572
|
+
*
|
|
2573
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2574
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2575
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2576
|
+
* See the License for the specific language governing permissions and
|
|
2577
|
+
* limitations under the License.
|
|
2578
|
+
*/class Xi{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new M(L.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new He(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
|
|
2579
|
+
* @license
|
|
2580
|
+
* Copyright 2020 Google LLC
|
|
2581
|
+
*
|
|
2582
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2583
|
+
* you may not use this file except in compliance with the License.
|
|
2584
|
+
* You may obtain a copy of the License at
|
|
2585
|
+
*
|
|
2586
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2587
|
+
*
|
|
2588
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2589
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2590
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2591
|
+
* See the License for the specific language governing permissions and
|
|
2592
|
+
* limitations under the License.
|
|
2593
|
+
*/class Jl{constructor(e){this._methodName=e}}/**
|
|
2594
|
+
* @license
|
|
2595
|
+
* Copyright 2017 Google LLC
|
|
2596
|
+
*
|
|
2597
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2598
|
+
* you may not use this file except in compliance with the License.
|
|
2599
|
+
* You may obtain a copy of the License at
|
|
2600
|
+
*
|
|
2601
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2602
|
+
*
|
|
2603
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2604
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2605
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2606
|
+
* See the License for the specific language governing permissions and
|
|
2607
|
+
* limitations under the License.
|
|
2608
|
+
*/class Xl{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new M(L.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new M(L.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return ee(this._lat,e._lat)||ee(this._long,e._long)}}/**
|
|
2609
|
+
* @license
|
|
2610
|
+
* Copyright 2024 Google LLC
|
|
2611
|
+
*
|
|
2612
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2613
|
+
* you may not use this file except in compliance with the License.
|
|
2614
|
+
* You may obtain a copy of the License at
|
|
2615
|
+
*
|
|
2616
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2617
|
+
*
|
|
2618
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2619
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2620
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2621
|
+
* See the License for the specific language governing permissions and
|
|
2622
|
+
* limitations under the License.
|
|
2623
|
+
*/class zl{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,n){if(r.length!==n.length)return!1;for(let s=0;s<r.length;++s)if(r[s]!==n[s])return!1;return!0}(this._values,e._values)}}/**
|
|
2624
|
+
* @license
|
|
2625
|
+
* Copyright 2017 Google LLC
|
|
2626
|
+
*
|
|
2627
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2628
|
+
* you may not use this file except in compliance with the License.
|
|
2629
|
+
* You may obtain a copy of the License at
|
|
2630
|
+
*
|
|
2631
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2632
|
+
*
|
|
2633
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2634
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2635
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2636
|
+
* See the License for the specific language governing permissions and
|
|
2637
|
+
* limitations under the License.
|
|
2638
|
+
*/const kQ=/^__.*__$/;class HQ{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new QA(e,this.data,this.fieldMask,t,this.fieldTransforms):new Kn(e,this.data,t,this.fieldTransforms)}}class Vg{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new QA(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function Mg(A){switch(A){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw W()}}class Yl{constructor(e,t,r,n,s,i){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=n,s===void 0&&this.vu(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new Yl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Mu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),n=this.Fu({path:r,xu:!1});return n.Ou(e),n}Nu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),n=this.Fu({path:r,xu:!1});return n.vu(),n}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return Yi(e,this.settings.methodName,this.settings.ku||!1,this.path,this.settings.qu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}vu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Ou(this.path.get(e))}Ou(e){if(e.length===0)throw this.Bu("Document fields must not be empty");if(Mg(this.Cu)&&kQ.test(e))throw this.Bu('Document fields cannot begin and end with "__"')}}class LQ{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||Ki(e)}Qu(e,t,r,n=!1){return new Yl({Cu:e,methodName:t,qu:r,path:He.emptyPath(),xu:!1,ku:n},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Zl(A){const e=A._freezeSettings(),t=Ki(A._databaseId);return new LQ(A._databaseId,!!e.ignoreUndefinedProperties,t)}function DQ(A,e,t,r,n,s={}){const i=A.Qu(s.merge||s.mergeFields?2:0,e,t,n);ec("Data must be an object, but it was:",i,r);const o=Kg(r,i);let l,c;if(s.merge)l=new ut(i.fieldMask),c=i.fieldTransforms;else if(s.mergeFields){const u=[];for(const d of s.mergeFields){const g=tc(e,d,t);if(!i.contains(g))throw new M(L.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);jg(u,g)||u.push(g)}l=new ut(u),c=i.fieldTransforms.filter(d=>l.covers(d.field))}else l=null,c=i.fieldTransforms;return new HQ(new st(o),l,c)}class zi extends Jl{_toFieldTransform(e){if(e.Cu!==2)throw e.Cu===1?e.Bu(`${this._methodName}() can only appear at the top level of your update data`):e.Bu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof zi}}function OQ(A,e,t,r){const n=A.Qu(1,e,t);ec("Data must be an object, but it was:",n,r);const s=[],i=st.empty();WA(r,(l,c)=>{const u=Ac(e,l,t);c=nt(c);const d=n.Nu(u);if(c instanceof zi)s.push(u);else{const g=Jn(c,d);g!=null&&(s.push(u),i.set(u,g))}});const o=new ut(s);return new Vg(i,o,n.fieldTransforms)}function PQ(A,e,t,r,n,s){const i=A.Qu(1,e,t),o=[tc(e,r,t)],l=[n];if(s.length%2!=0)throw new M(L.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g<s.length;g+=2)o.push(tc(e,s[g])),l.push(s[g+1]);const c=[],u=st.empty();for(let g=o.length-1;g>=0;--g)if(!jg(c,o[g])){const p=o[g];let B=l[g];B=nt(B);const C=i.Nu(p);if(B instanceof zi)c.push(p);else{const E=Jn(B,C);E!=null&&(c.push(p),u.set(p,E))}}const d=new ut(c);return new Vg(u,d,i.fieldTransforms)}function NQ(A,e,t,r=!1){return Jn(t,A.Qu(r?4:3,e))}function Jn(A,e){if(Gg(A=nt(A)))return ec("Unsupported field value:",e,A),Kg(A,e);if(A instanceof Jl)return function(r,n){if(!Mg(n.Cu))throw n.Bu(`${r._methodName}() can only be used with update() and set()`);if(!n.path)throw n.Bu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(n);s&&n.fieldTransforms.push(s)}(A,e),null;if(A===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),A instanceof Array){if(e.settings.xu&&e.Cu!==4)throw e.Bu("Nested arrays are not supported");return function(r,n){const s=[];let i=0;for(const o of r){let l=Jn(o,n.Lu(i));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),i++}return{arrayValue:{values:s}}}(A,e)}return function(r,n){if((r=nt(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return kb(n.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=Fe.fromDate(r);return{timestampValue:Vi(n.serializer,s)}}if(r instanceof Fe){const s=new Fe(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Vi(n.serializer,s)}}if(r instanceof Xl)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Pr)return{bytesValue:$f(n.serializer,r._byteString)};if(r instanceof it){const s=n.databaseId,i=r.firestore._databaseId;if(!i.isEqual(s))throw n.Bu(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Cl(r.firestore._databaseId||n.databaseId,r._key.path)}}if(r instanceof zl)return function(i,o){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:i.toArray().map(l=>{if(typeof l!="number")throw o.Bu("VectorValues must only contain numeric values.");return Bl(o.serializer,l)})}}}}}}(r,n);throw n.Bu(`Unsupported field value: ${qi(r)}`)}(A,e)}function Kg(A,e){const t={};return tf(A)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):WA(A,(r,n)=>{const s=Jn(n,e.Mu(r));s!=null&&(t[r]=s)}),{mapValue:{fields:t}}}function Gg(A){return!(typeof A!="object"||A===null||A instanceof Array||A instanceof Date||A instanceof Fe||A instanceof Xl||A instanceof Pr||A instanceof it||A instanceof Jl||A instanceof zl)}function ec(A,e,t){if(!Gg(t)||!function(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}(t)){const r=qi(t);throw r==="an object"?e.Bu(A+" a custom object"):e.Bu(A+" "+r)}}function tc(A,e,t){if((e=nt(e))instanceof Xi)return e._internalPath;if(typeof e=="string")return Ac(A,e);throw Yi("Field path arguments must be of type string or ",A,!1,void 0,t)}const VQ=new RegExp("[~\\*/\\[\\]]");function Ac(A,e,t){if(e.search(VQ)>=0)throw Yi(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,A,!1,void 0,t);try{return new Xi(...e.split("."))._internalPath}catch{throw Yi(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,A,!1,void 0,t)}}function Yi(A,e,t,r,n){const s=r&&!r.isEmpty(),i=n!==void 0;let o=`Function ${e}() called with invalid data`;t&&(o+=" (via `toFirestore()`)"),o+=". ";let l="";return(s||i)&&(l+=" (found",s&&(l+=` in field ${r}`),i&&(l+=` in document ${n}`),l+=")"),new M(L.INVALID_ARGUMENT,o+A+l)}function jg(A,e){return A.some(t=>t.isEqual(e))}/**
|
|
2639
|
+
* @license
|
|
2640
|
+
* Copyright 2020 Google LLC
|
|
2641
|
+
*
|
|
2642
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2643
|
+
* you may not use this file except in compliance with the License.
|
|
2644
|
+
* You may obtain a copy of the License at
|
|
2645
|
+
*
|
|
2646
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2647
|
+
*
|
|
2648
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2649
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2650
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2651
|
+
* See the License for the specific language governing permissions and
|
|
2652
|
+
* limitations under the License.
|
|
2653
|
+
*/class $g{constructor(e,t,r,n,s){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=n,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new it(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new MQ(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(rc("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class MQ extends $g{data(){return super.data()}}function rc(A,e){return typeof e=="string"?Ac(A,e):e instanceof Xi?e._internalPath:e._delegate._internalPath}/**
|
|
2654
|
+
* @license
|
|
2655
|
+
* Copyright 2020 Google LLC
|
|
2656
|
+
*
|
|
2657
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2658
|
+
* you may not use this file except in compliance with the License.
|
|
2659
|
+
* You may obtain a copy of the License at
|
|
2660
|
+
*
|
|
2661
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2662
|
+
*
|
|
2663
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2664
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2665
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2666
|
+
* See the License for the specific language governing permissions and
|
|
2667
|
+
* limitations under the License.
|
|
2668
|
+
*/function Wg(A){if(A.limitType==="L"&&A.explicitOrderBy.length===0)throw new M(L.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class nc{}class KQ extends nc{}function qg(A,e,...t){let r=[];e instanceof nc&&r.push(e),r=r.concat(t),function(s){const i=s.filter(l=>l instanceof sc).length,o=s.filter(l=>l instanceof Zi).length;if(i>1||i>0&&o>0)throw new M(L.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const n of r)A=n._apply(A);return A}class Zi extends KQ{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new Zi(e,t,r)}_apply(e){const t=this._parse(e);return zg(e._query,t),new YA(e.firestore,e.converter,pl(e._query,t))}_parse(e){const t=Zl(e.firestore);return function(s,i,o,l,c,u,d){let g;if(c.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new M(L.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){Xg(d,u);const p=[];for(const B of d)p.push(Jg(l,s,B));g={arrayValue:{values:p}}}else g=Jg(l,s,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||Xg(d,u),g=NQ(o,i,d,u==="in"||u==="not-in");return Ce.create(c,u,g)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function eo(A,e,t){const r=e,n=rc("where",A);return Zi._create(n,r,t)}class sc extends nc{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new sc(e,t)}_parse(e){const t=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return t.length===1?t[0]:Qt.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(n,s){let i=n;const o=s.getFlattenedFilters();for(const l of o)zg(i,l),i=pl(i,l)}(e._query,t),new YA(e.firestore,e.converter,pl(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Jg(A,e,t){if(typeof(t=nt(t))=="string"){if(t==="")throw new M(L.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!vf(e)&&t.indexOf("/")!==-1)throw new M(L.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(ce.fromString(t));if(!j.isDocumentKey(r))throw new M(L.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return of(A,new j(r))}if(t instanceof it)return of(A,t._key);throw new M(L.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${qi(t)}.`)}function Xg(A,e){if(!Array.isArray(A)||A.length===0)throw new M(L.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function zg(A,e){const t=function(n,s){for(const i of n)for(const o of i.getFlattenedFilters())if(s.indexOf(o.op)>=0)return o.op;return null}(A.filters,function(n){switch(n){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new M(L.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new M(L.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class GQ{convertValue(e,t="none"){switch(JA(e)){case 0:return null;case 1:return e.booleanValue;case 2:return me(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(qA(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw W()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return WA(e,(n,s)=>{r[n]=this.convertValue(s,t)}),r}convertVectorValue(e){var t,r,n;const s=(n=(r=(t=e.fields)===null||t===void 0?void 0:t.value.arrayValue)===null||r===void 0?void 0:r.values)===null||n===void 0?void 0:n.map(i=>me(i.doubleValue));return new zl(s)}convertGeoPoint(e){return new Xl(me(e.latitude),me(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=ol(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(Rn(e));default:return null}}convertTimestamp(e){const t=UA(e);return new Fe(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=ce.fromString(e);re(Zf(r));const n=new xn(r.get(1),r.get(3)),s=new j(r.popFirst(5));return n.isEqual(t)||tA(`Document ${s} contains a document reference within a different database (${n.projectId}/${n.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}/**
|
|
2669
|
+
* @license
|
|
2670
|
+
* Copyright 2020 Google LLC
|
|
2671
|
+
*
|
|
2672
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2673
|
+
* you may not use this file except in compliance with the License.
|
|
2674
|
+
* You may obtain a copy of the License at
|
|
2675
|
+
*
|
|
2676
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2677
|
+
*
|
|
2678
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2679
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2680
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2681
|
+
* See the License for the specific language governing permissions and
|
|
2682
|
+
* limitations under the License.
|
|
2683
|
+
*/function jQ(A,e,t){let r;return r=A?A.toFirestore(e):e,r}/**
|
|
2684
|
+
* @license
|
|
2685
|
+
* Copyright 2020 Google LLC
|
|
2686
|
+
*
|
|
2687
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2688
|
+
* you may not use this file except in compliance with the License.
|
|
2689
|
+
* You may obtain a copy of the License at
|
|
2690
|
+
*
|
|
2691
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2692
|
+
*
|
|
2693
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2694
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2695
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2696
|
+
* See the License for the specific language governing permissions and
|
|
2697
|
+
* limitations under the License.
|
|
2698
|
+
*/class Xn{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Yg extends $g{constructor(e,t,r,n,s,i){super(e,t,r,n,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new to(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(rc("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class to extends Yg{data(e={}){return super.data(e)}}class Zg{constructor(e,t,r,n){this._firestore=e,this._userDataWriter=t,this._snapshot=n,this.metadata=new Xn(n.hasPendingWrites,n.fromCache),this.query=r}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new to(this._firestore,this._userDataWriter,r.key,r,new Xn(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new M(L.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(n,s){if(n._snapshot.oldDocs.isEmpty()){let i=0;return n._snapshot.docChanges.map(o=>{const l=new to(n._firestore,n._userDataWriter,o.doc.key,o.doc,new Xn(n._snapshot.mutatedKeys.has(o.doc.key),n._snapshot.fromCache),n.query.converter);return o.doc,{type:"added",doc:l,oldIndex:-1,newIndex:i++}})}{let i=n._snapshot.oldDocs;return n._snapshot.docChanges.filter(o=>s||o.type!==3).map(o=>{const l=new to(n._firestore,n._userDataWriter,o.doc.key,o.doc,new Xn(n._snapshot.mutatedKeys.has(o.doc.key),n._snapshot.fromCache),n.query.converter);let c=-1,u=-1;return o.type!==0&&(c=i.indexOf(o.doc.key),i=i.delete(o.doc.key)),o.type!==1&&(i=i.add(o.doc),u=i.indexOf(o.doc.key)),{type:$Q(o.type),doc:l,oldIndex:c,newIndex:u}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function $Q(A){switch(A){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return W()}}class ic extends GQ{constructor(e){super(),this.firestore=e}convertBytes(e){return new Pr(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new it(this.firestore,null,t)}}function ep(A){A=Gt(A,YA);const e=Gt(A.firestore,ZA),t=ql(e),r=new ic(e);return Wg(A._query),FQ(t,A._query).then(n=>new Zg(e,r,A,n))}function WQ(A,e,t,...r){A=Gt(A,it);const n=Gt(A.firestore,ZA),s=Zl(n);let i;return i=typeof(e=nt(e))=="string"||e instanceof Xi?PQ(s,"updateDoc",A._key,e,t,r):OQ(s,"updateDoc",A._key,e),oc(n,[i.toMutation(A._key,It.exists(!0))])}function qQ(A){return oc(Gt(A.firestore,ZA),[new ml(A._key,It.none())])}function tp(A,e){const t=Gt(A.firestore,ZA),r=Wl(A),n=jQ(A.converter,e);return oc(t,[DQ(Zl(A.firestore),"addDoc",r._key,n,A.converter!==null,{}).toMutation(r._key,It.exists(!1))]).then(()=>r)}function JQ(A,...e){var t,r,n;A=nt(A);let s={includeMetadataChanges:!1,source:"default"},i=0;typeof e[i]!="object"||Ng(e[i])||(s=e[i],i++);const o={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(Ng(e[i])){const d=e[i];e[i]=(t=d.next)===null||t===void 0?void 0:t.bind(d),e[i+1]=(r=d.error)===null||r===void 0?void 0:r.bind(d),e[i+2]=(n=d.complete)===null||n===void 0?void 0:n.bind(d)}let l,c,u;if(A instanceof it)c=Gt(A.firestore,ZA),u=gl(A._key.path),l={next:d=>{e[i]&&e[i](XQ(c,A,d))},error:e[i+1],complete:e[i+2]};else{const d=Gt(A,YA);c=Gt(d.firestore,ZA),u=d._query;const g=new ic(c);l={next:p=>{e[i]&&e[i](new Zg(c,g,d,p))},error:e[i+1],complete:e[i+2]},Wg(A._query)}return function(g,p,B,C){const E=new Tg(C),I=new mg(p,E,B);return g.asyncQueue.enqueueAndForget(async()=>pg(await $l(g),I)),()=>{E.Za(),g.asyncQueue.enqueueAndForget(async()=>wg(await $l(g),I))}}(ql(c),u,o,l)}function oc(A,e){return function(r,n){const s=new EA;return r.asyncQueue.enqueueAndForget(async()=>BQ(await IQ(r),n,s)),s.promise}(ql(A),e)}function XQ(A,e,t){const r=t.docs.get(e._key),n=new ic(A);return new Yg(A,n,e._key,r,new Xn(t.hasPendingWrites,t.fromCache),e.converter)}(function(e,t=!0){(function(n){Ur=n})(Ld),bn(new br("firestore",(r,{instanceIdentifier:n,options:s})=>{const i=r.getProvider("app").getImmediate(),o=new ZA(new zE(r.getProvider("auth-internal")),new tb(r.getProvider("app-check-internal")),function(c,u){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new M(L.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new xn(c.options.projectId,u)}(i,n),i);return s=Object.assign({useFetchStreams:t},s),o._setSettings(s),o},"PUBLIC").setMultipleInstances(!0)),CA(zd,"4.7.3",e),CA(zd,"4.7.3","esm2017")})();/**
|
|
2699
|
+
* @license
|
|
2700
|
+
* Copyright 2017 Google LLC
|
|
2701
|
+
*
|
|
2702
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2703
|
+
* you may not use this file except in compliance with the License.
|
|
2704
|
+
* You may obtain a copy of the License at
|
|
2705
|
+
*
|
|
2706
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2707
|
+
*
|
|
2708
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2709
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2710
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2711
|
+
* See the License for the specific language governing permissions and
|
|
2712
|
+
* limitations under the License.
|
|
2713
|
+
*/const Ap="firebasestorage.googleapis.com",rp="storageBucket",zQ=2*60*1e3,YQ=10*60*1e3;/**
|
|
2714
|
+
* @license
|
|
2715
|
+
* Copyright 2017 Google LLC
|
|
2716
|
+
*
|
|
2717
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2718
|
+
* you may not use this file except in compliance with the License.
|
|
2719
|
+
* You may obtain a copy of the License at
|
|
2720
|
+
*
|
|
2721
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2722
|
+
*
|
|
2723
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2724
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2725
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2726
|
+
* See the License for the specific language governing permissions and
|
|
2727
|
+
* limitations under the License.
|
|
2728
|
+
*/let be=class QB extends KA{constructor(e,t,r=0){super(ac(e),`Firebase Storage: ${t} (${ac(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,QB.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return ac(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
|
|
2729
|
+
${this.customData.serverResponse}`:this.message=this._baseMessage}};var fe;(function(A){A.UNKNOWN="unknown",A.OBJECT_NOT_FOUND="object-not-found",A.BUCKET_NOT_FOUND="bucket-not-found",A.PROJECT_NOT_FOUND="project-not-found",A.QUOTA_EXCEEDED="quota-exceeded",A.UNAUTHENTICATED="unauthenticated",A.UNAUTHORIZED="unauthorized",A.UNAUTHORIZED_APP="unauthorized-app",A.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",A.INVALID_CHECKSUM="invalid-checksum",A.CANCELED="canceled",A.INVALID_EVENT_NAME="invalid-event-name",A.INVALID_URL="invalid-url",A.INVALID_DEFAULT_BUCKET="invalid-default-bucket",A.NO_DEFAULT_BUCKET="no-default-bucket",A.CANNOT_SLICE_BLOB="cannot-slice-blob",A.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",A.NO_DOWNLOAD_URL="no-download-url",A.INVALID_ARGUMENT="invalid-argument",A.INVALID_ARGUMENT_COUNT="invalid-argument-count",A.APP_DELETED="app-deleted",A.INVALID_ROOT_OPERATION="invalid-root-operation",A.INVALID_FORMAT="invalid-format",A.INTERNAL_ERROR="internal-error",A.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(fe||(fe={}));function ac(A){return"storage/"+A}function lc(){const A="An unknown error occurred, please check the error payload for server response.";return new be(fe.UNKNOWN,A)}function ZQ(A){return new be(fe.OBJECT_NOT_FOUND,"Object '"+A+"' does not exist.")}function eI(A){return new be(fe.QUOTA_EXCEEDED,"Quota for bucket '"+A+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function tI(){const A="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new be(fe.UNAUTHENTICATED,A)}function AI(){return new be(fe.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function rI(A){return new be(fe.UNAUTHORIZED,"User does not have permission to access '"+A+"'.")}function nI(){return new be(fe.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function sI(){return new be(fe.CANCELED,"User canceled the upload/download.")}function iI(A){return new be(fe.INVALID_URL,"Invalid URL '"+A+"'.")}function oI(A){return new be(fe.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+A+"'.")}function aI(){return new be(fe.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+rp+"' property when initializing the app?")}function lI(){return new be(fe.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function cI(){return new be(fe.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function uI(A){return new be(fe.UNSUPPORTED_ENVIRONMENT,`${A} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function cc(A){return new be(fe.INVALID_ARGUMENT,A)}function np(){return new be(fe.APP_DELETED,"The Firebase app was deleted.")}function hI(A){return new be(fe.INVALID_ROOT_OPERATION,"The operation '"+A+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function zn(A,e){return new be(fe.INVALID_FORMAT,"String does not match format '"+A+"': "+e)}function Yn(A){throw new be(fe.INTERNAL_ERROR,"Internal error: "+A)}/**
|
|
2730
|
+
* @license
|
|
2731
|
+
* Copyright 2017 Google LLC
|
|
2732
|
+
*
|
|
2733
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2734
|
+
* you may not use this file except in compliance with the License.
|
|
2735
|
+
* You may obtain a copy of the License at
|
|
2736
|
+
*
|
|
2737
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2738
|
+
*
|
|
2739
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2740
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2741
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2742
|
+
* See the License for the specific language governing permissions and
|
|
2743
|
+
* limitations under the License.
|
|
2744
|
+
*/class ht{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=ht.makeFromUrl(e,t)}catch{return new ht(e,"")}if(r.path==="")return r;throw oI(e)}static makeFromUrl(e,t){let r=null;const n="([A-Za-z0-9.\\-_]+)";function s(k){k.path.charAt(k.path.length-1)==="/"&&(k.path_=k.path_.slice(0,-1))}const i="(/(.*))?$",o=new RegExp("^gs://"+n+i,"i"),l={bucket:1,path:3};function c(k){k.path_=decodeURIComponent(k.path)}const u="v[A-Za-z0-9_]+",d=t.replace(/[.]/g,"\\."),g="(/([^?#]*).*)?$",p=new RegExp(`^https?://${d}/${u}/b/${n}/o${g}`,"i"),B={bucket:1,path:3},C=t===Ap?"(?:storage.googleapis.com|storage.cloud.google.com)":t,E="([^?#]*)",I=new RegExp(`^https?://${C}/${n}/${E}`,"i"),S=[{regex:o,indices:l,postModify:s},{regex:p,indices:B,postModify:c},{regex:I,indices:{bucket:1,path:2},postModify:c}];for(let k=0;k<S.length;k++){const H=S[k],R=H.regex.exec(e);if(R){const _=R[H.indices.bucket];let m=R[H.indices.path];m||(m=""),r=new ht(_,m),H.postModify(r);break}}if(r==null)throw iI(e);return r}}class dI{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
|
|
2745
|
+
* @license
|
|
2746
|
+
* Copyright 2017 Google LLC
|
|
2747
|
+
*
|
|
2748
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2749
|
+
* you may not use this file except in compliance with the License.
|
|
2750
|
+
* You may obtain a copy of the License at
|
|
2751
|
+
*
|
|
2752
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2753
|
+
*
|
|
2754
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2755
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2756
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2757
|
+
* See the License for the specific language governing permissions and
|
|
2758
|
+
* limitations under the License.
|
|
2759
|
+
*/function fI(A,e,t){let r=1,n=null,s=null,i=!1,o=0;function l(){return o===2}let c=!1;function u(...E){c||(c=!0,e.apply(null,E))}function d(E){n=setTimeout(()=>{n=null,A(p,l())},E)}function g(){s&&clearTimeout(s)}function p(E,...I){if(c){g();return}if(E){g(),u.call(null,E,...I);return}if(l()||i){g(),u.call(null,E,...I);return}r<64&&(r*=2);let S;o===1?(o=2,S=0):S=(r+Math.random())*1e3,d(S)}let B=!1;function C(E){B||(B=!0,g(),!c&&(n!==null?(E||(o=2),clearTimeout(n),d(0)):E||(o=1)))}return d(0),s=setTimeout(()=>{i=!0,C(!0)},t),C}function gI(A){A(!1)}/**
|
|
2760
|
+
* @license
|
|
2761
|
+
* Copyright 2017 Google LLC
|
|
2762
|
+
*
|
|
2763
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2764
|
+
* you may not use this file except in compliance with the License.
|
|
2765
|
+
* You may obtain a copy of the License at
|
|
2766
|
+
*
|
|
2767
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2768
|
+
*
|
|
2769
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2770
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2771
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2772
|
+
* See the License for the specific language governing permissions and
|
|
2773
|
+
* limitations under the License.
|
|
2774
|
+
*/function pI(A){return A!==void 0}function wI(A){return typeof A=="object"&&!Array.isArray(A)}function uc(A){return typeof A=="string"||A instanceof String}function sp(A){return hc()&&A instanceof Blob}function hc(){return typeof Blob<"u"}function ip(A,e,t,r){if(r<e)throw cc(`Invalid value for '${A}'. Expected ${e} or greater.`);if(r>t)throw cc(`Invalid value for '${A}'. Expected ${t} or less.`)}/**
|
|
2775
|
+
* @license
|
|
2776
|
+
* Copyright 2017 Google LLC
|
|
2777
|
+
*
|
|
2778
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2779
|
+
* you may not use this file except in compliance with the License.
|
|
2780
|
+
* You may obtain a copy of the License at
|
|
2781
|
+
*
|
|
2782
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2783
|
+
*
|
|
2784
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2785
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2786
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2787
|
+
* See the License for the specific language governing permissions and
|
|
2788
|
+
* limitations under the License.
|
|
2789
|
+
*/function dc(A,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${A}`}function op(A){const e=encodeURIComponent;let t="?";for(const r in A)if(A.hasOwnProperty(r)){const n=e(r)+"="+e(A[r]);t=t+n+"&"}return t=t.slice(0,-1),t}var er;(function(A){A[A.NO_ERROR=0]="NO_ERROR",A[A.NETWORK_ERROR=1]="NETWORK_ERROR",A[A.ABORT=2]="ABORT"})(er||(er={}));/**
|
|
2790
|
+
* @license
|
|
2791
|
+
* Copyright 2022 Google LLC
|
|
2792
|
+
*
|
|
2793
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2794
|
+
* you may not use this file except in compliance with the License.
|
|
2795
|
+
* You may obtain a copy of the License at
|
|
2796
|
+
*
|
|
2797
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2798
|
+
*
|
|
2799
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2800
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2801
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2802
|
+
* See the License for the specific language governing permissions and
|
|
2803
|
+
* limitations under the License.
|
|
2804
|
+
*/function BI(A,e){const t=A>=500&&A<600,n=[408,429].indexOf(A)!==-1,s=e.indexOf(A)!==-1;return t||n||s}/**
|
|
2805
|
+
* @license
|
|
2806
|
+
* Copyright 2017 Google LLC
|
|
2807
|
+
*
|
|
2808
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2809
|
+
* you may not use this file except in compliance with the License.
|
|
2810
|
+
* You may obtain a copy of the License at
|
|
2811
|
+
*
|
|
2812
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2813
|
+
*
|
|
2814
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2815
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2816
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2817
|
+
* See the License for the specific language governing permissions and
|
|
2818
|
+
* limitations under the License.
|
|
2819
|
+
*/class mI{constructor(e,t,r,n,s,i,o,l,c,u,d,g=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=n,this.successCodes_=s,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=l,this.timeout_=c,this.progressCallback_=u,this.connectionFactory_=d,this.retry=g,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((p,B)=>{this.resolve_=p,this.reject_=B,this.start_()})}start_(){const e=(r,n)=>{if(n){r(!1,new Ao(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const i=o=>{const l=o.loaded,c=o.lengthComputable?o.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,c)};this.progressCallback_!==null&&s.addUploadProgressListener(i),s.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(i),this.pendingConnection_=null;const o=s.getErrorCode()===er.NO_ERROR,l=s.getStatus();if(!o||BI(l,this.additionalRetryCodes_)&&this.retry){const u=s.getErrorCode()===er.ABORT;r(!1,new Ao(!1,null,u));return}const c=this.successCodes_.indexOf(l)!==-1;r(!0,new Ao(c,s))})},t=(r,n)=>{const s=this.resolve_,i=this.reject_,o=n.connection;if(n.wasSuccessCode)try{const l=this.callback_(o,o.getResponse());pI(l)?s(l):s()}catch(l){i(l)}else if(o!==null){const l=lc();l.serverResponse=o.getErrorText(),this.errorCallback_?i(this.errorCallback_(o,l)):i(l)}else if(n.canceled){const l=this.appDelete_?np():sI();i(l)}else{const l=nI();i(l)}};this.canceled_?t(!1,new Ao(!1,null,!0)):this.backoffId_=fI(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&gI(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class Ao{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function yI(A,e){e!==null&&e.length>0&&(A.Authorization="Firebase "+e)}function vI(A,e){A["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function _I(A,e){e&&(A["X-Firebase-GMPID"]=e)}function CI(A,e){e!==null&&(A["X-Firebase-AppCheck"]=e)}function EI(A,e,t,r,n,s,i=!0){const o=op(A.urlParams),l=A.url+o,c=Object.assign({},A.headers);return _I(c,e),yI(c,t),vI(c,s),CI(c,r),new mI(l,A.method,c,A.body,A.successCodes,A.additionalRetryCodes,A.handler,A.errorHandler,A.timeout,A.progressCallback,n,i)}/**
|
|
2820
|
+
* @license
|
|
2821
|
+
* Copyright 2017 Google LLC
|
|
2822
|
+
*
|
|
2823
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2824
|
+
* you may not use this file except in compliance with the License.
|
|
2825
|
+
* You may obtain a copy of the License at
|
|
2826
|
+
*
|
|
2827
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2828
|
+
*
|
|
2829
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2830
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2831
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2832
|
+
* See the License for the specific language governing permissions and
|
|
2833
|
+
* limitations under the License.
|
|
2834
|
+
*/function bI(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function UI(...A){const e=bI();if(e!==void 0){const t=new e;for(let r=0;r<A.length;r++)t.append(A[r]);return t.getBlob()}else{if(hc())return new Blob(A);throw new be(fe.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function QI(A,e,t){return A.webkitSlice?A.webkitSlice(e,t):A.mozSlice?A.mozSlice(e,t):A.slice?A.slice(e,t):null}/**
|
|
2835
|
+
* @license
|
|
2836
|
+
* Copyright 2021 Google LLC
|
|
2837
|
+
*
|
|
2838
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2839
|
+
* you may not use this file except in compliance with the License.
|
|
2840
|
+
* You may obtain a copy of the License at
|
|
2841
|
+
*
|
|
2842
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2843
|
+
*
|
|
2844
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2845
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2846
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2847
|
+
* See the License for the specific language governing permissions and
|
|
2848
|
+
* limitations under the License.
|
|
2849
|
+
*/function II(A){if(typeof atob>"u")throw uI("base-64");return atob(A)}/**
|
|
2850
|
+
* @license
|
|
2851
|
+
* Copyright 2017 Google LLC
|
|
2852
|
+
*
|
|
2853
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2854
|
+
* you may not use this file except in compliance with the License.
|
|
2855
|
+
* You may obtain a copy of the License at
|
|
2856
|
+
*
|
|
2857
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2858
|
+
*
|
|
2859
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2860
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2861
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2862
|
+
* See the License for the specific language governing permissions and
|
|
2863
|
+
* limitations under the License.
|
|
2864
|
+
*/const Ft={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class fc{constructor(e,t){this.data=e,this.contentType=t||null}}function ap(A,e){switch(A){case Ft.RAW:return new fc(lp(e));case Ft.BASE64:case Ft.BASE64URL:return new fc(cp(A,e));case Ft.DATA_URL:return new fc(TI(e),SI(e))}throw lc()}function lp(A){const e=[];for(let t=0;t<A.length;t++){let r=A.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<A.length-1&&(A.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const s=r,i=A.charCodeAt(++t);r=65536|(s&1023)<<10|i&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function FI(A){let e;try{e=decodeURIComponent(A)}catch{throw zn(Ft.DATA_URL,"Malformed data URL.")}return lp(e)}function cp(A,e){switch(A){case Ft.BASE64:{const n=e.indexOf("-")!==-1,s=e.indexOf("_")!==-1;if(n||s)throw zn(A,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break}case Ft.BASE64URL:{const n=e.indexOf("+")!==-1,s=e.indexOf("/")!==-1;if(n||s)throw zn(A,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=II(e)}catch(n){throw n.message.includes("polyfill")?n:zn(A,"Invalid character found")}const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}class up{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw zn(Ft.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=RI(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function TI(A){const e=new up(A);return e.base64?cp(Ft.BASE64,e.rest):FI(e.rest)}function SI(A){return new up(A).contentType}function RI(A,e){return A.length>=e.length?A.substring(A.length-e.length)===e:!1}/**
|
|
2865
|
+
* @license
|
|
2866
|
+
* Copyright 2017 Google LLC
|
|
2867
|
+
*
|
|
2868
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2869
|
+
* you may not use this file except in compliance with the License.
|
|
2870
|
+
* You may obtain a copy of the License at
|
|
2871
|
+
*
|
|
2872
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2873
|
+
*
|
|
2874
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2875
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2876
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2877
|
+
* See the License for the specific language governing permissions and
|
|
2878
|
+
* limitations under the License.
|
|
2879
|
+
*/class SA{constructor(e,t){let r=0,n="";sp(e)?(this.data_=e,r=e.size,n=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=n}size(){return this.size_}type(){return this.type_}slice(e,t){if(sp(this.data_)){const r=this.data_,n=QI(r,e,t);return n===null?null:new SA(n)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new SA(r,!0)}}static getBlob(...e){if(hc()){const t=e.map(r=>r instanceof SA?r.data_:r);return new SA(UI.apply(null,t))}else{const t=e.map(i=>uc(i)?ap(Ft.RAW,i).data:i.data_);let r=0;t.forEach(i=>{r+=i.byteLength});const n=new Uint8Array(r);let s=0;return t.forEach(i=>{for(let o=0;o<i.length;o++)n[s++]=i[o]}),new SA(n,!0)}}uploadData(){return this.data_}}/**
|
|
2880
|
+
* @license
|
|
2881
|
+
* Copyright 2017 Google LLC
|
|
2882
|
+
*
|
|
2883
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2884
|
+
* you may not use this file except in compliance with the License.
|
|
2885
|
+
* You may obtain a copy of the License at
|
|
2886
|
+
*
|
|
2887
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2888
|
+
*
|
|
2889
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2890
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2891
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2892
|
+
* See the License for the specific language governing permissions and
|
|
2893
|
+
* limitations under the License.
|
|
2894
|
+
*/function hp(A){let e;try{e=JSON.parse(A)}catch{return null}return wI(e)?e:null}/**
|
|
2895
|
+
* @license
|
|
2896
|
+
* Copyright 2017 Google LLC
|
|
2897
|
+
*
|
|
2898
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2899
|
+
* you may not use this file except in compliance with the License.
|
|
2900
|
+
* You may obtain a copy of the License at
|
|
2901
|
+
*
|
|
2902
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2903
|
+
*
|
|
2904
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2905
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2906
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2907
|
+
* See the License for the specific language governing permissions and
|
|
2908
|
+
* limitations under the License.
|
|
2909
|
+
*/function xI(A){if(A.length===0)return null;const e=A.lastIndexOf("/");return e===-1?"":A.slice(0,e)}function kI(A,e){const t=e.split("/").filter(r=>r.length>0).join("/");return A.length===0?t:A+"/"+t}function dp(A){const e=A.lastIndexOf("/",A.length-2);return e===-1?A:A.slice(e+1)}/**
|
|
2910
|
+
* @license
|
|
2911
|
+
* Copyright 2017 Google LLC
|
|
2912
|
+
*
|
|
2913
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2914
|
+
* you may not use this file except in compliance with the License.
|
|
2915
|
+
* You may obtain a copy of the License at
|
|
2916
|
+
*
|
|
2917
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2918
|
+
*
|
|
2919
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2920
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2921
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2922
|
+
* See the License for the specific language governing permissions and
|
|
2923
|
+
* limitations under the License.
|
|
2924
|
+
*/function HI(A,e){return e}class Ze{constructor(e,t,r,n){this.server=e,this.local=t||e,this.writable=!!r,this.xform=n||HI}}let ro=null;function LI(A){return!uc(A)||A.length<2?A:dp(A)}function fp(){if(ro)return ro;const A=[];A.push(new Ze("bucket")),A.push(new Ze("generation")),A.push(new Ze("metageneration")),A.push(new Ze("name","fullPath",!0));function e(s,i){return LI(i)}const t=new Ze("name");t.xform=e,A.push(t);function r(s,i){return i!==void 0?Number(i):i}const n=new Ze("size");return n.xform=r,A.push(n),A.push(new Ze("timeCreated")),A.push(new Ze("updated")),A.push(new Ze("md5Hash",null,!0)),A.push(new Ze("cacheControl",null,!0)),A.push(new Ze("contentDisposition",null,!0)),A.push(new Ze("contentEncoding",null,!0)),A.push(new Ze("contentLanguage",null,!0)),A.push(new Ze("contentType",null,!0)),A.push(new Ze("metadata","customMetadata",!0)),ro=A,ro}function DI(A,e){function t(){const r=A.bucket,n=A.fullPath,s=new ht(r,n);return e._makeStorageReference(s)}Object.defineProperty(A,"ref",{get:t})}function OI(A,e,t){const r={};r.type="file";const n=t.length;for(let s=0;s<n;s++){const i=t[s];r[i.local]=i.xform(r,e[i.server])}return DI(r,A),r}function gp(A,e,t){const r=hp(e);return r===null?null:OI(A,r,t)}function PI(A,e,t,r){const n=hp(e);if(n===null||!uc(n.downloadTokens))return null;const s=n.downloadTokens;if(s.length===0)return null;const i=encodeURIComponent;return s.split(",").map(c=>{const u=A.bucket,d=A.fullPath,g="/b/"+i(u)+"/o/"+i(d),p=dc(g,t,r),B=op({alt:"media",token:c});return p+B})[0]}function NI(A,e){const t={},r=e.length;for(let n=0;n<r;n++){const s=e[n];s.writable&&(t[s.server]=A[s.local])}return JSON.stringify(t)}class pp{constructor(e,t,r,n){this.url=e,this.method=t,this.handler=r,this.timeout=n,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
|
|
2925
|
+
* @license
|
|
2926
|
+
* Copyright 2017 Google LLC
|
|
2927
|
+
*
|
|
2928
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2929
|
+
* you may not use this file except in compliance with the License.
|
|
2930
|
+
* You may obtain a copy of the License at
|
|
2931
|
+
*
|
|
2932
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2933
|
+
*
|
|
2934
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2935
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2936
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2937
|
+
* See the License for the specific language governing permissions and
|
|
2938
|
+
* limitations under the License.
|
|
2939
|
+
*/function wp(A){if(!A)throw lc()}function VI(A,e){function t(r,n){const s=gp(A,n,e);return wp(s!==null),s}return t}function MI(A,e){function t(r,n){const s=gp(A,n,e);return wp(s!==null),PI(s,n,A.host,A._protocol)}return t}function Bp(A){function e(t,r){let n;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?n=AI():n=tI():t.getStatus()===402?n=eI(A.bucket):t.getStatus()===403?n=rI(A.path):n=r,n.status=t.getStatus(),n.serverResponse=r.serverResponse,n}return e}function KI(A){const e=Bp(A);function t(r,n){let s=e(r,n);return r.getStatus()===404&&(s=ZQ(A.path)),s.serverResponse=n.serverResponse,s}return t}function GI(A,e,t){const r=e.fullServerUrl(),n=dc(r,A.host,A._protocol),s="GET",i=A.maxOperationRetryTime,o=new pp(n,s,MI(A,t),i);return o.errorHandler=KI(e),o}function jI(A,e){return A&&A.contentType||e&&e.type()||"application/octet-stream"}function $I(A,e,t){const r=Object.assign({},t);return r.fullPath=A.path,r.size=e.size(),r.contentType||(r.contentType=jI(null,e)),r}function WI(A,e,t,r,n){const s=e.bucketOnlyServerUrl(),i={"X-Goog-Upload-Protocol":"multipart"};function o(){let S="";for(let k=0;k<2;k++)S=S+Math.random().toString().slice(2);return S}const l=o();i["Content-Type"]="multipart/related; boundary="+l;const c=$I(e,r,n),u=NI(c,t),d="--"+l+`\r
|
|
2940
|
+
Content-Type: application/json; charset=utf-8\r
|
|
2941
|
+
\r
|
|
2942
|
+
`+u+`\r
|
|
2943
|
+
--`+l+`\r
|
|
2944
|
+
Content-Type: `+c.contentType+`\r
|
|
2945
|
+
\r
|
|
2946
|
+
`,g=`\r
|
|
2947
|
+
--`+l+"--",p=SA.getBlob(d,r,g);if(p===null)throw lI();const B={name:c.fullPath},C=dc(s,A.host,A._protocol),E="POST",I=A.maxUploadRetryTime,Q=new pp(C,E,VI(A,t),I);return Q.urlParams=B,Q.headers=i,Q.body=p.uploadData(),Q.errorHandler=Bp(e),Q}class qI{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=er.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=er.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=er.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,n){if(this.sent_)throw Yn("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),n!==void 0)for(const s in n)n.hasOwnProperty(s)&&this.xhr_.setRequestHeader(s,n[s].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Yn("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Yn("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Yn("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Yn("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class JI extends qI{initXhr(){this.xhr_.responseType="text"}}function mp(){return new JI}/**
|
|
2948
|
+
* @license
|
|
2949
|
+
* Copyright 2019 Google LLC
|
|
2950
|
+
*
|
|
2951
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2952
|
+
* you may not use this file except in compliance with the License.
|
|
2953
|
+
* You may obtain a copy of the License at
|
|
2954
|
+
*
|
|
2955
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2956
|
+
*
|
|
2957
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2958
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2959
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2960
|
+
* See the License for the specific language governing permissions and
|
|
2961
|
+
* limitations under the License.
|
|
2962
|
+
*/class tr{constructor(e,t){this._service=e,t instanceof ht?this._location=t:this._location=ht.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new tr(e,t)}get root(){const e=new ht(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return dp(this._location.path)}get storage(){return this._service}get parent(){const e=xI(this._location.path);if(e===null)return null;const t=new ht(this._location.bucket,e);return new tr(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw hI(e)}}function XI(A,e,t){A._throwIfRoot("uploadBytes");const r=WI(A.storage,A._location,fp(),new SA(e,!0),t);return A.storage.makeRequestWithTokens(r,mp).then(n=>({metadata:n,ref:A}))}function zI(A,e,t=Ft.RAW,r){A._throwIfRoot("uploadString");const n=ap(t,e),s=Object.assign({},r);return s.contentType==null&&n.contentType!=null&&(s.contentType=n.contentType),XI(A,n.data,s)}function YI(A){A._throwIfRoot("getDownloadURL");const e=GI(A.storage,A._location,fp());return A.storage.makeRequestWithTokens(e,mp).then(t=>{if(t===null)throw cI();return t})}function ZI(A,e){const t=kI(A._location.path,e),r=new ht(A._location.bucket,t);return new tr(A.storage,r)}/**
|
|
2963
|
+
* @license
|
|
2964
|
+
* Copyright 2017 Google LLC
|
|
2965
|
+
*
|
|
2966
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2967
|
+
* you may not use this file except in compliance with the License.
|
|
2968
|
+
* You may obtain a copy of the License at
|
|
2969
|
+
*
|
|
2970
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2971
|
+
*
|
|
2972
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2973
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2974
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2975
|
+
* See the License for the specific language governing permissions and
|
|
2976
|
+
* limitations under the License.
|
|
2977
|
+
*/function eF(A){return/^[A-Za-z]+:\/\//.test(A)}function tF(A,e){return new tr(A,e)}function yp(A,e){if(A instanceof gc){const t=A;if(t._bucket==null)throw aI();const r=new tr(t,t._bucket);return e!=null?yp(r,e):r}else return e!==void 0?ZI(A,e):A}function AF(A,e){if(e&&eF(e)){if(A instanceof gc)return tF(A,e);throw cc("To use ref(service, url), the first argument must be a Storage instance.")}else return yp(A,e)}function vp(A,e){const t=e==null?void 0:e[rp];return t==null?null:ht.makeFromBucketSpec(t,A)}function rF(A,e,t,r={}){A.host=`${e}:${t}`,A._protocol="http";const{mockUserToken:n}=r;n&&(A._overrideAuthToken=typeof n=="string"?n:Ed(n,A.app.options.projectId))}class gc{constructor(e,t,r,n,s){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=n,this._firebaseVersion=s,this._bucket=null,this._host=Ap,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=zQ,this._maxUploadRetryTime=YQ,this._requests=new Set,n!=null?this._bucket=ht.makeFromBucketSpec(n,this._host):this._bucket=vp(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=ht.makeFromBucketSpec(this._url,e):this._bucket=vp(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ip("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ip("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new tr(this,e)}_makeRequest(e,t,r,n,s=!0){if(this._deleted)return new dI(np());{const i=EI(e,this._appId,r,n,t,this._firebaseVersion,s);return this._requests.add(i),i.getPromise().then(()=>this._requests.delete(i),()=>this._requests.delete(i)),i}}async makeRequestWithTokens(e,t){const[r,n]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,n).getPromise()}}const _p="@firebase/storage",Cp="0.13.2";/**
|
|
2978
|
+
* @license
|
|
2979
|
+
* Copyright 2020 Google LLC
|
|
2980
|
+
*
|
|
2981
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2982
|
+
* you may not use this file except in compliance with the License.
|
|
2983
|
+
* You may obtain a copy of the License at
|
|
2984
|
+
*
|
|
2985
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2986
|
+
*
|
|
2987
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2988
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2989
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2990
|
+
* See the License for the specific language governing permissions and
|
|
2991
|
+
* limitations under the License.
|
|
2992
|
+
*/const Ep="storage";function nF(A,e,t,r){return A=nt(A),zI(A,e,t,r)}function sF(A){return A=nt(A),YI(A)}function iF(A,e){return A=nt(A),AF(A,e)}function oF(A=Od(),e){A=nt(A);const r=Hd(A,Ep).getImmediate({identifier:e}),n=_d("storage");return n&&aF(r,...n),r}function aF(A,e,t,r={}){rF(A,e,t,r)}function lF(A,{instanceIdentifier:e}){const t=A.getProvider("app").getImmediate(),r=A.getProvider("auth-internal"),n=A.getProvider("app-check-internal");return new gc(t,r,n,e,Ld)}function cF(){bn(new br(Ep,lF,"PUBLIC").setMultipleInstances(!0)),CA(_p,Cp,""),CA(_p,Cp,"esm2017")}cF();class uF{constructor(e){pt(this,"db");pt(this,"storage");const{provider:t,...r}=e;let n;const s=DE().find(i=>i.name==="ui-feedback-plugin");s?n=s:n=Dd(r,"ui-feedback-plugin"),this.db=RQ(n),this.storage=oF(n)}async addComment(e){return(await tp(qn(this.db,"ufp_comments"),e)).id}async getComments(e,t){const r=qg(qn(this.db,"ufp_comments"),eo("pageUrl","==",e),eo("projectKey","==",t));return(await ep(r)).docs.map(i=>({id:i.id,...i.data()})).sort((i,o)=>o.createdAt-i.createdAt)}async updateComment(e,t){await WQ(Wl(this.db,"ufp_comments",e),t)}async deleteComment(e){await qQ(Wl(this.db,"ufp_comments",e))}async addReply(e){return(await tp(qn(this.db,"ufp_comments",e.commentId,"replies"),e)).id}async getReplies(e){return(await ep(qn(this.db,"ufp_comments",e,"replies"))).docs.map(n=>({id:n.id,...n.data()})).sort((n,s)=>n.createdAt-s.createdAt)}subscribeToComments(e,t,r){const n=qg(qn(this.db,"ufp_comments"),eo("pageUrl","==",e),eo("projectKey","==",t));return JQ(n,s=>{const i=s.docs.map(o=>({id:o.id,...o.data()})).sort((o,l)=>l.createdAt-o.createdAt);r(i)},s=>{console.error("[ui-feedback-plugin] Firestore listener error:",s)})}async uploadScreenshot(e,t){const r=iF(this.storage,`ufp_screenshots/${e}.png`);return await nF(r,t,"data_url"),sF(r)}}const hF=Object.freeze(Object.defineProperty({__proto__:null,FirebaseAdapter:uF},Symbol.toStringTag,{value:"Module"}));function dF(A){return{id:A.id,pageUrl:A.page_url,projectKey:A.project_key,authorName:A.author_name,text:A.text,screenshotUrl:A.screenshot_url??"",annotation:A.annotation,resolved:A.resolved,createdAt:A.created_at}}function fF(A){return{page_url:A.pageUrl,project_key:A.projectKey,author_name:A.authorName,text:A.text,screenshot_url:A.screenshotUrl,annotation:A.annotation,resolved:A.resolved,created_at:A.createdAt}}function gF(A){return{id:A.id,commentId:A.comment_id,authorName:A.author_name,text:A.text,createdAt:A.created_at}}function pF(A){return{comment_id:A.commentId,author_name:A.authorName,text:A.text,created_at:A.createdAt}}class wF{constructor(e,t){pt(this,"client");pt(this,"_url");pt(this,"_key");pt(this,"_client",null);this._url=e,this._key=t}async _getClient(){if(this._client)return this._client;try{const{createClient:e}=await Promise.resolve().then(()=>dR);return this._client=e(this._url,this._key),this._client}catch{throw new Error("[ui-feedback-plugin] @supabase/supabase-js is not installed. Run: npm install @supabase/supabase-js")}}async addComment(e){const t=await this._getClient(),{data:r,error:n}=await t.from("ufp_comments").insert(fF(e)).select("id").single();if(n)throw n;return r.id}async getComments(e,t){const r=await this._getClient(),{data:n,error:s}=await r.from("ufp_comments").select("*").eq("page_url",e).eq("project_key",t);if(s)throw s;return(n??[]).map(dF).sort((o,l)=>l.createdAt-o.createdAt)}async updateComment(e,t){const r=await this._getClient(),n={};t.resolved!==void 0&&(n.resolved=t.resolved),t.screenshotUrl!==void 0&&(n.screenshot_url=t.screenshotUrl),t.text!==void 0&&(n.text=t.text),t.annotation!==void 0&&(n.annotation=t.annotation);const{error:s}=await r.from("ufp_comments").update(n).eq("id",e);if(s)throw s}async deleteComment(e){const t=await this._getClient(),{error:r}=await t.from("ufp_comments").delete().eq("id",e);if(r)throw r}async addReply(e){const t=await this._getClient(),{data:r,error:n}=await t.from("ufp_replies").insert(pF(e)).select("id").single();if(n)throw n;return r.id}async getReplies(e){const t=await this._getClient(),{data:r,error:n}=await t.from("ufp_replies").select("*").eq("comment_id",e);if(n)throw n;return(r??[]).map(gF).sort((i,o)=>i.createdAt-o.createdAt)}subscribeToComments(e,t,r){let n=null,s=!0;const i=async()=>{if(s)try{const o=await this.getComments(e,t);s&&r(o)}catch(o){console.error("[ui-feedback-plugin] Supabase fetch error:",o)}};return i(),this._getClient().then(o=>{s&&(n=o.channel("ufp-comments").on("postgres_changes",{event:"*",schema:"public",table:"ufp_comments"},()=>{i()}).subscribe())}).catch(console.error),()=>{s=!1,n&&this._getClient().then(o=>o.removeChannel(n)).catch(()=>{})}}async uploadScreenshot(e,t){var p;const r=await this._getClient(),[n,s]=t.split(","),i=((p=n.match(/:(.*?);/))==null?void 0:p[1])??"image/png",o=atob(s),l=new Uint8Array(o.length);for(let B=0;B<o.length;B++)l[B]=o.charCodeAt(B);const c=new Blob([l],{type:i}),u=`${e}.png`,{error:d}=await r.storage.from("ufp-screenshots").upload(u,c,{contentType:"image/png",upsert:!0});if(d)throw d;const{data:g}=r.storage.from("ufp-screenshots").getPublicUrl(u);return g.publicUrl}}const BF=Object.freeze(Object.defineProperty({__proto__:null,SupabaseAdapter:wF},Symbol.toStringTag,{value:"Module"}));class mF{constructor(e,t={}){pt(this,"endpoint");pt(this,"headers");this.endpoint=e,this.headers=t}async uploadScreenshot(e,t){const r=t.includes(",")?t.split(",")[1]:t,n=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json",...this.headers},body:JSON.stringify({commentId:e,imageData:r})});if(!n.ok)throw new Error(`[ui-feedback-plugin] Screenshot upload failed: ${n.status} ${n.statusText}`);const s=await n.json();if(!(s!=null&&s.url))throw new Error("[ui-feedback-plugin] Upload endpoint did not return { url }");return s.url}}const yF=Object.freeze(Object.defineProperty({__proto__:null,S3ScreenshotAdapter:mF},Symbol.toStringTag,{value:"Module"}));function no(A,e){var t={};for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&e.indexOf(r)<0&&(t[r]=A[r]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(A);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(A,r[n])&&(t[r[n]]=A[r[n]]);return t}function vF(A,e,t,r){function n(s){return s instanceof t?s:new t(function(i){i(s)})}return new(t||(t=Promise))(function(s,i){function o(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((r=r.apply(A,e||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const _F=A=>A?(...e)=>A(...e):(...e)=>fetch(...e);class so extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class bp extends so{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class pc extends so{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class wc extends so{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var io;(function(A){A.Any="any",A.ApNortheast1="ap-northeast-1",A.ApNortheast2="ap-northeast-2",A.ApSouth1="ap-south-1",A.ApSoutheast1="ap-southeast-1",A.ApSoutheast2="ap-southeast-2",A.CaCentral1="ca-central-1",A.EuCentral1="eu-central-1",A.EuWest1="eu-west-1",A.EuWest2="eu-west-2",A.EuWest3="eu-west-3",A.SaEast1="sa-east-1",A.UsEast1="us-east-1",A.UsWest1="us-west-1",A.UsWest2="us-west-2"})(io||(io={}));class CF{constructor(e,{headers:t={},customFetch:r,region:n=io.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=_F(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return vF(this,arguments,void 0,function*(t,r={}){var n;let s,i;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=r;let g={},{region:p}=r;p||(p=this.region);const B=new URL(`${this.url}/${t}`);p&&p!=="any"&&(g["x-region"]=p,B.searchParams.set("forceFunctionRegion",p));let C;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(g["Content-Type"]="application/octet-stream",C=c):typeof c=="string"?(g["Content-Type"]="text/plain",C=c):typeof FormData<"u"&&c instanceof FormData?C=c:(g["Content-Type"]="application/json",C=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?C=JSON.stringify(c):C=c;let E=u;d&&(i=new AbortController,s=setTimeout(()=>i.abort(),d),u?(E=i.signal,u.addEventListener("abort",()=>i.abort())):E=i.signal);const I=yield this.fetch(B.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},g),this.headers),o),body:C,signal:E}).catch(H=>{throw new bp(H)}),Q=I.headers.get("x-relay-error");if(Q&&Q==="true")throw new pc(I);if(!I.ok)throw new wc(I);let S=((n=I.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),k;return S==="application/json"?k=yield I.json():S==="application/octet-stream"||S==="application/pdf"?k=yield I.blob():S==="text/event-stream"?k=I:S==="multipart/form-data"?k=yield I.formData():k=yield I.text(),{data:k,error:null,response:I}}catch(o){return{data:null,error:o,response:o instanceof wc||o instanceof pc?o.context:void 0}}finally{s&&clearTimeout(s)}})}}const Up=3,Qp=A=>Math.min(1e3*2**A,3e4),EF=[520,503],Ip=["GET","HEAD","OPTIONS"];var Bc=class extends Error{constructor(A){super(A.message),this.name="PostgrestError",this.details=A.details,this.hint=A.hint,this.code=A.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Fp(A,e){return new Promise(t=>{if(e!=null&&e.aborted){t();return}const r=setTimeout(()=>{e==null||e.removeEventListener("abort",n),t()},A);function n(){clearTimeout(r),t()}e==null||e.addEventListener("abort",n)})}function bF(A,e,t,r){return!(!r||t>=Up||!Ip.includes(A)||!EF.includes(e))}var UF=class{constructor(A){var e,t,r,n,s;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=A.method,this.url=A.url,this.headers=new Headers(A.headers),this.schema=A.schema,this.body=A.body,this.shouldThrowOnError=(e=A.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=A.signal,this.isMaybeSingle=(t=A.isMaybeSingle)!==null&&t!==void 0?t:!1,this.shouldStripNulls=(r=A.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(n=A.urlLengthLimit)!==null&&n!==void 0?n:8e3,this.retryEnabled=(s=A.retry)!==null&&s!==void 0?s:!0,A.fetch?this.fetch=A.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(A,e){return this.headers=new Headers(this.headers),this.headers.set(A,e),this}retry(A){return this.retryEnabled=A,this}then(A,e){var t=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const i=this.headers.get("Accept");i==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!i||i==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let s=(async()=>{let i=0;for(;;){const c={};t.headers.forEach((d,g)=>{c[g]=d}),i>0&&(c["X-Retry-Count"]=String(i));let u;try{u=await r(t.url.toString(),{method:t.method,headers:c,body:JSON.stringify(t.body,(d,g)=>typeof g=="bigint"?g.toString():g),signal:t.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!Ip.includes(t.method))throw d;if(t.retryEnabled&&i<Up){const g=Qp(i);i++,await Fp(g,t.signal);continue}throw d}if(bF(t.method,u.status,i,t.retryEnabled)){var o,l;const d=(o=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&o!==void 0?o:null,g=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:Qp(i);await u.text(),i++,await Fp(g,t.signal);continue}return await t.processResponse(u)}})();return this.shouldThrowOnError||(s=s.catch(i=>{var o;let l="",c="",u="";const d=i==null?void 0:i.cause;if(d){var g,p,B,C;const Q=(g=d==null?void 0:d.message)!==null&&g!==void 0?g:"",S=(p=d==null?void 0:d.code)!==null&&p!==void 0?p:"";l=`${(B=i==null?void 0:i.name)!==null&&B!==void 0?B:"FetchError"}: ${i==null?void 0:i.message}`,l+=`
|
|
2993
|
+
|
|
2994
|
+
Caused by: ${(C=d==null?void 0:d.name)!==null&&C!==void 0?C:"Error"}: ${Q}`,S&&(l+=` (${S})`),d!=null&&d.stack&&(l+=`
|
|
2995
|
+
${d.stack}`)}else{var E;l=(E=i==null?void 0:i.stack)!==null&&E!==void 0?E:""}const I=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",I>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${I} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",I>this.urlLengthLimit&&(c+=`. Your request URL is ${I} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),s.then(A,e)}async processResponse(A){var e=this;let t=null,r=null,n=null,s=A.status,i=A.statusText;if(A.ok){var o,l;if(e.method!=="HEAD"){var c;const g=await A.text();if(g!=="")if(e.headers.get("Accept")==="text/csv")r=g;else if(e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text")))r=g;else try{r=JSON.parse(g)}catch{if(t={message:g},r=null,e.shouldThrowOnError)throw new Bc({message:g,details:"",hint:"",code:""})}}const u=(o=e.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),d=(l=A.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(n=parseInt(d[1])),e.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(t={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,n=null,s=406,i="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await A.text();try{t=JSON.parse(u),Array.isArray(t)&&A.status===404&&(r=[],t=null,s=200,i="OK")}catch{A.status===404&&u===""?(s=204,i="No Content"):t={message:u}}if(t&&e.shouldThrowOnError)throw new Bc(t)}return{success:t===null,error:t,data:r,count:n,status:s,statusText:i}}returns(){return this}overrideTypes(){return this}},QF=class extends UF{throwOnError(){return super.throwOnError()}select(A){let e=!1;const t=(A??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",t),this.headers.append("Prefer","return=representation"),this}order(A,{ascending:e=!0,nullsFirst:t,foreignTable:r,referencedTable:n=r}={}){const s=n?`${n}.order`:"order",i=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${i?`${i},`:""}${A}.${e?"asc":"desc"}${t===void 0?"":t?".nullsfirst":".nullslast"}`),this}limit(A,{foreignTable:e,referencedTable:t=e}={}){const r=typeof t>"u"?"limit":`${t}.limit`;return this.url.searchParams.set(r,`${A}`),this}range(A,e,{foreignTable:t,referencedTable:r=t}={}){const n=typeof r>"u"?"offset":`${r}.offset`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${A}`),this.url.searchParams.set(s,`${e-A+1}`),this}abortSignal(A){return this.signal=A,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:A=!1,verbose:e=!1,settings:t=!1,buffers:r=!1,wal:n=!1,format:s="text"}={}){var i;const o=[A?"analyze":null,e?"verbose":null,t?"settings":null,r?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=(i=this.headers.get("Accept"))!==null&&i!==void 0?i:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(A){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${A}`),this}};const Tp=new RegExp("[,()]");var Nr=class extends QF{throwOnError(){return super.throwOnError()}eq(A,e){return this.url.searchParams.append(A,`eq.${e}`),this}neq(A,e){return this.url.searchParams.append(A,`neq.${e}`),this}gt(A,e){return this.url.searchParams.append(A,`gt.${e}`),this}gte(A,e){return this.url.searchParams.append(A,`gte.${e}`),this}lt(A,e){return this.url.searchParams.append(A,`lt.${e}`),this}lte(A,e){return this.url.searchParams.append(A,`lte.${e}`),this}like(A,e){return this.url.searchParams.append(A,`like.${e}`),this}likeAllOf(A,e){return this.url.searchParams.append(A,`like(all).{${e.join(",")}}`),this}likeAnyOf(A,e){return this.url.searchParams.append(A,`like(any).{${e.join(",")}}`),this}ilike(A,e){return this.url.searchParams.append(A,`ilike.${e}`),this}ilikeAllOf(A,e){return this.url.searchParams.append(A,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(A,e){return this.url.searchParams.append(A,`ilike(any).{${e.join(",")}}`),this}regexMatch(A,e){return this.url.searchParams.append(A,`match.${e}`),this}regexIMatch(A,e){return this.url.searchParams.append(A,`imatch.${e}`),this}is(A,e){return this.url.searchParams.append(A,`is.${e}`),this}isDistinct(A,e){return this.url.searchParams.append(A,`isdistinct.${e}`),this}in(A,e){const t=Array.from(new Set(e)).map(r=>typeof r=="string"&&Tp.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(A,`in.(${t})`),this}notIn(A,e){const t=Array.from(new Set(e)).map(r=>typeof r=="string"&&Tp.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(A,`not.in.(${t})`),this}contains(A,e){return typeof e=="string"?this.url.searchParams.append(A,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(A,`cs.{${e.join(",")}}`):this.url.searchParams.append(A,`cs.${JSON.stringify(e)}`),this}containedBy(A,e){return typeof e=="string"?this.url.searchParams.append(A,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(A,`cd.{${e.join(",")}}`):this.url.searchParams.append(A,`cd.${JSON.stringify(e)}`),this}rangeGt(A,e){return this.url.searchParams.append(A,`sr.${e}`),this}rangeGte(A,e){return this.url.searchParams.append(A,`nxl.${e}`),this}rangeLt(A,e){return this.url.searchParams.append(A,`sl.${e}`),this}rangeLte(A,e){return this.url.searchParams.append(A,`nxr.${e}`),this}rangeAdjacent(A,e){return this.url.searchParams.append(A,`adj.${e}`),this}overlaps(A,e){return typeof e=="string"?this.url.searchParams.append(A,`ov.${e}`):this.url.searchParams.append(A,`ov.{${e.join(",")}}`),this}textSearch(A,e,{config:t,type:r}={}){let n="";r==="plain"?n="pl":r==="phrase"?n="ph":r==="websearch"&&(n="w");const s=t===void 0?"":`(${t})`;return this.url.searchParams.append(A,`${n}fts${s}.${e}`),this}match(A){return Object.entries(A).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(A,e,t){return this.url.searchParams.append(A,`not.${e}.${t}`),this}or(A,{foreignTable:e,referencedTable:t=e}={}){const r=t?`${t}.or`:"or";return this.url.searchParams.append(r,`(${A})`),this}filter(A,e,t){return this.url.searchParams.append(A,`${e}.${t}`),this}},IF=class{constructor(A,{headers:e={},schema:t,fetch:r,urlLengthLimit:n=8e3,retry:s}){this.url=A,this.headers=new Headers(e),this.schema=t,this.fetch=r,this.urlLengthLimit=n,this.retry=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(A,e){const{head:t=!1,count:r}=e??{},n=t?"HEAD":"GET";let s=!1;const i=(A??"*").split("").map(c=>/\s/.test(c)&&!s?"":(c==='"'&&(s=!s),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",i),r&&l.append("Prefer",`count=${r}`),new Nr({method:n,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(A,{count:e,defaultToNull:t=!0}={}){var r;const n="POST",{url:s,headers:i}=this.cloneRequestState();if(e&&i.append("Prefer",`count=${e}`),t||i.append("Prefer","missing=default"),Array.isArray(A)){const o=A.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);s.searchParams.set("columns",l.join(","))}}return new Nr({method:n,url:s,headers:i,schema:this.schema,body:A,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(A,{onConflict:e,ignoreDuplicates:t=!1,count:r,defaultToNull:n=!0}={}){var s;const i="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${t?"ignore":"merge"}-duplicates`),e!==void 0&&o.searchParams.set("on_conflict",e),r&&l.append("Prefer",`count=${r}`),n||l.append("Prefer","missing=default"),Array.isArray(A)){const c=A.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new Nr({method:i,url:o,headers:l,schema:this.schema,body:A,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(A,{count:e}={}){var t;const r="PATCH",{url:n,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Nr({method:r,url:n,headers:s,schema:this.schema,body:A,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:A}={}){var e;const t="DELETE",{url:r,headers:n}=this.cloneRequestState();return A&&n.append("Prefer",`count=${A}`),new Nr({method:t,url:r,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Zn(A){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(A)}function FF(A,e){if(Zn(A)!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var r=t.call(A,e);if(Zn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function TF(A){var e=FF(A,"string");return Zn(e)=="symbol"?e:e+""}function SF(A,e,t){return(e=TF(e))in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Sp(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(A);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(A,n).enumerable})),t.push.apply(t,r)}return t}function oo(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sp(Object(t),!0).forEach(function(r){SF(A,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):Sp(Object(t)).forEach(function(r){Object.defineProperty(A,r,Object.getOwnPropertyDescriptor(t,r))})}return A}var RF=class IB{constructor(e,{headers:t={},schema:r,fetch:n,timeout:s,urlLengthLimit:i=8e3,retry:o}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.urlLengthLimit=i;const l=n??globalThis.fetch;s!==void 0&&s>0?this.fetch=(c,u)=>{const d=new AbortController,g=setTimeout(()=>d.abort(),s),p=u==null?void 0:u.signal;if(p){if(p.aborted)return clearTimeout(g),l(c,u);const B=()=>{clearTimeout(g),d.abort()};return p.addEventListener("abort",B,{once:!0}),l(c,oo(oo({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(g),p.removeEventListener("abort",B)})}return l(c,oo(oo({},u),{},{signal:d.signal})).finally(()=>clearTimeout(g))}:this.fetch=l,this.retry=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new IF(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new IB(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:n=!1,count:s}={}){var i;let o;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(u)),d=r&&Object.values(t).some(u);d?(o="POST",c=t):r||n?(o=r?"HEAD":"GET",Object.entries(t).filter(([p,B])=>B!==void 0).map(([p,B])=>[p,Array.isArray(B)?`{${B.join(",")}}`:`${B}`]).forEach(([p,B])=>{l.searchParams.append(p,B)})):(o="POST",c=t);const g=new Headers(this.headers);return d?g.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&g.set("Prefer",`count=${s}`),new Nr({method:o,url:l,headers:g,schema:this.schemaName,body:c,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Rp{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const t=globalThis;if(typeof globalThis<"u"&&typeof t.WebSocket<"u")return{type:"native",wsConstructor:t.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof t.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&t.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const s=n.versions;if(s&&s.node){const i=s.node,o=parseInt(i.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
2996
|
+
import ws from "ws"
|
|
2997
|
+
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
|
|
2998
|
+
|
|
2999
|
+
Suggested solution: ${e.workaround}`),new Error(t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const xF="realtime-js/2.108.2",kF="1.0.0",xp="2.0.0",HF=xp,LF=1e4,DF=100,rA={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},kp={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},mc={connecting:"connecting",closing:"closing",closed:"closed"};class OF{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return t(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer((t=e.payload)===null||t===void 0?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,r;const n=(r=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var t,r;const n=(r=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&r!==void 0?r:{},i=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(e,t,r){var n,s;const i=e.topic,o=(n=e.ref)!==null&&n!==void 0?n:"",l=(s=e.join_ref)!==null&&s!==void 0?s:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(i.length>255)throw new Error(`topic length ${i.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const g=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+i.length+c.length+d.length,p=new ArrayBuffer(this.HEADER_LENGTH+g);let B=new DataView(p),C=0;B.setUint8(C++,this.KINDS.userBroadcastPush),B.setUint8(C++,l.length),B.setUint8(C++,o.length),B.setUint8(C++,i.length),B.setUint8(C++,c.length),B.setUint8(C++,d.length),B.setUint8(C++,t),Array.from(l,I=>B.setUint8(C++,I.charCodeAt(0))),Array.from(o,I=>B.setUint8(C++,I.charCodeAt(0))),Array.from(i,I=>B.setUint8(C++,I.charCodeAt(0))),Array.from(c,I=>B.setUint8(C++,I.charCodeAt(0))),Array.from(d,I=>B.setUint8(C++,I.charCodeAt(0)));var E=new Uint8Array(p.byteLength+r.byteLength);return E.set(new Uint8Array(p),0),E.set(new Uint8Array(r),p.byteLength),E.buffer}decode(e,t){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return t(r)}if(typeof e=="string"){const r=JSON.parse(e),[n,s,i,o,l]=r;return t({join_ref:n,ref:s,topic:i,event:o,payload:l})}return t({})}_binaryDecode(e){const t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,t,n)}}_decodeUserBroadcast(e,t,r){const n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+n));l=l+n;const u=r.decode(e.slice(l,l+s));l=l+s;const d=r.decode(e.slice(l,l+i));l=l+i;const g=e.slice(l,e.byteLength),p=o===this.JSON_ENCODING?JSON.parse(r.decode(g)):g,B={type:this.BROADCAST_EVENT,event:u,payload:p};return i>0&&(B.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:B}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||((t=e==null?void 0:e.constructor)===null||t===void 0?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>t.includes(r)))}}var ae;(function(A){A.abstime="abstime",A.bool="bool",A.date="date",A.daterange="daterange",A.float4="float4",A.float8="float8",A.int2="int2",A.int4="int4",A.int4range="int4range",A.int8="int8",A.int8range="int8range",A.json="json",A.jsonb="jsonb",A.money="money",A.numeric="numeric",A.oid="oid",A.reltime="reltime",A.text="text",A.time="time",A.timestamp="timestamp",A.timestamptz="timestamptz",A.timetz="timetz",A.tsrange="tsrange",A.tstzrange="tstzrange"})(ae||(ae={}));const Hp=(A,e,t={})=>{var r;const n=(r=t.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((s,i)=>(s[i]=PF(i,A,e,n),s),{}):{}},PF=(A,e,t,r)=>{const n=e.find(o=>o.name===A),s=n==null?void 0:n.type,i=t[A];return s&&!r.includes(s)?Lp(s,i):yc(i)},Lp=(A,e)=>{if(A.charAt(0)==="_"){const t=A.slice(1,A.length);return KF(e,t)}switch(A){case ae.bool:return NF(e);case ae.float4:case ae.float8:case ae.int2:case ae.int4:case ae.int8:case ae.numeric:case ae.oid:return VF(e);case ae.json:case ae.jsonb:return MF(e);case ae.timestamp:return GF(e);case ae.abstime:case ae.date:case ae.daterange:case ae.int4range:case ae.int8range:case ae.money:case ae.reltime:case ae.text:case ae.time:case ae.timestamptz:case ae.timetz:case ae.tsrange:case ae.tstzrange:return yc(e);default:return yc(e)}},yc=A=>A,NF=A=>{switch(A){case"t":return!0;case"f":return!1;default:return A}},VF=A=>{if(typeof A=="string"){const e=parseFloat(A);if(!Number.isNaN(e))return e}return A},MF=A=>{if(typeof A=="string")try{return JSON.parse(A)}catch{return A}return A},KF=(A,e)=>{if(typeof A!="string")return A;const t=A.length-1,r=A[t];if(A[0]==="{"&&r==="}"){let s;const i=A.slice(1,t);try{s=JSON.parse("["+i+"]")}catch{s=i?i.split(","):[]}return s.map(o=>Lp(e,o))}return A},GF=A=>typeof A=="string"?A.replace(" ","T"):A,Dp=A=>{const e=new URL(A);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var es=A=>typeof A=="function"?A:function(){return A},jF=typeof self<"u"?self:null,Vr=typeof window<"u"?window:null,jt=jF||Vr||globalThis,$F="2.0.0",WF=1e4,qF=1e3,$t={connecting:0,open:1,closing:2,closed:3},ot={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},nA={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},vc={longpoll:"longpoll",websocket:"websocket"},JF={complete:4},_c="base64url.bearer.phx.",ao=class{constructor(A,e,t,r){this.channel=A,this.event=e,this.payload=t||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(A){this.timeout=A,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(A,e){return this.hasReceived(A)&&e(this.receivedResp.response),this.recHooks.push({status:A,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:A,response:e,_ref:t}){this.recHooks.filter(r=>r.status===A).forEach(r=>r.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,A=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=A,this.matchReceive(A)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(A){return this.receivedResp&&this.receivedResp.status===A}trigger(A,e){this.channel.trigger(this.refEvent,{status:A,response:e})}},Op=class{constructor(A,e){this.callback=A,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},XF=class{constructor(A,e,t){this.state=ot.closed,this.topic=A,this.params=es(e||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ao(this,nA.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Op(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=ot.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=ot.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ot.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=ot.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new ao(this,nA.leave,es({}),this.timeout).send(),this.state=ot.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(nA.reply,(r,n)=>{this.trigger(this.replyEventName(n),r)})}join(A=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=A,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(A=>A.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ot.closed,this.bindings=[]}onClose(A){this.on(nA.close,A)}onError(A){return this.on(nA.error,e=>A(e))}on(A,e){let t=this.bindingRef++;return this.bindings.push({event:A,ref:t,callback:e}),t}off(A,e){this.bindings=this.bindings.filter(t=>!(t.event===A&&(typeof e>"u"||e===t.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(A,e,t=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${A}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ao(this,A,function(){return e},t);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(A=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ot.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(nA.close,"leave")},t=new ao(this,nA.leave,es({}),A);return t.receive("ok",()=>e()).receive("timeout",()=>e()),t.send(),this.canPush()||t.trigger("ok",{}),t}onMessage(A,e,t){return e}filterBindings(A,e,t){return!0}isMember(A,e,t,r){return this.topic!==A?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:A,event:e,payload:t,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(A=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ot.joining,this.joinPush.resend(A))}trigger(A,e,t,r){let n=this.onMessage(A,e,t,r);if(e&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(i=>i.event===A&&this.filterBindings(i,e,t));for(let i=0;i<s.length;i++)s[i].callback(n,t,r||this.joinRef())}replyEventName(A){return`chan_reply_${A}`}isClosed(){return this.state===ot.closed}isErrored(){return this.state===ot.errored}isJoined(){return this.state===ot.joined}isJoining(){return this.state===ot.joining}isLeaving(){return this.state===ot.leaving}},lo=class{static request(A,e,t,r,n,s,i){if(jt.XDomainRequest){let o=new jt.XDomainRequest;return this.xdomainRequest(o,A,e,r,n,s,i)}else if(jt.XMLHttpRequest){let o=new jt.XMLHttpRequest;return this.xhrRequest(o,A,e,t,r,n,s,i)}else{if(jt.fetch&&jt.AbortController)return this.fetchRequest(A,e,t,r,n,s,i);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(A,e,t,r,n,s,i){let o={method:A,headers:t,body:r},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),o.signal=l.signal),jt.fetch(e,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>i&&i(c)).catch(c=>{c.name==="AbortError"&&s?s():i&&i(null)}),l}static xdomainRequest(A,e,t,r,n,s,i){return A.timeout=n,A.open(e,t),A.onload=()=>{let o=this.parseJSON(A.responseText);i&&i(o)},s&&(A.ontimeout=s),A.onprogress=()=>{},A.send(r),A}static xhrRequest(A,e,t,r,n,s,i,o){A.open(e,t,!0),A.timeout=s;for(let[l,c]of Object.entries(r))A.setRequestHeader(l,c);return A.onerror=()=>o&&o(null),A.onreadystatechange=()=>{if(A.readyState===JF.complete&&o){let l=this.parseJSON(A.responseText);o(l)}},i&&(A.ontimeout=i),A.send(n),A}static parseJSON(A){if(!A||A==="")return null;try{return JSON.parse(A)}catch{return console&&console.log("failed to parse JSON response",A),null}}static serialize(A,e){let t=[];for(var r in A){if(!Object.prototype.hasOwnProperty.call(A,r))continue;let n=e?`${e}[${r}]`:r,s=A[r];typeof s=="object"?t.push(this.serialize(s,n)):t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}return t.join("&")}static appendParams(A,e){if(Object.keys(e).length===0)return A;let t=A.match(/\?/)?"&":"?";return`${A}${t}${this.serialize(e)}`}},zF=A=>{let e="",t=new Uint8Array(A),r=t.byteLength;for(let n=0;n<r;n++)e+=String.fromCharCode(t[n]);return btoa(e)},Mr=class{constructor(A,e){e&&e.length===2&&e[1].startsWith(_c)&&(this.authToken=atob(e[1].slice(_c.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(A),this.readyState=$t.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(A){return A.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+vc.websocket),"$1/"+vc.longpoll)}endpointURL(){return lo.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(A,e,t){this.close(A,e,t),this.readyState=$t.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===$t.open||this.readyState===$t.connecting}poll(){const A={Accept:"application/json"};this.authToken&&(A["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",A,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:r,messages:n}=e;if(t===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else t=0;switch(t){case 200:n.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=$t.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(A){typeof A!="string"&&(A=zF(A)),this.currentBatch?this.currentBatch.push(A):this.awaitingBatchAck?this.batchBuffer.push(A):(this.currentBatch=[A],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(A){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},A.join(`
|
|
3000
|
+
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(A,e,t){for(let n of this.reqs)n.abort();this.readyState=$t.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:A,reason:e,wasClean:t});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(A,e,t,r,n){let s,i=()=>{this.reqs.delete(s),r()};s=lo.request(A,this.endpointURL(),e,t,this.timeout,i,o=>{this.reqs.delete(s),this.isActive()&&n(o)}),this.reqs.add(s)}},YF=class Is{constructor(e,t={}){let r=t.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,n=>{let{onJoin:s,onLeave:i,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Is.syncState(this.state,n,s,i),this.pendingDiffs.forEach(l=>{this.state=Is.syncDiff(this.state,l,s,i)}),this.pendingDiffs=[],o()}),this.channel.on(r.diff,n=>{let{onJoin:s,onLeave:i,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Is.syncDiff(this.state,n,s,i),o())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Is.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,r,n){let s=this.clone(e),i={},o={};return this.map(s,(l,c)=>{t[l]||(o[l]=c)}),this.map(t,(l,c)=>{let u=s[l];if(u){let d=c.metas.map(C=>C.phx_ref),g=u.metas.map(C=>C.phx_ref),p=c.metas.filter(C=>g.indexOf(C.phx_ref)<0),B=u.metas.filter(C=>d.indexOf(C.phx_ref)<0);p.length>0&&(i[l]=c,i[l].metas=p),B.length>0&&(o[l]=this.clone(u),o[l].metas=B)}else i[l]=c}),this.syncDiff(s,{joins:i,leaves:o},r,n)}static syncDiff(e,t,r,n){let{joins:s,leaves:i}=this.clone(t);return r||(r=function(){}),n||(n=function(){}),this.map(s,(o,l)=>{let c=e[o];if(e[o]=this.clone(l),c){let u=e[o].metas.map(g=>g.phx_ref),d=c.metas.filter(g=>u.indexOf(g.phx_ref)<0);e[o].metas.unshift(...d)}r(o,c,l)}),this.map(i,(o,l)=>{let c=e[o];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),n(o,c,l),c.metas.length===0&&delete e[o]}),e}static list(e,t){return t||(t=function(r,n){return n}),this.map(e,(r,n)=>t(r,n))}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},co={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(A,e){if(A.payload.constructor===ArrayBuffer)return e(this.binaryEncode(A));{let t=[A.join_ref,A.ref,A.topic,A.event,A.payload];return e(JSON.stringify(t))}},decode(A,e){if(A.constructor===ArrayBuffer)return e(this.binaryDecode(A));{let[t,r,n,s,i]=JSON.parse(A);return e({join_ref:t,ref:r,topic:n,event:s,payload:i})}},binaryEncode(A){let{join_ref:e,ref:t,event:r,topic:n,payload:s}=A,i=this.META_LENGTH+e.length+t.length+n.length+r.length,o=new ArrayBuffer(this.HEADER_LENGTH+i),l=new DataView(o),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,r.length),Array.from(e,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(t,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(o.byteLength+s.byteLength);return u.set(new Uint8Array(o),0),u.set(new Uint8Array(s),o.byteLength),u.buffer},binaryDecode(A){let e=new DataView(A),t=e.getUint8(0),r=new TextDecoder;switch(t){case this.KINDS.push:return this.decodePush(A,e,r);case this.KINDS.reply:return this.decodeReply(A,e,r);case this.KINDS.broadcast:return this.decodeBroadcast(A,e,r)}},decodePush(A,e,t){let r=e.getUint8(1),n=e.getUint8(2),s=e.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,o=t.decode(A.slice(i,i+r));i=i+r;let l=t.decode(A.slice(i,i+n));i=i+n;let c=t.decode(A.slice(i,i+s));i=i+s;let u=A.slice(i,A.byteLength);return{join_ref:o,ref:null,topic:l,event:c,payload:u}},decodeReply(A,e,t){let r=e.getUint8(1),n=e.getUint8(2),s=e.getUint8(3),i=e.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=t.decode(A.slice(o,o+r));o=o+r;let c=t.decode(A.slice(o,o+n));o=o+n;let u=t.decode(A.slice(o,o+s));o=o+s;let d=t.decode(A.slice(o,o+i));o=o+i;let g=A.slice(o,A.byteLength),p={status:d,response:g};return{join_ref:l,ref:c,topic:u,event:nA.reply,payload:p}},decodeBroadcast(A,e,t){let r=e.getUint8(1),n=e.getUint8(2),s=this.HEADER_LENGTH+2,i=t.decode(A.slice(s,s+r));s=s+r;let o=t.decode(A.slice(s,s+n));s=s+n;let l=A.slice(s,A.byteLength);return{join_ref:null,ref:null,topic:i,event:o,payload:l}}},ZF=class{constructor(A,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||WF,this.transport=e.transport||jt.WebSocket||Mr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let t=null;try{t=jt&&jt.sessionStorage}catch{}this.sessionStore=e.sessionStorage||t,this.establishedConnections=0,this.defaultEncoder=co.encode.bind(co),this.defaultDecoder=co.decode.bind(co),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Mr?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Vr&&Vr.addEventListener&&(Vr.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Vr.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),Vr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,s,i)=>{console.log(`${n}: ${s}`,i)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=es(e.params||{}),this.endPoint=`${A}/${vc.websocket}`,this.vsn=e.vsn||$F,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Op(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return Mr}replaceTransport(A){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=A}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let A=lo.appendParams(lo.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return A.charAt(0)!=="/"?A:A.charAt(1)==="/"?`${this.protocol()}:${A}`:`${this.protocol()}://${location.host}${A}`}disconnect(A,e,t){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,A&&A()},e,t)}connect(A){A&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=es(A)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Mr?this.connectWithFallback(Mr,this.longPollFallbackMs):this.transportConnect())}log(A,e,t){this.logger&&this.logger(A,e,t)}hasLogger(){return this.logger!==null}onOpen(A){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,A]),e}onClose(A){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,A]),e}onError(A){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,A]),e}onMessage(A){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,A]),e}onHeartbeat(A){this.heartbeatCallback=A}ping(A){if(!this.isConnected())return!1;let e=this.makeRef(),t=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let r=this.onMessage(n=>{n.ref===e&&(this.off([r]),A(Date.now()-t))});return!0}transportName(A){switch(A){case Mr:return"LongPoll";default:return A.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let A;this.authToken&&(A=["phoenix",`${_c}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),A),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(A){return this.sessionStore&&this.sessionStore.getItem(A)}storeSession(A,e){this.sessionStore&&this.sessionStore.setItem(A,e)}connectWithFallback(A,e=2500){clearTimeout(this.fallbackTimer);let t=!1,r=!0,n,s,i=this.transportName(A),o=l=>{this.log("transport",`falling back to ${i}...`,l),this.off([n,s]),r=!1,this.replaceTransport(A),this.transportConnect()};if(this.getSession(`phx:fallback:${i}`))return o("memorized");this.fallbackTimer=setTimeout(o,e),s=this.onError(l=>{this.log("transport","error",l),r&&!t&&(clearTimeout(this.fallbackTimer),o(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(t=!0,!r){let l=this.transportName(A);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(A){this.log("error","error in heartbeat callback",A)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),qF,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(A,e,t){if(!this.conn)return A&&A();const r=this.conn;this.waitForBufferDone(r,()=>{e?r.close(e,t||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),A&&A()})})}waitForBufferDone(A,e,t=1){if(t===5||!A.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(A,e,t+1)},150*t)}waitForSocketClosed(A,e,t=1){if(t===5||A.readyState===$t.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(A,e,t+1)},150*t)}onConnClose(A){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",A),this.triggerChanError(A),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",A)}onConnError(A){this.hasLogger()&&this.log("transport","error",A);let e=this.transport,t=this.establishedConnections;this.triggerStateCallbacks("error",A,e,t),(e===this.transport||t>0)&&this.triggerChanError(A)}triggerChanError(A){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(nA.error,A)})}connectionState(){switch(this.conn&&this.conn.readyState){case $t.connecting:return"connecting";case $t.open:return"open";case $t.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(A){this.off(A.stateChangeRefs),this.channels=this.channels.filter(e=>e!==A)}off(A){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([t])=>A.indexOf(t)===-1)}channel(A,e={}){let t=new XF(A,e,this);return this.channels.push(t),t}push(A){if(this.hasLogger()){let{topic:e,event:t,payload:r,ref:n,join_ref:s}=A;this.log("push",`${e} ${t} (${s}, ${n})`,r)}this.isConnected()?this.encode(A,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(A,e=>this.conn.send(e)))}makeRef(){let A=this.ref+1;return A===this.ref?this.ref=0:this.ref=A,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(A){this.log("error","error in heartbeat callback",A)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(A){this.log("error","error in heartbeat callback",A)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(A=>A()),this.sendBuffer=[])}onConnMessage(A){this.decode(A.data,e=>{let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;if(s&&s===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(n.status==="ok"?"ok":"error",o)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${s&&"("+s+")"||""}`.trim(),n);for(let o=0;o<this.channels.length;o++){const l=this.channels[o];l.isMember(t,r,n,i)&&l.trigger(r,n,s,i)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(A,...e){try{this.stateChangeCallbacks[A].forEach(([t,r])=>{try{r(...e)}catch(n){this.log("error",`error in ${A} callback`,n)}})}catch(t){this.log("error",`error triggering ${A} callbacks`,t)}}leaveOpenTopic(A){let e=this.channels.find(t=>t.topic===A&&(t.isJoined()||t.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${A}"`),e.leave())}};class ts{constructor(e,t){const r=tT(t);this.presence=new YF(e.getChannel(),r),this.presence.onJoin((n,s,i)=>{const o=ts.onJoinPayload(n,s,i);e.getChannel().trigger("presence",o)}),this.presence.onLeave((n,s,i)=>{const o=ts.onLeavePayload(n,s,i);e.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return ts.transformState(this.presence.state)}static transformState(e){return e=eT(e),Object.getOwnPropertyNames(e).reduce((t,r)=>{const n=e[r];return t[r]=uo(n),t},{})}static onJoinPayload(e,t,r){const n=Pp(t),s=uo(r);return{event:"join",key:e,currentPresences:n,newPresences:s}}static onLeavePayload(e,t,r){const n=Pp(t),s=uo(r);return{event:"leave",key:e,currentPresences:n,leftPresences:s}}}function uo(A){return A.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function eT(A){return JSON.parse(JSON.stringify(A))}function tT(A){return(A==null?void 0:A.events)&&{events:A.events}}function Pp(A){return A!=null&&A.metas?uo(A):[]}var Cc;(function(A){A.SYNC="sync",A.JOIN="join",A.LEAVE="leave"})(Cc||(Cc={}));class Np{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new ts(this.channel.channelAdapter,t)}}function AT(A){if(A instanceof Error)return A;if(typeof A=="string")return new Error(A);if(A&&typeof A=="object"){const e=A;if(typeof e.code=="number"){const t=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${t}`,{cause:A})}return new Error("channel error: transport failure",{cause:A})}return new Error("channel error: connection lost")}class rT{constructor(e,t,r){const n=nT(r);this.channel=e.getSocket().channel(t,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,r){let n;try{n=this.channel.push(e,t,r)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>DF){const s=this.channel.pushBuffer.shift();s.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload())}return n}updateJoinPayload(e){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===rA.joined}isJoined(){return this.state===rA.joined}isJoining(){return this.state===rA.joining}isClosed(){return this.state===rA.closed}isLeaving(){return this.state===rA.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function nT(A){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},A.config)}}var Ec;(function(A){A.ALL="*",A.INSERT="INSERT",A.UPDATE="UPDATE",A.DELETE="DELETE"})(Ec||(Ec={}));var Ar;(function(A){A.BROADCAST="broadcast",A.PRESENCE="presence",A.POSTGRES_CHANGES="postgres_changes",A.SYSTEM="system"})(Ar||(Ar={}));var Wt;(function(A){A.SUBSCRIBED="SUBSCRIBED",A.TIMED_OUT="TIMED_OUT",A.CLOSED="CLOSED",A.CHANNEL_ERROR="CHANNEL_ERROR"})(Wt||(Wt={}));const sT=rA;class Kr{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},r){var n,s;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.channelAdapter=new rT(this.socket.socketAdapter,e,this.params),this.presence=new Np(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Dp(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((s=(n=this.params.config)===null||n===void 0?void 0:n.broadcast)===null||s===void 0)&&s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,n,s;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:i,presence:o,private:l}}=this.params,c=(n=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[Ar.PRESENCE]&&this.bindings[Ar.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,d={},g={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(p=>{e==null||e(Wt.CHANNEL_ERROR,AT(p))}),this._onClose(()=>e==null?void 0:e(Wt.CLOSED)),this.updateJoinPayload(Object.assign({config:g},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(Wt.SUBSCRIBED);return}this._updatePostgresBindings(p,e)}).receive("error",p=>{this.state=rA.errored;const B=Object.values(p).join(", ")||"error";e==null||e(Wt.CHANNEL_ERROR,new Error(B,{cause:p}))}).receive("timeout",()=>{e==null||e(Wt.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var r;const n=this.bindings.postgres_changes,s=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0,i=[];for(let o=0;o<s;o++){const l=n[o],{filter:{event:c,schema:u,table:d,filter:g}}=l,p=e&&e[o];if(p&&p.event===c&&Kr.isFilterValueEqual(p.schema,u)&&Kr.isFilterValueEqual(p.table,d)&&Kr.isFilterValueEqual(p.filter,g))i.push(Object.assign(Object.assign({},l),{id:p.id}));else{this.unsubscribe(),this.state=rA.errored,t==null||t(Wt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=i,this.state!=rA.errored&&t&&t(Wt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),s=e===Ar.PRESENCE||e===Ar.POSTGRES_CHANGES;if(n&&s)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,t,r)}async httpSend(e,t,r={}){var n;if(t==null)return Promise.reject(new Error("Payload is required for httpSend()"));const s=t instanceof ArrayBuffer||ArrayBuffer.isView(t),i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":s?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o=new URL(this.broadcastEndpointURL);o.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&o.searchParams.set("private","true");const l={method:"POST",headers:i,body:s?t:JSON.stringify(t)},c=await this._fetchWithTimeout(o.toString(),l,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);if(c.status===202)return{success:!0};if(c.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let u=c.statusText;try{const d=await c.json();u=d.error||d.message||u}catch{}return Promise.reject(new Error(u))}async send(e,t={}){var r,n;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:i}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:i,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=t.timeout)!==null&&r!==void 0?r:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var i,o,l;const c=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(i=this.params)===null||i===void 0?void 0:i.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>t("ok")).receive("timeout",()=>t("timed out")).receive("error",()=>t("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,r){const n=new AbortController,s=setTimeout(()=>n.abort(),r),i=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(s),i}_on(e,t,r){const n=e.toLocaleLowerCase(),s=this.channelAdapter.on(e,r),i={type:n,filter:t,callback:r,ref:s};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,r)=>{var n,s,i,o,l,c,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,r))return!1;const g=(n=this.bindings[d])===null||n===void 0?void 0:n.find(p=>p.ref===e.ref);if(!g)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in g){const p=g.id,B=(s=g.filter)===null||s===void 0?void 0:s.event;return p&&((i=t.ids)===null||i===void 0?void 0:i.includes(p))&&(B==="*"||(B==null?void 0:B.toLocaleLowerCase())===((o=t.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const p=(c=(l=g==null?void 0:g.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return p==="*"||p===((u=t==null?void 0:t.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return g.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:r,error:n,leave:s,join:i}=kp;return t&&[r,n,s,i].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,r)=>{if(typeof t=="object"&&"ids"in t){const n=t.data,{schema:s,table:i,commit_timestamp:o,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:s,table:i,commit_timestamp:o,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const t in e.bindings)for(const r of e.bindings[t])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=Hp(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=Hp(e.columns,e.old_record)),t}}class iT{constructor(e,t){this.socket=new ZF(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,r,n=1e4){return new Promise(s=>{setTimeout(()=>s("timeout"),n),this.socket.disconnect(()=>{e(),s("ok")},t,r)})}push(e){this.socket.push(e)}log(e,t,r){this.socket.log(e,t,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==mc.connecting}isDisconnecting(){return this.socket.connectionState()==mc.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Vp={HEARTBEAT_INTERVAL:25e3},oT=[1e3,2e3,5e3,1e4],aT=1e4;function lT(){const A=new Map;return{get length(){return A.size},clear(){A.clear()},getItem(e){return A.has(e)?A.get(e):null},key(e){var t;return(t=Array.from(A.keys())[e])!==null&&t!==void 0?t:null},removeItem(e){A.delete(e)},setItem(e,t){A.set(e,String(t))}}}function cT(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return lT()}const uT=`
|
|
3001
|
+
addEventListener("message", (e) => {
|
|
3002
|
+
if (e.data.event === "start") {
|
|
3003
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
3004
|
+
}
|
|
3005
|
+
});`;class Mp{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new OF,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=s=>s?(...i)=>s(...i):(...i)=>fetch(...i),!(!((r=t==null?void 0:t.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey;const n=this._initializeOptions(t);this.socketAdapter=new iT(e,n),this.httpEndpoint=Dp(e),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;throw t.includes("Node.js")?new Error(`${t}
|
|
3006
|
+
|
|
3007
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
3008
|
+
|
|
3009
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
3010
|
+
Option 2: Install and provide the "ws" package:
|
|
3011
|
+
|
|
3012
|
+
npm install ws
|
|
3013
|
+
|
|
3014
|
+
import ws from "ws"
|
|
3015
|
+
const client = new RealtimeClient(url, {
|
|
3016
|
+
...options,
|
|
3017
|
+
transport: ws
|
|
3018
|
+
})`):new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return t==="ok"&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async r=>{const n=await r.unsubscribe();return r.teardown(),n}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,r){this.socketAdapter.log(e,t,r)}connectionState(){return this.socketAdapter.connectionState()||mc.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(s=>s.topic===r);if(n)return n;{const s=new Kr(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(s),s}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,r=!1;if(e)t=e,r=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),t=this.accessTokenValue}else t=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(n=>{const s={access_token:t,version:xF};t&&n.updateJoinPayload(s),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(kp.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(t=>{this.log("error","error waiting for auth on connect",t)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,r)=>{t=="sent"&&this._setAuthSafely(),e&&e(t,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const r=new Blob([uT],{type:"application/javascript"});t=URL.createObjectURL(r)}return t}_initializeOptions(e){var t,r,n,s,i,o,l,c,u,d,g,p;this.worker=(t=e==null?void 0:e.worker)!==null&&t!==void 0?t:!1,this.accessToken=(r=e==null?void 0:e.accessToken)!==null&&r!==void 0?r:null;const B={};B.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:LF,B.heartbeatIntervalMs=(s=e==null?void 0:e.heartbeatIntervalMs)!==null&&s!==void 0?s:Vp.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(i=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&i!==void 0?i:2*((o=e==null?void 0:e.heartbeatIntervalMs)!==null&&o!==void 0?o:Vp.HEARTBEAT_INTERVAL),B.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Rp.getWebSocketConstructor(),B.params=e==null?void 0:e.params,B.logger=e==null?void 0:e.logger,B.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),B.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:cT(),B.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:Q=>oT[Q-1]||aT;let C,E;const I=(d=e==null?void 0:e.vsn)!==null&&d!==void 0?d:HF;switch(I){case kF:C=(Q,S)=>S(JSON.stringify(Q)),E=(Q,S)=>S(JSON.parse(Q));break;case xp:C=this.serializer.encode.bind(this.serializer),E=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${B.vsn}`)}if(B.vsn=I,B.encode=(g=e==null?void 0:e.encode)!==null&&g!==void 0?g:C,B.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:E,B.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,B.params=Object.assign(Object.assign({},B.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,B.autoSendHeartbeat=!this.worker}return B}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var As=class extends Error{constructor(A,e){var t;super(A),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((t=e.icebergType)==null?void 0:t.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function hT(A,e,t){const r=new URL(e,A);if(t)for(const[n,s]of Object.entries(t))s!==void 0&&r.searchParams.set(n,s);return r.toString()}async function dT(A){return!A||A.type==="none"?{}:A.type==="bearer"?{Authorization:`Bearer ${A.token}`}:A.type==="header"?{[A.name]:A.value}:A.type==="custom"?await A.getHeaders():{}}function fT(A){const e=A.fetchImpl??globalThis.fetch;return{async request({method:t,path:r,query:n,body:s,headers:i}){const o=hT(A.baseUrl,r,n),l=await dT(A.auth),c=await e(o,{method:t,headers:{...s?{"Content-Type":"application/json"}:{},...l,...i},body:s?JSON.stringify(s):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),g=d&&u?JSON.parse(u):u;if(!c.ok){const p=d?g:void 0,B=p==null?void 0:p.error;throw new As((B==null?void 0:B.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:B==null?void 0:B.type,icebergCode:B==null?void 0:B.code,details:p})}return{status:c.status,headers:c.headers,data:g}}}}function ho(A){return A.join("")}var gT=class{constructor(A,e=""){this.client=A,this.prefix=e}async listNamespaces(A){const e=A?{parent:ho(A.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(A,e){const t={namespace:A.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:t})).data}async dropNamespace(A){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ho(A.namespace)}`})}async loadNamespaceMetadata(A){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ho(A.namespace)}`})).data.properties}}async namespaceExists(A){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ho(A.namespace)}`}),!0}catch(e){if(e instanceof As&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(A,e){try{return await this.createNamespace(A,e)}catch(t){if(t instanceof As&&t.status===409)return;throw t}}};function Gr(A){return A.join("")}var pT=class{constructor(A,e="",t){this.client=A,this.prefix=e,this.accessDelegation=t}async listTables(A){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables`})).data.identifiers}async createTable(A,e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables`,body:e,headers:t})).data.metadata}async updateTable(A,e){const t=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables/${A.name}`,body:e});return{"metadata-location":t.data["metadata-location"],metadata:t.data.metadata}}async dropTable(A,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables/${A.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(A){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables/${A.name}`,headers:e})).data.metadata}async tableExists(A){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Gr(A.namespace)}/tables/${A.name}`,headers:e}),!0}catch(t){if(t instanceof As&&t.status===404)return!1;throw t}}async createTableIfNotExists(A,e){try{return await this.createTable(A,e)}catch(t){if(t instanceof As&&t.status===409)return await this.loadTable({namespace:A.namespace,name:e.name});throw t}}},wT=class{constructor(A){var r;let e="v1";A.catalogName&&(e+=`/${A.catalogName}`);const t=A.baseUrl.endsWith("/")?A.baseUrl:`${A.baseUrl}/`;this.client=fT({baseUrl:t,auth:A.auth,fetchImpl:A.fetch}),this.accessDelegation=(r=A.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new gT(this.client,e),this.tableOps=new pT(this.client,e,this.accessDelegation)}async listNamespaces(A){return this.namespaceOps.listNamespaces(A)}async createNamespace(A,e){return this.namespaceOps.createNamespace(A,e)}async dropNamespace(A){await this.namespaceOps.dropNamespace(A)}async loadNamespaceMetadata(A){return this.namespaceOps.loadNamespaceMetadata(A)}async listTables(A){return this.tableOps.listTables(A)}async createTable(A,e){return this.tableOps.createTable(A,e)}async updateTable(A,e){return this.tableOps.updateTable(A,e)}async dropTable(A,e){await this.tableOps.dropTable(A,e)}async loadTable(A){return this.tableOps.loadTable(A)}async namespaceExists(A){return this.namespaceOps.namespaceExists(A)}async tableExists(A){return this.tableOps.tableExists(A)}async createNamespaceIfNotExists(A,e){return this.namespaceOps.createNamespaceIfNotExists(A,e)}async createTableIfNotExists(A,e){return this.tableOps.createTableIfNotExists(A,e)}};function rs(A){"@babel/helpers - typeof";return rs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rs(A)}function BT(A,e){if(rs(A)!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var r=t.call(A,e);if(rs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function mT(A){var e=BT(A,"string");return rs(e)=="symbol"?e:e+""}function yT(A,e,t){return(e=mT(e))in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Kp(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(A);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(A,n).enumerable})),t.push.apply(t,r)}return t}function $(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kp(Object(t),!0).forEach(function(r){yT(A,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):Kp(Object(t)).forEach(function(r){Object.defineProperty(A,r,Object.getOwnPropertyDescriptor(t,r))})}return A}var fo=class extends Error{constructor(A,e="storage",t,r){super(A),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function go(A){return typeof A=="object"&&A!==null&&"__isStorageError"in A}var po=class extends fo{constructor(A,e,t,r="storage"){super(A,r,e,t),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=t}toJSON(){return $({},super.toJSON())}},Gp=class extends fo{constructor(A,e,t="storage"){super(A,t),this.name=t==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function wo(A,e,t){const r=$({},A),n=e.toLowerCase();for(const s of Object.keys(r))s.toLowerCase()===n&&delete r[s];return r[n]=t,r}function vT(A){const e={};for(const[t,r]of Object.entries(A))e[t.toLowerCase()]=r;return e}const _T=A=>A?(...e)=>A(...e):(...e)=>fetch(...e),CT=A=>{if(typeof A!="object"||A===null)return!1;const e=Object.getPrototypeOf(A);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in A)&&!(Symbol.iterator in A)},bc=A=>{if(Array.isArray(A))return A.map(t=>bc(t));if(typeof A=="function"||A!==Object(A))return A;const e={};return Object.entries(A).forEach(([t,r])=>{const n=t.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[n]=bc(r)}),e},ET=A=>!A||typeof A!="string"||A.length===0||A.length>100||A.trim()!==A||A.includes("/")||A.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(A),jp=A=>{if(typeof A=="object"&&A!==null){const e=A;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const t=e.error;if(typeof t.message=="string")return t.message}}return JSON.stringify(A)},bT=async(A,e,t,r)=>{if(A!==null&&typeof A=="object"&&"json"in A&&typeof A.json=="function"){const n=A;let s=parseInt(String(n.status),10);Number.isFinite(s)||(s=500),n.json().then(i=>{const o=(i==null?void 0:i.statusCode)||(i==null?void 0:i.code)||s+"";e(new po(jp(i),s,o,r))}).catch(()=>{const i=s+"";e(new po(n.statusText||`HTTP ${s} error`,s,i,r))})}else e(new Gp(jp(A),A,r))},UT=(A,e,t,r)=>{const n={method:A,headers:(e==null?void 0:e.headers)||{}};if(A==="GET"||A==="HEAD"||!r)return $($({},n),t);if(CT(r)){var s;const i=(e==null?void 0:e.headers)||{};let o;for(const[l,c]of Object.entries(i))l.toLowerCase()==="content-type"&&(o=c);n.headers=wo(i,"Content-Type",(s=o)!==null&&s!==void 0?s:"application/json"),n.body=JSON.stringify(r)}else n.body=r;return e!=null&&e.duplex&&(n.duplex=e.duplex),$($({},n),t)};async function ns(A,e,t,r,n,s,i){return new Promise((o,l)=>{A(t,UT(e,r,n,s)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(i==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>o(c)).catch(c=>bT(c,l,r,i))})}function $p(A="storage"){return{get:async(e,t,r,n)=>ns(e,"GET",t,r,n,void 0,A),post:async(e,t,r,n,s)=>ns(e,"POST",t,n,s,r,A),put:async(e,t,r,n,s)=>ns(e,"PUT",t,n,s,r,A),head:async(e,t,r,n)=>ns(e,"HEAD",t,$($({},r),{},{noResolveJson:!0}),n,void 0,A),remove:async(e,t,r,n,s)=>ns(e,"DELETE",t,n,s,r,A)}}const QT=$p("storage"),{get:ss,post:Tt,put:Uc,head:IT,remove:Qc}=QT,dt=$p("vectors");var jr=class{constructor(A,e={},t,r="storage"){this.shouldThrowOnError=!1,this.url=A,this.headers=vT(e),this.fetch=_T(t),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(A,e){return this.headers=wo(this.headers,A,e),this}async handleOperation(A){var e=this;try{return{data:await A(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(go(t))return{data:null,error:t};throw t}}};let Wp;Wp=Symbol.toStringTag;var FT=class{constructor(A,e){this.downloadFn=A,this.shouldThrowOnError=e,this[Wp]="StreamDownloadBuilder",this.promise=null}then(A,e){return this.getPromise().then(A,e)}catch(A){return this.getPromise().catch(A)}finally(A){return this.getPromise().finally(A)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var A=this;try{return{data:(await A.downloadFn()).body,error:null}}catch(e){if(A.shouldThrowOnError)throw e;if(go(e))return{data:null,error:e};throw e}}};let qp;qp=Symbol.toStringTag;var TT=class{constructor(A,e){this.downloadFn=A,this.shouldThrowOnError=e,this[qp]="BlobDownloadBuilder",this.promise=null}asStream(){return new FT(this.downloadFn,this.shouldThrowOnError)}then(A,e){return this.getPromise().then(A,e)}catch(A){return this.getPromise().catch(A)}finally(A){return this.getPromise().finally(A)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var A=this;try{return{data:await(await A.downloadFn()).blob(),error:null}}catch(e){if(A.shouldThrowOnError)throw e;if(go(e))return{data:null,error:e};throw e}}};const ST={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jp={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var RT=class extends jr{constructor(A,e={},t,r){super(A,e,r,"storage"),this.bucketId=t}async uploadOrUpdate(A,e,t,r){var n=this;return n.handleOperation(async()=>{let s;const i=$($({},Jp),r);let o=$($({},n.headers),A==="POST"&&{"x-upsert":String(i.upsert)});const l=i.metadata;if(typeof Blob<"u"&&t instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",n.encodeMetadata(l)),s.append("",t)):typeof FormData<"u"&&t instanceof FormData?(s=t,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",n.encodeMetadata(l))):(s=t,o["cache-control"]=`max-age=${i.cacheControl}`,o["content-type"]=i.contentType,l&&(o["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!i.duplex&&(i.duplex="half")),r!=null&&r.headers)for(const[g,p]of Object.entries(r.headers))o=wo(o,g,p);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),d=await(A=="PUT"?Uc:Tt)(n.fetch,`${n.url}/object/${u}`,s,$({headers:o},i!=null&&i.duplex?{duplex:i.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(A,e,t){return this.uploadOrUpdate("POST",A,e,t)}async uploadToSignedUrl(A,e,t,r){var n=this;const s=n._removeEmptyFolders(A),i=n._getFinalPath(s),o=new URL(n.url+`/object/upload/sign/${i}`);return o.searchParams.set("token",e),n.handleOperation(async()=>{let l;const c=$($({},Jp),r);let u=$($({},n.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&t instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",n.encodeMetadata(d)),l.append("",t)):typeof FormData<"u"&&t instanceof FormData?(l=t,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(d))):(l=t,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[g,p]of Object.entries(r.headers))u=wo(u,g,p);return{path:s,fullPath:(await Uc(n.fetch,o.toString(),l,$({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(A,e){var t=this;return t.handleOperation(async()=>{let r=t._getFinalPath(A);const n=$({},t.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const s=await Tt(t.fetch,`${t.url}/object/upload/sign/${r}`,{},{headers:n}),i=new URL(t.url+s.url),o=i.searchParams.get("token");if(!o)throw new fo("No token returned by API");return{signedUrl:i.toString(),path:A,token:o}})}async update(A,e,t){return this.uploadOrUpdate("PUT",A,e,t)}async move(A,e,t){var r=this;return r.handleOperation(async()=>await Tt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:A,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:r.headers}))}async copy(A,e,t){var r=this;return r.handleOperation(async()=>({path:(await Tt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:A,destinationKey:e,destinationBucket:t==null?void 0:t.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(A,e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(A);const s=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0;let i=await Tt(r.fetch,`${r.url}/object/sign/${n}`,$({expiresIn:e},s?{transform:t.transform}:{}),{headers:r.headers});const o=new URLSearchParams;t!=null&&t.download&&o.set("download",t.download===!0?"":t.download),(t==null?void 0:t.cacheNonce)!=null&&o.set("cacheNonce",String(t.cacheNonce));const l=o.toString();return{signedUrl:encodeURI(`${r.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(A,e,t){var r=this;return r.handleOperation(async()=>{const n=await Tt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:A},{headers:r.headers}),s=new URLSearchParams;t!=null&&t.download&&s.set("download",t.download===!0?"":t.download),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString();return n.map(o=>$($({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${i?`&${i}`:""}`):null}))})}download(A,e,t){const r=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=this._getFinalPath(A),o=()=>ss(this.fetch,`${this.url}/${r}/${i}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},t);return new TT(o,this.shouldThrowOnError)}async info(A){var e=this;const t=e._getFinalPath(A);return e.handleOperation(async()=>bc(await ss(e.fetch,`${e.url}/object/info/${t}`,{headers:e.headers})))}async exists(A){var e=this;const t=e._getFinalPath(A);try{return await IT(e.fetch,`${e.url}/object/${t}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(go(n)){var r;const s=n instanceof po?n.status:n instanceof Gp?(r=n.originalError)===null||r===void 0?void 0:r.status:void 0;if(s!==void 0&&[400,404].includes(s))return{data:!1,error:n}}throw n}}getPublicUrl(A,e){const t=this._getFinalPath(A),r=new URLSearchParams;e!=null&&e.download&&r.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(r,e.transform),(e==null?void 0:e.cacheNonce)!=null&&r.set("cacheNonce",String(e.cacheNonce));const n=r.toString(),s=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${t}`)+(n?`?${n}`:"")}}}async remove(A){var e=this;return e.handleOperation(async()=>await Qc(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:A},{headers:e.headers}))}async list(A,e,t){var r=this;return r.handleOperation(async()=>{const n=$($($({},ST),e),{},{prefix:A||""});return await Tt(r.fetch,`${r.url}/object/list/${r.bucketId}`,n,{headers:r.headers},t)})}async listV2(A,e){var t=this;return t.handleOperation(async()=>{const r=$({},A);return await Tt(t.fetch,`${t.url}/object/list-v2/${t.bucketId}`,r,{headers:t.headers},e)})}encodeMetadata(A){return JSON.stringify(A)}toBase64(A){return typeof Buffer<"u"?Buffer.from(A).toString("base64"):btoa(A)}_getFinalPath(A){return`${this.bucketId}/${A.replace(/^\/+/,"")}`}_removeEmptyFolders(A){return A.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(A,e){return e.width&&A.set("width",e.width.toString()),e.height&&A.set("height",e.height.toString()),e.resize&&A.set("resize",e.resize),e.format&&A.set("format",e.format),e.quality&&A.set("quality",e.quality.toString()),A}};const is={"X-Client-Info":"storage-js/2.108.2"};var xT=class extends jr{constructor(A,e={},t,r){const n=new URL(A);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const s=n.href.replace(/\/$/,""),i=$($({},is),e);super(s,i,t,"storage")}async listBuckets(A){var e=this;return e.handleOperation(async()=>{const t=e.listBucketOptionsToQueryString(A);return await ss(e.fetch,`${e.url}/bucket${t}`,{headers:e.headers})})}async getBucket(A){var e=this;return e.handleOperation(async()=>await ss(e.fetch,`${e.url}/bucket/${A}`,{headers:e.headers}))}async createBucket(A,e={public:!1}){var t=this;return t.handleOperation(async()=>await Tt(t.fetch,`${t.url}/bucket`,{id:A,name:A,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async updateBucket(A,e){var t=this;return t.handleOperation(async()=>await Uc(t.fetch,`${t.url}/bucket/${A}`,{id:A,name:A,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async emptyBucket(A){var e=this;return e.handleOperation(async()=>await Tt(e.fetch,`${e.url}/bucket/${A}/empty`,{},{headers:e.headers}))}async deleteBucket(A){var e=this;return e.handleOperation(async()=>await Qc(e.fetch,`${e.url}/bucket/${A}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(A){const e={};return A&&("limit"in A&&(e.limit=String(A.limit)),"offset"in A&&(e.offset=String(A.offset)),A.search&&(e.search=A.search),A.sortColumn&&(e.sortColumn=A.sortColumn),A.sortOrder&&(e.sortOrder=A.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},kT=class extends jr{constructor(A,e={},t){const r=A.replace(/\/$/,""),n=$($({},is),e);super(r,n,t,"storage")}async createBucket(A){var e=this;return e.handleOperation(async()=>await Tt(e.fetch,`${e.url}/bucket`,{name:A},{headers:e.headers}))}async listBuckets(A){var e=this;return e.handleOperation(async()=>{const t=new URLSearchParams;(A==null?void 0:A.limit)!==void 0&&t.set("limit",A.limit.toString()),(A==null?void 0:A.offset)!==void 0&&t.set("offset",A.offset.toString()),A!=null&&A.sortColumn&&t.set("sortColumn",A.sortColumn),A!=null&&A.sortOrder&&t.set("sortOrder",A.sortOrder),A!=null&&A.search&&t.set("search",A.search);const r=t.toString(),n=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await ss(e.fetch,n,{headers:e.headers})})}async deleteBucket(A){var e=this;return e.handleOperation(async()=>await Qc(e.fetch,`${e.url}/bucket/${A}`,{},{headers:e.headers}))}from(A){var e=this;if(!ET(A))throw new fo("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const t=new wT({baseUrl:this.url,catalogName:A,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(t,{get(n,s){const i=n[s];return typeof i!="function"?i:async(...o)=>{try{return{data:await i.apply(n,o),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},HT=class extends jr{constructor(A,e={},t){const r=A.replace(/\/$/,""),n=$($({},is),{},{"Content-Type":"application/json"},e);super(r,n,t,"vectors")}async createIndex(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/CreateIndex`,A,{headers:e.headers})||{})}async getIndex(A,e){var t=this;return t.handleOperation(async()=>await dt.post(t.fetch,`${t.url}/GetIndex`,{vectorBucketName:A,indexName:e},{headers:t.headers}))}async listIndexes(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/ListIndexes`,A,{headers:e.headers}))}async deleteIndex(A,e){var t=this;return t.handleOperation(async()=>await dt.post(t.fetch,`${t.url}/DeleteIndex`,{vectorBucketName:A,indexName:e},{headers:t.headers})||{})}},LT=class extends jr{constructor(A,e={},t){const r=A.replace(/\/$/,""),n=$($({},is),{},{"Content-Type":"application/json"},e);super(r,n,t,"vectors")}async putVectors(A){var e=this;if(A.vectors.length<1||A.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/PutVectors`,A,{headers:e.headers})||{})}async getVectors(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/GetVectors`,A,{headers:e.headers}))}async listVectors(A){var e=this;if(A.segmentCount!==void 0){if(A.segmentCount<1||A.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(A.segmentIndex!==void 0&&(A.segmentIndex<0||A.segmentIndex>=A.segmentCount))throw new Error(`segmentIndex must be between 0 and ${A.segmentCount-1}`)}return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/ListVectors`,A,{headers:e.headers}))}async queryVectors(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/QueryVectors`,A,{headers:e.headers}))}async deleteVectors(A){var e=this;if(A.keys.length<1||A.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/DeleteVectors`,A,{headers:e.headers})||{})}},DT=class extends jr{constructor(A,e={},t){const r=A.replace(/\/$/,""),n=$($({},is),{},{"Content-Type":"application/json"},e);super(r,n,t,"vectors")}async createBucket(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:A},{headers:e.headers})||{})}async getBucket(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:A},{headers:e.headers}))}async listBuckets(A={}){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/ListVectorBuckets`,A,{headers:e.headers}))}async deleteBucket(A){var e=this;return e.handleOperation(async()=>await dt.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:A},{headers:e.headers})||{})}},OT=class extends DT{constructor(A,e={}){super(A,e.headers||{},e.fetch)}from(A){return new PT(this.url,this.headers,A,this.fetch)}async createBucket(A){var e=()=>super.createBucket,t=this;return e().call(t,A)}async getBucket(A){var e=()=>super.getBucket,t=this;return e().call(t,A)}async listBuckets(A={}){var e=()=>super.listBuckets,t=this;return e().call(t,A)}async deleteBucket(A){var e=()=>super.deleteBucket,t=this;return e().call(t,A)}},PT=class extends HT{constructor(A,e,t,r){super(A,e,r),this.vectorBucketName=t}async createIndex(A){var e=()=>super.createIndex,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName}))}async listIndexes(A={}){var e=()=>super.listIndexes,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName}))}async getIndex(A){var e=()=>super.getIndex,t=this;return e().call(t,t.vectorBucketName,A)}async deleteIndex(A){var e=()=>super.deleteIndex,t=this;return e().call(t,t.vectorBucketName,A)}index(A){return new NT(this.url,this.headers,this.vectorBucketName,A,this.fetch)}},NT=class extends LT{constructor(A,e,t,r,n){super(A,e,n),this.vectorBucketName=t,this.indexName=r}async putVectors(A){var e=()=>super.putVectors,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(A){var e=()=>super.getVectors,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(A={}){var e=()=>super.listVectors,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(A){var e=()=>super.queryVectors,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(A){var e=()=>super.deleteVectors,t=this;return e().call(t,$($({},A),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},VT=class extends xT{constructor(A,e={},t,r){super(A,e,t,r)}from(A){return new RT(this.url,this.headers,A,this.fetch)}get vectors(){return new OT(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new kT(this.url+"/iceberg",this.headers,this.fetch)}};const Xp="2.108.2",sA=30*1e3,os=3,Ic=os*sA,MT=2*sA,KT="http://localhost:9999",GT="supabase.auth.token",jT={"X-Client-Info":`gotrue-js/${Xp}`},Fc="X-Supabase-Api-Version",zp={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},$T=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,WT=10*60*1e3;class $r extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function P(A){return typeof A=="object"&&A!==null&&"__isAuthError"in A}class Yp extends $r{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}function Zp(A){return P(A)&&A.name==="AuthApiError"}class _t extends $r{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class St extends $r{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class Te extends St{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function as(A){return P(A)&&A.name==="AuthSessionMissingError"}class rr extends St{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ls extends St{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class cs extends St{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function ew(A){return P(A)&&A.name==="AuthImplicitGrantRedirectError"}class Tc extends St{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class tw extends St{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}function qT(A){return P(A)&&A.name==="AuthPKCECodeVerifierMissingError"}class Bo extends St{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Sc(A){return P(A)&&A.name==="AuthRetryableFetchError"}class Rc extends St{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function Aw(A){return P(A)&&A.name==="AuthRefreshDiscardedError"}class xc extends St{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}function JT(A){return P(A)&&A.name==="AuthWeakPasswordError"}class us extends St{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rw=`
|
|
3019
|
+
\r=`.split(""),XT=(()=>{const A=new Array(128);for(let e=0;e<A.length;e+=1)A[e]=-1;for(let e=0;e<rw.length;e+=1)A[rw[e].charCodeAt(0)]=-2;for(let e=0;e<mo.length;e+=1)A[mo[e].charCodeAt(0)]=e;return A})();function nw(A,e,t){if(A!==null)for(e.queue=e.queue<<8|A,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(mo[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;t(mo[r]),e.queuedBits-=6}}function sw(A,e,t){const r=XT[A];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(A)}"`)}}function iw(A){const e=[],t=i=>{e.push(String.fromCodePoint(i))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},s=i=>{ZT(i,r,t)};for(let i=0;i<A.length;i+=1)sw(A.charCodeAt(i),n,s);return e.join("")}function zT(A,e){if(A<=127){e(A);return}else if(A<=2047){e(192|A>>6),e(128|A&63);return}else if(A<=65535){e(224|A>>12),e(128|A>>6&63),e(128|A&63);return}else if(A<=1114111){e(240|A>>18),e(128|A>>12&63),e(128|A>>6&63),e(128|A&63);return}throw new Error(`Unrecognized Unicode codepoint: ${A.toString(16)}`)}function YT(A,e){for(let t=0;t<A.length;t+=1){let r=A.charCodeAt(t);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(A.charCodeAt(t+1)-56320&65535|n)+65536,t+=1}zT(r,e)}}function ZT(A,e,t){if(e.utf8seq===0){if(A<=127){t(A);return}for(let r=1;r<6;r+=1)if(!(A>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=A&31;else if(e.utf8seq===3)e.codepoint=A&15;else if(e.utf8seq===4)e.codepoint=A&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(A<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|A&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function Wr(A){const e=[],t={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<A.length;n+=1)sw(A.charCodeAt(n),t,r);return new Uint8Array(e)}function eS(A){const e=[];return YT(A,t=>e.push(t)),new Uint8Array(e)}function nr(A){const e=[],t={queue:0,queuedBits:0},r=n=>{e.push(n)};return A.forEach(n=>nw(n,t,r)),nw(null,t,r),e.join("")}function tS(A){return Math.round(Date.now()/1e3)+A}function AS(){return Symbol("auth-callback")}const je=()=>typeof window<"u"&&typeof document<"u",sr={tested:!1,writable:!1},ow=()=>{if(!je())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(sr.tested)return sr.writable;const A=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(A,A),globalThis.localStorage.removeItem(A),sr.tested=!0,sr.writable=!0}catch{sr.tested=!0,sr.writable=!1}return sr.writable};function rS(A){const e={},t=new URL(A);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((n,s)=>{e[s]=n})}catch{}return t.searchParams.forEach((r,n)=>{e[n]=r}),e}const aw=A=>A?(...e)=>A(...e):(...e)=>fetch(...e),nS=A=>typeof A=="object"&&A!==null&&"status"in A&&"ok"in A&&"json"in A&&typeof A.json=="function",qr=async(A,e,t)=>{await A.setItem(e,JSON.stringify(t))},Rt=async(A,e)=>{const t=await A.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return null}},ye=async(A,e)=>{await A.removeItem(e)};class yo{constructor(){this.promise=new yo.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}yo.promiseConstructor=Promise;function vo(A){const e=A.split(".");if(e.length!==3)throw new us("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!$T.test(e[r]))throw new us("JWT not in base64url format");return{header:JSON.parse(iw(e[0])),payload:JSON.parse(iw(e[1])),signature:Wr(e[2]),raw:{header:e[0],payload:e[1]}}}async function sS(A){return await new Promise(e=>{setTimeout(()=>e(null),A)})}function iS(A,e){return new Promise((r,n)=>{(async()=>{for(let s=0;s<1/0;s++)try{const i=await A(s);if(!e(s,null,i)){r(i);return}}catch(i){if(!e(s,i)){n(i);return}}})()})}function oS(A){return("0"+A.toString(16)).substr(-2)}function aS(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=t.length;let n="";for(let s=0;s<56;s++)n+=t.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,oS).join("")}async function lS(A){const t=new TextEncoder().encode(A),r=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r);return Array.from(n).map(s=>String.fromCharCode(s)).join("")}async function cS(A){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),A;const t=await lS(A);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ir(A,e,t=!1){const r=aS();let n=r;t&&(n+="/recovery"),await qr(A,`${e}-code-verifier`,n);const s=await cS(r);return[s,r===s?"plain":"s256"]}const uS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function hS(A){const e=A.headers.get(Fc);if(!e||!e.match(uS))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function dS(A){if(!A)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(A<=e)throw new Error("JWT has expired")}function fS(A){switch(A){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const gS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function iA(A){if(!gS.test(A))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function xt(A){if(!A.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function kc(){const A={};return new Proxy(A,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const r=t.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function pS(A,e){return new Proxy(A,{get:(t,r,n)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(t,r,n)}return!e.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(t,r,n)}})}function lw(A){return JSON.parse(JSON.stringify(A))}const or=A=>{if(typeof A=="object"&&A!==null){const e=A;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(A)},wS=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function cw(A){var e;if(!nS(A))throw new Bo(or(A),0);if(wS.includes(A.status))throw new Bo(or(A),A.status);let t;try{t=await A.json()}catch(s){throw new _t(or(s),s)}let r;const n=hS(A);if(n&&n.getTime()>=zp["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?r=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(r=t.error_code),r){if(r==="weak_password")throw new xc(or(t),A.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Te}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((s,i)=>s&&typeof i=="string",!0))throw new xc(or(t),A.status,t.weak_password.reasons);throw new Yp(or(t),A.status||500,r)}const BS=(A,e,t,r)=>{const n={method:A,headers:(e==null?void 0:e.headers)||{}};return A==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(r),Object.assign(Object.assign({},n),t))};async function K(A,e,t,r){var n;const s=Object.assign({},r==null?void 0:r.headers);s[Fc]||(s[Fc]=zp["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const i=(n=r==null?void 0:r.query)!==null&&n!==void 0?n:{};r!=null&&r.redirectTo&&(i.redirect_to=r.redirectTo);const o=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",l=await mS(A,e,t+o,{headers:s,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function mS(A,e,t,r,n,s){const i=BS(e,r,n,s);let o;try{o=await A(t,Object.assign({},i))}catch(l){throw console.error(l),new Bo(or(l),0)}if(o.ok||await cw(o),r!=null&&r.noResolveJson)return o;try{return await o.json()}catch(l){await cw(l)}}function Ct(A){var e;let t=null;_S(A)&&(t=Object.assign({},A),A.expires_at||(t.expires_at=tS(A.expires_in)));const r=(e=A.user)!==null&&e!==void 0?e:typeof(A==null?void 0:A.id)=="string"?A:null;return{data:{session:t,user:r},error:null}}function uw(A){const e=Ct(A);return!e.error&&A.weak_password&&typeof A.weak_password=="object"&&Array.isArray(A.weak_password.reasons)&&A.weak_password.reasons.length&&A.weak_password.message&&typeof A.weak_password.message=="string"&&A.weak_password.reasons.reduce((t,r)=>t&&typeof r=="string",!0)&&(e.data.weak_password=A.weak_password),e}function RA(A){var e;return{data:{user:(e=A.user)!==null&&e!==void 0?e:A},error:null}}function yS(A){return{data:A,error:null}}function vS(A){const{action_link:e,email_otp:t,hashed_token:r,redirect_to:n,verification_type:s}=A,i=no(A,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:t,hashed_token:r,redirect_to:n,verification_type:s},l=Object.assign({},i);return{data:{properties:o,user:l},error:null}}function hw(A){return A}function _S(A){return!!A.access_token&&!!A.refresh_token&&!!A.expires_in}const _o=["global","local","others"];class Hc{constructor({url:e="",headers:t={},fetch:r,experimental:n}){this.url=e,this.headers=t,this.fetch=aw(r),this.experimental=n??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,t=_o[0]){if(_o.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${_o.join(", ")}`);try{return await K(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,t={}){try{return await K(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:RA})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:t}=e,r=no(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=r==null?void 0:r.newEmail,delete n.newEmail),await K(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:vS,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(P(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await K(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:RA})}catch(t){if(P(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,r,n,s,i,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await K(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:"",per_page:(s=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:""},xform:hw});if(u.error)throw u.error;const d=await u.json(),g=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(B=>{const C=parseInt(B.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(B.split(";")[1].split("=")[1]);c[`${E}Page`]=C}),c.total=parseInt(g)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(P(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){iA(e);try{return await K(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:RA})}catch(t){if(P(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){iA(e);try{return await K(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:RA})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,t=!1){iA(e);try{return await K(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:RA})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){iA(e.userId);try{const{data:t,error:r}=await K(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:t,error:r}}catch(t){if(P(t))return{data:null,error:t};throw t}}async _deleteFactor(e){iA(e.userId),iA(e.id);try{return{data:await K(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,r,n,s,i,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await K(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&r!==void 0?r:"",per_page:(s=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:""},xform:hw});if(u.error)throw u.error;const d=await u.json(),g=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(B=>{const C=parseInt(B.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(B.split(";")[1].split("=")[1]);c[`${E}Page`]=C}),c.total=parseInt(g)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(P(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await K(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await K(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await K(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await K(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await K(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _listCustomProviders(e){try{const t={};return e!=null&&e.type&&(t.type=e.type),await K(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:r=>{var n;return{data:{providers:(n=r==null?void 0:r.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(t){if(P(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(e){try{return await K(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _getCustomProvider(e){try{return await K(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _updateCustomProvider(e,t){try{return await K(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await K(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}async _adminListPasskeys(e){xt(this.experimental),iA(e.userId);try{return await K(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(e){xt(this.experimental),iA(e.userId),iA(e.passkeyId);try{return await K(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}}function dw(A={}){return{getItem:e=>A[e]||null,setItem:(e,t)=>{A[e]=t},removeItem:e=>{delete A[e]}}}const kt={debug:!!(globalThis&&ow()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class hs extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Lc extends hs{}class CS extends hs{}async function ES(A,e,t){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",A,e);const r=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{r.abort(),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",A)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(A,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){clearTimeout(n),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",A,s.name);try{return await t()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",A,s.name)}}else{if(e===0)throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",A),new Lc(`Acquiring an exclusive Navigator LockManager lock "${A}" immediately failed`);if(kt.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(n),await t()}})}catch(s){if(e>0&&clearTimeout(n),s!==null&&typeof s=="object"&&"name"in s&&s.name==="AbortError"&&e>0){if(r.signal.aborted)return kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",A),console.warn(`@supabase/gotrue-js: Lock "${A}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(A,{mode:"exclusive",steal:!0},async i=>{if(i){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",A,i.name);try{return await t()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",A,i.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await t()}));throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",A),new Lc(`Lock "${A}" was released because another request stole it`)}throw s}}const fw={};async function bS(A,e,t){var r;const n=(r=fw[A])!==null&&r!==void 0?r:Promise.resolve(),s=(async()=>{try{return await n,null}catch{return null}})(),i=(async()=>{let o=null;try{const l=e>=0?new Promise((c,u)=>{o=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${A}" acquisition timed out after ${e}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),u(new CS(`Acquiring process lock with name "${A}" timed out`))},e)}):null;await Promise.race([s,l].filter(c=>c)),o!==null&&clearTimeout(o)}catch(l){if(o!==null&&clearTimeout(o),l instanceof hs)throw l}return await t()})();return fw[A]=(async()=>{try{return await i}catch(o){if(o instanceof hs){try{await n}catch{}return null}throw o}})(),await i}function US(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function gw(A){if(!/^0x[a-fA-F0-9]{40}$/.test(A))throw new Error(`@supabase/auth-js: Address "${A}" is invalid.`);return A.toLowerCase()}function QS(A){return parseInt(A,16)}function IS(A){const e=new TextEncoder().encode(A);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function FS(A){var e;const{chainId:t,domain:r,expirationTime:n,issuedAt:s=new Date,nonce:i,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:g}=A;{if(!Number.isInteger(t))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${t}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(g!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${g}`);if(!((e=A.statement)===null||e===void 0)&&e.includes(`
|
|
3020
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${A.statement}`)}const p=gw(A.address),B=u?`${u}://${r}`:r,C=A.statement?`${A.statement}
|
|
3021
|
+
`:"",E=`${B} wants you to sign in with your Ethereum account:
|
|
3022
|
+
${p}
|
|
3023
|
+
|
|
3024
|
+
${C}`;let I=`URI: ${d}
|
|
3025
|
+
Version: ${g}
|
|
3026
|
+
Chain ID: ${t}${i?`
|
|
3027
|
+
Nonce: ${i}`:""}
|
|
3028
|
+
Issued At: ${s.toISOString()}`;if(n&&(I+=`
|
|
3029
|
+
Expiration Time: ${n.toISOString()}`),o&&(I+=`
|
|
3030
|
+
Not Before: ${o.toISOString()}`),l&&(I+=`
|
|
3031
|
+
Request ID: ${l}`),c){let Q=`
|
|
3032
|
+
Resources:`;for(const S of c){if(!S||typeof S!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${S}`);Q+=`
|
|
3033
|
+
- ${S}`}I+=Q}return`${E}
|
|
3034
|
+
${I}`}class Ue extends Error{constructor({message:e,code:t,cause:r,name:n}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=n??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=t}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Co extends Ue{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function TS({error:A,options:e}){var t,r,n;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(A.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ue({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:A})}else if(A.name==="ConstraintError"){if(((t=s.authenticatorSelection)===null||t===void 0?void 0:t.requireResidentKey)===!0)return new Ue({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:A});if(e.mediation==="conditional"&&((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Ue({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:A});if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Ue({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:A})}else{if(A.name==="InvalidStateError")return new Ue({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:A});if(A.name==="NotAllowedError")return new Ue({message:A.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:A});if(A.name==="NotSupportedError")return s.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Ue({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:A}):new Ue({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:A});if(A.name==="SecurityError"){const i=window.location.hostname;if(yw(i)){if(s.rp.id!==i)return new Ue({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:A})}else return new Ue({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:A})}else if(A.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new Ue({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:A})}else if(A.name==="UnknownError")return new Ue({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:A})}return new Ue({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:A})}function SS({error:A,options:e}){const{publicKey:t}=e;if(!t)throw Error("options was missing required publicKey property");if(A.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ue({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:A})}else{if(A.name==="NotAllowedError")return new Ue({message:A.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:A});if(A.name==="SecurityError"){const r=window.location.hostname;if(yw(r)){if(t.rpId!==r)return new Ue({message:`The RP ID "${t.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:A})}else return new Ue({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:A})}else if(A.name==="UnknownError")return new Ue({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:A})}return new Ue({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:A})}class RS{createNewAbortSignal(){if(this.controller){const t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Dc=new RS;function pw(A){if(!A)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(A);const{challenge:e,user:t,excludeCredentials:r}=A,n=no(A,["challenge","user","excludeCredentials"]),s=Wr(e).buffer,i=Object.assign(Object.assign({},t),{id:Wr(t.id).buffer}),o=Object.assign(Object.assign({},n),{challenge:s,user:i});if(r&&r.length>0){o.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Wr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function ww(A){if(!A)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(A);const{challenge:e,allowCredentials:t}=A,r=no(A,["challenge","allowCredentials"]),n=Wr(e).buffer,s=Object.assign(Object.assign({},r),{challenge:n});if(t&&t.length>0){s.allowCredentials=new Array(t.length);for(let i=0;i<t.length;i++){const o=t[i];s.allowCredentials[i]=Object.assign(Object.assign({},o),{id:Wr(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return s}function Bw(A){var e;if("toJSON"in A&&typeof A.toJSON=="function")return A.toJSON();const t=A;return{id:A.id,rawId:A.id,response:{attestationObject:nr(new Uint8Array(A.response.attestationObject)),clientDataJSON:nr(new Uint8Array(A.response.clientDataJSON))},type:"public-key",clientExtensionResults:A.getClientExtensionResults(),authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function mw(A){var e;if("toJSON"in A&&typeof A.toJSON=="function")return A.toJSON();const t=A,r=A.getClientExtensionResults(),n=A.response;return{id:A.id,rawId:A.id,response:{authenticatorData:nr(new Uint8Array(n.authenticatorData)),clientDataJSON:nr(new Uint8Array(n.clientDataJSON)),signature:nr(new Uint8Array(n.signature)),userHandle:n.userHandle?nr(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function yw(A){return A==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(A)}function Eo(){var A,e;return!!(je()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((A=navigator==null?void 0:navigator.credentials)===null||A===void 0?void 0:A.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function vw(A){try{const e=await navigator.credentials.create(A);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Co("Browser returned unexpected credential type",e)}:{data:null,error:new Co("Empty credential response",e)}}catch(e){return{data:null,error:TS({error:e,options:A})}}}async function _w(A){try{const e=await navigator.credentials.get(A);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Co("Browser returned unexpected credential type",e)}:{data:null,error:new Co("Empty credential response",e)}}catch(e){return{data:null,error:SS({error:e,options:A})}}}const xS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},kS={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function bo(...A){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),t=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),r={};for(const n of A)if(n)for(const s in n){const i=n[s];if(i!==void 0)if(Array.isArray(i))r[s]=i;else if(t(i))r[s]=i;else if(e(i)){const o=r[s];e(o)?r[s]=bo(o,i):r[s]=bo(i)}else r[s]=i}return r}function HS(A,e){return bo(xS,A,e||{})}function LS(A,e){return bo(kS,A,e||{})}class DS{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:n},s){var i;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!o)return{data:null,error:l};const c=n??Dc.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=r;if(d)u.name=`${u.id}:${d}`;else{const p=(await this.client.getUser()).data.user,B=((i=p==null?void 0:p.user_metadata)===null||i===void 0?void 0:i.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";u.name=`${u.id}:${B}`}}u.displayName||(u.displayName=u.name)}switch(o.webauthn.type){case"create":{const u=HS(o.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:d,error:g}=await vw({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:g}}case"request":{const u=LS(o.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:d,error:g}=await _w(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:g}}}}catch(o){return P(o)?{data:null,error:o}:{data:null,error:new _t("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},s){if(!t)return{data:null,error:new $r("rpId is required for WebAuthn authentication")};try{if(!Eo())return{data:null,error:new _t("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:n},{request:s});if(!i)return{data:null,error:o};const{webauthn:l}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:l.type,rpId:t,rpOrigins:r,credential_response:l.credential_response}})}catch(i){return P(i)?{data:null,error:i}:{data:null,error:new _t("Unexpected error in authenticate",i)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},s){if(!t)return{data:null,error:new $r("rpId is required for WebAuthn registration")};try{if(!Eo())return{data:null,error:new _t("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this._enroll({friendlyName:e});if(!i)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(g=>g.factor_type==="webauthn"&&g.friendly_name===e&&g.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:n},{create:s});return l?this._verify({factorId:i.id,challengeId:l.challengeId,webauthn:{rpId:t,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(i){return P(i)?{data:null,error:i}:{data:null,error:new _t("Unexpected error in register",i)}}}}US();const OS={url:KT,storageKey:GT,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:jT,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Jr={};class Xr{get jwks(){var e,t;return(t=(e=Jr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){Jr[this.storageKey]=Object.assign(Object.assign({},Jr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=Jr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Jr[this.storageKey]=Object.assign(Object.assign({},Jr[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},OS),e);if(this.storageKey=s.storageKey,this.instanceID=(t=Xr.nextInstanceID[this.storageKey])!==null&&t!==void 0?t:0,Xr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&je()){const i=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(i),this.logDebugMessages&&console.trace(i)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.experimental=(r=s.experimental)!==null&&r!==void 0?r:{},this.admin=new Hc({url:s.url,headers:s.headers,fetch:s.fetch,experimental:this.experimental}),this.url=s.url,this.headers=s.headers,this.fetch=aw(s.fetch),this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock!=null&&(this.lock=s.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new DS(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:ow()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=dw(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=dw(this.memoryStorage)),je()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),(i.data.event==="TOKEN_REFRESHED"||i.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(i.data.event,i.data.session,!1)}catch(o){this._debug("#broadcastChannel","error",o)}})}s.skipAutoInitialize||this.initialize().catch(i=>{this._debug("#initialize()","error",i)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Xp}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var e;try{let t={},r="none";if(je()&&(t=rS(window.location.href),this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce")),je()&&this.detectSessionInUrl&&r!=="none"){const{data:n,error:s}=await this._getSessionFromURL(t,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),ew(s)){const l=(e=s.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:i,redirectType:o}=n;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return P(t)?this._returnResult({error:t}):this._returnResult({error:new _t("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{const s=await K(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:Ct}),{data:i,error:o}=s;if(o||!i)return this._returnResult({data:{user:null,session:null},error:o});const l=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var t,r,n;try{let s;if("email"in e){const{email:u,password:d,options:g}=e;let p=null,B=null;this.flowType==="pkce"&&([p,B]=await ir(this.storage,this.storageKey)),s=await K(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:g==null?void 0:g.emailRedirectTo,body:{email:u,password:d,data:(t=g==null?void 0:g.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken},code_challenge:p,code_challenge_method:B},xform:Ct})}else if("phone"in e){const{phone:u,password:d,options:g}=e;s=await K(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=g==null?void 0:g.data)!==null&&r!==void 0?r:{},channel:(n=g==null?void 0:g.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken}},xform:Ct})}else throw new ls("You must provide either an email or phone number and a password");const{data:i,error:o}=s;if(o||!i)return await ye(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let t;if("email"in e){const{email:s,password:i,options:o}=e;t=await K(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:uw})}else if("phone"in e){const{phone:s,password:i,options:o}=e;t=await K(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:uw})}else throw new ls("You must provide either an email or phone number and a password");const{data:r,error:n}=t;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){const s=new rr;return this._returnResult({data:{user:null,session:null},error:s})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(t){if(P(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,r,n,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,n,s,i,o,l,c,u,d,g;let p,B;if("message"in e)p=e.message,B=e.signature;else{const{chain:C,wallet:E,statement:I,options:Q}=e;let S;if(je())if(typeof E=="object")S=E;else{const y=window;if("ethereum"in y&&typeof y.ethereum=="object"&&"request"in y.ethereum&&typeof y.ethereum.request=="function")S=y.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(Q!=null&&Q.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");S=E}const k=new URL((t=Q==null?void 0:Q.url)!==null&&t!==void 0?t:window.location.href),H=await S.request({method:"eth_requestAccounts"}).then(y=>y).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!H||H.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const R=gw(H[0]);let _=(r=Q==null?void 0:Q.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!_){const y=await S.request({method:"eth_chainId"});_=QS(y)}const m={domain:k.host,address:R,statement:I,uri:k.href,version:"1",chainId:_,nonce:(n=Q==null?void 0:Q.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(i=(s=Q==null?void 0:Q.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(o=Q==null?void 0:Q.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=Q==null?void 0:Q.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=Q==null?void 0:Q.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=Q==null?void 0:Q.signInWithEthereum)===null||u===void 0?void 0:u.resources};p=FS(m),B=await S.request({method:"personal_sign",params:[IS(p),R]})}try{const{data:C,error:E}=await K(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:B},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(g=e.options)===null||g===void 0?void 0:g.captchaToken}}:null),xform:Ct});if(E)throw E;if(!C||!C.session||!C.user){const I=new rr;return this._returnResult({data:{user:null,session:null},error:I})}return C.session&&(await this._saveSession(C.session),await this._notifyAllSubscribers("SIGNED_IN",C.session)),this._returnResult({data:Object.assign({},C),error:E})}catch(C){if(P(C))return this._returnResult({data:{user:null,session:null},error:C});throw C}}async signInWithSolana(e){var t,r,n,s,i,o,l,c,u,d,g,p;let B,C;if("message"in e)B=e.message,C=e.signature;else{const{chain:E,wallet:I,statement:Q,options:S}=e;let k;if(je())if(typeof I=="object")k=I;else{const R=window;if("solana"in R&&typeof R.solana=="object"&&("signIn"in R.solana&&typeof R.solana.signIn=="function"||"signMessage"in R.solana&&typeof R.solana.signMessage=="function"))k=R.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof I!="object"||!(S!=null&&S.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=I}const H=new URL((t=S==null?void 0:S.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in k&&k.signIn){const R=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},S==null?void 0:S.signInWithSolana),{version:"1",domain:H.host,uri:H.href}),Q?{statement:Q}:null));let _;if(Array.isArray(R)&&R[0]&&typeof R[0]=="object")_=R[0];else if(R&&typeof R=="object"&&"signedMessage"in R&&"signature"in R)_=R;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in _&&"signature"in _&&(typeof _.signedMessage=="string"||_.signedMessage instanceof Uint8Array)&&_.signature instanceof Uint8Array)B=typeof _.signedMessage=="string"?_.signedMessage:new TextDecoder().decode(_.signedMessage),C=_.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");B=[`${H.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...Q?["",Q,""]:[""],"Version: 1",`URI: ${H.href}`,`Issued At: ${(n=(r=S==null?void 0:S.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((s=S==null?void 0:S.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${S.signInWithSolana.notBefore}`]:[],...!((i=S==null?void 0:S.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${S.signInWithSolana.expirationTime}`]:[],...!((o=S==null?void 0:S.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${S.signInWithSolana.chainId}`]:[],...!((l=S==null?void 0:S.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${S.signInWithSolana.nonce}`]:[],...!((c=S==null?void 0:S.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${S.signInWithSolana.requestId}`]:[],...!((d=(u=S==null?void 0:S.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...S.signInWithSolana.resources.map(_=>`- ${_}`)]:[]].join(`
|
|
3035
|
+
`);const R=await k.signMessage(new TextEncoder().encode(B),"utf8");if(!R||!(R instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");C=R}}try{const{data:E,error:I}=await K(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:B,signature:nr(C)},!((g=e.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Ct});if(I)throw I;if(!E||!E.session||!E.user){const Q=new rr;return this._returnResult({data:{user:null,session:null},error:Q})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:I})}catch(E){if(P(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(e){const t=await Rt(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(t??"").split("/");try{if(!r&&this.flowType==="pkce")throw new tw;const{data:s,error:i}=await K(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Ct});if(await ye(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!s||!s.session||!s.user){const o=new rr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers(n==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:n??null}),error:i})}catch(s){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:t,provider:r,token:n,access_token:s,nonce:i}=e,o=await K(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:Ct}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new rr;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(t){if(P(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,r,n,s,i;try{if("email"in e){const{email:o,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await ir(this.storage,this.storageKey));const{error:d}=await K(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(t=l==null?void 0:l.data)!==null&&t!==void 0?t:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in e){const{phone:o,options:l}=e,{data:c,error:u}=await K(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(i=l==null?void 0:l.channel)!==null&&i!==void 0?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new ls("You must provide either an email or phone number.")}catch(o){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var t,r;try{let n,s;"options"in e&&(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo,s=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:i,error:o}=await K(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:Ct});if(o)throw o;if(!i)throw new Error("An error occurred on token verification.");const l=i.session,c=i.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(n){if(P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var t,r,n,s,i;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await ir(this.storage,this.storageKey));const c=await K(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&r!==void 0?r:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:yS});return!((s=c.data)===null||s===void 0)&&s.url&&je()&&!(!((i=e.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new Te;const{error:n}=await K(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(P(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:s}=e;let i=null,o=null;this.flowType==="pkce"&&([i,o]=await ir(this.storage,this.storageKey));const{error:l}=await K(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken},code_challenge:i,code_challenge_method:o},redirectTo:s==null?void 0:s.emailRedirectTo});return l&&await ye(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l})}else if("phone"in e){const{phone:r,type:n,options:s}=e,{data:i,error:o}=await K(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:i==null?void 0:i.message_id},error:o})}throw new ls("You must provide either an email or phone number and a type")}catch(t){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await r,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=t();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await Rt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Ic:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const i=await Rt(this.userStorage,this.storageKey+"-user");i!=null&&i.user?e.user=i.user:e.user=kc()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const i={value:this.suppressGetSessionWarning};e.user=pS(e.user,i),i.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:s}=await this._callRefreshToken(e.refresh_token);if(s){if(!!(e.expires_at&&e.expires_at*1e3>Date.now())){const o=await Rt(this.storage,this.storageKey);if(o&&o.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:s})}return this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t;return this.lock!=null?t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):t=await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await K(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:RA}):await this._useSession(async t=>{var r,n,s;const{data:i,error:o}=t;if(o)throw o;return!(!((r=i.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Te}:await K(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0,xform:RA})})}catch(t){if(P(t))return as(t)&&(await this._removeSession(),await ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async r=>{const{data:n,error:s}=r;if(s)throw s;if(!n.session)throw new Te;const i=n.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await ir(this.storage,this.storageKey));const{data:c,error:u}=await K(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:l}),jwt:i.access_token,xform:RA});if(u)throw u;return i.user=c.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(r){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Te;const t=Date.now()/1e3;let r=t,n=!0,s=null;const{payload:i}=vo(e.access_token);if(i.exp&&(r=i.exp,n=r<=t),n){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};s=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});s={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(t){if(P(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){const{data:i,error:o}=t;if(o)throw o;e=(r=i.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Te;const{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(P(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){var r;try{if(!je())throw new cs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new cs(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new Tc("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new cs("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Tc("No code detected.");const{data:S,error:k}=await this._exchangeCodeForSession(e.code);if(k)throw k;const H=new URL(window.location.href);return H.searchParams.delete("code"),window.history.replaceState(window.history.state,"",H.toString()),{data:{session:S.session,redirectType:(r=S.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=e;if(!i||!l||!o||!u)throw new cs("No session defined in URL");const d=Math.round(Date.now()/1e3),g=parseInt(l);let p=d+g;c&&(p=parseInt(c));const B=p-d;B*1e3<=sA&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${B}s, should have been closer to ${g}s`);const C=p-g;d-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,p,d):d-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,p,d);const{data:E,error:I}=await this._getUser(i);if(I)throw I;const Q={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:g,expires_at:p,refresh_token:o,token_type:u,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:Q,redirectType:e.type},error:null})}catch(n){if(P(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await Rt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;const{data:n,error:s}=t;if(s&&!as(s))return this._returnResult({error:s});const i=(r=n.session)===null||r===void 0?void 0:r.access_token;if(i){const{error:o}=await this.admin.signOut(i,e);if(o&&!(Zp(o)&&(o.status===404||o.status===401||o.status===403)||as(o)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await ye(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=AS(),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{const{data:{session:s},error:i}=t;if(i)throw i;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),as(s)?console.warn(s):console.error(s)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;this.flowType==="pkce"&&([r,n]=await ir(this.storage,this.storageKey,!0));try{return await K(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(s){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:r,error:n}=await this._useSession(async s=>{var i,o,l,c,u;const{data:d,error:g}=s;if(g)throw g;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(i=e.options)===null||i===void 0?void 0:i.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await K(this.fetch,"GET",p,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return je()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(P(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{const{error:n,data:{session:s}}=t;if(n)throw n;const{options:i,provider:o,token:l,access_token:c,nonce:u}=e,d=await K(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Ct}),{data:g,error:p}=d;return p?this._returnResult({data:{user:null,session:null},error:p}):!g||!g.session||!g.user?this._returnResult({data:{user:null,session:null},error:new rr}):(g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("USER_UPDATED",g.session)),this._returnResult({data:g,error:p}))}catch(n){if(await ye(this.storage,`${this.storageKey}-code-verifier`),P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;const{data:s,error:i}=t;if(i)throw i;return await K(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,"begin");try{const r=Date.now();return await iS(async n=>(n>0&&await sS(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await K(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ct})),(n,s)=>{const i=200*Math.pow(2,n);return s&&Sc(s)&&Date.now()+i-r<sA})}catch(r){if(this._debug(t,"error",r),P(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),je()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const n=await Rt(this.storage,this.storageKey);if(n&&this.userStorage){let i=await Rt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:n.user},await qr(this.userStorage,this.storageKey+"-user",i)),n.user=(e=i==null?void 0:i.user)!==null&&e!==void 0?e:kc()}else if(n&&!n.user&&!n.user){const i=await Rt(this.storage,this.storageKey+"-user");i&&(i!=null&&i.user)?(n.user=i.user,await ye(this.storage,this.storageKey+"-user"),await qr(this.storage,this.storageKey,n)):n.user=kc()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),n!==null&&await this._removeSession();return}const s=((t=n.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Ic;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${Ic}s`),s){if(this.autoRefreshToken&&n.refresh_token){const{error:i}=await this._callRefreshToken(n.refresh_token);i&&(Aw(i)?this._debug(r,"refresh discarded by commit guard",i):this._debug(r,"refresh failed",i))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:o}=await this._getUser(n.access_token);!o&&(i!=null&&i.user)?(n.user=i.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(r,"error getting user data, skipping SIGNED_IN notification",i)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(r,"error",n),console.error(n);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new Te;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const n="#_callRefreshToken()";this._debug(n,"begin");try{this.refreshingDeferred=new yo;const s=await Rt(this.storage,this.storageKey),{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Te;const l=await Rt(this.storage,this.storageKey);if(s!==null&&(l===null||l.refresh_token!==s.refresh_token)){this._debug(n,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:l?"replaced":"cleared"});const g={data:null,error:new Rc};return this.refreshingDeferred.resolve(g),g}const u=this._sessionRemovalEpoch;if(await this._saveSession(i.session),this._sessionRemovalEpoch!==u){this._debug(n,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await ye(this.storage,this.storageKey),this.userStorage&&await ye(this.userStorage,this.storageKey+"-user");const g={data:null,error:new Rc};return this.refreshingDeferred.resolve(g),g}await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const d={data:i.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(d),d}catch(s){if(this._debug(n,"error",s),P(s)){const i={data:null,error:s};if(!Sc(s)){const o=await Rt(this.storage,this.storageKey);!!(o!=null&&o.expires_at&&o.expires_at*1e3>Date.now())?this._debug(n,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:i,expiresAt:Date.now()+MT},(t=this.refreshingDeferred)===null||t===void 0||t.resolve(i),i}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});const s=[],i=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,t)}catch(l){s.push(l)}});if(await Promise.all(i),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await ye(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),r=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&t.user&&await qr(this.userStorage,this.storageKey+"-user",{user:t.user});const n=Object.assign({},t);delete n.user;const s=lw(n);await qr(this.storage,this.storageKey,s)}else{const n=lw(t);await qr(this.storage,this.storageKey,n)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ye(this.storage,this.storageKey),await ye(this.storage,this.storageKey+"-code-verifier"),await ye(this.storage,this.storageKey+"-user"),this.userStorage&&await ye(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&je()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),sA);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/sA);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${sA}ms, refresh threshold is ${os} ticks`),n<=os&&await this._callRefreshToken(r.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof hs)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/sA);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${sA}ms, refresh threshold is ${os} ticks`),n<=os&&await this._callRefreshToken(r.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!je()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(t,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){const n=[`provider=${encodeURIComponent(t)}`];if(r!=null&&r.redirectTo&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[s,i]=await ir(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(i)}`});n.push(o.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);n.push(s.toString())}return r!=null&&r.skipBrowserRedirect&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;const{data:n,error:s}=t;return s?this._returnResult({data:null,error:s}):await K(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;const{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await K(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){const t=async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Bw(e.webauthn.credential_response):mw(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await K(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await K(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:pw(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:ww(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};const n={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=t==null?void 0:t.factors)!==null&&e!==void 0?e:[])n.all.push(s),s.status==="verified"&&n[s.factor_type].push(s);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,r,n,s;if(e)try{const{payload:p}=vo(e);let B=null;p.aal&&(B=p.aal);let C=B;const{data:{user:E},error:I}=await this.getUser(e);if(I)return this._returnResult({data:null,error:I});((r=(t=E==null?void 0:E.factors)===null||t===void 0?void 0:t.filter(k=>k.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(C="aal2");const S=p.amr||[];return{data:{currentLevel:B,nextLevel:C,currentAuthenticationMethods:S},error:null}}catch(p){if(P(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=vo(i.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((s=(n=i.user.factors)===null||n===void 0?void 0:n.filter(p=>p.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(u="aal2");const g=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:g},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await K(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Te})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Te});const i=await K(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return i.data&&i.data.redirect_url&&je()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Te});const i=await K(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return i.data&&i.data.redirect_url&&je()&&!(t!=null&&t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await K(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new Te})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?(await K(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Te})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(o=>o.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(o=>o.kid===e),r&&this.jwks_cached_at+WT>n)return r;const{data:s,error:i}=await K(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=n,r=s.keys.find(o=>o.kid===e),!r)?null:r}async getClaims(e,t={}){try{let r=e;if(!r){const{data:p,error:B}=await this.getSession();if(B||!p.session)return this._returnResult({data:null,error:B});r=p.session.access_token}const{header:n,payload:s,signature:i,raw:{header:o,payload:l}}=vo(r);if(!(t!=null&&t.allowExpired))try{dS(s.exp)}catch(p){throw new us(p instanceof Error?p.message:"JWT validation failed")}const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!c){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:s,header:n,signature:i},error:null}}const u=fS(n.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,i,eS(`${o}.${l}`)))throw new us("Invalid JWT signature");return{data:{claims:s,header:n,signature:i},error:null}}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var t,r,n;xt(this.experimental);try{if(!Eo())return this._returnResult({data:null,error:new _t("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyAuthentication({options:{captchaToken:(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.captchaToken}});if(i||!s)return this._returnResult({data:null,error:i});const o=ww(s.options),l=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Dc.createNewAbortSignal(),{data:c,error:u}=await _w({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new _t("WebAuthn ceremony failed",null)});const d=mw(c);return this._verifyPasskeyAuthentication({challengeId:s.challenge_id,credential:d})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async registerPasskey(e){var t,r;xt(this.experimental);try{if(!Eo())return this._returnResult({data:null,error:new _t("Browser does not support WebAuthn",null)});const{data:n,error:s}=await this._startPasskeyRegistration();if(s||!n)return this._returnResult({data:null,error:s});const i=pw(n.options),o=(r=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.signal)!==null&&r!==void 0?r:Dc.createNewAbortSignal(),{data:l,error:c}=await vw({publicKey:i,signal:o});if(c||!l)return this._returnResult({data:null,error:c??new _t("WebAuthn ceremony failed",null)});const u=Bw(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(P(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){xt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new Te});const{data:n,error:s}=await K(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){xt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:s,error:i}=await K(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _startPasskeyAuthentication(e){var t;xt(this.experimental);try{const{data:r,error:n}=await K(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:r,error:null})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){xt(this.experimental);try{const{data:t,error:r}=await K(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Ct});return r?this._returnResult({data:null,error:r}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:t,error:null}))}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _listPasskeys(){xt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new Te});const{data:n,error:s}=await K(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:i=>({data:i,error:null})});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){xt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:s,error:i}=await K(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}async _deletePasskey(e){xt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{error:s}=await K(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return s?this._returnResult({data:null,error:s}):this._returnResult({data:null,error:null})})}catch(t){if(P(t))return this._returnResult({data:null,error:t});throw t}}}Xr.nextInstanceID={};const PS=Hc,Cw=Xr,NS="2.108.2";let ds="",Uo;if(typeof Deno<"u"){var Oc;ds="deno",Uo=(Oc=Deno.version)===null||Oc===void 0?void 0:Oc.deno}else if(typeof document<"u")ds="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")ds="react-native";else{var Pc;ds="node",Uo=typeof process<"u"?(Pc=process.version)===null||Pc===void 0?void 0:Pc.replace(/^v/,""):void 0}const Ew=[`runtime=${ds}`];Uo&&Ew.push(`runtime-version=${Uo}`);const VS={headers:{"X-Client-Info":`supabase-js/${NS}; ${Ew.join("; ")}`}},MS={schema:"public"},KS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},GS={},jS={enabled:!1,respectSamplingDecision:!0};function $S(A,e,t,r){function n(s){return s instanceof t?s:new t(function(i){i(s)})}return new(t||(t=Promise))(function(s,i){function o(u){try{c(r.next(u))}catch(d){i(d)}}function l(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((r=r.apply(A,[])).next())})}let Nc=null;const WS="@opentelemetry/api";function qS(){return Nc===null&&(Nc=import(WS).catch(()=>null)),Nc}function JS(){return $S(this,void 0,void 0,function*(){try{const A=yield qS();if(!A||!A.propagation||!A.context)return null;const e={};A.propagation.inject(A.context.active(),e);const t=e.traceparent;return t?{traceparent:t,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function XS(A){if(!A||typeof A!="string")return null;const e=A.split("-");if(e.length!==4)return null;const[t,r,n,s]=e;if(t.length!==2||r.length!==32||n.length!==16||s.length!==2)return null;const i=/^[0-9a-f]+$/i;return!i.test(t)||!i.test(r)||!i.test(n)||!i.test(s)||r==="00000000000000000000000000000000"||n==="0000000000000000"?null:{version:t,traceId:r,parentId:n,traceFlags:s,isSampled:(parseInt(s,16)&1)===1}}function zS(A,e){if(!A||!e||e.length===0)return!1;let t;if(A instanceof URL)t=A;else try{t=new URL(A)}catch{return!1}for(const r of e)try{if(typeof r=="string"){if(YS(t.hostname,r))return!0}else if(r instanceof RegExp){if(r.test(t.hostname))return!0}else if(typeof r=="function"&&r(t))return!0}catch{continue}return!1}function YS(A,e){if(e===A)return!0;if(e.startsWith("*.")){const t=e.slice(2);if(A.endsWith(t)&&(A===t||A.endsWith("."+t)))return!0}return!1}function ZS(A){const e=[];try{const t=new URL(A);e.push(t.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function fs(A){"@babel/helpers - typeof";return fs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fs(A)}function eR(A,e){if(fs(A)!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var r=t.call(A,e);if(fs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function tR(A){var e=eR(A,"string");return fs(e)=="symbol"?e:e+""}function AR(A,e,t){return(e=tR(e))in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function bw(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(A);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(A,n).enumerable})),t.push.apply(t,r)}return t}function ge(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bw(Object(t),!0).forEach(function(r){AR(A,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):bw(Object(t)).forEach(function(r){Object.defineProperty(A,r,Object.getOwnPropertyDescriptor(t,r))})}return A}const rR=A=>A?(...e)=>A(...e):(...e)=>fetch(...e),nR=()=>Headers,sR=(A,e,t,r,n)=>{const s=rR(r),i=nR(),o=(n==null?void 0:n.enabled)===!0,l=(n==null?void 0:n.respectSamplingDecision)!==!1,c=o?ZS(e):null;return async(u,d)=>{var g;const p=(g=await t())!==null&&g!==void 0?g:A;let B=new i(d==null?void 0:d.headers);if(B.has("apikey")||B.set("apikey",A),B.has("Authorization")||B.set("Authorization",`Bearer ${p}`),c){const C=await iR(u,c,l);C&&(C.traceparent&&!B.has("traceparent")&&B.set("traceparent",C.traceparent),C.tracestate&&!B.has("tracestate")&&B.set("tracestate",C.tracestate),C.baggage&&!B.has("baggage")&&B.set("baggage",C.baggage))}return s(u,ge(ge({},d),{},{headers:B}))}};async function iR(A,e,t){if(!zS(typeof A=="string"||A instanceof URL?A:A.url,e))return null;const r=await JS();if(!r||!r.traceparent)return null;if(t){const n=XS(r.traceparent);if(n&&!n.isSampled)return null}return r}function Uw(A){return typeof A=="boolean"?{enabled:A}:A}function oR(A){return A.endsWith("/")?A:A+"/"}function aR(A,e){var t,r,n,s,i,o;const{db:l,auth:c,realtime:u,global:d}=A,{db:g,auth:p,realtime:B,global:C}=e,E=Uw(A.tracePropagation),I=Uw(e.tracePropagation),Q={db:ge(ge({},g),l),auth:ge(ge({},p),c),realtime:ge(ge({},B),u),storage:{},global:ge(ge(ge({},C),d),{},{headers:ge(ge({},(t=C==null?void 0:C.headers)!==null&&t!==void 0?t:{}),(r=d==null?void 0:d.headers)!==null&&r!==void 0?r:{})}),tracePropagation:{enabled:(n=(s=E==null?void 0:E.enabled)!==null&&s!==void 0?s:I==null?void 0:I.enabled)!==null&&n!==void 0?n:!1,respectSamplingDecision:(i=(o=E==null?void 0:E.respectSamplingDecision)!==null&&o!==void 0?o:I==null?void 0:I.respectSamplingDecision)!==null&&i!==void 0?i:!0},accessToken:async()=>""};return A.accessToken?Q.accessToken=A.accessToken:delete Q.accessToken,Q}function lR(A){const e=A==null?void 0:A.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(oR(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var cR=class extends Cw{constructor(A){super(A)}},Qw=class{constructor(A,e,t){var r,n;this.supabaseUrl=A,this.supabaseKey=e;const s=lR(A);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const i=`sb-${s.hostname.split(".")[0]}-auth-token`,o={db:MS,realtime:GS,auth:ge(ge({},KS),{},{storageKey:i}),global:VS,tracePropagation:jS},l=aR(t??{},o);if(this.settings=l,this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=sR(e,A,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(ge({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new RF(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new VT(this.storageUrl.href,this.headers,this.fetch,t==null?void 0:t.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new CF(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(A){return this.rest.from(A)}schema(A){return this.rest.schema(A)}rpc(A,e={},t={head:!1,get:!1,count:void 0}){return this.rest.rpc(A,e,t)}channel(A,e={config:{}}){return this.realtime.channel(A,e)}getChannels(){return this.realtime.getChannels()}removeChannel(A){return this.realtime.removeChannel(A)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var A=this,e,t;if(A.accessToken)return await A.accessToken();const{data:r}=await A.auth.getSession();return(e=(t=r.session)===null||t===void 0?void 0:t.access_token)!==null&&e!==void 0?e:A.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:A,persistSession:e,detectSessionInUrl:t,storage:r,userStorage:n,storageKey:s,flowType:i,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:g},p,B){const C={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new cR({url:this.authUrl.href,headers:ge(ge({},C),p),storageKey:s,autoRefreshToken:A,persistSession:e,detectSessionInUrl:t,storage:r,userStorage:n,flowType:i,lock:o,debug:l,throwOnError:c,experimental:u,fetch:B,lockAcquireTimeout:d,skipAutoInitialize:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(E=>E.toLowerCase()==="authorization")})}_initRealtimeClient(A){return new Mp(this.realtimeUrl.href,ge(ge({},A),{},{params:ge(ge({},{apikey:this.supabaseKey}),A==null?void 0:A.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((A,e)=>{this._handleTokenChanged(A,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(A,e,t){(A==="TOKEN_REFRESHED"||A==="SIGNED_IN")&&this.changedAccessToken!==t?(this.changedAccessToken=t,this.realtime.setAuth(t)):A==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const uR=(A,e,t)=>new Qw(A,e,t);function hR(){if(typeof window<"u")return!1;const A=globalThis.process;if(!A)return!1;const e=A.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}hR()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const dR=Object.freeze(Object.defineProperty({__proto__:null,AuthAdminApi:PS,AuthApiError:Yp,AuthClient:Cw,AuthError:$r,AuthImplicitGrantRedirectError:cs,AuthInvalidCredentialsError:ls,AuthInvalidJwtError:us,AuthInvalidTokenResponseError:rr,AuthPKCECodeVerifierMissingError:tw,AuthPKCEGrantCodeExchangeError:Tc,AuthRefreshDiscardedError:Rc,AuthRetryableFetchError:Bo,AuthSessionMissingError:Te,AuthUnknownError:_t,AuthWeakPasswordError:xc,CustomAuthError:St,get FunctionRegion(){return io},FunctionsError:so,FunctionsFetchError:bp,FunctionsHttpError:wc,FunctionsRelayError:pc,GoTrueAdminApi:Hc,GoTrueClient:Xr,NavigatorLockAcquireTimeoutError:Lc,PostgrestError:Bc,REALTIME_CHANNEL_STATES:sT,get REALTIME_LISTEN_TYPES(){return Ar},get REALTIME_POSTGRES_CHANGES_LISTEN_EVENT(){return Ec},get REALTIME_PRESENCE_LISTEN_EVENTS(){return Cc},get REALTIME_SUBSCRIBE_STATES(){return Wt},RealtimeChannel:Kr,RealtimeClient:Mp,RealtimePresence:Np,SIGN_OUT_SCOPES:_o,StorageApiError:po,SupabaseClient:Qw,WebSocketFactory:Rp,createClient:uR,isAuthApiError:Zp,isAuthError:P,isAuthImplicitGrantRedirectError:ew,isAuthPKCECodeVerifierMissingError:qT,isAuthRefreshDiscardedError:Aw,isAuthRetryableFetchError:Sc,isAuthSessionMissingError:as,isAuthWeakPasswordError:JT,lockInternals:kt,navigatorLock:ES,processLock:bS},Symbol.toStringTag,{value:"Module"}));wt.initFeedbackPlugin=qB,Object.defineProperty(wt,Symbol.toStringTag,{value:"Module"})});
|
|
3036
|
+
//# sourceMappingURL=ui-feedback-plugin.umd.js.map
|