@tung-engineering/agent-platform-web-sdk 0.0.59 → 0.0.61

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.
@@ -1,14 +1,4 @@
1
- var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;var Dk=(we,It,un)=>It in we?Ok(we,It,{enumerable:!0,configurable:!0,writable:!0,value:un}):we[It]=un;var ae=(we,It,un)=>Dk(we,typeof It!="symbol"?It+"":It,un);var Oo;const It=`
2
- /* ── Agent Platform SDK — namespaced styles ────────────────────────────── */
3
-
4
- /* Reset Popover API UA defaults so top-layer-promoted elements keep our own
5
- explicit positioning (see top-layer.ts). The popover UA stylesheet sets
6
- "inset: 0" on open popovers; component classes below only set the sides
7
- they actually position (e.g. .ap-sdk-fab sets bottom/right, not top/left),
8
- so an unscoped reset would leave the *other* sides pinned to the UA's 0.
9
- Wrapped in :where() to keep this selector's specificity at zero, so every
10
- component class below (each specificity 10) cleanly overrides whichever
11
- side it declares, while "inset: auto" still clears the rest. */
1
+ var Fk=Object.defineProperty;var Bk=(we,Wt,lr)=>Wt in we?Fk(we,Wt,{enumerable:!0,configurable:!0,writable:!0,value:lr}):we[Wt]=lr;var ae=(we,Wt,lr)=>Bk(we,typeof Wt!="symbol"?Wt+"":Wt,lr);var AgentPlatformWebSdk=(function(we){"use strict";var Do;const Sl=[`
12
2
  :where([data-ap-sdk][popover]) {
13
3
  position: fixed;
14
4
  margin: 0;
@@ -19,8 +9,264 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
19
9
  overflow: visible;
20
10
  inset: auto;
21
11
  }
12
+ `,`
13
+ @keyframes ap-sdk-panel-in {
14
+ from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
15
+ to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
16
+ }
17
+
18
+ /* Capture panel — floating dialog */
19
+ .ap-sdk-panel {
20
+ position: fixed;
21
+ top: 50%;
22
+ right: 24px;
23
+ transform: translateY(-50%);
24
+ width: 340px;
25
+ max-width: calc(100vw - 32px);
26
+ max-height: calc(100vh - 64px);
27
+ overflow-x: hidden;
28
+ overflow-y: auto !important;
29
+ overscroll-behavior: contain;
30
+ background: #ffffff;
31
+ border: 1px solid #e5e7eb;
32
+ border-radius: 12px;
33
+ box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
34
+ z-index: 2147483647;
35
+ font-family: system-ui, -apple-system, sans-serif;
36
+ font-size: 14px;
37
+ color: #111827;
38
+ pointer-events: all !important;
39
+ animation: ap-sdk-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
40
+ }
41
+
42
+ .ap-sdk-panel__header {
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: space-between;
46
+ padding: 14px 16px 10px;
47
+ border-bottom: 1px solid #f3f4f6;
48
+ }
49
+
50
+ .ap-sdk-panel__title {
51
+ font-size: 14px;
52
+ font-weight: 600;
53
+ color: #111827;
54
+ display: flex;
55
+ align-items: center;
56
+ gap: 6px;
57
+ }
58
+
59
+ .ap-sdk-panel__logo {
60
+ width: 18px;
61
+ height: 18px;
62
+ background: oklch(58% 0.13 42);
63
+ border-radius: 4px;
64
+ display: inline-flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ color: #fff;
68
+ font-size: 10px;
69
+ font-weight: 700;
70
+ flex-shrink: 0;
71
+ }
72
+
73
+ .ap-sdk-panel__close {
74
+ background: none;
75
+ border: none;
76
+ padding: 4px;
77
+ cursor: pointer;
78
+ color: oklch(58% 0.13 42);
79
+ font-size: 18px;
80
+ line-height: 1;
81
+ border-radius: 4px;
82
+ transition: color 0.15s, background 0.15s;
83
+ }
84
+
85
+ .ap-sdk-panel__close:hover {
86
+ color: oklch(47% 0.13 40);
87
+ background: oklch(95% 0.035 50);
88
+ }
89
+
90
+ .ap-sdk-panel__header-actions {
91
+ display: flex;
92
+ align-items: center;
93
+ gap: 2px;
94
+ }
95
+
96
+ .ap-sdk-panel__config {
97
+ background: none;
98
+ border: none;
99
+ padding: 4px;
100
+ cursor: pointer;
101
+ color: oklch(58% 0.13 42);
102
+ font-size: 14px;
103
+ line-height: 1;
104
+ border-radius: 4px;
105
+ transition: color 0.15s, background 0.15s;
106
+ }
107
+
108
+ .ap-sdk-panel__config:hover {
109
+ color: oklch(47% 0.13 40);
110
+ background: oklch(95% 0.035 50);
111
+ }
112
+
113
+ .ap-sdk-panel__body {
114
+ padding: 14px 16px;
115
+ display: flex;
116
+ flex-direction: column;
117
+ gap: 12px;
118
+ }
119
+
120
+ .ap-sdk-panel__field {
121
+ display: flex;
122
+ flex-direction: column;
123
+ gap: 4px;
124
+ }
125
+
126
+ .ap-sdk-panel__label {
127
+ font-size: 12px;
128
+ font-weight: 500;
129
+ color: oklch(38% 0.13 40);
130
+ }
131
+
132
+ .ap-sdk-panel__input,
133
+ .ap-sdk-panel__textarea {
134
+ width: 100%;
135
+ box-sizing: border-box;
136
+ border: 1px solid oklch(58% 0.13 42);
137
+ border-radius: 8px;
138
+ padding: 7px 10px;
139
+ font-size: 13px;
140
+ font-family: inherit;
141
+ color: #111827;
142
+ background: #fff;
143
+ outline: none;
144
+ transition: border-color 0.15s, box-shadow 0.15s;
145
+ resize: none;
146
+ }
147
+
148
+ .ap-sdk-panel__input:focus,
149
+ .ap-sdk-panel__textarea:focus {
150
+ border-color: oklch(58% 0.13 42);
151
+ box-shadow: 0 0 0 3px oklch(58% 0.13 42 / 0.12);
152
+ }
153
+
154
+ .ap-sdk-panel__textarea {
155
+ min-height: 72px;
156
+ }
157
+
158
+ .ap-sdk-panel__toggle {
159
+ display: flex;
160
+ border: 1px solid oklch(58% 0.13 42);
161
+ border-radius: 8px;
162
+ overflow: hidden;
163
+ background: rgba(255, 255, 255, 0.92);
164
+ padding: 2px;
165
+ gap: 2px;
166
+ }
167
+
168
+ .ap-sdk-panel__toggle-btn {
169
+ flex: 1;
170
+ padding: 6px 10px;
171
+ background: transparent;
172
+ border: none;
173
+ cursor: pointer;
174
+ font-size: 12px;
175
+ font-weight: 500;
176
+ color: oklch(58% 0.13 42);
177
+ font-family: inherit;
178
+ border-radius: 6px;
179
+ transition: background 0.15s, color 0.15s, box-shadow 0.15s;
180
+ }
181
+
182
+ .ap-sdk-panel__toggle-btn:not(:last-child) {
183
+ border-right: none;
184
+ }
185
+
186
+ .ap-sdk-panel__toggle-btn.ap-sdk-active {
187
+ background: #fff;
188
+ color: oklch(38% 0.13 40);
189
+ box-shadow: inset 0 0 0 2px oklch(58% 0.13 42);
190
+ font-weight: 600;
191
+ }
192
+
193
+ .ap-sdk-panel__footer {
194
+ display: flex;
195
+ gap: 8px;
196
+ padding: 12px 16px 14px;
197
+ border-top: 1px solid #f3f4f6;
198
+ }
199
+
200
+ .ap-sdk-panel__btn {
201
+ flex: 1;
202
+ padding: 8px 14px;
203
+ border-radius: 8px;
204
+ font-size: 13px;
205
+ font-weight: 500;
206
+ font-family: inherit;
207
+ cursor: pointer;
208
+ border: none;
209
+ transition: background 0.15s, opacity 0.15s;
210
+ }
211
+
212
+ .ap-sdk-panel__btn--primary {
213
+ background: oklch(58% 0.13 42);
214
+ color: #fff;
215
+ }
216
+
217
+ .ap-sdk-panel__btn--primary:hover:not(:disabled) {
218
+ background: oklch(47% 0.13 40);
219
+ }
220
+
221
+ .ap-sdk-panel__btn--secondary {
222
+ background: #f3f4f6;
223
+ color: #374151;
224
+ flex: 0 0 auto;
225
+ padding: 8px 16px;
226
+ }
227
+
228
+ .ap-sdk-panel__btn--secondary:hover:not(:disabled) {
229
+ background: #e5e7eb;
230
+ }
231
+
232
+ .ap-sdk-panel__btn--ghost {
233
+ background: transparent;
234
+ color: oklch(47% 0.13 40);
235
+ border: 1px solid oklch(58% 0.13 42);
236
+ flex: 0 0 auto;
237
+ padding: 8px 16px;
238
+ }
239
+
240
+ .ap-sdk-panel__btn--ghost:hover:not(:disabled) {
241
+ border-color: oklch(58% 0.13 42);
242
+ color: oklch(58% 0.13 42);
243
+ background: oklch(95% 0.035 50);
244
+ }
245
+
246
+ .ap-sdk-panel__btn:disabled {
247
+ opacity: 0.55;
248
+ cursor: not-allowed;
249
+ }
250
+
251
+ .ap-sdk-panel__status {
252
+ padding: 10px 16px;
253
+ font-size: 13px;
254
+ border-radius: 6px;
255
+ margin: 0 16px 12px;
256
+ }
257
+
258
+ .ap-sdk-panel__status--success {
259
+ background: #d1fae5;
260
+ color: #065f46;
261
+ border: 1px solid #a7f3d0;
262
+ }
22
263
 
23
- /* Picker highlight overlay that tracks the hovered element */
264
+ .ap-sdk-panel__status--error {
265
+ background: #fee2e2;
266
+ color: #991b1b;
267
+ border: 1px solid #fca5a5;
268
+ }
269
+ `,`
24
270
  .ap-sdk-highlight {
25
271
  position: fixed;
26
272
  pointer-events: none;
@@ -31,8 +277,7 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
31
277
  z-index: 2147483645;
32
278
  transition: top 60ms ease, left 60ms ease, width 60ms ease, height 60ms ease;
33
279
  }
34
-
35
- /* Cursor indicator shown during picker mode */
280
+ `,`
36
281
  .ap-sdk-picker-cursor {
37
282
  position: fixed;
38
283
  bottom: 16px;
@@ -106,8 +351,7 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
106
351
  background: rgba(255, 255, 255, 0.12);
107
352
  opacity: 1;
108
353
  }
109
-
110
- /* Floating bar shown while recorder.ts is capturing a workflow */
354
+ `,`
111
355
  .ap-sdk-recorder-bar {
112
356
  position: fixed;
113
357
  bottom: 16px;
@@ -161,107 +405,7 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
161
405
  .ap-sdk-recorder-bar__btn--stop:hover {
162
406
  background: oklch(95% 0.035 50);
163
407
  }
164
-
165
- @keyframes ap-sdk-panel-in {
166
- from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
167
- to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
168
- }
169
-
170
- /* Capture panel — floating dialog */
171
- .ap-sdk-panel {
172
- position: fixed;
173
- top: 50%;
174
- right: 24px;
175
- transform: translateY(-50%);
176
- width: 340px;
177
- max-width: calc(100vw - 32px);
178
- max-height: calc(100vh - 64px);
179
- overflow-x: hidden;
180
- overflow-y: auto !important;
181
- overscroll-behavior: contain;
182
- background: #ffffff;
183
- border: 1px solid #e5e7eb;
184
- border-radius: 12px;
185
- box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
186
- z-index: 2147483647;
187
- font-family: system-ui, -apple-system, sans-serif;
188
- font-size: 14px;
189
- color: #111827;
190
- pointer-events: all !important;
191
- animation: ap-sdk-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
192
- }
193
-
194
- .ap-sdk-panel__header {
195
- display: flex;
196
- align-items: center;
197
- justify-content: space-between;
198
- padding: 14px 16px 10px;
199
- border-bottom: 1px solid #f3f4f6;
200
- }
201
-
202
- .ap-sdk-panel__title {
203
- font-size: 14px;
204
- font-weight: 600;
205
- color: #111827;
206
- display: flex;
207
- align-items: center;
208
- gap: 6px;
209
- }
210
-
211
- .ap-sdk-panel__logo {
212
- width: 18px;
213
- height: 18px;
214
- background: oklch(58% 0.13 42);
215
- border-radius: 4px;
216
- display: inline-flex;
217
- align-items: center;
218
- justify-content: center;
219
- color: #fff;
220
- font-size: 10px;
221
- font-weight: 700;
222
- flex-shrink: 0;
223
- }
224
-
225
- .ap-sdk-panel__close {
226
- background: none;
227
- border: none;
228
- padding: 4px;
229
- cursor: pointer;
230
- color: oklch(58% 0.13 42);
231
- font-size: 18px;
232
- line-height: 1;
233
- border-radius: 4px;
234
- transition: color 0.15s, background 0.15s;
235
- }
236
-
237
- .ap-sdk-panel__close:hover {
238
- color: oklch(47% 0.13 40);
239
- background: oklch(95% 0.035 50);
240
- }
241
-
242
- .ap-sdk-panel__header-actions {
243
- display: flex;
244
- align-items: center;
245
- gap: 2px;
246
- }
247
-
248
- .ap-sdk-panel__config {
249
- background: none;
250
- border: none;
251
- padding: 4px;
252
- cursor: pointer;
253
- color: oklch(58% 0.13 42);
254
- font-size: 14px;
255
- line-height: 1;
256
- border-radius: 4px;
257
- transition: color 0.15s, background 0.15s;
258
- }
259
-
260
- .ap-sdk-panel__config:hover {
261
- color: oklch(47% 0.13 40);
262
- background: oklch(95% 0.035 50);
263
- }
264
-
408
+ `,`
265
409
  .ap-sdk-panel__context {
266
410
  padding: 10px 16px;
267
411
  background: #f9fafb;
@@ -340,194 +484,158 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
340
484
  white-space: nowrap;
341
485
  }
342
486
 
343
- .ap-sdk-panel__body {
344
- padding: 14px 16px;
345
- display: flex;
346
- flex-direction: column;
347
- gap: 12px;
348
- }
349
-
350
- .ap-sdk-panel__field {
487
+ .ap-sdk-credentials-section {
488
+ padding: 0 16px 12px;
489
+ border-bottom: 1px solid #f3f4f6;
351
490
  display: flex;
352
491
  flex-direction: column;
353
- gap: 4px;
492
+ gap: 10px;
354
493
  }
355
494
 
356
- .ap-sdk-panel__label {
495
+ .ap-sdk-credentials-heading {
357
496
  font-size: 12px;
358
497
  font-weight: 500;
359
- color: oklch(38% 0.13 40);
360
- }
361
-
362
- .ap-sdk-panel__input,
363
- .ap-sdk-panel__textarea {
364
- width: 100%;
365
- box-sizing: border-box;
366
- border: 1px solid oklch(58% 0.13 42);
367
- border-radius: 8px;
368
- padding: 7px 10px;
369
- font-size: 13px;
370
- font-family: inherit;
371
- color: #111827;
372
- background: #fff;
373
- outline: none;
374
- transition: border-color 0.15s, box-shadow 0.15s;
375
- resize: none;
376
- }
377
-
378
- .ap-sdk-panel__input:focus,
379
- .ap-sdk-panel__textarea:focus {
380
- border-color: oklch(58% 0.13 42);
381
- box-shadow: 0 0 0 3px oklch(58% 0.13 42 / 0.12);
382
- }
383
-
384
- .ap-sdk-panel__textarea {
385
- min-height: 72px;
386
- }
387
-
388
- .ap-sdk-panel__toggle {
389
- display: flex;
390
- border: 1px solid oklch(58% 0.13 42);
391
- border-radius: 8px;
392
- overflow: hidden;
393
- background: rgba(255, 255, 255, 0.92);
394
- padding: 2px;
395
- gap: 2px;
498
+ color: oklch(47% 0.13 40);
499
+ margin: 0;
500
+ padding-top: 12px;
396
501
  }
397
502
 
398
- .ap-sdk-panel__toggle-btn {
399
- flex: 1;
400
- padding: 6px 10px;
401
- background: transparent;
402
- border: none;
403
- cursor: pointer;
503
+ /* Config panel hint text */
504
+ .ap-sdk-config-hint {
404
505
  font-size: 12px;
405
- font-weight: 500;
406
- color: oklch(58% 0.13 42);
407
- font-family: inherit;
408
- border-radius: 6px;
409
- transition: background 0.15s, color 0.15s, box-shadow 0.15s;
410
- }
411
-
412
- .ap-sdk-panel__toggle-btn:not(:last-child) {
413
- border-right: none;
506
+ color: oklch(47% 0.13 40);
507
+ margin: 0;
508
+ line-height: 1.5;
414
509
  }
415
510
 
416
- .ap-sdk-panel__toggle-btn.ap-sdk-active {
417
- background: #fff;
511
+ .ap-sdk-config-hint strong {
418
512
  color: oklch(38% 0.13 40);
419
- box-shadow: inset 0 0 0 2px oklch(58% 0.13 42);
420
- font-weight: 600;
421
513
  }
422
514
 
423
- .ap-sdk-panel__footer {
424
- display: flex;
425
- gap: 8px;
426
- padding: 12px 16px 14px;
427
- border-top: 1px solid #f3f4f6;
428
- }
515
+ /* ── Success state ──────────────────────────────────────────────────────── */
429
516
 
430
- .ap-sdk-panel__btn {
431
- flex: 1;
432
- padding: 8px 14px;
433
- border-radius: 8px;
434
- font-size: 13px;
435
- font-weight: 500;
436
- font-family: inherit;
437
- cursor: pointer;
438
- border: none;
439
- transition: background 0.15s, opacity 0.15s;
517
+ .ap-sdk-panel--success .ap-sdk-pick-list,
518
+ .ap-sdk-panel--success .ap-sdk-credentials-section,
519
+ .ap-sdk-panel--success .ap-sdk-panel__body,
520
+ .ap-sdk-panel--success .ap-sdk-panel__footer {
521
+ display: none !important;
440
522
  }
441
523
 
442
- .ap-sdk-panel__btn--primary {
443
- background: oklch(58% 0.13 42);
444
- color: #fff;
445
- }
524
+ /* ── Multi-pick list ─────────────────────────────────────────────────────── */
446
525
 
447
- .ap-sdk-panel__btn--primary:hover:not(:disabled) {
448
- background: oklch(47% 0.13 40);
526
+ .ap-sdk-pick-list {
527
+ border-bottom: 1px solid #f3f4f6;
528
+ max-height: 220px;
529
+ overflow-y: auto;
530
+ overscroll-behavior: contain;
449
531
  }
450
532
 
451
- .ap-sdk-panel__btn--secondary {
452
- background: #f3f4f6;
453
- color: #374151;
454
- flex: 0 0 auto;
533
+ .ap-sdk-pick-entry {
455
534
  padding: 8px 16px;
535
+ border-bottom: 1px solid #f3f4f6;
536
+ font-size: 12px;
456
537
  }
457
538
 
458
- .ap-sdk-panel__btn--secondary:hover:not(:disabled) {
459
- background: #e5e7eb;
460
- }
461
-
462
- .ap-sdk-panel__btn--ghost {
463
- background: transparent;
464
- color: oklch(47% 0.13 40);
465
- border: 1px solid oklch(58% 0.13 42);
466
- flex: 0 0 auto;
467
- padding: 8px 16px;
539
+ .ap-sdk-pick-entry:last-child {
540
+ border-bottom: none;
468
541
  }
469
542
 
470
- .ap-sdk-panel__btn--ghost:hover:not(:disabled) {
471
- border-color: oklch(58% 0.13 42);
472
- color: oklch(58% 0.13 42);
473
- background: oklch(95% 0.035 50);
543
+ .ap-sdk-pick-entry__header {
544
+ display: flex;
545
+ align-items: center;
546
+ gap: 6px;
547
+ margin-bottom: 3px;
474
548
  }
475
549
 
476
- .ap-sdk-panel__btn:disabled {
477
- opacity: 0.55;
478
- cursor: not-allowed;
550
+ .ap-sdk-pick-entry__number {
551
+ display: inline-flex;
552
+ align-items: center;
553
+ justify-content: center;
554
+ width: 18px;
555
+ height: 18px;
556
+ background: oklch(58% 0.13 42);
557
+ color: #fff;
558
+ border-radius: 999px;
559
+ font-size: 10px;
560
+ font-weight: 700;
561
+ flex-shrink: 0;
479
562
  }
480
563
 
481
- .ap-sdk-panel__status {
482
- padding: 10px 16px;
483
- font-size: 13px;
484
- border-radius: 6px;
485
- margin: 0 16px 12px;
564
+ .ap-sdk-pick-entry__element {
565
+ flex: 1;
566
+ font-family: ui-monospace, SFMono-Regular, monospace;
567
+ font-size: 11px;
568
+ color: #374151;
569
+ overflow: hidden;
570
+ text-overflow: ellipsis;
571
+ white-space: nowrap;
486
572
  }
487
573
 
488
- .ap-sdk-panel__status--success {
489
- background: #d1fae5;
490
- color: #065f46;
491
- border: 1px solid #a7f3d0;
574
+ .ap-sdk-pick-entry__remove {
575
+ background: none;
576
+ border: none;
577
+ cursor: pointer;
578
+ color: oklch(58% 0.13 42);
579
+ font-size: 16px;
580
+ line-height: 1;
581
+ padding: 0 2px;
582
+ border-radius: 3px;
583
+ flex-shrink: 0;
584
+ transition: color 0.1s, background 0.1s;
492
585
  }
493
586
 
494
- .ap-sdk-panel__status--error {
587
+ .ap-sdk-pick-entry__remove:hover {
588
+ color: #ef4444;
495
589
  background: #fee2e2;
496
- color: #991b1b;
497
- border: 1px solid #fca5a5;
498
590
  }
499
591
 
500
- .ap-sdk-credentials-section {
501
- padding: 0 16px 12px;
502
- border-bottom: 1px solid #f3f4f6;
503
- display: flex;
504
- flex-direction: column;
505
- gap: 10px;
592
+ .ap-sdk-pick-entry__instruction {
593
+ color: oklch(47% 0.13 40);
594
+ font-size: 11px;
595
+ padding-left: 24px;
596
+ white-space: pre-wrap;
597
+ word-break: break-word;
598
+ max-height: 48px;
599
+ overflow: hidden;
600
+ text-overflow: ellipsis;
601
+ display: -webkit-box;
602
+ -webkit-line-clamp: 2;
603
+ -webkit-box-orient: vertical;
506
604
  }
507
605
 
508
- .ap-sdk-credentials-heading {
606
+ /* "Add another" button */
607
+ .ap-sdk-panel__btn--add-another {
608
+ width: 100%;
609
+ padding: 6px 12px;
610
+ border: 1px dashed oklch(58% 0.13 42);
611
+ border-radius: 8px;
612
+ background: none;
613
+ color: oklch(47% 0.13 40);
509
614
  font-size: 12px;
510
615
  font-weight: 500;
511
- color: oklch(47% 0.13 40);
512
- margin: 0;
513
- padding-top: 12px;
616
+ font-family: inherit;
617
+ cursor: pointer;
618
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
514
619
  }
515
620
 
516
- /* Config panel hint text */
517
- .ap-sdk-config-hint {
518
- font-size: 12px;
519
- color: oklch(47% 0.13 40);
520
- margin: 0;
521
- line-height: 1.5;
621
+ .ap-sdk-panel__btn--add-another:not(:disabled):hover {
622
+ border-color: oklch(58% 0.13 42);
623
+ color: oklch(58% 0.13 42);
624
+ background: oklch(95% 0.035 50);
522
625
  }
523
626
 
524
- .ap-sdk-config-hint strong {
525
- color: oklch(38% 0.13 40);
627
+ .ap-sdk-panel__btn--add-another:disabled {
628
+ opacity: 0.45;
629
+ cursor: not-allowed;
526
630
  }
527
631
 
528
-
529
- /* ── FAB — speed dial ────────────────────────────────────────────────────── */
530
-
632
+ /* Awaiting-pick indicator in context section */
633
+ .ap-sdk-awaiting-pick {
634
+ color: oklch(58% 0.13 42);
635
+ font-style: italic;
636
+ white-space: normal;
637
+ }
638
+ `,`
531
639
  .ap-sdk-fab {
532
640
  position: fixed;
533
641
  bottom: 20px;
@@ -657,18 +765,7 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
657
765
  line-height: 1;
658
766
  pointer-events: none;
659
767
  }
660
-
661
- /* ── Success state ──────────────────────────────────────────────────────── */
662
-
663
- .ap-sdk-panel--success .ap-sdk-pick-list,
664
- .ap-sdk-panel--success .ap-sdk-credentials-section,
665
- .ap-sdk-panel--success .ap-sdk-panel__body,
666
- .ap-sdk-panel--success .ap-sdk-panel__footer {
667
- display: none !important;
668
- }
669
-
670
- /* ── Advanced options collapsible ───────────────────────────────────────── */
671
-
768
+ `,`
672
769
  .ap-sdk-advanced {
673
770
  border-top: 1px solid #f3f4f6;
674
771
  padding-top: 8px;
@@ -724,9 +821,7 @@ var AgentPlatformWebSdk=function(we){"use strict";var Ok=Object.defineProperty;v
724
821
  color: #9ca3af;
725
822
  margin-top: 2px;
726
823
  }
727
-
728
- /* ── List panel ─────────────────────────────────────────────────────────── */
729
-
824
+ `,`
730
825
  .ap-sdk-list-body {
731
826
  padding: 8px 0;
732
827
  max-height: 320px;
@@ -851,91 +946,7 @@ button.ap-sdk-list-item__link {
851
946
  .ap-sdk-status-link:hover {
852
947
  color: oklch(47% 0.13 40);
853
948
  }
854
-
855
- /* ── Multi-pick list ─────────────────────────────────────────────────────── */
856
-
857
- .ap-sdk-pick-list {
858
- border-bottom: 1px solid #f3f4f6;
859
- max-height: 220px;
860
- overflow-y: auto;
861
- overscroll-behavior: contain;
862
- }
863
-
864
- .ap-sdk-pick-entry {
865
- padding: 8px 16px;
866
- border-bottom: 1px solid #f3f4f6;
867
- font-size: 12px;
868
- }
869
-
870
- .ap-sdk-pick-entry:last-child {
871
- border-bottom: none;
872
- }
873
-
874
- .ap-sdk-pick-entry__header {
875
- display: flex;
876
- align-items: center;
877
- gap: 6px;
878
- margin-bottom: 3px;
879
- }
880
-
881
- .ap-sdk-pick-entry__number {
882
- display: inline-flex;
883
- align-items: center;
884
- justify-content: center;
885
- width: 18px;
886
- height: 18px;
887
- background: oklch(58% 0.13 42);
888
- color: #fff;
889
- border-radius: 999px;
890
- font-size: 10px;
891
- font-weight: 700;
892
- flex-shrink: 0;
893
- }
894
-
895
- .ap-sdk-pick-entry__element {
896
- flex: 1;
897
- font-family: ui-monospace, SFMono-Regular, monospace;
898
- font-size: 11px;
899
- color: #374151;
900
- overflow: hidden;
901
- text-overflow: ellipsis;
902
- white-space: nowrap;
903
- }
904
-
905
- .ap-sdk-pick-entry__remove {
906
- background: none;
907
- border: none;
908
- cursor: pointer;
909
- color: oklch(58% 0.13 42);
910
- font-size: 16px;
911
- line-height: 1;
912
- padding: 0 2px;
913
- border-radius: 3px;
914
- flex-shrink: 0;
915
- transition: color 0.1s, background 0.1s;
916
- }
917
-
918
- .ap-sdk-pick-entry__remove:hover {
919
- color: #ef4444;
920
- background: #fee2e2;
921
- }
922
-
923
- .ap-sdk-pick-entry__instruction {
924
- color: oklch(47% 0.13 40);
925
- font-size: 11px;
926
- padding-left: 24px;
927
- white-space: pre-wrap;
928
- word-break: break-word;
929
- max-height: 48px;
930
- overflow: hidden;
931
- text-overflow: ellipsis;
932
- display: -webkit-box;
933
- -webkit-line-clamp: 2;
934
- -webkit-box-orient: vertical;
935
- }
936
-
937
- /* ── Record review list ─────────────────────────────────────────────────── */
938
-
949
+ `,`
939
950
  .ap-sdk-record-review__list {
940
951
  max-height: 320px;
941
952
  overflow-y: auto;
@@ -996,42 +1007,7 @@ button.ap-sdk-list-item__link {
996
1007
  color: #ef4444;
997
1008
  background: #fee2e2;
998
1009
  }
999
-
1000
- /* "Add another" button */
1001
- .ap-sdk-panel__btn--add-another {
1002
- width: 100%;
1003
- padding: 6px 12px;
1004
- border: 1px dashed oklch(58% 0.13 42);
1005
- border-radius: 8px;
1006
- background: none;
1007
- color: oklch(47% 0.13 40);
1008
- font-size: 12px;
1009
- font-weight: 500;
1010
- font-family: inherit;
1011
- cursor: pointer;
1012
- transition: border-color 0.15s, color 0.15s, background 0.15s;
1013
- }
1014
-
1015
- .ap-sdk-panel__btn--add-another:not(:disabled):hover {
1016
- border-color: oklch(58% 0.13 42);
1017
- color: oklch(58% 0.13 42);
1018
- background: oklch(95% 0.035 50);
1019
- }
1020
-
1021
- .ap-sdk-panel__btn--add-another:disabled {
1022
- opacity: 0.45;
1023
- cursor: not-allowed;
1024
- }
1025
-
1026
- /* Awaiting-pick indicator in context section */
1027
- .ap-sdk-awaiting-pick {
1028
- color: oklch(58% 0.13 42);
1029
- font-style: italic;
1030
- white-space: normal;
1031
- }
1032
-
1033
- /* ── Success card ───────────────────────────────────────────────────────── */
1034
-
1010
+ `,`
1035
1011
  @keyframes ap-sdk-card-in {
1036
1012
  from { opacity: 0; transform: scale(0.97); }
1037
1013
  to { opacity: 1; transform: scale(1); }
@@ -1110,7 +1086,7 @@ button.ap-sdk-list-item__link {
1110
1086
  flex: 1;
1111
1087
  white-space: nowrap;
1112
1088
  }
1113
-
1089
+ `,`
1114
1090
  .ap-sdk-runner__approval {
1115
1091
  margin-top: 10px;
1116
1092
  display: flex;
@@ -1136,8 +1112,6 @@ button.ap-sdk-list-item__link {
1136
1112
  font-size: 12px;
1137
1113
  }
1138
1114
 
1139
- /* ── Automation runner ──────────────────────────────────────────────────── */
1140
-
1141
1115
  .ap-sdk-runner__meta {
1142
1116
  display: flex;
1143
1117
  flex-direction: column;
@@ -1318,9 +1292,7 @@ button.ap-sdk-list-item__link {
1318
1292
  font-style: italic;
1319
1293
  padding: 4px 0;
1320
1294
  }
1321
-
1322
- /* ── Resize handle (shared by all three floating dialogs) ──────────────── */
1323
-
1295
+ `,`
1324
1296
  .ap-sdk-resize-handle {
1325
1297
  position: absolute;
1326
1298
  bottom: 2px;
@@ -1342,11 +1314,12 @@ button.ap-sdk-list-item__link {
1342
1314
  border-right: 2px solid #d1d5db;
1343
1315
  border-bottom: 2px solid #d1d5db;
1344
1316
  }
1345
- `;let un=!1;function cr(){if(un)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=It,document.head.appendChild(e),un=!0}function Fr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const s=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(s.length>1){const a=s.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Br(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const kl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Gr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],s=new Set,a=u=>{if(s.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;s.add(u);const h=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${h}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&a(u.name);for(const u of kl)a(u);return`${t}${n}${r}${o.join("")}`}function _l(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function vl(e,t=5,n=10){function r(o,s){const a=Gr(o),u=" ".repeat(s),d=Array.from(o.children).slice(0,n);if(s>=t||d.length===0){const h=_l(o);return h?`${u}${a} "${h}"`:`${u}${a}`}return[`${u}${a}`,...d.map(h=>r(h,s+1))].join(`
1346
- `)}return r(e,0)}const yl='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',wl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Wr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"":n}function xl(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(yl);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function Sl(e,t=80){var a,u,d;const n=wl[e.tagName.toLowerCase()];if(n){const h=(u=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:u.trim();if(h)return Wr(h,t)}const r=xl(e);if(r)return Wr(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return Wr(o,t);const s=e.getAttribute("aria-labelledby");if(s){const h=s.split(/\s+/).map(p=>{var b,m;return((m=(b=document.getElementById(p))==null?void 0:b.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(h)return Wr(h,t)}return""}function Tl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const s=o===e?"":Sl(o),a=s&&!r.has(s)?`${Gr(o)} ["${s}"]`:Gr(o);s&&r.add(s),n.unshift(a),o=o.parentElement}return n.join(" > ")||Gr(e)}function us(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function lr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function ds(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>lr('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>lr('meta[property="og:title"]')),ogDescription:e(()=>lr('meta[property="og:description"]')),ogType:e(()=>lr('meta[property="og:type"]')),ogSiteName:e(()=>lr('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?us(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function El(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function Al(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const s=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((s==null?void 0:s.textContent)||"").trim(),u=o.tagName.toLowerCase();r=a?`${u}: ${us(a,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Cl(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1347
- `)}const zn=new Set;let In=null,Jr=!1,Qo=!1;function Pl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Rl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(zn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Pl(r))return!0}return!1}function ps(){const e=Rl(),t=e&&!Qo;Qo=e;for(const n of zn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function hs(e){if(!(e instanceof Node))return!1;for(const t of zn)if(t===e||t.contains(e))return!0;return!1}function $n(e){(hs(e.target)||"relatedTarget"in e&&hs(e.relatedTarget))&&e.stopPropagation()}function Ll(){Jr||(window.addEventListener("focusin",$n,!0),window.addEventListener("focusout",$n,!0),window.addEventListener("pointerdown",$n,!0),Jr=!0),!In&&(In=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&ps()}),In.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function $t(e){"showPopover"in e&&(e.setAttribute("popover","manual"),zn.add(e),Ll(),ps())}function Nt(e){if(zn.delete(e),zn.size===0&&(In&&(In.disconnect(),In=null),Jr&&(window.removeEventListener("focusin",$n,!0),window.removeEventListener("focusout",$n,!0),window.removeEventListener("pointerdown",$n,!0),Jr=!1),Qo=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function ei(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),$t(t),{el:t,update:s=>{const a=s.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Nt(t),t.remove()}}}const fs=/^cc-|current-password|new-password/i,zl=/token|secret|password|apikey|auth/i,ti="[redacted]";function Il(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&fs.test(t)}function gs(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ti);const r=n.getAttribute("autocomplete");r&&fs.test(r)&&n.setAttribute("value",ti);for(const o of Array.from(n.attributes))zl.test(o.name)&&n.setAttribute(o.name,ti)}}const $l="🎯 Click any element to capture";let Wt=null,Ae=null,Ne=null;function ur(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function Nl(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function ms(e){Wt==null||Wt.update(e)}function bs(e){const t=ds(),n=El(e),r=Al(e);let o;try{const s=e.cloneNode(!0);gs(s),o=s.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Br(e),cssSelector:Fr(e),innerTree:vl(e),outerTree:Tl(e),elementOuterHtml:o,ancestry:n,...r,...t}}function ni(e,t){Ne&&Ne();const n=Nl();Wt=ei(),Ae=document.createElement("div"),Ae.className="ap-sdk-picker-cursor",Ae.setAttribute("data-ap-sdk","1"),Ae.textContent=n?"Tap any element to preview":$l,document.body.appendChild(Ae),$t(Ae);let r=null,o=null;const s=p=>{Ne==null||Ne(),e(bs(p),p)},a=p=>{if(o=p,ms(p),!Ae)return;Ae.classList.add("ap-sdk-picker-cursor--confirm"),Ae.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${p.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),Ne==null||Ne(),t()});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn",_.textContent="⬆ Parent",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const w=document.createElement("button");w.type="button",w.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",w.textContent="✓ Select",w.setAttribute("data-ap-sdk","1"),w.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o&&s(o)}),Ae.appendChild(b),Ae.appendChild(m),Ae.appendChild(_),Ae.appendChild(w)},u=p=>{ur(p.target)||(r=p.target,ms(r))},d=p=>{if(ur(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const b=p.target??r;if(b){if(n){a(b);return}s(b)}},h=p=>{p.key==="Escape"&&(Ne==null||Ne(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),Ne=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),Ae&&Nt(Ae),Ae==null||Ae.remove(),Wt==null||Wt.destroy(),Wt=null,Ae=null,o=null,Ne=null}}function ri(){Ne==null||Ne()}function Nn(){return Ne!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const h=a.prototype,p=Object.keys(h);for(let b=0;b<p.length;b++){const m=p[b];m in u||(u[m]=h[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(u){var d;const h=n!=null&&n.Parent?new s:this;r(h,u),(d=h._zod).deferred??(d.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class On extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ks extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const _s={};function Jt(e){return _s}function vs(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function oi(e,t){return typeof t=="bigint"?t.toString():t}function Xr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ii(e){return e==null}function si(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ol(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,a=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return a%u/10**s}const ys=Symbol("evaluating");function Y(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ys)return r===void 0&&(r=ys,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ws(e){return JSON.stringify(e)}function Dl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const xs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ml=Xr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Dn(e){if(dr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ss(e){return Dn(e)?{...e}:Array.isArray(e)?[...e]:e}const Ul=new Set(["string","number","symbol"]);function Mn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function N(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function jl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Zl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ql(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Xt(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return dn(this,"shape",a),a},checks:[]});return Vt(e,s)}function Hl(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Xt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return dn(this,"shape",a),a},checks:[]});return Vt(e,s)}function Fl(e,t){if(!Dn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Xt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return dn(this,"shape",s),s}});return Vt(e,o)}function Bl(e,t){if(!Dn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return dn(this,"shape",r),r}});return Vt(e,n)}function Gl(e,t){const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return dn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Vt(e,n)}function Wl(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Xt(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const h in n){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(d[h]=e?new e({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)d[h]=e?new e({type:"optional",innerType:u[h]}):u[h];return dn(this,"shape",d),d},checks:[]});return Vt(t,a)}function Jl(e,t,n){const r=Xt(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return dn(this,"shape",s),s}});return Vt(t,r)}function Un(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function jn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Vr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Yt(e,t,n){var o,s,a,u,d,h;const r={...e,path:e.path??[]};if(!e.message){const p=Vr((a=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??Vr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Vr((d=n.customError)==null?void 0:d.call(n,e))??Vr((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function ai(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ts=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Es=v("$ZodError",Ts),As=v("$ZodError",Ts,{Parent:Error});function Xl(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Vl(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let a=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(s))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const ci=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new On;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Yt(d,s,Jt())));throw xs(u,o==null?void 0:o.callee),u}return a.value},li=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Yt(d,s,Jt())));throw xs(u,o==null?void 0:o.callee),u}return a.value},Yr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new On;return s.issues.length?{success:!1,error:new(e??Es)(s.issues.map(a=>Yt(a,o,Jt())))}:{success:!0,data:s.value}},Yl=Yr(As),Kr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>Yt(a,o,Jt())))}:{success:!0,data:s.value}},Kl=Kr(As),Ql=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ci(e)(t,n,o)},eu=e=>(t,n,r)=>ci(e)(t,n,r),tu=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return li(e)(t,n,o)},nu=e=>async(t,n,r)=>li(e)(t,n,r),ru=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yr(e)(t,n,o)},ou=e=>(t,n,r)=>Yr(e)(t,n,r),iu=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Kr(e)(t,n,o)},su=e=>async(t,n,r)=>Kr(e)(t,n,r),au=/^[cC][^\s-]{8,}$/,cu=/^[0-9a-z]+$/,lu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uu=/^[0-9a-vA-V]{20}$/,du=/^[A-Za-z0-9]{27}$/,pu=/^[a-zA-Z0-9_-]{21}$/,hu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Cs=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function bu(){return new RegExp(mu,"u")}const ku=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_u=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ps=/^[A-Za-z0-9_-]*$/,xu=/^\+[1-9]\d{6,14}$/,Rs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Su=new RegExp(`^${Rs}$`);function Ls(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tu(e){return new RegExp(`^${Ls(e)}$`)}function Eu(e){const t=Ls({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Rs}T(?:${r})$`)}const Au=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Cu=/^-?\d+$/,zs=/^-?\d+(?:\.\d+)?$/,Pu=/^(?:true|false)$/i,Ru=/^[^A-Z]*$/,Lu=/^[^a-z]*$/,Ke=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Is={number:"number",bigint:"bigint",object:"date"},$s=v("$ZodCheckLessThan",(e,t)=>{Ke.init(e,t);const n=Is[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ns=v("$ZodCheckGreaterThan",(e,t)=>{Ke.init(e,t);const n=Is[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zu=v("$ZodCheckMultipleOf",(e,t)=>{Ke.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Ol(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Iu=v("$ZodCheckNumberFormat",(e,t)=>{var a;Ke.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,s]=Zl[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=s,n&&(d.pattern=Cu)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>s&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),$u=v("$ZodCheckMaxLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ii(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=ai(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Nu=v("$ZodCheckMinLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ii(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=ai(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ou=v("$ZodCheckLengthEquals",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ii(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const a=ai(o),u=s>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Qr=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Ke.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Du=v("$ZodCheckRegex",(e,t)=>{Qr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ru),Qr.init(e,t)}),Uu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Lu),Qr.init(e,t)}),ju=v("$ZodCheckIncludes",(e,t)=>{Ke.init(e,t);const n=Mn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Zu=v("$ZodCheckStartsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`^${Mn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),qu=v("$ZodCheckEndsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`.*${Mn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Hu=v("$ZodCheckOverwrite",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Fu{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1348
- `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
1349
- `))}}const Bu={major:4,minor:3,patch:5},he=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Bu;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const a of s._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,h)=>{let p=Un(u),b;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(p)continue;const _=u.issues.length,w=m._zod.check(u);if(w instanceof Promise&&(h==null?void 0:h.async)===!1)throw new On;if(b||w instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await w,u.issues.length!==_&&(p||(p=Un(u,_)))});else{if(u.issues.length===_)continue;p||(p=Un(u,_))}}return b?b.then(()=>u):u},a=(u,d,h)=>{if(Un(u))return u.aborted=!0,u;const p=s(d,r,h);if(p instanceof Promise){if(h.async===!1)throw new On;return p.then(b=>e._zod.parse(b,h))}return e._zod.parse(p,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>a(b,u,d)):a(p,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new On;return h.then(p=>s(p,r,d))}return s(h,r,d)}}Y(e,"~standard",()=>({validate:s=>{var a;try{const u=Yl(e,s);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return Kl(e,s).then(d=>{var h;return d.success?{value:d.data}:{issues:(h=d.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),ui=v("$ZodString",(e,t)=>{var n;he.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Au(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),fe=v("$ZodStringFormat",(e,t)=>{Qr.init(e,t),ui.init(e,t)}),Gu=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fu),fe.init(e,t)}),Wu=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Cs(r))}else t.pattern??(t.pattern=Cs());fe.init(e,t)}),Ju=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gu),fe.init(e,t)}),Xu=v("$ZodURL",(e,t)=>{fe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Vu=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bu()),fe.init(e,t)}),Yu=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=pu),fe.init(e,t)}),Ku=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=au),fe.init(e,t)}),Qu=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=cu),fe.init(e,t)}),ed=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=lu),fe.init(e,t)}),td=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uu),fe.init(e,t)}),nd=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=du),fe.init(e,t)}),rd=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Eu(t)),fe.init(e,t)}),od=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Su),fe.init(e,t)}),id=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tu(t)),fe.init(e,t)}),sd=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hu),fe.init(e,t)}),ad=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ku),fe.init(e,t),e._zod.bag.format="ipv4"}),cd=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_u),fe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),ld=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vu),fe.init(e,t)}),ud=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=yu),fe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Os(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dd=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wu),fe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Os(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function pd(e){if(!Ps.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Os(n)}const hd=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ps),fe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{pd(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),fd=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xu),fe.init(e,t)});function gd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const md=v("$ZodJWT",(e,t)=>{fe.init(e,t),e._zod.check=n=>{gd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ds=v("$ZodNumber",(e,t)=>{he.init(e,t),e._zod.pattern=e._zod.bag.pattern??zs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),bd=v("$ZodNumberFormat",(e,t)=>{Iu.init(e,t),Ds.init(e,t)}),kd=v("$ZodBoolean",(e,t)=>{he.init(e,t),e._zod.pattern=Pu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),_d=v("$ZodAny",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),vd=v("$ZodUnknown",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),yd=v("$ZodNever",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ms(e,t,n){e.issues.length&&t.issues.push(...jn(n,e.issues)),t.value[n]=e.value}const wd=v("$ZodArray",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const u=o[a],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?s.push(d.then(h=>Ms(h,n,a))):Ms(d,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function eo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...jn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Us(e){var r,o,s,a;const t=Object.keys(e.shape);for(const u of t)if(!((a=(s=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=jl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function js(e,t,n,r,o,s){const a=[],u=o.keySet,d=o.catchall._zod,h=d.def.type,p=d.optout==="optional";for(const b in t){if(u.has(b))continue;if(h==="never"){a.push(b);continue}const m=d.run({value:t[b],issues:[]},r);m instanceof Promise?e.push(m.then(_=>eo(_,n,b,t,p))):eo(m,n,b,t,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const xd=v("$ZodObject",(e,t)=>{he.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Xr(()=>Us(t));Y(e._zod,"propValues",()=>{const u=t.shape,d={};for(const h in u){const p=u[h]._zod;if(p.values){d[h]??(d[h]=new Set);for(const b of p.values)d[h].add(b)}}return d});const o=dr,s=t.catchall;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const h=u.value;if(!o(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value={};const p=[],b=a.shape;for(const m of a.keys){const _=b[m],w=_._zod.optout==="optional",C=_._zod.run({value:h[m],issues:[]},d);C instanceof Promise?p.push(C.then(M=>eo(M,u,m,h,w))):eo(C,u,m,h,w)}return s?js(p,h,u,d,r.value,e):p.length?Promise.all(p).then(()=>u):u}}),Sd=v("$ZodObjectJIT",(e,t)=>{xd.init(e,t);const n=e._zod.parse,r=Xr(()=>Us(t)),o=m=>{var T;const _=new Fu(["shape","payload","ctx"]),w=r.value,C=x=>{const R=ws(x);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};_.write("const input = payload.value;");const M=Object.create(null);let W=0;for(const x of w.keys)M[x]=`key_${W++}`;_.write("const newResult = {};");for(const x of w.keys){const R=M[x],D=ws(x),pe=m[x],_e=((T=pe==null?void 0:pe._zod)==null?void 0:T.optout)==="optional";_.write(`const ${R} = ${C(x)};`),_e?_.write(`
1317
+ `].join(`
1318
+ `);let hi=!1;function ur(){if(hi)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Sl,document.head.appendChild(e),hi=!0}function Fr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Br(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const Tl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Gr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=u=>{if(i.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;i.add(u);const h=d.length>80?d.slice(0,80)+"":d;o.push(`[${u}="${h}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&a(u.name);for(const u of Tl)a(u);return`${t}${n}${r}${o.join("")}`}function El(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"":n}function Al(e,t=5,n=10){function r(o,i){const a=Gr(o),u=" ".repeat(i),d=Array.from(o.children).slice(0,n);if(i>=t||d.length===0){const h=El(o);return h?`${u}${a} "${h}"`:`${u}${a}`}return[`${u}${a}`,...d.map(h=>r(h,i+1))].join(`
1319
+ `)}return r(e,0)}const Cl='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Pl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Wr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Rl(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(Cl);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function Ll(e,t=80){var a,u,d;const n=Pl[e.tagName.toLowerCase()];if(n){const h=(u=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:u.trim();if(h)return Wr(h,t)}const r=Rl(e);if(r)return Wr(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return Wr(o,t);const i=e.getAttribute("aria-labelledby");if(i){const h=i.split(/\s+/).map(p=>{var b,m;return((m=(b=document.getElementById(p))==null?void 0:b.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(h)return Wr(h,t)}return""}function Il(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Ll(o),a=i&&!r.has(i)?`${Gr(o)} ["${i}"]`:Gr(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||Gr(e)}function fi(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function dr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function gi(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>dr('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>dr('meta[property="og:title"]')),ogDescription:e(()=>dr('meta[property="og:description"]')),ogType:e(()=>dr('meta[property="og:type"]')),ogSiteName:e(()=>dr('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?fi(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function zl(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function $l(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),u=o.tagName.toLowerCase();r=a?`${u}: ${fi(a,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Ol(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1320
+ `)}const zn=new Set;let $n=null,Jr=!1,es=!1;function Nl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Dl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(zn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Nl(r))return!0}return!1}function mi(){const e=Dl(),t=e&&!es;es=e;for(const n of zn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function bi(e){if(!(e instanceof Node))return!1;for(const t of zn)if(t===e||t.contains(e))return!0;return!1}function On(e){(bi(e.target)||"relatedTarget"in e&&bi(e.relatedTarget))&&e.stopPropagation()}function Ml(){Jr||(window.addEventListener("focusin",On,!0),window.addEventListener("focusout",On,!0),window.addEventListener("pointerdown",On,!0),Jr=!0),!$n&&($n=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&mi()}),$n.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function $t(e){"showPopover"in e&&(e.setAttribute("popover","manual"),zn.add(e),Ml(),mi())}function Ot(e){if(zn.delete(e),zn.size===0&&($n&&($n.disconnect(),$n=null),Jr&&(window.removeEventListener("focusin",On,!0),window.removeEventListener("focusout",On,!0),window.removeEventListener("pointerdown",On,!0),Jr=!1),es=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function ts(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),$t(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ot(t),t.remove()}}}const ki=/^cc-|current-password|new-password/i,Ul=/token|secret|password|apikey|auth/i,ns="[redacted]";function jl(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&ki.test(t)}function _i(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ns);const r=n.getAttribute("autocomplete");r&&ki.test(r)&&n.setAttribute("value",ns);for(const o of Array.from(n.attributes))Ul.test(o.name)&&n.setAttribute(o.name,ns)}}const Zl="🎯 Click any element to capture";let Jt=null,Ae=null,Oe=null;function pr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function ql(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function vi(e){Jt==null||Jt.update(e)}function yi(e){const t=gi(),n=zl(e),r=$l(e);let o;try{const i=e.cloneNode(!0);_i(i),o=i.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Br(e),cssSelector:Fr(e),innerTree:Al(e),outerTree:Il(e),elementOuterHtml:o,ancestry:n,...r,...t}}function rs(e,t){Oe&&Oe();const n=ql();Jt=ts(),Ae=document.createElement("div"),Ae.className="ap-sdk-picker-cursor",Ae.setAttribute("data-ap-sdk","1"),Ae.textContent=n?"Tap any element to preview":Zl,document.body.appendChild(Ae),$t(Ae);let r=null,o=null;const i=p=>{Oe==null||Oe(),e(yi(p),p)},a=p=>{if(o=p,vi(p),!Ae)return;Ae.classList.add("ap-sdk-picker-cursor--confirm"),Ae.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${p.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),Oe==null||Oe(),t()});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn",_.textContent="⬆ Parent",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o&&i(o)}),Ae.appendChild(b),Ae.appendChild(m),Ae.appendChild(_),Ae.appendChild(y)},u=p=>{pr(p.target)||(r=p.target,vi(r))},d=p=>{if(pr(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const b=p.target??r;if(b){if(n){a(b);return}i(b)}},h=p=>{p.key==="Escape"&&(Oe==null||Oe(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),Oe=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),Ae&&Ot(Ae),Ae==null||Ae.remove(),Jt==null||Jt.destroy(),Jt=null,Ae=null,o=null,Oe=null}}function os(){Oe==null||Oe()}function Nn(){return Oe!==null}const Yr={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const h=a.prototype,p=Object.keys(h);for(let b=0;b<p.length;b++){const m=p[b];m in u||(u[m]=h[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var d;const h=n!=null&&n.Parent?new i:this;r(h,u),(d=h._zod).deferred??(d.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class wi extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const xi={};function Yt(e){return xi}function Si(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ss(e,t){return typeof t=="bigint"?t.toString():t}function Vr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function is(e){return e==null}function as(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Hl(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),u=Number.parseInt(t.toFixed(i).replace(".",""));return a%u/10**i}const Ti=Symbol("evaluating");function K(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ti)return r===void 0&&(r=Ti,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Vt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ei(e){return JSON.stringify(e)}function Fl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ai="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Bl=Vr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Mn(e){if(hr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(hr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ci(e){return Mn(e)?{...e}:Array.isArray(e)?[...e]:e}const Gl=new Set(["string","number","symbol"]);function Un(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function O(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Wl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Jl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yl(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Vt(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return dn(this,"shape",a),a},checks:[]});return Xt(e,i)}function Vl(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Vt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return dn(this,"shape",a),a},checks:[]});return Xt(e,i)}function Xl(e,t){if(!Mn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Vt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return dn(this,"shape",i),i}});return Xt(e,o)}function Kl(e,t){if(!Mn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Vt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return dn(this,"shape",r),r}});return Xt(e,n)}function Ql(e,t){const n=Vt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return dn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Xt(e,n)}function eu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Vt(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const h in n){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(d[h]=e?new e({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)d[h]=e?new e({type:"optional",innerType:u[h]}):u[h];return dn(this,"shape",d),d},checks:[]});return Xt(t,a)}function tu(e,t,n){const r=Vt(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return dn(this,"shape",i),i}});return Xt(t,r)}function jn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Zn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Xr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Kt(e,t,n){var o,i,a,u,d,h;const r={...e,path:e.path??[]};if(!e.message){const p=Xr((a=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:a.call(i,e))??Xr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Xr((d=n.customError)==null?void 0:d.call(n,e))??Xr((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function cs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Pi=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ss,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ri=v("$ZodError",Pi),Li=v("$ZodError",Pi,{Parent:Error});function nu(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ru(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const ls=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Dn;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Kt(d,i,Yt())));throw Ai(u,o==null?void 0:o.callee),u}return a.value},us=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Kt(d,i,Yt())));throw Ai(u,o==null?void 0:o.callee),u}return a.value},Kr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Dn;return i.issues.length?{success:!1,error:new(e??Ri)(i.issues.map(a=>Kt(a,o,Yt())))}:{success:!0,data:i.value}},ou=Kr(Li),Qr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Kt(a,o,Yt())))}:{success:!0,data:i.value}},su=Qr(Li),iu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ls(e)(t,n,o)},au=e=>(t,n,r)=>ls(e)(t,n,r),cu=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return us(e)(t,n,o)},lu=e=>async(t,n,r)=>us(e)(t,n,r),uu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Kr(e)(t,n,o)},du=e=>(t,n,r)=>Kr(e)(t,n,r),pu=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qr(e)(t,n,o)},hu=e=>async(t,n,r)=>Qr(e)(t,n,r),fu=/^[cC][^\s-]{8,}$/,gu=/^[0-9a-z]+$/,mu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bu=/^[0-9a-vA-V]{20}$/,ku=/^[A-Za-z0-9]{27}$/,_u=/^[a-zA-Z0-9_-]{21}$/,vu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ii=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,wu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Su(){return new RegExp(xu,"u")}const Tu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Eu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Au=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zi=/^[A-Za-z0-9_-]*$/,Ru=/^\+[1-9]\d{6,14}$/,$i="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Lu=new RegExp(`^${$i}$`);function Oi(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Iu(e){return new RegExp(`^${Oi(e)}$`)}function zu(e){const t=Oi({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${$i}T(?:${r})$`)}const $u=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ou=/^-?\d+$/,Ni=/^-?\d+(?:\.\d+)?$/,Nu=/^(?:true|false)$/i,Du=/^[^A-Z]*$/,Mu=/^[^a-z]*$/,Ke=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Di={number:"number",bigint:"bigint",object:"date"},Mi=v("$ZodCheckLessThan",(e,t)=>{Ke.init(e,t);const n=Di[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=v("$ZodCheckGreaterThan",(e,t)=>{Ke.init(e,t);const n=Di[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uu=v("$ZodCheckMultipleOf",(e,t)=>{Ke.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Hl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ju=v("$ZodCheckNumberFormat",(e,t)=>{var a;Ke.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Jl[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=i,n&&(d.pattern=Ou)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>i&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Zu=v("$ZodCheckMaxLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!is(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=cs(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),qu=v("$ZodCheckMinLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!is(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=cs(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hu=v("$ZodCheckLengthEquals",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!is(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const a=cs(o),u=i>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eo=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Ke.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Fu=v("$ZodCheckRegex",(e,t)=>{eo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Bu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Du),eo.init(e,t)}),Gu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mu),eo.init(e,t)}),Wu=v("$ZodCheckIncludes",(e,t)=>{Ke.init(e,t);const n=Un(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ju=v("$ZodCheckStartsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`^${Un(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Yu=v("$ZodCheckEndsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`.*${Un(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Vu=v("$ZodCheckOverwrite",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Xu{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1321
+ `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
1322
+ `))}}const Ku={major:4,minor:3,patch:5},he=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ku;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const a of i._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(u,d,h)=>{let p=jn(u),b;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(p)continue;const _=u.issues.length,y=m._zod.check(u);if(y instanceof Promise&&(h==null?void 0:h.async)===!1)throw new Dn;if(b||y instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await y,u.issues.length!==_&&(p||(p=jn(u,_)))});else{if(u.issues.length===_)continue;p||(p=jn(u,_))}}return b?b.then(()=>u):u},a=(u,d,h)=>{if(jn(u))return u.aborted=!0,u;const p=i(d,r,h);if(p instanceof Promise){if(h.async===!1)throw new Dn;return p.then(b=>e._zod.parse(b,h))}return e._zod.parse(p,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>a(b,u,d)):a(p,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new Dn;return h.then(p=>i(p,r,d))}return i(h,r,d)}}K(e,"~standard",()=>({validate:i=>{var a;try{const u=ou(e,i);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return su(e,i).then(d=>{var h;return d.success?{value:d.data}:{issues:(h=d.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),ds=v("$ZodString",(e,t)=>{var n;he.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??$u(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),fe=v("$ZodStringFormat",(e,t)=>{eo.init(e,t),ds.init(e,t)}),Qu=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yu),fe.init(e,t)}),ed=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ii(r))}else t.pattern??(t.pattern=Ii());fe.init(e,t)}),td=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wu),fe.init(e,t)}),nd=v("$ZodURL",(e,t)=>{fe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),rd=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Su()),fe.init(e,t)}),od=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=_u),fe.init(e,t)}),sd=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fu),fe.init(e,t)}),id=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gu),fe.init(e,t)}),ad=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=mu),fe.init(e,t)}),cd=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bu),fe.init(e,t)}),ld=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ku),fe.init(e,t)}),ud=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zu(t)),fe.init(e,t)}),dd=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Lu),fe.init(e,t)}),pd=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Iu(t)),fe.init(e,t)}),hd=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vu),fe.init(e,t)}),fd=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Tu),fe.init(e,t),e._zod.bag.format="ipv4"}),gd=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Eu),fe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),md=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Au),fe.init(e,t)}),bd=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Cu),fe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ji(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const kd=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pu),fe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ji(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function _d(e){if(!zi.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ji(n)}const vd=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zi),fe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{_d(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),yd=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ru),fe.init(e,t)});function wd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const xd=v("$ZodJWT",(e,t)=>{fe.init(e,t),e._zod.check=n=>{wd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Zi=v("$ZodNumber",(e,t)=>{he.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ni,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Sd=v("$ZodNumberFormat",(e,t)=>{ju.init(e,t),Zi.init(e,t)}),Td=v("$ZodBoolean",(e,t)=>{he.init(e,t),e._zod.pattern=Nu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Ed=v("$ZodAny",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),Ad=v("$ZodUnknown",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),Cd=v("$ZodNever",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function qi(e,t,n){e.issues.length&&t.issues.push(...Zn(n,e.issues)),t.value[n]=e.value}const Pd=v("$ZodArray",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const u=o[a],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?i.push(d.then(h=>qi(h,n,a))):qi(d,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function to(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Zn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Hi(e){var r,o,i,a;const t=Object.keys(e.shape);for(const u of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=Wl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Fi(e,t,n,r,o,i){const a=[],u=o.keySet,d=o.catchall._zod,h=d.def.type,p=d.optout==="optional";for(const b in t){if(u.has(b))continue;if(h==="never"){a.push(b);continue}const m=d.run({value:t[b],issues:[]},r);m instanceof Promise?e.push(m.then(_=>to(_,n,b,t,p))):to(m,n,b,t,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Rd=v("$ZodObject",(e,t)=>{he.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Vr(()=>Hi(t));K(e._zod,"propValues",()=>{const u=t.shape,d={};for(const h in u){const p=u[h]._zod;if(p.values){d[h]??(d[h]=new Set);for(const b of p.values)d[h].add(b)}}return d});const o=hr,i=t.catchall;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const h=u.value;if(!o(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value={};const p=[],b=a.shape;for(const m of a.keys){const _=b[m],y=_._zod.optout==="optional",C=_._zod.run({value:h[m],issues:[]},d);C instanceof Promise?p.push(C.then(M=>to(M,u,m,h,y))):to(C,u,m,h,y)}return i?Fi(p,h,u,d,r.value,e):p.length?Promise.all(p).then(()=>u):u}}),Ld=v("$ZodObjectJIT",(e,t)=>{Rd.init(e,t);const n=e._zod.parse,r=Vr(()=>Hi(t)),o=m=>{var T;const _=new Xu(["shape","payload","ctx"]),y=r.value,C=x=>{const R=Ei(x);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};_.write("const input = payload.value;");const M=Object.create(null);let J=0;for(const x of y.keys)M[x]=`key_${J++}`;_.write("const newResult = {};");for(const x of y.keys){const R=M[x],D=Ei(x),pe=m[x],_e=((T=pe==null?void 0:pe._zod)==null?void 0:T.optout)==="optional";_.write(`const ${R} = ${C(x)};`),_e?_.write(`
1350
1323
  if (${R}.issues.length) {
1351
1324
  if (${D} in input) {
1352
1325
  payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
@@ -1380,48 +1353,48 @@ button.ap-sdk-list-item__link {
1380
1353
  newResult[${D}] = ${R}.value;
1381
1354
  }
1382
1355
 
1383
- `)}_.write("payload.value = newResult;"),_.write("return payload;");const P=_.compile();return(x,R)=>P(m,x,R)};let s;const a=dr,u=!_s.jitless,h=u&&Ml.value,p=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const w=m.value;return a(w)?u&&h&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),p?js([],w,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Zs(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Un(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>Yt(a,r,Jt())))}),t)}const qs=v("$ZodUnion",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Y(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Y(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Y(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>si(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let a=!1;const u=[];for(const d of t.options){const h=d._zod.run({value:o.value,issues:[]},s);if(h instanceof Promise)u.push(h),a=!0;else{if(h.issues.length===0)return h;u.push(h)}}return a?Promise.all(u).then(d=>Zs(d,o,e,s)):Zs(u,o,e,s)}}),Td=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,qs.init(e,t);const n=e._zod.parse;Y(e._zod,"propValues",()=>{const o={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const h of d)o[u].add(h)}}return o});const r=Xr(()=>{var a;const o=t.options,s=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const h of d){if(s.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);s.set(h,u)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!dr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Ed=v("$ZodIntersection",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([d,h])=>Hs(n,d,h)):Hs(n,s,a)}});function di(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Dn(e)&&Dn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const a=di(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],a=di(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Hs(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),Un(e))return e;const a=di(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Ad=v("$ZodRecord",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Dn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?s.push(p.then(b=>{b.issues.length&&n.issues.push(...jn(h,b.issues)),n.value[h]=b.value})):(p.issues.length&&n.issues.push(...jn(h,p.issues)),n.value[h]=p.value)}let d;for(const h in o)u.has(h)||(d=d??[],d.push(h));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&zs.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>Yt(b,r,Jt())),input:u,path:[u],inst:e});continue}const p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?s.push(p.then(b=>{b.issues.length&&n.issues.push(...jn(u,b.issues)),n.value[d.value]=b.value})):(p.issues.length&&n.issues.push(...jn(u,p.issues)),n.value[d.value]=p.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Cd=v("$ZodEnum",(e,t)=>{he.init(e,t);const n=vs(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ul.has(typeof o)).map(o=>typeof o=="string"?Mn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Pd=v("$ZodLiteral",(e,t)=>{if(he.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Mn(r):r?Mn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Rd=v("$ZodTransform",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ks(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new On;return n.value=o,n}});function Fs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Bs=v("$ZodOptional",(e,t)=>{he.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${si(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fs(s,n.value)):Fs(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Ld=v("$ZodExactOptional",(e,t)=>{Bs.init(e,t),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),zd=v("$ZodNullable",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${si(n.source)}|null)$`):void 0}),Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Id=v("$ZodDefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Gs(s,t)):Gs(o,t)}});function Gs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const $d=v("$ZodPrefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Nd=v("$ZodNonOptional",(e,t)=>{he.init(e,t),Y(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ws(s,e)):Ws(o,e)}});function Ws(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Od=v("$ZodCatch",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>Yt(a,r,Jt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Yt(s,r,Jt()))},input:n.value}),n.issues=[]),n)}}),Dd=v("$ZodPipe",(e,t)=>{he.init(e,t),Y(e._zod,"values",()=>t.in._zod.values),Y(e._zod,"optin",()=>t.in._zod.optin),Y(e._zod,"optout",()=>t.out._zod.optout),Y(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(a=>to(a,t.in,r)):to(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>to(s,t.out,r)):to(o,t.out,r)}});function to(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Md=v("$ZodReadonly",(e,t)=>{he.init(e,t),Y(e._zod,"propValues",()=>t.innerType._zod.propValues),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Y(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Js):Js(o)}});function Js(e){return e.value=Object.freeze(e.value),e}const Ud=v("$ZodCustom",(e,t)=>{Ke.init(e,t),he.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Xs(s,n,r,e));Xs(o,n,r,e)}});function Xs(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(pr(o))}}var Vs;class jd{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Zd(){return new jd}(Vs=globalThis).__zod_globalRegistry??(Vs.__zod_globalRegistry=Zd());const hr=globalThis.__zod_globalRegistry;function qd(e,t){return new e({type:"string",...N(t)})}function Hd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...N(t)})}function Ys(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...N(t)})}function Fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...N(t)})}function Bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(t)})}function Gd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(t)})}function Wd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(t)})}function Jd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...N(t)})}function Xd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...N(t)})}function Vd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(t)})}function Yd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...N(t)})}function Kd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(t)})}function Qd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...N(t)})}function ep(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...N(t)})}function tp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(t)})}function np(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(t)})}function rp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(t)})}function op(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(t)})}function ip(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(t)})}function sp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...N(t)})}function ap(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...N(t)})}function cp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...N(t)})}function lp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...N(t)})}function up(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(t)})}function dp(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function pp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function hp(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function fp(e,t){return new e({type:"number",checks:[],...N(t)})}function gp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...N(t)})}function mp(e,t){return new e({type:"boolean",...N(t)})}function bp(e){return new e({type:"any"})}function kp(e){return new e({type:"unknown"})}function _p(e,t){return new e({type:"never",...N(t)})}function Ks(e,t){return new $s({check:"less_than",...N(t),value:e,inclusive:!1})}function pi(e,t){return new $s({check:"less_than",...N(t),value:e,inclusive:!0})}function Qs(e,t){return new Ns({check:"greater_than",...N(t),value:e,inclusive:!1})}function hi(e,t){return new Ns({check:"greater_than",...N(t),value:e,inclusive:!0})}function ea(e,t){return new zu({check:"multiple_of",...N(t),value:e})}function ta(e,t){return new $u({check:"max_length",...N(t),maximum:e})}function no(e,t){return new Nu({check:"min_length",...N(t),minimum:e})}function na(e,t){return new Ou({check:"length_equals",...N(t),length:e})}function vp(e,t){return new Du({check:"string_format",format:"regex",...N(t),pattern:e})}function yp(e){return new Mu({check:"string_format",format:"lowercase",...N(e)})}function wp(e){return new Uu({check:"string_format",format:"uppercase",...N(e)})}function xp(e,t){return new ju({check:"string_format",format:"includes",...N(t),includes:e})}function Sp(e,t){return new Zu({check:"string_format",format:"starts_with",...N(t),prefix:e})}function Tp(e,t){return new qu({check:"string_format",format:"ends_with",...N(t),suffix:e})}function Zn(e){return new Hu({check:"overwrite",tx:e})}function Ep(e){return Zn(t=>t.normalize(e))}function Ap(){return Zn(e=>e.trim())}function Cp(){return Zn(e=>e.toLowerCase())}function Pp(){return Zn(e=>e.toUpperCase())}function Rp(){return Zn(e=>Dl(e))}function Lp(e,t,n){return new e({type:"array",element:t,...N(n)})}function zp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...N(n)})}function Ip(e){const t=$p(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(pr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(pr(o))}},e(n.value,n)));return t}function $p(e,t){const n=new Ke({check:"custom",...N(t)});return n._zod.check=e,n}function ra(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??hr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function xe(e,t,n={path:[],schemaPath:[]}){var p,b;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(b=(p=e._zod).toJSONSchema)==null?void 0:b.call(p);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const w=a.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,w,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),xe(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&He(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function oa(e,t){var a,u,d,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of e.seen.entries()){const b=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(b){const m=r.get(b);if(m&&m!==p[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,p[0])}}const o=p=>{var C;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const M=(C=e.external.registry.get(p[0]))==null?void 0:C.id,W=e.external.uri??(T=>T);if(M)return{ref:W(M)};const P=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=P,{defId:P,ref:`${W("__shared")}#/${b}/${P}`}}if(p[1]===n)return{ref:"#"};const _=`#/${b}/`,w=p[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=p=>{if(p[1].schema.$ref)return;const b=p[1],{ref:m,defId:_}=o(p);b.def={...b.schema},_&&(b.defId=_);const w=b.schema;for(const C in w)delete w[C];w.$ref=m};if(e.cycles==="throw")for(const p of e.seen.entries()){const b=p[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
1356
+ `)}_.write("payload.value = newResult;"),_.write("return payload;");const P=_.compile();return(x,R)=>P(m,x,R)};let i;const a=hr,u=!xi.jitless,h=u&&Bl.value,p=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const y=m.value;return a(y)?u&&h&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(i||(i=o(t.shape)),m=i(m,_),p?Fi([],y,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Bi(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!jn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>Kt(a,r,Yt())))}),t)}const Gi=v("$ZodUnion",(e,t)=>{he.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>as(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const u=[];for(const d of t.options){const h=d._zod.run({value:o.value,issues:[]},i);if(h instanceof Promise)u.push(h),a=!0;else{if(h.issues.length===0)return h;u.push(h)}}return a?Promise.all(u).then(d=>Bi(d,o,e,i)):Bi(u,o,e,i)}}),Id=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Gi.init(e,t);const n=e._zod.parse;K(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const h of d)o[u].add(h)}}return o});const r=Vr(()=>{var a;const o=t.options,i=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const h of d){if(i.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);i.set(h,u)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),zd=v("$ZodIntersection",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([d,h])=>Wi(n,d,h)):Wi(n,i,a)}});function ps(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Mn(e)&&Mn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=ps(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=ps(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Wi(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const i=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(i.length&&o&&e.issues.push({...o,keys:i}),jn(e))return e;const a=ps(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const $d=v("$ZodRecord",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Mn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Zn(h,b.issues)),n.value[h]=b.value})):(p.issues.length&&n.issues.push(...Zn(h,p.issues)),n.value[h]=p.value)}let d;for(const h in o)u.has(h)||(d=d??[],d.push(h));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Ni.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>Kt(b,r,Yt())),input:u,path:[u],inst:e});continue}const p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?i.push(p.then(b=>{b.issues.length&&n.issues.push(...Zn(u,b.issues)),n.value[d.value]=b.value})):(p.issues.length&&n.issues.push(...Zn(u,p.issues)),n.value[d.value]=p.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Od=v("$ZodEnum",(e,t)=>{he.init(e,t);const n=Si(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Gl.has(typeof o)).map(o=>typeof o=="string"?Un(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Nd=v("$ZodLiteral",(e,t)=>{if(he.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Un(r):r?Un(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Dd=v("$ZodTransform",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new wi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Dn;return n.value=o,n}});function Ji(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Yi=v("$ZodOptional",(e,t)=>{he.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${as(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ji(i,n.value)):Ji(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Md=v("$ZodExactOptional",(e,t)=>{Yi.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ud=v("$ZodNullable",(e,t)=>{he.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${as(n.source)}|null)$`):void 0}),K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),jd=v("$ZodDefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Vi(i,t)):Vi(o,t)}});function Vi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Zd=v("$ZodPrefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),qd=v("$ZodNonOptional",(e,t)=>{he.init(e,t),K(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Xi(i,e)):Xi(o,e)}});function Xi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Hd=v("$ZodCatch",(e,t)=>{he.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>Kt(a,r,Yt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Kt(i,r,Yt()))},input:n.value}),n.issues=[]),n)}}),Fd=v("$ZodPipe",(e,t)=>{he.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>no(a,t.in,r)):no(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>no(i,t.out,r)):no(o,t.out,r)}});function no(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Bd=v("$ZodReadonly",(e,t)=>{he.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),K(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ki):Ki(o)}});function Ki(e){return e.value=Object.freeze(e.value),e}const Gd=v("$ZodCustom",(e,t)=>{Ke.init(e,t),he.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Qi(i,n,r,e));Qi(o,n,r,e)}});function Qi(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(fr(o))}}var ea;class Wd{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Jd(){return new Wd}(ea=globalThis).__zod_globalRegistry??(ea.__zod_globalRegistry=Jd());const gr=globalThis.__zod_globalRegistry;function Yd(e,t){return new e({type:"string",...O(t)})}function Vd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function ta(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Qd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function ep(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function tp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function np(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function rp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function op(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function sp(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function ip(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function ap(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function cp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function lp(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function up(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function dp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function pp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function hp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function fp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function gp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function mp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function bp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function kp(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function _p(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function vp(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function yp(e,t){return new e({type:"number",checks:[],...O(t)})}function wp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function xp(e,t){return new e({type:"boolean",...O(t)})}function Sp(e){return new e({type:"any"})}function Tp(e){return new e({type:"unknown"})}function Ep(e,t){return new e({type:"never",...O(t)})}function na(e,t){return new Mi({check:"less_than",...O(t),value:e,inclusive:!1})}function hs(e,t){return new Mi({check:"less_than",...O(t),value:e,inclusive:!0})}function ra(e,t){return new Ui({check:"greater_than",...O(t),value:e,inclusive:!1})}function fs(e,t){return new Ui({check:"greater_than",...O(t),value:e,inclusive:!0})}function oa(e,t){return new Uu({check:"multiple_of",...O(t),value:e})}function sa(e,t){return new Zu({check:"max_length",...O(t),maximum:e})}function ro(e,t){return new qu({check:"min_length",...O(t),minimum:e})}function ia(e,t){return new Hu({check:"length_equals",...O(t),length:e})}function Ap(e,t){return new Fu({check:"string_format",format:"regex",...O(t),pattern:e})}function Cp(e){return new Bu({check:"string_format",format:"lowercase",...O(e)})}function Pp(e){return new Gu({check:"string_format",format:"uppercase",...O(e)})}function Rp(e,t){return new Wu({check:"string_format",format:"includes",...O(t),includes:e})}function Lp(e,t){return new Ju({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Ip(e,t){return new Yu({check:"string_format",format:"ends_with",...O(t),suffix:e})}function qn(e){return new Vu({check:"overwrite",tx:e})}function zp(e){return qn(t=>t.normalize(e))}function $p(){return qn(e=>e.trim())}function Op(){return qn(e=>e.toLowerCase())}function Np(){return qn(e=>e.toUpperCase())}function Dp(){return qn(e=>Fl(e))}function Mp(e,t,n){return new e({type:"array",element:t,...O(n)})}function Up(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function jp(e){const t=Zp(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(fr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(fr(o))}},e(n.value,n)));return t}function Zp(e,t){const n=new Ke({check:"custom",...O(t)});return n._zod.check=e,n}function aa(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??gr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function xe(e,t,n={path:[],schemaPath:[]}){var p,b;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(b=(p=e._zod).toJSONSchema)==null?void 0:b.call(p);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const y=a.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,y,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),xe(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&He(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ca(e,t){var a,u,d,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of e.seen.entries()){const b=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(b){const m=r.get(b);if(m&&m!==p[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,p[0])}}const o=p=>{var C;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const M=(C=e.external.registry.get(p[0]))==null?void 0:C.id,J=e.external.uri??(T=>T);if(M)return{ref:J(M)};const P=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=P,{defId:P,ref:`${J("__shared")}#/${b}/${P}`}}if(p[1]===n)return{ref:"#"};const _=`#/${b}/`,y=p[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:_+y}},i=p=>{if(p[1].schema.$ref)return;const b=p[1],{ref:m,defId:_}=o(p);b.def={...b.schema},_&&(b.defId=_);const y=b.schema;for(const C in y)delete y[C];y.$ref=m};if(e.cycles==="throw")for(const p of e.seen.entries()){const b=p[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
1384
1357
 
1385
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const b=p[1];if(t===p[0]){s(p);continue}if(e.external){const _=(d=e.external.registry.get(p[0]))==null?void 0:d.id;if(t!==p[0]&&_){s(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){s(p);continue}if(b.cycle){s(p);continue}if(b.count>1&&e.reused==="ref"){s(p);continue}}}function ia(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const p=e.seen.get(h);if(p.ref===null)return;const b=p.def??p.schema,m={...b},_=p.ref;if(p.ref=null,_){r(_);const C=e.seen.get(_),M=C.schema;if(M.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(M)):Object.assign(b,M),Object.assign(b,m),h._zod.parent===_)for(const P in b)P==="$ref"||P==="allOf"||P in m||delete b[P];if(M.$ref)for(const P in b)P==="$ref"||P==="allOf"||P in C.def&&JSON.stringify(b[P])===JSON.stringify(C.def[P])&&delete b[P]}const w=h._zod.parent;if(w&&w!==_){r(w);const C=e.seen.get(w);if(C!=null&&C.schema.$ref&&(b.$ref=C.schema.$ref,C.def))for(const M in b)M==="$ref"||M==="allOf"||M in C.def&&JSON.stringify(b[M])===JSON.stringify(C.def[M])&&delete b[M]}e.override({zodSchema:h,jsonSchema:b,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(s[p.defId]=p.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:ro(t,"input",e.processors),output:ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function He(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return He(r.element,n);if(r.type==="set")return He(r.valueType,n);if(r.type==="lazy")return He(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return He(r.innerType,n);if(r.type==="intersection")return He(r.left,n)||He(r.right,n);if(r.type==="record"||r.type==="map")return He(r.keyType,n)||He(r.valueType,n);if(r.type==="pipe")return He(r.in,n)||He(r.out,n);if(r.type==="object"){for(const o in r.shape)if(He(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(He(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(He(o,n))return!0;return!!(r.rest&&He(r.rest,n))}return!1}const Np=(e,t={})=>n=>{const r=ra({...n,processors:t});return xe(e,r),oa(r,e),ia(r,e)},ro=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=ra({...o??{},target:s,io:t,processors:n});return xe(e,a),oa(a,e),ia(a,e)},Op={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:u,patterns:d,contentEncoding:h}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Op[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),h&&(o.contentEncoding=h),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},Mp=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,format:u,multipleOf:d,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof s=="number"&&(o.minimum=s,typeof p=="number"&&t.target!=="draft-04"&&(p>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},Up=(e,t,n,r)=>{n.type="boolean"},jp=(e,t,n,r)=>{n.not={}},Zp=(e,t,n,r)=>{},qp=(e,t,n,r)=>{},Hp=(e,t,n,r)=>{const o=e._zod.def,s=vs(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},Fp=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},Bp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Gp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Wp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=xe(s.element,t,{...r,path:[...r.path,"items"]})},Jp=(e,t,n,r)=>{var h;const o=n,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const p in a)o.properties[p]=xe(a[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(p=>{const b=s.shape[p]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((h=s.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Xp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,d)=>xe(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=a:n.anyOf=a},Vp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,d=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];n.allOf=d},Yp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const p=xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(b=>typeof b=="string"||typeof b=="number");p.length>0&&(o.required=p)}},Kp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Qp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},eh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},th=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},nh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},rh=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(s,t,r);const a=t.seen.get(e);a.ref=s},oh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},sa=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},ih=v("ZodISODateTime",(e,t)=>{rd.init(e,t),ke.init(e,t)});function sh(e){return up(ih,e)}const ah=v("ZodISODate",(e,t)=>{od.init(e,t),ke.init(e,t)});function ch(e){return dp(ah,e)}const lh=v("ZodISOTime",(e,t)=>{id.init(e,t),ke.init(e,t)});function uh(e){return pp(lh,e)}const dh=v("ZodISODuration",(e,t)=>{sd.init(e,t),ke.init(e,t)});function ph(e){return hp(dh,e)}const ot=v("ZodError",(e,t)=>{Es.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Vl(e,n)},flatten:{value:n=>Xl(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oi,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),hh=ci(ot),fh=li(ot),gh=Yr(ot),mh=Kr(ot),bh=Ql(ot),kh=eu(ot),_h=tu(ot),vh=nu(ot),yh=ru(ot),wh=ou(ot),xh=iu(ot),Sh=su(ot),ge=v("ZodType",(e,t)=>(he.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ro(e,"input"),output:ro(e,"output")}}),e.toJSONSchema=Np(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Xt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Vt(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>hh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>gh(e,n,r),e.parseAsync=async(n,r)=>fh(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>mh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>bh(e,n,r),e.decode=(n,r)=>kh(e,n,r),e.encodeAsync=async(n,r)=>_h(e,n,r),e.decodeAsync=async(n,r)=>vh(e,n,r),e.safeEncode=(n,r)=>yh(e,n,r),e.safeDecode=(n,r)=>wh(e,n,r),e.safeEncodeAsync=async(n,r)=>xh(e,n,r),e.safeDecodeAsync=async(n,r)=>Sh(e,n,r),e.refine=(n,r)=>e.check(vf(n,r)),e.superRefine=n=>e.check(yf(n)),e.overwrite=n=>e.check(Zn(n)),e.optional=()=>ma(e),e.exactOptional=()=>af(e),e.nullable=()=>ba(e),e.nullish=()=>ma(ba(e)),e.nonoptional=n=>hf(e,n),e.array=()=>ht(e),e.or=n=>Yh([e,n]),e.and=n=>ef(e,n),e.transform=n=>_a(e,of(n)),e.default=n=>uf(e,n),e.prefault=n=>pf(e,n),e.catch=n=>gf(e,n),e.pipe=n=>_a(e,n),e.readonly=()=>kf(e),e.describe=n=>{const r=e.clone();return hr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=hr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hr.get(e);const r=e.clone();return hr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),aa=v("_ZodString",(e,t)=>{ui.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Dp(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(vp(...r)),e.includes=(...r)=>e.check(xp(...r)),e.startsWith=(...r)=>e.check(Sp(...r)),e.endsWith=(...r)=>e.check(Tp(...r)),e.min=(...r)=>e.check(no(...r)),e.max=(...r)=>e.check(ta(...r)),e.length=(...r)=>e.check(na(...r)),e.nonempty=(...r)=>e.check(no(1,...r)),e.lowercase=r=>e.check(yp(r)),e.uppercase=r=>e.check(wp(r)),e.trim=()=>e.check(Ap()),e.normalize=(...r)=>e.check(Ep(...r)),e.toLowerCase=()=>e.check(Cp()),e.toUpperCase=()=>e.check(Pp()),e.slugify=()=>e.check(Rp())}),Th=v("ZodString",(e,t)=>{ui.init(e,t),aa.init(e,t),e.email=n=>e.check(Hd(Eh,n)),e.url=n=>e.check(Jd(Ah,n)),e.jwt=n=>e.check(lp(qh,n)),e.emoji=n=>e.check(Xd(Ch,n)),e.guid=n=>e.check(Ys(ca,n)),e.uuid=n=>e.check(Fd(oo,n)),e.uuidv4=n=>e.check(Bd(oo,n)),e.uuidv6=n=>e.check(Gd(oo,n)),e.uuidv7=n=>e.check(Wd(oo,n)),e.nanoid=n=>e.check(Vd(Ph,n)),e.guid=n=>e.check(Ys(ca,n)),e.cuid=n=>e.check(Yd(Rh,n)),e.cuid2=n=>e.check(Kd(Lh,n)),e.ulid=n=>e.check(Qd(zh,n)),e.base64=n=>e.check(sp(Uh,n)),e.base64url=n=>e.check(ap(jh,n)),e.xid=n=>e.check(ep(Ih,n)),e.ksuid=n=>e.check(tp($h,n)),e.ipv4=n=>e.check(np(Nh,n)),e.ipv6=n=>e.check(rp(Oh,n)),e.cidrv4=n=>e.check(op(Dh,n)),e.cidrv6=n=>e.check(ip(Mh,n)),e.e164=n=>e.check(cp(Zh,n)),e.datetime=n=>e.check(sh(n)),e.date=n=>e.check(ch(n)),e.time=n=>e.check(uh(n)),e.duration=n=>e.check(ph(n))});function A(e){return qd(Th,e)}const ke=v("ZodStringFormat",(e,t)=>{fe.init(e,t),aa.init(e,t)}),Eh=v("ZodEmail",(e,t)=>{Ju.init(e,t),ke.init(e,t)}),ca=v("ZodGUID",(e,t)=>{Gu.init(e,t),ke.init(e,t)}),oo=v("ZodUUID",(e,t)=>{Wu.init(e,t),ke.init(e,t)}),Ah=v("ZodURL",(e,t)=>{Xu.init(e,t),ke.init(e,t)}),Ch=v("ZodEmoji",(e,t)=>{Vu.init(e,t),ke.init(e,t)}),Ph=v("ZodNanoID",(e,t)=>{Yu.init(e,t),ke.init(e,t)}),Rh=v("ZodCUID",(e,t)=>{Ku.init(e,t),ke.init(e,t)}),Lh=v("ZodCUID2",(e,t)=>{Qu.init(e,t),ke.init(e,t)}),zh=v("ZodULID",(e,t)=>{ed.init(e,t),ke.init(e,t)}),Ih=v("ZodXID",(e,t)=>{td.init(e,t),ke.init(e,t)}),$h=v("ZodKSUID",(e,t)=>{nd.init(e,t),ke.init(e,t)}),Nh=v("ZodIPv4",(e,t)=>{ad.init(e,t),ke.init(e,t)}),Oh=v("ZodIPv6",(e,t)=>{cd.init(e,t),ke.init(e,t)}),Dh=v("ZodCIDRv4",(e,t)=>{ld.init(e,t),ke.init(e,t)}),Mh=v("ZodCIDRv6",(e,t)=>{ud.init(e,t),ke.init(e,t)}),Uh=v("ZodBase64",(e,t)=>{dd.init(e,t),ke.init(e,t)}),jh=v("ZodBase64URL",(e,t)=>{hd.init(e,t),ke.init(e,t)}),Zh=v("ZodE164",(e,t)=>{fd.init(e,t),ke.init(e,t)}),qh=v("ZodJWT",(e,t)=>{md.init(e,t),ke.init(e,t)}),la=v("ZodNumber",(e,t)=>{Ds.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Mp(e,r,o),e.gt=(r,o)=>e.check(Qs(r,o)),e.gte=(r,o)=>e.check(hi(r,o)),e.min=(r,o)=>e.check(hi(r,o)),e.lt=(r,o)=>e.check(Ks(r,o)),e.lte=(r,o)=>e.check(pi(r,o)),e.max=(r,o)=>e.check(pi(r,o)),e.int=r=>e.check(ua(r)),e.safe=r=>e.check(ua(r)),e.positive=r=>e.check(Qs(0,r)),e.nonnegative=r=>e.check(hi(0,r)),e.negative=r=>e.check(Ks(0,r)),e.nonpositive=r=>e.check(pi(0,r)),e.multipleOf=(r,o)=>e.check(ea(r,o)),e.step=(r,o)=>e.check(ea(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Tt(e){return fp(la,e)}const Hh=v("ZodNumberFormat",(e,t)=>{bd.init(e,t),la.init(e,t)});function ua(e){return gp(Hh,e)}const Fh=v("ZodBoolean",(e,t)=>{kd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Up(e,n,r)});function me(e){return mp(Fh,e)}const Bh=v("ZodAny",(e,t)=>{_d.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zp()});function da(){return bp(Bh)}const Gh=v("ZodUnknown",(e,t)=>{vd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qp()});function pa(){return kp(Gh)}const Wh=v("ZodNever",(e,t)=>{yd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r)});function Jh(e){return _p(Wh,e)}const Xh=v("ZodArray",(e,t)=>{wd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(no(n,r)),e.nonempty=n=>e.check(no(1,n)),e.max=(n,r)=>e.check(ta(n,r)),e.length=(n,r)=>e.check(na(n,r)),e.unwrap=()=>e.element});function ht(e,t){return Lp(Xh,e,t)}const Vh=v("ZodObject",(e,t)=>{Sd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jp(e,n,r,o),Y(e,"shape",()=>t.shape),e.keyof=()=>it(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pa()}),e.loose=()=>e.clone({...e._zod.def,catchall:pa()}),e.strict=()=>e.clone({...e._zod.def,catchall:Jh()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Fl(e,n),e.safeExtend=n=>Bl(e,n),e.merge=n=>Gl(e,n),e.pick=n=>ql(e,n),e.omit=n=>Hl(e,n),e.partial=(...n)=>Wl(ga,e,n[0]),e.required=(...n)=>Jl(ka,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...N(t)};return new Vh(n)}const ha=v("ZodUnion",(e,t)=>{qs.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xp(e,n,r,o),e.options=t.options});function Yh(e,t){return new ha({type:"union",options:e,...N(t)})}const Kh=v("ZodDiscriminatedUnion",(e,t)=>{ha.init(e,t),Td.init(e,t)});function fa(e,t,n){return new Kh({type:"union",options:t,discriminator:e,...N(n)})}const Qh=v("ZodIntersection",(e,t)=>{Ed.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vp(e,n,r,o)});function ef(e,t){return new Qh({type:"intersection",left:e,right:t})}const tf=v("ZodRecord",(e,t)=>{Ad.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Et(e,t,n){return new tf({type:"record",keyType:e,valueType:t,...N(n)})}const fi=v("ZodEnum",(e,t)=>{Cd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Hp(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...t,checks:[],...N(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new fi({...t,checks:[],...N(o),entries:s})}});function it(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new fi({type:"enum",entries:n,...N(t)})}const nf=v("ZodLiteral",(e,t)=>{Pd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fp(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function st(e,t){return new nf({type:"literal",values:Array.isArray(e)?e:[e],...N(t)})}const rf=v("ZodTransform",(e,t)=>{Rd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ks(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(pr(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(pr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function of(e){return new rf({type:"transform",transform:e})}const ga=v("ZodOptional",(e,t)=>{Bs.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new ga({type:"optional",innerType:e})}const sf=v("ZodExactOptional",(e,t)=>{Ld.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function af(e){return new sf({type:"optional",innerType:e})}const cf=v("ZodNullable",(e,t)=>{zd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ba(e){return new cf({type:"nullable",innerType:e})}const lf=v("ZodDefault",(e,t)=>{Id.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uf(e,t){return new lf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ss(t)}})}const df=v("ZodPrefault",(e,t)=>{$d.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pf(e,t){return new df({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ss(t)}})}const ka=v("ZodNonOptional",(e,t)=>{Nd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hf(e,t){return new ka({type:"nonoptional",innerType:e,...N(t)})}const ff=v("ZodCatch",(e,t)=>{Od.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gf(e,t){return new ff({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mf=v("ZodPipe",(e,t)=>{Dd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rh(e,n,r,o),e.in=t.in,e.out=t.out});function _a(e,t){return new mf({type:"pipe",in:e,out:t})}const bf=v("ZodReadonly",(e,t)=>{Md.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function kf(e){return new bf({type:"readonly",innerType:e})}const _f=v("ZodCustom",(e,t)=>{Ud.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bp(e,n)});function vf(e,t={}){return zp(_f,e,t)}function yf(e){return Ip(e)}const wf=de({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:ht(A()).optional(),failOnError:me().default(!0).optional(),timeout:Tt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Et(A(),A()).optional(),runOnBackground:me().optional()});de({name:A(),command:A(),success:me(),exitCode:Tt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:Tt(),failOnError:me()});const pn=de({path:A(),extraCommands:ht(wf).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:it(["free","in_use"]).optional()}),xf=fa("operation",[pn.extend({operation:st("create"),content:A().optional(),contentPath:A().optional(),encoding:it(["utf-8","base64"]).optional()}),pn.extend({operation:st("merge"),data:Et(A(),da()),mergeStrategy:it(["deep","shallow"]).optional(),arrayMergeStrategy:it(["concat","replace"]).optional()}),pn.extend({operation:st("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:me().optional()}),pn.extend({operation:st("delete"),ignoreIfMissing:me().optional()}),pn.extend({operation:st("createDirectory"),contentPath:A().optional(),mode:Tt().optional(),ignoreIfExists:me().optional()}),pn.extend({operation:st("download"),url:A().url(),headers:Et(A(),A()).optional(),timeout:Tt().min(1e3).max(3e5).optional()}),pn.extend({operation:st("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const Sf=de({type:it(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:de({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),Tf=de({type:it(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:da().describe("Hook-specific configuration")});de({command:A().optional().describe("Legacy — unused in SDK mode"),args:ht(A()).optional().describe("Legacy — unused in SDK mode"),env:Et(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:ht(xf).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:Sf.optional().describe("Schema for extracting result data"),postExecutionHooks:ht(Tf).optional().describe("Hooks to run after task completion"),executionMode:it(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:fa("executionMode",[de({executionMode:st("claudeAgentSdk"),promptText:A(),sdkOptions:de({model:A(),permissionMode:it(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ht(A()),allowDangerouslySkipPermissions:me(),persistSession:me(),streamSdkEvents:me().optional(),allowedTools:ht(A()).optional(),settings:de({enabledPlugins:Et(A(),me())}),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("opencodeSdk"),promptText:A(),sdkOptions:de({provider:A(),model:A(),allowedTools:ht(A()).optional(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("openaiAgentSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("codexSdk"),promptText:A(),sdkOptions:de({model:A().optional(),sandboxMode:it(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:it(["never","on-request","on-failure","untrusted"]).optional(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("cursorSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:me().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:me().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:me().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ht(de({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Tt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:Tt().optional(),notificationChannelFailedMessageId:Tt().optional(),streamSdkEvents:me().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:me().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ht(de({id:A(),selectedText:A(),startOffset:Tt(),endOffset:Tt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:me().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:me().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:it(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:me().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const va="browser_capture",Ef="browser_automate";async function ya(e){if(!e.ok){const t=await e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()}async function Ue(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return ya(a)}async function wa(e,t){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function gi(e,t,n,r,o,s,a=va,u){var d,h,p,b,m,_;return Ue(e,"POST","/tasks",{type:a,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",titleInstruction:u??n,projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(d=o==null?void 0:o.selectedPluginIds)!=null&&d.length?{selectedPluginIds:o.selectedPluginIds}:{},...(h=o==null?void 0:o.selectedSkillIds)!=null&&h.length?{selectedSkillIds:o.selectedSkillIds}:{},...(p=o==null?void 0:o.selectedPluginSkillIds)!=null&&p.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(b=o==null?void 0:o.selectedMcpServerIds)!=null&&b.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(m=o==null?void 0:o.selectedSlashCommandIds)!=null&&m.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(_=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&_.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:a,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt,interactionSteps:r.interactionSteps}})}async function xa(e,t,n,r,o,s,a){return gi(e,t,n,r,o,s,Ef,a)}async function Sa(e,t,n,r){return Ue(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function Af(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)}async function Ta(e,t){return Ue(e,"GET",`/tasks/${t}`)}async function Cf(e,t){return Ue(e,"GET",`/planning-sessions/${t}`)}async function Pf(e){return Ue(e,"GET","/projects")}async function Rf(e,t,n){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return ya(s)}async function Lf(e,t){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function zf(e,t,n,r,o){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function If(e,t){return Ue(e,"GET",`/tasks/${t}/chunks`)}async function $f(e,t,n){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Nf(e,t){return Ue(e,"POST",`/tasks/${t}/cancel`)}async function Of(e,t){return Ue(e,"POST",`/tasks/${t}/approve-result`)}async function Df(e,t,n){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function io(e,t){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function Ea(e,t,n,r){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}function Mf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Aa={exports:{}};/*!
1358
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const b=p[1];if(t===p[0]){i(p);continue}if(e.external){const _=(d=e.external.registry.get(p[0]))==null?void 0:d.id;if(t!==p[0]&&_){i(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){i(p);continue}if(b.cycle){i(p);continue}if(b.count>1&&e.reused==="ref"){i(p);continue}}}function la(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const p=e.seen.get(h);if(p.ref===null)return;const b=p.def??p.schema,m={...b},_=p.ref;if(p.ref=null,_){r(_);const C=e.seen.get(_),M=C.schema;if(M.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(M)):Object.assign(b,M),Object.assign(b,m),h._zod.parent===_)for(const P in b)P==="$ref"||P==="allOf"||P in m||delete b[P];if(M.$ref)for(const P in b)P==="$ref"||P==="allOf"||P in C.def&&JSON.stringify(b[P])===JSON.stringify(C.def[P])&&delete b[P]}const y=h._zod.parent;if(y&&y!==_){r(y);const C=e.seen.get(y);if(C!=null&&C.schema.$ref&&(b.$ref=C.schema.$ref,C.def))for(const M in b)M==="$ref"||M==="allOf"||M in C.def&&JSON.stringify(b[M])===JSON.stringify(C.def[M])&&delete b[M]}e.override({zodSchema:h,jsonSchema:b,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const i=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(i[p.defId]=p.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:oo(t,"input",e.processors),output:oo(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function He(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return He(r.element,n);if(r.type==="set")return He(r.valueType,n);if(r.type==="lazy")return He(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return He(r.innerType,n);if(r.type==="intersection")return He(r.left,n)||He(r.right,n);if(r.type==="record"||r.type==="map")return He(r.keyType,n)||He(r.valueType,n);if(r.type==="pipe")return He(r.in,n)||He(r.out,n);if(r.type==="object"){for(const o in r.shape)if(He(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(He(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(He(o,n))return!0;return!!(r.rest&&He(r.rest,n))}return!1}const qp=(e,t={})=>n=>{const r=aa({...n,processors:t});return xe(e,r),ca(r,e),la(r,e)},oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=aa({...o??{},target:i,io:t,processors:n});return xe(e,a),ca(a,e),la(a,e)},Hp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:u,patterns:d,contentEncoding:h}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Hp[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),h&&(o.contentEncoding=h),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},Bp=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:u,multipleOf:d,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof i=="number"&&(o.minimum=i,typeof p=="number"&&t.target!=="draft-04"&&(p>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},Gp=(e,t,n,r)=>{n.type="boolean"},Wp=(e,t,n,r)=>{n.not={}},Jp=(e,t,n,r)=>{},Yp=(e,t,n,r)=>{},Vp=(e,t,n,r)=>{const o=e._zod.def,i=Si(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Xp=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},Kp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Qp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},eh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=xe(i.element,t,{...r,path:[...r.path,"items"]})},th=(e,t,n,r)=>{var h;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const p in a)o.properties[p]=xe(a[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(p=>{const b=i.shape[p]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((h=i.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=xe(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},nh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((u,d)=>xe(u,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));i?n.oneOf=a:n.anyOf=a},rh=(e,t,n,r)=>{const o=e._zod.def,i=xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,d=[...u(i)?i.allOf:[i],...u(a)?a.allOf:[a]];n.allOf=d},oh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(i.mode==="loose"&&d&&d.size>0){const p=xe(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=xe(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=xe(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(b=>typeof b=="string"||typeof b=="number");p.length>0&&(o.required=p)}},sh=(e,t,n,r)=>{const o=e._zod.def,i=xe(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},ih=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},ah=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},ch=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},lh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},uh=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(i,t,r);const a=t.seen.get(e);a.ref=i},dh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ua=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},ph=v("ZodISODateTime",(e,t)=>{ud.init(e,t),ke.init(e,t)});function hh(e){return bp(ph,e)}const fh=v("ZodISODate",(e,t)=>{dd.init(e,t),ke.init(e,t)});function gh(e){return kp(fh,e)}const mh=v("ZodISOTime",(e,t)=>{pd.init(e,t),ke.init(e,t)});function bh(e){return _p(mh,e)}const kh=v("ZodISODuration",(e,t)=>{hd.init(e,t),ke.init(e,t)});function _h(e){return vp(kh,e)}const rt=v("ZodError",(e,t)=>{Ri.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ru(e,n)},flatten:{value:n=>nu(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ss,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ss,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),vh=ls(rt),yh=us(rt),wh=Kr(rt),xh=Qr(rt),Sh=iu(rt),Th=au(rt),Eh=cu(rt),Ah=lu(rt),Ch=uu(rt),Ph=du(rt),Rh=pu(rt),Lh=hu(rt),ge=v("ZodType",(e,t)=>(he.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:oo(e,"input"),output:oo(e,"output")}}),e.toJSONSchema=qp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Vt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Xt(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>vh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>wh(e,n,r),e.parseAsync=async(n,r)=>yh(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>xh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Sh(e,n,r),e.decode=(n,r)=>Th(e,n,r),e.encodeAsync=async(n,r)=>Eh(e,n,r),e.decodeAsync=async(n,r)=>Ah(e,n,r),e.safeEncode=(n,r)=>Ch(e,n,r),e.safeDecode=(n,r)=>Ph(e,n,r),e.safeEncodeAsync=async(n,r)=>Rh(e,n,r),e.safeDecodeAsync=async(n,r)=>Lh(e,n,r),e.refine=(n,r)=>e.check(Af(n,r)),e.superRefine=n=>e.check(Cf(n)),e.overwrite=n=>e.check(qn(n)),e.optional=()=>va(e),e.exactOptional=()=>ff(e),e.nullable=()=>ya(e),e.nullish=()=>va(ya(e)),e.nonoptional=n=>vf(e,n),e.array=()=>ht(e),e.or=n=>of([e,n]),e.and=n=>cf(e,n),e.transform=n=>xa(e,pf(n)),e.default=n=>bf(e,n),e.prefault=n=>_f(e,n),e.catch=n=>wf(e,n),e.pipe=n=>xa(e,n),e.readonly=()=>Tf(e),e.describe=n=>{const r=e.clone();return gr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=gr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return gr.get(e);const r=e.clone();return gr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),da=v("_ZodString",(e,t)=>{ds.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Fp(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Ap(...r)),e.includes=(...r)=>e.check(Rp(...r)),e.startsWith=(...r)=>e.check(Lp(...r)),e.endsWith=(...r)=>e.check(Ip(...r)),e.min=(...r)=>e.check(ro(...r)),e.max=(...r)=>e.check(sa(...r)),e.length=(...r)=>e.check(ia(...r)),e.nonempty=(...r)=>e.check(ro(1,...r)),e.lowercase=r=>e.check(Cp(r)),e.uppercase=r=>e.check(Pp(r)),e.trim=()=>e.check($p()),e.normalize=(...r)=>e.check(zp(...r)),e.toLowerCase=()=>e.check(Op()),e.toUpperCase=()=>e.check(Np()),e.slugify=()=>e.check(Dp())}),Ih=v("ZodString",(e,t)=>{ds.init(e,t),da.init(e,t),e.email=n=>e.check(Vd(zh,n)),e.url=n=>e.check(tp($h,n)),e.jwt=n=>e.check(mp(Yh,n)),e.emoji=n=>e.check(np(Oh,n)),e.guid=n=>e.check(ta(pa,n)),e.uuid=n=>e.check(Xd(so,n)),e.uuidv4=n=>e.check(Kd(so,n)),e.uuidv6=n=>e.check(Qd(so,n)),e.uuidv7=n=>e.check(ep(so,n)),e.nanoid=n=>e.check(rp(Nh,n)),e.guid=n=>e.check(ta(pa,n)),e.cuid=n=>e.check(op(Dh,n)),e.cuid2=n=>e.check(sp(Mh,n)),e.ulid=n=>e.check(ip(Uh,n)),e.base64=n=>e.check(hp(Gh,n)),e.base64url=n=>e.check(fp(Wh,n)),e.xid=n=>e.check(ap(jh,n)),e.ksuid=n=>e.check(cp(Zh,n)),e.ipv4=n=>e.check(lp(qh,n)),e.ipv6=n=>e.check(up(Hh,n)),e.cidrv4=n=>e.check(dp(Fh,n)),e.cidrv6=n=>e.check(pp(Bh,n)),e.e164=n=>e.check(gp(Jh,n)),e.datetime=n=>e.check(hh(n)),e.date=n=>e.check(gh(n)),e.time=n=>e.check(bh(n)),e.duration=n=>e.check(_h(n))});function A(e){return Yd(Ih,e)}const ke=v("ZodStringFormat",(e,t)=>{fe.init(e,t),da.init(e,t)}),zh=v("ZodEmail",(e,t)=>{td.init(e,t),ke.init(e,t)}),pa=v("ZodGUID",(e,t)=>{Qu.init(e,t),ke.init(e,t)}),so=v("ZodUUID",(e,t)=>{ed.init(e,t),ke.init(e,t)}),$h=v("ZodURL",(e,t)=>{nd.init(e,t),ke.init(e,t)}),Oh=v("ZodEmoji",(e,t)=>{rd.init(e,t),ke.init(e,t)}),Nh=v("ZodNanoID",(e,t)=>{od.init(e,t),ke.init(e,t)}),Dh=v("ZodCUID",(e,t)=>{sd.init(e,t),ke.init(e,t)}),Mh=v("ZodCUID2",(e,t)=>{id.init(e,t),ke.init(e,t)}),Uh=v("ZodULID",(e,t)=>{ad.init(e,t),ke.init(e,t)}),jh=v("ZodXID",(e,t)=>{cd.init(e,t),ke.init(e,t)}),Zh=v("ZodKSUID",(e,t)=>{ld.init(e,t),ke.init(e,t)}),qh=v("ZodIPv4",(e,t)=>{fd.init(e,t),ke.init(e,t)}),Hh=v("ZodIPv6",(e,t)=>{gd.init(e,t),ke.init(e,t)}),Fh=v("ZodCIDRv4",(e,t)=>{md.init(e,t),ke.init(e,t)}),Bh=v("ZodCIDRv6",(e,t)=>{bd.init(e,t),ke.init(e,t)}),Gh=v("ZodBase64",(e,t)=>{kd.init(e,t),ke.init(e,t)}),Wh=v("ZodBase64URL",(e,t)=>{vd.init(e,t),ke.init(e,t)}),Jh=v("ZodE164",(e,t)=>{yd.init(e,t),ke.init(e,t)}),Yh=v("ZodJWT",(e,t)=>{xd.init(e,t),ke.init(e,t)}),ha=v("ZodNumber",(e,t)=>{Zi.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Bp(e,r,o),e.gt=(r,o)=>e.check(ra(r,o)),e.gte=(r,o)=>e.check(fs(r,o)),e.min=(r,o)=>e.check(fs(r,o)),e.lt=(r,o)=>e.check(na(r,o)),e.lte=(r,o)=>e.check(hs(r,o)),e.max=(r,o)=>e.check(hs(r,o)),e.int=r=>e.check(fa(r)),e.safe=r=>e.check(fa(r)),e.positive=r=>e.check(ra(0,r)),e.nonnegative=r=>e.check(fs(0,r)),e.negative=r=>e.check(na(0,r)),e.nonpositive=r=>e.check(hs(0,r)),e.multipleOf=(r,o)=>e.check(oa(r,o)),e.step=(r,o)=>e.check(oa(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Tt(e){return yp(ha,e)}const Vh=v("ZodNumberFormat",(e,t)=>{Sd.init(e,t),ha.init(e,t)});function fa(e){return wp(Vh,e)}const Xh=v("ZodBoolean",(e,t)=>{Td.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gp(e,n,r)});function me(e){return xp(Xh,e)}const Kh=v("ZodAny",(e,t)=>{Ed.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jp()});function ga(){return Sp(Kh)}const Qh=v("ZodUnknown",(e,t)=>{Ad.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yp()});function ma(){return Tp(Qh)}const ef=v("ZodNever",(e,t)=>{Cd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wp(e,n,r)});function tf(e){return Ep(ef,e)}const nf=v("ZodArray",(e,t)=>{Pd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(ro(n,r)),e.nonempty=n=>e.check(ro(1,n)),e.max=(n,r)=>e.check(sa(n,r)),e.length=(n,r)=>e.check(ia(n,r)),e.unwrap=()=>e.element});function ht(e,t){return Mp(nf,e,t)}const rf=v("ZodObject",(e,t)=>{Ld.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>th(e,n,r,o),K(e,"shape",()=>t.shape),e.keyof=()=>ot(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ma()}),e.loose=()=>e.clone({...e._zod.def,catchall:ma()}),e.strict=()=>e.clone({...e._zod.def,catchall:tf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Xl(e,n),e.safeExtend=n=>Kl(e,n),e.merge=n=>Ql(e,n),e.pick=n=>Yl(e,n),e.omit=n=>Vl(e,n),e.partial=(...n)=>eu(_a,e,n[0]),e.required=(...n)=>tu(wa,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...O(t)};return new rf(n)}const ba=v("ZodUnion",(e,t)=>{Gi.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nh(e,n,r,o),e.options=t.options});function of(e,t){return new ba({type:"union",options:e,...O(t)})}const sf=v("ZodDiscriminatedUnion",(e,t)=>{ba.init(e,t),Id.init(e,t)});function ka(e,t,n){return new sf({type:"union",options:t,discriminator:e,...O(n)})}const af=v("ZodIntersection",(e,t)=>{zd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rh(e,n,r,o)});function cf(e,t){return new af({type:"intersection",left:e,right:t})}const lf=v("ZodRecord",(e,t)=>{$d.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Et(e,t,n){return new lf({type:"record",keyType:e,valueType:t,...O(n)})}const gs=v("ZodEnum",(e,t)=>{Od.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Vp(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new gs({...t,checks:[],...O(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new gs({...t,checks:[],...O(o),entries:i})}});function ot(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new gs({type:"enum",entries:n,...O(t)})}const uf=v("ZodLiteral",(e,t)=>{Nd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xp(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function st(e,t){return new uf({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const df=v("ZodTransform",(e,t)=>{Dd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new wi(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(fr(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(fr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function pf(e){return new df({type:"transform",transform:e})}const _a=v("ZodOptional",(e,t)=>{Yi.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ua(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function va(e){return new _a({type:"optional",innerType:e})}const hf=v("ZodExactOptional",(e,t)=>{Md.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ua(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ff(e){return new hf({type:"optional",innerType:e})}const gf=v("ZodNullable",(e,t)=>{Ud.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ya(e){return new gf({type:"nullable",innerType:e})}const mf=v("ZodDefault",(e,t)=>{jd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ah(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bf(e,t){return new mf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ci(t)}})}const kf=v("ZodPrefault",(e,t)=>{Zd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _f(e,t){return new kf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ci(t)}})}const wa=v("ZodNonOptional",(e,t)=>{qd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ih(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new wa({type:"nonoptional",innerType:e,...O(t)})}const yf=v("ZodCatch",(e,t)=>{Hd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wf(e,t){return new yf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const xf=v("ZodPipe",(e,t)=>{Fd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r,o),e.in=t.in,e.out=t.out});function xa(e,t){return new xf({type:"pipe",in:e,out:t})}const Sf=v("ZodReadonly",(e,t)=>{Bd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tf(e){return new Sf({type:"readonly",innerType:e})}const Ef=v("ZodCustom",(e,t)=>{Gd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kp(e,n)});function Af(e,t={}){return Up(Ef,e,t)}function Cf(e){return jp(e)}const Pf=de({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:ht(A()).optional(),failOnError:me().default(!0).optional(),timeout:Tt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Et(A(),A()).optional(),runOnBackground:me().optional()});de({name:A(),command:A(),success:me(),exitCode:Tt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:Tt(),failOnError:me()});const pn=de({path:A(),extraCommands:ht(Pf).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:ot(["free","in_use"]).optional()}),Rf=ka("operation",[pn.extend({operation:st("create"),content:A().optional(),contentPath:A().optional(),encoding:ot(["utf-8","base64"]).optional()}),pn.extend({operation:st("merge"),data:Et(A(),ga()),mergeStrategy:ot(["deep","shallow"]).optional(),arrayMergeStrategy:ot(["concat","replace"]).optional()}),pn.extend({operation:st("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:me().optional()}),pn.extend({operation:st("delete"),ignoreIfMissing:me().optional()}),pn.extend({operation:st("createDirectory"),contentPath:A().optional(),mode:Tt().optional(),ignoreIfExists:me().optional()}),pn.extend({operation:st("download"),url:A().url(),headers:Et(A(),A()).optional(),timeout:Tt().min(1e3).max(3e5).optional()}),pn.extend({operation:st("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const Lf=de({type:ot(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:de({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),If=de({type:ot(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:ga().describe("Hook-specific configuration")});de({command:A().optional().describe("Legacy — unused in SDK mode"),args:ht(A()).optional().describe("Legacy — unused in SDK mode"),env:Et(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:ht(Rf).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:Lf.optional().describe("Schema for extracting result data"),postExecutionHooks:ht(If).optional().describe("Hooks to run after task completion"),executionMode:ot(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:ka("executionMode",[de({executionMode:st("claudeAgentSdk"),promptText:A(),sdkOptions:de({model:A(),permissionMode:ot(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ht(A()),allowDangerouslySkipPermissions:me(),persistSession:me(),streamSdkEvents:me().optional(),allowedTools:ht(A()).optional(),settings:de({enabledPlugins:Et(A(),me())}),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("opencodeSdk"),promptText:A(),sdkOptions:de({provider:A(),model:A(),allowedTools:ht(A()).optional(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("openaiAgentSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("codexSdk"),promptText:A(),sdkOptions:de({model:A().optional(),sandboxMode:ot(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ot(["never","on-request","on-failure","untrusted"]).optional(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("cursorSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:me().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:me().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:me().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ht(de({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Tt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:Tt().optional(),notificationChannelFailedMessageId:Tt().optional(),streamSdkEvents:me().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:me().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ht(de({id:A(),selectedText:A(),startOffset:Tt(),endOffset:Tt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:me().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:me().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ot(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:me().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const Sa="browser_capture",zf="browser_automate";async function Ta(e){if(!e.ok){const t=await e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()}const $f=3e4;async function io(e,t={},n=$f){const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):i}finally{clearTimeout(o)}}async function Ue(e,t,n,r){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await io(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ta(a)}async function Ea(e,t){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}const Of=["projectId","note","ctx"];function Nf(e){const t=Of.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}async function ms(e,t){var h,p,b,m,_,y;Nf(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:u,type:d=Sa}=t;return Ue(e,"POST","/tasks",{type:d,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:u??r,projectId:n,autoAssign:!0,...i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{},...(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{},...(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{},...(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{},...(i==null?void 0:i.effort)!=null?{effort:i.effort}:{},...(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{},...(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{},...(p=i==null?void 0:i.selectedSkillIds)!=null&&p.length?{selectedSkillIds:i.selectedSkillIds}:{},...(b=i==null?void 0:i.selectedPluginSkillIds)!=null&&b.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{},...(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{},...(_=i==null?void 0:i.selectedSlashCommandIds)!=null&&_.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{},...(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{},metadata:{type:d,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}})}async function Aa(e,t){return ms(e,{...t,type:zf})}async function Ca(e,t,n,r){return Ue(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function Df(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)}async function Pa(e,t){return Ue(e,"GET",`/tasks/${t}`)}async function Mf(e,t){return Ue(e,"GET",`/planning-sessions/${t}`)}async function Ra(e){return Ue(e,"GET","/projects")}async function La(e,t,n){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=await io(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ta(i)}async function Uf(e,t){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function jf(e,t,n,r,o){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Zf(e,t){return Ue(e,"GET",`/tasks/${t}/chunks`)}async function qf(e,t,n){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Hf(e,t){return Ue(e,"POST",`/tasks/${t}/cancel`)}async function Ff(e,t){return Ue(e,"POST",`/tasks/${t}/approve-result`)}async function Bf(e,t,n){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function ao(e,t){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function Ia(e,t,n,r){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bs={exports:{}};/*!
1386
1359
  * Pusher JavaScript Library v8.5.0
1387
1360
  * https://pusher.com/
1388
1361
  *
1389
1362
  * Copyright 2020, Pusher
1390
1363
  * Released under the MIT licence.
1391
- */(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||function(){var P=function(T,x){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var pe in D)D.hasOwnProperty(pe)&&(R[pe]=D[pe])},P(T,x)};return function(T,x){P(T,x);function R(){this.constructor=T}T.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}}();Object.defineProperty(u,"__esModule",{value:!0});var h=256,p=function(){function P(T){T===void 0&&(T="="),this._paddingCharacter=T}return P.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},P.prototype.encode=function(T){for(var x="",R=0;R<T.length-2;R+=3){var D=T[R]<<16|T[R+1]<<8|T[R+2];x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),x+=this._encodeByte(D>>>1*6&63),x+=this._encodeByte(D>>>0*6&63)}var pe=T.length-R;if(pe>0){var D=T[R]<<16|(pe===2?T[R+1]<<8:0);x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),pe===2?x+=this._encodeByte(D>>>1*6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},P.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},P.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},P.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(T),R=T.length-x,D=new Uint8Array(this.maxDecodedLength(R)),pe=0,_e=0,Ce=0,Ve=0,V=0,Pe=0,Ze=0;_e<R-4;_e+=4)Ve=this._decodeChar(T.charCodeAt(_e+0)),V=this._decodeChar(T.charCodeAt(_e+1)),Pe=this._decodeChar(T.charCodeAt(_e+2)),Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Ve<<2|V>>>4,D[pe++]=V<<4|Pe>>>2,D[pe++]=Pe<<6|Ze,Ce|=Ve&h,Ce|=V&h,Ce|=Pe&h,Ce|=Ze&h;if(_e<R-1&&(Ve=this._decodeChar(T.charCodeAt(_e)),V=this._decodeChar(T.charCodeAt(_e+1)),D[pe++]=Ve<<2|V>>>4,Ce|=Ve&h,Ce|=V&h),_e<R-2&&(Pe=this._decodeChar(T.charCodeAt(_e+2)),D[pe++]=V<<4|Pe>>>2,Ce|=Pe&h),_e<R-3&&(Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Pe<<6|Ze,Ce|=Ze&h),Ce!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},P.prototype._encodeByte=function(T){var x=T;return x+=65,x+=25-T>>>8&6,x+=51-T>>>8&-75,x+=61-T>>>8&-15,x+=62-T>>>8&3,String.fromCharCode(x)},P.prototype._decodeChar=function(T){var x=h;return x+=(42-T&T-44)>>>8&-h+T-43+62,x+=(46-T&T-48)>>>8&-h+T-47+63,x+=(47-T&T-58)>>>8&-h+T-48+52,x+=(64-T&T-91)>>>8&-h+T-65+0,x+=(96-T&T-123)>>>8&-h+T-97+26,x},P.prototype._getPaddingLength=function(T){var x=0;if(this._paddingCharacter){for(var R=T.length-1;R>=0&&T[R]===this._paddingCharacter;R--)x++;if(T.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},P}();u.Coder=p;var b=new p;function m(P){return b.encode(P)}u.encode=m;function _(P){return b.decode(P)}u.decode=_;var w=function(P){d(T,P);function T(){return P!==null&&P.apply(this,arguments)||this}return T.prototype._encodeByte=function(x){var R=x;return R+=65,R+=25-x>>>8&6,R+=51-x>>>8&-75,R+=61-x>>>8&-13,R+=62-x>>>8&49,String.fromCharCode(R)},T.prototype._decodeChar=function(x){var R=h;return R+=(44-x&x-46)>>>8&-h+x-45+62,R+=(94-x&x-96)>>>8&-h+x-95+63,R+=(47-x&x-58)>>>8&-h+x-48+52,R+=(64-x&x-91)>>>8&-h+x-65+0,R+=(96-x&x-123)>>>8&-h+x-97+26,R},T}(p);u.URLSafeCoder=w;var C=new w;function M(P){return C.encode(P)}u.encodeURLSafe=M;function W(P){return C.decode(P)}u.decodeURLSafe=W,u.encodedLength=function(P){return b.encodedLength(P)},u.maxDecodedLength=function(P){return b.maxDecodedLength(P)},u.decodedLength=function(P){return b.decodedLength(P)}},978(a,u){var d="utf8: invalid source encoding";function h(p){for(var b=[],m=0;m<p.length;m++){var _=p[m];if(_&128){var w=void 0;if(_<224){if(m>=p.length)throw new Error(d);var C=p[++m];if((C&192)!==128)throw new Error(d);_=(_&31)<<6|C&63,w=128}else if(_<240){if(m>=p.length-1)throw new Error(d);var C=p[++m],M=p[++m];if((C&192)!==128||(M&192)!==128)throw new Error(d);_=(_&15)<<12|(C&63)<<6|M&63,w=2048}else if(_<248){if(m>=p.length-2)throw new Error(d);var C=p[++m],M=p[++m],W=p[++m];if((C&192)!==128||(M&192)!==128||(W&192)!==128)throw new Error(d);_=(_&15)<<18|(C&63)<<12|(M&63)<<6|W&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=h},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>Yo});class h{constructor(i,c){this.lastId=0,this.prefix=i,this.name=c}create(i){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=b;class _{constructor(i){this.options=i,this.receivers=i.receivers||p,this.loading={}}load(i,c,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=F.createScriptRequest(g.getPath(i,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var H=g.loading[i];delete g.loading[i];for(var X=function(Ee){Ee||y.cleanup()},te=0;te<H.length;te++)H[te]($,X)}});y.send(E)}}getRoot(i){var c,f=F.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,c){return this.getRoot(c)+"/"+i+this.options.suffix+".js"}}var w=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),C=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const M={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},P={buildLogSuffix:function(l){const i="See:",c=M.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=M.baseUrl+c.path),f?`${i} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class x extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class pe extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Ce extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Ve extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(i,c){super(c),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const _t=function(l,i,c,f,g){const y=F.createXHR();y.open("POST",c.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)y.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,H=!1;try{$=JSON.parse(y.responseText),H=!0}catch{g(new Pe(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}H&&g(null,$)}else{let $="";switch(f){case T.UserAuthentication:$=P.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${P.buildLogSuffix("authorizationEndpoint")}`;break}g(new Pe(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${c.endpoint}. ${$}`),null)}},y.send(i),y};function on(l){return J(K(l))}var rt=String.fromCharCode,Zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?rt(192|i>>>6)+rt(128|i&63):rt(224|i>>>12&15)+rt(128|i>>>6&63)+rt(128|i&63)},K=function(l){return l.replace(/[^\x00-\x7F]/g,Z)},De=function(l){var i=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Zt.charAt(c>>>18),Zt.charAt(c>>>12&63),i>=2?"=":Zt.charAt(c>>>6&63),i>=1?"=":Zt.charAt(c&63)];return f.join("")},J=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,De)};class vt{constructor(i,c,f,g){this.clear=c,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const oe=vt;function Sn(l){window.clearTimeout(l)}function ce(l){window.clearInterval(l)}class ie extends oe{constructor(i,c){super(setTimeout,Sn,i,function(f){return c(),null})}}class Re extends oe{constructor(i,c){super(setInterval,ce,i,function(f){return c(),f})}}var Le={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new ie(0,l)},method(l,...i){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Le;function Te(l,...i){for(var c=0;c<i.length;c++){var f=i[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=Te(l[g]||{},f[g]):l[g]=f[g]}return l}function tt(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Ye(arguments[i]));return l.join(" : ")}function lt(l,i){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function ze(l,i){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&i(l[c],c,l)}function ut(l){var i=[];return ze(l,function(c,f){i.push(f)}),i}function qt(l){var i=[];return ze(l,function(c){i.push(c)}),i}function Ht(l,i,c){for(var f=0;f<l.length;f++)i.call(c||window,l[f],f,l)}function nr(l,i){for(var c=[],f=0;f<l.length;f++)c.push(i(l[f],f,l,c));return c}function sn(l,i){var c={};return ze(l,function(f,g){c[g]=i(f)}),c}function Tn(l,i){i=i||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)i(l[f],f,l,c)&&c.push(l[f]);return c}function En(l,i){var c={};return ze(l,function(f,g){(i&&i(f,g,l,c)||f)&&(c[g]=f)}),c}function Do(l){var i=[];return ze(l,function(c,f){i.push([f,c])}),i}function zr(l,i){for(var c=0;c<l.length;c++)if(i(l[c],c,l))return!0;return!1}function Yi(l,i){for(var c=0;c<l.length;c++)if(!i(l[c],c,l))return!1;return!0}function Ir(l){return sn(l,function(i){return typeof i=="object"&&(i=Ye(i)),encodeURIComponent(on(i.toString()))})}function An(l){var i=En(l,function(f){return f!==void 0}),c=nr(Do(Ir(i)),ee.method("join","=")).join("&");return c}function an(l){var i=[],c=[];return function f(g,y){var E,$,H;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:c[E]};if(i.push(g),c.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(H=[],E=0;E<g.length;E+=1)H[E]=f(g[E],y+"["+E+"]");else{H={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(H[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return H;case"number":case"string":case"boolean":return g}}(l,"$")}function Ye(l){try{return JSON.stringify(l)}catch{return JSON.stringify(an(l))}}class $r{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...c){var f=tt.apply(this,arguments);Yo.log?Yo.log(f):Yo.logToConsole&&i.bind(this)(f)}}const le=new $r;var Mo=function(l,i,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&le.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(te){g(null,te)};var H="Pusher.auth_callbacks['"+y+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(H)+"&"+i;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const Nr=Mo;class Uo{constructor(i){this.src=i}send(i){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=i.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){i.callback(f)},c.script.onload=function(){i.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&i.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=i.id+"_error",c.errorScript.text=i.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class rr{constructor(i,c){this.url=i,this.data=c}send(i){if(!this.request){var c=An(this.data),f=this.url+"/"+i.number+"?"+c;this.request=F.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var or=function(l,i){return function(c,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=F.createJSONPRequest(y,c),$=F.ScriptReceivers.create(function(H,X){p.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(H,X)});E.send($)}},yt={name:"jsonp",getAgent:or};const cn=yt;function Cn(l,i,c){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+c}function Pn(l,i){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return c+f}var Ki={getInitial:function(l,i){var c=(i.httpPath||"")+Pn(l,"flash=false");return Cn("ws",i,c)}},ir={getInitial:function(l,i){var c=(i.httpPath||"/pusher")+Pn(l);return Cn("http",i,c)}},sr={getInitial:function(l,i){return Cn("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return Pn(l)}};class Qi{constructor(){this._callbacks={}}get(i){return this._callbacks[Ft(i)]}add(i,c,f){var g=Ft(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(i,c,f){if(!i&&!c&&!f){this._callbacks={};return}var g=i?[Ft(i)]:ut(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(i,c,f){Ht(i,function(g){this._callbacks[g]=Tn(this._callbacks[g]||[],function(y){return c&&c!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){Ht(i,function(c){delete this._callbacks[c]},this)}}function Ft(l){return"_"+l}class wt{constructor(i){this.callbacks=new Qi,this.global_callbacks=[],this.failThrough=i}bind(i,c,f){return this.callbacks.add(i,c,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,c,f){return this.callbacks.remove(i,c,f),this}unbind_global(i){return i?(this.global_callbacks=Tn(this.global_callbacks||[],c=>c!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,c);var y=this.callbacks.get(i),E=[];if(f?E.push(c,f):c&&E.push(c),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,c);return this}}class es extends wt{constructor(i,c,f,g,y){super(),this.initialize=F.transportConnectionInitializer,this.hooks=i,this.name=c,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),le.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(i)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(i,c){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:c})),this.emit(i,c)}buildTimelineMessage(i){return Te({cid:this.id},i)}}class ue{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,c,f,g){return new es(this.hooks,i,c,f,g)}}var ln=new ue({urls:Ki,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(l){return F.createWebSocket(l)}}),jo={urls:ir,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Or=Te({getSocket:function(l){return F.HTTPFactory.createStreamingSocket(l)}},jo),ar=Te({getSocket:function(l){return F.HTTPFactory.createPollingSocket(l)}},jo),Dr={isSupported:function(){return F.isXHRSupported()}},Zo=new ue(Te({},Or,Dr)),ts=new ue(Te({},ar,Dr)),dt={ws:ln,xhr_streaming:Zo,xhr_polling:ts};const pt=dt;var qo=new ue({file:"sockjs",urls:sr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,i){return new window.SockJS(l,null,{js_path:C.getPath("sockjs",{useTLS:i.useTLS}),ignore_null_origin:i.ignoreNullOrigin})},beforeOpen:function(l,i){l.send(JSON.stringify({path:i}))}}),Mr={isSupported:function(l){var i=F.isXDRSupported(l.useTLS);return i}},Ur=new ue(Te({},Or,Mr)),Ho=new ue(Te({},ar,Mr));pt.xdr_streaming=Ur,pt.xdr_polling=Ho,pt.sockjs=qo;const xt=pt;class Fo extends wt{constructor(){super();var i=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){i.emit("online")},!1),window.addEventListener("offline",function(){i.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Bo=new Fo;class Go{constructor(i,c,f){this.manager=i,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,c,f,g){g=Te({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,c,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",H),E=ee.now()},H=X=>{if(y.unbind("closed",H),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var te=ee.now()-E;te<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(te/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const jr={decodeMessage:function(l){try{var i=JSON.parse(l.data),c=i.data;if(typeof c=="string")try{c=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:c};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=jr.decodeMessage(l);if(i.event==="pusher:connection_established"){if(!i.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:i.data.socket_id,activityTimeout:i.data.activity_timeout*1e3}}else{if(i.event==="pusher:error")return{action:this.getCloseAction(i.data),error:this.getCloseError(i.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Bt=jr;class O extends wt{constructor(i,c){super(),this.id=i,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,c,f){var g={event:i,data:c};return f&&(g.channel=f),le.debug("Event sent",g),this.send(Bt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var i={message:f=>{var g;try{g=Bt.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(le.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{ze(i,(f,g)=>{this.transport.unbind(g,f)})};ze(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var c=Bt.getCloseAction(i),f=Bt.getCloseError(i);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class k{constructor(i,c){this.transport=i,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var c;try{c=Bt.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new O(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var c=Bt.getCloseAction(i)||"backoff",f=Bt.getCloseError(i);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(i,c){this.callback(Te({transport:this.transport,action:i},c))}}class S{constructor(i,c){this.timeline=i,this.options=c||{}}send(i,c){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,i),c)}}class L extends wt{constructor(i,c){super(function(f,g){le.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,c){return c(null,{auth:""})}trigger(i,c){if(i.indexOf("client-")!==0)throw new x("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=P.buildLogSuffix("triggeringClientEvents");le.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var c=i.event,f=i.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,c)=>{i?(this.subscriptionPending=!1,le.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof Pe?{status:i.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class se extends L{authorize(i,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},c)}}class $e{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){ze(this.members,(c,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var c=this.get(i.user_id);return c&&(delete this.members[i.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,i,c,f){function g(y){return y instanceof c?y:new c(function(E){E(y)})}return new(c||(c=Promise))(function(y,E){function $(te){try{X(f.next(te))}catch(Ee){E(Ee)}}function H(te){try{X(f.throw(te))}catch(Ee){E(Ee)}}function X(te){te.done?y(te.value):g(te.value).then($,H)}X((f=f.apply(l,i||[])).next())})};class qe extends se{constructor(i,c){super(i,c),this.members=new $e}authorize(i,c){super.authorize(i,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=P.buildLogSuffix("authorizationEndpoint");le.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(i){var c=i.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(c,f,g)}}handleInternalEvent(i){var c=i.event,f=i.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var St=d(978),zt=d(594);class Zr extends se{constructor(i,c,f){super(i,c),this.key=null,this.nacl=f}authorize(i,c){super.authorize(i,(f,g)=>{if(f){c(f,g);return}let y=g.shared_secret;if(!y){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,zt.decode)(y),delete g.shared_secret,c(null,g)})}trigger(i,c){throw new Ce("Client events are not currently supported for encrypted channels")}handleEvent(i){var c=i.event,f=i.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(i,c){if(!this.key){le.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){le.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,zt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){le.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,zt.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){le.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){le.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){le.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){le.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let c=(0,St.D4)(i);try{return JSON.parse(c)}catch{return c}}}class Ie extends wt{constructor(i,c){super(),this.state="initialized",this.connection=null,this.key=i,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=F.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(i){this.key=i,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(i){return this.connection?this.connection.send(i):!1}send_event(i,c,f){return this.connection?this.connection.send_event(i,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(c,f)=>{c?this.runner=this.strategy.connect(0,i):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new ie(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new ie(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new ie(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new ie(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return Te({},i,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(i){return Te({},i,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let i=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var c=this.connection;return this.connection=null,c}}updateState(i,c){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+c.socket_id),le.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:c}),this.emit("state_change",{previous:f,current:i}),this.emit(i,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Wo{constructor(){this.channels={}}add(i,c){return this.channels[i]||(this.channels[i]=Jo(i,c)),this.channels[i]}all(){return qt(this.channels)}find(i){return this.channels[i]}remove(i){var c=this.channels[i];return delete this.channels[i],c}disconnect(){ze(this.channels,function(i){i.disconnect()})}}function Jo(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Gt.createEncryptedChannel(l,i,i.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=P.buildLogSuffix("encryptedChannelSupport");throw new Ce(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Gt.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Gt.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new R('Cannot create a channel with name "'+l+'".');return Gt.createChannel(l,i)}}var Ab={createChannels(){return new Wo},createConnectionManager(l,i){return new Ie(l,i)},createChannel(l,i){return new L(l,i)},createPrivateChannel(l,i){return new se(l,i)},createPresenceChannel(l,i){return new qe(l,i)},createEncryptedChannel(l,i,c){return new Zr(l,i,c)},createTimelineSender(l,i){return new S(l,i)},createHandshake(l,i){return new k(l,i)},createAssistantToTheTransportManager(l,i,c){return new Go(l,i,c)}};const Gt=Ab;class nl{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Gt.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Rn{constructor(i,c){this.strategies=i,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return zr(this.strategies,ee.method("isSupported"))}connect(i,c){var f=this.strategies,g=0,y=this.timeout,E=null,$=(H,X)=>{X?c(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(H){i=H,E&&E.forceMinPriority(H)}}}tryStrategy(i,c,f,g){var y=null,E=null;return f.timeout>0&&(y=new ie(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(c,function($,H){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,H))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class ns{constructor(i){this.strategies=i}isSupported(){return zr(this.strategies,ee.method("isSupported"))}connect(i,c){return Cb(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){Pb(g)&&c(!0);return}Ht(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function Cb(l,i,c){var f=nr(l,function(g,y,E,$){return g.connect(i,c(y,$))});return{abort:function(){Ht(f,Rb)},forceMinPriority:function(g){Ht(f,function(y){y.forceMinPriority(g)})}}}function Pb(l){return Yi(l,function(i){return!!i.error})}function Rb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Lb{constructor(i,c,f){this.strategy=i,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.usingTLS,g=zb(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ee.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new Rn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var H=ee.now(),X=E.pop().connect(i,function te(Ee,Ko){Ee?(rl(f),E.length>0?(H=ee.now(),X=E.pop().connect(i,te)):c(Ee)):(Ib(f,Ko.transport.name,ee.now()-H,y),c(null,Ko))});return{abort:function(){X.abort()},forceMinPriority:function(te){i=te,X&&X.forceMinPriority(te)}}}}function rs(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function zb(l){var i=F.getLocalStorage();if(i)try{var c=i[rs(l)];if(c)return JSON.parse(c)}catch{rl(l)}return null}function Ib(l,i,c,f){var g=F.getLocalStorage();if(g)try{g[rs(l)]=Ye({timestamp:ee.now(),transport:i,latency:c,cacheSkipCount:f})}catch{}}function rl(l){var i=F.getLocalStorage();if(i)try{delete i[rs(l)]}catch{}}class Xo{constructor(i,{delay:c}){this.strategy=i,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy,g,y=new ie(this.options.delay,function(){g=f.connect(i,c)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class qr{constructor(i,c,f){this.test=i,this.trueBranch=c,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,c)}}class $b{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),c(g,y)});return f}}function Hr(l){return function(){return l.isSupported()}}var Nb=function(l,i,c){var f={};function g(ml,zk,Ik,$k,Nk){var bl=c(l,ml,zk,Ik,$k,Nk);return f[ml]=bl,bl}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),H={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new nl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),te=new nl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ee=g("ws","ws",3,y,X),Ko=g("wss","ws",3,E,X),Ak=g("sockjs","sockjs",1,$),ul=g("xhr_streaming","xhr_streaming",1,$,te),Ck=g("xdr_streaming","xdr_streaming",1,$,te),dl=g("xhr_polling","xhr_polling",1,$),Pk=g("xdr_polling","xdr_polling",1,$),pl=new Rn([Ee],H),Rk=new Rn([Ko],H),Lk=new Rn([Ak],H),hl=new Rn([new qr(Hr(ul),ul,Ck)],H),fl=new Rn([new qr(Hr(dl),dl,Pk)],H),gl=new Rn([new qr(Hr(hl),new ns([hl,new Xo(fl,{delay:4e3})]),fl)],H),ss=new qr(Hr(gl),gl,Lk),as;return i.useTLS?as=new ns([pl,new Xo(ss,{delay:2e3})]):as=new ns([pl,new Xo(Rk,{delay:2e3}),new Xo(ss,{delay:5e3})]),new Lb(new $b(new qr(Hr(Ee),as,ss)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const Ob=Nb;function Db(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),C.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(i&&l.onError(i),l.onClose(),c(!1))})):l.onClose()}var Mb={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new D),l.close()},i.onerror=function(c){l.emit("error",c),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Ub=Mb,jb=256*1024;class Zb extends wt{constructor(i,c,f){super(),this.hooks=i,this.method=c,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(i){var c=i.slice(this.position),f=c.indexOf(`
1392
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>jb}}var os;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(os||(os={}));const Ln=os;var qb=1;class Hb{constructor(i,c){this.hooks=i,this.session=il(1e3)+"/"+Wb(8),this.location=Fb(c),this.readyState=Ln.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,c){this.onClose(i,c,!0)}sendRaw(i){if(this.readyState===Ln.OPEN)try{return F.createSocketRequest("POST",ol(Bb(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,c,f){this.closeStream(),this.readyState=Ln.CLOSED,this.onclose&&this.onclose({code:i,reason:c,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===Ln.OPEN&&this.onActivity();var c,f=i.data.slice(0,1);switch(f){case"o":c=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(i.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(i.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(i){this.readyState===Ln.CONNECTING?(i&&i.hostname&&(this.location.base=Gb(this.location.base,i.hostname)),this.readyState=Ln.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===Ln.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=F.createSocketRequest("POST",ol(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){ee.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Fb(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function Bb(l,i){return l.base+"/"+i+"/xhr_send"}function ol(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+qb++}function Gb(l,i){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+i+c[3]}function il(l){return F.randomInt(l)}function Wb(l){for(var i=[],c=0;c<l;c++)i.push(il(32).toString(32));return i.join("")}const Jb=Hb;var Xb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Vb=Xb;var Yb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){i===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Kb=Yb;var Qb={getRequest:function(l){var i=F.getXHRAPI(),c=new i;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const ek=Qb;var tk={createStreamingSocket(l){return this.createSocket(Vb,l)},createPollingSocket(l){return this.createSocket(Kb,l)},createSocket(l,i){return new Jb(l,i)},createXHR(l,i){return this.createRequest(ek,l,i)},createRequest(l,i,c){return new Zb(l,i,c)}};const sl=tk;sl.createXDR=function(l,i){return this.createRequest(Ub,l,i)};var nk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:w,getDefaultStrategy:Ob,Transports:xt,transportConnectionInitializer:Db,HTTPFactory:sl,TimelineTransport:cn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var i=()=>{this.onDocumentBody(l.ready)};window.JSON?i():C.load("json2",{},i)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:_t,jsonp:Nr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new rr(l,i)},createScriptRequest(l){return new Uo(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Bo},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===i},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const F=nk;var is;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(is||(is={}));const Vo=is;class rk{constructor(i,c,f){this.key=i,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,c){i<=this.options.level&&(this.events.push(Te({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log(Vo.ERROR,i)}info(i){this.log(Vo.INFO,i)}debug(i){this.log(Vo.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,c){var f=Te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],i(f,(g,y)=>{g||this.sent++,c&&c(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class ok{constructor(i,c,f,g){this.name=i,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,c){if(this.isSupported()){if(this.priority<i)return al(new pe,c)}else return al(new V,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Gt.createHandshake(g,function(Ee){f=!0,te(),c(null,Ee)})},H=function(Ee){te(),c(Ee)},X=function(){te();var Ee;Ee=Ye(g),c(new _e(Ee))},te=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",H),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",H),g.bind("closed",X),g.initialize(),{abort:()=>{f||(te(),y?y.close():g.close())},forceMinPriority:Ee=>{f||this.priority<Ee&&(y?y.close():g.close())}}}}function al(l,i){return ee.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:ik}=F;var sk=function(l,i,c,f,g,y){var E=ik[c];if(!E)throw new Ve(c);var $=(!l.enabledTransports||lt(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||lt(l.disabledTransports,i)===-1),H;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),H=new ok(i,f,y?y.getAssistant(E):E,g)):H=ak,H},ak={isSupported:function(){return!1},connect:function(l,i){var c=ee.defer(function(){i(new V)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function ck(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&le.warn("The disableStats option is deprecated in favor of enableStats")}const lk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},uk=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=lk(i,l);F.getAuthorizers()[l.transport](F,f,l,T.UserAuthentication,c)}},dk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},pk=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=dk(i,l);F.getAuthorizers()[l.transport](F,f,l,T.ChannelAuthorization,c)}},hk=(l,i,c)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,y)}};function cl(l,i){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:kk(l),httpHost:fk(l),useTLS:bk(l),wsHost:gk(l),userAuthenticator:_k(l),channelAuthorizer:yk(l,i)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function fk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function gk(l){return l.wsHost?l.wsHost:mk(l.cluster)}function mk(l){return`ws-${l}.pusher.com`}function bk(l){return F.getProtocol()==="https:"?!0:l.forceTLS!==!1}function kk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const ll=l=>"customHandler"in l&&l.customHandler!=null;function _k(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return ll(i)?i.customHandler:uk(i)}function vk(l,i){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:hk(i,c,l.authorizer)};return c}function yk(l,i){const c=vk(l,i);return ll(c)?c.customHandler:pk(c)}class wk extends wt{constructor(i){super(function(c,f){le.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var c=i.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function xk(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const Sk=xk;class Tk extends wt{constructor(i){super(function(c,f){le.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){le.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new wk(i),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(i){try{this.user_data=JSON.parse(i.user_data)}catch{le.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){le.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),i(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:i,resolve:c}=Sk();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=c}}class Me{static ready(){Me.isReady=!0;for(var i=0,c=Me.instances.length;i<c;i++)Me.instances[i].connect()}static getClientFeatures(){return ut(En({ws:F.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,c){Ek(i),ck(c),this.key=i,this.options=c,this.config=cl(this.options,this),this.channels=Gt.createChannels(),this.global_emitter=new wt,this.sessionID=F.randomInt(1e9),this.timeline=new rk(this.key,this.sessionID,{cluster:this.config.cluster,features:Me.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Vo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Gt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var f=g=>F.getDefaultStrategy(this.config,g,sk);this.connection=Gt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{le.warn(g)}),Me.instances.push(this),this.timeline.info({instances:Me.instances.length}),this.user=new Tk(this),Me.isReady&&this.connect()}switchCluster(i){const{appKey:c,cluster:f}=i;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=cl(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Re(6e4,function(){c.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,c,f){return this.global_emitter.bind(i,c,f),this}unbind(i,c,f){return this.global_emitter.unbind(i,c,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var c=this.channels.add(i,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(i){var c=this.channels.find(i);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(i),c&&c.subscribed&&c.unsubscribe())}send_event(i,c,f){return this.connection.send_event(i,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Me.instances=[],Me.isReady=!1,Me.logToConsole=!1,Me.Runtime=F,Me.ScriptReceivers=F.ScriptReceivers,Me.DependenciesReceivers=F.DependenciesReceivers,Me.auth_callbacks=F.auth_callbacks;const Yo=Me;function Ek(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(Me)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var s=o(721);return s})())})(Aa);var Uf=Aa.exports;const jf=Mf(Uf),so={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};let ft=null,qn=null;async function Zf(e){return qn||(qn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();ft=new jf(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:s},a)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),qn.catch(()=>{qn=null}),qn)}function qf(e){if(!e||!ft)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return ft.connection.bind("state_change",n),()=>ft==null?void 0:ft.connection.unbind("state_change",n)}async function Hf(e,t,n){if(await Zf(e),!ft)return()=>{};const r=ft.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(so.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(so.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(so.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(so.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=qf(n.onReconnect);return()=>{r.unbind_all(),ft==null||ft.unsubscribe(`private-task-${t}`),o==null||o()}}const mi="ap-sdk-active-automation";function Ff(){try{const e=sessionStorage.getItem(mi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function Ca(e){try{sessionStorage.setItem(mi,JSON.stringify(e))}catch{}}function Pa(){try{sessionStorage.removeItem(mi)}catch{}}async function Bf(e){var s;try{(s=e.focus)==null||s.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await Gf(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()}function Gf(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const bi="shared",Ra="ap-sdk-panel-size:",La=280,za=200;function Wf(e){try{const t=sessionStorage.getItem(Ra+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function Jf(e,t){try{sessionStorage.setItem(Ra+e,JSON.stringify(t))}catch{}}function ao(e,t,n){return Math.min(Math.max(e,t),n)}function Ia(){return window.innerWidth-32}function $a(){return window.innerHeight-64}function ki(e,t){const n=Wf(t);n&&(e.style.width=`${ao(n.width,La,Ia())}px`,e.style.height=`${ao(n.height,za,$a())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,a=0,u=0,d=0,h=0,p=0;const b=_=>{o&&(h=ao(u+(_.clientX-s),La,Ia()),p=ao(d+(_.clientY-a),za,$a()),e.style.width=`${h}px`,e.style.height=`${p}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),Jf(t,{width:h,height:p}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,a=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,h=u,p=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function _i(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var hn=_i();function Na(e){hn=e}var fn={exec:()=>null};function Hn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Xf=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Hn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Hn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}>`))},Vf=/^(?:[ \t]*(?:\n|$))+/,Yf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Kf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Oa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Da=G(Oa).replace(/bull/g,vi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),eg=G(Oa).replace(/bull/g,vi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),yi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,tg=/^[^\n]+/,wi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ng=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rg=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,vi).getRegex(),co="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",xi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,og=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",xi).replace("tag",co).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ma=e=>G(yi).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),ig=Ma(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),sg=Ma(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ag=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",sg).getRegex(),Si={blockquote:ag,code:Yf,def:ng,fences:Kf,heading:Qf,hr:fr,html:og,lheading:Da,list:rg,newline:Vf,paragraph:ig,table:fn,text:tg},Ua=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),cg={...Si,lheading:eg,table:Ua,paragraph:G(yi).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ua).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex()},lg={...Si,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xi).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(yi).replace("hr",fr).replace("heading",` *#{1,6} *[^
1393
- ]`).replace("lheading",Da).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ug=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ja=/^( {2,}|\\)\n(?!\s*$)/,pg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ot=/[\p{P}\p{S}]/u,Fn=/[\s\p{P}\p{S}]/u,gr=/[^\s\p{P}\p{S}]/u,hg=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Fn).getRegex(),fg=/[\p{Pi}\p{Ps}"']/u,Za=/(?!~)[\p{P}\p{S}]/u,gg=/(?!~)[\s\p{P}\p{S}]/u,mg=/(?:[^\s\p{P}\p{S}]|~)/u,bg=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),qa=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kg=G(qa,"u").replace(/punct/g,Ot).getRegex(),_g=G(qa,"u").replace(/punct/g,Za).getRegex(),vg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,yg=G(vg,"u").replace(/openQuote/g,fg).replace(/punct/g,Ot).getRegex(),Ha="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",wg=G(Ha,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Fn).replace(/punct/g,Ot).getRegex(),xg=G(Ha,"gu").replace(/notPunctSpace/g,mg).replace(/punctSpace/g,gg).replace(/punct/g,Za).getRegex(),Sg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Tg=G(Sg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Fn).replace(/punct/g,Ot).getRegex(),Eg=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Fn).replace(/punct/g,Ot).getRegex(),Ag="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Cg=G(Ag,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Fn).replace(/punct/g,Ot).getRegex(),Pg=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ot).getRegex(),Rg="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Lg=G(Rg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Fn).replace(/punct/g,Ot).getRegex(),zg=G(/\\(punct)/,"gu").replace(/punct/g,Ot).getRegex(),Ig=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$g=G(xi).replace("(?:-->|$)","-->").getRegex(),Ng=G("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$g).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),lo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Og=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",lo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fa=G(/^!?\[(label)\]\[(ref)\]/).replace("label",lo).replace("ref",wi).getRegex(),Ba=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",wi).getRegex(),Dg=G("reflink|nolink(?!\\()","g").replace("reflink",Fa).replace("nolink",Ba).getRegex(),Ga=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ti={_backpedal:fn,anyPunctuation:zg,autolink:Ig,blockSkip:bg,br:ja,code:dg,del:fn,delLDelim:fn,delRDelim:fn,emStrongLDelim:kg,emStrongRDelimAst:wg,emStrongRDelimUnd:Eg,escape:ug,link:Og,nolink:Ba,punctuation:hg,reflink:Fa,reflinkSearch:Dg,tag:Ng,text:pg,url:fn},Mg={...Ti,emStrongLDelim:yg,emStrongRDelimAst:Tg,emStrongRDelimUnd:Cg,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",lo).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",lo).getRegex()},Ei={...Ti,emStrongRDelimAst:xg,emStrongLDelim:_g,delLDelim:Pg,delRDelim:Lg,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ga).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ga).getRegex()},Ug={...Ei,br:G(ja).replace("{2,}","*").getRegex(),text:G(Ei.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},uo={normal:Si,gfm:cg,pedantic:lg},mr={normal:Ti,gfm:Ei,breaks:Ug,pedantic:Mg},jg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Wa=e=>jg[e];function At(e,t){if(t){if(je.escapeTest.test(e))return e.replace(je.escapeReplace,Wa)}else if(je.escapeTestNoEncode.test(e))return e.replace(je.escapeReplaceNoEncode,Wa);return e}function Ja(e){try{e=encodeURI(e).replace(je.percentDecode,"%")}catch{return null}return e}function Xa(e,t){var s;let n=e.replace(je.findPipe,(a,u,d)=>{let h=!1,p=u;for(;--p>=0&&d[p]==="\\";)h=!h;return h?"|":" |"}),r=n.split(je.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(je.slashPipe,"|");return r}function Kt(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function Va(e){let t=e.split(`
1364
+ */var za;function Wf(){return za||(za=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||(function(){var P=function(T,x){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var pe in D)D.hasOwnProperty(pe)&&(R[pe]=D[pe])},P(T,x)};return function(T,x){P(T,x);function R(){this.constructor=T}T.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}})();Object.defineProperty(u,"__esModule",{value:!0});var h=256,p=(function(){function P(T){T===void 0&&(T="="),this._paddingCharacter=T}return P.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},P.prototype.encode=function(T){for(var x="",R=0;R<T.length-2;R+=3){var D=T[R]<<16|T[R+1]<<8|T[R+2];x+=this._encodeByte(D>>>18&63),x+=this._encodeByte(D>>>12&63),x+=this._encodeByte(D>>>6&63),x+=this._encodeByte(D>>>0&63)}var pe=T.length-R;if(pe>0){var D=T[R]<<16|(pe===2?T[R+1]<<8:0);x+=this._encodeByte(D>>>18&63),x+=this._encodeByte(D>>>12&63),pe===2?x+=this._encodeByte(D>>>6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},P.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},P.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},P.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(T),R=T.length-x,D=new Uint8Array(this.maxDecodedLength(R)),pe=0,_e=0,Ce=0,Ve=0,X=0,Pe=0,Ze=0;_e<R-4;_e+=4)Ve=this._decodeChar(T.charCodeAt(_e+0)),X=this._decodeChar(T.charCodeAt(_e+1)),Pe=this._decodeChar(T.charCodeAt(_e+2)),Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Ve<<2|X>>>4,D[pe++]=X<<4|Pe>>>2,D[pe++]=Pe<<6|Ze,Ce|=Ve&h,Ce|=X&h,Ce|=Pe&h,Ce|=Ze&h;if(_e<R-1&&(Ve=this._decodeChar(T.charCodeAt(_e)),X=this._decodeChar(T.charCodeAt(_e+1)),D[pe++]=Ve<<2|X>>>4,Ce|=Ve&h,Ce|=X&h),_e<R-2&&(Pe=this._decodeChar(T.charCodeAt(_e+2)),D[pe++]=X<<4|Pe>>>2,Ce|=Pe&h),_e<R-3&&(Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Pe<<6|Ze,Ce|=Ze&h),Ce!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},P.prototype._encodeByte=function(T){var x=T;return x+=65,x+=25-T>>>8&6,x+=51-T>>>8&-75,x+=61-T>>>8&-15,x+=62-T>>>8&3,String.fromCharCode(x)},P.prototype._decodeChar=function(T){var x=h;return x+=(42-T&T-44)>>>8&-h+T-43+62,x+=(46-T&T-48)>>>8&-h+T-47+63,x+=(47-T&T-58)>>>8&-h+T-48+52,x+=(64-T&T-91)>>>8&-h+T-65+0,x+=(96-T&T-123)>>>8&-h+T-97+26,x},P.prototype._getPaddingLength=function(T){var x=0;if(this._paddingCharacter){for(var R=T.length-1;R>=0&&T[R]===this._paddingCharacter;R--)x++;if(T.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},P})();u.Coder=p;var b=new p;function m(P){return b.encode(P)}u.encode=m;function _(P){return b.decode(P)}u.decode=_;var y=(function(P){d(T,P);function T(){return P!==null&&P.apply(this,arguments)||this}return T.prototype._encodeByte=function(x){var R=x;return R+=65,R+=25-x>>>8&6,R+=51-x>>>8&-75,R+=61-x>>>8&-13,R+=62-x>>>8&49,String.fromCharCode(R)},T.prototype._decodeChar=function(x){var R=h;return R+=(44-x&x-46)>>>8&-h+x-45+62,R+=(94-x&x-96)>>>8&-h+x-95+63,R+=(47-x&x-58)>>>8&-h+x-48+52,R+=(64-x&x-91)>>>8&-h+x-65+0,R+=(96-x&x-123)>>>8&-h+x-97+26,R},T})(p);u.URLSafeCoder=y;var C=new y;function M(P){return C.encode(P)}u.encodeURLSafe=M;function J(P){return C.decode(P)}u.decodeURLSafe=J,u.encodedLength=function(P){return b.encodedLength(P)},u.maxDecodedLength=function(P){return b.maxDecodedLength(P)},u.decodedLength=function(P){return b.decodedLength(P)}},978(a,u){var d="utf8: invalid source encoding";function h(p){for(var b=[],m=0;m<p.length;m++){var _=p[m];if(_&128){var y=void 0;if(_<224){if(m>=p.length)throw new Error(d);var C=p[++m];if((C&192)!==128)throw new Error(d);_=(_&31)<<6|C&63,y=128}else if(_<240){if(m>=p.length-1)throw new Error(d);var C=p[++m],M=p[++m];if((C&192)!==128||(M&192)!==128)throw new Error(d);_=(_&15)<<12|(C&63)<<6|M&63,y=2048}else if(_<248){if(m>=p.length-2)throw new Error(d);var C=p[++m],M=p[++m],J=p[++m];if((C&192)!==128||(M&192)!==128||(J&192)!==128)throw new Error(d);_=(_&15)<<18|(C&63)<<12|(M&63)<<6|J&63,y=65536}else throw new Error(d);if(_<y||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=h},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>Ko});class h{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",w=!1,E=function(){w||(s.apply(null,arguments),w=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(s){delete this[s.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=b;class _{constructor(s){this.options=s,this.receivers=s.receivers||p,this.loading={}}load(s,c,f){var g=this;if(g.loading[s]&&g.loading[s].length>0)g.loading[s].push(f);else{g.loading[s]=[f];var w=F.createScriptRequest(g.getPath(s,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[s]){var H=g.loading[s];delete g.loading[s];for(var V=function(Ee){Ee||w.cleanup()},te=0;te<H.length;te++)H[te]($,V)}});w.send(E)}}getRoot(s){var c,f=F.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),C=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const M={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},P={buildLogSuffix:function(l){const s="See:",c=M.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=M.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class x extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class pe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ce extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ve extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class X extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const _t=function(l,s,c,f,g){const w=F.createXHR();w.open("POST",c.endpoint,!0),w.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)w.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)w.setRequestHeader(E,$[E])}return w.onreadystatechange=function(){if(w.readyState===4)if(w.status===200){let $,H=!1;try{$=JSON.parse(w.responseText),H=!0}catch{g(new Pe(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${w.responseText}`),null)}H&&g(null,$)}else{let $="";switch(f){case T.UserAuthentication:$=P.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${P.buildLogSuffix("authorizationEndpoint")}`;break}g(new Pe(w.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${w.status} from ${c.endpoint}. ${$}`),null)}},w.send(s),w};function sn(l){return Y(Q(l))}var nt=String.fromCharCode,Zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?nt(192|s>>>6)+nt(128|s&63):nt(224|s>>>12&15)+nt(128|s>>>6&63)+nt(128|s&63)},Q=function(l){return l.replace(/[^\x00-\x7F]/g,Z)},De=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Zt.charAt(c>>>18),Zt.charAt(c>>>12&63),s>=2?"=":Zt.charAt(c>>>6&63),s>=1?"=":Zt.charAt(c&63)];return f.join("")},Y=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,De)};class vt{constructor(s,c,f,g){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const oe=vt;function Tn(l){window.clearTimeout(l)}function ce(l){window.clearInterval(l)}class se extends oe{constructor(s,c){super(setTimeout,Tn,s,function(f){return c(),null})}}class Re extends oe{constructor(s,c){super(setInterval,ce,s,function(f){return c(),f})}}var Le={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new se(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Le;function Te(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=Te(l[g]||{},f[g]):l[g]=f[g]}return l}function et(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(Xe(arguments[s]));return l.join(" : ")}function lt(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,g=l.length;f<g;f++)if(l[f]===s)return f;return-1}function Ie(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function ut(l){var s=[];return Ie(l,function(c,f){s.push(f)}),s}function qt(l){var s=[];return Ie(l,function(c){s.push(c)}),s}function Ht(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function rr(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function an(l,s){var c={};return Ie(l,function(f,g){c[g]=s(f)}),c}function En(l,s){s=s||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function An(l,s){var c={};return Ie(l,function(f,g){(s&&s(f,g,l,c)||f)&&(c[g]=f)}),c}function Mo(l){var s=[];return Ie(l,function(c,f){s.push([f,c])}),s}function Ir(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function ei(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function zr(l){return an(l,function(s){return typeof s=="object"&&(s=Xe(s)),encodeURIComponent(sn(s.toString()))})}function Cn(l){var s=An(l,function(f){return f!==void 0}),c=rr(Mo(zr(s)),ee.method("join","=")).join("&");return c}function cn(l){var s=[],c=[];return(function f(g,w){var E,$,H;switch(typeof g){case"object":if(!g)return null;for(E=0;E<s.length;E+=1)if(s[E]===g)return{$ref:c[E]};if(s.push(g),c.push(w),Object.prototype.toString.apply(g)==="[object Array]")for(H=[],E=0;E<g.length;E+=1)H[E]=f(g[E],w+"["+E+"]");else{H={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(H[$]=f(g[$],w+"["+JSON.stringify($)+"]"))}return H;case"number":case"string":case"boolean":return g}})(l,"$")}function Xe(l){try{return JSON.stringify(l)}catch{return JSON.stringify(cn(l))}}class $r{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=et.apply(this,arguments);Ko.log?Ko.log(f):Ko.logToConsole&&s.bind(this)(f)}}const le=new $r;var Uo=function(l,s,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&le.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var w=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[w]=function(te){g(null,te)};var H="Pusher.auth_callbacks['"+w+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(H)+"&"+s;var V=E.getElementsByTagName("head")[0]||E.documentElement;V.insertBefore($,V.firstChild)};const Or=Uo;class jo{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class or{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=Cn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=F.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var sr=function(l,s){return function(c,f){var g="http"+(s?"s":"")+"://",w=g+(l.host||l.options.host)+l.options.path,E=F.createJSONPRequest(w,c),$=F.ScriptReceivers.create(function(H,V){p.remove($),E.cleanup(),V&&V.host&&(l.host=V.host),f&&f(H,V)});E.send($)}},yt={name:"jsonp",getAgent:sr};const ln=yt;function Pn(l,s,c){var f=l+(s.useTLS?"s":""),g=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+g+c}function Rn(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ti={getInitial:function(l,s){var c=(s.httpPath||"")+Rn(l,"flash=false");return Pn("ws",s,c)}},ir={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Rn(l);return Pn("http",s,c)}},ar={getInitial:function(l,s){return Pn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Rn(l)}};class ni{constructor(){this._callbacks={}}get(s){return this._callbacks[Ft(s)]}add(s,c,f){var g=Ft(s);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var g=s?[Ft(s)]:ut(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(s,c,f){Ht(s,function(g){this._callbacks[g]=En(this._callbacks[g]||[],function(w){return c&&c!==w.fn||f&&f!==w.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(s){Ht(s,function(c){delete this._callbacks[c]},this)}}function Ft(l){return"_"+l}class wt{constructor(s){this.callbacks=new ni,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=En(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](s,c);var w=this.callbacks.get(s),E=[];if(f?E.push(c,f):c&&E.push(c),w&&w.length>0)for(var g=0;g<w.length;g++)w[g].fn.apply(w[g].context||window,E);else this.failThrough&&this.failThrough(s,c);return this}}class ri extends wt{constructor(s,c,f,g,w){super(),this.initialize=F.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=g,this.options=w,this.state="new",this.timeline=w.timeline,this.activityTimeout=w.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),le.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Te({cid:this.id},s)}}class ue{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,g){return new ri(this.hooks,s,c,f,g)}}var un=new ue({urls:ti,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(l){return F.createWebSocket(l)}}),Zo={urls:ir,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Nr=Te({getSocket:function(l){return F.HTTPFactory.createStreamingSocket(l)}},Zo),cr=Te({getSocket:function(l){return F.HTTPFactory.createPollingSocket(l)}},Zo),Dr={isSupported:function(){return F.isXHRSupported()}},qo=new ue(Te({},Nr,Dr)),oi=new ue(Te({},cr,Dr)),dt={ws:un,xhr_streaming:qo,xhr_polling:oi};const pt=dt;var Ho=new ue({file:"sockjs",urls:ar,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:C.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Mr={isSupported:function(l){var s=F.isXDRSupported(l.useTLS);return s}},Ur=new ue(Te({},Nr,Mr)),Fo=new ue(Te({},cr,Mr));pt.xdr_streaming=Ur,pt.xdr_polling=Fo,pt.sockjs=Ho;const xt=pt;class Bo extends wt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Go=new Bo;class Wo{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,g){g=Te({},g,{activityTimeout:this.pingDelay});var w=this.transport.createConnection(s,c,f,g),E=null,$=function(){w.unbind("open",$),w.bind("closed",H),E=ee.now()},H=V=>{if(w.unbind("closed",H),V.code===1002||V.code===1003)this.manager.reportDeath();else if(!V.wasClean&&E){var te=ee.now()-E;te<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(te/2,this.minPingDelay))}};return w.bind("open",$),w}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const jr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch{}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=jr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Bt=jr;class N extends wt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var g={event:s,data:c};return f&&(g.channel=f),le.debug("Event sent",g),this.send(Bt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var g;try{g=Bt.decodeMessage(f)}catch(w){this.emit("error",{type:"MessageParseError",error:w,data:f.data})}if(g!==void 0){switch(le.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Ie(s,(f,g)=>{this.transport.unbind(g,f)})};Ie(s,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(s){var c=Bt.getCloseAction(s),f=Bt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class k{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Bt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new N(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Bt.getCloseAction(s)||"backoff",f=Bt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Te({transport:this.transport,action:s},c))}}class S{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,s),c)}}class L extends wt{constructor(s,c){super(function(f,g){le.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new x("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=P.buildLogSuffix("triggeringClientEvents");le.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,le.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Pe?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ie extends L{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class $e{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Ie(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,s,c,f){function g(w){return w instanceof c?w:new c(function(E){E(w)})}return new(c||(c=Promise))(function(w,E){function $(te){try{V(f.next(te))}catch(Ee){E(Ee)}}function H(te){try{V(f.throw(te))}catch(Ee){E(Ee)}}function V(te){te.done?w(te.value):g(te.value).then($,H)}V((f=f.apply(l,s||[])).next())})};class qe extends ie{constructor(s,c){super(s,c),this.members=new $e}authorize(s,c){super.authorize(s,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var w=JSON.parse(g.channel_data);this.members.setMyID(w.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=P.buildLogSuffix("authorizationEndpoint");le.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,g={};s.user_id&&(g.user_id=s.user_id),this.emit(c,f,g)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var w=this.members.removeMember(f);w&&this.emit("pusher:member_removed",w);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var St=d(978),zt=d(594);class Zr extends ie{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,g)=>{if(f){c(f,g);return}let w=g.shared_secret;if(!w){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,zt.decode)(w),delete g.shared_secret,c(null,g)})}trigger(s,c){throw new Ce("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){le.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){le.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,zt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){le.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,zt.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){le.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let w=this.nacl.secretbox.open(f,g,this.key);if(w===null){le.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){le.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(w=this.nacl.secretbox.open(f,g,this.key),w===null){le.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(w))});return}this.emit(s,this.getDataToEmit(w))}getDataToEmit(s){let c=(0,St.D4)(s);try{return JSON.parse(c)}catch{return c}}}class ze extends wt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=F.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new se(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new se(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new se(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new se(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Te({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Te({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var g=s;g==="connected"&&(g+=" with new socket ID "+c.socket_id),le.debug("State changed",f+" -> "+g),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Jo{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=Yo(s,c)),this.channels[s]}all(){return qt(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Ie(this.channels,function(s){s.disconnect()})}}function Yo(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Gt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=P.buildLogSuffix("encryptedChannelSupport");throw new Ce(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Gt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Gt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new R('Cannot create a channel with name "'+l+'".');return Gt.createChannel(l,s)}}var Ob={createChannels(){return new Jo},createConnectionManager(l,s){return new ze(l,s)},createChannel(l,s){return new L(l,s)},createPrivateChannel(l,s){return new ie(l,s)},createPresenceChannel(l,s){return new qe(l,s)},createEncryptedChannel(l,s,c){return new Zr(l,s,c)},createTimelineSender(l,s){return new S(l,s)},createHandshake(l,s){return new k(l,s)},createAssistantToTheTransportManager(l,s,c){return new Wo(l,s,c)}};const Gt=Ob;class cl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Gt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Ln{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Ir(this.strategies,ee.method("isSupported"))}connect(s,c){var f=this.strategies,g=0,w=this.timeout,E=null,$=(H,V)=>{V?c(null,V):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(w&&(w=w*2,this.timeoutLimit&&(w=Math.min(w,this.timeoutLimit))),E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],s,{timeout:w,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(H){s=H,E&&E.forceMinPriority(H)}}}tryStrategy(s,c,f,g){var w=null,E=null;return f.timeout>0&&(w=new se(f.timeout,function(){E.abort(),g(!0)})),E=s.connect(c,function($,H){$&&w&&w.isRunning()&&!f.failFast||(w&&w.ensureAborted(),g($,H))}),{abort:function(){w&&w.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class si{constructor(s){this.strategies=s}isSupported(){return Ir(this.strategies,ee.method("isSupported"))}connect(s,c){return Nb(this.strategies,s,function(f,g){return function(w,E){if(g[f].error=w,w){Db(g)&&c(!0);return}Ht(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function Nb(l,s,c){var f=rr(l,function(g,w,E,$){return g.connect(s,c(w,$))});return{abort:function(){Ht(f,Mb)},forceMinPriority:function(g){Ht(f,function(w){w.forceMinPriority(g)})}}}function Db(l){return ei(l,function(s){return!!s.error})}function Mb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Ub{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,g=jb(f),w=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ee.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||w>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new Ln([$],{timeout:g.latency*2+1e3,failFast:!0}))):w++)}var H=ee.now(),V=E.pop().connect(s,function te(Ee,Qo){Ee?(ll(f),E.length>0?(H=ee.now(),V=E.pop().connect(s,te)):c(Ee)):(Zb(f,Qo.transport.name,ee.now()-H,w),c(null,Qo))});return{abort:function(){V.abort()},forceMinPriority:function(te){s=te,V&&V.forceMinPriority(te)}}}}function ii(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function jb(l){var s=F.getLocalStorage();if(s)try{var c=s[ii(l)];if(c)return JSON.parse(c)}catch{ll(l)}return null}function Zb(l,s,c,f){var g=F.getLocalStorage();if(g)try{g[ii(l)]=Xe({timestamp:ee.now(),transport:s,latency:c,cacheSkipCount:f})}catch{}}function ll(l){var s=F.getLocalStorage();if(s)try{delete s[ii(l)]}catch{}}class Vo{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,g,w=new se(this.options.delay,function(){g=f.connect(s,c)});return{abort:function(){w.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){s=E,g&&g.forceMinPriority(E)}}}}class qr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class qb{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(g,w){w&&f.abort(),c(g,w)});return f}}function Hr(l){return function(){return l.isSupported()}}var Hb=function(l,s,c){var f={};function g(wl,jk,Zk,qk,Hk){var xl=c(l,wl,jk,Zk,qk,Hk);return f[wl]=xl,xl}var w=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},w,{useTLS:!0}),$=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),H={loop:!0,timeout:15e3,timeoutLimit:6e4},V=new cl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),te=new cl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ee=g("ws","ws",3,w,V),Qo=g("wss","ws",3,E,V),Ok=g("sockjs","sockjs",1,$),ml=g("xhr_streaming","xhr_streaming",1,$,te),Nk=g("xdr_streaming","xdr_streaming",1,$,te),bl=g("xhr_polling","xhr_polling",1,$),Dk=g("xdr_polling","xdr_polling",1,$),kl=new Ln([Ee],H),Mk=new Ln([Qo],H),Uk=new Ln([Ok],H),_l=new Ln([new qr(Hr(ml),ml,Nk)],H),vl=new Ln([new qr(Hr(bl),bl,Dk)],H),yl=new Ln([new qr(Hr(_l),new si([_l,new Vo(vl,{delay:4e3})]),vl)],H),li=new qr(Hr(yl),yl,Uk),ui;return s.useTLS?ui=new si([kl,new Vo(li,{delay:2e3})]):ui=new si([kl,new Vo(Mk,{delay:2e3}),new Vo(li,{delay:5e3})]),new Ub(new qb(new qr(Hr(Ee),ui,li)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Fb=Hb;function Bb(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),C.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var Gb={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new D),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Wb=Gb,Jb=256*1024;class Yb extends wt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Jb}}var ai;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(ai||(ai={}));const In=ai;var Vb=1;class Xb{constructor(s,c){this.hooks=s,this.session=dl(1e3)+"/"+tk(8),this.location=Kb(c),this.readyState=In.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===In.OPEN)try{return F.createSocketRequest("POST",ul(Qb(this.location,this.session))).start(s),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=In.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===In.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===In.CONNECTING?(s&&s.hostname&&(this.location.base=ek(this.location.base,s.hostname)),this.readyState=In.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===In.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=F.createSocketRequest("POST",ul(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ee.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Kb(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function Qb(l,s){return l.base+"/"+s+"/xhr_send"}function ul(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+Vb++}function ek(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function dl(l){return F.randomInt(l)}function tk(l){for(var s=[],c=0;c<l;c++)s.push(dl(32).toString(32));return s.join("")}const nk=Xb;var rk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const ok=rk;var sk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const ik=sk;var ak={getRequest:function(l){var s=F.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const ck=ak;var lk={createStreamingSocket(l){return this.createSocket(ok,l)},createPollingSocket(l){return this.createSocket(ik,l)},createSocket(l,s){return new nk(l,s)},createXHR(l,s){return this.createRequest(ck,l,s)},createRequest(l,s,c){return new Yb(l,s,c)}};const pl=lk;pl.createXDR=function(l,s){return this.createRequest(Wb,l,s)};var uk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:y,getDefaultStrategy:Fb,Transports:xt,transportConnectionInitializer:Bb,HTTPFactory:pl,TimelineTransport:ln,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():C.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:_t,jsonp:Or}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new or(l,s)},createScriptRequest(l){return new jo(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Go},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const F=uk;var ci;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(ci||(ci={}));const Xo=ci;class dk{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Te({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(Xo.ERROR,s)}info(s){this.log(Xo.INFO,s)}debug(s){this.log(Xo.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(g,w)=>{g||this.sent++,c&&c(g,w)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class pk{constructor(s,c,f,g){this.name=s,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return hl(new pe,c)}else return hl(new X,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),w=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){w=Gt.createHandshake(g,function(Ee){f=!0,te(),c(null,Ee)})},H=function(Ee){te(),c(Ee)},V=function(){te();var Ee;Ee=Xe(g),c(new _e(Ee))},te=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",H),g.unbind("closed",V)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",H),g.bind("closed",V),g.initialize(),{abort:()=>{f||(te(),w?w.close():g.close())},forceMinPriority:Ee=>{f||this.priority<Ee&&(w?w.close():g.close())}}}}function hl(l,s){return ee.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:hk}=F;var fk=function(l,s,c,f,g,w){var E=hk[c];if(!E)throw new Ve(c);var $=(!l.enabledTransports||lt(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||lt(l.disabledTransports,s)===-1),H;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),H=new pk(s,f,w?w.getAssistant(E):E,g)):H=gk,H},gk={isSupported:function(){return!1},connect:function(l,s){var c=ee.defer(function(){s(new X)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function mk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&le.warn("The disableStats option is deprecated in favor of enableStats")}const bk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},kk=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=bk(s,l);F.getAuthorizers()[l.transport](F,f,l,T.UserAuthentication,c)}},_k=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},vk=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=_k(s,l);F.getAuthorizers()[l.transport](F,f,l,T.ChannelAuthorization,c)}},yk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(g,w)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,w)}};function fl(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:Ek(l),httpHost:wk(l),useTLS:Tk(l),wsHost:xk(l),userAuthenticator:Ak(l),channelAuthorizer:Pk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function wk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function xk(l){return l.wsHost?l.wsHost:Sk(l.cluster)}function Sk(l){return`ws-${l}.pusher.com`}function Tk(l){return F.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Ek(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const gl=l=>"customHandler"in l&&l.customHandler!=null;function Ak(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return gl(s)?s.customHandler:kk(s)}function Ck(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:yk(s,c,l.authorizer)};return c}function Pk(l,s){const c=Ck(l,s);return gl(c)?c.customHandler:vk(c)}class Rk extends wt{constructor(s){super(function(c,f){le.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Lk(){let l,s;return{promise:new Promise((f,g)=>{l=f,s=g}),resolve:l,reject:s}}const Ik=Lk;class zk extends wt{constructor(s){super(function(c,f){le.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){le.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Rk(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch{le.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){le.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Ik();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Me{static ready(){Me.isReady=!0;for(var s=0,c=Me.instances.length;s<c;s++)Me.instances[s].connect()}static getClientFeatures(){return ut(An({ws:F.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){$k(s),mk(c),this.key=s,this.options=c,this.config=fl(this.options,this),this.channels=Gt.createChannels(),this.global_emitter=new wt,this.sessionID=F.randomInt(1e9),this.timeline=new dk(this.key,this.sessionID,{cluster:this.config.cluster,features:Me.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Xo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Gt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var f=g=>F.getDefaultStrategy(this.config,g,fk);this.connection=Gt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var w=g.event,E=w.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{le.warn(g)}),Me.instances.push(this),this.timeline.info({instances:Me.instances.length}),this.user=new zk(this),Me.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=fl(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Re(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Me.instances=[],Me.isReady=!1,Me.logToConsole=!1,Me.Runtime=F,Me.ScriptReceivers=F.ScriptReceivers,Me.DependenciesReceivers=F.DependenciesReceivers,Me.auth_callbacks=F.auth_callbacks;const Ko=Me;function $k(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(Me)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var i=o(721);return i})())})(bs)),bs.exports}var Jf=Wf();const Yf=Gf(Jf);let ft=null,Hn=null;async function Vf(e){return Hn||(Hn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await io(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();ft=new Yf(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{io(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),Hn.catch(()=>{Hn=null}),Hn)}function Xf(e){if(!e||!ft)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return ft.connection.bind("state_change",n),()=>ft==null?void 0:ft.connection.unbind("state_change",n)}async function Kf(e,t,n){if(await Vf(e),!ft)return()=>{};const r=ft.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(Yr.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(Yr.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(Yr.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(Yr.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Xf(n.onReconnect);return()=>{r.unbind_all(),ft==null||ft.unsubscribe(`private-task-${t}`),o==null||o()}}const ks="ap-sdk-active-automation";function Qf(){try{const e=sessionStorage.getItem(ks);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function $a(e){try{sessionStorage.setItem(ks,JSON.stringify(e))}catch{}}function Oa(){try{sessionStorage.removeItem(ks)}catch{}}async function eg(e){var i;try{(i=e.focus)==null||i.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await tg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()}function tg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const _s="shared",Na="ap-sdk-panel-size:",Da=280,Ma=200;function ng(e){try{const t=sessionStorage.getItem(Na+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function rg(e,t){try{sessionStorage.setItem(Na+e,JSON.stringify(t))}catch{}}function co(e,t,n){return Math.min(Math.max(e,t),n)}function Ua(){return window.innerWidth-32}function ja(){return window.innerHeight-64}function vs(e,t){const n=ng(t);n&&(e.style.width=`${co(n.width,Da,Ua())}px`,e.style.height=`${co(n.height,Ma,ja())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,u=0,d=0,h=0,p=0;const b=_=>{o&&(h=co(u+(_.clientX-i),Da,Ua()),p=co(d+(_.clientY-a),Ma,ja()),e.style.width=`${h}px`,e.style.height=`${p}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),rg(t,{width:h,height:p}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,i=_.clientX,a=_.clientY;const y=e.getBoundingClientRect();u=y.width,d=y.height,h=u,p=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function ys(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var hn=ys();function Za(e){hn=e}var fn={exec:()=>null};function Fn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var og=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Fn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Fn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}>`))},sg=/^(?:[ \t]*(?:\n|$))+/,ig=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ag=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,mr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ws=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,qa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ha=G(qa).replace(/bull/g,ws).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lg=G(qa).replace(/bull/g,ws).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ug=/^[^\n]+/,Ss=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,dg=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ss).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pg=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ws).getRegex(),lo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ts=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,hg=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ts).replace("tag",lo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Fa=e=>G(xs).replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lo).getRegex(),fg=Fa(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),gg=Fa(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),mg=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",gg).getRegex(),Es={blockquote:mg,code:ig,def:dg,fences:ag,heading:cg,hr:mr,html:hg,lheading:Ha,list:pg,newline:sg,paragraph:fg,table:fn,text:ug},Ba=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lo).getRegex(),bg={...Es,lheading:lg,table:Ba,paragraph:G(xs).replace("hr",mr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ba).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lo).getRegex()},kg={...Es,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ts).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(xs).replace("hr",mr).replace("heading",` *#{1,6} *[^
1366
+ ]`).replace("lheading",Ha).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_g=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ga=/^( {2,}|\\)\n(?!\s*$)/,yg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Nt=/[\p{P}\p{S}]/u,Bn=/[\s\p{P}\p{S}]/u,br=/[^\s\p{P}\p{S}]/u,wg=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Bn).getRegex(),xg=/[\p{Pi}\p{Ps}"']/u,Wa=/(?!~)[\p{P}\p{S}]/u,Sg=/(?!~)[\s\p{P}\p{S}]/u,Tg=/(?:[^\s\p{P}\p{S}]|~)/u,Eg=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",og?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ja=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ag=G(Ja,"u").replace(/punct/g,Nt).getRegex(),Cg=G(Ja,"u").replace(/punct/g,Wa).getRegex(),Pg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Rg=G(Pg,"u").replace(/openQuote/g,xg).replace(/punct/g,Nt).getRegex(),Ya="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Lg=G(Ya,"gu").replace(/notPunctSpace/g,br).replace(/punctSpace/g,Bn).replace(/punct/g,Nt).getRegex(),Ig=G(Ya,"gu").replace(/notPunctSpace/g,Tg).replace(/punctSpace/g,Sg).replace(/punct/g,Wa).getRegex(),zg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",$g=G(zg,"gu").replace(/notPunctSpace/g,br).replace(/punctSpace/g,Bn).replace(/punct/g,Nt).getRegex(),Og=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,br).replace(/punctSpace/g,Bn).replace(/punct/g,Nt).getRegex(),Ng="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Dg=G(Ng,"gu").replace(/notPunctSpace/g,br).replace(/punctSpace/g,Bn).replace(/punct/g,Nt).getRegex(),Mg=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Nt).getRegex(),Ug="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",jg=G(Ug,"gu").replace(/notPunctSpace/g,br).replace(/punctSpace/g,Bn).replace(/punct/g,Nt).getRegex(),Zg=G(/\\(punct)/,"gu").replace(/punct/g,Nt).getRegex(),qg=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Hg=G(Ts).replace("(?:-->|$)","-->").getRegex(),Fg=G("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Hg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),uo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Bg=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",uo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Va=G(/^!?\[(label)\]\[(ref)\]/).replace("label",uo).replace("ref",Ss).getRegex(),Xa=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ss).getRegex(),Gg=G("reflink|nolink(?!\\()","g").replace("reflink",Va).replace("nolink",Xa).getRegex(),Ka=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,As={_backpedal:fn,anyPunctuation:Zg,autolink:qg,blockSkip:Eg,br:Ga,code:vg,del:fn,delLDelim:fn,delRDelim:fn,emStrongLDelim:Ag,emStrongRDelimAst:Lg,emStrongRDelimUnd:Og,escape:_g,link:Bg,nolink:Xa,punctuation:wg,reflink:Va,reflinkSearch:Gg,tag:Fg,text:yg,url:fn},Wg={...As,emStrongLDelim:Rg,emStrongRDelimAst:$g,emStrongRDelimUnd:Dg,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",uo).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",uo).getRegex()},Cs={...As,emStrongRDelimAst:Ig,emStrongLDelim:Cg,delLDelim:Mg,delRDelim:jg,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ka).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ka).getRegex()},Jg={...Cs,br:G(Ga).replace("{2,}","*").getRegex(),text:G(Cs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},po={normal:Es,gfm:bg,pedantic:kg},kr={normal:As,gfm:Cs,breaks:Jg,pedantic:Wg},Yg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qa=e=>Yg[e];function At(e,t){if(t){if(je.escapeTest.test(e))return e.replace(je.escapeReplace,Qa)}else if(je.escapeTestNoEncode.test(e))return e.replace(je.escapeReplaceNoEncode,Qa);return e}function ec(e){try{e=encodeURI(e).replace(je.percentDecode,"%")}catch{return null}return e}function tc(e,t){var i;let n=e.replace(je.findPipe,(a,u,d)=>{let h=!1,p=u;for(;--p>=0&&d[p]==="\\";)h=!h;return h?"|":" |"}),r=n.split(je.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(je.slashPipe,"|");return r}function Qt(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function nc(e){let t=e.split(`
1394
1367
  `),n=t.length-1;for(;n>=0&&je.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1395
- `)}function Zg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qg(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=o,n++;return r}function Ya(e,t,n,r,o){let s=t.href,a=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function Hg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1396
- `).map(s=>{let a=s.match(n.other.beginningSpace);if(a===null)return s;let[u]=a;return u.length>=o.length?s.slice(o.length):s}).join(`
1397
- `)}var po=class{constructor(e){ae(this,"options");ae(this,"rules");ae(this,"lexer");this.options=e||hn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Va(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Hg(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Kt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Kt(t[0],`
1398
- `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Kt(t[0],`
1399
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Kt(t[0],`
1368
+ `)}function Vg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Xg(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function rc(e,t,n,r,o){let i=t.href,a=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function Kg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1369
+ `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[u]=a;return u.length>=o.length?i.slice(o.length):i}).join(`
1370
+ `)}var ho=class{constructor(e){ae(this,"options");ae(this,"rules");ae(this,"lexer");this.options=e||hn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:nc(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Kg(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Qt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Qt(t[0],`
1371
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Qt(t[0],`
1372
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Qt(t[0],`
1400
1373
  `).split(`
1401
- `),r="",o="",s=[];for(;n.length>0;){let a=!1,u=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))u.push(n[d]),a=!0;else if(!a)u.push(n[d]);else break;n=n.slice(d);let h=u.join(`
1374
+ `),r="",o="",i=[];for(;n.length>0;){let a=!1,u=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))u.push(n[d]),a=!0;else if(!a)u.push(n[d]);else break;n=n.slice(d);let h=u.join(`
1402
1375
  `),p=h.replace(this.rules.other.blockquoteSetextReplace,`
1403
1376
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
1404
1377
  ${h}`:h,o=o?`${o}
1405
- ${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=b,n.length===0)break;let m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,w=n.join(`
1378
+ ${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=b,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,y=n.join(`
1406
1379
  `),C=_.raw+`
1407
- `+w.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(C);s[s.length-1]=M,r=`${r}
1408
- ${w}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,w=_.raw+`
1380
+ `+y.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(C);i[i.length-1]=M,r=`${r}
1381
+ ${y}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,y=_.raw+`
1409
1382
  `+n.join(`
1410
- `),C=this.list(w);s[s.length-1]=C,r=r.substring(0,r.length-m.raw.length)+C.raw,o=o.substring(0,o.length-_.raw.length)+C.raw,n=w.substring(s.at(-1).raw.length).split(`
1411
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,h="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let b=qg(t[2].split(`
1383
+ `),C=this.list(y);i[i.length-1]=C,r=r.substring(0,r.length-m.raw.length)+C.raw,o=o.substring(0,o.length-_.raw.length)+C.raw,n=y.substring(i.at(-1).raw.length).split(`
1384
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,h="",p="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let b=Xg(t[2].split(`
1412
1385
  `,1)[0],t[1].length),m=e.split(`
1413
- `,1)[0],_=!b.trim(),w=0;if(this.options.pedantic?(w=2,p=b.trimStart()):_?w=t[1].length+1:(w=b.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=b.slice(w),w+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(h+=m+`
1414
- `,e=e.substring(m.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(w),M=this.rules.other.hrRegex(w),W=this.rules.other.fencesBeginRegex(w),P=this.rules.other.headingBeginRegex(w),T=this.rules.other.htmlBeginRegex(w),x=this.rules.other.blockquoteBeginRegex(w);for(;e;){let R=e.split(`
1415
- `,1)[0],D;if(m=R,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),W.test(m)||P.test(m)||T.test(m)||x.test(m)||C.test(m)||M.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=w||!m.trim())p+=`
1416
- `+D.slice(w);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||W.test(b)||P.test(b)||M.test(b))break;p+=`
1386
+ `,1)[0],_=!b.trim(),y=0;if(this.options.pedantic?(y=2,p=b.trimStart()):_?y=t[1].length+1:(y=b.search(this.rules.other.nonSpaceChar),y=y>4?1:y,p=b.slice(y),y+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(h+=m+`
1387
+ `,e=e.substring(m.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(y),M=this.rules.other.hrRegex(y),J=this.rules.other.fencesBeginRegex(y),P=this.rules.other.headingBeginRegex(y),T=this.rules.other.htmlBeginRegex(y),x=this.rules.other.blockquoteBeginRegex(y);for(;e;){let R=e.split(`
1388
+ `,1)[0],D;if(m=R,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),J.test(m)||P.test(m)||T.test(m)||x.test(m)||C.test(m)||M.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=y||!m.trim())p+=`
1389
+ `+D.slice(y);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||J.test(b)||P.test(b)||M.test(b))break;p+=`
1417
1390
  `+m}_=!m.trim(),h+=R+`
1418
- `,e=e.substring(R.length+1),b=D.slice(w)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=h}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let h=d.tokens[0];if(d.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=b.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=b.raw+d.tokens[0].raw,d.tokens[0].text=b.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(b)):d.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):d.tokens.unshift(b)}}else d.task&&(d.task=!1);if(!o.loose){let p=d.tokens.filter(m=>m.type==="space"),b=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=b}}if(o.loose)for(let d of o.items){d.loose=!0;for(let h of d.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Va(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Kt(t[0],`
1419
- `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Xa(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1420
- `):[],s={type:"table",raw:Kt(t[0],`
1421
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?s.align.push("right"):this.rules.other.tableAlignCenter.test(u)?s.align.push("center"):this.rules.other.tableAlignLeft.test(u)?s.align.push("left"):s.align.push(null);for(let u=0;u<n.length;u++)s.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:s.align[u]});for(let u of o)s.rows.push(Xa(u,s.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[h]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Kt(t[0],`
1391
+ `,e=e.substring(R.length+1),b=D.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=h}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let h=d.tokens[0];if(d.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=b.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=b.raw+d.tokens[0].raw,d.tokens[0].text=b.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(b)):d.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):d.tokens.unshift(b)}}else d.task&&(d.task=!1);if(!o.loose){let p=d.tokens.filter(m=>m.type==="space"),b=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=b}}if(o.loose)for(let d of o.items){d.loose=!0;for(let h of d.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=nc(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Qt(t[0],`
1392
+ `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=tc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1393
+ `):[],i={type:"table",raw:Qt(t[0],`
1394
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?i.align.push("right"):this.rules.other.tableAlignCenter.test(u)?i.align.push("center"):this.rules.other.tableAlignLeft.test(u)?i.align.push("left"):i.align.push(null);for(let u=0;u<n.length;u++)i.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:i.align[u]});for(let u of o)i.rows.push(tc(u,i.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:i.align[h]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Qt(t[0],`
1422
1395
  `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
1423
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Kt(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=Zg(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ya(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Ya(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,s,a,u=o,d=0,h=r[0][0],p=n===h,b=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,t=t.slice(-1*e.length+o);(r=b.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){u+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){d+=a;continue}if(p)break}if(u-=a,u>0)continue;a=Math.min(a,a+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let C=_.slice(1,-1);return{type:"em",raw:_,text:C,tokens:this.lexer.inlineTokens(C)}}let w=_.slice(2,-2);return{type:"strong",raw:_,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,s,a,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(a=[...s].length,a!==o))continue;if(r[3]||r[4]){u+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u);let h=[...r[0]][0].length,p=e.slice(0,o+r.index+h+a),b=p.slice(o,-o);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},gt=class cs{constructor(t){ae(this,"tokens");ae(this,"options");ae(this,"state");ae(this,"inlineQueue");ae(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||hn,this.options.tokenizer=this.options.tokenizer||new po,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:je,block:uo.normal,inline:mr.normal};this.options.pedantic?(n.block=uo.pedantic,n.inline=mr.pedantic):this.options.gfm&&(n.block=uo.gfm,this.options.breaks?n.inline=mr.breaks:n.inline=mr.gfm),this.tokenizer.rules=n}static get rules(){return{block:uo,inline:mr}}static lex(t,n){return new cs(n).lex(t)}static lexInline(t,n){return new cs(n).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
1424
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var s,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(je.tabCharGlobal," ").replace(je.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((a=(s=this.options.extensions)==null?void 0:s.block)!=null&&a.some(p=>(d=p.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let p=n.at(-1);d.raw.length===1&&p!==void 0?p.raw+=`
1396
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Qt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Vg(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),rc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return rc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,u=o,d=0,h=r[0][0],p=n===h,b=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,t=t.slice(-1*e.length+o);(r=b.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){u+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){d+=a;continue}if(p)break}if(u-=a,u>0)continue;a=Math.min(a,a+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let C=_.slice(1,-1);return{type:"em",raw:_,text:C,tokens:this.lexer.inlineTokens(C)}}let y=_.slice(2,-2);return{type:"strong",raw:_,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){u+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u);let h=[...r[0]][0].length,p=e.slice(0,o+r.index+h+a),b=p.slice(o,-o);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},gt=class di{constructor(t){ae(this,"tokens");ae(this,"options");ae(this,"state");ae(this,"inlineQueue");ae(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||hn,this.options.tokenizer=this.options.tokenizer||new ho,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:je,block:po.normal,inline:kr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=kr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=kr.breaks:n.inline=kr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:kr}}static lex(t,n){return new di(n).lex(t)}static lexInline(t,n){return new di(n).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
1397
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(je.tabCharGlobal," ").replace(je.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(p=>(d=p.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let p=n.at(-1);d.raw.length===1&&p!==void 0?p.raw+=`
1425
1398
  `:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
1426
1399
  `)?"":`
1427
1400
  `)+d.raw,p.text+=`
@@ -1434,27 +1407,27 @@ ${w}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void
1434
1407
  `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d),r=h.length!==t.length,t=t.substring(d.raw.length);continue}if(d=this.tokenizer.text(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
1435
1408
  `)?"":`
1436
1409
  `)+d.raw,p.text+=`
1437
- `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,h,p,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let C=w?w.length:0;return m.slice(0,C)+"["+"a".repeat(m.length-C-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,s="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(s=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(w=>(m=w.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let w=n.at(-1);m.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((b=this.options.extensions)!=null&&b.startInline){let w=1/0,C=t.slice(1),M;this.options.extensions.startInline.forEach(W=>{M=W.call({lexer:this},C),typeof M=="number"&&M>=0&&(w=Math.min(w,M))}),w<1/0&&w>=0&&(_=t.substring(0,w+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(s=m.raw.slice(-1)),o=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},ho=class{constructor(e){ae(this,"options");ae(this,"parser");this.options=e||hn}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let r=(s=(t||"").match(je.notSpaceStart))==null?void 0:s[0],o=e.replace(je.endingNewline,"")+`
1410
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,h,p,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,y)=>{let C=y?y.length:0;return m.slice(0,C)+"["+"a".repeat(m.length-C-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(y=>(m=y.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let y=n.at(-1);m.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=m.raw,y.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,i)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,i)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((b=this.options.extensions)!=null&&b.startInline){let y=1/0,C=t.slice(1),M;this.options.extensions.startInline.forEach(J=>{M=J.call({lexer:this},C),typeof M=="number"&&M>=0&&(y=Math.min(y,M))}),y<1/0&&y>=0&&(_=t.substring(0,y+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(i=m.raw.slice(-1)),o=!0;let y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=m.raw,y.text+=m.text):n.push(m);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},fo=class{constructor(e){ae(this,"options");ae(this,"parser");this.options=e||hn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(je.notSpaceStart))==null?void 0:i[0],o=e.replace(je.endingNewline,"")+`
1438
1411
  `;return r?'<pre><code class="language-'+At(r)+'">'+(n?o:At(o,!0))+`</code></pre>
1439
1412
  `:"<pre><code>"+(n?o:At(o,!0))+`</code></pre>
1440
1413
  `}blockquote({tokens:e}){return`<blockquote>
1441
1414
  ${this.parser.parse(e)}</blockquote>
1442
1415
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
1443
1416
  `}hr(e){return`<hr>
1444
- `}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let u=e.items[a];r+=this.listitem(u)}let o=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+o+s+`>
1417
+ `}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let u=e.items[a];r+=this.listitem(u)}let o=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+o+i+`>
1445
1418
  `+r+"</"+o+`>
1446
1419
  `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
1447
1420
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
1448
- `}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){let s=e.rows[o];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
1421
+ `}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){let i=e.rows[o];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
1449
1422
  <thead>
1450
1423
  `+t+`</thead>
1451
1424
  `+r+`</table>
1452
1425
  `}tablerow({text:e}){return`<tr>
1453
1426
  ${e}</tr>
1454
1427
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1455
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${At(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=Ja(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+At(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=Ja(e);if(o===null)return At(n);e=o;let s=`<img src="${e}" alt="${At(n)}"`;return t&&(s+=` title="${At(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:At(e.text)}},Ai=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},mt=class ls{constructor(t){ae(this,"options");ae(this,"renderer");ae(this,"textRenderer");this.options=t||hn,this.options.renderer=this.options.renderer||new ho,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ai}static parse(t,n){return new ls(n).parse(t)}static parseInline(t,n){return new ls(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let a=t[s];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let d=a,h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=h||"";continue}}let u=a;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,s;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let u=t[a];if((s=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&s[u.type]){let h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=h||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},br=(Oo=class{constructor(e){ae(this,"options");ae(this,"block");this.options=e||hn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?gt.lex:gt.lexInline}provideParser(e=this.block){return e?mt.parse:mt.parseInline}},ae(Oo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ae(Oo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Oo),Fg=class{constructor(...e){ae(this,"defaults",_i());ae(this,"options",this.setOptions);ae(this,"parse",this.parseMarkdown(!0));ae(this,"parseInline",this.parseMarkdown(!1));ae(this,"Parser",mt);ae(this,"Renderer",ho);ae(this,"TextRenderer",Ai);ae(this,"Lexer",gt);ae(this,"Tokenizer",po);ae(this,"Hooks",br);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let a=s;for(let u of a.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of a.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let a=s;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(u=>{let d=a[u].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=t.renderers[o.name];s?t.renderers[o.name]=function(...a){let u=o.renderer.apply(this,a);return u===!1&&(u=s.apply(this,a)),u}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[o.level];s?s.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new ho(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,u=n.renderer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new po(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,u=n.tokenizer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new br;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,u=n.hooks[a],d=o[a];br.passThroughHooks.has(s)?o[a]=h=>{if(this.defaults.async&&br.passThroughHooksRespectAsync.has(s))return(async()=>{let b=await u.call(o,h);return d.call(o,b)})();let p=u.call(o,h);return d.call(o,p)}:o[a]=(...h)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(o,h);return b===!1&&(b=await d.apply(o,h)),b})();let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let u=[];return u.push(s.call(this,a)),o&&(u=u.concat(o.call(this,a))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return gt.lex(e,t??this.defaults)}parser(e,t){return mt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?gt.lex:gt.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let h=await(o.hooks?await o.hooks.provideParser(e):e?mt.parse:mt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(h):h})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?gt.lex:gt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?mt.parse:mt.parseInline)(a,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(a){return s(a)}}}onError(e,t){return n=>{if(n.message+=`
1456
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+At(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},gn=new Fg;function ne(e,t){return gn.parse(e,t)}ne.options=ne.setOptions=function(e){return gn.setOptions(e),ne.defaults=gn.defaults,Na(ne.defaults),ne},ne.getDefaults=_i,ne.defaults=hn;function Bg(...e){return gn.use(...e),ne.defaults=gn.defaults,Na(ne.defaults),ne}ne.use=Bg,ne.walkTokens=function(e,t){return gn.walkTokens(e,t)},ne.parseInline=gn.parseInline,ne.Parser=mt,ne.parser=mt.parse,ne.Renderer=ho,ne.TextRenderer=Ai,ne.Lexer=gt,ne.lexer=gt.lex,ne.Tokenizer=po,ne.Hooks=br,ne.parse=ne,ne.options,ne.setOptions,ne.walkTokens,ne.parseInline,mt.parse,gt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Ka,setPrototypeOf:Qa,isFrozen:Gg,getPrototypeOf:Wg,getOwnPropertyDescriptor:Jg}=Object;let{freeze:Fe,seal:at,create:Ci}=Object,{apply:Pi,construct:Ri}=typeof Reflect<"u"&&Reflect;Fe||(Fe=function(t){return t}),at||(at=function(t){return t}),Pi||(Pi=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)}),Ri||(Ri=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const fo=Ge(Array.prototype.forEach),Xg=Ge(Array.prototype.lastIndexOf),ec=Ge(Array.prototype.pop),kr=Ge(Array.prototype.push),Vg=Ge(Array.prototype.splice),go=Ge(String.prototype.toLowerCase),Li=Ge(String.prototype.toString),zi=Ge(String.prototype.match),_r=Ge(String.prototype.replace),Yg=Ge(String.prototype.indexOf),Kg=Ge(String.prototype.trim),bt=Ge(Object.prototype.hasOwnProperty),Be=Ge(RegExp.prototype.test),vr=Qg(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Pi(e,t,r)}}function Qg(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ri(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:go;Qa&&Qa(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Gg(t)||(t[r]=s),o=s)}e[o]=!0}return e}function em(e){for(let t=0;t<e.length;t++)bt(e,t)||(e[t]=null);return e}function Ct(e){const t=Ci(null);for(const[n,r]of Ka(e))bt(e,n)&&(Array.isArray(r)?t[n]=em(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ct(r):t[n]=r);return t}function yr(e,t){for(;e!==null;){const r=Jg(e,t);if(r){if(r.get)return Ge(r.get);if(typeof r.value=="function")return Ge(r.value)}e=Wg(e)}function n(){return null}return n}const tc=Fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ii=Fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$i=Fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),tm=Fe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ni=Fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),nm=Fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nc=Fe(["#text"]),rc=Fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Oi=Fe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oc=Fe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),mo=Fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rm=at(/\{\{[\w\W]*|[\w\W]*\}\}/gm),om=at(/<%[\w\W]*|[\w\W]*%>/gm),im=at(/\$\{[\w\W]*/gm),sm=at(/^data-[\-\w.\u00B7-\uFFFF]+$/),am=at(/^aria-[\-\w]+$/),ic=at(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cm=at(/^(?:\w+script|data):/i),lm=at(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sc=at(/^html$/i),um=at(/^[a-z][.\w]*(-[.\w]+)+$/i);var ac=Object.freeze({__proto__:null,ARIA_ATTR:am,ATTR_WHITESPACE:lm,CUSTOM_ELEMENT:um,DATA_ATTR:sm,DOCTYPE_NAME:sc,ERB_EXPR:om,IS_ALLOWED_URI:ic,IS_SCRIPT_OR_DATA:cm,MUSTACHE_EXPR:rm,TMPLIT_EXPR:im});const wr={element:1,text:3,progressingInstruction:7,comment:8,document:9},dm=function(){return typeof window>"u"?null:window},pm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},cc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dm();const t=O=>lc(O);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==wr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,w=d.prototype,C=yr(w,"cloneNode"),M=yr(w,"remove"),W=yr(w,"nextSibling"),P=yr(w,"childNodes"),T=yr(w,"parentNode");if(typeof a=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let x,R="";const{implementation:D,createNodeIterator:pe,createDocumentFragment:_e,getElementsByTagName:Ce}=n,{importNode:Ve}=r;let V=cc();t.isSupported=typeof Ka=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pe,ERB_EXPR:Ze,TMPLIT_EXPR:_t,DATA_ATTR:on,ARIA_ATTR:rt,IS_SCRIPT_OR_DATA:Zt,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:K}=ac;let{IS_ALLOWED_URI:De}=ac,J=null;const vt=B({},[...tc,...Ii,...$i,...Ni,...nc]);let oe=null;const Sn=B({},[...rc,...Oi,...oc,...mo]);let ce=Object.seal(Ci(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,Re=null;const Le=Object.seal(Ci(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,Te=!0,tt=!1,lt=!0,ze=!1,ut=!0,qt=!1,Ht=!1,nr=!1,sn=!1,Tn=!1,En=!1,Do=!0,zr=!1;const Yi="user-content-";let Ir=!0,An=!1,an={},Ye=null;const $r=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const Mo=B({},["audio","video","img","source","image","track"]);let Nr=null;const Uo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rr="http://www.w3.org/1998/Math/MathML",or="http://www.w3.org/2000/svg",yt="http://www.w3.org/1999/xhtml";let cn=yt,Cn=!1,Pn=null;const Ki=B({},[rr,or,yt],Li);let ir=B({},["mi","mo","mn","ms","mtext"]),sr=B({},["annotation-xml"]);const Qi=B({},["title","style","font","a","script"]);let Ft=null;const wt=["application/xhtml+xml","text/html"],es="text/html";let ue=null,ln=null;const jo=n.createElement("form"),Or=function(k){return k instanceof RegExp||k instanceof Function},ar=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ln&&ln===k)){if((!k||typeof k!="object")&&(k={}),k=Ct(k),Ft=wt.indexOf(k.PARSER_MEDIA_TYPE)===-1?es:k.PARSER_MEDIA_TYPE,ue=Ft==="application/xhtml+xml"?Li:go,J=bt(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,ue):vt,oe=bt(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,ue):Sn,Pn=bt(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,Li):Ki,Nr=bt(k,"ADD_URI_SAFE_ATTR")?B(Ct(Uo),k.ADD_URI_SAFE_ATTR,ue):Uo,le=bt(k,"ADD_DATA_URI_TAGS")?B(Ct(Mo),k.ADD_DATA_URI_TAGS,ue):Mo,Ye=bt(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,ue):$r,ie=bt(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,ue):Ct({}),Re=bt(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,ue):Ct({}),an=bt(k,"USE_PROFILES")?k.USE_PROFILES:!1,ee=k.ALLOW_ARIA_ATTR!==!1,Te=k.ALLOW_DATA_ATTR!==!1,tt=k.ALLOW_UNKNOWN_PROTOCOLS||!1,lt=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=k.SAFE_FOR_TEMPLATES||!1,ut=k.SAFE_FOR_XML!==!1,qt=k.WHOLE_DOCUMENT||!1,sn=k.RETURN_DOM||!1,Tn=k.RETURN_DOM_FRAGMENT||!1,En=k.RETURN_TRUSTED_TYPE||!1,nr=k.FORCE_BODY||!1,Do=k.SANITIZE_DOM!==!1,zr=k.SANITIZE_NAMED_PROPS||!1,Ir=k.KEEP_CONTENT!==!1,An=k.IN_PLACE||!1,De=k.ALLOWED_URI_REGEXP||ic,cn=k.NAMESPACE||yt,ir=k.MATHML_TEXT_INTEGRATION_POINTS||ir,sr=k.HTML_INTEGRATION_POINTS||sr,ce=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&Or(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&Or(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(Te=!1),Tn&&(sn=!0),an&&(J=B({},nc),oe=[],an.html===!0&&(B(J,tc),B(oe,rc)),an.svg===!0&&(B(J,Ii),B(oe,Oi),B(oe,mo)),an.svgFilters===!0&&(B(J,$i),B(oe,Oi),B(oe,mo)),an.mathMl===!0&&(B(J,Ni),B(oe,oc),B(oe,mo))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Le.tagCheck=k.ADD_TAGS:(J===vt&&(J=Ct(J)),B(J,k.ADD_TAGS,ue))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Le.attributeCheck=k.ADD_ATTR:(oe===Sn&&(oe=Ct(oe)),B(oe,k.ADD_ATTR,ue))),k.ADD_URI_SAFE_ATTR&&B(Nr,k.ADD_URI_SAFE_ATTR,ue),k.FORBID_CONTENTS&&(Ye===$r&&(Ye=Ct(Ye)),B(Ye,k.FORBID_CONTENTS,ue)),k.ADD_FORBID_CONTENTS&&(Ye===$r&&(Ye=Ct(Ye)),B(Ye,k.ADD_FORBID_CONTENTS,ue)),Ir&&(J["#text"]=!0),qt&&B(J,["html","head","body"]),J.table&&(B(J,["tbody"]),delete ie.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=k.TRUSTED_TYPES_POLICY,R=x.createHTML("")}else x===void 0&&(x=pm(_,o)),x!==null&&typeof R=="string"&&(R=x.createHTML(""));Fe&&Fe(k),ln=k}},Dr=B({},[...Ii,...$i,...tm]),Zo=B({},[...Ni,...nm]),ts=function(k){let S=T(k);(!S||!S.tagName)&&(S={namespaceURI:cn,tagName:"template"});const L=go(k.tagName),se=go(S.tagName);return Pn[k.namespaceURI]?k.namespaceURI===or?S.namespaceURI===yt?L==="svg":S.namespaceURI===rr?L==="svg"&&(se==="annotation-xml"||ir[se]):!!Dr[L]:k.namespaceURI===rr?S.namespaceURI===yt?L==="math":S.namespaceURI===or?L==="math"&&sr[se]:!!Zo[L]:k.namespaceURI===yt?S.namespaceURI===or&&!sr[se]||S.namespaceURI===rr&&!ir[se]?!1:!Zo[L]&&(Qi[L]||!Dr[L]):!!(Ft==="application/xhtml+xml"&&Pn[k.namespaceURI]):!1},dt=function(k){kr(t.removed,{element:k});try{T(k).removeChild(k)}catch{M(k)}},pt=function(k,S){try{kr(t.removed,{attribute:S.getAttributeNode(k),from:S})}catch{kr(t.removed,{attribute:null,from:S})}if(S.removeAttribute(k),k==="is")if(sn||Tn)try{dt(S)}catch{}else try{S.setAttribute(k,"")}catch{}},qo=function(k){let S=null,L=null;if(nr)k="<remove></remove>"+k;else{const ve=zi(k,/^[\r\n\t ]+/);L=ve&&ve[0]}Ft==="application/xhtml+xml"&&cn===yt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const se=x?x.createHTML(k):k;if(cn===yt)try{S=new m().parseFromString(se,Ft)}catch{}if(!S||!S.documentElement){S=D.createDocument(cn,"template",null);try{S.documentElement.innerHTML=Cn?R:se}catch{}}const $e=S.body||S.documentElement;return k&&L&&$e.insertBefore(n.createTextNode(L),$e.childNodes[0]||null),cn===yt?Ce.call(S,qt?"html":"body")[0]:qt?S.documentElement:$e},Mr=function(k){return pe.call(k.ownerDocument||k,k,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Ur=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof p)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Ho=function(k){return typeof u=="function"&&k instanceof u};function xt(O,k,S){fo(O,L=>{L.call(t,k,S,ln)})}const Fo=function(k){let S=null;if(xt(V.beforeSanitizeElements,k,null),Ur(k))return dt(k),!0;const L=ue(k.nodeName);if(xt(V.uponSanitizeElement,k,{tagName:L,allowedTags:J}),ut&&k.hasChildNodes()&&!Ho(k.firstElementChild)&&Be(/<[/\w!]/g,k.innerHTML)&&Be(/<[/\w!]/g,k.textContent)||k.nodeType===wr.progressingInstruction||ut&&k.nodeType===wr.comment&&Be(/<[/\w]/g,k.data))return dt(k),!0;if(!(Le.tagCheck instanceof Function&&Le.tagCheck(L))&&(!J[L]||ie[L])){if(!ie[L]&&Go(L)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L)))return!1;if(Ir&&!Ye[L]){const se=T(k)||k.parentNode,$e=P(k)||k.childNodes;if($e&&se){const ve=$e.length;for(let qe=ve-1;qe>=0;--qe){const St=C($e[qe],!0);St.__removalCount=(k.__removalCount||0)+1,se.insertBefore(St,W(k))}}}return dt(k),!0}return k instanceof d&&!ts(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Be(/<\/no(script|embed|frames)/i,k.innerHTML)?(dt(k),!0):(ze&&k.nodeType===wr.text&&(S=k.textContent,fo([Pe,Ze,_t],se=>{S=_r(S,se," ")}),k.textContent!==S&&(kr(t.removed,{element:k.cloneNode()}),k.textContent=S)),xt(V.afterSanitizeElements,k,null),!1)},Bo=function(k,S,L){if(Do&&(S==="id"||S==="name")&&(L in n||L in jo))return!1;if(!(Te&&!Re[S]&&Be(on,S))){if(!(ee&&Be(rt,S))){if(!(Le.attributeCheck instanceof Function&&Le.attributeCheck(S,k))){if(!oe[S]||Re[S]){if(!(Go(k)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,k)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(k))&&(ce.attributeNameCheck instanceof RegExp&&Be(ce.attributeNameCheck,S)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(S,k))||S==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L))))return!1}else if(!Nr[S]){if(!Be(De,_r(L,Z,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&k!=="script"&&Yg(L,"data:")===0&&le[k])){if(!(tt&&!Be(Zt,_r(L,Z,"")))){if(L)return!1}}}}}}}return!0},Go=function(k){return k!=="annotation-xml"&&zi(k,K)},jr=function(k){xt(V.beforeSanitizeAttributes,k,null);const{attributes:S}=k;if(!S||Ur(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let se=S.length;for(;se--;){const $e=S[se],{name:ve,namespaceURI:qe,value:St}=$e,zt=ue(ve),Zr=St;let Ie=ve==="value"?Zr:Kg(Zr);if(L.attrName=zt,L.attrValue=Ie,L.keepAttr=!0,L.forceKeepAttr=void 0,xt(V.uponSanitizeAttribute,k,L),Ie=L.attrValue,zr&&(zt==="id"||zt==="name")&&(pt(ve,k),Ie=Yi+Ie),ut&&Be(/((--!?|])>)|<\/(style|title|textarea)/i,Ie)){pt(ve,k);continue}if(zt==="attributename"&&zi(Ie,"href")){pt(ve,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){pt(ve,k);continue}if(!lt&&Be(/\/>/i,Ie)){pt(ve,k);continue}ze&&fo([Pe,Ze,_t],Jo=>{Ie=_r(Ie,Jo," ")});const Wo=ue(k.nodeName);if(!Bo(Wo,zt,Ie)){pt(ve,k);continue}if(x&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!qe)switch(_.getAttributeType(Wo,zt)){case"TrustedHTML":{Ie=x.createHTML(Ie);break}case"TrustedScriptURL":{Ie=x.createScriptURL(Ie);break}}if(Ie!==Zr)try{qe?k.setAttributeNS(qe,ve,Ie):k.setAttribute(ve,Ie),Ur(k)?dt(k):ec(t.removed)}catch{pt(ve,k)}}xt(V.afterSanitizeAttributes,k,null)},Bt=function O(k){let S=null;const L=Mr(k);for(xt(V.beforeSanitizeShadowDOM,k,null);S=L.nextNode();)xt(V.uponSanitizeShadowNode,S,null),Fo(S),jr(S),S.content instanceof s&&O(S.content);xt(V.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(O){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,se=null,$e=null;if(Cn=!O,Cn&&(O="<!-->"),typeof O!="string"&&!Ho(O))if(typeof O.toString=="function"){if(O=O.toString(),typeof O!="string")throw vr("dirty is not a string, aborting")}else throw vr("toString is not a function");if(!t.isSupported)return O;if(Ht||ar(k),t.removed=[],typeof O=="string"&&(An=!1),An){if(O.nodeName){const St=ue(O.nodeName);if(!J[St]||ie[St])throw vr("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof u)S=qo("<!---->"),L=S.ownerDocument.importNode(O,!0),L.nodeType===wr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!sn&&!ze&&!qt&&O.indexOf("<")===-1)return x&&En?x.createHTML(O):O;if(S=qo(O),!S)return sn?null:En?R:""}S&&nr&&dt(S.firstChild);const ve=Mr(An?O:S);for(;se=ve.nextNode();)Fo(se),jr(se),se.content instanceof s&&Bt(se.content);if(An)return O;if(sn){if(Tn)for($e=_e.call(S.ownerDocument);S.firstChild;)$e.appendChild(S.firstChild);else $e=S;return(oe.shadowroot||oe.shadowrootmode)&&($e=Ve.call(r,$e,!0)),$e}let qe=qt?S.outerHTML:S.innerHTML;return qt&&J["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Be(sc,S.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
1457
- `+qe),ze&&fo([Pe,Ze,_t],St=>{qe=_r(qe,St," ")}),x&&En?x.createHTML(qe):qe},t.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ar(O),Ht=!0},t.clearConfig=function(){ln=null,Ht=!1},t.isValidAttribute=function(O,k,S){ln||ar({});const L=ue(O),se=ue(k);return Bo(L,se,S)},t.addHook=function(O,k){typeof k=="function"&&kr(V[O],k)},t.removeHook=function(O,k){if(k!==void 0){const S=Xg(V[O],k);return S===-1?void 0:Vg(V[O],S,1)[0]}return ec(V[O])},t.removeHooks=function(O){V[O]=[]},t.removeAllHooks=function(){V=cc()},t}var hm=lc();function uc(e){const t=ne.parse(e,{gfm:!0,breaks:!0,async:!1});return hm.sanitize(t)}const dc=1e3,pc=32,hc=15e3,fm=new Set(["completed","failed","cancelled"]),gm=4e3;let z=null,Pt=null,Oe=null,Di=null,bo=null,Mi=!1,ko=null,xr=null,U={kind:"connecting"},Bn=[],Gn=null,be=null,Wn=null,Dt=null,Sr=-1,We=null,Mt=!1,Ut=null,mn=new Set;function Ui(){_o(),Pa(),Pt&&clearInterval(Pt),Pt=null,Ut==null||Ut(),Ut=null,Oe==null||Oe.destroy(),Oe=null,z&&Nt(z),z==null||z.remove(),z=null,Di=null,U={kind:"connecting"},Bn=[],Gn=null,be=null,Wn=null,Dt=null,bo=null,Sr=-1,We=null,Mt=!1,mn=new Set}function ji(e,t,n,r,o){z&&Ui(),Di=o??null,U={kind:"connecting"},Bn=[],Gn=null,Sr=-1,We=null,Mt=!1,mn=new Set,be=e,Wn=n,Dt=t,bo=r,Ca({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const s=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1428
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${At(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=ec(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+At(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=ec(e);if(o===null)return At(n);e=o;let i=`<img src="${e}" alt="${At(n)}"`;return t&&(i+=` title="${At(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:At(e.text)}},Ps=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},mt=class pi{constructor(t){ae(this,"options");ae(this,"renderer");ae(this,"textRenderer");this.options=t||hn,this.options.renderer=this.options.renderer||new fo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ps}static parse(t,n){return new pi(n).parse(t)}static parseInline(t,n){return new pi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let d=a,h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=h||"";continue}}let u=a;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let u=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[u.type]){let h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=h||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},_r=(Do=class{constructor(e){ae(this,"options");ae(this,"block");this.options=e||hn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?gt.lex:gt.lexInline}provideParser(e=this.block){return e?mt.parse:mt.parseInline}},ae(Do,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ae(Do,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Do),Qg=class{constructor(...e){ae(this,"defaults",ys());ae(this,"options",this.setOptions);ae(this,"parse",this.parseMarkdown(!0));ae(this,"parseInline",this.parseMarkdown(!1));ae(this,"Parser",mt);ae(this,"Renderer",fo);ae(this,"TextRenderer",Ps);ae(this,"Lexer",gt);ae(this,"Tokenizer",ho);ae(this,"Hooks",_r);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let u of a.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of a.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(u=>{let d=a[u].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let u=o.renderer.apply(this,a);return u===!1&&(u=i.apply(this,a)),u}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new fo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,u=n.renderer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new ho(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,u=n.tokenizer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new _r;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,u=n.hooks[a],d=o[a];_r.passThroughHooks.has(i)?o[a]=h=>{if(this.defaults.async&&_r.passThroughHooksRespectAsync.has(i))return(async()=>{let b=await u.call(o,h);return d.call(o,b)})();let p=u.call(o,h);return d.call(o,p)}:o[a]=(...h)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(o,h);return b===!1&&(b=await d.apply(o,h)),b})();let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let u=[];return u.push(i.call(this,a)),o&&(u=u.concat(o.call(this,a))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return gt.lex(e,t??this.defaults)}parser(e,t){return mt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?gt.lex:gt.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let h=await(o.hooks?await o.hooks.provideParser(e):e?mt.parse:mt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(h):h})().catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?gt.lex:gt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?mt.parse:mt.parseInline)(a,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+At(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},gn=new Qg;function ne(e,t){return gn.parse(e,t)}ne.options=ne.setOptions=function(e){return gn.setOptions(e),ne.defaults=gn.defaults,Za(ne.defaults),ne},ne.getDefaults=ys,ne.defaults=hn;function em(...e){return gn.use(...e),ne.defaults=gn.defaults,Za(ne.defaults),ne}ne.use=em,ne.walkTokens=function(e,t){return gn.walkTokens(e,t)},ne.parseInline=gn.parseInline,ne.Parser=mt,ne.parser=mt.parse,ne.Renderer=fo,ne.TextRenderer=Ps,ne.Lexer=gt,ne.lexer=gt.lex,ne.Tokenizer=ho,ne.Hooks=_r,ne.parse=ne,ne.options,ne.setOptions,ne.walkTokens,ne.parseInline,mt.parse,gt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:oc,setPrototypeOf:sc,isFrozen:tm,getPrototypeOf:nm,getOwnPropertyDescriptor:rm}=Object;let{freeze:Fe,seal:it,create:Rs}=Object,{apply:Ls,construct:Is}=typeof Reflect<"u"&&Reflect;Fe||(Fe=function(t){return t}),it||(it=function(t){return t}),Ls||(Ls=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Is||(Is=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const go=Ge(Array.prototype.forEach),om=Ge(Array.prototype.lastIndexOf),ic=Ge(Array.prototype.pop),vr=Ge(Array.prototype.push),sm=Ge(Array.prototype.splice),mo=Ge(String.prototype.toLowerCase),zs=Ge(String.prototype.toString),$s=Ge(String.prototype.match),yr=Ge(String.prototype.replace),im=Ge(String.prototype.indexOf),am=Ge(String.prototype.trim),bt=Ge(Object.prototype.hasOwnProperty),Be=Ge(RegExp.prototype.test),wr=cm(TypeError);function Ge(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ls(e,t,r)}}function cm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Is(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mo;sc&&sc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(tm(t)||(t[r]=i),o=i)}e[o]=!0}return e}function lm(e){for(let t=0;t<e.length;t++)bt(e,t)||(e[t]=null);return e}function Ct(e){const t=Rs(null);for(const[n,r]of oc(e))bt(e,n)&&(Array.isArray(r)?t[n]=lm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ct(r):t[n]=r);return t}function xr(e,t){for(;e!==null;){const r=rm(e,t);if(r){if(r.get)return Ge(r.get);if(typeof r.value=="function")return Ge(r.value)}e=nm(e)}function n(){return null}return n}const ac=Fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Os=Fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ns=Fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),um=Fe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ds=Fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),dm=Fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cc=Fe(["#text"]),lc=Fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ms=Fe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),uc=Fe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),bo=Fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pm=it(/\{\{[\w\W]*|[\w\W]*\}\}/gm),hm=it(/<%[\w\W]*|[\w\W]*%>/gm),fm=it(/\$\{[\w\W]*/gm),gm=it(/^data-[\-\w.\u00B7-\uFFFF]+$/),mm=it(/^aria-[\-\w]+$/),dc=it(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bm=it(/^(?:\w+script|data):/i),km=it(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pc=it(/^html$/i),_m=it(/^[a-z][.\w]*(-[.\w]+)+$/i);var hc=Object.freeze({__proto__:null,ARIA_ATTR:mm,ATTR_WHITESPACE:km,CUSTOM_ELEMENT:_m,DATA_ATTR:gm,DOCTYPE_NAME:pc,ERB_EXPR:hm,IS_ALLOWED_URI:dc,IS_SCRIPT_OR_DATA:bm,MUSTACHE_EXPR:pm,TMPLIT_EXPR:fm});const Sr={element:1,text:3,progressingInstruction:7,comment:8,document:9},vm=function(){return typeof window>"u"?null:window},ym=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},fc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function gc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vm();const t=N=>gc(N);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Sr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,y=d.prototype,C=xr(y,"cloneNode"),M=xr(y,"remove"),J=xr(y,"nextSibling"),P=xr(y,"childNodes"),T=xr(y,"parentNode");if(typeof a=="function"){const N=n.createElement("template");N.content&&N.content.ownerDocument&&(n=N.content.ownerDocument)}let x,R="";const{implementation:D,createNodeIterator:pe,createDocumentFragment:_e,getElementsByTagName:Ce}=n,{importNode:Ve}=r;let X=fc();t.isSupported=typeof oc=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pe,ERB_EXPR:Ze,TMPLIT_EXPR:_t,DATA_ATTR:sn,ARIA_ATTR:nt,IS_SCRIPT_OR_DATA:Zt,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:Q}=hc;let{IS_ALLOWED_URI:De}=hc,Y=null;const vt=B({},[...ac,...Os,...Ns,...Ds,...cc]);let oe=null;const Tn=B({},[...lc,...Ms,...uc,...bo]);let ce=Object.seal(Rs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,Re=null;const Le=Object.seal(Rs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,Te=!0,et=!1,lt=!0,Ie=!1,ut=!0,qt=!1,Ht=!1,rr=!1,an=!1,En=!1,An=!1,Mo=!0,Ir=!1;const ei="user-content-";let zr=!0,Cn=!1,cn={},Xe=null;const $r=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const Uo=B({},["audio","video","img","source","image","track"]);let Or=null;const jo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),or="http://www.w3.org/1998/Math/MathML",sr="http://www.w3.org/2000/svg",yt="http://www.w3.org/1999/xhtml";let ln=yt,Pn=!1,Rn=null;const ti=B({},[or,sr,yt],zs);let ir=B({},["mi","mo","mn","ms","mtext"]),ar=B({},["annotation-xml"]);const ni=B({},["title","style","font","a","script"]);let Ft=null;const wt=["application/xhtml+xml","text/html"],ri="text/html";let ue=null,un=null;const Zo=n.createElement("form"),Nr=function(k){return k instanceof RegExp||k instanceof Function},cr=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(un&&un===k)){if((!k||typeof k!="object")&&(k={}),k=Ct(k),Ft=wt.indexOf(k.PARSER_MEDIA_TYPE)===-1?ri:k.PARSER_MEDIA_TYPE,ue=Ft==="application/xhtml+xml"?zs:mo,Y=bt(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,ue):vt,oe=bt(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,ue):Tn,Rn=bt(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,zs):ti,Or=bt(k,"ADD_URI_SAFE_ATTR")?B(Ct(jo),k.ADD_URI_SAFE_ATTR,ue):jo,le=bt(k,"ADD_DATA_URI_TAGS")?B(Ct(Uo),k.ADD_DATA_URI_TAGS,ue):Uo,Xe=bt(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,ue):$r,se=bt(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,ue):Ct({}),Re=bt(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,ue):Ct({}),cn=bt(k,"USE_PROFILES")?k.USE_PROFILES:!1,ee=k.ALLOW_ARIA_ATTR!==!1,Te=k.ALLOW_DATA_ATTR!==!1,et=k.ALLOW_UNKNOWN_PROTOCOLS||!1,lt=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ie=k.SAFE_FOR_TEMPLATES||!1,ut=k.SAFE_FOR_XML!==!1,qt=k.WHOLE_DOCUMENT||!1,an=k.RETURN_DOM||!1,En=k.RETURN_DOM_FRAGMENT||!1,An=k.RETURN_TRUSTED_TYPE||!1,rr=k.FORCE_BODY||!1,Mo=k.SANITIZE_DOM!==!1,Ir=k.SANITIZE_NAMED_PROPS||!1,zr=k.KEEP_CONTENT!==!1,Cn=k.IN_PLACE||!1,De=k.ALLOWED_URI_REGEXP||dc,ln=k.NAMESPACE||yt,ir=k.MATHML_TEXT_INTEGRATION_POINTS||ir,ar=k.HTML_INTEGRATION_POINTS||ar,ce=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&Nr(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&Nr(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ie&&(Te=!1),En&&(an=!0),cn&&(Y=B({},cc),oe=[],cn.html===!0&&(B(Y,ac),B(oe,lc)),cn.svg===!0&&(B(Y,Os),B(oe,Ms),B(oe,bo)),cn.svgFilters===!0&&(B(Y,Ns),B(oe,Ms),B(oe,bo)),cn.mathMl===!0&&(B(Y,Ds),B(oe,uc),B(oe,bo))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Le.tagCheck=k.ADD_TAGS:(Y===vt&&(Y=Ct(Y)),B(Y,k.ADD_TAGS,ue))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Le.attributeCheck=k.ADD_ATTR:(oe===Tn&&(oe=Ct(oe)),B(oe,k.ADD_ATTR,ue))),k.ADD_URI_SAFE_ATTR&&B(Or,k.ADD_URI_SAFE_ATTR,ue),k.FORBID_CONTENTS&&(Xe===$r&&(Xe=Ct(Xe)),B(Xe,k.FORBID_CONTENTS,ue)),k.ADD_FORBID_CONTENTS&&(Xe===$r&&(Xe=Ct(Xe)),B(Xe,k.ADD_FORBID_CONTENTS,ue)),zr&&(Y["#text"]=!0),qt&&B(Y,["html","head","body"]),Y.table&&(B(Y,["tbody"]),delete se.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw wr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=k.TRUSTED_TYPES_POLICY,R=x.createHTML("")}else x===void 0&&(x=ym(_,o)),x!==null&&typeof R=="string"&&(R=x.createHTML(""));Fe&&Fe(k),un=k}},Dr=B({},[...Os,...Ns,...um]),qo=B({},[...Ds,...dm]),oi=function(k){let S=T(k);(!S||!S.tagName)&&(S={namespaceURI:ln,tagName:"template"});const L=mo(k.tagName),ie=mo(S.tagName);return Rn[k.namespaceURI]?k.namespaceURI===sr?S.namespaceURI===yt?L==="svg":S.namespaceURI===or?L==="svg"&&(ie==="annotation-xml"||ir[ie]):!!Dr[L]:k.namespaceURI===or?S.namespaceURI===yt?L==="math":S.namespaceURI===sr?L==="math"&&ar[ie]:!!qo[L]:k.namespaceURI===yt?S.namespaceURI===sr&&!ar[ie]||S.namespaceURI===or&&!ir[ie]?!1:!qo[L]&&(ni[L]||!Dr[L]):!!(Ft==="application/xhtml+xml"&&Rn[k.namespaceURI]):!1},dt=function(k){vr(t.removed,{element:k});try{T(k).removeChild(k)}catch{M(k)}},pt=function(k,S){try{vr(t.removed,{attribute:S.getAttributeNode(k),from:S})}catch{vr(t.removed,{attribute:null,from:S})}if(S.removeAttribute(k),k==="is")if(an||En)try{dt(S)}catch{}else try{S.setAttribute(k,"")}catch{}},Ho=function(k){let S=null,L=null;if(rr)k="<remove></remove>"+k;else{const ve=$s(k,/^[\r\n\t ]+/);L=ve&&ve[0]}Ft==="application/xhtml+xml"&&ln===yt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const ie=x?x.createHTML(k):k;if(ln===yt)try{S=new m().parseFromString(ie,Ft)}catch{}if(!S||!S.documentElement){S=D.createDocument(ln,"template",null);try{S.documentElement.innerHTML=Pn?R:ie}catch{}}const $e=S.body||S.documentElement;return k&&L&&$e.insertBefore(n.createTextNode(L),$e.childNodes[0]||null),ln===yt?Ce.call(S,qt?"html":"body")[0]:qt?S.documentElement:$e},Mr=function(k){return pe.call(k.ownerDocument||k,k,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Ur=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof p)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Fo=function(k){return typeof u=="function"&&k instanceof u};function xt(N,k,S){go(N,L=>{L.call(t,k,S,un)})}const Bo=function(k){let S=null;if(xt(X.beforeSanitizeElements,k,null),Ur(k))return dt(k),!0;const L=ue(k.nodeName);if(xt(X.uponSanitizeElement,k,{tagName:L,allowedTags:Y}),ut&&k.hasChildNodes()&&!Fo(k.firstElementChild)&&Be(/<[/\w!]/g,k.innerHTML)&&Be(/<[/\w!]/g,k.textContent)||k.nodeType===Sr.progressingInstruction||ut&&k.nodeType===Sr.comment&&Be(/<[/\w]/g,k.data))return dt(k),!0;if(!(Le.tagCheck instanceof Function&&Le.tagCheck(L))&&(!Y[L]||se[L])){if(!se[L]&&Wo(L)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L)))return!1;if(zr&&!Xe[L]){const ie=T(k)||k.parentNode,$e=P(k)||k.childNodes;if($e&&ie){const ve=$e.length;for(let qe=ve-1;qe>=0;--qe){const St=C($e[qe],!0);St.__removalCount=(k.__removalCount||0)+1,ie.insertBefore(St,J(k))}}}return dt(k),!0}return k instanceof d&&!oi(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Be(/<\/no(script|embed|frames)/i,k.innerHTML)?(dt(k),!0):(Ie&&k.nodeType===Sr.text&&(S=k.textContent,go([Pe,Ze,_t],ie=>{S=yr(S,ie," ")}),k.textContent!==S&&(vr(t.removed,{element:k.cloneNode()}),k.textContent=S)),xt(X.afterSanitizeElements,k,null),!1)},Go=function(k,S,L){if(Mo&&(S==="id"||S==="name")&&(L in n||L in Zo))return!1;if(!(Te&&!Re[S]&&Be(sn,S))){if(!(ee&&Be(nt,S))){if(!(Le.attributeCheck instanceof Function&&Le.attributeCheck(S,k))){if(!oe[S]||Re[S]){if(!(Wo(k)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,k)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(k))&&(ce.attributeNameCheck instanceof RegExp&&Be(ce.attributeNameCheck,S)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(S,k))||S==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L))))return!1}else if(!Or[S]){if(!Be(De,yr(L,Z,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&k!=="script"&&im(L,"data:")===0&&le[k])){if(!(et&&!Be(Zt,yr(L,Z,"")))){if(L)return!1}}}}}}}return!0},Wo=function(k){return k!=="annotation-xml"&&$s(k,Q)},jr=function(k){xt(X.beforeSanitizeAttributes,k,null);const{attributes:S}=k;if(!S||Ur(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let ie=S.length;for(;ie--;){const $e=S[ie],{name:ve,namespaceURI:qe,value:St}=$e,zt=ue(ve),Zr=St;let ze=ve==="value"?Zr:am(Zr);if(L.attrName=zt,L.attrValue=ze,L.keepAttr=!0,L.forceKeepAttr=void 0,xt(X.uponSanitizeAttribute,k,L),ze=L.attrValue,Ir&&(zt==="id"||zt==="name")&&(pt(ve,k),ze=ei+ze),ut&&Be(/((--!?|])>)|<\/(style|title|textarea)/i,ze)){pt(ve,k);continue}if(zt==="attributename"&&$s(ze,"href")){pt(ve,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){pt(ve,k);continue}if(!lt&&Be(/\/>/i,ze)){pt(ve,k);continue}Ie&&go([Pe,Ze,_t],Yo=>{ze=yr(ze,Yo," ")});const Jo=ue(k.nodeName);if(!Go(Jo,zt,ze)){pt(ve,k);continue}if(x&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!qe)switch(_.getAttributeType(Jo,zt)){case"TrustedHTML":{ze=x.createHTML(ze);break}case"TrustedScriptURL":{ze=x.createScriptURL(ze);break}}if(ze!==Zr)try{qe?k.setAttributeNS(qe,ve,ze):k.setAttribute(ve,ze),Ur(k)?dt(k):ic(t.removed)}catch{pt(ve,k)}}xt(X.afterSanitizeAttributes,k,null)},Bt=function N(k){let S=null;const L=Mr(k);for(xt(X.beforeSanitizeShadowDOM,k,null);S=L.nextNode();)xt(X.uponSanitizeShadowNode,S,null),Bo(S),jr(S),S.content instanceof i&&N(S.content);xt(X.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(N){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,ie=null,$e=null;if(Pn=!N,Pn&&(N="<!-->"),typeof N!="string"&&!Fo(N))if(typeof N.toString=="function"){if(N=N.toString(),typeof N!="string")throw wr("dirty is not a string, aborting")}else throw wr("toString is not a function");if(!t.isSupported)return N;if(Ht||cr(k),t.removed=[],typeof N=="string"&&(Cn=!1),Cn){if(N.nodeName){const St=ue(N.nodeName);if(!Y[St]||se[St])throw wr("root node is forbidden and cannot be sanitized in-place")}}else if(N instanceof u)S=Ho("<!---->"),L=S.ownerDocument.importNode(N,!0),L.nodeType===Sr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!an&&!Ie&&!qt&&N.indexOf("<")===-1)return x&&An?x.createHTML(N):N;if(S=Ho(N),!S)return an?null:An?R:""}S&&rr&&dt(S.firstChild);const ve=Mr(Cn?N:S);for(;ie=ve.nextNode();)Bo(ie),jr(ie),ie.content instanceof i&&Bt(ie.content);if(Cn)return N;if(an){if(En)for($e=_e.call(S.ownerDocument);S.firstChild;)$e.appendChild(S.firstChild);else $e=S;return(oe.shadowroot||oe.shadowrootmode)&&($e=Ve.call(r,$e,!0)),$e}let qe=qt?S.outerHTML:S.innerHTML;return qt&&Y["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Be(pc,S.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
1430
+ `+qe),Ie&&go([Pe,Ze,_t],St=>{qe=yr(qe,St," ")}),x&&An?x.createHTML(qe):qe},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};cr(N),Ht=!0},t.clearConfig=function(){un=null,Ht=!1},t.isValidAttribute=function(N,k,S){un||cr({});const L=ue(N),ie=ue(k);return Go(L,ie,S)},t.addHook=function(N,k){typeof k=="function"&&vr(X[N],k)},t.removeHook=function(N,k){if(k!==void 0){const S=om(X[N],k);return S===-1?void 0:sm(X[N],S,1)[0]}return ic(X[N])},t.removeHooks=function(N){X[N]=[]},t.removeAllHooks=function(){X=fc()},t}var wm=gc();function mc(e){const t=ne.parse(e,{gfm:!0,breaks:!0,async:!1});return wm.sanitize(t)}const bc=1e3,kc=32,_c=15e3,xm=new Set(["completed","failed","cancelled"]),Sm=4e3;let I=null,Pt=null,Ne=null,Us=null,ko=null,js=!1,_o=null,Tr=null,U={kind:"connecting"},Gn=[],Wn=null,be=null,Jn=null,Dt=null,Er=-1,We=null,Mt=!1,Ut=null,mn=new Set;function Zs(){vo(),Oa(),Pt&&clearInterval(Pt),Pt=null,Ut==null||Ut(),Ut=null,Ne==null||Ne.destroy(),Ne=null,I&&Ot(I),I==null||I.remove(),I=null,Us=null,U={kind:"connecting"},Gn=[],Wn=null,be=null,Jn=null,Dt=null,ko=null,Er=-1,We=null,Mt=!1,mn=new Set}function qs(e,t,n,r,o){I&&Zs(),Us=o??null,U={kind:"connecting"},Gn=[],Wn=null,Er=-1,We=null,Mt=!1,mn=new Set,be=e,Jn=n,Dt=t,ko=r,$a({taskId:e,backendUrl:n,title:r}),I=document.createElement("div"),I.className="ap-sdk-panel",I.setAttribute("data-ap-sdk","1"),I.setAttribute("role","dialog"),I.setAttribute("aria-modal","true"),I.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;I.innerHTML=`
1458
1431
  <div class="ap-sdk-panel__header">
1459
1432
  <span class="ap-sdk-panel__title">
1460
1433
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1467,7 +1440,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1467
1440
  <div class="ap-sdk-runner__meta">
1468
1441
  <div class="ap-sdk-runner__meta-row">
1469
1442
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1470
- <span class="ap-sdk-runner__title" title="${Am(r)}">${qi(s)}</span>
1443
+ <span class="ap-sdk-runner__title" title="${Nm(r)}">${Fs(i)}</span>
1471
1444
  </div>
1472
1445
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1473
1446
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1493,17 +1466,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1493
1466
  </div>
1494
1467
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1495
1468
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1496
- `,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),Oe=ei(),$t(z),ki(z,bi),z.querySelector("[data-ap-close]").addEventListener("click",()=>{Ui(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),km(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const u=a.currentTarget;if(!Mi){Mi=!0,u.textContent="Confirm",ko=setTimeout(_o,gm),xr=d=>{d.target!==u&&_o()},document.addEventListener("click",xr,!0);return}_o(),mm(t,e)}),Zi(),fc(e,t)}function fc(e,t){const n=async u=>{if(be!==e||!z||U.kind!=="idle"&&U.kind!=="connecting"||mn.has(u.commandId))return;mn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};bn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await mc(d,t,e)},r=u=>{if(!(be!==e||!z)&&fm.has(u)){if(U.kind==="executing")bn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;bn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{be!==e||!z||(u.outputChunk&&bc([u.outputChunk]),r(u.status))},s=async()=>{if(!(be!==e||!z))try{const u=await io(t,e);be===e&&z&&(We=u[0]??null,kn())}catch{}},a=async()=>{try{const[u,d,h,p]=await Promise.all([Ta(t,e),If(t,e),io(t,e),Lf(t,e)]);if(be!==e||!z)return;bc(d),We=h[0]??null,kn(),r(u.status),p&&p.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!mn.has(p.id)?(mn.add(p.id),bn({kind:"executing",command:p,actionsRun:U.kind==="idle"?U.actionsRun:0}),await mc(p,t,e)):U.kind==="connecting"&&bn({kind:"idle",actionsRun:0})}catch{}};a(),Hf(t,e,{onStatusUpdate:o,onInteractionCreated:s,onInteractionAnswered:s,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(u=>{if(be!==e||U.kind==="finished"){u();return}Ut=u})}function bn(e){U=e,U.kind==="idle"&&Gn===null&&(Gn=Date.now(),vo(),Pt=setInterval(vo,dc)),U.kind==="finished"&&(Pt&&(clearInterval(Pt),Pt=null),Ut==null||Ut(),Ut=null,Oe==null||Oe.hide(),Pa()),Zi()}function _o(){Mi=!1,ko&&(clearTimeout(ko),ko=null),xr&&(document.removeEventListener("click",xr,!0),xr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function mm(e,t){if(be!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await Nf(e,t)}catch{n&&(n.disabled=!1)}}function gc(){if(!be||!Dt||!Wn||!bo)return;const e=be,t=Dt;Ca({taskId:e,backendUrl:Wn,title:bo}),Pt&&clearInterval(Pt),vo(),Pt=setInterval(vo,dc);const n=U.kind==="finished"?U.actionsRun:0;mn=new Set,U={kind:"idle",actionsRun:n},Zi(),fc(e,t)}function Zi(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",Tm(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const s=n.querySelector("[data-ap-runner-placeholder]");if(Bn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!s){const p=document.createElement("div");p.className="ap-sdk-runner__placeholder",p.setAttribute("data-ap-runner-placeholder","1"),p.textContent="Waiting for the agent's first action…",n.appendChild(p)}}else s==null||s.remove();kn();const a=z.querySelector("[data-ap-runner-chat-input]"),u=z.querySelector("[data-ap-runner-chat-send]");if(a&&u){const p=U.kind==="finished"&&U.status==="failed";a.disabled=p,u.disabled=p||Mt,p&&(a.placeholder="This task failed — start a new automation to continue.")}const d=z.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const h=z.querySelector("[data-ap-runner-summary]");h&&U.kind!=="finished"&&(h.style.display="none",h.innerHTML="")}function kn(){if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!We){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=We.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1497
- <div class="ap-sdk-runner__question-label">${qi((n==null?void 0:n.header)||"The agent has a question")}</div>
1498
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${uc((n==null?void 0:n.question)||We.question)}</div>
1469
+ `,I.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),I.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(I),Ne=ts(),$t(I),vs(I,_s),I.querySelector("[data-ap-close]").addEventListener("click",()=>{Zs(),o==null||o()}),I.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Am(t,e)}),I.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const u=a.currentTarget;if(!js){js=!0,u.textContent="Confirm",_o=setTimeout(vo,Sm),Tr=d=>{d.target!==u&&vo()},document.addEventListener("click",Tr,!0);return}vo(),Tm(t,e)}),Hs(),vc(e,t)}function vc(e,t){const n=async u=>{if(be!==e||!I||U.kind!=="idle"&&U.kind!=="connecting"||mn.has(u.commandId))return;mn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};bn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await wc(d,t,e)},r=u=>{if(!(be!==e||!I)&&xm.has(u)){if(U.kind==="executing")bn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;bn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{be!==e||!I||(u.outputChunk&&xc([u.outputChunk]),r(u.status))},i=async()=>{if(!(be!==e||!I))try{const u=await ao(t,e);be===e&&I&&(We=u[0]??null,kn())}catch{}},a=async()=>{try{const[u,d,h,p]=await Promise.all([Pa(t,e),Zf(t,e),ao(t,e),Uf(t,e)]);if(be!==e||!I)return;xc(d),We=h[0]??null,kn(),r(u.status),p&&p.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!mn.has(p.id)?(mn.add(p.id),bn({kind:"executing",command:p,actionsRun:U.kind==="idle"?U.actionsRun:0}),await wc(p,t,e)):U.kind==="connecting"&&bn({kind:"idle",actionsRun:0})}catch{}};a(),Kf(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(u=>{if(be!==e||U.kind==="finished"){u();return}Ut=u})}function bn(e){U=e,U.kind==="idle"&&Wn===null&&(Wn=Date.now(),yo(),Pt=setInterval(yo,bc)),U.kind==="finished"&&(Pt&&(clearInterval(Pt),Pt=null),Ut==null||Ut(),Ut=null,Ne==null||Ne.hide(),Oa()),Hs()}function vo(){js=!1,_o&&(clearTimeout(_o),_o=null),Tr&&(document.removeEventListener("click",Tr,!0),Tr=null);const e=I==null?void 0:I.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function Tm(e,t){if(be!==t||!I)return;const n=I.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await Hf(e,t)}catch{n&&(n.disabled=!1)}}function yc(){if(!be||!Dt||!Jn||!ko)return;const e=be,t=Dt;$a({taskId:e,backendUrl:Jn,title:ko}),Pt&&clearInterval(Pt),yo(),Pt=setInterval(yo,bc);const n=U.kind==="finished"?U.actionsRun:0;mn=new Set,U={kind:"idle",actionsRun:n},Hs(),vc(e,t)}function Hs(){if(!I)return;const e=I.querySelector("[data-ap-runner-status]"),t=I.querySelector("[data-ap-runner-counter]"),n=I.querySelector("[data-ap-runner-log]"),r=I.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",$m(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Gn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!i){const p=document.createElement("div");p.className="ap-sdk-runner__placeholder",p.setAttribute("data-ap-runner-placeholder","1"),p.textContent="Waiting for the agent's first action…",n.appendChild(p)}}else i==null||i.remove();kn();const a=I.querySelector("[data-ap-runner-chat-input]"),u=I.querySelector("[data-ap-runner-chat-send]");if(a&&u){const p=U.kind==="finished"&&U.status==="failed";a.disabled=p,u.disabled=p||Mt,p&&(a.placeholder="This task failed — start a new automation to continue.")}const d=I.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const h=I.querySelector("[data-ap-runner-summary]");h&&U.kind!=="finished"&&(h.style.display="none",h.innerHTML="")}function kn(){if(!I)return;const e=I.querySelector("[data-ap-runner-question]"),t=I.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!We){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=We.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1470
+ <div class="ap-sdk-runner__question-label">${Fs((n==null?void 0:n.header)||"The agent has a question")}</div>
1471
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${mc((n==null?void 0:n.question)||We.question)}</div>
1499
1472
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1500
- `,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const s of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=s.label,a.addEventListener("click",()=>void bm(s.label)),o.appendChild(a)}}}async function bm(e){if(!z||!We||!be||Mt)return;const t=be,n=Dt;if(n){Mt=!0;try{const r={selectedOption:e};await Ea(n,t,We.id,r),We=null,kn();const o=await io(n,t);be===t&&z&&(We=o[0]??null,kn())}catch{const r=z.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Mt=!1}}}function vo(){if(!z||Gn===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Gn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function mc(e,t,n){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Oe==null||Oe.update(a),o=vm(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Oe==null||Oe.update(a),e.action==="click")await Bf(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");ym(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(be===n&&z&&wm(r,e,o),await _m(t,n,e.id,r,o),be!==n||!z)return;Oe==null||Oe.hide();const s=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?bn({kind:"finished",status:U.status,actionsRun:s}):U.kind==="executing"&&bn({kind:"idle",actionsRun:s})}async function km(e,t){if(!z||Mt||U.kind==="finished"&&U.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const s=n.value.trim();if(s){Mt=!0,o.disabled=!0,r.style.display="none";try{if(We){await Ea(e,t,We.id,s),We=null,kn();try{const a=await io(e,t);be===t&&z&&(We=a[0]??null,kn())}catch{}}else await $f(e,t,s),U.kind==="finished"&&gc();n.value=""}catch(a){r.textContent=a instanceof Error?a.message:"Failed to send — try again.",r.style.display="block"}finally{Mt=!1,o.disabled=!1}}}async function _m(e,t,n,r,o){try{await zf(e,t,n,r,o)}catch{}}function vm(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),gs(t);let n=t.outerHTML,r=!1;return n.length>hc&&(n=n.slice(0,hc),r=!0),`URL: ${location.href}
1473
+ `,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const i of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=i.label,a.addEventListener("click",()=>void Em(i.label)),o.appendChild(a)}}}async function Em(e){if(!I||!We||!be||Mt)return;const t=be,n=Dt;if(n){Mt=!0;try{const r={selectedOption:e};await Ia(n,t,We.id,r),We=null,kn();const o=await ao(n,t);be===t&&I&&(We=o[0]??null,kn())}catch{const r=I.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Mt=!1}}}function yo(){if(!I||Wn===null)return;const e=I.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Wn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function wc(e,t,n){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Ne==null||Ne.update(a),o=Pm(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Ne==null||Ne.update(a),e.action==="click")await eg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Rm(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(be===n&&I&&Lm(r,e,o),await Cm(t,n,e.id,r,o),be!==n||!I)return;Ne==null||Ne.hide();const i=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?bn({kind:"finished",status:U.status,actionsRun:i}):U.kind==="executing"&&bn({kind:"idle",actionsRun:i})}async function Am(e,t){if(!I||Mt||U.kind==="finished"&&U.status==="failed")return;const n=I.querySelector("[data-ap-runner-chat-input]"),r=I.querySelector("[data-ap-runner-chat-error]"),o=I.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Mt=!0,o.disabled=!0,r.style.display="none";try{if(We){await Ia(e,t,We.id,i),We=null,kn();try{const a=await ao(e,t);be===t&&I&&(We=a[0]??null,kn())}catch{}}else await qf(e,t,i),U.kind==="finished"&&yc();n.value=""}catch(a){r.textContent=a instanceof Error?a.message:"Failed to send — try again.",r.style.display="block"}finally{Mt=!1,o.disabled=!1}}}async function Cm(e,t,n,r,o){try{await jf(e,t,n,r,o)}catch{}}function Pm(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),_i(t);let n=t.outerHTML,r=!1;return n.length>_c&&(n=n.slice(0,_c),r=!0),`URL: ${location.href}
1501
1474
  Title: ${document.title}
1502
1475
 
1503
1476
  ${n}${r?`
1504
- … (truncated)`:""}`}function ym(e,t){var s;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(s=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:s.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function wm(e,t,n){var b;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",s=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=a?` — ${a}`:"";if(Bn.push({status:e,text:`${r} ${s}${u}`}),!z)return;const d=z.querySelector("[data-ap-runner-log]");if(!d)return;(b=d.querySelector("[data-ap-runner-placeholder]"))==null||b.remove();const h=d.scrollHeight-d.scrollTop-d.clientHeight<=pc,p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=Bn[Bn.length-1].text,d.appendChild(p),h&&(d.scrollTop=d.scrollHeight)}function xm(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function Sm(e){const t=xm(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function bc(e){var r;const t=e.filter(o=>o.sequence>Sr).sort((o,s)=>o.sequence-s.sequence);if(t.length===0||(Sr=Math.max(Sr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const s=Sm(o);if(!s)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=pc,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=uc(s)):u.textContent=s,n.appendChild(u),a&&(n.scrollTop=n.scrollHeight)}}function Tm(e){if(!z||!be||!Wn)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Wn.replace(/\/+$/,"")}/tasks/${be}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1477
+ … (truncated)`:""}`}function Rm(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Lm(e,t,n){var b;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=a?` — ${a}`:"";if(Gn.push({status:e,text:`${r} ${i}${u}`}),!I)return;const d=I.querySelector("[data-ap-runner-log]");if(!d)return;(b=d.querySelector("[data-ap-runner-placeholder]"))==null||b.remove();const h=d.scrollHeight-d.scrollTop-d.clientHeight<=kc,p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=Gn[Gn.length-1].text,d.appendChild(p),h&&(d.scrollTop=d.scrollHeight)}function Im(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function zm(e){const t=Im(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function xc(e){var r;const t=e.filter(o=>o.sequence>Er).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Er=Math.max(Er,...t.map(o=>o.sequence)),!I))return;const n=I.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=zm(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=kc,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=mc(i)):u.textContent=i,n.appendChild(u),a&&(n.scrollTop=n.scrollHeight)}}function $m(e){if(!I||!be||!Jn)return;const t=I.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Jn.replace(/\/+$/,"")}/tasks/${be}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1505
1478
  <div class="ap-sdk-success-card">
1506
- <p class="ap-sdk-success-headline">${qi(r)}</p>
1479
+ <p class="ap-sdk-success-headline">${Fs(r)}</p>
1507
1480
  ${o?`
1508
1481
  <div class="ap-sdk-runner__approval" data-ap-runner-approval>
1509
1482
  <div class="ap-sdk-runner__approval-actions">
@@ -1521,7 +1494,7 @@ ${n}${r?`
1521
1494
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
1522
1495
  </div>
1523
1496
  </div>
1524
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const s=Di;Ui(),s==null||s()}),o&&Em(t)}function Em(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),s=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=p=>{a.textContent=p,a.style.display="block"};t.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{await Of(b,p),u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,d(m instanceof Error?m.message:"Failed to approve — try again.")}}),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const h=()=>{s.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",h),s.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt,m=o.value.trim();s.disabled=!0,t.disabled=!0,a.style.display="none",s.textContent="Rejecting…";try{await Df(b,p,m),m?gc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){s.disabled=!1,t.disabled=!1,h(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function Am(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cm(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1497
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=Us;Zs(),i==null||i()}),o&&Om(t)}function Om(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=p=>{a.textContent=p,a.style.display="block"};t.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{await Ff(b,p),u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,d(m instanceof Error?m.message:"Failed to approve — try again.")}}),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const h=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",h),i.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{await Bf(b,p,m),m?yc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){i.disabled=!1,t.disabled=!1,h(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function Nm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Fs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Dm(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1525
1498
  <details class="ap-sdk-advanced__details">
1526
1499
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1527
1500
  <div class="ap-sdk-advanced__body">
@@ -1540,12 +1513,12 @@ ${n}${r?`
1540
1513
  </div>
1541
1514
  </div>
1542
1515
  </details>
1543
- `,e.appendChild(o);const s=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};Af(h,n??void 0).then(p=>{if(d=p,p.length===0){s.style.display="none";return}const b=p.find(m=>m.isDefault&&m.scope==="project")??p.find(m=>m.isDefault&&m.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+p.map(m=>`<option value="${Pm(m.id)}">${Rm(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),a.value=(b==null?void 0:b.id)??""}).catch(()=>{s.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const h=document.createElement("span");h.className="ap-sdk-advanced__hint",h.textContent="Connect credentials to enable template selection",s.appendChild(h)}return{getOptions(){var b,m,_,w,C,M,W;const h=a.value||null,p=h?((b=d.find(P=>P.id===h))==null?void 0:b.templateData)??{}:{};return{claudeTemplateId:h,quickMode:u.checked,...p.modelOverride!=null?{modelOverride:p.modelOverride}:{},...p.claudeProfileId!=null?{claudeProfileId:p.claudeProfileId}:{},...p.effort!=null?{effort:p.effort}:{},...p.executionMode!=null?{executionMode:p.executionMode}:{},...(m=p.selectedPluginIds)!=null&&m.length?{selectedPluginIds:p.selectedPluginIds}:{},...(_=p.selectedSkillIds)!=null&&_.length?{selectedSkillIds:p.selectedSkillIds}:{},...(w=p.selectedPluginSkillIds)!=null&&w.length?{selectedPluginSkillIds:p.selectedPluginSkillIds}:{},...(C=p.selectedMcpServerIds)!=null&&C.length?{selectedMcpServerIds:p.selectedMcpServerIds}:{},...(M=p.selectedSlashCommandIds)!=null&&M.length?{selectedSlashCommandIds:p.selectedSlashCommandIds}:{},...(W=p.selectedRemoteContextProviderIds)!=null&&W.length?{selectedRemoteContextProviderIds:p.selectedRemoteContextProviderIds}:{}}}}}function Pm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Hi="ap-sdk-captures",Lm=50;function Jn(){try{const e=localStorage.getItem(Hi);return e?JSON.parse(e):[]}catch{return[]}}function zm(e){const t=Jn(),n=[e,...t].slice(0,Lm);try{localStorage.setItem(Hi,JSON.stringify(n))}catch{}}function Im(){try{localStorage.removeItem(Hi)}catch{}}function kc(e){var a,u,d,h,p;if(e.id){const b=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=b==null?void 0:b.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(u=t==null?void 0:t.textContent)==null?void 0:u.trim();if(n)return n;const r=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(r)return r;const o=(h=e.placeholder)==null?void 0:h.trim();if(o)return o;const s=(p=e.getAttribute("name"))==null?void 0:p.trim();return s||e.tagName.toLowerCase()}function $m(e,t){return`Click "${e}" ${t.toLowerCase()}`}function _c(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function vc(e,t){return`Scrolled to (${e}, ${t})`}function Nm(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function yc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1544
- `)}const Om=400,Dm=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Mm=new Set(["Control","Meta","Alt","Shift"]);function Um(e){if(Mm.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):Dm.has(e.key)?e.key:null}function jm(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?kc(e):Br(e)||e.tagName.toLowerCase()}let Xn=[],Je=null,yo=null,Qe=null,Rt=null,Lt=null;function wc(){yo&&(yo.textContent=`● Recording — ${Xn.length} step${Xn.length===1?"":"s"}`)}function Fi(){Lt&&(clearTimeout(Lt),Lt=null),Rt&&(Xn.push(Rt),Rt=null,wc())}function Bi(e){Fi(),Xn.push(e),wc()}function Zm(e){var t,n;return e instanceof HTMLSelectElement?((n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())??e.value:e.value}function qm(e,t){Qe&&Qe(),Xn=[],Rt=null,Je=document.createElement("div"),Je.className="ap-sdk-recorder-bar",Je.setAttribute("data-ap-sdk","1"),Je.innerHTML=`
1516
+ `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};Df(h,n??void 0).then(p=>{if(d=p,p.length===0){i.style.display="none";return}const b=p.find(m=>m.isDefault&&m.scope==="project")??p.find(m=>m.isDefault&&m.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+p.map(m=>`<option value="${Mm(m.id)}">${Um(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),a.value=(b==null?void 0:b.id)??""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const h=document.createElement("span");h.className="ap-sdk-advanced__hint",h.textContent="Connect credentials to enable template selection",i.appendChild(h)}return{getOptions(){var b,m,_,y,C,M,J;const h=a.value||null,p=h?((b=d.find(P=>P.id===h))==null?void 0:b.templateData)??{}:{};return{claudeTemplateId:h,quickMode:u.checked,...p.modelOverride!=null?{modelOverride:p.modelOverride}:{},...p.claudeProfileId!=null?{claudeProfileId:p.claudeProfileId}:{},...p.effort!=null?{effort:p.effort}:{},...p.executionMode!=null?{executionMode:p.executionMode}:{},...(m=p.selectedPluginIds)!=null&&m.length?{selectedPluginIds:p.selectedPluginIds}:{},...(_=p.selectedSkillIds)!=null&&_.length?{selectedSkillIds:p.selectedSkillIds}:{},...(y=p.selectedPluginSkillIds)!=null&&y.length?{selectedPluginSkillIds:p.selectedPluginSkillIds}:{},...(C=p.selectedMcpServerIds)!=null&&C.length?{selectedMcpServerIds:p.selectedMcpServerIds}:{},...(M=p.selectedSlashCommandIds)!=null&&M.length?{selectedSlashCommandIds:p.selectedSlashCommandIds}:{},...(J=p.selectedRemoteContextProviderIds)!=null&&J.length?{selectedRemoteContextProviderIds:p.selectedRemoteContextProviderIds}:{}}}}}function Mm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Um(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Bs="ap-sdk-captures",jm=50;function Yn(){try{const e=localStorage.getItem(Bs);return e?JSON.parse(e):[]}catch{return[]}}function Zm(e){const t=Yn(),n=[e,...t].slice(0,jm);try{localStorage.setItem(Bs,JSON.stringify(n))}catch{}}function qm(){try{localStorage.removeItem(Bs)}catch{}}function Sc(e){var a,u,d,h,p;if(e.id){const b=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=b==null?void 0:b.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(u=t==null?void 0:t.textContent)==null?void 0:u.trim();if(n)return n;const r=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(r)return r;const o=(h=e.placeholder)==null?void 0:h.trim();if(o)return o;const i=(p=e.getAttribute("name"))==null?void 0:p.trim();return i||e.tagName.toLowerCase()}function Hm(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Tc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Ec(e,t){return`Scrolled to (${e}, ${t})`}function Fm(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Ac(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1517
+ `)}const Bm=400,Gm=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Wm=new Set(["Control","Meta","Alt","Shift"]);function Jm(e){if(Wm.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):Gm.has(e.key)?e.key:null}function Ym(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Sc(e):Br(e)||e.tagName.toLowerCase()}let Vn=[],Je=null,wo=null,Qe=null,Rt=null,Lt=null;function Cc(){wo&&(wo.textContent=`● Recording — ${Vn.length} step${Vn.length===1?"":"s"}`)}function Gs(){Lt&&(clearTimeout(Lt),Lt=null),Rt&&(Vn.push(Rt),Rt=null,Cc())}function Ws(e){Gs(),Vn.push(e),Cc()}function Vm(e){var t,n;return e instanceof HTMLSelectElement?((n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())??e.value:e.value}function Xm(e,t){Qe&&Qe(),Vn=[],Rt=null,Je=document.createElement("div"),Je.className="ap-sdk-recorder-bar",Je.setAttribute("data-ap-sdk","1"),Je.innerHTML=`
1545
1518
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1546
1519
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1547
1520
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1548
- `,document.body.appendChild(Je),$t(Je),yo=Je.querySelector("[data-ap-recorder-counter]");const n=()=>{Fi();const d=Xn;Qe==null||Qe(),e(d)},r=()=>{Qe==null||Qe()};Je.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Je.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(ur(d.target))return;const h=d.target;Bi({action:"click",cssSelector:Fr(h),elementText:Br(h),description:$m(Br(h),h.tagName),capturedAt:new Date().toISOString()})},s=d=>{if(ur(d.target))return;const h=d.target;if(!(h instanceof HTMLInputElement)&&!(h instanceof HTMLTextAreaElement)&&!(h instanceof HTMLSelectElement))return;const p=kc(h),b=Il(h),m=b?"[redacted]":Zm(h);Bi({action:"inputText",cssSelector:Fr(h),elementText:p,value:m,...b?{redacted:!0}:{},description:_c(p,m,b),capturedAt:new Date().toISOString()})},a=()=>{const d=Math.round(window.scrollX),h=Math.round(window.scrollY);Rt?(Rt.scrollX=d,Rt.scrollY=h,Rt.description=vc(d,h)):Rt={action:"scroll",scrollX:d,scrollY:h,description:vc(d,h),capturedAt:new Date().toISOString()},Lt&&clearTimeout(Lt),Lt=setTimeout(()=>{Lt=null,Fi()},Om)},u=d=>{if(d.key==="Escape"){r();return}if(ur(d.target))return;const h=Um(d);if(!h)return;const p=d.target instanceof Element?d.target:document.body,b=jm(p);Bi({action:"keypress",cssSelector:Fr(p),elementText:b,key:h,description:Nm(h,b),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",s,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),Qe=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",s,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),Lt&&(clearTimeout(Lt),Lt=null),Rt=null,Je&&Nt(Je),Je==null||Je.remove(),Je=null,yo=null,Qe=null}}function Hm(){Qe==null||Qe()}function wo(){return Qe!==null}const Fm="data-ap-sdk",Bm="ap-sdk-fab",xc="ap-sdk-fab--dragging",Gi="ap-sdk-fab--open",Sc="ap-sdk-fab-pos",xo="ap-sdk-fab--left-edge",Gm='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',Wm='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',Jm='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',Xm='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let I=null,et=null,Qt=null,en=null,tn=null,Vn=null,Yn=null,Kn=null,So=null,Tr=null,Qn=null,To=null,Eo=null,Ao=null,Tc=0,Ec=0,Ac=0,Cc=0,er=!1,kt=!1,Er=null,_n=null;function Vm(){Er=e=>{if(!I){Co();return}if(!er){if(Math.hypot(e.clientX-Ac,e.clientY-Cc)<5)return;er=!0,kt=!0,I.classList.add(xc)}Ym(e.clientX-Tc,e.clientY-Ec)},_n=()=>{if(!I){Co();return}er?(er=!1,I.classList.remove(xc),I.style.transition="",Km(I.getBoundingClientRect())):I.style.transition="",Co()},window.addEventListener("pointermove",Er),window.addEventListener("pointerup",_n),window.addEventListener("pointercancel",_n)}function Co(){Er&&(window.removeEventListener("pointermove",Er),Er=null),_n&&(window.removeEventListener("pointerup",_n),window.removeEventListener("pointercancel",_n),_n=null)}function Ym(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function Km(e){if(!I)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(xo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(xo));try{localStorage.setItem(Sc,JSON.stringify({edge:r,bottom:n}))}catch{}}function Qm(){if(I)try{const e=localStorage.getItem(Sc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(xo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(xo))}catch{}}function tr(){I==null||I.classList.remove(Gi),Qn&&(window.removeEventListener("pointerdown",Qn,{capture:!0}),Qn=null)}function eb(){I&&(I.classList.add(Gi),Qn=e=>{!I||I.contains(e.target)||tr()},requestAnimationFrame(()=>{Qn&&window.addEventListener("pointerdown",Qn,{capture:!0})}))}function Po(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Pc(e,t,n){if(To=e,Eo=t,Ao=n,I)return;I=document.createElement("div"),I.className=Bm,I.setAttribute(Fm,"1"),Vn=document.createElement("div"),Vn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",tn=document.createElement("button"),tn.className="ap-sdk-fab__list ap-sdk-fab__sub",tn.setAttribute("aria-label","My captures"),tn.setAttribute("title","View my captures"),tn.appendChild(Po(Xm)),Vn.appendChild(r),Vn.appendChild(tn),Yn=document.createElement("div"),Yn.className="ap-sdk-fab__row";const o=document.createElement("span");o.className="ap-sdk-fab__label",o.textContent="Capture element",Qt=document.createElement("button"),Qt.className="ap-sdk-fab__capture ap-sdk-fab__sub",Qt.setAttribute("aria-label","Capture element"),Qt.setAttribute("title","Capture element to Agent Platform"),Qt.appendChild(Po(Wm)),Yn.appendChild(o),Yn.appendChild(Qt),Kn=document.createElement("div"),Kn.className="ap-sdk-fab__row";const s=document.createElement("span");s.className="ap-sdk-fab__label",s.textContent="Record interaction",en=document.createElement("button"),en.className="ap-sdk-fab__record ap-sdk-fab__sub",en.setAttribute("aria-label","Record interaction"),en.setAttribute("title","Record a sequence of interactions"),en.appendChild(Po(Jm)),Kn.appendChild(s),Kn.appendChild(en),et=document.createElement("button"),et.className="ap-sdk-fab__main",et.setAttribute("aria-label","Agent Platform"),et.setAttribute("title","Agent Platform"),et.appendChild(Po(Gm));const a=document.createElement("span");a.className="ap-sdk-fab__badge",a.setAttribute("data-ap-badge",""),a.style.display="none",et.appendChild(a),I.appendChild(Vn),I.appendChild(Yn),I.appendChild(Kn),I.appendChild(et),et.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),I!=null&&I.classList.contains(Gi)?tr():eb()}),Qt.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),tr(),!Nn()&&!wo()&&To&&To()}),en.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),tr(),!Nn()&&!wo()&&Eo&&Eo()}),tn.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),tr(),Ao&&Ao()}),Tr=u=>{if(!I||!(I===u.target||I.contains(u.target)))return;const d=I.getBoundingClientRect();Tc=u.clientX-d.left,Ec=u.clientY-d.top,Ac=u.clientX,Cc=u.clientY,er=!1,kt=!1,I.style.transition="none",u.stopPropagation(),Vm()},window.addEventListener("pointerdown",Tr,{capture:!0}),(document.body??document.documentElement).appendChild(I),$t(I),Qm(),So=setInterval(()=>{et&&et.classList.toggle("ap-sdk-fab__main--active",Nn()||wo())},200)}function vn(e){const t=et==null?void 0:et.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Rc(){er=!1,kt=!1,Co(),tr(),So&&(clearInterval(So),So=null),Tr&&(window.removeEventListener("pointerdown",Tr,{capture:!0}),Tr=null),I&&Nt(I),I==null||I.remove(),I=null,et=null,Qt=null,en=null,tn=null,Vn=null,Yn=null,Kn=null,To=null,Eo=null,Ao=null}async function Lc(e,t){try{if(e.type==="planning"){const r=await Cf(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await Ta(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function zc(e){return e.filter(t=>!t.approved).length}async function Ic(e){const t=Jn();if(!e||t.length===0){vn(t.length);return}const n=await Promise.all(t.map(r=>Lc(r,e)));vn(zc(n))}let q=null,Xe=null,jt=null;function Ar(){return q!==null}function Cr(){q&&Nt(q),q==null||q.remove(),q=null,jt==null||jt(),jt=null,Xe==null||Xe.destroy(),Xe=null}function $c(e,t,n,r,o,s,a,u,d,h){q&&Cr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},b=!n.backendUrl||!n.token;q=document.createElement("div"),q.className="ap-sdk-panel",q.setAttribute("data-ap-sdk","1"),q.setAttribute("role","dialog"),q.setAttribute("aria-modal","true"),q.setAttribute("aria-label","Capture to Agent Platform"),q.innerHTML=`
1521
+ `,document.body.appendChild(Je),$t(Je),wo=Je.querySelector("[data-ap-recorder-counter]");const n=()=>{Gs();const d=Vn;Qe==null||Qe(),e(d)},r=()=>{Qe==null||Qe()};Je.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Je.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(pr(d.target))return;const h=d.target;Ws({action:"click",cssSelector:Fr(h),elementText:Br(h),description:Hm(Br(h),h.tagName),capturedAt:new Date().toISOString()})},i=d=>{if(pr(d.target))return;const h=d.target;if(!(h instanceof HTMLInputElement)&&!(h instanceof HTMLTextAreaElement)&&!(h instanceof HTMLSelectElement))return;const p=Sc(h),b=jl(h),m=b?"[redacted]":Vm(h);Ws({action:"inputText",cssSelector:Fr(h),elementText:p,value:m,...b?{redacted:!0}:{},description:Tc(p,m,b),capturedAt:new Date().toISOString()})},a=()=>{const d=Math.round(window.scrollX),h=Math.round(window.scrollY);Rt?(Rt.scrollX=d,Rt.scrollY=h,Rt.description=Ec(d,h)):Rt={action:"scroll",scrollX:d,scrollY:h,description:Ec(d,h),capturedAt:new Date().toISOString()},Lt&&clearTimeout(Lt),Lt=setTimeout(()=>{Lt=null,Gs()},Bm)},u=d=>{if(d.key==="Escape"){r();return}if(pr(d.target))return;const h=Jm(d);if(!h)return;const p=d.target instanceof Element?d.target:document.body,b=Ym(p);Ws({action:"keypress",cssSelector:Fr(p),elementText:b,key:h,description:Fm(h,b),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),Qe=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),Lt&&(clearTimeout(Lt),Lt=null),Rt=null,Je&&Ot(Je),Je==null||Je.remove(),Je=null,wo=null,Qe=null}}function Km(){Qe==null||Qe()}function xo(){return Qe!==null}const Qm="data-ap-sdk",eb="ap-sdk-fab",Pc="ap-sdk-fab--dragging",Js="ap-sdk-fab--open",Rc="ap-sdk-fab-pos",So="ap-sdk-fab--left-edge",tb='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',nb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',rb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',ob='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let z=null,It=null,en=null,tn=null,at=null,Xn=null,Kn=null,Qn=null,To=null,Ar=null,er=null,Eo=null,Ao=null,Co=null,Lc=0,Ic=0,zc=0,$c=0,tr=!1,kt=!1,Cr=null,_n=null;function sb(){Cr=e=>{if(!z){Po();return}if(!tr){if(Math.hypot(e.clientX-zc,e.clientY-$c)<5)return;tr=!0,kt=!0,z.classList.add(Pc)}ib(e.clientX-Lc,e.clientY-Ic)},_n=()=>{if(!z){Po();return}tr?(tr=!1,z.classList.remove(Pc),z.style.transition="",ab(z.getBoundingClientRect())):z.style.transition="",Po()},window.addEventListener("pointermove",Cr),window.addEventListener("pointerup",_n),window.addEventListener("pointercancel",_n)}function Po(){Cr&&(window.removeEventListener("pointermove",Cr),Cr=null),_n&&(window.removeEventListener("pointerup",_n),window.removeEventListener("pointercancel",_n),_n=null)}function ib(e,t){if(!z)return;const n=z.offsetWidth||52,r=z.offsetHeight||52;z.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,z.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,z.style.bottom="auto",z.style.right="auto"}function ab(e){if(!z)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";z.style.top="auto",z.style.bottom=`${n}px`,r==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(So)):(z.style.left="auto",z.style.right="16px",z.classList.remove(So));try{localStorage.setItem(Rc,JSON.stringify({edge:r,bottom:n}))}catch{}}function cb(){if(z)try{const e=localStorage.getItem(Rc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));z.style.top="auto",z.style.bottom=`${r}px`,t.edge==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(So)):(z.style.left="auto",z.style.right="16px",z.classList.remove(So))}catch{}}function nr(){z==null||z.classList.remove(Js),er&&(window.removeEventListener("pointerdown",er,{capture:!0}),er=null)}function lb(){z&&(z.classList.add(Js),er=e=>{!z||z.contains(e.target)||nr()},requestAnimationFrame(()=>{er&&window.addEventListener("pointerdown",er,{capture:!0})}))}function Ro(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Oc(e,t,n){if(Eo=e,Ao=t,Co=n,z)return;z=document.createElement("div"),z.className=eb,z.setAttribute(Qm,"1"),Xn=document.createElement("div"),Xn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",at=document.createElement("button"),at.className="ap-sdk-fab__list ap-sdk-fab__sub",at.setAttribute("aria-label","My captures"),at.setAttribute("title","View my captures"),at.appendChild(Ro(ob));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",at.appendChild(o),Xn.appendChild(r),Xn.appendChild(at),Kn=document.createElement("div"),Kn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",en=document.createElement("button"),en.className="ap-sdk-fab__capture ap-sdk-fab__sub",en.setAttribute("aria-label","Capture element"),en.setAttribute("title","Capture element to Agent Platform"),en.appendChild(Ro(nb)),Kn.appendChild(i),Kn.appendChild(en),Qn=document.createElement("div"),Qn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",tn=document.createElement("button"),tn.className="ap-sdk-fab__record ap-sdk-fab__sub",tn.setAttribute("aria-label","Record interaction"),tn.setAttribute("title","Record a sequence of interactions"),tn.appendChild(Ro(rb)),Qn.appendChild(a),Qn.appendChild(tn),It=document.createElement("button"),It.className="ap-sdk-fab__main",It.setAttribute("aria-label","Agent Platform"),It.setAttribute("title","Agent Platform"),It.appendChild(Ro(tb)),z.appendChild(Xn),z.appendChild(Kn),z.appendChild(Qn),z.appendChild(It),It.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),z!=null&&z.classList.contains(Js)?nr():lb()}),en.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),nr(),!Nn()&&!xo()&&Eo&&Eo()}),tn.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),nr(),!Nn()&&!xo()&&Ao&&Ao()}),at.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),nr(),Co&&Co()}),Ar=u=>{if(!z||!(z===u.target||z.contains(u.target)))return;const d=z.getBoundingClientRect();Lc=u.clientX-d.left,Ic=u.clientY-d.top,zc=u.clientX,$c=u.clientY,tr=!1,kt=!1,z.style.transition="none",u.stopPropagation(),sb()},window.addEventListener("pointerdown",Ar,{capture:!0}),(document.body??document.documentElement).appendChild(z),$t(z),cb(),To=setInterval(()=>{It&&It.classList.toggle("ap-sdk-fab__main--active",Nn()||xo())},200)}function vn(e){const t=at==null?void 0:at.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Nc(){tr=!1,kt=!1,Po(),nr(),To&&(clearInterval(To),To=null),Ar&&(window.removeEventListener("pointerdown",Ar,{capture:!0}),Ar=null),z&&Ot(z),z==null||z.remove(),z=null,It=null,en=null,tn=null,at=null,Xn=null,Kn=null,Qn=null,Eo=null,Ao=null,Co=null}async function Dc(e,t){try{if(e.type==="planning"){const r=await Mf(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await Pa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function Mc(e){return e.filter(t=>!t.approved).length}async function Uc(e){const t=Yn();if(!e||t.length===0){vn(t.length);return}const n=await Promise.all(t.map(r=>Dc(r,e)));vn(Mc(n))}let q=null,Ye=null,jt=null;function Pr(){return q!==null}function Rr(){q&&Ot(q),q==null||q.remove(),q=null,jt==null||jt(),jt=null,Ye==null||Ye.destroy(),Ye=null}function jc(e,t,n,r,o,i,a,u,d,h){q&&Rr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},b=!n.backendUrl||!n.token;q=document.createElement("div"),q.className="ap-sdk-panel",q.setAttribute("data-ap-sdk","1"),q.setAttribute("role","dialog"),q.setAttribute("aria-modal","true"),q.setAttribute("aria-label","Capture to Agent Platform"),q.innerHTML=`
1549
1522
  <div class="ap-sdk-panel__header">
1550
1523
  <span class="ap-sdk-panel__title">
1551
1524
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1558,7 +1531,7 @@ ${n}${r?`
1558
1531
  </div>
1559
1532
  <div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
1560
1533
  <div class="ap-sdk-panel__context" data-ap-context>
1561
- ${Nc(e)}
1534
+ ${Zc(e)}
1562
1535
  </div>
1563
1536
  <div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
1564
1537
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
@@ -1609,41 +1582,41 @@ ${n}${r?`
1609
1582
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1610
1583
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1611
1584
  </div>
1612
- `,q.addEventListener("wheel",Z=>{Z.stopPropagation()},{passive:!0}),q.addEventListener("touchmove",Z=>{Z.stopPropagation()},{passive:!0});const m=q.querySelector(".ap-sdk-panel__body"),_=Cm(m,n,(r==null?void 0:r.id)??null);document.body.appendChild(q),Xe=ei(),p.currentPickedEl&&Xe.update(p.currentPickedEl),$t(q),ki(q,bi);const w=q.querySelector("[data-ap-close]"),C=q.querySelector("[data-ap-cancel]"),M=q.querySelector("[data-ap-submit]"),W=q.querySelector("[data-ap-note]"),P=q.querySelector("[data-ap-status]"),T=q.querySelectorAll("[data-ap-type]"),x=q.querySelector("[data-ap-pick-list]"),R=q.querySelector("[data-ap-context]"),D=q.querySelector("[data-ap-add-another]"),pe=q.querySelector("[data-ap-pick-actions]"),_e=q.querySelector("[data-ap-select-parent]"),Ce=q.querySelector("[data-ap-reselect]"),Ve=()=>{p.currentPickedEl&&(Xe==null||Xe.update(p.currentPickedEl))};window.addEventListener("scroll",Ve,{capture:!0,passive:!0}),window.addEventListener("resize",Ve),jt=()=>{window.removeEventListener("scroll",Ve,!0),window.removeEventListener("resize",Ve)};const V=Z=>{Z?(R.innerHTML=Nc(Z),W.disabled=!1,W.placeholder="Describe the task or planning session…",setTimeout(()=>W.focus(),50)):(R.innerHTML=`
1585
+ `,q.addEventListener("wheel",Z=>{Z.stopPropagation()},{passive:!0}),q.addEventListener("touchmove",Z=>{Z.stopPropagation()},{passive:!0});const m=q.querySelector(".ap-sdk-panel__body"),_=Dm(m,n,(r==null?void 0:r.id)??null);document.body.appendChild(q),Ye=ts(),p.currentPickedEl&&Ye.update(p.currentPickedEl),$t(q),vs(q,_s);const y=q.querySelector("[data-ap-close]"),C=q.querySelector("[data-ap-cancel]"),M=q.querySelector("[data-ap-submit]"),J=q.querySelector("[data-ap-note]"),P=q.querySelector("[data-ap-status]"),T=q.querySelectorAll("[data-ap-type]"),x=q.querySelector("[data-ap-pick-list]"),R=q.querySelector("[data-ap-context]"),D=q.querySelector("[data-ap-add-another]"),pe=q.querySelector("[data-ap-pick-actions]"),_e=q.querySelector("[data-ap-select-parent]"),Ce=q.querySelector("[data-ap-reselect]"),Ve=()=>{p.currentPickedEl&&(Ye==null||Ye.update(p.currentPickedEl))};window.addEventListener("scroll",Ve,{capture:!0,passive:!0}),window.addEventListener("resize",Ve),jt=()=>{window.removeEventListener("scroll",Ve,!0),window.removeEventListener("resize",Ve)};const X=Z=>{Z?(R.innerHTML=Zc(Z),J.disabled=!1,J.placeholder="Describe the task or planning session…",setTimeout(()=>J.focus(),50)):(R.innerHTML=`
1613
1586
  <div class="ap-sdk-panel__context-label">Next element</div>
1614
1587
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1615
- `,W.disabled=!0,W.placeholder="Pick an element to continue…")},Pe=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((Z,K)=>`
1616
- <div class="ap-sdk-pick-entry" data-pick-index="${K}">
1588
+ `,J.disabled=!0,J.placeholder="Pick an element to continue…")},Pe=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((Z,Q)=>`
1589
+ <div class="ap-sdk-pick-entry" data-pick-index="${Q}">
1617
1590
  <div class="ap-sdk-pick-entry__header">
1618
- <span class="ap-sdk-pick-entry__number">${K+1}</span>
1619
- <span class="ap-sdk-pick-entry__element" title="${nt(Z.ctx.elementText??"")}">${nt(Z.ctx.elementText||"(no text)")}</span>
1620
- <button class="ap-sdk-pick-entry__remove" data-ap-remove="${K}" aria-label="Remove pick ${K+1}">×</button>
1591
+ <span class="ap-sdk-pick-entry__number">${Q+1}</span>
1592
+ <span class="ap-sdk-pick-entry__element" title="${tt(Z.ctx.elementText??"")}">${tt(Z.ctx.elementText||"(no text)")}</span>
1593
+ <button class="ap-sdk-pick-entry__remove" data-ap-remove="${Q}" aria-label="Remove pick ${Q+1}">×</button>
1621
1594
  </div>
1622
- <div class="ap-sdk-pick-entry__instruction">${nt(Z.instruction)}</div>
1595
+ <div class="ap-sdk-pick-entry__instruction">${tt(Z.instruction)}</div>
1623
1596
  </div>
1624
- `).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const K=parseInt(Z.dataset.apRemove,10);p.completedPicks.splice(K,1),Pe()})})},Ze=()=>{if(!p.currentPickedEl){pe.style.display="none";return}pe.style.display="",_e.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Ce&&(Ce.disabled=p.awaitingPick)},_t=()=>{D&&(D.disabled=!W.value.trim()||p.submitting||p.awaitingPick)},on=(Z,K)=>{p.currentCtx=Z,p.currentPickedEl=K,V(Z),Xe==null||Xe.update(K),Ze()};Ze(),_e.addEventListener("click",()=>{var K;const Z=(K=p.currentPickedEl)==null?void 0:K.parentElement;Z&&on(bs(Z),Z)}),Ce&&d&&Ce.addEventListener("click",()=>{if(p.awaitingPick)return;const Z=p.currentCtx,K=p.currentPickedEl;p.awaitingPick=!0,Ze(),_t(),V(null),d((De,J)=>{p.awaitingPick=!1,on(De,J),_t()},()=>{p.awaitingPick=!1,K&&on(Z,K),_t()})});const rt=()=>{Cr(),h==null||h()};w.addEventListener("click",rt),C.addEventListener("click",rt),T.forEach(Z=>{Z.addEventListener("click",()=>{p.captureType=Z.dataset.apType,T.forEach(K=>K.classList.toggle("ap-sdk-active",K===Z))})});const Zt=q.querySelector("[data-ap-reconfigure]");a?Zt.addEventListener("click",()=>{rt(),a()}):Zt.style.display="none",D&&u&&(W.addEventListener("input",_t),D.addEventListener("click",()=>{const Z=W.value.trim();!Z||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:Z}),Pe(),W.value="",p.awaitingPick=!0,D.disabled=!0,Ze(),V(null),u((K,De)=>{p.awaitingPick=!1,on(K,De),_t()}))})),M.addEventListener("click",async()=>{var Sn,ce;if(p.submitting)return;let Z=n.backendUrl??"",K=n.token??"";if(b){const ie=q==null?void 0:q.querySelector("[data-ap-backend-url]"),Re=q==null?void 0:q.querySelector("[data-ap-token]");if(ie&&(Z=ie.value.trim()),Re&&(K=Re.value.trim()),!Z){Pr(P,"error","Backend URL is required.");return}if(!K){Pr(P,"error","API Token is required.");return}}const De=W.value.trim();if(!De){Pr(P,"error","Please enter an instruction.");return}p.submitting=!0,Oc(q,!0),Pr(P,null,""),M.textContent="Submitting…";const J={backendUrl:Z,token:K},vt=_.getOptions(),oe=[...p.completedPicks,{ctx:p.currentCtx,instruction:De}];try{let ie=r;ie||(ie=await wa(J,o),s({backendUrl:Z,token:K}));let Re,Le,ee;if(oe.length===1)if(p.captureType==="task")Re=(await gi(J,ie.id,De,p.currentCtx,vt)).id,Le="task",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let tt=Cl(De,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(Sn=p.currentCtx.innerTree)!=null&&Sn.trim()&&(tt+=`
1597
+ `).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const Q=parseInt(Z.dataset.apRemove,10);p.completedPicks.splice(Q,1),Pe()})})},Ze=()=>{if(!p.currentPickedEl){pe.style.display="none";return}pe.style.display="",_e.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Ce&&(Ce.disabled=p.awaitingPick)},_t=()=>{D&&(D.disabled=!J.value.trim()||p.submitting||p.awaitingPick)},sn=(Z,Q)=>{p.currentCtx=Z,p.currentPickedEl=Q,X(Z),Ye==null||Ye.update(Q),Ze()};Ze(),_e.addEventListener("click",()=>{var Q;const Z=(Q=p.currentPickedEl)==null?void 0:Q.parentElement;Z&&sn(yi(Z),Z)}),Ce&&d&&Ce.addEventListener("click",()=>{if(p.awaitingPick)return;const Z=p.currentCtx,Q=p.currentPickedEl;p.awaitingPick=!0,Ze(),_t(),X(null),d((De,Y)=>{p.awaitingPick=!1,sn(De,Y),_t()},()=>{p.awaitingPick=!1,Q&&sn(Z,Q),_t()})});const nt=()=>{Rr(),h==null||h()};y.addEventListener("click",nt),C.addEventListener("click",nt),T.forEach(Z=>{Z.addEventListener("click",()=>{p.captureType=Z.dataset.apType,T.forEach(Q=>Q.classList.toggle("ap-sdk-active",Q===Z))})});const Zt=q.querySelector("[data-ap-reconfigure]");a?Zt.addEventListener("click",()=>{nt(),a()}):Zt.style.display="none",D&&u&&(J.addEventListener("input",_t),D.addEventListener("click",()=>{const Z=J.value.trim();!Z||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:Z}),Pe(),J.value="",p.awaitingPick=!0,D.disabled=!0,Ze(),X(null),u((Q,De)=>{p.awaitingPick=!1,sn(Q,De),_t()}))})),M.addEventListener("click",async()=>{var Tn,ce;if(p.submitting)return;let Z=n.backendUrl??"",Q=n.token??"";if(b){const se=q==null?void 0:q.querySelector("[data-ap-backend-url]"),Re=q==null?void 0:q.querySelector("[data-ap-token]");if(se&&(Z=se.value.trim()),Re&&(Q=Re.value.trim()),!Z){Lr(P,"error","Backend URL is required.");return}if(!Q){Lr(P,"error","API Token is required.");return}}const De=J.value.trim();if(!De){Lr(P,"error","Please enter an instruction.");return}p.submitting=!0,qc(q,!0),Lr(P,null,""),M.textContent="Submitting…";const Y={backendUrl:Z,token:Q},vt=_.getOptions(),oe=[...p.completedPicks,{ctx:p.currentCtx,instruction:De}];try{let se=r;se||(se=await Ea(Y,o),i({backendUrl:Z,token:Q}));let Re,Le,ee;if(oe.length===1)if(p.captureType==="task")Re=(await ms(Y,{projectId:se.id,note:De,ctx:p.currentCtx,advancedOpts:vt})).id,Le="task",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let et=Ol(De,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(Tn=p.currentCtx.innerTree)!=null&&Tn.trim()&&(et+=`
1625
1598
 
1626
1599
  Element tree:
1627
- ${p.currentCtx.innerTree}`),(ce=p.currentCtx.interactionSteps)!=null&&ce.length&&(tt+=`
1600
+ ${p.currentCtx.innerTree}`),(ce=p.currentCtx.interactionSteps)!=null&&ce.length&&(et+=`
1628
1601
 
1629
1602
  Recorded steps:
1630
- ${yc(p.currentCtx.interactionSteps)}`),Re=(await Sa(J,ie.id,tt,vt)).id,Le="planning",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else Re=(await xa(J,ie.id,De,p.currentCtx,vt)).id,Le="automate",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const tt=nb(oe),lt=oe[0].instruction.slice(0,120)||oe[0].ctx.pageTitle||"Multi-element capture",ze=oe.map(ut=>ut.instruction).filter(Boolean).join(`
1603
+ ${Ac(p.currentCtx.interactionSteps)}`),Re=(await Ca(Y,se.id,et,vt)).id,Le="planning",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else Re=(await Aa(Y,{projectId:se.id,note:De,ctx:p.currentCtx,advancedOpts:vt})).id,Le="automate",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const et=db(oe),lt=oe[0].instruction.slice(0,120)||oe[0].ctx.pageTitle||"Multi-element capture",Ie=oe.map(ut=>ut.instruction).filter(Boolean).join(`
1631
1604
 
1632
- `);p.captureType==="task"?(Re=(await gi(J,ie.id,tt,oe[0].ctx,vt,lt,va,ze)).id,Le="task",ee=lt):p.captureType==="planning"?(Re=(await Sa(J,ie.id,tt,vt)).id,Le="planning",ee=lt):(Re=(await xa(J,ie.id,tt,oe[0].ctx,vt,lt,ze)).id,Le="automate",ee=lt)}if(zm({id:Re,type:Le,title:ee,backendUrl:Z,createdAt:new Date().toISOString()}),Ic(J).catch(()=>{}),b&&s({backendUrl:Z,token:K}),Le==="automate"){rt(),ji(Re,J,Z,ee,h);return}const Te=Le==="task"?`${Z.replace(/\/+$/,"")}/tasks/${Re}`:`${Z.replace(/\/+$/,"")}/planning/${Re}`;rb(P,Le,ee,Te,rt),q.classList.add("ap-sdk-panel--success"),jt==null||jt(),jt=null,Xe==null||Xe.hide(),p.submitting=!1}catch(ie){Pr(P,"error",ie instanceof Error?ie.message:"An unexpected error occurred."),p.submitting=!1,Oc(q,!1),M.textContent="Submit"}}),setTimeout(()=>W.focus(),50)}const tb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Nc(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
1605
+ `);p.captureType==="task"?(Re=(await ms(Y,{projectId:se.id,note:et,ctx:oe[0].ctx,advancedOpts:vt,titleOverride:lt,type:Sa,titleInstruction:Ie})).id,Le="task",ee=lt):p.captureType==="planning"?(Re=(await Ca(Y,se.id,et,vt)).id,Le="planning",ee=lt):(Re=(await Aa(Y,{projectId:se.id,note:et,ctx:oe[0].ctx,advancedOpts:vt,titleOverride:lt,titleInstruction:Ie})).id,Le="automate",ee=lt)}if(Zm({id:Re,type:Le,title:ee,backendUrl:Z,createdAt:new Date().toISOString()}),Uc(Y).catch(()=>{}),b&&i({backendUrl:Z,token:Q}),Le==="automate"){nt(),qs(Re,Y,Z,ee,h);return}const Te=Le==="task"?`${Z.replace(/\/+$/,"")}/tasks/${Re}`:`${Z.replace(/\/+$/,"")}/planning/${Re}`;pb(P,Le,ee,Te,nt),q.classList.add("ap-sdk-panel--success"),jt==null||jt(),jt=null,Ye==null||Ye.hide(),p.submitting=!1}catch(se){Lr(P,"error",se instanceof Error?se.message:"An unexpected error occurred."),p.submitting=!1,qc(q,!1),M.textContent="Submit"}}),setTimeout(()=>J.focus(),50)}const ub={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Zc(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
1633
1606
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1634
1607
  <div class="ap-sdk-panel__context-steps">
1635
1608
  ${e.interactionSteps.map(n=>`
1636
1609
  <div class="ap-sdk-panel__context-step">
1637
- <span class="ap-sdk-panel__context-step-icon">${tb[n.action]}</span>
1638
- <span class="ap-sdk-panel__context-step-text">${nt(n.description)}</span>
1610
+ <span class="ap-sdk-panel__context-step-icon">${ub[n.action]}</span>
1611
+ <span class="ap-sdk-panel__context-step-text">${tt(n.description)}</span>
1639
1612
  </div>
1640
1613
  `).join("")}
1641
1614
  </div>
1642
1615
  `:`
1643
1616
  <div class="ap-sdk-panel__context-label">Captured element</div>
1644
- <div class="ap-sdk-panel__context-text" title="${nt(e.elementText??"")}">${nt(e.elementText||"(no text)")}</div>
1645
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${nt(e.cssSelector)}">${nt(e.cssSelector)}</div>`:""}
1646
- `}function nb(e){return e.map((t,n)=>{var o,s;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",yc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(s=t.ctx.innerTree)!=null&&s.trim()&&r.push(`
1617
+ <div class="ap-sdk-panel__context-text" title="${tt(e.elementText??"")}">${tt(e.elementText||"(no text)")}</div>
1618
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${tt(e.cssSelector)}">${tt(e.cssSelector)}</div>`:""}
1619
+ `}function db(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Ac(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
1647
1620
  Element tree:
1648
1621
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1649
1622
  ${t.instruction}`),r.join(`
@@ -1651,23 +1624,23 @@ ${t.instruction}`),r.join(`
1651
1624
 
1652
1625
  ---
1653
1626
 
1654
- `)}function Pr(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function rb(e,t,n,r,o){const s=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1627
+ `)}function Lr(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function pb(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1655
1628
  <div class="ap-sdk-success-card">
1656
1629
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1657
1630
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1658
1631
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1659
1632
  </svg>
1660
- <p class="ap-sdk-success-headline">${nt(a)}</p>
1633
+ <p class="ap-sdk-success-headline">${tt(a)}</p>
1661
1634
  <div class="ap-sdk-success-meta">
1662
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${nt(s)}</span>
1663
- <span class="ap-sdk-success-title" title="${nt(n)}">${nt(d)}</span>
1635
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${tt(i)}</span>
1636
+ <span class="ap-sdk-success-title" title="${tt(n)}">${tt(d)}</span>
1664
1637
  </div>
1665
1638
  <div class="ap-sdk-success-actions">
1666
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${nt(u)}</button>
1639
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${tt(u)}</button>
1667
1640
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1668
1641
  </div>
1669
1642
  </div>
1670
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Oc(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function nt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let re=null;function Dc(){return re!==null}function yn(){re&&Nt(re),re==null||re.remove(),re=null}function ob(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function ib(e){if(re){yn();return}re=document.createElement("div"),re.className="ap-sdk-panel",re.setAttribute("data-ap-sdk","1"),re.setAttribute("role","dialog"),re.setAttribute("aria-modal","true"),re.setAttribute("aria-label","My captures"),re.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),re.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),re.innerHTML=`
1643
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function qc(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function tt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let re=null;function Hc(){return re!==null}function yn(){re&&Ot(re),re==null||re.remove(),re=null}function hb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function fb(e){if(re){yn();return}re=document.createElement("div"),re.className="ap-sdk-panel",re.setAttribute("data-ap-sdk","1"),re.setAttribute("role","dialog"),re.setAttribute("aria-modal","true"),re.setAttribute("aria-label","My captures"),re.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),re.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),re.innerHTML=`
1671
1644
  <div class="ap-sdk-panel__header">
1672
1645
  <span class="ap-sdk-panel__title">
1673
1646
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1680,18 +1653,37 @@ ${t.instruction}`),r.join(`
1680
1653
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1681
1654
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1682
1655
  </div>
1683
- `,document.body.appendChild(re),$t(re),ki(re,bi),re.querySelector("[data-ap-close]").addEventListener("click",()=>{yn()}),re.querySelector("[data-ap-close-list]").addEventListener("click",()=>{yn()}),re.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Im(),vn(0),Mc(e)}),Mc(e)}function Mc(e){if(!re)return;const t=re.querySelector("[data-ap-list-body]"),n=Jn();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1656
+ `,document.body.appendChild(re),$t(re),vs(re,_s),re.querySelector("[data-ap-close]").addEventListener("click",()=>{yn()}),re.querySelector("[data-ap-close-list]").addEventListener("click",()=>{yn()}),re.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{qm(),vn(0),Fc(e)}),Fc(e)}function Fc(e){if(!re)return;const t=re.querySelector("[data-ap-list-body]"),n=Yn();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1684
1657
  <div class="ap-sdk-list-item">
1685
1658
  <div class="ap-sdk-list-item__row">
1686
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${ob(r.type)}</span>
1687
- <span class="ap-sdk-list-item__title" title="${Ro(r.title)}">${cb(r.title)}</span>
1659
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${hb(r.type)}</span>
1660
+ <span class="ap-sdk-list-item__title" title="${Lo(r.title)}">${bb(r.title)}</span>
1688
1661
  </div>
1689
1662
  <div class="ap-sdk-list-item__row">
1690
- <span class="ap-sdk-status-badge" data-ap-status="${Ro(r.id)}">${e?"…":"—"}</span>
1691
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Ro(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Ro(ab(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1663
+ <span class="ap-sdk-status-badge" data-ap-status="${Lo(r.id)}">${e?"…":"—"}</span>
1664
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Lo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Lo(mb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1692
1665
  </div>
1693
1666
  </div>
1694
- `).join(""),e){const r=e;Promise.all(n.map(o=>sb(o,r))).then(o=>{vn(zc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const s=o.dataset.apResume,a=n.find(u=>u.id===s);a&&(yn(),ji(a.id,r,a.backendUrl,a.title,()=>{}))})})}}async function sb(e,t){const n=await Lc(e,t),r=re==null?void 0:re.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n}function ab(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Ro(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let nn=null;function lb(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function ub(e){if(nn){const u=nn;u.cleanup(),u.popup.closed||u.popup.close(),nn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=lb(),o=window.location.origin,s=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(s,"ap-sdk-oauth","width=480,height=640");return a?new Promise((u,d)=>{let h=!1;function p(){window.removeEventListener("message",b),clearInterval(m),(nn==null?void 0:nn.popup)===a&&(nn=null)}function b(_){if(_.origin!==n)return;const w=_.data;!w||w.type!=="ap-sdk-oauth"||w.state!==r||!w.code||(h=!0,p(),u({code:w.code}))}window.addEventListener("message",b);const m=window.setInterval(()=>{a.closed&&(p(),h||d(new Error("Connection cancelled.")))},500);nn={popup:a,cleanup:p}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const Wi="ap-sdk-config";function db(){try{const e=sessionStorage.getItem(Wi);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(Uc(),null):t}catch{return null}}function pb(e){sessionStorage.setItem(Wi,JSON.stringify(e)),fb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function Uc(){sessionStorage.removeItem(Wi)}const jc="ap-sdk-last-connection";function hb(){try{const e=localStorage.getItem(jc);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch{return null}}function fb(e){try{localStorage.setItem(jc,JSON.stringify(e))}catch{}}let Q=null;function Rr(){Q&&Nt(Q),Q==null||Q.remove(),Q=null}function gb(e){Q&&Rr(),Q=document.createElement("div"),Q.className="ap-sdk-panel",Q.setAttribute("data-ap-sdk","1"),Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label","Connect to Agent Platform");const t=hb();n((t==null?void 0:t.backendUrl)??""),document.body.appendChild(Q),$t(Q);function n(o){if(!Q)return;Q.innerHTML=`
1667
+ `).join(""),e){const r=e;Promise.all(n.map(o=>gb(o,r))).then(o=>{vn(Mc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(u=>u.id===i);a&&(yn(),qs(a.id,r,a.backendUrl,a.title,()=>{}))})})}}async function gb(e,t){const n=await Dc(e,t),r=re==null?void 0:re.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n}function mb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Lo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let nn=null;function kb(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Bc(e){if(nn){const u=nn;u.cleanup(),u.popup.closed||u.popup.close(),nn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=kb(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((u,d)=>{let h=!1;function p(){window.removeEventListener("message",b),clearInterval(m),(nn==null?void 0:nn.popup)===a&&(nn=null)}function b(_){if(_.origin!==n)return;const y=_.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(h=!0,p(),u({code:y.code}))}window.addEventListener("message",b);const m=window.setInterval(()=>{a.closed&&(p(),h||d(new Error("Connection cancelled.")))},500);nn={popup:a,cleanup:p}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const Ys="ap-sdk-config";function _b(){try{const e=sessionStorage.getItem(Ys);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(Gc(),null):t}catch{return null}}function vb(e){sessionStorage.setItem(Ys,JSON.stringify(e)),wb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function Gc(){sessionStorage.removeItem(Ys)}const Wc="ap-sdk-last-connection";function yb(){try{const e=localStorage.getItem(Wc);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch{return null}}function wb(e){try{localStorage.setItem(Wc,JSON.stringify(e))}catch{}}let W=null;function wn(){W&&Ot(W),W==null||W.remove(),W=null}function xb(e){W&&wn(),W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Connect to Agent Platform");const t=yb();t?n(t):r(""),document.body.appendChild(W),$t(W);function n(i){if(!W)return;W.innerHTML=`
1668
+ <div class="ap-sdk-panel__header">
1669
+ <span class="ap-sdk-panel__title">
1670
+ <span class="ap-sdk-panel__logo">AP</span>
1671
+ Connect to Agent Platform
1672
+ </span>
1673
+ <button class="ap-sdk-panel__close" aria-label="Close" data-ap-close>×</button>
1674
+ </div>
1675
+ <div class="ap-sdk-panel__body">
1676
+ <p class="ap-sdk-config-hint">
1677
+ Reconnect to <strong>${Vs(i.backendUrl)}</strong>. You'll be asked to
1678
+ approve this connection on Agent Platform's own sign-in page.
1679
+ </p>
1680
+ </div>
1681
+ <div class="ap-sdk-panel__status" data-ap-cfg-status style="display:none"></div>
1682
+ <div class="ap-sdk-panel__footer">
1683
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
1684
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
1685
+ </div>
1686
+ `;const a=W.querySelector("[data-ap-cfg-status]"),u=W.querySelector("[data-ap-reconnect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{wn()}),W.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),u.addEventListener("click",async()=>{u.disabled=!0,u.textContent="Connecting…",rn(a,null,"");try{const{code:d}=await Bc(i.backendUrl),{token:h,expiresAt:p}=await La({backendUrl:i.backendUrl},d,window.location.origin),b={backendUrl:i.backendUrl,token:h},m=await Ra(b);if(m.length===0){rn(a,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Reconnect";return}const _=m.find(y=>y.key===i.projectCode);_?(wn(),e({backendUrl:i.backendUrl,token:h,projectCode:_.key,expiresAt:p})):o(i.backendUrl,h,p,m)}catch(d){rn(a,"error",`Could not connect — ${d instanceof Error?d.message:"please try again"}`),u.disabled=!1,u.textContent="Reconnect"}})}function r(i){if(!W)return;W.innerHTML=`
1695
1687
  <div class="ap-sdk-panel__header">
1696
1688
  <span class="ap-sdk-panel__title">
1697
1689
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1704,7 +1696,7 @@ ${t.instruction}`),r.join(`
1704
1696
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
1705
1697
  <input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
1706
1698
  placeholder="https://your-platform.example.com"
1707
- value="${Zc(o)}" autocomplete="off" data-ap-cfg-url />
1699
+ value="${Jc(i)}" autocomplete="off" data-ap-cfg-url />
1708
1700
  </div>
1709
1701
  <p class="ap-sdk-config-hint">
1710
1702
  You'll be asked to approve this connection on Agent Platform's own sign-in page.
@@ -1715,7 +1707,7 @@ ${t.instruction}`),r.join(`
1715
1707
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
1716
1708
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1717
1709
  </div>
1718
- `;const s=Q.querySelector("[data-ap-cfg-url]"),a=Q.querySelector("[data-ap-cfg-status]"),u=Q.querySelector("[data-ap-connect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{Rr()}),Q.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Rr()}),u.addEventListener("click",async()=>{const d=s.value.trim();if(!d){Lr(a,"error","Backend URL is required.");return}u.disabled=!0,u.textContent="Connecting…",Lr(a,null,"");try{const{code:h}=await ub(d),{token:p,expiresAt:b}=await Rf({backendUrl:d},h,window.location.origin),_=await Pf({backendUrl:d,token:p});if(_.length===0){Lr(a,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Connect via Agent Platform";return}r(d,p,b,_)}catch(h){Lr(a,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),u.disabled=!1,u.textContent="Connect via Agent Platform"}}),setTimeout(()=>s.focus(),50)}function r(o,s,a,u){if(!Q)return;const d=u.map(b=>`<option value="${Zc(b.key)}"${b.key===(t==null?void 0:t.projectCode)?" selected":""}>${qc(b.name)} (${qc(b.key)})</option>`).join("");Q.innerHTML=`
1710
+ `;const a=W.querySelector("[data-ap-cfg-url]"),u=W.querySelector("[data-ap-cfg-status]"),d=W.querySelector("[data-ap-connect]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{wn()}),W.querySelector("[data-ap-cancel]").addEventListener("click",()=>{wn()}),d.addEventListener("click",async()=>{const h=a.value.trim();if(!h){rn(u,"error","Backend URL is required.");return}d.disabled=!0,d.textContent="Connecting…",rn(u,null,"");try{const{code:p}=await Bc(h),{token:b,expiresAt:m}=await La({backendUrl:h},p,window.location.origin),y=await Ra({backendUrl:h,token:b});if(y.length===0){rn(u,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Connect via Agent Platform";return}o(h,b,m,y)}catch(p){rn(u,"error",`Could not connect — ${p instanceof Error?p.message:"please try again"}`),d.disabled=!1,d.textContent="Connect via Agent Platform"}}),setTimeout(()=>a.focus(),50)}function o(i,a,u,d){if(!W)return;const h=d.map(m=>`<option value="${Jc(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${Vs(m.name)} (${Vs(m.key)})</option>`).join("");W.innerHTML=`
1719
1711
  <div class="ap-sdk-panel__header">
1720
1712
  <span class="ap-sdk-panel__title">
1721
1713
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1728,7 +1720,7 @@ ${t.instruction}`),r.join(`
1728
1720
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-project">Project</label>
1729
1721
  <select id="ap-sdk-cfg-project" class="ap-sdk-panel__input" data-ap-cfg-project>
1730
1722
  <option value="">Select a project…</option>
1731
- ${d}
1723
+ ${h}
1732
1724
  </select>
1733
1725
  </div>
1734
1726
  </div>
@@ -1737,7 +1729,7 @@ ${t.instruction}`),r.join(`
1737
1729
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1738
1730
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1739
1731
  </div>
1740
- `;const h=Q.querySelector("[data-ap-cfg-project]"),p=Q.querySelector("[data-ap-cfg-status]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{Rr()}),Q.querySelector("[data-ap-back]").addEventListener("click",()=>n(o)),Q.querySelector("[data-ap-save]").addEventListener("click",()=>{const b=h.value;if(!b){Lr(p,"error","Please select a project.");return}Rr(),e({backendUrl:o,token:s,projectCode:b,expiresAt:a})})}}function Lr(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Zc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ct=null,Lo=!1;function mb(){ct==null||ct.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ct&&ct.observe(document.body,{childList:!0}),Lo=!1}function Hc(){ct||(ct=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Lo||(Lo=!0,queueMicrotask(mb))}),ct.observe(document.body,{childList:!0}))}function bb(){ct==null||ct.disconnect(),ct=null,Lo=!1}const kb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Se=null,rn=[];function zo(){Se&&Nt(Se),Se==null||Se.remove(),Se=null,rn=[]}function _b(e,t,n){Se&&zo(),rn=[...e],Se=document.createElement("div"),Se.className="ap-sdk-panel ap-sdk-record-review",Se.setAttribute("data-ap-sdk","1"),Se.setAttribute("role","dialog"),Se.setAttribute("aria-modal","true"),Se.setAttribute("aria-label","Review recorded steps"),Se.innerHTML=`
1732
+ `;const p=W.querySelector("[data-ap-cfg-project]"),b=W.querySelector("[data-ap-cfg-status]");W.querySelector("[data-ap-close]").addEventListener("click",()=>{wn()}),W.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),W.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=p.value;if(!m){rn(b,"error","Please select a project.");return}wn(),e({backendUrl:i,token:a,projectCode:m,expiresAt:u})})}}function rn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Jc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ct=null,Io=!1;function Sb(){ct==null||ct.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ct&&ct.observe(document.body,{childList:!0}),Io=!1}function Yc(){ct||(ct=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Io||(Io=!0,queueMicrotask(Sb))}),ct.observe(document.body,{childList:!0}))}function Tb(){ct==null||ct.disconnect(),ct=null,Io=!1}const Eb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Se=null,on=[];function zo(){Se&&Ot(Se),Se==null||Se.remove(),Se=null,on=[]}function Ab(e,t,n){Se&&zo(),on=[...e],Se=document.createElement("div"),Se.className="ap-sdk-panel ap-sdk-record-review",Se.setAttribute("data-ap-sdk","1"),Se.setAttribute("role","dialog"),Se.setAttribute("aria-modal","true"),Se.setAttribute("aria-label","Review recorded steps"),Se.innerHTML=`
1741
1733
  <div class="ap-sdk-panel__header">
1742
1734
  <span class="ap-sdk-panel__title">
1743
1735
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1752,11 +1744,11 @@ ${t.instruction}`),r.join(`
1752
1744
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1753
1745
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1754
1746
  </div>
1755
- `,document.body.appendChild(Se),$t(Se);const r=Se.querySelector("[data-ap-review-list]"),o=Se.querySelector("[data-ap-review-continue]"),s=()=>{if(rn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=rn.map((u,d)=>`
1747
+ `,document.body.appendChild(Se),$t(Se);const r=Se.querySelector("[data-ap-review-list]"),o=Se.querySelector("[data-ap-review-continue]"),i=()=>{if(on.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=on.map((u,d)=>`
1756
1748
  <div class="ap-sdk-record-step" data-step-index="${d}">
1757
- <span class="ap-sdk-record-step__icon">${kb[u.action]}</span>
1758
- ${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${vb(u.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Fc(u.description)}</span>`}
1749
+ <span class="ap-sdk-record-step__icon">${Eb[u.action]}</span>
1750
+ ${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${Cb(u.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Vc(u.description)}</span>`}
1759
1751
  <button class="ap-sdk-record-step__remove" data-ap-step-remove="${d}" aria-label="Remove step ${d+1}">✕</button>
1760
1752
  </div>
1761
- `).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);rn.splice(d,1),s()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),h=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const p=rn[h];p.value=u.value,p.description=_c(p.elementText??"",u.value,!1)})})};s();const a=()=>{zo()};Se.querySelector("[data-ap-review-close]").addEventListener("click",a),Se.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(rn.length===0)return;const u=rn,d={...ds(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:u};zo(),t(d)})}function Fc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function vb(e){return Fc(e)}let j=null,Io=null,$o=null,No=null;function Ji(e,t,n){Io=e,$o=t,No=n,Pc(e,t,n)}const Bc="#agent-platform-web-sdk",Gc="ap-sdk-fab-unlocked";let wn=null;function Wc(){try{if(localStorage.getItem(Gc)==="1")return!0}catch{}return window.location.hash===Bc}function Jc(){try{localStorage.setItem(Gc,"1")}catch{}}async function Xc(e){if(cr(),!(j&&j.projectCode===e.projectCode&&j.backendUrl===(e.backendUrl??null)&&j.token===(e.token??null))){if(j={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},Ji(()=>Vc(),()=>wb(),()=>Vi()),vn(Jn().length),j.backendUrl&&j.token){const t=j.backendUrl,n=j.token;await tl(),Ic({backendUrl:t,token:n}).catch(()=>{});const r=Ff();r&&ji(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}Hc()}}async function Xi(e,t){if(!j)throw new Error("AgentPlatformSDK: call init() first.");j.backendUrl=e,j.token=t,j.project=null,await tl()}function Vc(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");Nn()||(cr(),ni(async(e,t)=>{Dc()&&yn(),$c(e,t,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Xi(n.backendUrl,n.token)},xn,n=>{ni((r,o)=>{Ar()&&n(r,o)},()=>{Yc()})},(n,r)=>{ni((o,s)=>{Ar()&&n(o,s)},()=>{Ar()&&r()})},()=>{Nn()&&ri()})},()=>{}))}function yb(){ri()}function wb(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");wo()||(cr(),qm(e=>{_b(e,t=>{$c(t,null,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Xi(n.backendUrl,n.token)},xn,void 0,void 0,()=>{})})}))}function Yc(){Ar()&&Cr()}function xb(){return Nn()}function Kc(){bb(),wn&&(window.removeEventListener("hashchange",wn),wn=null),ri(),Hm(),zo(),Cr(),yn(),Rc(),Io=null,$o=null,No=null,j=null}function Qc(){if(typeof window>"u"||typeof document>"u")return;cr();const e=db(),t=()=>{e?el(e).catch(console.error):(Ji(()=>xn(),()=>xn(),()=>Vi()),vn(Jn().length),Hc())};if(Wc()){Jc(),t();return}wn=()=>{window.location.hash===Bc&&(Jc(),window.removeEventListener("hashchange",wn),wn=null,t())},window.addEventListener("hashchange",wn)}function Sb(){Io&&$o&&No&&Pc(Io,$o,No)}function Tb(){Rc()}function xn(){gb(e=>{pb(e),el(e).catch(console.error)})}function Eb(){Uc(),Kc(),cr(),Wc()&&(Ji(()=>xn(),()=>xn(),()=>Vi()),vn(Jn().length))}async function el(e){await Xc({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function Vi(){if(Dc()){yn();return}Ar()&&Cr();const e=j!=null&&j.backendUrl&&(j!=null&&j.token)?{backendUrl:j.backendUrl,token:j.token}:null;ib(e)}async function tl(){if(!(!j||!j.backendUrl||!j.token||j.project||j.resolvingProject)){j.resolvingProject=!0;try{j.project=await wa({backendUrl:j.backendUrl,token:j.token},j.projectCode)}catch{}finally{j&&(j.resolvingProject=!1)}}}return Qc(),we.activateElementPicker=Vc,we.autoInit=Qc,we.clearConfig=Eb,we.closePanelIfOpen=Yc,we.configure=xn,we.deactivateElementPicker=yb,we.destroy=Kc,we.hideFab=Tb,we.init=Xc,we.isPickerRunning=xb,we.showFab=Sb,we.updateCredentials=Xi,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"}),we}({});
1753
+ `).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);on.splice(d,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),h=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const p=on[h];p.value=u.value,p.description=Tc(p.elementText??"",u.value,!1)})})};i();const a=()=>{zo()};Se.querySelector("[data-ap-review-close]").addEventListener("click",a),Se.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(on.length===0)return;const u=on,d={...gi(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:u};zo(),t(d)})}function Vc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Cb(e){return Vc(e)}let j=null,$o=null,Oo=null,No=null;function Xs(e,t,n){$o=e,Oo=t,No=n,Oc(e,t,n)}const Xc="#agent-platform-web-sdk",Kc="ap-sdk-fab-unlocked";let xn=null;function Qc(){try{if(localStorage.getItem(Kc)==="1")return!0}catch{}return window.location.hash===Xc}function el(){try{localStorage.setItem(Kc,"1")}catch{}}async function tl(e){if(ur(),!(j&&j.projectCode===e.projectCode&&j.backendUrl===(e.backendUrl??null)&&j.token===(e.token??null))){if(j={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},Xs(()=>nl(),()=>Rb(),()=>Qs()),vn(Yn().length),j.backendUrl&&j.token){const t=j.backendUrl,n=j.token;await al(),Uc({backendUrl:t,token:n}).catch(()=>{});const r=Qf();r&&qs(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}Yc()}}async function Ks(e,t){if(!j)throw new Error("AgentPlatformSDK: call init() first.");j.backendUrl=e,j.token=t,j.project=null,await al()}function nl(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");Nn()||(ur(),rs(async(e,t)=>{Hc()&&yn(),jc(e,t,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Ks(n.backendUrl,n.token)},Sn,n=>{rs((r,o)=>{Pr()&&n(r,o)},()=>{rl()})},(n,r)=>{rs((o,i)=>{Pr()&&n(o,i)},()=>{Pr()&&r()})},()=>{Nn()&&os()})},()=>{}))}function Pb(){os()}function Rb(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");xo()||(ur(),Xm(e=>{Ab(e,t=>{jc(t,null,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Ks(n.backendUrl,n.token)},Sn,void 0,void 0,()=>{})})}))}function rl(){Pr()&&Rr()}function Lb(){return Nn()}function ol(){Tb(),xn&&(window.removeEventListener("hashchange",xn),xn=null),os(),Km(),zo(),Rr(),yn(),Nc(),$o=null,Oo=null,No=null,j=null}function sl(){if(typeof window>"u"||typeof document>"u")return;ur();const e=_b(),t=()=>{e?il(e).catch(console.error):(Xs(()=>Sn(),()=>Sn(),()=>Qs()),vn(Yn().length),Yc())};if(Qc()){el(),t();return}xn=()=>{window.location.hash===Xc&&(el(),window.removeEventListener("hashchange",xn),xn=null,t())},window.addEventListener("hashchange",xn)}function Ib(){$o&&Oo&&No&&Oc($o,Oo,No)}function zb(){Nc()}function Sn(){xb(e=>{vb(e),il(e).catch(console.error)})}function $b(){Gc(),ol(),ur(),Qc()&&(Xs(()=>Sn(),()=>Sn(),()=>Qs()),vn(Yn().length))}async function il(e){await tl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function Qs(){if(Hc()){yn();return}Pr()&&Rr();const e=j!=null&&j.backendUrl&&(j!=null&&j.token)?{backendUrl:j.backendUrl,token:j.token}:null;fb(e)}async function al(){if(!(!j||!j.backendUrl||!j.token||j.project||j.resolvingProject)){j.resolvingProject=!0;try{j.project=await Ea({backendUrl:j.backendUrl,token:j.token},j.projectCode)}catch{}finally{j&&(j.resolvingProject=!1)}}}return sl(),we.activateElementPicker=nl,we.autoInit=sl,we.clearConfig=$b,we.closePanelIfOpen=rl,we.configure=Sn,we.deactivateElementPicker=Pb,we.destroy=ol,we.hideFab=zb,we.init=tl,we.isPickerRunning=Lb,we.showFab=Ib,we.updateCredentials=Ks,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"}),we})({});
1762
1754
  //# sourceMappingURL=web-sdk.min.js.map