@whop/checkout 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -380
- package/dist/static/checkout/chunk-D7BU562Q.mjs +1 -0
- package/dist/static/checkout/index.cjs +1 -1
- package/dist/static/checkout/index.js +1 -1
- package/dist/static/checkout/index.mjs +1 -1
- package/dist/static/checkout/loader.cjs +1 -1
- package/dist/static/checkout/loader.js +1 -1
- package/dist/static/checkout/loader.mjs +1 -1
- package/dist/static/checkout/react/index.cjs +1 -1
- package/dist/static/checkout/react/index.d.mts +28 -2
- package/dist/static/checkout/react/index.d.ts +28 -2
- package/dist/static/checkout/react/index.js +1 -1
- package/dist/static/checkout/react/index.mjs +1 -1
- package/dist/static/checkout/util-B5tOGbpF.d.mts +130 -0
- package/dist/static/checkout/util-B5tOGbpF.d.ts +130 -0
- package/dist/static/checkout/util.cjs +1 -1
- package/dist/static/checkout/util.d.mts +1 -82
- package/dist/static/checkout/util.d.ts +1 -82
- package/dist/static/checkout/util.js +1 -1
- package/dist/static/checkout/util.mjs +1 -1
- package/package.json +1 -1
- package/dist/static/checkout/chunk-N2KVERZN.mjs +0 -1
package/README.md
CHANGED
|
@@ -2,384 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Embedded checkout allows you to embed Whop's checkout flow on your own website in two easy steps. This allows you to offer your users a seamless checkout experience without leaving your website.
|
|
4
4
|
|
|
5
|
-
**For React users**: This package now includes React components! Use `@whop/checkout/react` for React integration.
|
|
5
|
+
**For React users**: This package now includes React components! Use `@whop/checkout/react` for React integration.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
To embed checkout, you need to add the following script tag into the `<head>` of your page:
|
|
10
|
-
|
|
11
|
-
```md
|
|
12
|
-
<script
|
|
13
|
-
async
|
|
14
|
-
defer
|
|
15
|
-
src="https://js.whop.com/static/checkout/loader.js"
|
|
16
|
-
></script>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Step 2: Add the checkout element
|
|
20
|
-
|
|
21
|
-
To create a checkout element, you need to include the following attribute on an element in your page:
|
|
22
|
-
|
|
23
|
-
```md
|
|
24
|
-
<div data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This will now mount an iframe inside of the element with the plan id you provided. Once the checkout is complete, the user will be redirected to the redirect url you specified in the settings on Whop.
|
|
28
|
-
|
|
29
|
-
You can configure the redirect url in your [whop's settings](https://whop.com/dashboard/whops/) or in your [company's settings](https://whop.com/dashboard/settings/checkout/) on the dashboard. If both are specified, the redirect url specified in the whop's settings will take precedence.
|
|
30
|
-
|
|
31
|
-
## React Integration
|
|
32
|
-
|
|
33
|
-
For React applications, you can use the React component instead of the script-based approach:
|
|
34
|
-
|
|
35
|
-
### Installation and Setup
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install @whop/checkout
|
|
39
|
-
# or
|
|
40
|
-
pnpm add @whop/checkout
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Basic Usage
|
|
44
|
-
|
|
45
|
-
```tsx
|
|
46
|
-
import { WhopCheckoutEmbed } from "@whop/checkout/react";
|
|
47
|
-
|
|
48
|
-
export default function CheckoutPage() {
|
|
49
|
-
return (
|
|
50
|
-
<WhopCheckoutEmbed
|
|
51
|
-
planId="plan_XXXXXXXXX"
|
|
52
|
-
onComplete={(planId, receiptId) => {
|
|
53
|
-
console.log("Checkout completed!", { planId, receiptId });
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Advanced Usage with Controls
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
import { WhopCheckoutEmbed, useCheckoutEmbedControls } from "@whop/checkout/react";
|
|
64
|
-
|
|
65
|
-
export default function CheckoutPage() {
|
|
66
|
-
const checkoutRef = useCheckoutEmbedControls();
|
|
67
|
-
|
|
68
|
-
const handleSubmit = () => {
|
|
69
|
-
checkoutRef.current?.submit();
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const handleGetEmail = async () => {
|
|
73
|
-
try {
|
|
74
|
-
const email = await checkoutRef.current?.getEmail();
|
|
75
|
-
console.log("Current email:", email);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error("Failed to get email:", error);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div>
|
|
83
|
-
<WhopCheckoutEmbed
|
|
84
|
-
ref={checkoutRef}
|
|
85
|
-
planId="plan_XXXXXXXXX"
|
|
86
|
-
theme="dark"
|
|
87
|
-
onComplete={(planId, receiptId) => {
|
|
88
|
-
console.log("Checkout completed!", { planId, receiptId });
|
|
89
|
-
}}
|
|
90
|
-
onStateChange={(state) => {
|
|
91
|
-
console.log("Checkout state changed:", state);
|
|
92
|
-
}}
|
|
93
|
-
/>
|
|
94
|
-
<button onClick={handleSubmit}>Submit Checkout</button>
|
|
95
|
-
<button onClick={handleGetEmail}>Get Email</button>
|
|
96
|
-
</div>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### React Component Props
|
|
102
|
-
|
|
103
|
-
The `WhopCheckoutEmbed` component accepts the following props:
|
|
104
|
-
|
|
105
|
-
- `planId` (required): The plan ID you want to checkout
|
|
106
|
-
- `theme`: Theme preference (`"light"`, `"dark"`, or `"system"`)
|
|
107
|
-
- `sessionId`: Session ID for attaching metadata
|
|
108
|
-
- `hidePrice`: Hide the price in the checkout form
|
|
109
|
-
- `skipRedirect`: Skip the final redirect after completion
|
|
110
|
-
- `onComplete`: Callback when checkout is complete
|
|
111
|
-
- `onStateChange`: Callback when checkout state changes
|
|
112
|
-
- `utm`: UTM parameters for tracking
|
|
113
|
-
- `styles`: Custom styles for the embed
|
|
114
|
-
- `prefill`: Prefill options (e.g., email)
|
|
115
|
-
- `themeOptions`: Theme customization options
|
|
116
|
-
- `hideSubmitButton`: Hide the submit button
|
|
117
|
-
- `hideTermsAndConditions`: Hide terms and conditions
|
|
118
|
-
- `hideEmail`: Hide the email input
|
|
119
|
-
- `disableEmail`: Disable the email input
|
|
120
|
-
- `fallback`: Fallback content while loading
|
|
121
|
-
|
|
122
|
-
### React Version Compatibility
|
|
123
|
-
|
|
124
|
-
This package is compatible with React 18+ and React 19. It uses:
|
|
125
|
-
|
|
126
|
-
- Modern React 18+ type definitions for better type safety
|
|
127
|
-
- React hooks and modern patterns
|
|
128
|
-
- Server-side rendering safe patterns
|
|
129
|
-
- forwardRef for proper ref handling
|
|
130
|
-
|
|
131
|
-
### TypeScript Support
|
|
132
|
-
|
|
133
|
-
Full TypeScript support is included with proper type definitions for all components and hooks.
|
|
134
|
-
|
|
135
|
-
## Available methods
|
|
136
|
-
|
|
137
|
-
First, attach an `id` to the checkout container:
|
|
138
|
-
|
|
139
|
-
```md
|
|
140
|
-
<div id="whop-embedded-checkout" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### **`submit`**
|
|
144
|
-
|
|
145
|
-
To submit checkout programmatically, you can use the `submit` method on the checkout element.
|
|
146
|
-
|
|
147
|
-
```js
|
|
148
|
-
wco.submit("whop-embedded-checkout");
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### **`getEmail`**
|
|
152
|
-
|
|
153
|
-
To get the email of the user who is checking out, you can use the `getEmail` method on the checkout element.
|
|
154
|
-
|
|
155
|
-
```js
|
|
156
|
-
const email = await wco.getEmail("whop-embedded-checkout");
|
|
157
|
-
console.log(email);
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### **`setEmail`**
|
|
161
|
-
|
|
162
|
-
To set the email of the user who is checking out, you can use the `setEmail` method on the checkout element.
|
|
163
|
-
|
|
164
|
-
```js
|
|
165
|
-
wco.setEmail("whop-embedded-checkout", "example@domain.com");
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Available attributes
|
|
169
|
-
|
|
170
|
-
### **`data-whop-checkout-plan-id`**
|
|
171
|
-
|
|
172
|
-
**Required** - The plan id you want to checkout.
|
|
173
|
-
|
|
174
|
-
> To get your plan id, you need to first create a plan in the **Manage Pricing** section on your whop page.
|
|
175
|
-
|
|
176
|
-
### **`data-whop-checkout-theme`**
|
|
177
|
-
|
|
178
|
-
**Optional** - The theme you want to use for the checkout.
|
|
179
|
-
|
|
180
|
-
Possible values are `light`, `dark` or `system`.
|
|
181
|
-
|
|
182
|
-
```md
|
|
183
|
-
<div data-whop-checkout-theme="light" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### **`data-whop-checkout-theme-accent-color`**
|
|
187
|
-
|
|
188
|
-
**Optional** - The accent color to apply to the checkout embed
|
|
189
|
-
|
|
190
|
-
Possible values are
|
|
191
|
-
- `tomato`
|
|
192
|
-
- `red`
|
|
193
|
-
- `ruby`
|
|
194
|
-
- `crimson`
|
|
195
|
-
- `pink`
|
|
196
|
-
- `plum`
|
|
197
|
-
- `purple`
|
|
198
|
-
- `violet`
|
|
199
|
-
- `iris`
|
|
200
|
-
- `cyan`
|
|
201
|
-
- `teal`
|
|
202
|
-
- `jade`
|
|
203
|
-
- `green`
|
|
204
|
-
- `grass`
|
|
205
|
-
- `brown`
|
|
206
|
-
- `blue`
|
|
207
|
-
- `orange`
|
|
208
|
-
- `indigo`
|
|
209
|
-
- `sky`
|
|
210
|
-
- `mint`
|
|
211
|
-
- `yellow`
|
|
212
|
-
- `amber`
|
|
213
|
-
- `lime`
|
|
214
|
-
- `lemon`
|
|
215
|
-
- `magenta`
|
|
216
|
-
- `gold`
|
|
217
|
-
- `bronze`
|
|
218
|
-
- `gray`
|
|
219
|
-
|
|
220
|
-
```md
|
|
221
|
-
<div data-whop-checkout-theme-accent-color="green" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### **`data-whop-checkout-session`**
|
|
225
|
-
|
|
226
|
-
**Optional** - The session id to use for the checkout.
|
|
227
|
-
|
|
228
|
-
This can be used to attach metadata to a checkout by first creating a session through the API and then passing the session id to the checkout element.
|
|
229
|
-
|
|
230
|
-
```md
|
|
231
|
-
<div data-whop-checkout-session="ch_XXXXXXXXX" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### **`data-whop-checkout-hide-price`**
|
|
235
|
-
|
|
236
|
-
**Optional** - Set to `true` to hide the price in the embedded checkout form.
|
|
237
|
-
|
|
238
|
-
Defaults to `false`
|
|
239
|
-
|
|
240
|
-
```md
|
|
241
|
-
<div data-whop-checkout-hide-price="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### **`data-whop-checkout-hide-submit-button`**
|
|
245
|
-
|
|
246
|
-
**Optional** - Set to `true` to hide the submit button in the embedded checkout form.
|
|
247
|
-
|
|
248
|
-
Defaults to `false`
|
|
249
|
-
|
|
250
|
-
<Note>
|
|
251
|
-
When using this Option, you will need to [programmatically submit](#submit)
|
|
252
|
-
the checkout form.
|
|
253
|
-
</Note>
|
|
254
|
-
|
|
255
|
-
```md
|
|
256
|
-
<div data-whop-checkout-hide-submit-button="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### **`data-whop-checkout-hide-tos`**
|
|
260
|
-
|
|
261
|
-
**Optional** - Set to `true` to hide the terms and conditions in the embedded checkout form.
|
|
262
|
-
|
|
263
|
-
Defaults to `false`
|
|
264
|
-
|
|
265
|
-
```md
|
|
266
|
-
<div data-whop-checkout-hide-tos="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### **`data-whop-checkout-skip-redirect`**
|
|
270
|
-
|
|
271
|
-
**Optional** - Set to `true` to skip the final redirect and keep the top frame loaded.
|
|
272
|
-
|
|
273
|
-
Defaults to `false`
|
|
274
|
-
|
|
275
|
-
### **`data-whop-checkout-on-complete`**
|
|
276
|
-
|
|
277
|
-
**Optional** - The callback to call when the checkout succeed.
|
|
278
|
-
|
|
279
|
-
**Note** - This option will set `data-whop-checkout-skip-redirect` to `true`
|
|
280
|
-
|
|
281
|
-
```html
|
|
282
|
-
<script>
|
|
283
|
-
window.onCheckoutComplete = (planId, receiptId) => {
|
|
284
|
-
console.log(planId, receiptId);
|
|
285
|
-
}
|
|
286
|
-
</script>
|
|
287
|
-
|
|
288
|
-
<div data-whop-checkout-on-complete="onCheckoutComplete" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### **`data-whop-checkout-on-state-change`**
|
|
292
|
-
|
|
293
|
-
**Optional** - The callback to call when state of the checkout changes
|
|
294
|
-
|
|
295
|
-
This can be used when programmatically controlling the submit of the checkout embed.
|
|
296
|
-
|
|
297
|
-
```html
|
|
298
|
-
<script>
|
|
299
|
-
window.onCheckoutStateChange = (state) => {
|
|
300
|
-
console.log(state);
|
|
301
|
-
};
|
|
302
|
-
</script>
|
|
303
|
-
|
|
304
|
-
<div
|
|
305
|
-
data-whop-checkout-on-state-change="onCheckoutStateChange"
|
|
306
|
-
data-whop-checkout-plan-id="plan_XXXXXXXXX"
|
|
307
|
-
></div>
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### **`data-whop-checkout-skip-utm`**
|
|
311
|
-
|
|
312
|
-
By default any utm params from the main page will be forwarded to the checkout embed.
|
|
313
|
-
|
|
314
|
-
**Optional** - Set to `true` to prevent the automatic forwarding of utm parameters
|
|
315
|
-
|
|
316
|
-
Defaults to `false`
|
|
317
|
-
|
|
318
|
-
### **`data-whop-checkout-prefill-email`**
|
|
319
|
-
|
|
320
|
-
Used to prefill the email in the embedded checkout form. This setting can be helpful when integrating the embed into a funnel that collects the email prior to payment already.
|
|
321
|
-
|
|
322
|
-
```md
|
|
323
|
-
<div data-whop-checkout-prefill-email="example@domain.com" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
#### **`data-whop-checkout-hide-email`**
|
|
328
|
-
|
|
329
|
-
**Optional** - Set to `true` to hide the email input in the embedded checkout form. Make sure to display the users email in the parent page when setting this attribute.
|
|
330
|
-
|
|
331
|
-
Defaults to `false`
|
|
332
|
-
|
|
333
|
-
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
334
|
-
|
|
335
|
-
```md
|
|
336
|
-
<div data-whop-checkout-hide-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
#### **`data-whop-checkout-disable-email`**
|
|
340
|
-
|
|
341
|
-
**Optional** - Set to `true` to disable the email input in the embedded checkout form.
|
|
342
|
-
|
|
343
|
-
Defaults to `false`
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
Use this in conjunction with the `data-whop-checkout-prefill-email` attribute or the `setEmail` method to control the email input.
|
|
347
|
-
|
|
348
|
-
```md
|
|
349
|
-
<div data-whop-checkout-disable-email="true" data-whop-checkout-plan-id="plan_XXXXXXXXX"></div>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
## Full example
|
|
354
|
-
|
|
355
|
-
```md
|
|
356
|
-
<!DOCTYPE html>
|
|
357
|
-
<html>
|
|
358
|
-
<head>
|
|
359
|
-
<meta charset="utf-8">
|
|
360
|
-
<meta name="viewport" content="width=device-width">
|
|
361
|
-
<script
|
|
362
|
-
async
|
|
363
|
-
defer
|
|
364
|
-
src="https://js.whop.com/static/checkout/loader.js"
|
|
365
|
-
></script>
|
|
366
|
-
<title>Whop embedded checkout example</title>
|
|
367
|
-
<style>
|
|
368
|
-
div {
|
|
369
|
-
box-sizing: border-box;
|
|
370
|
-
}
|
|
371
|
-
body {
|
|
372
|
-
margin: 0
|
|
373
|
-
}
|
|
374
|
-
</style>
|
|
375
|
-
</head>
|
|
376
|
-
<body>
|
|
377
|
-
<div
|
|
378
|
-
data-whop-checkout-plan-id="plan_XXXXXXXXX"
|
|
379
|
-
data-whop-checkout-session="ch_XXXXXXXXX"
|
|
380
|
-
data-whop-checkout-theme="light"
|
|
381
|
-
style="height: fit-content; overflow: hidden; max-width: 50%;"
|
|
382
|
-
></div>
|
|
383
|
-
</body>
|
|
384
|
-
</html>
|
|
385
|
-
```
|
|
7
|
+
Read the full documentation [here](https://docs.whop.com/payments/checkout-embed).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function n(e,t,r,n,o,a,i){try{var u=e[a](i);var s=u.value}catch(e){r(e);return}if(u.done){t(s)}else{Promise.resolve(s).then(n,o)}}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var i=e.apply(t,r);function u(e){n(i,o,a,u,s,"next",e)}function s(e){n(i,o,a,u,s,"throw",e)}u(undefined)})}}function a(e,t,r){t=c(t);return m(e,_()?Reflect.construct(t,r||[],c(e).constructor):t.apply(e,r))}function i(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t,r){if(_()){u=Reflect.construct}else{u=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)b(a,r.prototype);return a}}return u.apply(null,arguments)}function s(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function c(e){c=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return c(e)}function l(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)b(e,t)}function f(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function d(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){s(e,t,r[t])})}return e}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function h(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{y(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function m(e,t){if(t&&(g(t)==="object"||typeof t==="function")){return t}return r(e)}function b(e,t){b=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return b(e,t)}function w(e,r){return t(e)||d(e,r)||P(e,r)||v()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function P(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function O(e){var t=typeof Map==="function"?new Map:undefined;O=function e(e){if(e===null||!f(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,c(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return b(r,e)};return O(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function j(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var S=Object.defineProperty;var E=function(e,t,r){return t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var k=function(e,t,r){return E(e,(typeof t==="undefined"?"undefined":g(t))!="symbol"?t+"":t,r)};var x=/*#__PURE__*/function(e){"use strict";l(t,e);function t(){i(this,t);var e;e=a(this,t,arguments);k(e,"type","WhopCheckoutError");return e}return t}(O(Error));var R=/*#__PURE__*/function(e){"use strict";l(t,e);function t(e){i(this,t);var r;r=a(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);k(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(x);var A=/*#__PURE__*/function(e){"use strict";l(t,e);function t(){i(this,t);var e;e=a(this,t,arguments);k(e,"name","WhopCheckoutSetEmailError");return e}return t}(x);var C=/*#__PURE__*/function(e){"use strict";l(t,e);function t(){i(this,t);var e;e=a(this,t,arguments);k(e,"name","WhopCheckoutSetAddressError");return e}return t}(x);var T=/*#__PURE__*/function(e){"use strict";l(t,e);function t(){i(this,t);var e;e=a(this,t,arguments);k(e,"name","WhopCheckoutGetAddressError");return e}return t}(x);var U=["resize","center","complete","state","get-email-result","set-email-result","set-address-result","get-address-result","address-validation-error"];function W(e){return g(e.data)=="object"&&e.data!==null&&"event"in e.data&&U.includes(e.data.event)}function L(e,t){return W(e)&&e.data.event===t}var M=[];function D(e){return M[e]||(M[e]=(e+256).toString(16).slice(1))}function I(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":g(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,D(e[0])+D(e[1])+D(e[2])+D(e[3])+"-"+D(e[4])+D(e[5])+"-"+D(e[6])+D(e[7])+"-"+D(e[8])+D(e[9])+"-"+D(e[10])+D(e[11])+D(e[12])+D(e[13])+D(e[14])+D(e[15])}function B(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var a;var i=new URL(e.src).origin,u=I();return(a=e.contentWindow)===null||a===void 0?void 0:a.postMessage(h(p({},t),{__scope:"whop-embedded-checkout",event_id:u}),i),new Promise(function(t,a){var i=setTimeout(function(){a(new R),window.removeEventListener("message",s)},o),s=function(o){if(o.source===e.contentWindow&&L(o,r)&&o.data.event===r&&o.data.event_id===u){clearTimeout(i),window.removeEventListener("message",s);try{t(n(o.data))}catch(e){a(e)}}};window.addEventListener("message",s)})}function F(e,t){function r(r){r.source===e.contentWindow&&W(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function G(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return o(function(){return j(this,function(n){return[2,B(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new A(e.error)},r)]})})()}function V(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return o(function(){return j(this,function(r){return[2,B(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function q(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return o(function(){return j(this,function(n){return[2,B(e,{event:"set-address",address:t},"set-address-result",function(e){if(!e.ok)throw new C(e.error)},r)]})})()}function z(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return o(function(){return j(this,function(r){return[2,B(e,{event:"get-address"},"get-address-result",function(e){if(!e.ok)throw new T(e.error);return{address:e.address,isComplete:e.is_complete}},t)]})})()}function $(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function H(e,t,r,n,o,a,i,u,s,c,l,f,d,v,p,y){var h,m,b,g,P,O,_;var j=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(j.searchParams.set("h",window.location.origin),t&&j.searchParams.set("theme",t),r&&j.searchParams.set("session",r),o&&j.searchParams.set("hide_price","true"),a&&j.searchParams.set("skip_redirect","true"),l&&j.searchParams.set("hide_submit_button","true"),f&&j.searchParams.set("hide_tos","true"),d&&j.searchParams.set("email.hidden","1"),v&&j.searchParams.set("email.disabled","1"),p&&j.searchParams.set("address.hidden","1"),y&&j.searchParams.set("a",y),i){var S=true,E=false,k=undefined,x=true,R=false,A=undefined;try{for(var C=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),T;!(x=(T=C.next()).done);x=true){var U=w(T.value,2),W=U[0],L=U[1];if(W.startsWith("utm_"))if(Array.isArray(L))try{for(var M=L[Symbol.iterator](),D;!(S=(D=M.next()).done);S=true){var I=D.value;j.searchParams.append(W,I)}}catch(e){E=true;k=e}finally{try{if(!S&&M.return!=null){M.return()}}finally{if(E){throw k}}}else j.searchParams.set(W,L)}}catch(e){R=true;A=e}finally{try{if(!x&&C.return!=null){C.return()}}finally{if(R){throw A}}}}if(u){var B=true,F=false,G=undefined,V=true,q=false,z=undefined;try{for(var $=Object.entries(u)[Symbol.iterator](),H;!(V=(H=$.next()).done);V=true){var J=w(H.value,2),K=J[0],N=J[1];if(N)try{for(var Q=Object.entries(N)[Symbol.iterator](),X;!(B=(X=Q.next()).done);B=true){var Y=w(X.value,2),Z=Y[0],ee=Y[1];j.searchParams.set("style.".concat(K,".").concat(Z),ee.toString())}}catch(e){F=true;G=e}finally{try{if(!B&&Q.return!=null){Q.return()}}finally{if(F){throw G}}}}}catch(e){q=true;z=e}finally{try{if(!V&&$.return!=null){$.return()}}finally{if(q){throw z}}}}var et=true,er=false,en=undefined;if((s===null||s===void 0?void 0:s.email)&&j.searchParams.set("email",s.email),(s===null||s===void 0?void 0:(h=s.address)===null||h===void 0?void 0:h.name)&&j.searchParams.set("name",s.address.name),(s===null||s===void 0?void 0:(m=s.address)===null||m===void 0?void 0:m.line1)&&j.searchParams.set("address.line1",s.address.line1),(s===null||s===void 0?void 0:(b=s.address)===null||b===void 0?void 0:b.line2)&&j.searchParams.set("address.line2",s.address.line2),(s===null||s===void 0?void 0:(g=s.address)===null||g===void 0?void 0:g.city)&&j.searchParams.set("address.city",s.address.city),(s===null||s===void 0?void 0:(P=s.address)===null||P===void 0?void 0:P.country)&&j.searchParams.set("address.country",s.address.country),(s===null||s===void 0?void 0:(O=s.address)===null||O===void 0?void 0:O.state)&&j.searchParams.set("address.state",s.address.state),(s===null||s===void 0?void 0:(_=s.address)===null||_===void 0?void 0:_.postalCode)&&j.searchParams.set("address.postal_code",s.address.postalCode),c)try{for(var eo=Object.entries(c)[Symbol.iterator](),ea;!(et=(ea=eo.next()).done);et=true){var ei=w(ea.value,2),eu=ei[0],es=ei[1];es&&j.searchParams.set("theme.".concat(eu),es)}}catch(e){er=true;en=e}finally{try{if(!et&&eo.return!=null){eo.return()}}finally{if(er){throw en}}}return j.toString()}var J=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],K="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";export{W as a,F as b,G as c,V as d,q as e,z as f,$ as g,H as h,J as i,K as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var l=u.value}catch(e){r(e);return}if(u.done){t(l)}else{Promise.resolve(l).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,l,"next",e)}function l(e){o(i,n,a,u,l,"throw",e)}u(undefined)})}}function i(e,t,r){t=f(t);return k(e,x()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function l(e,t,r){if(x()){l=Reflect.construct}else{l=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)O(a,r.prototype);return a}}return l.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function s(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)O(e,t)}function d(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function p(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function g(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function k(e,t){if(t&&(j(t)==="object"||typeof t==="function")){return t}return n(e)}function O(e,t){O=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return O(e,t)}function P(e,r){return t(e)||v(e,r)||_(e,r)||w()}function S(e){return t(e)||p(e)||_(e)||w()}function C(e){return r(e)||p(e)||_(e)||y()}function j(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function _(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return l(e,arguments,f(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return O(r,e)};return E(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function A(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return l([e,t])}}function l(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var R=Object.defineProperty;var T=function(e,t,r){return t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var I=function(e,t,r){return T(e,(typeof t==="undefined"?"undefined":j(t))!="symbol"?t+"":t,r)};var L=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"type","WhopCheckoutError");return e}return t}(E(Error));var W=/*#__PURE__*/function(e){s(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);I(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(L);var M=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"name","WhopCheckoutSetEmailError");return e}return t}(L);var U=["resize","center","complete","state","get-email-result","set-email-result"];function F(e){return j(e.data)=="object"&&e.data!==null&&"event"in e.data&&U.includes(e.data.event)}function D(e,t){return F(e)&&e.data.event===t}var H=[];function N(e){return H[e]||(H[e]=(e+256).toString(16).slice(1))}function B(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":j(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,N(e[0])+N(e[1])+N(e[2])+N(e[3])+"-"+N(e[4])+N(e[5])+"-"+N(e[6])+N(e[7])+"-"+N(e[8])+N(e[9])+"-"+N(e[10])+N(e[11])+N(e[12])+N(e[13])+N(e[14])+N(e[15])}function V(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var a;var i=new URL(e.src).origin,u=B();return(a=e.contentWindow)===null||a===void 0?void 0:a.postMessage(g(m({},t),{__scope:"whop-embedded-checkout",event_id:u}),i),new Promise(function(t,a){var i=setTimeout(function(){a(new W),window.removeEventListener("message",l)},o),l=function(o){if(o.source===e.contentWindow&&D(o,r)&&o.data.event===r&&o.data.event_id===u){clearTimeout(i),window.removeEventListener("message",l);try{t(n(o.data))}catch(e){a(e)}}};window.addEventListener("message",l)})}function q(e,t){function r(r){r.source===e.contentWindow&&F(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function z(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return A(this,function(n){return[2,V(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new M(e.error)},r)]})})()}function G(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return A(this,function(r){return[2,V(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function $(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function J(e,t,r,n,o,a,i,u,l,c,f,s,d,h){var p=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(p.searchParams.set("h",window.location.origin),t&&p.searchParams.set("theme",t),r&&p.searchParams.set("session",r),o&&p.searchParams.set("hide_price","true"),a&&p.searchParams.set("skip_redirect","true"),f&&p.searchParams.set("hide_submit_button","true"),s&&p.searchParams.set("hide_tos","true"),d&&p.searchParams.set("email.hidden","1"),h&&p.searchParams.set("email.disabled","1"),i){var v=true,w=false,y=undefined,m=true,b=false,g=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),O;!(m=(O=k.next()).done);m=true){var S=P(O.value,2),C=S[0],j=S[1];if(C.startsWith("utm_"))if(Array.isArray(j))try{for(var _=j[Symbol.iterator](),E;!(v=(E=_.next()).done);v=true){var x=E.value;p.searchParams.append(C,x)}}catch(e){w=true;y=e}finally{try{if(!v&&_.return!=null){_.return()}}finally{if(w){throw y}}}else p.searchParams.set(C,j)}}catch(e){b=true;g=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(b){throw g}}}}if(u){var A=true,R=false,T=undefined,I=true,L=false,W=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),U;!(I=(U=M.next()).done);I=true){var F=P(U.value,2),D=F[0],H=F[1];if(H)try{for(var N=Object.entries(H)[Symbol.iterator](),B;!(A=(B=N.next()).done);A=true){var V=P(B.value,2),q=V[0],z=V[1];p.searchParams.set("style.".concat(D,".").concat(q),z.toString())}}catch(e){R=true;T=e}finally{try{if(!A&&N.return!=null){N.return()}}finally{if(R){throw T}}}}}catch(e){L=true;W=e}finally{try{if(!I&&M.return!=null){M.return()}}finally{if(L){throw W}}}}var G=true,$=false,J=undefined;if((l===null||l===void 0?void 0:l.email)&&p.searchParams.set("email",l.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),Q;!(G=(Q=K.next()).done);G=true){var X=P(Q.value,2),Y=X[0],Z=X[1];Z&&p.searchParams.set("theme.".concat(Y),Z)}}catch(e){$=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if($){throw J}}}return p.toString()}var K=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],Q="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function X(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,C(r))}function Y(e,t){var r;e.addEventListener("checkout:submit",function(t){$(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,q(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{X(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{X(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))}function Z(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var ee="data-whop-checkout-style-";function et(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(ee)){var l=u.name.slice(ee.length),c=u.value,f=S(l.split("-")),s=f[0],d=f.slice(1);if(s&&d.length>0){var h=d.reduce(function(e,t,r){if(r===0)return t;var n=S(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var p;(p=t[s])!==null&&p!==void 0?p:t[s]={},t[s][h]=c}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function er(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function en(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t}function eo(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=J(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:Z(),et(e),en(e),er(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true"),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,C(K)),a.allow=Q,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),Y(a,e)}if((typeof window==="undefined"?"undefined":j(window))<"u"&&window.wco&&!window.wco.listening){window.wco.getEmail=function(e,t){var r;var n=(r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.get(e);if(!n)throw new Error("Failed to get email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return G(n,t)},window.wco.setEmail=function(e,t,r){var n;var o=(n=window.wco)===null||n===void 0?void 0:n.identifiedFrames.get(e);if(!o)throw new Error("Failed to set email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return z(o,t,r)};var ea=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,l,c;var f=true,s=false,h=undefined;try{for(var p=i.addedNodes[Symbol.iterator](),v;!(f=(v=p.next()).done);f=true){var w=v.value;d(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&eo(w)}}catch(e){s=true;h=e}finally{try{if(!f&&p.return!=null){p.return()}}finally{if(s){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,g=false,k=undefined;try{for(var O=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),S;!(b=(S=O.next()).done);b=true){var C=P(S.value,2),j=C[0],_=C[1];y.includes(j)&&(j.dataset.whopCheckoutIdentifier&&((l=window.wco)===null||l===void 0?void 0:l.identifiedFrames.delete(j.dataset.whopCheckoutIdentifier)),_(),(c=window.wco)===null||c===void 0?void 0:c.frames.delete(j))}}catch(e){g=true;k=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(g){throw k}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var ei=true,eu=false,el=undefined;try{for(var ec=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),ef;!(ei=(ef=ec.next()).done);ei=true){var es=ef.value;d(es,HTMLElement)&&eo(es)}}catch(e){eu=true;el=e}finally{try{if(!ei&&ec.return!=null){ec.return()}}finally{if(eu){throw el}}}ea.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var s=u.value}catch(e){r(e);return}if(u.done){t(s)}else{Promise.resolve(s).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,s,"next",e)}function s(e){o(i,n,a,u,s,"throw",e)}u(undefined)})}}function i(e,t,r){t=d(t);return g(e,j()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function s(e,t,r){if(j()){s=Reflect.construct}else{s=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)P(a,r.prototype);return a}}return s.apply(null,arguments)}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function c(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)P(e,t)}function f(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function k(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function g(e,t){if(t&&(S(t)==="object"||typeof t==="function")){return t}return n(e)}function P(e,t){P=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return P(e,t)}function C(e,r){return t(e)||p(e,r)||A(e,r)||w()}function O(e){return t(e)||v(e)||A(e)||w()}function _(e){return r(e)||v(e)||A(e)||y()}function S(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function A(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,d(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return P(r,e)};return E(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var R=Object.defineProperty;var L=function(e,t,r){return t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var T=function(e,t,r){return L(e,(typeof t==="undefined"?"undefined":S(t))!="symbol"?t+"":t,r)};var I=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"type","WhopCheckoutError");return e}return t}(E(Error));var U=/*#__PURE__*/function(e){c(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);T(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(I);var W=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutSetEmailError");return e}return t}(I);var M=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutSetAddressError");return e}return t}(I);var H=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutGetAddressError");return e}return t}(I);var D=["resize","center","complete","state","get-email-result","set-email-result","set-address-result","get-address-result","address-validation-error"];function F(e){return S(e.data)=="object"&&e.data!==null&&"event"in e.data&&D.includes(e.data.event)}function N(e,t){return F(e)&&e.data.event===t}var V=[];function B(e){return V[e]||(V[e]=(e+256).toString(16).slice(1))}function q(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":S(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,B(e[0])+B(e[1])+B(e[2])+B(e[3])+"-"+B(e[4])+B(e[5])+"-"+B(e[6])+B(e[7])+"-"+B(e[8])+B(e[9])+"-"+B(e[10])+B(e[11])+B(e[12])+B(e[13])+B(e[14])+B(e[15])}function z(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var a;var i=new URL(e.src).origin,u=q();return(a=e.contentWindow)===null||a===void 0?void 0:a.postMessage(k(m({},t),{__scope:"whop-embedded-checkout",event_id:u}),i),new Promise(function(t,a){var i=setTimeout(function(){a(new U),window.removeEventListener("message",s)},o),s=function(o){if(o.source===e.contentWindow&&N(o,r)&&o.data.event===r&&o.data.event_id===u){clearTimeout(i),window.removeEventListener("message",s);try{t(n(o.data))}catch(e){a(e)}}};window.addEventListener("message",s)})}function G(e,t){function r(r){r.source===e.contentWindow&&F(r)&&t(r.data)}return window.addEventListener("message",r),function(){window.removeEventListener("message",r)}}function $(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return x(this,function(n){return[2,z(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new W(e.error)},r)]})})()}function J(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return x(this,function(r){return[2,z(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}function K(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return x(this,function(n){return[2,z(e,{event:"set-address",address:t},"set-address-result",function(e){if(!e.ok)throw new M(e.error)},r)]})})()}function Q(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return x(this,function(r){return[2,z(e,{event:"get-address"},"get-address-result",function(e){if(!e.ok)throw new H(e.error);return{address:e.address,isComplete:e.is_complete}},t)]})})()}function X(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)}function Y(e,t,r,n,o,a,i,u,s,l,d,c,f,h,v,p){var w,y,m,b,k,g,P;var O=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(O.searchParams.set("h",window.location.origin),t&&O.searchParams.set("theme",t),r&&O.searchParams.set("session",r),o&&O.searchParams.set("hide_price","true"),a&&O.searchParams.set("skip_redirect","true"),d&&O.searchParams.set("hide_submit_button","true"),c&&O.searchParams.set("hide_tos","true"),f&&O.searchParams.set("email.hidden","1"),h&&O.searchParams.set("email.disabled","1"),v&&O.searchParams.set("address.hidden","1"),p&&O.searchParams.set("a",p),i){var _=true,S=false,A=undefined,E=true,j=false,x=undefined;try{for(var R=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),L;!(E=(L=R.next()).done);E=true){var T=C(L.value,2),I=T[0],U=T[1];if(I.startsWith("utm_"))if(Array.isArray(U))try{for(var W=U[Symbol.iterator](),M;!(_=(M=W.next()).done);_=true){var H=M.value;O.searchParams.append(I,H)}}catch(e){S=true;A=e}finally{try{if(!_&&W.return!=null){W.return()}}finally{if(S){throw A}}}else O.searchParams.set(I,U)}}catch(e){j=true;x=e}finally{try{if(!E&&R.return!=null){R.return()}}finally{if(j){throw x}}}}if(u){var D=true,F=false,N=undefined,V=true,B=false,q=undefined;try{for(var z=Object.entries(u)[Symbol.iterator](),G;!(V=(G=z.next()).done);V=true){var $=C(G.value,2),J=$[0],K=$[1];if(K)try{for(var Q=Object.entries(K)[Symbol.iterator](),X;!(D=(X=Q.next()).done);D=true){var Y=C(X.value,2),Z=Y[0],ee=Y[1];O.searchParams.set("style.".concat(J,".").concat(Z),ee.toString())}}catch(e){F=true;N=e}finally{try{if(!D&&Q.return!=null){Q.return()}}finally{if(F){throw N}}}}}catch(e){B=true;q=e}finally{try{if(!V&&z.return!=null){z.return()}}finally{if(B){throw q}}}}var et=true,er=false,en=undefined;if((s===null||s===void 0?void 0:s.email)&&O.searchParams.set("email",s.email),(s===null||s===void 0?void 0:(w=s.address)===null||w===void 0?void 0:w.name)&&O.searchParams.set("name",s.address.name),(s===null||s===void 0?void 0:(y=s.address)===null||y===void 0?void 0:y.line1)&&O.searchParams.set("address.line1",s.address.line1),(s===null||s===void 0?void 0:(m=s.address)===null||m===void 0?void 0:m.line2)&&O.searchParams.set("address.line2",s.address.line2),(s===null||s===void 0?void 0:(b=s.address)===null||b===void 0?void 0:b.city)&&O.searchParams.set("address.city",s.address.city),(s===null||s===void 0?void 0:(k=s.address)===null||k===void 0?void 0:k.country)&&O.searchParams.set("address.country",s.address.country),(s===null||s===void 0?void 0:(g=s.address)===null||g===void 0?void 0:g.state)&&O.searchParams.set("address.state",s.address.state),(s===null||s===void 0?void 0:(P=s.address)===null||P===void 0?void 0:P.postalCode)&&O.searchParams.set("address.postal_code",s.address.postalCode),l)try{for(var eo=Object.entries(l)[Symbol.iterator](),ea;!(et=(ea=eo.next()).done);et=true){var ei=C(ea.value,2),eu=ei[0],es=ei[1];es&&O.searchParams.set("theme.".concat(eu),es)}}catch(e){er=true;en=e}finally{try{if(!et&&eo.return!=null){eo.return()}}finally{if(er){throw en}}}return O.toString()}var Z=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],ee="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function et(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,_(r))}function er(e,t){var r;e.addEventListener("checkout:submit",function(t){X(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,G(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{et(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{et(t.dataset.whopCheckoutOnStateChange,r.state);break}case"address-validation-error":{et(t.dataset.whopCheckoutOnAddressValidationError,{error_message:r.error_message,error_code:r.error_code});break}}}))}function en(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})}var eo="data-whop-checkout-style-";function ea(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(eo)){var s=u.name.slice(eo.length),l=u.value,d=O(s.split("-")),c=d[0],f=d.slice(1);if(c&&f.length>0){var h=f.reduce(function(e,t,r){if(r===0)return t;var n=O(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[c])!==null&&v!==void 0?v:t[c]={},t[c][h]=l}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t}function ei(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function eu(e){var t={};var r,n,o,a,i,u,s;return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),e.dataset.whopCheckoutPrefillName&&((r=t.address)!==null&&r!==void 0?r:t.address={},t.address.name=e.dataset.whopCheckoutPrefillName),e.dataset.whopCheckoutPrefillAddressLine1&&((n=t.address)!==null&&n!==void 0?n:t.address={},t.address.line1=e.dataset.whopCheckoutPrefillAddressLine1),e.dataset.whopCheckoutPrefillAddressLine2&&((o=t.address)!==null&&o!==void 0?o:t.address={},t.address.line2=e.dataset.whopCheckoutPrefillAddressLine2),e.dataset.whopCheckoutPrefillAddressCity&&((a=t.address)!==null&&a!==void 0?a:t.address={},t.address.city=e.dataset.whopCheckoutPrefillAddressCity),e.dataset.whopCheckoutPrefillAddressCountry&&((i=t.address)!==null&&i!==void 0?i:t.address={},t.address.country=e.dataset.whopCheckoutPrefillAddressCountry),e.dataset.whopCheckoutPrefillAddressState&&((u=t.address)!==null&&u!==void 0?u:t.address={},t.address.state=e.dataset.whopCheckoutPrefillAddressState),e.dataset.whopCheckoutPrefillAddressPostalCode&&((s=t.address)!==null&&s!==void 0?s:t.address={},t.address.postalCode=e.dataset.whopCheckoutPrefillAddressPostalCode),t}function es(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=Y(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:en(),ea(e),eu(e),ei(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true",e.dataset.whopCheckoutHideAddress==="true",e.dataset.whopCheckoutAffiliateCode),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,_(Z)),a.allow=ee,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),er(a,e)}if((typeof window==="undefined"?"undefined":S(window))<"u"&&window.wco&&!window.wco.listening){var el=function e(e){var t;var r=(t=window.wco)===null||t===void 0?void 0:t.identifiedFrames.get(e);if(!r)throw new Error("No embed with identifier ".concat(e," found."));return r};ey=el,window.wco.getEmail=function(e,t){return J(el(e),t)},window.wco.setEmail=function(e,t,r){return $(el(e),t,r)},window.wco.getAddress=function(e,t){return Q(el(e),t)},window.wco.setAddress=function(e,t,r){return K(el(e),t,r)};var ed=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,s,l;var d=true,c=false,h=undefined;try{for(var v=i.addedNodes[Symbol.iterator](),p;!(d=(p=v.next()).done);d=true){var w=p.value;f(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&es(w)}}catch(e){c=true;h=e}finally{try{if(!d&&v.return!=null){v.return()}}finally{if(c){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,k=false,g=undefined;try{for(var P=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),O;!(b=(O=P.next()).done);b=true){var _=C(O.value,2),S=_[0],A=_[1];y.includes(S)&&(S.dataset.whopCheckoutIdentifier&&((s=window.wco)===null||s===void 0?void 0:s.identifiedFrames.delete(S.dataset.whopCheckoutIdentifier)),A(),(l=window.wco)===null||l===void 0?void 0:l.frames.delete(S))}}catch(e){k=true;g=e}finally{try{if(!b&&P.return!=null){P.return()}}finally{if(k){throw g}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var ec=true,ef=false,eh=undefined;try{for(var ev=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),ep;!(ec=(ep=ev.next()).done);ec=true){var ew=ep.value;f(ew,HTMLElement)&&es(ew)}}catch(e){ef=true;eh=e}finally{try{if(!ec&&ev.return!=null){ev.return()}}finally{if(ef){throw eh}}}ed.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}var ey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var l=u.value}catch(e){r(e);return}if(u.done){t(l)}else{Promise.resolve(l).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,l,"next",e)}function l(e){o(i,n,a,u,l,"throw",e)}u(undefined)})}}function i(e,t,r){t=f(t);return k(e,x()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function l(e,t,r){if(x()){l=Reflect.construct}else{l=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)O(a,r.prototype);return a}}return l.apply(null,arguments)}function c(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function f(e){f=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return f(e)}function s(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)O(e,t)}function d(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){c(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function g(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function k(e,t){if(t&&(j(t)==="object"||typeof t==="function")){return t}return n(e)}function O(e,t){O=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return O(e,t)}function P(e,r){return t(e)||p(e,r)||_(e,r)||w()}function S(e){return t(e)||v(e)||_(e)||w()}function C(e){return r(e)||v(e)||_(e)||y()}function j(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function _(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return l(e,arguments,f(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return O(r,e)};return E(e)}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function A(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return l([e,t])}}function l(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}(function(){var e=function e(e){return j(e.data)=="object"&&e.data!==null&&"event"in e.data&&M.includes(e.data.event)};var t=function t(t,r){return e(t)&&t.data.event===r};var r=function e(e){return U[e]||(U[e]=(e+256).toString(16).slice(1))};var n=function e(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":j(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,r(e[0])+r(e[1])+r(e[2])+r(e[3])+"-"+r(e[4])+r(e[5])+"-"+r(e[6])+r(e[7])+"-"+r(e[8])+r(e[9])+"-"+r(e[10])+r(e[11])+r(e[12])+r(e[13])+r(e[14])+r(e[15])};var o=function e(e,r,o,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var u;var l=new URL(e.src).origin,c=n();return(u=e.contentWindow)===null||u===void 0?void 0:u.postMessage(g(m({},r),{__scope:"whop-embedded-checkout",event_id:c}),l),new Promise(function(r,n){var u=setTimeout(function(){n(new L),window.removeEventListener("message",l)},i),l=function(i){if(i.source===e.contentWindow&&t(i,o)&&i.data.event===o&&i.data.event_id===c){clearTimeout(u),window.removeEventListener("message",l);try{r(a(i.data))}catch(e){n(e)}}};window.addEventListener("message",l)})};var l=function t(t,r){function n(n){n.source===t.contentWindow&&e(n)&&r(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var c=function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return A(this,function(n){return[2,o(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new W(e.error)},r)]})})()};var f=function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return A(this,function(r){return[2,o(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()};var h=function e(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var v=function e(e,t,r,n,o,a,i,u,l,c,f,s,d,h){var v=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(v.searchParams.set("h",window.location.origin),t&&v.searchParams.set("theme",t),r&&v.searchParams.set("session",r),o&&v.searchParams.set("hide_price","true"),a&&v.searchParams.set("skip_redirect","true"),f&&v.searchParams.set("hide_submit_button","true"),s&&v.searchParams.set("hide_tos","true"),d&&v.searchParams.set("email.hidden","1"),h&&v.searchParams.set("email.disabled","1"),i){var p=true,w=false,y=undefined,m=true,b=false,g=undefined;try{for(var k=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),O;!(m=(O=k.next()).done);m=true){var S=P(O.value,2),C=S[0],j=S[1];if(C.startsWith("utm_"))if(Array.isArray(j))try{for(var _=j[Symbol.iterator](),E;!(p=(E=_.next()).done);p=true){var x=E.value;v.searchParams.append(C,x)}}catch(e){w=true;y=e}finally{try{if(!p&&_.return!=null){_.return()}}finally{if(w){throw y}}}else v.searchParams.set(C,j)}}catch(e){b=true;g=e}finally{try{if(!m&&k.return!=null){k.return()}}finally{if(b){throw g}}}}if(u){var A=true,R=false,T=undefined,I=true,L=false,W=undefined;try{for(var M=Object.entries(u)[Symbol.iterator](),U;!(I=(U=M.next()).done);I=true){var F=P(U.value,2),D=F[0],H=F[1];if(H)try{for(var N=Object.entries(H)[Symbol.iterator](),B;!(A=(B=N.next()).done);A=true){var V=P(B.value,2),q=V[0],z=V[1];v.searchParams.set("style.".concat(D,".").concat(q),z.toString())}}catch(e){R=true;T=e}finally{try{if(!A&&N.return!=null){N.return()}}finally{if(R){throw T}}}}}catch(e){L=true;W=e}finally{try{if(!I&&M.return!=null){M.return()}}finally{if(L){throw W}}}}var G=true,$=false,J=undefined;if((l===null||l===void 0?void 0:l.email)&&v.searchParams.set("email",l.email),c)try{for(var K=Object.entries(c)[Symbol.iterator](),Q;!(G=(Q=K.next()).done);G=true){var X=P(Q.value,2),Y=X[0],Z=X[1];Z&&v.searchParams.set("theme.".concat(Y),Z)}}catch(e){$=true;J=e}finally{try{if(!G&&K.return!=null){K.return()}}finally{if($){throw J}}}return v.toString()};var p=function e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,C(r))};var w=function e(e,t){var r;e.addEventListener("checkout:submit",function(t){h(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,l(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{p(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{p(t.dataset.whopCheckoutOnStateChange,r.state);break}}}))};var y=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var b=function e(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(H)){var l=u.name.slice(H.length),c=u.value,f=S(l.split("-")),s=f[0],d=f.slice(1);if(s&&d.length>0){var h=d.reduce(function(e,t,r){if(r===0)return t;var n=S(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[s])!==null&&v!==void 0?v:t[s]={},t[s][h]=c}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t};var k=function e(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t};var O=function e(e){var t={};return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),t};var _=function e(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=v(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:y(),b(e),O(e),k(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true"),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,C(F)),a.allow=D,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),w(a,e)};var x=Object.defineProperty;var R=function(e,t,r){return t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var T=function(e,t,r){return R(e,(typeof t==="undefined"?"undefined":j(t))!="symbol"?t+"":t,r)};var I=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"type","WhopCheckoutError");return e}return t}(E(Error));var L=/*#__PURE__*/function(e){s(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);T(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(I);var W=/*#__PURE__*/function(e){s(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);T(e,"name","WhopCheckoutSetEmailError");return e}return t}(I);var M=["resize","center","complete","state","get-email-result","set-email-result"];var U=[];var F=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],D="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var H="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":j(window))<"u"&&window.wco&&!window.wco.listening){window.wco.getEmail=function(e,t){var r;var n=(r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.get(e);if(!n)throw new Error("Failed to get email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return f(n,t)},window.wco.setEmail=function(e,t,r){var n;var o=(n=window.wco)===null||n===void 0?void 0:n.identifiedFrames.get(e);if(!o)throw new Error("Failed to set email for Whop embedded checkout. No embed with identifier ".concat(e," found."));return c(o,t,r)};var N=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,l,c;var f=true,s=false,h=undefined;try{for(var v=i.addedNodes[Symbol.iterator](),p;!(f=(p=v.next()).done);f=true){var w=p.value;d(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&_(w)}}catch(e){s=true;h=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(s){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,g=false,k=undefined;try{for(var O=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),S;!(b=(S=O.next()).done);b=true){var C=P(S.value,2),j=C[0],E=C[1];y.includes(j)&&(j.dataset.whopCheckoutIdentifier&&((l=window.wco)===null||l===void 0?void 0:l.identifiedFrames.delete(j.dataset.whopCheckoutIdentifier)),E(),(c=window.wco)===null||c===void 0?void 0:c.frames.delete(j))}}catch(e){g=true;k=e}finally{try{if(!b&&O.return!=null){O.return()}}finally{if(g){throw k}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var B=true,V=false,q=undefined;try{for(var z=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),G;!(B=(G=z.next()).done);B=true){var $=G.value;d($,HTMLElement)&&_($)}}catch(e){V=true;q=e}finally{try{if(!B&&z.return!=null){z.return()}}finally{if(V){throw q}}}N.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}})();
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function o(e,t,r,n,o,a,i){try{var u=e[a](i);var s=u.value}catch(e){r(e);return}if(u.done){t(s)}else{Promise.resolve(s).then(n,o)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function u(e){o(i,n,a,u,s,"next",e)}function s(e){o(i,n,a,u,s,"throw",e)}u(undefined)})}}function i(e,t,r){t=d(t);return g(e,j()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function s(e,t,r){if(j()){s=Reflect.construct}else{s=function e(e,t,r){var n=[null];n.push.apply(n,t);var o=Function.bind.apply(e,n);var a=new o;if(r)P(a,r.prototype);return a}}return s.apply(null,arguments)}function l(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function c(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)P(e,t)}function f(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function h(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function v(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var o=true;var a=false;var i,u;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){n.push(i.value);if(t&&n.length===t)break}}catch(e){a=true;u=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(a)throw u}}return n}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){l(e,t,r[t])})}return e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function k(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function g(e,t){if(t&&(S(t)==="object"||typeof t==="function")){return t}return n(e)}function P(e,t){P=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return P(e,t)}function C(e,r){return t(e)||p(e,r)||A(e,r)||w()}function O(e){return t(e)||v(e)||A(e)||w()}function _(e){return r(e)||v(e)||A(e)||y()}function S(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function A(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function E(e){var t=typeof Map==="function"?new Map:undefined;E=function e(e){if(e===null||!h(e))return e;if(typeof e!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof t!=="undefined"){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,d(this).constructor)}r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});return P(r,e)};return E(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var r,n,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=u(0),i["throw"]=u(1),i["return"]=u(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(a=0)),a)try{if(r=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e];n=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}(function(){var e=function e(e){return S(e.data)=="object"&&e.data!==null&&"event"in e.data&&F.includes(e.data.event)};var t=function t(t,r){return e(t)&&t.data.event===r};var r=function e(e){return N[e]||(N[e]=(e+256).toString(16).slice(1))};var n=function e(){var e=new Uint8Array(16);if((typeof crypto==="undefined"?"undefined":S(crypto))<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=Math.random()*256|0;return e[6]=e[6]&15|64,e[8]=e[8]&63|128,r(e[0])+r(e[1])+r(e[2])+r(e[3])+"-"+r(e[4])+r(e[5])+"-"+r(e[6])+r(e[7])+"-"+r(e[8])+r(e[9])+"-"+r(e[10])+r(e[11])+r(e[12])+r(e[13])+r(e[14])+r(e[15])};var o=function e(e,r,o,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:2e3;var u;var s=new URL(e.src).origin,l=n();return(u=e.contentWindow)===null||u===void 0?void 0:u.postMessage(k(m({},r),{__scope:"whop-embedded-checkout",event_id:l}),s),new Promise(function(r,n){var u=setTimeout(function(){n(new W),window.removeEventListener("message",s)},i),s=function(i){if(i.source===e.contentWindow&&t(i,o)&&i.data.event===o&&i.data.event_id===l){clearTimeout(u),window.removeEventListener("message",s);try{r(a(i.data))}catch(e){n(e)}}};window.addEventListener("message",s)})};var s=function t(t,r){function n(n){n.source===t.contentWindow&&e(n)&&r(n.data)}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}};var l=function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return x(this,function(n){return[2,o(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new M(e.error)},r)]})})()};var d=function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return x(this,function(r){return[2,o(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()};var h=function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2e3;return a(function(){return x(this,function(n){return[2,o(e,{event:"set-address",address:t},"set-address-result",function(e){if(!e.ok)throw new H(e.error)},r)]})})()};var v=function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;return a(function(){return x(this,function(r){return[2,o(e,{event:"get-address"},"get-address-result",function(e){if(!e.ok)throw new D(e.error);return{address:e.address,isComplete:e.is_complete}},t)]})})()};var p=function e(e,t){var r;var n=new URL(e.src).origin;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({__scope:"whop-embedded-checkout",event:"submit"},n)};var w=function e(e,t,r,n,o,a,i,u,s,l,d,c,f,h,v,p){var w,y,m,b,k,g,P;var O=new URL("/embedded/checkout/".concat(e,"/"),n!==null&&n!==void 0?n:"https://whop.com/");if(O.searchParams.set("h",window.location.origin),t&&O.searchParams.set("theme",t),r&&O.searchParams.set("session",r),o&&O.searchParams.set("hide_price","true"),a&&O.searchParams.set("skip_redirect","true"),d&&O.searchParams.set("hide_submit_button","true"),c&&O.searchParams.set("hide_tos","true"),f&&O.searchParams.set("email.hidden","1"),h&&O.searchParams.set("email.disabled","1"),v&&O.searchParams.set("address.hidden","1"),p&&O.searchParams.set("a",p),i){var _=true,S=false,A=undefined,E=true,j=false,x=undefined;try{for(var R=Object.entries(i).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator](),L;!(E=(L=R.next()).done);E=true){var T=C(L.value,2),I=T[0],U=T[1];if(I.startsWith("utm_"))if(Array.isArray(U))try{for(var W=U[Symbol.iterator](),M;!(_=(M=W.next()).done);_=true){var H=M.value;O.searchParams.append(I,H)}}catch(e){S=true;A=e}finally{try{if(!_&&W.return!=null){W.return()}}finally{if(S){throw A}}}else O.searchParams.set(I,U)}}catch(e){j=true;x=e}finally{try{if(!E&&R.return!=null){R.return()}}finally{if(j){throw x}}}}if(u){var D=true,F=false,N=undefined,V=true,B=false,q=undefined;try{for(var z=Object.entries(u)[Symbol.iterator](),G;!(V=(G=z.next()).done);V=true){var $=C(G.value,2),J=$[0],K=$[1];if(K)try{for(var Q=Object.entries(K)[Symbol.iterator](),X;!(D=(X=Q.next()).done);D=true){var Y=C(X.value,2),Z=Y[0],ee=Y[1];O.searchParams.set("style.".concat(J,".").concat(Z),ee.toString())}}catch(e){F=true;N=e}finally{try{if(!D&&Q.return!=null){Q.return()}}finally{if(F){throw N}}}}}catch(e){B=true;q=e}finally{try{if(!V&&z.return!=null){z.return()}}finally{if(B){throw q}}}}var et=true,er=false,en=undefined;if((s===null||s===void 0?void 0:s.email)&&O.searchParams.set("email",s.email),(s===null||s===void 0?void 0:(w=s.address)===null||w===void 0?void 0:w.name)&&O.searchParams.set("name",s.address.name),(s===null||s===void 0?void 0:(y=s.address)===null||y===void 0?void 0:y.line1)&&O.searchParams.set("address.line1",s.address.line1),(s===null||s===void 0?void 0:(m=s.address)===null||m===void 0?void 0:m.line2)&&O.searchParams.set("address.line2",s.address.line2),(s===null||s===void 0?void 0:(b=s.address)===null||b===void 0?void 0:b.city)&&O.searchParams.set("address.city",s.address.city),(s===null||s===void 0?void 0:(k=s.address)===null||k===void 0?void 0:k.country)&&O.searchParams.set("address.country",s.address.country),(s===null||s===void 0?void 0:(g=s.address)===null||g===void 0?void 0:g.state)&&O.searchParams.set("address.state",s.address.state),(s===null||s===void 0?void 0:(P=s.address)===null||P===void 0?void 0:P.postalCode)&&O.searchParams.set("address.postal_code",s.address.postalCode),l)try{for(var eo=Object.entries(l)[Symbol.iterator](),ea;!(et=(ea=eo.next()).done);et=true){var ei=C(ea.value,2),eu=ei[0],es=ei[1];es&&O.searchParams.set("theme.".concat(eu),es)}}catch(e){er=true;en=e}finally{try{if(!et&&eo.return!=null){eo.return()}}finally{if(er){throw en}}}return O.toString()};var y=function e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,_(r))};var b=function e(e,t){var r;e.addEventListener("checkout:submit",function(t){p(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,s(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{y(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{y(t.dataset.whopCheckoutOnStateChange,r.state);break}case"address-validation-error":{y(t.dataset.whopCheckoutOnAddressValidationError,{error_message:r.error_message,error_code:r.error_code});break}}}))};var g=function e(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var n=e.getAll(r);switch(n.length){case 0:return t;case 1:{t[r]=n[0];break}default:t[r]=n}return t},{})};var P=function e(e){var t={};var r=true,n=false,o=undefined;try{for(var a=e.attributes[Symbol.iterator](),i;!(r=(i=a.next()).done);r=true){var u=i.value;if(u.name.startsWith(q)){var s=u.name.slice(q.length),l=u.value,d=O(s.split("-")),c=d[0],f=d.slice(1);if(c&&f.length>0){var h=f.reduce(function(e,t,r){if(r===0)return t;var n=O(t),o=n[0],a=n.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(a.join(""))},"");var v;(v=t[c])!==null&&v!==void 0?v:t[c]={},t[c][h]=l}}}}catch(e){n=true;o=e}finally{try{if(!r&&a.return!=null){a.return()}}finally{if(n){throw o}}}return t};var A=function e(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t};var j=function e(e){var t={};var r,n,o,a,i,u,s;return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),e.dataset.whopCheckoutPrefillName&&((r=t.address)!==null&&r!==void 0?r:t.address={},t.address.name=e.dataset.whopCheckoutPrefillName),e.dataset.whopCheckoutPrefillAddressLine1&&((n=t.address)!==null&&n!==void 0?n:t.address={},t.address.line1=e.dataset.whopCheckoutPrefillAddressLine1),e.dataset.whopCheckoutPrefillAddressLine2&&((o=t.address)!==null&&o!==void 0?o:t.address={},t.address.line2=e.dataset.whopCheckoutPrefillAddressLine2),e.dataset.whopCheckoutPrefillAddressCity&&((a=t.address)!==null&&a!==void 0?a:t.address={},t.address.city=e.dataset.whopCheckoutPrefillAddressCity),e.dataset.whopCheckoutPrefillAddressCountry&&((i=t.address)!==null&&i!==void 0?i:t.address={},t.address.country=e.dataset.whopCheckoutPrefillAddressCountry),e.dataset.whopCheckoutPrefillAddressState&&((u=t.address)!==null&&u!==void 0?u:t.address={},t.address.state=e.dataset.whopCheckoutPrefillAddressState),e.dataset.whopCheckoutPrefillAddressPostalCode&&((s=t.address)!==null&&s!==void 0?s:t.address={},t.address.postalCode=e.dataset.whopCheckoutPrefillAddressPostalCode),t};var R=function e(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var n=e.dataset.whopCheckoutPlanId;if(!n)return;var o=w(n,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:g(),P(e),j(e),A(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true",e.dataset.whopCheckoutHideAddress==="true",e.dataset.whopCheckoutAffiliateCode),a=document.createElement("iframe");a.src=o,a.style.width="100%",a.style.height="480px",a.style.border="none",a.style.overflow="hidden",(t=a.sandbox).add.apply(t,_(V)),a.allow=B,e.dataset.whopCheckoutMounted="true",e.appendChild(a);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,a),a.dataset.whopCheckoutIdentifier=i),b(a,e)};var L=Object.defineProperty;var T=function(e,t,r){return t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r};var I=function(e,t,r){return T(e,(typeof t==="undefined"?"undefined":S(t))!="symbol"?t+"":t,r)};var U=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"type","WhopCheckoutError");return e}return t}(E(Error));var W=/*#__PURE__*/function(e){c(t,e);function t(e){u(this,t);var r;r=i(this,t,[e!==null&&e!==void 0?e:"Timeout waiting for embed response"]);I(r,"name","WhopCheckoutRpcTimeoutError");return r}return t}(U);var M=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"name","WhopCheckoutSetEmailError");return e}return t}(U);var H=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"name","WhopCheckoutSetAddressError");return e}return t}(U);var D=/*#__PURE__*/function(e){c(t,e);function t(){u(this,t);var e;e=i(this,t,arguments);I(e,"name","WhopCheckoutGetAddressError");return e}return t}(U);var F=["resize","center","complete","state","get-email-result","set-email-result","set-address-result","get-address-result","address-validation-error"];var N=[];var V=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],B="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";var q="data-whop-checkout-style-";if((typeof window==="undefined"?"undefined":S(window))<"u"&&window.wco&&!window.wco.listening){var z=function e(e){var t;var r=(t=window.wco)===null||t===void 0?void 0:t.identifiedFrames.get(e);if(!r)throw new Error("No embed with identifier ".concat(e," found."));return r};Z=z,window.wco.getEmail=function(e,t){return d(z(e),t)},window.wco.setEmail=function(e,t,r){return l(z(e),t,r)},window.wco.getAddress=function(e,t){return v(z(e),t)},window.wco.setAddress=function(e,t,r){return h(z(e),t,r)};var G=new MutationObserver(function(e){var t=true,r=false,n=undefined;try{for(var o=e[Symbol.iterator](),a;!(t=(a=o.next()).done);t=true){var i=a.value;var u,s,l;var d=true,c=false,h=undefined;try{for(var v=i.addedNodes[Symbol.iterator](),p;!(d=(p=v.next()).done);d=true){var w=p.value;f(w,HTMLElement)&&w.dataset.whopCheckoutPlanId&&R(w)}}catch(e){c=true;h=e}finally{try{if(!d&&v.return!=null){v.return()}}finally{if(c){throw h}}}var y=Array.from(i.removedNodes);var m;var b=true,k=false,g=undefined;try{for(var P=((m=(u=window.wco)===null||u===void 0?void 0:u.frames)!==null&&m!==void 0?m:[])[Symbol.iterator](),O;!(b=(O=P.next()).done);b=true){var _=C(O.value,2),S=_[0],A=_[1];y.includes(S)&&(S.dataset.whopCheckoutIdentifier&&((s=window.wco)===null||s===void 0?void 0:s.identifiedFrames.delete(S.dataset.whopCheckoutIdentifier)),A(),(l=window.wco)===null||l===void 0?void 0:l.frames.delete(S))}}catch(e){k=true;g=e}finally{try{if(!b&&P.return!=null){P.return()}}finally{if(k){throw g}}}}}catch(e){r=true;n=e}finally{try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}}});var $=true,J=false,K=undefined;try{for(var Q=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),X;!($=(X=Q.next()).done);$=true){var Y=X.value;f(Y,HTMLElement)&&R(Y)}}catch(e){J=true;K=e}finally{try{if(!$&&Q.return!=null){Q.return()}}finally{if(J){throw K}}}G.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}var Z})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function a(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function n(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var a=[];var o=true;var n=false;var i,d;try{for(r=r.call(e);!(o=(i=r.next()).done);o=true){a.push(i.value);if(t&&a.length===t)break}}catch(e){n=true;d=e}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(n)throw d}}return a}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,r){return t(e)||n(e,r)||f(e,r)||i()}function s(e){return t(e)||o(e)||f(e)||i()}function u(e){return r(e)||o(e)||f(e)||d()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor)a=t.constructor.name;if(a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return e(t,r)}import{b as h,c as w,d as v,e as p,f as y,g as m,h as C,i as k,j as b}from"./chunk-D7BU562Q.mjs";function A(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),a=1;a<t;a++){r[a-1]=arguments[a]}if(!e)return;var o=window[e];o===null||o===void 0?void 0:o.apply(void 0,u(r))}function S(e,t){var r;e.addEventListener("checkout:submit",function(t){m(e,t.detail)}),(r=window.wco)===null||r===void 0?void 0:r.frames.set(e,h(e,function(r){switch(r.event){case"resize":{e.style.height="".concat(r.height,"px");break}case"center":{e.scrollIntoView({block:"center",inline:"center"});break}case"complete":{A(t.dataset.whopCheckoutOnComplete,r.plan_id,r.receipt_id);break}case"state":{A(t.dataset.whopCheckoutOnStateChange,r.state);break}case"address-validation-error":{A(t.dataset.whopCheckoutOnAddressValidationError,{error_message:r.error_message,error_code:r.error_code});break}}}))}function g(){var e=new URLSearchParams(window.location.search);return Array.from(e.keys()).reduce(function(t,r){if(!r.startsWith("utm_"))return t;var a=e.getAll(r);switch(a.length){case 0:return t;case 1:{t[r]=a[0];break}default:t[r]=a}return t},{})}var P="data-whop-checkout-style-";function E(e){var t={};var r=true,a=false,o=undefined;try{for(var n=e.attributes[Symbol.iterator](),i;!(r=(i=n.next()).done);r=true){var d=i.value;if(d.name.startsWith(P)){var l=d.name.slice(P.length),u=d.value,c=s(l.split("-")),f=c[0],h=c.slice(1);if(f&&h.length>0){var w=h.reduce(function(e,t,r){if(r===0)return t;var a=s(t),o=a[0],n=a.slice(1);return"".concat(e).concat(o.toUpperCase()).concat(n.join(""))},"");var v;(v=t[f])!==null&&v!==void 0?v:t[f]={},t[f][w]=u}}}}catch(e){a=true;o=e}finally{try{if(!r&&n.return!=null){n.return()}}finally{if(a){throw o}}}return t}function I(e){var t={};return e.dataset.whopCheckoutThemeAccentColor&&(t.accentColor=e.dataset.whopCheckoutThemeAccentColor),t}function x(e){var t={};var r,a,o,n,i,d,l;return e.dataset.whopCheckoutPrefillEmail&&(t.email=e.dataset.whopCheckoutPrefillEmail),e.dataset.whopCheckoutPrefillName&&((r=t.address)!==null&&r!==void 0?r:t.address={},t.address.name=e.dataset.whopCheckoutPrefillName),e.dataset.whopCheckoutPrefillAddressLine1&&((a=t.address)!==null&&a!==void 0?a:t.address={},t.address.line1=e.dataset.whopCheckoutPrefillAddressLine1),e.dataset.whopCheckoutPrefillAddressLine2&&((o=t.address)!==null&&o!==void 0?o:t.address={},t.address.line2=e.dataset.whopCheckoutPrefillAddressLine2),e.dataset.whopCheckoutPrefillAddressCity&&((n=t.address)!==null&&n!==void 0?n:t.address={},t.address.city=e.dataset.whopCheckoutPrefillAddressCity),e.dataset.whopCheckoutPrefillAddressCountry&&((i=t.address)!==null&&i!==void 0?i:t.address={},t.address.country=e.dataset.whopCheckoutPrefillAddressCountry),e.dataset.whopCheckoutPrefillAddressState&&((d=t.address)!==null&&d!==void 0?d:t.address={},t.address.state=e.dataset.whopCheckoutPrefillAddressState),e.dataset.whopCheckoutPrefillAddressPostalCode&&((l=t.address)!==null&&l!==void 0?l:t.address={},t.address.postalCode=e.dataset.whopCheckoutPrefillAddressPostalCode),t}function L(e){var t;var r;if(e.dataset.whopCheckoutMounted)return;var a=e.dataset.whopCheckoutPlanId;if(!a)return;var o=C(a,e.dataset.whopCheckoutTheme,e.dataset.whopCheckoutSession,e.dataset.whopCheckoutOrigin,e.dataset.whopCheckoutHidePrice==="true",e.dataset.whopCheckoutSkipRedirect==="true"||!!e.dataset.whopCheckoutOnComplete,e.dataset.whopCheckoutSkipUtm==="true"?void 0:g(),E(e),x(e),I(e),e.dataset.whopCheckoutHideSubmitButton==="true",e.dataset.whopCheckoutHideTos==="true",e.dataset.whopCheckoutHideEmail==="true",e.dataset.whopCheckoutDisableEmail==="true",e.dataset.whopCheckoutHideAddress==="true",e.dataset.whopCheckoutAffiliateCode),n=document.createElement("iframe");n.src=o,n.style.width="100%",n.style.height="480px",n.style.border="none",n.style.overflow="hidden",(t=n.sandbox).add.apply(t,u(k)),n.allow=b,e.dataset.whopCheckoutMounted="true",e.appendChild(n);var i=e.id;i&&((r=window.wco)===null||r===void 0?void 0:r.identifiedFrames.set(i,n),n.dataset.whopCheckoutIdentifier=i),S(n,e)}if((typeof window==="undefined"?"undefined":c(window))<"u"&&window.wco&&!window.wco.listening){var O=function e(e){var t;var r=(t=window.wco)===null||t===void 0?void 0:t.identifiedFrames.get(e);if(!r)throw new Error("No embed with identifier ".concat(e," found."));return r};F=O,window.wco.getEmail=function(e,t){return v(O(e),t)},window.wco.setEmail=function(e,t,r){return w(O(e),t,r)},window.wco.getAddress=function(e,t){return y(O(e),t)},window.wco.setAddress=function(e,t,r){return p(O(e),t,r)};var T=new MutationObserver(function(e){var t=true,r=false,o=undefined;try{for(var n=e[Symbol.iterator](),i;!(t=(i=n.next()).done);t=true){var d=i.value;var s,u,c;var f=true,h=false,w=undefined;try{for(var v=d.addedNodes[Symbol.iterator](),p;!(f=(p=v.next()).done);f=true){var y=p.value;a(y,HTMLElement)&&y.dataset.whopCheckoutPlanId&&L(y)}}catch(e){h=true;w=e}finally{try{if(!f&&v.return!=null){v.return()}}finally{if(h){throw w}}}var m=Array.from(d.removedNodes);var C;var k=true,b=false,A=undefined;try{for(var S=((C=(s=window.wco)===null||s===void 0?void 0:s.frames)!==null&&C!==void 0?C:[])[Symbol.iterator](),g;!(k=(g=S.next()).done);k=true){var P=l(g.value,2),E=P[0],I=P[1];m.includes(E)&&(E.dataset.whopCheckoutIdentifier&&((u=window.wco)===null||u===void 0?void 0:u.identifiedFrames.delete(E.dataset.whopCheckoutIdentifier)),I(),(c=window.wco)===null||c===void 0?void 0:c.frames.delete(E))}}catch(e){b=true;A=e}finally{try{if(!k&&S.return!=null){S.return()}}finally{if(b){throw A}}}}}catch(e){r=true;o=e}finally{try{if(!t&&n.return!=null){n.return()}}finally{if(r){throw o}}}});var j=true,H=false,_=undefined;try{for(var M=document.querySelectorAll("[data-whop-checkout-plan-id]")[Symbol.iterator](),N;!(j=(N=M.next()).done);j=true){var U=N.value;a(U,HTMLElement)&&L(U)}}catch(e){H=true;_=e}finally{try{if(!j&&M.return!=null){M.return()}}finally{if(H){throw _}}}T.observe(document.body,{childList:!0,subtree:!0}),window.wco.listening=!0}var F;
|