@busha/ramp-web-sdk
Version:
Official Busha Ramp Web SDK for integrating cryptocurrency on-ramp functionality into web applications
36 lines (30 loc) • 39.9 kB
JavaScript
(function(S,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(S=typeof globalThis<"u"?globalThis:S||self,g(S.BushaRampWebSDK={}))})(this,function(S){"use strict";var xt=Object.defineProperty;var gt=(S,g,k)=>g in S?xt(S,g,{enumerable:!0,configurable:!0,writable:!0,value:k}):S[g]=k;var Z=(S,g,k)=>gt(S,typeof g!="symbol"?g+"":g,k);const g="busha-ramp-container",k="busha-ramp-loader",J="busha-ramp-styles",Q="busha-ramp-close-btn",V="busha-ramp-iframe",Se="busha-ramp-form",Oe="INITIALIZED",ae="CANCELLED",Te="COMPLETED";function ke(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var W,ue;function Ce(){if(ue)return W;ue=1;function r(c){this._maxSize=c,this.clear()}r.prototype.clear=function(){this._size=0,this._values=Object.create(null)},r.prototype.get=function(c){return this._values[c]},r.prototype.set=function(c,p){return this._size>=this._maxSize&&this.clear(),c in this._values||this._size++,this._values[c]=p};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,n=/^\d/,s=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,a=512,u=new r(a),o=new r(a),d=new r(a);W={Cache:r,split:f,normalizePath:l,setter:function(c){var p=l(c);return o.get(c)||o.set(c,function(D,y){for(var E=0,A=p.length,N=D;E<A-1;){var P=p[E];if(P==="__proto__"||P==="constructor"||P==="prototype")return D;N=N[p[E++]]}N[p[E]]=y})},getter:function(c,p){var v=l(c);return d.get(c)||d.set(c,function(y){for(var E=0,A=v.length;E<A;)if(y!=null||!p)y=y[v[E++]];else return;return y})},join:function(c){return c.reduce(function(p,v){return p+(m(v)||t.test(v)?"["+v+"]":(p?".":"")+v)},"")},forEach:function(c,p,v){h(Array.isArray(c)?c:f(c),p,v)}};function l(c){return u.get(c)||u.set(c,f(c).map(function(p){return p.replace(i,"$2")}))}function f(c){return c.match(e)||[""]}function h(c,p,v){var D=c.length,y,E,A,N;for(E=0;E<D;E++)y=c[E],y&&($(y)&&(y='"'+y+'"'),N=m(y),A=!N&&/^\d+$/.test(y),p.call(v,y,N,A,E,c))}function m(c){return typeof c=="string"&&c&&["'",'"'].indexOf(c.charAt(0))!==-1}function w(c){return c.match(n)&&!c.match(t)}function x(c){return s.test(c)}function $(c){return!m(c)&&(w(c)||x(c))}return W}var U=Ce(),ee,oe;function De(){if(oe)return ee;oe=1;const r=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=l=>l.match(r)||[],t=l=>l[0].toUpperCase()+l.slice(1),n=(l,f)=>e(l).join(f).toLowerCase(),s=l=>e(l).reduce((f,h)=>`${f}${f?h[0].toUpperCase()+h.slice(1).toLowerCase():h.toLowerCase()}`,"");return ee={words:e,upperFirst:t,camelCase:s,pascalCase:l=>t(s(l)),snakeCase:l=>n(l,"_"),kebabCase:l=>n(l,"-"),sentenceCase:l=>t(n(l," ")),titleCase:l=>e(l).map(t).join(" ")},ee}var te=De(),B={exports:{}},le;function Ae(){if(le)return B.exports;le=1,B.exports=function(s){return r(e(s),s)},B.exports.array=r;function r(s,i){var a=s.length,u=new Array(a),o={},d=a,l=t(i),f=n(s);for(i.forEach(function(m){if(!f.has(m[0])||!f.has(m[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)o[d]||h(s[d],d,new Set);return u;function h(m,w,x){if(x.has(m)){var $;try{$=", node was:"+JSON.stringify(m)}catch{$=""}throw new Error("Cyclic dependency"+$)}if(!f.has(m))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(m));if(!o[w]){o[w]=!0;var c=l.get(m)||new Set;if(c=Array.from(c),w=c.length){x.add(m);do{var p=c[--w];h(p,f.get(p),x)}while(w);x.delete(m)}u[--a]=m}}}function e(s){for(var i=new Set,a=0,u=s.length;a<u;a++){var o=s[a];i.add(o[0]),i.add(o[1])}return Array.from(i)}function t(s){for(var i=new Map,a=0,u=s.length;a<u;a++){var o=s[a];i.has(o[0])||i.set(o[0],new Set),i.has(o[1])||i.set(o[1],new Set),i.get(o[0]).add(o[1])}return i}function n(s){for(var i=new Map,a=0,u=s.length;a<u;a++)i.set(s[a],a);return i}return B.exports}var Ie=Ae();const je=ke(Ie),Ne=Object.prototype.toString,Pe=Error.prototype.toString,Ue=RegExp.prototype.toString,Me=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Re=/^Symbol\((.*)\)(.*)$/;function ze(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function ce(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return ze(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Me.call(r).replace(Re,"Symbol($1)");const n=Ne.call(r).slice(8,-1);return n==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):n==="Error"||r instanceof Error?"["+Pe.call(r)+"]":n==="RegExp"?Ue.call(r):null}function I(r,e){let t=ce(r,e);return t!==null?t:JSON.stringify(r,function(n,s){let i=ce(this[n],e);return i!==null?i:s},2)}function fe(r){return r==null?[]:[].concat(r)}let de,he,pe,Le=/\$\{\s*(\w+)\s*\}/g;de=Symbol.toStringTag;class me{constructor(e,t,n,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[de]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=s,this.errors=[],this.inner=[],fe(e).forEach(i=>{if(_.isError(i)){this.errors.push(...i.errors);const a=i.inner.length?i.inner:[i];this.inner.push(...a)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}he=Symbol.hasInstance,pe=Symbol.toStringTag;class _ extends Error{static formatError(e,t){const n=t.label||t.path||"this";return t=Object.assign({},t,{path:n,originalPath:t.path}),typeof e=="string"?e.replace(Le,(s,i)=>I(t[i])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,n,s,i){const a=new me(e,t,n,s);if(i)return a;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[pe]="Error",this.name=a.name,this.message=a.message,this.type=a.type,this.value=a.value,this.path=a.path,this.errors=a.errors,this.inner=a.inner,Error.captureStackTrace&&Error.captureStackTrace(this,_)}static[he](e){return me[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let O={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:n})=>{const s=n!=null&&n!==t?` (cast from the value \`${I(n,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${I(t,!0)}\``+s:`${r} must match the configured type. The validated value was: \`${I(t,!0)}\``+s}},F={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},qe={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ne={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ve={isValue:"${path} field must be ${value}"},Y={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:O,string:F,number:qe,date:ne,object:Y,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:Ve,tuple:{notType:r=>{const{path:e,value:t,spec:n}=r,s=n.types.length;if(Array.isArray(t)){if(t.length<s)return`${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${I(t,!0)}\``;if(t.length>s)return`${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${I(t,!0)}\``}return _.formatError(O.notType,r)}}});const re=r=>r&&r.__isYupSchema__;class G{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:s,otherwise:i}=t,a=typeof n=="function"?n:(...u)=>u.every(o=>o===n);return new G(e,(u,o)=>{var d;let l=a(...u)?s:i;return(d=l==null?void 0:l(o))!=null?d:o})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(i=>i.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),s=this.fn(n,e,t);if(s===void 0||s===e)return e;if(!re(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const K={context:"$",value:"."};class M{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===K.context,this.isValue=this.key[0]===K.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?K.context:this.isValue?K.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&U.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let s=this.isContext?n:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}M.prototype.__isYupRef=!0;const R=r=>r==null;function L(r){function e({value:t,path:n="",options:s,originalValue:i,schema:a},u,o){const{name:d,test:l,params:f,message:h,skipAbsent:m}=r;let{parent:w,context:x,abortEarly:$=a.spec.abortEarly,disableStackTrace:c=a.spec.disableStackTrace}=s;function p(b){return M.isRef(b)?b.getValue(t,w,x):b}function v(b={}){const z=Object.assign({value:t,originalValue:i,label:a.spec.label,path:b.path||n,spec:a.spec,disableStackTrace:b.disableStackTrace||c},f,b.params);for(const $e of Object.keys(z))z[$e]=p(z[$e]);const Fe=new _(_.formatError(b.message||h,z),t,z.path,b.type||d,z.disableStackTrace);return Fe.params=z,Fe}const D=$?u:o;let y={path:n,parent:w,type:d,from:s.from,createError:v,resolve:p,options:s,originalValue:i,schema:a};const E=b=>{_.isError(b)?D(b):b?o(null):D(v())},A=b=>{_.isError(b)?D(b):u(b)};if(m&&R(t))return E(!0);let P;try{var _e;if(P=l.call(y,t,y),typeof((_e=P)==null?void 0:_e.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${y.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(P).then(E,A)}}catch(b){A(b);return}E(P)}return e.OPTIONS=r,e}function Ze(r,e,t,n=t){let s,i,a;return e?(U.forEach(e,(u,o,d)=>{let l=o?u.slice(1,u.length-1):u;r=r.resolve({context:n,parent:s,value:t});let f=r.type==="tuple",h=d?parseInt(l,10):0;if(r.innerType||f){if(f&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);if(t&&h>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${u}, in the path: ${e}. because there is no value at that index. `);s=t,t=t&&t[h],r=f?r.spec.types[h]:r.innerType}if(!d){if(!r.fields||!r.fields[l])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${r.type}")`);s=t,t=t&&t[l],r=r.fields[l]}i=l,a=o?"["+u+"]":"."+u}),{schema:r,parent:s,parentPath:i}):{parent:s,parentPath:e,schema:r}}class H extends Set{describe(){const e=[];for(const t of this.values())e.push(M.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new H(this.values())}merge(e,t){const n=this.clone();return e.forEach(s=>n.add(s)),t.forEach(s=>n.delete(s)),n}}function q(r,e=new Map){if(re(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let n=0;n<r.length;n++)t[n]=q(r[n],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[n,s]of r.entries())t.set(n,q(s,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const n of r)t.add(q(n,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[n,s]of Object.entries(r))t[n]=q(s,e)}else throw Error(`Unable to clone ${r}`);return t}class T{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new H,this._blacklist=new H,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(O.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=q(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const s=Object.assign({},t.spec,n.spec);return n.spec=s,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(i=>{e.tests.forEach(a=>{i.test(a.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((s,i)=>i.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,s,i;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(n=e.abortEarly)!=null?n:this.spec.abortEarly,recursive:(s=e.recursive)!=null?s:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({value:e},t)),s=t.assert==="ignore-optionality",i=n._cast(e,t);if(t.assert!==!1&&!n.isType(i)){if(s&&R(i))return i;let a=I(e),u=I(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
attempted value: ${a}
`+(u!==a?`result of cast: ${u}`:""))}return i}_cast(e,t){let n=e===void 0?e:this.transforms.reduce((s,i)=>i.call(this,s,e,this),e);return n===void 0&&(n=this.getDefault(t)),n}_validate(e,t={},n,s){let{path:i,originalValue:a=e,strict:u=this.spec.strict}=t,o=e;u||(o=this._cast(o,Object.assign({assert:!1},t)));let d=[];for(let l of Object.values(this.internalTests))l&&d.push(l);this.runTests({path:i,value:o,originalValue:a,options:t,tests:d},n,l=>{if(l.length)return s(l,o);this.runTests({path:i,value:o,originalValue:a,options:t,tests:this.tests},n,s)})}runTests(e,t,n){let s=!1,{tests:i,value:a,originalValue:u,path:o,options:d}=e,l=x=>{s||(s=!0,t(x,a))},f=x=>{s||(s=!0,n(x,a))},h=i.length,m=[];if(!h)return f([]);let w={value:a,originalValue:u,path:o,options:d,schema:this};for(let x=0;x<i.length;x++){const $=i[x];$(w,l,function(p){p&&(Array.isArray(p)?m.push(...p):m.push(p)),--h<=0&&f(m)})}}asNestedTest({key:e,index:t,parent:n,parentPath:s,originalParent:i,options:a}){const u=e??t;if(u==null)throw TypeError("Must include `key` or `index` for nested validations");const o=typeof u=="number";let d=n[u];const l=Object.assign({},a,{strict:!0,parent:n,value:d,originalValue:i[u],key:void 0,[o?"index":"key"]:u,path:o||u.includes(".")?`${s||""}[${o?u:`"${u}"`}]`:(s?`${s}.`:"")+e});return(f,h,m)=>this.resolve(l)._validate(d,l,h,m)}validate(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),i=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return new Promise((a,u)=>s._validate(e,t,(o,d)=>{_.isError(o)&&(o.value=d),u(o)},(o,d)=>{o.length?u(new _(o,d,void 0,void 0,i)):a(d)}))}validateSync(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),i,a=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(u,o)=>{throw _.isError(u)&&(u.value=o),u},(u,o)=>{if(u.length)throw new _(u,e,void 0,void 0,a);i=o}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,n=>{if(_.isError(n))return!1;throw n})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(n){if(_.isError(n))return!1;throw n}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):q(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=L({message:t,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=L({message:t,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(e=O.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=O.notNull){return this.nullability(!1,e)}required(e=O.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=O.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),s=L(t),i=t.exclusive||t.name&&n.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(a=>!(a.OPTIONS.name===t.name&&(i||a.OPTIONS.test===s.OPTIONS.test))),n.tests.push(s),n}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let n=this.clone(),s=fe(e).map(i=>new M(i));return s.forEach(i=>{i.isSibling&&n.deps.push(i.key)}),n.conditions.push(typeof t=="function"?new G(s,t):G.fromOptions(s,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=L({message:e,name:"typeError",skipAbsent:!0,test(n){return this.schema._typeCheck(n)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=O.oneOf){let n=this.clone();return e.forEach(s=>{n._whitelist.add(s),n._blacklist.delete(s)}),n.internalTests.whiteList=L({message:t,name:"oneOf",skipAbsent:!0,test(s){let i=this.schema._whitelist,a=i.resolveAll(this.resolve);return a.includes(s)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:a}})}}),n}notOneOf(e,t=O.notOneOf){let n=this.clone();return e.forEach(s=>{n._blacklist.add(s),n._whitelist.delete(s)}),n.internalTests.blacklist=L({message:t,name:"notOneOf",test(s){let i=this.schema._blacklist,a=i.resolveAll(this.resolve);return a.includes(s)?this.createError({params:{values:Array.from(i).join(", "),resolved:a}}):!0}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:s,optional:i,nullable:a}=t.spec;return{meta:s,label:n,optional:i,nullable:a,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(o=>({name:o.OPTIONS.name,params:o.OPTIONS.params})).filter((o,d,l)=>l.findIndex(f=>f.name===o.name)===d)}}}T.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])T.prototype[`${r}At`]=function(e,t,n={}){const{parent:s,parentPath:i,schema:a}=Ze(this,e,t,n.context);return a[r](s&&s[i],Object.assign({},n,{parent:s,path:e}))};for(const r of["equals","is"])T.prototype[r]=T.prototype.oneOf;for(const r of["not","nope"])T.prototype[r]=T.prototype.notOneOf;const Be=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Ye(r){const e=se(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function se(r){var e,t;const n=Be.exec(r);return n?{year:C(n[1]),month:C(n[2],1)-1,day:C(n[3],1),hour:C(n[4]),minute:C(n[5]),second:C(n[6]),millisecond:n[7]?C(n[7].substring(0,3)):0,precision:(e=(t=n[7])==null?void 0:t.length)!=null?e:void 0,z:n[8]||void 0,plusMinus:n[9]||void 0,hourOffset:C(n[10]),minuteOffset:C(n[11])}:null}function C(r,e=0){return Number(r)||e}let Ge=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ke=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,He=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Xe="^\\d{4}-\\d{2}-\\d{2}",Je="\\d{2}:\\d{2}:\\d{2}",Qe="(([+-]\\d{2}(:?\\d{2})?)|Z)",We=new RegExp(`${Xe}T${Je}(\\.\\d+)?${Qe}$`),et=r=>R(r)||r===r.trim(),tt={}.toString();function j(){return new ye}class ye extends T{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,n)=>{if(!n.spec.coerce||n.isType(e)||Array.isArray(e))return e;const s=e!=null&&e.toString?e.toString():e;return s===tt?e:s})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||O.required,name:"required",skipAbsent:!0,test:n=>!!n.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=F.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(n){return n.length===this.resolve(e)}})}min(e,t=F.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(n){return n.length>=this.resolve(e)}})}max(e,t=F.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(n){return n.length<=this.resolve(e)}})}matches(e,t){let n=!1,s,i;return t&&(typeof t=="object"?{excludeEmptyString:n=!1,message:s,name:i}=t:s=t),this.test({name:i||"matches",message:s||F.matches,params:{regex:e},skipAbsent:!0,test:a=>a===""&&n||a.search(e)!==-1})}email(e=F.email){return this.matches(Ge,{name:"email",message:e,excludeEmptyString:!0})}url(e=F.url){return this.matches(Ke,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=F.uuid){return this.matches(He,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",n,s;return e&&(typeof e=="object"?{message:t="",allowOffset:n=!1,precision:s=void 0}=e:t=e),this.matches(We,{name:"datetime",message:t||F.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||F.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:i=>{if(!i||n)return!0;const a=se(i);return a?!!a.z:!1}}).test({name:"datetime_precision",message:t||F.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const a=se(i);return a?a.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=F.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:et})}lowercase(e=F.lowercase){return this.transform(t=>R(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>R(t)||t===t.toLowerCase()})}uppercase(e=F.uppercase){return this.transform(t=>R(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>R(t)||t===t.toUpperCase()})}}j.prototype=ye.prototype;let nt=new Date(""),rt=r=>Object.prototype.toString.call(r)==="[object Date]";class ie extends T{constructor(){super({type:"date",check(e){return rt(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,n)=>!n.spec.coerce||n.isType(e)||e===null?e:(e=Ye(e),isNaN(e)?ie.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(M.isRef(e))n=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=s}return n}min(e,t=ne.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(n)}})}max(e,t=ne.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(n)}})}}ie.INVALID_DATE=nt;function st(r,e=[]){let t=[],n=new Set,s=new Set(e.map(([a,u])=>`${a}-${u}`));function i(a,u){let o=U.split(a)[0];n.add(o),s.has(`${u}-${o}`)||t.push([u,o])}for(const a of Object.keys(r)){let u=r[a];n.add(a),M.isRef(u)&&u.isSibling?i(u.path,a):re(u)&&"deps"in u&&u.deps.forEach(o=>i(o,a))}return je.array(Array.from(n),t).reverse()}function be(r,e){let t=1/0;return r.some((n,s)=>{var i;if((i=e.path)!=null&&i.includes(n))return t=s,!0}),t}function xe(r){return(e,t)=>be(r,e)-be(r,t)}const it=(r,e,t)=>{if(typeof r!="string")return r;let n=r;try{n=JSON.parse(r)}catch{}return t.isType(n)?n:r};function X(r){if("fields"in r){const e={};for(const[t,n]of Object.entries(r.fields))e[t]=X(n);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=X(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(X)}):"optional"in r?r.optional():r}const at=(r,e)=>{const t=[...U.normalizePath(e)];if(t.length===1)return t[0]in r;let n=t.pop(),s=U.getter(U.join(t),!0)(r);return!!(s&&n in s)};let ge=r=>Object.prototype.toString.call(r)==="[object Object]";function Ee(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(n=>t.indexOf(n)===-1)}const ut=xe([]);function we(r){return new ve(r)}class ve extends T{constructor(e){super({type:"object",check(t){return ge(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=ut,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let s=super._cast(e,t);if(s===void 0)return this.getDefault(t);if(!this._typeCheck(s))return s;let i=this.fields,a=(n=t.stripUnknown)!=null?n:this.spec.noUnknown,u=[].concat(this._nodes,Object.keys(s).filter(f=>!this._nodes.includes(f))),o={},d=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),l=!1;for(const f of u){let h=i[f],m=f in s;if(h){let w,x=s[f];d.path=(t.path?`${t.path}.`:"")+f,h=h.resolve({value:x,context:t.context,parent:o});let $=h instanceof T?h.spec:void 0,c=$==null?void 0:$.strict;if($!=null&&$.strip){l=l||f in s;continue}w=!t.__validating||!c?h.cast(s[f],d):s[f],w!==void 0&&(o[f]=w)}else m&&!a&&(o[f]=s[f]);(m!==f in o||o[f]!==s[f])&&(l=!0)}return l?o:s}_validate(e,t={},n,s){let{from:i=[],originalValue:a=e,recursive:u=this.spec.recursive}=t;t.from=[{schema:this,value:a},...i],t.__validating=!0,t.originalValue=a,super._validate(e,t,n,(o,d)=>{if(!u||!ge(d)){s(o,d);return}a=a||d;let l=[];for(let f of this._nodes){let h=this.fields[f];!h||M.isRef(h)||l.push(h.asNestedTest({options:t,key:f,parent:d,parentPath:t.path,originalParent:a}))}this.runTests({tests:l,value:d,originalValue:a,options:t},n,f=>{s(f.sort(this._sortErrors).concat(o),d)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[s,i]of Object.entries(this.fields)){const a=n[s];n[s]=a===void 0?i:a}return t.withMutation(s=>s.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var s;const i=this.fields[n];let a=e;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[n]})),t[n]=i&&"getDefault"in i?i.getDefault(a):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=st(e,t),n._sortErrors=xe(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let s=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),s)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return X(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([n,s])=>e.includes(n)&&e.includes(s)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let s=U.getter(e,!0);return this.transform(i=>{if(!i)return i;let a=i;return at(i,e)&&(a=Object.assign({},i),n||delete a[e],a[t]=s(i)),a})}json(){return this.transform(it)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Y.exact,test(t){if(t==null)return!0;const n=Ee(this.schema,t);return n.length===0||this.createError({params:{properties:n.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Y.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(s){if(s==null)return!0;const i=Ee(this.schema,s);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=Y.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const s of Object.keys(t))n[e(s)]=t[s];return n})}camelCase(){return this.transformKeys(te.camelCase)}snakeCase(){return this.transformKeys(te.snakeCase)}constantCase(){return this.transformKeys(e=>te.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[i,a]of Object.entries(t.fields)){var s;let u=e;(s=u)!=null&&s.value&&(u=Object.assign({},u,{parent:u.value,value:u.value[i]})),n.fields[i]=a.describe(u)}return n}}we.prototype=ve.prototype;const ot="#000639",lt='<svg width="40" height="41" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 10.5C0 4.977 4.477.5 10 .5h20c5.523 0 10 4.477 10 10v20c0 5.523-4.477 10-10 10H10c-5.523 0-10-4.477-10-10v-20Z" fill="#F1F1F1"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.927 15.78a.75.75 0 1 0-1.06-1.06l-4.793 4.793-4.793-4.793a.75.75 0 0 0-1.061 1.06l4.793 4.793-4.793 4.793a.75.75 0 1 0 1.06 1.061l4.794-4.793 4.793 4.793a.75.75 0 0 0 1.06-1.06l-4.793-4.794 4.793-4.793Z" fill="#000639"/></svg>';function ct(){if(document.head.querySelector(`#${J}`))return;const e=document.createElement("style");e.id=J,e.dataset.testid=J,document.head.appendChild(e),e.textContent=`
#${g}, #${g} * {
margin: 0;
padding: 0px;
box-sizing: border-box;
}
#${k} {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#${V} {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 480px;
max-width: 100%;
height: 100dvh;
z-index: 20;
border-radius: 0px;
@media (min-width: 640px) {
height: 680px;
border-radius: 24px;
}
}
`}function ft(r){we({fiatAmount:j().optional(),fiatCurrency:j().optional(),cryptoAmount:j().optional(),cryptoCurrency:j().optional(),publicKey:j().required("Public key is required"),redirectUrl:j().optional(),side:j().oneOf(["buy","sell"]).required()}).validateSync(r,{abortEarly:!1})}function dt(){const r=document.createElement("div");return r.id=g,r.dataset.testid=g,r.style.position="fixed",r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%",r.style.zIndex="999999999",r.style.backgroundColor="rgba(0, 0, 0, 0.4)",r}function ht(){const r=document.createElement("button");return r.id=Q,r.dataset.testid=Q,r.setAttribute("type","button"),r.style.width="40px",r.style.height="40px",r.style.position="absolute",r.style.right="0",r.style.zIndex="40",r.style.backgroundColor="transparent",r.style.border="none",r.innerHTML=lt,r}function pt(){const r=document.createElement("div");return r.id=k,r.dataset.testid=k,r.style.width="40px",r.style.height="40px",r.style.backgroundColor="transparent",r.style.border=`2px solid ${ot}`,r.style.borderLeftColor="transparent",r.style.borderBottomColor="transparent",r.style.borderRadius="100%",r.animate&&r.animate([{transform:"rotate(0)"},{transform:"rotate(360deg)"}],{duration:300,iterations:1/0}),r}function mt(){const r=document.createElement("iframe");return r.dataset.testid=V,r.name=V,r.id=V,r.allow="clipboard-write self undefined",r}function yt(r){const e=(r.side==="buy",void 0),t=document.createElement("form");t.target=V,t.dataset.testid=Se,t.action=e??"",t.method="GET",t.style.display="none",(u=>{const o=process.env.NODE_ENV==="production",d=["onSuccess","onClose"];o&&d.push("side");for(const l in u){if(!Object.prototype.hasOwnProperty.call(u,l)||d.includes(l))continue;const f=u[l],h=document.createElement("input");h.name=l,h.value=String(f),t.appendChild(h)}})(r);const s="POPUP",i=document.createElement("input");i.name="displayMode",i.value=s;const a=document.createElement("input");return a.name="parentOrigin",a.value=window.location.origin,t.appendChild(i),t.appendChild(a),t}class bt{constructor(e){Z(this,"payload");Z(this,"container",null);Z(this,"boundClose");Z(this,"onMessage",e=>{const t=process.env.NODE_ENV==="test",n=(this.payload.side==="buy",void 0);if(t){if(e.source!==window)return}else{if(!n)return;const s=new URL(n);if(e.origin!==s.origin)return}if(this.payload){if(e.data.status===Oe){const s=document.getElementById(k);s&&s.remove()}e.data.status===ae&&(this.payload.onClose&&this.payload.onClose(e.data),this.cleanup()),e.data.status===Te&&(this.payload.onSuccess&&this.payload.onSuccess(e.data),this.cleanup())}});ct(),ft(e),this.payload=e,this.boundClose=this.close.bind(this)}show(){this.container=dt();const e=pt(),t=ht();t.addEventListener("click",this.boundClose),this.container.appendChild(e),this.container.appendChild(t);const n=mt();this.container.appendChild(n),document.body.appendChild(this.container);const s=yt(this.payload);this.container.appendChild(s),s.submit(),window.addEventListener("message",this.onMessage)}close(){this.payload.onClose&&this.payload.onClose({status:ae,data:{reference:""}}),this.cleanup()}cleanup(){const e=document.getElementById(g),t=document.getElementById(Q);t&&t.removeEventListener("click",this.boundClose),window.removeEventListener("message",this.onMessage),e&&document.body.removeChild(e)}}S.BushaRampWidget=bt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});