@busha/ramp-web-sdk 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BushaRampWidget.d.ts +1 -1
- package/dist/index.es.js +14 -14
- package/dist/index.umd.js +4 -4
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
2
|
var $e = (r, e, t) => e in r ? Fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var R = (r, e, t) => $e(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
const
|
|
4
|
+
const V = "busha-ramp-container", X = "busha-ramp-loader", K = "busha-ramp-styles", ee = "busha-ramp-close-btn", z = "busha-ramp-iframe", Oe = "busha-ramp-form";
|
|
5
5
|
const Te = "INITIALIZED", oe = "CANCELLED", ke = "COMPLETED";
|
|
6
6
|
function Ce(r) {
|
|
7
7
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
@@ -104,12 +104,12 @@ function Ae() {
|
|
|
104
104
|
titleCase: (l) => e(l).map(t).join(" ")
|
|
105
105
|
}, Q;
|
|
106
106
|
}
|
|
107
|
-
var W = Ae(),
|
|
107
|
+
var W = Ae(), q = { exports: {} }, fe;
|
|
108
108
|
function Ie() {
|
|
109
|
-
if (fe) return
|
|
110
|
-
fe = 1,
|
|
109
|
+
if (fe) return q.exports;
|
|
110
|
+
fe = 1, q.exports = function(s) {
|
|
111
111
|
return r(e(s), s);
|
|
112
|
-
},
|
|
112
|
+
}, q.exports.array = r;
|
|
113
113
|
function r(s, a) {
|
|
114
114
|
var i = s.length, u = new Array(i), o = {}, d = i, l = t(a), f = n(s);
|
|
115
115
|
for (a.forEach(function(p) {
|
|
@@ -164,7 +164,7 @@ function Ie() {
|
|
|
164
164
|
a.set(s[i], i);
|
|
165
165
|
return a;
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return q.exports;
|
|
168
168
|
}
|
|
169
169
|
var Ue = Ie();
|
|
170
170
|
const je = /* @__PURE__ */ Ce(Ue), Ne = Object.prototype.toString, Le = Error.prototype.toString, Me = RegExp.prototype.toString, Pe = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", Re = /^Symbol\((.*)\)(.*)$/;
|
|
@@ -191,7 +191,7 @@ function I(r, e) {
|
|
|
191
191
|
function be(r) {
|
|
192
192
|
return r == null ? [] : [].concat(r);
|
|
193
193
|
}
|
|
194
|
-
let xe, ge, Ee,
|
|
194
|
+
let xe, ge, Ee, Ve = /\$\{\s*(\w+)\s*\}/g;
|
|
195
195
|
xe = Symbol.toStringTag;
|
|
196
196
|
class he {
|
|
197
197
|
constructor(e, t, n, s) {
|
|
@@ -213,7 +213,7 @@ class S extends Error {
|
|
|
213
213
|
return t = Object.assign({}, t, {
|
|
214
214
|
path: n,
|
|
215
215
|
originalPath: t.path
|
|
216
|
-
}), typeof e == "string" ? e.replace(
|
|
216
|
+
}), typeof e == "string" ? e.replace(Ve, (s, a) => I(t[a])) : typeof e == "function" ? e(t) : e;
|
|
217
217
|
}
|
|
218
218
|
static isError(e) {
|
|
219
219
|
return e && e.name === "ValidationError";
|
|
@@ -258,7 +258,7 @@ let F = {
|
|
|
258
258
|
trim: "${path} must be a trimmed string",
|
|
259
259
|
lowercase: "${path} must be a lowercase string",
|
|
260
260
|
uppercase: "${path} must be a upper case string"
|
|
261
|
-
},
|
|
261
|
+
}, qe = {
|
|
262
262
|
min: "${path} must be greater than or equal to ${min}",
|
|
263
263
|
max: "${path} must be less than or equal to ${max}",
|
|
264
264
|
lessThan: "${path} must be less than ${less}",
|
|
@@ -295,7 +295,7 @@ let F = {
|
|
|
295
295
|
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
296
296
|
mixed: F,
|
|
297
297
|
string: v,
|
|
298
|
-
number:
|
|
298
|
+
number: qe,
|
|
299
299
|
date: te,
|
|
300
300
|
object: B,
|
|
301
301
|
array: Be,
|
|
@@ -1517,7 +1517,7 @@ function ht() {
|
|
|
1517
1517
|
const e = document.createElement("style");
|
|
1518
1518
|
e.id = K, e.dataset.testid = K, document.head.appendChild(e), e.textContent = `
|
|
1519
1519
|
|
|
1520
|
-
#${
|
|
1520
|
+
#${V}, #${V} * {
|
|
1521
1521
|
margin: 0;
|
|
1522
1522
|
padding: 0px;
|
|
1523
1523
|
box-sizing: border-box;
|
|
@@ -1554,14 +1554,14 @@ function pt(r) {
|
|
|
1554
1554
|
fiatCurrency: A().optional(),
|
|
1555
1555
|
cryptoAmount: A().optional(),
|
|
1556
1556
|
cryptoCurrency: A().optional(),
|
|
1557
|
-
publicKey: A().
|
|
1557
|
+
publicKey: A().optional(),
|
|
1558
1558
|
redirectUrl: A().optional(),
|
|
1559
1559
|
side: A().oneOf(["buy", "sell"]).required()
|
|
1560
1560
|
}).validateSync(r, { abortEarly: !1 });
|
|
1561
1561
|
}
|
|
1562
1562
|
function mt() {
|
|
1563
1563
|
const r = document.createElement("div");
|
|
1564
|
-
return r.id =
|
|
1564
|
+
return r.id = V, r.dataset.testid = V, 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;
|
|
1565
1565
|
}
|
|
1566
1566
|
function yt() {
|
|
1567
1567
|
const r = document.createElement("button");
|
|
@@ -1637,7 +1637,7 @@ class _t {
|
|
|
1637
1637
|
}), this.cleanup();
|
|
1638
1638
|
}
|
|
1639
1639
|
cleanup() {
|
|
1640
|
-
const e = document.getElementById(
|
|
1640
|
+
const e = document.getElementById(V), t = document.getElementById(ee);
|
|
1641
1641
|
t && t.removeEventListener("click", this.boundClose), window.removeEventListener("message", this.onMessage), e && document.body.removeChild(e);
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function($,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):($=typeof globalThis<"u"?globalThis:$||self,_($.BushaRampWidget={}))})(this,function($){"use strict";var xt=Object.defineProperty;var gt=($,_,k)=>_ in $?xt($,_,{enumerable:!0,configurable:!0,writable:!0,value:k}):$[_]=k;var B=($,_,k)=>gt($,typeof _!="symbol"?_+"":_,k);const _="busha-ramp-container",k="busha-ramp-loader",J="busha-ramp-styles",Q="busha-ramp-close-btn",V="busha-ramp-iframe",$e="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,m){return this._size>=this._maxSize&&this.clear(),c in this._values||this._size++,this._values[c]=m};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,n=/^\d/,s=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,u=new r(i),o=new r(i),d=new r(i);W={Cache:r,split:f,normalizePath:l,setter:function(c){var m=l(c);return o.get(c)||o.set(c,function(D,x){for(var w=0,A=m.length,j=D;w<A-1;){var N=m[w];if(N==="__proto__"||N==="constructor"||N==="prototype")return D;j=j[m[w++]]}j[m[w]]=x})},getter:function(c,m){var v=l(c);return d.get(c)||d.set(c,function(x){for(var w=0,A=v.length;w<A;)if(x!=null||!m)x=x[v[w++]];else return;return x})},join:function(c){return c.reduce(function(m,v){return m+(p(v)||t.test(v)?"["+v+"]":(m?".":"")+v)},"")},forEach:function(c,m,v){h(Array.isArray(c)?c:f(c),m,v)}};function l(c){return u.get(c)||u.set(c,f(c).map(function(m){return m.replace(a,"$2")}))}function f(c){return c.match(e)||[""]}function h(c,m,v){var D=c.length,x,w,A,j;for(w=0;w<D;w++)x=c[w],x&&(E(x)&&(x='"'+x+'"'),j=p(x),A=!j&&/^\d+$/.test(x),m.call(v,x,j,A,w,c))}function p(c){return typeof c=="string"&&c&&["'",'"'].indexOf(c.charAt(0))!==-1}function y(c){return c.match(n)&&!c.match(t)}function b(c){return s.test(c)}function E(c){return!p(c)&&(y(c)||b(c))}return W}var M=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(),Z={exports:{}},le;function Ae(){if(le)return Z.exports;le=1,Z.exports=function(s){return r(e(s),s)},Z.exports.array=r;function r(s,a){var i=s.length,u=new Array(i),o={},d=i,l=t(a),f=n(s);for(a.forEach(function(p){if(!f.has(p[0])||!f.has(p[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(p,y,b){if(b.has(p)){var E;try{E=", node was:"+JSON.stringify(p)}catch{E=""}throw new Error("Cyclic dependency"+E)}if(!f.has(p))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(p));if(!o[y]){o[y]=!0;var c=l.get(p)||new Set;if(c=Array.from(c),y=c.length){b.add(p);do{var m=c[--y];h(m,f.get(m),b)}while(y);b.delete(p)}u[--i]=p}}}function e(s){for(var a=new Set,i=0,u=s.length;i<u;i++){var o=s[i];a.add(o[0]),a.add(o[1])}return Array.from(a)}function t(s){for(var a=new Map,i=0,u=s.length;i<u;i++){var o=s[i];a.has(o[0])||a.set(o[0],new Set),a.has(o[1])||a.set(o[1],new Set),a.get(o[0]).add(o[1])}return a}function n(s){for(var a=new Map,i=0,u=s.length;i<u;i++)a.set(s[i],i);return a}return Z.exports}var Ie=Ae();const Ue=ke(Ie),je=Object.prototype.toString,Ne=Error.prototype.toString,Me=RegExp.prototype.toString,Pe=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Le=/^Symbol\((.*)\)(.*)$/;function Re(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 Re(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Pe.call(r).replace(Le,"Symbol($1)");const n=je.call(r).slice(8,-1);return n==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):n==="Error"||r instanceof Error?"["+Ne.call(r)+"]":n==="RegExp"?Me.call(r):null}function I(r,e){let t=ce(r,e);return t!==null?t:JSON.stringify(r,function(n,s){let a=ce(this[n],e);return a!==null?a:s},2)}function fe(r){return r==null?[]:[].concat(r)}let de,he,pe,ze=/\$\{\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(a=>{if(S.isError(a)){this.errors.push(...a.errors);const i=a.inner.length?a.inner:[a];this.inner.push(...i)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}he=Symbol.hasInstance,pe=Symbol.toStringTag;class S 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(ze,(s,a)=>I(t[a])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,n,s,a){const i=new me(e,t,n,s);if(a)return i;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=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,S)}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 S.formatError(O.notType,r)}}});const re=r=>r&&r.__isYupSchema__;class X{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:a}=t,i=typeof n=="function"?n:(...u)=>u.every(o=>o===n);return new X(e,(u,o)=>{var d;let l=i(...u)?s:a;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(a=>a.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 G={context:"$",value:"."};class P{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]===G.context,this.isValue=this.key[0]===G.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?G.context:this.isValue?G.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&M.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}}P.prototype.__isYupRef=!0;const L=r=>r==null;function z(r){function e({value:t,path:n="",options:s,originalValue:a,schema:i},u,o){const{name:d,test:l,params:f,message:h,skipAbsent:p}=r;let{parent:y,context:b,abortEarly:E=i.spec.abortEarly,disableStackTrace:c=i.spec.disableStackTrace}=s;function m(g){return P.isRef(g)?g.getValue(t,y,b):g}function v(g={}){const R=Object.assign({value:t,originalValue:a,label:i.spec.label,path:g.path||n,spec:i.spec,disableStackTrace:g.disableStackTrace||c},f,g.params);for(const Fe of Object.keys(R))R[Fe]=m(R[Fe]);const Se=new S(S.formatError(g.message||h,R),t,R.path,g.type||d,R.disableStackTrace);return Se.params=R,Se}const D=E?u:o;let x={path:n,parent:y,type:d,from:s.from,createError:v,resolve:m,options:s,originalValue:a,schema:i};const w=g=>{S.isError(g)?D(g):g?o(null):D(v())},A=g=>{S.isError(g)?D(g):u(g)};if(p&&L(t))return w(!0);let N;try{var ve;if(N=l.call(x,t,x),typeof((ve=N)==null?void 0:ve.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(N).then(w,A)}}catch(g){A(g);return}w(N)}return e.OPTIONS=r,e}function Be(r,e,t,n=t){let s,a,i;return e?(M.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 "${i}" must contain an index to the tuple element, e.g. "${i}[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: ${i} which is a type: "${r.type}")`);s=t,t=t&&t[l],r=r.fields[l]}a=l,i=o?"["+u+"]":"."+u}),{schema:r,parent:s,parentPath:a}):{parent:s,parentPath:e,schema:r}}class H extends Set{describe(){const e=[];for(const t of this.values())e.push(P.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(a=>{e.tests.forEach(i=>{a.test(i.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,a)=>a.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,s,a;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:(a=e.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({value:e},t)),s=t.assert==="ignore-optionality",a=n._cast(e,t);if(t.assert!==!1&&!n.isType(a)){if(s&&L(a))return a;let i=I(e),u=I(a);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
1
|
+
(function($,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):($=typeof globalThis<"u"?globalThis:$||self,_($.BushaRampWidget={}))})(this,function($){"use strict";var xt=Object.defineProperty;var gt=($,_,k)=>_ in $?xt($,_,{enumerable:!0,configurable:!0,writable:!0,value:k}):$[_]=k;var B=($,_,k)=>gt($,typeof _!="symbol"?_+"":_,k);const _="busha-ramp-container",k="busha-ramp-loader",J="busha-ramp-styles",W="busha-ramp-close-btn",q="busha-ramp-iframe",$e="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 Q,ue;function Ce(){if(ue)return Q;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,m){return this._size>=this._maxSize&&this.clear(),c in this._values||this._size++,this._values[c]=m};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,n=/^\d/,s=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,u=new r(i),o=new r(i),d=new r(i);Q={Cache:r,split:f,normalizePath:l,setter:function(c){var m=l(c);return o.get(c)||o.set(c,function(D,x){for(var w=0,A=m.length,j=D;w<A-1;){var N=m[w];if(N==="__proto__"||N==="constructor"||N==="prototype")return D;j=j[m[w++]]}j[m[w]]=x})},getter:function(c,m){var v=l(c);return d.get(c)||d.set(c,function(x){for(var w=0,A=v.length;w<A;)if(x!=null||!m)x=x[v[w++]];else return;return x})},join:function(c){return c.reduce(function(m,v){return m+(p(v)||t.test(v)?"["+v+"]":(m?".":"")+v)},"")},forEach:function(c,m,v){h(Array.isArray(c)?c:f(c),m,v)}};function l(c){return u.get(c)||u.set(c,f(c).map(function(m){return m.replace(a,"$2")}))}function f(c){return c.match(e)||[""]}function h(c,m,v){var D=c.length,x,w,A,j;for(w=0;w<D;w++)x=c[w],x&&(E(x)&&(x='"'+x+'"'),j=p(x),A=!j&&/^\d+$/.test(x),m.call(v,x,j,A,w,c))}function p(c){return typeof c=="string"&&c&&["'",'"'].indexOf(c.charAt(0))!==-1}function y(c){return c.match(n)&&!c.match(t)}function b(c){return s.test(c)}function E(c){return!p(c)&&(y(c)||b(c))}return Q}var M=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(),Z={exports:{}},le;function Ae(){if(le)return Z.exports;le=1,Z.exports=function(s){return r(e(s),s)},Z.exports.array=r;function r(s,a){var i=s.length,u=new Array(i),o={},d=i,l=t(a),f=n(s);for(a.forEach(function(p){if(!f.has(p[0])||!f.has(p[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(p,y,b){if(b.has(p)){var E;try{E=", node was:"+JSON.stringify(p)}catch{E=""}throw new Error("Cyclic dependency"+E)}if(!f.has(p))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(p));if(!o[y]){o[y]=!0;var c=l.get(p)||new Set;if(c=Array.from(c),y=c.length){b.add(p);do{var m=c[--y];h(m,f.get(m),b)}while(y);b.delete(p)}u[--i]=p}}}function e(s){for(var a=new Set,i=0,u=s.length;i<u;i++){var o=s[i];a.add(o[0]),a.add(o[1])}return Array.from(a)}function t(s){for(var a=new Map,i=0,u=s.length;i<u;i++){var o=s[i];a.has(o[0])||a.set(o[0],new Set),a.has(o[1])||a.set(o[1],new Set),a.get(o[0]).add(o[1])}return a}function n(s){for(var a=new Map,i=0,u=s.length;i<u;i++)a.set(s[i],i);return a}return Z.exports}var Ie=Ae();const Ue=ke(Ie),je=Object.prototype.toString,Ne=Error.prototype.toString,Me=RegExp.prototype.toString,Le=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Pe=/^Symbol\((.*)\)(.*)$/;function Re(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 Re(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Le.call(r).replace(Pe,"Symbol($1)");const n=je.call(r).slice(8,-1);return n==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):n==="Error"||r instanceof Error?"["+Ne.call(r)+"]":n==="RegExp"?Me.call(r):null}function I(r,e){let t=ce(r,e);return t!==null?t:JSON.stringify(r,function(n,s){let a=ce(this[n],e);return a!==null?a:s},2)}function fe(r){return r==null?[]:[].concat(r)}let de,he,pe,ze=/\$\{\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(a=>{if(S.isError(a)){this.errors.push(...a.errors);const i=a.inner.length?a.inner:[a];this.inner.push(...i)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}he=Symbol.hasInstance,pe=Symbol.toStringTag;class S 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(ze,(s,a)=>I(t[a])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,n,s,a){const i=new me(e,t,n,s);if(a)return i;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=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,S)}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"},Ve={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}"},qe={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:Ve,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:qe,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 S.formatError(O.notType,r)}}});const re=r=>r&&r.__isYupSchema__;class X{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:a}=t,i=typeof n=="function"?n:(...u)=>u.every(o=>o===n);return new X(e,(u,o)=>{var d;let l=i(...u)?s:a;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(a=>a.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 G={context:"$",value:"."};class L{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]===G.context,this.isValue=this.key[0]===G.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?G.context:this.isValue?G.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&M.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}}L.prototype.__isYupRef=!0;const P=r=>r==null;function z(r){function e({value:t,path:n="",options:s,originalValue:a,schema:i},u,o){const{name:d,test:l,params:f,message:h,skipAbsent:p}=r;let{parent:y,context:b,abortEarly:E=i.spec.abortEarly,disableStackTrace:c=i.spec.disableStackTrace}=s;function m(g){return L.isRef(g)?g.getValue(t,y,b):g}function v(g={}){const R=Object.assign({value:t,originalValue:a,label:i.spec.label,path:g.path||n,spec:i.spec,disableStackTrace:g.disableStackTrace||c},f,g.params);for(const Fe of Object.keys(R))R[Fe]=m(R[Fe]);const Se=new S(S.formatError(g.message||h,R),t,R.path,g.type||d,R.disableStackTrace);return Se.params=R,Se}const D=E?u:o;let x={path:n,parent:y,type:d,from:s.from,createError:v,resolve:m,options:s,originalValue:a,schema:i};const w=g=>{S.isError(g)?D(g):g?o(null):D(v())},A=g=>{S.isError(g)?D(g):u(g)};if(p&&P(t))return w(!0);let N;try{var ve;if(N=l.call(x,t,x),typeof((ve=N)==null?void 0:ve.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(N).then(w,A)}}catch(g){A(g);return}w(N)}return e.OPTIONS=r,e}function Be(r,e,t,n=t){let s,a,i;return e?(M.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 "${i}" must contain an index to the tuple element, e.g. "${i}[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: ${i} which is a type: "${r.type}")`);s=t,t=t&&t[l],r=r.fields[l]}a=l,i=o?"["+u+"]":"."+u}),{schema:r,parent:s,parentPath:a}):{parent:s,parentPath:e,schema:r}}class H extends Set{describe(){const e=[];for(const t of this.values())e.push(L.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 V(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]=V(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,V(s,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const n of r)t.add(V(n,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[n,s]of Object.entries(r))t[n]=V(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=V(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(a=>{e.tests.forEach(i=>{a.test(i.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,a)=>a.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,s,a;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:(a=e.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({value:e},t)),s=t.assert==="ignore-optionality",a=n._cast(e,t);if(t.assert!==!1&&!n.isType(a)){if(s&&P(a))return a;let i=I(e),u=I(a);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
2
2
|
|
|
3
3
|
attempted value: ${i}
|
|
4
|
-
`+(u!==i?`result of cast: ${u}`:""))}return a}_cast(e,t){let n=e===void 0?e:this.transforms.reduce((s,a)=>a.call(this,s,e,this),e);return n===void 0&&(n=this.getDefault(t)),n}_validate(e,t={},n,s){let{path:a,originalValue:i=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:a,value:o,originalValue:i,options:t,tests:d},n,l=>{if(l.length)return s(l,o);this.runTests({path:a,value:o,originalValue:i,options:t,tests:this.tests},n,s)})}runTests(e,t,n){let s=!1,{tests:a,value:i,originalValue:u,path:o,options:d}=e,l=b=>{s||(s=!0,t(b,i))},f=b=>{s||(s=!0,n(b,i))},h=a.length,p=[];if(!h)return f([]);let y={value:i,originalValue:u,path:o,options:d,schema:this};for(let b=0;b<a.length;b++){const E=a[b];E(y,l,function(m){m&&(Array.isArray(m)?p.push(...m):p.push(m)),--h<=0&&f(p)})}}asNestedTest({key:e,index:t,parent:n,parentPath:s,originalParent:a,options:i}){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({},i,{strict:!0,parent:n,value:d,originalValue:a[u],key:void 0,[o?"index":"key"]:u,path:o||u.includes(".")?`${s||""}[${o?u:`"${u}"`}]`:(s?`${s}.`:"")+e});return(f,h,p)=>this.resolve(l)._validate(d,l,h,p)}validate(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),a=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return new Promise((i,u)=>s._validate(e,t,(o,d)=>{S.isError(o)&&(o.value=d),u(o)},(o,d)=>{o.length?u(new S(o,d,void 0,void 0,a)):i(d)}))}validateSync(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),a,i=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(u,o)=>{throw S.isError(u)&&(u.value=o),u},(u,o)=>{if(u.length)throw new S(u,e,void 0,void 0,i);a=o}),a}isValid(e,t){return this.validate(e,t).then(()=>!0,n=>{if(S.isError(n))return!1;throw n})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(n){if(S.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=z({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=z({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=z(t),a=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(i=>!(i.OPTIONS.name===t.name&&(a||i.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(a=>new P(a));return s.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof t=="function"?new X(s,t):X.fromOptions(s,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=z({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=z({message:t,name:"oneOf",skipAbsent:!0,test(s){let a=this.schema._whitelist,i=a.resolveAll(this.resolve);return i.includes(s)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:i}})}}),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=z({message:t,name:"notOneOf",test(s){let a=this.schema._blacklist,i=a.resolveAll(this.resolve);return i.includes(s)?this.createError({params:{values:Array.from(a).join(", "),resolved:i}}):!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:a,nullable:i}=t.spec;return{meta:s,label:n,optional:a,nullable:i,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:a,schema:i}=Be(this,e,t,n.context);return i[r](s&&s[a],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 Ze=/^(\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=Ze.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 Xe=/^[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])?)*$/,Ge=/^((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,Ke="^\\d{4}-\\d{2}-\\d{2}",Je="\\d{2}:\\d{2}:\\d{2}",Qe="(([+-]\\d{2}(:?\\d{2})?)|Z)",We=new RegExp(`${Ke}T${Je}(\\.\\d+)?${Qe}$`),et=r=>L(r)||r===r.trim(),tt={}.toString();function U(){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,a;return t&&(typeof t=="object"?{excludeEmptyString:n=!1,message:s,name:a}=t:s=t),this.test({name:a||"matches",message:s||F.matches,params:{regex:e},skipAbsent:!0,test:i=>i===""&&n||i.search(e)!==-1})}email(e=F.email){return this.matches(Xe,{name:"email",message:e,excludeEmptyString:!0})}url(e=F.url){return this.matches(Ge,{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:a=>{if(!a||n)return!0;const i=se(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:t||F.datetime_precision,params:{precision:s},skipAbsent:!0,test:a=>{if(!a||s==null)return!0;const i=se(a);return i?i.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=>L(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>L(t)||t===t.toLowerCase()})}uppercase(e=F.uppercase){return this.transform(t=>L(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>L(t)||t===t.toUpperCase()})}}U.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(P.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(([i,u])=>`${i}-${u}`));function a(i,u){let o=M.split(i)[0];n.add(o),s.has(`${u}-${o}`)||t.push([u,o])}for(const i of Object.keys(r)){let u=r[i];n.add(i),P.isRef(u)&&u.isSibling?a(u.path,i):re(u)&&"deps"in u&&u.deps.forEach(o=>a(o,i))}return Ue.array(Array.from(n),t).reverse()}function be(r,e){let t=1/0;return r.some((n,s)=>{var a;if((a=e.path)!=null&&a.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 K(r){if("fields"in r){const e={};for(const[t,n]of Object.entries(r.fields))e[t]=K(n);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=K(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(K)}):"optional"in r?r.optional():r}const at=(r,e)=>{const t=[...M.normalizePath(e)];if(t.length===1)return t[0]in r;let n=t.pop(),s=M.getter(M.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 _e(r){return new we(r)}class we 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 a=this.fields,i=(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=a[f],p=f in s;if(h){let y,b=s[f];d.path=(t.path?`${t.path}.`:"")+f,h=h.resolve({value:b,context:t.context,parent:o});let E=h instanceof T?h.spec:void 0,c=E==null?void 0:E.strict;if(E!=null&&E.strip){l=l||f in s;continue}y=!t.__validating||!c?h.cast(s[f],d):s[f],y!==void 0&&(o[f]=y)}else p&&!i&&(o[f]=s[f]);(p!==f in o||o[f]!==s[f])&&(l=!0)}return l?o:s}_validate(e,t={},n,s){let{from:a=[],originalValue:i=e,recursive:u=this.spec.recursive}=t;t.from=[{schema:this,value:i},...a],t.__validating=!0,t.originalValue=i,super._validate(e,t,n,(o,d)=>{if(!u||!ge(d)){s(o,d);return}i=i||d;let l=[];for(let f of this._nodes){let h=this.fields[f];!h||P.isRef(h)||l.push(h.asNestedTest({options:t,key:f,parent:d,parentPath:t.path,originalParent:i}))}this.runTests({tests:l,value:d,originalValue:i,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,a]of Object.entries(this.fields)){const i=n[s];n[s]=i===void 0?a:i}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 a=this.fields[n];let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[n]})),t[n]=a&&"getDefault"in a?a.getDefault(i):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 K(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=M.getter(e,!0);return this.transform(a=>{if(!a)return a;let i=a;return at(a,e)&&(i=Object.assign({},a),n||delete i[e],i[t]=s(a)),i})}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 a=Ee(this.schema,s);return!e||a.length===0||this.createError({params:{unknown:a.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[a,i]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[a]})),n.fields[a]=i.describe(u)}return n}}_e.prototype=we.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=`
|
|
4
|
+
`+(u!==i?`result of cast: ${u}`:""))}return a}_cast(e,t){let n=e===void 0?e:this.transforms.reduce((s,a)=>a.call(this,s,e,this),e);return n===void 0&&(n=this.getDefault(t)),n}_validate(e,t={},n,s){let{path:a,originalValue:i=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:a,value:o,originalValue:i,options:t,tests:d},n,l=>{if(l.length)return s(l,o);this.runTests({path:a,value:o,originalValue:i,options:t,tests:this.tests},n,s)})}runTests(e,t,n){let s=!1,{tests:a,value:i,originalValue:u,path:o,options:d}=e,l=b=>{s||(s=!0,t(b,i))},f=b=>{s||(s=!0,n(b,i))},h=a.length,p=[];if(!h)return f([]);let y={value:i,originalValue:u,path:o,options:d,schema:this};for(let b=0;b<a.length;b++){const E=a[b];E(y,l,function(m){m&&(Array.isArray(m)?p.push(...m):p.push(m)),--h<=0&&f(p)})}}asNestedTest({key:e,index:t,parent:n,parentPath:s,originalParent:a,options:i}){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({},i,{strict:!0,parent:n,value:d,originalValue:a[u],key:void 0,[o?"index":"key"]:u,path:o||u.includes(".")?`${s||""}[${o?u:`"${u}"`}]`:(s?`${s}.`:"")+e});return(f,h,p)=>this.resolve(l)._validate(d,l,h,p)}validate(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),a=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return new Promise((i,u)=>s._validate(e,t,(o,d)=>{S.isError(o)&&(o.value=d),u(o)},(o,d)=>{o.length?u(new S(o,d,void 0,void 0,a)):i(d)}))}validateSync(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),a,i=(n=t==null?void 0:t.disableStackTrace)!=null?n:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(u,o)=>{throw S.isError(u)&&(u.value=o),u},(u,o)=>{if(u.length)throw new S(u,e,void 0,void 0,i);a=o}),a}isValid(e,t){return this.validate(e,t).then(()=>!0,n=>{if(S.isError(n))return!1;throw n})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(n){if(S.isError(n))return!1;throw n}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):V(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=z({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=z({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=z(t),a=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(i=>!(i.OPTIONS.name===t.name&&(a||i.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(a=>new L(a));return s.forEach(a=>{a.isSibling&&n.deps.push(a.key)}),n.conditions.push(typeof t=="function"?new X(s,t):X.fromOptions(s,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=z({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=z({message:t,name:"oneOf",skipAbsent:!0,test(s){let a=this.schema._whitelist,i=a.resolveAll(this.resolve);return i.includes(s)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:i}})}}),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=z({message:t,name:"notOneOf",test(s){let a=this.schema._blacklist,i=a.resolveAll(this.resolve);return i.includes(s)?this.createError({params:{values:Array.from(a).join(", "),resolved:i}}):!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:a,nullable:i}=t.spec;return{meta:s,label:n,optional:a,nullable:i,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:a,schema:i}=Be(this,e,t,n.context);return i[r](s&&s[a],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 Ze=/^(\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=Ze.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 Xe=/^[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])?)*$/,Ge=/^((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,Ke="^\\d{4}-\\d{2}-\\d{2}",Je="\\d{2}:\\d{2}:\\d{2}",We="(([+-]\\d{2}(:?\\d{2})?)|Z)",Qe=new RegExp(`${Ke}T${Je}(\\.\\d+)?${We}$`),et=r=>P(r)||r===r.trim(),tt={}.toString();function U(){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,a;return t&&(typeof t=="object"?{excludeEmptyString:n=!1,message:s,name:a}=t:s=t),this.test({name:a||"matches",message:s||F.matches,params:{regex:e},skipAbsent:!0,test:i=>i===""&&n||i.search(e)!==-1})}email(e=F.email){return this.matches(Xe,{name:"email",message:e,excludeEmptyString:!0})}url(e=F.url){return this.matches(Ge,{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(Qe,{name:"datetime",message:t||F.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||F.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:a=>{if(!a||n)return!0;const i=se(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:t||F.datetime_precision,params:{precision:s},skipAbsent:!0,test:a=>{if(!a||s==null)return!0;const i=se(a);return i?i.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=>P(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>P(t)||t===t.toLowerCase()})}uppercase(e=F.uppercase){return this.transform(t=>P(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>P(t)||t===t.toUpperCase()})}}U.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(L.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(([i,u])=>`${i}-${u}`));function a(i,u){let o=M.split(i)[0];n.add(o),s.has(`${u}-${o}`)||t.push([u,o])}for(const i of Object.keys(r)){let u=r[i];n.add(i),L.isRef(u)&&u.isSibling?a(u.path,i):re(u)&&"deps"in u&&u.deps.forEach(o=>a(o,i))}return Ue.array(Array.from(n),t).reverse()}function be(r,e){let t=1/0;return r.some((n,s)=>{var a;if((a=e.path)!=null&&a.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 K(r){if("fields"in r){const e={};for(const[t,n]of Object.entries(r.fields))e[t]=K(n);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=K(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(K)}):"optional"in r?r.optional():r}const at=(r,e)=>{const t=[...M.normalizePath(e)];if(t.length===1)return t[0]in r;let n=t.pop(),s=M.getter(M.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 _e(r){return new we(r)}class we 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 a=this.fields,i=(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=a[f],p=f in s;if(h){let y,b=s[f];d.path=(t.path?`${t.path}.`:"")+f,h=h.resolve({value:b,context:t.context,parent:o});let E=h instanceof T?h.spec:void 0,c=E==null?void 0:E.strict;if(E!=null&&E.strip){l=l||f in s;continue}y=!t.__validating||!c?h.cast(s[f],d):s[f],y!==void 0&&(o[f]=y)}else p&&!i&&(o[f]=s[f]);(p!==f in o||o[f]!==s[f])&&(l=!0)}return l?o:s}_validate(e,t={},n,s){let{from:a=[],originalValue:i=e,recursive:u=this.spec.recursive}=t;t.from=[{schema:this,value:i},...a],t.__validating=!0,t.originalValue=i,super._validate(e,t,n,(o,d)=>{if(!u||!ge(d)){s(o,d);return}i=i||d;let l=[];for(let f of this._nodes){let h=this.fields[f];!h||L.isRef(h)||l.push(h.asNestedTest({options:t,key:f,parent:d,parentPath:t.path,originalParent:i}))}this.runTests({tests:l,value:d,originalValue:i,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,a]of Object.entries(this.fields)){const i=n[s];n[s]=i===void 0?a:i}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 a=this.fields[n];let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[n]})),t[n]=a&&"getDefault"in a?a.getDefault(i):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 K(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=M.getter(e,!0);return this.transform(a=>{if(!a)return a;let i=a;return at(a,e)&&(i=Object.assign({},a),n||delete i[e],i[t]=s(a)),i})}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 a=Ee(this.schema,s);return!e||a.length===0||this.createError({params:{unknown:a.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[a,i]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[a]})),n.fields[a]=i.describe(u)}return n}}_e.prototype=we.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=`
|
|
5
5
|
|
|
6
6
|
#${_}, #${_} * {
|
|
7
7
|
margin: 0;
|
|
@@ -16,7 +16,7 @@ attempted value: ${i}
|
|
|
16
16
|
transform: translate(-50%, -50%);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
#${
|
|
19
|
+
#${q} {
|
|
20
20
|
position: absolute;
|
|
21
21
|
top: 50%;
|
|
22
22
|
left: 50%;
|
|
@@ -32,4 +32,4 @@ attempted value: ${i}
|
|
|
32
32
|
border-radius: 24px;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
`}function ft(r){_e({fiatAmount:U().optional(),fiatCurrency:U().optional(),cryptoAmount:U().optional(),cryptoCurrency:U().optional(),publicKey:U().
|
|
35
|
+
`}function ft(r){_e({fiatAmount:U().optional(),fiatCurrency:U().optional(),cryptoAmount:U().optional(),cryptoCurrency:U().optional(),publicKey:U().optional(),redirectUrl:U().optional(),side:U().oneOf(["buy","sell"]).required()}).validateSync(r,{abortEarly:!1})}function dt(){const r=document.createElement("div");return r.id=_,r.dataset.testid=_,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=W,r.dataset.testid=W,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=q,r.name=q,r.id=q,r.allow="clipboard-write self undefined",r}function yt({sandbox:r,...e}){const t=r??!1,a=e.side==="buy"?void 0:void 0,i=document.createElement("form");i.target=q,i.dataset.testid=$e,i.action=a??"",i.method="GET",i.style.display="none",(f=>{const h=process.env.NODE_ENV==="production",p=["onSuccess","onClose"];h&&p.push("side");for(const y in f){if(!Object.prototype.hasOwnProperty.call(f,y)||p.includes(y))continue;const b=f[y],E=document.createElement("input");E.name=y,E.value=String(b),i.appendChild(E)}})(e);const o="POPUP",d=document.createElement("input");d.name="displayMode",d.value=o;const l=document.createElement("input");return l.name="parentOrigin",l.value=window.location.origin,i.appendChild(d),i.appendChild(l),i}class bt{constructor(e){B(this,"payload");B(this,"container",null);B(this,"boundClose");B(this,"onMessage",e=>{const t=process.env.NODE_ENV==="test",n=this.payload.sandboxMode??!1,i=this.payload.side==="buy"?void 0:void 0;if(t){if(e.source!==window)return}else{if(!i)return;const u=new URL(i);if(e.origin!==u.origin)return}if(this.payload){if(e.data.status===Oe){const u=document.getElementById(k);u&&u.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(_),t=document.getElementById(W);t&&t.removeEventListener("click",this.boundClose),window.removeEventListener("message",this.onMessage),e&&document.body.removeChild(e)}}$.BushaRampWidget=bt,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED