Files
discord-decomp/_bundle/Module4513.js
T
2026-11-01 12:12:55 +02:00

1407 lines
48 KiB
JavaScript

// Metro module 4513 (f4514).
import * as _Module19 from "react";
function $mk103863($env) {
return function() {
const r1 = $env;
r1[4].current = r1[2];
};
}
function $mk103864($env) {
return function() {
const r2 = $env;
if (r2[3]) {
const r5 = r2[0];
if (r5) {
let env29376 = {
$parent: $env
};
const r4 = $mk114568(r2);
env29376[0] = r4;
r5.on(r2[1], r4);
return function() {
const r1 = env29376.$parent;
r1[0].off(r1[1], env29376[0]);
};
}
}
return function() {};
};
}
function $mk103865($env) {
return function() {
const r1 = $env;
r1[1].current = r1[0];
};
}
function $mk103867($env) {
return function(a0, a1) {
let r31;
const r7 = $env;
const r6 = $env.$parent;
const r5 = r6[8];
const r4 = r7[1];
const r1 = r4 !== null && (0, r6[2])(r4) === "object";
const r21 = r1 ? !(0, r6[10])(r7[0][a1], r4[a1]) : !r1;
if (r7[2].includes(a1)) {
r31 = a0;
if (r21) {
console.warn("Unsupported prop change: options.".concat(a1, " is not a mutable property."));
r31 = a0;
}
} else {
r31 = a0;
if (r21) {
const r9 = r6[1];
const r32 = a0 ? a0 : {};
const r33 = {};
r9(r33, r32);
const r36 = {};
const value = r7[0][a1];
if (a1 in r36) {
Object.defineProperty(r36, a1, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
r36[a1] = value;
}
r9(r33, {}, r36);
r31 = r33;
}
}
return r31;
};
}
function $mk114568($env) {
return function decoratedCb() {
const r2 = $env[4];
if (r2.current) {
r2.current.apply(r2, arguments);
}
};
}
function $mk114572($env) {
return function(a0) {
let r0 = a0;
if (!(a0.stripe && a0.checkoutSdk)) {
const r2 = $env;
r0 = {
stripe: r2[0],
checkoutSdk: r2[1]
};
}
return r0;
};
}
function $mk117861($env) {
return function(a0) {
let r0 = a0;
if (!a0.stripe) {
const stripe2 = $env[0];
r0 = {
stripe: stripe2,
elements: stripe2.elements($env.$parent[1])
};
}
return r0;
};
}
function $mk117864($env) {
return function(a0) {
(0, $env[6])({
embeddedCheckout: a0
});
};
}
const t = function t(a0, a1) {
"use strict";
let c14281_0, emptyFunction2, emptyFunctionWithReset2;
let env14280 = {};
env14280[0] = a1;
env14280[1] = function _objectSpread2(a0) {
let c25213_1;
const r6 = 1 < arguments.length;
let r0 = 1;
if (r6) {
do {
const r20 = arguments[r0];
const r1 = r0;
const r13 = r20 != null ? arguments[r1] : {};
c25213_1 = r13;
const r21 = Object;
if (r1 % 2) {
const r40 = r21(r13);
let c25215_0 = r40;
const r44 = Object.keys(r40);
if (Object.getOwnPropertySymbols) {
r44.push.apply(r44, Object.getOwnPropertySymbols(r40).filter(function(item) {
return Object.getOwnPropertyDescriptor(c25215_0, item).enumerable;
}));
}
r44.forEach(function(item) {
const value = c25213_1[item];
if (item in a0) {
Object.defineProperty(a0, item, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else {
a0[item] = value;
}
});
} else {
const getOwnPropertyDescriptors = r21.getOwnPropertyDescriptors;
const r16 = Object;
if (getOwnPropertyDescriptors) {
r16.defineProperties(a0, Object.getOwnPropertyDescriptors(r13));
} else {
const r18 = r16(r13);
let c25214_0 = r18;
const r17 = Object.keys(r18);
if (Object.getOwnPropertySymbols) {
r17.push.apply(r17, Object.getOwnPropertySymbols(r18));
}
r17.forEach(function(item) {
Object.defineProperty(a0, item, Object.getOwnPropertyDescriptor(c25213_1, item));
});
}
}
r0 = r1 + 1;
} while (r0 < arguments.length);
}
return a0;
};
env14280[2] = function _typeof(a0) {
const r6 = typeof globalThis.Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(a0) {
return typeof a0;
} : function(a0) {
return a0 && typeof globalThis.Symbol === "function" && a0.constructor === Symbol ? a0 === Symbol.prototype ? typeof a0 : "symbol" : typeof a0;
};
env14280[2] = r6;
return r6(a0);
};
env14280[3] = function _objectWithoutProperties(a0, a1) {
let r16, length;
if (a0 == null) {
return {};
}
if (a0 == null) {
r16 = {};
} else {
const r8 = {};
const r7 = Object.keys(a0);
const r15 = 0 < r7.length;
let r0 = 0;
r16 = r8;
if (r15) {
do {
const r11 = r7[r0];
const r18 = a1.indexOf(r11);
const r1 = r0;
if (!(r18 >= 0)) {
r8[r11] = a0[r11];
}
r0 = r1 + 1;
length = r7.length;
r16 = r8;
} while (r0 < length);
}
}
if (Object.getOwnPropertySymbols) {
const ownPropertySymbols = Object.getOwnPropertySymbols(a0);
const r29 = 0 < ownPropertySymbols.length;
let r31 = 0;
if (r29) {
do {
const r32 = ownPropertySymbols[r31];
const r34 = a1.indexOf(r32);
const r35 = r31;
if (!(r34 >= 0) && Object.prototype.propertyIsEnumerable.call(a0, r32)) {
r16[r32] = a0[r32];
}
r31 = r35 + 1;
} while (r31 < ownPropertySymbols.length);
}
}
return r16;
};
env14280[4] = function _slicedToArray(a0, a1) {
let r35;
let r16 = (Array.isArray(a0) ? a0 : void 0) || (function _iterableToArrayLimit(a0, a1) {
let r17;
let r0 = void 0;
let r5 = a0;
if (a0) {
const Symbol2 = globalThis.Symbol;
r5 = (typeof Symbol2 !== "undefined" ? a0[Symbol.iterator] : typeof Symbol2 !== "undefined") || a0["@@iterator"];
}
let r13 = r5;
if (r5 != null) {
let r15 = true;
let r16 = false;
L21: {
try {
r17 = [];
try {
const r20 = r13.call(a0);
r13 = r20;
const r22 = r20.next();
const done = r22.done;
r15 = done;
if (!done) {
r17.push(r22.value);
if (a1 && r17.length === a1) {
break L21;
}
do {
const r33 = r13.next();
const done2 = r33.done;
r15 = done2;
if (done2) {
break;
}
r17.push(r33.value);
} while (!(a1 && r17.length === a1));
}
} catch ($e) {
r0 = $e;
r16 = true;
}
} catch ($e) {
const r52 = $e;
try {
if (!r15) {
r15 = r13.return == null;
}
if (!r15) {
r13.return();
}
} catch (r60) {
if (r16) {
throw r0;
}
throw r60;
}
if (r16) {
throw r0;
}
throw r52;
}
}
try {
if (!(r15 || r13.return == null)) {
r13.return();
}
} catch (r49) {
if (r16) {
throw r0;
}
throw r49;
}
if (r16) {
throw r0;
}
return r17;
}
})(a0, 2);
if (!r16) {
let r18 = void 0;
if (a0) {
if (typeof a0 === "string") {
const r49 = 2 > a0.length ? a0.length : 2;
const array2 = new Array(r49);
let r57 = 0;
const r58 = 0 < r49;
r18 = array2;
if (r58) {
do {
array2[r57] = a0[r57];
r57 = r57 + 1;
r18 = array2;
} while (r57 < r49);
}
} else {
const r25 = Object.prototype.toString.call(a0).slice(8, -1);
const r11 = r25 === "Object" && a0.constructor ? a0.constructor.name : r25;
L24: {
if (r11 !== "Map" && r11 !== "Set") {
if (r11 !== "Arguments") {
const r34 = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r11);
r35 = void 0;
if (!r34) {
break L24;
}
}
const r37 = 2 > a0.length ? a0.length : 2;
const array = new Array(r37);
let r42 = 0;
const r43 = 0 < r37;
r35 = array;
if (!r43) {
break L24;
}
do {
array[r42] = a0[r42];
r42 = r42 + 1;
r35 = array;
} while (r42 < r37);
} else {
r35 = Array.from(a0);
}
}
r18 = r35;
}
}
r16 = r18;
}
if (r16) {
return r16;
}
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
};
emptyFunction2 = function emptyFunction() {};
emptyFunctionWithReset2 = function emptyFunctionWithReset() {};
c14281_0 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
emptyFunctionWithReset2.resetWarningCache = emptyFunction2;
const r35 = (function() {
const shim2 = function shim(a0, a1, a2, a3, a4, a5) {
if (a5 !== c14281_0) {
const error = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
error.name = "Invariant Violation";
throw error;
}
};
const getShim = function getShim() {
return shim2;
};
shim2.isRequired = shim2;
const PropTypes = {
array: shim2,
bool: shim2,
func: shim2,
number: shim2,
object: shim2,
string: shim2,
symbol: shim2,
any: shim2,
arrayOf: getShim,
element: shim2,
elementType: shim2,
instanceOf: getShim,
node: shim2,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset2,
resetWarningCache: emptyFunction2
};
PropTypes.PropTypes = PropTypes;
return PropTypes;
})();
const r36 = r35 ? r35.__esModule ? Object.prototype.hasOwnProperty.call(r35, "default") ? r35.default : r35 : r35 : r35;
env14280[5] = r36;
env14280[6] = function useAttachEvent(a0, a1, a2) {};
env14280[7] = function usePrevious(a0) {};
env14280[8] = function isUnknownObject(a0) {};
env14280[9] = "[object Object]";
const isEqual = function isEqual(a0, a1) {
const r7 = env14280[8];
if (a0 !== null && (0, env14280[2])(a0) === "object") {
if (a1 !== null && (0, env14280[2])(a1) === "object") {
const isArray = Array.isArray(a0);
if (isArray !== Array.isArray(a1)) {
return false;
}
const r36 = Object.prototype.toString.call(a0);
const r37 = env14280[9];
const r41 = Object.prototype.toString.call(a1);
const r42 = r36 === r37;
if (r42 !== (r41 === r37)) {
return false;
}
if (!r42 && !isArray) {
return a0 === a1;
}
const r47 = Object.keys(a0);
const r50 = Object.keys(a1);
if (r47.length !== r50.length) {
return false;
}
const r53 = {};
const r55 = 0 < r47.length;
let r1 = 0;
if (r55) {
do {
r53[r47[r1]] = true;
r1 = r1 + 1;
} while (r1 < r47.length);
}
const r60 = 0 < r50.length;
let r61 = 0;
if (r60) {
do {
r53[r50[r61]] = true;
r61 = r61 + 1;
} while (r61 < r50.length);
}
const r66 = Object.keys(r53);
if (r66.length !== r47.length) {
return false;
}
let c25216_0 = a0;
let c25216_1 = a1;
return r66.every(function pred(item) {
return (0, env14280[27])(c25216_0[item], c25216_1[item]);
});
}
}
return a0 === a1;
};
env14280[27] = isEqual;
env14280[10] = isEqual;
env14280[11] = function extractAllowedOptionsUpdates(a0, a1, a2) {};
env14280[12] = "Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.";
env14280[13] = function validateStripe(a0) {
const r6 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : env14280[12];
if (a0 !== null) {
if (!(a0 !== null && (0, env14280[2])(a0) === "object" && typeof a0.elements === "function" && typeof a0.createToken === "function" && typeof a0.createPaymentMethod === "function" && typeof a0.confirmCardPayment === "function")) {
throw new Error(r6);
}
}
return a0;
};
env14280[14] = function parseStripeProp(a0) {
const r15 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : env14280[12];
let c25217_0 = r15;
if (a0 !== null && (0, env14280[2])(a0) === "object" && typeof a0.then === "function") {
return {
tag: "async",
stripePromise: Promise.resolve(a0).then(function(result) {
(0, env14280[13])(result, c25217_0);
return result;
})
};
}
(0, env14280[13])(a0, r15);
return a0 === null ? {
tag: "empty"
} : {
tag: "sync",
stripe: a0
};
};
env14280[15] = function registerWithStripeJs(a0) {};
const context = a1.createContext(null);
env14280[16] = context;
context.displayName = "ElementsContext";
env14280[17] = function parseElementsContext(a0, a1) {};
const Elements = function Elements(a0) {
let env25218 = {
$parent: env14280
};
const stripe2 = a0.stripe;
env25218[0] = stripe2;
const options2 = a0.options;
env25218[1] = options2;
const children = a0.children;
const r5 = env14280[0];
const memo2 = r5.useMemo(function() {
return (0, env14280[14])(env25218[0]);
}, [stripe2]);
env25218[2] = memo2;
const r22 = (0, env14280[4])(r5.useState(function() {
const r3 = env25218[2];
return {
stripe: r3.tag === "sync" ? r3.stripe : null,
elements: r3.tag === "sync" ? r3.stripe.elements(env25218[1]) : null
};
}), 2);
const value = r22[0];
env25218[3] = value;
env25218[4] = r22[1];
r5.useEffect(function() {
let c29377_0 = true;
const r2 = env25218[2];
if (r2.tag === "async" && !env25218[3].stripe) {
r2.stripePromise.then(function(result) {
if (result ? c29377_0 : result) {
let env31346;
const r5 = env31346 = {
$parent: env25218
};
env31346[0] = result;
(0, env25218[4])($mk117861(r5));
}
});
} else if (!(r2.tag !== "sync" || env25218[3].stripe)) {
let env29378;
const stripe2 = r2.stripe;
const r17 = env29378 = {
$parent: env25218
};
env29378[0] = stripe2;
(0, env25218[4])($mk117861(r17));
}
return function() {
c29377_0 = false;
};
}, [memo2, value, options2]);
const r29 = env14280[7];
let env25219;
const r31 = env25219 = {};
env25219[0] = stripe2;
const ref6 = r5.useRef(stripe2);
env25219[1] = ref6;
r5.useEffect($mk103865(r31), [stripe2]);
const current5 = ref6.current;
env25218[5] = current5;
r5.useEffect(function() {
const r3 = env25218[5];
if (r3 !== null && r3 !== env25218[0]) {
console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.");
}
}, [current5, stripe2]);
let env25220;
const r43 = env25220 = {};
env25220[0] = options2;
const ref7 = r5.useRef(options2);
env25220[1] = ref7;
r5.useEffect($mk103865(r43), [options2]);
const current6 = ref7.current;
env25218[6] = current6;
r5.useEffect(function() {
const r3 = env25218[3];
if (r3.elements) {
const r5 = env14280;
const r11 = env14280[11];
const r8 = env25218[1];
const r7 = env25218[6];
let env29379;
const r13 = ["clientSecret", "fonts"];
const r14 = env29379 = {
$parent: r5
};
env29379[0] = r8;
env29379[1] = r7;
env29379[2] = r13;
const r21 = r8 !== null && (0, env14280[2])(r8) === "object" ? Object.keys(r8).reduce($mk103867(r14), null) : null;
if (r21) {
r3.elements.update(r21);
}
}
}, [options2, current6, value.elements]);
r5.useEffect(function() {
const r5 = env14280[15];
const stripe2 = env25218[3].stripe;
if (stripe2 && stripe2._registerWrapper && stripe2.registerAppInfo) {
stripe2._registerWrapper({
name: "react-stripe-js",
version: "3.7.0"
});
stripe2.registerAppInfo({
name: "react-stripe-js",
version: "3.7.0",
url: "https://stripe.com/docs/stripe-js/react"
});
}
}, [value.stripe]);
return r5.createElement(env14280[16].Provider, {
value
}, children);
};
Elements.propTypes = {
stripe: r36.any,
options: r36.object
};
env14280[18] = function useElementsContextWithUseCase(a0) {};
const ElementsConsumer = function ElementsConsumer({ children }) {
const context = env14280[0].useContext(env14280[16]);
if (context) {
return children(context);
}
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat("mounts <ElementsConsumer>", " in an <Elements> provider."));
};
ElementsConsumer.propTypes = {
children: r36.func.isRequired
};
env14280[19] = ["on", "session"];
const context2 = a1.createContext(null);
env14280[20] = context2;
context2.displayName = "CheckoutSdkContext";
env14280[21] = function parseCheckoutSdkContext(a0, a1) {};
const context3 = a1.createContext(null);
env14280[22] = context3;
context3.displayName = "CheckoutContext";
const CheckoutProvider = function CheckoutProvider({ stripe, options, children }) {
let state, setState, state2, setState2, safeSetContext2, ref, current, current2, current3;
const r9 = env14280[0];
const memo = r9.useMemo(function() {
return (0, env14280[14])(stripe, "Invalid prop `stripe` supplied to `CheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.");
}, [stripe]);
const r11 = env14280[4];
const r23 = r11(r9.useState(null), 2);
state = r23[0];
setState = r23[1];
const r28 = r11(r9.useState(function() {
return {
stripe: memo.tag === "sync" ? memo.stripe : null,
checkoutSdk: null
};
}), 2);
state2 = r28[0];
setState2 = r28[1];
safeSetContext2 = function safeSetContext(a0, a1) {};
ref = r9.useRef(false);
r9.useEffect(function() {
let c29380_0 = true;
if (memo.tag === "async" && !state2.stripe) {
memo.stripePromise.then(function(result) {
let c31348_0 = result;
if ((result ? c29380_0 : result) && !ref.current) {
ref.current = true;
result.initCheckout(options).then(function(result) {
if (result) {
let env31928;
const r9 = env31928 = {};
env31928[0] = c31348_0;
env31928[1] = result;
setState2($mk114572(r9));
result.on("change", setState);
}
});
}
});
} else if (memo.tag === "sync" && memo.stripe && !ref.current) {
ref.current = true;
memo.stripe.initCheckout(options).then(function(result) {
if (result) {
const stripe2 = memo.stripe;
let env31347;
const r9 = env31347 = {};
env31347[0] = stripe2;
env31347[1] = result;
setState2($mk114572(r9));
result.on("change", setState);
}
});
}
return function() {
c29380_0 = false;
};
}, [memo, state2, options, setState]);
const r38 = env14280[7];
let env25222;
const r40 = env25222 = {};
env25222[0] = stripe;
const ref6 = r9.useRef(stripe);
env25222[1] = ref6;
r9.useEffect($mk103865(r40), [stripe]);
current = ref6.current;
r9.useEffect(function() {
if (current !== null && current !== stripe) {
console.warn("Unsupported prop change on CheckoutProvider: You cannot change the `stripe` prop after setting it.");
}
}, [current, stripe]);
let env25223;
const r53 = env25223 = {};
env25223[0] = options;
const ref7 = r9.useRef(options);
env25223[1] = ref7;
r9.useEffect($mk103865(r53), [options]);
current2 = ref7.current;
const checkoutSdk2 = state2.checkoutSdk;
let env25224;
const r64 = env25224 = {};
env25224[0] = checkoutSdk2;
const ref8 = r9.useRef(checkoutSdk2);
env25224[1] = ref8;
r9.useEffect($mk103865(r64), [checkoutSdk2]);
current3 = ref8.current;
r9.useEffect(function() {
if (state2.checkoutSdk) {
const r3 = current2 == null;
let r8 = void 0;
if (!r3) {
const elementsOptions = current2.elementsOptions;
r8 = elementsOptions !== null ? elementsOptions !== void 0 ? elementsOptions.appearance : void 0 : void 0;
}
const r12 = options == null;
let r13 = void 0;
if (!r12) {
const elementsOptions2 = options.elementsOptions;
r13 = elementsOptions2 !== null ? elementsOptions2 !== void 0 ? elementsOptions2.appearance : void 0 : void 0;
}
const r9 = (0, env14280[10])(r13, r8);
let r17 = !r9;
const r19 = current3 ? !current3 : state2.checkoutSdk;
let r20 = r13;
if (r20) {
if (r9) {
r17 = r19;
}
r20 = r17;
}
if (r20) {
state2.checkoutSdk.changeAppearance(r13);
}
}
}, [options, current2, state2.checkoutSdk, current3]);
r9.useEffect(function() {
const r5 = env14280[15];
const stripe2 = state2.stripe;
if (stripe2 && stripe2._registerWrapper && stripe2.registerAppInfo) {
stripe2._registerWrapper({
name: "react-stripe-js",
version: "3.7.0"
});
stripe2.registerAppInfo({
name: "react-stripe-js",
version: "3.7.0",
url: "https://stripe.com/docs/stripe-js/react"
});
}
}, [state2.stripe]);
const memo2 = r9.useMemo(function() {
const checkoutSdk2 = state2.checkoutSdk;
let r8 = null;
if (checkoutSdk2) {
checkoutSdk2.on;
checkoutSdk2.session;
const r5 = (0, env14280[3])(checkoutSdk2, env14280[19]);
const r4 = Object;
r8 = state ? r4.assign(state, r5) : r4.assign(checkoutSdk2.session(), r5);
}
return r8;
}, [state2.checkoutSdk, state]);
return state2.checkoutSdk ? r9.createElement(env14280[20].Provider, {
value: state2
}, r9.createElement(env14280[22].Provider, {
value: memo2
}, children)) : null;
};
CheckoutProvider.propTypes = {
stripe: r36.any,
options: r36.shape({
fetchClientSecret: r36.func.isRequired,
elementsOptions: r36.object
}).isRequired
};
env14280[23] = function useElementsOrCheckoutSdkContextWithUseCase(a0) {};
env14280[24] = ["mode"];
const window2 = globalThis.window;
const context4 = a1.createContext(null);
env14280[25] = context4;
context4.displayName = "EmbeddedCheckoutProviderContext";
env14280[26] = function useEmbeddedCheckoutContext() {};
const EmbeddedCheckout = typeof window2 === "undefined" ? function EmbeddedCheckoutServerElement({ id, className }) {
const r3 = env14280[0];
if (r3.useContext(env14280[25])) {
return r3.createElement("div", {
id,
className
});
}
throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");
} : function EmbeddedCheckoutClientElement({ id, className }) {
const r4 = env14280[0];
const context = r4.useContext(env14280[25]);
if (context) {
const embeddedCheckout = context.embeddedCheckout;
const ref2 = r4.useRef(false);
const ref3 = r4.useRef(null);
r4.useLayoutEffect(function() {
const current5 = ref2.current;
if ((current5 ? !current5 : embeddedCheckout) && ref3.current !== null) {
embeddedCheckout.mount(ref3.current);
ref2.current = true;
}
return function() {
if (ref2.current && embeddedCheckout) {
try {
embeddedCheckout.unmount();
ref2.current = false;
} catch ($e) {}
}
};
}, [embeddedCheckout]);
return r4.createElement("div", {
ref: ref3,
id,
className
});
}
throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");
};
const createElementComponent = function createElementComponent(a0, a1) {
let c25225_0 = a0;
const displayName = "".concat(a0.charAt(0).toUpperCase() + a0.slice(1), "Element");
let c25225_1 = displayName;
const r16 = a1 ? function ServerElement(a0) {
const r0 = env14280[23];
const r12 = "mounts <".concat(c25225_1, ">");
const r14 = env14280[0];
const context = r14.useContext(env14280[20]);
const context2 = r14.useContext(env14280[16]);
if (context && context2) {
throw new Error("You cannot wrap the part of your app that ".concat(r12, " in both <CheckoutProvider> and <Elements> providers."));
}
if (context) {
if (!context) {
throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat(r12, " in an <CheckoutProvider> provider."));
}
} else if (!context2) {
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(r12, " in an <Elements> provider."));
}
return r14.createElement("div", {
id: a0.id,
className: a0.className
});
} : function ClientElement(a0) {
const { id, className, options: options2 = {} } = a0;
let current4;
let c29381_0 = options2;
const { onBlur, onFocus } = a0;
let onReady2 = a0.onReady;
const onReady = onReady2;
const { onChange, onEscape, onClick, onLoadError, onLoaderStart, onNetworksChange, onConfirm, onCancel, onShippingAddressChange, onShippingRateChange } = a0;
const r39 = env14280[23];
const r40 = "mounts <".concat(c25225_1, ">");
const r42 = env14280[0];
const context = r42.useContext(env14280[20]);
let r48 = r42.useContext(env14280[16]);
if (context && r48) {
throw new Error("You cannot wrap the part of your app that ".concat(r40, " in both <CheckoutProvider> and <Elements> providers."));
}
if (context) {
r48 = context;
if (!r48) {
throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat(r40, " in an <CheckoutProvider> provider."));
}
} else if (!r48) {
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(r40, " in an <Elements> provider."));
}
const elements = "elements" in r48 ? r48.elements : null;
const checkoutSdk = "checkoutSdk" in r48 ? r48.checkoutSdk : null;
const r79 = (0, env14280[4])(r42.useState(null), 2);
const state3 = r79[0];
const setState3 = r79[1];
const ref4 = r42.useRef(null);
const ref5 = r42.useRef(null);
const r86 = env14280[6];
let env29382;
const r89 = env29382 = {};
env29382[0] = state3;
env29382[1] = "blur";
env29382[2] = onBlur;
const r91 = !!onBlur;
env29382[3] = r91;
const ref6 = r42.useRef(onBlur);
env29382[4] = ref6;
r42.useEffect($mk103863(r89), [onBlur]);
r42.useEffect($mk103864(r89), [r91, "blur", state3, ref6]);
let env29383;
const r101 = env29383 = {};
env29383[0] = state3;
env29383[1] = "focus";
env29383[2] = onFocus;
const r104 = !!onFocus;
env29383[3] = r104;
const ref7 = r42.useRef(onFocus);
env29383[4] = ref7;
r42.useEffect($mk103863(r101), [onFocus]);
r42.useEffect($mk103864(r101), [r104, "focus", state3, ref7]);
let env29384;
const r117 = env29384 = {};
env29384[0] = state3;
env29384[1] = "escape";
env29384[2] = onEscape;
const r120 = !!onEscape;
env29384[3] = r120;
const ref8 = r42.useRef(onEscape);
env29384[4] = ref8;
r42.useEffect($mk103863(r117), [onEscape]);
r42.useEffect($mk103864(r117), [r120, "escape", state3, ref8]);
let env29385;
const r133 = env29385 = {};
env29385[0] = state3;
env29385[1] = "click";
env29385[2] = onClick;
const r136 = !!onClick;
env29385[3] = r136;
const ref9 = r42.useRef(onClick);
env29385[4] = ref9;
r42.useEffect($mk103863(r133), [onClick]);
r42.useEffect($mk103864(r133), [r136, "click", state3, ref9]);
let env29386;
const r149 = env29386 = {};
env29386[0] = state3;
env29386[1] = "loaderror";
env29386[2] = onLoadError;
const r152 = !!onLoadError;
env29386[3] = r152;
const ref10 = r42.useRef(onLoadError);
env29386[4] = ref10;
r42.useEffect($mk103863(r149), [onLoadError]);
r42.useEffect($mk103864(r149), [r152, "loaderror", state3, ref10]);
let env29387;
const r165 = env29387 = {};
env29387[0] = state3;
env29387[1] = "loaderstart";
env29387[2] = onLoaderStart;
const r168 = !!onLoaderStart;
env29387[3] = r168;
const ref11 = r42.useRef(onLoaderStart);
env29387[4] = ref11;
r42.useEffect($mk103863(r165), [onLoaderStart]);
r42.useEffect($mk103864(r165), [r168, "loaderstart", state3, ref11]);
let env29388;
const r181 = env29388 = {};
env29388[0] = state3;
env29388[1] = "networkschange";
env29388[2] = onNetworksChange;
const r184 = !!onNetworksChange;
env29388[3] = r184;
const ref12 = r42.useRef(onNetworksChange);
env29388[4] = ref12;
r42.useEffect($mk103863(r181), [onNetworksChange]);
r42.useEffect($mk103864(r181), [r184, "networkschange", state3, ref12]);
let env29389;
const r197 = env29389 = {};
env29389[0] = state3;
env29389[1] = "confirm";
env29389[2] = onConfirm;
const r200 = !!onConfirm;
env29389[3] = r200;
const ref13 = r42.useRef(onConfirm);
env29389[4] = ref13;
r42.useEffect($mk103863(r197), [onConfirm]);
r42.useEffect($mk103864(r197), [r200, "confirm", state3, ref13]);
let env29390;
const r213 = env29390 = {};
env29390[0] = state3;
env29390[1] = "cancel";
env29390[2] = onCancel;
const r216 = !!onCancel;
env29390[3] = r216;
const ref14 = r42.useRef(onCancel);
env29390[4] = ref14;
r42.useEffect($mk103863(r213), [onCancel]);
r42.useEffect($mk103864(r213), [r216, "cancel", state3, ref14]);
let env29391;
const r229 = env29391 = {};
env29391[0] = state3;
env29391[1] = "shippingaddresschange";
env29391[2] = onShippingAddressChange;
const r232 = !!onShippingAddressChange;
env29391[3] = r232;
const ref15 = r42.useRef(onShippingAddressChange);
env29391[4] = ref15;
r42.useEffect($mk103863(r229), [onShippingAddressChange]);
r42.useEffect($mk103864(r229), [r232, "shippingaddresschange", state3, ref15]);
let env29392;
const r245 = env29392 = {};
env29392[0] = state3;
env29392[1] = "shippingratechange";
env29392[2] = onShippingRateChange;
const r248 = !!onShippingRateChange;
env29392[3] = r248;
const ref16 = r42.useRef(onShippingRateChange);
env29392[4] = ref16;
r42.useEffect($mk103863(r245), [onShippingRateChange]);
r42.useEffect($mk103864(r245), [r248, "shippingratechange", state3, ref16]);
let env29393;
const r261 = env29393 = {};
env29393[0] = state3;
env29393[1] = "change";
env29393[2] = onChange;
const r264 = !!onChange;
env29393[3] = r264;
const ref17 = r42.useRef(onChange);
env29393[4] = ref17;
r42.useEffect($mk103863(r261), [onChange]);
r42.useEffect($mk103864(r261), [r264, "change", state3, ref17]);
let r275 = void 0;
if (onReady) {
if (c25225_0 !== "expressCheckout") {
onReady2 = function readyCallback() {
onReady(state3);
};
}
r275 = onReady2;
}
let env29394;
const r280 = env29394 = {};
env29394[0] = state3;
env29394[1] = "ready";
env29394[2] = r275;
const r283 = !!r275;
env29394[3] = r283;
const ref18 = r42.useRef(r275);
env29394[4] = ref18;
r42.useEffect($mk103863(r280), [r275]);
r42.useEffect($mk103864(r280), [r283, "ready", state3, ref18]);
r42.useLayoutEffect(function() {
let current5;
L24: {
if (ref4.current === null && ref5.current !== null) {
if (!elements && !checkoutSdk) {
break L24;
}
if (checkoutSdk) {
if (c25225_0 === "payment") {
current5 = checkoutSdk.createPaymentElement(c29381_0);
} else if (c25225_0 === "address") {
if (!("mode" in c29381_0)) {
throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");
}
const mode = c29381_0.mode;
const r50 = (0, env14280[3])(c29381_0, env14280[24]);
if (mode === "shipping") {
current5 = checkoutSdk.createShippingAddressElement(r50);
} else {
if (mode !== "billing") {
throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.");
}
current5 = checkoutSdk.createBillingAddressElement(r50);
}
} else if (c25225_0 === "expressCheckout") {
current5 = checkoutSdk.createExpressCheckoutElement(c29381_0);
} else {
if (c25225_0 !== "currencySelector") {
throw new Error("Invalid Element type ".concat(c25225_1, ". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."));
}
current5 = checkoutSdk.createCurrencySelectorElement();
}
} else {
current5 = elements ? elements.create(c25225_0, c29381_0) : null;
}
ref4.current = current5;
setState3(current5);
const r67 = current5;
if (r67) {
r67.mount(ref5.current);
}
}
}
}, [elements, checkoutSdk, options2]);
let env29395;
const r301 = env29395 = {};
env29395[0] = options2;
const ref19 = r42.useRef(options2);
env29395[1] = ref19;
r42.useEffect($mk103865(r301), [options2]);
current4 = ref19.current;
r42.useEffect(function() {
if (ref4.current) {
const r5 = env14280;
const r11 = env14280[11];
let env31349;
const r13 = ["paymentRequest"];
const r14 = env31349 = {
$parent: r5
};
env31349[0] = c29381_0;
env31349[1] = current4;
env31349[2] = r13;
const r21 = c29381_0 !== null && (0, env14280[2])(c29381_0) === "object" ? Object.keys(c29381_0).reduce($mk103867(r14), null) : null;
if (r21 && "update" in ref4.current) {
ref4.current.update(r21);
}
}
}, [options2, current4]);
r42.useLayoutEffect(function() {
return function() {
if (ref4.current && typeof ref4.current.destroy === "function") {
try {
ref4.current.destroy();
ref4.current = null;
} catch ($e) {}
}
};
}, []);
return r42.createElement("div", {
id,
className,
ref: ref5
});
};
const r18 = env14280[5];
r16.propTypes = {
id: r18.string,
className: r18.string,
onChange: r18.func,
onBlur: r18.func,
onFocus: r18.func,
onReady: r18.func,
onEscape: r18.func,
onClick: r18.func,
onLoadError: r18.func,
onLoaderStart: r18.func,
onNetworksChange: r18.func,
onConfirm: r18.func,
onCancel: r18.func,
onShippingAddressChange: r18.func,
onShippingRateChange: r18.func,
options: r18.object
};
r16.displayName = displayName;
r16.__elementType = a0;
return r16;
};
const r92 = typeof window2 === "undefined";
const AuBankAccountElement = createElementComponent("auBankAccount", r92);
const CardElement = createElementComponent("card", r92);
const CardNumberElement = createElementComponent("cardNumber", r92);
const CardExpiryElement = createElementComponent("cardExpiry", r92);
const CardCvcElement = createElementComponent("cardCvc", r92);
const FpxBankElement = createElementComponent("fpxBank", r92);
const IbanElement = createElementComponent("iban", r92);
const IdealBankElement = createElementComponent("idealBank", r92);
const P24BankElement = createElementComponent("p24Bank", r92);
const EpsBankElement = createElementComponent("epsBank", r92);
const PaymentElement = createElementComponent("payment", r92);
const ExpressCheckoutElement = createElementComponent("expressCheckout", r92);
const CurrencySelectorElement = createElementComponent("currencySelector", r92);
const PaymentRequestButtonElement = createElementComponent("paymentRequestButton", r92);
const LinkAuthenticationElement = createElementComponent("linkAuthentication", r92);
const AddressElement = createElementComponent("address", r92);
const ShippingAddressElement = createElementComponent("shippingAddress", r92);
const PaymentMethodMessagingElement = createElementComponent("paymentMethodMessaging", r92);
const AffirmMessageElement = createElementComponent("affirmMessage", r92);
const AfterpayClearpayMessageElement = createElementComponent("afterpayClearpayMessage", r92);
a0.AddressElement = AddressElement;
a0.AffirmMessageElement = AffirmMessageElement;
a0.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;
a0.AuBankAccountElement = AuBankAccountElement;
a0.CardCvcElement = CardCvcElement;
a0.CardElement = CardElement;
a0.CardExpiryElement = CardExpiryElement;
a0.CardNumberElement = CardNumberElement;
a0.CheckoutProvider = CheckoutProvider;
a0.CurrencySelectorElement = CurrencySelectorElement;
a0.Elements = Elements;
a0.ElementsConsumer = ElementsConsumer;
a0.EmbeddedCheckout = EmbeddedCheckout;
a0.EmbeddedCheckoutProvider = function EmbeddedCheckoutProvider(a0) {
let env25227 = {
$parent: env14280
};
const stripe2 = a0.stripe;
env25227[0] = stripe2;
const options2 = a0.options;
env25227[1] = options2;
const children = a0.children;
const r6 = env14280[0];
const memo2 = r6.useMemo(function() {
return (0, env14280[14])(env25227[0], "Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.");
}, [stripe2]);
env25227[2] = memo2;
env25227[3] = r6.useRef(null);
const ref6 = r6.useRef(null);
env25227[4] = ref6;
const r26 = (0, env14280[4])(r6.useState({
embeddedCheckout: null
}), 2);
const value = r26[0];
env25227[5] = value;
env25227[6] = r26[1];
r6.useEffect(function() {
let r11;
L18: {
const r2 = env25227;
const r4 = env25227[4];
if (!r4.current) {
const r9 = env25227[3];
if (!r9.current) {
let setStripeAndInitEmbeddedCheckout2;
L7: {
setStripeAndInitEmbeddedCheckout2 = function setStripeAndInitEmbeddedCheckout(a0) {};
r11 = env25227[2];
if (r11.tag === "async" && !r4.current) {
const r13 = env25227[1];
if (!r13.clientSecret && !r13.fetchClientSecret) {
break L7;
}
r11.stripePromise.then(function(result) {
if (result) {
const r9 = env25227;
const r3 = env25227[4];
if (!(r3.current || env25227[3].current)) {
r3.current = result;
env25227[3].current = r3.current.initEmbeddedCheckout(env25227[1]).then($mk117864(r9));
}
}
});
break L18;
}
}
let r22 = r11.tag !== "sync" || r4.current;
if (!r22) {
const r23 = env25227[1];
const clientSecret = r23.clientSecret;
r22 = clientSecret ? !clientSecret : !r23.fetchClientSecret;
}
if (!r22) {
const stripe2 = r11.stripe;
if (!(r4.current || r9.current)) {
r4.current = stripe2;
r9.current = r4.current.initEmbeddedCheckout(env25227[1]).then($mk117864(r2));
}
}
}
}
}
}, [memo2, options2, value, ref6]);
r6.useEffect(function() {
return function() {
const r1 = env25227[5];
const embeddedCheckout2 = r1.embeddedCheckout;
const r2 = env25227[3];
if (embeddedCheckout2) {
r2.current = null;
r1.embeddedCheckout.destroy();
} else if (r2.current) {
r2.current.then(function() {
env25227[3].current = null;
const r3 = env25227[5];
if (r3.embeddedCheckout) {
r3.embeddedCheckout.destroy();
}
});
}
};
}, [value.embeddedCheckout]);
r6.useEffect(function() {
const r5 = env14280[15];
const r3 = env25227[4];
if (r3 && r3._registerWrapper && r3.registerAppInfo) {
r3._registerWrapper({
name: "react-stripe-js",
version: "3.7.0"
});
r3.registerAppInfo({
name: "react-stripe-js",
version: "3.7.0",
url: "https://stripe.com/docs/stripe-js/react"
});
}
}, [ref6]);
const r42 = env14280[7];
let env25228;
const r44 = env25228 = {};
env25228[0] = stripe2;
const ref7 = r6.useRef(stripe2);
env25228[1] = ref7;
r6.useEffect($mk103865(r44), [stripe2]);
const current5 = ref7.current;
env25227[7] = current5;
r6.useEffect(function() {
const r3 = env25227[7];
if (r3 !== null && r3 !== env25227[0]) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.");
}
}, [current5, stripe2]);
let env25229;
const r57 = env25229 = {};
env25229[0] = options2;
const ref8 = r6.useRef(options2);
env25229[1] = ref8;
r6.useEffect($mk103865(r57), [options2]);
const current6 = ref8.current;
env25227[8] = current6;
r6.useEffect(function() {
const r3 = env25227[8];
if (r3 != null) {
const r8 = env25227[1];
if (r8 != null) {
if (r8.clientSecret === void 0 && r8.fetchClientSecret === void 0) {
console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`.");
}
if (r3.clientSecret != null && r8.clientSecret !== r3.clientSecret) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead.");
}
if (r3.fetchClientSecret != null && r8.fetchClientSecret !== r3.fetchClientSecret) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead.");
}
if (r3.onComplete != null && r8.onComplete !== r3.onComplete) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it.");
}
if (r3.onShippingDetailsChange != null && r8.onShippingDetailsChange !== r3.onShippingDetailsChange) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it.");
}
if (r3.onLineItemsChange != null && r8.onLineItemsChange !== r3.onLineItemsChange) {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.");
}
} else {
console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");
}
}
}, [current6, options2]);
return r6.createElement(env14280[25].Provider, {
value
}, children);
};
a0.EpsBankElement = EpsBankElement;
a0.ExpressCheckoutElement = ExpressCheckoutElement;
a0.FpxBankElement = FpxBankElement;
a0.IbanElement = IbanElement;
a0.IdealBankElement = IdealBankElement;
a0.LinkAuthenticationElement = LinkAuthenticationElement;
a0.P24BankElement = P24BankElement;
a0.PaymentElement = PaymentElement;
a0.PaymentMethodMessagingElement = PaymentMethodMessagingElement;
a0.PaymentRequestButtonElement = PaymentRequestButtonElement;
a0.ShippingAddressElement = ShippingAddressElement;
a0.useCheckout = function useCheckout() {
const r2 = env14280[0];
if (r2.useContext(env14280[20])) {
const context = r2.useContext(env14280[22]);
if (context) {
return context;
}
throw new Error("Could not find Checkout Context; You need to wrap the part of your app that calls useCheckout() in an <CheckoutProvider> provider.");
}
throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat("calls useCheckout()", " in an <CheckoutProvider> provider."));
};
a0.useElements = function useElements() {
const context = env14280[0].useContext(env14280[16]);
if (context) {
return context.elements;
}
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat("calls useElements()", " in an <Elements> provider."));
};
a0.useStripe = function useStripe() {
const r4 = env14280[0];
const context = r4.useContext(env14280[20]);
let r15 = r4.useContext(env14280[16]);
if (context && r15) {
throw new Error("You cannot wrap the part of your app that ".concat("calls useStripe()", " in both <CheckoutProvider> and <Elements> providers."));
}
if (context) {
r15 = context;
if (!r15) {
throw new Error("Could not find CheckoutProvider context; You need to wrap the part of your app that ".concat("calls useStripe()", " in an <CheckoutProvider> provider."));
}
} else if (!r15) {
throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat("calls useStripe()", " in an <Elements> provider."));
}
return r15.stripe;
};
};
if (typeof exports === "object" && module !== void 0) {
t(exports, _Module19);
} else if (typeof globalThis.define === "function" && define.amd) {
define(["exports", "react"], t);
} else {
const r10 = typeof globalThis.globalThis !== "undefined" ? globalThis.globalThis : this;
const ReactStripe = {};
r10.ReactStripe = ReactStripe;
t(ReactStripe, r10.React);
}