1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7777],{66337:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},73810:function(e,t,r){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t,r,n,o,i,a){try{var s=e[i](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(e){o(a,n,i,s,l,"next",e)}function l(e){o(a,n,i,s,l,"throw",e)}s(void 0)})}}function a(e,t,r){var n;return t=u(t),(n=g()?Reflect.construct(t,r||[],u(e).constructor):t.apply(e,r))&&("object"===y(n)||"function"==typeof n)?n:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function l(e,t,r){return(l=g()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&v(o,r.prototype),o}).apply(null,arguments)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function p(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,s=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(s)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function b(e){var t="function"==typeof Map?new Map:void 0;return(b=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return l(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function w(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}r.d(t,{IT:function(){return eT},Cj:function(){return eD}});var k=Object.defineProperty,O=function(e,t,r){var n;return(n=(void 0===t?"undefined":y(t))!="symbol"?t+"":t)in e?k(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r},C=function(e){function t(){var e;return s(this,t),e=a(this,t,arguments),O(e,"type","WhopCheckoutError"),e}return d(t,e),t}(b(Error)),_=function(e){function t(e){var r;return s(this,t),O(r=a(this,t,[null!=e?e:"Timeout waiting for embed response"]),"name","WhopCheckoutRpcTimeoutError"),r}return d(t,e),t}(C),P=function(e){function t(e){var r;return s(this,t),O(r=a(this,t,[null!=e?e:"Aborted waiting for embed response"]),"name","WhopCheckoutRpcAbortedError"),r}return d(t,e),t}(C),A=function(e){function t(){var e;return s(this,t),e=a(this,t,arguments),O(e,"name","WhopCheckoutSetEmailError"),e}return d(t,e),t}(C),E=function(e){function t(){var e;return s(this,t),e=a(this,t,arguments),O(e,"name","WhopCheckoutSetAddressError"),e}return d(t,e),t}(C),S=function(e){function t(){var e;return s(this,t),e=a(this,t,arguments),O(e,"name","WhopCheckoutGetAddressError"),e}return d(t,e),t}(C),R=function(e){function t(){var e;return s(this,t),e=a(this,t,arguments),O(e,"name","WhopCheckoutSetDisplayCurrencyError"),e}return d(t,e),t}(C),I=["resize","center","complete","state","get-email-result","set-email-result","set-address-result","get-address-result","address-validation-error","payment-error","promo-code-changed","payment-request-merchant-validation-result","payment-request-update-request","payment-request-create-request","payment-request-event-result","plaid-token-request","plaid-ready","identity-captured","currencies-available","currency-changed","set-display-currency-result","express-method-resolved","express-loading","request-overlay","request-requirement-overlay","close-overlay"];function j(e){return"object"==y(e.data)&&null!==e.data&&"event"in e.data&&I.includes(e.data.event)}var x=[];function L(e){return x[e]||(x[e]=(e+256).toString(16).slice(1))}function q(){var e=new Uint8Array(16);if(("undefined"==typeof crypto?"undefined":y(crypto))<"u"&&"function"==typeof crypto.getRandomValues)crypto.getRandomValues(e);else for(var t=0;t<16;t++)e[t]=256*Math.random()|0;return e[6]=15&e[6]|64,e[8]=63&e[8]|128,L(e[0])+L(e[1])+L(e[2])+L(e[3])+"-"+L(e[4])+L(e[5])+"-"+L(e[6])+L(e[7])+"-"+L(e[8])+L(e[9])+"-"+L(e[10])+L(e[11])+L(e[12])+L(e[13])+L(e[14])+L(e[15])}function U(e,t,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2e3,a=arguments.length>5?arguments[5]:void 0,s=new URL(e.src).origin,l=q();return null===(o=e.contentWindow)||void 0===o||o.postMessage(h(f({},t),{__scope:"whop-embedded-checkout",event_id:l}),s),new Promise(function(t,o){if(null==a?void 0:a.aborted){o(Error("Aborted"));return}var s=function(){c&&clearTimeout(c),window.removeEventListener("message",d),null==a||a.removeEventListener("abort",u)}
1,c=null!==i?setTimeout(function(){o(new _),s()},i):null,u=function(){o(new P),s()};null==a||a.addEventListener("abort",u,{once:!0});var d=function(i){if(i.source===e.contentWindow&&j(i)&&i.data.event===r&&i.data.event===r&&i.data.event_id===l){s();try{t(n(i.data))}catch(e){o(e)}}};window.addEventListener("message",d)})}var W=function(){var e,t;function r(e,t,n,o){s(this,r),this.iframe=e,this.methodData=t,this.details=n,this.options=o,O(this,"id",q()),O(this,"abortController")}return e=[{key:"active",get:function(){var e;return null!==(e=r.activeRequests.get(this.iframe))&&void 0!==e&&e}},{key:"updateMethodData",value:function(e){this.methodData=e}},{key:"updateDetails",value:function(e){this.details=e}},{key:"updateOptions",value:function(e){this.options=e}},{key:"getResult",value:function(){return i(function(){var e,t,r,n,o,a,s,l,c,u;return w(this,function(d){switch(d.label){case 0:e=this,t=new AbortController,this.abortController=t,(r=new PaymentRequest(this.methodData,this.details,this.options)).onmerchantvalidation=function(n){return i(function(){var e,o;return w(this,function(i){switch(i.label){case 0:return e={event:"payment-request-merchant-validation-request",validationURL:n.validationURL,methodName:n.methodName,id:this.id},[4,U(this.iframe,e,"payment-request-merchant-validation-result",function(e){return e},null,t.signal).catch(function(){return null})];case 1:return(null==(o=i.sent())?void 0:o.ok)?n.complete(o.merchantSession):r.abort(),[2]}})}).call(e)},r.onshippingaddresschange=function(e){e.updateWith({})},r.onpaymentmethodchange=function(r){return i(function(){var e,n;return w(this,function(o){switch(o.label){case 0:return e={event:"payment-request-payment-method-change-request",id:this.id,data:r.methodDetails},[4,U(this.iframe,e,"payment-request-event-result",function(e){return e},null,t.signal).catch(function(){return null})];case 1:return(null==(n=o.sent())?void 0:n.ok)?r.updateWith(n.details):r.updateWith({}),[2]}})}).call(e)},n=r,d.label=1;case 1:return d.trys.push([1,,6,7]),l=new Promise(function(e,r){var n=function(){r(Error("Aborted"))};t.signal.addEventListener("abort",n,{once:!0}),o=function(){t.signal.removeEventListener("abort",n)}}),[4,Promise.race([r.show().then(function(e){return n=null,e}),l])];case 2:if(c=d.sent(),u=this.methodData.find(function(e){return e.supportedMethods===c.methodName}))return[3,4];return[4,c.complete("fail")];case 3:throw d.sent(),Error("PaymentRequest failed to complete because of missing method data");case 4:return[4,c.complete("success")];case 5:return[2,(d.sent(),{method:c.methodName,response:{payerEmail:c.payerEmail,details:JSON.parse(JSON.stringify(c.details))},options:this.options,methodData:{applePayMerchantIdentifier:null==u?void 0:null===(a=u.data)||void 0===a?void 0:a.merchantIdentifier,requestShipping:null==u?void 0:null===(s=u.data)||void 0===s?void 0:s.requiredShippingContactFields}})];case 6:return null==n||n.abort(),null==o||o(),this.abortController=void 0,[7];case 7:return[2]}})}).call(this)}},{key:"abort",value:function(){var e;null===(e=this.abortController)||void 0===e||e.abort()}}],t=[{key:"get",value:function(e){var t;return null!==(t=r.requests.get(e))&&void 0!==t?t:null}},{key:"create",value:function(e,t,n,o){var i=new r(e,t,n,o);return r.requests.set(e,i),i}},{key:"remove",value:function(e){var t;null===(t=r.requests.get(e))||void 0===t||t.abort(),r.requests.delete(e),r.activeRequests.delete(e)}},{key:"setActive",value:function(e,t){r.activeRequests.set(e,t)}}],e&&c(r.prototype,e),t&&c(r,t),r}();
1function M(e,t,r){function n(n){if(n.source===e.contentWindow&&j(n)){switch(n.data.event){case"request-overlay":case"request-requirement-overlay":null==r||r.handleOverlayRequest(n.data);return;case"close-overlay":if(r){r.handleCloseOverlay(n.data);return}break;case"payment-request-create-request":try{var o,a=W.create(e,n.data.method_data,n.data.details,n.data.options),s={__scope:"whop-embedded-checkout",event:"payment-request-create-result",event_id:n.data.event_id,ok:!0,id:a.id},l=new URL(e.src).origin;null===(o=e.contentWindow)||void 0===o||o.postMessage(s,l)}catch(t){var c,u={__scope:"whop-embedded-checkout",event:"payment-request-create-result",event_id:n.data.event_id,ok:!1,error:p(t,Error)?t.message:"Unknown error"},d=new URL(e.src).origin;null===(c=e.contentWindow)||void 0===c||c.postMessage(u,d)}return;case"payment-request-update-request":"active"in n.data&&"boolean"==typeof n.data.active&&W.setActive(e,n.data.active);try{var f,h=W.get(e);if(!h)throw Error("Payment request not found");"method_data"in n.data&&n.data.method_data&&h.updateMethodData(n.data.method_data),"details"in n.data&&n.data.details&&h.updateDetails(n.data.details),"options"in n.data&&n.data.options&&h.updateOptions(n.data.options);var v={__scope:"whop-embedded-checkout",event:"payment-request-update-result",event_id:n.data.event_id,ok:!0},m=new URL(e.src).origin;null===(f=e.contentWindow)||void 0===f||f.postMessage(v,m)}catch(t){var y,b={__scope:"whop-embedded-checkout",event:"payment-request-update-result",event_id:n.data.event_id,ok:!1,error:p(t,Error)?t.message:"Unknown error"},g=new URL(e.src).origin;null===(y=e.contentWindow)||void 0===y||y.postMessage(b,g)}return;case"plaid-token-request":var k=n.data;i(function(){var t,r,n,o,i,a,s,l,c;return w(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),[4,D()];case 1:return r=u.sent(),[4,new Promise(function(e,t){var n=r.create({token:k.token,onSuccess:function(t){e(t),n.destroy()},onExit:function(e){var r;t(Error(null!==(r=null==e?void 0:e.display_message)&&void 0!==r?r:"Canceled by user")),n.destroy()}});n.open()})];case 2:return n=u.sent(),o={__scope:"whop-embedded-checkout",event:"plaid-token-result",event_id:k.event_id,ok:!0,token:n},i=new URL(e.src).origin,null===(t=e.contentWindow)||void 0===t||t.postMessage(o,i),[3,4];case 3:return a=u.sent(),l={__scope:"whop-embedded-checkout",event:"plaid-token-result",event_id:k.event_id,ok:!1,error:p(a,Error)?a.message:"Unknown error"},c=new URL(e.src).origin,null===(s=e.contentWindow)||void 0===s||s.postMessage(l,c),[3,4];case 4:return[2]}})})();return;case"plaid-ready":try{D().catch(function(){})}catch(e){}return}t(n.data)}}return window.addEventListener("message",n),function(){window.removeEventListener("message",n)}}O(W,"requests",new WeakMap),O(W,"activeRequests",new WeakMap);var T=null;function D(){return i(function(){var e,t;return w(this,function(r){switch(r.label){case 0:if(function(){if(!document.getElementById(F)){var e=document.createElement("style");e.id=F,e.textContent="iframe[id^='plaid-link-iframe-'] { pointer-events: auto; }",document.head.appendChild(e)}}(),!window.Plaid)return[3,1];return e=window.Plaid,[3,6];case 1:if(!T)return[3,3];return[4,T];case 2:return t=r.sent(),[3,5];case 3:return[4,T=i(function(){var e;return w(this,function(t){return[2,((e=document.createElement("script")).src="https://cdn.plaid.com/link/v2/stable/link-initialize.js",e.async=!0,e.defer=!0,document.head.appendChild(e),new Promise(function(t,r){e.onload=function(){window.Plaid?t(window.Plaid):r(Error("Plaid not available"))},e.onerror=function(){return r(Error("Failed to load Plaid Link script"))},T=null}))]})})()];case 4:t=r.sent(),r.label=5;case 5:e=t,r.label=6;case 6:return[2,e]}})})()}var F="whop-checkout-plaid-link-style";function N(e){if("off_session"===e)return"off_session"}function B(e){return"production"===e||"sandbox"===e?e:"production"}function z(e,t){if(t.paymentRedirectUrl&&e.searchParams.set("payment_redirect_url",t.paymentRedirectUrl),t.skipRedirect&&e.searchParams.set("skip_redirect","true"),t.theme&&e.searchParams.set("theme",t.theme),t.affiliateCode&&e.searchParams.set("a",t.affiliateCode),t.setupFutureUsage&&e.searchParams.set("setup_future_usage",t.setupFutureUsage),t.stateId&&e.searchParams.set("state_id",t.stateId),t.promoCode&&e.searchParams.set("promoCode",t.promoCode),t.utm){var r=!0,n=!1,o=void 0,i=!0,a=!1,s=void 0;try{for(var l,c,u,d,p=Object.entries(t.utm).sort(function(e,t){return e[0].localeCompare(t[0])})[Symbol.iterator]();!(i=(d=p.next()).done);i=!0){var f=m(d.value,2),h=f[0],v=f[1];if(h.startsWith("utm_")){if(Array.isArray(v))try{for(var y,b=v[Symbol.iterator]();!(r=(y=b.next()).done);r=!0){var g=y.value;e.searchParams.append(h,g)}}catch(e){n=!0,o=e}finally{try{r||null==b.return||b.return()}finally{if(n)throw o}}else e.searchParams.set(h,v)}}}catch(e){a=!0,s=e}finally{try{i||null==p.return||p.return()}finally{if(a)throw s}}}var w=!0,k=!1,O=void 0;if((null===(l=t.prefill)||void 0===l?void 0:l.email)&&e.searchParams.set("email",t.prefill.email),V(e,null===(c=t.prefill)||void 0===c?void 0:c.address),V(e,null===(u=t.prefill)||void 0===u?void 0:u.shippingAddress,"shipping."),t.themeOptions)try{for(var C,_=Object.entries(t.themeOptions)[Symbol.iterator]();!(w=(C=_.next()).done);w=!0){var P=m(C.value,2),A=P[0],E=P[1];(E||0===E)&&e.searchParams.set("theme.".concat(A),"boolean"==typeof E?"1":String(E))}}catch(e){k=!0,O=e}finally{try{w||null==_.return||_.return()}finally{if(k)throw O}}t.resolvedWuid&&e.searchParams.set("wuid",t.resolvedWuid),t.adaptivePricing&&e.searchParams.set("adaptive_pricing","1"),t.locale&&e.searchParams.set("locale",t.locale)}function G(e,t,r,n,o,i,a,s,l,c,u,d,p,f,h,v,y,b,g,w){var k=arguments.length>20&&void 0!==arguments[20]?arguments[20]:"production",O=arguments.length>21?arguments[21]:void 0,C=arguments.length>22?arguments[22]:void 0,_=arguments.length>
123?arguments[23]:void 0,P=arguments.length>24?arguments[24]:void 0,A=arguments.length>25?arguments[25]:void 0,E=O||H(),S="string"!=typeof r||r.startsWith("ch_XXXXX")?e:r,R=new URL("/embedded/checkout/".concat(S,"/"),Z(n,k));if("sandbox"===k&&n&&console.warn("Ignoring environment in favor of provided origin"),K(R),z(R,{theme:t,skipRedirect:i,affiliateCode:v,setupFutureUsage:y,paymentRedirectUrl:b,stateId:g,promoCode:w,utm:a,prefill:l,themeOptions:c,resolvedWuid:E,adaptivePricing:C,locale:P}),r&&R.searchParams.set("session",r),o&&R.searchParams.set("hide_price","true"),u&&R.searchParams.set("hide_submit_button","true"),d&&R.searchParams.set("hide_tos","true"),p&&R.searchParams.set("email.hidden","1"),f&&R.searchParams.set("email.disabled","1"),h&&R.searchParams.set("address.hidden","1"),null!=_&&R.searchParams.set("collectPhoneNumbers",_?"1":"0"),A&&R.searchParams.set("collectShipping","1"),s){var I=!0,j=!1,x=void 0,L=!0,q=!1,U=void 0;try{for(var W,M=Object.entries(s)[Symbol.iterator]();!(L=(W=M.next()).done);L=!0){var T=m(W.value,2),D=T[0],F=T[1];if(F)try{for(var N,B=Object.entries(F)[Symbol.iterator]();!(I=(N=B.next()).done);I=!0){var G=m(N.value,2),V=G[0],X=G[1];R.searchParams.set("style.".concat(D,".").concat(V),X.toString())}}catch(e){j=!0,x=e}finally{try{I||null==B.return||B.return()}finally{if(j)throw x}}}}catch(e){q=!0,U=e}finally{try{L||null==M.return||M.return()}finally{if(q)throw U}}}return R.toString()}function V(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t&&(t.name&&e.searchParams.set("".concat(r,"name"),t.name),t.line1&&e.searchParams.set("".concat(r,"address.line1"),t.line1),t.line2&&e.searchParams.set("".concat(r,"address.line2"),t.line2),t.city&&e.searchParams.set("".concat(r,"address.city"),t.city),t.country&&e.searchParams.set("".concat(r,"address.country"),t.country),t.state&&e.searchParams.set("".concat(r,"address.state"),t.state),t.postalCode&&e.searchParams.set("".concat(r,"address.postal_code"),t.postalCode))}function H(){if(!(("undefined"==typeof document?"undefined":y(document))>"u")){var e,t=null===(e=document.cookie.match(/(?:^|;\s*)_wuid=([^;]*)/))||void 0===e?void 0:e[1];return(null==t?void 0:t.startsWith("wuid_"))?t:void 0}}var X=["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads"],$="document-domain; execution-while-not-rendered; execution-while-out-of-viewport; payment; paymentRequest; sync-script;";function J(e){if(null===(t=window.whop)||void 0===t?void 0:t.track){var t,r={};e.email&&(r.email=e.email),e.user_id&&(r.user_id=e.user_id),window.whop.track("id",h(f({},r),{source:"embedded_checkout"}))}}function Z(e,t){return e||function(){if(!(("undefined"==typeof window?"undefined":y(window))>"u")){var e=window.__whopCheckoutInternalOriginOverride;return"string"==typeof e&&e.length>0?e:void 0}}()||("sandbox"===t?"https://sandbox.whop.com/":"https://whop.com/")}function K(e){e.searchParams.set("h",window.location.origin),e.searchParams.set("v","3");try{for(var t=window;t.parent!==t;)t=t.parent;var r=t.location.hostname;"https:"===t.location.protocol&&r&&e.searchParams.set("t",r)}catch(e){}}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Y(e,t,r){return(Y=ea()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&er(o,r.prototype),o}).apply(null,arguments)}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function et(e){return(et=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e,t){return(er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function en(e){return function(e){if(Array.isArray(e))return Q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Q(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);
1if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eo(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function ei(e){var t="function"==typeof Map?new Map:void 0;return(ei=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Y(e,arguments,et(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),er(r,e)})(e)}function ea(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ea=function(){return!!e})()}var es={padding:"0",border:"0",background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",position:"fixed",inset:"0",width:"100vw",maxWidth:"100vw",height:"100dvh",maxHeight:"100dvh"},el=null;function ec(){if(el){var e=el.dialog,t=el.cleanup;try{e.close()}catch(e){t()}}}function eu(e){if(el&&el.channelId===e){var t=el.dialog,r=el.cleanup;try{t.close()}catch(e){r()}}}function ed(e){var t=null;return{handleOverlayRequest:function(r){var n=e.getOverlayContext(),o=("request-overlay"===r.event?function(e){var t=e.channelId,r=e.theme,n=e.origin,o=e.environment,i=e.locale,a=new URL("/embedded/checkout/overlay-loader/",Z(n,void 0===o?"production":o));return a.searchParams.set("channel",t),K(a),r&&a.searchParams.set("theme",r),i&&a.searchParams.set("locale",i),a.toString()}:function(e){var t=e.channelId,r=e.theme,n=e.origin,o=e.environment,i=e.locale,a=new URL("/embedded/checkout/requirements/",Z(n,void 0===o?"production":o));return a.searchParams.set("channel",t),K(a),r&&a.searchParams.set("theme",r),i&&a.searchParams.set("locale",i),a.toString()})({channelId:r.channelId,theme:n.theme,origin:n.origin,environment:n.environment,locale:n.locale}),i="request-requirement-overlay"===r.event?r.iframeSrc:void 0,a=o;if(i)try{var s=new URL(i),l=new URL(o);s.origin!==l.origin||s.pathname!==l.pathname||s.searchParams.get("channel")!==r.channelId||s.searchParams.has("secret")||(a=s.toString())}catch(e){}if(function(e){if(el)return el.channelId===e.channelId?el:null;var t,r=document.createElement("dialog");r.setAttribute("data-whop-checkout-overlay","true"),Object.assign(r.style,es);var n=document.createElement("iframe");n.src=e.iframeSrc,n.style.display="block",n.style.width="100%",n.style.height="100%",n.style.border="0",n.style.background="transparent",n.style.colorScheme="normal",n.setAttribute("frameborder","no"),(t=n.sandbox).add.apply(t,en(X)),n.allow=$,r.appendChild(n),document.body.appendChild(r);var o=document.body.style.overflow,i=document.documentElement.style.overflow,a=function(){document.body.style.overflow=o,document.documentElement.style.overflow=i};document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden";var s=M(n,function(e){"close-overlay"===e.event&&ec()}),l=!1,c=function(){var t;l||(l=!0,s(),a(),r.remove(),el=null,null===(t=e.onClose)||void 0===t||t.call(e))};r.addEventListener("close",c),r.addEventListener("cancel",function(e){e.preventDefault();try{var t,r=new URL(n.src).origin;null===(t=n.contentWindow)||void 0===t||t.postMessage({__scope:"whop-embedded-checkout",event:"host-cancel-requested"},r)}catch(e){}});try{r.showModal()}catch(e){return s(),a(),r.remove(),null}return el={dialog:r,iframe:n,channelId:e.channelId,cleanup:c}}({channelId:r.channelId,iframeSrc:a,onClose:function(){var n;t===r.channelId&&(t=null),null===(n=e.onOverlayClose)||void 0===n||n.call(e)}})){var c,u,d=t===r.channelId;t=r.channelId,d||null===(u=e.onOverlayOpen)||void 0===u||u.call(e)}else null===(c=e.onOverlayClose)||void 0===c||c.call(e)},handleCloseOverlay:function(e){e.channelId?eu(e.channelId):ec()},scheduleAutoCloseAfterComplete:function(){if(t&&null!==el){var e=t;window.setTimeout(function(){return eu(e)},1500)}},closeOwnOverlay:function(){t&&eu(t)}}}function ep(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e){var o=window[e];null==o||o.apply(void 0,en(r))}}var ef=["apple-pay","whop-pay"],eh=["session","hide-price","hide-submit-button","hide-tos","hide-email","disable-email","hide-address","on-state-change","on-address-validation-error","on-promo-code-changed"];function ev(e,t,r){var n="billing"===r?"prefill":"prefill-shipping",o=function(){var e,n;return"billing"===r?(null!==(e=t.address)&&void 0!==e||(t.address={}),t.address):(null!==(n=t.shippingAddress)&&void 0!==n||(t.shippingAddress={}),t.shippingAddress)},i=e.getAttribute("".concat(n,"-name"));i&&(o().name=i);var a=e.getAttribute("".concat(n,"-address-line1"));a&&(o().line1=a);var s=e.getAttribute("".concat(n,"-address-line2"));s&&(o().line2=s);var l=e.getAttribute("".concat(n,"-address-city"));l&&(o().city=l);var c=e.getAttribute("".concat(n,"-address-country"));c&&(o().country=c);var u=e.getAttribute("".concat(n,"-address-state"));u&&(o().state=u);var d=e.getAttribute("".concat(n,"-address-postal-code"));d&&(o().postalCode=d)}var em=new Set;function ey(){var e=em.size>0,t=!0,r=!1,n=void 0;try{for(var o,i=document.querySelectorAll("whop-express-checkout-button")[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a,s=o.value;if(a=HTMLElement,null!=a&&"undefined"!=typeof Symbol&&a[Symbol.hasInstance]?!!a[Symbol.hasInstance](s):s instanceof a){var l=em.has(s);e&&!l?(s.toggleAttribute("data-disabled-by-peer",!0),s.toggleAttribute("inert",!0)):(s.toggleAttribute("data-disabled-by-peer",!1),s.toggleAttribute("inert",!1))}}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}}var eb="whop-express-checkout-button-peer-disabled-styles",eg=["plan-id","checkout-configuration-id","environment","origin","affiliate-code","state-id","setup-future-usage","adaptive-pricing","collect-shipping","wuid","promo-code","locale","methods"],ew={theme:{key:"theme"},"theme-accent-color":{key:"theme.accentColor"},"theme-high-contrast":{key:"theme.highContrast",transform:function(e){return"true"===e?"1":null}},"return-url":{key:"payment_redirect_url"},"redirect-url":{key:"payment_redirect_url"},"prefill-email":{key:"email"},"prefill-name":{key:"name"},"prefill-address-line1":{key:"address.line1"},"prefill-address-line2":{key:"address.line2"},"prefill-address-city":{key:"address.city"},"prefill-address-country":{key:"address.country"},"prefill-address-state":{key:"address.state"},"prefill-address-postal-code":{key:"address.postal_code"},"prefill-shipping-name":{key:"shipping.name"},"prefill-shipping-address-line1":{key:"shipping.address.line1"},"prefill-shipping-address-line2":{key:"shipping.address.line2"},"prefill-shipping-address-city":{key:"shipping.address.city"},"prefill-shipping-address-country":{key:"shipping.address.country"},"prefill-shipping-address-state":{key:"shipping.address.state"},"prefill-shipping-address-postal-code":{key:"shipping.address.postal_code"}},ek=en(eg).concat(en(Object.keys(ew)),["on-complete","skip-redirect"]),eO=null,eC=r(2265);function e_(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function eP(e,t,r,n,o,i,a){try{var s=e[i](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,o)}function eA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function eE(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function eS(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function eR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,s=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(s)throw n}}return i}}(e,t)||ej(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eI(e){return function(e){if(Array.isArray(e))return e_(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ej(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ej(e,t){if(e){if("string"==typeof e)return e_(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e_(e,t)}}function ex(){return function(){}}var eL=Symbol("none");function eq(e){var t=(0,eC.useRef)(eL);return t.current===eL&&(t.current=e()),t}function eU(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=eR(r,26),i=o[0],a=o[1],s=o[2],l=(o[3],o[4]),c=o[5],u=o[6],d=o[7],p=o[8],f=o[9],h=o[10],v=o[11],m=o[12],y=o[13],b=o[14],g=o[15],w=o[16],k=o[17],O=o[18],C=o[19],_=o[20],P=o[21],A=o[22],E=o[23],S=o[24],R=o[25],I=(0,eC.useMemo)(function(){return G(i,a,s,void 0,l,c,u,d,p,f,h,v,m,y,b,g,w,k,O,C,_,P,A,E,S,R)},[i,a,s,l,c,u,d,p,f,h,v,m,y,b,g,w,k,O,C,_,P,A,E,S,R]);(0,eC.useEffect)(function(){},[e,I])}var eW=X.join(" "),eM=(0,eC.forwardRef)(function(e,t){var r=e.theme,n=e.hidePrice,o=e.skipRedirect,a=e.onComplete,s=e.onStateChange,l=e.onAddressValidationError,c=e.onPaymentError,u=e.onPromoCodeChanged,d=e.onIdentityCaptured,p=e.onCurrenciesAvailable,f=e.onCurrencyChanged,h=e.utm,v=e.styles,m=e.prefill,y=e.themeOptions,b=e.hideSubmitButton,g=e.hideTermsAndConditions,k=e.hideEmail,O=e.disableEmail,C=e.hideAddressForm,_=e.affiliateCode,P=e.setupFutureUsage,I=e.redirectUrl,j=e.returnUrl,x=e.stateId,L=e.promoCode,T=e.environment,D=e.wuid,F=e.adaptivePricing,B=e.collectPhoneNumbers,z=e.locale,V=e.collectShipping,H=eS(e,["theme","hidePrice","skipRedirect","onComplete","onStateChange","onAddressValidationError","onPaymentError","onPromoCodeChanged","onIdentityCaptured","onCurrenciesAvailable","onCurrencyChanged","utm","styles","prefill","themeOptions","hideSubmitButton","hideTermsAndConditions","hideEmail","disableEmail","hideAddressForm","affiliateCode","setupFutureUsage","redirectUrl","returnUrl","stateId","promoCode","environment","wuid","adaptivePricing","collectPhoneNumbers","locale","collectShipping"]),X=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=eq(function(){return G.apply(void 0,eI(t))}).current;return eU.apply(void 0,[n].concat(eI(t))),n}("planId"in H?H.planId:void 0,r,"sessionId"in H?H.sessionId:void 0,void 0,void 0!==n&&n,void 0!==o&&o||!!a,h,v,m,(0,eC.useMemo)(function(){var e;return{accentColor:null==y?void 0:y.accentColor,highContrast:null!==(e=null==y?void 0:y.highContrast)&&void 0!==e&&e,backgroundColor:null==y?void 0:y.backgroundColor,borderRadius:null==y?void 0:y.borderRadius,buttonText:null==y?void 0:y.buttonText}},[null==y?void 0:y.accentColor,null==y?void 0:y.highContrast,null==y?void 0:y.backgroundColor,null==y?void 0:y.borderRadius,null==y?void 0:y.buttonText]),void 0!==b&&b,void 0!==g&&g,void 0!==k&&k,void 0!==O&&O,void 0!==C&&C,_,N(P),null!=j?j:I,x,L,T,D,void 0!==F&&F,B,z,V),Z=(0,eC.useRef)(null),K=eR((0,eC.useState)(480),2),Q=K[0],Y=K[1],ee=(0,eC.useRef)(null),et=(0,eC.useRef)({theme:r,environment:T,locale:z});et.current={theme:r,environment:T,locale:z};var er=eq(function(){return ed({getOverlayContext:function(){var e;return{theme:et.current.theme,origin:void 0,environment:null!==(e=et.current.environment)&&void 0!==e?e:"production",locale:et.current.locale}},onOverlayClose:function(){var e=Z.current;if(e)try{var t,r=new URL(e.src).origin;null===(t=e.contentWindow)||void 0===t||t.postMessage({__scope:"whop-embedded-checkout",event:"overlay-closed"},r)}catch(e){}}})});return(0,eC.useEffect)(function(){var e=Z.current;if(e)return M(e,function(t){switch(t.event){case"resize":Y(t.height);break;case"center":e.scrollIntoView({block:"center",inline:"center"});break;case"complete":a&&a(t.plan_id,t.setup_intent_id||t.receipt_id),er.current.scheduleAutoCloseAfterComplete();break;case"state":s&&s(t.state);break;case"address-validation-error":l&&l({error_message:t.error_message,error_code:t.error_code});break;case"payment-error":c&&c({message:t.message,code:t.code});break;case"promo-code-changed":u&&u(t.promoCode);break;case"identity-captured":J(t),d&&d({email:t.email,user_id:t.user_id});break;case"currencies-available":var r={base_currency:t.base_currency,optional_currency:t.optional_currency,current_currency:t.current_currency,exchange_rate:t.exchange_rate};ee.current=r,p&&p(r);break;case"currency-changed":ee.current&&(ee.current=eE(eA({},ee.current),{current_currency:t.currency,exchange_rate:t.exchange_rate})),f&&f({currency:t.currency,exchange_rate:t.exchange_rate})}},er.current)},[a,s,l,c,u,d,p,f]),(0,eC.useEffect)(function(){return function(){Z.current&&W.remove(Z.current),er.current.closeOwnOverlay()}},[]),(0,eC.useImperativeHandle)(t,function(){return{submit:function(e){var t;return(t=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,function(e){switch(e.label){case 0:var t;if(!Z.current)return[3,2];return[4,(t=Z.current,i(function(){var e,r,n,o,i;return w(this,function(a){switch(a.label){case 0:if(r={__scope:"whop-embedded-checkout",event:"submit",event_id:q()},!(null==(n=W.get(t))?void 0:n.active))return[3,2];return[4,n.getResult()];case 1:o=a.sent(),r.payment_request_result=o,a.label=2;case 2:return i=new URL(t.src).origin,null===(e=t.contentWindow)||void 0===e||e.postMessage(r,i),[2]}})})())];case 1:return[2,e.sent()];case 2:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(e){eP(i,n,o,a,s,"next",e)}function s(e){eP(i,n,o,a,s,"throw",e)}a(void 0)})})()},getEmail:function(e){if(!Z.current)throw Error("Whop embedded checkout frame not found");return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;return i(function(){return w(this,function(r){return[2,U(e,{event:"get-email"},"get-email-result",function(e){return e.email},t)]})})()}(Z.current,e)},setEmail:function(e,t){if(!Z.current)throw Error("Whop embedded checkout frame not found");return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3;return i(function(){return w(this,function(n){return[2,U(e,{event:"set-email",email:t},"set-email-result",function(e){if(!e.ok)throw new A(e.error)},r)]})})()}(Z.current,e,t)},setAddress:function(e,t){if(!Z.current)throw Error("Whop embedded checkout frame not found");return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3;return i(function(){return w(this,function(n){return[2,U(e,{event:"set-address",address:t},"set-address-result",function(e){if(!e.ok)throw new E(e.error)},r)]})})()}(Z.current,e,t)},getAddress:function(e){if(!Z.current)throw Error("Whop embedded checkout frame not found");return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3;return i(function(){return w(this,function(r){return[2,U(e,{event:"get-a
1ddress"},"get-address-result",function(e){if(!e.ok)throw new S(e.error);return{address:e.address,isComplete:e.is_complete}},t)]})})()}(Z.current,e)},setDisplayCurrency:function(e,t){if(!Z.current)throw Error("Whop embedded checkout frame not found");return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3;return i(function(){return w(this,function(n){return[2,U(e,{event:"set-display-currency",currency:t},"set-display-currency-result",function(e){if(!e.ok)throw new R(e.error)},r)]})})()}(Z.current,e,t)},getAvailableCurrencies:function(){return ee.current}}},[]),eC.createElement("iframe",{ref:Z,allow:$,sandbox:eW,title:"Whop Embedded Checkout",src:null!=X?X:void 0,style:{border:"none",height:"".concat(Q,"px"),width:"100%",overflow:"hidden",background:"transparent",colorScheme:"normal"}})});eM.displayName="WhopCheckoutEmbedInner";var eT=(0,eC.forwardRef)(function(e,t){var r=e.fallback,n=eS(e,["fallback"]);return(0,eC.useSyncExternalStore)(ex,function(){return!0},function(){return!1})?eC.createElement(eM,eE(eA({},n),{ref:t})):null!=r?r:null});function eD(){return(0,eC.useRef)(null)}eT.displayName="WhopCheckoutEmbed",function(){if(!(("undefined"==typeof window?"undefined":eo(window))>"u"||("undefined"==typeof customElements?"undefined":eo(customElements))>"u"||customElements.get("whop-express-checkout-button"))){var e=("undefined"==typeof HTMLElement?"undefined":eo(HTMLElement))>"u"?null:eO||(eO=function(e){var t,r;function n(){var e,t,r,o;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,n),t=n,r=arguments,t=et(t),O(e=(o=ea()?Reflect.construct(t,r||[],et(this).constructor):t.apply(this,r))&&("object"===eo(o)||"function"==typeof o)?o:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this),"iframe",null),O(e,"removeListeners",null),O(e,"pendingIframe",null),O(e,"pendingRemoveListeners",null),O(e,"pendingRendered",null),O(e,"pendingUrlReplace",{}),O(e,"urlReplaceScheduled",!1),O(e,"refreshScheduled",!1),O(e,"pendingPostOverlayRefresh",!1),O(e,"clearPositionOnSwap",!1),e}return function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&er(e,t)}(n,e),t=[{key:"connectedCallback",value:function(){this.iframe||this.mount()}},{key:"attributeChangedCallback",value:function(e,t,r){if(t!==r){if(!this.iframe){this.isConnected&&"error"===this.dataset.state&&eg.includes(e)&&this.scheduleRefresh();return}if(eg.includes(e)){this.scheduleRefresh();return}if("on-complete"===e||"skip-redirect"===e){var n="skip-redirect"===e?r:this.getAttribute("skip-redirect"),o="on-complete"===e?r:this.getAttribute("on-complete");this.queueUrlReplace("skip_redirect","true"===n||o?"true":null);return}var i=ew[e];if(i){var a=i.transform?i.transform(r):r;this.queueUrlReplace(i.key,a)}}}},{key:"queueUrlReplace",value:function(e,t){var r=this;this.pendingUrlReplace[e]=t,this.urlReplaceScheduled||(this.urlReplaceScheduled=!0,queueMicrotask(function(){r.urlReplaceScheduled=!1;var e,t,n=r.pendingUrlReplace;r.pendingUrlReplace={};var o=r.iframe;if(o){try{t=new URL(o.src).origin}catch(e){return}null===(e=o.contentWindow)||void 0===e||e.postMessage({__scope:"whop-embedded-checkout",event:"update-search-params",params:n},t)}}))}},{key:"scheduleRefresh",value:function(){var e=this;this.refreshScheduled||(this.refreshScheduled=!0,queueMicrotask(function(){if(e.refreshScheduled=!1,e.isConnected){if(!e.iframe){e.mount();return}if(e.hasAttribute("data-overlay-open")){e.pendingPostOverlayRefresh=!0;return}e.beginGracefulRefresh()}}))}},{key:"disconnectedCallback",value:function(){this.unmount()}},{key:"mount",value:function(){var e=this.buildIframe();e&&(this.appendChild(e.iframe),this.adoptAsLive(e.iframe,e.removeListeners))}},{key:"unmount",value:function(){this.pendingIframe&&this.pendingRemoveListeners&&(this.teardownIframe(this.pendingIframe,this.pendingRemoveListeners),this.pendingIframe=null,this.pendingRemoveListeners=null,this.pendingRendered=null),this.iframe&&this.removeListeners&&(this.teardownIframe(this.iframe,this.removeListeners),this.iframe=null,this.removeListeners=null),delete this.dataset.state,delete this.dataset.rendered,this.toggleAttribute("data-overlay-open",!1),this.toggleAttribute("data-loading",!1),this.toggleAttribute("data-refreshing",!1),this.clearPositionOnSwap&&(this.style.position="",this.clearPositionOnSwap=!1),ey()}},{key:"buildIframe",value:function(){var e,t,r,n,o,i,a,s,l,c,u,d,p,f,h,v,m,y,b,g,w,k,O,C,_,P=this,A=null!==(f=this.getAttribute("plan-id"))&&void 0!==f?f:void 0,E=null!==(h=this.getAttribute("checkout-configuration-id"))&&void 0!==h?h:void 0;if(!A&&!E)return this.dataset.state="error",null;var S=null!==(v=this.getAttribute("return-url"))&&void 0!==v?v:this.getAttribute("redirect-url");if(!S)return console.error("[whop-checkout] return-url is required on <whop-express-checkout-button>. Refusing to mount."),this.dataset.state="error",null;"ready"!==this.dataset.state&&(this.dataset.state="mounting"),function(){if(!document.getElementById(eb)){var e=document.createElement("style");e.id=eb,e.textContent="\n whop-express-checkout-button[data-disabled-by-peer] {\n pointer-events: none;\n opacity: 0.55;\n filter: grayscale(0.6);\n transition: opacity 150ms ease, filter 150ms ease;\n }\n ",document.head.appendChild(e)}}(),e=this,t=eh.filter(function(t){return e.hasAttribute(t)}),r=Array.from(e.attributes).map(function(e){return e.name}).filter(function(e){return e.startsWith("style-")}),0===t.length&&0===r.length||console.warn("[whop-checkout] Ignoring attributes on <whop-express-checkout-button>: ".concat(en(t).concat(en(r)).join(", ")));var R=function(e){if(e){var t=Array.from(new Set(e.split(",").map(function(e){return e.trim().toLowerCase()}).filter(function(e){return ef.includes(e)})));return t.length>0?t:void 0}}(this.getAttribute("methods"));A&&function(e){if(!(window.whop||document.querySelector('script[src*="t.whop.tw/e/"]'))){var t=document.createElement("script");t.async=!0,t.src="https://t.whop.tw/e/".concat(e,".js"),document.head.appendChild(t)}}(A);var I=function(e){var t=e.planId,r=e.checkoutConfigurationId,n=e.theme,o=e.origin,i=e.utm,a=e.prefill,s=e.themeOptions,l=e.affiliateCode,c=e.paymentRedirectUrl,u=e.stateId,d=e.promoCode,p=e.environment,f=void 0===p?"production":p,h=e.wuid,v=e.adaptivePricing,m=e.methods,y=e.setupFutureUsage,b=e.skipRedirect,g=e.locale,w=e.collectShipping,k=h||H(),O=new
1URL("/embedded/checkout/".concat(null!=r?r:t,"/express/"),Z(o,f)),C=!0,_=!1,P=void 0;if(r&&O.searchParams.set("session",r),"sandbox"===f&&o&&console.warn("Ignoring environment in favor of provided origin"),K(O),z(O,{theme:n,skipRedirect:b,affiliateCode:l,setupFutureUsage:y,paymentRedirectUrl:c,stateId:u,promoCode:d,utm:i,prefill:a,themeOptions:s,resolvedWuid:k,adaptivePricing:v,locale:g}),m)try{for(var A,E=m[Symbol.iterator]();!(C=(A=E.next()).done);C=!0){var S=A.value;O.searchParams.append("methods",S)}}catch(e){_=!0,P=e}finally{try{C||null==E.return||E.return()}finally{if(_)throw P}}return w&&O.searchParams.set("collectShipping","1"),O.toString()}({planId:A,checkoutConfigurationId:E,theme:null!==(m=this.getAttribute("theme"))&&void 0!==m?m:void 0,origin:null!==(y=this.getAttribute("origin"))&&void 0!==y?y:void 0,utm:"true"===this.getAttribute("skip-utm")?void 0:Array.from((n=function(){var e=window;try{for(e.parent.location.href;"null"===e.location.origin&&e!==e.parent;)e=e.parent}catch(e){}return new URLSearchParams(e.location.search)}()).keys()).reduce(function(e,t){if(!t.startsWith("utm_"))return e;var r=n.getAll(t);return 1===r.length?e[t]=r[0]:r.length>1&&(e[t]=r),e},{}),prefill:(o={},(i=this.getAttribute("prefill-email"))&&(o.email=i),ev(this,o,"billing"),ev(this,o,"shipping"),o),themeOptions:(a={},(s=this.getAttribute("theme-accent-color"))&&(a.accentColor=s),null!==(l=this.getAttribute("theme-high-contrast"))&&(a.highContrast="true"===l),a),affiliateCode:null!==(b=this.getAttribute("affiliate-code"))&&void 0!==b?b:void 0,paymentRedirectUrl:S,stateId:null!==(g=this.getAttribute("state-id"))&&void 0!==g?g:void 0,promoCode:null!==(w=this.getAttribute("promo-code"))&&void 0!==w?w:void 0,environment:B(null!==(k=this.getAttribute("environment"))&&void 0!==k?k:void 0),wuid:null!==(O=this.getAttribute("wuid"))&&void 0!==O?O:void 0,adaptivePricing:"true"===this.getAttribute("adaptive-pricing"),methods:R,setupFutureUsage:N(null!==(C=this.getAttribute("setup-future-usage"))&&void 0!==C?C:void 0),skipRedirect:"true"===this.getAttribute("skip-redirect")||this.hasAttribute("on-complete"),locale:null!==(_=this.getAttribute("locale"))&&void 0!==_?_:void 0,collectShipping:"true"===this.getAttribute("collect-shipping")}),j=document.createElement("iframe");j.src=I,j.style.display="block",j.style.width="100%",j.style.height="0px",j.style.border="none",j.style.overflow="hidden",j.style.background="transparent",j.style.colorScheme="normal",j.setAttribute("frameborder","no"),(p=j.sandbox).add.apply(p,en(X)),j.allow=$;var x=(d=M(j,function(e){switch(e.event){case"resize":j.style.height="".concat(e.height,"px"),null===(n=c.onResize)||void 0===n||n.call(c,e.height);break;case"center":j.scrollIntoView({block:"center",inline:"center"});break;case"complete":var t,r,n,o,i=e.setup_intent_id||e.receipt_id;ep(c.getCallback("on-complete"),e.plan_id,i),null===(o=c.onComplete)||void 0===o||o.call(c,e.plan_id,i),u.scheduleAutoCloseAfterComplete();break;case"state":ep(c.getCallback("on-state-change"),e.state);break;case"address-validation-error":ep(c.getCallback("on-address-validation-error"),{error_message:e.error_message,error_code:e.error_code});break;case"payment-error":var a,s={message:e.message,code:e.code};ep(c.getCallback("on-payment-error"),s),null===(a=c.onPaymentError)||void 0===a||a.call(c,s);break;case"promo-code-changed":ep(c.getCallback("on-promo-code-changed"),e.promoCode);break;case"identity-captured":J(e),ep(c.getCallback("on-identity-captured"),{email:e.email,user_id:e.user_id});break;case"currencies-available":var l,d={base_currency:e.base_currency,optional_currency:e.optional_currency,current_currency:e.current_currency,exchange_rate:e.exchange_rate},p=j.dataset.whopCheckoutIdentifier;p&&(null===(l=window.wco)||void 0===l||l.availableCurrencies.set(p,d)),ep(c.getCallback("on-currencies-available"),d);break;case"currency-changed":var f=j.dataset.whopCheckoutIdentifier;if(f){var h,v,m,y,b=null===(m=window.wco)||void 0===m?void 0:m.availableCurrencies.get(f);b&&(null===(y=window.wco)||void 0===y||y.availableCurrencies.set(f,(h=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},b),v=v={current_currency:e.currency,exchange_rate:e.exchange_rate},Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(v)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(v)).forEach(function(e){Object.defineProperty(h,e,Object.getOwnPropertyDescriptor(v,e))}),h)))}ep(c.getCallback("on-currency-changed"),{currency:e.currency,exchange_rate:e.exchange_rate});break;case"express-method-resolved":null===(t=c.onExpressMethodResolved)||void 0===t||t.call(c,e.rendered),ep(c.getCallback("on-express-method-resolved"),{rendered:e.rendered});break;case"express-loading":null===(r=c.onExpressLoadingChange)||void 0===r||r.call(c,e.loading)}},u=ed({getOverlayContext:(c={getCallback:function(e){var t;return null!==(t=P.getAttribute(e))&&void 0!==t?t:void 0},getOverlayContext:function(){var e,t,r,n;return{theme:null!==(e=P.getAttribute("theme"))&&void 0!==e?e:void 0,origin:null!==(t=P.getAttribute("origin"))&&void 0!==t?t:void 0,environment:B(null!==(r=P.getAttribute("environment"))&&void 0!==r?r:void 0),locale:null!==(n=P.getAttribute("locale"))&&void 0!==n?n:void 0}},onResize:function(e){if(e>0&&P.pendingIframe===j){P.completeGracefulSwap();return}P.iframe===j&&e>0&&"ready"!==P.dataset.state&&(P.dataset.state="ready",P.dispatchEvent(new CustomEvent("ready")))},onExpressMethodResolved:function(e){if(P.pendingIframe===j){P.pendingRendered=e,"none"===e&&P.completeGracefulSwap();return}P.iframe===j&&(P.dataset.rendered=e,P.dispatchEvent(new CustomEvent("express-method-resolved",{detail:{rendered:e}})))},onExpressLoadingChange:function(e){P.iframe===j&&(e?(em.add(P),P.toggleAttribute("data-loading",!0)):(em.delete(P),P.toggleAttribute("data-loading",!1)),ey())},onOverlayOpen:function(){P.toggleAttribute("data-overlay-open",!0),P.dispatchEvent(new CustomEvent("overlay-open"))},onOverlayClose:function(){var e=P.iframe;if(e)try{var t,r=new URL(e.src).origin;null===(t=e.contentWindow)||void 0===t||t.postMessage({__scope:"whop-embedded-checkout",event:"overlay-closed"},r)}catch(e){}var n=P.hasAttribute("data-overlay-open");P.toggleAttribute("data-overlay-open",!1),n&&P.dispatchEvent(new CustomEvent("overlay-close")),P.pendingPostOverlayRefresh&&(P.pendingPostOverlayRefresh=!1,P.scheduleRefresh())},onComplete:function(e,t){P.iframe===j&&P.dispatchEvent(new CustomEvent("complete",{detail:{planId:e,receiptOrSetupIntentId:t}}))},onPaymentError:function(e){P.iframe===j&&P.dispatchEvent(new CustomEvent("payment-error",{detail:e}))}}).getOverlayContext,onOverlayOpen:c.onOverlayOpen,onOverlayClose:c.onOverlayClose})),function(){d(),u.closeOwnOverlay()});return{iframe:j,removeListeners:x}}},{key:"adoptAsLive",value:function(e,t){this.iframe=e,this.removeListeners=t;var r,n=this.id;n&&(null===(r=window.wco)||void 0===r||r.identifiedFrames.set(n,e),e.dataset.whopCheckoutIdentifier=n)}},{key:"teardownIframe",value:function(e,t){var r,n,o=e.dataset.whopCheckoutIdentifier;o&&(null===(r=window.wco)||void 0===r||r.identifiedFrames.delete(o),null===(n=window.wco)||void 0===n||n.availableCurrencies.delete(o)),W.remove(e),em.delete(this),t(),e.remove()}},{key:"beginGracefulRefresh",value:function(){var e=this.iframe,t=this.removeListeners;if(!e||!t){this.mount();return}this.pendingIframe&&this.pendingRemoveListeners&&(this.teardownIframe(this.pendingIframe,this.pendingRemoveListeners),this.pendingIframe=null,this.pendingRemoveListeners=null,this.pendingRendered=null),this.toggleAttribute("data-refreshing",!0),e.setAttribute("inert",""),e.style.opacity="0.55",e.style.filter="grayscale(0.6)",e.style.pointerEvents="none",e.style.transition="opacity 150ms ease, filter 150ms ease";var r=this.dataset.state,n=this.buildIframe();if(!n){e.removeAttribute("inert"),e.style.opacity="",e.style.filter="",e.style.pointerEvents="",e.style.transition="",void 0===r?delete this.dataset.state:this.dataset.state=r,this.toggleAttribute("data-refreshing",!1),this.clearPositionOnSwap&&(this.style.position="",this.clearPositionOnSwap=!1);return}this.style.position||(this.style.position="relative",this.clearPositionOnSwap=!0),n.iframe.style.position="absolute",n.iframe.style.top="0",n.iframe.style.left="0",n.iframe.style.right="0",n.iframe.style.opacity="0",n.iframe.style.pointerEvents="none",this.pendingIframe=n.iframe,this.pendingRemoveListeners=n.removeListeners,this.appendChild(n.iframe)}},{key:"completeGracefulSwap",value:function(){var e=this.pendingIframe,t=this.pendingRemoveListeners,r
1=this.pendingRendered,n=this.iframe,o=this.removeListeners;e&&t&&(this.pendingIframe=null,this.pendingRemoveListeners=null,this.pendingRendered=null,n&&o&&this.teardownIframe(n,o),e.style.position="",e.style.top="",e.style.left="",e.style.right="",e.style.opacity="",e.style.pointerEvents="",this.adoptAsLive(e,t),this.toggleAttribute("data-refreshing",!1),this.clearPositionOnSwap&&(this.style.position="",this.clearPositionOnSwap=!1),ey(),this.dispatchEvent(new CustomEvent("ready")),null!==r?(this.dataset.rendered=r,this.dispatchEvent(new CustomEvent("express-method-resolved",{detail:{rendered:r}}))):delete this.dataset.rendered)}}],r=[{key:"observedAttributes",get:function(){return ek}}],t&&ee(n.prototype,t),r&&ee(n,r),n}(ei(HTMLElement)));e&&customElements.define("whop-express-checkout-button",e)}}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.