@one-payments/web-components 1.5.6 → 1.6.0

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.
@@ -1,6 +1,6 @@
1
1
  var OnePayments=function(t){"use strict";
2
2
  /*!
3
- * @one-payments/web-components v1.5.6
3
+ * @one-payments/web-components v1.6.0
4
4
  * Browser CDN Bundle (IIFE)
5
5
  *
6
6
  * This bundle is designed for direct browser usage via <script> tag.
@@ -8,7 +8,7 @@ var OnePayments=function(t){"use strict";
8
8
  *
9
9
  * (c) 2026 One Payments
10
10
  * Released under the MIT License
11
- */var e;const r=globalThis,i=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),o=new WeakMap;let s=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(e,t))}return t}toString(){return this.cssText}};const a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:p}=Object,m=globalThis,g=m.trustedTypes,f=g?g.emptyScript:"",y=m.reactiveElementPolyfillSupport,v=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(i){r=null}}return r}},w=(t,e)=>!l(t,e),x={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(t,r,e);void 0!==i&&d(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){const{get:i,set:n}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const o=null==i?void 0:i.call(this);null==n||n.call(this,e),this.requestUpdate(t,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...h(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const t=this._$Eu(e,r);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach(t=>t(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){var r;const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const o=(void 0!==(null==(r=i.converter)?void 0:r.toAttribute)?i.converter:b).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var r,i;const n=this.constructor,o=n._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=n.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(r=t.converter)?void 0:r.fromAttribute)?t.converter:b;this._$Em=o;const a=s.fromAttribute(e,t.type);this[o]=a??(null==(i=this._$Ej)?void 0:i.get(o))??a,this._$Em=null}}requestUpdate(t,e,r){var i;if(void 0!==t){const n=this.constructor,o=this[t];if(r??(r=n.getPropertyOptions(t)),!((r.hasChanged??w)(o,e)||r.useDefault&&r.reflect&&o===(null==(i=this._$Ej)?void 0:i.get(t))&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},o){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,r,i)}}let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostUpdate)?void 0:e.call(t)}),this.update(r)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null==(e=this._$EO)||e.forEach(t=>{var e;return null==(e=t.hostUpdated)?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[v("elementProperties")]=new Map,k[v("finalized")]=new Map,null==y||y({ReactiveElement:k}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.1.1");const S=globalThis,P=S.trustedTypes,C=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+$,_=`<${E}>`,I=document,M=()=>I.createComment(""),N=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,D="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,U=/>/g,B=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,z=/"/g,q=/^(?:script|style|textarea|title)$/i,O=(Q=1,(t,...e)=>({_$litType$:Q,strings:t,values:e})),H=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),V=new WeakMap,Y=I.createTreeWalker(I,129);var Q;function K(t,e){if(!T(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}class G{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,o=0;const s=t.length-1,a=this.parts,[l,d]=((t,e)=>{const r=t.length-1,i=[];let n,o=2===e?"<svg>":3===e?"<math>":"",s=R;for(let a=0;a<r;a++){const e=t[a];let r,l,d=-1,c=0;for(;c<e.length&&(s.lastIndex=c,l=s.exec(e),null!==l);)c=s.lastIndex,s===R?"!--"===l[1]?s=L:void 0!==l[1]?s=U:void 0!==l[2]?(q.test(l[2])&&(n=RegExp("</"+l[2],"g")),s=B):void 0!==l[3]&&(s=B):s===B?">"===l[0]?(s=n??R,d=-1):void 0===l[1]?d=-2:(d=s.lastIndex-l[2].length,r=l[1],s=void 0===l[3]?B:'"'===l[3]?z:F):s===z||s===F?s=B:s===L||s===U?s=R:(s=B,n=void 0);const u=s===B&&t[a+1].startsWith("/>")?" ":"";o+=s===R?e+_:d>=0?(i.push(r),e.slice(0,d)+A+e.slice(d)+$+u):e+$+(-2===d?a:u)}return[K(t,o+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]})(t,e);if(this.el=G.createElement(l,r),Y.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=Y.nextNode())&&a.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(A)){const e=d[o++],r=i.getAttribute(t).split($),s=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:s[2],strings:r,ctor:"."===s[1]?tt:"?"===s[1]?et:"@"===s[1]?rt:X}),i.removeAttribute(t)}else t.startsWith($)&&(a.push({type:6,index:n}),i.removeAttribute(t));if(q.test(i.tagName)){const t=i.textContent.split($),e=t.length-1;if(e>0){i.textContent=P?P.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],M()),Y.nextNode(),a.push({type:2,index:++n});i.append(t[e],M())}}}else if(8===i.nodeType)if(i.data===E)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf($,t+1));)a.push({type:7,index:n}),t+=$.length-1}n++}}static createElement(t,e){const r=I.createElement("template");return r.innerHTML=t,r}}function J(t,e,r=t,i){var n,o;if(e===H)return e;let s=void 0!==i?null==(n=r._$Co)?void 0:n[i]:r._$Cl;const a=N(e)?void 0:e._$litDirective$;return(null==s?void 0:s.constructor)!==a&&(null==(o=null==s?void 0:s._$AO)||o.call(s,!1),void 0===a?s=void 0:(s=new a(t),s._$AT(t,r,i)),void 0!==i?(r._$Co??(r._$Co=[]))[i]=s:r._$Cl=s),void 0!==s&&(e=J(t,s._$AS(t,e.values),s,i)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((null==t?void 0:t.creationScope)??I).importNode(e,!0);Y.currentNode=i;let n=Y.nextNode(),o=0,s=0,a=r[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new W(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new it(n,this,t)),this._$AV.push(e),a=r[++s]}o!==(null==a?void 0:a.index)&&(n=Y.nextNode(),o++)}return Y.currentNode=I,i}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class W{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(null==i?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),N(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==H&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==j&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(I.createTextNode(t)),this._$AH=t}$(t){var e;const{values:r,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=G.createElement(K(i.h,i.h[0]),this.options)),i);if((null==(e=this._$AH)?void 0:e._$AD)===n)this._$AH.p(r);else{const t=new Z(n,this),e=t.u(this.options);t.p(r),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new G(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of t)i===e.length?e.push(r=new W(this.O(M()),this.O(M()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for(null==(r=this._$AP)||r.call(this,!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cv=t,null==(e=this._$AP)||e.call(this,t))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=j}_$AI(t,e=this,r,i){const n=this.strings;let o=!1;if(void 0===n)t=J(this,t,e,0),o=!N(t)||t!==this._$AH&&t!==H,o&&(this._$AH=t);else{const i=t;let s,a;for(t=n[0],s=0;s<n.length-1;s++)a=J(this,i[r+s],e,s),a===H&&(a=this._$AH[s]),o||(o=!N(a)||a!==this._$AH[s]),a===j?t=j:t!==j&&(t+=(a??"")+n[s+1]),this._$AH[s]=a}o&&!i&&this.j(t)}j(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===j?void 0:t}}class et extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==j)}}class rt extends X{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??j)===H)return;const r=this._$AH,i=t===j&&r!==j||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==j&&(r===j||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;"function"==typeof this._$AH?this._$AH.call((null==(e=this.options)?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const nt=S.litHtmlPolyfillSupport;null==nt||nt(G,W),(S.litHtmlVersions??(S.litHtmlVersions=[])).push("3.3.1");const ot=globalThis;class st extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const i=(null==r?void 0:r.renderBefore)??e;let n=i._$litPart$;if(void 0===n){const t=(null==r?void 0:r.renderBefore)??null;i._$litPart$=n=new W(e.insertBefore(M(),t),t,void 0,r??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return H}}st._$litElement$=!0,st.finalized=!0,null==(e=ot.litElementHydrateSupport)||e.call(ot,{LitElement:st});const at=ot.litElementPolyfillSupport;null==at||at({LitElement:st}),(ot.litElementVersions??(ot.litElementVersions=[])).push("4.2.1");const lt={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},dt=(t=lt,e,r)=>{const{kind:i,metadata:n}=r;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),o.set(r.name,t),"accessor"===i){const{name:i}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(i,n,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=r;return function(r){const n=this[i];e.call(this,r),this.requestUpdate(i,n,t)}}throw Error("Unsupported decorator location: "+i)};function ct(t){return(e,r)=>"object"==typeof r?dt(t,e,r):((t,e,r)=>{const i=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),i?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}function ut(t){return ct({...t,state:!0,attribute:!1})}const ht="card",pt="paynow",mt="promptpay",gt="duitnow",ft="gopay",yt="boost",vt="shopeepay",bt="atom",wt="dana",xt="tng",kt="idle",St="initializing",Pt="ready",Ct="processing",At="requires_action",$t="succeeded",Et="failed";class _t{constructor(t,e,r,i,n={},o){this.isPolling=!1,this.attempts=0,this.startTime=0,this.pollTimeoutId=null,this.adapters=t,this.baseUrl=e,this.token=r,this.onStatusUpdate=i,this.onPollStart=o,this.config={interval:n.interval??3e3,maxAttempts:n.maxAttempts??60,timeout:n.timeout??18e4,ignore3DS:n.ignore3DS??!1,ignoreQR:n.ignoreQR??!1}}start(){this.isPolling||(this.isPolling=!0,this.attempts=0,this.startTime=this.adapters.timer.now(),this.scheduleNextPoll())}stop(){this.isPolling=!1,null!==this.pollTimeoutId&&(clearTimeout(this.pollTimeoutId),this.pollTimeoutId=null)}get active(){return this.isPolling}get attemptCount(){return this.attempts}scheduleNextPoll(){if(!this.isPolling)return;if(this.attempts>=this.config.maxAttempts)return this.stop(),void this.onStatusUpdate({status:"failed",paymentIntentId:"",error:{code:"POLLING_MAX_ATTEMPTS",message:`Maximum polling attempts (${this.config.maxAttempts}) exceeded`}});if(this.adapters.timer.now()-this.startTime>=this.config.timeout)return this.stop(),void this.onStatusUpdate({status:"failed",paymentIntentId:"",error:{code:"POLLING_TIMEOUT",message:`Polling timeout (${this.config.timeout}ms) exceeded`}});this.pollTimeoutId=setTimeout(()=>{this.poll()},this.config.interval)}async poll(){if(this.isPolling){this.attempts++,this.onPollStart&&this.onPollStart();try{const e=await this.adapters.http.get(`${this.baseUrl}/payment-intent/get-payment-data`,{"x-token":this.token}),r={status:(t=e.result.status,"paid"===t?"succeeded":t),paymentIntentId:e.result.paymentIntentId||"",...void 0!==e.result.amount&&{amount:e.result.amount},...void 0!==e.result.currency&&{currency:e.result.currency},...void 0!==e.result.metadata&&{metadata:e.result.metadata},...void 0!==e.result.nextActionUrl&&{nextActionUrl:e.result.nextActionUrl},...void 0!==e.result.qrCode&&{qrCode:e.result.qrCode}};if(e.result.nextActionUrl&&!this.config.ignore3DS)return this.stop(),void this.onStatusUpdate(r);if(e.result.qrCode&&!this.config.ignoreQR)return this.stop(),void this.onStatusUpdate(r);if("succeeded"===e.result.status||"failed"===e.result.status||"paid"===e.result.status)return this.stop(),void this.onStatusUpdate(r);this.scheduleNextPoll()}catch(e){const t={status:"processing",paymentIntentId:"",error:{code:"POLLING_ERROR",message:e instanceof Error?e.message:"Unknown polling error"}};this.onStatusUpdate(t),this.scheduleNextPoll()}var t}}}class It{constructor(t,e){this.state={status:kt},this.subscribers=new Set,this.eventListeners={},this.paymentToken=null,this.paymentIntentId=null,this.pollingService=null,this.ignore3DSInPolling=!1,this.ignoreQRInPolling=!1,this.config=t,this.adapters=e}getApiBaseUrl(){return this.config.apiBaseUrl??function(t){switch(t){case"prod":return"https://public.prod.one.ooo";case"demo":return"https://public.demo.one.ooo";default:return"https://public.dev.one.ooo"}}(this.config.environment)}getState(){return this.state}subscribe(t){return this.subscribers.add(t),t(this.state),()=>{this.subscribers.delete(t)}}on(t,e){this.eventListeners[t]||(this.eventListeners[t]=[]);const r=this.eventListeners[t];return r.push(e),()=>{const t=r.indexOf(e);t>-1&&r.splice(t,1)}}async initialize(t){this.setState({status:St}),this.emit({type:"initialize",payload:t});try{const e={amount:t.amount,currency:t.currency,notes:t.notes,orderId:t.orderId},r=JSON.stringify(e),i=await this.adapters.crypto.hmacSHA256(this.config.secretKey,r),n=await this.adapters.http.post(`${this.getApiBaseUrl()}/payment-intent/create`,e,{"x-api-key":this.config.apiKey,"x-signature":i}),o=new URL(n.result.redirectUrl).searchParams.get("token");if(!o)throw new Error("No token found in redirectUrl");this.paymentToken=o,this.paymentIntentId=n.result.paymentIntentId;const s=await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/get-payment-data`,{"x-token":this.paymentToken}),a=await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/available-methods`,{"x-token":this.paymentToken}),l={id:this.paymentIntentId,amount:s.result.customerAmount||t.amount,currency:s.result.currency||t.currency,status:Pt,...t.metadata&&{metadata:t.metadata}},d=[];let c=0;return a.result.paymentMethods.forEach(t=>{const e=t.type.toLowerCase(),r=t.capabilities||[];e.includes("card")&&d.push({id:"card",enabled:!0,priority:c++}),(e.includes("paynow")||r.includes("payments_pay_now"))&&d.push({id:"paynow",enabled:!0,priority:c++}),(e.includes("promptpay")||e.includes("prompt pay")||r.includes("payments_prompt_pay"))&&d.push({id:"promptpay",enabled:!0,priority:c++}),(e.includes("duitnow")||e.includes("duit now")||r.includes("payments_duit_now"))&&d.push({id:"duitnow",enabled:!0,priority:c++}),(e.includes("gopay")||e.includes("go pay")||r.includes("payments_go_pay"))&&d.push({id:"gopay",enabled:!0,priority:c++}),(e.includes("boost")||r.includes("payments_boost"))&&d.push({id:"boost",enabled:!0,priority:c++}),(e.includes("shopeepay")||e.includes("shopee pay")||e.includes("shopee_pay")||r.includes("payments_shopee_pay"))&&d.push({id:"shopeepay",enabled:!0,priority:c++}),(e.includes("atom")||e.includes("atome")||r.includes("payments_atome"))&&d.push({id:"atom",enabled:!0,priority:c++}),(e.includes("dana")||r.includes("payments_dana"))&&d.push({id:"dana",enabled:!0,priority:c++}),(e.includes("tng")||e.includes("touch")||r.includes("payments_tng"))&&d.push({id:"tng",enabled:!0,priority:c++})}),this.setState({status:Pt,paymentIntent:l,availableMethods:d}),this.emit({type:"initialized",payload:{paymentIntent:l,paymentData:s.result}}),l}catch(e){const t={code:"INITIALIZATION_FAILED",message:e instanceof Error?e.message:"Unknown error",timestamp:this.adapters.timer.now()};throw this.setState({status:Et,error:t}),this.emit({type:"payment_failed",payload:{error:t}}),e}}async submitPayment(t,e){var r,i,n,o,s;const a=this.state;if("ready"!==a.status)throw new Error("Cannot submit payment: SDK not in ready state");if(!this.paymentToken)throw new Error("Cannot submit payment: No payment token available");this.ignore3DSInPolling=!1,this.ignoreQRInPolling=!1,this.setState({status:Ct,paymentIntent:a.paymentIntent,selectedMethod:t,availableMethods:a.availableMethods}),this.emit({type:"payment_processing",payload:{paymentIntent:a.paymentIntent,methodId:t}});try{const r=t=>{switch(t){case"paynow":default:return"qr";case"promptpay":return"prompt_pay";case"duitnow":return"duit_now";case"gopay":return"go_pay";case"boost":return"boost";case"shopeepay":return"shopee_pay";case"atom":return"atome";case"dana":return"dana";case"tng":return"tng"}},i={firstName:String(e.firstName),lastName:String(e.lastName),email:String(e.email),phoneNumber:String(e.phoneNumber),paymentMethod:"card"===t?{type:"card",card:{number:String(e.cardNumber),expiryMonth:String(e.expiryMonth),expiryYear:String(e.expiryYear),cvc:String(e.cvv)}}:{type:r(t)}};return await this.adapters.http.patch(`${this.getApiBaseUrl()}/payment-intent/confirm`,i,{"x-token":this.paymentToken}),this.startPolling(),{id:this.paymentIntentId||"",amount:a.paymentIntent.amount,currency:a.paymentIntent.currency,status:Ct}}catch(l){let t="Unknown error",e="PAYMENT_FAILED";if(l instanceof Error)try{if(function(t){return t instanceof Error&&("response"in t&&"object"==typeof t.response&&null!==t.response||"data"in t&&"object"==typeof t.data&&null!==t.data)}(l)){const a=null==(r=l.response)?void 0:r.data,d=l.data;a?(t=a.message||(null==(i=a.error)?void 0:i.message)||l.message,e=a.code||(null==(n=a.error)?void 0:n.code)||e):d?(t=d.message||(null==(o=d.error)?void 0:o.message)||l.message,e=d.code||(null==(s=d.error)?void 0:s.code)||e):t=l.message}else t=l.message}catch{t=l.message}const d={code:e,message:t,timestamp:this.adapters.timer.now()};throw this.setState({status:Et,error:d,paymentIntent:a.paymentIntent}),this.emit({type:"payment_failed",payload:{error:d,paymentIntent:a.paymentIntent}}),l}}resumePolling(){this.paymentToken&&(this.ignore3DSInPolling=!0,this.ignoreQRInPolling=!0,this.startPolling())}destroy(){this.stopPolling(),this.subscribers.clear(),Object.keys(this.eventListeners).forEach(t=>{delete this.eventListeners[t]})}startPolling(){this.paymentToken&&(this.stopPolling(),this.pollingService=new _t(this.adapters,this.getApiBaseUrl(),this.paymentToken,this.handlePollingUpdate.bind(this),{interval:4e3,maxAttempts:100,timeout:4e5,ignore3DS:this.ignore3DSInPolling,ignoreQR:this.ignoreQRInPolling},this.handlePollStart.bind(this)),this.pollingService.start())}stopPolling(){this.pollingService&&(this.pollingService.stop(),this.pollingService=null)}handlePollStart(){this.emit({type:"poll_started",payload:{}})}handlePollingUpdate(t){if(t.error)return;const e=this.state;if("processing"!==e.status&&"requires_action"!==e.status)return void this.stopPolling();const r="promptpay"===e.selectedMethod||"duitnow"===e.selectedMethod||"gopay"===e.selectedMethod||"boost"===e.selectedMethod||"shopeepay"===e.selectedMethod||"atom"===e.selectedMethod||"dana"===e.selectedMethod||"tng"===e.selectedMethod;if(t.qrCode&&!this.ignoreQRInPolling&&!r)return void this.emit({type:"qr_code_received",payload:{qrCode:t.qrCode,methodId:e.selectedMethod}});if(t.nextActionUrl&&!this.ignore3DSInPolling){if("promptpay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"promptpay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("duitnow"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"duitnow_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("gopay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"gopay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("boost"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"boost_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("shopeepay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"shopeepay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("atom"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"atom_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("dana"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"dana_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("tng"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"tng_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("paynow"===e.selectedMethod&&!this.ignoreQRInPolling)return void this.emit({type:"qr_code_received",payload:{qrCode:t.nextActionUrl,methodId:e.selectedMethod}});const r={id:t.paymentIntentId,amount:t.amount??e.paymentIntent.amount,currency:t.currency??e.paymentIntent.currency,status:At,...t.metadata&&{metadata:t.metadata}};return this.setState({status:At,paymentIntent:r,actionUrl:t.nextActionUrl,selectedMethod:e.selectedMethod,availableMethods:e.availableMethods}),void this.emit({type:"payment_requires_action",payload:{paymentIntent:r,actionUrl:t.nextActionUrl,methodId:e.selectedMethod}})}const i={id:t.paymentIntentId,amount:t.amount??e.paymentIntent.amount,currency:t.currency??e.paymentIntent.currency,status:t.status,...t.metadata&&{metadata:t.metadata}};if("succeeded"===t.status)this.stopPolling(),this.setState({status:$t,paymentIntent:i,selectedMethod:e.selectedMethod}),this.emit({type:"payment_succeeded",payload:{paymentIntent:i,methodId:e.selectedMethod}});else if("failed"===t.status){this.stopPolling();const e={code:"PAYMENT_FAILED",message:t.error&&"object"==typeof t.error&&null!==t.error&&"message"in t.error?String(t.error.message):"Payment failed",timestamp:this.adapters.timer.now()};this.setState({status:Et,error:e,paymentIntent:i}),this.emit({type:"payment_failed",payload:{error:e,paymentIntent:i}})}}setState(t){const e=this.state.status;this.state=t,this.subscribers.forEach(t=>{t(this.state)}),e!==t.status&&this.emit({type:"state_changed",payload:{previousStatus:e,currentStatus:t.status}})}emit(t){const e=this.eventListeners[t.type];void 0!==e&&e.forEach(e=>{e(t)})}}var Mt="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Nt=function(t,e,r,i,n,o,s,a,l,d){var c=this;c.numeralDecimalMark=t||".",c.numeralIntegerScale=e>0?e:0,c.numeralDecimalScale=r>=0?r:2,c.numeralThousandsGroupStyle=i||Nt.groupStyle.thousand,c.numeralPositiveOnly=!!n,c.stripLeadingZeroes=!1!==o,c.prefix=s||""===s?s:"",c.signBeforePrefix=!!a,c.tailPrefix=!!l,c.delimiter=d||""===d?d:",",c.delimiterRE=d?new RegExp("\\"+d,"g"):""};Nt.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},Nt.prototype={getRawValue:function(t){return t.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(t){var e,r,i,n,o=this,s="";switch(t=t.replace(/[A-Za-z]/g,"").replace(o.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",o.numeralPositiveOnly?"":"-").replace("M",o.numeralDecimalMark),o.stripLeadingZeroes&&(t=t.replace(/^(-)?0+(?=\d)/,"$1")),r="-"===t.slice(0,1)?"-":"",i=void 0!==o.prefix?o.signBeforePrefix?r+o.prefix:o.prefix+r:r,n=t,t.indexOf(o.numeralDecimalMark)>=0&&(n=(e=t.split(o.numeralDecimalMark))[0],s=o.numeralDecimalMark+e[1].slice(0,o.numeralDecimalScale)),"-"===r&&(n=n.slice(1)),o.numeralIntegerScale>0&&(n=n.slice(0,o.numeralIntegerScale)),o.numeralThousandsGroupStyle){case Nt.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+o.delimiter);break;case Nt.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+o.delimiter);break;case Nt.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+o.delimiter)}return o.tailPrefix?r+n.toString()+(o.numeralDecimalScale>0?s.toString():"")+o.prefix:i+n.toString()+(o.numeralDecimalScale>0?s.toString():"")}};var Tt=Nt,Dt=function(t,e,r){var i=this;i.date=[],i.blocks=[],i.datePattern=t,i.dateMin=e.split("-").reverse().map(function(t){return parseInt(t,10)}),2===i.dateMin.length&&i.dateMin.unshift(0),i.dateMax=r.split("-").reverse().map(function(t){return parseInt(t,10)}),2===i.dateMax.length&&i.dateMax.unshift(0),i.initBlocks()};Dt.prototype={initBlocks:function(){var t=this;t.datePattern.forEach(function(e){"Y"===e?t.blocks.push(4):t.blocks.push(2)})},getISOFormatDate:function(){var t=this,e=t.date;return e[2]?e[2]+"-"+t.addLeadingZero(e[1])+"-"+t.addLeadingZero(e[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(t){var e=this,r="";return t=t.replace(/[^\d]/g,""),e.blocks.forEach(function(i,n){if(t.length>0){var o=t.slice(0,i),s=o.slice(0,1),a=t.slice(i);switch(e.datePattern[n]){case"d":"00"===o?o="01":parseInt(s,10)>3?o="0"+s:parseInt(o,10)>31&&(o="31");break;case"m":"00"===o?o="01":parseInt(s,10)>1?o="0"+s:parseInt(o,10)>12&&(o="12")}r+=o,t=a}}),this.getFixedDateString(r)},getFixedDateString:function(t){var e,r,i,n=this,o=n.datePattern,s=[],a=0,l=0,d=0,c=0,u=0,h=0,p=!1;return 4===t.length&&"y"!==o[0].toLowerCase()&&"y"!==o[1].toLowerCase()&&(u=2-(c="d"===o[0]?0:2),e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),s=this.getFixedDate(e,r,0)),8===t.length&&(o.forEach(function(t,e){switch(t){case"d":a=e;break;case"m":l=e;break;default:d=e}}),h=2*d,c=a<=d?2*a:2*a+2,u=l<=d?2*l:2*l+2,e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+4),10),p=4===t.slice(h,h+4).length,s=this.getFixedDate(e,r,i)),4!==t.length||"y"!==o[0]&&"y"!==o[1]||(h=2-(u="m"===o[0]?0:2),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),p=2===t.slice(h,h+2).length,s=[0,r,i]),6!==t.length||"Y"!==o[0]&&"Y"!==o[1]||(h=2-.5*(u="m"===o[0]?0:4),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+4),10),p=4===t.slice(h,h+4).length,s=[0,r,i]),s=n.getRangeFixedDate(s),n.date=s,0===s.length?t:o.reduce(function(t,e){switch(e){case"d":return t+(0===s[0]?"":n.addLeadingZero(s[0]));case"m":return t+(0===s[1]?"":n.addLeadingZero(s[1]));case"y":return t+(p?n.addLeadingZeroForYear(s[2],!1):"");case"Y":return t+(p?n.addLeadingZeroForYear(s[2],!0):"")}},"")},getRangeFixedDate:function(t){var e=this,r=e.datePattern,i=e.dateMin||[],n=e.dateMax||[];return!t.length||i.length<3&&n.length<3||r.find(function(t){return"y"===t.toLowerCase()})&&0===t[2]?t:n.length&&(n[2]<t[2]||n[2]===t[2]&&(n[1]<t[1]||n[1]===t[1]&&n[0]<t[0]))?n:i.length&&(i[2]>t[2]||i[2]===t[2]&&(i[1]>t[1]||i[1]===t[1]&&i[0]>t[0]))?i:t},getFixedDate:function(t,e,r){return t=Math.min(t,31),e=Math.min(e,12),r=parseInt(r||0,10),(e<7&&e%2==0||e>8&&e%2==1)&&(t=Math.min(t,2===e?this.isLeapYear(r)?29:28:30)),[t,e,r]},isLeapYear:function(t){return t%4==0&&t%100!=0||t%400==0},addLeadingZero:function(t){return(t<10?"0":"")+t},addLeadingZeroForYear:function(t,e){return e?(t<10?"000":t<100?"00":t<1e3?"0":"")+t:(t<10?"0":"")+t}};var Rt=Dt,Lt=function(t,e){var r=this;r.time=[],r.blocks=[],r.timePattern=t,r.timeFormat=e,r.initBlocks()};Lt.prototype={initBlocks:function(){var t=this;t.timePattern.forEach(function(){t.blocks.push(2)})},getISOFormatTime:function(){var t=this,e=t.time;return e[2]?t.addLeadingZero(e[0])+":"+t.addLeadingZero(e[1])+":"+t.addLeadingZero(e[2]):""},getBlocks:function(){return this.blocks},getTimeFormatOptions:function(){return"12"===String(this.timeFormat)?{maxHourFirstDigit:1,maxHours:12,maxMinutesFirstDigit:5,maxMinutes:60}:{maxHourFirstDigit:2,maxHours:23,maxMinutesFirstDigit:5,maxMinutes:60}},getValidatedTime:function(t){var e=this,r="";t=t.replace(/[^\d]/g,"");var i=e.getTimeFormatOptions();return e.blocks.forEach(function(n,o){if(t.length>0){var s=t.slice(0,n),a=s.slice(0,1),l=t.slice(n);switch(e.timePattern[o]){case"h":parseInt(a,10)>i.maxHourFirstDigit?s="0"+a:parseInt(s,10)>i.maxHours&&(s=i.maxHours+"");break;case"m":case"s":parseInt(a,10)>i.maxMinutesFirstDigit?s="0"+a:parseInt(s,10)>i.maxMinutes&&(s=i.maxMinutes+"")}r+=s,t=l}}),this.getFixedTimeString(r)},getFixedTimeString:function(t){var e,r,i,n=this,o=n.timePattern,s=[],a=0,l=0,d=0,c=0,u=0,h=0;return 6===t.length&&(o.forEach(function(t,e){switch(t){case"s":a=2*e;break;case"m":l=2*e;break;case"h":d=2*e}}),h=d,u=l,c=a,e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),s=this.getFixedTime(i,r,e)),4===t.length&&n.timePattern.indexOf("s")<0&&(o.forEach(function(t,e){switch(t){case"m":l=2*e;break;case"h":d=2*e}}),h=d,u=l,e=0,r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),s=this.getFixedTime(i,r,e)),n.time=s,0===s.length?t:o.reduce(function(t,e){switch(e){case"s":return t+n.addLeadingZero(s[2]);case"m":return t+n.addLeadingZero(s[1]);case"h":return t+n.addLeadingZero(s[0])}},"")},getFixedTime:function(t,e,r){return r=Math.min(parseInt(r||0,10),60),e=Math.min(e,60),[t=Math.min(t,60),e,r]},addLeadingZero:function(t){return(t<10?"0":"")+t}};var Ut=Lt,Bt=function(t,e){var r=this;r.delimiter=e||""===e?e:" ",r.delimiterRE=e?new RegExp("\\"+e,"g"):"",r.formatter=t};Bt.prototype={setFormatter:function(t){this.formatter=t},format:function(t){var e=this;e.formatter.clear();for(var r,i="",n=!1,o=0,s=(t=(t=(t=t.replace(/[^\d+]/g,"")).replace(/^\+/,"B").replace(/\+/g,"").replace("B","+")).replace(e.delimiterRE,"")).length;o<s;o++)r=e.formatter.inputDigit(t.charAt(o)),/[\s()-]/g.test(r)?(i=r,n=!0):n||(i=r);return i=(i=i.replace(/[()]/g,"")).replace(/[\s-]/g,e.delimiter)}};var Ft=Bt,zt={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^(62|81)\d{0,14}/},getStrictBlocks:function(t){var e=t.reduce(function(t,e){return t+e},0);return t.concat(19-e)},getInfo:function(t,e){var r=zt.blocks,i=zt.re;for(var n in e=!!e,i)if(i[n].test(t)){var o=r[n];return{type:n,blocks:e?this.getStrictBlocks(o):o}}return{type:"unknown",blocks:e?this.getStrictBlocks(r.general):r.general}}},qt=zt,Ot={noop:function(){},strip:function(t,e){return t.replace(e,"")},getPostDelimiter:function(t,e,r){if(0===r.length)return t.slice(-e.length)===e?e:"";var i="";return r.forEach(function(e){t.slice(-e.length)===e&&(i=e)}),i},getDelimiterREByDelimiter:function(t){return new RegExp(t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(t,e,r,i,n){return e.length===t?r.length:t+this.getPositionOffset(t,e,r,i,n)},getPositionOffset:function(t,e,r,i,n){var o,s,a;return o=this.stripDelimiters(e.slice(0,t),i,n),s=this.stripDelimiters(r.slice(0,t),i,n),0!==(a=o.length-s.length)?a/Math.abs(a):0},stripDelimiters:function(t,e,r){var i=this;if(0===r.length){var n=e?i.getDelimiterREByDelimiter(e):"";return t.replace(n,"")}return r.forEach(function(e){e.split("").forEach(function(e){t=t.replace(i.getDelimiterREByDelimiter(e),"")})}),t},headStr:function(t,e){return t.slice(0,e)},getMaxLength:function(t){return t.reduce(function(t,e){return t+e},0)},getPrefixStrippedValue:function(t,e,r,i,n,o,s,a,l){if(0===r)return t;if(t===e&&""!==t)return"";if(l&&"-"==t.slice(0,1)){var d="-"==i.slice(0,1)?i.slice(1):i;return"-"+this.getPrefixStrippedValue(t.slice(1),e,r,d,n,o,s,a,l)}if(i.slice(0,r)!==e&&!a)return s&&!i&&t?t:"";if(i.slice(-r)!==e&&a)return s&&!i&&t?t:"";var c=this.stripDelimiters(i,n,o);return t.slice(0,r)===e||a?t.slice(-r)!==e&&a?c.slice(0,-r-1):a?t.slice(0,-r):t.slice(r):c.slice(r)},getFirstDiffIndex:function(t,e){for(var r=0;t.charAt(r)===e.charAt(r);)if(""===t.charAt(r++))return-1;return r},getFormattedValue:function(t,e,r,i,n,o){var s="",a=n.length>0,l="";return 0===r?t:(e.forEach(function(e,d){if(t.length>0){var c=t.slice(0,e),u=t.slice(e);l=a?n[o?d-1:d]||l:i,o?(d>0&&(s+=l),s+=c):(s+=c,c.length===e&&d<r-1&&(s+=l)),t=u}}),s)},fixPrefixCursor:function(t,e,r,i){if(t){var n=t.value,o=r||i[0]||" ";if(t.setSelectionRange&&e&&!(e.length+o.length<=n.length)){var s=2*n.length;setTimeout(function(){t.setSelectionRange(s,s)},1)}}},checkFullSelection:function(t){try{return(window.getSelection()||document.getSelection()||{}).toString().length===t.length}catch(e){}return!1},setSelection:function(t,e,r){if(t===this.getActiveElement(r)&&!(t&&t.value.length<=e))if(t.createTextRange){var i=t.createTextRange();i.move("character",e),i.select()}else try{t.setSelectionRange(e,e)}catch(n){console.warn("The input element type does not support selection")}},getActiveElement:function(t){var e=t.activeElement;return e&&e.shadowRoot?this.getActiveElement(e.shadowRoot):e},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(t,e){return!!(this.isAndroid()&&t&&e)&&e===t.slice(0,-1)}},Ht={assign:function(t,e){return e=e||{},(t=t||{}).creditCard=!!e.creditCard,t.creditCardStrictMode=!!e.creditCardStrictMode,t.creditCardType="",t.onCreditCardTypeChanged=e.onCreditCardTypeChanged||function(){},t.phone=!!e.phone,t.phoneRegionCode=e.phoneRegionCode||"AU",t.phoneFormatter={},t.time=!!e.time,t.timePattern=e.timePattern||["h","m","s"],t.timeFormat=e.timeFormat||"24",t.timeFormatter={},t.date=!!e.date,t.datePattern=e.datePattern||["d","m","Y"],t.dateMin=e.dateMin||"",t.dateMax=e.dateMax||"",t.dateFormatter={},t.numeral=!!e.numeral,t.numeralIntegerScale=e.numeralIntegerScale>0?e.numeralIntegerScale:0,t.numeralDecimalScale=e.numeralDecimalScale>=0?e.numeralDecimalScale:2,t.numeralDecimalMark=e.numeralDecimalMark||".",t.numeralThousandsGroupStyle=e.numeralThousandsGroupStyle||"thousand",t.numeralPositiveOnly=!!e.numeralPositiveOnly,t.stripLeadingZeroes=!1!==e.stripLeadingZeroes,t.signBeforePrefix=!!e.signBeforePrefix,t.tailPrefix=!!e.tailPrefix,t.swapHiddenInput=!!e.swapHiddenInput,t.numericOnly=t.creditCard||t.date||!!e.numericOnly,t.uppercase=!!e.uppercase,t.lowercase=!!e.lowercase,t.prefix=t.creditCard||t.date?"":e.prefix||"",t.noImmediatePrefix=!!e.noImmediatePrefix,t.prefixLength=t.prefix.length,t.rawValueTrimPrefix=!!e.rawValueTrimPrefix,t.copyDelimiter=!!e.copyDelimiter,t.initValue=void 0!==e.initValue&&null!==e.initValue?e.initValue.toString():"",t.delimiter=e.delimiter||""===e.delimiter?e.delimiter:e.date?"/":e.time?":":e.numeral?",":(e.phone," "),t.delimiterLength=t.delimiter.length,t.delimiterLazyShow=!!e.delimiterLazyShow,t.delimiters=e.delimiters||[],t.blocks=e.blocks||[],t.blocksLength=t.blocks.length,t.root="object"==typeof Mt&&Mt?Mt:window,t.document=e.document||t.root.document,t.maxLength=0,t.backspace=!1,t.result="",t.onValueChanged=e.onValueChanged||function(){},t}},jt=function(t,e){var r=this,i=!1;if("string"==typeof t?(r.element=document.querySelector(t),i=document.querySelectorAll(t).length>1):void 0!==t.length&&t.length>0?(r.element=t[0],i=t.length>1):r.element=t,!r.element)throw new Error("[cleave.js] Please check the element");if(i)try{console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.")}catch(n){}e.initValue=r.element.value,r.properties=jt.DefaultProperties.assign({},e),r.init()};jt.prototype={init:function(){var t=this,e=t.properties;e.numeral||e.phone||e.creditCard||e.time||e.date||0!==e.blocksLength||e.prefix?(e.maxLength=jt.Util.getMaxLength(e.blocks),t.isAndroid=jt.Util.isAndroid(),t.lastInputValue="",t.isBackward="",t.onChangeListener=t.onChange.bind(t),t.onKeyDownListener=t.onKeyDown.bind(t),t.onFocusListener=t.onFocus.bind(t),t.onCutListener=t.onCut.bind(t),t.onCopyListener=t.onCopy.bind(t),t.initSwapHiddenInput(),t.element.addEventListener("input",t.onChangeListener),t.element.addEventListener("keydown",t.onKeyDownListener),t.element.addEventListener("focus",t.onFocusListener),t.element.addEventListener("cut",t.onCutListener),t.element.addEventListener("copy",t.onCopyListener),t.initPhoneFormatter(),t.initDateFormatter(),t.initTimeFormatter(),t.initNumeralFormatter(),(e.initValue||e.prefix&&!e.noImmediatePrefix)&&t.onInput(e.initValue)):t.onInput(e.initValue)},initSwapHiddenInput:function(){var t=this;if(t.properties.swapHiddenInput){var e=t.element.cloneNode(!0);t.element.parentNode.insertBefore(e,t.element),t.elementSwapHidden=t.element,t.elementSwapHidden.type="hidden",t.element=e,t.element.id=""}},initNumeralFormatter:function(){var t=this.properties;t.numeral&&(t.numeralFormatter=new jt.NumeralFormatter(t.numeralDecimalMark,t.numeralIntegerScale,t.numeralDecimalScale,t.numeralThousandsGroupStyle,t.numeralPositiveOnly,t.stripLeadingZeroes,t.prefix,t.signBeforePrefix,t.tailPrefix,t.delimiter))},initTimeFormatter:function(){var t=this.properties;t.time&&(t.timeFormatter=new jt.TimeFormatter(t.timePattern,t.timeFormat),t.blocks=t.timeFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=jt.Util.getMaxLength(t.blocks))},initDateFormatter:function(){var t=this.properties;t.date&&(t.dateFormatter=new jt.DateFormatter(t.datePattern,t.dateMin,t.dateMax),t.blocks=t.dateFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=jt.Util.getMaxLength(t.blocks))},initPhoneFormatter:function(){var t=this.properties;if(t.phone)try{t.phoneFormatter=new jt.PhoneFormatter(new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),t.delimiter)}catch(e){throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(t){var e=this,r=t.which||t.keyCode;e.lastInputValue=e.element.value,e.isBackward=8===r},onChange:function(t){var e=this,r=e.properties,i=jt.Util;e.isBackward=e.isBackward||"deleteContentBackward"===t.inputType;var n=i.getPostDelimiter(e.lastInputValue,r.delimiter,r.delimiters);e.isBackward&&n?r.postDelimiterBackspace=n:r.postDelimiterBackspace=!1,this.onInput(this.element.value)},onFocus:function(){var t=this,e=t.properties;t.lastInputValue=t.element.value,e.prefix&&e.noImmediatePrefix&&!t.element.value&&this.onInput(e.prefix),jt.Util.fixPrefixCursor(t.element,e.prefix,e.delimiter,e.delimiters)},onCut:function(t){jt.Util.checkFullSelection(this.element.value)&&(this.copyClipboardData(t),this.onInput(""))},onCopy:function(t){jt.Util.checkFullSelection(this.element.value)&&this.copyClipboardData(t)},copyClipboardData:function(t){var e=this.properties,r=jt.Util,i=this.element.value,n="";n=e.copyDelimiter?i:r.stripDelimiters(i,e.delimiter,e.delimiters);try{t.clipboardData?t.clipboardData.setData("Text",n):window.clipboardData.setData("Text",n),t.preventDefault()}catch(o){}},onInput:function(t){var e=this,r=e.properties,i=jt.Util,n=i.getPostDelimiter(t,r.delimiter,r.delimiters);return r.numeral||!r.postDelimiterBackspace||n||(t=i.headStr(t,t.length-r.postDelimiterBackspace.length)),r.phone?(!r.prefix||r.noImmediatePrefix&&!t.length?r.result=r.phoneFormatter.format(t):r.result=r.prefix+r.phoneFormatter.format(t).slice(r.prefix.length),void e.updateValueState()):r.numeral?(r.prefix&&r.noImmediatePrefix&&0===t.length?r.result="":r.result=r.numeralFormatter.format(t),void e.updateValueState()):(r.date&&(t=r.dateFormatter.getValidatedDate(t)),r.time&&(t=r.timeFormatter.getValidatedTime(t)),t=i.stripDelimiters(t,r.delimiter,r.delimiters),t=i.getPrefixStrippedValue(t,r.prefix,r.prefixLength,r.result,r.delimiter,r.delimiters,r.noImmediatePrefix,r.tailPrefix,r.signBeforePrefix),t=r.numericOnly?i.strip(t,/[^\d]/g):t,t=r.uppercase?t.toUpperCase():t,t=r.lowercase?t.toLowerCase():t,r.prefix&&(r.tailPrefix?t+=r.prefix:t=r.prefix+t,0===r.blocksLength)?(r.result=t,void e.updateValueState()):(r.creditCard&&e.updateCreditCardPropsByValue(t),t=i.headStr(t,r.maxLength),r.result=i.getFormattedValue(t,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void e.updateValueState()))},updateCreditCardPropsByValue:function(t){var e,r=this.properties,i=jt.Util;i.headStr(r.result,4)!==i.headStr(t,4)&&(e=jt.CreditCardDetector.getInfo(t,r.creditCardStrictMode),r.blocks=e.blocks,r.blocksLength=r.blocks.length,r.maxLength=i.getMaxLength(r.blocks),r.creditCardType!==e.type&&(r.creditCardType=e.type,r.onCreditCardTypeChanged.call(this,r.creditCardType)))},updateValueState:function(){var t=this,e=jt.Util,r=t.properties;if(t.element){var i=t.element.selectionEnd,n=t.element.value,o=r.result;i=e.getNextCursorPosition(i,n,o,r.delimiter,r.delimiters),t.isAndroid?window.setTimeout(function(){t.element.value=o,e.setSelection(t.element,i,r.document,!1),t.callOnValueChanged()},1):(t.element.value=o,r.swapHiddenInput&&(t.elementSwapHidden.value=t.getRawValue()),e.setSelection(t.element,i,r.document,!1),t.callOnValueChanged())}},callOnValueChanged:function(){var t=this,e=t.properties;e.onValueChanged.call(t,{target:{name:t.element.name,value:e.result,rawValue:t.getRawValue()}})},setPhoneRegionCode:function(t){var e=this;e.properties.phoneRegionCode=t,e.initPhoneFormatter(),e.onChange()},setRawValue:function(t){var e=this,r=e.properties;t=null!=t?t.toString():"",r.numeral&&(t=t.replace(".",r.numeralDecimalMark)),r.postDelimiterBackspace=!1,e.element.value=t,e.onInput(t)},getRawValue:function(){var t=this.properties,e=jt.Util,r=this.element.value;return t.rawValueTrimPrefix&&(r=e.getPrefixStrippedValue(r,t.prefix,t.prefixLength,t.result,t.delimiter,t.delimiters,t.noImmediatePrefix,t.tailPrefix,t.signBeforePrefix)),r=t.numeral?t.numeralFormatter.getRawValue(r):e.stripDelimiters(r,t.delimiter,t.delimiters)},getISOFormatDate:function(){var t=this.properties;return t.date?t.dateFormatter.getISOFormatDate():""},getISOFormatTime:function(){var t=this.properties;return t.time?t.timeFormatter.getISOFormatTime():""},getFormattedValue:function(){return this.element.value},destroy:function(){var t=this;t.element.removeEventListener("input",t.onChangeListener),t.element.removeEventListener("keydown",t.onKeyDownListener),t.element.removeEventListener("focus",t.onFocusListener),t.element.removeEventListener("cut",t.onCutListener),t.element.removeEventListener("copy",t.onCopyListener)},toString:function(){return"[Cleave Object]"}},jt.NumeralFormatter=Tt,jt.DateFormatter=Rt,jt.TimeFormatter=Ut,jt.PhoneFormatter=Ft,jt.CreditCardDetector=qt,jt.Util=Ot,jt.DefaultProperties=Ht,("object"==typeof Mt&&Mt?Mt:window).Cleave=jt;var Vt=jt,Yt={},Qt={},Kt={};let Gt;const Jt=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Kt.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},Kt.getSymbolTotalCodewords=function(t){return Jt[t]},Kt.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},Kt.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');Gt=t},Kt.isKanjiModeEnabled=function(){return void 0!==Gt},Kt.toSJIS=function(t){return Gt(t)};var Zt,Wt={};function Xt(){this.buffer=[],this.length=0}(Zt=Wt).L={bit:1},Zt.M={bit:0},Zt.Q={bit:3},Zt.H={bit:2},Zt.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},Zt.from=function(t,e){if(Zt.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Zt.L;case"m":case"medium":return Zt.M;case"q":case"quartile":return Zt.Q;case"h":case"high":return Zt.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(r){return e}},Xt.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let r=0;r<e;r++)this.putBit(1==(t>>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var te=Xt;function ee(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ee.prototype.set=function(t,e,r,i){const n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},ee.prototype.get=function(t,e){return this.data[t*this.size+e]},ee.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},ee.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var re=ee,ie={};!function(t){const e=Kt.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const r=Math.floor(t/7)+2,i=e(t),n=145===i?26:2*Math.ceil((i-13)/(2*r-2)),o=[i-7];for(let e=1;e<r-1;e++)o[e]=o[e-1]-n;return o.push(6),o.reverse()},t.getPositions=function(e){const r=[],i=t.getRowColCoords(e),n=i.length;for(let t=0;t<n;t++)for(let e=0;e<n;e++)0===t&&0===e||0===t&&e===n-1||t===n-1&&0===e||r.push([i[t],i[e]]);return r}}(ie);var ne={};const oe=Kt.getSymbolSize;ne.getPositions=function(t){const e=oe(t);return[[0,0],[e-7,0],[0,e-7]]};var se={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,r=3,i=40,n=10;function o(e,r,i){switch(e){case t.Patterns.PATTERN000:return(r+i)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return i%3==0;case t.Patterns.PATTERN011:return(r+i)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2==0;case t.Patterns.PATTERN101:return r*i%2+r*i%3==0;case t.Patterns.PATTERN110:return(r*i%2+r*i%3)%2==0;case t.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const r=t.size;let i=0,n=0,o=0,s=null,a=null;for(let l=0;l<r;l++){n=o=0,s=a=null;for(let d=0;d<r;d++){let r=t.get(l,d);r===s?n++:(n>=5&&(i+=e+(n-5)),s=r,n=1),r=t.get(d,l),r===a?o++:(o>=5&&(i+=e+(o-5)),a=r,o=1)}n>=5&&(i+=e+(n-5)),o>=5&&(i+=e+(o-5))}return i},t.getPenaltyN2=function(t){const e=t.size;let i=0;for(let r=0;r<e-1;r++)for(let n=0;n<e-1;n++){const e=t.get(r,n)+t.get(r,n+1)+t.get(r+1,n)+t.get(r+1,n+1);4!==e&&0!==e||i++}return i*r},t.getPenaltyN3=function(t){const e=t.size;let r=0,n=0,o=0;for(let i=0;i<e;i++){n=o=0;for(let s=0;s<e;s++)n=n<<1&2047|t.get(i,s),s>=10&&(1488===n||93===n)&&r++,o=o<<1&2047|t.get(s,i),s>=10&&(1488===o||93===o)&&r++}return r*i},t.getPenaltyN4=function(t){let e=0;const r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return Math.abs(Math.ceil(100*e/r/5)-10)*n},t.applyMask=function(t,e){const r=e.size;for(let i=0;i<r;i++)for(let n=0;n<r;n++)e.isReserved(n,i)||e.xor(n,i,o(t,n,i))},t.getBestMask=function(e,r){const i=Object.keys(t.Patterns).length;let n=0,o=1/0;for(let s=0;s<i;s++){r(s),t.applyMask(s,e);const i=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),i<o&&(o=i,n=s)}return n}}(se);var ae={};const le=Wt,de=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],ce=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ae.getBlocksCount=function(t,e){switch(e){case le.L:return de[4*(t-1)+0];case le.M:return de[4*(t-1)+1];case le.Q:return de[4*(t-1)+2];case le.H:return de[4*(t-1)+3];default:return}},ae.getTotalCodewordsCount=function(t,e){switch(e){case le.L:return ce[4*(t-1)+0];case le.M:return ce[4*(t-1)+1];case le.Q:return ce[4*(t-1)+2];case le.H:return ce[4*(t-1)+3];default:return}};var ue={},he={};const pe=new Uint8Array(512),me=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)pe[e]=t,me[t]=e,t<<=1,256&t&&(t^=285);for(let e=255;e<512;e++)pe[e]=pe[e-255]}(),he.log=function(t){if(t<1)throw new Error("log("+t+")");return me[t]},he.exp=function(t){return pe[t]},he.mul=function(t,e){return 0===t||0===e?0:pe[me[t]+me[e]]},function(t){const e=he;t.mul=function(t,r){const i=new Uint8Array(t.length+r.length-1);for(let n=0;n<t.length;n++)for(let o=0;o<r.length;o++)i[n+o]^=e.mul(t[n],r[o]);return i},t.mod=function(t,r){let i=new Uint8Array(t);for(;i.length-r.length>=0;){const t=i[0];for(let o=0;o<r.length;o++)i[o]^=e.mul(r[o],t);let n=0;for(;n<i.length&&0===i[n];)n++;i=i.slice(n)}return i},t.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let n=0;n<r;n++)i=t.mul(i,new Uint8Array([1,e.exp(n)]));return i}}(ue);const ge=ue;function fe(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}fe.prototype.initialize=function(t){this.degree=t,this.genPoly=ge.generateECPolynomial(this.degree)},fe.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const r=ge.mod(e,this.genPoly),i=this.degree-r.length;if(i>0){const t=new Uint8Array(this.degree);return t.set(r,i),t}return r};var ye=fe,ve={},be={},we={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},xe={};const ke="[0-9]+";let Se="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Se=Se.replace(/u/g,"\\u");const Pe="(?:(?![A-Z0-9 $%*+\\-./:]|"+Se+")(?:.|[\r\n]))+";xe.KANJI=new RegExp(Se,"g"),xe.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),xe.BYTE=new RegExp(Pe,"g"),xe.NUMERIC=new RegExp(ke,"g"),xe.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const Ce=new RegExp("^"+Se+"$"),Ae=new RegExp("^"+ke+"$"),$e=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");xe.testKanji=function(t){return Ce.test(t)},xe.testNumeric=function(t){return Ae.test(t)},xe.testAlphanumeric=function(t){return $e.test(t)},function(t){const e=we,r=xe;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(i){return r}}}(be),function(t){const e=Kt,r=ae,i=Wt,n=be,o=we,s=e.getBCHDigit(7973);function a(t,e){return n.getCharCountIndicator(t,e)+4}function l(t,e){let r=0;return t.forEach(function(t){const i=a(t.mode,e);r+=i+t.getBitsLength()}),r}t.from=function(t,e){return o.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,i,s){if(!o.isValid(t))throw new Error("Invalid QR Code version");void 0===s&&(s=n.BYTE);const l=8*(e.getSymbolTotalCodewords(t)-r.getTotalCodewordsCount(t,i));if(s===n.MIXED)return l;const d=l-a(s,t);switch(s){case n.NUMERIC:return Math.floor(d/10*3);case n.ALPHANUMERIC:return Math.floor(d/11*2);case n.KANJI:return Math.floor(d/13);case n.BYTE:default:return Math.floor(d/8)}},t.getBestVersionForData=function(e,r){let o;const s=i.from(r,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,r){for(let i=1;i<=40;i++)if(l(e,i)<=t.getCapacity(i,r,n.MIXED))return i}(e,s);if(0===e.length)return 1;o=e[0]}else o=e;return function(e,r,i){for(let n=1;n<=40;n++)if(r<=t.getCapacity(n,i,e))return n}(o.mode,o.getLength(),s)},t.getEncodedBits=function(t){if(!o.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;e.getBCHDigit(r)-s>=0;)r^=7973<<e.getBCHDigit(r)-s;return t<<12|r}}(ve);var Ee={};const _e=Kt,Ie=_e.getBCHDigit(1335);Ee.getEncodedBits=function(t,e){const r=t.bit<<3|e;let i=r<<10;for(;_e.getBCHDigit(i)-Ie>=0;)i^=1335<<_e.getBCHDigit(i)-Ie;return 21522^(r<<10|i)};var Me={};const Ne=be;function Te(t){this.mode=Ne.NUMERIC,this.data=t.toString()}Te.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Te.prototype.getLength=function(){return this.data.length},Te.prototype.getBitsLength=function(){return Te.getBitsLength(this.data.length)},Te.prototype.write=function(t){let e,r,i;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),i=parseInt(r,10),t.put(i,10);const n=this.data.length-e;n>0&&(r=this.data.substr(e),i=parseInt(r,10),t.put(i,3*n+1))};var De=Te;const Re=be,Le=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Ue(t){this.mode=Re.ALPHANUMERIC,this.data=t}Ue.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},Ue.prototype.getLength=function(){return this.data.length},Ue.prototype.getBitsLength=function(){return Ue.getBitsLength(this.data.length)},Ue.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*Le.indexOf(this.data[e]);r+=Le.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(Le.indexOf(this.data[e]),6)};var Be=Ue;const Fe=be;function ze(t){this.mode=Fe.BYTE,this.data="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}ze.getBitsLength=function(t){return 8*t},ze.prototype.getLength=function(){return this.data.length},ze.prototype.getBitsLength=function(){return ze.getBitsLength(this.data.length)},ze.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var qe=ze;const Oe=be,He=Kt;function je(t){this.mode=Oe.KANJI,this.data=t}je.getBitsLength=function(t){return 13*t},je.prototype.getLength=function(){return this.data.length},je.prototype.getBitsLength=function(){return je.getBitsLength(this.data.length)},je.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=He.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}};var Ve,Ye=je,Qe={exports:{}};Ve={single_source_shortest_paths:function(t,e,r){var i={},n={};n[e]=0;var o,s,a,l,d,c,u,h=Ve.PriorityQueue.make();for(h.push(e,0);!h.empty();)for(a in s=(o=h.pop()).value,l=o.cost,d=t[s]||{})d.hasOwnProperty(a)&&(c=l+d[a],u=n[a],(void 0===n[a]||u>c)&&(n[a]=c,h.push(a,c),i[a]=s));if(void 0!==r&&void 0===n[r]){var p=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],i=e;i;)r.push(i),t[i],i=t[i];return r.reverse(),r},find_path:function(t,e,r){var i=Ve.single_source_shortest_paths(t,e,r);return Ve.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e,r=Ve.PriorityQueue,i={};for(e in t=t||{},r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}},Qe.exports=Ve;var Ke=Qe.exports;!function(t){const e=be,r=De,i=Be,n=qe,o=Ye,s=xe,a=Kt,l=Ke;function d(t){return unescape(encodeURIComponent(t)).length}function c(t,e,r){const i=[];let n;for(;null!==(n=t.exec(r));)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function u(t){const r=c(s.NUMERIC,e.NUMERIC,t),i=c(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let n,o;a.isKanjiModeEnabled()?(n=c(s.BYTE,e.BYTE,t),o=c(s.KANJI,e.KANJI,t)):(n=c(s.BYTE_KANJI,e.BYTE,t),o=[]);return r.concat(i,n,o).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function h(t,s){switch(s){case e.NUMERIC:return r.getBitsLength(t);case e.ALPHANUMERIC:return i.getBitsLength(t);case e.KANJI:return o.getBitsLength(t);case e.BYTE:return n.getBitsLength(t)}}function p(t,s){let l;const d=e.getBestModeForData(t);if(l=e.from(s,d),l!==e.BYTE&&l.bit<d.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(l)+".\n Suggested mode is: "+e.toString(d));switch(l!==e.KANJI||a.isKanjiModeEnabled()||(l=e.BYTE),l){case e.NUMERIC:return new r(t);case e.ALPHANUMERIC:return new i(t);case e.KANJI:return new o(t);case e.BYTE:return new n(t)}}t.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t},[])},t.fromString=function(r,i){const n=function(t){const r=[];for(let i=0;i<t.length;i++){const n=t[i];switch(n.mode){case e.NUMERIC:r.push([n,{data:n.data,mode:e.ALPHANUMERIC,length:n.length},{data:n.data,mode:e.BYTE,length:n.length}]);break;case e.ALPHANUMERIC:r.push([n,{data:n.data,mode:e.BYTE,length:n.length}]);break;case e.KANJI:r.push([n,{data:n.data,mode:e.BYTE,length:d(n.data)}]);break;case e.BYTE:r.push([{data:n.data,mode:e.BYTE,length:d(n.data)}])}}return r}(u(r,a.isKanjiModeEnabled())),o=function(t,r){const i={},n={start:{}};let o=["start"];for(let s=0;s<t.length;s++){const a=t[s],l=[];for(let t=0;t<a.length;t++){const d=a[t],c=""+s+t;l.push(c),i[c]={node:d,lastCount:0},n[c]={};for(let t=0;t<o.length;t++){const s=o[t];i[s]&&i[s].node.mode===d.mode?(n[s][c]=h(i[s].lastCount+d.length,d.mode)-h(i[s].lastCount,d.mode),i[s].lastCount+=d.length):(i[s]&&(i[s].lastCount=d.length),n[s][c]=h(d.length,d.mode)+4+e.getCharCountIndicator(d.mode,r))}}o=l}for(let e=0;e<o.length;e++)n[o[e]].end=0;return{map:n,table:i}}(n,i),s=l.find_path(o.map,"start","end"),c=[];for(let t=1;t<s.length-1;t++)c.push(o.table[s[t]].node);return t.fromArray(function(t){return t.reduce(function(t,e){const r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}(c))},t.rawSplit=function(e){return t.fromArray(u(e,a.isKanjiModeEnabled()))}}(Me);const Ge=Kt,Je=Wt,Ze=te,We=re,Xe=ie,tr=ne,er=se,rr=ae,ir=ye,nr=ve,or=Ee,sr=be,ar=Me;function lr(t,e,r){const i=t.size,n=or.getEncodedBits(e,r);let o,s;for(o=0;o<15;o++)s=1==(n>>o&1),o<6?t.set(o,8,s,!0):o<8?t.set(o+1,8,s,!0):t.set(i-15+o,8,s,!0),o<8?t.set(8,i-o-1,s,!0):o<9?t.set(8,15-o-1+1,s,!0):t.set(8,15-o-1,s,!0);t.set(i-8,8,1,!0)}function dr(t,e,r){const i=new Ze;r.forEach(function(e){i.put(e.mode.bit,4),i.put(e.getLength(),sr.getCharCountIndicator(e.mode,t)),e.write(i)});const n=8*(Ge.getSymbolTotalCodewords(t)-rr.getTotalCodewordsCount(t,e));for(i.getLengthInBits()+4<=n&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const o=(n-i.getLengthInBits())/8;for(let s=0;s<o;s++)i.put(s%2?17:236,8);return function(t,e,r){const i=Ge.getSymbolTotalCodewords(e),n=rr.getTotalCodewordsCount(e,r),o=i-n,s=rr.getBlocksCount(e,r),a=i%s,l=s-a,d=Math.floor(i/s),c=Math.floor(o/s),u=c+1,h=d-c,p=new ir(h);let m=0;const g=new Array(s),f=new Array(s);let y=0;const v=new Uint8Array(t.buffer);for(let S=0;S<s;S++){const t=S<l?c:u;g[S]=v.slice(m,m+t),f[S]=p.encode(g[S]),m+=t,y=Math.max(y,t)}const b=new Uint8Array(i);let w,x,k=0;for(w=0;w<y;w++)for(x=0;x<s;x++)w<g[x].length&&(b[k++]=g[x][w]);for(w=0;w<h;w++)for(x=0;x<s;x++)b[k++]=f[x][w];return b}(i,t,e)}function cr(t,e,r,i){let n;if(Array.isArray(t))n=ar.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let i=e;if(!i){const e=ar.rawSplit(t);i=nr.getBestVersionForData(e,r)}n=ar.fromString(t,i||40)}}const o=nr.getBestVersionForData(n,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else e=o;const s=dr(e,r,n),a=Ge.getSymbolSize(e),l=new We(a);return function(t,e){const r=t.size,i=tr.getPositions(e);for(let n=0;n<i.length;n++){const e=i[n][0],o=i[n][1];for(let i=-1;i<=7;i++)if(!(e+i<=-1||r<=e+i))for(let n=-1;n<=7;n++)o+n<=-1||r<=o+n||(i>=0&&i<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===i||6===i)||i>=2&&i<=4&&n>=2&&n<=4?t.set(e+i,o+n,!0,!0):t.set(e+i,o+n,!1,!0))}}(l,e),function(t){const e=t.size;for(let r=8;r<e-8;r++){const e=r%2==0;t.set(r,6,e,!0),t.set(6,r,e,!0)}}(l),function(t,e){const r=Xe.getPositions(e);for(let i=0;i<r.length;i++){const e=r[i][0],n=r[i][1];for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)-2===r||2===r||-2===i||2===i||0===r&&0===i?t.set(e+r,n+i,!0,!0):t.set(e+r,n+i,!1,!0)}}(l,e),lr(l,r,0),e>=7&&function(t,e){const r=t.size,i=nr.getEncodedBits(e);let n,o,s;for(let a=0;a<18;a++)n=Math.floor(a/3),o=a%3+r-8-3,s=1==(i>>a&1),t.set(n,o,s,!0),t.set(o,n,s,!0)}(l,e),function(t,e){const r=t.size;let i=-1,n=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!t.isReserved(n,a-r)){let i=!1;s<e.length&&(i=1==(e[s]>>>o&1)),t.set(n,a-r,i),o--,-1===o&&(s++,o=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}(l,s),isNaN(i)&&(i=er.getBestMask(l,lr.bind(null,l,r))),er.applyMask(i,l),lr(l,r,i),{modules:l,version:e,errorCorrectionLevel:r,maskPattern:i,segments:n}}Qt.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let r,i,n=Je.M;return void 0!==e&&(n=Je.from(e.errorCorrectionLevel,Je.M),r=nr.from(e.version),i=er.from(e.maskPattern),e.toSJISFunc&&Ge.setToSJISFunction(e.toSJISFunc)),cr(t,r,n,i)};var ur={},hr={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");const r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const r=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,i=t.width&&t.width>=21?t.width:void 0,n=t.scale||4;return{width:i,scale:i?4:n,margin:r,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,r){const i=t.getScale(e,r);return Math.floor((e+2*r.margin)*i)},t.qrToImageData=function(e,r,i){const n=r.modules.size,o=r.modules.data,s=t.getScale(n,i),a=Math.floor((n+2*i.margin)*s),l=i.margin*s,d=[i.color.light,i.color.dark];for(let t=0;t<a;t++)for(let r=0;r<a;r++){let c=4*(t*a+r),u=i.color.light;if(t>=l&&r>=l&&t<a-l&&r<a-l){u=d[o[Math.floor((t-l)/s)*n+Math.floor((r-l)/s)]?1:0]}e[c++]=u.r,e[c++]=u.g,e[c++]=u.b,e[c]=u.a}}}(hr),function(t){const e=hr;t.render=function(t,r,i){let n=i,o=r;void 0!==n||r&&r.getContext||(n=r,r=void 0),r||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),n=e.getOptions(n);const s=e.getImageWidth(t.modules.size,n),a=o.getContext("2d"),l=a.createImageData(s,s);return e.qrToImageData(l.data,t,n),function(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}(a,o,s),a.putImageData(l,0,0),o},t.renderToDataURL=function(e,r,i){let n=i;void 0!==n||r&&r.getContext||(n=r,r=void 0),n||(n={});const o=t.render(e,r,n),s=n.type||"image/png",a=n.rendererOpts||{};return o.toDataURL(s,a.quality)}}(ur);var pr={};const mr=hr;function gr(t,e){const r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function fr(t,e,r){let i=t+e;return void 0!==r&&(i+=" "+r),i}pr.render=function(t,e,r){const i=mr.getOptions(e),n=t.modules.size,o=t.modules.data,s=n+2*i.margin,a=i.color.light.a?"<path "+gr(i.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",l="<path "+gr(i.color.dark,"stroke")+' d="'+function(t,e,r){let i="",n=0,o=!1,s=0;for(let a=0;a<t.length;a++){const l=Math.floor(a%e),d=Math.floor(a/e);l||o||(o=!0),t[a]?(s++,a>0&&l>0&&t[a-1]||(i+=o?fr("M",l+r,.5+d+r):fr("m",n,0),n=0,o=!1),l+1<e&&t[a+1]||(i+=fr("h",s),s=0)):n++}return i}(o,n,i.margin)+'"/>',d='viewBox="0 0 '+s+" "+s+'"',c='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+d+' shape-rendering="crispEdges">'+a+l+"</svg>\n";return"function"==typeof r&&r(null,c),c};const yr=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},vr=Qt,br=ur,wr=pr;function xr(t,e,r,i,n){const o=[].slice.call(arguments,1),s=o.length,a="function"==typeof o[s-1];if(!a&&!yr())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=e,e=i=void 0):2!==s||e.getContext||(i=r,r=e,e=void 0),new Promise(function(n,o){try{const o=vr.create(r,i);n(t(o,e,i))}catch(s){o(s)}})}if(s<2)throw new Error("Too few arguments provided");2===s?(n=r,r=e,e=i=void 0):3===s&&(e.getContext&&void 0===n?(n=i,i=void 0):(n=i,i=r,r=e,e=void 0));try{const o=vr.create(r,i);n(null,t(o,e,i))}catch(l){n(l)}}Yt.create=vr.create,Yt.toCanvas=xr.bind(null,br.render),Yt.toDataURL=xr.bind(null,br.renderToDataURL),Yt.toString=xr.bind(null,function(t,e,r){return wr.render(t,r)});var kr=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,Pr=(t,e,r,i)=>{for(var n,o=i>1?void 0:i?Sr(e,r):e,s=t.length-1;s>=0;s--)(n=t[s])&&(o=(i?n(e,r,o):n(o))||o);return i&&o&&kr(e,r,o),o};let Cr=class extends st{constructor(){super(...arguments),this.currentState={status:"idle"},this.selectedMethod=null,this.cardFormData={cardNumber:"",expiry:"",cvv:"",cardholderName:""},this.formErrors={},this.paymentData=null,this.feesExpanded=!1,this.isInitializing=!0,this.cardBrand="unknown",this.paymentLocked=!1,this.show3DSModal=!1,this.showQRModal=!1,this.nextActionUrl=null,this.qrCode=null,this.qrCodeDataUrl=null,this.qrAutoResumeTimer=null,this.qrPollingInProgress=!1,this.sdk=null,this.isInitialized=!1,this.cardNumberCleave=null,this.expiryCleave=null,this.leaveEventsCounter=0,this.previousState=null,this.cssVariableMap={colorPrimary:"--op-color-primary",colorPrimaryHover:"--op-color-primary-hover",colorPrimaryText:"--op-color-primary-text",colorBackground:"--op-color-background",colorSurface:"--op-color-surface",colorText:"--op-color-text",colorTextSecondary:"--op-color-text-secondary",colorDanger:"--op-color-danger",colorSuccess:"--op-color-success",colorWarning:"--op-color-warning",colorBorder:"--op-color-border",colorBorderFocus:"--op-color-border-focus",fontFamily:"--op-font-family",fontSize:"--op-font-size",fontSizeSmall:"--op-font-size-sm",borderRadius:"--op-border-radius",borderRadiusLarge:"--op-border-radius-lg",spacingUnit:"--op-spacing-unit",boxShadow:"--op-box-shadow",boxShadowLarge:"--op-box-shadow-lg"},this.themeMediaQuery=null,this.themeMediaQueryHandler=null,this.handle3DSPostMessage=t=>{"ON_AWX_3DS_START_PAGE_LEAVE"===t.data&&(this.leaveEventsCounter++,this.leaveEventsCounter>1&&this.handle3DSComplete())}}hasAllRequiredProps(){return!!(this.config&&this.adapters&&this.amount&&this.currency&&this.orderId)&&(!(!this.firstName||"string"!=typeof this.firstName||""===this.firstName.trim())&&(!(!this.lastName||"string"!=typeof this.lastName||""===this.lastName.trim())&&(!(!this.email||"string"!=typeof this.email||""===this.email.trim())&&!(!this.phoneNumber||"string"!=typeof this.phoneNumber||""===this.phoneNumber.trim()))))}applyAppearance(){if(!this.appearance)return void this.removeAttribute("data-theme");const{theme:t,variables:e}=this.appearance;if(t)if("auto"===t){const t=window.matchMedia("(prefers-color-scheme: dark)").matches;this.dataset.theme=t?"dark":"light",this.setupThemeMediaQueryListener()}else this.dataset.theme=t;e&&this.applyCssVariables(e)}applyCssVariables(t){for(const[e,r]of Object.entries(this.cssVariableMap)){const i=t[e];null!=i?this.style.setProperty(r,i):this.style.removeProperty(r)}}setupThemeMediaQueryListener(){this.cleanupThemeMediaQueryListener(),this.themeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.themeMediaQueryHandler=t=>{var e;"auto"===(null==(e=this.appearance)?void 0:e.theme)&&(this.dataset.theme=t.matches?"dark":"light")},this.themeMediaQuery.addEventListener("change",this.themeMediaQueryHandler)}cleanupThemeMediaQueryListener(){this.themeMediaQuery&&this.themeMediaQueryHandler&&(this.themeMediaQuery.removeEventListener("change",this.themeMediaQueryHandler),this.themeMediaQuery=null,this.themeMediaQueryHandler=null)}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.handle3DSPostMessage),this.addEventListener("force-close-3ds-modal",()=>{this.show3DSModal&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0)})}firstUpdated(){this.applyAppearance(),this.initializeSDK()}updated(t){super.updated(t),t.has("appearance")&&this.applyAppearance(),!this.isInitialized&&this.hasAllRequiredProps()&&(console.info("[OnePayment] All required props now available. Initializing SDK..."),this.initializeSDK())}disconnectedCallback(){var t;super.disconnectedCallback(),this.cleanupThemeMediaQueryListener(),null==(t=this.sdk)||t.destroy(),this.isInitialized=!1,this.destroyCleave(),window.removeEventListener("message",this.handle3DSPostMessage),null!==this.qrAutoResumeTimer&&clearTimeout(this.qrAutoResumeTimer)}setupCleave(){setTimeout(()=>{var t,e;const r=null==(t=this.shadowRoot)?void 0:t.querySelector("#cardNumber"),i=null==(e=this.shadowRoot)?void 0:e.querySelector("#expiry");r&&!this.cardNumberCleave&&(this.cardNumberCleave=new Vt(r,{creditCard:!0,delimiter:" ",onCreditCardTypeChanged:t=>{this.cardBrand={visa:"visa",mastercard:"mastercard",amex:"amex",discover:"discover"}[t]||"unknown"}})),i&&!this.expiryCleave&&(this.expiryCleave=new Vt(i,{date:!0,datePattern:["m","y"],delimiter:"/"}))},50)}destroyCleave(){this.cardNumberCleave&&(this.cardNumberCleave.destroy(),this.cardNumberCleave=null),this.expiryCleave&&(this.expiryCleave.destroy(),this.expiryCleave=null)}getFilteredPaymentMethods(){const t=("ready"===this.currentState.status||"processing"===this.currentState.status||"requires_action"===this.currentState.status)&&this.currentState.availableMethods||[];return 0===t.length?[]:t.filter(t=>{var e;return!(null==(e=this.excludePaymentMethods)?void 0:e.includes(t.id))}).map(t=>{if(t.id===pt){if("SGD"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"PayNow is only available for SGD currency"}}if(t.id===mt){if("THB"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"PromptPay is only available for THB currency"}}if(t.id===gt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"DuitNow is only available for MYR currency"}}if(t.id===ft){if("IDR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"GoPay is only available for IDR currency"}}if(t.id===yt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Boost is only available for MYR currency"}}if(t.id===vt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"ShopeePay is only available for MYR currency"}}if(t.id===bt){const e=this.getTransactionData().currency;if("SGD"!==e&&"MYR"!==e)return{id:t.id,enabled:!1,disabledReason:"Atom is only available for SGD and MYR currencies"}}if(t.id===wt){if("IDR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Dana is only available for IDR currency"}}if(t.id===xt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Touch 'n Go is only available for MYR currency"}}return{id:t.id,enabled:!0}})}initializeSDK(){var t;this.config&&this.adapters&&this.amount&&this.currency&&this.orderId?this.firstName&&"string"==typeof this.firstName&&""!==this.firstName.trim()?this.lastName&&"string"==typeof this.lastName&&""!==this.lastName.trim()?this.email&&"string"==typeof this.email&&""!==this.email.trim()?this.isInitialized||(this.isInitialized=!0,null==(t=this.sdk)||t.destroy(),this.sdk=new It(this.config,this.adapters),this.sdk.subscribe(t=>{var e;"requires_action"===(null==(e=this.previousState)?void 0:e.status)&&"requires_action"!==t.status&&this.show3DSModal&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling()),this.previousState=t,this.currentState=t,this.dispatchEvent(new CustomEvent("state-change",{detail:{state:t},bubbles:!0,composed:!0}))}),this.sdk.on("payment_succeeded",t=>{this.dispatchEvent(new CustomEvent("payment-success",{detail:{paymentIntentId:t.payload.paymentIntent.id},bubbles:!0,composed:!0}))}),this.sdk.on("payment_failed",t=>{this.dispatchEvent(new CustomEvent("payment-error",{detail:{error:t.payload.error.message},bubbles:!0,composed:!0}))}),this.sdk.on("initialized",t=>{var e;if(this.paymentData=t.payload.paymentData,this.isInitializing=!1,null==(e=t.payload.paymentData)?void 0:e.sessionId){if(!document.getElementById("airwallex-fraud-api")){const e=document.createElement("script");e.src="https://static.airwallex.com/webapp/fraud/device-fingerprint/index.js",e.async=!0,e.setAttribute("data-order-session-id",t.payload.paymentData.sessionId),e.setAttribute("id","airwallex-fraud-api"),document.body.appendChild(e)}}}),this.sdk.on("payment_requires_action",t=>{this.nextActionUrl=t.payload.actionUrl,this.show3DSModal=!0,this.paymentLocked=!0,this.leaveEventsCounter=0}),this.sdk.on("poll_started",()=>{const t="undefined"!=typeof window&&"ReactNativeWebView"in window;this.show3DSModal&&t&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling())}),this.sdk.on("qr_code_received",async t=>{if(this.qrCode=t.payload.qrCode,!this.qrCode)return;const e=this.qrCode.startsWith("http://")||this.qrCode.startsWith("https://"),r=this.qrCode.startsWith("data:image");if(e||r)this.qrCodeDataUrl=this.qrCode;else try{const t=await Yt.toDataURL(this.qrCode,{width:300,margin:2,color:{dark:"#000000",light:"#FFFFFF"}});this.qrCodeDataUrl=t}catch(i){this.qrCodeDataUrl=null}this.showQRModal=!0,this.paymentLocked=!0,this.qrAutoResumeTimer=window.setTimeout(()=>{this.handleQRScanned()},1e4)}),this.sdk.on("promptpay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("duitnow_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("gopay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("boost_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("shopeepay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("atom_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("dana_redirect",t=>{console.log("[WebComponent] dana_redirect event received:",t.payload);const{redirectUrl:e}=t.payload;e&&(console.log("[WebComponent] Redirecting to Dana URL:",e),window.location.href=e)}),this.sdk.on("tng_redirect",t=>{console.log("[WebComponent] tng_redirect event received:",t.payload);const{redirectUrl:e}=t.payload;e&&(console.log("[WebComponent] Redirecting to TnG URL:",e),window.location.href=e)}),this.sdk.initialize({amount:this.amount,currency:this.currency,orderId:this.orderId})):console.error("OnePayment: email is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: lastName is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: firstName is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: Missing required props. Ensure config, adapters, amount, currency, and orderId are provided.")}handleMethodSelect(t){this.paymentLocked||(this.selectedMethod=t)}handleQRScanned(){null!==this.qrAutoResumeTimer&&(clearTimeout(this.qrAutoResumeTimer),this.qrAutoResumeTimer=null),this.qrPollingInProgress=!0,this.sdk&&this.sdk.resumePolling()}handle3DSComplete(){this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling()}handleInputChange(t,e){if(this.cardFormData={...this.cardFormData,[t]:e},this.formErrors[t]){const e={...this.formErrors};delete e[t],this.formErrors=e}}luhnCheck(t){const e=t.replace(/\s/g,"");if(!/^\d+$/.test(e))return!1;let r=0,i=!1;for(let n=e.length-1;n>=0;n--){const t=e.charAt(n);if(!t)continue;let o=parseInt(t,10);i&&(o*=2,o>9&&(o-=9)),r+=o,i=!i}return r%10==0}validateExpiry(t){const e=t.trim();if(!/^\d{1,2}\/\d{2}$/.test(e))return{valid:!1,error:"Invalid format (MM/YY)"};const r=e.split("/"),i=r[0],n=r[1];if(!i||!n)return{valid:!1,error:"Invalid format (MM/YY)"};const o=parseInt(i,10);if(o<1||o>12)return{valid:!1,error:"Invalid month (01-12)"};const s=new Date,a=s.getFullYear(),l=s.getMonth()+1;let d;if(2!==n.length)return{valid:!1,error:"Invalid year format"};{const t=parseInt(n,10),e=a%100,r=100*Math.floor(a/100);if(t<e){d=e-t>80?r+100+t:r+t}else d=r+t}return d<a||d===a&&o<l?{valid:!1,error:"Card has expired"}:{valid:!0}}validateCardForm(){const t={};if(this.cardFormData.cardNumber.trim()?this.luhnCheck(this.cardFormData.cardNumber)||(t.cardNumber="Invalid card number"):t.cardNumber="Please enter card number",this.cardFormData.expiry.trim()){const e=this.validateExpiry(this.cardFormData.expiry);e.valid||(t.expiry=e.error)}else t.expiry="Please enter expiry date";return this.cardFormData.cvv.trim()||(t.cvv="Please enter CVV"),this.cardFormData.cardholderName.trim()||(t.cardholderName="Please enter cardholder name"),this.formErrors=t,0===Object.keys(t).length}handleCardPayment(){if(!this.sdk||"ready"!==this.currentState.status)return;if(!this.validateCardForm())return;this.paymentLocked=!0;const t=this.cardFormData.expiry.split("/"),e=(t[0]||"").trim(),r=`20${(t[1]||"").trim().substring(0,2)}`;this.sdk.submitPayment(ht,{cardNumber:this.cardFormData.cardNumber.replace(/\s/g,""),expiryMonth:e,expiryYear:r,cvv:this.cardFormData.cvv,firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber})}handlePayNowPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(pt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handlePromptPayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(mt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleDuitNowPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(gt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleGoPayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(ft,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleBoostPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(yt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleShopeePayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(vt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleAtomPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(bt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleDanaPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(wt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleTngPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(xt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}getPayButtonAmount(){const t=this.getTransactionData();return`${this.currency} ${t.netAmount.toFixed(2)}`}getTransactionData(){var t;const e=this.paymentData;if(!e)return{currency:this.currency,charge:this.amount,fees:0,feeBreakdown:{transactionFee:0,merchantFee:0,merchantFeeLabel:""},netAmount:this.amount};const r=null==(t=e.fees)?void 0:t.find(t=>"merchant"===t.owner),i="number"==typeof e.totalFee?e.totalFee:Number(e.totalFee)||0,n="number"==typeof e.totalSystemFee?e.totalSystemFee:Number(e.totalSystemFee)||0,o=null!=e.initialAmount?"number"==typeof e.initialAmount?e.initialAmount:Number(e.initialAmount)||0:this.amount,s=null!=e.customerAmount?"number"==typeof e.customerAmount?e.customerAmount:Number(e.customerAmount)||0:o,a=i-n;return{currency:e.currency||this.currency,charge:o,fees:i,feeBreakdown:{transactionFee:a,merchantFee:a,merchantFeeLabel:(r?"percentage"===r.type?`${r.value}%`:`${r.value} ${r.currency}`:"")||"0%"},netAmount:s}}renderTransactionDetailsSkeleton(){return O`
11
+ */var e;const r=globalThis,i=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),s=new WeakMap;let o=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&s.set(e,t))}return t}toString(){return this.cssText}};const a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:p}=Object,m=globalThis,g=m.trustedTypes,f=g?g.emptyScript:"",y=m.reactiveElementPolyfillSupport,v=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(i){r=null}}return r}},w=(t,e)=>!l(t,e),x={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(t,r,e);void 0!==i&&d(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){const{get:i,set:n}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const s=null==i?void 0:i.call(this);null==n||n.call(this,e),this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...h(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const t=this._$Eu(e,r);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach(t=>t(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),n=r.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){var r;const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==(null==(r=i.converter)?void 0:r.toAttribute)?i.converter:b).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){var r,i;const n=this.constructor,s=n._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=n.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(r=t.converter)?void 0:r.fromAttribute)?t.converter:b;this._$Em=s;const a=o.fromAttribute(e,t.type);this[s]=a??(null==(i=this._$Ej)?void 0:i.get(s))??a,this._$Em=null}}requestUpdate(t,e,r){var i;if(void 0!==t){const n=this.constructor,s=this[t];if(r??(r=n.getPropertyOptions(t)),!((r.hasChanged??w)(s,e)||r.useDefault&&r.reflect&&s===(null==(i=this._$Ej)?void 0:i.get(t))&&!this.hasAttribute(n._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,s??e??this[t]),!0!==n||void 0!==s)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,r,i)}}let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostUpdate)?void 0:e.call(t)}),this.update(r)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null==(e=this._$EO)||e.forEach(t=>{var e;return null==(e=t.hostUpdated)?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[v("elementProperties")]=new Map,k[v("finalized")]=new Map,null==y||y({ReactiveElement:k}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.1.1");const S=globalThis,P=S.trustedTypes,C=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+$,_=`<${E}>`,M=document,I=()=>M.createComment(""),N=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,D="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,U=/>/g,B=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,q=/"/g,z=/^(?:script|style|textarea|title)$/i,H=(Q=1,(t,...e)=>({_$litType$:Q,strings:t,values:e})),O=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),V=new WeakMap,Y=M.createTreeWalker(M,129);var Q;function K(t,e){if(!T(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}class G{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0;const o=t.length-1,a=this.parts,[l,d]=((t,e)=>{const r=t.length-1,i=[];let n,s=2===e?"<svg>":3===e?"<math>":"",o=R;for(let a=0;a<r;a++){const e=t[a];let r,l,d=-1,c=0;for(;c<e.length&&(o.lastIndex=c,l=o.exec(e),null!==l);)c=o.lastIndex,o===R?"!--"===l[1]?o=L:void 0!==l[1]?o=U:void 0!==l[2]?(z.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=B):void 0!==l[3]&&(o=B):o===B?">"===l[0]?(o=n??R,d=-1):void 0===l[1]?d=-2:(d=o.lastIndex-l[2].length,r=l[1],o=void 0===l[3]?B:'"'===l[3]?q:F):o===q||o===F?o=B:o===L||o===U?o=R:(o=B,n=void 0);const u=o===B&&t[a+1].startsWith("/>")?" ":"";s+=o===R?e+_:d>=0?(i.push(r),e.slice(0,d)+A+e.slice(d)+$+u):e+$+(-2===d?a:u)}return[K(t,s+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]})(t,e);if(this.el=G.createElement(l,r),Y.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=Y.nextNode())&&a.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(A)){const e=d[s++],r=i.getAttribute(t).split($),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:o[2],strings:r,ctor:"."===o[1]?tt:"?"===o[1]?et:"@"===o[1]?rt:X}),i.removeAttribute(t)}else t.startsWith($)&&(a.push({type:6,index:n}),i.removeAttribute(t));if(z.test(i.tagName)){const t=i.textContent.split($),e=t.length-1;if(e>0){i.textContent=P?P.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],I()),Y.nextNode(),a.push({type:2,index:++n});i.append(t[e],I())}}}else if(8===i.nodeType)if(i.data===E)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf($,t+1));)a.push({type:7,index:n}),t+=$.length-1}n++}}static createElement(t,e){const r=M.createElement("template");return r.innerHTML=t,r}}function J(t,e,r=t,i){var n,s;if(e===O)return e;let o=void 0!==i?null==(n=r._$Co)?void 0:n[i]:r._$Cl;const a=N(e)?void 0:e._$litDirective$;return(null==o?void 0:o.constructor)!==a&&(null==(s=null==o?void 0:o._$AO)||s.call(o,!1),void 0===a?o=void 0:(o=new a(t),o._$AT(t,r,i)),void 0!==i?(r._$Co??(r._$Co=[]))[i]=o:r._$Cl=o),void 0!==o&&(e=J(t,o._$AS(t,e.values),o,i)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((null==t?void 0:t.creationScope)??M).importNode(e,!0);Y.currentNode=i;let n=Y.nextNode(),s=0,o=0,a=r[0];for(;void 0!==a;){if(s===a.index){let e;2===a.type?e=new W(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new it(n,this,t)),this._$AV.push(e),a=r[++o]}s!==(null==a?void 0:a.index)&&(n=Y.nextNode(),s++)}return Y.currentNode=M,i}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class W{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=j,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(null==i?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),N(t)?t===j||null==t||""===t?(this._$AH!==j&&this._$AR(),this._$AH=j):t!==this._$AH&&t!==O&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==j&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){var e;const{values:r,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=G.createElement(K(i.h,i.h[0]),this.options)),i);if((null==(e=this._$AH)?void 0:e._$AD)===n)this._$AH.p(r);else{const t=new Z(n,this),e=t.u(this.options);t.p(r),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new G(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of t)i===e.length?e.push(r=new W(this.O(I()),this.O(I()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for(null==(r=this._$AP)||r.call(this,!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cv=t,null==(e=this._$AP)||e.call(this,t))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=j,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=j}_$AI(t,e=this,r,i){const n=this.strings;let s=!1;if(void 0===n)t=J(this,t,e,0),s=!N(t)||t!==this._$AH&&t!==O,s&&(this._$AH=t);else{const i=t;let o,a;for(t=n[0],o=0;o<n.length-1;o++)a=J(this,i[r+o],e,o),a===O&&(a=this._$AH[o]),s||(s=!N(a)||a!==this._$AH[o]),a===j?t=j:t!==j&&(t+=(a??"")+n[o+1]),this._$AH[o]=a}s&&!i&&this.j(t)}j(t){t===j?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===j?void 0:t}}class et extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==j)}}class rt extends X{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??j)===O)return;const r=this._$AH,i=t===j&&r!==j||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==j&&(r===j||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;"function"==typeof this._$AH?this._$AH.call((null==(e=this.options)?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const nt=S.litHtmlPolyfillSupport;null==nt||nt(G,W),(S.litHtmlVersions??(S.litHtmlVersions=[])).push("3.3.1");const st=globalThis;class ot extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const i=(null==r?void 0:r.renderBefore)??e;let n=i._$litPart$;if(void 0===n){const t=(null==r?void 0:r.renderBefore)??null;i._$litPart$=n=new W(e.insertBefore(I(),t),t,void 0,r??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return O}}ot._$litElement$=!0,ot.finalized=!0,null==(e=st.litElementHydrateSupport)||e.call(st,{LitElement:ot});const at=st.litElementPolyfillSupport;null==at||at({LitElement:ot}),(st.litElementVersions??(st.litElementVersions=[])).push("4.2.1");const lt={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},dt=(t=lt,e,r)=>{const{kind:i,metadata:n}=r;let s=globalThis.litPropertyMetadata.get(n);if(void 0===s&&globalThis.litPropertyMetadata.set(n,s=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),"accessor"===i){const{name:i}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(i,n,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=r;return function(r){const n=this[i];e.call(this,r),this.requestUpdate(i,n,t)}}throw Error("Unsupported decorator location: "+i)};function ct(t){return(e,r)=>"object"==typeof r?dt(t,e,r):((t,e,r)=>{const i=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),i?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}function ut(t){return ct({...t,state:!0,attribute:!1})}const ht="card",pt="paynow",mt="promptpay",gt="duitnow",ft="gopay",yt="boost",vt="shopeepay",bt="atom",wt="dana",xt="tng",kt="alipaycn",St="alipayhk",Pt="gcash",Ct="idle",At="initializing",$t="ready",Et="processing",_t="requires_action",Mt="succeeded",It="failed";class Nt{constructor(t,e,r,i,n={},s){this.isPolling=!1,this.attempts=0,this.startTime=0,this.pollTimeoutId=null,this.adapters=t,this.baseUrl=e,this.token=r,this.onStatusUpdate=i,this.onPollStart=s,this.config={interval:n.interval??3e3,maxAttempts:n.maxAttempts??60,timeout:n.timeout??18e4,ignore3DS:n.ignore3DS??!1,ignoreQR:n.ignoreQR??!1}}start(){this.isPolling||(this.isPolling=!0,this.attempts=0,this.startTime=this.adapters.timer.now(),this.scheduleNextPoll())}stop(){this.isPolling=!1,null!==this.pollTimeoutId&&(clearTimeout(this.pollTimeoutId),this.pollTimeoutId=null)}get active(){return this.isPolling}get attemptCount(){return this.attempts}scheduleNextPoll(){if(!this.isPolling)return;if(this.attempts>=this.config.maxAttempts)return this.stop(),void this.onStatusUpdate({status:"failed",paymentIntentId:"",error:{code:"POLLING_MAX_ATTEMPTS",message:`Maximum polling attempts (${this.config.maxAttempts}) exceeded`}});if(this.adapters.timer.now()-this.startTime>=this.config.timeout)return this.stop(),void this.onStatusUpdate({status:"failed",paymentIntentId:"",error:{code:"POLLING_TIMEOUT",message:`Polling timeout (${this.config.timeout}ms) exceeded`}});this.pollTimeoutId=setTimeout(()=>{this.poll()},this.config.interval)}async poll(){if(this.isPolling){this.attempts++,this.onPollStart&&this.onPollStart();try{const e=await this.adapters.http.get(`${this.baseUrl}/payment-intent/get-payment-data`,{"x-token":this.token}),r={status:(t=e.result.status,"paid"===t?"succeeded":t),paymentIntentId:e.result.paymentIntentId||"",...void 0!==e.result.amount&&{amount:e.result.amount},...void 0!==e.result.currency&&{currency:e.result.currency},...void 0!==e.result.metadata&&{metadata:e.result.metadata},...void 0!==e.result.nextActionUrl&&{nextActionUrl:e.result.nextActionUrl},...void 0!==e.result.qrCode&&{qrCode:e.result.qrCode}};if(e.result.nextActionUrl&&!this.config.ignore3DS)return this.stop(),void this.onStatusUpdate(r);if(e.result.qrCode&&!this.config.ignoreQR)return this.stop(),void this.onStatusUpdate(r);if("succeeded"===e.result.status||"failed"===e.result.status||"paid"===e.result.status)return this.stop(),void this.onStatusUpdate(r);this.scheduleNextPoll()}catch(e){const t={status:"processing",paymentIntentId:"",error:{code:"POLLING_ERROR",message:e instanceof Error?e.message:"Unknown polling error"}};this.onStatusUpdate(t),this.scheduleNextPoll()}var t}}}class Tt{constructor(t,e){this.state={status:Ct},this.subscribers=new Set,this.eventListeners={},this.paymentToken=null,this.paymentIntentId=null,this.pollingService=null,this.ignore3DSInPolling=!1,this.ignoreQRInPolling=!1,this.config=t,this.adapters=e}getApiBaseUrl(){return this.config.apiBaseUrl??function(t){switch(t){case"prod":return"https://public.prod.one.ooo";case"demo":return"https://public.demo.one.ooo";default:return"https://public.dev.one.ooo"}}(this.config.environment)}getState(){return this.state}subscribe(t){return this.subscribers.add(t),t(this.state),()=>{this.subscribers.delete(t)}}on(t,e){this.eventListeners[t]||(this.eventListeners[t]=[]);const r=this.eventListeners[t];return r.push(e),()=>{const t=r.indexOf(e);t>-1&&r.splice(t,1)}}async initialize(t){this.setState({status:At}),this.emit({type:"initialize",payload:t});try{const e={amount:t.amount,currency:t.currency,notes:t.notes,orderId:t.orderId},r=JSON.stringify(e),i=await this.adapters.crypto.hmacSHA256(this.config.secretKey,r),n=await this.adapters.http.post(`${this.getApiBaseUrl()}/payment-intent/create`,e,{"x-api-key":this.config.apiKey,"x-signature":i}),s=new URL(n.result.redirectUrl).searchParams.get("token");if(!s)throw new Error("No token found in redirectUrl");this.paymentToken=s,this.paymentIntentId=n.result.paymentIntentId;const o=await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/get-payment-data`,{"x-token":this.paymentToken}),a=await this.adapters.http.get(`${this.getApiBaseUrl()}/payment-intent/available-methods`,{"x-token":this.paymentToken}),l={id:this.paymentIntentId,amount:o.result.customerAmount||t.amount,currency:o.result.currency||t.currency,status:$t,...t.metadata&&{metadata:t.metadata}},d=[];let c=0;return a.result.paymentMethods.forEach(t=>{const e=t.type.toLowerCase(),r=t.capabilities||[];e.includes("card")&&d.push({id:"card",enabled:!0,priority:c++}),(e.includes("paynow")||r.includes("payments_pay_now"))&&d.push({id:"paynow",enabled:!0,priority:c++}),(e.includes("promptpay")||e.includes("prompt pay")||r.includes("payments_prompt_pay"))&&d.push({id:"promptpay",enabled:!0,priority:c++}),(e.includes("duitnow")||e.includes("duit now")||r.includes("payments_duit_now"))&&d.push({id:"duitnow",enabled:!0,priority:c++}),(e.includes("gopay")||e.includes("go pay")||r.includes("payments_go_pay"))&&d.push({id:"gopay",enabled:!0,priority:c++}),(e.includes("boost")||r.includes("payments_boost"))&&d.push({id:"boost",enabled:!0,priority:c++}),(e.includes("shopeepay")||e.includes("shopee pay")||e.includes("shopee_pay")||r.includes("payments_shopee_pay"))&&d.push({id:"shopeepay",enabled:!0,priority:c++}),(e.includes("atom")||e.includes("atome")||r.includes("payments_atome"))&&d.push({id:"atom",enabled:!0,priority:c++}),(e.includes("dana")||r.includes("payments_dana"))&&d.push({id:"dana",enabled:!0,priority:c++}),(e.includes("tng")||e.includes("touch")||r.includes("payments_tng"))&&d.push({id:"tng",enabled:!0,priority:c++}),(e.includes("alipaycn")||e.includes("alipay cn")||e.includes("alipay_cn")||r.includes("payments_alipaycn"))&&d.push({id:"alipaycn",enabled:!0,priority:c++}),(e.includes("alipayhk")||e.includes("alipay hk")||e.includes("alipay_hk")||r.includes("payments_alipayhk"))&&d.push({id:"alipayhk",enabled:!0,priority:c++}),(e.includes("gcash")||e.includes("g cash")||r.includes("payments_gcash"))&&d.push({id:"gcash",enabled:!0,priority:c++})}),this.setState({status:$t,paymentIntent:l,availableMethods:d}),this.emit({type:"initialized",payload:{paymentIntent:l,paymentData:o.result}}),l}catch(e){const t={code:"INITIALIZATION_FAILED",message:e instanceof Error?e.message:"Unknown error",timestamp:this.adapters.timer.now()};throw this.setState({status:It,error:t}),this.emit({type:"payment_failed",payload:{error:t}}),e}}async submitPayment(t,e){var r,i,n,s,o;const a=this.state;if("ready"!==a.status)throw new Error("Cannot submit payment: SDK not in ready state");if(!this.paymentToken)throw new Error("Cannot submit payment: No payment token available");this.ignore3DSInPolling=!1,this.ignoreQRInPolling=!1,this.setState({status:Et,paymentIntent:a.paymentIntent,selectedMethod:t,availableMethods:a.availableMethods}),this.emit({type:"payment_processing",payload:{paymentIntent:a.paymentIntent,methodId:t}});try{const r=t=>{switch(t){case"paynow":default:return"qr";case"promptpay":return"prompt_pay";case"duitnow":return"duit_now";case"gopay":return"go_pay";case"boost":return"boost";case"shopeepay":return"shopee_pay";case"atom":return"atome";case"dana":return"dana";case"tng":return"tng";case"alipaycn":return"alipaycn";case"alipayhk":return"alipayhk";case"gcash":return"gcash"}},i={firstName:String(e.firstName),lastName:String(e.lastName),email:String(e.email),phoneNumber:String(e.phoneNumber),paymentMethod:"card"===t?{type:"card",card:{number:String(e.cardNumber),expiryMonth:String(e.expiryMonth),expiryYear:String(e.expiryYear),cvc:String(e.cvv)}}:{type:r(t)}};return await this.adapters.http.patch(`${this.getApiBaseUrl()}/payment-intent/confirm`,i,{"x-token":this.paymentToken}),this.startPolling(),{id:this.paymentIntentId||"",amount:a.paymentIntent.amount,currency:a.paymentIntent.currency,status:Et}}catch(l){let t="Unknown error",e="PAYMENT_FAILED";if(l instanceof Error)try{if(function(t){return t instanceof Error&&("response"in t&&"object"==typeof t.response&&null!==t.response||"data"in t&&"object"==typeof t.data&&null!==t.data)}(l)){const a=null==(r=l.response)?void 0:r.data,d=l.data;a?(t=a.message||(null==(i=a.error)?void 0:i.message)||l.message,e=a.code||(null==(n=a.error)?void 0:n.code)||e):d?(t=d.message||(null==(s=d.error)?void 0:s.message)||l.message,e=d.code||(null==(o=d.error)?void 0:o.code)||e):t=l.message}else t=l.message}catch{t=l.message}const d={code:e,message:t,timestamp:this.adapters.timer.now()};throw this.setState({status:It,error:d,paymentIntent:a.paymentIntent}),this.emit({type:"payment_failed",payload:{error:d,paymentIntent:a.paymentIntent}}),l}}resumePolling(){this.paymentToken&&(this.ignore3DSInPolling=!0,this.ignoreQRInPolling=!0,this.startPolling())}destroy(){this.stopPolling(),this.subscribers.clear(),Object.keys(this.eventListeners).forEach(t=>{delete this.eventListeners[t]})}startPolling(){this.paymentToken&&(this.stopPolling(),this.pollingService=new Nt(this.adapters,this.getApiBaseUrl(),this.paymentToken,this.handlePollingUpdate.bind(this),{interval:4e3,maxAttempts:100,timeout:4e5,ignore3DS:this.ignore3DSInPolling,ignoreQR:this.ignoreQRInPolling},this.handlePollStart.bind(this)),this.pollingService.start())}stopPolling(){this.pollingService&&(this.pollingService.stop(),this.pollingService=null)}handlePollStart(){this.emit({type:"poll_started",payload:{}})}handlePollingUpdate(t){if(t.error)return;const e=this.state;if("processing"!==e.status&&"requires_action"!==e.status)return void this.stopPolling();const r="promptpay"===e.selectedMethod||"duitnow"===e.selectedMethod||"gopay"===e.selectedMethod||"boost"===e.selectedMethod||"shopeepay"===e.selectedMethod||"atom"===e.selectedMethod||"dana"===e.selectedMethod||"tng"===e.selectedMethod||"alipaycn"===e.selectedMethod||"alipayhk"===e.selectedMethod||"gcash"===e.selectedMethod;if(t.qrCode&&!this.ignoreQRInPolling&&!r)return void this.emit({type:"qr_code_received",payload:{qrCode:t.qrCode,methodId:e.selectedMethod}});if(t.nextActionUrl&&!this.ignore3DSInPolling){if("promptpay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"promptpay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("duitnow"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"duitnow_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("gopay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"gopay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("boost"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"boost_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("shopeepay"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"shopeepay_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("atom"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"atom_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("dana"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"dana_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("tng"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"tng_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("alipaycn"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"alipaycn_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("alipayhk"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"alipayhk_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("gcash"===e.selectedMethod)return this.stopPolling(),void this.emit({type:"gcash_redirect",payload:{redirectUrl:t.nextActionUrl,methodId:e.selectedMethod}});if("paynow"===e.selectedMethod&&!this.ignoreQRInPolling)return void this.emit({type:"qr_code_received",payload:{qrCode:t.nextActionUrl,methodId:e.selectedMethod}});const r={id:t.paymentIntentId,amount:t.amount??e.paymentIntent.amount,currency:t.currency??e.paymentIntent.currency,status:_t,...t.metadata&&{metadata:t.metadata}};return this.setState({status:_t,paymentIntent:r,actionUrl:t.nextActionUrl,selectedMethod:e.selectedMethod,availableMethods:e.availableMethods}),void this.emit({type:"payment_requires_action",payload:{paymentIntent:r,actionUrl:t.nextActionUrl,methodId:e.selectedMethod}})}const i={id:t.paymentIntentId,amount:t.amount??e.paymentIntent.amount,currency:t.currency??e.paymentIntent.currency,status:t.status,...t.metadata&&{metadata:t.metadata}};if("succeeded"===t.status)this.stopPolling(),this.setState({status:Mt,paymentIntent:i,selectedMethod:e.selectedMethod}),this.emit({type:"payment_succeeded",payload:{paymentIntent:i,methodId:e.selectedMethod}});else if("failed"===t.status){this.stopPolling();const e={code:"PAYMENT_FAILED",message:t.error&&"object"==typeof t.error&&null!==t.error&&"message"in t.error?String(t.error.message):"Payment failed",timestamp:this.adapters.timer.now()};this.setState({status:It,error:e,paymentIntent:i}),this.emit({type:"payment_failed",payload:{error:e,paymentIntent:i}})}}setState(t){const e=this.state.status;this.state=t,this.subscribers.forEach(t=>{t(this.state)}),e!==t.status&&this.emit({type:"state_changed",payload:{previousStatus:e,currentStatus:t.status}})}emit(t){const e=this.eventListeners[t.type];void 0!==e&&e.forEach(e=>{e(t)})}}var Dt="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Rt=function(t,e,r,i,n,s,o,a,l,d){var c=this;c.numeralDecimalMark=t||".",c.numeralIntegerScale=e>0?e:0,c.numeralDecimalScale=r>=0?r:2,c.numeralThousandsGroupStyle=i||Rt.groupStyle.thousand,c.numeralPositiveOnly=!!n,c.stripLeadingZeroes=!1!==s,c.prefix=o||""===o?o:"",c.signBeforePrefix=!!a,c.tailPrefix=!!l,c.delimiter=d||""===d?d:",",c.delimiterRE=d?new RegExp("\\"+d,"g"):""};Rt.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},Rt.prototype={getRawValue:function(t){return t.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(t){var e,r,i,n,s=this,o="";switch(t=t.replace(/[A-Za-z]/g,"").replace(s.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",s.numeralPositiveOnly?"":"-").replace("M",s.numeralDecimalMark),s.stripLeadingZeroes&&(t=t.replace(/^(-)?0+(?=\d)/,"$1")),r="-"===t.slice(0,1)?"-":"",i=void 0!==s.prefix?s.signBeforePrefix?r+s.prefix:s.prefix+r:r,n=t,t.indexOf(s.numeralDecimalMark)>=0&&(n=(e=t.split(s.numeralDecimalMark))[0],o=s.numeralDecimalMark+e[1].slice(0,s.numeralDecimalScale)),"-"===r&&(n=n.slice(1)),s.numeralIntegerScale>0&&(n=n.slice(0,s.numeralIntegerScale)),s.numeralThousandsGroupStyle){case Rt.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+s.delimiter);break;case Rt.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+s.delimiter);break;case Rt.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+s.delimiter)}return s.tailPrefix?r+n.toString()+(s.numeralDecimalScale>0?o.toString():"")+s.prefix:i+n.toString()+(s.numeralDecimalScale>0?o.toString():"")}};var Lt=Rt,Ut=function(t,e,r){var i=this;i.date=[],i.blocks=[],i.datePattern=t,i.dateMin=e.split("-").reverse().map(function(t){return parseInt(t,10)}),2===i.dateMin.length&&i.dateMin.unshift(0),i.dateMax=r.split("-").reverse().map(function(t){return parseInt(t,10)}),2===i.dateMax.length&&i.dateMax.unshift(0),i.initBlocks()};Ut.prototype={initBlocks:function(){var t=this;t.datePattern.forEach(function(e){"Y"===e?t.blocks.push(4):t.blocks.push(2)})},getISOFormatDate:function(){var t=this,e=t.date;return e[2]?e[2]+"-"+t.addLeadingZero(e[1])+"-"+t.addLeadingZero(e[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(t){var e=this,r="";return t=t.replace(/[^\d]/g,""),e.blocks.forEach(function(i,n){if(t.length>0){var s=t.slice(0,i),o=s.slice(0,1),a=t.slice(i);switch(e.datePattern[n]){case"d":"00"===s?s="01":parseInt(o,10)>3?s="0"+o:parseInt(s,10)>31&&(s="31");break;case"m":"00"===s?s="01":parseInt(o,10)>1?s="0"+o:parseInt(s,10)>12&&(s="12")}r+=s,t=a}}),this.getFixedDateString(r)},getFixedDateString:function(t){var e,r,i,n=this,s=n.datePattern,o=[],a=0,l=0,d=0,c=0,u=0,h=0,p=!1;return 4===t.length&&"y"!==s[0].toLowerCase()&&"y"!==s[1].toLowerCase()&&(u=2-(c="d"===s[0]?0:2),e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),o=this.getFixedDate(e,r,0)),8===t.length&&(s.forEach(function(t,e){switch(t){case"d":a=e;break;case"m":l=e;break;default:d=e}}),h=2*d,c=a<=d?2*a:2*a+2,u=l<=d?2*l:2*l+2,e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+4),10),p=4===t.slice(h,h+4).length,o=this.getFixedDate(e,r,i)),4!==t.length||"y"!==s[0]&&"y"!==s[1]||(h=2-(u="m"===s[0]?0:2),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),p=2===t.slice(h,h+2).length,o=[0,r,i]),6!==t.length||"Y"!==s[0]&&"Y"!==s[1]||(h=2-.5*(u="m"===s[0]?0:4),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+4),10),p=4===t.slice(h,h+4).length,o=[0,r,i]),o=n.getRangeFixedDate(o),n.date=o,0===o.length?t:s.reduce(function(t,e){switch(e){case"d":return t+(0===o[0]?"":n.addLeadingZero(o[0]));case"m":return t+(0===o[1]?"":n.addLeadingZero(o[1]));case"y":return t+(p?n.addLeadingZeroForYear(o[2],!1):"");case"Y":return t+(p?n.addLeadingZeroForYear(o[2],!0):"")}},"")},getRangeFixedDate:function(t){var e=this,r=e.datePattern,i=e.dateMin||[],n=e.dateMax||[];return!t.length||i.length<3&&n.length<3||r.find(function(t){return"y"===t.toLowerCase()})&&0===t[2]?t:n.length&&(n[2]<t[2]||n[2]===t[2]&&(n[1]<t[1]||n[1]===t[1]&&n[0]<t[0]))?n:i.length&&(i[2]>t[2]||i[2]===t[2]&&(i[1]>t[1]||i[1]===t[1]&&i[0]>t[0]))?i:t},getFixedDate:function(t,e,r){return t=Math.min(t,31),e=Math.min(e,12),r=parseInt(r||0,10),(e<7&&e%2==0||e>8&&e%2==1)&&(t=Math.min(t,2===e?this.isLeapYear(r)?29:28:30)),[t,e,r]},isLeapYear:function(t){return t%4==0&&t%100!=0||t%400==0},addLeadingZero:function(t){return(t<10?"0":"")+t},addLeadingZeroForYear:function(t,e){return e?(t<10?"000":t<100?"00":t<1e3?"0":"")+t:(t<10?"0":"")+t}};var Bt=Ut,Ft=function(t,e){var r=this;r.time=[],r.blocks=[],r.timePattern=t,r.timeFormat=e,r.initBlocks()};Ft.prototype={initBlocks:function(){var t=this;t.timePattern.forEach(function(){t.blocks.push(2)})},getISOFormatTime:function(){var t=this,e=t.time;return e[2]?t.addLeadingZero(e[0])+":"+t.addLeadingZero(e[1])+":"+t.addLeadingZero(e[2]):""},getBlocks:function(){return this.blocks},getTimeFormatOptions:function(){return"12"===String(this.timeFormat)?{maxHourFirstDigit:1,maxHours:12,maxMinutesFirstDigit:5,maxMinutes:60}:{maxHourFirstDigit:2,maxHours:23,maxMinutesFirstDigit:5,maxMinutes:60}},getValidatedTime:function(t){var e=this,r="";t=t.replace(/[^\d]/g,"");var i=e.getTimeFormatOptions();return e.blocks.forEach(function(n,s){if(t.length>0){var o=t.slice(0,n),a=o.slice(0,1),l=t.slice(n);switch(e.timePattern[s]){case"h":parseInt(a,10)>i.maxHourFirstDigit?o="0"+a:parseInt(o,10)>i.maxHours&&(o=i.maxHours+"");break;case"m":case"s":parseInt(a,10)>i.maxMinutesFirstDigit?o="0"+a:parseInt(o,10)>i.maxMinutes&&(o=i.maxMinutes+"")}r+=o,t=l}}),this.getFixedTimeString(r)},getFixedTimeString:function(t){var e,r,i,n=this,s=n.timePattern,o=[],a=0,l=0,d=0,c=0,u=0,h=0;return 6===t.length&&(s.forEach(function(t,e){switch(t){case"s":a=2*e;break;case"m":l=2*e;break;case"h":d=2*e}}),h=d,u=l,c=a,e=parseInt(t.slice(c,c+2),10),r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),o=this.getFixedTime(i,r,e)),4===t.length&&n.timePattern.indexOf("s")<0&&(s.forEach(function(t,e){switch(t){case"m":l=2*e;break;case"h":d=2*e}}),h=d,u=l,e=0,r=parseInt(t.slice(u,u+2),10),i=parseInt(t.slice(h,h+2),10),o=this.getFixedTime(i,r,e)),n.time=o,0===o.length?t:s.reduce(function(t,e){switch(e){case"s":return t+n.addLeadingZero(o[2]);case"m":return t+n.addLeadingZero(o[1]);case"h":return t+n.addLeadingZero(o[0])}},"")},getFixedTime:function(t,e,r){return r=Math.min(parseInt(r||0,10),60),e=Math.min(e,60),[t=Math.min(t,60),e,r]},addLeadingZero:function(t){return(t<10?"0":"")+t}};var qt=Ft,zt=function(t,e){var r=this;r.delimiter=e||""===e?e:" ",r.delimiterRE=e?new RegExp("\\"+e,"g"):"",r.formatter=t};zt.prototype={setFormatter:function(t){this.formatter=t},format:function(t){var e=this;e.formatter.clear();for(var r,i="",n=!1,s=0,o=(t=(t=(t=t.replace(/[^\d+]/g,"")).replace(/^\+/,"B").replace(/\+/g,"").replace("B","+")).replace(e.delimiterRE,"")).length;s<o;s++)r=e.formatter.inputDigit(t.charAt(s)),/[\s()-]/g.test(r)?(i=r,n=!0):n||(i=r);return i=(i=i.replace(/[()]/g,"")).replace(/[\s-]/g,e.delimiter)}};var Ht=zt,Ot={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^(62|81)\d{0,14}/},getStrictBlocks:function(t){var e=t.reduce(function(t,e){return t+e},0);return t.concat(19-e)},getInfo:function(t,e){var r=Ot.blocks,i=Ot.re;for(var n in e=!!e,i)if(i[n].test(t)){var s=r[n];return{type:n,blocks:e?this.getStrictBlocks(s):s}}return{type:"unknown",blocks:e?this.getStrictBlocks(r.general):r.general}}},jt=Ot,Vt={noop:function(){},strip:function(t,e){return t.replace(e,"")},getPostDelimiter:function(t,e,r){if(0===r.length)return t.slice(-e.length)===e?e:"";var i="";return r.forEach(function(e){t.slice(-e.length)===e&&(i=e)}),i},getDelimiterREByDelimiter:function(t){return new RegExp(t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(t,e,r,i,n){return e.length===t?r.length:t+this.getPositionOffset(t,e,r,i,n)},getPositionOffset:function(t,e,r,i,n){var s,o,a;return s=this.stripDelimiters(e.slice(0,t),i,n),o=this.stripDelimiters(r.slice(0,t),i,n),0!==(a=s.length-o.length)?a/Math.abs(a):0},stripDelimiters:function(t,e,r){var i=this;if(0===r.length){var n=e?i.getDelimiterREByDelimiter(e):"";return t.replace(n,"")}return r.forEach(function(e){e.split("").forEach(function(e){t=t.replace(i.getDelimiterREByDelimiter(e),"")})}),t},headStr:function(t,e){return t.slice(0,e)},getMaxLength:function(t){return t.reduce(function(t,e){return t+e},0)},getPrefixStrippedValue:function(t,e,r,i,n,s,o,a,l){if(0===r)return t;if(t===e&&""!==t)return"";if(l&&"-"==t.slice(0,1)){var d="-"==i.slice(0,1)?i.slice(1):i;return"-"+this.getPrefixStrippedValue(t.slice(1),e,r,d,n,s,o,a,l)}if(i.slice(0,r)!==e&&!a)return o&&!i&&t?t:"";if(i.slice(-r)!==e&&a)return o&&!i&&t?t:"";var c=this.stripDelimiters(i,n,s);return t.slice(0,r)===e||a?t.slice(-r)!==e&&a?c.slice(0,-r-1):a?t.slice(0,-r):t.slice(r):c.slice(r)},getFirstDiffIndex:function(t,e){for(var r=0;t.charAt(r)===e.charAt(r);)if(""===t.charAt(r++))return-1;return r},getFormattedValue:function(t,e,r,i,n,s){var o="",a=n.length>0,l="";return 0===r?t:(e.forEach(function(e,d){if(t.length>0){var c=t.slice(0,e),u=t.slice(e);l=a?n[s?d-1:d]||l:i,s?(d>0&&(o+=l),o+=c):(o+=c,c.length===e&&d<r-1&&(o+=l)),t=u}}),o)},fixPrefixCursor:function(t,e,r,i){if(t){var n=t.value,s=r||i[0]||" ";if(t.setSelectionRange&&e&&!(e.length+s.length<=n.length)){var o=2*n.length;setTimeout(function(){t.setSelectionRange(o,o)},1)}}},checkFullSelection:function(t){try{return(window.getSelection()||document.getSelection()||{}).toString().length===t.length}catch(e){}return!1},setSelection:function(t,e,r){if(t===this.getActiveElement(r)&&!(t&&t.value.length<=e))if(t.createTextRange){var i=t.createTextRange();i.move("character",e),i.select()}else try{t.setSelectionRange(e,e)}catch(n){console.warn("The input element type does not support selection")}},getActiveElement:function(t){var e=t.activeElement;return e&&e.shadowRoot?this.getActiveElement(e.shadowRoot):e},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(t,e){return!!(this.isAndroid()&&t&&e)&&e===t.slice(0,-1)}},Yt={assign:function(t,e){return e=e||{},(t=t||{}).creditCard=!!e.creditCard,t.creditCardStrictMode=!!e.creditCardStrictMode,t.creditCardType="",t.onCreditCardTypeChanged=e.onCreditCardTypeChanged||function(){},t.phone=!!e.phone,t.phoneRegionCode=e.phoneRegionCode||"AU",t.phoneFormatter={},t.time=!!e.time,t.timePattern=e.timePattern||["h","m","s"],t.timeFormat=e.timeFormat||"24",t.timeFormatter={},t.date=!!e.date,t.datePattern=e.datePattern||["d","m","Y"],t.dateMin=e.dateMin||"",t.dateMax=e.dateMax||"",t.dateFormatter={},t.numeral=!!e.numeral,t.numeralIntegerScale=e.numeralIntegerScale>0?e.numeralIntegerScale:0,t.numeralDecimalScale=e.numeralDecimalScale>=0?e.numeralDecimalScale:2,t.numeralDecimalMark=e.numeralDecimalMark||".",t.numeralThousandsGroupStyle=e.numeralThousandsGroupStyle||"thousand",t.numeralPositiveOnly=!!e.numeralPositiveOnly,t.stripLeadingZeroes=!1!==e.stripLeadingZeroes,t.signBeforePrefix=!!e.signBeforePrefix,t.tailPrefix=!!e.tailPrefix,t.swapHiddenInput=!!e.swapHiddenInput,t.numericOnly=t.creditCard||t.date||!!e.numericOnly,t.uppercase=!!e.uppercase,t.lowercase=!!e.lowercase,t.prefix=t.creditCard||t.date?"":e.prefix||"",t.noImmediatePrefix=!!e.noImmediatePrefix,t.prefixLength=t.prefix.length,t.rawValueTrimPrefix=!!e.rawValueTrimPrefix,t.copyDelimiter=!!e.copyDelimiter,t.initValue=void 0!==e.initValue&&null!==e.initValue?e.initValue.toString():"",t.delimiter=e.delimiter||""===e.delimiter?e.delimiter:e.date?"/":e.time?":":e.numeral?",":(e.phone," "),t.delimiterLength=t.delimiter.length,t.delimiterLazyShow=!!e.delimiterLazyShow,t.delimiters=e.delimiters||[],t.blocks=e.blocks||[],t.blocksLength=t.blocks.length,t.root="object"==typeof Dt&&Dt?Dt:window,t.document=e.document||t.root.document,t.maxLength=0,t.backspace=!1,t.result="",t.onValueChanged=e.onValueChanged||function(){},t}},Qt=function(t,e){var r=this,i=!1;if("string"==typeof t?(r.element=document.querySelector(t),i=document.querySelectorAll(t).length>1):void 0!==t.length&&t.length>0?(r.element=t[0],i=t.length>1):r.element=t,!r.element)throw new Error("[cleave.js] Please check the element");if(i)try{console.warn("[cleave.js] Multiple input fields matched, cleave.js will only take the first one.")}catch(n){}e.initValue=r.element.value,r.properties=Qt.DefaultProperties.assign({},e),r.init()};Qt.prototype={init:function(){var t=this,e=t.properties;e.numeral||e.phone||e.creditCard||e.time||e.date||0!==e.blocksLength||e.prefix?(e.maxLength=Qt.Util.getMaxLength(e.blocks),t.isAndroid=Qt.Util.isAndroid(),t.lastInputValue="",t.isBackward="",t.onChangeListener=t.onChange.bind(t),t.onKeyDownListener=t.onKeyDown.bind(t),t.onFocusListener=t.onFocus.bind(t),t.onCutListener=t.onCut.bind(t),t.onCopyListener=t.onCopy.bind(t),t.initSwapHiddenInput(),t.element.addEventListener("input",t.onChangeListener),t.element.addEventListener("keydown",t.onKeyDownListener),t.element.addEventListener("focus",t.onFocusListener),t.element.addEventListener("cut",t.onCutListener),t.element.addEventListener("copy",t.onCopyListener),t.initPhoneFormatter(),t.initDateFormatter(),t.initTimeFormatter(),t.initNumeralFormatter(),(e.initValue||e.prefix&&!e.noImmediatePrefix)&&t.onInput(e.initValue)):t.onInput(e.initValue)},initSwapHiddenInput:function(){var t=this;if(t.properties.swapHiddenInput){var e=t.element.cloneNode(!0);t.element.parentNode.insertBefore(e,t.element),t.elementSwapHidden=t.element,t.elementSwapHidden.type="hidden",t.element=e,t.element.id=""}},initNumeralFormatter:function(){var t=this.properties;t.numeral&&(t.numeralFormatter=new Qt.NumeralFormatter(t.numeralDecimalMark,t.numeralIntegerScale,t.numeralDecimalScale,t.numeralThousandsGroupStyle,t.numeralPositiveOnly,t.stripLeadingZeroes,t.prefix,t.signBeforePrefix,t.tailPrefix,t.delimiter))},initTimeFormatter:function(){var t=this.properties;t.time&&(t.timeFormatter=new Qt.TimeFormatter(t.timePattern,t.timeFormat),t.blocks=t.timeFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=Qt.Util.getMaxLength(t.blocks))},initDateFormatter:function(){var t=this.properties;t.date&&(t.dateFormatter=new Qt.DateFormatter(t.datePattern,t.dateMin,t.dateMax),t.blocks=t.dateFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=Qt.Util.getMaxLength(t.blocks))},initPhoneFormatter:function(){var t=this.properties;if(t.phone)try{t.phoneFormatter=new Qt.PhoneFormatter(new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),t.delimiter)}catch(e){throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(t){var e=this,r=t.which||t.keyCode;e.lastInputValue=e.element.value,e.isBackward=8===r},onChange:function(t){var e=this,r=e.properties,i=Qt.Util;e.isBackward=e.isBackward||"deleteContentBackward"===t.inputType;var n=i.getPostDelimiter(e.lastInputValue,r.delimiter,r.delimiters);e.isBackward&&n?r.postDelimiterBackspace=n:r.postDelimiterBackspace=!1,this.onInput(this.element.value)},onFocus:function(){var t=this,e=t.properties;t.lastInputValue=t.element.value,e.prefix&&e.noImmediatePrefix&&!t.element.value&&this.onInput(e.prefix),Qt.Util.fixPrefixCursor(t.element,e.prefix,e.delimiter,e.delimiters)},onCut:function(t){Qt.Util.checkFullSelection(this.element.value)&&(this.copyClipboardData(t),this.onInput(""))},onCopy:function(t){Qt.Util.checkFullSelection(this.element.value)&&this.copyClipboardData(t)},copyClipboardData:function(t){var e=this.properties,r=Qt.Util,i=this.element.value,n="";n=e.copyDelimiter?i:r.stripDelimiters(i,e.delimiter,e.delimiters);try{t.clipboardData?t.clipboardData.setData("Text",n):window.clipboardData.setData("Text",n),t.preventDefault()}catch(s){}},onInput:function(t){var e=this,r=e.properties,i=Qt.Util,n=i.getPostDelimiter(t,r.delimiter,r.delimiters);return r.numeral||!r.postDelimiterBackspace||n||(t=i.headStr(t,t.length-r.postDelimiterBackspace.length)),r.phone?(!r.prefix||r.noImmediatePrefix&&!t.length?r.result=r.phoneFormatter.format(t):r.result=r.prefix+r.phoneFormatter.format(t).slice(r.prefix.length),void e.updateValueState()):r.numeral?(r.prefix&&r.noImmediatePrefix&&0===t.length?r.result="":r.result=r.numeralFormatter.format(t),void e.updateValueState()):(r.date&&(t=r.dateFormatter.getValidatedDate(t)),r.time&&(t=r.timeFormatter.getValidatedTime(t)),t=i.stripDelimiters(t,r.delimiter,r.delimiters),t=i.getPrefixStrippedValue(t,r.prefix,r.prefixLength,r.result,r.delimiter,r.delimiters,r.noImmediatePrefix,r.tailPrefix,r.signBeforePrefix),t=r.numericOnly?i.strip(t,/[^\d]/g):t,t=r.uppercase?t.toUpperCase():t,t=r.lowercase?t.toLowerCase():t,r.prefix&&(r.tailPrefix?t+=r.prefix:t=r.prefix+t,0===r.blocksLength)?(r.result=t,void e.updateValueState()):(r.creditCard&&e.updateCreditCardPropsByValue(t),t=i.headStr(t,r.maxLength),r.result=i.getFormattedValue(t,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void e.updateValueState()))},updateCreditCardPropsByValue:function(t){var e,r=this.properties,i=Qt.Util;i.headStr(r.result,4)!==i.headStr(t,4)&&(e=Qt.CreditCardDetector.getInfo(t,r.creditCardStrictMode),r.blocks=e.blocks,r.blocksLength=r.blocks.length,r.maxLength=i.getMaxLength(r.blocks),r.creditCardType!==e.type&&(r.creditCardType=e.type,r.onCreditCardTypeChanged.call(this,r.creditCardType)))},updateValueState:function(){var t=this,e=Qt.Util,r=t.properties;if(t.element){var i=t.element.selectionEnd,n=t.element.value,s=r.result;i=e.getNextCursorPosition(i,n,s,r.delimiter,r.delimiters),t.isAndroid?window.setTimeout(function(){t.element.value=s,e.setSelection(t.element,i,r.document,!1),t.callOnValueChanged()},1):(t.element.value=s,r.swapHiddenInput&&(t.elementSwapHidden.value=t.getRawValue()),e.setSelection(t.element,i,r.document,!1),t.callOnValueChanged())}},callOnValueChanged:function(){var t=this,e=t.properties;e.onValueChanged.call(t,{target:{name:t.element.name,value:e.result,rawValue:t.getRawValue()}})},setPhoneRegionCode:function(t){var e=this;e.properties.phoneRegionCode=t,e.initPhoneFormatter(),e.onChange()},setRawValue:function(t){var e=this,r=e.properties;t=null!=t?t.toString():"",r.numeral&&(t=t.replace(".",r.numeralDecimalMark)),r.postDelimiterBackspace=!1,e.element.value=t,e.onInput(t)},getRawValue:function(){var t=this.properties,e=Qt.Util,r=this.element.value;return t.rawValueTrimPrefix&&(r=e.getPrefixStrippedValue(r,t.prefix,t.prefixLength,t.result,t.delimiter,t.delimiters,t.noImmediatePrefix,t.tailPrefix,t.signBeforePrefix)),r=t.numeral?t.numeralFormatter.getRawValue(r):e.stripDelimiters(r,t.delimiter,t.delimiters)},getISOFormatDate:function(){var t=this.properties;return t.date?t.dateFormatter.getISOFormatDate():""},getISOFormatTime:function(){var t=this.properties;return t.time?t.timeFormatter.getISOFormatTime():""},getFormattedValue:function(){return this.element.value},destroy:function(){var t=this;t.element.removeEventListener("input",t.onChangeListener),t.element.removeEventListener("keydown",t.onKeyDownListener),t.element.removeEventListener("focus",t.onFocusListener),t.element.removeEventListener("cut",t.onCutListener),t.element.removeEventListener("copy",t.onCopyListener)},toString:function(){return"[Cleave Object]"}},Qt.NumeralFormatter=Lt,Qt.DateFormatter=Bt,Qt.TimeFormatter=qt,Qt.PhoneFormatter=Ht,Qt.CreditCardDetector=jt,Qt.Util=Vt,Qt.DefaultProperties=Yt,("object"==typeof Dt&&Dt?Dt:window).Cleave=Qt;var Kt=Qt,Gt={},Jt={},Zt={};let Wt;const Xt=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Zt.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},Zt.getSymbolTotalCodewords=function(t){return Xt[t]},Zt.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},Zt.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');Wt=t},Zt.isKanjiModeEnabled=function(){return void 0!==Wt},Zt.toSJIS=function(t){return Wt(t)};var te,ee={};function re(){this.buffer=[],this.length=0}(te=ee).L={bit:1},te.M={bit:0},te.Q={bit:3},te.H={bit:2},te.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},te.from=function(t,e){if(te.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return te.L;case"m":case"medium":return te.M;case"q":case"quartile":return te.Q;case"h":case"high":return te.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(r){return e}},re.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let r=0;r<e;r++)this.putBit(1==(t>>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var ie=re;function ne(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ne.prototype.set=function(t,e,r,i){const n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)},ne.prototype.get=function(t,e){return this.data[t*this.size+e]},ne.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},ne.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var se=ne,oe={};!function(t){const e=Zt.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const r=Math.floor(t/7)+2,i=e(t),n=145===i?26:2*Math.ceil((i-13)/(2*r-2)),s=[i-7];for(let e=1;e<r-1;e++)s[e]=s[e-1]-n;return s.push(6),s.reverse()},t.getPositions=function(e){const r=[],i=t.getRowColCoords(e),n=i.length;for(let t=0;t<n;t++)for(let e=0;e<n;e++)0===t&&0===e||0===t&&e===n-1||t===n-1&&0===e||r.push([i[t],i[e]]);return r}}(oe);var ae={};const le=Zt.getSymbolSize;ae.getPositions=function(t){const e=le(t);return[[0,0],[e-7,0],[0,e-7]]};var de={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,r=3,i=40,n=10;function s(e,r,i){switch(e){case t.Patterns.PATTERN000:return(r+i)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return i%3==0;case t.Patterns.PATTERN011:return(r+i)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2==0;case t.Patterns.PATTERN101:return r*i%2+r*i%3==0;case t.Patterns.PATTERN110:return(r*i%2+r*i%3)%2==0;case t.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const r=t.size;let i=0,n=0,s=0,o=null,a=null;for(let l=0;l<r;l++){n=s=0,o=a=null;for(let d=0;d<r;d++){let r=t.get(l,d);r===o?n++:(n>=5&&(i+=e+(n-5)),o=r,n=1),r=t.get(d,l),r===a?s++:(s>=5&&(i+=e+(s-5)),a=r,s=1)}n>=5&&(i+=e+(n-5)),s>=5&&(i+=e+(s-5))}return i},t.getPenaltyN2=function(t){const e=t.size;let i=0;for(let r=0;r<e-1;r++)for(let n=0;n<e-1;n++){const e=t.get(r,n)+t.get(r,n+1)+t.get(r+1,n)+t.get(r+1,n+1);4!==e&&0!==e||i++}return i*r},t.getPenaltyN3=function(t){const e=t.size;let r=0,n=0,s=0;for(let i=0;i<e;i++){n=s=0;for(let o=0;o<e;o++)n=n<<1&2047|t.get(i,o),o>=10&&(1488===n||93===n)&&r++,s=s<<1&2047|t.get(o,i),o>=10&&(1488===s||93===s)&&r++}return r*i},t.getPenaltyN4=function(t){let e=0;const r=t.data.length;for(let i=0;i<r;i++)e+=t.data[i];return Math.abs(Math.ceil(100*e/r/5)-10)*n},t.applyMask=function(t,e){const r=e.size;for(let i=0;i<r;i++)for(let n=0;n<r;n++)e.isReserved(n,i)||e.xor(n,i,s(t,n,i))},t.getBestMask=function(e,r){const i=Object.keys(t.Patterns).length;let n=0,s=1/0;for(let o=0;o<i;o++){r(o),t.applyMask(o,e);const i=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(o,e),i<s&&(s=i,n=o)}return n}}(de);var ce={};const ue=ee,he=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],pe=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ce.getBlocksCount=function(t,e){switch(e){case ue.L:return he[4*(t-1)+0];case ue.M:return he[4*(t-1)+1];case ue.Q:return he[4*(t-1)+2];case ue.H:return he[4*(t-1)+3];default:return}},ce.getTotalCodewordsCount=function(t,e){switch(e){case ue.L:return pe[4*(t-1)+0];case ue.M:return pe[4*(t-1)+1];case ue.Q:return pe[4*(t-1)+2];case ue.H:return pe[4*(t-1)+3];default:return}};var me={},ge={};const fe=new Uint8Array(512),ye=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)fe[e]=t,ye[t]=e,t<<=1,256&t&&(t^=285);for(let e=255;e<512;e++)fe[e]=fe[e-255]}(),ge.log=function(t){if(t<1)throw new Error("log("+t+")");return ye[t]},ge.exp=function(t){return fe[t]},ge.mul=function(t,e){return 0===t||0===e?0:fe[ye[t]+ye[e]]},function(t){const e=ge;t.mul=function(t,r){const i=new Uint8Array(t.length+r.length-1);for(let n=0;n<t.length;n++)for(let s=0;s<r.length;s++)i[n+s]^=e.mul(t[n],r[s]);return i},t.mod=function(t,r){let i=new Uint8Array(t);for(;i.length-r.length>=0;){const t=i[0];for(let s=0;s<r.length;s++)i[s]^=e.mul(r[s],t);let n=0;for(;n<i.length&&0===i[n];)n++;i=i.slice(n)}return i},t.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let n=0;n<r;n++)i=t.mul(i,new Uint8Array([1,e.exp(n)]));return i}}(me);const ve=me;function be(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}be.prototype.initialize=function(t){this.degree=t,this.genPoly=ve.generateECPolynomial(this.degree)},be.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const r=ve.mod(e,this.genPoly),i=this.degree-r.length;if(i>0){const t=new Uint8Array(this.degree);return t.set(r,i),t}return r};var we=be,xe={},ke={},Se={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},Pe={};const Ce="[0-9]+";let Ae="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ae=Ae.replace(/u/g,"\\u");const $e="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ae+")(?:.|[\r\n]))+";Pe.KANJI=new RegExp(Ae,"g"),Pe.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Pe.BYTE=new RegExp($e,"g"),Pe.NUMERIC=new RegExp(Ce,"g"),Pe.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const Ee=new RegExp("^"+Ae+"$"),_e=new RegExp("^"+Ce+"$"),Me=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Pe.testKanji=function(t){return Ee.test(t)},Pe.testNumeric=function(t){return _e.test(t)},Pe.testAlphanumeric=function(t){return Me.test(t)},function(t){const e=Se,r=Pe;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return r.testNumeric(e)?t.NUMERIC:r.testAlphanumeric(e)?t.ALPHANUMERIC:r.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(i){return r}}}(ke),function(t){const e=Zt,r=ce,i=ee,n=ke,s=Se,o=e.getBCHDigit(7973);function a(t,e){return n.getCharCountIndicator(t,e)+4}function l(t,e){let r=0;return t.forEach(function(t){const i=a(t.mode,e);r+=i+t.getBitsLength()}),r}t.from=function(t,e){return s.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,i,o){if(!s.isValid(t))throw new Error("Invalid QR Code version");void 0===o&&(o=n.BYTE);const l=8*(e.getSymbolTotalCodewords(t)-r.getTotalCodewordsCount(t,i));if(o===n.MIXED)return l;const d=l-a(o,t);switch(o){case n.NUMERIC:return Math.floor(d/10*3);case n.ALPHANUMERIC:return Math.floor(d/11*2);case n.KANJI:return Math.floor(d/13);case n.BYTE:default:return Math.floor(d/8)}},t.getBestVersionForData=function(e,r){let s;const o=i.from(r,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,r){for(let i=1;i<=40;i++)if(l(e,i)<=t.getCapacity(i,r,n.MIXED))return i}(e,o);if(0===e.length)return 1;s=e[0]}else s=e;return function(e,r,i){for(let n=1;n<=40;n++)if(r<=t.getCapacity(n,i,e))return n}(s.mode,s.getLength(),o)},t.getEncodedBits=function(t){if(!s.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;e.getBCHDigit(r)-o>=0;)r^=7973<<e.getBCHDigit(r)-o;return t<<12|r}}(xe);var Ie={};const Ne=Zt,Te=Ne.getBCHDigit(1335);Ie.getEncodedBits=function(t,e){const r=t.bit<<3|e;let i=r<<10;for(;Ne.getBCHDigit(i)-Te>=0;)i^=1335<<Ne.getBCHDigit(i)-Te;return 21522^(r<<10|i)};var De={};const Re=ke;function Le(t){this.mode=Re.NUMERIC,this.data=t.toString()}Le.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Le.prototype.getLength=function(){return this.data.length},Le.prototype.getBitsLength=function(){return Le.getBitsLength(this.data.length)},Le.prototype.write=function(t){let e,r,i;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),i=parseInt(r,10),t.put(i,10);const n=this.data.length-e;n>0&&(r=this.data.substr(e),i=parseInt(r,10),t.put(i,3*n+1))};var Ue=Le;const Be=ke,Fe=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function qe(t){this.mode=Be.ALPHANUMERIC,this.data=t}qe.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},qe.prototype.getLength=function(){return this.data.length},qe.prototype.getBitsLength=function(){return qe.getBitsLength(this.data.length)},qe.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let r=45*Fe.indexOf(this.data[e]);r+=Fe.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(Fe.indexOf(this.data[e]),6)};var ze=qe;const He=ke;function Oe(t){this.mode=He.BYTE,this.data="string"==typeof t?(new TextEncoder).encode(t):new Uint8Array(t)}Oe.getBitsLength=function(t){return 8*t},Oe.prototype.getLength=function(){return this.data.length},Oe.prototype.getBitsLength=function(){return Oe.getBitsLength(this.data.length)},Oe.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var je=Oe;const Ve=ke,Ye=Zt;function Qe(t){this.mode=Ve.KANJI,this.data=t}Qe.getBitsLength=function(t){return 13*t},Qe.prototype.getLength=function(){return this.data.length},Qe.prototype.getBitsLength=function(){return Qe.getBitsLength(this.data.length)},Qe.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=Ye.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}};var Ke,Ge=Qe,Je={exports:{}};Ke={single_source_shortest_paths:function(t,e,r){var i={},n={};n[e]=0;var s,o,a,l,d,c,u,h=Ke.PriorityQueue.make();for(h.push(e,0);!h.empty();)for(a in o=(s=h.pop()).value,l=s.cost,d=t[o]||{})d.hasOwnProperty(a)&&(c=l+d[a],u=n[a],(void 0===n[a]||u>c)&&(n[a]=c,h.push(a,c),i[a]=o));if(void 0!==r&&void 0===n[r]){var p=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],i=e;i;)r.push(i),t[i],i=t[i];return r.reverse(),r},find_path:function(t,e,r){var i=Ke.single_source_shortest_paths(t,e,r);return Ke.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e,r=Ke.PriorityQueue,i={};for(e in t=t||{},r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}},Je.exports=Ke;var Ze=Je.exports;!function(t){const e=ke,r=Ue,i=ze,n=je,s=Ge,o=Pe,a=Zt,l=Ze;function d(t){return unescape(encodeURIComponent(t)).length}function c(t,e,r){const i=[];let n;for(;null!==(n=t.exec(r));)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function u(t){const r=c(o.NUMERIC,e.NUMERIC,t),i=c(o.ALPHANUMERIC,e.ALPHANUMERIC,t);let n,s;a.isKanjiModeEnabled()?(n=c(o.BYTE,e.BYTE,t),s=c(o.KANJI,e.KANJI,t)):(n=c(o.BYTE_KANJI,e.BYTE,t),s=[]);return r.concat(i,n,s).sort(function(t,e){return t.index-e.index}).map(function(t){return{data:t.data,mode:t.mode,length:t.length}})}function h(t,o){switch(o){case e.NUMERIC:return r.getBitsLength(t);case e.ALPHANUMERIC:return i.getBitsLength(t);case e.KANJI:return s.getBitsLength(t);case e.BYTE:return n.getBitsLength(t)}}function p(t,o){let l;const d=e.getBestModeForData(t);if(l=e.from(o,d),l!==e.BYTE&&l.bit<d.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(l)+".\n Suggested mode is: "+e.toString(d));switch(l!==e.KANJI||a.isKanjiModeEnabled()||(l=e.BYTE),l){case e.NUMERIC:return new r(t);case e.ALPHANUMERIC:return new i(t);case e.KANJI:return new s(t);case e.BYTE:return new n(t)}}t.fromArray=function(t){return t.reduce(function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t},[])},t.fromString=function(r,i){const n=function(t){const r=[];for(let i=0;i<t.length;i++){const n=t[i];switch(n.mode){case e.NUMERIC:r.push([n,{data:n.data,mode:e.ALPHANUMERIC,length:n.length},{data:n.data,mode:e.BYTE,length:n.length}]);break;case e.ALPHANUMERIC:r.push([n,{data:n.data,mode:e.BYTE,length:n.length}]);break;case e.KANJI:r.push([n,{data:n.data,mode:e.BYTE,length:d(n.data)}]);break;case e.BYTE:r.push([{data:n.data,mode:e.BYTE,length:d(n.data)}])}}return r}(u(r,a.isKanjiModeEnabled())),s=function(t,r){const i={},n={start:{}};let s=["start"];for(let o=0;o<t.length;o++){const a=t[o],l=[];for(let t=0;t<a.length;t++){const d=a[t],c=""+o+t;l.push(c),i[c]={node:d,lastCount:0},n[c]={};for(let t=0;t<s.length;t++){const o=s[t];i[o]&&i[o].node.mode===d.mode?(n[o][c]=h(i[o].lastCount+d.length,d.mode)-h(i[o].lastCount,d.mode),i[o].lastCount+=d.length):(i[o]&&(i[o].lastCount=d.length),n[o][c]=h(d.length,d.mode)+4+e.getCharCountIndicator(d.mode,r))}}s=l}for(let e=0;e<s.length;e++)n[s[e]].end=0;return{map:n,table:i}}(n,i),o=l.find_path(s.map,"start","end"),c=[];for(let t=1;t<o.length-1;t++)c.push(s.table[o[t]].node);return t.fromArray(function(t){return t.reduce(function(t,e){const r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)},[])}(c))},t.rawSplit=function(e){return t.fromArray(u(e,a.isKanjiModeEnabled()))}}(De);const We=Zt,Xe=ee,tr=ie,er=se,rr=oe,ir=ae,nr=de,sr=ce,or=we,ar=xe,lr=Ie,dr=ke,cr=De;function ur(t,e,r){const i=t.size,n=lr.getEncodedBits(e,r);let s,o;for(s=0;s<15;s++)o=1==(n>>s&1),s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function hr(t,e,r){const i=new tr;r.forEach(function(e){i.put(e.mode.bit,4),i.put(e.getLength(),dr.getCharCountIndicator(e.mode,t)),e.write(i)});const n=8*(We.getSymbolTotalCodewords(t)-sr.getTotalCodewordsCount(t,e));for(i.getLengthInBits()+4<=n&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const s=(n-i.getLengthInBits())/8;for(let o=0;o<s;o++)i.put(o%2?17:236,8);return function(t,e,r){const i=We.getSymbolTotalCodewords(e),n=sr.getTotalCodewordsCount(e,r),s=i-n,o=sr.getBlocksCount(e,r),a=i%o,l=o-a,d=Math.floor(i/o),c=Math.floor(s/o),u=c+1,h=d-c,p=new or(h);let m=0;const g=new Array(o),f=new Array(o);let y=0;const v=new Uint8Array(t.buffer);for(let S=0;S<o;S++){const t=S<l?c:u;g[S]=v.slice(m,m+t),f[S]=p.encode(g[S]),m+=t,y=Math.max(y,t)}const b=new Uint8Array(i);let w,x,k=0;for(w=0;w<y;w++)for(x=0;x<o;x++)w<g[x].length&&(b[k++]=g[x][w]);for(w=0;w<h;w++)for(x=0;x<o;x++)b[k++]=f[x][w];return b}(i,t,e)}function pr(t,e,r,i){let n;if(Array.isArray(t))n=cr.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let i=e;if(!i){const e=cr.rawSplit(t);i=ar.getBestVersionForData(e,r)}n=cr.fromString(t,i||40)}}const s=ar.getBestVersionForData(n,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<s)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+s+".\n")}else e=s;const o=hr(e,r,n),a=We.getSymbolSize(e),l=new er(a);return function(t,e){const r=t.size,i=ir.getPositions(e);for(let n=0;n<i.length;n++){const e=i[n][0],s=i[n][1];for(let i=-1;i<=7;i++)if(!(e+i<=-1||r<=e+i))for(let n=-1;n<=7;n++)s+n<=-1||r<=s+n||(i>=0&&i<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===i||6===i)||i>=2&&i<=4&&n>=2&&n<=4?t.set(e+i,s+n,!0,!0):t.set(e+i,s+n,!1,!0))}}(l,e),function(t){const e=t.size;for(let r=8;r<e-8;r++){const e=r%2==0;t.set(r,6,e,!0),t.set(6,r,e,!0)}}(l),function(t,e){const r=rr.getPositions(e);for(let i=0;i<r.length;i++){const e=r[i][0],n=r[i][1];for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)-2===r||2===r||-2===i||2===i||0===r&&0===i?t.set(e+r,n+i,!0,!0):t.set(e+r,n+i,!1,!0)}}(l,e),ur(l,r,0),e>=7&&function(t,e){const r=t.size,i=ar.getEncodedBits(e);let n,s,o;for(let a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=1==(i>>a&1),t.set(n,s,o,!0),t.set(s,n,o,!0)}(l,e),function(t,e){const r=t.size;let i=-1,n=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!t.isReserved(n,a-r)){let i=!1;o<e.length&&(i=1==(e[o]>>>s&1)),t.set(n,a-r,i),s--,-1===s&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}(l,o),isNaN(i)&&(i=nr.getBestMask(l,ur.bind(null,l,r))),nr.applyMask(i,l),ur(l,r,i),{modules:l,version:e,errorCorrectionLevel:r,maskPattern:i,segments:n}}Jt.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let r,i,n=Xe.M;return void 0!==e&&(n=Xe.from(e.errorCorrectionLevel,Xe.M),r=ar.from(e.version),i=nr.from(e.maskPattern),e.toSJISFunc&&We.setToSJISFunction(e.toSJISFunc)),pr(t,r,n,i)};var mr={},gr={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map(function(t){return[t,t]}))),6===e.length&&e.push("F","F");const r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const r=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,i=t.width&&t.width>=21?t.width:void 0,n=t.scale||4;return{width:i,scale:i?4:n,margin:r,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,r){const i=t.getScale(e,r);return Math.floor((e+2*r.margin)*i)},t.qrToImageData=function(e,r,i){const n=r.modules.size,s=r.modules.data,o=t.getScale(n,i),a=Math.floor((n+2*i.margin)*o),l=i.margin*o,d=[i.color.light,i.color.dark];for(let t=0;t<a;t++)for(let r=0;r<a;r++){let c=4*(t*a+r),u=i.color.light;if(t>=l&&r>=l&&t<a-l&&r<a-l){u=d[s[Math.floor((t-l)/o)*n+Math.floor((r-l)/o)]?1:0]}e[c++]=u.r,e[c++]=u.g,e[c++]=u.b,e[c]=u.a}}}(gr),function(t){const e=gr;t.render=function(t,r,i){let n=i,s=r;void 0!==n||r&&r.getContext||(n=r,r=void 0),r||(s=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),n=e.getOptions(n);const o=e.getImageWidth(t.modules.size,n),a=s.getContext("2d"),l=a.createImageData(o,o);return e.qrToImageData(l.data,t,n),function(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}(a,s,o),a.putImageData(l,0,0),s},t.renderToDataURL=function(e,r,i){let n=i;void 0!==n||r&&r.getContext||(n=r,r=void 0),n||(n={});const s=t.render(e,r,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}}(mr);var fr={};const yr=gr;function vr(t,e){const r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function br(t,e,r){let i=t+e;return void 0!==r&&(i+=" "+r),i}fr.render=function(t,e,r){const i=yr.getOptions(e),n=t.modules.size,s=t.modules.data,o=n+2*i.margin,a=i.color.light.a?"<path "+vr(i.color.light,"fill")+' d="M0 0h'+o+"v"+o+'H0z"/>':"",l="<path "+vr(i.color.dark,"stroke")+' d="'+function(t,e,r){let i="",n=0,s=!1,o=0;for(let a=0;a<t.length;a++){const l=Math.floor(a%e),d=Math.floor(a/e);l||s||(s=!0),t[a]?(o++,a>0&&l>0&&t[a-1]||(i+=s?br("M",l+r,.5+d+r):br("m",n,0),n=0,s=!1),l+1<e&&t[a+1]||(i+=br("h",o),o=0)):n++}return i}(s,n,i.margin)+'"/>',d='viewBox="0 0 '+o+" "+o+'"',c='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+d+' shape-rendering="crispEdges">'+a+l+"</svg>\n";return"function"==typeof r&&r(null,c),c};const wr=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},xr=Jt,kr=mr,Sr=fr;function Pr(t,e,r,i,n){const s=[].slice.call(arguments,1),o=s.length,a="function"==typeof s[o-1];if(!a&&!wr())throw new Error("Callback required as last argument");if(!a){if(o<1)throw new Error("Too few arguments provided");return 1===o?(r=e,e=i=void 0):2!==o||e.getContext||(i=r,r=e,e=void 0),new Promise(function(n,s){try{const s=xr.create(r,i);n(t(s,e,i))}catch(o){s(o)}})}if(o<2)throw new Error("Too few arguments provided");2===o?(n=r,r=e,e=i=void 0):3===o&&(e.getContext&&void 0===n?(n=i,i=void 0):(n=i,i=r,r=e,e=void 0));try{const s=xr.create(r,i);n(null,t(s,e,i))}catch(l){n(l)}}Gt.create=xr.create,Gt.toCanvas=Pr.bind(null,kr.render),Gt.toDataURL=Pr.bind(null,kr.renderToDataURL),Gt.toString=Pr.bind(null,function(t,e,r){return Sr.render(t,r)});var Cr=Object.defineProperty,Ar=Object.getOwnPropertyDescriptor,$r=(t,e,r,i)=>{for(var n,s=i>1?void 0:i?Ar(e,r):e,o=t.length-1;o>=0;o--)(n=t[o])&&(s=(i?n(e,r,s):n(s))||s);return i&&s&&Cr(e,r,s),s};let Er=class extends ot{constructor(){super(...arguments),this.currentState={status:"idle"},this.selectedMethod=null,this.cardFormData={cardNumber:"",expiry:"",cvv:"",cardholderName:""},this.formErrors={},this.paymentData=null,this.feesExpanded=!1,this.isInitializing=!0,this.cardBrand="unknown",this.paymentLocked=!1,this.show3DSModal=!1,this.showQRModal=!1,this.nextActionUrl=null,this.qrCode=null,this.qrCodeDataUrl=null,this.qrAutoResumeTimer=null,this.qrPollingInProgress=!1,this.sdk=null,this.isInitialized=!1,this.cardNumberCleave=null,this.expiryCleave=null,this.leaveEventsCounter=0,this.previousState=null,this.cssVariableMap={colorPrimary:"--op-color-primary",colorPrimaryHover:"--op-color-primary-hover",colorPrimaryText:"--op-color-primary-text",colorBackground:"--op-color-background",colorSurface:"--op-color-surface",colorText:"--op-color-text",colorTextSecondary:"--op-color-text-secondary",colorDanger:"--op-color-danger",colorSuccess:"--op-color-success",colorWarning:"--op-color-warning",colorBorder:"--op-color-border",colorBorderFocus:"--op-color-border-focus",fontFamily:"--op-font-family",fontSize:"--op-font-size",fontSizeSmall:"--op-font-size-sm",borderRadius:"--op-border-radius",borderRadiusLarge:"--op-border-radius-lg",spacingUnit:"--op-spacing-unit",boxShadow:"--op-box-shadow",boxShadowLarge:"--op-box-shadow-lg"},this.themeMediaQuery=null,this.themeMediaQueryHandler=null,this.handle3DSPostMessage=t=>{"ON_AWX_3DS_START_PAGE_LEAVE"===t.data&&(this.leaveEventsCounter++,this.leaveEventsCounter>1&&this.handle3DSComplete())}}hasAllRequiredProps(){return!!(this.config&&this.adapters&&this.amount&&this.currency&&this.orderId)&&(!(!this.firstName||"string"!=typeof this.firstName||""===this.firstName.trim())&&(!(!this.lastName||"string"!=typeof this.lastName||""===this.lastName.trim())&&(!(!this.email||"string"!=typeof this.email||""===this.email.trim())&&!(!this.phoneNumber||"string"!=typeof this.phoneNumber||""===this.phoneNumber.trim()))))}applyAppearance(){if(!this.appearance)return void this.removeAttribute("data-theme");const{theme:t,variables:e}=this.appearance;if(t)if("auto"===t){const t=window.matchMedia("(prefers-color-scheme: dark)").matches;this.dataset.theme=t?"dark":"light",this.setupThemeMediaQueryListener()}else this.dataset.theme=t;e&&this.applyCssVariables(e)}applyCssVariables(t){for(const[e,r]of Object.entries(this.cssVariableMap)){const i=t[e];null!=i?this.style.setProperty(r,i):this.style.removeProperty(r)}}setupThemeMediaQueryListener(){this.cleanupThemeMediaQueryListener(),this.themeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.themeMediaQueryHandler=t=>{var e;"auto"===(null==(e=this.appearance)?void 0:e.theme)&&(this.dataset.theme=t.matches?"dark":"light")},this.themeMediaQuery.addEventListener("change",this.themeMediaQueryHandler)}cleanupThemeMediaQueryListener(){this.themeMediaQuery&&this.themeMediaQueryHandler&&(this.themeMediaQuery.removeEventListener("change",this.themeMediaQueryHandler),this.themeMediaQuery=null,this.themeMediaQueryHandler=null)}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.handle3DSPostMessage),this.addEventListener("force-close-3ds-modal",()=>{this.show3DSModal&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0)})}firstUpdated(){this.applyAppearance(),this.initializeSDK()}updated(t){super.updated(t),t.has("appearance")&&this.applyAppearance(),!this.isInitialized&&this.hasAllRequiredProps()&&(console.info("[OnePayment] All required props now available. Initializing SDK..."),this.initializeSDK())}disconnectedCallback(){var t;super.disconnectedCallback(),this.cleanupThemeMediaQueryListener(),null==(t=this.sdk)||t.destroy(),this.isInitialized=!1,this.destroyCleave(),window.removeEventListener("message",this.handle3DSPostMessage),null!==this.qrAutoResumeTimer&&clearTimeout(this.qrAutoResumeTimer)}setupCleave(){setTimeout(()=>{var t,e;const r=null==(t=this.shadowRoot)?void 0:t.querySelector("#cardNumber"),i=null==(e=this.shadowRoot)?void 0:e.querySelector("#expiry");r&&!this.cardNumberCleave&&(this.cardNumberCleave=new Kt(r,{creditCard:!0,delimiter:" ",onCreditCardTypeChanged:t=>{this.cardBrand={visa:"visa",mastercard:"mastercard",amex:"amex",discover:"discover"}[t]||"unknown"}})),i&&!this.expiryCleave&&(this.expiryCleave=new Kt(i,{date:!0,datePattern:["m","y"],delimiter:"/"}))},50)}destroyCleave(){this.cardNumberCleave&&(this.cardNumberCleave.destroy(),this.cardNumberCleave=null),this.expiryCleave&&(this.expiryCleave.destroy(),this.expiryCleave=null)}getFilteredPaymentMethods(){const t=("ready"===this.currentState.status||"processing"===this.currentState.status||"requires_action"===this.currentState.status)&&this.currentState.availableMethods||[];return 0===t.length?[]:t.filter(t=>{var e;return!(null==(e=this.excludePaymentMethods)?void 0:e.includes(t.id))}).map(t=>{if(t.id===pt){if("SGD"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"PayNow is only available for SGD currency"}}if(t.id===mt){if("THB"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"PromptPay is only available for THB currency"}}if(t.id===gt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"DuitNow is only available for MYR currency"}}if(t.id===ft){if("IDR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"GoPay is only available for IDR currency"}}if(t.id===yt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Boost is only available for MYR currency"}}if(t.id===vt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"ShopeePay is only available for MYR currency"}}if(t.id===bt){const e=this.getTransactionData().currency;if("SGD"!==e&&"MYR"!==e)return{id:t.id,enabled:!1,disabledReason:"Atom is only available for SGD and MYR currencies"}}if(t.id===wt){if("IDR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Dana is only available for IDR currency"}}if(t.id===xt){if("MYR"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Touch 'n Go is only available for MYR currency"}}if(t.id===kt){if("CNY"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"Alipay is only available for CNY currency"}}if(t.id===St){if("HKD"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"AlipayHK is only available for HKD currency"}}if(t.id===Pt){if("PHP"!==this.getTransactionData().currency)return{id:t.id,enabled:!1,disabledReason:"GCash is only available for PHP currency"}}return{id:t.id,enabled:!0}})}initializeSDK(){var t;this.config&&this.adapters&&this.amount&&this.currency&&this.orderId?this.firstName&&"string"==typeof this.firstName&&""!==this.firstName.trim()?this.lastName&&"string"==typeof this.lastName&&""!==this.lastName.trim()?this.email&&"string"==typeof this.email&&""!==this.email.trim()?this.isInitialized||(this.isInitialized=!0,null==(t=this.sdk)||t.destroy(),this.sdk=new Tt(this.config,this.adapters),this.sdk.subscribe(t=>{var e;"requires_action"===(null==(e=this.previousState)?void 0:e.status)&&"requires_action"!==t.status&&this.show3DSModal&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling()),this.previousState=t,this.currentState=t,this.dispatchEvent(new CustomEvent("state-change",{detail:{state:t},bubbles:!0,composed:!0}))}),this.sdk.on("payment_succeeded",t=>{this.dispatchEvent(new CustomEvent("payment-success",{detail:{paymentIntentId:t.payload.paymentIntent.id},bubbles:!0,composed:!0}))}),this.sdk.on("payment_failed",t=>{this.dispatchEvent(new CustomEvent("payment-error",{detail:{error:t.payload.error.message},bubbles:!0,composed:!0}))}),this.sdk.on("initialized",t=>{var e;if(this.paymentData=t.payload.paymentData,this.isInitializing=!1,null==(e=t.payload.paymentData)?void 0:e.sessionId){if(!document.getElementById("airwallex-fraud-api")){const e=document.createElement("script");e.src="https://static.airwallex.com/webapp/fraud/device-fingerprint/index.js",e.async=!0,e.setAttribute("data-order-session-id",t.payload.paymentData.sessionId),e.setAttribute("id","airwallex-fraud-api"),document.body.appendChild(e)}}}),this.sdk.on("payment_requires_action",t=>{this.nextActionUrl=t.payload.actionUrl,this.show3DSModal=!0,this.paymentLocked=!0,this.leaveEventsCounter=0}),this.sdk.on("poll_started",()=>{const t="undefined"!=typeof window&&"ReactNativeWebView"in window;this.show3DSModal&&t&&(this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling())}),this.sdk.on("qr_code_received",async t=>{if(this.qrCode=t.payload.qrCode,!this.qrCode)return;const e=this.qrCode.startsWith("http://")||this.qrCode.startsWith("https://"),r=this.qrCode.startsWith("data:image");if(e||r)this.qrCodeDataUrl=this.qrCode;else try{const t=await Gt.toDataURL(this.qrCode,{width:300,margin:2,color:{dark:"#000000",light:"#FFFFFF"}});this.qrCodeDataUrl=t}catch(i){this.qrCodeDataUrl=null}this.showQRModal=!0,this.paymentLocked=!0,this.qrAutoResumeTimer=window.setTimeout(()=>{this.handleQRScanned()},1e4)}),this.sdk.on("promptpay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("duitnow_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("gopay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("boost_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("shopeepay_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("atom_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("dana_redirect",t=>{console.log("[WebComponent] dana_redirect event received:",t.payload);const{redirectUrl:e}=t.payload;e&&(console.log("[WebComponent] Redirecting to Dana URL:",e),window.location.href=e)}),this.sdk.on("tng_redirect",t=>{console.log("[WebComponent] tng_redirect event received:",t.payload);const{redirectUrl:e}=t.payload;e&&(console.log("[WebComponent] Redirecting to TnG URL:",e),window.location.href=e)}),this.sdk.on("alipaycn_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("alipayhk_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.on("gcash_redirect",t=>{const{redirectUrl:e}=t.payload;e&&(window.location.href=e)}),this.sdk.initialize({amount:this.amount,currency:this.currency,orderId:this.orderId})):console.error("OnePayment: email is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: lastName is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: firstName is required and must be a non-empty string. Customer information is required for all payment methods."):console.error("OnePayment: Missing required props. Ensure config, adapters, amount, currency, and orderId are provided.")}handleMethodSelect(t){this.paymentLocked||(this.selectedMethod=t)}handleQRScanned(){null!==this.qrAutoResumeTimer&&(clearTimeout(this.qrAutoResumeTimer),this.qrAutoResumeTimer=null),this.qrPollingInProgress=!0,this.sdk&&this.sdk.resumePolling()}handle3DSComplete(){this.show3DSModal=!1,this.nextActionUrl=null,this.leaveEventsCounter=0,this.sdk&&this.sdk.resumePolling()}handleInputChange(t,e){if(this.cardFormData={...this.cardFormData,[t]:e},this.formErrors[t]){const e={...this.formErrors};delete e[t],this.formErrors=e}}luhnCheck(t){const e=t.replace(/\s/g,"");if(!/^\d+$/.test(e))return!1;let r=0,i=!1;for(let n=e.length-1;n>=0;n--){const t=e.charAt(n);if(!t)continue;let s=parseInt(t,10);i&&(s*=2,s>9&&(s-=9)),r+=s,i=!i}return r%10==0}validateExpiry(t){const e=t.trim();if(!/^\d{1,2}\/\d{2}$/.test(e))return{valid:!1,error:"Invalid format (MM/YY)"};const r=e.split("/"),i=r[0],n=r[1];if(!i||!n)return{valid:!1,error:"Invalid format (MM/YY)"};const s=parseInt(i,10);if(s<1||s>12)return{valid:!1,error:"Invalid month (01-12)"};const o=new Date,a=o.getFullYear(),l=o.getMonth()+1;let d;if(2!==n.length)return{valid:!1,error:"Invalid year format"};{const t=parseInt(n,10),e=a%100,r=100*Math.floor(a/100);if(t<e){d=e-t>80?r+100+t:r+t}else d=r+t}return d<a||d===a&&s<l?{valid:!1,error:"Card has expired"}:{valid:!0}}validateCardForm(){const t={};if(this.cardFormData.cardNumber.trim()?this.luhnCheck(this.cardFormData.cardNumber)||(t.cardNumber="Invalid card number"):t.cardNumber="Please enter card number",this.cardFormData.expiry.trim()){const e=this.validateExpiry(this.cardFormData.expiry);e.valid||(t.expiry=e.error)}else t.expiry="Please enter expiry date";return this.cardFormData.cvv.trim()||(t.cvv="Please enter CVV"),this.cardFormData.cardholderName.trim()||(t.cardholderName="Please enter cardholder name"),this.formErrors=t,0===Object.keys(t).length}handleCardPayment(){if(!this.sdk||"ready"!==this.currentState.status)return;if(!this.validateCardForm())return;this.paymentLocked=!0;const t=this.cardFormData.expiry.split("/"),e=(t[0]||"").trim(),r=`20${(t[1]||"").trim().substring(0,2)}`;this.sdk.submitPayment(ht,{cardNumber:this.cardFormData.cardNumber.replace(/\s/g,""),expiryMonth:e,expiryYear:r,cvv:this.cardFormData.cvv,firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber})}handlePayNowPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(pt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handlePromptPayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(mt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleDuitNowPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(gt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleGoPayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(ft,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleBoostPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(yt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleShopeePayPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(vt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleAtomPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(bt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleDanaPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(wt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleTngPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(xt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleAlipayCNPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(kt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleAlipayHKPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(St,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}handleGCashPayment(){this.sdk&&"ready"===this.currentState.status&&(this.paymentLocked=!0,this.sdk.submitPayment(Pt,{firstName:this.firstName,lastName:this.lastName,email:this.email,phoneNumber:this.phoneNumber}))}getPayButtonAmount(){const t=this.getTransactionData();return`${this.currency} ${t.netAmount.toFixed(2)}`}getTransactionData(){var t;const e=this.paymentData;if(!e)return{currency:this.currency,charge:this.amount,fees:0,feeBreakdown:{transactionFee:0,merchantFee:0,merchantFeeLabel:""},netAmount:this.amount};const r=null==(t=e.fees)?void 0:t.find(t=>"merchant"===t.owner),i="number"==typeof e.totalFee?e.totalFee:Number(e.totalFee)||0,n="number"==typeof e.totalSystemFee?e.totalSystemFee:Number(e.totalSystemFee)||0,s=null!=e.initialAmount?"number"==typeof e.initialAmount?e.initialAmount:Number(e.initialAmount)||0:this.amount,o=null!=e.customerAmount?"number"==typeof e.customerAmount?e.customerAmount:Number(e.customerAmount)||0:s,a=i-n;return{currency:e.currency||this.currency,charge:s,fees:i,feeBreakdown:{transactionFee:a,merchantFee:a,merchantFeeLabel:(r?"percentage"===r.type?`${r.value}%`:`${r.value} ${r.currency}`:"")||"0%"},netAmount:o}}renderTransactionDetailsSkeleton(){return H`
12
12
  <div class="skeleton-transaction">
13
13
  <div class="skeleton skeleton-title"></div>
14
14
  <div class="skeleton-row">
@@ -29,7 +29,7 @@ var OnePayments=function(t){"use strict";
29
29
  <div class="skeleton skeleton-net-value"></div>
30
30
  </div>
31
31
  </div>
32
- `}renderPaymentMethodsSkeleton(){return O`
32
+ `}renderPaymentMethodsSkeleton(){return H`
33
33
  <div>
34
34
  <div class="skeleton-method">
35
35
  <div class="skeleton skeleton-radio"></div>
@@ -42,13 +42,13 @@ var OnePayments=function(t){"use strict";
42
42
  <div class="skeleton skeleton-method-name"></div>
43
43
  </div>
44
44
  </div>
45
- `}renderSkeletons(){const t=[this.width?`--one-payment-width: ${this.width}`:"",this.maxWidth?`--one-payment-max-width: ${this.maxWidth}`:""].filter(Boolean).join("; ");return O`
45
+ `}renderSkeletons(){const t=[this.width?`--one-payment-width: ${this.width}`:"",this.maxWidth?`--one-payment-max-width: ${this.maxWidth}`:""].filter(Boolean).join("; ");return H`
46
46
  <div class="payment-element" style="${t}">
47
47
  ${this.renderTransactionDetailsSkeleton()}
48
48
  <div class="header">Select a payment method</div>
49
49
  ${this.renderPaymentMethodsSkeleton()}
50
50
  </div>
51
- `}renderTransactionDetails(){const t=this.getTransactionData(),e=t=>t.toFixed(2);return O`
51
+ `}renderTransactionDetails(){const t=this.getTransactionData(),e=t=>t.toFixed(2);return H`
52
52
  <div class="transaction-details">
53
53
  <h2 class="transaction-title">Transaction details</h2>
54
54
 
@@ -79,7 +79,7 @@ var OnePayments=function(t){"use strict";
79
79
  class="fee-breakdown"
80
80
  style=${`\n max-height: ${this.feesExpanded?"200px":"0"};\n opacity: ${this.feesExpanded?1:0};\n margin-top: ${this.feesExpanded?"0.625rem":"0"};\n `}
81
81
  >
82
- ${t.feeBreakdown?O`
82
+ ${t.feeBreakdown?H`
83
83
  <div class="fee-breakdown-inner">
84
84
  <div class="breakdown-row">
85
85
  <span class="breakdown-label">Transaction fee:</span>
@@ -105,7 +105,7 @@ var OnePayments=function(t){"use strict";
105
105
  <span class="net-value">${e(t.netAmount)}</span>
106
106
  </div>
107
107
  </div>
108
- `}renderCardForm(){setTimeout(()=>this.setupCleave(),0);const t="amex"===this.cardBrand?4:3,e="amex"===this.cardBrand?"1234":"123";return O`
108
+ `}renderCardForm(){setTimeout(()=>this.setupCleave(),0);const t="amex"===this.cardBrand?4:3,e="amex"===this.cardBrand?"1234":"123";return H`
109
109
  <div class="card-form">
110
110
  <h4 class="form-title">Card Information</h4>
111
111
  <div class="form-fields">
@@ -120,7 +120,7 @@ var OnePayments=function(t){"use strict";
120
120
  .value=${this.cardFormData.cardNumber}
121
121
  @input=${t=>this.handleInputChange("cardNumber",t.target.value)}
122
122
  />
123
- ${this.formErrors.cardNumber?O`<div class="error-message">${this.formErrors.cardNumber}</div>`:""}
123
+ ${this.formErrors.cardNumber?H`<div class="error-message">${this.formErrors.cardNumber}</div>`:""}
124
124
  </div>
125
125
 
126
126
  <!-- Single Expiry Field -->
@@ -134,7 +134,7 @@ var OnePayments=function(t){"use strict";
134
134
  .value=${this.cardFormData.expiry}
135
135
  @input=${t=>{const e=t.target;setTimeout(()=>{this.handleInputChange("expiry",e.value)},0)}}
136
136
  />
137
- ${this.formErrors.expiry?O`<div class="error-message">${this.formErrors.expiry}</div>`:""}
137
+ ${this.formErrors.expiry?H`<div class="error-message">${this.formErrors.expiry}</div>`:""}
138
138
  </div>
139
139
 
140
140
  <!-- CVV -->
@@ -148,7 +148,7 @@ var OnePayments=function(t){"use strict";
148
148
  .value=${this.cardFormData.cvv}
149
149
  @input=${t=>{const e=t.target.value.replace(/\D/g,"");t.target.value=e,this.handleInputChange("cvv",e)}}
150
150
  />
151
- ${this.formErrors.cvv?O`<div class="error-message">${this.formErrors.cvv}</div>`:""}
151
+ ${this.formErrors.cvv?H`<div class="error-message">${this.formErrors.cvv}</div>`:""}
152
152
  </div>
153
153
 
154
154
  <!-- Cardholder Name -->
@@ -161,7 +161,7 @@ var OnePayments=function(t){"use strict";
161
161
  .value=${this.cardFormData.cardholderName}
162
162
  @input=${t=>{const e=t.target.value.replace(/[^A-Za-z\s]/g,"").toUpperCase();t.target.value=e,this.handleInputChange("cardholderName",e)}}
163
163
  />
164
- ${this.formErrors.cardholderName?O`<div class="error-message">${this.formErrors.cardholderName}</div>`:""}
164
+ ${this.formErrors.cardholderName?H`<div class="error-message">${this.formErrors.cardholderName}</div>`:""}
165
165
  </div>
166
166
  </div>
167
167
 
@@ -175,7 +175,7 @@ var OnePayments=function(t){"use strict";
175
175
  </button>
176
176
  </div>
177
177
  </div>
178
- `}renderPayNowContent(){return this.showQRModal&&this.qrCodeDataUrl?O`
178
+ `}renderPayNowContent(){return this.showQRModal&&this.qrCodeDataUrl?H`
179
179
  <div class="paynow-container">
180
180
  <!-- Render generated QR code image -->
181
181
  <div class="qr-code-wrapper">
@@ -190,7 +190,7 @@ var OnePayments=function(t){"use strict";
190
190
  ${this.qrPollingInProgress?"Verifying...":"I Have Scanned the QR Code"}
191
191
  </button>
192
192
  </div>
193
- `:O`
193
+ `:H`
194
194
  <div class="paynow-container">
195
195
  <div class="paynow-instructions">
196
196
  <h3 class="instructions-title">How to Pay by QR:</h3>
@@ -218,7 +218,7 @@ var OnePayments=function(t){"use strict";
218
218
  </div>
219
219
  </div>
220
220
  </div>
221
- `}renderPromptPayContent(){return O`
221
+ `}renderPromptPayContent(){return H`
222
222
  <div class="paynow-container">
223
223
  <div class="paynow-instructions">
224
224
  <h3 class="instructions-title">How to Pay with PromptPay:</h3>
@@ -251,7 +251,7 @@ var OnePayments=function(t){"use strict";
251
251
  </div>
252
252
  </div>
253
253
  </div>
254
- `}renderDuitNowContent(){return O`
254
+ `}renderDuitNowContent(){return H`
255
255
  <div class="paynow-container">
256
256
  <div class="paynow-instructions">
257
257
  <h3 class="instructions-title">How to Pay with DuitNow:</h3>
@@ -284,7 +284,7 @@ var OnePayments=function(t){"use strict";
284
284
  </div>
285
285
  </div>
286
286
  </div>
287
- `}renderGoPayContent(){return O`
287
+ `}renderGoPayContent(){return H`
288
288
  <div class="paynow-container">
289
289
  <div class="paynow-instructions">
290
290
  <h3 class="instructions-title">How to Pay with GoPay:</h3>
@@ -317,7 +317,7 @@ var OnePayments=function(t){"use strict";
317
317
  </div>
318
318
  </div>
319
319
  </div>
320
- `}renderBoostContent(){return O`
320
+ `}renderBoostContent(){return H`
321
321
  <div class="paynow-container">
322
322
  <div class="paynow-instructions">
323
323
  <h3 class="instructions-title">How to Pay with Boost:</h3>
@@ -350,7 +350,7 @@ var OnePayments=function(t){"use strict";
350
350
  </div>
351
351
  </div>
352
352
  </div>
353
- `}renderShopeePayContent(){return O`
353
+ `}renderShopeePayContent(){return H`
354
354
  <div class="paynow-container">
355
355
  <div class="paynow-instructions">
356
356
  <h3 class="instructions-title">How to Pay with ShopeePay:</h3>
@@ -383,7 +383,7 @@ var OnePayments=function(t){"use strict";
383
383
  </div>
384
384
  </div>
385
385
  </div>
386
- `}renderAtomContent(){return O`
386
+ `}renderAtomContent(){return H`
387
387
  <div class="paynow-container">
388
388
  <div class="paynow-instructions">
389
389
  <h3 class="instructions-title">How to Pay with Atome:</h3>
@@ -416,7 +416,7 @@ var OnePayments=function(t){"use strict";
416
416
  </div>
417
417
  </div>
418
418
  </div>
419
- `}renderDanaContent(){return O`
419
+ `}renderDanaContent(){return H`
420
420
  <div class="paynow-container">
421
421
  <div class="paynow-instructions">
422
422
  <h3 class="instructions-title">How to Pay with Dana:</h3>
@@ -449,7 +449,7 @@ var OnePayments=function(t){"use strict";
449
449
  </div>
450
450
  </div>
451
451
  </div>
452
- `}renderTngContent(){return O`
452
+ `}renderTngContent(){return H`
453
453
  <div class="paynow-container">
454
454
  <div class="paynow-instructions">
455
455
  <h3 class="instructions-title">How to Pay with Touch 'n Go:</h3>
@@ -482,7 +482,106 @@ var OnePayments=function(t){"use strict";
482
482
  </div>
483
483
  </div>
484
484
  </div>
485
- `}render3DSModal(){return this.show3DSModal&&this.nextActionUrl?O`
485
+ `}renderAlipayCNContent(){return H`
486
+ <div class="paynow-container">
487
+ <div class="paynow-instructions">
488
+ <h3 class="instructions-title">How to Pay with Alipay:</h3>
489
+
490
+ <div class="instruction-steps">
491
+ <div class="instruction-step">
492
+ <div class="step-number">1</div>
493
+ <p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
494
+ </div>
495
+
496
+ <div class="instruction-step">
497
+ <div class="step-number">2</div>
498
+ <p class="step-text">Complete the payment in the Alipay app.</p>
499
+ </div>
500
+
501
+ <div class="instruction-step">
502
+ <div class="step-number">3</div>
503
+ <p class="step-text">You'll be redirected back automatically.</p>
504
+ </div>
505
+ </div>
506
+
507
+ <div class="submit-section">
508
+ <button
509
+ class="pay-button ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"loading":""}"
510
+ @click=${this.handleAlipayCNPayment}
511
+ ?disabled=${"processing"===this.currentState.status||"requires_action"===this.currentState.status}
512
+ >
513
+ ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"Redirecting...":`Pay ${this.getPayButtonAmount()}`}
514
+ </button>
515
+ </div>
516
+ </div>
517
+ </div>
518
+ `}renderAlipayHKContent(){return H`
519
+ <div class="paynow-container">
520
+ <div class="paynow-instructions">
521
+ <h3 class="instructions-title">How to Pay with AlipayHK:</h3>
522
+
523
+ <div class="instruction-steps">
524
+ <div class="instruction-step">
525
+ <div class="step-number">1</div>
526
+ <p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
527
+ </div>
528
+
529
+ <div class="instruction-step">
530
+ <div class="step-number">2</div>
531
+ <p class="step-text">Complete the payment in the AlipayHK app.</p>
532
+ </div>
533
+
534
+ <div class="instruction-step">
535
+ <div class="step-number">3</div>
536
+ <p class="step-text">You'll be redirected back automatically.</p>
537
+ </div>
538
+ </div>
539
+
540
+ <div class="submit-section">
541
+ <button
542
+ class="pay-button ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"loading":""}"
543
+ @click=${this.handleAlipayHKPayment}
544
+ ?disabled=${"processing"===this.currentState.status||"requires_action"===this.currentState.status}
545
+ >
546
+ ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"Redirecting...":`Pay ${this.getPayButtonAmount()}`}
547
+ </button>
548
+ </div>
549
+ </div>
550
+ </div>
551
+ `}renderGCashContent(){return H`
552
+ <div class="paynow-container">
553
+ <div class="paynow-instructions">
554
+ <h3 class="instructions-title">How to Pay with GCash:</h3>
555
+
556
+ <div class="instruction-steps">
557
+ <div class="instruction-step">
558
+ <div class="step-number">1</div>
559
+ <p class="step-text">Click <strong>"Pay"</strong> to go to the payment page.</p>
560
+ </div>
561
+
562
+ <div class="instruction-step">
563
+ <div class="step-number">2</div>
564
+ <p class="step-text">Complete the payment in the GCash app.</p>
565
+ </div>
566
+
567
+ <div class="instruction-step">
568
+ <div class="step-number">3</div>
569
+ <p class="step-text">You'll be redirected back automatically.</p>
570
+ </div>
571
+ </div>
572
+
573
+ <div class="submit-section">
574
+ <button
575
+ class="pay-button ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"loading":""}"
576
+ @click=${this.handleGCashPayment}
577
+ ?disabled=${"processing"===this.currentState.status||"requires_action"===this.currentState.status}
578
+ >
579
+ ${"processing"===this.currentState.status||"requires_action"===this.currentState.status?"Redirecting...":`Pay ${this.getPayButtonAmount()}`}
580
+ </button>
581
+ </div>
582
+ </div>
583
+ </div>
584
+ `}render3DSModal(){return this.show3DSModal&&this.nextActionUrl?H`
486
585
  <div class="modal-overlay">
487
586
  <div class="modal-content iframe-modal">
488
587
  <iframe
@@ -493,7 +592,7 @@ var OnePayments=function(t){"use strict";
493
592
  ></iframe>
494
593
  </div>
495
594
  </div>
496
- `:null}renderStatusBlock(){if("succeeded"===this.currentState.status){const t=this.getTransactionData(),e=t.netAmount.toFixed(2);return O`
595
+ `:null}renderStatusBlock(){if("succeeded"===this.currentState.status){const t=this.getTransactionData(),e=t.netAmount.toFixed(2);return H`
497
596
  <div class="result-card success">
498
597
  <div class="result-icon-wrapper">
499
598
  <div class="result-icon">✓</div>
@@ -504,7 +603,7 @@ var OnePayments=function(t){"use strict";
504
603
  successfully.
505
604
  </p>
506
605
  </div>
507
- `}if("failed"===this.currentState.status){const t=this.currentState.error?this.currentState.error.message:"An error occurred while processing your payment";return O`
606
+ `}if("failed"===this.currentState.status){const t=this.currentState.error?this.currentState.error.message:"An error occurred while processing your payment";return H`
508
607
  <div class="result-card error">
509
608
  <div class="result-icon-wrapper">
510
609
  <div class="result-icon">✕</div>
@@ -512,16 +611,16 @@ var OnePayments=function(t){"use strict";
512
611
  <h2 class="result-title">Payment Failed</h2>
513
612
  <p class="result-message">${t}</p>
514
613
  </div>
515
- `}return null}render(){if(("idle"===this.currentState.status||"initializing"===this.currentState.status)&&this.isInitializing&&!this.paymentData)return this.renderSkeletons();const t="succeeded"===this.currentState.status||"failed"===this.currentState.status,e=!t,r=this.getFilteredPaymentMethods();if(r.length>0){const t=r.some(t=>t.id===this.selectedMethod&&t.enabled);if(!this.selectedMethod||!t){const t=r.find(t=>t.enabled);t&&this.selectedMethod!==t.id&&(this.selectedMethod=t.id)}}const i=[this.width?`--one-payment-width: ${this.width}`:"",this.maxWidth?`--one-payment-max-width: ${this.maxWidth}`:""].filter(Boolean).join("; ");return O`
614
+ `}return null}render(){if(("idle"===this.currentState.status||"initializing"===this.currentState.status)&&this.isInitializing&&!this.paymentData)return this.renderSkeletons();const t="succeeded"===this.currentState.status||"failed"===this.currentState.status,e=!t,r=this.getFilteredPaymentMethods();if(r.length>0){const t=r.some(t=>t.id===this.selectedMethod&&t.enabled);if(!this.selectedMethod||!t){const t=r.find(t=>t.enabled);t&&this.selectedMethod!==t.id&&(this.selectedMethod=t.id)}}const i=[this.width?`--one-payment-width: ${this.width}`:"",this.maxWidth?`--one-payment-max-width: ${this.maxWidth}`:""].filter(Boolean).join("; ");return H`
516
615
  <div class="payment-element" style="${i}">
517
616
  ${this.renderTransactionDetails()}
518
- ${e?O`
617
+ ${e?H`
519
618
  <div class="header">Select a payment method</div>
520
619
  <div class="payment-methods-list">
521
- ${r.map(t=>{const e=this.selectedMethod===t.id,r=!t.enabled||this.paymentLocked&&!e;return O`
620
+ ${r.map(t=>{const e=this.selectedMethod===t.id,r=!t.enabled||this.paymentLocked&&!e;return H`
522
621
  <div
523
622
  class="payment-method-item"
524
- ${t.disabledReason?O`data-tooltip="${t.disabledReason}"`:""}
623
+ ${t.disabledReason?H`data-tooltip="${t.disabledReason}"`:""}
525
624
  >
526
625
  <div
527
626
  class="method-header ${e?"selected":""} ${r?"disabled":""}"
@@ -535,8 +634,8 @@ var OnePayments=function(t){"use strict";
535
634
  ?disabled=${r}
536
635
  @click=${e=>{e.stopPropagation(),t.enabled&&this.handleMethodSelect(t.id)}}
537
636
  />
538
- <span class="method-name">${(t=>{switch(t){case ht:return"Card";case pt:return"PayNow";case mt:return"PromptPay";case gt:return"DuitNow";case ft:return"GoPay";case yt:return"Boost";case vt:return"ShopeePay";case bt:return"Atome";case wt:return"Dana";case xt:return"Touch 'n Go";default:return t}})(t.id)}</span>
539
- ${i=t.id,i===ht?O`
637
+ <span class="method-name">${(t=>{switch(t){case ht:return"Card";case pt:return"PayNow";case mt:return"PromptPay";case gt:return"DuitNow";case ft:return"GoPay";case yt:return"Boost";case vt:return"ShopeePay";case bt:return"Atome";case wt:return"Dana";case xt:return"Touch 'n Go";case kt:return"Alipay";case St:return"AlipayHK";case Pt:return"GCash";default:return t}})(t.id)}</span>
638
+ ${i=t.id,i===ht?H`
540
639
  <div class="method-icon-right">
541
640
  <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
542
641
  <path
@@ -549,46 +648,58 @@ var OnePayments=function(t){"use strict";
549
648
  />
550
649
  </svg>
551
650
  </div>
552
- `:i===pt?O`
651
+ `:i===pt?H`
553
652
  <div class="method-icon-right">
554
653
  <img src="${"https://images.ctfassets.net/c3n7jozh84hr/2A5qlS6JkUsOyFVPzQ0KlK/22b497afd71030ef1a44a52394b15027/______2022-06-30_11.03.43.png"}" alt="PayNow" style="width: 45px; height: auto;" />
555
654
  </div>
556
- `:i===mt?O`
655
+ `:i===mt?H`
557
656
  <div class="method-icon-right">
558
657
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/xLSOJpNvMp7cBKdvDln0B/eb2f53a0a3f2317750739dceff9df413/______2022-06-30_10.59.00.png"}" alt="PromptPay" style="width: 45px; height: auto;" />
559
658
  </div>
560
- `:i===gt?O`
659
+ `:i===gt?H`
561
660
  <div class="method-icon-right">
562
661
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4Iq13VoxktB3amHFbQK1yb/f2fe12add0dac233d56c22cf5651c65c/image-20220630-030728.png"}" alt="DuitNow" style="width: 45px; height: auto;" />
563
662
  </div>
564
- `:i===ft?O`
663
+ `:i===ft?H`
565
664
  <div class="method-icon-right">
566
665
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/mjau5Tqscwu9tbhRLFbmJ/a66cd2894060b2d3a94b75d7f4e65355/______2022-07-04_17.05.18.png"}" alt="GoPay" style="width: 45px; height: auto;" />
567
666
  </div>
568
- `:i===yt?O`
667
+ `:i===yt?H`
569
668
  <div class="method-icon-right">
570
669
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1M4DBVFhOrkprPmjxZwS7M/c4a90840d3846b926d3a5524392435fe/Boost.svg"}" alt="Boost" style="width: 45px; height: auto;" />
571
670
  </div>
572
- `:i===vt?O`
671
+ `:i===vt?H`
573
672
  <div class="method-icon-right">
574
673
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/1BYCLeHNQEyPXBjlIdu09h/71d67c5be3975f77091bf45c7ab58f65/ShopeePay.svg"}" alt="ShopeePay" style="width: 45px; height: auto;" />
575
674
  </div>
576
- `:i===bt?O`
675
+ `:i===bt?H`
577
676
  <div class="method-icon-right">
578
677
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/61LYQ3RuziTGisarZgaAV1/309f3f1e569609dd0b0095857d6382b5/__2022-05-31_11.44.42.png"}" alt="Atome" style="width: 45px; height: auto;" />
579
678
  </div>
580
- `:i===wt?O`
679
+ `:i===wt?H`
581
680
  <div class="method-icon-right">
582
681
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/79Uj5xItEZE7L51j2oh6IV/6af4cfefdd65834305931fd16f652d87/DANA.svg"}" alt="Dana" style="width: 45px; height: auto;" />
583
682
  </div>
584
- `:i===xt?O`
683
+ `:i===xt?H`
585
684
  <div class="method-icon-right">
586
685
  <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/15FHwC4H3W0JrNvsqy6TWH/5d18aa44231c55d6457389e17ac7ea0c/TnG.svg"}" alt="Touch 'n Go" style="width: 45px; height: auto;" />
587
686
  </div>
687
+ `:i===kt?H`
688
+ <div class="method-icon-right">
689
+ <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/5EK8VF1nACmJ0KpPocLuR7/785178078004e82cb69782c570623b8c/Alipay.svg"}" alt="Alipay" style="width: 45px; height: auto;" />
690
+ </div>
691
+ `:i===St?H`
692
+ <div class="method-icon-right">
693
+ <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/3sNSjVq0K9mq5whYcGJhBe/78857434adff807c8e293425491e0bd4/AlipayHK.svg"}" alt="AlipayHK" style="width: 45px; height: auto;" />
694
+ </div>
695
+ `:i===Pt?H`
696
+ <div class="method-icon-right">
697
+ <img src="${"https://www.airwallex.com/docs/assets/contentful/images.ctfassets.net/c3n7jozh84hr/4WAO5JJPUOrZ9jBA0Vf4tf/c3896e1a5508efa0c569bd3eaa577dad/GCash.svg"}" alt="GCash" style="width: 45px; height: auto;" />
698
+ </div>
588
699
  `:null}
589
700
  </div>
590
- ${e?O`<div class="method-content">
591
- ${t.id===ht?this.renderCardForm():t.id===pt?this.renderPayNowContent():t.id===mt?this.renderPromptPayContent():t.id===gt?this.renderDuitNowContent():t.id===ft?this.renderGoPayContent():t.id===yt?this.renderBoostContent():t.id===vt?this.renderShopeePayContent():t.id===bt?this.renderAtomContent():t.id===wt?this.renderDanaContent():t.id===xt?this.renderTngContent():null}
701
+ ${e?H`<div class="method-content">
702
+ ${t.id===ht?this.renderCardForm():t.id===pt?this.renderPayNowContent():t.id===mt?this.renderPromptPayContent():t.id===gt?this.renderDuitNowContent():t.id===ft?this.renderGoPayContent():t.id===yt?this.renderBoostContent():t.id===vt?this.renderShopeePayContent():t.id===bt?this.renderAtomContent():t.id===wt?this.renderDanaContent():t.id===xt?this.renderTngContent():t.id===kt?this.renderAlipayCNContent():t.id===St?this.renderAlipayHKContent():t.id===Pt?this.renderGCashContent():null}
592
703
  </div>`:""}
593
704
  </div>
594
705
  `;var i})}
@@ -598,7 +709,7 @@ var OnePayments=function(t){"use strict";
598
709
  </div>
599
710
 
600
711
  ${this.render3DSModal()}
601
- `}};async function Ar(t){var e;try{const r=await t.json();return r.message||(null==(e=r.error)?void 0:e.message)||r.error||t.statusText}catch{return t.statusText}}Cr.styles=((t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[i+1],t[0]);return new s(r,t,n)})`
712
+ `}};async function _r(t){var e;try{const r=await t.json();return r.message||(null==(e=r.error)?void 0:e.message)||r.error||t.statusText}catch{return t.statusText}}Er.styles=((t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[i+1],t[0]);return new o(r,t,n)})`
602
713
  /* ═══════════════════════════════════════════════════════════════
603
714
  CSS CUSTOM PROPERTIES (Theming)
604
715
  ═══════════════════════════════════════════════════════════════ */
@@ -1920,5 +2031,5 @@ var OnePayments=function(t){"use strict";
1920
2031
  transform: translateX(-50%) translateY(0);
1921
2032
  }
1922
2033
  }
1923
- `,Pr([ct({type:Object})],Cr.prototype,"config",2),Pr([ct({type:Object})],Cr.prototype,"adapters",2),Pr([ct({type:Number})],Cr.prototype,"amount",2),Pr([ct({type:String})],Cr.prototype,"currency",2),Pr([ct({type:String})],Cr.prototype,"orderId",2),Pr([ct({type:String})],Cr.prototype,"firstName",2),Pr([ct({type:String})],Cr.prototype,"lastName",2),Pr([ct({type:String})],Cr.prototype,"email",2),Pr([ct({type:String})],Cr.prototype,"phoneNumber",2),Pr([ct({type:Array})],Cr.prototype,"excludePaymentMethods",2),Pr([ct({type:String})],Cr.prototype,"width",2),Pr([ct({type:String})],Cr.prototype,"maxWidth",2),Pr([ct({type:Object})],Cr.prototype,"appearance",2),Pr([ut()],Cr.prototype,"currentState",2),Pr([ut()],Cr.prototype,"selectedMethod",2),Pr([ut()],Cr.prototype,"cardFormData",2),Pr([ut()],Cr.prototype,"formErrors",2),Pr([ut()],Cr.prototype,"paymentData",2),Pr([ut()],Cr.prototype,"feesExpanded",2),Pr([ut()],Cr.prototype,"isInitializing",2),Pr([ut()],Cr.prototype,"cardBrand",2),Pr([ut()],Cr.prototype,"paymentLocked",2),Pr([ut()],Cr.prototype,"show3DSModal",2),Pr([ut()],Cr.prototype,"showQRModal",2),Pr([ut()],Cr.prototype,"nextActionUrl",2),Pr([ut()],Cr.prototype,"qrCode",2),Pr([ut()],Cr.prototype,"qrCodeDataUrl",2),Pr([ut()],Cr.prototype,"qrAutoResumeTimer",2),Pr([ut()],Cr.prototype,"qrPollingInProgress",2),Cr=Pr([(t=>(e,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("one-payment")],Cr);class $r{async get(t,e){const r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",...e}});if(!r.ok){const t=await Ar(r);throw new Error(t)}return await r.json()}async post(t,e,r){const i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await Ar(i);throw new Error(t)}return await i.json()}async put(t,e,r){const i=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await Ar(i);throw new Error(t)}return await i.json()}async patch(t,e,r){const i=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await Ar(i);throw new Error(t)}return await i.json()}async delete(t,e){const r=await fetch(t,{method:"DELETE",headers:{"Content-Type":"application/json",...e}});if(!r.ok){const t=await Ar(r);throw new Error(t)}return await r.json()}}class Er{constructor(t="one-payments:"){this.prefix=t}async get(t){return localStorage.getItem(this.prefix+t)}async set(t,e){localStorage.setItem(this.prefix+t,e)}async remove(t){localStorage.removeItem(this.prefix+t)}async clear(){Object.keys(localStorage).forEach(t=>{t.startsWith(this.prefix)&&localStorage.removeItem(t)})}}class _r{async sha256(t){const e="string"==typeof t?(new TextEncoder).encode(t):t,r=await crypto.subtle.digest("SHA-256",e);return this.bufferToHex(r)}async hmacSHA256(t,e){const r=new TextEncoder,i=r.encode(t),n=r.encode(e),o=await crypto.subtle.importKey("raw",i,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),s=await crypto.subtle.sign("HMAC",o,n);return this.bufferToHex(s)}uuid(){return crypto.randomUUID()}randomBytes(t){return crypto.getRandomValues(new Uint8Array(t))}bufferToHex(t){return Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join("")}}class Ir{now(){return Date.now()}async delay(t){return new Promise(e=>{setTimeout(e,t)})}}function Mr(){return{http:new $r,storage:new Er,crypto:new _r,timer:new Ir}}const Nr="one-payment",Tr="1.5.6";!function(){if("undefined"==typeof customElements)return console.error("[OnePayments] customElements API is not available in this environment. This bundle is designed for browser environments only."),!1;if(customElements.get(Nr))return console.info(`[OnePayments] <${Nr}> is already registered. Skipping re-registration.`),!0;try{return customElements.define(Nr,Cr),console.info(`[OnePayments] Registered <${Nr}> custom element (v${Tr})`),!0}catch(t){return console.error(`[OnePayments] Failed to register <${Nr}>:`,t),!1}}();const Dr={createWebAdapters:Mr,TAG_NAME:Nr,VERSION:Tr,isRegistered:()=>"undefined"!=typeof customElements&&void 0!==customElements.get(Nr),whenDefined:()=>"undefined"==typeof customElements?Promise.reject(new Error("customElements API is not available")):customElements.whenDefined(Nr)};return"undefined"!=typeof window&&(window.OnePayments?console.warn("[OnePayments] window.OnePayments already exists. The bundle may have been loaded multiple times. Using existing reference."):window.OnePayments=Dr),t.OnePayments=Dr,t.TAG_NAME=Nr,t.VERSION=Tr,t.createWebAdapters=Mr,t.default=Dr,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
2034
+ `,$r([ct({type:Object})],Er.prototype,"config",2),$r([ct({type:Object})],Er.prototype,"adapters",2),$r([ct({type:Number})],Er.prototype,"amount",2),$r([ct({type:String})],Er.prototype,"currency",2),$r([ct({type:String})],Er.prototype,"orderId",2),$r([ct({type:String})],Er.prototype,"firstName",2),$r([ct({type:String})],Er.prototype,"lastName",2),$r([ct({type:String})],Er.prototype,"email",2),$r([ct({type:String})],Er.prototype,"phoneNumber",2),$r([ct({type:Array})],Er.prototype,"excludePaymentMethods",2),$r([ct({type:String})],Er.prototype,"width",2),$r([ct({type:String})],Er.prototype,"maxWidth",2),$r([ct({type:Object})],Er.prototype,"appearance",2),$r([ut()],Er.prototype,"currentState",2),$r([ut()],Er.prototype,"selectedMethod",2),$r([ut()],Er.prototype,"cardFormData",2),$r([ut()],Er.prototype,"formErrors",2),$r([ut()],Er.prototype,"paymentData",2),$r([ut()],Er.prototype,"feesExpanded",2),$r([ut()],Er.prototype,"isInitializing",2),$r([ut()],Er.prototype,"cardBrand",2),$r([ut()],Er.prototype,"paymentLocked",2),$r([ut()],Er.prototype,"show3DSModal",2),$r([ut()],Er.prototype,"showQRModal",2),$r([ut()],Er.prototype,"nextActionUrl",2),$r([ut()],Er.prototype,"qrCode",2),$r([ut()],Er.prototype,"qrCodeDataUrl",2),$r([ut()],Er.prototype,"qrAutoResumeTimer",2),$r([ut()],Er.prototype,"qrPollingInProgress",2),Er=$r([(t=>(e,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("one-payment")],Er);class Mr{async get(t,e){const r=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",...e}});if(!r.ok){const t=await _r(r);throw new Error(t)}return await r.json()}async post(t,e,r){const i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await _r(i);throw new Error(t)}return await i.json()}async put(t,e,r){const i=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await _r(i);throw new Error(t)}return await i.json()}async patch(t,e,r){const i=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(e)});if(!i.ok){const t=await _r(i);throw new Error(t)}return await i.json()}async delete(t,e){const r=await fetch(t,{method:"DELETE",headers:{"Content-Type":"application/json",...e}});if(!r.ok){const t=await _r(r);throw new Error(t)}return await r.json()}}class Ir{constructor(t="one-payments:"){this.prefix=t}async get(t){return localStorage.getItem(this.prefix+t)}async set(t,e){localStorage.setItem(this.prefix+t,e)}async remove(t){localStorage.removeItem(this.prefix+t)}async clear(){Object.keys(localStorage).forEach(t=>{t.startsWith(this.prefix)&&localStorage.removeItem(t)})}}class Nr{async sha256(t){const e="string"==typeof t?(new TextEncoder).encode(t):t,r=await crypto.subtle.digest("SHA-256",e);return this.bufferToHex(r)}async hmacSHA256(t,e){const r=new TextEncoder,i=r.encode(t),n=r.encode(e),s=await crypto.subtle.importKey("raw",i,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),o=await crypto.subtle.sign("HMAC",s,n);return this.bufferToHex(o)}uuid(){return crypto.randomUUID()}randomBytes(t){return crypto.getRandomValues(new Uint8Array(t))}bufferToHex(t){return Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join("")}}class Tr{now(){return Date.now()}async delay(t){return new Promise(e=>{setTimeout(e,t)})}}function Dr(){return{http:new Mr,storage:new Ir,crypto:new Nr,timer:new Tr}}const Rr="one-payment",Lr="1.6.0";!function(){if("undefined"==typeof customElements)return console.error("[OnePayments] customElements API is not available in this environment. This bundle is designed for browser environments only."),!1;if(customElements.get(Rr))return console.info(`[OnePayments] <${Rr}> is already registered. Skipping re-registration.`),!0;try{return customElements.define(Rr,Er),console.info(`[OnePayments] Registered <${Rr}> custom element (v${Lr})`),!0}catch(t){return console.error(`[OnePayments] Failed to register <${Rr}>:`,t),!1}}();const Ur={createWebAdapters:Dr,TAG_NAME:Rr,VERSION:Lr,isRegistered:()=>"undefined"!=typeof customElements&&void 0!==customElements.get(Rr),whenDefined:()=>"undefined"==typeof customElements?Promise.reject(new Error("customElements API is not available")):customElements.whenDefined(Rr)};return"undefined"!=typeof window&&(window.OnePayments?console.warn("[OnePayments] window.OnePayments already exists. The bundle may have been loaded multiple times. Using existing reference."):window.OnePayments=Ur),t.OnePayments=Ur,t.TAG_NAME=Rr,t.VERSION=Lr,t.createWebAdapters=Dr,t.default=Ur,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
1924
2035
  //# sourceMappingURL=one-payment.browser.iife.js.map