UNPKG

@exerp/odin-dropin

Version:
2 lines 350 kB
(function(Wt,Bt){typeof exports=="object"&&typeof module<"u"?Bt(exports):typeof define=="function"&&define.amd?define(["exports"],Bt):(Wt=typeof globalThis<"u"?globalThis:Wt||self,Bt(Wt.OdinDropin={}))})(this,function(Wt){"use strict";var cT=Object.defineProperty;var fT=(Wt,Bt,In)=>Bt in Wt?cT(Wt,Bt,{enumerable:!0,configurable:!0,writable:!0,value:In}):Wt[Bt]=In;var He=(Wt,Bt,In)=>fT(Wt,typeof Bt!="symbol"?Bt+"":Bt,In);const Bt="exerp-odin-dropin-core",In={hydratedSelectorName:"hydrated",lazyLoad:!1,updatable:!0};var Kg=Object.defineProperty,Hg=(e,n)=>{for(var r in n)Kg(e,r,{get:n[r],enumerable:!0})},Wg=(e,n)=>{var r;const a=n.$cmpMeta$;Object.entries((r=a.$members$)!=null?r:{}).map(([u,[c]])=>{if(c&31||c&32){const f=e[u],d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),u);Object.defineProperty(e,u,{get(){return d.get.call(this)},set(h){d.set.call(this,h)},configurable:!0,enumerable:!0}),e[u]=n.$instanceValues$.has(u)?n.$instanceValues$.get(u):f}})},Er=e=>{if(e.__stencil__getHostRef)return e.__stencil__getHostRef()},Jg=(e,n)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:n,$instanceValues$:new Map};r.$onReadyPromise$=new Promise(o=>r.$onReadyResolve$=o),e["s-p"]=[],e["s-rc"]=[];const a=r;return e.__stencil__getHostRef=()=>a,Wg(e,r),a},$f=(e,n)=>n in e,Na=(e,n)=>(0,console.error)(e,n),Pa=new Map,Yg="sty-id",Zg="slot-fb{display:contents}slot-fb[hidden]{display:none}",bn=typeof window<"u"?window:{},Xg=bn.HTMLElement||class{},wr={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,n,r,a)=>e.addEventListener(n,r,a),rel:(e,n,r,a)=>e.removeEventListener(n,r,a),ce:(e,n)=>new CustomEvent(e,n)},Qg=e=>Promise.resolve(e),bf=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),Bo=!1,Ef=[],wf=[],ey=(e,n)=>r=>{e.push(r),Bo||(Bo=!0,wr.raf(Af))},Sf=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(r){Na(r)}e.length=0},Af=()=>{Sf(Ef),Sf(wf),(Bo=Ef.length>0)&&wr.raf(Af)},jo=e=>Qg().then(e),ty=ey(wf),zo=e=>(e=typeof e,e==="object"||e==="function");function ny(e){var n,r,a;return(a=(r=(n=e.head)==null?void 0:n.querySelector('meta[name="csp-nonce"]'))==null?void 0:r.getAttribute("content"))!=null?a:void 0}var ry=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),iy={};Hg(iy,{err:()=>Of,map:()=>ay,ok:()=>Go,unwrap:()=>sy,unwrapErr:()=>oy});var Go=e=>({isOk:!0,isErr:!1,value:e}),Of=e=>({isOk:!1,isErr:!0,value:e});function ay(e,n){if(e.isOk){const r=n(e.value);return r instanceof Promise?r.then(a=>Go(a)):Go(r)}if(e.isErr){const r=e.value;return Of(r)}throw"should never get here"}var sy=e=>{if(e.isOk)return e.value;throw e.value},oy=e=>{if(e.isErr)return e.value;throw e.value},Sr=(e,n="")=>()=>{},De=(e,n,...r)=>{let a=null,o=null,u=!1,c=!1;const f=[],d=m=>{for(let _=0;_<m.length;_++)a=m[_],Array.isArray(a)?d(a):a!=null&&typeof a!="boolean"&&((u=typeof e!="function"&&!zo(a))&&(a=String(a)),u&&c?f[f.length-1].$text$+=a:f.push(u?Vo(null,a):a),c=u)};if(d(r),n){n.key&&(o=n.key);{const m=n.className||n.class;m&&(n.class=typeof m!="object"?m:Object.keys(m).filter(_=>m[_]).join(" "))}}const h=Vo(e,null);return h.$attrs$=n,f.length>0&&(h.$children$=f),h.$key$=o,h},Vo=(e,n)=>{const r={$flags$:0,$tag$:e,$text$:n,$elm$:null,$children$:null};return r.$attrs$=null,r.$key$=null,r},uy={},ly=e=>e&&e.$tag$===uy,qo=e=>{const n=ry(e);return new RegExp(`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${n}))(${n}\\b)`,"g")};qo("::slotted"),qo(":host"),qo(":host-context");var Cf=(e,n)=>e!=null&&!zo(e)&&n&1?String(e):e,cy=e=>e,Tf=(e,n,r)=>{const a=cy(e);return{emit:o=>If(a,n,{bubbles:!0,composed:!0,cancelable:!0,detail:o})}},If=(e,n,r)=>{const a=wr.ce(n,r);return e.dispatchEvent(a),a},Xr=new WeakMap,fy=(e,n,r)=>{let a=Pa.get(e);bf&&r?(a=a||new CSSStyleSheet,typeof a=="string"?a=n:a.replaceSync(n)):a=n,Pa.set(e,a)},dy=(e,n,r)=>{var a;const o=Nf(n),u=Pa.get(o);if(!bn.document)return o;if(e=e.nodeType===11?e:bn.document,u)if(typeof u=="string"){e=e.head||e;let c=Xr.get(e),f;if(c||Xr.set(e,c=new Set),!c.has(o)){{f=document.querySelector(`[${Yg}="${o}"]`)||bn.document.createElement("style"),f.innerHTML=u;const d=(a=wr.$nonce$)!=null?a:ny(bn.document);if(d!=null&&f.setAttribute("nonce",d),!(n.$flags$&1))if(e.nodeName==="HEAD"){const h=e.querySelectorAll("link[rel=preconnect]"),m=h.length>0?h[h.length-1].nextSibling:e.querySelector("style");e.insertBefore(f,(m==null?void 0:m.parentNode)===e?m:null)}else if("host"in e)if(bf){const h=new CSSStyleSheet;h.replaceSync(u),e.adoptedStyleSheets=[h,...e.adoptedStyleSheets]}else{const h=e.querySelector("style");h?h.innerHTML=u+h.innerHTML:e.prepend(f)}else e.append(f);n.$flags$&1&&e.insertBefore(f,null)}n.$flags$&4&&(f.innerHTML+=Zg),c&&c.add(o)}}else e.adoptedStyleSheets.includes(u)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,u]);return o},hy=e=>{const n=e.$cmpMeta$,r=e.$hostElement$,a=Sr("attachStyles",n.$tagName$);dy(r.getRootNode(),n),a()},Nf=(e,n)=>"sc-"+e.$tagName$,Pf=(e,n,r,a,o,u,c)=>{if(r===a)return;let f=$f(e,n),d=n.toLowerCase();if(n==="class"){const h=e.classList,m=Rf(r);let _=Rf(a);h.remove(...m.filter(b=>b&&!_.includes(b))),h.add(..._.filter(b=>b&&!m.includes(b)))}else if(n==="style"){for(const h in r)(!a||a[h]==null)&&(h.includes("-")?e.style.removeProperty(h):e.style[h]="");for(const h in a)(!r||a[h]!==r[h])&&(h.includes("-")?e.style.setProperty(h,a[h]):e.style[h]=a[h])}else if(n!=="key")if(!e.__lookupSetter__(n)&&n[0]==="o"&&n[1]==="n"){if(n[2]==="-"?n=n.slice(3):$f(bn,d)?n=d.slice(2):n=d[2]+n.slice(3),r||a){const h=n.endsWith(Df);n=n.replace(my,""),r&&wr.rel(e,n,r,h),a&&wr.ael(e,n,a,h)}}else{const h=zo(a);if(f||h&&a!==null)try{if(e.tagName.includes("-"))e[n]!==a&&(e[n]=a);else{const m=a??"";n==="list"?f=!1:(r==null||e[n]!=m)&&(typeof e.__lookupSetter__(n)=="function"?e[n]=m:e.setAttribute(n,m))}}catch{}a==null||a===!1?(a!==!1||e.getAttribute(n)==="")&&e.removeAttribute(n):(!f||u&4||o)&&!h&&e.nodeType===1&&(a=a===!0?"":a,e.setAttribute(n,a))}},py=/\s/,Rf=e=>(typeof e=="object"&&e&&"baseVal"in e&&(e=e.baseVal),!e||typeof e!="string"?[]:e.split(py)),Df="Capture",my=new RegExp(Df+"$"),Ff=(e,n,r,a)=>{const o=n.$elm$.nodeType===11&&n.$elm$.host?n.$elm$.host:n.$elm$,u=e&&e.$attrs$||{},c=n.$attrs$||{};for(const f of Lf(Object.keys(u)))f in c||Pf(o,f,u[f],void 0,r,n.$flags$);for(const f of Lf(Object.keys(c)))Pf(o,f,u[f],c[f],r,n.$flags$)};function Lf(e){return e.includes("ref")?[...e.filter(n=>n!=="ref"),"ref"]:e}var kf,Mf=!1,Ra=(e,n,r)=>{const a=n.$children$[r];let o=0,u,c;if(a.$text$!==null)u=a.$elm$=bn.document.createTextNode(a.$text$);else{if(!bn.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(u=a.$elm$=bn.document.createElement(a.$tag$),Ff(null,a,Mf),a.$children$)for(o=0;o<a.$children$.length;++o)c=Ra(e,a,o),c&&u.appendChild(c)}return u["s-hn"]=kf,u},xf=(e,n,r,a,o,u)=>{let c=e,f;for(;o<=u;++o)a[o]&&(f=Ra(null,r,o),f&&(a[o].$elm$=f,Fa(c,f,n)))},Uf=(e,n,r)=>{for(let a=n;a<=r;++a){const o=e[a];if(o){const u=o.$elm$;u&&u.remove()}}},gy=(e,n,r,a,o=!1)=>{let u=0,c=0,f=0,d=0,h=n.length-1,m=n[0],_=n[h],b=a.length-1,w=a[0],A=a[b],N,C;for(;u<=h&&c<=b;)if(m==null)m=n[++u];else if(_==null)_=n[--h];else if(w==null)w=a[++c];else if(A==null)A=a[--b];else if(Da(m,w,o))Qr(m,w,o),m=n[++u],w=a[++c];else if(Da(_,A,o))Qr(_,A,o),_=n[--h],A=a[--b];else if(Da(m,A,o))Qr(m,A,o),Fa(e,m.$elm$,_.$elm$.nextSibling),m=n[++u],A=a[--b];else if(Da(_,w,o))Qr(_,w,o),Fa(e,_.$elm$,m.$elm$),_=n[--h],w=a[++c];else{for(f=-1,d=u;d<=h;++d)if(n[d]&&n[d].$key$!==null&&n[d].$key$===w.$key$){f=d;break}f>=0?(C=n[f],C.$tag$!==w.$tag$?N=Ra(n&&n[c],r,f):(Qr(C,w,o),n[f]=void 0,N=C.$elm$),w=a[++c]):(N=Ra(n&&n[c],r,c),w=a[++c]),N&&Fa(m.$elm$.parentNode,N,m.$elm$)}u>h?xf(e,a[b+1]==null?null:a[b+1].$elm$,r,a,c,b):c>b&&Uf(n,u,h)},Da=(e,n,r=!1)=>e.$tag$===n.$tag$?r?(r&&!e.$key$&&n.$key$&&(e.$key$=n.$key$),!0):e.$key$===n.$key$:!1,Qr=(e,n,r=!1)=>{const a=n.$elm$=e.$elm$,o=e.$children$,u=n.$children$,c=n.$text$;c===null?(Ff(e,n,Mf),o!==null&&u!==null?gy(a,o,n,u,r):u!==null?(e.$text$!==null&&(a.textContent=""),xf(a,null,n,u,0,u.length-1)):!r&&In.updatable&&o!==null&&Uf(o,0,o.length-1)):e.$text$!==c&&(a.data=c)},Fa=(e,n,r)=>e==null?void 0:e.insertBefore(n,r),yy=(e,n,r=!1)=>{const a=e.$hostElement$,o=e.$vnode$||Vo(null,null),c=ly(n)?n:De(null,null,n);if(kf=a.tagName,r&&c.$attrs$)for(const f of Object.keys(c.$attrs$))a.hasAttribute(f)&&!["key","ref","style","class"].includes(f)&&(c.$attrs$[f]=a[f]);c.$tag$=null,c.$flags$|=4,e.$vnode$=c,c.$elm$=o.$elm$=a,Qr(o,c,r)},Bf=(e,n)=>{if(n&&!e.$onRenderResolve$&&n["s-p"]){const r=n["s-p"].push(new Promise(a=>e.$onRenderResolve$=()=>{n["s-p"].splice(r-1,1),a()}))}},Ko=(e,n)=>{if(e.$flags$|=16,e.$flags$&4){e.$flags$|=512;return}return Bf(e,e.$ancestorComponent$),ty(()=>_y(e,n))},_y=(e,n)=>{const r=e.$hostElement$,a=Sr("scheduleUpdate",e.$cmpMeta$.$tagName$),o=r;if(!o)throw new Error(`Can't render component <${r.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let u;return n?u=ei(o,"componentWillLoad",void 0,r):u=ei(o,"componentWillUpdate",void 0,r),u=jf(u,()=>ei(o,"componentWillRender",void 0,r)),a(),jf(u,()=>$y(e,o,n))},jf=(e,n)=>vy(e)?e.then(n).catch(r=>{console.error(r),n()}):n(),vy=e=>e instanceof Promise||e&&e.then&&typeof e.then=="function",$y=async(e,n,r)=>{var a;const o=e.$hostElement$,u=Sr("update",e.$cmpMeta$.$tagName$),c=o["s-rc"];r&&hy(e);const f=Sr("render",e.$cmpMeta$.$tagName$);by(e,n,o,r),c&&(c.map(d=>d()),o["s-rc"]=void 0),f(),u();{const d=(a=o["s-p"])!=null?a:[],h=()=>Ey(e);d.length===0?h():(Promise.all(d).then(h),e.$flags$|=4,d.length=0)}},by=(e,n,r,a)=>{try{n=n.render(),e.$flags$&=-17,e.$flags$|=2,yy(e,n,a)}catch(o){Na(o,e.$hostElement$)}return null},Ey=e=>{const n=e.$cmpMeta$.$tagName$,r=e.$hostElement$,a=Sr("postUpdate",n),o=r,u=e.$ancestorComponent$;ei(o,"componentDidRender",void 0,r),e.$flags$&64?(ei(o,"componentDidUpdate",void 0,r),a()):(e.$flags$|=64,Sy(r),ei(o,"componentDidLoad",void 0,r),a(),e.$onReadyResolve$(r),u||wy()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),e.$flags$&512&&jo(()=>Ko(e,!1)),e.$flags$&=-517},wy=e=>{jo(()=>If(bn,"appload",{detail:{namespace:Bt}}))},ei=(e,n,r,a)=>{if(e&&e[n])try{return e[n](r)}catch(o){Na(o,a)}},Sy=e=>{var n;return e.classList.add((n=In.hydratedSelectorName)!=null?n:"hydrated")},Ay=(e,n)=>Er(e).$instanceValues$.get(n),zf=(e,n,r,a)=>{const o=Er(e),u=e,c=o.$instanceValues$.get(n),f=o.$flags$,d=u;r=Cf(r,a.$members$[n][0]);const h=Number.isNaN(c)&&Number.isNaN(r);if(r!==c&&!h){o.$instanceValues$.set(n,r);{if(a.$watchers$&&f&128){const _=a.$watchers$[n];_&&_.map(b=>{try{d[b](r,c,n)}catch(w){Na(w,u)}})}if((f&18)===2){if(d.componentShouldUpdate&&d.componentShouldUpdate(r,c,n)===!1)return;Ko(o,!1)}}}},Oy=(e,n,r)=>{var a,o;const u=e.prototype;if(n.$members$||n.$watchers$||e.watchers){e.watchers&&!n.$watchers$&&(n.$watchers$=e.watchers);const c=Object.entries((a=n.$members$)!=null?a:{});c.map(([f,[d]])=>{if(d&31||d&32){const{get:h,set:m}=Object.getOwnPropertyDescriptor(u,f)||{};h&&(n.$members$[f][0]|=2048),m&&(n.$members$[f][0]|=4096),Object.defineProperty(u,f,{get(){return h?h.apply(this):Ay(this,f)},configurable:!0,enumerable:!0}),Object.defineProperty(u,f,{set(_){const b=Er(this);if(m){const w=d&32?this[f]:b.$hostElement$[f];typeof w>"u"&&b.$instanceValues$.get(f)?_=b.$instanceValues$.get(f):!b.$instanceValues$.get(f)&&w&&b.$instanceValues$.set(f,w),m.apply(this,[Cf(_,d)]),_=d&32?this[f]:b.$hostElement$[f],zf(this,f,_,n);return}{zf(this,f,_,n);return}}})}});{const f=new Map;u.attributeChangedCallback=function(d,h,m){wr.jmp(()=>{var _;const b=f.get(d);if(!(this.hasOwnProperty(b)&&In.lazyLoad)){if(u.hasOwnProperty(b)&&typeof this[b]=="number"&&this[b]==m)return;if(b==null){const A=Er(this),N=A==null?void 0:A.$flags$;if(N&&!(N&8)&&N&128&&m!==h){const S=this,I=(_=n.$watchers$)==null?void 0:_[d];I==null||I.forEach(k=>{S[k]!=null&&S[k].call(S,m,h,d)})}return}}const w=Object.getOwnPropertyDescriptor(u,b);m=m===null&&typeof this[b]=="boolean"?!1:m,m!==this[b]&&(!w.get||w.set)&&(this[b]=m)})},e.observedAttributes=Array.from(new Set([...Object.keys((o=n.$watchers$)!=null?o:{}),...c.filter(([d,h])=>h[0]&15).map(([d,h])=>{const m=h[1]||d;return f.set(m,d),m})]))}}return e},Gf=async(e,n,r,a)=>{let o;if((n.$flags$&32)===0){n.$flags$|=32;{o=e.constructor;const f=e.localName;customElements.whenDefined(f).then(()=>n.$flags$|=128)}if(o&&o.style){let f;typeof o.style=="string"&&(f=o.style);const d=Nf(r);if(!Pa.has(d)){const h=Sr("registerStyles",r.$tagName$);fy(d,f,!!(r.$flags$&1)),h()}}}const u=n.$ancestorComponent$,c=()=>Ko(n,!0);u&&u["s-rc"]?u["s-rc"].push(c):c()},Cy=(e,n)=>{},Ty=e=>{{const n=Er(e),r=n.$cmpMeta$,a=Sr("connectedCallback",r.$tagName$);if(n.$flags$&1)n!=null&&n.$lazyInstance$||n!=null&&n.$onReadyPromise$&&n.$onReadyPromise$.then(()=>Cy());else{n.$flags$|=1;{let o=e;for(;o=o.parentNode||o.host;)if(o["s-p"]){Bf(n,n.$ancestorComponent$=o);break}}r.$members$&&Object.entries(r.$members$).map(([o,[u]])=>{if(u&31&&e.hasOwnProperty(o)){const c=e[o];delete e[o],e[o]=c}}),In.initializeNextTick?jo(()=>Gf(e,n,r)):Gf(e,n,r)}a()}},Iy=async e=>{Er(e),Xr.has(e)&&Xr.delete(e),e.shadowRoot&&Xr.has(e.shadowRoot)&&Xr.delete(e.shadowRoot)},Ny=(e,n)=>{const r={$flags$:n[0],$tagName$:n[1]};r.$members$=n[2],r.$watchers$=e.$watchers$;const a=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__hasHostListenerAttached:!1,__registerHost(){Jg(this,r)},connectedCallback(){this.__hasHostListenerAttached||(Er(this),this.__hasHostListenerAttached=!0),Ty(this),a&&a.call(this)},disconnectedCallback(){Iy(this),o&&o.call(this)},__attachShadow(){this.shadowRoot=this}}),e.is=r.$tagName$,Oy(e,r)};function tt(e,n,r,a){Object.defineProperty(e,n,{get:r,set:a,enumerable:!0,configurable:!0})}function Jt(e,n){return Object.keys(n).forEach(function(r){r==="default"||r==="__esModule"||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return n[r]}})}),e}var Py={};tt(Py,"basistheory",()=>Zo);const Ry=e=>{const n=document.querySelector(`script[src^="${e}"]`);if(n)return n;const r=document.head||document.body;if(!r)throw new Error("No <head> or <body> elements found in the document.");const a=Object.assign(document.createElement("script"),{src:e});return r.append(a),a},Ho="Tried to load BasisTheoryElements in a non-DOM environment.",Dy="Basis Theory Elements did not load properly. Check network tab for more details.",Wo="Unable to load the Elements script. This may be due to network restrictions or browser extensions like ad blockers interfering with script loading. Check browser settings or network connection and try again.",Vf="https://undefined",Xn=(()=>{const e="pubb96b84a13912504f4354f2d794ea4fab";let n=!0;const r=async(o,u,c={})=>{if(!n)return;let f;Vf.includes("localhost")?f="local":Vf.includes("dev")?f="dev":f="prod";const d={level:u,message:o,service:"web-elements-loader",env:f,referrer:document==null?void 0:document.referrer,origin:window==null?void 0:window.location.origin,url:window==null?void 0:window.location.href,userAgent:navigator==null?void 0:navigator.userAgent,...c};try{await fetch(`https://http-intake.logs.datadoghq.com/v1/input/${e}`,{method:"POST",body:JSON.stringify(d),headers:{"Content-Type":"application/json"}})}catch{console.warn("There was an error sending telemetry.")}};return{setTelemetryEnabled:o=>{n=o},log:{error:(o,u={})=>r(o,"error",u),info:(o,u={})=>r(o,"info",u),warn:(o,u={})=>r(o,"warn",u)}}})();let Jo;const qf=(e,n)=>new Promise((r,a)=>{let o=Ry(e),u=!1;o.addEventListener("load",()=>{window.BasisTheoryElements?r(window.BasisTheoryElements):((async()=>await Xn.log.error("Elements not found on window on load",{logType:"elementsNotFoundOnWindow",logOrigin:"loadScript",retryCount:n}))(),a(new Error(Dy)))}),o.addEventListener("error",async c=>{if(!u){u=!0,await Xn.log.error("Elements script onError event",{logType:"elementsScriptOnError",logOrigin:"loadScript",retryCount:n,event:{message:c==null?void 0:c.message,source:c==null?void 0:c.filename,lineno:c==null?void 0:c.lineno,colno:c==null?void 0:c.colno,error:c==null?void 0:c.error,target:c==null?void 0:c.target}});try{o==null||o.remove()}catch(f){await Xn.log.error(`Error removing script from DOM on retry attempt ${n}`,{logType:"scriptRemovalError",logOrigin:"loadScript",retryCount:n,removalError:f})}if(n===0){qf(e,n+1).then(r).catch(a);return}try{const f=await fetch(e);f.ok?(await Xn.log.error("Second attempt to load elements script failed, fetch success",{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:n,fetchResult:"success",fetchResponse:f}),a(new Error(Wo))):(await Xn.log.error(`Second attempt to load elements script failed, fetch failed with status: ${f.status}.`,{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:n,fetchResult:"error",fetchResponse:f}),a(new Error(Ho)))}catch(f){await Xn.log.error("Second attempt failed to load elements script failed, fetch network error.",{logType:"elementsScriptFetchError",logOrigin:"loadScript",retryCount:n,fetchResult:"error",fetchError:f}),a(new Error(Wo))}a((c==null?void 0:c.error)||(c==null?void 0:c.message)||new Error(Wo))}})}),Fy=e=>(Jo||(Jo=new Promise((n,r)=>{if(typeof window!="object"){(async()=>(await Xn.log.warn(Ho,{logType:"elementsNonDomError",logOrigin:"loadElements"}),r(new Error(Ho))))();return}if(window.BasisTheoryElements){n(window.BasisTheoryElements);return}let a="https://undefined/elements";if(typeof e<"u")try{a=new URL(e).toString().replace(/\/$/u,"")}catch{throw(async()=>await Xn.log.warn("Invalid format for the given Elements client url.",{logType:"invalidClientUrlError",logOrigin:"loadElements"}))(),new Error("Invalid format for the given Elements client url.")}qf(a,0).then(n).catch(o=>{r(o)})})),Jo);var Yo={};Yo={version:"1.8.0"};const Ly="js.flock-dev.com",ky="js.basistheory.com",Zo=async(e,n)=>{if(!e||e.length===0)throw new Error("API key is required");const r=n!=null&&n._devMode?Ly:ky;return(await Fy(`https://${r}/web-elements/${Yo.version}/client/index.js`)).init(e,`https://${r}/web-elements/${Yo.version}/hosted-elements/`,!1,(n==null?void 0:n.disableTelemetry)??!1,(n==null?void 0:n.useSameOriginApi)??!1)};var My={},Qn={},Nt={};tt(Nt,"VISA",()=>Kf),tt(Nt,"MASTERCARD",()=>Hf),tt(Nt,"AMERICAN_EXPRESS",()=>Wf),tt(Nt,"DINERS_CLUB",()=>Jf),tt(Nt,"DISCOVER",()=>Yf),tt(Nt,"JCB",()=>Zf),tt(Nt,"UNION_PAY",()=>Xf),tt(Nt,"MAESTRO",()=>Qf),tt(Nt,"ELO",()=>ed),tt(Nt,"MIR",()=>td),tt(Nt,"HIPER",()=>nd),tt(Nt,"HIPERCARD",()=>rd),tt(Nt,"DEFAULT_CARD_TYPES",()=>xy);const Kf={niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},Hf={niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},Wf={niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},Jf={niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},Yf={niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},Zf={niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},Xf={niceType:"UnionPay",type:"unionpay",patterns:[620,[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[62207,62209],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},Qf={niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},ed={niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},td={niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},nd={niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},rd={niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},xy=[Kf,Hf,Wf,Jf,Yf,Zf,Xf,Qf,ed,td,nd,rd];var Uy={},By={},id={};tt(id,"ELEMENTS_TYPES",()=>jy);const jy=["card","cardExpirationDate","cardNumber","cardVerificationCode","data","text"];var ki={},zy={},Gy={},Vy={},qy={};Jt(ki,zy),Jt(ki,Gy),Jt(ki,Vy),Jt(ki,qy);var Ky={},Ar={};tt(Ar,"SAFE_CSS_PROPERTIES",()=>ad),tt(Ar,"SAFE_CSS_PROPERTIES_ALTERNATES",()=>sd),tt(Ar,"SAFE_CSS_PROPERTIES_WITH_ALTERNATES",()=>Hy),tt(Ar,"CARD_ELEMENT_STYLE_VARIANT_SELECTORS",()=>Wy),tt(Ar,"CARD_ELEMENT_STYLE_VARIANTS",()=>Jy),tt(Ar,"CARD_ELEMENT_STYLE_FONTS_ATTR",()=>Yy);const ad=["backgroundColor","color","fontFamily","fontSize","fontSmooth","fontStyle","fontVariant","fontWeight","lineHeight","letterSpacing","textAlign","padding","textDecoration","textShadow","textTransform"],sd={fontSmooth:["-webkit-font-smoothing","-moz-osx-font-smoothing"]},Hy=Object.keys(sd),Wy=[":hover",":focus",":read-only","::placeholder","::selection",":disabled"],Jy=["base","complete","invalid","empty"],Yy="fonts";Jt(Qn,Nt),Jt(Qn,Uy),Jt(Qn,By),Jt(Qn,id),Jt(Qn,ki),Jt(Qn,Ky),Jt(Qn,Ar),Jt(My,Qn),typeof window<"u"&&document.currentScript&&!window.basistheory&&(window.basistheory=Zo);const Xo=Object.freeze({BANK_ACCOUNT:"BANK_ACCOUNT",CREDIT_CARD:"CREDIT_CARD",DEBIT_CARD:"DEBIT_CARD"}),od=Object.freeze({CHECKING:"CHECKING",SAVINGS:"SAVINGS"}),Yt=Object.freeze({US:"US",CA:"CA"}),Nn=Object.freeze({VISA:"Visa",MASTERCARD:"Mastercard",AMERICAN_EXPRESS:"American Express",DINERS_CLUB:"Diners Club",DISCOVER:"Discover",JCB:"JCB",UNION_PAY:"UnionPay",MAESTRO:"Maestro",DEBIT:"Debit"});async function Zy(e,n="",r={}){const a=new Headers;a.append("Authorization",e);const o=await fetch(n,{method:"PUT",headers:a,referrerPolicy:"strict-origin-when-cross-origin",body:JSON.stringify(r)});if(!o.ok){let u=await o.json();throw u.statusCode||(u={...u,statusCode:o.status}),u}return o.json()}const Xy=(e,n)=>{const r=e,a=n;return{putPaymentMethod:async o=>Zy(a,`${r}/payment-methods`,{...o})}},La=async e=>{try{return[await e,null]}catch(n){return[null,n]}};var St=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Or(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Qy(e){if(e.__esModule)return e;var n=e.default;if(typeof n=="function"){var r=function a(){return this instanceof a?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};r.prototype=n.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return e[a]}})}),r}var Qo={exports:{}},ud={},Pn={},Cr={},eu={},tu={},nu={},ld;function ka(){return ld||(ld=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class n{}e._CodeOrName=n,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends n{constructor(I){if(super(),!e.IDENTIFIER.test(I))throw new Error("CodeGen: name must be a valid identifier");this.str=I}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class a extends n{constructor(I){super(),this._items=typeof I=="string"?[I]:I}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const I=this._items[0];return I===""||I==='""'}get str(){var I;return(I=this._str)!==null&&I!==void 0?I:this._str=this._items.reduce((k,z)=>`${k}${z}`,"")}get names(){var I;return(I=this._names)!==null&&I!==void 0?I:this._names=this._items.reduce((k,z)=>(z instanceof r&&(k[z.str]=(k[z.str]||0)+1),k),{})}}e._Code=a,e.nil=new a("");function o(S,...I){const k=[S[0]];let z=0;for(;z<I.length;)f(k,I[z]),k.push(S[++z]);return new a(k)}e._=o;const u=new a("+");function c(S,...I){const k=[w(S[0])];let z=0;for(;z<I.length;)k.push(u),f(k,I[z]),k.push(u,w(S[++z]));return d(k),new a(k)}e.str=c;function f(S,I){I instanceof a?S.push(...I._items):I instanceof r?S.push(I):S.push(_(I))}e.addCodeArg=f;function d(S){let I=1;for(;I<S.length-1;){if(S[I]===u){const k=h(S[I-1],S[I+1]);if(k!==void 0){S.splice(I-1,3,k);continue}S[I++]="+"}I++}}function h(S,I){if(I==='""')return S;if(S==='""')return I;if(typeof S=="string")return I instanceof r||S[S.length-1]!=='"'?void 0:typeof I!="string"?`${S.slice(0,-1)}${I}"`:I[0]==='"'?S.slice(0,-1)+I.slice(1):void 0;if(typeof I=="string"&&I[0]==='"'&&!(S instanceof r))return`"${S}${I.slice(1)}`}function m(S,I){return I.emptyStr()?S:S.emptyStr()?I:c`${S}${I}`}e.strConcat=m;function _(S){return typeof S=="number"||typeof S=="boolean"||S===null?S:w(Array.isArray(S)?S.join(","):S)}function b(S){return new a(w(S))}e.stringify=b;function w(S){return JSON.stringify(S).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function A(S){return typeof S=="string"&&e.IDENTIFIER.test(S)?new a(`.${S}`):o`[${S}]`}e.getProperty=A;function N(S){if(typeof S=="string"&&e.IDENTIFIER.test(S))return new a(`${S}`);throw new Error(`CodeGen: invalid export name: ${S}, use explicit $id name mapping`)}e.getEsmExportName=N;function C(S){return new a(S.toString())}e.regexpCode=C}(nu)),nu}var ru={},cd;function fd(){return cd||(cd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const n=ka();class r extends Error{constructor(h){super(`CodeGen: "code" for ${h} not defined`),this.value=h.value}}var a;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(a||(e.UsedValueState=a={})),e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class o{constructor({prefixes:h,parent:m}={}){this._names={},this._prefixes=h,this._parent=m}toName(h){return h instanceof n.Name?h:this.name(h)}name(h){return new n.Name(this._newName(h))}_newName(h){const m=this._names[h]||this._nameGroup(h);return`${h}${m.index++}`}_nameGroup(h){var m,_;if(!((_=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||_===void 0)&&_.has(h)||this._prefixes&&!this._prefixes.has(h))throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);return this._names[h]={prefix:h,index:0}}}e.Scope=o;class u extends n.Name{constructor(h,m){super(m),this.prefix=h}setValue(h,{property:m,itemIndex:_}){this.value=h,this.scopePath=(0,n._)`.${new n.Name(m)}[${_}]`}}e.ValueScopeName=u;const c=(0,n._)`\n`;class f extends o{constructor(h){super(h),this._values={},this._scope=h.scope,this.opts={...h,_n:h.lines?c:n.nil}}get(){return this._scope}name(h){return new u(h,this._newName(h))}value(h,m){var _;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(h),{prefix:w}=b,A=(_=m.key)!==null&&_!==void 0?_:m.ref;let N=this._values[w];if(N){const I=N.get(A);if(I)return I}else N=this._values[w]=new Map;N.set(A,b);const C=this._scope[w]||(this._scope[w]=[]),S=C.length;return C[S]=m.ref,b.setValue(m,{property:w,itemIndex:S}),b}getValue(h,m){const _=this._values[h];if(_)return _.get(m)}scopeRefs(h,m=this._values){return this._reduceValues(m,_=>{if(_.scopePath===void 0)throw new Error(`CodeGen: name "${_}" has no value`);return(0,n._)`${h}${_.scopePath}`})}scopeCode(h=this._values,m,_){return this._reduceValues(h,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},m,_)}_reduceValues(h,m,_={},b){let w=n.nil;for(const A in h){const N=h[A];if(!N)continue;const C=_[A]=_[A]||new Map;N.forEach(S=>{if(C.has(S))return;C.set(S,a.Started);let I=m(S);if(I){const k=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,n._)`${w}${k} ${S} = ${I};${this.opts._n}`}else if(I=b==null?void 0:b(S))w=(0,n._)`${w}${I}${this.opts._n}`;else throw new r(S);C.set(S,a.Completed)})}return w}}e.ValueScope=f}(ru)),ru}var dd;function Oe(){return dd||(dd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const n=ka(),r=fd();var a=ka();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var o=fd();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class u{optimizeNodes(){return this}optimizeNames(v,O){return this}}class c extends u{constructor(v,O,j){super(),this.varKind=v,this.name=O,this.rhs=j}render({es5:v,_n:O}){const j=v?r.varKinds.var:this.varKind,ie=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${ie};`+O}optimizeNames(v,O){if(v[this.name.str])return this.rhs&&(this.rhs=le(this.rhs,v,O)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class f extends u{constructor(v,O,j){super(),this.lhs=v,this.rhs=O,this.sideEffects=j}render({_n:v}){return`${this.lhs} = ${this.rhs};`+v}optimizeNames(v,O){if(!(this.lhs instanceof n.Name&&!v[this.lhs.str]&&!this.sideEffects))return this.rhs=le(this.rhs,v,O),this}get names(){const v=this.lhs instanceof n.Name?{}:{...this.lhs.names};return fe(v,this.rhs)}}class d extends f{constructor(v,O,j,ie){super(v,j,ie),this.op=O}render({_n:v}){return`${this.lhs} ${this.op}= ${this.rhs};`+v}}class h extends u{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`${this.label}:`+v}}class m extends u{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`break${this.label?` ${this.label}`:""};`+v}}class _ extends u{constructor(v){super(),this.error=v}render({_n:v}){return`throw ${this.error};`+v}get names(){return this.error.names}}class b extends u{constructor(v){super(),this.code=v}render({_n:v}){return`${this.code};`+v}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(v,O){return this.code=le(this.code,v,O),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class w extends u{constructor(v=[]){super(),this.nodes=v}render(v){return this.nodes.reduce((O,j)=>O+j.render(v),"")}optimizeNodes(){const{nodes:v}=this;let O=v.length;for(;O--;){const j=v[O].optimizeNodes();Array.isArray(j)?v.splice(O,1,...j):j?v[O]=j:v.splice(O,1)}return v.length>0?this:void 0}optimizeNames(v,O){const{nodes:j}=this;let ie=j.length;for(;ie--;){const ne=j[ie];ne.optimizeNames(v,O)||(Ye(v,ne.names),j.splice(ie,1))}return j.length>0?this:void 0}get names(){return this.nodes.reduce((v,O)=>se(v,O.names),{})}}class A extends w{render(v){return"{"+v._n+super.render(v)+"}"+v._n}}class N extends w{}class C extends A{}C.kind="else";class S extends A{constructor(v,O){super(O),this.condition=v}render(v){let O=`if(${this.condition})`+super.render(v);return this.else&&(O+="else "+this.else.render(v)),O}optimizeNodes(){super.optimizeNodes();const v=this.condition;if(v===!0)return this.nodes;let O=this.else;if(O){const j=O.optimizeNodes();O=this.else=Array.isArray(j)?new C(j):j}if(O)return v===!1?O instanceof S?O:O.nodes:this.nodes.length?this:new S(yt(v),O instanceof S?[O]:O.nodes);if(!(v===!1||!this.nodes.length))return this}optimizeNames(v,O){var j;if(this.else=(j=this.else)===null||j===void 0?void 0:j.optimizeNames(v,O),!!(super.optimizeNames(v,O)||this.else))return this.condition=le(this.condition,v,O),this}get names(){const v=super.names;return fe(v,this.condition),this.else&&se(v,this.else.names),v}}S.kind="if";class I extends A{}I.kind="for";class k extends I{constructor(v){super(),this.iteration=v}render(v){return`for(${this.iteration})`+super.render(v)}optimizeNames(v,O){if(super.optimizeNames(v,O))return this.iteration=le(this.iteration,v,O),this}get names(){return se(super.names,this.iteration.names)}}class z extends I{constructor(v,O,j,ie){super(),this.varKind=v,this.name=O,this.from=j,this.to=ie}render(v){const O=v.es5?r.varKinds.var:this.varKind,{name:j,from:ie,to:ne}=this;return`for(${O} ${j}=${ie}; ${j}<${ne}; ${j}++)`+super.render(v)}get names(){const v=fe(super.names,this.from);return fe(v,this.to)}}class H extends I{constructor(v,O,j,ie){super(),this.loop=v,this.varKind=O,this.name=j,this.iterable=ie}render(v){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(v)}optimizeNames(v,O){if(super.optimizeNames(v,O))return this.iterable=le(this.iterable,v,O),this}get names(){return se(super.names,this.iterable.names)}}class ee extends A{constructor(v,O,j){super(),this.name=v,this.args=O,this.async=j}render(v){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(v)}}ee.kind="func";class ue extends w{render(v){return"return "+super.render(v)}}ue.kind="return";class _e extends A{render(v){let O="try"+super.render(v);return this.catch&&(O+=this.catch.render(v)),this.finally&&(O+=this.finally.render(v)),O}optimizeNodes(){var v,O;return super.optimizeNodes(),(v=this.catch)===null||v===void 0||v.optimizeNodes(),(O=this.finally)===null||O===void 0||O.optimizeNodes(),this}optimizeNames(v,O){var j,ie;return super.optimizeNames(v,O),(j=this.catch)===null||j===void 0||j.optimizeNames(v,O),(ie=this.finally)===null||ie===void 0||ie.optimizeNames(v,O),this}get names(){const v=super.names;return this.catch&&se(v,this.catch.names),this.finally&&se(v,this.finally.names),v}}class Ee extends A{constructor(v){super(),this.error=v}render(v){return`catch(${this.error})`+super.render(v)}}Ee.kind="catch";class Fe extends A{render(v){return"finally"+super.render(v)}}Fe.kind="finally";class Z{constructor(v,O={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...O,_n:O.lines?` `:""},this._extScope=v,this._scope=new r.Scope({parent:v}),this._nodes=[new N]}toString(){return this._root.render(this.opts)}name(v){return this._scope.name(v)}scopeName(v){return this._extScope.name(v)}scopeValue(v,O){const j=this._extScope.value(v,O);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(v,O){return this._extScope.getValue(v,O)}scopeRefs(v){return this._extScope.scopeRefs(v,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(v,O,j,ie){const ne=this._scope.toName(O);return j!==void 0&&ie&&(this._constants[ne.str]=j),this._leafNode(new c(v,ne,j)),ne}const(v,O,j){return this._def(r.varKinds.const,v,O,j)}let(v,O,j){return this._def(r.varKinds.let,v,O,j)}var(v,O,j){return this._def(r.varKinds.var,v,O,j)}assign(v,O,j){return this._leafNode(new f(v,O,j))}add(v,O){return this._leafNode(new d(v,e.operators.ADD,O))}code(v){return typeof v=="function"?v():v!==n.nil&&this._leafNode(new b(v)),this}object(...v){const O=["{"];for(const[j,ie]of v)O.length>1&&O.push(","),O.push(j),(j!==ie||this.opts.es5)&&(O.push(":"),(0,n.addCodeArg)(O,ie));return O.push("}"),new n._Code(O)}if(v,O,j){if(this._blockNode(new S(v)),O&&j)this.code(O).else().code(j).endIf();else if(O)this.code(O).endIf();else if(j)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(v){return this._elseNode(new S(v))}else(){return this._elseNode(new C)}endIf(){return this._endBlockNode(S,C)}_for(v,O){return this._blockNode(v),O&&this.code(O).endFor(),this}for(v,O){return this._for(new k(v),O)}forRange(v,O,j,ie,ne=this.opts.es5?r.varKinds.var:r.varKinds.let){const we=this._scope.toName(v);return this._for(new z(ne,we,O,j),()=>ie(we))}forOf(v,O,j,ie=r.varKinds.const){const ne=this._scope.toName(v);if(this.opts.es5){const we=O instanceof n.Name?O:this.var("_arr",O);return this.forRange("_i",0,(0,n._)`${we}.length`,Se=>{this.var(ne,(0,n._)`${we}[${Se}]`),j(ne)})}return this._for(new H("of",ie,ne,O),()=>j(ne))}forIn(v,O,j,ie=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(v,(0,n._)`Object.keys(${O})`,j);const ne=this._scope.toName(v);return this._for(new H("in",ie,ne,O),()=>j(ne))}endFor(){return this._endBlockNode(I)}label(v){return this._leafNode(new h(v))}break(v){return this._leafNode(new m(v))}return(v){const O=new ue;if(this._blockNode(O),this.code(v),O.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ue)}try(v,O,j){if(!O&&!j)throw new Error('CodeGen: "try" without "catch" and "finally"');const ie=new _e;if(this._blockNode(ie),this.code(v),O){const ne=this.name("e");this._currNode=ie.catch=new Ee(ne),O(ne)}return j&&(this._currNode=ie.finally=new Fe,this.code(j)),this._endBlockNode(Ee,Fe)}throw(v){return this._leafNode(new _(v))}block(v,O){return this._blockStarts.push(this._nodes.length),v&&this.code(v).endBlock(O),this}endBlock(v){const O=this._blockStarts.pop();if(O===void 0)throw new Error("CodeGen: not in self-balancing block");const j=this._nodes.length-O;if(j<0||v!==void 0&&j!==v)throw new Error(`CodeGen: wrong number of nodes: ${j} vs ${v} expected`);return this._nodes.length=O,this}func(v,O=n.nil,j,ie){return this._blockNode(new ee(v,O,j)),ie&&this.code(ie).endFunc(),this}endFunc(){return this._endBlockNode(ee)}optimize(v=1){for(;v-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(v){return this._currNode.nodes.push(v),this}_blockNode(v){this._currNode.nodes.push(v),this._nodes.push(v)}_endBlockNode(v,O){const j=this._currNode;if(j instanceof v||O&&j instanceof O)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${O?`${v.kind}/${O.kind}`:v.kind}"`)}_elseNode(v){const O=this._currNode;if(!(O instanceof S))throw new Error('CodeGen: "else" without "if"');return this._currNode=O.else=v,this}get _root(){return this._nodes[0]}get _currNode(){const v=this._nodes;return v[v.length-1]}set _currNode(v){const O=this._nodes;O[O.length-1]=v}}e.CodeGen=Z;function se(L,v){for(const O in v)L[O]=(L[O]||0)+(v[O]||0);return L}function fe(L,v){return v instanceof n._CodeOrName?se(L,v.names):L}function le(L,v,O){if(L instanceof n.Name)return j(L);if(!ie(L))return L;return new n._Code(L._items.reduce((ne,we)=>(we instanceof n.Name&&(we=j(we)),we instanceof n._Code?ne.push(...we._items):ne.push(we),ne),[]));function j(ne){const we=O[ne.str];return we===void 0||v[ne.str]!==1?ne:(delete v[ne.str],we)}function ie(ne){return ne instanceof n._Code&&ne._items.some(we=>we instanceof n.Name&&v[we.str]===1&&O[we.str]!==void 0)}}function Ye(L,v){for(const O in v)L[O]=(L[O]||0)-(v[O]||0)}function yt(L){return typeof L=="boolean"||typeof L=="number"||L===null?!L:(0,n._)`!${W(L)}`}e.not=yt;const st=M(e.operators.AND);function _t(...L){return L.reduce(st)}e.and=_t;const jt=M(e.operators.OR);function X(...L){return L.reduce(jt)}e.or=X;function M(L){return(v,O)=>v===n.nil?O:O===n.nil?v:(0,n._)`${W(v)} ${L} ${W(O)}`}function W(L){return L instanceof n.Name?L:(0,n._)`(${L})`}}(tu)),tu}var te={};Object.defineProperty(te,"__esModule",{value:!0}),te.checkStrictMode=te.getErrorPath=te.Type=te.useFunc=te.setEvaluated=te.evaluatedPropsToName=te.mergeEvaluated=te.eachItem=te.unescapeJsonPointer=te.escapeJsonPointer=te.escapeFragment=te.unescapeFragment=te.schemaRefOrVal=te.schemaHasRulesButRef=te.schemaHasRules=te.checkUnknownRules=te.alwaysValidSchema=te.toHash=void 0;const Ve=Oe(),e0=ka();function t0(e){const n={};for(const r of e)n[r]=!0;return n}te.toHash=t0;function n0(e,n){return typeof n=="boolean"?n:Object.keys(n).length===0?!0:(hd(e,n),!pd(n,e.self.RULES.all))}te.alwaysValidSchema=n0;function hd(e,n=e.schema){const{opts:r,self:a}=e;if(!r.strictSchema||typeof n=="boolean")return;const o=a.RULES.keywords;for(const u in n)o[u]||vd(e,`unknown keyword: "${u}"`)}te.checkUnknownRules=hd;function pd(e,n){if(typeof e=="boolean")return!e;for(const r in e)if(n[r])return!0;return!1}te.schemaHasRules=pd;function r0(e,n){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&n.all[r])return!0;return!1}te.schemaHasRulesButRef=r0;function i0({topSchemaRef:e,schemaPath:n},r,a,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ve._)`${r}`}return(0,Ve._)`${e}${n}${(0,Ve.getProperty)(a)}`}te.schemaRefOrVal=i0;function a0(e){return md(decodeURIComponent(e))}te.unescapeFragment=a0;function s0(e){return encodeURIComponent(iu(e))}te.escapeFragment=s0;function iu(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}te.escapeJsonPointer=iu;function md(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}te.unescapeJsonPointer=md;function o0(e,n){if(Array.isArray(e))for(const r of e)n(r);else n(e)}te.eachItem=o0;function gd({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:a}){return(o,u,c,f)=>{const d=c===void 0?u:c instanceof Ve.Name?(u instanceof Ve.Name?e(o,u,c):n(o,u,c),c):u instanceof Ve.Name?(n(o,c,u),u):r(u,c);return f===Ve.Name&&!(d instanceof Ve.Name)?a(o,d):d}}te.mergeEvaluated={props:gd({mergeNames:(e,n,r)=>e.if((0,Ve._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,Ve._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Ve._)`${r} || {}`).code((0,Ve._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,Ve._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,Ve._)`${r} || {}`),au(e,r,n))}),mergeValues:(e,n)=>e===!0?!0:{...e,...n},resultToName:yd}),items:gd({mergeNames:(e,n,r)=>e.if((0,Ve._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,Ve._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,Ve._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,Ve._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,n)=>e===!0?!0:Math.max(e,n),resultToName:(e,n)=>e.var("items",n)})};function yd(e,n){if(n===!0)return e.var("props",!0);const r=e.var("props",(0,Ve._)`{}`);return n!==void 0&&au(e,r,n),r}te.evaluatedPropsToName=yd;function au(e,n,r){Object.keys(r).forEach(a=>e.assign((0,Ve._)`${n}${(0,Ve.getProperty)(a)}`,!0))}te.setEvaluated=au;const _d={};function u0(e,n){return e.scopeValue("func",{ref:n,code:_d[n.code]||(_d[n.code]=new e0._Code(n.code))})}te.useFunc=u0;var su;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(su||(te.Type=su={}));function l0(e,n,r){if(e instanceof Ve.Name){const a=n===su.Num;return r?a?(0,Ve._)`"[" + ${e} + "]"`:(0,Ve._)`"['" + ${e} + "']"`:a?(0,Ve._)`"/" + ${e}`:(0,Ve._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ve.getProperty)(e).toString():"/"+iu(e)}te.getErrorPath=l0;function vd(e,n,r=e.opts.strictSchema){if(r){if(n=`strict mode: ${n}`,r===!0)throw new Error(n);e.self.logger.warn(n)}}te.checkStrictMode=vd;var Ma={},$d;function er(){if($d)return Ma;$d=1,Object.defineProperty(Ma,"__esModule",{value:!0});const e=Oe(),n={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Ma.default=n,Ma}var bd;function xa(){return bd||(bd=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const n=Oe(),r=te,a=er();e.keywordError={message:({keyword:C})=>(0,n.str)`must pass "${C}" keyword validation`},e.keyword$DataError={message:({keyword:C,schemaType:S})=>S?(0,n.str)`"${C}" keyword must be ${S} ($data)`:(0,n.str)`"${C}" keyword is invalid ($data)`};function o(C,S=e.keywordError,I,k){const{it:z}=C,{gen:H,compositeRule:ee,allErrors:ue}=z,_e=_(C,S,I);k??(ee||ue)?d(H,_e):h(z,(0,n._)`[${_e}]`)}e.reportError=o;function u(C,S=e.keywordError,I){const{it:k}=C,{gen:z,compositeRule:H,allErrors:ee}=k,ue=_(C,S,I);d(z,ue),H||ee||h(k,a.default.vErrors)}e.reportExtraError=u;function c(C,S){C.assign(a.default.errors,S),C.if((0,n._)`${a.default.vErrors} !== null`,()=>C.if(S,()=>C.assign((0,n._)`${a.default.vErrors}.length`,S),()=>C.assign(a.default.vErrors,null)))}e.resetErrorsCount=c;function f({gen:C,keyword:S,schemaValue:I,data:k,errsCount:z,it:H}){if(z===void 0)throw new Error("ajv implementation error");const ee=C.name("err");C.forRange("i",z,a.default.errors,ue=>{C.const(ee,(0,n._)`${a.default.vErrors}[${ue}]`),C.if((0,n._)`${ee}.instancePath === undefined`,()=>C.assign((0,n._)`${ee}.instancePath`,(0,n.strConcat)(a.default.instancePath,H.errorPath))),C.assign((0,n._)`${ee}.schemaPath`,(0,n.str)`${H.errSchemaPath}/${S}`),H.opts.verbose&&(C.assign((0,n._)`${ee}.schema`,I),C.assign((0,n._)`${ee}.data`,k))})}e.extendErrors=f;function d(C,S){const I=C.const("err",S);C.if((0,n._)`${a.default.vErrors} === null`,()=>C.assign(a.default.vErrors,(0,n._)`[${I}]`),(0,n._)`${a.default.vErrors}.push(${I})`),C.code((0,n._)`${a.default.errors}++`)}function h(C,S){const{gen:I,validateName:k,schemaEnv:z}=C;z.$async?I.throw((0,n._)`new ${C.ValidationError}(${S})`):(I.assign((0,n._)`${k}.errors`,S),I.return(!1))}const m={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function _(C,S,I){const{createErrors:k}=C.it;return k===!1?(0,n._)`{}`:b(C,S,I)}function b(C,S,I={}){const{gen:k,it:z}=C,H=[w(z,I),A(C,I)];return N(C,S,H),k.object(...H)}function w({errorPath:C},{instancePath:S}){const I=S?(0,n.str)`${C}${(0,r.getErrorPath)(S,r.Type.Str)}`:C;return[a.default.instancePath,(0,n.strConcat)(a.default.instancePath,I)]}function A({keyword:C,it:{errSchemaPath:S}},{schemaPath:I,parentSchema:k}){let z=k?S:(0,n.str)`${S}/${C}`;return I&&(z=(0,n.str)`${z}${(0,r.getErrorPath)(I,r.Type.Str)}`),[m.schemaPath,z]}function N(C,{params:S,message:I},k){const{keyword:z,data:H,schemaValue:ee,it:ue}=C,{opts:_e,propertyName:Ee,topSchemaRef:Fe,schemaPath:Z}=ue;k.push([m.keyword,z],[m.params,typeof S=="function"?S(C):S||(0,n._)`{}`]),_e.messages&&k.push([m.message,typeof I=="function"?I(C):I]),_e.verbose&&k.push([m.schema,ee],[m.parentSchema,(0,n._)`${Fe}${Z}`],[a.default.data,H]),Ee&&k.push([m.propertyName,Ee])}}(eu)),eu}var Ed;function c0(){if(Ed)return Cr;Ed=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.boolOrEmptySchema=Cr.topBoolOrEmptySchema=void 0;const e=xa(),n=Oe(),r=er(),a={message:"boolean schema is false"};function o(f){const{gen:d,schema:h,validateName:m}=f;h===!1?c(f,!1):typeof h=="object"&&h.$async===!0?d.return(r.default.data):(d.assign((0,n._)`${m}.errors`,null),d.return(!0))}Cr.topBoolOrEmptySchema=o;function u(f,d){const{gen:h,schema:m}=f;m===!1?(h.var(d,!1),c(f)):h.var(d,!0)}Cr.boolOrEmptySchema=u;function c(f,d){const{gen:h,data:m}=f,_={gen:h,keyword:"false schema",data:m,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:f};(0,e.reportError)(_,a,void 0,d)}return Cr}var at={},Tr={};Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.getRules=Tr.isJSONType=void 0;const f0=["string","number","integer","boolean","null","object","array"],d0=new Set(f0);function h0(e){return typeof e=="string"&&d0.has(e)}Tr.isJSONType=h0;function p0(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Tr.getRules=p0;var Rn={},wd;function Sd(){if(wd)return Rn;wd=1,Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.shouldUseRule=Rn.shouldUseGroup=Rn.schemaHasRulesForType=void 0;function e({schema:a,self:o},u){const c=o.RULES.types[u];return c&&c!==!0&&n(a,c)}Rn.schemaHasRulesForType=e;function n(a,o){return o.rules.some(u=>r(a,u))}Rn.shouldUseGroup=n;function r(a,o){var u;return a[o.keyword]!==void 0||((u=o.definition.implements)===null||u===void 0?void 0:u.some(c=>a[c]!==void 0))}return Rn.shouldUseRule=r,Rn}Object.defineProperty(at,"__esModule",{value:!0}),at.reportTypeError=at.checkDataTypes=at.checkDataType=at.coerceAndCheckDataType=at.getJSONTypes=at.getSchemaTypes=at.DataType=void 0;c