PageSourceSearch

https://whop.com/_web/assets/gha-35971278800-1/controller-DltsyOJx.js

js whop.com collected 2026-09-24 08:30:26 UTC 391,710 bytes, 13 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ad27fbcf-bf04-5866-a8ba-7051d5a783fe")}catch(e){}}();
3import{o as e,t}from"./rolldown-runtime-CMxvf4Kt.js";import{Ca as n,Ji as r,Q as i,Qt as a,Ta as o,Zi as s,Zt as c,hr as l,ya as u,zt as d}from"./frosted-ui-IuunJNEA.js";import{m as f,t as p}from"./useQuery-h_lbmEls.js";import{n as m,t as h}from"./preload-helper-CHfnNNiK.js";import{a as g}from"./react-BBpLUrWf.js";import{n as _}from"./react-client-D5SPP8rz.js";import{t as v}from"./ChevronRight16-C1D1_N7m.js";import{t as y}from"./Bank16-CCASCihJ.js";import{t as b}from"./Bank20-C_AxaJrh.js";import{t as x}from"./Wallet16-W4cjWjHo.js";import{t as S}from"./Wallet20-eWUwOr8v.js";import{t as C}from"./CreditCard12-dLyY8DRU.js";import{t as w}from"./CreditCard16-DSOi_OGc.js";import{t as T}from"./Clock16-CXBcl48T.js";import{t as E}from"./Clock20-B3FbOQnX.js";import{t as D}from"./cn-CIC46yv0.js";import{o as O}from"./toast-BSw6zLhC.js";import{t as k}from"./chrome-BFk9Hveq.js";import{b as A}from"./Client-B_pmEYgI.js";import{t as j}from"./raw-BMs3X-qX.js";import{C as M,_ as N,c as ee,d as P,f as F,i as I,l as L,p as R,r as z,s as B,u as V,v as H,y as te}from"./builder-Co1ciMTd.js";import{C as U,S as W,_ as ne,a as G,b as K,c as re,d as ie,f as q,g as ae,h as oe,i as se,l as ce,m as le,n as J,o as ue,p as de,r as fe,s as pe,u as me,v as Y,w as he,x as ge,y as _e}from"./parsePhoneNumber_-BVXRnZuY.js";import{t as ve}from"./parsePhoneNumber-TWaZ-HO7.js";import{i as ye,n as be,o as xe,r as Se}from"./src-DJYTMIfL.js";import{n as Ce}from"./use-immutable-callback-DDv5WypE.js";import{a as we,o as Te,r as Ee,s as De}from"./money-tMbdBxC6.js";import{_ as Oe,d as X,f as ke,h as Ae,l as je,m as Me,o as Ne,p as Pe,s as Fe,u as Ie}from"./next-action-Dxoof7Yc.js";import{t as Le}from"./payment-method-icon-BxyZMzRf.js";import{t as Re}from"./whop-logo-full-CukoRWaH.js";import{a as ze,c as Be,d as Ve,f as He,i as Ue,l as We,m as Ge,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as Ze,u as Qe}from"./module-LoJoYbqM.js";import{t as $e}from"./esm-DGk0mjrZ.js";import{_ as et,a as tt,c as nt,d as rt,g as it,i as at,l as ot,m as st,n as ct,p as lt,r as ut,s as dt,u as ft}from"./complete-payment-flow-Cld_TBNN.js";import{t as pt}from"./phone-input-CmdUI1s3.js";import{t as mt}from"./infinite-scroll-fetcher-B1EdaQnE.js";function ht(e){"@babel/helpers - typeof";return ht=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ht(e)}function gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _t(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gt(Object(n),!0).forEach(function(t){vt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vt(e,t,n){return(t=yt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(e){var t=bt(e,`string`);return ht(t)==`symbol`?t:t+``}function bt(e,t){if(ht(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ht(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function xt(){var e=J(arguments),t=e.text,n=e.options,r=e.metadata;n=_t(_t({},n),{},{extract:!1});try{var i=fe(t,n,r);r=new K(r),r.selectNumberingPlan(i.countryCallingCode);var a=_e(i.nationalNumber,i.country,r);if(a!==`IS_POSSIBLE`)return a}catch(e){if(e instanceof G)return e.message;throw e}}function St(e){"@babel/helpers - typeof";return St=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},St(e)}function Ct(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function wt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Et(r.key),r)}}function Tt(e,t,n){return t&&wt(e.prototype,t),n&&wt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Et(e){var t=Dt(e,`string`);return St(t)==`symbol`?t:t+``}function Dt(e,t){if(St(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(St(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ot=function(){function e(t){var n=t.onCountryChange,r=t.onCallingCodeChange;Ct(this,e),this.onCountryChange=n,this.onCallingCodeChange=r}return Tt(e,[{key:`reset`,value:function(e){var t=e.country,n=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits=``,this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:`resetNationalSignificantNumber`,value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberIsModified=!1,this.nationalPrefix=void 0,this.carrierCode=void 0,this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix=void 0}},{key:`update`,value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];this[r]=e[r]}}}
vendor: 5,639 bytes, lines 3-4
3,{key:`initCountryAndCallingCode`,value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:`setCountry`,value:function(e){this.country=e,this.onCountryChange(e)}},{key:`setCallingCode`,value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:`startInternationalNumber`,value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:`appendDigits`,value:function(e){this.digits+=e}},{key:`appendNationalSignificantNumberDigits`,value:function(e){this.nationalSignificantNumber+=e}},{key:`getNationalDigits`,value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:`getDigitsWithoutInternationalPrefix`,value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])}();function kt(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=At(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
4In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function At(e,t){if(e){if(typeof e==`string`)return jt(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jt(e,t):void 0}}function jt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Mt=RegExp(`x`);function Nt(e,t){if(t<1)return``;for(var n=``;t>1;)t&1&&(n+=e),t>>=1,e+=e;return n+e}function Pt(e,t){return e[t]===`)`&&t++,Ft(e.slice(0,t))}function Ft(e){for(var t=[],n=0;n<e.length;)e[n]===`(`?t.push(n):e[n]===`)`&&t.pop(),n++;var r=0,i=``;t.push(e.length);for(var a=0,o=t;a<o.length;a++){var s=o[a];i+=e.slice(r,s),r=s+1}return i}function It(e,t,n){for(var r=kt(n.split(``)),i;!(i=r()).done;){var a=i.value;if(e.slice(t+1).search(Mt)<0)return;t=e.search(Mt),e=e.replace(Mt,a)}return[e,t]}function Lt(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,a=n.getSeparatorAfterNationalPrefix;if(RegExp(`^(?:${t.pattern()})\$`).test(e.nationalSignificantNumber))return zt(e,t,{metadata:r,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:a})}function Rt(e,t,n){return _e(e,t,n)===`IS_POSSIBLE`}function zt(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,a=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var o=Bt(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:r});if(o)return o}return Bt(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:r})}function Bt(e,t,n){var r=n.metadata,i=n.useNationalPrefixFormattingRule,a=n.getSeparatorAfterNationalPrefix,o=re(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:r});if(i||(e.nationalPrefix?o=e.nationalPrefix+a(t)+o:e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix&&(o=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix+` `+o)),Vt(o,e))return o}function Vt(e,t){return se(e)===t.getNationalDigits()}function Ht(e){"@babel/helpers - typeof";return Ht=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ht(e)}function Ut(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Wt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Kt(r.key),r)}}function Gt(e,t,n){return t&&Wt(e.prototype,t),n&&Wt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kt(e){var t=qt(e,`string`);return Ht(t)==`symbol`?t:t+``}function qt(e,t){if(Ht(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Ht(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Jt=function(){function e(){Ut(this,e)}return Gt(e,[{key:`parse`,value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),this.context.length!==1)throw Error(`Non-finalized contexts left when pattern parse ended`);var t=this.context[0],n=t.branches,r=t.instructions;if(n)return{op:`|`,args:n.concat([Qt(r)])};if(r.length===0)throw Error(`Pattern is required`);return r.length===1?r[0]:r}},{key:`startContext`,value:function(e){this.context.push(e)}},{key:`endContext`,value:function(){this.context.pop()}},{key:`getContext`,value:function(){return this.context[this.context.length-1]}},{key:`parsePattern`,value:function(e){if(!e)throw Error(`Pattern is required`);var t=e.match(Zt);if(!t){if(Xt.test(e))throw Error(`Illegal characters found in a pattern: ${e}`);this.getContext().instructions=this.getContext().instructions.concat(e.split(``));return}var n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+n.length);switch(n){case`(?:`:r&&this.parsePattern(r),this.startContext({or:!0,instructions:[],branches:[]});break;case`)`:if(!this.getContext().or)throw Error(`")" operator must be preceded by "(?:" operator`);if(r&&this.parsePattern(r),this.getContext().instructions.length===0)throw Error(`No instructions foun
4d after "|" operator in an "or" group`);var a=this.getContext().branches;a.push(Qt(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:`|`,args:a});break;case`|`:if(!this.getContext().or)throw Error(`"|" operator can only be used inside "or" groups`);if(r&&this.parsePattern(r),!this.getContext().branches)if(this.context.length===1)this.getContext().branches=[];else throw Error(`"branches" not found in an "or" group context`);this.getContext().branches.push(Qt(this.getContext().instructions)),this.getContext().instructions=[];break;case`[`:r&&this.parsePattern(r),this.startContext({oneOfSet:!0});break;case`]`:if(!this.getContext().oneOfSet)throw Error(`"]" operator must be preceded by "[" operator`);this.endContext(),this.getContext().instructions.push({op:`[]`,args:Yt(r)});break;default:throw Error(`Unknown operator: ${n}`)}i&&this.parsePattern(i)}}])}();function Yt(e){for(var t=[],n=0;n<e.length;){if(e[n]===`-`){if(n===0||n===e.length-1)throw Error(`Couldn't parse a one-of set pattern: ${e}`);for(var r=e[n-1].charCodeAt(0)+1,i=e[n+1].charCodeAt(0)-1,a=r;a<=i;)t.push(String.fromCharCode(a)),a++}else t.push(e[n]);n++}return t}var Xt=/[\(\)\[\]\?\:\|]/,Zt=RegExp(`(\\||\\(\\?\\:|\\)|\\[|\\])`);function Qt(e){return e.length===1?e[0]:e}function $t(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=en(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
5In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function en(e,t){if(e){if(typeof e==`string`)return tn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tn(e,t):void 0}}function tn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nn(e){"@babel/helpers - typeof";return nn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nn(e)}function rn(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function an(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,sn(r.key),r)}}function on(e,t,n){return t&&an(e.prototype,t),n&&an(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sn(e){var t=cn(e,`string`);return nn(t)==`symbol`?t:t+``}function cn(e,t){if(nn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(nn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ln=function(){function e(t){rn(this,e),this.matchTree=new Jt().parse(t)}return on(e,[{key:`match`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).allowOverflow;if(!e)throw Error(`String is required`);var n=un(e.split(``),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!(n&&n.overflow&&!t))return n}}])}();function un(e,t,n){if(typeof t==`string`){var r=e.join(``);return t.indexOf(r)===0?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:r.indexOf(t)===0?n&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var i=e.slice(),a=0;a<t.length;){var o=t[a],s=un(i,o,n&&a===t.length-1);if(!s)return;if(s.overflow)return s;if(s.match){if(i=i.slice(s.matchedChars.length),i.length===0)return a===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0}}else if(s.partialMatch)return{partialMatch:!0};else throw Error(`Unsupported match result:
6${JSON.stringify(s,null,2)}`);a++}return n?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-i.length)}}switch(t.op){case`|`:for(var c,l=$t(t.args),u;!(u=l()).done;){var d=u.value,f=un(e,d,n);if(f){if(f.overflow)return f;if(f.match)return{match:!0,matchedChars:f.matchedChars};if(f.partialMatch)c=!0;else throw Error(`Unsupported match result:
7${JSON.stringify(f,null,2)}`)}}return c?{partialMatch:!0}:void 0;case`[]`:for(var p=$t(t.args),m;!(m=p()).done;){var h=m.value;if(e[0]===h)return e.length===1?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[h]}}return;default:throw Error(`Unsupported instruction tree: ${t}`)}}function dn(e){"@babel/helpers - typeof";return dn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},dn(e)}function fn(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=pn(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
8In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pn(e,t){if(e){if(typeof e==`string`)return mn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mn(e,t):void 0}}function mn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hn(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function gn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,vn(r.key),r)}}
8function _n(e,t,n){return t&&gn(e.prototype,t),n&&gn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function vn(e){var t=yn(e,`string`);return dn(t)==`symbol`?t:t+``}function yn(e,t){if(dn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(dn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var bn=`9`,xn=Nt(bn,15),Sn=/[- ]/,Cn=!0,wn=Cn&&function(){return/\[([^\[\]])*\]/g},Tn=Cn&&function(){return/\d(?=[^,}][^,}])/g},En=RegExp(`[`+Y+`]*\\$1[`+Y+`]*(\\$\\d[`+Y+`]*)*$`),Dn=3,On=function(){function e(t){t.state;var n=t.metadata;hn(this,e),this.metadata=n,this.resetFormat()}return _n(e,[{key:`resetFormat`,value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:`reset`,value:function(e,t){this.resetFormat(),e?(this.isNANP=e.callingCode()===`1`,this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:`format`,value:function(e,t){var n=this;if(Rt(t.nationalSignificantNumber,t.country,this.metadata))for(var r=fn(this.matchingFormats),i;!(i=r()).done;){var a=i.value,o=Lt(t,a,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=a,this.setNationalNumberTemplate(o.replace(/\d/g,`x`),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(`x`),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:`formatNationalNumberWithNextDigits`,value:function(e,t){var n=this.chosenFormat,r=this.chooseFormat(t);if(r)return r===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:`narrowDownMatchingFormats`,value:function(e){var t=this,n=e.nationalSignificantNumber,r=e.nationalPrefix,i=e.international,a=n,o=a.length-Dn;o<0&&(o=0),this.matchingFormats=this.matchingFormats.filter(function(e){return t.formatSuits(e,i,r)&&t.formatMatches(e,a,o)}),this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1&&this.resetFormat()}},{key:`formatSuits`,value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:`formatMatches`,value:function(e,t,n){var r=e.leadingDigitsPatterns().length;if(r===0)return!0;n=Math.min(n,r-1);var i=e.leadingDigitsPatterns()[n];if(t.length<Dn)try{return new ln(i).match(t,{allowOverflow:!0})!==void 0}catch(e){return console.error(e),!0}return RegExp(`^(${i})`).test(t)}},{key:`getFormatFormat`,value:function(e,t){return t?e.internationalFormat():e.format()}},{key:`chooseFormat`,value:function(e){for(var t=this,n=function(){var n=a.value;return t.chosenFormat===n?0:En.test(t.getFormatFormat(n,e.international))?t.createTemplateForFormat(n,e)?(t.chosenFormat=n,0):(t.matchingFormats=t.matchingFormats.filter(function(e){return e!==n}),1):1},r,i=fn(this.matchingFormats.slice()),a;!(a=i()).done&&(r=n(),r!==0););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:`createTemplateForFormat`,value:function(e,t){if(!(Cn&&e.pattern().indexOf(`|`)>=0)){var n=this.getTemplateForFormat(e,t);if(n)return this.setNationalNumberTemplate(n,t),!0}}},{key:`getSeparatorAfterNationalPrefix`,value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&Sn.test(e.nationalPrefixFormattingRule())?` `:``}},{key:`getInternationalPrefixBeforeCountryCallingCode`,value:function(e,t){var n=e.IDDPrefix,r=e.missingPlus;return n?t&&t.spacing===!1?n:n+` `:r?``:`+`}},{key:`getTemplate`,value:function(e){if(this.template){for(var t=-1,n=0,r=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):``;n<r.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(`x`,t+1),n++;return Pt(this.template,t+1)}}},{key:`setNationalNumberTemplate`,value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,`x`)+Nt(`x`,t.callingCode.length)+` `+e:this.template=e}},{key:`getTemplateForFormat`,value:function(e,t){var n=t.nationalSignificantNumber,r=t.international,i=t.nationalPrefix,a=t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,o=e.pattern();Cn&&(o=o.replace(wn(),`\\d`).replace(Tn(),`\\d`));var s=xn.match(o)[0];if(!(n.length>s.length)){var c=RegExp(`^`+o+`$`),l=n.replace(/\d/g,bn);c.test(l)&&(s=l);var u=this.getFormatFormat(e,r),d;if(this.shouldTryNationalPrefixFormattingRule(e,{international:r,nationalPrefix:i})){var f=u.replace(pe,e.nationalPrefixFormattingRule());if(se(e.nationalPrefixFormattingRule())===(i||``)+se(`$1`)&&(u=f,d=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,`x`),p--}var m=s.replace(new RegExp(o),u).replace(new RegExp(bn,`g`),`x`);return d||(a?m=Nt(`x`,a.length)+` `+m:i&&(m=Nt(`x`,i.length)+this.getSeparatorAfterNationalPrefix(e)+m)),r&&(m=ce(m)),m}}},{key:`formatNextNationalNumberDigits`,value:function(e){var t=It(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(!t){this.resetFormat();return}return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Pt(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1)}},{key:`shouldTryNationalPrefixFormattingRule`,value:function(e,t){var n=t.international,r=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&r||!i&&!n)return!0}}}])}();function kn(e){"@babel/helpers - typeof";return kn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},kn(e)}function An(e,t){return Fn(e)||Pn(e,t)||Mn(e,t)||jn()}
8function jn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
9In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mn(e,t){if(e){if(typeof e==`string`)return Nn(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nn(e,t):void 0}}function Nn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pn(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Fn(e){if(Array.isArray(e))return e}function In(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ln(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,zn(r.key),r)}}function Rn(e,t,n){return t&&Ln(e.prototype,t),n&&Ln(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function zn(e){var t=Bn(e,`string`);return kn(t)==`symbol`?t:t+``}function Bn(e,t){if(kn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(kn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Vn=`[`+Y+ne+`]+`,Hn=RegExp(`^`+Vn+`$`,`i`),Un=`(?:[`+ae+`][`+Y+ne+`]*|[`+Y+ne+`]+)`,Wn=RegExp(`[^`+Y+ne+`]+.*$`),Gn=/[^\d\[\]]/,Kn=function(){function e(t){var n=t.defaultCountry,r=t.defaultCallingCode,i=t.metadata,a=t.onNationalSignificantNumberChange;In(this,e),this.defaultCountry=n,this.defaultCallingCode=r,this.metadata=i,this.onNationalSignificantNumberChange=a}return Rn(e,[{key:`input`,value:function(e,t){var n=An(Yn(e),2),r=n[0],i=n[1],a=se(r),o;return i&&(t.digits||(t.startInternationalNumber(void 0,void 0),a||(o=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:o}}}
vendor: 4,195 bytes, line 9
9,{key:`inputDigits`,value:function(e,t){var n=t.digits,r=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),r&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),function(e){return t.update(e)})}},{key:`isWaitingForCountryCallingCode`,value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:`extractCountryCallingCode`,value:function(e){var t=me(`+`+e.getDigitsWithoutInternationalPrefix(),e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,r=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:r}),!0}},{key:`reset`,value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Gn.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:`extractNationalSignificantNumber`,value:function(e,t){if(this.hasSelectedNumberingPlan){var n=le(e,this.metadata),r=n.nationalPrefix,i=n.nationalNumber,a=n.carrierCode;if(i!==e)return this.onExtractedNationalNumber(r,a,i,e,t),!0}}},{key:`extractAnotherNationalSignificantNumber`,value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var r=le(e,this.metadata),i=r.nationalPrefix,a=r.nationalNumber,o=r.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,n),!0}}},{key:`onExtractedNationalNumber`,value:function(e,t,n,r,i){var a=!1,o,s=r.lastIndexOf(n);if(s<0||s!==r.length-n.length)a=!0;else{var c=r.slice(0,s);c&&c!==e&&(o=c)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberIsModified:a,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:`reExtractNationalSignificantNumber`,value:function(e){if(this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,function(t){return e.update(t)}))return!0;if(this.extractIddPrefix(e)||this.fixMissingPlus(e))return this.extractCallingCodeAndNationalSignificantNumber(e),!0}},{key:`extractIddPrefix`,value:function(e){var t=e.international,n=e.IDDPrefix,r=e.digits;if(e.nationalSignificantNumber,!(t||n)){var i=oe(r,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(i!==void 0&&i!==r)return e.update({IDDPrefix:r.slice(0,r.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0}}},{key:`fixMissingPlus`,value:function(e){if(!e.international){var t=ie(e.digits,e.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata).countryCallingCode;if(t)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:t}),!0}}},{key:`startInternationalNumber`,value:function(e,t){var n=t.country,r=t.callingCode;e.startInternationalNumber(n,r),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:`extractCallingCodeAndNationalSignificantNumber`,value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),function(t){return e.update(t)})}}])}();function qn(e){var t=e.search(Un);if(!(t<0)){e=e.slice(t);var n;return e[0]===`+`&&(n=!0,e=e.slice(1)),e=e.replace(Wn,``),n&&(e=`+`+e),e}}function Jn(e){var t=qn(e)||``;return t[0]===`+`?[t.slice(1),!0]:[t]}function Yn(e){var t=An(Jn(e),2),n=t[0],r=t[1];return Hn.test(n)||(n=``),[n,r]}function Xn(e){"@babel/helpers - typeof";return Xn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Xn(e)}function Zn(e,t){return nr(e)||tr(e,t)||$n(e,t)||Qn()}
9function Qn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
10In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $n(e,t){if(e){if(typeof e==`string`)return er(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}function er(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function nr(e){if(Array.isArray(e))return e}function rr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ir(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,or(r.key),r)}}function ar(e,t,n){return t&&ir(e.prototype,t),n&&ir(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function or(e){var t=sr(e,`string`);return Xn(t)==`symbol`?t:t+``}function sr(e,t){if(Xn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Xn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var cr=!1,lr=function(){function e(t,n){rr(this,e),this.metadata=new K(n);var r=Zn(this.getCountryAndCallingCode(t),2),i=r[0],a=r[1];this.defaultCountry=i,this.defaultCallingCode=a,this.reset()}return ar(e,[{key:`getCountryAndCallingCode`,value:function(e){var t,n;return e&&(W(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),n&&cr&&this.metadata.isNonGeographicCallingCode(n)&&(t=`001`),[t,n]}}
10,{key:`input`,value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput=`+`;else if(n){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var r;if(this.metadata.hasSelectedNumberingPlan()&&(r=this.formatter.format(n,this.state)),r===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(r=this.formatter.format(i,this.state))}this.formattedOutput=r?this.getFullNumber(r):this.getNonFormattedNumber()}return this.formattedOutput}},{key:`reset`,value:function(){var e=this;return this.state=new Ot({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new On({state:this.state,metadata:this.metadata}),this.parser=new Kn({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput=``,this}},{key:`isInternational`,value:function(){return this.state.international}},{key:`getCallingCode`,value:function(){if(this.isInternational())return this.state.callingCode}},{key:`getCountryCallingCode`,value:function(){return this.getCallingCode()}},{key:`getCountry`,value:function(){if(this.state.digits)return this._getCountry()}},{key:`_getCountry`,value:function(){var e=this.state.country;if(!(cr&&e===`001`))return e}},{key:`determineTheCountryIfNeeded`,value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:`getFullNumber`,value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},r=this.state.callingCode;return n(r?e?`${r} ${e}`:r:`${this.state.getDigitsWithoutInternationalPrefix()}`)}return e}},{key:`getNonFormattedNationalNumberWithPrefix`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,r=e.nationalPrefix,i=t,a=n||r;return a&&(i=a+i),i}},{key:`getNonFormattedNumber`,value:function(){var e=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(e?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{key:`getNonFormattedTemplate`,value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,`x`)}},{key:`isCountryCallingCodeAmbiguous`,value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:`determineTheCountry`,value:function(){this.state.setCountry(q(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,metadata:this.metadata}))}},{key:`getNumberValue`,value:function(){var e=this.state,t=e.digits,n=e.callingCode,r=e.country,i=e.nationalSignificantNumber;if(t){if(this.isInternational())return n?`+`+n+i:`+`+t;if(r||n)return`+`+(r?this.metadata.countryCallingCode():n)+i}}},{key:`getNumber`,value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,r=e.callingCode,i=this._getCountry();if(t&&!(!i&&!r)){if(i&&i===this.defaultCountry){var a=new K(this.metadata.metadata);a.selectNumberingPlan(i);var o=a.numberingPlan.callingCode(),s=this.metadata.getCountryCodesForCallingCode(o);if(s.length>1){var c=de(t,{countries:s,metadata:this.metadata.metadata});c&&(i=c)}}var l=new ue(i||r,t,this.metadata.metadata);return n&&(l.carrierCode=n),l}}},{key:`isPossible`,value:function(){var e=this.getNumber();return e?e.isPossible():!1}},{key:`isValid`,value:function(){var e=this.getNumber();return e?e.isValid():!1}},{key:`getNationalNumber`,value:function(){return this.state.nationalSignificantNumber}},{key:`getChars`,value:function(){return(this.state.international?`+`:``)+this.state.digits}},{key:`getTemplate`,value:function(){return this.formatter.getTemplate(this.state)||this.getNon
10FormattedTemplate()||``}}])}();function ur(){return U(xt,arguments)}function dr(e){return lr.call(this,e,he)}dr.prototype=Object.create(lr.prototype,{}),dr.prototype.constructor=dr;function fr(){return U(ge,arguments)}var Z=e(o(),1),Q=n();function pr(e){let t=e.inputType;return!t||t===`insertReplacementText`}var mr={name:`name`,first_name:`given-name`,last_name:`family-name`,organization:`organization`,line1:`address-line1`,line2:`address-line2`,city:`address-level2`,state:`address-level1`,postal_code:`postal-code`,country:`country`};function hr(e,t,n){if(t.startsWith(`custom:`))return n;let r=n??mr[t];return r?`${e===`shipping`?`shipping`:`billing`} ${r}`:void 0}function gr(e,t){return e?`h-full w-full min-w-0 border-0 bg-transparent text-2 text-gray-12 outline-none [color-scheme:normal] ${t?`placeholder:text-danger-9`:`placeholder:text-gray-9`} ${z(`AddressFieldInput`,`A text input in the address form`)}`:`box-border h-11 w-full rounded-lg border bg-transparent px-3 text-2 text-gray-12 outline-none transition-[box-shadow,border-color] [color-scheme:normal] placeholder:text-gray-9 focus:border-accent-a8 focus:shadow-[0_0_0_3px_var(--accent-a5)] ${z(`AddressFieldInput`,`A text input in the address form`)} ${t?`border-danger-9 ${z(`AddressFieldInputInvalid`,`Added to an address input while it fails validation`)}`:`border-stroke`}`}function _r(e){let t=`w-full min-w-0 appearance-none bg-transparent pr-6 text-2 text-gray-12 outline-none [color-scheme:normal] ${z(`AddressFieldSelect`,`A select (country, state, organization type) in the address form`)}`;return e?`h-full border-0 ${t}`:`box-border h-11 rounded-lg border border-stroke px-3 transition-[box-shadow,border-color] focus:border-accent-a8 focus:shadow-[0_0_0_3px_var(--accent-a5)] ${t}`}function vr(){return(0,Q.jsx)(`svg`,{"aria-hidden":`true`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,className:`text-gray-a10 pointer-events-none absolute top-1/2 right-3 -translate-y-1/2`,children:(0,Q.jsx)(`path`,{d:`M2.5 4.5L6 8l3.5-3.5`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function yr({compact:e,invalid:t,children:n}){return e?(0,Q.jsxs)(`span`,{className:D(`relative flex h-full w-full items-center`,t&&`text-danger-9`),children:[n,(0,Q.jsx)(vr,{})]}):(0,Q.jsxs)(`span`,{className:`relative flex w-full`,children:[n,(0,Q.jsx)(vr,{})]})}function br({compact:e,fieldKey:t,label:n,half:r,corner:i,error:a,errorId:o,children:s}){let c=_()(a===`card_number`?`BQ8s+Q`:a===`required`?`Seanpx`:`89T/ze`);return e?(0,Q.jsxs)(`div`,{"data-row":r?void 0:!0,className:D(`relative flex h-10 items-center bg-transparent px-3 transition-shadow focus-within:z-10 focus-within:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,i,r&&`min-w-0 flex-1`,r===`second`&&`border-stroke border-l`,z(`AddressField`,`One field cell in the address form`),a&&`z-[5] shadow-[inset_0_0_0_1px_var(--danger-9)]`,a&&z(`AddressFieldInvalid`,`Added to a compact field cell while it fails validation`)),"data-field":t,children:[s,a&&(0,Q.jsx)(`p`,{id:o,className:`sr-only`,children:c})]}):(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1`,r&&`min-w-0 flex-1`,z(`AddressField`,`One field cell in the address form`)),"data-field":t,children:[(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`AddressFieldLabel`,`Address field label in full layout`)),children:n}),s,a&&(0,Q.jsx)(`p`,{id:o,className:D(`text-1 text-danger-9`,z(`AddressFieldError`,`The error line under an address field (full layout)`)),children:c})]})}m();var xr={N:`name`,O:`organization`,A:`line1`,C:`city`,S:`state`,Z:`postal_code`,D:`dependent_locality`,X:`sorting_code`},Sr=[`province`,`state`,`county`,`area`,`emirate`,`island`,`parish`,`prefecture`,`oblast`,`department`,`do_si`],Cr=[`postal`,`zip`,`pin`,`eircode`],wr={AR:{zip:`\\d{4}|[A-HJ-NP-Z]\\d{4}([A-Z]{3})?`},HN:{sub_keys:`Atlántida~Choluteca~Colón~Comayagua~Copán~Cortés~El Paraíso~Francisco Morazán~Gracias a Dios~Intibucá~Islas de la Bahía~La Paz~Lempira~Ocotepeque~Olancho~Santa Bárbara~Valle~Yoro`,sub_names:`Atlántida~Choluteca~Colón~Comayagua~Copán~Cortés~El Paraíso~Francisco Morazán~Gracias a Dios~Intibucá~Islas de la Bahía~La Paz~Lempira~Ocotepeque~Olancho~Santa Bárbara~Valle~Yoro`},CR:{sub_keys:`Alajuela~Cartago~Guanacaste~Heredia~Limón~Puntarenas~San José`,sub_names:`Alajuela~Cartago~Guanacaste~Heredia~Limón~Puntarenas~San José`},UZ:{sub_keys:`Andijan Region~Bukhara Region~Fergana Region~Jizzakh Region~Namangan Region~Navoiy Region~Qashqadaryo Region~Karakalpakstan~Samarqand Region~Sirdaryo Region~Surxondaryo Region~Tashkent~Tashkent Region~Xorazm Region`,sub_names:`Andijan Region~Bukhara Region~Fergana Region~Jizzakh Region~Namangan Region~Navoiy Region~Qashqadaryo Region~Karakalpakstan~Samarqand Region~Sirdaryo Region~Surxondaryo Region~Tashkent~Tashkent Region~Xorazm Region`}};function Tr(e){let t=e?.trim().toUpperCase();return t&&/^[A-Z]{2}$/.test(t)?t:void 0}function Er(e){let t=e.sub_keys?.split(`~`)??[],n=e.sub_names?.split(`~`)??[],r=e.sub_lnames?.split(`~`)??[],i=e.sub_isoids?.split(`~`)??[],a=[];for(let e=0;e<t.length;e++){let o=t[e];
10o&&a.push({key:o,name:[n[e]||o,r[e]].filter(Boolean).join(` — `),iso:i[e]||void 0})}return a}function Dr(e,t){let n=Tr(e)??`ZZ`,r={...t,...wr[n]},i=r.lfmt??r.fmt,a=r.state_name_type&&Sr.includes(r.state_name_type)?r.state_name_type:`province`,o=r.zip_name_type&&Cr.includes(r.zip_name_type)?r.zip_name_type:`postal`;if(!i)return{country:n,fields:[{type:`line1`,required:!0,upper:!1},{type:`postal_code`,required:!1,upper:!1},{type:`city`,required:!1,upper:!1}],zipRegex:r.zip,stateOptions:[],stateLabel:a,postalLabel:o};let s=[];for(let e=0;e<i.length;e++){if(i[e]!==`%`)continue;e+=1;let t=i[e]??``,n=xr[t];!n||s.some(e=>e.type===n)||s.push({type:n,required:r.require?.includes(t)??!1,upper:r.upper?.includes(t)??!1,postalPlaceholder:n===`postal_code`?r.zipex?.split(`,`)[0]:void 0})}return{country:n,fields:s,zipRegex:r.zip,stateOptions:s.some(e=>e.type===`state`)?Er(r):[],stateLabel:a,postalLabel:o}}var Or=null;function kr(){return Or??=h(()=>import(`./country-data-DPZKAwpa.js`).then(e=>e.default),[])}function Ar(e,t){if(!e||!t)return!0;try{return RegExp(`^(?:${e})$`,`i`).test(t)}catch{return!0}}var jr={name:`name`,organization:`organization`,line1:`line1`,city:`city`,state:`state`,postal_code:`postal_code`};function Mr(e,t){let n={country:e.country},r=(e,t)=>{let r=t?.trim();r&&(n[e]=r)};r(`name`,t.name),r(`first_name`,t.first_name),r(`last_name`,t.last_name),r(`organization`,t.organization),r(`line1`,t.line1),r(`line2`,t.line2),r(`city`,t.city),r(`state`,t.state),r(`postal_code`,t.postal_code),n.organization&&(t.organization_type===`business`||t.organization_type===`individual`)&&(n.organization_type=t.organization_type);for(let t of e.fields){let e=t.upper?jr[t.type]:void 0,r=e?n[e]:void 0;e&&r&&(n[e]=r.toUpperCase())}return e.fields.some(e=>e.type===`name`&&e.upper)&&(n.first_name&&=n.first_name.toUpperCase(),n.last_name&&=n.last_name.toUpperCase()),n}var Nr={usd:`US`,gbp:`GB`,cad:`CA`,aud:`AU`,nzd:`NZ`,jpy:`JP`,brl:`BR`,mxn:`MX`,inr:`IN`,pln:`PL`,chf:`CH`,sek:`SE`,nok:`NO`,dkk:`DK`,czk:`CZ`,huf:`HU`,ron:`RO`,bgn:`BG`,try:`TR`,uah:`UA`,ils:`IL`,aed:`AE`,sar:`SA`,qar:`QA`,kwd:`KW`,zar:`ZA`,ngn:`NG`,kes:`KE`,egp:`EG`,mad:`MA`,sgd:`SG`,hkd:`HK`,twd:`TW`,krw:`KR`,thb:`TH`,php:`PH`,idr:`ID`,myr:`MY`,vnd:`VN`,pkr:`PK`,bdt:`BD`,lkr:`LK`,clp:`CL`,cop:`CO`,pen:`PE`,ars:`AR`,uyu:`UY`,isk:`IS`};function Pr(e){return e?Nr[e.toLowerCase()]:void 0}var Fr=[`name`,`first_name`,`last_name`,`organization`,`line1`,`line2`,`city`,`state`,`postal_code`];function Ir(e,t){let n=e.allowedCountries??[],r=n.map(e=>Tr(e)).filter(e=>!!e);if(n.length>0&&r.length===0)throw Error(`allowedCountries has no valid ISO2 entries (got ${JSON.stringify(n)}) — use two-letter codes like 'US'`);return r.length>0?r:t}function Lr(e,t){return e&&t.includes(e)?e:void 0}function Rr(e,t,n){let r=Ir(e,n),i=t.defaultValues?.address?.country,a=Lr(Tr(i),r),o=a??Lr(Tr(t.detectedCountry),r)??Lr(Tr(t.countryHint),r)??Lr(`US`,r)??r.at(0)??`US`,s=t.defaultValues?.address??{},c=i?.trim()&&!a?{}:s,l={},u=(e,t)=>{t?.trim()&&(l[e]=t)};u(`name`,t.defaultValues?.name??s.name),u(`first_name`,s.first_name),u(`last_name`,s.last_name),u(`organization`,s.organization),u(`line1`,c.line1),u(`line2`,c.line2),u(`city`,c.city),u(`state`,c.state),u(`postal_code`,c.postal_code);let d=!!(l.city||l.state||l.postal_code||l.line2);return{country:o,values:l,organizationType:s.organization_type??``,custom:{},revealed:e.scope===`minimal`||d,line2Open:e.line2===`always`||!!l.line2,selecting:!1,touched:{},showAllErrors:!1}}var zr=new Set([`city`,`state`,`postal_code`,`line2`]);function Br(e,t){switch(t.type){case`edit`:{let n={...e.values,[t.field]:t.value},r=!e.revealed&&zr.has(t.field)&&t.value.trim().length>0,i=!!t.autofilled&&t.value.trim().length>0,a=r||i;return{...e,values:n,revealed:e.revealed||a,line2Open:e.line2Open||a||t.field===`line2`&&t.value.trim().length>0,selecting:!1}}case`edit-custom`:return{...e,custom:{...e.custom,[t.key]:t.value}};case`set-organization-type`:return{...e,organizationType:t.value};case`set-country`:{let n=Tr(t.country);return!n||n===e.country?e:{...e,country:n,values:{...e.values,state:void 0},selecting:!1}}case`begin-select`:return{...e,selecting:!0};case`select-failed`:return{...e,selecting:!1};case`apply-place`:{let{parsed:n,allowed:r}=t;if(!Hr(r,n))return{...e,selecting:!1};let i={...e.values,line1:n.line1??e.values.line1,line2:n.line2??e.values.line2,city:n.city??``,state:n.state??``,postal_code:n.postal_code??``};return{...e,country:n.country??e.country,values:i,revealed:!0,line2Open:e.line2Open||!!n.line2,selecting:!1}}case`reveal`:{let n=e.line2Open||!!t.autofill;return e.revealed&&n===e.line2Open?e:{...e,revealed:!0,line2Open:n}}case`toggle-line2`:return{...e,line2Open:!e.line2Open};case`blur`:{let n={...e.touched,[t.field]:!0},r=t.field===`line1`&&!!e.values.line1?.trim();return{...e,touched:n,revealed:e.revealed||r}}case`show-errors`:return{...e,showAllErrors:!0};default:return e}}function Vr(e,t){return e.allowedCountries?.length?Ir(e,t):[]}function Hr(e,t){return e.length===0?!0:!!(t.country&&e.includes(t.country))}var Ur=new Set([`line1`,`city`,`state`,`postal_code`]);function Wr(e,t){let n=new Set((e.requiredFloor??[]).filter(e=>e!==`country`)),r=new Set([`country`]),i=[],a=e=>t.fields.some(t=>t.type===e),o=e=>t.fields.some(t=>t.type===e&&t.required),s=t=>e.scope===`minimal`?n.has(t):a(t)||n.has(t),c=[];for(let e of t.fields)(e.type===`line1`||e.type===`city`||e.type===`state`||e.type===`postal_code`)&&c.push(e.type);for(let e of[`line1`,`city`,`state`,`postal_code`])c.includes(e)||c.push(e);for(let e of c)s(e)&&i.push(e);for(let t of i)(e.scope===`minimal`||o(t)||n.has(t))&&r.add(t);e.scope===`full`&&i.includes(`line1`)&&r.add(`line1`),e.name===`combined`&&r.add(`name`),e.name===`split`&&(r.add(`first_name`),r.add(`last_name`)),e.name===`none`&&n.has(`name`)&&r.add(`name`),e.organization!==`none`&&n.has(`organization`)&&r.add(`organization`);for(let t of e.customFields??[])t.required&&r.add(`custom:${t.key}`);return{gridFields:i,required:r}}var Gr=320,Kr=new Map;function qr(e){let t=Kr.get(e);if(t===void 0){try{t=new RegExp(e)}catch{t=null}Kr.set(e,t)}return t}function Jr(e,t){return!e.format||!t?!0:t.length>Gr?!1:qr(e.format)?.test(t)??!0}function Yr(e,t,n){let r=Wr(e,t),i={},a=e=>!!n.values[e]?.trim();for(let e of r.required)if(e!==`country`){if(e.startsWith(`custom:`)){n.custom[e.slice(7)]?.trim()||(i[e]=`required`);continue}Ur.has(e)&&!r.gridFields.includes(e)||a(e)||(i[e]=`required`)}let o=n.values.postal_code?.trim()??``;r.gridFields.includes(`postal_code`)&&o&&!Ar(t.zipRegex,o)&&(i.postal_code=`invalid`);for(let t of e.customFields??[]){let e=`custom:${t.key}`;if(i[e])continue;let r=n.custom[t.key]?.trim()??``;
10r&&!Jr(t,r)&&(i[e]=`invalid`)}let s=new Set([...r.gridFields,...r.required]);e.organization!==`none`&&s.add(`organization`),r.gridFields.includes(`line1`)&&e.line2!==`never`&&s.add(`line2`);for(let e of Fr)s.has(e)&&Ce(n.values[e])&&(i[e]=`card_number`);return{errors:i,complete:Object.keys(i).length===0}}function Xr(e){let t=e.filter(e=>e!==`line1`),n=t.filter(e=>e!==`state`),r=[];return n.length>0&&r.push(n),t.includes(`state`)&&r.push([`state`]),r}var Zr={solo:`rounded-t-[7px]`,first:`rounded-tl-[7px]`,last:`rounded-tr-[7px]`},Qr={solo:`rounded-b-[7px]`,first:`rounded-bl-[7px]`,last:`rounded-br-[7px]`};function $r(e,t,n){let r=t=>(e.customFields??[]).filter(e=>e.position===t).map(e=>[`custom:${e.key}`]),i=[];e.name===`split`?i.push([`first_name`,`last_name`]):e.name===`combined`&&i.push([`name`]),i.push(...r(`after_name`)),e.organization===`name_with_type`?i.push([`organization`,`organization_type`]):e.organization===`name`&&i.push([`organization`]),i.push(...r(`after_organization`),...r(`before_country`)),i.push([`country`]),t.includes(`line1`)&&i.push([`line1`]),n.revealed&&(n.line2&&i.push([`line2`]),i.push(...Xr(t),...r(`after_address`)));let a={},o=(e,t)=>{e?.forEach((n,r)=>{let i=e.length===1?t.solo:r===0?t.first:t.last;a[n]=a[n]?`${a[n]} ${i}`:i})};return o(i[0],Zr),o(i[i.length-1],Qr),a}function ei(e,t,n){let r=Yr(e,t,n),i={};for(let t of e.customFields??[]){let e=n.custom[t.key]?.trim();e&&(i[t.key]=e)}let a=new Set(Wr(e,t).gridFields),o={...n.values};for(let e of Fr)Ce(o[e])&&(o[e]=``);return{complete:r.complete,address:Mr(t,{name:e.name===`combined`?o.name:void 0,first_name:e.name===`split`?o.first_name:void 0,last_name:e.name===`split`?o.last_name:void 0,organization:e.organization===`none`?void 0:o.organization,organization_type:e.organization===`name_with_type`?n.organizationType:``,line1:a.has(`line1`)?o.line1:void 0,line2:a.has(`line1`)&&e.line2!==`never`?o.line2:void 0,city:a.has(`city`)?o.city:void 0,state:a.has(`state`)?o.state:void 0,postal_code:a.has(`postal_code`)?o.postal_code:void 0}),custom:i,errors:r.errors}}function ti({value:e}){if(!e.text)return null;if(e.matches.length===0)return e.text;let t=[],n=0;for(let[r,{start:i,end:a}]of e.matches.entries())i>n&&t.push((0,Q.jsx)(Z.Fragment,{children:e.text.slice(n,i)},`plain-${r}`)),t.push((0,Q.jsx)(s,{weight:`semi-bold`,children:e.text.slice(i,a)},`match-${r}`)),n=Math.max(n,a);return n<e.text.length&&t.push((0,Q.jsx)(Z.Fragment,{children:e.text.slice(n)},`tail`)),t}var ni=(0,Z.createContext)(null);function ri(e){let t=_(),n=e.predictions.length;return(0,Q.jsxs)(u,{className:`flex flex-col`,children:[(0,Q.jsx)(`div`,{className:`flex items-center p-1`,children:(0,Q.jsx)(s,{size:`1`,weight:`regular`,className:`text-gray-11 ml-1`,children:t(`Hj98I7`)})}),(0,Q.jsxs)(`div`,{id:e.listboxId,role:`listbox`,"aria-label":t(`P/qObk`),className:`flex max-h-64 flex-col overflow-y-auto`,children:[e.predictions.length===0&&!e.searching&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(i,{orientation:`horizontal`,className:`bg-gray-a3 w-full`}),(0,Q.jsx)(s,{size:`2`,weight:`regular`,className:D(`text-gray-11 border-l-4 border-transparent p-1 leading-1`,z(`AddressSuggestionsEmpty`,`The quiet line shown when the query settled with no address matches`)),children:t(`KeJh7y`)})]}),e.predictions.map((t,n)=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(i,{orientation:`horizontal`,className:`bg-gray-a3 w-full`}),(0,Q.jsxs)(`button`,{type:`button`,id:e.listboxId?`${e.listboxId}-${n}`:void 0,role:`option`,"aria-selected":n===e.highlightedIndex,tabIndex:-1,onPointerDown:n=>{n.preventDefault(),e.onPick(t.id)},onPointerMove:()=>e.onHover?.(n),className:D(`hover:bg-gray-a3 cursor-pointer gap-2 border-l-4 border-transparent p-1 text-left leading-1`,z(`AddressSuggestion`,`One suggestion row in the autocomplete overlay`),n===e.highlightedIndex&&`border-accent-11 bg-gray-a4 ${z(`AddressSuggestionActive`,`Added to the keyboard/pointer-active suggestion row`)}`),children:[(0,Q.jsx)(s,{size:`2`,weight:`regular`,children:(0,Q.jsx)(ti,{value:t.main})}),t.secondary.text&&(0,Q.jsx)(s,{size:`1`,weight:`regular`,className:`text-gray-11 ml-2`,children:(0,Q.jsx)(ti,{value:t.secondary})})]})]},t.id)),(0,Q.jsx)(i,{orientation:`horizontal`,className:`bg-gray-a3 w-full`}),(0,Q.jsx)(`button`,{type:`button`,id:e.listboxId?`${e.listboxId}-${n}`:void 0,role:`option`,"aria-selected":n===e.highlightedIndex,tabIndex:-1,onPointerDown:t=>{t.preventDefault(),e.onManual()},onPointerMove:()=>e.onHover?.(n),className:D(`hover:bg-gray-a3 cursor-pointer border-l-4 border-transparent p-1 text-left leading-1`,z(`AddressSuggestionManual`,`The "Enter address manually" row closing the suggestions list`),n===e.highlightedIndex&&`border-accent-11 bg-gray-a4 ${z(`AddressSuggestionActive`,`Added to the keyboard/pointer-active suggestion row`)}
10`),children:(0,Q.jsx)(s,{size:`2`,weight:`regular`,className:`text-gray-11`,children:t(`29cqvH`)})})]})]})}m();var ii=`AIzaSyCD4btKc3S75LMZq2qBr1cJPKQTc35p4BY`;async function ai(){let{importLibrary:e,setOptions:t}=await h(async()=>{let{importLibrary:e,setOptions:t}=await import(`./dist-DdD6YUhM.js`);return{importLibrary:e,setOptions:t}},[]);return t({key:ii,v:`weekly`}),await e(`places`)}var oi=ai,si=null;function ci(){return si??=oi()}async function li(e=1500){try{let t=await fetch(`/cdn-cgi/trace`,{signal:AbortSignal.timeout(e)});if(!t.ok)return;let n=await t.text();return Tr(/(?:^|\n)loc=([A-Za-z]{2})/.exec(n)?.[1])}catch{return}}function ui(e,t){return e.addressComponents?.find(e=>e.types.includes(t))?.longText??``}function di(e,t){return e.addressComponents?.find(e=>e.types.includes(t))?.shortText??``}function fi(e){if(e)try{return new DOMParser().parseFromString(e,`text/html`).querySelector(`.street-address`)?.textContent.trim()||void 0}catch{return}}function pi(e){if(!e)return;let t=e.indexOf(`,`);return(t>=0?e.slice(0,t):e).replace(/\s+/g,` `).trim()||void 0}var mi=new Set([`US`,`CA`,`GB`,`IE`,`AU`,`NZ`,`IN`,`PH`,`MY`,`SG`,`ZA`]);function hi(e){let t=ui(e,`route`),n=ui(e,`street_number`);if(!t&&!n)return;let r=Tr(di(e,`country`));return(r&&mi.has(r)?[n,t]:[t,n]).filter(Boolean).join(` `).trim()||void 0}function gi(e){if(!e.addressComponents)throw Error(`Missing addressComponents on Place`);return{line1:fi(e.adrFormatAddress??void 0)??pi(e.formattedAddress??void 0)??hi(e),line2:ui(e,`subpremise`)||ui(e,`floor`)||void 0,city:ui(e,`locality`)||ui(e,`postal_town`)||ui(e,`sublocality`)||void 0,state:di(e,`administrative_area_level_1`)||ui(e,`administrative_area_level_1`)||void 0,postal_code:ui(e,`postal_code`)||void 0,country:Tr(di(e,`country`))}}var _i=[`adrFormatAddress`,`formattedAddress`,`addressComponents`];async function vi(e){let t=_i.filter(t=>e[t]===void 0||e[t]===null);if(t.length===0)return e;let{place:n}=await e.fetchFields({fields:[...t]});return n}function yi(e){let t=e?.text??``;return{text:t,matches:(e?.matches??[]).map(e=>({start:Math.max(0,Math.min(t.length,e.startOffset??0)),end:Math.max(0,Math.min(t.length,e.endOffset))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start)}}function bi(e){let t=(0,Z.useId)(),[n,r]=(0,Z.useState)(!1),i=(0,Z.useCallback)(()=>r(!0),[]),a=(0,Z.useRef)(null),o=(0,Z.useRef)(new Map),[s,c]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=setTimeout(()=>c(e.query),50);return()=>clearTimeout(t)},[e.query]);let l=p({queryKey:[`address-places-lib`],enabled:e.enabled&&(n||e.query.trim().length>0),staleTime:1/0,gcTime:1/0,retry:!1,queryFn:()=>ci()}),u=l.isError?`unavailable`:l.data?`ready`:`pending`,d=Tr(e.country),f=Ce(e.query)||Ce(s),m=f?``:s.trim(),h=p({queryKey:[`address-autocomplete`,t,m,d??``],enabled:e.enabled&&u===`ready`&&m.length>=3,staleTime:0,gcTime:0,placeholderData:(e,t)=>t?.queryKey[3]===(d??``)?e:void 0,retry:(e,t)=>e<2&&!/INVALID_REQUEST|ZERO_RESULTS/.test(String(t)),queryFn:async()=>{let e=await ci();a.current??=Promise.resolve(new e.AutocompleteSessionToken);let t={input:m,sessionToken:await a.current,...d?{region:d.toLowerCase(),includedRegionCodes:[d.toLowerCase()]}:{}},{suggestions:n}=await e.AutocompleteSuggestion.fetchAutocompleteSuggestions(t),r=n.filter(e=>e.placePrediction?.placeId).slice(0,5);for(let e of r)o.current.set(e.placePrediction.placeId,e.placePrediction);return r.map(e=>{let t=e.placePrediction;return{id:t.placeId,main:yi(t.mainText??t.text),secondary:yi(t.secondaryText)}})}}),g=(0,Z.useCallback)(async e=>{let t=o.current.get(e);if(!t)throw Error(`Unknown address suggestion`);try{return gi(await vi(t.toPlace()))}finally{a.current=null}},[]),_=e.enabled&&!f&&u!==`unavailable`&&e.query.trim().length>=3&&(u===`pending`||e.query!==s||h.isFetching);return{status:u,predictions:f?[]:h.data??[],searching:_,warm:i,resolve:g}}var xi=B(`address-line1-field`).internal().doc(`The street-address entry cell of the address unit: a combobox whose box opens whenever the user is typing an address — Google Places predictions when available, a quiet no-matches line otherwise, and "Enter address manually" always last. With a suggestions bridge in scope the list rides a controller-driven anchored overlay beside the field — zero reserved layout; without one it falls back to an in-document popover. Owns the live Places session; only the parsed address rides up as an internal event. Composed in-process by the address element, never minted by a consumer.`).props(e=>({corner:e.default(``).doc(`The compact group’s corner-radius classes for this cell, assigned by the layout that orders the rows.`),form:e.fromController().doc(`The projected form facts — value, country biasing, allowed countries, layout — injected by the address-form unit.`)})).events(e=>({input:e.internal().analytics(`autofilled`).doc("An edit landed in line 1; `autofilled` = the inputType-less/insertReplacementText engine shape (reveals instead of opening suggestions)."),blur:e.internal().doc(`Line 1 lost focus — blur-with-content is a manual reveal rail.`),reveal:e.internal().doc(`Enter with content and no open suggestion, a manual-entry pick, or a suggestions dismissal with content (Escape / outside press) — the manual reveal rail.`),toggleLine2:e.internal().doc(`The compact in-row "Line 2" text button was pressed.`),placeStart:e.internal().doc("A suggestion was chosen — resolution started (the unit enters `selecting`)."),placeSelected:e.internal().doc(`The chosen place resolved and parsed — the unit distributes it across the fields in one commit. Never emitted for a place outside allowedCountries (the choose declines the apply instead).`),placeFailed:e.internal().doc(`The chosen place failed to resolve — the unit leaves the form as typed.`)})).render(()=>{"use embed";return(0,Q.jsx)(Si,{})});function Si(){let{props:e,emit:t}=P(),n=_(),r=(0,Z.useContext)(ni),i=(0,Z.useId)(),o=(0,Z.useId)(),[s,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(null),m=(0,Z.useRef)(null),h=(0,Z.useRef)(null),g=(0,Z.useRef)(0),v=e.form,y=(0,Z.useRef)(v);y.current=v;let b=v?.values.line1??``,[x,S]=(0,Z.useState)(b),[C,w]=(0,Z.useState)(v?v.fillSeq:null);v&&v.fillSeq!==C&&(w(v.fillSeq),g.current+=1,x!==b&&S(b));let T=bi({query:x,country:v?.country,enabled:!!v?.autocomplete&&u}),E=!!v?.autocomplete&&r?.suspended!==!0&&s&&u&&!v?.selecting&&x.trim().length>=3,O=T.predictions,k=O.length+1,A=f===null?O.length>0?0:-1:f.kind===`manual`?O.length:O.findIndex(e=>e.id===f.id),j=e=>{let t=e<O.length?O[e]:void 0;
10return t?{kind:`place`,id:t.id}:{kind:`manual`}},M=()=>{d(!1),t(`reveal`,{})},N=()=>{x.trim()?M():d(!1)},ee=async e=>{let n=++g.current;d(!1),t(`placeStart`,{});try{let r=await T.resolve(e);if(n!==g.current)return;if(!Hr(y.current?.placeAllowList??v?.placeAllowList??[],r)){d(!0),t(`placeFailed`,{});return}t(`placeSelected`,{parsed:r})}catch{if(n!==g.current)return;d(!0),t(`placeFailed`,{})}},F=(0,Z.useRef)(``),I=r?.publish,L=r?.suspended===!0,R=T.searching;(0,Z.useEffect)(()=>{if(!I)return;if(L){F.current!==``&&(F.current=``,I({open:!1,predictions:[],highlightedIndex:0,searching:!1}));return}let e={open:E,predictions:O,highlightedIndex:A,searching:R},t=JSON.stringify(e);t!==F.current&&(F.current=t,I(e))},[I,L,E,O,A,R]);let B=(0,Z.useRef)(null);if((0,Z.useEffect)(()=>{if(!r||r.suspended){B.current=null;return}let e={pick:r.pick?.nonce??0,manual:r.manualNonce,dismiss:r.dismissNonce,hover:r.hover?.nonce??0},t=B.current;B.current=e,t&&(r.pick&&e.pick!==t.pick&&ee(r.pick.id),e.manual!==t.manual&&M(),e.dismiss!==t.dismiss&&N(),r.hover&&e.hover!==t.hover&&p(j(r.hover.index)))},[r]),!v)return null;let V=v.compact,H=v.errors.line1,te=!!H,U=`${o}line1-error`,W=n(`e6Ph5+`),ne=(0,Q.jsxs)(`div`,{className:`relative`,ref:r?r.anchorRef:h,children:[(0,Q.jsx)(br,{compact:V,fieldKey:`line1`,label:W,corner:e.corner,error:H,errorId:U,children:(0,Q.jsx)(`input`,{ref:m,type:`text`,role:`combobox`,"aria-expanded":E,"aria-controls":r?void 0:i,"aria-autocomplete":`list`,"aria-activedescendant":!r&&E&&A>=0?`${i}-${A}`:void 0,"aria-label":W,"aria-invalid":te||void 0,"aria-describedby":te?U:void 0,value:x,placeholder:V?W:void 0,autoComplete:hr(v.mode,`line1`),name:`line1`,"data-address-field":`line1`,onFocus:()=>{l(!0),v.autocomplete&&T.warm()},onBlur:()=>{l(!1),t(`blur`,{})},onChange:e=>{let n=pr(e.nativeEvent);n?d(!1):(d(!0),p(null)),g.current+=1,S(e.target.value),t(`input`,{value:e.target.value,autofilled:n})},onKeyDown:e=>{e.key===`ArrowDown`&&E?(e.preventDefault(),p(j(Math.min(A+1,k-1)))):e.key===`ArrowUp`&&E?(e.preventDefault(),p(j(Math.max(A-1,0)))):e.key===`Enter`?E&&A>=0&&A<O.length&&O[A]?(e.preventDefault(),ee(O[A].id)):(E&&A===O.length||x.trim())&&(e.preventDefault(),M()):e.key===`Escape`&&E&&N()},className:gr(V,te)})}),V&&v.line2Mode===`toggle`&&!v.line2Open&&!!x.trim()&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(`toggleLine2`,{}),className:D(`text-1 text-accent-a11 hover:text-accent-12 absolute top-1/2 right-2 -translate-y-1/2 rounded-md bg-transparent px-1.5 py-0.5 font-medium`,z(`AddressLine2Toggle`,`Collapsed address line 2 toggle`)),children:n(`MnZ3r0`)})]});return r?ne:(0,Q.jsxs)(Q.Fragment,{children:[ne,(0,Q.jsx)(a,{open:E,onOpenChange:e=>{if(e)return;let t=m.current;t&&t.ownerDocument.activeElement===t||N()},children:(0,Q.jsx)(c,{anchor:h,variant:`solid`,side:`bottom`,sideOffset:2,initialFocus:!1,finalFocus:!1,className:D(`w-full max-w-[var(--anchor-width)] rounded-lg`,z(`AddressSuggestions`,`The autocomplete suggestions overlay anchored to the address line 1 field`)),children:(0,Q.jsx)(ri,{predictions:T.predictions,highlightedIndex:A,searching:T.searching,listboxId:i,onPick:e=>void ee(e),onManual:M,onHover:e=>p(j(e))})})})]})}function Ci(e,t,n){let r=Dr(n.country,t[n.country]),i=Yr(e,r,n),a={};for(let[e,t]of Object.entries(i.errors))t&&(n.showAllErrors||n.touched[e])&&(a[e]=t);return{compact:e.layout===`compact`,mode:e.mode,country:n.country,values:n.values,custom:n.custom,organizationType:n.organizationType,errors:a,revealed:n.revealed||e.scope===`minimal`,selecting:n.selecting,line2Open:n.line2Open,line2Mode:e.line2,autocomplete:e.autocomplete,allowedCountries:Ir(e,Object.keys(t)),placeAllowList:Vr(e,Object.keys(t)),stateOptions:r.stateOptions,fillSeq:n.fillSeq}}function wi(e,t){return t===`country`?e.country:t===`organization_type`?e.organizationType:t.startsWith(`custom:`)?e.custom[t.slice(7)]??``:e.values[t]??``}var Ti=B(`address-select-field`).internal().doc(`A generic select cell of the address unit — the country select, the subdivision (state) select, the organization-type select, and custom selects, one element by input kind. Composed in-process by the address element, never minted by a consumer.`).props(e=>
10({field:e.default(``).analytics().doc("The unit value key this cell edits: `country`, `state`, `organization_type`, or `custom:<key>` — it also decides the select family (options, value mapping, advertised attributes)."),label:e.default(``).doc(`The visible label (full layout) / first-option placeholder (compact layout).`),half:e.default(void 0).doc(`Two-column row position when the cell shares a row; undefined = full-width.`),corner:e.default(``).doc(`The compact group’s corner-radius classes for this cell, assigned by the layout that orders the rows.`),options:e.default([]).doc(`A custom select’s authored option list.`),revealGated:e.default(!1).doc(`The cell lives in the collapsed grid: disabled until the unit reveals it (Chrome fills hidden selects despite skipping hidden inputs).`),form:e.fromController().doc(`The projected form facts — value, options, visible error, layout — injected by the address-form unit.`)})).events(e=>({input:e.internal().analytics(`field`).doc(`A selection landed in this cell.`),blur:e.internal().analytics(`field`).doc(`The cell lost focus — the unit marks it touched (state and custom selects only).`)})).contributes(e=>({focus:e.required().doc(`Focus the live select — the unit’s focus routing after a resolved place lands here.`),commit:e.required().doc(`Read the control’s live DOM value — the unit’s autofill/focus machinery must see engine-written values the controller state may not hold yet.`)})).actions(e=>({focus:e.controllerOnly(async e=>{"use embed";await e.contributions.focus()}).doc(`Focus this cell’s select, via its render-tree contribution.`),commit:e.controllerOnly(async e=>{"use embed";return await e.contributions.commit()}).doc(`Report this cell’s field key and live DOM value, via its render-tree contribution.`)})).render(()=>{"use embed";return(0,Q.jsx)(ki,{})});function Ei(e){return e===`country`?`country`:e===`state`?`state`:e===`organization_type`?`organization-type`:`custom`}function Di(e,t){if(!t)return``;let n=t.trim().toLowerCase(),r=e.find(e=>e.key.toLowerCase()===n||e.iso?.toLowerCase()===n||e.name.toLowerCase()===n);return r?r.iso??r.key:``}function Oi({codes:e,locale:t}){return(0,Q.jsx)(Q.Fragment,{children:(0,Z.useMemo)(()=>{let n;try{n=new Intl.DisplayNames([t],{type:`region`})}catch{n=void 0}return e.map(e=>{let t=n?.of(e)??e;return{code:e,label:t===e?e:t}}).sort((e,n)=>e.label.localeCompare(n.label,t))},[e,t]).map(e=>(0,Q.jsx)(`option`,{value:e.code,children:e.label},e.code))})}function ki(){let{props:e,emit:t}=P(),n=_(),r=g(),i=(0,Z.useRef)(null),a=(0,Z.useId)(),o=e.form,s=Ei(e.field),c=o?s===`state`?Di(o.stateOptions,o.values.state):wi(o,e.field):``,[l,u]=(0,Z.useState)(c),[d,f]=(0,Z.useState)(o?o.fillSeq:null);o&&o.fillSeq!==d&&(f(o.fillSeq),l!==c&&u(c));let p=s===`state`&&o?o.values.state??``:``,m=s===`state`&&o?Di(o.stateOptions,p):``;if((0,Z.useEffect)(()=>{!p||!m||m===p||t(`input`,{field:`state`,value:m})},[p,m,t]),N(Ti,`focus`,()=>i.current?.focus(),!0),N(Ti,`commit`,()=>({field:e.field,value:i.current?.value??l}),!0),!o)return null;let h=o.compact,v=s===`state`||s===`custom`,y=v?o.errors[e.field]:void 0,b=!!y,x=`${a}${e.field}-error`,S=e.revealGated&&!o.revealed,C=n=>{u(n),t(`input`,{field:e.field,value:n})};return(0,Q.jsx)(br,{compact:h,fieldKey:e.field,label:e.label,half:e.half,corner:e.corner,error:y,errorId:x,children:(0,Q.jsx)(yr,{compact:h,invalid:b,children:(0,Q.jsx)(`select`,{value:l,"aria-label":e.label,"aria-invalid":b||void 0,"aria-describedby":b?x:void 0,autoComplete:s===`country`||s===`state`?hr(o.mode,e.field):void 0,name:s===`country`||s===`state`?e.field:void 0,"data-address-field":s===`country`||s===`state`?e.field:void 0,disabled:S||void 0,ref:i,onChange:e=>C(e.target.value),onBlur:v?()=>t(`blur`,{field:e.field}):void 0,className:_r(h),children:s===`country`?(0,Q.jsx)(Oi,{codes:o.allowedCountries,locale:r}):s===`state`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:e.label}),o.stateOptions.map(e=>(0,Q.jsx)(`option`,{value:e.iso??e.key,children:e.name},e.key))]}):s===`organization-type`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`option`,{value:``,children:n(`aVwI1J`)}),(0,Q.jsx)(`option`,{value:`business`,children:n(`w1Fanr`)}),(0,Q.jsx)(`option`,{value:`individual`,children:n(`IgB6GU`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:e.label}),e.options.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})})})})}var Ai=B(`address-text-field`).internal().doc(`A generic text cell of the address unit — name/organization/street/city/postal cells plus custom text, phone, and date fields, one element by input kind. Composed in-process by the address element, never minted by a consumer. Controlled by the unit controller: edits ride internal events up; the value and per-cell facts project back down.`).props(e=>
10({field:e.default(``).analytics().doc("The unit value key this cell edits: `name`, `city`, `postal_code`, … or `custom:<key>`."),label:e.default(``).doc(`The visible label (full layout) / placeholder fallback (compact layout).`),half:e.default(void 0).doc(`Two-column row position when the cell shares a row; undefined = full-width.`),corner:e.default(``).doc(`The compact group’s corner-radius classes for this cell, assigned by the layout that orders the rows.`),placeholder:e.default(void 0).doc(`Placeholder override (the postal example code).`),inputKind:e.default(`text`).analytics().doc(`The DOM input type family.`),autocompleteOverride:e.default(void 0).doc(`A custom field’s authored autocomplete attribute — advertised raw, never mode-prefixed.`),revealGated:e.default(!1).doc(`The cell lives in the collapsed grid: disabled until the unit reveals it, so a first-pass browser fill cannot half-land inside the grid and truncate its own refill.`),form:e.fromController().doc(`The projected form facts — value, visible error, layout — injected by the address-form unit.`)})).events(e=>({input:e.internal().analytics(`field`,`autofilled`).doc("An edit landed in this cell; `autofilled` = the inputType-less/insertReplacementText engine shape."),blur:e.internal().analytics(`field`).doc(`The cell lost focus — the unit marks it touched.`)})).contributes(e=>({focus:e.required().doc(`Focus the live input — the unit’s focus routing after a resolved place lands here.`),commit:e.required().doc(`Read the control’s live DOM value — the unit’s autofill/focus machinery must see engine-written values the controller state may not hold yet.`)})).actions(e=>({focus:e.controllerOnly(async e=>{"use embed";await e.contributions.focus()}).doc(`Focus this cell’s input, via its render-tree contribution.`),commit:e.controllerOnly(async e=>{"use embed";return await e.contributions.commit()}).doc(`Report this cell’s field key and live DOM value, via its render-tree contribution.`)})).render(()=>{"use embed";return(0,Q.jsx)(ji,{})});function ji(){let{props:e,emit:t}=P(),n=e.form,r=(0,Z.useRef)(null),i=(0,Z.useId)(),a=n?wi(n,e.field):``,[o,s]=(0,Z.useState)(a),[c,l]=(0,Z.useState)(n?n.fillSeq:null);if(n&&n.fillSeq!==c&&(l(n.fillSeq),o!==a&&s(a)),N(Ai,`focus`,()=>r.current?.focus(),!0),N(Ai,`commit`,()=>({field:e.field,value:r.current?.value??o}),!0),!n)return null;let u=n.compact,d=n.errors[e.field],f=!!d,p=`${i}${e.field}-error`,m=e.field.startsWith(`custom:`),h=e.revealGated&&!n.revealed;return(0,Q.jsx)(br,{compact:u,fieldKey:e.field,label:e.label,half:e.half,corner:e.corner,error:d,errorId:p,children:(0,Q.jsx)(`input`,{type:e.inputKind===`date`?`date`:e.inputKind===`phone`?`tel`:`text`,inputMode:e.inputKind===`phone`?`tel`:void 0,value:o,placeholder:u?e.placeholder??e.label:e.placeholder,"aria-label":e.label,"aria-invalid":f||void 0,"aria-describedby":f?p:void 0,autoComplete:hr(n.mode,e.field,e.autocompleteOverride),name:m?e.field.slice(7):e.field,"data-address-field":m?void 0:e.field,disabled:h||void 0,ref:r,onChange:n=>{s(n.target.value),t(`input`,{field:e.field,value:n.target.value,autofilled:pr(n.nativeEvent)})},onBlur:()=>t(`blur`,{field:e.field}),className:gr(u,f)})})}var Mi={mode:`billing`,layout:`full`,scope:`full`,name:`combined`,organization:`none`,line2:`always`,autocomplete:!0};function $(e,t,n){let r=e.state,i=Br(r,t);i!==r&&e.setState({...i,fillSeq:n?.distribute?r.fillSeq+1:r.fillSeq,placeSeq:n?.placed?r.placeSeq+1:r.placeSeq})}var Ni=I(`address-form`).doc(`The address unit: per-country field plan, controller-owned values, reveal/autofill state, and central validation. Inlined-only — it ships inside the address element and is never mintable by a consumer.`).props(e=>({config:e.default(Mi).doc(`The resolved form configuration — mapped once from the address element’s consumer props.`),catalog:e.default({}).doc(`The whole libaddressinput country catalog — loaded by the element before the unit mounts, so country switches stay synchronous.`),seed:e.default({}).doc(`The one pre-paint hydration input: defaultValues > detected IP country > currency hint > US.`)})).state(({props:e})=>({...Rr(e.config,e.seed,Object.keys(e.catalog)),fillSeq:0,placeSeq:0})).children(e=>({text:e(Ai).many().fromController(({state:e,props:t})=>{"use controller";return{form:Ci(t.config,t.catalog,e)}}),select:e(Ti).many().fromController(({state:e,props:t})=>{"use controller";return{form:Ci(t.config,t.catalog,e)}}),line1:e(xi).fromController(({state:e,props:t})=>{"use controller";return{form:Ci(t.config,t.catalog,e)}})})).actions(e=>({snapshot:e.controller(async(e,t)=>{"use controller";t?.revealErrors&&$(e,{type:`show-errors`});let n=e.state,r=Dr(n.country,e.props.catalog[n.country]);return ei(e.props.config,r,n)}).doc("The current emitted snapshot — `revealErrors: true` also flips the form into show-all-errors mode."),autofillReveal:e.controller(async(e,t)=>{"use controller";
10if(t?.field&&t.value!==void 0){t.field===`country`?($(e,{type:`set-country`,country:t.value},{distribute:!0}),$(e,{type:`reveal`,autofill:!0})):$(e,{type:`edit`,field:t.field,value:t.value,autofilled:!0},{distribute:!0});return}$(e,{type:`reveal`,autofill:!0})}).analytics(`field`).doc(`A committed browser autofill was detected by the form-level probe — commit the control value (when the engine skipped input events) and reveal the grid.`),clampCountry:e.controller(async e=>{"use controller";let t=Ir(e.props.config,Object.keys(e.props.catalog));if(t.includes(e.state.country))return;let n=t.includes(`US`)?`US`:t.at(0);n&&$(e,{type:`set-country`,country:n},{distribute:!0})}).doc(`Re-clamp the selected country after a live config update shrank the allowed list.`),setCountry:e.controller(async(e,t)=>{"use controller";let n=Ir(e.props.config,Object.keys(e.props.catalog)),r=Tr(t);!r||!n.includes(r)||$(e,{type:`set-country`,country:r},{distribute:!0})}).doc(`Set the selected country from the parent composite while preserving the remaining address values.`),toggleLine2:e.controller(async e=>{"use controller";$(e,{type:`toggle-line2`})}).doc(`Open the collapsed line 2 field (the full layout’s text button).`),reveal:e.controller(async e=>{"use controller";$(e,{type:`reveal`})}).doc(`Reveal the country-derived field grid (the "Enter address manually" affordances).`),focusFirstEmpty:e.controller(async e=>{"use controller";let t=e.state,n=Wr(e.props.config,Dr(t.country,e.props.catalog[t.country])).gridFields.filter(e=>e!==`line1`),r=[];for(let t of[`text`,`select`])for(let n of e.children[t].ids())try{let i=await e.children[t].get(n).commit();r.push({...i,focus:()=>e.children[t].get(n).focus()})}catch{}for(let e of n){let t=r.find(t=>t.field===e);if(t&&!t.value){await t.focus();return}}}).doc(`After a resolved place lands, focus the first still-empty visible grid cell — reads each cell’s live DOM value through its commit contribution.`)})).on(e=>{e.controller(Ai,`input`,(e,t)=>{"use controller";$(e,t.field.startsWith(`custom:`)?{type:`edit-custom`,key:t.field.slice(7),value:t.value}:{type:`edit`,field:t.field,value:t.value,autofilled:t.autofilled})}),e.controller(Ai,`blur`,(e,t)=>{"use controller";$(e,{type:`blur`,field:t.field})}),e.controller(Ti,`input`,(e,t)=>{"use controller";t.field===`country`?$(e,{type:`set-country`,country:t.value},{distribute:!0}):t.field===`organization_type`?$(e,{type:`set-organization-type`,value:t.value}):t.field.startsWith(`custom:`)?$(e,{type:`edit-custom`,key:t.field.slice(7),value:t.value}):$(e,{type:`edit`,field:`state`,value:t.value})}),e.controller(Ti,`blur`,(e,t)=>{"use controller";$(e,{type:`blur`,field:t.field})}),e.controller(xi,`input`,(e,t)=>{"use controller";$(e,{type:`edit`,field:`line1`,value:t.value,autofilled:t.autofilled})}),e.controller(xi,`blur`,e=>{"use controller";$(e,{type:`blur`,field:`line1`})}),e.controller(xi,`reveal`,e=>{"use controller";$(e,{type:`reveal`})}),e.controller(xi,`toggleLine2`,e=>{"use controller";$(e,{type:`toggle-line2`})}),e.controller(xi,`placeStart`,e=>{"use controller";$(e,{type:`begin-select`})}),e.controller(xi,`placeFailed`,e=>{"use controller";$(e,{type:`select-failed`})}),e.controller(xi,`placeSelected`,(e,t)=>{"use controller";let n=Vr(e.props.config,Object.keys(e.props.catalog));if(!Hr(n,t.parsed)){$(e,{type:`select-failed`});return}$(e,{type:`apply-place`,parsed:t.parsed,allowed:n},{distribute:!0,placed:!0})})}),Pi=`whop-autofill-detect`,Fi=`animation:${Pi} 1ms;transition:background-color 9999999s ease-in-out 0s,color 9999999s ease-in-out 0s;-webkit-text-fill-color:var(--gray-12);caret-color:var(--gray-12);`,Ii=`@keyframes ${Pi}{from{opacity:0.999;}}
11[data-whop-autofill] input:-webkit-autofill,[data-whop-autofill] select:-webkit-autofill{${Fi}}
12[data-whop-autofill] input:autofill,[data-whop-autofill] select:autofill{${Fi}}`;function Li(){return(0,Q.jsx)(`style`,{children:Ii})}var Ri=280;function zi(e,t,n){let r=`motion-safe:transition-[grid-template-rows,opacity,margin-top] motion-safe:duration-200 motion-safe:ease-out`;return e?t?`grid grid-rows-[1fr]`:`grid grid-rows-[1fr] mt-0 visible opacity-100 ${r}`:`grid grid-rows-[0fr] ${n?``:`-mt-3`} invisible opacity-0 ${r}`}
12function Bi(e){let{config:t,catalog:n}=e,r=_(),i=V(Ni),a=i.state,o=(0,Z.useRef)(i);o.current=i;let s=(0,Z.useMemo)(()=>Dr(a.country,n[a.country]),[a.country,n]),c=(0,Z.useMemo)(()=>Wr(t,s),[t,s]),l=(0,Z.useMemo)(()=>Yr(t,s,a),[t,s,a]),u=(0,Z.useRef)({config:t,state:a});u.current={config:t,state:a};let d=(0,Z.useCallback)(e=>{if(!(e instanceof HTMLInputElement)&&!(e instanceof HTMLSelectElement))return;let t=e.getAttribute(`data-address-field`);if(!t)return;let n=()=>{let{state:n}=u.current,r=t===`country`?n.country:n.values[t]??``;return e.value.trim().length>0&&e.value!==r},r=()=>void o.current.autofillReveal({field:t,value:e.value});if(n()){r();return}queueMicrotask(()=>{n()&&r()}),typeof requestAnimationFrame==`function`&&requestAnimationFrame(()=>{n()&&r()})},[]),f=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{let n=ei(t,s,a),r=JSON.stringify(n);r!==f.current&&(f.current=r,e.onSnapshot?.(n))});let p=(0,Z.useRef)(a.country);(0,Z.useEffect)(()=>{p.current!==a.country&&(p.current=a.country,e.onCountryChange?.(a.country))},[e.onCountryChange,a.country]);let{connect:m}=e;(0,Z.useEffect)(()=>{m?.({snapshot:e=>o.current.snapshot({revealErrors:!!e?.revealErrors}),setCountry:e=>o.current.setCountry(e)})},[m]);let h=a.placeSeq,g=(0,Z.useRef)(h);(0,Z.useEffect)(()=>{h!==g.current&&(g.current=h,o.current.focusFirstEmpty())},[h]);let v=(0,Z.useMemo)(()=>Ir(t,Object.keys(n)),[t,n]),y=a.country;(0,Z.useEffect)(()=>{v.includes(y)||o.current.clampCountry()},[v,y]);let b=t.layout===`compact`,x=a.revealed||t.scope===`minimal`,S=t.line2!==`never`&&c.gridFields.includes(`line1`)&&(t.line2===`always`||a.line2Open),C=b?$r(t,c.gridFields,{line2:S,revealed:x}):{},w=e=>C[e]??``,[T,E]=(0,Z.useState)(x);(0,Z.useEffect)(()=>{if(!x){T&&E(!1);return}if(T)return;let e=setTimeout(()=>E(!0),Ri);return()=>clearTimeout(e)},[x,T]);let O=e=>(t.customFields??[]).filter(t=>t.position===e),k=(e,t)=>e.type===`select`?(0,Q.jsx)(Ti,{field:`custom:${e.key}`,label:e.label,corner:w(`custom:${e.key}`),options:e.options??[],revealGated:t},e.key):(0,Q.jsx)(Ai,{field:`custom:${e.key}`,label:e.label,corner:w(`custom:${e.key}`),inputKind:e.type===`date`?`date`:e.type===`phone`?`phone`:`text`,autocompleteOverride:e.autocomplete??(e.type===`phone`?`tel`:void 0),revealGated:t},e.key),A=b?Xr(c.gridFields):c.gridFields.filter(e=>e!==`line1`).map(e=>[e]),j=(e,t,n)=>(0,Q.jsxs)(`div`,{className:b?`flex`:`flex gap-3`,"data-row":b||void 0,children:[t,n]},e),M=t.name===`none`?null:t.name===`split`?j(`name`,(0,Q.jsx)(Ai,{field:`first_name`,label:r(`pONqz8`),half:`first`,corner:w(`first_name`)}),(0,Q.jsx)(Ai,{field:`last_name`,label:r(`txUL0F`),half:`second`,corner:w(`last_name`)})):(0,Q.jsx)(Ai,{field:`name`,label:r(`yk4PT9`),corner:w(`name`)}),N=t.organization===`none`?null:t.organization===`name_with_type`?j(`organization`,(0,Q.jsx)(Ai,{field:`organization`,label:r(`K56Dim`),half:`first`,corner:w(`organization`)}),(0,Q.jsx)(Ti,{field:`organization_type`,label:r(`aVwI1J`),half:`second`,corner:w(`organization_type`)})):(0,Q.jsx)(Ai,{field:`organization`,label:r(`K56Dim`),corner:w(`organization`)}),ee=t.line2===`toggle`&&!a.line2Open&&c.gridFields.includes(`line1`)?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void o.current.toggleLine2(),className:D(`text-1 text-accent-a11 hover:text-accent-12 self-start bg-transparent p-0 font-medium`,z(`AddressLine2Toggle`,`Collapsed address line 2 toggle`)),children:r(`68WTdZ`)}):null,P={province:r(`f9teca`),state:r(`ku+mDU`),county:r(`B+KJhc`),area:r(`8o8Qs2`),emirate:r(`Bd77XH`),island:r(`y+Zbzg`),parish:r(`dHT1dg`),prefecture:r(`/LfL10`),oblast:r(`rh2ojy`),department:r(`eXcD4S`),do_si:r(`bEWWol`)}[s.stateLabel],F={postal:r(`3EnruA`),zip:r(`iZL8VQ`),pin:r(`u/Dh8t`),eircode:r(`QW4jgg`)}[s.postalLabel],I=e=>e===`city`?r(`TE4fIS`):e===`state`?P:F,L=(e,t)=>e===`state`&&s.stateOptions.length>0?(0,Q.jsx)(Ti,{field:`state`,label:P,half:t,corner:w(e),revealGated:!0},e):(0,Q.jsx)(Ai,{field:e,label:I(e),half:t,corner:w(e),revealGated:!0,placeholder:e===`postal_code`?s.fields.find(e=>e.type===`postal_code`)?.postalPlaceholder:void 0},e),R=(0,Q.jsxs)(Q.Fragment,{children:[S&&(0,Q.jsx)(Ai,{field:`line2`,label:r(`oQY0a2`),corner:w(`line2`),revealGated:!0}),!S&&!b&&ee,A.map(e=>
12e.length===2?j(e.join(`-`),L(e[0],`first`),L(e[1],`second`)):L(e[0])),O(`after_address`).map(e=>k(e,!0))]}),B=b?`relative flex flex-col rounded-lg border border-stroke shadow-xs shadow-black-a1 [&_[data-row]]:border-t [&_[data-row]]:border-stroke [&>*:first-child]:border-t-0`:`relative flex flex-col gap-3`;return(0,Q.jsxs)(`div`,{className:D(`flex flex-col`,b?`gap-2`:`gap-3`,z(`Address`,`The address form root`)),"data-address-form":!0,"data-whop-autofill":``,"data-layout":t.layout,onAnimationStart:e=>{e.animationName===`whop-autofill-detect`&&d(e.target)},children:[(0,Q.jsx)(Li,{}),(0,Q.jsxs)(`div`,{className:B,children:[M,O(`after_name`).map(e=>k(e)),N,O(`after_organization`).map(e=>k(e)),O(`before_country`).map(e=>k(e)),(0,Q.jsx)(Ti,{field:`country`,label:r(`vONi+O`),corner:w(`country`)}),c.gridFields.includes(`line1`)&&(0,Q.jsx)(xi,{corner:w(`line1`)}),(0,Q.jsx)(`div`,{inert:!x,"aria-hidden":!x||void 0,className:zi(x,T,b),children:(0,Q.jsx)(`div`,{className:D(`flex min-w-0 flex-col`,!b&&`gap-3`,!(x&&T)&&`min-h-0 overflow-hidden`),children:R})}),x&&!T&&(0,Q.jsx)(`input`,{type:`text`,readOnly:!0,tabIndex:-1,"aria-hidden":`true`,className:`hidden`,"data-refill-probe":!0})]}),!x&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void o.current.reveal(),className:D(`text-1 text-gray-a10 hover:text-gray-12 self-start bg-transparent p-0 underline underline-offset-2`,z(`AddressManualEntry`,`The "Enter address manually" text button below the collapsed form — expands the full country format`)),children:r(`29cqvH`)}),a.showAllErrors&&!l.complete&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`AddressErrorSummary`,`The summary line shown when validation reveals missing or invalid fields`)),children:Object.values(l.errors).includes(`card_number`)?r(`BQ8s+Q`):r(`3RFOD4`)})]})}function Vi(e=!0){let t=p({queryKey:[`address-ip-country`],enabled:e,staleTime:1/0,gcTime:1/0,retry:!1,queryFn:async()=>await li()??null});return{country:t.data??void 0,settled:t.isSuccess||t.isError}}function Hi(e){let t=p({queryKey:[`address-country-catalog`],staleTime:1/0,gcTime:1/0,queryFn:()=>kr()}),n=Vi(e.detectCountry);return{ready:!!t.data&&(!e.detectCountry||n.settled),catalog:t.data,detectedCountry:n.country,error:t.error??null}}function Ui({amount:e,currency:t,baseCurrency:n,exchangeRate:r}){if(t.toLowerCase()===`usd`)return e;if(!(n.toLowerCase()!==`usd`||r===null||r<=0))return Number((e/r).toFixed(2))}var Wi=()=>{},Gi=(0,Z.createContext)({emit:Wi,sessionCreated:Wi});function Ki({analytics:e,children:t}){return(0,Z.createElement)(Gi,{value:e},t)}function qi(){return(0,Z.useContext)(Gi)}function Ji(e){return e?{"x-whop-elements-branding":e.presence,"x-whop-elements-surface":e.surface,"x-whop-elements-host-origin":e.hostOrigin}:{}}function Yi(){return{platform:navigator.platform,color_depth:window.screen.colorDepth,screen_height:window.screen.height,screen_width:window.screen.width,javascript_enabled:!0,language:navigator.language,java_enabled:!1,browser_time_difference:new Date().getTimezoneOffset()}}var Xi=`https://api.basistheory.com/token-intents`,Zi=/\s+/g;function Qi(e){return e.input_mask?.map(e=>typeof e==`string`?e:new RegExp(e.pattern))}function $i(e){let t=Object.values(e.input_formats??{}),n=t.length>0?t:Object.values(e.formats??{});if(n.length!==0)try{return new RegExp(n.map(e=>`(?:${e})`).join(`|`))}catch{return}}async function ea(e,t){let n=await fetch(Xi,{method:`POST`,headers:{"BT-API-KEY":e,"Content-Type":`application/json`},body:JSON.stringify({type:`token`,data:t})});if(!n.ok)throw Error(`token intent creation failed (${n.status})`);let r=await n.json().catch(()=>null);if(!r?.id)throw Error(`token intent creation returned no id`);return r.id}async function ta(e,t){if(!e)throw new Me(`SECURE_FIELD_TOKENIZER_UNAVAILABLE`,`This method declares a secure field but its tokenizer is not available`);try{let n=await e.tokenIntents.create({type:`token`,data:t});if(!n.id)throw Error(`token intent creation returned no id`);return n.id}catch(e){throw new Me(`SECURE_FIELD_TOKENIZE_FAILED`,`Secure field tokenization failed${e instanceof Error&&e.message?`: ${e.message}`:``}`)}}var na=3,ra=12,ia=[`visa`,`masterCard`,`amex`,`discover`],aa=[`VISA`,`MASTERCARD`,`AMEX`,`DISCOVER`],oa=[`PAN_ONLY`,`CRYPTOGRAM_3DS`],sa=`https://pay.google.com/gp/p/js/pay.js`,ca=`https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js`,la=`https://applepay.cdn-apple.com/jsapi/1.latest/`,ua=50,da=5e3,fa=`Total`;function pa(e,t){let n=we(t);return(e/10**n).toFixed(n)}function ma(){return window}
12function ha(){return navigator.userAgentData?.mobile===!0}function ga(e){if(!e)return{};let t=[e.givenName,e.familyName].filter(Boolean).join(` `);return{line1:e.addressLines?.[0],line2:e.addressLines?.[1],city:e.locality,state:e.administrativeArea,postal_code:e.postalCode,country:e.countryCode?.toUpperCase(),recipient:t||void 0,phone:e.phoneNumber}}function _a(e){return e?{line1:e.address1,line2:e.address2,city:e.locality,state:e.administrativeArea,postal_code:e.postalCode,country:e.countryCode?.toUpperCase(),recipient:e.name,phone:e.phoneNumber}:{}}function va(e,t){let n=e?.trim();if(!n)return;let r=ve(n,t&&fr(t)?t:void 0);return r?.isPossible()?r.number:n}function ya(e){let t={};return e.line1&&(t.line1=e.line1),e.line2&&(t.line2=e.line2),e.city&&(t.city=e.city),e.state&&(t.state=e.state),e.postal_code&&(t.postal_code=e.postal_code),e.country&&(t.country=e.country),Object.keys(t).length>0?t:void 0}function ba(e,t,n){if(e.countryCode)return e.countryCode.toUpperCase();let r=t.wallet?.merchants??[];return((wa(t,n)??r.find(e=>e.country))?.country)?.toUpperCase()??`US`}function xa(e){return e?.top??window.location.origin}function Sa(){let e=window.location.ancestorOrigins,t=e?.length?e[e.length-1]:void 0;return t&&t!==`null`?t:void 0}function Ca(e){if(!(typeof window>`u`))try{return new URL(xa(e)).hostname}catch{return}}function wa(e,t){let n=Ca(t);return n?e.wallet?.merchants?.find(e=>e.domains?.includes(n)):void 0}function Ta(e,t){return wa(e,t)!==void 0}function Ea(e,t,n,r){let i={countryCode:ba(e,n,r),currencyCode:e.currency.toUpperCase(),supportedNetworks:n.wallet?.supported_networks??ia,merchantCapabilities:n.wallet?.merchant_capabilities??[`supports3DS`],total:{label:fa,amount:pa(t.amount,e.currency)},requiredBillingContactFields:[`postalAddress`,`name`]};t.lineItems.length>0&&(i.lineItems=t.lineItems.map(t=>({label:t.label,amount:pa(t.amount,e.currency)})));let a=[];return e.requestPayerEmail!==!1&&a.push(`email`),e.requestShipping&&a.push(`postalAddress`,`name`),e.requestPayerPhone&&a.push(`phone`),a.length>0&&(i.requiredShippingContactFields=a),e.requestShipping&&t.shippingOptions.length>0&&(i.shippingMethods=t.shippingOptions.map(t=>({identifier:t.id,label:t.label,detail:t.detail??``,amount:pa(t.amount,e.currency)}))),i}function Da(e,t,n){let r={newTotal:{label:fa,amount:pa(t.amount,e.currency)},newLineItems:t.lineItems.map(t=>({label:t.label,amount:pa(t.amount,e.currency)})),newShippingMethods:t.shippingOptions.map(t=>({identifier:t.id,label:t.label,detail:t.detail??``,amount:pa(t.amount,e.currency)}))};if(n&&n.length>0){let e=ma().ApplePayError;r.errors=n.map(t=>{let n=t.code===`shipping_address_unserviceable`?`addressUnserviceable`:t.code===`shipping_option_invalid`?`shippingContactInvalid`:t.code===`other`?`unknown`:`shippingContactInvalid`,r=n===`shippingContactInvalid`?`postalAddress`:void 0;return e?new e(n,r,t.message):{code:n,contactField:r,message:t.message}})}return r}function Oa(e,t){let n={totalPriceStatus:`FINAL`,totalPrice:pa(t.amount,e.currency),currencyCode:e.currency.toUpperCase(),totalPriceLabel:fa};return t.lineItems.length>0&&(n.displayItems=t.lineItems.map(t=>({label:t.label,type:`LINE_ITEM`,price:pa(t.amount,e.currency)}))),n}function ka(e,t){return{defaultSelectedOptionId:t??e.shippingOptions[0]?.id,shippingOptions:e.shippingOptions.map(e=>({id:e.id,label:e.label,description:e.detail}))}}function Aa(e,t){let n=e?.allowed_payment_methods?.find(e=>e.type===`CARD`),r=n?.parameters;if(!r?.allowed_auth_methods?.length||!r.allowed_card_networks?.length)return;let i={type:`CARD`,parameters:{allowedAuthMethods:r.allowed_auth_methods,allowedCardNetworks:r.allowed_card_networks}};if(t)return i;r.billing_address_required&&(i.parameters.billingAddressRequired=!0);let a=r.billing_address_parameters?.format;(a===`FULL`||a===`MIN`)&&(i.parameters.billingAddressParameters={format:a});let o=n?.tokenization_specification;return o?.type===`PAYMENT_GATEWAY`&&o.parameters?.gateway&&o.parameters.gateway_merchant_id&&(i.tokenizationSpecification={type:`PAYMENT_GATEWAY`,parameters:{gateway:o.parameters.gateway,gatewayMerchantId:o.parameters.gateway_merchant_id}}),i}function ja(e,t,n){let r=Aa(t?.sheet_request,n);if(r)return r;let i={type:`CARD`,parameters:{allowedAuthMethods:e.wallet?.allowed_auth_methods??oa,allowedCardNetworks:e.wallet?.allowed_card_networks??aa}};
12if(!n){i.parameters.billingAddressRequired=!0,i.parameters.billingAddressParameters={format:`FULL`};let e=t?.tokenization;e?.gateway&&e.gateway_merchant_id&&(i.tokenizationSpecification={type:`PAYMENT_GATEWAY`,parameters:{gateway:e.gateway,gatewayMerchantId:e.gateway_merchant_id}})}return i}function Ma(e,t,n,r){let i=r.sheet_request,a=i?.callback_intents??[],o=a.includes(`OFFER`),s=a.filter(e=>e!==`OFFER`);s.includes(`PAYMENT_AUTHORIZATION`)||s.push(`PAYMENT_AUTHORIZATION`);let c=ja(n,r,!1);e.requestPayerPhone&&(c.parameters.billingAddressRequired=!0,c.parameters.billingAddressParameters={format:c.parameters.billingAddressParameters?.format??`FULL`,phoneNumberRequired:!0});let l={apiVersion:i?.api_version??2,apiVersionMinor:i?.api_version_minor??0,allowedPaymentMethods:[c],transactionInfo:Oa(e,t),emailRequired:e.requestPayerEmail===!1?!1:i?.email_required??!0,callbackIntents:s},u={},d=i?.merchant_info;d?.merchant_id&&(u.merchantId=d.merchant_id),d?.merchant_name&&(u.merchantName=d.merchant_name);let f=d?.auth_jwt??r.auth_jwt;if(f){u.authJwt=f,d?.merchant_origin&&(u.merchantOrigin=d.merchant_origin);let e=d?.software_info;e?.id&&e.version&&(u.softwareInfo={id:e.id,version:e.version})}return Object.keys(u).length>0&&(l.merchantInfo=u),e.requestShipping&&(l.shippingAddressRequired=!0,s.unshift(`SHIPPING_ADDRESS`),t.shippingOptions.length>0&&(l.shippingOptionRequired=!0,l.shippingOptionParameters=ka(t),s.unshift(`SHIPPING_OPTION`))),e.requestPromoCode&&o&&(s.unshift(`OFFER`),e.appliedPromoCode&&(l.offerInfo={offers:[{redemptionCode:e.appliedPromoCode,description:e.appliedPromoDescription??e.appliedPromoCode}]})),l}function Na(e){return new Promise((t,n)=>{let r=e.readGlobal();if(r)return t(r);let i=!1,a=e=>{i||(i=!0,t(e))},o=t=>{i||(i=!0,e.onFailure(),n(Error(t)))},s=t=>{let n=e.readGlobal();n?a(n):t()},c=document.querySelector(`script[src^="${e.srcPrefix}"]`);if(c){c.addEventListener(`load`,()=>s(()=>o(e.loadedWithoutGlobal))),c.addEventListener(`error`,()=>o(e.failedToLoad));let t=Date.now()+da,n=()=>{i||s(()=>{Date.now()>=t?o(e.failedToLoad):setTimeout(n,ua)})};n();return}let l=document.createElement(`script`);l.src=e.src,l.async=!0,e.crossOrigin&&(l.crossOrigin=e.crossOrigin),l.onload=()=>s(()=>{l.remove(),o(e.loadedWithoutGlobal)}),l.onerror=()=>{l.remove(),o(e.failedToLoad)},document.head.appendChild(l)})}var Pa;function Fa(){return Pa??=Na({src:sa,srcPrefix:sa,readGlobal:()=>ma().google?.payments?.api?.PaymentsClient,loadedWithoutGlobal:`pay.js loaded without google.payments.api.PaymentsClient`,failedToLoad:`Failed to load pay.js`,onFailure:()=>{Pa=void 0}}),Pa}var Ia;function La(){return Ia??=Na({src:ca,srcPrefix:la,crossOrigin:`anonymous`,readGlobal:()=>ma().ApplePaySession,loadedWithoutGlobal:`apple-pay-sdk.js loaded without ApplePaySession`,failedToLoad:`Failed to load apple-pay-sdk.js`,onFailure:()=>{Ia=void 0}}),Ia}function Ra(){let e=typeof window>`u`?void 0:ma().ApplePaySession;return e&&e.isNotWebkit!==!0?[`apple_pay`,`google_pay`]:[`google_pay`,`apple_pay`]}var za=new Map,Ba;function Va(){return Ba?.origins}function Ha(e,t){let n={port:e,origins:t};return Ba=n,()=>{Ba===n&&(Ba=void 0)}}var Ua=class{options;emit;internal;client;state;entries=new Map;googleSession;googleClientCtor;selectedShippingOption;showing=!1;sheetPromoCode;sheetPromoDescription;constructor(e,t,n){this.options={...e,currency:e.currency.toLowerCase()},this.emit=t,this.internal=n??{},this.client=R(),this.state={amount:e.amount,lineItems:e.lineItems??[],shippingOptions:e.shippingOptions??[]}}async canMakePayment(){let[e,t]=await Promise.all([this.probeApple().catch(()=>!1),this.probeGoogle().catch(()=>!1)]);return{applePay:e,googlePay:t,order:Ra()}}show(e,t){if(this.showing)return Promise.reject(Error(`A payment sheet is already open`));if(this.options.requestPayerEmail===!1&&!t?.email?.trim())return Promise.reject(Error(`This ${e} request does not collect the buyer's email — pass one to show() or configure requestPayerEmail`));let n=eo();return e===`apple_pay`?this.showApple(n,t?.email):this.showGoogle(n,t?.email)}probeOne(e){return(e===`apple_pay`?this.probeApple():this.probeGoogle()).catch(()=>!1)}feePostureOf(e){return this.entries.get(e)?.supports_buyer_fee??!0}submitButtonOf(e){return this.entries.get(e)?.submit_button??void 0}repriceTo(e){this.state.amount=e}async matrixEntry(e){if(this.entries.has(e))return this.entries.get(e);let t=await this.client.paymentMethodTypes.retrieve(e,{account_id:this.options.accountId,currency:this.options.currency}).catch(()=>void 0);return t&&this.entries.set(e,t),t}async probeApple(){let e=ma().ApplePaySession,t=!e||e.isNotWebkit===!0;if(t&&ha()||e&&!t&&!e.canMakePayments())return!1;let n=e??await La().catch(()=>void 0);if(!n)return!1;let r=await this.matrixEntry(`apple_pay`);if(!r||!Ta(r,this.internal.origins))return!1;if(t){let e=wa(r,this.internal.origins);if(!await n.canMakePaymentsWithActiveCard(e?.merchant_identifier))return!1}return n.supportsVersion(r.wallet?.version??na)}async probeGoogle(){let e=await this.matrixEntry(`google_pay`);if(!e)return!1;let t=await this.mintGoogleSession().catch(()=>void 0);if(!t||(this.googleSession=t,!t.origin_cleared))return!1;let n=await Fa();return this.googleClientCtor=n,!!(await new n({environment:t.environment}).isReadyToPay({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[ja(e,t,!0)]})).result}mintGoogleSession(){let e=window.location.origin,t=this.framingPageOrigin();return this.client.paymentMethodTypes.createGooglePaySession({account_id:this.options.accountId,origin:e,...t&&t!==e?{top_origin:t}:{}}).then(e=>e.session)}framingPageOrigin(){let e=this.internal.origins;if(e)return Sa()??(e.top===e.host?e.host:void 0)}mintAppleSession(e){return this.client.paymentMethodTypes.createApplePaySession({account_id:this.options.accountId,origin:xa(this.internal.origins),...e}).then(e=>e.session)}showApple(e,t){let n=ma().ApplePaySession;if(!n)return Promise.reject(Error(`Apple Pay is not available in this browser`));let r=this.entries.get(`apple_pay`);if(!r)return Promise.reject(Error(`Call and await canMakePayment() before show("apple_pay")`));if(this.internal.handoff&&n.isNotWebkit===!0)return this.handOffApple(this.internal.handoff,r,e,t);let i=Ea(this.options,this.state,r,this.internal.origins);if(t){let e=i.requiredShippingContactFields?.filter(e=>e!==`email`);e&&e.length>0?i.requiredShippingContactFields=e:delete i.requiredShippingContactFields}let a=r.wallet?.version??na,o=this.options.requestPromoCode===!0&&n.supportsVersion(ra);o&&(i.supportsCouponCode=!0,this.options.appliedPromoCode&&(i.couponCode=this.options.appliedPromoCode));let s=new n(o?Math.max(a,ra):a,i);return this.showing=!0,this.billingRepriceRestore=null,this.sheetPromoCode=void 0,this.sheetPromoDescription=void 0,new Promise((i,a)=>
12{let o=!1,c=!1,l=!1,u,d=e=>{o=!0,this.showing=!1,this.retireBillingReprice(),this.retirePromoChange(),this.restoreBillingRepricedTotals();try{s.abort()}catch{}a(e)};s.onvalidatemerchant=e=>{let t=wa(r,this.internal.origins)?.merchant_identifier;this.mintAppleSession({validation_url:e.validationURL,...t?{merchant_identifier:t}:{}}).then(e=>s.completeMerchantValidation(e.merchant_session)).catch(e=>d(Error(Oe(e,`Apple Pay merchant validation failed`))))},s.onpaymentmethodselected=e=>{this.dispatchBillingReprice(ga(e.paymentMethod.billingContact),()=>{let{newTotal:e,newLineItems:t}=Da(this.options,this.state);s.completePaymentMethodSelection({newTotal:e,newLineItems:t})})},s.oncouponcodechanged=e=>{this.dispatchPromoChange(e.couponCode.trim()||null,e=>{let t=Da(this.options,this.state);if(e){let n=ma().ApplePayError;t.errors=[n?new n(`couponCodeInvalid`,void 0,e.message):{code:`couponCodeInvalid`,message:e.message}]}s.completeCouponCodeChange(t)})},s.onshippingcontactselected=e=>{this.dispatchUpdate(`shippingaddresschange`,{address:ga(e.shippingContact)},e=>s.completeShippingContactSelection(Da(this.options,this.state,e)))},s.onshippingmethodselected=e=>{this.selectedShippingOption=this.state.shippingOptions.find(t=>t.id===e.shippingMethod.identifier),this.dispatchUpdate(`shippingoptionchange`,{option:this.selectedShippingOption??{id:e.shippingMethod.identifier}},()=>{let{newTotal:e,newLineItems:t}=Da(this.options,this.state);s.completeShippingMethodSelection({newTotal:e,newLineItems:t})})},s.oncancel=()=>{this.showing=!1,this.retireBillingReprice(),this.retirePromoChange(),!(o||l)&&(u?.retire(),this.restoreBillingRepricedTotals(),this.emit.cancel(),a(Error(`payment_request_cancelled`)))},s.onpaymentauthorized=r=>{if(c){s.completePayment({status:n.STATUS_FAILURE});return}c=!0;let o=r.payment,d=ga(o.billingContact),f=ga(o.shippingContact),p=o.shippingContact?.phoneNumber?va(o.shippingContact.phoneNumber,f.country??d.country):va(o.billingContact?.phoneNumber,d.country),m={email:t??o.shippingContact?.emailAddress??o.billingContact?.emailAddress,name:d.recipient??f.recipient,phone:p,country:d.country??f.country};this.finishWithToken(`apple_pay`,JSON.stringify(o.token),m,d,f).then(t=>{if(!e){s.completePayment({status:n.STATUS_SUCCESS}),this.showing=!1,i(t);return}i(t),u=Xa(this.internal.relay?.handoffId),u.promise.then(e=>{l=!0,s.completePayment({status:e===`success`?n.STATUS_SUCCESS:n.STATUS_FAILURE}),this.showing=!1})}).catch(e=>{s.completePayment({status:n.STATUS_FAILURE}),this.showing=!1,a(e instanceof Error?e:Error(`confirmation token creation failed`))})},s.begin()})}handOffApple(e,t,n,r){let i=`wh_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`;return this.showing=!0,this.billingRepriceRestore=null,this.sheetPromoCode=void 0,this.sheetPromoDescription=void 0,new Promise((a,o)=>{let s=new Set;za.set(i,{change:e=>new Promise(t=>{s.add(t);let n=e=>{s.delete(t),t(e)},r=()=>({amount:this.state.amount,lineItems:this.state.lineItems,shippingOptions:this.state.shippingOptions});switch(e.kind){case`nsure_device_id`:n({nsureDeviceId:M()[`x-nsure-device-id`]});return;case`billing_address`:this.dispatchBillingReprice(e.address,()=>n(r()));return;case`shipping_address`:this.dispatchUpdate(`shippingaddresschange`,{address:e.address},e=>n({...r(),...e?{errors:e}:{}}));return;case`shipping_option`:this.selectedShippingOption=this.state.shippingOptions.find(t=>t.id===e.optionId),this.dispatchUpdate(`shippingoptionchange`,{option:this.selectedShippingOption??{id:e.optionId}},()=>n(r()));return;case`promo_code`:this.dispatchPromoChange(e.code,t=>n({...t?{promoError:t}:{},...!t&&this.sheetPromoCode===e.code?{amount:this.state.amount,...this.sheetPromoDescription?{appliedDescription:this.sheetPromoDescription}:{}}:{}}));return}}),settle:t=>{za.delete(i),this.retireBillingReprice(),this.retirePromoChange();for(let e of s)e({});if(s.clear(),`error`in t){this.showing=!1,this.restoreBillingRepricedTotals(),t.error.cancelled?(this.emit.cancel(),o(Error(`payment_request_cancelled`))):o(Error(t.error.message));return}let r=t.result;this.selectedShippingOption=r.shipping?.option??this.selectedShippingOption,n?so().then(t=>{e.conclude(i,t),this.showing=!1}):this.showing=!1,this.emit.confirmationToken(r),a(r)}
12}),e.request({id:i,type:`apple_pay`,options:this.options,state:{amount:this.state.amount,lineItems:this.state.lineItems,shippingOptions:this.state.shippingOptions},entry:t,...r?{email:r}:{},deferred:n})})}seedWalletEntry(e,t){this.entries.set(e,t)}showGoogle(e,t){let n=this.entries.get(`google_pay`),r=this.googleSession,i=this.googleClientCtor;if(r?.origin_cleared===!1)return Promise.reject(Error(`This origin is not a cleared payment domain for Google Pay on this account`));if(!n||!r||!i)return Promise.reject(Error(`Call and await canMakePayment() before show("google_pay")`));this.showing=!0,this.billingRepriceRestore=null,this.sheetPromoCode=void 0,this.sheetPromoDescription=void 0;let a,o,s,c,l=!1,u=new Promise((e,t)=>{s=t=>{l=!0,e(t)},c=e=>{l||(l=!0,t(e))}}),d=Ma(this.options,this.state,n,r);t&&(d.emailRequired=!1);let f=[`SHIPPING_ADDRESS`,`SHIPPING_OPTION`,`OFFER`,`PAYMENT_METHOD`],p=d.callbackIntents?.some(e=>f.includes(e))??!1,m=new i({environment:r.environment??n.wallet?.environment??`TEST`,paymentDataCallbacks:{...p?{onPaymentDataChanged:e=>new Promise(t=>{let n=(e,n)=>{let r={newTransactionInfo:Oa(this.options,this.state)};this.options.requestShipping&&this.state.shippingOptions.length>0&&(r.newShippingOptionParameters=ka(this.state,this.selectedShippingOption?.id));let i=e?.[0];i&&(r.error={reason:i.code===`shipping_address_unserviceable`?`SHIPPING_ADDRESS_UNSERVICEABLE`:i.code===`shipping_option_invalid`?`SHIPPING_OPTION_INVA
12LID`:i.code===`other`?`OTHER_ERROR`:`SHIPPING_ADDRESS_INVALID`,message:i.message,intent:n??`SHIPPING_ADDRESS`}),t(r)},r=t=>{let n=e.callbackTrigger;if(n!==`INITIALIZE`&&n!==`PAYMENT_METHOD`)return t();this.dispatchBillingReprice(_a(e.paymentMethodData?.info?.billingAddress),t)};if(e.callbackTrigger===`OFFER`){let n=e=>{let n={newTransactionInfo:Oa(this.options,this.state),newOfferInfo:this.googleOfferInfo()};e&&(n.error={reason:`OFFER_INVALID`,message:e.message,intent:`OFFER`}),t(n)},r=this.effectivePromoCode(),i=(e.offerData?.redemptionCodes??[]).map(e=>e.trim()).filter(Boolean),a=i.find(e=>e!==r)??(i.length>0?r:null);a===r?n():this.dispatchPromoChange(a,n);return}if(e.callbackTrigger===`SHIPPING_OPTION`&&e.shippingOptionData?.id){let t=e.shippingOptionData.id;this.selectedShippingOption=this.state.shippingOptions.find(e=>e.id===t),this.dispatchUpdate(`shippingoptionchange`,{option:this.selectedShippingOption??{id:t}},e=>n(e,`SHIPPING_OPTION`))}else r(()=>{e.shippingAddress?this.dispatchUpdate(`shippingaddresschange`,{address:_a(e.shippingAddress)},e=>n(e,`SHIPPING_ADDRESS`)):n()})})}:{},onPaymentAuthorized:async n=>{if(a&&e)return{transactionState:`ERROR`,error:{reason:`OTHER_ERROR`,message:`This payment was not completed — close the sheet and try again`,intent:`PAYMENT_AUTHORIZATION`}};let r=_a(n.paymentMethodData.info?.billingAddress),i={email:t??n.email,name:r.recipient,phone:va(r.phone,r.country),country:r.country};try{return a=await this.finishWithToken(`google_pay`,{token:n.paymentMethodData.tokenizationData.token,cardNetwork:n.paymentMethodData.info?.cardNetwork??null},i,r,_a(n.shippingAddress)),e&&(s(a),await so()!==`success`)?{transactionState:`ERROR`,error:{reason:`OTHER_ERROR`,message:`This payment was not completed — close the sheet and try again`,intent:`PAYMENT_AUTHORIZATION`}}:{transactionState:`SUCCESS`}}catch(e){return o=e instanceof Error?e:Error(`confirmation token creation failed`),{transactionState:`ERROR`,error:{reason:`OTHER_ERROR`,message:o.message,intent:`PAYMENT_AUTHORIZATION`}}}}}}).loadPaymentData(d).then(()=>{if(this.showing=!1,this.retireBillingReprice(),this.retirePromoChange(),o)throw o;if(!a)throw Error(`The Google Pay sheet closed without authorizing`);return a}).catch(e=>{if(this.showing=!1,this.retireBillingReprice(),this.retirePromoChange(),l||this.restoreBillingRepricedTotals(),o)throw o;if(e?.statusCode===`CANCELED`)throw l||this.emit.cancel(),Error(`payment_request_cancelled`);let t=e,n=t?.statusMessage??t?.statusCode;throw e instanceof Error?e:Error(n?`Google Pay rejected the request: ${n}`:`The Google Pay sheet failed`)});return e?(m.then(e=>s(e),e=>c(e)),u):m}async tokenizerPublicKey(e){let t=(await this.matrixEntry(e))?.wallet?.public_key;if(!t)throw Error(`The wallet config carries no tokenizer key for this account`);return t}async finishWithToken(e,t,n,r,i){if(!n.email)throw Error(`No payer email was available — a confirmation token requires one`);let a=await ea(await this.tokenizerPublicKey(e),t),o=e===`apple_pay`?await this.matrixEntry(e):void 0,s=o?wa(o,this.internal.origins)?.merchant_identifier:void 0,c=await this.internal.nsureDeviceId?.(),l=await this.client.confirmationTokens.create({account_id:this.options.accountId,payment_method:{type:e,category:`wallet`,[e]:{token_intent:a,...s?{merchant_identifier:s}:{}}},billing_details:{email:n.email,name:n.name??null,address:ya(r)??null},return_url:window.location.href,setup_future_usage:this.options.setupFutureUsage??null,browser_info:Yi()},{headers:{...c?{"x-nsure-device-id":c}:M(),...Ji(this.internal.brandingReport?.())}}).catch(e=>{throw Error(Oe(e,`confirmation token creation failed`))}),u=this.options.requestShipping?{address:i,option:this.selectedShippingOption}:null,d={ctok:l.id,type:e,payer:n,shipping:u};return this.emit.confirmationToken(d),d}dispatchUpdate(e,t,n){let r=!1,i=e=>{r||(r=!0,e.amount!=null&&(this.state.amount=e.amount),e.lineItems&&(this.state.lineItems=e.lineItems),e.shippingOptions&&(this.state.shippingOptions=e.shippingOptions),n(e.errors))};(e===`shippingaddresschange`?this.emit.shippingAddressChange({...t,updateWith:i}):this.emit.shippingOptionChange({...t,updateWith:i}))===0&&n()}pendingBillingReprice=null;retireBillingReprice(){this.pendingBillingReprice?.retire()}billingRepriceRestore=null;restoreBillingRepricedTotals(){this.billingRepriceRestore?.(),this.billingRepriceRestore=null}dispatchBillingReprice(e,t){if(this.pendingBillingReprice?.supersede(),!e.country&&!this.internal.relay){t();return}let n=!1,r=e=>{n||(n=!0,clearTimeout(o),this.pendingBillingReprice===a&&(this.pendingBillingReprice=null),e&&t())},i=()=>r(!0),a={supersede:i,retire:()=>r(!1)};this.pendingBillingReprice=a;let o=setTimeout(i,this.internal.relay?.askDeadlineMs??io);this.emit.billingAddressChange({address:e,updateWith:e=>
12{if(!n){if(e.amount!=null||e.lineItems){let e=this.state.amount,t=this.state.lineItems;this.billingRepriceRestore??=()=>{this.state.amount=e,this.state.lineItems=t}}e.amount!=null&&(this.state.amount=e.amount),e.lineItems&&(this.state.lineItems=e.lineItems),i()}}})===0&&i()}pendingPromoChange=null;retirePromoChange(){this.pendingPromoChange?.retire()}dispatchPromoChange(e,t){this.pendingPromoChange?.supersede();let n=!1,r=(e,r)=>{n||(n=!0,clearTimeout(o),this.pendingPromoChange===a&&(this.pendingPromoChange=null),e&&t(r))},i=()=>r(!0),a={supersede:i,retire:()=>r(!1)};this.pendingPromoChange=a;let o=setTimeout(i,this.internal.relay?.askDeadlineMs??io);(this.internal.promoCodeChange?.({code:e,updateWith:t=>{if(!n){if(t.error){r(!0,t.error);return}if(t.amount!=null){let n=this.state.amount,r=this.state.lineItems;this.billingRepriceRestore??=()=>{this.state.amount=n,this.state.lineItems=r},this.state.amount=t.amount,this.sheetPromoCode=e,this.sheetPromoDescription=t.appliedDescription}i()}}})??0)===0&&i()}effectivePromoCode(){return this.sheetPromoCode===void 0?this.options.appliedPromoCode??null:this.sheetPromoCode}googleOfferInfo(){let e=this.effectivePromoCode();return e?{offers:[{redemptionCode:e,description:(this.sheetPromoCode===void 0?this.options.appliedPromoDescription:this.sheetPromoDescription)??e}]}:{offers:[]}}},Wa=H(`paymentRequest`).doc("Low-level Apple Pay or Google Pay sheet for custom buttons, express checkout, and shipping callbacks. Wallet tiles automate this flow through `payments.createConfirmationToken`. Await `canMakePayment()` to check availability and prime the sheet, then call `show(type)` synchronously in the user-interaction handler. The resolved `ctok` is a `ctok_`-prefixed confirmation token. Confirm it server-side like an element-minted token.").options(e=>({accountId:e.required().doc("Account ID, prefixed `biz_`, that scopes every client-side call."),currency:e.required().doc(`Three-letter ISO 4217 payment currency code.`),amount:e.required().doc(`Payment amount in minor units.`),setupFutureUsage:e.optional().doc("Set only after displaying save consent. Marks the token for `off_session` or `on_session` use."),requestPayerEmail:e.default(!0).doc(`Ask the sheet for the payer's email — the confirmation token requires one.`),requestPayerPhone:e.default(!1).doc("Ask the sheet for the payer's phone number, delivered as `payer.phone` on the result — in E.164 where it parses against the country of the contact that supplied it, as the wallet gave it otherwise; `payer.country` is the billing country. Google Pay collects it through the billing address the sheet already asks for."),requestShipping:e.default(!1).doc("Ask the sheet for a shipping address (and offer `shippingOptions` when given)."),countryCode:e.optional().doc("Account ISO 3166-1 alpha-2 country code for the Apple Pay sheet. Omit it to use the account's published registration country. The sheet defaults to `US` when neither is available."),lineItems:e.optional().doc(`Line items the sheet lists under the total.`),shippingOptions:e.optional().doc("Shipping options the sheet offers when `requestShipping` is set. Display-only — update `amount` from your change handler.")})).methods(e=>({canMakePayment:e.fn().doc("Returns availability for each wallet when the account offers it, the device supports it, and this page's origin is approved for the account (first-party whop.com pages are pre-approved; a merchant page needs its domain registered and verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain), and offering Google Pay there is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos)). Apple Pay on non-WebKit browsers is the desktop iPhone-handoff flow, so mobile devices there report it unavailable — native Apple Pay on iOS browsers is unaffected. `order` ranks the wallets by which sheet is native to the browser — Apple Pay first on Safari, Google Pay first elsewhere — so express buttons can stack best-first. This primes `show()`. Always await it first."),show:e.fn().gesture().doc("Open the selected wallet sheet after awaiting `canMakePayment()`. Apple requires session creation within the gesture stack. Pass `email` when your page already collected one — the sheet takes it and never asks for a second. With `requestPayerEmail: false`, passing one is required, and the sheet refuses to open without it because confirmation tokens require an email.")})).events(e=>({shippingAddressChange:e.event().reply(`updateWith`).doc(`The sheet's shipping address changed (redacted pre-authorization: city/state/postal/country only).`),shippingOptionChange:e.event().reply(`updateWith`).doc("The buyer picked a shipping option. Amount-only contract: `updateWith` carries amount/lineItems/shippingOptions/errors."),billingAddressChange:e.event().reply(`updateWith`).doc("Fires at sheet open and on card switches with the selected card's redacted billing address (city/state/postal/country only) — reprice the total for the address the charge taxes off. Answer `updateWith({ amount })` in minor units, or `updateWith({})` to keep the current total. Every event is answered exactly once: a slow, thrown, or superseded handler answers keep-current."),confirmationToken:e.event
12().doc("The sheet created a confirmation token. This is the same result that `show()` returns."),cancel:e.event().doc(`The buyer dismissed the sheet.`)})).create(({options:e,emit:t})=>{"use host";return new Ua(e,t)}),Ga={shippingAddressChange:()=>0,shippingOptionChange:()=>0,billingAddressChange:()=>0,confirmationToken:()=>0,cancel:()=>0};function Ka(e){return`${e.currency.toLowerCase()}|${e.amount}|${e.setupFutureUsage??``}`}var qa=25e3,Ja=!1,Ya=new Map;function Xa(e){let t,n;return{promise:new Promise(r=>{n=setTimeout(()=>{t&&Ya.delete(t),r(`failure`)},qa),t=e=>{clearTimeout(n),r(e)},Ya.set(t,e)}),retire:()=>{clearTimeout(n),t&&Ya.delete(t)}}}function Za(e,t){let n=[];for(let[t,r]of Ya)r===e&&n.push(t);for(let e of n)Ya.delete(e);for(let e of n)e(t)}function Qa(){Ja=!0}function $a(){Ja=!1}function eo(){let e=Ja;return Ja=!1,e}function to(e){let t=za.get(e.id);return t?t.change(e.change):Promise.resolve({})}function no(e){za.get(e.id)?.settle(e)}async function ro(e,t){let n={host:window.location.origin,top:ee(window)},r=(n,r)=>(t.change({id:e.id,change:n}).then(r,()=>r({})),1),i=e=>t.settle(e).catch(()=>void 0),a=new Ua({...e.options,amount:e.state.amount,lineItems:e.state.lineItems,shippingOptions:e.state.shippingOptions},{...Ga,shippingAddressChange:e=>r({kind:`shipping_address`,address:e.address},t=>e.updateWith(t)),shippingOptionChange:e=>r({kind:`shipping_option`,optionId:e.option.id},t=>e.updateWith(t)),billingAddressChange:e=>r({kind:`billing_address`,address:e.address},t=>e.updateWith(t))},{origins:n,nsureDeviceId:()=>new Promise(n=>{let r=setTimeout(()=>n(void 0),ao);Promise.resolve().then(()=>t.change({id:e.id,change:{kind:`nsure_device_id`}})).then(e=>e.nsureDeviceId).then(n,()=>n(void 0)).finally(()=>clearTimeout(r))}),relay:{askDeadlineMs:io+oo,handoffId:e.id},promoCodeChange:e=>r({kind:`promo_code`,code:e.code},t=>e.updateWith({...t.amount==null?{}:{amount:t.amount},...t.promoError?{error:t.promoError}:{},...t.appliedDescription?{appliedDescription:t.appliedDescription}:{}}))});a.seedWalletEntry(e.type,e.entry);try{let t=await La();t.isNotWebkit===!0&&await t.canMakePaymentsWithActiveCard(wa(e.entry,n)?.merchant_identifier).catch(()=>!1),e.deferred&&Qa();let r=await a.show(e.type,e.email?{email:e.email}:void 0);await i({id:e.id,result:r})}catch(t){$a();let n=t instanceof Error?t.message:`The wallet sheet could not be shown`;await i({id:e.id,error:{message:n,cancelled:n===`payment_request_cancelled`}})}}var io=1e4,ao=200,oo=5e3;function so(){return Xa().promise}function co(e){Za(void 0,e)}function lo(e,t){Za(e,t)}var uo=new Map,fo=2;function po(e){return ho({...e,requestPayerEmail:!1})}function mo(e){let{amounts:t,onStatus:n,promo:r,...i}=e;return ho({...i,amount:t.feeFree,...r?{requestPromoCode:!0,appliedPromoCode:r.applied,appliedPromoDescription:r.appliedDescription}:{}},(r,i)=>{let a=i.feePostureOf(e.type);r&&a&&i.repriceTo(t.feeInclusive),n(r?`ready`:`failed`,{supportsBuyerFee:a,submitButton:i.submitButtonOf(e.type)})})}function ho(e,t){let{origins:n,handoff:r,branding:i,...a}=e,o=n??Ba?.origins,s=r??Ba?.port,c=`wpr_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,l=new Set,u=new Set,d=new Ua({requestShipping:!1,...a},{...Ga,billingAddressChange:e=>{let t=[...l];for(let n of t)try{Promise.resolve(n(e)).catch(()=>e.updateWith({}))}catch{e.updateWith({})}return t.length}},{origins:o,...s?{handoff:s}:{},...i?{brandingReport:i}:{},promoCodeChange:e=>{let t=[...u];for(let n of t)try{Promise.resolve(n(e)).catch(()=>e.updateWith({}))}catch{e.updateWith({})}return t.length}}),f={request:{canMakePayment:()=>d.canMakePayment(),show:(e,t)=>d.show(e,t),onBillingAddressChange:e=>(l.add(e),()=>l.delete(e)),onPromoCodeChange:e=>(u.add(e),()=>u.delete(e))},owner:e.owner,status:`priming`};uo.set(c,f),d.probeOne(e.type).then(e=>{f.status=e?`ready`:`failed`,t?.(e,d)}).catch(()=>{f.status=`failed`,t?.(!1,d)});for(let[e,t]of uo)if(t.owner===f.owner){if(go(f.owner)<=fo)break;uo.delete(e)}return c}function go(e){let t=0;for(let n of uo.values())n.owner===e&&(t+=1);return t}function _o(e){return uo.get(e)?.request}function vo(e){return uo.get(e)?.status??`unknown`}function yo(e){uo.delete(e)}async function bo(e){return!e.accountId||!e.currency?{applePay:!1,googlePay:!1}:new Ua({...e,accountId:e.accountId,currency:e.currency,amount:e.amount??0},Ga,Ba?{origins:Ba.origins}:void 0).canMakePayment()}async function xo(e,t){let n=e.controllerState();if(n.selectedTemplate===`wallet_sheet`&&e.children.payment.created){let r=e.hostState.walletPrime;if(!r||n.selectedType&&r.type!==n.selectedType)throw Error(`The wallet sheet is not primed — reselect the payment method and try again`);let i=e.hostState.walletAvailability;if((r.type===`apple_pay`?i?.applePay:i?.googlePay)===!1)throw Error(`${r.type} is not available on this device for this page`);let a=n.charge;if(a?.configured&&a.currency!==void 0&&a.amount!==void 0&&Ka({currency:a.currency,amount:a.amount,setupFutureUsage:a.setupFutureUsage})!==r.chargeKey)throw Error(`The amount changed after this wallet was selected — reselect the payment method to continue`);let o=(e.primed??_o)(r.prKey);if(!o)throw Error(`The wallet sheet is not primed — reselect the payment method and try again`);let s=(e.primedStatus??vo)(r.prKey);if(s===`priming`)throw Error(`${r.type} is still getting ready — try again in a moment`);if(s===`failed`)throw Error(`${r.type} could not be prepared — reselect the payment method and try again`);let c=t?.billingDetails?.email?.trim()||(e.children.email.created?n.buyerEmail.trim():``);if(!c)throw Error(`A ${r.type} payment needs the buyer's email before the sheet can open — pass billingDetails.email or collect one first`);let l=e.checkoutSession,u=l?So(o,l,{supportsBuyerFee:r.supportsBuyerFee,currency:r.currency}):void 0;try{let e=await o.show(r.type,{email:c});return{confirmationToken:e.ctok,type:e.type}}finally{u?.()}}return await e.mint(t??{})}function So(e,t,n){let{supportsBuyerFee:r,currency:i,promo:a}=n,o,s,c=async(e,n)=>{let a=await R().checkoutSessions.calculateBreakdown(t.id,{client_secret:t.clientSecret,...e?{address:e}:{},supports_buyer_fee:r,...n===void 0?{}:{promo_code:n}}),o=a.calculated_for;return o!=null&&i!==void 0&&o.currency===i&&a.total.currency===i&&(o.supports_buyer_fee??void 0)===r&&(e?o.address?.country===e.country&&(o.address?.postal_code??void 0)===e.postal_code&&(o.address?.state??void 0)===e.state&&(o.address?.city??void 0)===e.city:o.address==null)&&(n===void 0||`promo_code`in o&&(o.promo_code??null)===n)?a:null},l=e.onBillingAddressChange(async({address:e,updateWith:t})=>{let n=Co(e);if(!n){t({});return}o=n;try{let e=await c(n,s);if(!e){t({});return}
12t({amount:De(Number(e.total.amount),e.total.currency)})}catch{t({})}}),u=a?e.onPromoCodeChange?.(async({code:e,updateWith:t})=>{try{let n=await c(o,e);if(!n){t({error:{message:a.failureMessage}});return}s=e,a.onCodeApplied(e);let r=e?n.adjustments.find(e=>e.kind===`discount`):void 0;t({amount:De(Number(n.total.amount),n.total.currency),...e?{appliedDescription:a.describeApplied(r?.amount??null)}:{}})}catch(e){t({error:{message:Oe(e,a.failureMessage)}})}}):void 0;return()=>{l(),u?.()}}function Co(e){if(!e.country)return null;let t={country:e.country};return e.city&&(t.city=e.city),e.state&&(t.state=e.state),e.postal_code&&(t.postal_code=e.postal_code),t}function wo(e){let t=e[e.category];return!t||typeof t!=`object`?{}:t}function To(e){let t=e[e.category];return!t||typeof t!=`object`?null:t.installment_count??null}function Eo(e){let t=e[e.category];if(!(!t||typeof t!=`object`))return t.public_key??void 0}var Do=[`redirect`,`bnpl_confirm`,`bank_connect`,`bank_wire`,`wallet_sheet`,`none`];function Oo(e){let t=e.detail.template;return Do.includes(t)?t:`redirect`}function ko(e,t,n){if(!t)return n??!0;let r=t.enabled??[];return(t.include_platform_defaults??!0)&&(n??!0)&&!(t.disabled??[]).includes(e)||r.includes(e)}function Ao(e){return e.supports_fresh_collection??e.category!==`balance`}function jo(e){return`abstract`in e&&e.abstract===!0}var Mo=[`card`,`wallet`,`bank_debit`,`bank_transfer`,`voucher`,`redirect`,`crypto`,`balance`];function No(e,t){let n=t?.toLowerCase(),r=n?e.countries.find(e=>e.country.toLowerCase()===n):void 0;return r?{min:r.min_amount,max:r.max_amount}:{min:e.min_amount,max:e.max_amount}}function Po(e,t,n){return e===null?!0:(t==null||e>=t)&&(n==null||e<=n)}
12function Fo(e,t,n){let r=e.currencies[t.toLowerCase()];return r?r.countries.filter(e=>e.country===`*`||Po(n,e.min_amount,e.max_amount)).map(e=>e.country):[]}function Io(e,t,n,r){let i=e.currencies[t.toLowerCase()];if(!i)return!1;let a=r.toLowerCase(),o=i.countries.find(e=>e.country?.toLowerCase()===a)??i.countries.find(e=>e.country===`*`)??i.countries.find(e=>!e.country);return o!==void 0&&Po(n,o.min_amount,o.max_amount)}function Lo(e,t,n,r,i,a,o){return ko(e.type,a,e.platform_default)?zo(e,t,n,r,i,o):!1}function Ro(e,t,n,r,i,a){return zo(e,t,n,r,i,a)}function zo(e,t,n,r,i,a){if(!Mo.includes(e.category)||!e.usage.one_time||r===`off_session`&&!e.usage.off_session||r===`on_session`&&!e.usage.on_session||e.category===`card`&&!e.card?.public_key||(e.required_fields??[]).some(e=>e.secure)&&!Eo(e)||Oo(e)===`wallet_sheet`&&(e.type===`apple_pay`&&!i?.applePay||e.type===`google_pay`&&!i?.googlePay))return!1;let o=e.currencies[t.toLowerCase()];if(!o)return!1;let{min:s,max:c}=No(o,a);return Po(n,s,c)}function Bo(e,t,n){let r=e/10**we(t);try{return new Intl.NumberFormat(n,{style:`currency`,currency:t.toUpperCase()}).format(r)}catch{return`${r} ${t.toUpperCase()}`}}function Vo({entry:e,small:t,square:n}){return(0,Q.jsx)(Le,{icons:e.icons,shape:n?`square`:`card`,size:t?17:19,fallback:(0,Q.jsx)(Ho,{entry:e,small:t})})}function Ho({entry:e,small:t}){let n=e.detail?.icon??(e.category===`card`?`card`:e.category===`bank_debit`||e.category===`bank_transfer`?`bank`:e.category===`wallet`||e.category===`balance`?`wallet`:void 0),r=n===`card`?t?C:w:n===`bank`?y:n===`wallet`?x:n===`installments`?T:void 0;if(r)return(0,Q.jsx)(`span`,{className:t?`[&>svg]:size-3.5`:`[&>svg]:size-4`,children:(0,Q.jsx)(r,{})});let i=e.display_name.trim().charAt(0).toUpperCase();return(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`bg-gray-a4 text-gray-11 flex items-center justify-center rounded-[3px] font-semibold`,t?`size-3.5 text-[8px]`:`size-4 text-[9px]`),children:i})}var Uo=`US`;function Wo(e){let t=e.replace(/[^\d+]/g,``);return t.startsWith(`+`)?`+${t.slice(1).replaceAll(`+`,``)}`:t.replaceAll(`+`,``)}function Go(e){return new dr(e.startsWith(`+`)?void 0:Uo).input(e)}function Ko(e,t=``){let n=Wo(e);return ur(n,Uo)===`TOO_LONG`?t:(e.length<t.length&&Go(n)===t&&(n=n.slice(0,-1)),Go(n))}function qo(e){let t=Wo(e);if(t===``)return;let n=ve(t,Uo);return n?.isPossible()?n.number:void 0}function Jo(e,t){if(!e)return;let n=ve(e.startsWith(`tel:`)?e.slice(4):e);if(n?.isPossible()&&!(t?.length&&!t.some(e=>e.toUpperCase()===n.country)))return n.number}var Yo=`https://whop.com`,Xo=`https://whop.com/?a=tristan`;function Zo(){return typeof window<`u`&&!je()?Xo:Yo}var Qo=B(`branding`).doc(`Whop's merchant-of-record notice: the Whop wordmark with links to the buyer terms and privacy policy. Mount it alongside every payment collection surface.`).loading(()=>{"use loading";return(0,Q.jsx)(`div`,{"aria-hidden":!0,className:`h-5 w-full`})}).demo(e=>e.props(()=>({}))).render(()=>{"use embed";return(0,Q.jsx)($o,{whopUrl:Zo()})});function $o({whopUrl:e}){let t=_(),n=`text-gray-a10 whitespace-nowrap no-underline hover:underline`,r=`text-[13px] leading-[1.2]`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-4 pt-1`,children:[(0,Q.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:D(n,`flex items-center`),children:(0,Q.jsx)(s,{size:`1`,className:r,children:t.rich(`Afmcjq`,{whop:e=>(0,Q.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center align-middle`,children:[(0,Q.jsx)(Re,{"aria-hidden":!0,className:`h-3 w-auto opacity-70 grayscale`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e})]})})})}),(0,Q.jsx)(`div`,{className:`border-gray-a5 h-4 w-px border-r`}),(0,Q.jsx)(`a`,{href:`https://whop.com/buyer-terms/`,target:`_blank`,rel:`noreferrer noopener`,className:n,children:(0,Q.jsx)(s,{size:`1`,className:r,children:t(`xkr+zo`)})}),(0,Q.jsx)(`a`,{href:`https://whop.com/privacy/`,target:`_blank`,rel:`noreferrer noopener`,className:n,children:(0,Q.jsx)(s,{size:`1`,className:r,children:t(`cXBJ7U`)})})]})}var es=B(`address-suggestions`).internal().doc("The address autocomplete overlay — suggestion rows plus `Enter address manually`, anchored beside the street field.").props(e=>({predictions:e.fromController().doc(`The live suggestions, projected from controller state.`),highlightedIndex:e.fromController().doc(`The keyboard highlight, driven by the street field's arrow keys through the controller.`),searching:e.fromController().doc(`Whether a result for the current query is still in flight — suppresses the "no matches" line.`)})).events(e=>({picked:e.internal().doc(`A suggestion row was pressed — the field resolves it and the frame closes.`),manualRequested:e.internal().doc(`"Enter address manually" was pressed — the form reveals its full country format and the frame closes.`),hovered:e.internal().doc(`The pointer moved onto a row — the street field moves its highlight to match.`)})).loading(()=>{"use loading";let e={height:28,borderRadius:6,background:`var(--gray-a3, #f0f0f3)`,marginBottom:4};return(0,Q.jsxs)(`div`,{"aria-busy":`true`,children:[(0,Q.jsx)(`div`,{style:e}),(0,Q.jsx)(`div`,{style:e})]})}).render(e=>{"use embed";return(0,Q.jsx)(`div`,{className:`bg-panel-solid border-gray-a5 shadow-4 rounded-lg border`,children:(0,Q.jsx)(ri,{predictions:e.props.predictions,highlightedIndex:e.props.highlightedIndex,searching:e.props.searching,onPick:t=>e.emit(`picked`,{id:t}),onManual:()=>e.emit(`manualRequested`,{}),onHover:t=>e.emit(`hovered`,{index:t})})})}),ts=B(`address`).anchors(`line1`).doc(`Collects a billing or shipping address. Fields, order, and validation follow the selected country. Includes street autocomplete and methods to read or validate the address.`).props(e=>({mode:e.default(`billing`).analytics().doc("Browser autocomplete purpose: `billing` (default) or `shipping`."),layout:e.default(`full`).analytics().doc("`full` (default) stacks labeled fields. `compact` groups placeholder-labeled fields within one border."),scope:e.default(`full`).analytics().doc("`full` (default) follows the selected country's complete address format. `minimal` collects only country and postal code. `name` independently adds required name fields. Set `name` to `none` to omit them. This element does not add fields required by a payment method. Card confirmation requires a name, country, and postal code, so keep `name` enabled or pass `billingDetails.name`."),defaultValues:e.default(void 0).doc("Seed values applied once before first paint (`address.country` is an ISO 3166-1 alpha-2 country code). Takes precedence over IP-country detection."),detectCountry:e.default(!0).analytics().doc("Default the country from the buyer's IP (resolved before first paint). Falls back to the controller's `countryHint`, then US."),allowedCountries:e.default(void 0).doc(`Allowed ISO 3166-1 alpha-2 country codes. With one code, the selector remains visible but offers only that country.`),name:e.default(`combined`).analytics().doc(`The name row: one full-name field (default), split first/last fields, or none.`),organization:e.default(`none`).analytics().doc(`Organization fields: none (default), name only, or name with a business/individual selector.`),line2:e.default(`always`).analytics().doc("Address line 2: always visible (default), revealed by a text button (`toggle`), or never collected."),autocomplete:e.default(!0).analytics().doc("Enables Google Places suggestions for the street address. If no match appears or Places is blocked, the list reports no matches and lets buyers enter the address manually. Set `false` for a plain input."),customFields:e.default(void 0).doc("Additional fields rendered with the address form. Values are validated and emitted in the separate `custom` map."),suggestionPick:e.fromController().doc(`A suggestion picked in the anch
12ored overlay — nonce-keyed; the street field resolves it. Injected by the declaring controller.`),suggestionManualNonce:e.fromController().doc(`Bumped when "Enter address manually" is picked in the overlay — reveals the full country format. Injected.`),suggestionDismissNonce:e.fromController().doc(`Bumped when the host dismisses the overlay (outside press / focus loss) — closes local open state. Injected.`),suggestionHover:e.fromController().doc(`A row hovered in the overlay — nonce-keyed; moves the keyboard highlight. Injected.`),countryHint:e.default(``).analytics().doc("Fallback country after `defaultValues` and IP detection. Use an ISO 3166-1 alpha-2 code. An empty value falls back to `US`.")})).events(e=>({suggestions:e.internal().doc(`The street field published its live suggestion list — the controller mirrors it into the anchored overlay and opens/closes the frame.`),change:e.external().analytics(`complete`).doc("Fires when the address changes. `complete` is true when all country-specific fields and required custom fields are valid. `address` follows confirmation-token `billing_details` names, including `postal_code`. `country` is an ISO 3166-1 alpha-2 code. Custom values are in `custom`.")})).contributes(e=>({snapshot:e.required().doc(`The form-tree capability behind validate()/getValues(): resolves the current emitted snapshot with localized error messages, optionally flipping the form into show-all-errors mode. Routed through the inlined address-form unit controller.`)})).actions(e=>({validate:e.public(async e=>{"use embed";let t=await e.contributions.snapshot({revealErrors:!0});return{complete:t.complete,address:t.address,errors:t.errors}}).doc("Validates the form, reveals all inline errors, and never throws. Returns `complete`, `address`, and `errors`. `errors` is empty exactly when `complete` is true. Keys use contract names such as `postal_code` and `line1`, `custom:<key>` for custom fields, and transient `form` while loading."),getValues:e.public(async e=>{"use embed";let t=await e.contributions.snapshot({revealErrors:!1});return{address:t.address,custom:t.custom}}).doc("Returns `address` and `custom` without validation or revealing errors.")})).loading(()=>{"use loading";let e={height:12,width:88,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`},t={height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`};return(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:12},children:[0,1,2,3].map(n=>(0,Q.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Q.jsx)(`div`,{style:e}),(0,Q.jsx)(`div`,{style:t})]},n))})}).demo(e=>e.controls(e=>({layout:e.select(`full`,[`full`,`compact`],{label:`Layout`}),scope:e.select(`full`,[`full`,`minimal`],{label:`Scope`}),nameMode:e.select(`combined`,[`combined`,`split`,`none`],{label:`Name row`}),organization:e.select(`none`,[`none`,`name`,`name_with_type`],{label:`Organization row`}),line2:e.select(`always`,[`always`,`toggle`,`never`],{label:`Line 2`}),suggestions:e.boolean(!0,{label:`Autocomplete`})})).props(e=>({layout:e.layout,scope:e.scope,name:e.nameMode,organization:e.organization,line2:e.line2,autocomplete:e.suggestions,detectCountry:!1,suggestionPick:void 0,suggestionManualNonce:0,suggestionDismissNonce:0,suggestionHover:void 0}))).render(e=>{"use embed";let t=_(),{props:n,emit:r,anchors:i}=e,a=Hi({detectCountry:n.detectCountry}),o=(0,Z.useRef)(null),s=(0,Z.useMemo)(()=>({mode:n.mode,layout:n.layout,scope:n.scope,name:n.name,organization:n.organization,line2:n.line2,autocomplete:n.autocomplete,allowedCountries:n.allowedCountries,customFields:n.customFields,requiredFloor:n.scope===`minimal`?[`postal_code`]:void 0}),[n.mode,n.layout,n.scope,n.name,n.organization,n.line2,n.autocomplete,n.allowedCountries,n.customFields]);N(ts,`snapshot`,async({revealErrors:e})=>{let n=o.current;if(!n)return{complete:!1,address:{country:``},custom:{},errors:{form:t(`c7x4BP`)}};let r=await n.snapshot({revealErrors:e});return{...r,errors:ns(r,t)}},!0);let c=(0,Z.useCallback)(e=>{o.current=e},[]),l=(0,Z.useCallback)(e=>{r(`change`,{complete:e.complete,address:e.address,custom:e.custom})},[r]),u=(0,Z.useMemo)(()=>({anchorRef:i.line1,publish:e=>r(`suggestions`,e),pick:n.suggestionPick,manualNonce:n.suggestionManualNonce,dismissNonce:n.suggestionDismissNonce,hover:n.suggestionHover}),[i.line1,r,n.suggestionPick,n.suggestionManualNonce,n.suggestionDismissNonce,n.suggestionHover]);if(a.error)throw a.error;return(0,Q.jsx)(e.Loading,{loading:!a.ready,children:a.ready&&a.catalog?(0,Q.jsx)(`div`,{className:`p-1`,children:(0,Q.jsx)(ni.Provider,{value:u,children:(0,Q.jsx)(Ni,{config:s,catalog:a.catalog,seed:{defaultValues:n.defaultValues,detectedCountry:a.detectedCountry,countryHint:n.countryHint},children:(0,Q.jsx)(Bi,{config:s,catalog:a.catalog,connect:c,onSnapshot:l})})})}):null})});function ns(e,t){let n={};for(let[r,i]of Object.entries(e.errors))i&&(n[r]=t(i===`card_number`?`Enter card numbers only in the card number field.`:i===`required`?`Required`:`Invalid`));return n}
12var rs=B(`billing-address-suggestions`).internal().doc("The billing address autocomplete overlay — suggestion rows plus `Enter address manually`, anchored beside the billing street field.").props(e=>({predictions:e.fromController().doc(`The live suggestions, projected from controller state.`),highlightedIndex:e.fromController().doc(`The keyboard highlight, driven by the street field's arrow keys through the controller.`),searching:e.fromController().doc(`Whether a result for the current query is still in flight — suppresses the "no matches" line.`)})).events(e=>({picked:e.internal().doc(`A suggestion row was pressed — the field resolves it and the frame closes.`),manualRequested:e.internal().doc(`"Enter address manually" was pressed — the billing form reveals its full country format and the frame closes.`),hovered:e.internal().doc(`The pointer moved onto a row — the billing street field moves its highlight to match.`)})).loading(()=>{"use loading";let e={height:28,borderRadius:6,background:`var(--gray-a3, #f0f0f3)`,marginBottom:4};return(0,Q.jsxs)(`div`,{"aria-busy":`true`,children:[(0,Q.jsx)(`div`,{style:e}),(0,Q.jsx)(`div`,{style:e})]})}).render(e=>{"use embed";return(0,Q.jsx)(`div`,{className:`bg-panel-solid border-gray-a5 shadow-4 rounded-lg border`,children:(0,Q.jsx)(ri,{predictions:e.props.predictions,highlightedIndex:e.props.highlightedIndex,searching:e.props.searching,onPick:t=>e.emit(`picked`,{id:t}),onManual:()=>e.emit(`manualRequested`,{}),onHover:t=>e.emit(`hovered`,{index:t})})})});function is(e,t){let n=getComputedStyle(t).getPropertyValue(e).trim();return n.includes(`display-p3`)?as(n):n}function as(e){let t=/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+))?\)/.exec(e);if(!t)return e;let[,n,r,i,a]=t,o=`${Math.round(Number(n)*255)}, ${Math.round(Number(r)*255)}, ${Math.round(Number(i)*255)}`;return a?`rgba(${o}, ${Number(a)})`:`rgb(${o})`}function os(e){let t=is(`--gray-12`,e);return{base:{backgroundColor:`transparent`,color:t,fontFamily:getComputedStyle(e).fontFamily,fontSize:`14px`,fontWeight:`400`,lineHeight:`20px`,padding:`0px`,"::placeholder":{color:is(`--gray-a10`,e)}},complete:{color:t},empty:{color:t},invalid:{color:t},container:{backgroundColor:`transparent`}}}function ss(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(null);return(0,Z.useLayoutEffect)(()=>{if(!e)return;let t=()=>{if(!e.isConnected)return;let t=os(e);r(e=>e&&JSON.stringify(e)===JSON.stringify(t)?e:t)};t();let n=e=>e.type===`attributes`?!0:e.type===`characterData`?e.target.parentElement?.tagName===`STYLE`:e.target.tagName===`STYLE`?!0:[...e.addedNodes,...e.removedNodes].some(e=>e.nodeName===`STYLE`),i=new MutationObserver(e=>{e.some(n)&&t()});return i.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-gray-color`],characterData:!0,childList:!0,subtree:!0}),()=>i.disconnect()},[e]),{styles:n,probeRef:t}}var cs,ls=Promise.resolve();function us(e){if(cs?.publicKey===e)return cs.promise;let t=ls.then(()=>Ge(e)),n={publicKey:e,promise:t};return cs=n,ls=t.then(()=>void 0,()=>void 0),t.then(e=>{!e&&cs===n&&(cs=void 0)},()=>{cs===n&&(cs=void 0)}),t}function ds(e){let[t,n]=(0,Z.useState)(void 0),[r,i]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(!e)return;let t=!0;return us(e).then(e=>{t&&(e?(n(e),i(null)):i(`tokenizer unavailable`))}).catch(e=>{t&&i(e.message)}),()=>{t=!1,n(void 0),i(null)}},[e]),{bt:t,loadError:r}}function fs(e){return{ok:!1,code:`card_fields_not_ready`,fields:e,message:`Card fields are not ready yet`}}function ps(){return{ok:!0,grant:{tokenId:`btok_demo`,sessionKey:`key_demo_session`}}}function ms(e){return e instanceof Error&&e.message.includes(`has no ACTIVE provider`)}var hs=3600*1e3;async function gs(e,t,n,r){let i;try{i=await e.sessions.create()}catch(e){return xs(e,`card_tokenizer_session_failed`,`card_tokenizer_session_failed`)}let a=`/card-assembly/${await bs(i.nonce)}/`;try{let o=await e.tokens.create({type:`card`,data:{number:t},containers:[a],expiresAt:new Date(Date.now()+hs).toISOString()});return await ys(n,i.nonce,r)||{ok:!0,grant:{tokenId:o.id,sessionKey:i.sessionKey}}}catch(e){return xs(e,`card_number_validation_failed`,`card_number_tokenization_failed`)}}
12async function _s(e,t,n){try{return await e.tokens.update(n.tokenId,{data:{expiration_month:t.month(),expiration_year:t.year()}},{apiKey:n.sessionKey}),{ok:!0}}catch(e){return xs(e,`card_expiry_validation_failed`,`card_expiry_tokenization_failed`)}}async function vs(e,t,n){try{return await e.tokens.update(n.tokenId,{data:{cvc:t}},{apiKey:n.sessionKey}),{ok:!0}}catch(e){return xs(e,`card_cvc_validation_failed`,`card_cvc_tokenization_failed`)}}async function ys(e,t,n){try{await n.paymentMethodTypes.createCardSession({account_id:e.accountId,nonce:t});return}catch(e){return{ok:!1,code:`card_session_authorization_failed`,message:Oe(e,`card session authorization failed`)}}}async function bs(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function xs(e,t,n){let r=e instanceof Error&&e.name===`BasisTheoryValidationError`?e.details?.data:void 0;return r?{ok:!1,code:t,message:`Your card details are incomplete or invalid`,fields:{number:Ss(r.number),cvc:Ss(r.cvc),expiry:Ss(r.expiration_month)??Ss(r.expiration_year)}}:{ok:!1,code:n,message:e instanceof Error?e.message:`Card tokenization failed`}}function Ss(e){return e?.type===`invalid`||e?.type===`incomplete`?e.type:void 0}var Cs=`card-fields`,ws={stacked:{number:`top`,expiry:`bottom-left`,cvc:`bottom-right`},compact:{number:`row-start`,expiry:`row-center`,cvc:`row-end`}};function Ts(e,t){let n=(0,Z.useContext)(L);for(let r=n;r;r=r.parent)if(r.runtime.namespace===Cs)return ws[e===`compact`?`compact`:`stacked`][t]}var Es={top:`rounded-t-lg`,"bottom-left":`rounded-bl-lg`,"bottom-right":`rounded-br-lg`,"row-start":`rounded-l-lg`,"row-center":``,"row-end":`rounded-r-lg`},Ds={top:`border-stroke`,"bottom-left":`border-stroke border-t-transparent`,"bottom-right":`border-stroke border-t-transparent border-l-transparent`,"row-start":`border-stroke`,"row-center":`border-stroke border-l-transparent`,"row-end":`border-stroke border-l-transparent`};function Os({slot:e,focused:t,errorType:n,loadError:r,probeRef:i,children:a}){let o=_(),s=e?Es[e]:`rounded-lg`,c=e?Ds[e]:`border-stroke`,l=n?(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`CardFieldError`,`Card validation message`)),children:o(n===`invalid`?`89T/ze`:`kHwKVg`)}):null;return r?(0,Q.jsx)(`div`,{className:D(`border-red-a7 bg-red-a2 text-1 text-red-11 flex h-11 items-center border px-3`,s),children:o(`UpwcFd`)}
12):(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1`,z(`CardField`,`Card number, expiration, or security code field`)),children:[(0,Q.jsx)(`div`,{ref:i,className:`hidden`}),e===`top`?l:null,(0,Q.jsx)(`div`,{className:D(`relative box-border flex h-11 items-center overflow-hidden border px-3 [color-scheme:normal] transition-[box-shadow,border-color]`,z(`CardFieldInput`,`Bordered PCI input container`),s,t?`border-accent-a8 z-10 shadow-[0_0_0_3px_var(--accent-a5)] ${z(`CardFieldInputFocused`,`Focused PCI input container`)}`:c,n&&z(`CardFieldInputInvalid`,`Invalid or incomplete PCI input container`)),children:(0,Q.jsx)(`div`,{className:`w-full`,children:a})}),e===`top`?null:l]})}var ks=B(`card-cvc`).doc(`PCI-isolated hosted card security code field.`).props(e=>({tokenizer:e.fromController().doc(`Basis Theory publishable key — from the matrix card entry tokenizer configuration (undefined until the unit resolves it).`),errorType:e.fromController().doc(`Validation failure surfaced by the last tokenize attempt.`),brand:e.fromController().doc(`Detected card brand — sizes the expected security code (4 digits for amex).`),layout:e.fromController().analytics().doc(`The card unit's field arrangement — shapes this cell's chrome only when the unit's composition renders it (the fused faces); a standalone mount draws fully independent chrome.`)})).demo(e=>e.props(()=>({errorType:void 0}))).loading(e=>{"use loading";return(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{height:44,display:`flex`,alignItems:`center`,padding:`0 12px`,boxSizing:`border-box`,border:`1px solid var(--gray-a6, #e0e0e3)`,...e.layout===`compact`?{borderTopRightRadius:8,borderBottomRightRadius:8}:{borderBottomRightRadius:8}},children:(0,Q.jsx)(`div`,{style:{height:12,width:32,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}})})},{parentProps:[`layout`]}).events(e=>({input:e.internal().analytics(`field`,`complete`).doc(`Completeness as the buyer types.`)})).contributes(e=>({patch:e.required().doc("Patches the security code onto the assembly token via the live BT instance the field component holds in its ref; consumed by the `patch` action the card unit drives."),focus:e.required().doc("Focuses the live BT instance — consumed by the `focus` action (the unit's auto-advance command).")})).actions(e=>({focus:e.controllerOnly(async e=>{"use embed";try{await e.contributions.focus()}catch(e){if(!ms(e))throw e}}).doc(`Focus the hosted input — the controller's auto-advance command, executed in this frame against the live instance.`),patch:e.controllerOnly(async(e,t)=>{"use embed";try{return await e.contributions.patch(t)}catch(e){if(ms(e))return fs([`cvc`]);throw e}}).doc(`Patch the security code onto the assembly token — executed in this frame under the serializable grant.`)})).render(e=>{"use embed";let{bt:t,loadError:n}=ds(e.props.tokenizer),{styles:r,probeRef:i}=ss(),a=Ts(e.props.layout,`cvc`),o=`card-cvc-${(0,Z.useId)().replaceAll(`:`,``)}`,s=(0,Z.useRef)(null),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=!c&&!n;return N(ks,`patch`,async n=>{if(e.props.tokenizer===`demo_public_key`)return{ok:!0};let r=s.current;return!t||!r?fs([`cvc`]):vs(t,r,n)},c),N(ks,`focus`,()=>s.current?.focus(),c),(0,Q.jsx)(e.Loading,{loading:f,children:(0,Q.jsx)(Os,{slot:a,focused:u,errorType:e.props.errorType,loadError:n,probeRef:i,children:t&&r?(0,Q.jsx)(Ke,{bt:t,cardBrand:e.props.brand,id:o,autoComplete:`cc-csc`,inputMode:`numeric`,copyIconStyles:{color:`transparent`},placeholder:`CVC`,ref:s,style:r,onReady:()=>l(!0),onFocus:()=>d(!0),onBlur:()=>d(!1),onChange:t=>e.emit(`input`,{field:`cvc`,complete:t.complete})}):null})})}),As=B(`card-expiry`).doc(`PCI-isolated hosted card expiration field.`).props(e=>({tokenizer:e.fromController().doc(`Basis Theory publishable key — from the matrix card entry tokenizer configuration (undefined until the unit resolves it).`),errorType:e.fromController().doc(`Validation failure surfaced by the last tokenize attempt.`),layout:e.fromController().analytics().doc(`The card unit's field arrangement — shapes this cell's chrome only when the unit's composition renders it (the fused faces); a standalone mount draws fully independent chrome.`)})).demo(e=>e.props(()=>({errorType:void 0}))).loading(e=>{"use loading";return(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{height:44,display:`flex`,alignItems:`center`,padding:`0 12px`,boxSizing:`border-box`,border:`1px solid var(--gray-a6, #e0e0e3)`,...e.layout===`compact`?{}:{borderBottomLeftRadius:8}},children:(0,Q.jsx)(`div`,{style:{height:12,width:44,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}})})},{parentProps:[`layout`]}).events(e=>({input:e.internal().analytics(`field`,`complete`).doc(`Completeness as the buyer types.`)})).contributes(e=>({patch:e.required().doc("Patches the expiration onto the assembly token via the live BT instance the field component holds in its ref; consumed by the `patch` action the card unit drives."),focus:e.required().doc("Focuses the live BT instance — consumed by the `focus` action (the unit's auto-advance command).")})).actions(e=>({focus:e.controllerOnly(async e=>{"use embed";try{await e.contributions.focus()}catch(e){if(!ms(e))throw e}}).doc(`Focus the hosted input — the controller's auto-advance command, executed in this frame against the live instance.`),patch:e.controllerOnly(async(e,t)=>{"use embed";try{return await e.contributions.patch(t)}catch(e){if(ms(e))return fs([`expiry`]);throw e}}).doc(`Patch the expiration onto the assembly token — executed in this frame under the serializable grant.`)})).render(e=>{"use embed";let t=_(),{bt:n,loadError:r}=ds(e.props.tokenizer),{styles:i,probeRef:a}=ss(),o=Ts(e.props.layout,`expiry`),s=`card-expiry-${(0,Z.useId)().replaceAll(`:`,``)}`,c=(0,Z.useRef)(null),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),p=!l&&!r;return N(As,`patch`,async t=>{if(e.props.tokenizer===`demo_public_key`)return{ok:!0};let r=c.current;return!n||!r?fs([`expiry`]):_s(n,r,t)},l),N(As,`focus`,()=>c.current?.focus(),l),(0,Q.jsx)(e.Loading,{loading:p,children:(0,Q.jsx)(Os,{slot:o,focused:d,errorType:e.props.errorType,loadError:r,probeRef:a,children:n&&i?(0,Q.jsx)(Ye,{bt:n,id:s,autoComplete:`cc-exp`,inputMode:`numeric`,copyIconStyles:{color:`transparent`},placeholder:t(`dQc0h5`),ref:c,style:i,onReady:()=>u(!0),onFocus:()=>f(!0),onBlur:()=>f(!1),onChange:t=>e.emit(`input`,{field:`expiry`,complete:t.complete})}):null})})}),js={visa:`visa`,mastercard:`mastercard`,"american-express":`amex`,discover:`discover`,jcb:`jcb`,"diners-club":`diners`,unionpay:`unionpay`,elo:`elo`,maestro:`maestro`},Ms={visa:ze,mastercard:qe,amex:Be,discover:Xe,jcb:Qe,diners:Je,unionpay:We,elo:Ve,maestro:He};function Ns(e){if(!e?.length)return;let t=e.map(e=>Ms[e.brand]).filter(e=>e!==void 0);return t.length>0?t:void 0}var Ps=4,Fs=`url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cpath%20fill%3D'%23fff'%20fill-rule%3D'evenodd'%20d%3D'M0%200h32v32H0zM-15.2-2H8.8a6%206%200%200%201%206%206v24a6%206%200%200%201-6%206h-24a6%206%200%200%201-6-6V4a6%206%200%200%201%206-6Z'%2F%3E%3C%2Fsvg%3E")`,Is={maskImage:Fs,maskSize:`100% 100%`,WebkitMaskImage:Fs,WebkitMaskSize:`100% 100%`},Ls=B(`card-number`).doc(`PCI-isolated hosted card number field. Card numbers never reach the host page.`).props(e=>({tokenizer:e.fromController().doc(`Basis Theory publishable key — from the matrix card entry tokenizer configuration (undefined until the unit resolves it).`),errorType:e.fromController().doc(`Validation failure surfaced by the last tokenize attempt.`),brands:e.fromController().doc(`The seller's accepted card networks with their API-served 
12icons, in display order — the idle pile shows the first four, and a detected brand shows its own art. Undefined renders no brand icons.`),layout:e.fromController().analytics().doc(`The card unit's field arrangement — shapes this cell's chrome only when the unit's composition renders it (the fused faces); a standalone mount draws fully independent chrome.`)})).demo(e=>e.props(()=>({errorType:void 0}))).loading(e=>{"use loading";return(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{height:44,display:`flex`,alignItems:`center`,padding:`0 12px`,boxSizing:`border-box`,border:`1px solid var(--gray-a6, #e0e0e3)`,...e.layout===`compact`?{borderTopLeftRadius:8,borderBottomLeftRadius:8}:{borderTopLeftRadius:8,borderTopRightRadius:8}},children:(0,Q.jsx)(`div`,{style:{height:12,width:96,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}})})},{parentProps:[`layout`]}).events(e=>({input:e.internal().analytics(`field`,`complete`,`brand`).doc(`Completeness, detected brand, and the detected funding type and issuing country (BIN-derived, lowercase; null until known) as the buyer types.`)})).contributes(e=>({begin:e.required().doc("Starts the assembly against the live BT number instance the field component holds in its ref — frame-local by construction; consumed by the `begin` action the card unit drives.")})).actions(e=>({begin:e.controllerOnly(async(e,t)=>{"use embed";try{return await e.contributions.begin(t,e.sdk)}catch(e){if(ms(e))return fs([`number`]);throw e}}).doc(`The card unit's in-frame assembly starter: mints the BT session + the ephemeral card token from the number instance living in THIS frame, authorizes the session with the backend, and returns only the serializable grant the sibling fields patch against.`)})).render(e=>{"use embed";let{bt:t,loadError:n}=ds(e.props.tokenizer),{styles:r,probeRef:i}=ss(),a=Ts(e.props.layout,`number`),o=`card-number-${(0,Z.useId)().replaceAll(`:`,``)}`,s=(0,Z.useRef)(null),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(`unknown`),m=!c&&!n;return N(Ls,`begin`,async(n,r)=>{if(e.props.tokenizer===`demo_public_key`)return ps();let i=s.current;return!t||!i?fs([`number`]):gs(t,i,n,r)},c),(0,Q.jsx)(e.Loading,{loading:m,children:(0,Q.jsx)(Os,{slot:a,focused:u,errorType:e.props.errorType,loadError:n,probeRef:i,children:(0,Q.jsxs)(`div`,{className:`relative w-full`,children:[t&&r?(0,Q.jsx)(Ue,{bt:t,id:o,autoComplete:`cc-number`,inputMode:`numeric`,iconPosition:`none`,binLookup:!0,cardTypes:Ns(e.props.brands),copyIconStyles:{color:`transparent`},placeholder:`1234 1234 1234 1234`,ref:s,style:r,onReady:()=>l(!0),onFocus:()=>d(!0),onBlur:()=>d(!1),onChange:t=>{p(t.cardBrand);let n=t.binInfo,r=t.empty?null:n?.funding?.toLowerCase()??null,i=t.empty?null:n?.issuer?.country?.toLowerCase()??null;e.emit(`input`,{field:`number`,complete:t.complete,brand:t.cardBrand,funding:r,issuingCountry:i})}}):null,(e.props.brands??[]).map((e,t,n)=>{let r=Math.min(n.length,Ps),i=js[f]===e.brand,a=t<Ps,o=t>0&&a;return(0,Q.jsxs)(`span`,{"aria-hidden":`true`,style:{transform:f===`unknown`&&a?`translateX(${-1*(32+(r-1-t)*12)}px)`:void 0,zIndex:i?5:Ps-t},className:D(`pointer-events-none absolute top-1/2 -right-6 size-5 -translate-y-1/2 transition-all duration-200`,i?`-translate-x-8 opacity-100`:f!==`unknown`||!a?`opacity-0`:``),children:[(0,Q.jsx)(Le,{icons:e.icons,size:null,className:`absolute inset-0`,style:o?Is:void 0}),o?(0,Q.jsx)(Le,{icons:e.icons,size:null,className:D(`absolute inset-0 transition-opacity`,f===`unknown`&&!i?`opacity-0 duration-200`:`opacity-100 duration-100`)}):null]},e.brand)})]})})})}),Rs=`pk_live_An9JqAUvxfDwIaRwDpuL9hVS`;m();var zs=(async()=>{try{let e=Rs;return e?await(await h(async()=>{let{loadStripe:e}=await import(`./lib-BbUSTc-J.js`);return{loadStripe:e}},[])).loadStripe(e):null}catch{return null}})(),Bs,Vs=!1;async function Hs(){if(!(Vs||Bs)){Vs=!0;try{let e=await zs;if(!e)return;let t=await e.createRadarSession();if(t.error)return;let n=t.radarSession.id;typeof n==`string`&&(Bs=n)}catch{return}finally{Vs=!1}}}Hs();function Us(){let e=Bs;return Bs=void 0,Hs(),e?{"X-Stripe-Radar-Session":e}:{}}async function Ws(e,t,n,r,i){if(!t.accountId)throw Error(`No seller account is in scope for this surface`);let a=n.category===`saved`,o=a||n.category===`balance`,{type:s,...c}=n;return{confirmationToken:(await e.confirmationTokens.create({account_id:t.accountId,payment_method:a?c:n,billing_details:{...r,...i??{}},return_url:t.returnUrl??window.location.href,setup_future_usage:o?void 0:t.setupFutureUsage,browser_info:Yi()},{headers:{...M(),...n.type===`card`&&!o?Us():{},...Ji(t.branding)}}).catch(e=>{throw new Pe(`confirmation_token_create_failed`,Oe(e,`collection failed`))})).id,type:n.type}}function Gs(e){if(!e?.email)throw Error(`billingDetails.email is required`);return{...e,email:e.email}}function Ks(e){if(!e.name)throw Error(`billingDetails.name is required for card payments`)}function qs(e){let t=e?.code;return t===`CHILD_NOT_CREATED`||t===`CHILD_DESTROYED`}async function Js(e,t){for(let n of[e.payment,e.card,e.cardFields])if(n.created)try{return await n.collect(t)}catch(e){if(!qs(e))throw e}throw Error(`Mount a collection surface first — the payment element, the card element, or the card-fields unit`)}var Ys=I(`card-fields`).doc('Three separately mountable, PCI-isolated card fields for custom layouts: number, expiration, and security code. Create with `payments.create("cardFields")`, place each field, enable your payment button from `onChange`, and confirm with `payments.createConfirmationToken()`. Card numbers remain in hosted fields.').props(e=>({accountId:e.fromController().doc("The account (`biz_…`) the collection session is scoped to — injected by the declaring payments controller (its handle's `accountId`);
12 a standalone or fused in-document mount reads undefined and receives the account per-command instead (the tokenize input)."),publicKey:e.default(void 0).doc(`Advanced Basis Theory publishable key. Omit it to fetch the key automatically.`),networks:e.default(void 0).doc("The seller's accepted card networks in display order — the matrix card entry's `networks` objects, whose API-served icons drive the number field's brand art. Omit it to fetch alongside the key."),layout:e.default(`stacked`).doc("`stacked` (default) shapes composed fields as a number row above expiration and security code. `compact` shapes one row. Separately mounted fields ignore this layout and render with full borders and rounded corners.")})).state(async({props:e,sdk:t})=>({...await(async()=>{if(e.publicKey)return{publicKey:e.publicKey,networks:e.networks};if(!e.accountId)return{publicKey:void 0,networks:e.networks};let n=await $s(t,e.accountId);return{publicKey:n.publicKey,networks:e.networks??n.networks}})(),accountId:e.accountId,brand:`unknown`,funding:null,issuingCountry:null,numberComplete:!1,expiryComplete:!1,cvcComplete:!1,numberError:void 0,expiryError:void 0,cvcError:void 0})).events(e=>({change:e.external().analytics(`complete`,`brand`).doc("Fires when completeness changes. `complete` becomes true after the buyer fills all three fields. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one."),tokenized:e.internal().doc(`A card credential was minted from the fields — parent-consumable coordination, never the consumer.`)})).children(e=>({cardNumber:e(Ls).fromController(({state:e,props:t})=>{"use controller";return{tokenizer:e.publicKey,errorType:e.numberError,brands:e.networks,layout:t.layout}}),cardExpiry:e(As).fromController(({state:e,props:t})=>{"use controller";return{tokenizer:e.publicKey,errorType:e.expiryError,layout:t.layout}}),cardCvc:e(ks).fromController(({state:e,props:t})=>{"use controller";return{tokenizer:e.publicKey,errorType:e.cvcError,brand:e.brand,layout:t.layout}})})).actions(e=>({tokenize:e.controller(async(e,t)=>{"use controller";return Xs(e,t)}).analytics(`accountId`).doc("Advanced method that tokenizes the three fields without creating a confirmation token. It emits `tokenized` to the payments controller. Validation errors appear on the failing field, and the method throws. Use `payments.createConfirmationToken()` to confirm a payment."),collect:e.controller(async(e,t)=>{"use controller";let n=Gs(t?.billingDetails);Ks(n);let{token:r}=await Xs(e,{});return{paymentMethod:{type:`card`,category:`card`,card:{token:r}},billingDetails:n}}).doc("`payments.createConfirmationToken()` calls this action for `cardFields`. Don't call it directly. It tokenizes the fields and returns the data used to create the confirmation token.")})).demo(e=>e.props(()=>({accountId:`biz_demo`,layout:`stacked`})).state(()=>({publicKey:`demo_public_key`,networks:ec(),accountId:`biz_demo`,brand:`unknown`,funding:null,issuingCountry:null,numberComplete:!1,expiryComplete:!1,cvcComplete:!1,numberError:void 0,expiryError:void 0,cvcError:void 0})).sdk(()=>({paymentMethodTypes:{retrieve:{object:`payment_method_type`,type:`card`,category:`card`,display_name:`Card`,detail:{template:`none`,icon:`card`,short_name:`Card`},required_fields:[],usage:{one_time:!0,off_session:!0,on_session:!0},currencies:{eur:{min_amount:null,max_amount:null,countries:[{country:`DE`,min_amount:null,max_amount:null}]}},card:{public_key:`demo_public_key`,networks:ec()}}}}))).on(e=>{e.controller(Ls,`input`,(e,t)=>{"use controller";e.setState({numberComplete:t.complete,brand:t.brand,funding:t.funding,issuingCountry:t.issuingCountry,numberError:void 0}),Zs(e,{numberComplete:t.complete,brand:t.brand,funding:t.funding,issuingCountry:t.issuingCountry}),t.complete&&e.children.cardExpiry.focus()}),e.controller(As,`input`,(e,t)=>{"use controller";e.setState({expiryComplete:t.complete,expiryError:void 0}),Zs(e,{expiryComplete:t.complete}),t.complete&&e.children.cardCvc.focus()}),e.controller(ks,`input`,(e,t)=>{"use controller";e.setState({cvcComplete:t.complete,cvcError:void 0}),Zs(e,{cvcComplete:t.complete})})});async function Xs(e,t){let n=t?.accountId??e.state.accountId;if(!n)throw Error(`No seller account is in scope for the card unit`);let r=await e.children.cardNumber.begin({accountId:n}
12);if(!r.ok)throw Qs(e,r);let i=await e.children.cardExpiry.patch(r.grant);if(!i.ok)throw Qs(e,i,`expiry`);let a=await e.children.cardCvc.patch(r.grant);if(!a.ok)throw Qs(e,a,`cvc`);return e.setState({numberError:void 0,expiryError:void 0,cvcError:void 0}),e.emit(`tokenized`,{token:r.grant.tokenId}),{token:r.grant.tokenId}}function Zs(e,t){let n={...e.state,...t};e.emit(`change`,{complete:n.numberComplete&&n.expiryComplete&&n.cvcComplete,brand:n.brand,funding:n.funding,issuingCountry:n.issuingCountry})}function Qs(e,t,n){if(t.code!==`card_fields_not_ready`){let r=t.fields??(n?{[n]:`invalid`}:{});e.setState({numberError:r.number,expiryError:r.expiry,cvcError:r.cvc})}return new Pe(t.code,t.message)}async function $s(e,t){let n=await e.paymentMethodTypes.retrieve(`card`,{account_id:t}).catch(e=>{throw Error(Oe(e,`card config fetch failed`))}),r=n.card?.public_key;if(!r)throw Error(`card payments are not available for this account`);return{publicKey:r,networks:n.card?.networks}}function ec(){return[`visa`,`mastercard`,`amex`,`discover`].map(e=>({brand:e,icons:{square:{light:{svg:`https://content.whop.com/payment_methods/${e}/icons/square_light.svg`},dark:{svg:`https://content.whop.com/payment_methods/${e}/icons/square_dark.svg`}}}}))}var tc=(e,t=12)=>({height:t,width:e,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}),nc={display:`flex`,alignItems:`center`,height:44,padding:`0 12px`},rc={borderRadius:8,border:`1px solid var(--gray-a6, #e0e0e3)`,overflow:`hidden`},ic=`1px solid var(--gray-a5, #e8e8ec)`;function ac({layout:e,label:t=!1}){return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton animate-pulse`,style:{display:`flex`,flexDirection:`column`,gap:4},children:[t&&(0,Q.jsx)(`div`,{style:tc(120,16)}),e===`compact`?(0,Q.jsxs)(`div`,{style:{...rc,display:`flex`},children:[(0,Q.jsx)(`div`,{style:{...nc,flex:1,minWidth:0},children:(0,Q.jsx)(`div`,{style:tc(96)})}),(0,Q.jsx)(`div`,{style:{...nc,width:88,borderLeft:ic},children:(0,Q.jsx)(`div`,{style:tc(44)})}),(0,Q.jsx)(`div`,{style:{...nc,width:72,borderLeft:ic},children:(0,Q.jsx)(`div`,{style:tc(32)})})]}):(0,Q.jsxs)(`div`,{style:{...rc,display:`flex`,flexDirection:`column`},children:[(0,Q.jsx)(`div`,{style:nc,children:(0,Q.jsx)(`div`,{style:tc(96)})}),(0,Q.jsxs)(`div`,{style:{display:`flex`,borderTop:ic},children:[(0,Q.jsx)(`div`,{style:{...nc,flex:1},children:(0,Q.jsx)(`div`,{style:tc(44)})}),(0,Q.jsx)(`div`,{style:{...nc,flex:1,borderLeft:ic},children:(0,Q.jsx)(`div`,{style:tc(32)})})]})]})]})}var oc=B(`card`).doc('Prearranged fields for card number, expiration, and security code. Create with `payments.create("card")`, enable your payment button from `onChange`, and confirm with `payments.createConfirmationToken()`. Card numbers remain in PCI-isolated hosted fields. `layout` supports `stacked` (default) and `compact`.').props(e=>({layout:e.default(`stacked`).analytics().doc("`stacked` (default) places the card number above expiration and security code. `compact` places all three in one row."),accountId:e.fromController().analytics().doc("The account (`biz_…`) the collection session is scoped to — injected by the declaring payments controller (its handle's `accountId`).")})).events(e=>({change:e.external().analytics(`complete`,`brand`).doc("Fires when card fields change. `complete` becomes true after the buyer fills all three. Use it to enable confirmation. `brand` is the detected card network. `funding` is the detected funding type (`credit`, `debit`, or `prepaid`), `null` until the number identifies one. `issuingCountry` is the lowercase two-letter code of the country the card was issued in, `null` until the number identifies one.")})).contributes(e=>({tokenize:e.required().doc("Validates card billing needs and tokenizes the inlined card-fields unit — registered by the render tree beside the unit (it holds the unit's live handle); consumed by the `collect` action the controller mints from.")})).actions(e=>({collect:e.controllerOnly(async(e,t)=>{"use embed";let n=Gs(t?.billingDetails),{token:r}=await e.contributions.tokenize({billingDetails:n});return{paymentMethod:{type:`card`,category:`card`,card:{token:r}},billingDetails:n}}).doc("The fused card face's collection — reached ONLY through `payments.createConfirmationToken` (the confirm cascade): tokenizes the inlined unit through the element-contained contribution and returns the collected bag the controller mints from.")})).demo(e=>
12e.controls(e=>({layout:e.select(`stacked`,[`stacked`,`compact`],{label:`Field arrangement`})})).props(e=>({layout:e.layout}))).loading(e=>{"use loading";return(0,Q.jsx)(ac,{layout:e.layout===`compact`?`compact`:`stacked`})},{props:[`layout`]}).render(e=>{"use embed";let t=_(),{props:n,emit:r}=e,i=be(),a=n.accountId??``,o=p({queryKey:[`paymentMethodTypes`,`retrieve`,`card`,{account_id:a}],queryFn:async()=>await i.paymentMethodTypes.retrieve(`card`,{account_id:a})}),s=o.data?.card?.public_key??null,c=o.error?Oe(o.error,`card config fetch failed`):o.data&&!s?`card payments are not available for this account`:null,l=!s&&!c;return(0,Q.jsx)(e.Loading,{loading:l,children:l?null:c||!s?(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`CardError`,`Card configuration error pane`)),children:[(0,Q.jsx)(`span`,{className:`bg-red-a3 text-4 text-red-11 flex size-10 items-center justify-center rounded-full`,children:`!`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:t(`zAmQWN`)}),(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 max-w-80`,children:c})]}):(0,Q.jsx)(`div`,{className:D(`flex flex-col gap-3 p-1`,z(`Card`,`Card element root`)),children:(0,Q.jsx)(Ys,{publicKey:s,layout:n.layout,fallback:(0,Q.jsx)(e.Loading,{}),onChange:e=>r(`change`,e),children:(0,Q.jsx)(sc,{})})})})});function sc(){let{props:e}=P(),t=V(Ys);return N(oc,`tokenize`,async({billingDetails:n})=>(Ks(n),t.tokenize({accountId:e.accountId})),!0),(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.layout===`compact`?(0,Q.jsxs)(`div`,{className:D(`shadow-black-a1 flex rounded-lg shadow-xs`,z(`CardFieldRow`,`Compact card number, expiration, and security code row`)),children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(Ls,{})}),(0,Q.jsx)(`div`,{className:`-ml-px w-[5.5rem] shrink-0`,children:(0,Q.jsx)(As,{})}),(0,Q.jsx)(`div`,{className:`-ml-px w-[4.5rem] shrink-0`,children:(0,Q.jsx)(ks,{})})]}):(0,Q.jsxs)(`div`,{className:D(`shadow-black-a1 flex flex-col rounded-lg shadow-xs`,z(`CardFieldGroup`,`Stacked card number, expiration, and security code fields`)),children:[(0,Q.jsx)(Ls,{}),(0,Q.jsxs)(`div`,{className:`-mt-px flex w-full`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(As,{})}),(0,Q.jsx)(`div`,{className:`-ml-px min-w-0 flex-1`,children:(0,Q.jsx)(ks,{})})]})]})})}var cc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function e(n,r){t(this,e),this.data=n,this.text=r.text||n,this.options=r}})),lc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE39=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(cc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),e=e.toUpperCase(),t.mod43&&(e+=f(m(e))),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=u(`*`),t=0;t<this.data.length;t++)e+=u(this.data[t])+`0`;return e+=u(`*`),{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),n}(n.default),c=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*`.split(``),l=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,3
120065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function u(e){return d(p(e))}function d(e){return l[e].toString(2)}function f(e){return c[e]}function p(e){return c.indexOf(e)}function m(e){for(var t=0,n=0;n<e.length;n++)t+=p(e[n]);return t%=43,t}e.CODE39=s})),uc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=e.SET_A=0,i=e.SET_B=1,a=e.SET_C=2;e.SHIFT=98;var o=e.START_A=103,s=e.START_B=104,c=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(t={},n(t,o,r),n(t,s,i),n(t,c,a),t),e.SWAP={101:r,100:i,99:a},e.A_START_CHAR=`Ð`,e.B_START_CHAR=`Ñ`,e.C_START_CHAR=`Ò`,e.A_CHARS=`[\0-_È-Ï]`,e.B_CHARS=`[ -�È-Ï]`,e.C_CHARS=`(Ï*[0-9]{2}Ï*)`,e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]})),dc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(cc()),r=uc();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){a(this,n);var r=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.substring(1),t));return r.bytes=e.split(``).map(function(e){return e.charCodeAt(0)}),r}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.bytes,t=e.shift()-105,i=r.SET_BY_CODE[t];if(i===void 0)throw RangeError(`The encoding does not start with a start character.`);this.shouldEncodeAsEan128()===!0&&e.unshift(r.FNC1);var a=n.next(e,1,i);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,``):this.text,data:n.getBar(t)+a.result+n.getBar((a.checksum+t)%r.MODULO)+n.getBar(r.STOP)}}},{key:`shouldEncodeAsEan128`,value:function(){var e=this.options.ean128||!1;return typeof e==`string`&&(e=e.toLowerCase()===`true`),e}}],[{key:`getBar`,value:function(e){return r.BARS[e]?r.BARS[e].toString():``}},{key:`correctIndex`,value:function(e,t){if(t===r.SET_A){var n=e.shift();return n<32?n+64:n-32}else if(t===r.SET_B)return e.shift()-32;else return(e.shift()-48)*10+e.shift()-48}},{key:`next`,value:function(e,t,i){if(!e.length)return{result:``,checksum:0};var a=void 0,o=void 0;if(e[0]>=200){o=e.shift()-105;var s=r.SWAP[o];s===void 0?((i===r.SET_A||i===r.SET_B)&&o===r.SHIFT&&(e[0]=i===r.SET_A?e[0]>95?e[0]-96:e[0]:e[0]<32?e[0]+96:e[0]),a=n.next(e,t+1,i)):a=n.next(e,t+1,s)}else o=n.correctIndex(e,i),a=n.next(e,t+1,i);var c=n.getBar(o),l=o*t;return{result:c+a.result,checksum:l+a.checksum}}}]),n}(n.default)})),fc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=uc(),n=function(e){return e.match(RegExp(`^`+t.A_CHARS+`*`))[0].length},r=function(e){return e.match(RegExp(`^`+t.B_CHARS+`*`))[0].length},i=function(e){return e.match(RegExp(`^`+t.C_CHARS+`*`))[0]};function a(e,n){var r=n?t.A_CHARS:t.B_CHARS,i=e.match(RegExp(`^(`+r+`+?)(([0-9]{2}){2,})([^0-9]|$)`));if(i)return i[1]+`Ì`+o(e.substring(i[1].length));var s=e.match(RegExp(`^`+r+`+`))[0];return s.length===e.length?e:s+String.fromCharCode(n?205:206)+a(e.substring(s.length),!n)}function o(e){var t=i(e),o=t.length;if(o===e.length)return e;e=e.substring(o);var s=n(e)>=r(e);return t+String.fromCharCode(s?206:205)+a(e,s)}e.default=function(e){var s=void 0;if(i(e).length>=2)s=t.C_START_CHAR+o(e);else{var c=n(e)>r(e);s=(c?t.A_START_CHAR:t.B_START_CHAR)+a(e,c)}return s.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(e,t){return`Ë`+t})}})),pc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(dc()),n=r(fc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){if(i(this,t),/^[\x00-\x7F\xC8-\xD3]+$/.test(e))var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,n.default)(e),r));else var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return a(o)}return t}(t.default)})),mc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(dc()),r=uc();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.A_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.A_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),hc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(dc()),r=uc();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.B_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.B_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),gc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(dc()),r=uc();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.C_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.C_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),_c=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var t=a(pc()),n=a(mc()),r=a(hc()),i=a(gc());function a(e){return e&&e.__esModule?e:{default:e}}e.CODE128=t.default,e.CODE128A=n.default,e.CODE128B=r.default,e.CODE128C=i.default})),vc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIDE_BIN=`101`,e.MIDDLE_BIN=`01010`,e.BINARIES={L:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],G:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],R:[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],O:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],E:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`]},e.EAN2_STRUCTURE=[`LL`,`LG`,`GL`,`GG`],e.EAN5_STRUCTURE=[`GGLLL`,`GLGLL`,`GLLGL`,`GLLLG`,`LGGLL`,`LLGGL`,`LLLGG`,`LGLGL`,`LGLLG`,`LLGLG`],e.EAN13_STRUCTURE=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`]})),yc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=vc();e.default=function(e,n,r){var i=e.split(``).map(function(e,r){return t.BINARIES[n[r]]}).map(function(t,n){return t?t[e[n]]:``});if(r){var a=e.length-1;i=i.map(function(e,t){return t<a?e+r:e})}return i.join(``)}})),bc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=vc(),r=a(yc()),i=a(cc());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){o(this,i);var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.fontSize=!t.flat&&t.fontSize>t.width*10?t.width*10:t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(i,[{key:`encode`,value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:`leftText`,value:function(e,t){return this.text.substr(e,t)}},{key:`leftEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`rightText`,value:function(e,t){return this.text.substr(e,t)}},{key:`rightEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`encodeGuarded`,value:function(){var e={fontSize:this.fontSize},t={height:this.guardHeight};return[{data:n.SIDE_BIN,options:t},{data:this.leftEncode(),text:this.leftText(),options:e},{data:n.MIDDLE_BIN,options:t},{data:this.rightEncode(),text:this.rightText(),options:e},{data:n.SIDE_BIN,options:t}]}},{key:`encodeFlat`,value:function(){return{data:[n.SIDE_BIN,this.leftEncode(),n.MIDDLE_BIN,this.rightEncode(),n.SIDE_BIN].join(``),text:this.text}}}]),i}(i.default)})),xc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=vc(),i=a(bc());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return(10-e.substr(0,12).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*3:e+t},0)%10)%10};e.default=function(e){c(i,e);function i(e,t){o(this,i),e.search(/^[0-9]{12}$/)!==-1&&(e+=l(e));var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.lastChar=t.lastChar,n}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===l(this.data)}},{key:`leftText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftText`,this).call(this,1,6)}},{key:`leftEncode`,value:function(){var e=this.data.substr(1,6),t=r.EAN13_STRUCTURE[this.data[0]];return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftEncode`,this).call(this,e,t)}},{key:`rightText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightText`,this).call(this,7,6)}},{key:`rightEncode`,value:function(){var e=this.data.substr(7,6);return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightEncode`,this).call(this,e,`RRRRRR`)}},{key:`encodeGuarded`,value:function(){var e=n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`encodeGuarded`,this).call(this);return this.options.displayValue&&(e.unshift({data:`000000000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),this.options.lastChar&&(e.push({data:`00`}),e.push({data:`00000`,text:this.options.lastChar,options:{fontSize:this.fontSize}}))),e}}]),i}(i.default)})),Sc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=i(bc());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){return(10-e.substr(0,7).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t:e+t*3},0)%10)%10};e.default=function(e){s(r,e);function r(e,t){return a(this,r),e.search(/^[0-9]{7}$/)!==-1&&(e+=c(e)),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===c(this.data)}},{key:`leftText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftText`,this).call(this,0,4)}},{key:`leftEncode`,value:function(){var e=this.data.substr(0,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftEncode`,this).call(this,e,`LLLL`)}},{key:`rightText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightText`,this).call(this,4,4)}},{key:`rightEncode`,value:function(){var e=this.data.substr(4,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightEncode`,this).call(this,e,`RRRR`)}}]),r}(r.default)})),Cc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=vc(),r=a(yc()),i=a(cc());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return e.split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*9:e+t*3},0)%10};e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN5_STRUCTURE[l(this.data)];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),wc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=vc(),r=a(yc()),i=a(cc());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),Tc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();e.checksum=l;var n=i(yc()),r=i(cc());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(r,e);function r(e,t){a(this,r),e.search(/^[0-9]{11}$/)!==-1&&(e+=l(e));var n=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==l(this.data)}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=(0,n.default)(this.data.substr(0,6),`LLLLLL`),e+=`01010`,e+=(0,n.default)(this.data.substr(6,6),`RRRRRR`),e+=`101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`+(0,n.default)(this.data[0],`L`),options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(1,5),`LLLLL`),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:`01010`,options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(6,5),`RRRRR`),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:(0,n.default)(this.data[11],`R`)+`101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text.substr(11,1),options:{textAlign:`right`,fontSize:this.fontSize}}),e}}]),r}(r.default);function l(e){var t=0,n;for(n=1;n<11;n+=2)t+=parseInt(e[n]);for(n=0;n<11;n+=2)t+=parseInt(e[n])*3;return(10-t%10)%10}e.default=c})),Ec=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=a(yc()),r=a(cc()),i=Tc();function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=[`XX00000XXX`,`XX10000XXX`,`XX20000XXX`,`XXX00000XX`,`XXXX00000X`,`XXXXX00005`,`XXXXX00006`,`XXXXX00007`,`XXXXX00008`,`XXXXX00009`],u=[[`EEEOOO`,`OOOEEE`],[`EEOEOO`,`OOEOEE`],[`EEOOEO`,`OOEEOE`],[`EEOOOE`,`OOEEEO`],[`EOEEOO`,`OEOOEE`],[`EOOEEO`,`OEEOOE`],[`EOOOEE`,`OEEEOO`],[`EOEOEO`,`OEOEOE`],[`EOEOOE`,`OEOEEO`],[`EOOEOE`,`OEEOEO`]],d=function(e){c(r,e);function r(e,t){o(this,r);var n=s(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));if(n.isValid=!1,e.search(/^[0-9]{6}$/)!==-1)n.middleDigits=e,n.upcA=f(e,`0`),n.text=t.text||``+n.upcA[0]+e+n.upcA[n.upcA.length-1],n.isValid=!0;else if(e.search(/^[01][0-9]{7}$/)!==-1)if(n.middleDigits=e.substring(1,e.length-1),n.upcA=f(n.middleDigits,e[0]),n.upcA[n.upcA.length-1]===e[e.length-1])n.isValid=!0;else return s(n);else return s(n);return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.isValid}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=this.encodeMiddleDigits(),e+=`010101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text[0],options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`,options:{height:this.guardHeight}}),e.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),e.push({data:`010101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text[7],options:{textAlign:`right`,fontSize:this.fontSize}}),e}},{key:`encodeMiddleDigits`,value:function(){var e=this.upcA[0],t=this.upcA[this.upcA.length-1],r=u[parseInt(t)][parseInt(e)];return(0,n.default)(this.middleDigits,r)}}]),r}(r.default);function f(e,t){for(var n=l[parseInt(e[e.length-1])],r=``,a=0,o=0;o<n.length;o++){var s=n[o];s===`X`?r+=e[a++]:r+=s}return r=``+t+r,``+r+(0,i.checksum)(r)}e.default=d}
12)),Dc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UPCE=e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var t=s(xc()),n=s(Sc()),r=s(Cc()),i=s(wc()),a=s(Tc()),o=s(Ec());function s(e){return e&&e.__esModule?e:{default:e}}e.EAN13=t.default,e.EAN8=n.default,e.EAN5=r.default,e.EAN2=i.default,e.UPC=a.default,e.UPCE=o.default})),Oc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.START_BIN=`1010`,e.END_BIN=`11101`,e.BINARIES=[`00110`,`10001`,`01001`,`11000`,`00101`,`10100`,`01100`,`00011`,`10010`,`01010`]})),kc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=Oc(),r=i(cc());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:`encode`,value:function(){var e=this,t=this.data.match(/.{2}/g).map(function(t){return e.encodePair(t)}).join(``);return{data:n.START_BIN+t+n.END_BIN,text:this.text}}},{key:`encodePair`,value:function(e){var t=n.BINARIES[e[1]];return n.BINARIES[e[0]].split(``).map(function(e,n){return(e===`1`?`111`:`1`)+(t[n]===`1`?`000`:`0`)}).join(``)}}]),r}(r.default)})),Ac=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){var t=e.substr(0,13).split(``).map(function(e){return parseInt(e,10)}).reduce(function(e,t,n){return e+t*(3-n%2*2)},0);return Math.ceil(t/10)*10-t};e.default=function(e){o(n,e);function n(e,t){return i(this,n),e.search(/^[0-9]{13}$/)!==-1&&(e+=s(e)),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===s(this.data)}}]),n}(n.default)})),jc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ITF14=e.ITF=void 0;var t=r(kc()),n=r(Ac());function r(e){return e&&e.__esModule?e:{default:e}}e.ITF=t.default,e.ITF14=n.default})),Mc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(cc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=`110`,t=0;t<this.data.length;t++){var n=parseInt(this.data[t]).toString(2);n=c(n,4-n.length);for(var r=0;r<n.length;r++)e+=n[r]==`0`?`100`:`110`}return e+=`1001`,{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),n}(n.default);function c(e,t){for(var n=0;n<t;n++)e=`0`+e;return e}e.default=s})),Nc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=t,e.mod11=n;function t(e){for(var t=0,n=0;n<e.length;n++){var r=parseInt(e[n]);(n+e.length)%2==0?t+=r:t+=r*2%10+Math.floor(r*2/10)}return(10-t%10)%10}function n(e){for(var t=0,n=[2,3,4,5,6,7],r=0;r<e.length;r++){var i=parseInt(e[e.length-1-r]);t+=n[r%n.length]*i}return(11-t%11)%11}})),Pc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(Mc()),n=Nc();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod10)(e),r))}return t}(t.default)})),Fc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(Mc()),n=Nc();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod11)(e),r))}return t}(t.default)})),Ic=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(Mc()),n=Nc();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod10)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),Lc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(Mc()),n=Nc();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod11)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),Rc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MSI1110=e.MSI1010=e.MSI11=e.MSI10=e.MSI=void 0;var t=o(Mc()),n=o(Pc()),r=o(Fc()),i=o(Ic()),a=o(Lc());function o(e){return e&&e.__esModule?e:{default:e}}e.MSI=t.default,e.MSI10=n.default,e.MSI11=r.default,e.MSI1010=i.default,e.MSI1110=a.default})),zc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0}),e.pharmacode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(cc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.pharmacode=function(e){o(n,e);function n(e,t){i(this,n);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.number=parseInt(e,10),r}return t(n,[{key:`encode`,value:function(){for(var e=this.number,t=``;!isNaN(e)&&e!=0;)e%2==0?(t=`11100`+t,e=(e-2)/2):(t=`100`+t,e=(e-1)/2);return t=t.slice(0,-2),{data:t,text:this.text}}},{key:`valid`,value:function(){return this.number>=3&&this.number<=131070}}]),n}(n.default)})),Bc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(cc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.codabar=function(e){o(n,e);function n(e,t){i(this,n),e.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(e=`A`+e+`A`);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.toUpperCase(),t));return r.text=r.options.text||r.text.replace(/[A-D]/g,``),r}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:`encode`,value:function(){for(var e=[],t=this.getEncodings(),n=0;n<this.data.length;n++)e.push(t[this.data.charAt(n)]),n!==this.data.length-1&&e.push(`0`);return{text:this.text,data:e.join(``)}}},{key:`getEncodings`,value:function(){return{0:`101010011`,1:`101011001`,2:`101001011`,3:`110010101`,4:`101101001`,5:`110101001`,6:`100101011`,7:`100101101`,8:`100110101`,9:`110100101`,"-":`101001101`,$:`101100101`,":":`1101011011`,"/":`1101101011`,".":`1101101101`,"+":`1011011011`,A:`1011001001`,B:`1001001011`,C:`1010010011`,D:`1010011001`}}}]),n}(n.default)})),Vc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SYMBOLS=`0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,-,., ,$,/,+,%,($),(%),(/),(+),ÿ`.split(`,`),e.BINARIES=`100010100.101001000.101000100.101000010.100101000.100100100.100100010.101010000.100010010.100001010.110101000.110100100.110100010.110010100.110010010.110001010.101101000.101100100.101100010.100110100.100011010.101011000.101001100.101000110.100101100.100010110.110110100.110110010.110101100.110100110.110010110.110011010.101101100.101100110.100110110.100111010.100101110.111010100.111010010.111001010.101101110.101110110.110101110.100100110.111011010.111010110.100110010.101011110`.split(`.`),e.MULTI_SYMBOLS={"\0":[`(%)`,`U`],"�":[`($)`,`A`],"�":[`($)`,`B`],"�":[`($)`,`C`],"�":[`($)`,`D`],"�":[`($)`,`E`],"�":[`($)`,`F`],"\x07":[`($)`,`G`],"\b":[`($)`,`H`],"	":[`($)`,`I`],"\n":[`($)`,`J`],"\v":[`($)`,`K`],"\f":[`($)`,`L`],"\r":[`($)`,`M`],"�":[`($)`,`N`],"�":[`($)`,`O`],"�":[`($)`,`P`],"�":[`($)`,`Q`],"�":[`($)`,`R`],"�":[`($)`,`S`],"�":[`($)`,`T`],"�":[`($)`,`U`],"�":[`($)`,`V`],"�":[`($)`,`W`],"�":[`($)`,`X`],"�":[`($)`,`Y`],"�":[`($)`,`Z`],"\x1B":[`(%)`,`A`],"�":[`(%)`,`B`],"�":[`(%)`,`C`],"�":[`(%)`,`D`],"�":[`(%)`,`E`],"!":[`(/)`,`A`],'"':[`(/)`,`B`],"#":[`(/)`,`C`],"&":[`(/)`,`F`],"'":[`(/)`,`G`],"(":[`(/)`,`H`],")":[`(/)`,`I`],"*":[`(/)`,`J`],",":[`(/)`,`L`],":":[`(/)`,`Z`],";":[`(%)`,`F`],"<":[`(%)`,`G`],"=":[`(%)`,`H`],">":[`(%)`,`I`],"?":[`(%)`,`J`],"@":[`(%)`,`V`],"[":[`(%)`,`K`],"\\":[`(%)`,`L`],"]":[`(%)`,`M`],"^":[`(%)`,`N`],_:[`(%)`,`O`],"`":[`(%)`,`W`],a:[`(+)`,`A`],b:[`(+)`,`B`],c:[`(+)`,`C`],d:[`(+)`,`D`],e:[`(+)`,`E`],f:[`(+)`,`F`],g:[`(+)`,`G`],h:[`(+)`,`H`],i:[`(+)`,`I`],j:[`(+)`,`J`],k:[`(+)`,`K`],l:[`(+)`,`L`],m:[`(+)`,`M`],n:[`(+)`,`N`],o:[`(+)`,`O`],p:[`(+)`,`P`],q:[`(+)`,`Q`],r:[`(+)`,`R`],s:[`(+)`,`S`],t:[`(+)`,`T`],u:[`(+)`,`U`],v:[`(+)`,`V`],w:[`(+)`,`W`],x:[`(+)`,`X`],y:[`(+)`,`Y`],z:[`(+)`,`Z`],"{":[`(%)`,`P`],"|":[`(%)`,`Q`],"}":[`(%)`,`R`],"~":[`(%)`,`S`],"�":[`(%)`,`T`]}})),Hc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=Vc(),r=i(cc());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(e,t){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.data.split(``).flatMap(function(e){return n.MULTI_SYMBOLS[e]||e}),t=e.map(function(e){return r.getEncoding(e)}).join(``),i=r.checksum(e,20),a=r.checksum(e.concat(i),15);return{text:this.text,data:r.getEncoding(`ÿ`)+t+r.getEncoding(i)+r.getEncoding(a)+r.getEncoding(`ÿ`)+`1`}}}],[{key:`getEncoding`,value:function(e){return n.BINARIES[r.symbolValue(e)]}},{key:`getSymbol`,value:function(e){return n.SYMBOLS[e]}},{key:`symbolValue`,value:function(e){return n.SYMBOLS.indexOf(e)}},{key:`checksum`,value:function(e,t){var n=e.slice().reverse().reduce(function(e,n,i){var a=i%t+1;return e+r.symbolValue(n)*a},0);return r.getSymbol(n%47)}}]),r}(r.default)})),Uc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(Hc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),n}(n.default)})),Wc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE93FullASCII=e.CODE93=void 0;var t=r(Hc()),n=r(Uc());function r(e){return e&&e.__esModule?e:{default:e}}e.CODE93=t.default,e.CODE93FullASCII=n.default})),Gc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GenericBarcode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(cc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.GenericBarcode=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){return{data:`10101010101010101010101010101010101010101`,text:this.text}}},{key:`valid`,value:function(){return!0}}]),n}(n.default)})),Kc=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=lc(),n=_c(),r=Dc(),i=jc(),a=Rc(),o=zc(),s=Bc(),c=Wc(),l=Gc();e.default={CODE39:t.CODE39,CODE128:n.CODE128,CODE128A:n.CODE128A,CODE128B:n.CODE128B,CODE128C:n.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:a.MSI,MSI10:a.MSI10,MSI11:a.MSI11,MSI1010:a.MSI1010,MSI1110:a.MSI1110,pharmacode:o.pharmacode,codabar:s.codabar,CODE93:c.CODE93,CODE93FullASCII:c.CODE93FullASCII,GenericBarcode:l.GenericBarcode}})),qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};e.default=function(e,n){return t({},e,n)}})),Jc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[];function n(e){if(Array.isArray(e))for(var r=0;r<e.length;r++)n(e[r]);else e.text=e.text||``,e.data=e.data||``,t.push(e)}return n(e),t}})),Yc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}})),Xc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[`width`,`height`,`textMargin`,`fontSize`,`margin`,`marginTop`,`marginBottom`,`marginLeft`,`marginRight`];for(var n in t)t.hasOwnProperty(n)&&(n=t[n],typeof e[n]==`string`&&(e[n]=parseInt(e[n],10)));return typeof e.displayValue==`string`&&(e.displayValue=e.displayValue!=`false`),e}})),Zc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={width:2,height:100,format:`auto`,displayValue:!0,fontOptions:``,font:`monospace`,text:void 0,textAlign:`center`,textPosition:`bottom`,textMargin:2,fontSize:20,background:`#ffffff`,lineColor:`#000000`,margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}}})),Qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(Xc()),n=r(Zc());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var r={};for(var i in n.default)n.default.hasOwnProperty(i)&&(e.hasAttribute(`jsbarcode-`+i.toLowerCase())&&(r[i]=e.getAttribute(`jsbarcode-`+i.toLowerCase())),e.hasAttribute(`data-`+i.toLowerCase())&&(r[i]=e.getAttribute(`data-`+i.toLowerCase())));return r.value=e.getAttribute(`jsbarcode-value`)||e.getAttribute(`data-value`),r=(0,t.default)(r),r}e.default=i})),$c=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var t=n(qc());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return t.height+(t.displayValue&&e.text.length>0?t.fontSize+t.textMargin:0)+t.marginTop+t.marginBottom}function i(e,t,n){if(n.displayValue&&t<e){if(n.textAlign==`center`)return Math.floor((e-t)/2);if(n.textAlign==`left`)return 0;if(n.textAlign==`right`)return Math.floor(e-t)}return 0}function a(e,n,a){for(var o=0;o<e.length;o++){var s=e[o],l=(0,t.default)(n,s.options),u=l.displayValue?c(s.text,l,a):0,d=s.data.length*l.width;s.width=Math.ceil(Math.max(u,d)),s.height=r(s,l),s.barcodePadding=i(u,d,l)}}function o(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].width;return t}function s(e){for(var t=0,n=0;n<e.length;n++)e[n].height>t&&(t=e[n].height);return t}function c(e,t,n){var r;if(n)r=n;else if(typeof document<`u`)r=document.createElement(`canvas`).getContext(`2d`);else return 0;r.font=t.fontOptions+` `+t.fontSize+`px `+t.font;var i=r.measureText(e);return i?i.width:0}e.getMaximumHeightOfEncodings=s,e.getEncodingHeight=r,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=o})),el=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(qc()),r=$c();
12function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,n,r){a(this,e),this.canvas=t,this.encodings=n,this.options=r}return t(e,[{key:`render`,value:function(){if(!this.canvas.getContext)throw Error(`The browser does not support canvas.`);this.prepareCanvas();for(var e=0;e<this.encodings.length;e++){var t=(0,n.default)(this.options,this.encodings[e].options);this.drawCanvasBarcode(t,this.encodings[e]),this.drawCanvasText(t,this.encodings[e]),this.moveCanvasDrawing(this.encodings[e])}this.restoreCanvas()}},{key:`prepareCanvas`,value:function(){var e=this.canvas.getContext(`2d`);e.save(),(0,r.calculateEncodingAttributes)(this.encodings,this.options,e);var t=(0,r.getTotalWidthOfEncodings)(this.encodings),n=(0,r.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=t+this.options.marginLeft+this.options.marginRight,this.canvas.height=n,e.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(e.fillStyle=this.options.background,e.fillRect(0,0,this.canvas.width,this.canvas.height)),e.translate(this.options.marginLeft,0)}},{key:`drawCanvasBarcode`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=t.data,i=e.textPosition==`top`?e.marginTop+e.fontSize+e.textMargin:e.marginTop;n.fillStyle=e.lineColor;for(var a=0;a<r.length;a++){var o=a*e.width+t.barcodePadding;r[a]===`1`?n.fillRect(o,i,e.width,e.height):r[a]&&n.fillRect(o,i,e.width,e.height*r[a])}}},{key:`drawCanvasText`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=e.fontOptions+` `+e.fontSize+`px `+e.font;if(e.displayValue){var i,a=e.textPosition==`top`?e.marginTop+e.fontSize-e.textMargin:e.height+e.textMargin+e.marginTop+e.fontSize;n.font=r,e.textAlign==`left`||t.barcodePadding>0?(i=0,n.textAlign=`left`):e.textAlign==`right`?(i=t.width-1,n.textAlign=`right`):(i=t.width/2,n.textAlign=`center`),n.fillText(t.text,i,a)}}},{key:`moveCanvasDrawing`,value:function(e){this.canvas.getContext(`2d`).translate(e.width,0)}},{key:`restoreCanvas`,value:function(){this.canvas.getContext(`2d`).restore()}}]),e}()})),tl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(qc()),r=$c();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var o=`http://www.w3.org/2000/svg`;e.default=function(){function e(t,n,r){a(this,e),this.svg=t,this.encodings=n,this.options=r,this.document=r.xmlDocument||document}return t(e,[{key:`render`,value:function(){var e=this.options.marginLeft;this.prepareSVG();for(var t=0;t<this.encodings.length;t++){var r=this.encodings[t],i=(0,n.default)(this.options,r.options),a=this.createGroup(e,i.marginTop,this.svg);this.setGroupOptions(a,i),this.drawSvgBarcode(a,i,r),this.drawSVGText(a,i,r),e+=r.width}}},{key:`prepareSVG`,value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,r.calculateEncodingAttributes)(this.encodings,this.options);var e=(0,r.getTotalWidthOfEncodings)(this.encodings),t=(0,r.getMaximumHeightOfEncodings)(this.encodings),n=e+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(n,t),this.options.background&&this.drawRect(0,0,n,t,this.svg).setAttribute(`fill`,this.options.background)}},{key:`drawSvgBarcode`,value:function(e,t,n){for(var r=n.data,i=t.textPosition==`top`?t.fontSize+t.textMargin:0,a=0,o=0,s=0;s<r.length;s++)o=s*t.width+n.barcodePadding,r[s]===`1`?a++:a>0&&(this.drawRect(o-t.width*a,i,t.width*a,t.height,e),a=0);a>0&&this.drawRect(o-t.width*(a-1),i,t.width*a,t.height,e)}},{key:`drawSVGText`,value:function(e,t,n){var r=this.document.createElementNS(o,`text`);if(t.displayValue){var i,a;r.setAttribute(`font-family`,t.font),r.setAttribute(`font-size`,t.fontSize),t.fontOptions.includes(`bold`)&&r.setAttribute(`font-weight`,`bold`),t.fontOptions.includes(`italic`)&&r.setAttribute(`font-style`,`italic`),a=t.textPosition==`top`?t.fontSize-t.textMargin:t.height+t.textMargin+t.fontSize,t.textAlign==`left`||n.barcodePadding>0?(i=0,r.setAttribute(`text-anchor`,`start`)):t.textAlign==`right`?(i=n.width-1,r.setAttribute(`text-anchor`,`end`)):(i=n.width/2,r.setAttribute(`text-anchor`,`middle`)),r.setAttribute(`x`,i),r.setAttribute(`y`,a),r.appendChild(this.document.createTextNode(n.text)),e.appendChild(r)}}},{key:`setSvgAttributes`,value:function(e,t){var n=this.svg;n.setAttribute(`width`,e+`px`),n.setAttribute(`height`,t+`px`),n.setAttribute(`x`,`0px`),n.setAttribute(`y`,`0px`),n.setAttribute(`viewBox`,`0 0 `+e+` `+t),n.setAttribute(`xmlns`,o),n.setAttribute(`version`,`1.1`)}},{key:`createGroup`,value:function(e,t,n){var r=this.document.createElementNS(o,`g`);return r.setAttribute(`transform`,`translate(`+e+`, `+t+`)`),n.appendChild(r),r}},{key:`setGroupOptions`,value:function(e,t){e.setAttribute(`fill`,t.lineColor)}},{key:`drawRect`,value:function(e,t,n,r,i){var a=this.document.createElementNS(o,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),i.appendChild(a),a}}]),e}()})),nl=t((e=>
12{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,r,i){n(this,e),this.object=t,this.encodings=r,this.options=i}return t(e,[{key:`render`,value:function(){this.object.encodings=this.encodings}}]),e}()})),rl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=i(el()),n=i(tl()),r=i(nl());function i(e){return e&&e.__esModule?e:{default:e}}e.default={CanvasRenderer:t.default,SVGRenderer:n.default,ObjectRenderer:r.default}})),il=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function n(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function r(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(e){r(i,e);function i(e,r){t(this,i);var a=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return a.name=`InvalidInputException`,a.symbology=e,a.input=r,a.message=`"`+a.input+`" is not a valid input for `+a.symbology,a}return i}(Error),a=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`InvalidElementException`,e.message=`Not supported type to render on`,e}return i}(Error),o=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`NoElementException`,e.message=`No element to render on.`,e}return i}(Error);e.InvalidInputException=i,e.InvalidElementException=a,e.NoElementException=o})),al=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n=a(Qc()),r=a(rl()),i=il();function a(e){return e&&e.__esModule?e:{default:e}}function o(e){if(typeof e==`string`)return s(e);if(Array.isArray(e)){for(var a=[],l=0;l<e.length;l++)a.push(o(e[l]));return a}else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLImageElement)return c(e);else if(e&&e.nodeName&&e.nodeName.toLowerCase()===`svg`||typeof SVGElement<`u`&&e instanceof SVGElement)return{element:e,options:(0,n.default)(e),renderer:r.default.SVGRenderer};else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement)return{element:e,options:(0,n.default)(e),renderer:r.default.CanvasRenderer};else if(e&&e.getContext)return{element:e,renderer:r.default.CanvasRenderer};else if(e&&(e===void 0?`undefined`:t(e))===`object`&&!e.nodeName)return{element:e,renderer:r.default.ObjectRenderer};else throw new i.InvalidElementException}function s(e){var t=document.querySelectorAll(e);if(t.length!==0){for(var n=[],r=0;r<t.length;r++)n.push(o(t[r]));return n}}function c(e){var t=document.createElement(`canvas`);return{element:t,options:(0,n.default)(e),renderer:r.default.CanvasRenderer,afterRender:function(){e.setAttribute(`src`,t.toDataURL())}}}e.default=o})),ol=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t){n(this,e),this.api=t}return t(e,[{key:`handleCatch`,value:function(e){if(e.name===`InvalidInputException`)if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw e.message;else throw e;this.api.render=function(){}}},{key:`wrapBarcodeCall`,value:function(e){try{var t=e.apply(void 0,arguments);return this.api._options.valid(!0),t}catch(e){return this.handleCatch(e),this.api}}}]),e}()})),sl=e(t(((e,t)=>
12{var n=d(Kc()),r=d(qc()),i=d(Jc()),a=d(Yc()),o=d(al()),s=d(Xc()),c=d(ol()),l=il(),u=d(Zc());function d(e){return e&&e.__esModule?e:{default:e}}var f=function(){},p=function(e,t,n){var r=new f;if(e===void 0)throw Error(`No element to render on was provided.`);return r._renderProperties=(0,o.default)(e),r._encodings=[],r._options=u.default,r._errorHandler=new c.default(r),t!==void 0&&(n||={},n.format||=_(),r.options(n)[n.format](t,n).render()),r};for(var m in p.getModule=function(e){return n.default[e]},n.default)n.default.hasOwnProperty(m)&&h(n.default,m);function h(e,t){f.prototype[t]=f.prototype[t.toUpperCase()]=f.prototype[t.toLowerCase()]=function(n,i){var a=this;return a._errorHandler.wrapBarcodeCall(function(){i.text=i.text===void 0?void 0:``+i.text;var o=(0,r.default)(a._options,i);o=(0,s.default)(o);var c=e[t],l=g(n,c,o);return a._encodings.push(l),a})}}function g(e,t,n){e=``+e;var a=new t(e,n);if(!a.valid())throw new l.InvalidInputException(a.constructor.name,e);var o=a.encode();o=(0,i.default)(o);for(var s=0;s<o.length;s++)o[s].options=(0,r.default)(n,o[s].options);return o}function _(){return n.default.CODE128?`CODE128`:Object.keys(n.default)[0]}f.prototype.options=function(e){return this._options=(0,r.default)(this._options,e),this},f.prototype.blank=function(e){var t=Array(e+1).join(`0`);return this._encodings.push({data:t}),this},f.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var e;for(var t in this._renderProperties){e=this._renderProperties[t];var i=(0,r.default)(this._options,e.options);i.format==`auto`&&(i.format=_()),this._errorHandler.wrapBarcodeCall(function(){var t=i.value,r=n.default[i.format.toUpperCase()],a=g(t,r,i);v(e,a,i)})}}},f.prototype.render=function(){if(!this._renderProperties)throw new l.NoElementException;if(Array.isArray(this._renderProperties))for(var e=0;e<this._renderProperties.length;e++)v(this._renderProperties[e],this._encodings,this._options);else v(this._renderProperties,this._encodings,this._options);return this},f.prototype._defaults=u.default;function v(e,t,n){t=(0,i.default)(t);for(var o=0;o<t.length;o++)t[o].options=(0,r.default)(n,t[o].options),(0,a.default)(t[o].options);(0,a.default)(n);var s=e.renderer;new s(e.element,t,n).render(),e.afterRender&&e.afterRender()}typeof window<`u`&&(window.JsBarcode=p),typeof jQuery<`u`&&(jQuery.fn.JsBarcode=function(e,t){var n=[];return jQuery(this).each(function(){n.push(this)}),p(n,e,t)}),t.exports=p}))(),1);function cl({view:e}){switch(e.kind){case`voucher`:return(0,Q.jsx)(ll,{voucher:e.voucher});case`qr`:return(0,Q.jsx)(ul,{qr:e.qr});case`bank_transfer`:return(0,Q.jsx)(dl,{transfer:e.bankTransfer});case`unknown`:return(0,Q.jsx)(fl,{documentUrl:e.documentUrl})}}function ll({voucher:e}){let t=_();return(0,Q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,Q.jsx)(pl,{logo:e.provider_logo,name:e.provider_name}),(0,Q.jsx)(ml,{amount:e.amount}),e.reference&&(0,Q.jsx)(hl,{label:t(`H7AdL7`),value:e.reference,emphasized:!0}),e.barcode&&(0,Q.jsx)(bl,{value:e.barcode,format:e.barcode_format}),e.company_name&&(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 m-0`,children:t(`6b+ZnK`,{name:e.company_name})}),(0,Q.jsx)(_l,{expiresAt:e.expires_at}),(0,Q.jsx)(yl,{url:e.document_url,label:t(`aL8deB`)})]})}function ul({qr:e}){let t=_();return(0,Q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,Q.jsx)(ml,{amount:e.amount}),e.qr_code&&(0,Q.jsx)(`div`,{role:`img`,"aria-label":t(`Bj7HJ2`),className:D(`rounded-xl bg-white p-3`,z(`CompletePaymentQr`,`The scannable QR card`)),children:(0,Q.jsx)($e,{value:e.qr_code,size:176,bgColor:`#ffffff`,fgColor:`#000000`})}),e.qr_code&&(0,Q.jsx)(`p`,{className:`text-2 m-0 font-medium`,children:t(`oLsRTe`)}),e.key&&(0,Q.jsx)(hl,{label:t(`goiGRF`),value:e.key}),(0,Q.jsx)(_l,{expiresAt:e.expires_at}),(0,Q.jsx)(yl,{url:e.document_url,label:t(`/HPODI`)})]})}function dl({transfer:e}){let t=_(),n=g(),r=et(e.amount);return(0,Q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[!!((r??e.bank_name)||e.bank_address||e.bank_code||e.bank_branch||e.bank_account_type||e.account_number||e.rout
12ing_number||e.secondary_account_number||e.beneficiary_name||e.beneficiary_document)&&(0,Q.jsxs)(`dl`,{className:D(`border-gray-a4 m-0 w-full max-w-90 rounded-lg border`,z(`CompletePaymentTransferDetails`,`The bank-transfer detail rows`)),children:[r&&(0,Q.jsx)(gl,{label:t(`/0TOL5`),value:Ee(r,n)}),e.bank_name&&(0,Q.jsx)(gl,{label:t(`hbSqJA`),value:e.bank_name}),e.bank_code&&(0,Q.jsx)(gl,{label:e.bank_code_label??t(`51hiwK`),value:e.bank_code,copyable:!0}),e.bank_address&&(0,Q.jsx)(gl,{label:t(`4PLerH`),value:e.bank_address,copyable:!0}),e.bank_branch&&(0,Q.jsx)(gl,{label:t(`8dAyZI`),value:e.bank_branch}),e.bank_account_type&&(0,Q.jsx)(gl,{label:t(`oWnXQL`),value:e.bank_account_type}),e.routing_number&&(0,Q.jsx)(gl,{label:t(`Pk5sml`),value:e.routing_number,copyable:!0}),e.account_number&&(0,Q.jsx)(gl,{label:e.account_number_label??t(`/BgyNa`),value:e.account_number,copyable:!0}),e.secondary_account_number&&(0,Q.jsx)(gl,{label:e.secondary_account_number_label??t(`/BgyNa`),value:e.secondary_account_number,copyable:!0}),e.beneficiary_name&&(0,Q.jsx)(gl,{label:t(`VfJsl4`),value:e.beneficiary_name}),e.beneficiary_document&&(0,Q.jsx)(gl,{label:e.beneficiary_document_type??t(`wmirkP`),value:e.beneficiary_document})]}),e.reference&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hl,{label:t(`cDZru5`),value:e.reference,emphasized:!0}),(0,Q.jsx)(`p`,{className:`text-1 text-amber-11 m-0 max-w-90`,children:t(`D/2720`)})]}),e.instructions&&(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 m-0 max-w-90 whitespace-pre-line`,children:e.instructions}),(0,Q.jsx)(_l,{expiresAt:e.expires_at}),(0,Q.jsx)(yl,{url:e.document_url,label:t(`/HPODI`)})]})}function fl({documentUrl:e}){let t=_();return(0,Q.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-2 m-0 font-medium`,children:t(`URiNa/`)}),e?(0,Q.jsx)(yl,{url:e,label:t(`/HPODI`)}):(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 m-0 max-w-90`,children:t(`0HVdn0`)})]})}function pl({logo:e,name:t}){let n=_(),[r,i]=(0,Z.useState)(!1);return e&&!r?(0,Q.jsx)(`img`,{src:e,alt:t??n(`A1faeX`),onError:()=>i(!0),className:D(`h-8 max-w-40 object-contain`,z(`CompletePaymentProviderMark`,`The voucher network logo`))}):t?(0,Q.jsx)(`p`,{className:`text-3 m-0 font-semibold`,children:n(`N3Z0az`,{provider:t})}):null}function ml({amount:e}){let t=_(),n=g(),r=et(e);return r?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,Q.jsx)(`span`,{className:`text-1 text-gray-a10`,children:t(`POHhS3`)}),(0,Q.jsx)(`span`,{className:D(`text-6 font-semibold`,z(`CompletePaymentAmount`,`The amount the buyer must pay`)),children:Ee(r,n)})]}):null}function hl({label:e,value:t,emphasized:n}){return(0,Q.jsxs)(`div`,{className:D(`border-gray-a4 flex w-full max-w-90 flex-col items-center gap-1 rounded-lg border px-3 py-2`,z(`CompletePaymentReference`,`A copyable code block (reference, payment key)`)),children:[(0,Q.jsx)(`span`,{className:`text-1 text-gray-a10`,children:e}),(0,Q.jsxs)(`div`,{className:`flex w-full items-center justify-center gap-2`,children:[(0,Q.jsx)(`span`,{className:D(`font-mono break-all`,n?`text-4 font-semibold`:`text-2 font-medium`),children:t}),(0,Q.jsx)(k,{value:t})]})]})}function gl({label:e,value:t,copyable:n}){return(0,Q.jsxs)(`div`,{className:`border-gray-a4 flex items-center justify-between gap-3 border-b px-3 py-2 text-left last:border-b-0`,children:[(0,Q.jsx)(`dt`,{className:`text-1 text-gray-a10 m-0 shrink-0`,children:e}),(0,Q.jsxs)(`dd`,{className:`m-0 flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-2 font-medium break-all`,children:t}),n&&(0,Q.jsx)(k,{value:t})]})]})}function _l({expiresAt:e}){let t=_(),n=vl(e,g());return n?(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 m-0`,children:t(`IlTnnn`,{deadline:n})}):null}function vl(e,t){if(!e)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toLocaleString()}}function yl({url:e,label:t}){let n=Ne(e);return n?(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:D(`bg-gray-a3 text-2 text-gray-12 rounded-lg px-4 py-2 font-medium no-underline`,z(`CompletePaymentDocumentLink`,`The hosted-instructions button`)),children:t}):null}function bl({value:e,format:t}){let n=_(),r=it(t),i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>
12{if(!(!r||!i.current))try{(0,sl.default)(i.current,e,{format:r,displayValue:!1,margin:0,height:56,width:1.6,background:`#ffffff`,lineColor:`#000000`}),o(!1)}catch{o(!0)}},[e,r]),!r||a?(0,Q.jsx)(`p`,{className:`text-1 m-0 max-w-90 font-mono break-all`,children:e}):(0,Q.jsxs)(`div`,{className:D(`w-full max-w-90 rounded-xl bg-white p-3`,z(`CompletePaymentBarcode`,`The scannable barcode card`)),children:[(0,Q.jsx)(`div`,{className:`flex justify-center overflow-x-auto`,children:(0,Q.jsx)(`svg`,{ref:i,role:`img`,"aria-label":n(`JB45mB`)})}),(0,Q.jsx)(`p`,{className:`text-1 m-0 pt-1 text-center font-mono break-all text-black`,children:e})]})}var xl={reference:`9300-30895-92390`,barcode:`2710066107843003`,barcode_format:`CODE_128`,company_name:`Demo Seller`,provider_name:`OXXO`,document_url:`https://sandbox.dlocal.com/gmx/ticket/demo`,amount:{amount:`250.00`,currency:`mxn`,decimals:2,display_decimals:2},expires_at:`2026-09-27T22:04:49.627Z`},Sl={qr_code:`00020101021226430014br.demo.whop.qr52040000530398654 06250.005802CO5911Demo Seller6304A1B2`,qr_format:`EMVCO`,key:`[email protected]`,document_url:`https://sandbox.dlocal.com/gco/qr/demo`,amount:{amount:`95000.00`,currency:`cop`,decimals:2,display_decimals:0},expires_at:`2026-09-27T22:04:49.627Z`},Cl={bank_name:`STP`,bank_code:`90646`,bank_account_type:`Checking`,beneficiary_name:`Whop Payments`,beneficiary_document:`WHO123456AB1`,beneficiary_document_type:`RFC`,account_number:`646180111812345678`,account_number_label:`CLABE`,reference:`7788990011`,instructions:`Send the exact amount from your own bank account and include the reference.`,document_url:`https://sandbox.dlocal.com/gmx/transfer/demo`,amount:{amount:`1250.00`,currency:`mxn`,decimals:2,display_decimals:2},expires_at:`2026-09-27T22:04:49.627Z`};function wl(e){return{status:`requires_action`,next_action:{type:`display_instructions`,render:[`inline`],data:e===`voucher`?{kind:e,voucher:xl,expires_at:xl.expires_at}:e===`qr`?{kind:e,qr:Sl,expires_at:Sl.expires_at}:{kind:e,bank_transfer:Cl,expires_at:Cl.expires_at}},last_payment_error:null}}var Tl=B(`complete-payment`).doc("Detached modal opened by `payments.handleNextAction` to finish a pending payment step. It handles embedded provider flows, bank-transfer instructions, and confirmation waits. The surface polls payment status with its scoped `client_secret` and closes when no action remains. Consumers never mount it directly.").internal().state({phase:`working`,payment:void 0,account:null}).auth({embed:({state:e})=>{"use embed";return F(e.payment?.clientSecret)}}).actions(e=>({adoptPayment:e.controllerOnly(async(e,t)=>{"use embed";e.setState({payment:t})}).doc("Deliver the payment reference (`clientSecret` + API origin) to the opened presentation — invoked by `handleNextAction`'s static body over the opened-child handle, the same-origin rpc rail; the reference never rides the open input.")})).modal(e=>{"use embed";return{header:(0,Q.jsx)(El,{phase:e.state.phase,close:e.close,account:e.state.account})}}).loading(()=>{"use loading";let e={borderRadius:8,background:`var(--gray-a3, #f0f0f3)`};return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,Q.jsx)(`div`,{style:{...e,height:16,width:160}}),(0,Q.jsx)(`div`,{style:{...e,height:120}})]})}).demo(e=>e.props(()=>({})).sdk(()=>({payments:{retrieveStatus:wl(`voucher`)}}))).render(()=>{"use embed";return(0,Q.jsx)(Ol,{})});function El({phase:e,close:t,account:n}){let r=_();(0,Z.useEffect)(()=>{e===`settled`&&t()},[e,t]);let i=n?.title.trim();return(0,Q.jsx)(`span`,{className:D(`text-2 font-semibold`,z(`CompletePaymentTitle`,`Dialog title`)),children:i?r(`WkzYsx`,{name:i}):r(`Ivyv4G`)})}function Dl(e){let t=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{if(e==null)return;let n=t.current?.closest(`.fui-DialogContent`);if(!n)return;let r=n.style.maxWidth;return n.style.maxWidth=`min(${e}px, 100%)`,()=>{n.style.maxWidth=r}},[e]),t}function Ol(){let e=_(),{state:t,setState:n}=P(),r=t.payment,i=Se(),[a,o]=(0,Z.useState)(null),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>
12{if(!r)return;let t;try{let e=at(r.clientSecret),a=new Promise(e=>{c.current=e});t=ct({client:i,payment:e.tag,kind:e.kind,intervalMs:r.pollIntervalMs,landingHint:a,onView:o,onSnapshot:e=>n({account:e.account??null})})}catch(t){o({kind:`error`,message:t instanceof Error?t.message:e(`sxcovO`)})}return()=>t?.stop()},[r,i]),(0,Z.useEffect)(()=>{let e=e=>{let t=e.data;!s.current||e.source!==s.current.contentWindow||t?.whop!==`payment-complete`&&t?.whop!==`setup-complete`||c.current?.()};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,Z.useEffect)(()=>{let e=a?.kind===`settled`?`settled`:a?.kind===`error`?`error`:`working`;t.phase!==e&&n({phase:e})}),(0,Q.jsx)(`div`,{ref:Dl(a?.kind===`redirect`?a.frameMaxWidth:null),className:D(`flex min-w-72 flex-col gap-3`,z(`CompletePayment`,`Completion surface root`)),children:a===null?(0,Q.jsx)(`div`,{className:`flex flex-col items-center py-6`,children:(0,Q.jsx)(Al,{})}):(0,Q.jsx)(kl,{view:a,frameRef:s})})}function kl({view:e,frameRef:t}){let n=_(),r=g();switch(e.kind){case`redirect`:return(0,Q.jsx)(`iframe`,{ref:t,title:n(`2JB0Pv`),src:e.url,allow:`payment *; publickey-credentials-get *`,className:D(`h-[560px] max-h-[60vh] w-full rounded-lg border-0 bg-white`,z(`CompletePaymentFrame`,`Framed PSP step`))});case`instructions`:return(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-3 py-2 text-center`,z(`CompletePaymentInstructions`,`Payment-instructions pane`)),children:[(0,Q.jsx)(cl,{view:e.instructions}),(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10 max-w-90`,z(`CompletePaymentHint`,`Automatic-update hint`)),children:n(`dAM7X7`)})]});case`waiting`:{let t=vl(e.expiresAt,r);return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,Q.jsx)(Al,{}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:n(`ZzUtD0`)}),t&&(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 max-w-90`,children:n(`KJ8dlK`,{deadline:t})})]})}case`settled`:return lt(e.snapshot)?(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`CompletePaymentSettledFailed`,`Failed resting-state pane shown before closing`)),children:[(0,Q.jsx)(`span`,{className:`bg-red-a3 text-4 text-red-11 flex size-10 items-center justify-center rounded-full`,children:`✕`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:n(`UhdQPk`)})]}):(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`CompletePaymentSettled`,`Resting-state pane shown before closing`)),children:[(0,Q.jsx)(`span`,{className:`bg-green-a3 text-4 text-green-11 flex size-10 items-center justify-center rounded-full`,children:`✓`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:n(`L33dTQ`)})]});case`error`:return(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`CompletePaymentError`,`Error pane`)),children:[(0,Q.jsx)(`span`,{className:`bg-red-a3 text-4 text-red-11 flex size-10 items-center justify-center rounded-full`,children:`!`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:n(`DyqcFL`)}),(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 max-w-80`,children:e.message})]})}}function Al(){return(0,Q.jsx)(`span`,{"aria-hidden":!0,className:D(`border-gray-a5 border-t-gray-11 size-7 animate-spin rounded-full border-3`,z(`CompletePaymentSpinner`,`Waiting spinner`))})}var jl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ml=700,Nl=`box-border h-11 w-full rounded-lg border bg-transparent px-3 text-2 text-gray-12 outline-none transition-[box-shadow,border-color] [color-scheme:normal] focus:border-accent-a8 focus:shadow-[0_0_0_3px_var(--accent-a5)] disabled:cursor-default disabled:opacity-60 disabled:focus:border-stroke disabled:focus:shadow-none`,Pl=`border-0 bg-transparent p-0 text-left text-1 underline underline-offset-2 cursor-pointer`,Fl=B(`email`).doc("Collects the buyer's email and passes it to `payments.createConfirmationToken()` while mounted. Explicit `billingDetails.email` wins. A matching Whop account shows optional sign-in with code verification. Successful sign-in unlocks saved payment methods in the payment element. Buyers can continue as guests.").props(e=>({defaultValue:e.default(``).doc(`Seed value applied once at mount.`),label:e.default(!0).analytics().doc("Shows the localized label. Set `false` when supplying your own. The input retains a localized `aria-label`."),placeholder:e.default(``).doc("Placeholder text for the email input. Empty (default) renders `[email protected]`."),locked:e.direct().default(!1).doc("Direct mode only. Disables editing of the seeded `defaultValue` when the host page already knows whose email this is — an invoice recipient, for one. Recognition and sign-in still run on the seeded value."),sessionEmail:e.fromController().doc(`The signed-in buyer's email (empty when signed out); the field locks to it and offers sign out — injected by the payments controller while a session is live.`),signInPending:e.fromController().doc(`Whether a login is starting (session create in flight) — the affordance disables while true. Driven by the payments controller.`),signInError:e.fromController().doc("The last sign-in start failure as a stable code (`sign_in_start_failed`), localized by the element under the affordance — empty when none, cleared on the next attempt. Driven by the payments controller.")})).state(e=>({email:e.defaultValue})).auth({embed:()=>{"use embed";return{maxRetries:0,...F(void 0)}}}).events(e=>({change:e.external().analytics(`complete`).doc("Fires when the email changes. `complete` is true when plausible. Sign-in fires it with the signed-in email, which also feeds `createConfirmationToken()`."),signInRequested:e.internal().doc(`Coordination only — the buyer chose the sign-in affordance; the controller creates the session and pops the verification-code dialog.`),signOutRequested:e.internal().doc(`Coordination only — the buyer chose to check out under a different email; the controller drops the session it holds. NOT a sign-out: the issued token stays valid until it expires (revocation is the sessions API's revoke follow-up), which is why the control is labeled for what it does.`),recognitionChanged:e.internal().doc("Coordination only — the identity verdict for the CURRENT email, re-emitted on every change: `settled` once the buyer is signed in or the recognition probe answered for exactly the typed email (either verdict; a probe failure settles too — a throttled probe must never hold a composing surface hostage). The controller mirrors it into state for reveal-style composition gates (the Whop Pay sheet)."),phoneVerificationRequested:e.internal().doc(`Coordination only — a composing surface asked for the phone-verification ceremony through this element’s relay; the controller opens the dialog it owns.`)})).actions(e=>({requestPhoneVerification:e.controllerOnly(async e=>{"use embed";return e.emit(`phoneVerificationRequested`,{}),{}}).doc(`Ask the payments controller to present the phone-verification ceremony — the composed-ref relay for surfaces that mount no payment element, no consumer surface. Resolves at delivery; the ceremony reports its own landing.`)})).loading(()=>{"use loading";return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Q.jsx)(`div`,{style:{height:12,width:48,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}}),(0,Q.jsx)(`div`,{style:{height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]})}).demo(e=>e.props(()=>({}))).render(e=>{"use embed";let t=_(),{props:n,state:r,setState:i,emit:a}=e,o=(0,Z.useId)(),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>clearTimeout(d.current??void 0),[]);let[p,m]=(0,Z.useState)(!1),h=xe(e=>e.users.me({include_balance:!1}),{enabled:!p,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),g=f(),v=p?void 0:n.sessionEmail||h.data?.email||void 0,y=!!v;(0,Z.useEffect)(()=>{p&&g.removeQueries({queryKey:[`users`,`me`]})},[p,g]),(0,Z.useEffect)(()=>{n.sessionEmail&&m(!1)},[n.sessionEmail]);let b=p||!!n.sessionEmail||!h.isPending,x=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>
12{if(x.current)return;x.current=!0;let e=r.email.trim();e&&!v&&(a(`change`,{email:e,complete:jl.test(e)}),jl.test(e)&&c(e))},[]);let S=(0,Z.useRef)(r.email.trim()),C=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(C.current||!b)return;C.current=!0;let t=S.current;!v&&!n.locked&&jl.test(t)&&e.identify({email:t})},[b]);let w=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{let e=w.current;if(w.current=v,v){a(`change`,{email:v,complete:!0});return}if(!e)return;let t=r.email.trim();a(`change`,{email:t,complete:jl.test(t)})},[v,a]);let T=xe(e=>e.sessionIntents.recognize({email:s}),{enabled:!y&&jl.test(s),staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),E=r.email.trim(),O=!y&&T.data?.recognized===!0&&s===E,k=y||b&&jl.test(E)&&s===E&&!T.isPending,A=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{let e={email:y?v??``:E,settled:k,recognized:O,signedIn:y},t=JSON.stringify(e);A.current!==t&&(A.current=t,a(`recognitionChanged`,e))});let j=!y&&!n.locked,M=e=>{if(!j)return;i({email:e});let t=e.trim();a(`change`,{email:t,complete:jl.test(t)}),d.current&&clearTimeout(d.current),jl.test(t)&&(d.current=setTimeout(()=>c(t),Ml))},N=()=>{u(!0),d.current&&clearTimeout(d.current),jl.test(E)&&(c(E),j&&e.identify({email:E}))},ee=j&&l&&E.length>0&&!jl.test(E);return(0,Q.jsx)(e.Loading,{loading:!b,children:(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1 p-1`,z(`Email`,`Email element root`)),"data-whop-autofill":``,children:[(0,Q.jsx)(Li,{}),n.label&&(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`EmailLabel`,`Email field label`)),htmlFor:o,children:t(`sy+pv5`)}),(0,Q.jsx)(`input`,{id:o,type:`email`,name:`email`,"aria-label":n.label?void 0:t(`sy+pv5`),placeholder:n.placeholder||t(`PwhG9W`),autoComplete:`email`,inputMode:`email`,value:v??r.email,disabled:!j,onChange:e=>M(e.target.value),onBlur:N,className:D(Nl,z(`EmailInput`,`The email input`),ee?`border-danger-9 ${z(`EmailInputInvalid`,`Email input with an implausible value`)}`:`border-stroke`)}),ee&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`EmailError`,`Invalid email message`)),children:t(`YRe93Y`)}),y?(0,Q.jsxs)(`div`,{className:D(`flex items-center justify-between`,z(`EmailSignedIn`,`Signed-in buyer row`)),children:[(0,Q.jsx)(`span`,{className:`text-1 text-gray-a10`,children:t(`77MbQy`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{m(!0),a(`signOutRequested`,{})},className:D(Pl,`text-gray-11 hover:text-gray-12`,z(`EmailSignOut`,`Choose a different email control`)),children:t(`zvbn/a`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[O&&(0,Q.jsx)(`button`,{type:`button`,disabled:n.signInPending,onClick:()=>a(`signInRequested`,{email:E}),className:D(Pl,`text-accent-11 hover:text-accent-12 disabled:cursor-default disabled:opacity-60`,z(`EmailSignIn`,`Welcome back sign-in control`)),children:n.signInPending?t(`xE4ksP`):t(`ZNHQcQ`)}),n.signInError&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`EmailSignInError`,`Sign-in error message`)),children:n.signInError===`sign_in_start_failed`?t(`TLba0O`):t(`B7hVdt`)})]})]})})});function Il(e){return e.name?e.name:[e.first_name,e.last_name].filter(Boolean).join(` `)||void 0}function Ll(e){let t={};return e.country&&(t.country=e.country),e.line1&&(t.line1=e.line1),e.line2&&(t.line2=e.line2),e.city&&(t.city=e.city),e.state&&(t.state=e.state),e.postal_code&&(t.postal_code=e.postal_code),Object.keys(t).length>0?t:void 0}function Rl(e){return!!(e&&Object.values(e).some(e=>typeof e==`string`&&e.trim().length>0))}function zl(e,t){if(!t)return e;let n=Rl(e?.address)?e?.address:void 0,r=!!(e?.phone&&t.completeWithoutPhone);if(t.phoneRequired&&!e?.phone&&!t.phone||!n&&!r&&!t.complete)throw new Pe(`billing_details_incomplete`,`Billing details are incomplete`);let i={...e};if(!i.phone&&t.phone&&(i.phone=t.phone),!i.name){let e=Il(t.address);e?i.name=e:delete i.name}let a=n??Ll(t.address);return a?i.address=a:delete i.address,Object.keys(i).length>0?i:e}var Bl=500;function Vl(e,t){return t===`setup`?e.status===`processing`:e.status===`confirming`?!0:e.status===`requires_confirmation`?!rt(e):st(e)}function Hl(e,t){return ft({client:e,payment:t.tag,kind:t.kind,intervalMs:Bl,restAt:e=>!Vl(e,t.kind)})}function Ul(e){return window.self===window.top?(window.location.assign(e),!0):Fe(e)}
12function Wl(e,t=!1){return{status:e.status,redirected:t,lastPaymentError:ut(e)}}async function Gl(e,t){let n=await e();try{await n.actions.adoptPayment(t),await n.closed}catch(e){try{n.close()}catch{}throw e}}function Kl(e){return e?.code===`CHILD_DESTROYED`?!0:/torn down before it became ready/.test(e instanceof Error?e.message:``)}async function ql(e,t){let n=at(t.clientSecret),r=ot(t.clientSecret),i=await Hl(r,n),a=i.next_action;if(i.status!==`requires_action`||!a?.type)return Wl(i);t.returnUrl&&await nt(r,n,t.returnUrl);let o=Array.isArray(a.render)&&a.render.length?a.render:[`full_page`],s=Ne(dt(a.data,`url`));if(a.type===`redirect`&&s&&!o.includes(`inline`))return Jl(e,s),{status:i.status,redirected:!0,lastPaymentError:null};if(a.type===`redirect`&&s||a.type===`display_instructions`||a.type===`await_confirmation`){try{await e.openCompletion({clientSecret:t.clientSecret,pollIntervalMs:t.pollIntervalMs})}catch(e){if(!Kl(e))throw e}return Wl(await tt(r,n))}return s?(Jl(e,s),{status:i.status,redirected:!0,lastPaymentError:null}):Wl(i)}function Jl(e,t){if(!e.navigate(t))throw new ke(`TAB_NAVIGATION_BLOCKED`,`The embedding page refused to navigate the tab to this payment's off-site step, so the step has not run and the payment is still pending. Offer the buyer their own press to open the step's url (the payment status's next_action carries it), or drive the step from a page that may leave the tab.`,{url:t})}var Yl=Object.freeze({configured:!1,mode:void 0,plan:void 0,currency:void 0,amount:void 0,setupFutureUsage:void 0,paymentMethodConfiguration:void 0});function Xl(e){return e.mode===void 0&&e.plan===void 0&&e.currency===void 0&&e.amount===void 0&&e.paymentMethodConfiguration===void 0}function Zl(e){let t={accountId:e.accountId,mode:e.mode,plan:e.plan,currency:e.currency,amount:e.amount,setupFutureUsage:e.setupFutureUsage,paymentMethodConfiguration:e.paymentMethodConfiguration};if(t.mode===`setup`){let e=[`plan`,`amount`].filter(e=>t[e]!==void 0);if(e.length>0)throw new X(`SETUP_CHARGE_CONFLICT`,`A setup mount saves a payment method and charges nothing — pass a currency, never a plan or amount (${e.join(`, `)} conflict with mode "setup").`);if(t.currency===void 0)throw new X(`CHARGE_CONFIG_MISSING`,`A setup mount needs a currency — it decides which payment methods can be saved.`);if(t.setupFutureUsage===`on_session`)throw new X(`SETUP_CHARGE_CONFLICT`,`A setup mount saves a payment method for off_session use — on_session is not a setup the API accepts.`);return t}if(t.plan!==void 0){let e=[`currency`,`amount`,`paymentMethodConfiguration`].filter(e=>t[e]!==void 0);if(e.length>0)throw new X(`PLAN_INLINE_CONFLICT`,`Pass a plan OR an inline charge config, never both — ${e.join(`, `)} conflict with plan ${t.plan}. The plan resolves to the same shape client-side.`);return t}if(t.currency===void 0||t.amount===void 0)throw new X(`CHARGE_CONFIG_MISSING`,`Pass a plan id, or an inline charge config with both currency and amount — neither is mounted.`);return t}function Ql(e){return{configured:!0,mode:`payment`,plan:void 0,currency:(e.currency??``).toLowerCase(),amount:e.amount??0,setupFutureUsage:e.setupFutureUsage,paymentMethodConfiguration:e.paymentMethodConfiguration}}function $l(e){return{configured:!0,mode:`setup`,plan:void 0,currency:(e.currency??``).toLowerCase(),amount:0,setupFutureUsage:`off_session`,paymentMethodConfiguration:e.paymentMethodConfiguration}}function eu(e,t){let n=e.id??t.plan,r=e.account?.id;if(!r||r!==t.accountId)throw new X(`PLAN_ACCOUNT_MISMATCH`,`Plan ${n} belongs to ${r??`no account`}, not the mounted accountId ${t.accountId} — mount the element on the plan's own account.`);let i=e.initial_price_due;if(!i||!Number.isFinite(Number(i.amount)))throw new X(`PLAN_RESOLUTION_FAILED`,`Plan ${n} resolved without a first-charge price.`);let a=i.currency.toLowerCase();return{configured:!0,mode:`payment`,plan:n,currency:a,amount:De(Number(i.amount),a),setupFutureUsage:t.setupFutureUsage??(e.plan_type===`renewal`?`off_session`:void 0),paymentMethodConfiguration:tu(e.effective_payment_method_configuration)}}function tu(e){if(e)return{enabled:e.enabled,disabled:e.disabled,include_platform_defaults:e.include_platform_defaults}}async function nu(e){if(Xl(e))return Yl;let t=Zl(e);
12if(t.mode===`setup`)return $l(t);if(t.plan===void 0)return Ql(t);let n=R(),r;try{r=await n.plans.retrieve(t.plan)}catch(e){throw new X(`PLAN_RESOLUTION_FAILED`,Oe(e,`plan ${t.plan} could not be resolved`))}return eu(r,t)}var ru=`payment`;function iu(){return R({maxRetries:0})}function au(e){if(e.status!==`requires_verification`||!e.client_secret||!e.verification)throw Error(`The created session intent is not awaiting verification`);return{id:e.id,clientSecret:e.client_secret,email:e.email,method:e.verification.method,maskedDestination:e.verification.masked_destination,resendAvailableAt:e.verification.resend_available_at,expiresAt:e.verification.expires_at}}function ou(e,t){return!!e&&e.email.toLowerCase()===t.trim().toLowerCase()&&Date.parse(e.expiresAt)>Date.now()}function su(e){return e.token||void 0}function cu(e){let t=e.last_verification_error;if(!(!t||typeof t!=`object`))return t}function lu(e){return e instanceof A&&e.statusCode===404?!0:e instanceof Error&&/expired/i.test(e.message)}var uu=`relative flex cursor-pointer items-center border-0 bg-transparent py-4 pr-3 pl-4 text-left outline-none before:pointer-events-none before:absolute before:inset-[6px] before:rounded-md before:bg-transparent before:transition-colors hover:before:bg-gray-a3 focus-visible:before:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,du=`rounded-xl border border-gray-a6 bg-panel-solid shadow-[0_1px_3px_-1px_rgba(0,0,0,0.05),0_1px_1px_-1px_rgba(0,0,0,0.03)]`;function fu({amount:e,botId:t,currency:n,methods:r,position:i,separated:a,sessionId:o}){let c=_(),l=qi();return(0,Q.jsx)(Q.Fragment,{children:r.map((r,u)=>(0,Q.jsx)(`div`,{className:D(`group flex flex-col`,a?D(`overflow-hidden`,du):`border-stroke border-t`,z(`PaymentMethod`,`One payment method — the row plus its expanding detail region`)),children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{O(c(`6cRSh4`)),l.emit({type:`coming_soon_payment_method_clicked`,sessionId:o,botId:t,paymentMethodType:r.type,position:i+u,amount:e,currency:n,amountUsd:r.usd_reference_rate?Number((e/r.usd_reference_rate).toFixed(2)):void 0})},className:D(uu,z(`PaymentMethodRow`,`The clickable payment method row`)),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`relative mr-4 flex size-[18px] shrink-0 items-center justify-center rounded-full border border-gray-a9 bg-transparent transition-[background-color,border-color] duration-300 ease-out group-hover:border-gray-a10`,z(`PaymentMethodRadio`,`The radio indicator on a method row`))}),(0,Q.jsx)(`span`,{className:D(`mr-2 flex`,z(`PaymentMethodIcon`,`The method icon on a row`),`text-gray-11 group-hover:text-gray-12`),children:(0,Q.jsx)(Vo,{entry:r})}),(0,Q.jsx)(s,{render:(0,Q.jsx)(`span`,{}),size:`2`,className:D(`text-gray-12 antialiased`,z(`PaymentMethodLabel`,`The method display name on a row`)),children:r.display_name})]})})},r.type))})}function pu(e){return e.required_parent_payment_method!=null&&To(e)!=null}function mu(e,t,n){let r=e.card?.supported_funding_types??null;if(!(r==null||(n.funding?r.includes(n.funding):!n.complete)))return!1;let i=e.currencies[t.toLowerCase()]?.countries??[];return i.some(e=>e.country===`*`)?!0:n.issuingCountry?i.some(e=>e.country===n.issuingCountry):!n.complete}function hu(e,t,n){let r=(e.currencies[t.toLowerCase()]?.countries??[]).map(e=>e.country);if(!(r.length===0||r.includes(`*`)))return n&&r.includes(n)?[n]:r}function gu(e,t){return e.card?.buyer_installment_fee_percentages?.[t.toLowerCase()]??null}function _u(e,t,n){let r=n==null?e:e*(1+n/100);return Math.ceil(r/t)}function vu(e,t,n,r){if(!t)return{status:`none`};let i=e.find(e=>e.type===t);return i?mu(i,n,r)?{status:`selected`,tier:i}:{status:`ineligible`}:{status:`none`}}function yu({tiers:e,card:t,currency:n,totalMinor:r,selectedType:i,onSelect:a}){let o=_(),s=g();if(e.length===0)return null;let c=e.find(e=>e.type===i&&(!t||mu(e,n,t)));return(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1`,z(`PaymentInstallments`,`The payment method installment picker`)),children:[(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-11 font-medium`,z(`PaymentInstallmentsLabel`,`The installment picker's heading`)),children:o(`wY2C+X`)}),(0,Q.jsxs)(`div`,{className:D(`border-stroke flex flex-col overflow-hidden rounded-lg border`,z(`PaymentInstallmentList`,`The installment picker's option list`)),children:[t&&(0,Q.jsx)(bu,{first:!0,selected:c==null,onSelect:()=>a(null),label:o(`VGZhw8`)}),e.map((e,i)=>{let l=!t||mu(e,n,t),u=To(e)??1,d=t?o(`YQekmW`,{amount:Bo(_u(r,u,gu(e,n)),n,s),c
12ount:u}):void 0;return(0,Q.jsx)(`div`,{"aria-hidden":!l,inert:!l,className:D(`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,l?`grid-rows-[1fr] opacity-100`:`pointer-events-none grid-rows-[0fr] opacity-0`),children:(0,Q.jsx)(`div`,{className:`overflow-hidden`,children:(0,Q.jsx)(bu,{first:!t&&i===0,selected:c?.type===e.type,disabled:!l,onSelect:()=>a(e.type),label:t?o(`n8ggae`,{count:u}):e.display_name,detail:d})})},e.type)})]}),t&&c&&gu(c,n)==null&&(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10`,z(`PaymentInstallmentsNotice`,`The issuer-fee disclaimer under a selected tier with no declared fee`)),children:o(`Kn4hQR`)}),!t&&c&&(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10`,z(`PaymentInstallmentsNotice`,`The issuer-fee disclaimer under a selected tier with no declared fee`)),children:o(`stU2SQ`)})]})}function bu({selected:e,disabled:t,onSelect:n,label:r,detail:i,first:a}){return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":e,disabled:t,onClick:n,className:D(`flex w-full cursor-pointer items-center px-3 py-2.5 text-left transition-colors`,a?``:`border-stroke border-t`,e?`bg-gray-a2`:`hover:bg-gray-a2`,z(`PaymentInstallmentRow`,`One installment option row`),e&&z(`PaymentInstallmentRowSelected`,`The selected installment option row`)),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`before:bg-gray-1 relative mr-3 flex size-4 shrink-0 items-center justify-center rounded-full border transition-[background-color,border-color] duration-300 ease-out before:block before:size-[5px] before:rounded-full before:transition-transform before:duration-300 before:ease-[cubic-bezier(0.34,1.56,0.64,1)]`,z(`PaymentInstallmentRadio`,`The radio indicator on an installment option row`),e?`border-gray-12 bg-gray-12 before:scale-100`:`border-gray-a9 bg-transparent before:scale-0`)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-12`,e?`font-semibold`:`font-medium`,z(`PaymentInstallmentLabel`,`An installment option row's label`)),children:r}),i?(0,Q.jsx)(`span`,{className:D(`text-1 shrink-0 font-medium`,e?`text-accent-a11`:`text-gray-11`,z(`PaymentInstallmentDetail`,`An installment option row's per-installment amount`)),children:i}):null]})]})}var xu=[`line1`,`line2`,`city`,`state`,`postal_code`];function Su(e){let t={country:e.country};for(let n of xu){let r=e[n];r&&(t[n]=r)}return t}function Cu(e,t){return e.complete===t.complete&&e.address.country===t.address.country&&xu.every(n=>e.address[n]===t.address[n])}var wu=(0,Z.createContext)({publish:()=>{},abandon:()=>{}}),Tu=wu.Provider;function Eu(){return(0,Z.useContext)(wu)}function Du(e){let t=(0,Z.useRef)(e),n=(0,Z.useRef)(void 0),r=(0,Z.useRef)(void 0),i=(0,Z.useRef)(void 0);return(0,Z.useEffect)(()=>{t.current=e}),(0,Z.useEffect)(()=>()=>clearTimeout(i.current),[]),(0,Z.useMemo)(()=>({publish:(e,a)=>{n.current={owner:e,change:a},clearTimeout(i.current),i.current=setTimeout(()=>{let e=n.current?.change;e&&(r.current&&Cu(r.current,e)||(r.current=e,t.current({complete:e.complete,address:{...e.address}})))},300)},abandon:e=>{n.current?.owner===e&&(n.current=void 0,clearTimeout(i.current))}}),[])}function Ou({bt:e,documentType:t,documentTypes:n,showError:r,onDocumentTypeChange:i,onNumberValidChange:a,connect:o}){let s=_(),c=(0,Z.useId)(),{styles:l,probeRef:u}=ss(),[d,f]=(0,Z.useState)(!1),p=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{o(async()=>{let t=p.current;if(!e||!t)throw Error(s(`ZFUuoW`));return(await e.tokens.create({type:`token`,data:t})).id})},[e,o,s]),(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1`,z(`PaymentPayerDocument`,`Currency-specific buyer identity document fields`)),children:[(0,Q.jsx)(`div`,{className:`hidden`,ref:u}),(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-11 font-medium`,z(`PaymentPayerDocumentLabel`,`Buyer identity document label`)),children:s(`WB2rmY`)}),(0,Q.jsxs)(`div`,{className:D(`flex flex-col rounded-lg border`,r?`border-danger-9`:`border-stroke`),children:[(0,Q.jsxs)(`div`,{className:`border-stroke relative flex h-11 items-center border-b px-3`,children:[(0,Q.jsx)(`svg`,{className:`pointer-events-none absolute top-1/2 right-3.5 -translate-y-1/2`,xmlns:`http://www.w3.org/2000/svg`,
12width:`10`,height:`10`,viewBox:`3.25 5.25 9.5 5.5`,fill:`none`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M4 6L8 10L12 6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,Q.jsxs)(`select`,{className:D(`text-2 text-gray-12 h-11 w-full appearance-none bg-transparent outline-none`,z(`PaymentPayerDocumentType`,`Buyer identity document type selector`)),value:t,onChange:e=>i(e.target.value),"aria-label":s(`so2/17`),children:[(0,Q.jsx)(`option`,{disabled:!0,value:``,children:s(`ZdVoJZ`)}),n.map(({type:e,label:t})=>(0,Q.jsx)(`option`,{value:e,children:t},e))]})]}),(0,Q.jsx)(`div`,{className:D(`relative flex h-11 items-center rounded-b-[7px] px-3 [color-scheme:normal] transition-shadow`,d&&`z-10 shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`),children:e&&l?(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(Ze,{id:c,bt:e,ref:p,style:l,inputMode:`text`,placeholder:s(`dFy4D7`),validation:/^[a-zA-Z0-9]+$/,onChange:e=>a(!e.empty&&e.complete&&(e.valid??!0)),onFocus:()=>f(!0),onBlur:()=>f(!1)})}):null})]}),r?(0,Q.jsx)(`span`,{className:D(`text-1 text-danger-9`,z(`PaymentPayerDocumentError`,`Buyer identity document error`)),children:s(`ZFUuoW`)}):null]})}function ku(e){return!!e&&!e.empty&&e.complete&&(e.valid??!0)}function Au({bt:e,field:t,inputId:n,label:r,connect:i,onInteract:a,onStateChange:o}){let s=_(),{styles:c,probeRef:l}=ss(),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(!1),h=(0,Z.useRef)(null),g=(0,Z.useMemo)(()=>Qi(t),[t]),v=(0,Z.useMemo)(()=>$i(t),[t]);return(0,Z.useEffect)(()=>{i(h)},[i]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`div`,{className:`hidden`,ref:l}),(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`PaymentFieldLabel`,`Declared payment field label`)),htmlFor:n,children:r}),(0,Q.jsx)(`div`,{className:D(`box-border h-11 w-full rounded-lg border bg-transparent px-3 [color-scheme:normal] transition-[box-shadow,border-color]`,z(`PaymentFieldInput`,`A declared method input in the detail region`),u&&`border-accent-a8 shadow-[0_0_0_3px_var(--accent-a5)]`,!u&&(f?`border-danger-9`:`border-stroke`),f&&z(`PaymentFieldInputInvalid`,`Added to a declared input while its value fails the declared format`)),children:e&&c?(0,Q.jsx)(`div`,{className:`flex h-full items-center`,children:(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(Ze,{id:n,bt:e,ref:h,style:c,inputMode:`text`,autoComplete:`off`,"aria-label":r,placeholder:t.placeholder??void 0,mask:g,transform:Zi,validation:v,validateOnChange:!0,onChange:e=>{a(),m.current=!e.empty&&e.valid===!1,p(!1),o({empty:e.empty,complete:e.valid??e.complete,valid:e.valid})},onFocus:()=>d(!0),onBlur:()=>{d(!1),p(m.current)}})})}):null}),f&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`PaymentFieldError`,`The Invalid message under a declared input`)),children:s(`89T/ze`)})]})}var ju=5,Mu=`url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cpath%20fill%3D'%23fff'%20fill-rule%3D'evenodd'%20d%3D'M0%200h32v32H0zM22.52-2.1h24.01a6.1%206.1%200%200%201%206.1%206.1v24a6.1%206.1%200%200%201-6.1%206.1H22.52a6.1%206.1%200%200%201-6.1-6.1V4a6.1%206.1%200%200%201%206.1-6.1Z'%2F%3E%3C%2Fsvg%3E")`,Nu={maskImage:Mu,maskSize:`100% 100%`,WebkitMaskImage:Mu,WebkitMaskSize:`100% 100%`},Pu=4,Fu=`url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2032%2032'%3E%3Cpath%20fill%3D'%23fff'%20fill-rule%3D'evenodd'%20d%3D'M0%200h32v32H0zM-14.53-2.1H9.48a6.1%206.1%200%200%201%206.1%206.1v24a6.1%206.1%200%200%201-6.1%206.1h-24.01a6.1%206.1%200%200%201-6.1-6.1V4a6.1%206.1%200%200%201%206.1-6.1Z'%2F%3E%3C%2Fsvg%3E")`,Iu={maskImage:Fu,maskSize:`100% 100%`,WebkitMaskImage:Fu,WebkitMaskSize:`100% 100%`},Lu=4;function Ru(e){return(e.card?.networks??[]).slice(0,Lu).map(e=>({id:e.brand,variants:e.icons.square}))}var zu=new Set([`name`,`line1`,`line2`,`city`,`state`,`postal_code`,`country`]);function Bu(e){let t=[];for(let n of e.required_fields??[])n.kind===`billing_details`&&zu.has(n.name)&&!t.includes(n.name)&&t.push(n.name);return t}function Vu(e,t){return(e.payer_document_requirements??[]).some(e=>e.currency===t.toLowerCase())}function Hu(e,t){return t===`full`||e.collect_billing_address===!0?`full`:`minimal`}function Uu(e,t){return t.mode===`setup`?null:t.offerAmounts===void 0?t.amount:e.supports_buyer_fee??!0?t.offerAmounts.feeInclusive:t.offerAmounts.feeFree}var Wu=5,Gu=10;function Ku(e,t,n){return e.balances.some(e=>e.currency===t.toLowerCase()&&Math.round(Number(e.amount)*10**e.decimals)>=n)}function qu(e,t,n){return e.find(e=>e.spendable&&Ku(e,t,n))??e.find(e=>e.spendable)}var Ju=(0,Z.createContext)(null),Yu=(0,Z.createContext)(void 0),Xu=(0,Z.createContext)(()=>{}),Zu=0,Qu=()=>`mount:${Zu+=1}`,$u=`relative flex items-center border-0 bg-transparent py-4 pr-3 pl-4 text-left outline-none cursor-pointer before:pointer-events-none before:absolute before:inset-[6px] before:rounded-md before:bg-transparent before:transition-colors hover:before:bg-gray-a3 focus-visible:before:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,ed=`rounded-xl border border-gray-a6 bg-panel-solid shadow-[0_1px_3px_-1px_rgba(0,0,0,0.05),0_1px_1px_-1px_rgba(0,0,0,0.03)]`,td=B(`payment`).anch
12ors(`billingLine1`).doc("Shows available payment methods and collects the selected method's required fields and disclosures. Use `change` to enable your pay button. In its activation handler, call `payments.createConfirmationToken()`. Confirm the token server-side, then pass any pending step to `payments.handleNextAction(…)`. Use `addressChange` for address-dependent updates.").props(e=>({accountId:e.fromController().analytics().doc("Account ID, prefixed `biz_` — injected by the controller."),plan:e.fromController().analytics().doc(`The plan being charged, when this payment uses one.`),checkoutSessionId:e.fromController().analytics().doc(`The composing checkout session ID, when this payment surface belongs to one.`),checkoutSurface:e.direct().embedDefault(`external_checkout`).doc("Which checkout is asking. Methods that do not serve it are never offered. Mounting this element IS building your own checkout, so an embedded mount is fixed to `external_checkout`; the first-party mounts that are something else — Whop's checkout element composes this one — say so at the mount."),showComingSoonPaymentMethods:e.direct().default(!1).doc(`Direct mode only. Shows demand-test payment methods returned by the payment-method matrix.`),currency:e.fromController().analytics().doc(`Lowercase three-letter ISO 4217 currency code — injected by the controller.`),amount:e.fromController().analytics().doc(`Payment amount in minor units — injected by the controller.`),mode:e.fromController().analytics().doc(`The controller's resolved mode — injected. In setup mode the offer has no amount to bound.`),offerAmounts:e.fromController().doc("Per-buyer-fee-posture totals the method offers are gated on, in minor units — injected when the composing checkout re-prices `amount` by the picked method’s fee, so each method’s bounds are judged against the total for that method and a pick can never re-gate the list and drop itself. Absent, `amount` gates every method."),setupFutureUsage:e.fromController().analytics().doc(`When set, only methods that can be saved for that usage are offered, and the confirmation token carries it.`),paymentMethodConfiguration:e.fromController().doc("The method filtering in force — the handle's inline configuration or the resolved plan's, in the API's own shape: disabled types are removed, enabled re-adds against the account's offered set, and with `include_platform_defaults: false` only enabled types remain."),composedPlan:e.direct().doc(`The plan belonging to a composing checkout. Direct mode only.`),composedPromoCode:e.direct().doc(`The promo code belonging to a composing checkout. Direct mode only.`),excludedPaymentMethodTypes:e.direct().doc(`Fresh payment method types already rendered by a composing checkout. Direct mode only.`),alternativePaymentMethodAvailabilityChanged:e.direct().doc(`Direct mode only. Reports whether another payment method remains after composed exclusions settle.`),walletAvailability:e.fromHost().doc(`Host-probed OS-sheet wallet facts — undefined while the probe is pending; wallet tiles render only once their fact lands true.`),previewWalletAvailability:e.fromController().doc(`Deterministic wallet visibility supplied only by non-interactive product previews.`),suggestionPick:e.fromController().doc(`A billing-address suggestion picked in the anchored overlay — nonce-keyed; the street field resolves it. Injected.`),suggestionManualNonce:e.fromController().doc(`Bumped when "Enter address manually" is picked in the billing overlay — reveals the full country format. Injected.`),suggestionDismissNonce:e.fromController().doc(`Bumped when the host dismisses the billing overlay — closes local open state. Injected.`),suggestionHover:e.fromController().doc(`A row hovered in the billing overlay — nonce-keyed; moves the keyboard highlight. Injected.`),fields:e.default({billingDetails:`minimal`}).doc("Controls billing-details collection. `billingDetails: 'minimal'` (default) follows each method's matrix. Methods collect name and the complete country format by default. An override may collect only the declared minimum or nothing. For cards, the minimum is name on card, country, and postal code. `'full'` requires name and the complete country format for every fresh method. `'never'` hides the block. `phone: '
12never'` hides only the billing phone input when your form already collects it; pass `billingDetails.phone` to `createConfirmationToken` for methods that require it. Pass the address to `createConfirmationToken` instead. The country selector includes only countries supported by the method and payment currency. With an installment plan selected, it narrows to the countries the plan serves — the billing country is the transaction country the charge processes under. It locks when only one is available."),defaultValues:e.default(void 0).doc("Prefills the billing details when each method's billing block first renders. The buyer can edit every prefilled field. `address.country` is an ISO 3166-1 alpha-2 code and applies only when the selected method accepts it. `phone` fills the billing phone input for methods that collect one, in E.164 format such as `+14155552671`; a number outside the method's supported phone countries is ignored. Only fields the block renders are prefilled and sent. Pass anything else to `createConfirmationToken` in `billingDetails`."),addressElementLive:e.fromController().doc(`Whether a standalone address element is live on the same handle — the internal billing block auto-collapses so the address is only collected once.`),billingCountry:e.fromController().doc(`The live country collected by a standalone address element on the same payments handle.`),layout:e.default(`accordion`).analytics().doc("Picker layout. `accordion` (default) stacks methods and expands details inline. `horizontal` shows equal-width, non-scrolling tiles with selected details below. After four methods, a More tile opens a native selector. The method picked there occupies the final tile until the next selection. Selection and confirmation behave identically."),separated:e.default(!1).analytics().doc("`accordion` only. Adds spacing and separate card styling between methods. Ignored when `layout` is `horizontal`."),order:e.default([]).doc(`Controls display order in either layout. Listed types appear first in order. Unlisted types retain their relative order. Does not affect availability.`),sessionNonce:e.fromController().doc(`Bumped by the controller every time the buyer session changes — a sign-in or a sign-out. It re-reads the saved methods, which is how a sign-out drops the previous buyer's cards: in first-party mode both directions change only an HttpOnly cookie this element cannot see, so the bump is the only announcement there is. Injected.`),autoSelect:e.default(!0).analytics().doc("Whether to select the first offered method after resolution. The default `true` respects `order` and emits `selected` and `change` like a buyer interaction. It runs once before buyer interaction and does nothing when no method is offered. Set `false` to mount unselected. Independently, if an update removes the selected method, selection falls back to the first offered method. An already unselected element stays unselected."),savedOnly:e.direct().default(!1).doc(`Direct mode only. Show the first eligible saved method as a compact one-click control and never fall back to a fresh collection method.`),savedMethodAvailabilityChanged:e.direct().doc(`Direct mode only. Reports whether the compact saved-method lane can be used for this payment.`),changeSavedMethodRequested:e.direct().doc(`Direct mode only. Called when the buyer asks to replace the compact saved method.`),currencyFallback:e.direct().doc("Direct mode only. When no methods are offered, the empty pane renders a one-click switch to this currency — the composing checkout passes the other currency its session offers, plus whether a switch is already in flight. Taking it fires `currencyFallbackRequested`.")})).state(()=>({selectedType:void 0,selectedCategory:void 0,selectedTemplate:void 0,selectedSubmitButton:void 0,sessionToken:void 0,selectedSavedId:void 0,selectedBalanceId:void 0})).auth({embed:({state:e})=>{"use embed";return F(e.sessionToken)}}).events(e=>({suggestions:e.internal().doc(`The billing street field published its live suggestion list — the controller mirrors it into the anchored overlay and opens/closes the frame.`),change:e.external().analytics(`complete`,`type`,`supportsBuyerFee`).doc("Fires when selection changes. `complete: true` means the buyer selected a method and completed its card fields or required inputs. Use it to enable confirmation. `method` provides category, per-currency countries, and amount bounds for dependent UI such as country fields. `requiresBillingPhone` indicates whether the selected method requires a phone in billing details, including when `fields.phone` disables its input. `supportsBuyerFee` indicates whether to include Whop's buyer service fee in the displayed total."),selected:e.internal().analytics(`type`,`category`,`template`).doc(`Coordination only — the controller mirrors the selection into its public state for the confirm dispatcher's synchronous gesture-time read.`),addressChange:e.external().analytics(`complete`).doc("Fires about 300 ms after the internal billing address changes. Use it for tax, shipping, or other address-dependent updates. `country` is an ISO 3166-1 alpha-2 code. The payload omits other address keys when empty or unused for that country. `complete: true` means the billing block is valid and complete. This event fires only while the payment element owns address collection. With `fields.billingDetails: 'never'`, use your address source. With a mounted `AddressElement`, use its `change` event."),sessionRequested:e.internal().doc("Coordination only — emitted once at mount: a payment element created after the buyer signed in asks the controller to re-deliver the session it already holds (the late-mount leg of `adoptSession`)."),phoneVerificationRequested:e.internal().doc("Coordination only — a composing surface (the checkout, over this element’s composed ref) asked for the phone-verification ceremony; the controller reaction presents the dialog it owns. An ASK, not an outcome: the ceremony landing announces itself as `phoneVerification`’s own verified event."),currencyF
12allbackRequested:e.direct().analytics(`currency`).doc("Fires when the buyer takes the empty pane’s switch to the `currencyFallback` currency — a direct-audience ask for the composing surface, which is the only mount kind that can offer the fallback. An ASK, not an outcome: re-price the charge in that currency (the composed checkout updates the session’s `display_currency`) and the re-resolved `currency` prop rebuilds the method list.")})).contributes(e=>({beforeTokenize:e.required().doc("The generic per-method collection point: every SELECTED method's tile registers a provider (active = selected) that validates its own requirements and returns its category-keyed payment_method slice — the card tile tokenizes the unit into { card: { token } } (and, when the buyer picked an installment plan, names the tier's `type` for the collect to send), declared-input methods validate and return { [category]: fields } (+ billingExtra), and a method with secure declared fields BT-tokenizes their hosted element instances (one token intent, keyed by field name) into { [category]: { token } } so the raw values never exist in frame JS. OS-sheet wallets never register (the host ceremony owns them). Consumed by the `collect` action."),billingBlock:e.optional().doc("The internal billing address block's snapshot (revealing its errors) — the block renders inside each fresh method's detail region (`fields.billingDetails` not \"never\", no standalone address element live, never on OS-sheet wallets) and only the SELECTED tile's provider is active. The `collect` action merges it UNDER the incoming billingDetails."),applySelection:e.required().doc("The live method list's selection writer: resolves a type against the current offers and runs the same path a click does, throws the coded SelectError refusal for a type that isn't offered, and clears the whole selection on null. C
12onsumed by the `select` action.")})).actions(e=>({adoptSession:e.controllerOnly(async(e,t)=>{"use embed";return e.setState({sessionToken:t.token}),{}}).doc(`The controller's session delivery over the same-origin bus: hold the buyer's session token (present only on an embedded sign-in — direct mode authenticates with the scoped cookie), or drop it when the input carries none (sign-out).`),requestPhoneVerification:e.controllerOnly(async e=>{"use embed";return e.emit(`phoneVerificationRequested`,{}),{}}).doc(`Ask the payments controller to present the phone-verification ceremony — the composed-ref relay behind the checkout’s verify_phone drive, no consumer surface. Resolves at delivery; the ceremony reports its own landing.`),collect:e.controllerOnly(async(e,t)=>{"use embed";let{selectedType:n,selectedCategory:r,selectedTemplate:i}=e.state;if(!n||!r)throw Error(`No payment method is selected`);if(r===`saved`){if(!e.state.selectedSavedId)throw Error(`No saved payment method is selected`);let r=await e.contributions.billingBlock();return{paymentMethod:{type:n,category:`saved`,saved:{payment_method:e.state.selectedSavedId}},billingDetails:Gs(zl(t?.billingDetails,r))}}if(r===`balance`){if(!e.state.selectedBalanceId)throw Error(`No balance is selected`);let r=await e.contributions.billingBlock();return{paymentMethod:{type:n,category:`balance`,balance:{id:e.state.selectedBalanceId}},billingDetails:Gs(zl(t?.billingDetails,r))}}if(i===`wallet_sheet`)throw Error(`The selected method needs its wallet sheet — reselect the payment method and try again`);let a=await e.contributions.billingBlock(),o=Gs(zl(t?.billingDetails,a)),{slice:s,billingExtra:c,type:l}=await e.contributions.beforeTokenize({billingDetails:o});return{paymentMethod:{type:l??n,category:r,...s},billingDetails:o,billingExtra:c}}).doc("The payment-element face's collection — reached ONLY through `payments.createConfirmationToken` (the confirm cascade): invokes the selected tile's beforeTokenize provider and returns the collected bag the controller mints from."),select:e.public(async(e,t)=>{"use embed";await e.contributions.applySelection(t)}).doc("Select a method through the same path as a buyer interaction. For example, `select('cashapp')` expands the tile and emits `selected` and `change`. Cards remain `complete: false` until their fields are complete. Unknown, unavailable, or amount-gated methods reject with code `METHOD_NOT_OFFERED`. `select(null)` clears selection and emits `change` with `complete: false`. Use with `autoSelect={false}` for full external control.")})).loading(e=>{"use loading";let t=`var(--gray-a3, #f0f0f3)`;if(e.layout===`horizontal`){let e={height:62,borderRadius:8,background:t};return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,gap:8,overflow:`hidden`,paddingBottom:4},children:[[0,1,2,3].map(t=>(0,Q.jsx)(`div`,{style:{...e,flex:`1 1 0`,minWidth:0}},t)),(0,Q.jsx)(`div`,{style:{...e,flex:`0 0 56px`}})]})}return e.separated?(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[0,1,2,3,4].map(e=>(0,Q.jsx)(`div`,{style:{height:55,borderRadius:12,background:t}},e))}):(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{height:271,borderRadius:12,background:t}})},{props:[`layout`,`separated`]}).demo(e=>e.controls(e=>({layout:e.select(`accordion`,[`accordion`,`horizontal`],{label:`Method layout`}),separated:e.boolean(!1,{label:`Separated items`}),order:e.text(``,{label:`Method order (comma-separated)`}),autoSelect:e.boolean(!0,{label:`Auto-select first method`})})).props(e=>({layout:e.layout,separated:e.separated,order:e.order.split(`,`).map(e=>e.trim()).filter(Boolean),autoSelect:e.autoSelect,checkoutSessionId:void 0,plan:void 0,offerAmounts:void 0,previewWalletAvailability:void 0,suggestionPick:void 0,suggestionManualNonce:0,suggestionDismissNonce:0,suggestionHover:void 0,billingCountry:void 0}))).render(e=>{"use embed";let t=_(),n=qi(),{props:r,state:i,setState:a,emit:o}=e,[s,c]=(0,Z.useState)(),l=Du(e=>o(`addressChange`,e));(0,Z.useEffect)(()=>{o(`sessionRequested`,{})},[]);let[u,d]=(0,Z.useState)(!1),f=(0,Z.useRef)(void 0),p=r.showComingSoonPaymentMethods?`true`:void 0,m={account_id:r.accountId,currency:r.checkoutSurface===`direct_checkout`?r.currency:void 0,surface:r.checkoutSurface,plan_id:r.composedPlan??r.plan,promo_code:r.composedPromoCode??void 0},h=xe(e=>e.paymentMethodTypes.list(m,{queryParams:p?{include_coming_soon:p}:void 0})),{country:g}=Vi(),v=r.billingCountry??s??Tr(r.defaultValues?.billingDetails?.address?.country)??g,y=e=>Uu(e,r),b=h.data?.data??[],x=b.filter(e=>e.coming_soon&&Ro(e,r.currency,y(e),r.setupFutureUsage,r.previewWalletAvailability??r.walletAvailability,v)),S=b.filter(e=>!e.coming_soon&&Lo(e,r.currency,y(e),r.setupFutureUsage,r.previewWalletAvailability??r.walletAvailability,r.paymentMethodConfiguration,v)),C=S.filter(pu),w=S.filter(e=>Oo(e)!==`wallet_sheet`&&!pu(e)&&(e.usage.off_session||e.usage.on_session)),T=w.find(e=>e.type===`card`),E=(T?.card?.networks??[]).map(e=>e.brand).sort(),O=!!h.data&&w.length===0,k=h.data&&!O?{payment_method_types:w.map(e=>e.type).sort(),...E.length>0?{card_brands:E}:{},...T&&Vu(T,r.currency)?{has_payer_document:!0}:{},expired:!1,broken:!1}:null,[A]=(0,Z.useState)(Qu),j=ye(e=>e.paymentMethods.list({first:Wu,...k??{}}),{scope:[A,i.sessionToken??`anonymous`],enabled:k!==null,staleTime:1/0,gcTime:0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),M=S.find(e=>e.category===`balance`),[ee]=(0,Z.useState)(Qu),P=ye(e=>e.balances.list({first:Gu}),{scope:[ee,i.sessionToken??`anonymous`,r.sessionNonce],enabled:M!==void 0,staleTime:1/0,gcTime:0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),F=P.isError?[]:P.data?.pages.flatMap(e=>e.data??[])??[],I=M!==void 0&&!P.isError&&P.isPending,L=M?y(M)??r.amount:r.amount,[R,B]=(0,Z.useState)(null),V=(0,Z.useRef)(r.sessionNonce);(0,Z.useEffect)(()=>{V.current!==r.sessionNonce&&(V.current=r.sessionNonce,k!==null&&j.refetch())},[r.sessionNonce,j,k]);let H=!O&&!j.isError&&j.isPending,te=!j.isError&&j.hasNextPage,U=h.error?Oe(h.error,`matrix fetch failed`):null,W=!
12h.data&&!U,ne=e=>e.category!==`balance`||F.some(e=>e.spendable),G=r.savedOnly?F.find(e=>e.spendable&&Ku(e,r.currency,L)):void 0,K=S.filter(e=>(Ao(e)||e.category===`balance`&&(r.savedOnly?G!==void 0:F.length>0))&&!pu(e)&&(!jo(e)||C.some(t=>t.required_parent_payment_method===e.type))&&!r.excludedPaymentMethodTypes?.some(t=>t===e.type));r.order.length>0&&K.sort((e,t)=>yd(e.type,r.order)-yd(t.type,r.order));let re=new Map(S.map(e=>[e.type,e])),ie=j.data?.pages.flatMap(e=>e.data)??[],q=j.isError?[]:ie.filter(e=>{let t=re.get(e.payment_method_type);return t?e.typename===`CardPaymentMethod`?!Vu(t,r.currency)||e.has_payer_document===!0:!0:!1}),ae=r.savedOnly?[]:K.map(e=>e.type),oe=r.savedOnly?G&&M?[M.type]:q.slice(0,1).map(e=>e.payment_method_type):q.map(e=>e.payment_method_type),se=U?`failed`:ae.length+oe.length>0?`available`:`empty`,ce=JSON.stringify([r.checkoutSessionId,se,ae,oe]);(0,Z.useEffect)(()=>{!r.checkoutSessionId||W||!U&&(H||I)&&(f.current!==void 0||ae.length===0)||f.current!==ce&&(f.current=ce,n.emit({type:`payment_methods_presented`,sessionId:r.checkoutSessionId,botId:r.accountId,freshPaymentMethodTypes:ae,savedPaymentMethodTypes:oe,paymentMethodsState:se}))},[n,I,ae,U,se,W,ce,r.accountId,r.checkoutSessionId,H,oe]);let[le,J]=(0,Z.useState)(null),[ue,de]=(0,Z.useState)(null),fe=e=>e?e.supports_buyer_fee??!0:void 0,pe=(e,t)=>{let n=e.currencies[r.currency];o(`change`,{complete:t,type:e.type,supportsBuyerFee:fe(e),requiresBillingPhone:e.collect_billing_phone_number===!0,method:{type:e.type,category:e.category,template:Oo(e),display_name:e.display_name,countries:n?.countries??[],min_amount:n?.min_amount??null,max_amount:n?.max_amount??null}})};(0,Z.useEffect)(()=>{if(!le)return;let e=K.find(e=>e.type===le.type);e&&pe(e,le.complete)},[le,r.currency,r.amount,r.setupFutureUsage]);let me=e=>{if(e.category===`balance`&&r.savedOnly){G&&he(G);return}if(i.selectedType===e.type&&!i.selectedSavedId){le?.type===e.type&&pe(e,le.complete);return}J(null),a({selectedType:e.type,selectedCategory:e.category,selectedTemplate:Oo(e),selectedSubmitButton:e.submit_button??void 0,selectedSavedId:void 0,selectedBalanceId:e.category===`balance`?F.find(e=>e.id===i.selectedBalanceId&&e.spendable)?.id??qu(F,r.currency,L)?.id:i.selectedBalanceId}),o(`selected`,{type:e.type,category:e.category,template:Oo(e),submitButton:e.submit_button??void 0})},Y=e=>{if(i.selectedSavedId===e.id)return;let t=S.find(t=>t.type===e.payment_method_type)?.submit_button??void 0;J(null),a({selectedType:e.payment_method_type,selectedCategory:`saved`,selectedTemplate:`none`,selectedSubmitButton:t,selectedSavedId:e.id}),o(`selected`,{type:e.payment_method_type,category:`saved`,template:`none`,submitButton:t}),o(`change`,{complete:!0,type:e.payment_method_type,supportsBuyerFee:fe(S.find(t=>t.type===e.payment_method_type))})},he=e=>{if(i.selectedCategory===`balance`&&i.selectedBalanceId===e.id)return;let t=M;if(!t)return;let n=t.submit_button??void 0;J(null),a({selectedType:t.type,selectedCategory:`balance`,selectedTemplate:`none`,selectedSubmitButton:n,selectedSavedId:void 0,selectedBalanceId:e.id}),o(`selected`,{type:t.type,category:`balance`,template:`none`,submitButton:n}),r.savedOnly&&o(`change`,{complete:!0,type:t.type,supportsBuyerFee:fe(t)})},ge=()=>{J(null),a({selectedType:void 0,selectedCategory:void 0,selectedTemplate:void 0,selectedSubmitButton:void 0,selectedSavedId:void 0,selectedBalanceId:void 0}),o(`selected`,{}),o(`change`,{complete:!1})},_e=(0,Z.useRef)(null),ve=(0,Z.useRef)(!1),be=(0,Z.useCallback)(()=>{ve.current=!0,_e.current=null,B(null)},[]);N(td,`applySelection`,e=>{if(e===null){be(),ge();return}let t=K.find(t=>t.type===e);if(!t)throw new Ae(`METHOD_NOT_OFFERED`,`"${e}" is not an offered payment method for this charge`);be(),me(t)},!0);let Se=(0,Z.useCallback)(e=>{be(),me(e)},[me,be]),Ce=(0,Z.useCallback)(e=>{be(),Y(e)},[Y,be]),we=!W&&!U&&!H&&!I;(0,Z.useEffect)(()=>{if(!we||ve.current||!r.autoSelect||R!==null||_e.current!==null)return;if(r.savedOnly&&G){he(G);return}let e=q[0];if(e){Y(e);return}if(r.savedOnly)return;let t=K.find(ne);t&&me(t)},[we,r.autoSelect,r.savedOnly,G?.id,q[0]?.id,K[0]?.type,q.length,K.length]);let Ee=r.savedOnly,De=r.savedMethodAvailabilityChanged;(0,Z.useEffect)(()=>{!Ee||W||H||I||De?.(!U&&(q.length>0||G!==void 0))},[Ee,De,W,H,I,U,q.length,G?.id]);let X=!!i.selectedType&&!i.selectedSavedId&&!(i.selectedCategory===`balance`&&I)&&!K.some(e=>e.type===i.selectedType),ke=!!i.selectedSavedId&&H,je=i.selectedCategory===`balance`&&!!i.selectedBalanceId&&I,Me=!!i.selectedSavedId&&!H&&
12!q.some(e=>e.id===i.selectedSavedId),Ne=i.selectedCategory===`balance`&&!!i.selectedBalanceId&&!I&&!F.some(e=>e.id===i.selectedBalanceId&&e.spendable),Pe=r.savedOnly&&i.selectedCategory===`balance`&&!!i.selectedBalanceId&&!I&&F.some(e=>e.id===i.selectedBalanceId&&!Ku(e,r.currency,L)),Fe=X||ke||je||Me||Ne||Pe;(0,Z.useEffect)(()=>{if(!Fe)return;if(J(null),ke&&(_e.current=i.selectedSavedId??null),je&&B(i.selectedBalanceId??null),Ne||Pe){let e=r.savedOnly?G:qu(F,r.currency,L);if(e){he(e);return}if(r.savedOnly){if(H||j.isFetching)B(i.selectedBalanceId??null);else if(q[0]){Y(q[0]);return}}}let e=r.savedOnly||ke||je?void 0:K.find(ne);if(e){me(e);return}a({selectedType:void 0,selectedCategory:void 0,selectedTemplate:void 0,selectedSubmitButton:void 0,selectedSavedId:void 0,selectedBalanceId:void 0}),o(`selected`,{}),o(`change`,{complete:!1})},[Fe,r.savedOnly,a,o]),(0,Z.useEffect)(()=>{if(H)return;let e=_e.current;if(e===null)return;_e.current=null;let t=q.find(t=>t.id===e);if(t){Y(t);return}if(r.savedOnly)return;let n=K.find(ne);n&&me(n)},[H,j.isError]),(0,Z.useEffect)(()=>{if(I||r.savedOnly&&(H||j.isFetching)||R===null)return;B(null);let e=F.find(e=>e.id===R),t=r.savedOnly?e?.spendable&&Ku(e,r.currency,L)?e:G:e?.spendable?e:qu(F,r.currency,L);if(t){he(t);return}if(r.savedOnly){q[0]&&Y(q[0]);return}let n=K.find(ne);n&&me(n)},[I,R,H,j.isFetching,P.isError]);let Ie=K.length===0,Le=W||!U&&(H||I)&&Ie,Re=r.alternativePaymentMethodAvailabilityChanged;(0,Z.useLayoutEffect)(()=>{Re?.(Le?null:!U&&(!Ie||q.length>0))},[Re,Le,Ie,U,q.length]);let ze=r.showComingSoonPaymentMethods&&x.length>0?r.checkoutSessionId:void 0,Be=ze!==void 0,Ve=(r.excludedPaymentMethodTypes?.length??0)===0&&!H&&!I&&Ie&&!Be&&q.length===0,He=r.currencyFallback,Ue=r.layout===`horizontal`,We=!Ue&&r.separated,Ge=!u&&!Ue&&K.length>6?K.slice(0,ju):K,Ke=K.length>5,qe=K,Je=[];if(Ke){qe=K.slice(0,Pu);let e=ue?K.find(e=>e.type===ue):void 0;e&&!qe.some(t=>t.type===e.type)&&(qe=[...qe.slice(0,Pu-1),e]),Je=K.filter(e=>!qe.some(t=>t.type===e.type))}let Ye=K.length-Ge.length,Xe=null;if(W)Xe=null;else if(r.savedOnly){let e=H||U?void 0:q.find(e=>e.id===i.selectedSavedId),t=I||U?void 0:i.selectedCategory===`balance`?F.find(e=>e.id===i.selectedBalanceId):void 0,n=i.selectedCategory===`balance`&&!!i.selectedBalanceId&&I&&t===void 0||R!==null&&I,a=e?void 0:t??(U||n?void 0:G),o=e??(a||H||j.isFetching||U||n?void 0:q.at(0));Xe=a?(0,Q.jsx)(cd,{balance:a,entry:M,change:r.changeSavedMethodRequested}):o?(0,Q.jsx)(sd,{method:o,change:r.changeSavedMethodRequested}):null}else Xe=U?(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`PaymentError`,`Unavailable payment methods error pane`)),children:[(0,Q.jsx)(`span`,{className:`bg-red-a3 text-4 text-red-11 flex size-10 items-center justify-center rounded-full`,children:`!`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:t(`abbnXC`)}),(0,Q.jsx)(`p`,{className:`text-1 text-gray-a10 max-w-80`,children:U})]}):(0,Q.jsxs)(`div`,{role:Ve?void 0:`radiogroup`,"aria-label":Ve?void 0:t(`9k5qQl`),className:D(`flex flex-col gap-3 p-1`,z(`Payment`,`The payment element root`)),"data-whop-autofill":``,children:[(0,Q.jsx)(Li,{}),(q.length>0||te)&&(0,Q.jsxs)(`div`,{role:`group`,"aria-label":t(`eClqvz`),className:D(We?`flex flex-col gap-2 ${z(`PaymentMethodsSeparated`,`Separated accordion method list`)}`:`flex flex-col overflow-hidden ${ed} [&>*]:-mt-px`,z(`PaymentMethods`,`The payment method list`),z(`PaymentSavedMethods`,`The saved-methods list specifically — carries PaymentMethods too, so one rule styles both lists`)),children:[q.map(e=>(0,Q.jsx)(ld,{method:e,choose:Ce,separated:We},e.id)),te&&(0,Q.jsx)(`div`,{className:We?`flex flex-col overflow-hidden ${ed}`:`border-stroke flex flex-col border-t`,children:(0,Q.jsx)(`button`,{type:`button`,disabled:j.isFetchingNextPage,onClick:()=>void j.fetchNextPage(),className:D($u,`text-gray-11 hover:text-gray-12 disabled:cursor-default`,z(`PaymentSavedMore`,`The control that fetches the next page of saved payment methods`)),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mr-4 size-[18px] shrink-0`}),(0,Q.jsx)(`span`,{className:`text-2 flex-1 antialiased`,children:t(`kCAn0f`)}),j.isFetchingNextPage?(0,Q.jsx)(`span`,{role:`status`,"aria-label":t(`iFsDVR`),className:D(`border-gray-a5 border-t-gray-11 size-3 animate-spin rounded-full border-2`,z(`PaymentSavedMoreSpinner`,`The spinner shown while the next page of saved payment methods loads`))}):(0,Q.jsx)(`svg`,{"aria-hidden":`true`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,children:(0,Q.jsx)(`path`,{d:`M2.5 4.5L6 8l3.5-3.5`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})})})]}),Ve&&(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 py-6 text-center`,z(`PaymentError`,`Unavailable payment methods error pane`)),children:[(0,Q.jsx)(`span`,{className:`bg-red-a3 text-4 text-red-11 flex size-10 items-center justify-center rounded-full`,children:`!`}),(0,Q.jsx)(`p`,{className:`text-2 font-medium`,children:t(`9xKSi+`)}),He&&(0,Q.jsx)(`button`,{type:`button`,disabled:He.pending,onClick:()=>
12o(`currencyFallbackRequested`,{currency:He.currency}),className:D(`border-stroke text-2 text-gray-12 hover:bg-gray-a2 mt-1 rounded-md border px-3 py-1.5 font-medium disabled:cursor-default disabled:opacity-60`,z(`PaymentCurrencyFallback`,`The switch to the fallback currency when nothing is offered`)),children:He.pending?t(`HZlipu`):t(`/4e/Il`,{currency:He.currency.toUpperCase()})})]}),(!Ie||Be)&&(Ue?(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsxs)(`div`,{className:D(`flex gap-2 pb-1`,z(`PaymentMethodTileRow`,`Horizontal method tile row with overflow methods in the final More tile`)),children:[qe.map(e=>(0,Q.jsx)(fd,{entry:e,choose:Se},e.type)),Je.length>0&&(0,Q.jsx)(pd,{overflow:Je,choose:e=>{de(e.type),Se(e)}})]}),(0,Q.jsx)(`div`,{className:z(`PaymentMethodPanel`,`The selected method's detail panel below the tile row (horizontal layout)`),children:K.map(e=>{let t=i.selectedType===e.type&&!i.selectedSavedId;return(0,Q.jsx)(`div`,{"aria-hidden":!t,className:D(`grid transition-opacity duration-150`,t?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),children:(0,Q.jsx)(`div`,{className:`relative overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`pt-2 pb-1`,inert:!t,children:e.category===`balance`?(0,Q.jsx)(ud,{entry:e,active:t,onInteract:be,onActiveComplete:t=>J({type:e.type,complete:t})}):(0,Q.jsx)(md,{entry:e,installmentTiers:C,active:t,onInteract:be,onActiveComplete:t=>J({type:e.type,complete:t})})})})},e.type)})}),ze!==void 0&&(0,Q.jsx)(`div`,{className:D(`flex flex-col overflow-hidden [&>*]:-mt-px`,!Ie&&`mt-2`,ed,z(`PaymentMethods`,`The payment method list`)),children:(0,Q.jsx)(fu,{amount:Te(r.amount,r.currency),sessionId:ze,botId:r.accountId,currency:r.currency,methods:x,position:qe.length+(Je.length>0?2:1),separated:!1},ze)})]}):(0,Q.jsxs)(`div`,{className:We?`flex flex-col gap-2 ${z(`PaymentMethods`,`The payment method list`)} ${z(`PaymentMethodsSeparated`,`Separated accordion method list`)}`:`flex flex-col overflow-hidden ${ed} [&>*]:-mt-px ${z(`PaymentMethods`,`The payment method list`)}`,children:[Ge.map(e=>(0,Q.jsx)(rd,{entry:e,installmentTiers:C,separated:We,choose:Se,onInteract:be,onActiveComplete:t=>J({type:e.type,complete:t})},e.type)),ze!==void 0&&(0,Q.jsx)(fu,{amount:Te(r.amount,r.currency),sessionId:ze,botId:r.accountId,currency:r.currency,methods:x,position:Ge.length+1,separated:We},ze),Ye>0&&(0,Q.jsx)(`div`,{className:We?`flex flex-col overflow-hidden ${ed}`:`border-stroke flex flex-col border-t`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(!0),className:D($u,`text-gray-11 hover:text-gray-12`,z(`PaymentMoreRow`,`The "N more payment methods" expander row`)),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mr-4 size-[18px] shrink-0`}),(0,Q.jsx)(`span`,{className:`mr-2 flex items-center`,children:K.slice(ju,9).map((e,t,n)=>(0,Q.jsx)(`span`,{className:D(`flex items-center`,t>0&&`-ml-2`),style:t<n.length-1?Nu:void 0,children:(0,Q.jsx)(Vo,{entry:e,square:!0})},e.type))}),(0,Q.jsx)(`span`,{className:`text-2 flex-1 antialiased`,children:t(`B8edW6`,{count:String(Ye)})}),(0,Q.jsx)(`svg`,{"aria-hidden":`true`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,children:(0,Q.jsx)(`path`,{d:`M2.5 4.5L6 8l3.5-3.5`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})})})]}))]});let Ze={balances:F,amount:L,hasNextPage:!P.isError&&!!P.hasNextPage,isFetchingNextPage:P.isFetchingNextPage,fetchNextPage:()=>void P.fetchNextPage()};return(0,Q.jsx)(e.Loading,{loading:W,children:(0,Q.jsx)(Tu,{value:l,children:(0,Q.jsx)(Xu.Provider,{value:c,children:(0,Q.jsx)(Yu.Provider,{value:v,children:(0,Q.jsx)(Ju.Provider,{value:Ze,children:Xe})})})})})});function nd({entry:e,active:t,addressElementLive:n,installmentCountries:r,onCompleteChange:i}){let a=_(),{props:o,emit:c,anchors:l}=P(),u=n?`minimal`:Hu(e,o.fields.billingDetails),d=Hi({detectCountry:!0}),f=(0,Z.useRef)(null),p=e.collect_billing_phone_number===!0&&o.fields.phone!==`never`,[m]=(0,Z.useState)(()=>
12Jo(o.defaultValues?.billingDetails?.phone,e.supported_phone_countries)),[h,g]=(0,Z.useState)(m??``),[v,y]=(0,Z.useState)(m??``),[b,x]=(0,Z.useState)(!1),S=(0,Z.useId)(),C=b&&!h,w=(0,Z.useRef)(!1),T=(0,Z.useMemo)(()=>({anchorRef:t?l.billingLine1:()=>{},publish:e=>c(`suggestions`,e),pick:o.suggestionPick,manualNonce:o.suggestionManualNonce,dismissNonce:o.suggestionDismissNonce,hover:o.suggestionHover,suspended:!t}),[t,l.billingLine1,c,o.suggestionPick,o.suggestionManualNonce,o.suggestionDismissNonce,o.suggestionHover]);N(td,`billingBlock`,async()=>{x(p);let e=f.current;if(!e)return{complete:!1,phoneRequired:p,address:{country:``}};let t=await e.snapshot({revealErrors:!0});return{complete:t.complete&&(!p||!!h),completeWithoutPhone:t.complete,phoneRequired:p,address:t.address,phone:p&&h||void 0}},t);let E=n?``:Bu(e).join(`,`),O=r??Fo(e,o.currency,Uu(e,o)),k=O.includes(`*`)?``:O.join(`,`),A=(0,Z.useMemo)(()=>{let e=E?E.split(`,`):[];return{mode:`billing`,layout:`compact`,scope:u,name:u===`full`||e.includes(`name`)?`combined`:`none`,organization:`none`,line2:`always`,autocomplete:!0,allowedCountries:k?k.split(`,`):void 0,requiredFloor:e}},[u,E,k]),j=(0,Z.useContext)(Yu),M=(0,Z.useContext)(Xu),ee=(0,Z.useCallback)(e=>{f.current=e,t&&j&&e.setCountry(j)},[t,j]),F=Eu(),I=(0,Z.useId)(),L=(0,Z.useRef)(null),R=(0,Z.useCallback)(e=>{w.current=e.complete,i(e.complete&&(!p||!!h)),L.current={complete:e.complete,address:Su(e.address)},t&&F.publish(I,L.current)},[t,I,i,F,p,h]),B=(0,Z.useRef)(p);(0,Z.useEffect)(()=>{B.current!==p&&(B.current=p,i(w.current&&(!p||!!h),`configuration`))},[i,p,h]);let V=(0,Z.useCallback)(e=>{g(e),i(w.current&&!!e)},[i]),H=(0,Z.useCallback)(e=>{if(!t)return;let n=e.target;n instanceof HTMLSelectElement&&n.dataset.addressField===`country`&&M(n.value)},[t,M]),te=(0,Z.useCallback)(e=>{t&&M(e)},[t,M]);return(0,Z.useEffect)(()=>(t&&L.current&&F.publish(I,L.current),()=>F.abandon(I)),[t,I,F]),(0,Q.jsxs)(`div`,{onChangeCapture:H,className:D(`flex flex-col gap-1`,z(`PaymentBillingBlock`,`The payment element's internal billing address block`)),children:[(0,Q.jsx)(`span`,{className:`text-2 text-gray-11 font-medium`,children:a(`H9Az5Z`)}),p?(0,Q.jsxs)(`div`,{className:`mt-1 mb-2 flex flex-col gap-1`,children:[(0,Q.jsx)(s,{render:(0,Q.jsx)(`label`,{htmlFor:S}),className:`sr-only`,children:a(`jdJhOL`)}),e.type===`splitit`?(0,Q.jsx)(`input`,{id:S,name:`phone`,type:`tel`,autoComplete:`tel`,value:v,placeholder:a(`v30i60`),onChange:e=>{let t=e.target.value;y(t),V(qo(t)??``)},required:t,"aria-invalid":C,"aria-describedby":C?`${S}-error`:void 0,className:D(`text-2 h-11 min-w-0 w-full rounded-lg border bg-transparent px-3 outline-none focus:border-[var(--accent-8)]`,C?`border-danger-9 placeholder:text-danger-9`:`border-[var(--gray-a6)]`)}):(0,Q.jsx)(pt,{id:S,name:`phone`,defaultValue:m,initialCountry:e.supported_phone_countries?.[0],allowedCountries:e.supported_phone_countries??void 0,placeholder:a(`jdJhOL`),onChange:V,required:t,ariaInvalid:C,ariaDescribedBy:C?`${S}-error`:void 0,variant:`surface`,size:`3`,className:D(`w-full rounded-lg text-2 outline-none transition-shadow [--accent-a5:inherit] [--accent-a8:inherit] focus-within:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,C&&`shadow-[inset_0_0_0_1px_var(--danger-9)] [&_input]:placeholder:text-danger-9`)}),C?(0,Q.jsx)(s,{id:`${S}-error`,size:`1`,color:`danger`,role:`alert`,children:e.type===`splitit`&&v.trim()?a(`Sw8YrN`):a(`OPvjVt`)}):null]}):null,d.ready&&d.catalog?(0,Q.jsx)(ni.Provider,{value:T,children:(0,Q.jsx)(Ni,{config:A,catalog:d.catalog,seed:{defaultValues:o.defaultValues?.billingDetails,detectedCountry:d.detectedCountry,countryHint:Pr(o.currency)},children:(0,Q.jsx)(Bi,{config:A,catalog:d.catalog,connect:ee,onSnapshot:R,onCountryChange:te})})}):(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`border-gray-a6 animate-pulse overflow-hidden rounded-lg border`,children:[(0,Q.jsx)(`div`,{className:`flex h-11 items-center px-3`,children:(0,Q.jsx)(`div`,{className:`bg-gray-a3 h-3 w-24 rounded`})}),u===`full`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-gray-a5 flex h-11 items-center border-t px-3`,children:(0,Q.jsx)(`div`,{className:`bg-gray-a3 h-3 w-32 rounded`})}),(0,Q.jsx)(`div`,{className:`border-gray-a5 flex h-11 items-center border-t px-3`,children:(0,Q.jsx)(`div`,{className:`bg-gray-a3 h-3 w-20 rounded`})})]}),(0,Q.jsxs)(`div`,{className:`border-gray-a5 flex border-t`,children:[(0,Q.jsx)(`div`,{className:`flex h-11 flex-1 items-center px-3`,children:(0,Q.jsx)(`div`,{className:`bg-gray-a3 h-3 w-16 rounded`})}),(0,Q.jsx)(`div`,{className:`border-gray-a5 flex h-11 flex-1 items-center border-l px-3`,children:(0,Q.jsx)(`div`,{className:`bg-gray-a3 h-3 w-12 rounded`})})]})]})]})}function rd({entry:e,installmentTiers:t,separated:n,choose:r,onInteract:i,onActiveComplete:a}){let{state:o}=P(),s=o.selectedType===e.type&&!o.selectedSavedId;return(0,Q.jsxs)(`div`,{className:D(`group flex flex-col`,n?`overflow-hidden ${ed} ${z(`PaymentMethodSeparated`,`Added to a method item while it renders as its own separated card`)}`:`border-stroke border-t`,z(`PaymentMethod`,`One payment method — the row plus its expanding detail region`)),children:[(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":s,onClick:()=>r(e),className:D($u,z(`PaymentMethodRow`,`The clickable payment method row`),s&&z(`PaymentMethodRowSelected`,`Selected payment method row`)),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`before:bg-gray-1 relative mr-4 flex size-[18px] shrink-0 items-center justify-center rounded-full border transition-[background-color,border-color] duration-300 ease-out before:block before:size-[5px] before:rounded-full before:transition-transform before:duration-300 before:ease-[cubic-bezier(0.34,1.56,0.64,1)]`,z(`PaymentMethodRadio`,`The radio indicator on a method row`),s?`border-gray-12 bg-gray-12 before:scale-100 ${z(`PaymentMethodRadioSelected`,`Selected payment method radio`)}`:`border-gray-a9 group-hover:border-gray-a10 bg-transparent before:scale-0`)}),(0,Q.jsx)(`span`,{className:D(`mr-2 flex`,z(`PaymentMethodIcon`,`The method icon on a row`),s?`text-gray-12`:`text-gray-11 group-hover:text-gray-12`),children:(0,Q.jsx)(Vo,{entry:e})}),(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-12 antialiased`,z(`PaymentMethodLabel`,`The method display name on a row`),s&&`font-semibold`),children:e.display_name}),e.category===`card`&&(0,Q.jsx)(`span`,{"aria-hidden":s,className:`isolate ml-auto flex items-center transition-opacity duration-200`,style:{opacity:+!s},children:Ru(e).map((e,t,n)=>(0,Q.jsx)(`span`,{className:D(`flex items-center`,t>0&&`-ml-2`),style:{zIndex:n.length-t,...t>0?Iu:{}},children:(0,Q.jsx)(Le,{icons:{square:e.variants},size:19})},e.id))})]})}),(0,Q.jsx)(`div`,{"aria-hidden":!s,className:D(`grid transition-all duration-[250ms]`,z(`PaymentMethodDetail`,`The expanding region that reveals the selected method's detail — inline card fields, explainer, or declared inputs`),s?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),style:{transitionTimingFunction:`ease`},children:(0,Q.jsx)(`div`,{className:`relative overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`px-4 pt-[3px] pb-3 empty:hidden`,inert:!s,children:e.category===`balance`?(0,Q.jsx)(ud,{entry:e,active:s,onInteract:i,onActiveComplete:a}):(0,Q.jsx)(md,{entry:e,installmentTiers:t,active:s,onInteract:i,onActiveComplete:a})})})})]})}var id={visa:`Visa`,mastercard:`Mastercard`,amex:`American Express`,discover:`Discover`,diners_club:`Diners Club`,jcb:`JCB`,unionpay:`UnionPay`};function ad(e){switch(e.typename){case`CardPaymentMethod`:{let t=e.card.brand??``,n=id[t]??(t?bd(t):`Card`);return{label:e.card.last4?`${n} •••• ${e.card.last4}`:n,hint:e.card.exp_month&&e.card.exp_year?`${String(e.card.exp_month).padStart(2,`0`)}/${String(e.card.exp_year).padStart(2,`0`)}`:void 0}}case`UsBankAccountPaymentMethod`:return{label:`${e.us_bank_account.bank_name} •••• ${e.us_bank_account.last4}`};case`CashappPaymentMethod`:return{label:e.cashapp.cashtag?`Cash App ${e.cashapp.cashtag}`:`Cash App`};case`IdealPaymentMethod`:return{label:e.ideal.bank?`iDEAL — ${e.ideal.bank}`:`iDEAL`};case`SepaDebitPaymentMethod`:return{label:e.sepa_debit.last4?`SEPA Direct Debit •••• ${e.sepa_debit.last4}`:`SEPA Direct Debit`};default:return{label:bd(e.payment_method_type)}}}function od({method:e}){let t=e.typename===`CardPaymentMethod`?(0,Q.jsx)(w,{}):e.typename===`UsBankAccountPaymentMethod`||e.typename===`SepaDebitPaymentMethod`?(0,Q.jsx)(y,{}):(0,Q.jsx)(x,{});return(0,Q.jsx)(Le,{icons:e.icons,shape:`card`,size:19,fallback:t})}function sd({method:e,change:t}){let n=_(),r=ad(e);return(0,Q.jsxs)(`button`,{type:`button`,"aria-label":n(`sA02QE`,{method:r.label}),onClick:t,className:D(`bg-gray-a3 hover:bg-gray-a4 focus-visible:ring-gray-a8 mx-auto flex max-w-full cursor-pointer items-center gap-2 rounded-full px-3 py-2 transition-colors focus-visible:ring-2 focus-visible:outline-none`,z(`PaymentCompactSavedMethod`,`The selected saved method on a compact direct checkout`)),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-gray-11 flex shrink-0`,children:(0,Q.jsx)(od,{method:e})}),(0,Q.jsx)(`span`,{className:`text-2 text-gray-12 min-w-0 truncate font-medium`,children:r.label}),(0,Q.jsx)(v,{"aria-hidden":`true`,className:`text-gray-a11 size-4 shrink-0`})]})}function cd({balance:e,entry:t,change:n}){let r=_(),{props:i}=P(),a=g(),o=e.balances.find(e=>e.currency===i.currency.toLowerCase()),s=e.owner?.title??r(`+aYIp0`),c=e.owner?.image_url,l=!!e.owner?.id.startsWith(`user_`);return(0,Q.jsxs)(`button`,{type:`button`,"aria-label":r(`sA02QE`,{method:s}),onClick:n,className:D(`bg-gray-a3 hover:bg-gray-a4 focus-visible:ring-gray-a8 mx-auto flex max-w-full cursor-pointer items-center gap-2 rounded-full px-3 py-2 transition-colors focus-visible:ring-2 focus-visible:outline-none`,z(`PaymentCompactBalance`,`The selected balance on a compact direct checkout`)),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-gray-11 flex shrink-0`,children:c?(0,Q.jsx)(`img`,{src:c,alt:``,className:D(`size-[19px] shrink-0 object-cover`,l?`rounded-full`:`rounded-[5px]`)}):t?(0,Q.jsx)(Vo,{entry:t,square:!0}):(0,Q.jsx)(x,{})}),(0,Q.jsx)(`span`,{className:`text-2 text-gray-12 min-w-0 truncate font-medium`,children:s}),o&&(0,Q.jsx)(`span`,{className:`text-1 text-gray-a10 shrink-0`,children:Ee(o,a)}),(0,Q.jsx)(v,{"aria-hidden":`true`,className:`text-gray-a11 size-4 shrink-0`})]})}function ld({method:e,choose:t,separated:n}){let{state:r}=P(),i=r.selectedSavedId===e.id,a=ad(e);return(0,Q.jsx)(`div`,{className:D(`group flex flex-col`,n?`overflow-hidden ${ed} ${z(`PaymentMethodSeparated`,`Added to a method item while it renders as its own separated card`)} ${z(`PaymentSavedMethodSeparated`,`The separated marker on a saved method specifically`)}`:`border-stroke border-t`,z(`PaymentMethod`,`One payment method — the row plus its expanding detail region`),z(`PaymentSavedMethod`,`One saved payment method specifically — carries PaymentMethod too`)),children:(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,onClick:()=>t(e),className:D($u,z(`PaymentMethodRow`,`The clickable payment method row`),z(`PaymentSavedMethodRow`,`The clickable saved method row specifically — carries PaymentMethodRow too`),i&&`${z(`PaymentMethodRowSelected`,`Selected payment method row`)} ${z(`PaymentSavedMethodRowSelected`,`Selected saved payment method row`)}`),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`before:bg-gray-1 relative mr-4 flex size-[18px] shrink-0 items-center justify-center rounded-full border transition-[background-color,border-color] duration-300 ease-out before:block before:size-[5px] before:rounded-full before:transition-transform before:duration-300 before:ease-[cubic-bezier(0.34,1.56,0.64,1)]`,z(`PaymentMethodRadio`,`The radio indicator on a method row`),i?`border-gray-12 bg-gray-12 before:scale-100 ${z(`PaymentMethodRadioSelected`,`Selected payment method radio`)}`:`border-gray-a9 group-hover:border-gray-a10 bg-transparent before:scale-0`)}),(0,Q.jsx)(`span`,{className:D(`mr-2 flex`,z(`PaymentMethodIcon`,`The method icon on a row`),i?`text-gray-12`:`text-gray-11 group-hover:text-gray-12`),children:(0,Q.jsx)(od,{method:e})}),(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-12 antialiased`,z(`PaymentMethodLabel`,`The method display name on a row`),i&&`font-semibold`),children:a.label}),a.hint&&(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-a10 ml-auto`,z(`PaymentSavedMethodHint`,`The saved method's trailing detail — a card's expiration`)),children:a.hint})]})})})}function ud({entry:e,active:t,onInteract:n,onActiveComplete:r}){let i=_(),{props:a,state:o,setState:s}=P(),c=(0,Z.useContext)(Ju),l=c?.balances??[],u=o.selectedBalanceId?l.find(e=>e.id===o.selectedBalanceId&&e.spendable):void 0,d=(a.fields.billingDetails??`minimal`)!==`never`,f=d&&!a.addressElementLive,p=Hu(e,a.fields.billingDetails),m=d&&(e.collect_billing_phone_number===!0&&a.fields.phone!==`never`||f&&(p===`full`||Bu(e).length>0)),[h,g]=(0,Z.useState)(!1),v=(0,Z.useRef)(void 0),y=(0,Z.useCallback)((e,t=`input`)=>{t===`input`&&v.current!==void 0&&v.current!==e&&n(),v.current=e,g(e)},[n]),b=u!==void 0&&(!m||h),x=(0,Z.useRef)(r);x.current=r,(0,Z.useEffect)(()=>{t&&x.current(b)},[t,b]);let S=c?.amount??a.amount;return(0,Z.useEffect)(()=>{!t||u||s({selectedBalanceId:qu(l,a.currency,S)?.id})},[t,u,qu(l,a.currency,S)?.id,s]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":i(`FVYhKc`),className:D(`border-stroke max-h-56 overflow-y-auto rounded-lg border`,z(`PaymentBalanceList`,`The balance tile's scrollable list of the buyer's wallets`)),children:[l.map(t=>(0,Q.jsx)(dd,{balance:t,entry:e,active:o.selectedBalanceId===t.id,choose:()=>{n(),s({selectedBalanceId:t.id})}},t.id)),c?.hasNextPage&&(0,Q.jsx)(mt,{onScrollIntoView:c.fetchNextPage,isFetchingNextPage:c.isFetchingNextPage,threshold:.9,children:(0,Q.jsx)(`div`,{role:`status`,"aria-label":i(`iFsDVR`),className:D(`border-stroke flex items-center justify-center border-t py-3`,z(`PaymentBalanceMore`,`The sentinel row that pages in more balances as it scrolls into view`)),children:(0,Q.jsx)(`span`,{className:`border-gray-a5 border-t-gray-11 size-3 animate-spin rounded-full border-2`})})})]}),m&&(0,Q.jsx)(nd,{entry:e,active:t,addressElementLive:a.addressElementLive,onCompleteChange:y})]})}function dd({balance:e,entry:t,active:n,choose:r}){let{props:i}=P(),a=g(),o=_(),s=e.balances.find(e=>e.currency===i.currency.toLowerCase()),c=!e.spendable,l=e.owner?.image_url,u=!!e.owner?.id.startsWith(`user_`);return(0,Q.jsx)(`div`,{className:D(`group border-stroke flex flex-col [&:not(:first-child)]:border-t`,z(`PaymentBalance`,`One wallet in the balance tile`)),children:(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-disabled":c||void 0,disabled:c,onClick:c?void 0:r,className:D($u,z(`PaymentBalanceRow`,`The clickable balance row`),n&&z(`PaymentBalanceRowSelected`,`Selected balance row`),c&&`cursor-default opacity-45 ${z(`PaymentBalanceRowUnavailable`,`A wallet that cannot pay right now — blocked or empty — greyed and disabled`)}`),children:(0,Q.jsxs)(`span`,{className:`relative z-[1] flex w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:D(`before:bg-gray-1 relative mr-4 flex size-[18px] shrink-0 items-center justify-center rounded-full border transition-[background-color,border-color] duration-300 ease-out before:block before:size-[5px] before:rounded-full before:transition-transform before:duration-300 before:ease-[cubic-bezier(0.34,1.56,0.64,1)]`,z(`PaymentMethodRadio`,`The radio indicator on a method row`),n?`border-gray-12 bg-gray-12 before:scale-100 ${z(`PaymentMethodRadioSelected`,`Selected payment method radio`)}`:`border-gray-a9 group-hover:border-gray-a10 bg-transparent before:scale-0`)}),(0,Q.jsx)(`span`,{className:D(`mr-2 flex`,z(`PaymentMethodIcon`,`The method icon on a row`),n?`text-gray-12`:`text-gray-11 group-hover:text-gray-12`),children:l?(0,Q.jsx)(`img`,{src:l,alt:``,className:D(`size-[19px] shrink-0 object-cover`,u?`rounded-f
12ull`:`rounded-[5px]`)}):(0,Q.jsx)(Vo,{entry:t,square:!0})}),(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-12 antialiased`,z(`PaymentMethodLabel`,`The method display name on a row`),n&&`font-semibold`),children:e.owner?.title??o(`+aYIp0`)}),s&&(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-a10 ml-auto`,z(`PaymentBalanceHint`,`The wallet's available amount in the charge currency`)),children:Ee(s,a)})]})})})}function fd({entry:e,choose:t}){let{state:n}=P(),r=n.selectedType===e.type&&!n.selectedSavedId;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,onClick:()=>t(e),className:D(`bg-panel-solid flex min-w-0 flex-1 cursor-pointer flex-col items-start gap-1.5 rounded-lg border px-3 py-2.5 text-left transition-[border-color,box-shadow] outline-none focus-visible:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,z(`PaymentMethodTile`,`One method tile in the horizontal tile row`),r?`border-gray-12 shadow-[inset_0_0_0_1px_var(--gray-12)] ${z(`PaymentMethodTileSelected`,`Selected payment method tile`)}`:`border-gray-a6 hover:border-gray-a8`),children:[(0,Q.jsx)(`span`,{className:D(`flex`,r?`text-gray-12`:`text-gray-11`),children:(0,Q.jsx)(Vo,{entry:e})}),(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-12 w-full truncate antialiased`,r?`font-semibold`:`font-medium`),children:e.display_name})]})}function pd({overflow:e,choose:t}){let n=_();return(0,Q.jsxs)(`div`,{className:D(`bg-panel-solid border-gray-a6 hover:border-gray-a8 relative flex w-14 shrink-0 flex-col items-center justify-center gap-1.5 rounded-lg border px-2 py-2.5 transition-[border-color,box-shadow] focus-within:shadow-[0_0_0_1px_var(--accent-a8),0_0_0_4px_var(--accent-a5)]`,z(`PaymentMethodMoreTile`,`Overflow tile with method icons and a native selector`)),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex flex-col -space-y-2.5`,children:e.slice(0,2).map(e=>(0,Q.jsx)(`span`,{className:`text-gray-11 bg-panel-solid flex rounded-md shadow-[0_0_0_2px_var(--panel-solid)]`,children:(0,Q.jsx)(Vo,{entry:e})},e.type))}),(0,Q.jsx)(`svg`,{"aria-hidden":`true`,className:`text-gray-11`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,children:(0,Q.jsx)(`path`,{d:`M3 4.5L6 7.5L9 4.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,Q.jsxs)(`select`,{"aria-label":n(`CPyrSe`),value:``,onChange:n=>{let r=e.find(e=>e.type===n.target.value);r&&t(r)},className:D(`absolute inset-0 size-full cursor-pointer opacity-0`,z(`PaymentMethodMoreSelect`,`The invisible native select stretched over the More tile`)),children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,hidden:!0,children:n(`CPyrSe`)}),e.map(e=>(0,Q.jsx)(`option`,{value:e.type,children:e.display_name},e.type))]})]})}function md({entry:e,installmentTiers:t,active:n,onInteract:r,onActiveComplete:i}){let a=_(),{props:o}=P(),[s,c]=(0,Z.useState)({}),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(``),[x,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),O=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)({}),[j,M]=(0,Z.useState)({}),[ee,F]=(0,Z.useState)(n&&e.category===`card`),I=Oo(e),L=wo(e),R=(o.fields.billingDetails??`minimal`)!==`never`,B=R&&!o.addressElementLive,V=(e.required_fields??[]).filter(t=>!(t.kind===`billing_details`&&(zu.has(t.name)||t.name===`phone`&&e.collect_billing_phone_number===!0))),H=V.some(e=>e.secure),te=Hu(e,o.fields.billingDetails),U=R&&I!==`wallet_sheet`&&(e.collect_billing_phone_number===!0&&o.fields.phone!==`never`||B&&(te===`full`||Bu(e).length>0)),[W,ne]=(0,Z.useState)(!1),G=(0,Z.useRef)(void 0),K=(0,Z.useCallback)((e,t=`input`)=>{t===`input`&&G.current!==void 0&&G.current!==e&&r(),G.current=e,ne(e)},[r]),re=(e.payer_document_requirements??[]).find(e=>e.currency===o.currency.toLowerCase())??null,ie=re!==null,q=e.category===`card`||H||ie,{bt:ae}=ds(n&&q?Eo(e):void 0);(0,Z.useEffect)(()=>{n||(A.current={},k.current=null,M({}),C(!1))},[n]),(0,Z.useEffect)(()=>{n&&e.category===`card`&&F(!0)},[n,e.category]);let oe=t.filter(t=>t.required_parent_payment_method===e.type),se=e.category===`card`?oe:[],ce=oe.length>
120&&e.category!==`card`,le={funding:d,issuingCountry:p,complete:l},J=vu(se,h,o.currency,le),ue=JSON.stringify([se.map(e=>e.type),o.currency,le]),de=J.status===`selected`?hu(J.tier,o.currency,p):void 0;(0,Z.useEffect)(()=>{e.category===`card`&&h&&J.status!==`selected`&&g(null)},[e.category,h,ue]),(0,Z.useEffect)(()=>{ie||(y(``),C(!1),T(!1))},[ie]);let fe=async()=>{if(!ie)return{};let e=k.current;if(!v||!x||!e)throw T(!0),Error(a(`ZFUuoW`));return{payer_document:{type:v,token:await e()}}},pe=(!q||ae!==void 0)&&(!ce||h!==null)&&(e.category!==`card`||l)&&V.every(e=>e.secure?ku(j[e.name]):vd(e,(s[e.name]??``).trim()))&&(!U||W)&&(!ie||v!==``&&x),me=(0,Z.useRef)(i);me.current=i,(0,Z.useEffect)(()=>{n&&me.current(pe)},[n,pe]),N(td,`beforeTokenize`,async({billingDetails:t})=>{if(e.collect_billing_phone_number===!0&&!t.phone?.trim())throw new Pe(`billing_details_incomplete`,a(`OPvjVt`));let n={},r={},i={};for(let e of V){if(e.secure){let t=j[e.name],n=A.current[e.name]?.current;if(!t||t.empty)throw Error(`The ${e.name} field is required`);if(!ku(t)||!n)throw Error(`The ${e.name} field is not valid`);i[e.name]=n;continue}let a=(s[e.name]??``).trim();if(!a)throw Error(`The ${e.name} field is required`);let o=gd(e,t.address?.country);if(o&&!_d(o,a))throw Error(`The ${e.name} field is not valid`);e.kind===`billing_details`?r[e.name]=a:n[e.name]=a}if(e.category===`card`){if(Ks(t),J.status===`ineligible`)throw Error(a(`Vfdbjv`));if(J.status===`selected`){let e=hu(J.tier,o.currency,p),n=t.address?.country;if(e&&(!n||!e.some(e=>e.toLowerCase()===n.toLowerCase())))throw Error(a(`VWrsMW`))}}let c=J.status===`selected`?J.tier:e,l=t.address?.country,u=Uu(c,o);if(l&&!Io(c,o.currency,u,l))throw Error(a(`CA2h/J`,{method:c.display_name}));let d=await fe();if(e.category===`card`){let e=O.current;if(!e)throw new Pe(`card_fields_not_ready`,a(`/+aVgh`));let{token:t}=await e({accountId:o.accountId});return{slice:{card:{token:t,...n},...d},billingExtra:r,type:J.status===`selected`?J.tier.type:void 0}}if(H){let t=await ta(ae,i);return{slice:{[e.category]:{token:t,...n},...d},billingExtra:r,type:ce?h??void 0:void 0}}if(ce&&h===null)throw Error(a(`R2dhQh`));return{slice:{[e.category]:n,...d},billingExtra:r,type:ce?h??void 0:void 0}},n&&I!==`wallet_sheet`);let Y=e.detail?.short_name??e.display_name,he=I===`bnpl_confirm`?a(`426Ljd`,{name:Y}):I===`bank_connect`?a(`gcsY9P`):I===`bank_wire`?a(`uxbcNI`):I===`wallet_sheet`?a(`t/2YL5`):a(`SQ8moM`,{name:Y});return(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-3`,z(`PaymentDetailRegion`,`The expanded detail region for a selected method — collection surfaces first (inline card fields, declared inputs), then the explainer and disclosure lines as the bottom block`)),children:[ee&&e.category===`card`&&e.card?.public_key&&(0,Q.jsx)(`div`,{className:z(`PaymentCardFields`,`The inline card fields panel`),children:(0,Q.jsx)(Ys,{publicKey:e.card.public_key,networks:e.card.networks??void 0,fallback:(0,Q.jsx)(ac,{layout:`stacked`,label:!0}),onChange:e=>{r(),u(e.complete),f(e.funding),m(e.issuingCountry)},children:(0,Q.jsx)(hd,{connect:e=>{O.current=e}})})}),oe.length>0&&(0,Q.jsx)(yu,{tiers:e.category===`card`?se:oe,card:e.category===`card`?le:void 0,currency:o.currency,totalMinor:Uu(e,o)??o.amount,selectedType:h,onSelect:e=>{r(),g(e)}}),V.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:V.map(t=>{let i=`${e.type}-${t.name}`;if(t.secure)return(0,Q.jsx)(Au,{bt:n?ae:void 0,field:t,inputId:i,label:bd(t.name),connect:e=>{A.current[t.name]=e},onInteract:r,onStateChange:e=>M(n=>({...n,[t.name]:e}))},t.name);let o=s[t.name]??``,l=o.trim(),u=l.length>0&&!vd(t,l);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`PaymentFieldLabel`,`Declared payment field label`)),htmlFor:i,children:bd(t.name)}),(0,Q.jsx)(`input`,{id:i,type:`text`,value:o,placeholder:t.placeholder??void 0,onChange:e=>{r(),c({...s,[t.name]:e.target.value})},className:D(`text-2 text-gray-12 placeholder:text-gray-a8 focus:border-accent-a8 box-border h-11 w-full rounded-lg border bg-transparent px-3 [color-scheme:normal] transition-[box-shadow,border-color] outline-none focus:shadow-[0_0_0_3px_var(--accent-a5)]`,z(`PaymentFieldInput`,`A declared method input in the detail region`),u?`border-danger-9 ${z(`PaymentFieldInputInvalid`,`Added to a declared input while its value fails the declared format`)}`:`border-stroke`)}),u&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`PaymentFieldError`,`The Invalid message under a declared input`)),children:a(`89T/ze`)})]},t.name)}
12)}),U&&(0,Q.jsx)(nd,{entry:e,active:n,addressElementLive:o.addressElementLive,installmentCountries:de,onCompleteChange:K}),re&&Eo(e)&&(0,Q.jsx)(Ou,{bt:n?ae:void 0,documentType:v,documentTypes:re.document_types,showError:w,onDocumentTypeChange:e=>{r(),y(e),T(!1)},onNumberValidChange:e=>{C(e),e&&T(!1)},connect:e=>{k.current=e}}),I===`wallet_sheet`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 rounded-lg pt-1 pb-2.5`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 pl-2`,children:[(0,Q.jsx)(`span`,{className:D(`text-gray-a10 shrink-0 [&>svg]:size-5`,z(`PaymentDetailIcon`,`The template icon beside the detail region's explainer`)),children:(0,Q.jsx)(S,{})}),(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-11`,z(`PaymentDetailText`,`The detail region's explainer line`)),children:he})]})}),(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10 pb-1 pl-11`,z(`PaymentDetailSubtext`,`The consent subtext under the explainer on wallet methods`)),children:a(`NDQBK6`,{method:Y})})]}):I===`none`?null:(0,Q.jsxs)(`div`,{className:`flex items-center gap-4 pl-2`,children:[(0,Q.jsx)(`span`,{className:D(`text-gray-a10 shrink-0 [&>svg]:size-5`,z(`PaymentDetailIcon`,`The template icon beside the detail region's explainer`)),children:I===`bank_connect`||I===`bank_wire`?(0,Q.jsx)(b,{}):e.detail?.icon===`installments`?(0,Q.jsx)(E,{}):(0,Q.jsx)(xd,{})}),(0,Q.jsx)(`span`,{className:D(`text-1 text-gray-11`,z(`PaymentDetailText`,`The detail region's explainer line`)),children:he})]}),L.mandate&&(0,Q.jsxs)(`p`,{className:D(`text-1 text-gray-a10 pl-2`,z(`PaymentMandateNotice`,`The mandate authorization notice on methods whose matrix configuration declares a mandate`)),children:[a(`NqY8nK`,{name:Y}),L.mandate.url&&(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`a`,{href:L.mandate.url,target:`_blank`,rel:`noreferrer`,className:D(`text-gray-11 hover:text-gray-12 underline underline-offset-2`,z(`PaymentMandateLink`,`The mandate terms link inside the mandate notice`)),children:a(`MeXD9E`)})]})]}),L.settlement_window&&(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10 pl-2`,z(`PaymentSettlementNotice`,`The settlement-window hint on methods whose matrix configuration declares one`)),children:a(`H0QwqR`,{window:L.settlement_window})})]})}function hd({connect:e}){let t=_(),n=V(Ys);return(0,Z.useEffect)(()=>{e(e=>n.tokenize(e))},[n,e]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:D(`text-2 text-gray-11 font-medium`,z(`CardLabel`,`Card information label`)),children:t(`rhzKXd`)}),(0,Q.jsxs)(`div`,{className:D(`shadow-black-a1 flex flex-col rounded-lg shadow-xs`,z(`CardFieldGroup`,`The grouped card fields — number on top, expiration and security code below`)),children:[(0,Q.jsx)(Ls,{}),(0,Q.jsxs)(`div`,{className:`-mt-px flex w-full`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(As,{})}),(0,Q.jsx)(`div`,{className:`-ml-px min-w-0 flex-1`,children:(0,Q.jsx)(ks,{})})]})]})]})}function gd(e,t){let n=e.formats;if(n)return(t?n[t.toLowerCase()]:void 0)??n[`*`]}function _d(e,t){try{return new RegExp(e).test(t)}catch{return!0}}function vd(e,t){let n=t.trim();if(!n)return!1;let r=Object.values(e.formats??{});return r.length===0||r.some(e=>_d(e,n))}function yd(e,t){let n=t.indexOf(e);return n===-1?t.length:n}function bd(e){let t=e.replace(/_/g,` `).replace(/\bid\b/gi,`ID`);return t.charAt(0).toUpperCase()+t.slice(1)}function xd(){return(0,Q.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,Q.jsx)(`path`,{d:`M13.75 0C17.2018 1.61069e-08 20 2.79822 20 6.25V10.25C20 10.6642 19.6642 11 19.25 11C18.8358 11 18.5 10.6642 18.5 10.25V6.25C18.5 3.62665 16.3734 1.5 13.75 1.5H6.25C3.62665 1.5 1.5 3.62665 1.5 6.25V13.75C1.5 16.3734 3.62665 18.5 6.25 18.5H7.25C7.66421 18.5 8 18.8358 8 19.25C8 19.6642 7.66421 20 7.25 20H6.25C2.79822 20 1.61064e-07 17.2018 0 13.75V6.25C0 2.79822 2.79822 1.61064e-08 6.25 0H13.75Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{d:`M5 4C5.55228 4 6 4.44772 6 5C6 5.55228 5.55228 6 5 6C4.44772 6 4 5.55228 4 5C4 4.44772 4.44772 4 5 4ZM8 4C8.55228 4 9 4.44772 9 5C9 5.55228 8.55228 6 8 6C7.44772 6 7 5.55228 7 5C7 4.44772 7.44772 4 8 4ZM11 4C11.5523 4 12 4.44772 12 5C12 5.55228 11.5523 6 11 6C10.4477 6 10 5.55228 10 5C10 4.44772 10.4477 4 11 4Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{d:`M15.2002 12.2393C15.482 11.936 15.9573 11.9185 16.2607 12.2002L19.7607 15.4502C19.9134 15.592 19.9999 15.7916 20 16C20 16.2084 19.9134 16.4079 19.7607 16.5498L16.2607 19.7998C15.9572 20.0816 15.4821 20.0642 15.2002 19.7607C14.9185 19.4572 14.9359 18.982 15.2393 18.7002L17.3398 16.75H10.75C10.3358 16.75 10 16.4142 10 16C10.0001 15.5859 10.3359 15.25 10.75 15.25H17.3398L15.2393 13.2998C14.936 13.0179 14.9184 12.5427 15.2002 12.2393Z`,fill:`currentColor`})]})}function Sd({inputId:e,code:t,locked:n,submitting:r,failure:i,onCode:a}){let o=_();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{id:e,autoFocus:!0,maxLength:6,value:t,disabled:n,onChange:a,c
12ontainerClassName:D(`group mx-auto flex w-fit max-w-full items-center justify-center transition-opacity`,n&&`opacity-30`,z(`VerificationInput`,`The one-time-code input`),i&&z(`VerificationInputInvalid`,`Added to the code input after a failed attempt`)),render:({slots:e})=>(0,Q.jsx)(`div`,{className:`flex justify-center gap-2`,children:e.map((e,t)=>(0,Q.jsx)(`div`,{className:D(`bg-gray-3 relative flex aspect-4/5 w-12 shrink-0 items-center justify-center rounded-xl border-2 font-['Acid_Grotesk'] text-[2rem] transition-all duration-200`,e.isActive?D(`border-accent-9`,z(`VerificationInputSlotActive`,`Added to the code slot the buyer is typing into`)):i?`border-danger-9`:`border-transparent`,z(`VerificationInputSlot`,`One digit box of the one-time-code input`)),children:(0,Q.jsx)(`div`,{className:`group-has-[input[data-input-otp-placeholder-shown]]:opacity-20`,children:e.char??e.placeholderChar})},`code-slot-${t+1}`))})}),r&&(0,Q.jsx)(`p`,{className:D(`text-1 text-gray-a10 text-center`,z(`VerificationPending`,`The verifying… line while a submit is in flight`)),children:o(`9UZKR3`)}),i&&!r&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`VerificationError`,`The failure message in the dialog`)),children:i})]})}var Cd=`#FA4616`;function wd({className:e,markFill:t=Cd}){return(0,Q.jsxs)(`svg`,{className:e,fill:`none`,height:`26`,viewBox:`0 0 119 26`,width:`119`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,Q.jsx)(`path`,{d:`M6.29654 0.0205078C3.70387 0.0205078 1.92397 1.15863 0.565903 2.45194C0.565903 2.45194 0.0206171 2.96927 0.0309055 2.98996L5.71011 8.70125L11.3893 2.98996C10.309 1.50006 8.28221 0.0205078 6.29654 0.0205078Z`,fill:t}),(0,Q.jsx)(`path`,{d:`M20.3194 0.0205078C17.7267 0.0205078 15.9468 1.16897 14.5888 2.45194C14.5888 2.45194 14.0949 2.95892 14.0641 2.98996L7.04736 10.0463L12.7163 15.7472L25.4019 2.98996C24.3216 1.50006 22.2948 0.0205078 20.3194 0.0205078Z`,fill:t}),(0,Q.jsx)(`path`,{d:`M34.3738 0.0205078C31.7811 0.0205078 30.0012 1.16897 28.6431 2.45194C28.6431 2.45194 28.1287 2.95893 28.1081 2.98997L14.0645 17.1026L15.546 18.5925C17.8403 20.8998 21.6059 20.8998 23.9105 18.5925L39.4357 2.98997C38.3657 1.50006 36.3594 0.0205078 34.3738 0.0205078Z`,fill:t}),(0,Q.jsx)(`path`,{d:`M49.8827 20.3443L45.5576 2.99365H49.4193L52.3233 15.0096H52.3748L56.5557 2.99365H59.8716L64.0525 15.0096H64.104L67.0286 2.99365H70.8696L66.5446 20.3443H62.6108L58.2342 8.74266H58.1827L53.7856 20.3443H49.8827Z`,fill:`currentcolor`}),(0,Q.jsx)(`path`,{d:`M72.0435 2.99365H75.6786V8.74266H75.7301C76.0493 8.15222 76.6878 7.67572 77.4292 7.35461C78.1192 7.05421 79.1181 6.86776 80.0037 6.86776C80.982 6.86776 82.3207 7.11636 83.2784 7.61357C84.2464 8.14186 84.9775 8.84624 85.4615 9.73708C85.9867 10.659 86.2441 11.6948 86.2441 12.855V20.3443H82.609V13.3419C82.609 12.3164 82.3104 11.5291 81.7028 10.9697C81.0952 10.4104 80.2714 10.1307 79.221 10.1307C78.1707 10.1307 77.3365 10.4311 76.6672 11.0215C76.0081 11.612 75.6889 12.3889 75.6889 13.3419V20.3443H72.0538V2.99365H72.0435Z`,fill:`currentcolor`}),(0,Q.jsx)(`path`,{d:`M87.521 13.7976C87.521 12.7617 87.7166 11.8087 88.108 10.949C88.4993 10.0892 89.0348 9.36409 89.7144 8.76329C90.3941 8.1625 91.1767 7.69636 92.0623 7.36489C92.9479 7.03341 93.885 6.86768 94.8633 6.86768C95.8416 6.86768 96.8302 7.03341 97.7261 7.37525C98.622 7.71708 99.3944 8.18321 100.064 8.78401C100.723 9.38481 101.248 10.1099 101.639 10.9593C102.02 11.8087 102.216 12.7513 102.216 13.7872C102.216 14.8231 102.02 15.7968 101.629 16.6462C101.238 17.4956 100.702 18.2207 100.033 18.8215C99.3635 19.4223 98.5808 19.8884 97.6849 20.2199C96.789 20.5513 95.8519 20.7171 94.8736 20.7171C93.8953 20.7171 92.9273 20.5513 92.0314 20.2095C91.1355 19.8677 90.3632 19.4015 89.6938 18.7904C89.0348 18.1792 88.4993 17.4541 88.108 16.6047C87.7166 15.745 87.521 14.8127 87.521 13.7976ZM98.5808 13.7976C98.5808 12.6788 98.241 11.7776 97.5614 11.1043C96.8817 10.431 95.9858 10.0892 94.8736 10.0892C94.3278 10.0892 93.8336 10.1824 93.3702 10.3585C92.9067 10.545 92.5154 10.7936 92.1859 11.1147C91.8564 11.4358 91.6092 11.8294 91.4239 12.2852C91.2385 12.7513 91.1561 13.2486 91.1561 13.7976C91.1561 14.3466 91.2488 14.8438 91.4239 15.2996C91.6092 15.7553 91.8667 16.149 92.1962 16.4701C92.536 16.8015 92.9273 17.0501 93.3804 17.2366C93.8336 17.4231 94.3278 17.50
1259 94.8736 17.5059C95.4194 17.5059 95.9137 17.4127 96.3771 17.2366C96.8405 17.0501 97.2318 16.8015 97.5614 16.4804C97.8909 16.1593 98.1483 15.7657 98.3234 15.3099C98.4985 14.8438 98.5808 14.3362 98.5808 13.7976Z`,fill:`currentcolor`}),(0,Q.jsx)(`path`,{d:`M103.544 6.85742H107.035V8.74268H107.087C107.313 8.24547 108.271 7.41679 109.033 7.19926C109.785 6.98173 110.547 6.86778 111.319 6.86778C112.298 6.86778 113.204 7.05423 114.028 7.41679C114.851 7.77934 115.552 8.27655 116.159 8.89806C116.757 9.52993 117.22 10.255 117.56 11.0941C117.9 11.9331 118.064 12.8343 118.064 13.7873C118.064 14.7403 117.9 15.6933 117.56 16.5323C117.22 17.3714 116.757 18.1068 116.159 18.718C115.562 19.3395 114.851 19.8264 114.017 20.1785C113.193 20.5307 112.287 20.7068 111.33 20.7068C111.021 20.7068 110.671 20.6758 110.289 20.624C109.898 20.5618 109.527 20.4789 109.157 20.365C108.786 20.2511 108.436 20.106 108.096 19.9299C107.756 19.7538 107.478 19.557 107.252 19.3188H107.2V25.8965H103.565L103.544 6.85742ZM114.409 13.7977C114.409 12.6789 114.069 11.7777 113.399 11.1148C112.73 10.4518 111.834 10.11 110.722 10.11C110.331 10.11 109.919 10.1722 109.507 10.3068C109.085 10.4415 108.704 10.6279 108.364 10.8765C108.024 11.1252 107.736 11.4256 107.519 11.7674C107.303 12.1092 107.19 12.5132 107.19 12.9586V14.616C107.19 15.1961 107.355 15.6933 107.694 16.1283C108.024 16.553 108.456 16.8845 108.961 17.1124C109.486 17.3714 110.084 17.506 110.753 17.506C111.855 17.506 112.74 17.1642 113.41 16.4805C114.069 15.7969 114.409 14.8957 114.409 13.7977Z`,fill:`currentcolor`})]})}var Td=B(`phone-verification`).doc("Dialog opened by the payments controller for a checkout's `verify_phone` step. It collects the buyer's phone number, sends a confirmation code, and verifies it with the buyer's signed-in credential. It closes after verification succeeds. Accounts requiring a verified phone block the sale until this two-pane flow succeeds. Consumers never mount it directly.").internal().state({sessionToken:void 0,phase:`number`,phoneNumber:``,sending:!1,submitting:!1,error:void 0,codeSentAt:void 0}).auth({embed:({state:e})=>{"use embed";return F(e.sessionToken)}}).events(e=>({verified:e.internal().doc(`Coordination only — the ceremony landed: the account now carries a verified number.`),sessionRequested:e.internal().doc("Coordination only — emitted once at mount: the dialog asks the controller to deliver the buyer session it already holds (the late-mount leg of `adoptSession`).")})).actions(e=>({adoptSession:e.controllerOnly(async(e,t)=>{"use embed";return e.setState({sessionToken:t.token}),{}}).doc(`The controller's session delivery over the same-origin bus: hold the buyer's session token (present only on an embedded sign-in — direct mode authenticates with the scoped cookie), or drop it when the input carries none.`),sendCode:e.controllerOnly(async(e,t)=>{"use embed";if(e.state.sending||e.state.submitting)return{status:`in_flight`};e.setState({sending:!0,error:void 0});try{let n=await Ed(e.sdk,`/sessions/current/send_phone_code`,{phone_number:t.phoneNumber});return n.status===`code_sent`?(e.setState({sending:!1,phase:`code`,phoneNumber:t.phoneNumber,codeSentAt:Date.now(),error:void 0}),{status:n.status}):(e.setState({sending:!1,error:{code:n.error?.code??`send_failed`}}),{status:`failed`})}catch{return e.setState({sending:!1,error:{code:`send_failed`}}),{status:`error`}}}).doc(`Text a confirmation code to the number — in-frame only (the number pane submits it, and the resend control re-sends to the held number). Refusals come back coded on the pane, never as raw API prose.`),verifyCode:e.controllerOnly(async(e,t)=>{"use embed";if(e.state.submitting||e.state.sending)return{status:`in_flight`};e.setState({submitting:!0});try{let n=await Ed(e.sdk,`/sessions/current/verify_phone_code`,{phone_number:e.state.phoneNumber,code:t.code});return n.status===`verified`?(e.setState({submitting:!1,phase:`verified`,error:void 0}),e.emit(`verified`,{}),{status:n.status}):(e.setState({submitting:!1,error:{code:n.error?.code??`verify_failed`}}),{status:`failed`})}catch{return e.setState({submitting:!1,error:{code:`verify_failed`}}),{status:`error`}}}).doc(`Verify the entered code against the held number — in-frame only (the code pane auto-submits).`)})).modal(e=>{"use embed";return{header:(0,Q.jsx)(kd,{}),footer:(0,Q.jsx)(Ad,{close:e.close})}},{maxWidth:448}).loading(()=>{"use loading";return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Q.jsx)(`div`,{style:{height:16,width:220,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}}),(0,Q.jsx)(`div`,{style:{height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]})}).demo(e=>e.props(()=>({}))).render(e=>{"use embed";let t=_(),{state:n,actions:r,emit:i}=e,a=(0,Z.useId)(),[o,c]=(0,Z.useState)(n.phoneNumber),[l,u]=(0,Z.useState)(``),f=Od(n.error);(0,Z.useEffect)(()=>{i(`sessionRequested`,{})},[]);let p=n.phase;if((0,Z.useEffect)(()=>{p===`code`&&u(``)},[p]),p===`verified`)return(0,Q.jsx)(`div`,{className:D(`flex flex-col items-center gap-2 py-4 text-center`,z(`PhoneVerificationDone`,`Success pane shown before closing`)),children:(0,Q.jsx)(s,{size:`3`,weight:`semi-bold`,children:t(`b2953w`)})});if(p===`code`){let e=n.submitting||n.sending;return(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-6`,z(`PhoneVerificationCode`,`Six-digit confirmation-code pane`)),"data-whop-autofill":``,children:[(0,Q.jsx)(Li,{}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Q.jsx)(s,{size:`4`,weight:`semi-bold`,children:t(`rCbVIL`)}),(0,Q.jsx)(s,{className:`text-gray-a11 text-balance`,render:(0,Q.jsx)(`label`,{htmlFor:a}),children:t(`0Xal+p`,{number:n.phoneNumber})})]}),(0,Q.jsx)(Sd,{inputId:a,code:l,locked:e,submitting:n.submitting,failure:f,onCode:e=>{let t=e.replace(/\D/g,``).slice(0,6);u(t),t.length===6&&!n.submitting&&!n.sending&&r.verifyCode({code:t})}})]})}let m=()=>{let e=o.trim();e===``||n.sending||r.sendCode({phoneNumber:e})};return(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-5`,z(`PhoneVerificationNumber`,`Phone-number entry pane`)),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Q.jsx)(s,{size:`4`,weight:`semi-bold`,children:t(`QofabW`)}),(0,Q.jsx)(s,{className:`text-gray-a11 text-balance`,render:(0,Q.jsx)(`label`,{htmlFor:a}),children:t(`eHUkJ6`)})]}),(0,Q.jsx)(`input`,{id:a,type:`tel`,autoComplete:`tel`,autoFocus:!0,value:o,disabled:n.sending,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m()},placeholder:`+1 903 555 0145`,className:D(`text-2 h-11 rounded-lg border border-[var(--gray-a6)] bg-transparent px-3 outline-none focus:border-[var(--accent-8)]`,z(`PhoneVerificationInput`,`Phone-number input`))}),f&&(0,Q.jsx)(s,{render:(0,Q.jsx)(`p`,{}),size:`1`,className:D(`text-danger-9`,z(`PhoneVerificationError`,`Number-pane failure message`)),children:f}),(0,Q.jsx)(d,{type:`button`,size:`3`,variant:`solid`,color:`gray`,highContrast:!0,disabled:n.sending||o.trim()===``,onClick:m,className:z(`PhoneVerificationSend`,`Send-code button`),children:n.sending?t(`ff2VGL`):t(`LvrXWM`)})]})});function Ed(e,t,n){return Promise.resolve(j(e).post(t,{body:n})).then(e=>e??{})}var Dd=15e3;function Od(e){let t=_();if(e)switch(e.code){case`invalid_number`:return t(`FzYV4A`);case`country_not_supported`:return t(`R1+Uxl`);case`number_in_use`:return t(`pU71Z8`);case`voip_not_supported`:return t(`UfWUAm`);case`sms_not_supported`:return t(`ggDf5m`);case`send_blocked`:return t(`S1Fpvj`);case`unsubscribed`:return t(`6aDo0C`);case`send_throttled`:return t(`qZQFqc`);case`rate_limited`:return t(`zBQA0/`);case`send_failed`:return t(`kEdwO/`);case`invalid_code`:return t(`P/9udd`);case`code_expired`:return t(`h6HW1i`);case`verify_failed`:return t(`xxtV2Z`);default:return t(`Vi2e24`)}}function kd(){return(0,Q.jsx)(wd,{className:D(`text-gray-12 h-[26px] w-auto`,z(`PhoneVerificationTitle`,`Dialog header wordmark`))})}function Ad({close:e}){let t=_(),{state:n,setState:r,actions:i}=P(),a=n.phase===`verified`;(0,Z.useEffect)(()=>{a&&e()},[a,e]);
12let o=n.codeSentAt===void 0?NaN:n.codeSentAt+Dd,[s,c]=(0,Z.useState)(()=>Date.now()),l=Number.isFinite(o)&&o>s;if((0,Z.useEffect)(()=>{if(!l)return;let e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[l]),n.phase!==`code`)return null;let u=l?Math.max(1,Math.ceil((o-s)/1e3)):0;return(0,Q.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-3`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:n.sending||n.submitting,onClick:()=>r({phase:`number`,error:void 0}),className:D(`text-1 text-gray-11 hover:text-gray-12 cursor-pointer border-0 bg-transparent p-0 underline underline-offset-2 disabled:cursor-default disabled:no-underline disabled:opacity-60`,z(`PhoneVerificationChangeNumber`,`Return-to-number control`)),children:t(`WCI6uY`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:l||n.sending||n.submitting,onClick:()=>void i.sendCode({phoneNumber:n.phoneNumber}),className:D(`text-1 text-gray-11 hover:text-gray-12 cursor-pointer border-0 bg-transparent p-0 underline underline-offset-2 disabled:cursor-default disabled:no-underline disabled:opacity-60`,z(`PhoneVerificationResend`,`Resend-code control with countdown`)),children:u>0?t(`XPklVO`,{seconds:String(u)}):t(`ZD48TW`)})]})}var jd={ad_nrt:{region:`AD`,placeholder:`A-123456-B`},ae_trn:{region:`AE`,placeholder:`123456789012345`},al_tin:{region:`AL`,placeholder:`J12345678N`},am_tin:{region:`AM`,placeholder:`12345678`},ao_tin:{region:`AO`,placeholder:`1234567890`},ar_cuit:{region:`AR`,placeholder:`20-12345678-9`},au_abn:{region:`AU`,placeholder:`12345678901`},au_arn:{region:`AU`,placeholder:`12345678901`},aw_tin:{region:`AW`,placeholder:`1234567`},az_tin:{region:`AZ`,placeholder:`1234567890`},ba_tin:{region:`BA`,placeholder:`1234567890123`},bb_tin:{region:`BB`,placeholder:`1234567890`},bd_bin:{region:`BD`,placeholder:`123456789`},bf_ifu:{region:`BF`,placeholder:`12345678901234`},bg_uic:{region:`BG`,placeholder:`123456789`},bh_vat:{region:`BH`,placeholder:`123456789012345`}
12,bj_ifu:{region:`BJ`,placeholder:`1234567890123`},bo_tin:{region:`BO`,placeholder:`1234567`},br_cnpj:{region:`BR`,placeholder:`12.345.678/0001-00`},br_cpf:{region:`BR`,placeholder:`123.456.789-00`},bs_tin:{region:`BS`,placeholder:`123456789`},by_tin:{region:`BY`,placeholder:`123456789`},ca_bn:{region:`CA`,placeholder:`123456789`},ca_gst_hst:{region:`CA`,placeholder:`123456789RT0001`},ca_pst_bc:{region:`CA`,placeholder:`PST-1234-5678`},ca_pst_mb:{region:`CA`,placeholder:`123456-7`},ca_pst_sk:{region:`CA`,placeholder:`1234567`},ca_qst:{region:`CA`,placeholder:`1234567890TQ1234`},cd_nif:{region:`CD`,placeholder:`A1234567B`},ch_uid:{region:`CH`,placeholder:`CHE-123.456.789`},ch_vat:{region:`CH`,placeholder:`CHE-123.456.789 MWST`},cl_tin:{region:`CL`,placeholder:`12.345.678-9`},cm_niu:{region:`CM`,placeholder:`M012345678901A`},cn_tin:{region:`CN`,placeholder:`123456789012345678`},co_nit:{region:`CO`,placeholder:`123.456.789-0`},cr_tin:{region:`CR`,placeholder:`1-234-567890`},cv_nif:{region:`CV`,placeholder:`123456789`},de_stn:{region:`DE`,placeholder:`12/345/67890`},do_rcn:{region:`DO`,placeholder:`123-4567890-1`},ec_ruc:{region:`EC`,placeholder:`1234567890001`},eg_tin:{region:`EG`,placeholder:`123456789`},es_cif:{region:`ES`,placeholder:`A12345678`},et_tin:{region:`ET`,placeholder:`1234567890`},eu_oss_vat:{region:`EU`,placeholder:`FR12345678901`},eu_vat:{region:`EU`,placeholder:`DE123456789`},gb_vat:{region:`GB`,placeholder:`GB123456789`},ge_vat:{region:`GE`,placeholder:`123456789`},gh_tin:{region:`GH`,placeholder:`C0001234567`},gn_nif:{region:`GN`,placeholder:`123456789`},hk_br:{region:`HK`,placeholder:`12345678`},hr_oib:{region:`HR`,placeholder:`12345678901`},hu_tin:{region:`HU`,placeholder:`12345678`},id_npwp:{region:`ID`,placeholder:`12.345.678.9-012.345`},il_vat:{region:`IL`,placeholder:`123456789`},in_gst:{region:`IN`,placeholder:`22AAAAA0000A1Z5`},is_vat:{region:`IS`,placeholder:`123456`},jp_cn:{region:`JP`,placeholder:`1234-56-7890`},jp_rn:{region:`JP`,placeholder:`12345`},jp_trn:{region:`JP`,placeholder:`T1234567890123`},ke_pin:{region:`KE`,placeholder:`P000123456A`},kg_tin:{region:`KG`,placeholder:`12345678`},kh_tin:{region:`KH`,placeholder:`K001-234567890`},kr_brn:{region:`KR`,placeholder:`123-45-67890`},kz_bin:{region:`KZ`,placeholder:`123456789012`},la_tin:{region:`LA`,placeholder:`1234567890`},li_uid:{region:`LI`,placeholder:`CHE-123.456.789`}
12,li_vat:{region:`LI`,placeholder:`12345`},ma_vat:{region:`MA`,placeholder:`12345678`},md_vat:{region:`MD`,placeholder:`1234567`},me_pib:{region:`ME`,placeholder:`12345678`},mk_vat:{region:`MK`,placeholder:`MK1234567890123`},mr_nif:{region:`MR`,placeholder:`12345678`},mx_rfc:{region:`MX`,placeholder:`XAXX010101000`},my_frp:{region:`MY`,placeholder:`12345678`},my_itn:{region:`MY`,placeholder:`C1234567890`},my_sst:{region:`MY`,placeholder:`A12-3456-78901234`},ng_tin:{region:`NG`,placeholder:`12345678-0001`},no_vat:{region:`NO`,placeholder:`123456789MVA`},no_voec:{region:`NO`,placeholder:`1234567`},np_pan:{region:`NP`,placeholder:`123456789`},nz_gst:{region:`NZ`,placeholder:`123456789`},om_vat:{region:`OM`,placeholder:`OM1234567890`},pe_ruc:{region:`PE`,placeholder:`12345678901`},ph_tin:{region:`PH`,placeholder:`123-456-789-000`},pl_nip:{region:`PL`,placeholder:`1234567890`},ro_tin:{region:`RO`,placeholder:`1234567890`},rs_pib:{region:`RS`,placeholder:`123456789`},ru_inn:{region:`RU`,placeholder:`1234567890`},ru_kpp:{region:`RU`,placeholder:`123456789`},sa_vat:{region:`SA`,placeholder:`123456789012345`},sg_gst:{region:`SG`,placeholder:`M12345678X`},sg_uen:{region:`SG`,placeholder:`123456789A`},si_tin:{region:`SI`,placeholder:`12345678`},sn_ninea:{region:`SN`,placeholder:`12345678901`},sr_fin:{region:`SR`,placeholder:`12345678`},sv_nit:{region:`SV`,placeholder:`0614-123456-123-4`},th_vat:{region:`TH`,placeholder:`1234567890123`},tj_tin:{region:`TJ`,placeholder:`123456789`},tr_tin:{region:`TR`,placeholder:`1234567890`},tw_vat:{region:`TW`,placeholder:`12345678`},tz_vat:{region:`TZ`,placeholder:`12-345-6789`},ua_vat:{region:`UA`,placeholder:`1234567890`},ug_tin:{region:`UG`,placeholder:`1234567890`},us_ein:{region:`US`,placeholder:`12-3456789`},uy_ruc:{region:`UY`,placeholder:`123456789012`},uz_tin:{region:`UZ`,placeholder:`123456789`},uz_vat:{region:`UZ`,placeholder:`123456789012`},ve_rif:{region:`VE`,placeholder:`J-12345678-9`},vn_tin:{region:`VN`,placeholder:`1234567890`},xi_vat:{region:`XI`,placeholder:`XI123456789`},za_vat:{region:`ZA`,placeholder:`4123456789`},zm_tin:{region:`ZM`,placeholder:`1234567890`},zw_tin:{region:`ZW`,placeholder:`1234567890`}},Md=Object.keys(jd);function Nd(e){return Object.prototype.hasOwnProperty.call(jd,e)}var Pd=new Set(`AT.BE.BG.HR.CY.CZ.DK.EE.FI.FR.DE.GR.HU.IE.IT.LV.LT.LU.MT.NL.PL.PT.RO.SK.SI.ES.SE`.split(`.`));function Fd(e){if(!e)return`eu_vat`;let t=e.toUpperCase();return Pd.has(t)?`eu_vat`:Md.find(e=>jd[e].region===t)??`eu_vat`}function Id(){let e=_();return(0,Z.useMemo)(()=>({ad_nrt:e(`pongiH`),ae_trn:e(`70oT7g`),al_tin:e(`rpPyBL`),am_tin:e(`BuqROX`),ao_tin:e(`8kIeGz`),ar_cuit:e(`ppsq8M`),au_abn:e(`5MpJqZ`),au_arn:e(`UaEw+r`),aw_tin:e(`6Xh0FX`),az_tin:e(`3ZGGkK`),ba_tin:e(`a8yeim`),bb_tin:e(`BNmrcz`),bd_bin:e(`+VQzcx`),bf_ifu:e(`UJwx3o`),bg_uic:e(`uK8oXY`),bh_vat:e(`2NHNbQ`),bj_ifu:e(`C76cPZ`),bo_tin:e(`a3TJ72`),br_cnpj:e(`xo0YMj`),br_cpf:e(`6e9xcK`),bs_tin:e(`frjDz1`),by_tin:e(`dZoy/3`),ca_bn:e(`Oc+qzd`),ca_gst_hst:e(`3+jkV7`),ca_pst_bc:e(`uB/8j6`),ca_pst_mb:e(`9Y9lCo`),ca_pst_sk:e(`YY5qBY`),ca_qst:e(`P+bM+Q`),cd_nif:e(`YK7HQC`),ch_uid:e(`IqYbT9`),ch_vat:e(`xMg7AX`),cl_tin:e(`wKmkqH`),cm_niu:e(`iOaPYw`),cn_tin:e(`ggThBG`),co_nit:e(`bhb8r5`),cr_tin:e(`Jr7sfJ`),cv_nif:e(`N9Mfua`),de_stn:e(`rsxE01`),do_rcn:e(`yGHsGZ`),ec_ruc:e(`cwMb5l`),eg_tin:e(`tYwysS`),es_cif:e(`aWbVTl`),et_tin:e(`Vwkst7`),eu_oss_vat:e(`YcC4s0`),eu_vat:e(`Q+HAUU`),gb_vat:e(`Jn8cJZ`),ge_vat:e(`bAtKXH`),gh_tin:e(`OmXi+d`),gn_nif:e(`WPemZk`),hk_br:e(`F4NWek`),hr_oib:e(`sc2dZg`),hu_tin:e(`hjRiev`),id_npwp:e(`1r2Hb0`),il_vat:e(`xOaF6U`),in_gst:e(`3QPAam`),is_vat:e(`U0lrSs`),jp_cn:e(`tR1ws6`),jp_rn:e(`lfWVXy`),jp_trn:e(`+92mD4`),ke_pin:e(`Wk8wOz`),kg_tin:e(`6aHSZg`),kh_tin:e(`EhCl0D`),kr_brn:e(`15x0CN`),kz_bin:e(`tlgrQO`),la_tin:e(`M66+zw`),li_uid:e(`fLMCLD`),li_vat:e(`D03+LF`),ma_vat:e(`qf0DJR`),md_vat:e(`wIjDS/`),me_pib:e(`r+SrAO`),mk_vat:e(`C1LjdU`),mr_nif:e(`AshaNe`),mx_rfc:e(`WO50wI`),my_frp:e(`s6oSSg`),my_itn:e(`7ImQYM`),my_sst:e(`3YLPvW`),ng_tin:e(`aDqADY`),no_vat:e(`9nlSUm`),no_voec:e(`jmN0Yn`),np_pan:e(`g0DevH`),nz_gst:e(`qopdZ7`),om_vat:e(`X88DtD`),pe_ruc:e(`BXxMHi`),ph_tin:e(`PPCaug`),pl_nip:e(`B38ssz`),ro_tin:e(`WnQFLZ`),rs_pib:e(`xXwuzS`),ru_inn:e(`8/9pC0`),ru_kpp:e(`tfag+K`),sa_vat:e(`2CY6qT`),sg_gst:e(`mWptlH`),sg_uen:e(`/HqrP/`),si_tin:e(`zWxzmH`),sn_ninea:e(`9KWDiv`),sr_fin:e(`OE7Qip`),sv_nit:e(`NM+S0g`),th_vat:e(`Wz3
12V5e`),tj_tin:e(`uz2rNh`),tr_tin:e(`Fxe3h0`),tw_vat:e(`9Y31fY`),tz_vat:e(`B6/GXK`),ua_vat:e(`HMwF+F`),ug_tin:e(`ytpKEF`),us_ein:e(`xTxKjV`),uy_ruc:e(`yrw1GG`),uz_tin:e(`jhnGbF`),uz_vat:e(`VLd3z/`),ve_rif:e(`xSq0g3`),vn_tin:e(`N6noIS`),xi_vat:e(`dBORFK`),za_vat:e(`AQ8j0Q`),zm_tin:e(`urPvTW`),zw_tin:e(`hvUUCk`)}),[e])}var Ld=`box-border h-11 w-full rounded-lg border border-stroke bg-transparent px-3 text-2 text-gray-12 outline-none transition-[box-shadow,border-color] [color-scheme:normal] focus:border-accent-a8 focus:shadow-[0_0_0_3px_var(--accent-a5)] disabled:cursor-default disabled:opacity-60 disabled:focus:border-stroke disabled:focus:shadow-none`,Rd=B(`tax-id`).doc("Collects a business tax registration accepted by the API. Labels use buyer-facing names. The placeholder matches the selected format. `country` preselects a type. `onChange` emits committed pairs. The host supplies API validation errors.").props(e=>({country:e.default(``).analytics().doc("ISO 3166-1 alpha-2 buyer country used to preselect the type. `AR` selects `ar_cuit`, `LI` selects `li_uid`. EU and unmapped or empty values select `eu_vat`. Other mapped countries select their own first type. A manual selection persists across country changes."),defaultValue:e.default(void 0).doc("Initial `type` and `value` from a resumed session. An unsupported `type` falls back to the country default."),disabled:e.default(!1).doc(`Disables both fields while the host saves the last committed registration.`),error:e.default(``).doc(`API validation error shown below the value input. Empty (default) shows nothing.`)})).events(e=>({change:e.external().doc(`Fires on blur or Enter when the value is nonempty, or when the type changes with a value present. Identical consecutive values fire once. Clearing the value doesn't fire. The host must clear stored registrations.`)})).demo(e=>e.controls(e=>({country:e.select(`DE`,[`DE`,`AR`,`US`,`GB`,`CA`,`JP`],{label:`Buyer country`})})).props(e=>({country:e.country}))).render(()=>{"use embed";return(0,Q.jsx)(zd,{})});function zd(){let e=_(),{props:t,emit:n}=P(),r=Id(),i=(0,Z.useId)(),a=(0,Z.useId)(),o=t.defaultValue?.type,[s,c]=(0,Z.useState)(o!==void 0&&Nd(o)?o:void 0),[l,u]=(0,Z.useState)(t.defaultValue?.value??``),d=s??Fd(t.country),f=(0,Z.useMemo)(()=>[...Md].sort((e,t)=>r[e].localeCompare(r[t])),[r]),p=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{t.error&&(p.current=void 0)},[t.error]);let m=(e,t)=>{let r=t.trim();if(r===``)return;c(e);let i=`${e} ${r}`;p.current!==i&&(p.current=i,n(`change`,{taxId:{type:e,value:r}}))};return(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-1 p-1`,z(`TaxId`,`Tax registration root`)),children:[(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`TaxIdTypeLabel`,`Registration type label`)),htmlFor:i,children:e(`/CnLTH`)}),(0,Q.jsx)(`select`,{id:i,value:d,disabled:t.disabled,onChange:e=>{let t=e.target.value;Nd(t)&&(c(t),m(t,l))},className:D(Ld,z(`TaxIdTypeSelect`,`Registration type selector`)),children:f.map(e=>(0,Q.jsx)(`option`,{value:e,children:r[e]},e))}),(0,Q.jsx)(`label`,{className:D(`text-1 text-gray-11 font-medium`,z(`TaxIdLabel`,`Registration value label`)),htmlFor:a,children:r[d]}),(0,Q.jsx)(`input`,{id:a,type:`text`,value:l,autoComplete:`off`,placeholder:jd[d].placeholder,disabled:t.disabled,onChange:e=>u(e.target.value),onBlur:()=>m(d,l),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m(d,l))},className:D(Ld,z(`TaxIdInput`,`Registration value input`))}),t.error!==``&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9`,z(`TaxIdError`,`API validation error`)),children:t.error})]})}var Bd=[`second_factor_required`,`login_challenge_required`];function Vd(e){return!!e?.code&&Bd.includes(e.code)}function Hd(e){return{method:e.method,maskedDestination:e.masked_destination,resendAvailableAt:e.resend_available_at}}var Ud=B(`verification-code`).doc("The payments controller opens this buyer sign-in dialog when a recognized buyer chooses to sign in. It verifies a one-time code with the pending session's `client_secret`. The dialog enforces the resend window and shows verification failures, including expired or incorrect codes, rate limits, and required email-link steps. On success, it sends the session token to the controller and closes.").internal().props(e=>({session:e.fromController().doc(`The pending session under verification — id, client_secret 
12capability, and challenge timing. Created (and replaced, on restart) by the payments controller.`),signInError:e.fromController().doc("The last controller-side sign-in failure as a stable code (`code_resend_failed` — a restart that could not create a session), localized on the expired pane — empty when none. Driven by the payments controller.")})).state(()=>({phase:`code`,submitting:!1,resending:!1,error:void 0,challenge:void 0,challengeSessionId:void 0,checkoutSession:void 0})).auth({embed:({props:e})=>{"use embed";return{token:e.session?.clientSecret,maxRetries:0}}}).events(e=>({verified:e.internal().doc("Coordination only — the session activated. `id` names the intent that verified, so the controller can ignore a stale response landing after it replaced the intent. `token` is present on an EMBEDDED verify, where the credential can only ride the response body — the scoped session token the verify minted — and the controller holds it internally (never host-readable) to route to the collection surfaces over the same-origin bus. It is ABSENT on a first-party verify: there the server sets the credential as HttpOnly cookies, so there is nothing to carry and subsequent calls authenticate themselves."),restartRequested:e.internal().doc(`Coordination only — the session expired and the buyer chose to start over; the controller creates a fresh session in place.`),terminal:e.internal().doc(`Coordination only — this intent reached a dead state (expired, revoked, already-consumed, or gone). The controller drops it so a later reopen mints a FRESH intent instead of resurrecting a server-dead one.`)})).actions(e=>({adoptCheckoutSession:e.controllerOnly(async(e,t)=>{"use embed";return e.setState({checkoutSession:t}),{}}).doc("The controller's checkout-session delivery over the same-origin bus: the OPEN session this sign-in happens inside, named on the verify so the backend records the proven buyer on it. `clientSecret` proves the session for callers its resume cookie does not ride with (an embedded mount); a first-party call proves it by the cookie alone."),verify:e.controllerOnly(async(e,t)=>{"use embed";let n=e.props.session;if(!n)throw Error(`No session is under verification`);if(e.state.submitting)return{status:`in_flight`};e.setState({submitting:!0});try{let r=e.state.checkoutSession,i={code:t.code,...r?{checkout_session:r.id}:{},...r?.clientSecret?{checkout_session_client_secret:r.clientSecret}:{}},a=await e.sdk.sessionIntents.verify(n.id,i);if(a.status===`active`){let t=su(a);return e.setState({submitting:!1,phase:`verified`,error:void 0,challengeSessionId:n.id}),e.emit(`verified`,{id:n.id,token:t,email:a.email,user:a.user??null}),{status:a.status}}if(a.status===`expired`||a.status===`revoked`)return e.setState({submitting:!1,phase:`expired`,error:cu(a),challengeSessionId:n.id}),e.emit(`terminal`,{id:n.id}),{status:a.status};let o=cu(a);return e.setState({submitting:!1,error:o,challenge:a.verification?Hd(a.verification):e.state.challenge,challengeSessionId:n.id}),Vd(o)&&e.emit(`terminal`,{id:n.id}),{status:a.status}}catch(t){return lu(t)?(e.setState({submitting:!1,phase:`expired`,error:void 0,challengeSessionId:n.id}),e.emit(`terminal`,{id:n.id})):e.setState({submitting:!1,error:{code:`verify_failed`},challengeSessionId:n.id}),{status:`error`}}}).doc(`Submit the entered code against the pending session — in-frame only (the dialog auto-submits a complete code).`),resend:e.controllerOnly(async e=>{"use embed";let t=e.props.session;if(!t)throw Error(`No session is under verification`);if(e.state.resending)return{status:`in_flight`};e.setState({resending:!0});try{let n=await e.sdk.sessionIntents.resend(t.id);if(n.status!==`requires_verification`)return e.setState({resending:!1,phase:`expired`,error:cu(n),challengeSessionId:t.id}),e.emit(`terminal`,{id:t.id}),{status:n.status};let r=cu(n);return e.setState({phase:e.state.phase===`verified`?`verified`:`code`,resending:!1,error:r,challenge:n.verification?Hd(n.verification):e.state.challenge,challengeSessionId:t.id}),Vd(r)&&e.emit(`terminal`,{id:t.id}),{status:n.status}}catch(n){return lu(n)?(e.setState({resending:!1,phase:`expired`,error:void 0,challengeSessionId:t.id}),e.emit(`terminal`,{id:t.id})):e.setState({resending:!1,error:{code:`resend_failed`},challengeSessionId:t.id}),{status:`error`}}}).doc(`Re-send the pending challenge's code — in-frame only (the dialog's resend control, throttled by the session's resend window).`)})).modal(e=>{"use embed";return{header:(0,Q.jsx)(Kd,{}),footer:(0,Q.jsx)(qd,{close:e.close})}},{maxWidth:448}).loading(()=>{"use loading";return(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Q.jsx)(`div`,{style:{height:16,width:220,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}}),(0,Q.jsx)(`div`,{style:{height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]})}).demo(e=>e.props(()=>({}))).render(e=>{"use embed";let t=_(),{props:n,state:i,setState:a,actions:o,emit:c}=e,l=(0,Z.useId)(),[u,d]=(0,Z.useState)(``),f=n.session,p=Gd(i.error),m=Gd(n.signInError?{
12code:n.signInError}:void 0),h=f?.id;(0,Z.useEffect)(()=>{if(!(!h||i.challengeSessionId===h)){if(i.challengeSessionId===void 0){a({challengeSessionId:h});return}a({phase:`code`,submitting:!1,resending:!1,error:void 0,challenge:void 0,challengeSessionId:h}),d(``)}},[h,i.challengeSessionId,a]);let g=null;if(f&&i.phase===`expired`)g=(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-3`,z(`VerificationExpired`,`Expired sign-in pane`)),children:[(0,Q.jsx)(`p`,{className:`text-2 text-gray-12`,children:p??t(`j3ME6C`)}),n.signInError&&(0,Q.jsx)(`p`,{className:D(`text-1 text-danger-9 text-center`,z(`VerificationError`,`Dialog failure message`)),children:m}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(`restartRequested`,{email:f.email}),className:D(`border-gray-a6 text-2 text-gray-12 hover:bg-gray-a3 h-10 cursor-pointer rounded-lg border bg-transparent px-4 font-medium`,z(`VerificationRestart`,`Expired-pane start-over control`)),children:t(`gdlGkp`)})]});else if(f){let e=Wd(f,i),n=e?.maskedDestination??f.email,a=Vd(i.error),c=i.phase===`verified`,m=i.submitting||i.resending||a||c;g=(0,Q.jsxs)(`div`,{className:D(`flex flex-col gap-6`,z(`Verification`,`Verification-code dialog body`)),"data-whop-autofill":``,children:[(0,Q.jsx)(Li,{}),(0,Q.jsxs)(`div`,{className:D(`flex flex-col items-center gap-2 text-center`,z(`VerificationHeading`,`Code dialog heading and explanation`)),children:[(0,Q.jsx)(s,{size:`4`,weight:`semi-bold`,children:t(`xeS9wb`)}),(0,Q.jsx)(s,{className:D(`text-gray-a11 text-balance`,z(`VerificationHint`,`Code-delivery explanation`)),render:(0,Q.jsx)(`label`,{htmlFor:l}),children:e?.method===`totp`?t(`skvuXF`):t.rich(`5KwPCu`,{strong:()=>(0,Q.jsx)(r,{children:n})})})]}),(0,Q.jsx)(Sd,{inputId:l,code:u,locked:m,submitting:i.submitting,failure:p,onCode:e=>{let t=e.replace(/\D/g,``).slice(0,6);d(t),t.length===6&&!i.submitting&&!i.resending&&!a&&o.verify({code:t})}})]})}return(0,Q.jsx)(e.Loading,{loading:!n.session&&i.phase!==`verified`,children:g})});function Wd(e,t){if(e)return t.challengeSessionId===e.id&&t.challenge?t.challenge:{method:e.method,maskedDestination:e.maskedDestination,resendAvailableAt:e.resendAvailableAt}}function Gd(e){let t=_();if(e)switch(e.code){case`invalid_code`:return t(`/f9OCo`);case`code_expired`:return t(`h6HW1i`);case`rate_limited`:return t(`ggZPDd`);case`login_challenge_required`:return t(`Brb3uA`);case`second_factor_required`:return t(`Z/vMJq`);case`verify_failed`:return t(`xxtV2Z`);case`resend_failed`:case`code_resend_failed`:return t(`uVUF1e`);default:return t(`Vi2e24`)}}function Kd(){return(0,Q.jsx)(wd,{className:D(`text-gray-12 h-[26px] w-auto`,z(`VerificationTitle`,`Dialog header wordmark`))})}function qd({close:e}){let t=_(),{props:n,state:r,actions:i,emit:a}=P(),o=r.phase===`verified`&&(!n.session||r.challengeSessionId===n.session.id);(0,Z.useEffect)(()=>{o&&e()},[o,e]);let s=Wd(n.session,r),c=s?Date.parse(s.resendAvailableAt):NaN,[l,u]=(0,Z.useState)(()=>Date.now()),d=Number.isFinite(c)&&c>l;if((0,Z.useEffect)(()=>{if(!d)return;let e=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(e)},[d]),r.phase!==`code`||!n.session)return null;if(Vd(r.error))return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{n.session&&a(`terminal`,{id:n.session.id}),e()},className:D(`text-1 text-gray-11 hover:text-gray-12 cursor-pointer border-0 bg-transparent p-0 underline underline-offset-2`,z(`VerificationDismiss`,`Continue-as-guest control for unavailable sign-in`)),children:t(`Z7c9rQ`)});if((r.challenge?.method??n.session.method)===`totp`)return null;let f=d?Math.max(1,Math.ceil((c-l)/1e3)):0;return(0,Q.jsx)(`button`,{type:`button`,disabled:d||r.submitting||r.resending,onClick:()=>void i.resend(),className:D(`text-1 text-gray-11 hover:text-gray-12 cursor-pointer border-0 bg-transparent p-0 underline underline-offset-2 disabled:cursor-default disabled:no-underline disabled:opacity-60`,z(`VerificationResend`,`Resend-code control with countdown`)),children:f>0?t(`XPklVO`,{seconds:String(f)}):t(`ZD48TW`)})}function Jd(e){let t=e.state.checkoutSessionRef;t?.id&&e.children.verificationCode.adoptCheckoutSession({id:t.id,clientSecret:t.clientSecret}).catch(()=>{})}var Yd={list:{data:[{object:`payment_method_type`,type:`card`,category:`card`,dis
12play_name:`Card`,icons:tf(`card`),detail:{template:`none`,icon:`card`,short_name:`Card`},required_fields:[{name:`name`,kind:`billing_details`},{name:`country`,kind:`billing_details`},{name:`postal_code`,kind:`billing_details`}],usage:{one_time:!0,off_session:!0,on_session:!0},currencies:{eur:{min_amount:null,max_amount:null,countries:[`DE`,`NL`,`FR`].map(e=>({country:e,min_amount:null,max_amount:null}))},usd:{min_amount:null,max_amount:null,countries:[{country:`US`,min_amount:null,max_amount:null}]}},card:{public_key:`demo_public_key`,networks:ef()}},nf(`ideal`,`iDEAL`,{eur:[`NL`]},{detail:{template:`redirect`,icon:`redirect`,short_name:`iDEAL`}}),nf(`bancontact`,`Bancontact`,{eur:[`BE`]}),nf(`klarna`,`Klarna`,{eur:[`DE`,`NL`,`BE`,`AT`],usd:[`US`]},{detail:{template:`bnpl_confirm`,icon:`redirect`,short_name:`Klarna`},minAmount:1e3}),nf(`apple_pay`,`Apple Pay`,{eur:[`DE`,`NL`,`FR`],usd:[`US`]},{category:`wallet`,detail:{template:`wallet_sheet`,icon:`wallet`,short_name:`Apple Pay`}}),nf(`paypal`,`PayPal`,{eur:[`DE`,`NL`,`FR`],usd:[`US`]}),nf(`pix`,`Pix`,{usd:[`BR`],eur:[`BR`]},{iconName:null,detail:{template:`redirect`,icon:`redirect`,short_name:`Pix`},requiredFields:[{name:`tax_id`,kind:`payment_method`,placeholder:`123.456.789-09`,formats:{br:`^[0-9.-]{11,14}$`,"*":`^[0-9.-]{11,14}$`}}]}),nf(`eps`,`EPS`,{eur:[`AT`]},{iconName:null}),nf(`webpay`,`Webpay`,{eur:[`CL`],usd:[`CL`]},{detail:{template:`redirect`,icon:`redirect`,short_name:`Webpay`},requiredFields:[{name:`document_id`,kind:`billing_details`,placeholder:`12.345.678-5`,formats:{cl:`^[0-9]{7,9}$`,"*":`^\\w{4,20}$`}},{name:`bank_code`,kind:`payment_method`,placeholder:`012`}]}),nf(`sepa_debit`,`SEPA Direct Debit`,{eur:[`DE`,`NL`,`FR`,`BE`]},{category:`bank_debit`,iconName:`sepa`,detail:{template:`none`,icon:`bank`,short_name:`SEPA`},requiredFields:[{name:`bank_account`,kind:`payment_method`,secure:!0,placeholder:`DE00 1234 1234 1234 1234 12`,formats:{"*":`^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$`},input_formats:{"*":String.raw`^\s*[A-Z]{2}[0-9]{2}(?:[A-Z0-9]{11,30}|[A-Z0-9\s]{14,39})\s*$`},input_mask:[{pattern:`[A-Z]`},{pattern:`[A-Z]`},{pattern:`[0-9]`},{pattern:`[0-9]`},...Array.from({length:7},()=>[` `,...Array.from({length:4},()=>({pattern:`[A-Z0-9]`}))]).flat(),` `,{pattern:`[A-Z0-9]`},{pattern:`[A-Z0-9]`}]}],config:{tokenizer:`basis_theory`,public_key:`demo_public_key`,mandate:{url:`https://whop.com/legal/sepa-mandate`}}}),nf(`eu_bank_transfer`,`Bank transfer`,{eur:[`DE`,`NL`]},{category:`bank_transfer`,iconName:`bank-wire`,detail:{template:`bank_wire`,icon:`bank`,short_name:`Bank transfer`},config:{settlement_window:`1-3 business days`}})],page_info:{end_cursor:null,has_next_page:!1,has_previous_page:!1,start_cursor:null}},retrieve:{object:`payment_method_type`,type:`card`,category:`card`,display_name:`Card`,icons:tf(`card`),detail:{template:`none`,icon:`card`,short_name:`Card`},required_fields:[],usage:{one_time:!0,off_session:!0,on_session:!0},currencies:{eur:{min_amount:null,max_amount:null,countries:[`DE`,`NL`,`FR`].map(e=>({country:e,min_amount:null,max_amount:null}))},usd:{min_amount:null,max_amount:null,countries:[{country:`US`,min_amount:null,max_amount:null}]}},card:{public_key:`demo_public_key`}}},Xd=I(`payments`).doc("Collect a payment from a `plan_` ID or inline currency and amount, or save a payment method without charging with `mode: \"setup\"`. Mount PaymentElement, CardElement, or CardFields, then call `payments.createConfirmationToken` with billing details. Wallet selections open their sheet automatically. Confirm the token server-side, then pass the payment's or setup intent's `client_secret` to `handleNextAction` for any pending step.").props().analytics(`accountId`,`mode`,`plan`,`currency`,`amount`,`setupFutureUsage`).flowSurface(`checkout`).state((e,t)=>({charge:t.async(async e=>{if(Xl(e.props))return Yl;let t=Zl(e.props);return t.mode===`setup`?$l(t):t.plan===void 0?Ql(t):eu(await e.sdk.plans.retrieve(t.plan).catch(e=>{throw new X(`PLAN_RESOLUTION_FAILED`,Oe(e,`plan ${t.plan} could not be resolved`))}),t)},[`mode`,`plan`,`currency`,`amount`,`setupFutureUsage`,`paymentMethodConfiguration`]),accountId:t.sync(e=>e.props.accountId,[`accountId`]),offerAmounts:t.sync(e=>e.props.offerAmounts,[`offerAmounts`]),returnUrl:t.sync(e=>e.props.returnUrl,[`returnUrl`]),previewWalletAvailability:t.sync(e=>e.props.previewWalletAvailability,[`previewWalletAvailability`]),checkoutSessionRef:t.sync(e=>e.props.checkoutSession,[`checkoutSession`]),phoneVerifiedNonce:0,selectedType:void 0,selectedCategory:void 0,selectedTemplate:void 0,selectedSubmitButton:void 0,addressCollected:void 0,addressLive:!1,addressPicker:{predictions:[],highlightedIndex:0,searching:!1},addressPick:void 0,addressManualNonce:0,addressDismissNonce:0,addressHover:void 0,billingPicker:{predictions:[],highlightedIndex:0,searching:!1},billingPick:void 0,billingManualNonce:0,billingDismissNonce:0,billingHover:void 0,session:void 0,sessionNonce:0,pendingIntent:void 0,pendingIntentDead:!1,buyerEmail:``,signInPending:!1,signInError:``,recognition:void 0})).hostState((e,t)=>({walletPrime:void 0,walletOwner:void 0,charge:t.sync(async()=>{"use host";return{data:await nu(e)}},[`accountId`,`mode`,`plan`,`currency`,`amount`,`setupFutureUsage`,`paymentMethodConfiguration`]),walletAvailability:t.async(async()=>{"use host";let t=await nu(e);return{data:await bo({accountId:e.accountId,currency:t.currency,amount:t.amount})}},[`accountId`,`mode`,`plan`,`currency`])})).publicState(`selectedType`,`selectedCategory`,`selectedTemplate`,`selectedSubmitButton`,`charge`,`buyerEmail`).auth({controller:({state:e})=>{"use controller";return e.session?.token?{token:e.session.token}:{}}}).children(e=>({payment:e(td).slot(`entry`).fromController(({state:e})=>{"use controller";if(!e.charge.configured)throw new X(`CHARGE_CONFIG_MISSING`,`This handle has no charge config — pass a plan or currency+amount to create collection faces.`);return{accountId:e.accountId,mode:e.charge.mode,plan:e.charge.plan,checkoutSessionId:e.checkoutSessionRef?.id,currency:e.charge.currency,amount:e.charge.amount,offerAmounts:e.offerAmounts,setupFutureUsage:e.charge.setupFutureUsage,paymentMethodConfiguration:e.charge.paymentMethodConfiguration,addressElementLive:e.addressLive,billingCountry:e.addressLive?e.addressCollected?.address.country:void 0,sessionNonce:e.sessionNonce,suggestionPick:e.billingPick,suggestionManualNonce:e.billingManualNonce,suggestionDismissNonce:e.billingDismissNonce,suggestionHover:e.billingHover,previewWalletAvailability:e.previewWalletAvailability}}).fromHost(e=>{"use host";return{walletAvailability:e.walletAvailability}}),address:e(ts).fromController(({state:e})=>{"use controller";return{suggestionPick:e.addressPick,suggestionManualNonce:e.addressManualNonce,suggestionDismissNonce:e.addressDismissNonce,suggestionHover:e.addressHover}}),addressSuggestions:e(es).anchored(`address`,`line1`).fromController(({state:e})=>{"use controller";return{predictions:e.addressPicker.predictions,highlightedIndex:e.addressPicker.highlightedIndex,searching:e.addressPicker.searching}}),billingAddressSuggestions:e(rs).anchored(`payment`,`billingLine1`).fromController(({state:e})=>{"use controller";return{predictions:e.billingPicker.predictions,highlightedIndex:e.billingPicker.highlightedIndex,searching:e.billingPicker.searching}}),card:e(oc).slot(`entry`).fromController(({state:e})=>{"use controller";if(!e.charge.configured)throw new X(`CHARGE_CONFIG_MISSING`,`This handle has no charge config — pass a plan or currency+amount to create collection faces.`);return{accountId:e.accountId}}),cardFields:e(Ys).slot(`entry`).fromController(({state:e})=>{"use controller";if(!e.charge.configured)throw new X(`CHARGE_CONFIG_MISSING`,`This handle has no charge config — pass a plan or currency+amount to create collection faces.`);return{accountId:e.accountId}}),email:e(Fl).fromController(({state:e})=>{"use controller";return{sessionEmail:e.session?.email??``,signInPending:e.signInPending,signInError:e.signInError}}),verificationCode:e(Ud).fromController(({state:e})=>{"use controller";return{session:e.pendingIntent,signInError:e.signInError}}),completePayment:e(Tl),phoneVerification:e(Td),taxId:e(Rd),branding:e(Qo)})).resources(e=>({paymentRequest:e(Wa)})).actions(e=>({handleNextAction:e.static(async(e,t)=>{"use host";return ql({openCompletion:t=>Gl(()=>e.open(`completePayment`),t),navigate:Ul},{clientSecret:t.clientSecret,returnUrl:t.returnUrl,pollIntervalMs:t.pollIntervalMs})}).doc("Completes a confirmed payment's pending step without mounting an element. `clientSecret` identifies the payment. You don't need a payment ID. Inline steps open in a dialog and resolve with `redirected: false`. Dism
12issing the dialog returns the payment's current status, which can remain pending. Full-page steps redirect with `redirected: true` to `return_url`, or a hosted receipt when the payment has no return URL. Inside an iframe they navigate the top-level tab. If the embedding page refuses that navigation, they reject with code `TAB_NAVIGATION_BLOCKED`, and the payment stays pending. Set `returnUrl` to update the destination before presentation. An update failure rejects before any step runs. Inline steps never navigate to that URL. A payment whose charge is still being decided is polled until a step appears or it settles; a decided payment with no step resolves immediately."),verifyPhone:e.internal(async e=>{"use controller";return await e.open(`phoneVerification`),{}}).doc(`Present the phone-verification ceremony — number entry and the texted code, one dialog — for the signed-in buyer. Internal coordination behind the composed checkout (the verify_phone next_action), no consumer surface.`),createConfirmationToken:e.host(async(e,t)=>{"use host";if(e.children.branding.attached&&!e.children.branding.visible)throw new Ie(`BRANDING_HIDDEN`,`The branding element is hidden — it must be visible on the page for payments to be confirmed.`);return xo({hostState:e.hostState,controllerState:()=>e.controllerState(),children:e.children,checkoutSession:e.props.checkoutSession,mint:t=>e.actions.mintConfirmationToken({...t,branding:{presence:e.children.branding.attached?`visible`:`missing`,surface:e.props.checkoutSession?`checkout`:`payments`,hostOrigin:Va()?.host??window.location.origin}})},t)}).doc("Creates a confirmation token for the selected method from your pay button. Pass the checkout's billing details. They must include `email`. Supply `phone` for methods that require it when billing collection is disabled. Cards also need `name` and an address containing `line1` and `country`. Wallet selections open their sheet during the pay-button interaction. Confirm the returned `confirmationToken` server-side, then call `WhopElements.payments.handleNextAction(…)`."),mintConfirmationToken:e.internal(async(e,t)=>{"use controller";let{branding:n,...r}=t;if(!e.state.charge.configured)throw new X(`CHARGE_CONFIG_MISSING`,`This handle has no charge config — pass a plan or currency+amount before confirming.`);let i=e.children.address.created?e.state.addressCollected:void 0,a=e.children.email.created&&e.state.buyerEmail?e.state.buyerEmail:void 0,o={...r,billingDetails:zl({...r.billingDetails,email:r.billingDetails?.email||a},i)},s=await Js({payment:{created:e.children.payment.created,collect:t=>e.children.payment.collect(t)},card:{created:e.children.card.created,collect:t=>e.children.card.collect(t)},cardFields:{created:e.children.cardFields.created,collect:t=>e.children.cardFields.collect(t)}},o);return await Ws(e.sdk,{accountId:e.state.accountId,returnUrl:e.state.returnUrl,setupFutureUsage:e.state.charge.setupFutureUsage,branding:n},s.paymentMethod,s.billingDetails,s.billingExtra)}).doc(`The confirm dispatcher's controller-frame gateway: the active collection surface (payment element → fused card element → exploded cardFields unit) collects, and THIS action mints — the one mint site, in the controller frame — internal, no consumer surface.`),startSessionIntent:e.internal(async(e,t)=>{"use controller";if(e.state.signInPending)return{started:!1};e.setState({signInPending:!0,signInError:``});try{if(t.open!==!1&&!e.state.pendingIntentDead&&ou(e.state.pendingIntent,t.email))return await e.open(`verificationCode`,{}),Jd(e),{started:!0};let n=await iu().sessionIntents.create({email:t.email,intent:ru});return e.setState({pendingIntent:au(n),pendingIntentDead:!1}),t.open!==!1&&(await e.open(`verificationCode`,{}),Jd(e)),{started:!0}}catch{return e.setState({signInError:t.open===!1?`code_resend_failed`:`sign_in_start_failed`}),{started:!1}}finally{e.setState({signInPending:!1})}}).doc(`Create a session intent for the email and pop the verification dialog (or re-enter the pending intent in place on a restart) — internal coordination behind the email element, no consumer surface.`),signOut:e.internal(async e=>{"use controller";try{await e.sdk.sessions.destroyCurrent()}catch{}return e.setState({session:void 0,sessionNonce:e.state.sessionNonce+1,pendingIntent:void 0,pendingIntentDead:!1,signInError:``}),e.children.payment.created&&e.children.payment.adoptSession({}).catch(()=>{}),{}}).doc(`Sign the buyer out: clears the credentials this browser holds for Whop (the login pair and the scoped session cookie) and drops the session this checkout held — internal, no consumer surface.`)})).demo(e=>
12e.controls(e=>({mode:e.select(`payment`,[`payment`,`setup`],{label:`Mode`}),amount:e.number(500,{label:`Amount (minor units)`,min:100,max:1e5,step:100}),currency:e.select(`eur`,[`eur`,`usd`],{label:`Currency`}),disabledTypes:e.text(``,{label:`Disabled method types (comma-separated)`})})).props(e=>Zd(e)).state(e=>({accountId:`biz_demo`,charge:Qd(e),returnUrl:`https://example.com/checkout/complete`,selectedType:void 0,selectedCategory:void 0,selectedTemplate:void 0,selectedSubmitButton:void 0,addressCollected:void 0,addressLive:!1,addressPicker:{predictions:[],highlightedIndex:0,searching:!1},addressPick:void 0,addressManualNonce:0,addressDismissNonce:0,addressHover:void 0,billingPicker:{predictions:[],highlightedIndex:0,searching:!1},billingPick:void 0,billingManualNonce:0,billingDismissNonce:0,billingHover:void 0,session:void 0,sessionNonce:0,pendingIntent:void 0,pendingIntentDead:!1,buyerEmail:``,signInPending:!1,signInError:``,checkoutSessionRef:void 0,phoneVerifiedNonce:0})).hostState(e=>({walletPrime:void 0,charge:Qd(e),walletAvailability:{applePay:!0,googlePay:!0}})).sdk(()=>({plans:{retrieve:{id:`plan_demo_1`,object:`plan`,currency:`eur`,initial_price:5,renewal_price:0,initial_price_due:{currency:`eur`,amount:`5.00`,decimals:2,display_decimals:2},plan_type:`one_time`,account:{id:`biz_demo`,title:`Demo Seller`},payment_method_configuration:null}},users:{me:{id:`user_demo_1`,object:`user`,email:null,username:`demo`}},sessions:{destroyCurrent:null},sessionIntents:{recognize:{object:`session_intent_recognition`,recognized:!1},verify:{object:`session_intent`,id:`sess_demo_1`,status:`active`,client_secret:null},resend:{object:`session_intent`,id:`sess_demo_1`,status:`requires_verification`}},paymentMethodTypes:Yd,confirmationTokens:{create:{id:`ctok_demo_5kY2mB91`,object:`confirmation_token`,billing_details:null,payment_method_preview:null,setup_future_usage:null,created_at:`2026-01-01T00:00:00Z`,expires_at:`2026-01-01T01:00:00Z`}}}))).on(e=>{e.controller(td,`selected`,(e,t)=>{"use controller";e.setState({selectedType:t.type,selectedCategory:t.category,selectedTemplate:t.template,selectedSubmitButton:t.submitButton})}),e.controller(ts,`suggestions`,async(e,t)=>{"use controller";e.setState({addressPicker:{predictions:t.predictions,highlightedIndex:t.highlightedIndex,searching:t.searching}}),t.open?await e.open(`addressSuggestions`):e.close(`addressSuggestions`)}),e.controller(`addressSuggestions`,`picked`,(e,t)=>{"use controller";e.setState({addressPick:{id:t.id,nonce:(e.state.addressPick?.nonce??0)+1}}),e.close(`addressSuggestions`)}),e.controller(`addressSuggestions`,`manualRequested`,e=>{"use controller";e.setState({addressManualNonce:e.state.addressManualNonce+1}),e.close(`addressSuggestions`)}),e.controller(`addressSuggestions`,te.dismissed,e=>{"use controller";e.setState({addressDismissNonce:e.state.addressDismissNonce+1})}),e.controller(`addressSuggestions`,`hovered`,(e,t)=>{"use controller";e.setState({addressHover:{index:t.index,nonce:(e.state.addressHover?.nonce??0)+1}})}),e.controller(td,`suggestions`,async(e,t)=>{"use controller";e.setState({billingPicker:{predictions:t.predictions,highlightedIndex:t.highlightedIndex,searching:t.searching}}),t.open?await e.open(`billingAddressSuggestions`):e.close(`billingAddressSuggestions`)}),e.controller(`billingAddressSuggestions`,`picked`,(e,t)=>{"use controller";e.setState({billingPick:{id:t.id,nonce:(e.state.billingPick?.nonce??0)+1}}),e.close(`billingAddressSuggestions`)}),e.controller(`billingAddressSuggestions`,`manualRequested`,e=>{"use controller";e.setState({billingManualNonce:e.state.billingManualNonce+1}),e.close(`billingAddressSuggestions`)}),e.controller(`billingAddressSuggestions`,te.dismissed,e=>{"use controller";e.setState({billingDismissNonce:e.state.billingDismissNonce+1})}),e.controller(`billingAddressSuggestions`,`hovered`,(e,t)=>{"use controller";e.setState({billingHover:{index:t.index,nonce:(e.state.billingHover?.nonce??0)+1}})}),e.controller(ts,`change`,(e,t)=>{"use controller";e.setState({addressCollected:{complete:t.complete,address:t.address},addressLive:!0})}),e.controller(Fl,`change`,(e,t)=>{"use controller";e.setState({buyerEmail:t.complete?t.email:``,...e.state.signInError?{signInError:``}:{}})}),e.controller(Fl,`signInRequested`,(e,t)=>{"use controller";e.actions.startSessionIntent({email:t.email})}),e.controller(Fl,`recognitionChanged`,(e,t)=>{"use controller";
12e.setState({recognition:t})}),e.controller(Fl,`signOutRequested`,e=>{"use controller";e.actions.signOut()}),e.controller(Ud,`verified`,(e,t)=>{"use controller";e.state.pendingIntent?.id===t.id&&(t.token&&e.children.payment.created&&e.children.payment.adoptSession({token:t.token}).catch(()=>{}),e.setState({session:{token:t.token,email:t.email,user:t.user??void 0},sessionNonce:e.state.sessionNonce+1,pendingIntentDead:!0,signInError:``}))}),e.controller(td,`sessionRequested`,e=>{"use controller";let t=e.state.session?.token;t&&e.children.payment.adoptSession({token:t}).catch(()=>{})}),e.controller(td,`phoneVerificationRequested`,e=>{"use controller";e.actions.verifyPhone()}),e.controller(Fl,`phoneVerificationRequested`,e=>{"use controller";e.actions.verifyPhone()}),e.controller(Td,`sessionRequested`,e=>{"use controller";let t=e.state.session?.token;t&&e.children.phoneVerification.adoptSession({token:t}).catch(()=>{})}),e.controller(Td,`verified`,e=>{"use controller";e.setState({phoneVerifiedNonce:e.state.phoneVerifiedNonce+1})}),e.controller(Ud,`restartRequested`,(e,t)=>{"use controller";e.actions.startSessionIntent({email:t.email,open:!1})}),e.controller(Ud,`terminal`,(e,t)=>{"use controller";e.state.pendingIntent?.id===t.id&&e.setState({pendingIntentDead:!0})}),e.host(td,`change`,(e,t)=>{"use host";let n=t.method;if(n?.template===`wallet_sheet`&&(n.type===`apple_pay`||n.type===`google_pay`)){let r=e.state.charge,i=e.props.accountId;if(!r.configured||i===void 0)return;let a=Ka(r),o=e.state.walletPrime;if(o?.type===n.type&&o.chargeKey===a&&vo(o.prKey)!==`failed`)return;o&&yo(o.prKey);let s=e.state.walletOwner??`wpo_${Math.random().toString(36).slice(2,10)}`,c=po({accountId:i,currency:r.currency,amount:r.amount,setupFutureUsage:r.setupFutureUsage,owner:s,type:n.type,branding:()=>({presence:e.children.branding.attached?`visible`:`missing`,surface:e.props.checkoutSession?`checkout`:`payments`,hostOrigin:Va()?.host??window.location.origin})});e.set({walletOwner:s,walletPrime:{type:n.type,prKey:c,chargeKey:a,currency:r.currency,supportsBuyerFee:t.supportsBuyerFee}});return}e.state.walletPrime&&(yo(e.state.walletPrime.prKey),e.set({walletPrime:void 0}))})});function Zd(e){let t={accountId:`biz_demo`,currency:e.currency,paymentMethodConfiguration:$d(e.disabledTypes)};return e.mode===`setup`?{...t,mode:`setup`}:{...t,amount:e.amount,setupFutureUsage:`on_session`}}function Qd(e){let t=Zl(Zd(e));return t.mode===`setup`?$l(t):Ql(t)}function $d(e){return{disabled:e.split(`,`).map(e=>e.trim()).filter(Boolean)}}function ef(){return[[`visa`,`Visa`],[`mastercard`,`Mastercard`],[`amex`,`American Express`],[`discover`,`Discover`]].map(([e,t])=>({brand:e,display_name:t,icons:tf(e)}))}function tf(e){let t=`https://content.whop.com/payment_methods/${e}/icons`,n=(e,n,r)=>({svg:`${t}/${e}_${n}.svg`,png_1x:`${t}/${e}_${n}_${r[0]}.png`,png_2x:`${t}/${e}_${n}_${r[1]}.png`,png_4x:`${t}/${e}_${n}_${r[2]}.png`});return{square:{light:n(`square`,`light`,[32,64,128]),dark:n(`square`,`dark`,[32,64,128])},card:{light:n(`card`,`light`,[30,60,120]),dark:n(`card`,`dark`,[30,60,120])}}}function nf(e,t,n,r){let i=r?.category??`redirect`;return{object:`payment_method_type`,type:e,category:i,display_name:t,icons:r?.iconName===null?null:tf(r?.iconName??e.replace(/_/g,`-`)),usage:{one_time:!0,off_session:!1,on_session:!0},currencies:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,{min_amount:r?.minAmount??null,max_amount:null,countries:t.map(e=>({country:e,min_amount:null,max_amount:null}))}])),detail:r?.detail??{template:`redirect`,icon:`redirect`,short_name:t},required_fields:r?.requiredFields??null,...r?.config?{[i]:r.config}:{}}}export{Ki as A,mo as C,yo as D,to as E,Li as F,Ni as I,Pr as L,qi as M,Hi as N,ro as O,Bi as P,Ra as S,vo as T,$a as _,td as a,Qa as b,Fl as c,Qo as d,Ko as f,So as g,ko as h,Sd as i,Ui as j,no as k,oc as l,Jo as m,Xd as n,Su as o,qo as p,Rd as r,Du as s,Yd as t,ts as u,lo as v,_o as w,Ha as x,co as y};
13//# debugId=ad27fbcf-bf04-5866-a8ba-7051d5a783fe

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.