@tinkerlandai/indiana-sdk 0.6.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -5
- package/README.md +11 -10
- package/README.zh-CN.md +16 -11
- package/dist/{ai-usage-B4W5m4Ie.d.ts → ai-usage-Bigjb8MS.d.ts} +570 -560
- package/dist/chunk-2A6UYUFA.js +1 -0
- package/dist/chunk-3BQFJANQ.js +1 -0
- package/dist/chunk-3ENVRJE6.js +350 -0
- package/dist/chunk-A3N4ZZTM.js +7 -0
- package/dist/chunk-AE4CUTUE.js +1 -0
- package/dist/chunk-CXYOZSOF.js +1 -0
- package/dist/{chunk-2EJSV6BA.js → chunk-G2R56FKU.js} +1 -1
- package/dist/chunk-KQCTDXVD.js +17 -0
- package/dist/{chunk-5TEZEOHX.js → chunk-OVMNCZYC.js} +1 -1
- package/dist/chunk-RRII2DMC.js +1 -0
- package/dist/chunk-YAFMBXIE.js +4 -0
- package/dist/{configuration-sync-C2mytNwU.d.ts → configuration-sync-VFbY1pCN.d.ts} +356 -49
- package/dist/content-K2HCZVC2.js +1 -0
- package/dist/{customer-page-B4FGCVpt.d.ts → customer-page-BrCZxcaQ.d.ts} +278 -5
- package/dist/funnel-runtime-host-HNZ47TZW.js +1 -0
- package/dist/{funnel-runtime-start-sZ8ZCNlq.d.ts → funnel-runtime-start-DKcTCRrd.d.ts} +6930 -3327
- package/dist/index.d.ts +17432 -14987
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +17 -17
- package/dist/page.js +1 -1
- package/dist/paywall-PD62B2AY.js +1 -0
- package/dist/popup.d.ts +7 -282
- package/dist/popup.js +1 -350
- package/dist/react-native.d.ts +15 -15
- package/dist/react-native.js +1 -1
- package/dist/{screen-16d-xADb.d.ts → screen-BazUOjwM.d.ts} +163 -160
- package/dist/server.d.ts +5 -5
- package/dist/server.js +1 -1
- package/dist/src-4MRSESVS.js +1 -0
- package/dist/visual.d.ts +5 -2
- package/dist/visual.js +2 -2
- package/package.json +1 -7
- package/dist/chunk-4K25DELJ.js +0 -1
- package/dist/chunk-63BWE27V.js +0 -1
- package/dist/chunk-CB63JLGT.js +0 -1
- package/dist/chunk-D7YHFS6B.js +0 -4
- package/dist/chunk-HTRQPMJO.js +0 -11
- package/dist/chunk-ISUXYPYL.js +0 -1
- package/dist/chunk-QG3WUJG5.js +0 -1
- package/dist/chunk-RMJJOSVZ.js +0 -1
- package/dist/chunk-S2MSIA57.js +0 -17
- package/dist/chunk-U6S6AZM6.js +0 -1
- package/dist/chunk-VVSQKVE7.js +0 -1
- package/dist/client-OYRHOMUQ.js +0 -1
- package/dist/funnel-runtime-host-NWS3URFA.js +0 -1
- package/dist/iam.d.ts +0 -131
- package/dist/iam.js +0 -1
- package/dist/paywall-4XZ6NDMY.js +0 -1
- package/dist/src-WV6GZYWA.js +0 -1
- package/dist/{errors-DrdTlPwf.d.ts → errors-BpCmukJr.d.ts} +1 -1
|
@@ -1,5 +1,258 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
declare const surfaceDataSchema: z.ZodObject<{
|
|
4
|
+
paywall: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
internal_feature_id: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
kind: z.ZodEnum<{
|
|
8
|
+
access: "access";
|
|
9
|
+
metered: "metered";
|
|
10
|
+
credit: "credit";
|
|
11
|
+
}>;
|
|
12
|
+
quantity: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
13
|
+
allowed: z.ZodBoolean;
|
|
14
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
15
|
+
not_entitled: "not_entitled";
|
|
16
|
+
insufficient_balance: "insufficient_balance";
|
|
17
|
+
capacity_exceeded: "capacity_exceeded";
|
|
18
|
+
limit_exceeded: "limit_exceeded";
|
|
19
|
+
awaiting_topup: "awaiting_topup";
|
|
20
|
+
authorization_required: "authorization_required";
|
|
21
|
+
payment_blocked: "payment_blocked";
|
|
22
|
+
cash_budget_exceeded: "cash_budget_exceeded";
|
|
23
|
+
unavailable: "unavailable";
|
|
24
|
+
authentication_required: "authentication_required";
|
|
25
|
+
}>>;
|
|
26
|
+
preview: z.ZodNullable<z.ZodObject<{
|
|
27
|
+
scenario: z.ZodEnum<{
|
|
28
|
+
feature_flag: "feature_flag";
|
|
29
|
+
usage_limit: "usage_limit";
|
|
30
|
+
}>;
|
|
31
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
32
|
+
productId: z.ZodString;
|
|
33
|
+
productVersionId: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
action: z.ZodEnum<{
|
|
36
|
+
purchase: "purchase";
|
|
37
|
+
upgrade: "upgrade";
|
|
38
|
+
addon: "addon";
|
|
39
|
+
topup: "topup";
|
|
40
|
+
}>;
|
|
41
|
+
membershipId: z.ZodNullable<z.ZodString>;
|
|
42
|
+
currency: z.ZodEnum<{
|
|
43
|
+
USD: "USD";
|
|
44
|
+
EUR: "EUR";
|
|
45
|
+
CNY: "CNY";
|
|
46
|
+
GBP: "GBP";
|
|
47
|
+
JPY: "JPY";
|
|
48
|
+
CAD: "CAD";
|
|
49
|
+
AUD: "AUD";
|
|
50
|
+
NZD: "NZD";
|
|
51
|
+
CHF: "CHF";
|
|
52
|
+
HKD: "HKD";
|
|
53
|
+
SGD: "SGD";
|
|
54
|
+
KRW: "KRW";
|
|
55
|
+
INR: "INR";
|
|
56
|
+
BRL: "BRL";
|
|
57
|
+
MXN: "MXN";
|
|
58
|
+
TWD: "TWD";
|
|
59
|
+
THB: "THB";
|
|
60
|
+
IDR: "IDR";
|
|
61
|
+
MYR: "MYR";
|
|
62
|
+
PHP: "PHP";
|
|
63
|
+
VND: "VND";
|
|
64
|
+
ZAR: "ZAR";
|
|
65
|
+
AED: "AED";
|
|
66
|
+
SAR: "SAR";
|
|
67
|
+
SEK: "SEK";
|
|
68
|
+
NOK: "NOK";
|
|
69
|
+
DKK: "DKK";
|
|
70
|
+
PLN: "PLN";
|
|
71
|
+
CZK: "CZK";
|
|
72
|
+
HUF: "HUF";
|
|
73
|
+
ILS: "ILS";
|
|
74
|
+
TRY: "TRY";
|
|
75
|
+
RON: "RON";
|
|
76
|
+
}>;
|
|
77
|
+
amountMinor: z.ZodString;
|
|
78
|
+
interval: z.ZodEnum<{
|
|
79
|
+
free: "free";
|
|
80
|
+
week: "week";
|
|
81
|
+
month: "month";
|
|
82
|
+
year: "year";
|
|
83
|
+
one_time: "one_time";
|
|
84
|
+
}>;
|
|
85
|
+
intervalCount: z.ZodNumber;
|
|
86
|
+
}, z.core.$strict>>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
90
|
+
base: z.ZodObject<{
|
|
91
|
+
text: z.ZodOptional<z.ZodString>;
|
|
92
|
+
label: z.ZodOptional<z.ZodString>;
|
|
93
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
94
|
+
html: z.ZodOptional<z.ZodString>;
|
|
95
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
current: z.ZodString;
|
|
97
|
+
original: z.ZodNullable<z.ZodString>;
|
|
98
|
+
period: z.ZodString;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
code: z.ZodOptional<z.ZodString>;
|
|
101
|
+
countdownAt: z.ZodOptional<z.ZodISODateTime>;
|
|
102
|
+
planId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
planVersionId: z.ZodOptional<z.ZodString>;
|
|
104
|
+
currency: z.ZodOptional<z.ZodEnum<{
|
|
105
|
+
USD: "USD";
|
|
106
|
+
EUR: "EUR";
|
|
107
|
+
CNY: "CNY";
|
|
108
|
+
GBP: "GBP";
|
|
109
|
+
JPY: "JPY";
|
|
110
|
+
CAD: "CAD";
|
|
111
|
+
AUD: "AUD";
|
|
112
|
+
NZD: "NZD";
|
|
113
|
+
CHF: "CHF";
|
|
114
|
+
HKD: "HKD";
|
|
115
|
+
SGD: "SGD";
|
|
116
|
+
KRW: "KRW";
|
|
117
|
+
INR: "INR";
|
|
118
|
+
BRL: "BRL";
|
|
119
|
+
MXN: "MXN";
|
|
120
|
+
TWD: "TWD";
|
|
121
|
+
THB: "THB";
|
|
122
|
+
IDR: "IDR";
|
|
123
|
+
MYR: "MYR";
|
|
124
|
+
PHP: "PHP";
|
|
125
|
+
VND: "VND";
|
|
126
|
+
ZAR: "ZAR";
|
|
127
|
+
AED: "AED";
|
|
128
|
+
SAR: "SAR";
|
|
129
|
+
SEK: "SEK";
|
|
130
|
+
NOK: "NOK";
|
|
131
|
+
DKK: "DKK";
|
|
132
|
+
PLN: "PLN";
|
|
133
|
+
CZK: "CZK";
|
|
134
|
+
HUF: "HUF";
|
|
135
|
+
ILS: "ILS";
|
|
136
|
+
TRY: "TRY";
|
|
137
|
+
RON: "RON";
|
|
138
|
+
}>>;
|
|
139
|
+
couponId: z.ZodOptional<z.ZodUUID>;
|
|
140
|
+
offerId: z.ZodOptional<z.ZodUUID>;
|
|
141
|
+
unavailable: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
unavailableReason: z.ZodOptional<z.ZodString>;
|
|
143
|
+
missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
picker: z.ZodOptional<z.ZodString>;
|
|
146
|
+
byPlan: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
147
|
+
text: z.ZodOptional<z.ZodString>;
|
|
148
|
+
label: z.ZodOptional<z.ZodString>;
|
|
149
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
150
|
+
html: z.ZodOptional<z.ZodString>;
|
|
151
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
current: z.ZodString;
|
|
153
|
+
original: z.ZodNullable<z.ZodString>;
|
|
154
|
+
period: z.ZodString;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
code: z.ZodOptional<z.ZodString>;
|
|
157
|
+
countdownAt: z.ZodOptional<z.ZodISODateTime>;
|
|
158
|
+
planId: z.ZodOptional<z.ZodString>;
|
|
159
|
+
planVersionId: z.ZodOptional<z.ZodString>;
|
|
160
|
+
currency: z.ZodOptional<z.ZodEnum<{
|
|
161
|
+
USD: "USD";
|
|
162
|
+
EUR: "EUR";
|
|
163
|
+
CNY: "CNY";
|
|
164
|
+
GBP: "GBP";
|
|
165
|
+
JPY: "JPY";
|
|
166
|
+
CAD: "CAD";
|
|
167
|
+
AUD: "AUD";
|
|
168
|
+
NZD: "NZD";
|
|
169
|
+
CHF: "CHF";
|
|
170
|
+
HKD: "HKD";
|
|
171
|
+
SGD: "SGD";
|
|
172
|
+
KRW: "KRW";
|
|
173
|
+
INR: "INR";
|
|
174
|
+
BRL: "BRL";
|
|
175
|
+
MXN: "MXN";
|
|
176
|
+
TWD: "TWD";
|
|
177
|
+
THB: "THB";
|
|
178
|
+
IDR: "IDR";
|
|
179
|
+
MYR: "MYR";
|
|
180
|
+
PHP: "PHP";
|
|
181
|
+
VND: "VND";
|
|
182
|
+
ZAR: "ZAR";
|
|
183
|
+
AED: "AED";
|
|
184
|
+
SAR: "SAR";
|
|
185
|
+
SEK: "SEK";
|
|
186
|
+
NOK: "NOK";
|
|
187
|
+
DKK: "DKK";
|
|
188
|
+
PLN: "PLN";
|
|
189
|
+
CZK: "CZK";
|
|
190
|
+
HUF: "HUF";
|
|
191
|
+
ILS: "ILS";
|
|
192
|
+
TRY: "TRY";
|
|
193
|
+
RON: "RON";
|
|
194
|
+
}>>;
|
|
195
|
+
couponId: z.ZodOptional<z.ZodUUID>;
|
|
196
|
+
offerId: z.ZodOptional<z.ZodUUID>;
|
|
197
|
+
unavailable: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
unavailableReason: z.ZodOptional<z.ZodString>;
|
|
199
|
+
missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
200
|
+
}, z.core.$strict>>>;
|
|
201
|
+
}, z.core.$strict>>;
|
|
202
|
+
plans: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
versionId: z.ZodString;
|
|
205
|
+
available: z.ZodBoolean;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
price: z.ZodString;
|
|
208
|
+
period: z.ZodString;
|
|
209
|
+
currency: z.ZodOptional<z.ZodEnum<{
|
|
210
|
+
USD: "USD";
|
|
211
|
+
EUR: "EUR";
|
|
212
|
+
CNY: "CNY";
|
|
213
|
+
GBP: "GBP";
|
|
214
|
+
JPY: "JPY";
|
|
215
|
+
CAD: "CAD";
|
|
216
|
+
AUD: "AUD";
|
|
217
|
+
NZD: "NZD";
|
|
218
|
+
CHF: "CHF";
|
|
219
|
+
HKD: "HKD";
|
|
220
|
+
SGD: "SGD";
|
|
221
|
+
KRW: "KRW";
|
|
222
|
+
INR: "INR";
|
|
223
|
+
BRL: "BRL";
|
|
224
|
+
MXN: "MXN";
|
|
225
|
+
TWD: "TWD";
|
|
226
|
+
THB: "THB";
|
|
227
|
+
IDR: "IDR";
|
|
228
|
+
MYR: "MYR";
|
|
229
|
+
PHP: "PHP";
|
|
230
|
+
VND: "VND";
|
|
231
|
+
ZAR: "ZAR";
|
|
232
|
+
AED: "AED";
|
|
233
|
+
SAR: "SAR";
|
|
234
|
+
SEK: "SEK";
|
|
235
|
+
NOK: "NOK";
|
|
236
|
+
DKK: "DKK";
|
|
237
|
+
PLN: "PLN";
|
|
238
|
+
CZK: "CZK";
|
|
239
|
+
HUF: "HUF";
|
|
240
|
+
ILS: "ILS";
|
|
241
|
+
TRY: "TRY";
|
|
242
|
+
RON: "RON";
|
|
243
|
+
}>>;
|
|
244
|
+
}, z.core.$strict>>;
|
|
245
|
+
pickers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
246
|
+
options: z.ZodArray<z.ZodString>;
|
|
247
|
+
selected: z.ZodNullable<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>>;
|
|
249
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
250
|
+
nodeId: z.ZodString;
|
|
251
|
+
message: z.ZodString;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
}, z.core.$strict>;
|
|
254
|
+
type SurfaceData = z.infer<typeof surfaceDataSchema>;
|
|
255
|
+
|
|
3
256
|
declare const couponInputSchema: z.ZodObject<{
|
|
4
257
|
name: z.ZodString;
|
|
5
258
|
description: z.ZodString;
|
|
@@ -79,11 +332,11 @@ declare const offerSchema: z.ZodObject<{
|
|
|
79
332
|
id: z.ZodUUID;
|
|
80
333
|
couponId: z.ZodUUID;
|
|
81
334
|
status: z.ZodEnum<{
|
|
82
|
-
revoked: "revoked";
|
|
83
|
-
expired: "expired";
|
|
84
335
|
reserved: "reserved";
|
|
336
|
+
expired: "expired";
|
|
85
337
|
issued: "issued";
|
|
86
338
|
redeemed: "redeemed";
|
|
339
|
+
revoked: "revoked";
|
|
87
340
|
}>;
|
|
88
341
|
issuedAt: z.ZodISODateTime;
|
|
89
342
|
expiresAt: z.ZodISODateTime;
|
|
@@ -161,12 +414,32 @@ declare const offerUnavailableReasonSchema: z.ZodEnum<{
|
|
|
161
414
|
}>;
|
|
162
415
|
type OfferUnavailableReason = z.infer<typeof offerUnavailableReasonSchema>;
|
|
163
416
|
|
|
417
|
+
declare const screenAnswersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
418
|
+
declare const screenParametersSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
419
|
+
type ScreenParameters = z.infer<typeof screenParametersSchema>;
|
|
420
|
+
type ScreenAnswers = z.infer<typeof screenAnswersSchema>;
|
|
421
|
+
declare const screenInputBindingsSchema: z.ZodArray<z.ZodObject<{
|
|
422
|
+
variable: z.ZodString;
|
|
423
|
+
componentId: z.ZodString;
|
|
424
|
+
required: z.ZodBoolean;
|
|
425
|
+
}, z.core.$strict>>;
|
|
426
|
+
declare const screenRendererInputSchema: z.ZodObject<{
|
|
427
|
+
bindings: z.ZodArray<z.ZodObject<{
|
|
428
|
+
variable: z.ZodString;
|
|
429
|
+
componentId: z.ZodString;
|
|
430
|
+
required: z.ZodBoolean;
|
|
431
|
+
}, z.core.$strict>>;
|
|
432
|
+
answers: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
433
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
434
|
+
}, z.core.$strict>;
|
|
435
|
+
type ScreenRendererInput = z.infer<typeof screenRendererInputSchema>;
|
|
436
|
+
|
|
164
437
|
declare const customerPageDataSchema: z.ZodObject<{
|
|
165
438
|
nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
166
439
|
source: z.ZodEnum<{
|
|
167
|
-
membership: "membership";
|
|
168
440
|
credit_balance: "credit_balance";
|
|
169
441
|
credit_transactions: "credit_transactions";
|
|
442
|
+
membership: "membership";
|
|
170
443
|
billing: "billing";
|
|
171
444
|
billing_controls: "billing_controls";
|
|
172
445
|
customer_plans: "customer_plans";
|
|
@@ -261,12 +534,12 @@ type CustomerPageData = z.infer<typeof customerPageDataSchema>;
|
|
|
261
534
|
declare const customerDataIntentSchema: z.ZodObject<{
|
|
262
535
|
nodeId: z.ZodString;
|
|
263
536
|
action: z.ZodEnum<{
|
|
537
|
+
invoice_open: "invoice_open";
|
|
264
538
|
filter: "filter";
|
|
265
539
|
billing_adjustment: "billing_adjustment";
|
|
266
540
|
billing_authorization: "billing_authorization";
|
|
267
541
|
buy_pack: "buy_pack";
|
|
268
542
|
billing_portal: "billing_portal";
|
|
269
|
-
invoice_open: "invoice_open";
|
|
270
543
|
refresh: "refresh";
|
|
271
544
|
next: "next";
|
|
272
545
|
previous: "previous";
|
|
@@ -280,4 +553,4 @@ declare const customerDataIntentSchema: z.ZodObject<{
|
|
|
280
553
|
}, z.core.$strict>;
|
|
281
554
|
type CustomerDataIntent = z.infer<typeof customerDataIntentSchema>;
|
|
282
555
|
|
|
283
|
-
export type
|
|
556
|
+
export { type CouponInput as C, type Offer as O, type ScreenAnswers as S, type SurfaceData as a, type CustomerDataIntent as b, type OfferUnavailableReason as c, type CustomerPageData as d, type ScreenParameters as e, type ScreenRendererInput as f, screenInputBindingsSchema as s };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as re}from"./chunk-6X42DWOM.js";import"./chunk-CXYOZSOF.js";import{Qd as be,bg as me}from"./chunk-A3N4ZZTM.js";import{a}from"./chunk-OVMNCZYC.js";import{Hb as ve}from"./chunk-3BQFJANQ.js";import"./chunk-AE4CUTUE.js";import"./chunk-S5TVMQRC.js";import"./chunk-RRII2DMC.js";import"./chunk-KQCTDXVD.js";function Ce(P){let M=P.view;if(!M?.paywall)throw new a("INVALID_REQUEST","The current node is not a Paywall");let n=M.paywall.receiptId,te=M.nodeId,se=M.visit,I=M.paywall.resolution,Q=I,v="document"in I?I:null;function U(t){return"document"in t?t.offering.id:t.content.offeringVersionId}function ie(t){if(t.id!==I.id||U(t)!==U(I)||t.content?.artifact.sha256!==I.content?.artifact.sha256)throw new a("INVALID_RESPONSE","The pinned Paywall binding changed")}let m=M.paywall.quote,T=M.paywall.operation,W=!1,q=new AbortController,S=M.paywall.purchaseRequestId,H=0,k=M.paywall.selectionGeneration??0,D=M.paywall.canReselect===!0,C=null,N=new Map,J=new Map;function V(t){if(t.purchase&&t.purchase.receiptId!==n)throw new a("INVALID_RESPONSE","Purchase receipt changed");let r=t.run.paywall;return t.purchase??(r?.receiptId===n?r:null)}function $(){if(W)throw new a("IDENTITY_CHANGED","Paywall presentation has closed")}function X(t,r,w){if($(),r!==H||w!==void 0&&m?.operationId!==w)return!1;let y=k,s=t.run.paywall;if(s?.receiptId===n){if((s.selectionGeneration??0)<k)return!1;k=s.selectionGeneration??0,D=s.canReselect===!0,ie(s.resolution)}let l=V(t),u=k>y,_=u?l?.quote??null:l?.quote??m,R=l?.operation??(_?.operationId===m?.operationId?T:null);if(_&&R&&_.operationId!==R.operationId)throw new a("INVALID_RESPONSE","Purchase operation changed");return s?.receiptId===n&&(Q=s.resolution,v="document"in Q?Q:v?{...Q,document:v.document,offering:v.offering}:null),(u||_?.operationId!==m?.operationId)&&(H++,s?.receiptId===n&&(S=s.purchaseRequestId)),m=_,(T?.operationId!==R?.operationId||T?.status==="pending"||R?.status==="complete")&&(T=R),!0}function B(t,r,w){return new Promise((y,s)=>{let l=!1,u=()=>{clearTimeout(Z),q.signal.removeEventListener("abort",Y)},_=x=>{l||(l=!0,u(),y(x))},R=x=>{l||(l=!0,u(),s(x))},Y=()=>R(new a("IDENTITY_CHANGED","Paywall presentation has closed")),Z=setTimeout(()=>R(new a("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,w)),Math.max(0,r-Date.now()));q.signal.addEventListener("abort",Y,{once:!0}),q.signal.aborted&&Y(),t.then(_,R)})}function h(t){return new Promise(r=>{let w=()=>{clearTimeout(y),q.signal.removeEventListener("abort",w),r()},y=setTimeout(w,t);q.signal.addEventListener("abort",w,{once:!0}),q.signal.aborted&&w()})}async function F(t,r,w){$();let y=N.get(t);if(!y){let u=P.pendingCommands?.find(_=>_.requestId===t)??P.pendingCommand;if(u?.operation==="submit"&&u.requestId===t&&u.nodeId===te&&u.visit===se){r.type==="paywall_quote"&&u.input.type==="paywall_quote"&&u.input.predecessor&&!r.predecessor&&(r={...r,predecessor:u.input.predecessor});let _=me.parse(u),R=me.parse({...u,input:r});if(R.operation!=="submit"||_.operation!=="submit"||JSON.stringify(R.input)!==JSON.stringify(_.input))throw new a("CONFLICT","A restored purchase request cannot change its input");r=R.input,y=_,N.set(t,y)}}if(y){if(JSON.stringify(y.input)!==JSON.stringify(r))throw new a("CONFLICT","A purchase request cannot change its input")}else{let u=P.view;if(!u||u.nodeId!==te||u.visit!==se||u.paywall?.receiptId!==n)throw new a("PRECONDITION_FAILED","The Paywall visit has changed");y={operation:"submit",requestId:t,nodeId:te,visit:se,revision:u.revision,input:r},N.set(t,y)}let s=Date.now()+3e4,l=await B(P.submit(y),s,t);for(;l.run.pendingRequest?.requestId===t&&Date.now()<s&&!W&&(await h(Math.min(1e3,s-Date.now())),!(W||Date.now()>=s));)l=await B(P.resume(t),s,t);if(W)throw new a("IDENTITY_CHANGED","Paywall presentation has closed");if(l.run.pendingRequest?.requestId===t)throw new a("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,t);if(!X(l,w,r.type==="paywall_confirm"||r.type==="paywall_cancel"?r.operationId:void 0))throw new a("PRECONDITION_FAILED","The purchase selection has changed")}async function oe(t){if(!m)throw new a("INVALID_REQUEST","A quoted purchase is required");let r=`${t}:${m.operationId}`,w=J.get(r);if(!w){let y=t==="confirm"?"paywall_confirm":"paywall_cancel",s=P.pendingCommands?.find(l=>l.operation==="submit"&&l.input.type===y&&"operationId"in l.input&&l.input.operationId===m.operationId)??P.pendingCommand;w=s?.operation==="submit"&&s.input.type===y&&"operationId"in s.input&&s.input.operationId===m.operationId?s.requestId:crypto.randomUUID(),J.set(r,w)}if(await F(w,{type:t==="confirm"?"paywall_confirm":"paywall_cancel",operationId:m.operationId},H),!T)throw new a("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(T)}return{get view(){return structuredClone(v)},get quote(){return m?structuredClone(m):null},get operation(){return T?structuredClone(T):null},get webViewUrl(){return P.webViewUrl},get canReselect(){return D},async refresh(){$();let t=H,r=await P.get();if(X(r,t),r.run.paywall?.receiptId!==n)throw new a("PRECONDITION_FAILED","Paywall presentation has changed");if(!v){if("document"in Q||!P.resolvePaywall)throw new a("INVALID_RESPONSE","Public Paywall reader is unavailable");let w=await P.resolvePaywall(Q);$(),ie(w),v={...Q,document:w.document,offering:w.offering}}return structuredClone(v)},preview(t){if(!v)return Promise.reject(new a("PRECONDITION_FAILED","Load the Paywall presentation first"));if(S&&S!==t.requestId&&(C||!D))return Promise.reject(new a("COMMAND_PENDING","Retry the original purchase before starting another"));if(S===t.requestId&&C)return C;let r=v.document.buttons[t.actionId],w=r?.type==="checkout"?be(r.product,t.selection,v.capabilities):null;if(!w)return Promise.reject(new a("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let y=S!==t.requestId&&k>0?{operationId:m?.operationId??null,generation:k}:void 0;if(y&&(!D||k<=0))return Promise.reject(new a("COMMAND_PENDING","Original purchase requires authoritative termination"));S!==t.requestId&&H++;let s=H;S=t.requestId;let l=(async()=>{if(await F(t.requestId,{type:"paywall_quote",actionId:t.actionId,productVersionId:w,...y?{predecessor:y}:{},...t.offerId?{offerId:t.offerId}:{},...t.nativeOffer?{nativeOffer:t.nativeOffer}:{}},s),!m)throw new a("INVALID_RESPONSE","The accepted quote is missing");return structuredClone(m)})();return C=l,l.then(()=>{C===l&&(C=null)},u=>{C===l&&(C=null),S===t.requestId&&P.pendingCommand?.requestId!==t.requestId&&u instanceof a&&u.status!==void 0&&u.status<500&&![401,425].includes(u.status)&&(S=null)}),l},confirm:()=>oe("confirm"),cancel:()=>oe("cancel"),async read(){if($(),!m)throw new a("INVALID_REQUEST","A quoted purchase is required");let t=m.operationId,r=H,w=P.pendingCommands?.find(u=>u.operation==="submit"&&(u.input.type==="paywall_confirm"||u.input.type==="paywall_cancel")&&u.input.operationId===t)??P.pendingCommand;w?.operation==="submit"&&(w.input.type==="paywall_confirm"||w.input.type==="paywall_cancel")&&w.input.operationId===t&&await P.settle?.(w.requestId);let y=await P.get(void 0,{receiptId:n,operationId:t});$();let s=V(y);if(s?.quote&&s.quote.operationId!==t||s?.operation&&s.operation.operationId!==t)throw new a("INVALID_RESPONSE","Purchase operation changed");let l=X(y,r,t)?T:s?.operation;if(!l)throw new a("INVALID_RESPONSE","The current purchase result is missing");return structuredClone(l)},destroy(){W=!0,q.abort(),N.clear(),J.clear()}}}async function Fe(P,M){let n=M,{mountScreenPreview:te}=await import("./popup.js"),{showPaywall:se}=await import("./paywall-PD62B2AY.js"),I=P.ownerDocument,Q=I.activeElement,v=I.createElement("section"),U=I.createElement("div"),ie=I.createElement("div"),m=I.createElement("div"),T=I.createElement("button");m.hidden=!0,T.type="button";let W=I.createElement("p"),q=I.createElement("p"),S=I.createElement("button"),H=I.createElement("button"),k=I.createElement("button"),D=I.createElement("dialog");v.dataset.indianaFunnel="",v.setAttribute("aria-busy","false"),v.style.cssText="box-sizing:border-box;width:100%;min-width:0;font:14px/1.5 system-ui,sans-serif;color:#172033;background:#fff",ie.style.cssText="display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 20px",W.setAttribute("role","status"),q.setAttribute("role","alert"),q.hidden=!0,S.type=H.type=k.type="button",ie.append(S,W,q,k,T,H),v.append(U,m,ie),P.append(v);let C=null,N=null,J=null,V="",$="",X="",B="",h=!1,F=0,oe=!1,t="",r=null,w=Promise.resolve(),y=null,s=null,l={},u=new Map,_=new Set,R=new Set,Y=new Set,Z=null,x={},E=!1,he,j=0,L=null,ae="",le=new Map,ye=e=>e?`${e.id}:${e.nodeId}:${e.visit}:${e.revision}:${e.paywall?.quote?.operationId??""}`:"",z=(e,i=null)=>{h||(s=i,q.textContent=e instanceof Error?e.message:"Request failed",q.hidden=!1,k.hidden=n.client.pendingCommand===null,re(n.onError,e))};function K(){let e=n.client.view;if(!e)throw new a("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision}}async function ee(e,i=!1){if(!(F&&!i||h||E&&!i)){F++,v.setAttribute("aria-busy","true"),q.hidden=!0,s=null;try{if(!i&&Z){let o=n.client.view;await Z;let g=n.client.view;if(!o||!g||g.id!==o.id||g.nodeId!==o.nodeId||g.visit!==o.visit||g.stopped||!["running","waiting"].includes(g.status))throw new a("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}if(h)return;let d=await e();h||await ne(n.client.view??d.run)}catch(d){z(d,n.client.pendingCommand?.requestId??null)}finally{F=Math.max(0,F-1),v.setAttribute("aria-busy",String(F>0)),h||(k.hidden=n.client.pendingCommand===null,S.disabled=F>0||!!n.client.pendingCommand||!n.client.view?.canBack)}}}function ge(e){if(E||_.has(e)||R.has(e)||h)return;R.add(e);let i=async()=>{if(E||h||V!==e){R.delete(e);return}if(F||n.client.pendingCommand){setTimeout(()=>{i()},250);return}let d=(async()=>{let g=n.client.view,p=K(),A=p.requestId,c=!1;try{await n.client.submit({operation:"shown",...p})}catch(b){if(!(b instanceof a)||b.code!=="CONFLICT"||b.status!==409||n.client.pendingCommand)throw b;await n.client.get();let f=n.client.view;if(h||E||V!==e||!f||!g||f.id!==g.id||f.source.versionId!==g.source.versionId||f.nodeId!==p.nodeId||f.visit!==p.visit||f.revision<=p.revision||f.stopped||!f.screen||!["running","waiting"].includes(f.status)||n.client.pendingCommand)throw b;let O=K();A=O.requestId,await n.client.submit({operation:"shown",...O})}for(;!h&&V===e&&n.client.pendingCommand?.requestId===A;){if(!n.client.settle)throw new a("COMMAND_PENDING","The original display acknowledgement is still pending");await n.client.settle(A),c=!0,n.client.pendingCommand?.requestId===A&&await new Promise(b=>setTimeout(b,1500))}h||V!==e||(c&&await n.client.get(),!(h||V!==e)&&_.add(e))})();Z=d;let o=()=>{Z===d&&(Z=null),R.delete(e)};d.then(o,g=>{o(),F||z(g)})};i()}function ue(){r&&clearTimeout(r),!(h||!J||!["running","waiting"].includes(J.status)&&!n.client.pendingCommand)&&(r=setTimeout(()=>{r=null,Ie().finally(ue)},J.pendingRequest||n.client.pendingCommand?1500:5e3))}async function Ie(){if(!(h||oe||F)){if(E){await ce(he);return}oe=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let i=n.client.view,d=l,o=await n.client.get(i?.screen&&Object.keys(d).length?{nodeId:i.nodeId,visit:i.visit,revision:i.revision,components:d}:void 0);!h&&d===l&&await ne(n.client.view??o.run)}catch(e){z(e)}finally{oe=!1}}}async function Ee(e){let i=n.client.view,d=i?.screen,o=d?.customerData.nodes[e.nodeId];if(h||F||!i||!d||!o)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(e.action)){let O=C?.document,G=O?ve(O,e.nodeId):null,we=G?.type==="customer_data"?G.data.outputs?.[e.action]:void 0;we&&d.outputs.includes(we)?await ee(()=>n.client.submit({operation:"submit",...K(),input:{type:"screen",output:we,answers:x,selection:e.value?{[e.nodeId]:e.value}:{}}})):await n.onCustomerDataIntent?.(e,i);return}let p=e.action.startsWith("sources_")?o.resources.find(O=>O.key===e.value):null;if(e.action.startsWith("sources_")&&!p)throw new a("INVALID_REQUEST","Choose a current resource");let A=`${i.visit}:${e.nodeId}:${p?.key??""}`,c=u.get(A)??[null],f=l[e.nodeId]??{page:1,after:null,filter:"all",...p?{resourceKey:p.key}:{}};if(e.action==="filter"){let O=e.value;if(!O||!(o.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(O))throw new a("INVALID_REQUEST","Unknown data filter");f={page:1,after:null,filter:O},c.splice(0,c.length,null)}else if(e.action==="next"||e.action==="sources_next"){let O=p?.sources.at(-1),G=p?O?{kind:"ledger",cursor:{at:O.detail[0],id:O.id,type:"source"}}:null:d.dataCursors[e.nodeId];if(!G||!p&&!o.hasNext)return;c[f.page]=G,f={...f,page:f.page+1,after:G}}else if(e.action==="previous"||e.action==="sources_previous"){if(f.page<=1)return;f={...f,page:f.page-1,after:c[f.page-2]??null}}u.set(A,c),l={...l,[e.nodeId]:f},await ee(()=>n.client.get({nodeId:i.nodeId,visit:i.visit,revision:i.revision,components:l}))}function Pe(e){let i=e.screen?.presentation;if(!i||i.type==="inline"){D.open&&D.close(),v.parentElement!==P&&P.append(v);return}v.parentElement!==D&&(D.append(v),P.append(D));let d={sm:420,md:640,lg:900};D.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in i?d[i.size]+"px":"100vw"}`,D.setAttribute("aria-label",C?.document?.name??e.screen?.content.document.name??"Funnel"),D.open||D.showModal()}async function De(e){if(h)return;J=e,s&&n.client.pendingCommand?.requestId!==s&&(q.hidden=!0,s=null);let i=e.locale.startsWith("zh");if(T.textContent=i?"\u56DE\u770B":"History",T.hidden=!n.client.review,S.textContent=E?i?"\u8FD4\u56DE\u5F53\u524D":"Return to current":i?"\u8FD4\u56DE":"Back",H.textContent=i?"\u5173\u95ED":"Close",k.textContent=i?"\u91CD\u8BD5":"Retry",S.disabled=!E&&(F>0||!!n.client.pendingCommand||!e.canBack),k.hidden=n.client.pendingCommand===null,W.textContent=e.pendingRequest?i?"\u6B63\u5728\u5904\u7406":"Processing":e.instruction?.type==="wait"?i?"\u7B49\u5F85\u4E2D":"Waiting":"",t!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(t=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,re(n.onState,structuredClone(e))),e.stopped||n.client.configurationReady===!1){E=!1,j++,L?.destroy(),L=null,m.replaceChildren(),m.hidden=!0,U.hidden=!1,C?.destroy(),C=null,N?.destroy(),N=null,U.replaceChildren(),V="",$="",B="",D.open&&D.close(),v.hidden=!0,ue();return}if(v.hidden=!1,E){ue();return}let d=e.screen||e.paywall?`${e.id}:${e.nodeId}:${e.visit}`:"";if(d!==V&&(C?.destroy(),C=null,N?.destroy(),N=null,U.replaceChildren(),V=d,$="",B="",x={...e.answers},l={},u.clear()),Pe(e),e.screen){let g=e.screen.content;C||(C=te(U,{mode:"live",rendererUrl:n.client.webViewUrl,title:g.document.name,onAction(c,b={},f={}){if(E)return;x={...x,...f};let O=Object.fromEntries((e.screen?.inputs??[]).filter(({variable:G})=>Object.hasOwn(x,G)).map(({variable:G})=>[G,x[G]]));ee(()=>n.client.submit({operation:"submit",...K(),input:{type:"screen",output:c,answers:O,selection:b}}))},onAnswers:c=>{E||(x={...x,...c})},onCustomerDataIntent:c=>{E||Ee(c).catch(z)},onEscape:()=>{E||de()},onError:c=>z(new Error(c)),onRendered:()=>ge(d)}));let p={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:x,values:e.screen.values}},A=JSON.stringify([g,e.locale,p.parameters,e.screen.inputs,e.screen.values]);if(A!==$)C.update(g.document,e.locale,p),$=A,X=JSON.stringify(p.capabilities),B=JSON.stringify(p.customerData);else{let c=JSON.stringify(p.capabilities);c!==X&&(C.updateCapabilities(p.capabilities),X=c),JSON.stringify(p.customerData)!==B&&(C.updateCustomerData(p.customerData),B=JSON.stringify(p.customerData))}await C.ready}else if(e.paywall&&!N){let g=await se(U,{canInteract:()=>!E&&!h,start:async()=>Ce(n.client),onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resolveOfferId:n.resolveOfferId,onEvent:n.onEvent,onOpenUrl:p=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:p,openIn:"same_window"}):I.defaultView?.location.assign(p),onAction:async p=>{if(E)return;let A=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision,input:{type:"screen",output:p,answers:{}}});await ne(n.client.view??A.run)},onError:z,onDismiss:()=>{!E&&!h&&n.client.view?.visit===e.visit&&de()}});h?g.host?.destroy():(N=g.host,N?.setSuspended(E)),ge(d)}let o=e.instruction;if(o&&(o.type==="open_url"||o.type==="event")&&!Y.has(o.receiptId)){let g=I.createElement("button");g.type="button",g.textContent=o.type==="open_url"?`${i?"\u524D\u5F80":"Continue to"} ${new URL(o.url).host}`:i?"\u7EE7\u7EED":"Continue",g.onclick=()=>{let p=K(),A=o.type==="open_url"&&!n.onOpenUrl&&o.openIn==="new_window"?Re(o.url):null;ee(async()=>{let c="success";if(o.type==="open_url")if(n.onOpenUrl)try{c=await n.onOpenUrl({receiptId:o.receiptId,url:o.url,openIn:o.openIn})===!1?"failed":"opened"}catch(f){re(n.onError,f),c="failed"}else c=o.openIn==="new_window"&&!A?"failed":"opened";if(o.type==="event"){if(!n.onEvent)throw new a("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(o.event)}if(h||n.client.view?.nodeId!==p.nodeId||n.client.view.visit!==p.visit)throw new a("PRECONDITION_FAILED","The client action visit changed");let b=await n.client.submit({operation:"submit",...p,input:{type:"client_action",receiptId:o.receiptId,outcome:c}});return Y.add(o.receiptId),o.type==="open_url"&&!n.onOpenUrl&&o.openIn==="same_window"&&I.defaultView?.location.assign(o.url),b})},U.replaceChildren(g)}!e.pendingRequest&&e.status==="completed"&&!Y.has(`complete:${e.id}`)&&(Y.add(`complete:${e.id}`),re(n.onComplete,structuredClone(e))),ue()}function Re(e){let i=I.defaultView?.open(e,"_blank")??null;return i&&(i.opener=null),i}function ne(e){return w=w.catch(()=>{}).then(()=>De(e)),w}async function ce(e){if(h||!n.client.review)return;E||(ae=ye(n.client.view),le.set(ae,structuredClone(x))),E=!0,he=e,U.hidden=!0,N?.setSuspended(!0),m.hidden=!1;let i=++j;try{let d=await n.client.review(e);if(h||i!==j||!E)return;if(!d.review)throw new a("INVALID_RESPONSE","Historical projection is missing");L?.destroy(),L=null,m.replaceChildren();let o=d.run.locale.startsWith("zh"),g=I.createElement("p");g.textContent=o?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",m.append(g);for(let[c,b]of d.review.pages.entries()){let f=I.createElement("button");f.type="button",f.textContent=o?`\u7B2C ${c+1} \u9875`:`Page ${c+1}`,f.onclick=()=>{ce(b.receiptId)},m.append(f)}if(d.review.page){let c=d.review.page,b=I.createElement("div");if(b.inert=!0,m.append(b),L=te(b,{mode:"live",rendererUrl:n.client.webViewUrl,title:c.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{},onEscape:()=>{fe()}}),L.update(c.document,d.run.locale,{serverInput:{bindings:c.inputs,answers:c.answers,values:c.values}}),await L.ready,h||i!==j||!E)return}let p=o?{issued:"\u5DF2\u9886\u53D6",reserved:"\u5DF2\u9884\u7559",redeemed:"\u5DF2\u4F7F\u7528",expired:"\u5DF2\u8FC7\u671F",revoked:"\u5DF2\u64A4\u9500",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},A=o?{pending:"\u5904\u7406\u4E2D",complete:"\u5DF2\u5B8C\u6210",cancelled:"\u5DF2\u53D6\u6D88",failed:"\u5931\u8D25",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{pending:"Processing",complete:"Completed",cancelled:"Cancelled",failed:"Failed",unknown:"Status unconfirmed"};for(let c of[...d.review.coupons.map((b,f)=>`${o?"\u4F18\u60E0\u5238":"Coupon"} ${f+1}: ${p[b.status]}`),...d.review.purchases.map((b,f)=>`${o?"\u8D2D\u4E70":"Purchase"} ${f+1}: ${A[b.status]}`)]){let b=I.createElement("p");b.textContent=c,m.append(b)}n.client.view&&await ne(n.client.view)}catch(d){if(i!==j||h)return;L?.destroy(),L=null,m.replaceChildren(),z(d)}}async function fe(){if(!E||h||!n.client.review)return;let e=++j;try{if(await n.client.review(),h||e!==j)return;E=!1,j++,L?.destroy(),L=null,m.replaceChildren(),m.hidden=!0,U.hidden=!1;let i=n.client.view;ye(i)!==ae?(le.set(ae,structuredClone(x)),V="",$=""):(le.delete(ae),N?.setSuspended(!1)),i&&await ne(i)}catch(i){if(e!==j||h)return;L?.destroy(),L=null,m.replaceChildren(),z(i)}}let Ne=n.client.subscribe(e=>{n.client.configurationReady===!1&&(v.hidden=!0,C?.destroy(),C=null,N?.destroy(),N=null,U.replaceChildren(),V="",$="",B="",D.open&&D.close()),ne(e).catch(z)}),Oe=n.client.subscribeError?.(z);function de(){return y||(h?Promise.resolve():n.client.view&&!["running","waiting"].includes(n.client.view.status)?(pe(),Promise.resolve()):(y=ee(()=>n.client.submit({operation:"close",...K()}),!0).then(()=>{n.client.view?.status==="closed"&&pe()}).finally(()=>{y=null}),y))}function pe(){h||(h=!0,r&&clearTimeout(r),Ne(),Oe?.(),C?.destroy(),j++,L?.destroy(),N?.destroy(),D.close(),D.remove(),v.remove(),Q instanceof HTMLElement&&Q.isConnected&&Q.focus(),re(n.onDismiss,J?structuredClone(J):null))}S.onclick=()=>{if(E){fe();return}ee(()=>n.client.submit({operation:"back",...K()}))},T.onclick=()=>{ce()},H.onclick=()=>{de()},k.onclick=()=>{ee(()=>n.client.retry())},D.addEventListener("cancel",e=>{e.preventDefault(),de()});try{let e=await n.client.get();await ne(n.client.view??e.run)}catch(e){throw pe(),e}return{destroy:pe,refresh:Ie,review:ce,exitReview:fe,get unappliedDrafts(){return new Map([...le].map(([e,i])=>[e,structuredClone(i)]))}}}export{Fe as showFunnelRun};
|