@bizzsv/bizz-payment 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -175
- package/README.npm.md +27 -0
- package/dist/index.cjs +3 -3
- package/dist/index.global.js +3 -3
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/dist/package.json +0 -71
package/README.md
CHANGED
|
@@ -1,191 +1,27 @@
|
|
|
1
1
|
# BizPaymentForm SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Secure, isolated payment form for integration in web apps.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- **Node.js:** 24.14.0 or higher
|
|
8
|
-
- **Vite:** 8.0.1 or higher
|
|
9
|
-
- **TypeScript:** 5.9.3 or higher
|
|
10
|
-
|
|
11
|
-
In the root of the project, we have .nvmrc file, if you have installed nvm, you can run
|
|
12
|
-
```bash
|
|
13
|
-
nvm use
|
|
14
|
-
```
|
|
15
|
-
to use the correct version of Node.js. If you don't have nvm installed, you can install it [here](https://github.com/nvm-sh/nvm).
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Plugins/packages used
|
|
19
|
-
|
|
20
|
-
This package is the only one that uses for productions.
|
|
21
|
-
|
|
22
|
-
- **Maska:** Used to mask the input fields, like credit card, number, expiration date, CVV, etc.
|
|
23
|
-
- **Node-Forge:** Used to generate the PKCE challenge and verifier for the OAuth 2.0 flow.
|
|
24
|
-
- **Dompurify:** Used to sanitize the HTML for prevent XSS attacks.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Features includes
|
|
28
|
-
- **Payments without 3DS:** show the form without 3DS if the commerce does not have 3DS enabled.
|
|
29
|
-
- **Payments with 3DS:** show the form with 3DS if the commerce has 3DS enabled.
|
|
30
|
-
|
|
31
|
-
## Development Workflow: Vite Bundle Plugin
|
|
32
|
-
|
|
33
|
-
To keep the project scalable and maintainable while using `srcdoc`, we implemented a custom Vite plugin:
|
|
34
|
-
|
|
35
|
-
1. **TypeScript Native:** We write the iframe logic using modern TypeScript and imports.
|
|
36
|
-
2. **IIFE Transformation:** Vite compiles the entire dependency tree of the iframe into a single, minified, self-executing string (IIFE).
|
|
37
|
-
3. **Dynamic Injection:** This string is injected into the `iframeContent.html` generator, making it available for the `srcdoc` at runtime.
|
|
38
|
-
|
|
39
|
-
## How run the project
|
|
40
|
-
|
|
41
|
-
Native development server with Vite:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pnpm dev
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
React development server with Vite:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
pnpm examples:react:dev
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Vue development server with Vite:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm examples:vue:dev
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular development server with Vite:
|
|
60
|
-
|
|
61
|
-
You need have installed the Angular CLI globally to run the development server. Read more about how to install the Angular CLI [here](https://angular.dev/installation).
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
pnpm install -g @angular/cli
|
|
65
|
-
```
|
|
66
|
-
then:
|
|
67
|
-
```bash
|
|
68
|
-
pnpm examples:angular:dev
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Note: for run the examples (React, Vue, Angular), you need to build the project first.
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
pnpm build
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Testing
|
|
78
|
-
|
|
79
|
-
The project has two types of tests:
|
|
80
|
-
- Unit tests: for testing the iframe logic.
|
|
81
|
-
- End-to-end tests: for testing the iframe in the browser.
|
|
82
|
-
|
|
83
|
-
To run the tests, you need to run the following command:
|
|
5
|
+
## Install
|
|
84
6
|
|
|
85
7
|
```bash
|
|
86
|
-
pnpm
|
|
8
|
+
pnpm add @bizzsv/bizz-payment
|
|
87
9
|
```
|
|
88
10
|
|
|
89
|
-
To run the tests in watch mode, you need to run the following command:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
pnpm test:watch
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
To run the end-to-end tests, you need to run the following command:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
pnpm test:e2e
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
To run the end-to-end tests, you need to run the following command:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
pnpm test:e2e
|
|
105
|
-
```
|
|
106
|
-
or run the tests with the UI:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
pnpm test:e2e:ui
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Documentation website
|
|
113
|
-
|
|
114
|
-
The documentation is built with Starlight and is hosted in the `docs` directory, run on Astro, and its SSR.
|
|
115
|
-
|
|
116
|
-
To run the documentation server, you need to run the following command:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
pnpm docs:dev
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
To build the documentation, you need to run the following command:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
pnpm docs:build
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
To preview the documentation, you need to run the following command:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pnpm docs:preview
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Build the project
|
|
135
|
-
|
|
136
11
|
```bash
|
|
137
|
-
|
|
12
|
+
npm install @bizzsv/bizz-payment
|
|
138
13
|
```
|
|
139
14
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[Read more](https://developer.cardinaltrusted.com/reference/emv-3ds-test-cases-challenge)
|
|
143
|
-
[Read documentation for Cardinal integration](https://developer.cardinaltrusted.com/docs/cardinal-cruise-integration)
|
|
144
|
-
|
|
145
|
-
### Cards for testing
|
|
146
|
-
|
|
147
|
-
The expiration data can be 01/2027 or 01/2028, always the year must be in the future.
|
|
148
|
-
|
|
149
|
-
| Card type | PAN | Cvv | Fecha | Friction |
|
|
150
|
-
|-----------|-----|-----|-------|----------|
|
|
151
|
-
| Visa | 4000000000002701 | 123 | 01 / 2027 | No |
|
|
152
|
-
| Mastercard | 5200000000002235 | 123 | 01 / 2027 | No |
|
|
153
|
-
| Visa | 4000000000002503 | 123 | 01 / 2027 | Yes |
|
|
154
|
-
| Mastercard | 5200000000002151 | 123 | 01 / 2027 | Yes |
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
For no 3DS cards
|
|
158
|
-
|
|
159
|
-
| Card type | PAN | Cvv | Fecha | Friction | Failed |
|
|
160
|
-
|-----------|-----|-----|-------|----------|--------|
|
|
161
|
-
| Visa | 4242000000000851 | 123 | 01 / 2027 | No | Yes |
|
|
162
|
-
| Visa | 4242000000000000 | 123 | 01 / 2027 | No | No |
|
|
163
|
-
| UnionPay | 6215000000003218 | 123 | 01 / 2027 | No | No |
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## Security: The `srcdoc` Approach
|
|
167
|
-
|
|
168
|
-
The package encapsulates the payment form inside an `iframe` with the `srcdoc` attribute. This architectural decision provides several critical security and operational benefits:
|
|
15
|
+
## Usage
|
|
169
16
|
|
|
170
|
-
|
|
171
|
-
By using `srcdoc`, the form lives in a separate environment (`about:srcdoc`). This acts as a "firewall" that prevents:
|
|
172
|
-
- **Script Interception:** External scripts (trackers, malicious ads, or browser extensions) cannot access the data inside the iframe, that means that the commerces can't get access to the data inside the iframe
|
|
173
|
-
- **Keyloggers:** It's significantly harder for generic DOM-based keyloggers to capture inputs inside an isolated iframe.
|
|
174
|
-
- ** CSS Integrity:** The host website's CSS (e.g., `input { margin: 50px !important }`) cannot leak into or break the payment form's layout.
|
|
17
|
+
The package exports `BizzPaymentForm` and related configuration types (`PaymentFormConfig`, `PaymentFormI18n`, etc.). Import from `@bizzsv/bizz-payment` according to your bundler (ESM or CJS).
|
|
175
18
|
|
|
176
|
-
|
|
177
|
-
The `srcdoc` ensures that the content is loaded in a "clean room" environment.
|
|
178
|
-
- **CSS Encapsulation:** The host website's CSS (e.g., `input { margin: 50px !important }`) cannot leak into or break the payment form's layout.
|
|
179
|
-
- **Deterministic UI:** The form will look exactly the same on any website, whether it's a WordPress site, a React app, or a legacy HTML page.
|
|
19
|
+
For framework examples (React, Vue, Angular), tests, docs tooling, and contribution workflow, see the full **README.md** in the source repository.
|
|
180
20
|
|
|
181
|
-
|
|
182
|
-
Unlike traditional `iframe.src` approaches used by other packages (which require hosting an external HTML file), our `srcdoc` architecture:
|
|
183
|
-
- **No Extra Hosting:** The entire form (HTML + CSS + JS) is bundled into your final `dist/index.js`.
|
|
184
|
-
- **Instant Load:** There is no additional network request to fetch the iframe content; it renders as soon as the JS is executed.
|
|
21
|
+
## Documentation
|
|
185
22
|
|
|
186
|
-
|
|
187
|
-
The data never is stored in the browser (localStorage, sessionStorage, cookies, etc.), all data keep in the memory, that means that for each page reload, the data is lost, and each page reload, is a new instance of the form.
|
|
23
|
+
Package documentation and integration details may be published separately; check the github pages documentation website [here](https://biz-latam.github.io/biz-payment/) for links.
|
|
188
24
|
|
|
189
|
-
|
|
25
|
+
## License
|
|
190
26
|
|
|
191
|
-
|
|
27
|
+
ISC — see the `LICENSE` file included in the package when published.
|
package/README.npm.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BizPaymentForm SDK
|
|
2
|
+
|
|
3
|
+
Secure, isolated payment form for integration in web apps.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @bizzsv/bizz-payment
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @bizzsv/bizz-payment
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The package exports `BizzPaymentForm` and related configuration types (`PaymentFormConfig`, `PaymentFormI18n`, etc.). Import from `@bizzsv/bizz-payment` according to your bundler (ESM or CJS).
|
|
18
|
+
|
|
19
|
+
For framework examples (React, Vue, Angular), tests, docs tooling, and contribution workflow, see the full **README.md** in the source repository.
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
Package documentation and integration details may be published separately; check the github pages documentation website [here](https://biz-latam.github.io/biz-payment/) for links.
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
ISC — see the `LICENSE` file included in the package when published.
|
package/dist/index.cjs
CHANGED
|
@@ -20,12 +20,12 @@ Private-Lines: `+f+`\r
|
|
|
20
20
|
`,l+=m;var b=o(`putty-private-key-file-mac-key`,t),x=n.util.createBuffer();a(x,s),a(x,c),a(x,r),x.putInt32(u.length()),x.putBuffer(u),x.putInt32(p.length()),x.putBuffer(p);var S=n.hmac.create();return S.start(`sha1`,b),S.update(x.bytes()),l+=`\r
|
|
21
21
|
Private-MAC: `+S.digest().toHex()+`\r
|
|
22
22
|
`,l},r.publicKeyToOpenSSH=function(e,t){var r=`ssh-rsa`;t||=``;var o=n.util.createBuffer();return a(o,r),i(o,e.e),i(o,e.n),r+` `+n.util.encode64(o.bytes())+` `+t},r.privateKeyToOpenSSH=function(e,t){return t?n.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:`aes128`}):n.pki.privateKeyToPem(e)},r.getPublicKeyFingerprint=function(e,t){t||={};var r=t.md||n.md.md5.create(),o=`ssh-rsa`,s=n.util.createBuffer();a(s,o),i(s,e.e),i(s,e.n),r.start(),r.update(s.getBytes());var c=r.digest();if(t.encoding===`hex`){var l=c.toHex();return t.delimiter?l.match(/.{2}/g).join(t.delimiter):l}else if(t.encoding===`binary`)return c.getBytes();else if(t.encoding)throw Error(`Unknown encoding "`+t.encoding+`".`);return c};function i(e,t){var r=t.toString(16);r[0]>=`8`&&(r=`00`+r);var i=n.util.hexToBytes(r);e.putInt32(i.length),e.putBytes(i)}function a(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}})),te=c(o(((e,t)=>{t.exports=d(),g(),U(),v(),m(),C(),K(),b(),q(),J(),Y(),I(),T(),S(),M(),B(),X(),V(),N(),D(),R(),O(),k(),Z(),H(),p()}))(),1),{entries:ne,setPrototypeOf:re,isFrozen:ie,getPrototypeOf:ae,getOwnPropertyDescriptor:oe}=Object,{freeze:se,seal:ce,create:le}=Object,{apply:ue,construct:de}=typeof Reflect<`u`&&Reflect;se||=function(e){return e},ce||=function(e){return e},ue||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},de||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var fe=Q(Array.prototype.forEach),pe=Q(Array.prototype.lastIndexOf),me=Q(Array.prototype.pop),he=Q(Array.prototype.push),ge=Q(Array.prototype.splice),_e=Q(String.prototype.toLowerCase),ve=Q(String.prototype.toString),ye=Q(String.prototype.match),be=Q(String.prototype.replace),xe=Q(String.prototype.indexOf),Se=Q(String.prototype.trim),Ce=Q(Object.prototype.hasOwnProperty),we=Q(RegExp.prototype.test),Te=Ee(TypeError);function Q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return ue(e,t,r)}}function Ee(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return de(e,n)}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_e;re&&re(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ie(t)||(t[r]=e),i=e)}e[i]=!0}return e}function De(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Oe(e){let t=le(null);for(let[n,r]of ne(e))Ce(e,n)&&(Array.isArray(r)?t[n]=De(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Oe(r):t[n]=r);return t}function ke(e,t){for(;e!==null;){let n=oe(e,t);if(n){if(n.get)return Q(n.get);if(typeof n.value==`function`)return Q(n.value)}e=ae(e)}function n(){return null}return n}var Ae=se(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),je=se(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Me=se([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ne=se([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Pe=se(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Fe=se([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ie=se([`#text`]),Le=se(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),Re=se(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ze=se(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Be=se([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ve=ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm),He=ce(/<%[\w\W]*|[\w\W]*%>/gm),Ue=ce(/\$\{[\w\W]*/gm),We=ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ge=ce(/^aria-[\-\w]+$/),Ke=ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qe=ce(/^(?:\w+script|data):/i),Je=ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ye=ce(/^html$/i),Xe=ce(/^[a-z][.\w]*(-[.\w]+)+$/i),Ze=Object.freeze({__proto__:null,ARIA_ATTR:Ge,ATTR_WHITESPACE:Je,CUSTOM_ELEMENT:Xe,DATA_ATTR:We,DOCTYPE_NAME:Ye,ERB_EXPR:He,IS_ALLOWED_URI:Ke,IS_SCRIPT_OR_DATA:qe,MUSTACHE_EXPR:Ve,TMPLIT_EXPR:Ue}),Qe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$e=function(){return typeof window>`u`?null:window},et=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},tt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$e(),t=e=>nt(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Qe.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=ke(m,`cloneNode`),g=ke(m,`remove`),_=ke(m,`nextSibling`),v=ke(m,`childNodes`),y=ke(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=tt();t.isSupported=typeof ne==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:O,ERB_EXPR:k,TMPLIT_EXPR:A,DATA_ATTR:j,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:ee}=Ze,{IS_ALLOWED_URI:F}=Ze,I=null,L=$({},[...Ae,...je,...Me,...Pe,...Ie]),R=null,z=$({},[...Le,...Re,...ze,...Be]),B=Object.seal(le(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,H=null,U=Object.seal(le(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),W=!0,G=!0,K=!1,q=!0,J=!1,Y=!0,X=!1,Z=!1,te=!1,re=!1,ie=!1,ae=!1,oe=!0,ce=!1,ue=!0,de=!1,Q={},Ee=null,De=$({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Ve=null,He=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ue=null,We=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ge=`http://www.w3.org/1998/Math/MathML`,qe=`http://www.w3.org/2000/svg`,Je=`http://www.w3.org/1999/xhtml`,Xe=Je,rt=!1,it=null,at=$({},[Ge,qe,Je],ve),ot=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),st=$({},[`annotation-xml`]),ct=$({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],dt=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ft&&ft===e)){if((!e||typeof e!=`object`)&&(e={}),e=Oe(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,dt=lt===`application/xhtml+xml`?ve:_e,I=Ce(e,`ALLOWED_TAGS`)?$({},e.ALLOWED_TAGS,dt):L,R=Ce(e,`ALLOWED_ATTR`)?$({},e.ALLOWED_ATTR,dt):z,it=Ce(e,`ALLOWED_NAMESPACES`)?$({},e.ALLOWED_NAMESPACES,ve):at,Ue=Ce(e,`ADD_URI_SAFE_ATTR`)?$(Oe(We),e.ADD_URI_SAFE_ATTR,dt):We,Ve=Ce(e,`ADD_DATA_URI_TAGS`)?$(Oe(He),e.ADD_DATA_URI_TAGS,dt):He,Ee=Ce(e,`FORBID_CONTENTS`)?$({},e.FORBID_CONTENTS,dt):De,V=Ce(e,`FORBID_TAGS`)?$({},e.FORBID_TAGS,dt):Oe({}),H=Ce(e,`FORBID_ATTR`)?$({},e.FORBID_ATTR,dt):Oe({}),Q=Ce(e,`USE_PROFILES`)?e.USE_PROFILES:!1,W=e.ALLOW_ARIA_ATTR!==!1,G=e.ALLOW_DATA_ATTR!==!1,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=e.SAFE_FOR_TEMPLATES||!1,Y=e.SAFE_FOR_XML!==!1,X=e.WHOLE_DOCUMENT||!1,re=e.RETURN_DOM||!1,ie=e.RETURN_DOM_FRAGMENT||!1,ae=e.RETURN_TRUSTED_TYPE||!1,te=e.FORCE_BODY||!1,oe=e.SANITIZE_DOM!==!1,ce=e.SANITIZE_NAMED_PROPS||!1,ue=e.KEEP_CONTENT!==!1,de=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||Ke,Xe=e.NAMESPACE||Je,ot=e.MATHML_TEXT_INTEGRATION_POINTS||ot,st=e.HTML_INTEGRATION_POINTS||st,B=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(G=!1),ie&&(re=!0),Q&&(I=$({},Ie),R=le(null),Q.html===!0&&($(I,Ae),$(R,Le)),Q.svg===!0&&($(I,je),$(R,Re),$(R,Be)),Q.svgFilters===!0&&($(I,Me),$(R,Re),$(R,Be)),Q.mathMl===!0&&($(I,Pe),$(R,ze),$(R,Be))),Ce(e,`ADD_TAGS`)||(U.tagCheck=null),Ce(e,`ADD_ATTR`)||(U.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?U.tagCheck=e.ADD_TAGS:(I===L&&(I=Oe(I)),$(I,e.ADD_TAGS,dt))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?U.attributeCheck=e.ADD_ATTR:(R===z&&(R=Oe(R)),$(R,e.ADD_ATTR,dt))),e.ADD_URI_SAFE_ATTR&&$(Ue,e.ADD_URI_SAFE_ATTR,dt),e.FORBID_CONTENTS&&(Ee===De&&(Ee=Oe(Ee)),$(Ee,e.FORBID_CONTENTS,dt)),e.ADD_FORBID_CONTENTS&&(Ee===De&&(Ee=Oe(Ee)),$(Ee,e.ADD_FORBID_CONTENTS,dt)),ue&&(I[`#text`]=!0),X&&$(I,[`html`,`head`,`body`]),I.table&&($(I,[`tbody`]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=et(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));se&&se(e),ft=e}},gt=$({},[...je,...Me,...Ne]),_t=$({},[...Pe,...Fe]),vt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Xe,tagName:`template`});let n=_e(e.tagName),r=_e(t.tagName);return it[e.namespaceURI]?e.namespaceURI===qe?t.namespaceURI===Je?n===`svg`:t.namespaceURI===Ge?n===`svg`&&(r===`annotation-xml`||ot[r]):!!gt[n]:e.namespaceURI===Ge?t.namespaceURI===Je?n===`math`:t.namespaceURI===qe?n===`math`&&st[r]:!!_t[n]:e.namespaceURI===Je?t.namespaceURI===qe&&!st[r]||t.namespaceURI===Ge&&!ot[r]?!1:!_t[n]&&(ct[n]||!gt[n]):!!(lt===`application/xhtml+xml`&&it[e.namespaceURI]):!1},yt=function(e){he(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},bt=function(e,n){try{he(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{he(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(re||ie)try{yt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},xt=function(e){let t=null,r=null;if(te)e=`<remove></remove>`+e;else{let t=ye(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&Xe===Je&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(Xe===Je)try{t=new f().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=S.createDocument(Xe,`template`,null);try{t.documentElement.innerHTML=rt?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Xe===Je?T.call(t,X?`html`:`body`)[0]:X?t.documentElement:a},St=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ct=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},wt=function(e){return typeof s==`function`&&e instanceof s};function Tt(e,n,r){fe(e,e=>{e.call(t,n,r,ft)})}let Et=function(e){let n=null;if(Tt(D.beforeSanitizeElements,e,null),Ct(e))return yt(e),!0;let r=dt(e.nodeName);if(Tt(D.uponSanitizeElement,e,{tagName:r,allowedTags:I}),Y&&e.hasChildNodes()&&!wt(e.firstElementChild)&&we(/<[/\w!]/g,e.innerHTML)&&we(/<[/\w!]/g,e.textContent)||e.nodeType===Qe.progressingInstruction||Y&&e.nodeType===Qe.comment&&we(/<[/\w]/g,e.data))return yt(e),!0;if(!(U.tagCheck instanceof Function&&U.tagCheck(r))&&(!I[r]||V[r])){if(!V[r]&&Ot(r)&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r)))return!1;if(ue&&!Ee[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return yt(e),!0}return e instanceof c&&!vt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&we(/<\/no(script|embed|frames)/i,e.innerHTML)?(yt(e),!0):(J&&e.nodeType===Qe.text&&(n=e.textContent,fe([O,k,A],e=>{n=be(n,e,` `)}),e.textContent!==n&&(he(t.removed,{element:e.cloneNode()}),e.textContent=n)),Tt(D.afterSanitizeElements,e,null),!1)},Dt=function(e,t,r){if(H[t]||oe&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;if(!(G&&!H[t]&&we(j,t))&&!(W&&we(M,t))&&!(U.attributeCheck instanceof Function&&U.attributeCheck(t,e))){if(!R[t]||H[t]){if(!(Ot(e)&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&we(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&we(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!Ue[t]&&!we(F,be(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&xe(r,`data:`)===0&&Ve[e])&&!(K&&!we(N,be(r,P,``)))&&r)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&ye(e,ee)},kt=function(e){Tt(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||Ct(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=dt(a),l=s,u=a===`value`?l:Se(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,Tt(D.uponSanitizeAttribute,e,r),u=r.attrValue,ce&&(c===`id`||c===`name`)&&(bt(a,e),u=`user-content-`+u),Y&&we(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){bt(a,e);continue}if(c===`attributename`&&ye(u,`href`)){bt(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){bt(a,e);continue}if(!q&&we(/\/>/i,u)){bt(a,e);continue}J&&fe([O,k,A],e=>{u=be(u,e,` `)});let d=dt(e.nodeName);if(!Dt(d,c,u)){bt(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),Ct(e)?yt(e):me(t.removed)}catch{bt(a,e)}}Tt(D.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=St(t);for(Tt(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Tt(D.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof a&&e(n.content);Tt(D.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(rt=!e,rt&&(e=`<!-->`),typeof e!=`string`&&!wt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Te(`dirty is not a string, aborting`)}else throw Te(`toString is not a function`);if(!t.isSupported)return e;if(Z||ht(n),t.removed=[],typeof e==`string`&&(de=!1),de){if(e.nodeName){let t=dt(e.nodeName);if(!I[t]||V[t])throw Te(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=xt(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Qe.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!re&&!J&&!X&&e.indexOf(`<`)===-1)return b&&ae?b.createHTML(e):e;if(i=xt(e),!i)return re?null:ae?x:``}i&&te&&yt(i.firstChild);let u=St(de?e:i);for(;c=u.nextNode();)Et(c),kt(c),c.content instanceof a&&At(c.content);if(de)return e;if(re){if(ie)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(R.shadowroot||R.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=X?i.outerHTML:i.innerHTML;return X&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&we(Ye,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
23
|
-
`+d),J&&fe([O,k,A],e=>{d=be(d,e,` `)}),b&&ae?b.createHTML(d):d},t.setConfig=function(){ht(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Z=!0},t.clearConfig=function(){ft=null,Z=!1},t.isValidAttribute=function(e,t,n){return ft||ht({}),Dt(dt(e),dt(t),n)},t.addHook=function(e,t){typeof t==`function`&&he(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=pe(D[e],t);return n===-1?void 0:ge(D[e],n,1)[0]}return me(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=tt()},t}var rt=nt(),it=class e{static instance;baseUrl=``;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:rt.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},at=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``),ot=async e=>{let t=new TextEncoder().encode(e);return at(await crypto.subtle.digest(`SHA-256`,t))},st=void 0,ct=void 0,lt=class e{static instance;authenticateAuthorize=`oauth/application/authorize`;authenticateToken=`oauth/application/token`;request=it.getInstance();pkceReady;authToken=null;constructor(){this.pkceReady=this.generatePkce()}static getInstance(){return e.instance||=new e,e.instance}getAuthToken(){return this.authToken}async generatePkce(){let e=te.util.bytesToHex(te.random.getBytesSync(32));return{verifier:e,challenge:await ot(e)}}async authorize(e){let t={client_id:st,redirect_uri:ct,response_type:`code`,code_challenge:e,code_challenge_method:`S256`};return(await this.request.post(this.authenticateAuthorize,t)).json()}async token(e,t){let n={client_id:st,code:e,code_verifier:t,redirect_uri:ct,grant_type:`authorization_code`};return(await this.request.post(this.authenticateToken,n)).json()}async authenticateAndAuthorize(){let{verifier:e,challenge:t}=await this.pkceReady;try{let n=await this.authorize(t);this.authToken=await this.token(n.redirect_uri.code,e)}catch(e){throw console.error(`Error authenticating or authorizing:`,e),e}}},ut=class e{request=it.getInstance();static instance;urlConfig=`external/online_payments/orders/configuration`;config=null;constructor(e,t){this.urlConfig=this.setURLcode(e,t)}static getInstance(t,n){return!e.instance&&t&&(e.instance=new e(t,n)),e.instance}getConfig(){return this.config}setURLcode=(e,t)=>t?`${this.urlConfig}?code=${t}&scope=order_template`:`${this.urlConfig}?code=${e}&scope=branch`;async configRequest(){let e=await this.request.get(this.urlConfig),t=await e.json();return e.ok&&(this.config=t),t}},dt=class e{request=it.getInstance();static instance;countries=[];countriesLoadError=null;urlCountries=`resources/countries`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCountries(){return this.countries}setCountries(e){this.countries=e}getCountriesLoadError(){return this.countriesLoadError}async fetchCountries(){let e=await this.request.get(this.urlCountries),t=await e.json();return e.ok?(this.countriesLoadError=null,this.setCountries(t.data),t):(this.countriesLoadError=`No se pudo cargar la lista de países.`,t)}},ft={400:`Error al cargar orden de pago: solicitud inválida`,401:`Error al cargar orden de pago: autenticación requerida`,403:`Error al cargar orden de pago: autorización denegada`,404:`Error al cargar orden de pago: recurso no encontrado`,500:`Error al cargar orden de pago: falla interna del servicio`,502:`Error al cargar orden de pago: respuesta inválida del servicio upstream`,503:`Error al cargar orden de pago: servicio no disponible`};function pt(e,t){return ft[e]||`Error al obtener información de sucursal: ${t}`}var mt=class e{static instance;initPromise=null;auth=lt.getInstance();request=it.getInstance();branchConfig;countryContent=dt.getInstance();authToken=null;config=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async initialize(e,t){return this.initPromise||=this.boot(e,t),this.initPromise}async boot(e,t){await this.auth.authenticateAndAuthorize(),this.authToken=this.auth.getAuthToken(),this.request.setBearerToken(this.authToken?.access_token??``),this.branchConfig=ut.getInstance(e,t);let n=await this.branchConfig.configRequest();if(`error`in n)throw Error(pt(n.status,e));this.config=this.branchConfig.getConfig(),await this.countryContent.fetchCountries()}getAuthToken(){if(!this.authToken)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.authToken}getConfig(){if(!this.config)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.config}},ht=class e{request=it.getInstance();static instance;cardinalToken=null;urlCardinalToken=`external/online_payments/orders/token`;orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCardinalToken(){return this.cardinalToken}setCardinalToken(e){this.cardinalToken=e}generateCardinalTokenPayload(e){return{branch_id:this.orchestrator.getConfig().data.branch_id,subtotal_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),subtotal_currency:`USD`,tip_cents:0,tip_currency:`USD`,description:e.description}}async fetchCardinalToken(e){let t=await this.request.post(this.urlCardinalToken,{data:e}),n=await t.json();return t.ok,n}},gt=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await it.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},_t=e=>{let t=e[0];return Number(t)===4?`visa`:Number(t)===2||Number(t)===5?`mastercard`:Number(t)===6?`union_pay`:`not_valid`},vt=e=>{let[t,n]=e.split(`/`);return{month:t,year:n}},yt=e=>e.replace(/\s/g,``),bt=class e{static instance;songbirdUrl=``;loaded=!1;initialized=!1;constructor(){}static getInstance(){return e.instance||=new e,e.instance}loadSongbird(){return this.loaded?Promise.resolve():new Promise((e,t)=>{let n=document.createElement(`script`);n.src=this.songbirdUrl,n.onload=()=>{this.loaded=!0,e()},n.onerror=()=>t(Error(`Failed to load Songbird script`)),document.head.appendChild(n)})}getBrowserData(){return{browser_java_enabled:!1,browser_language:navigator.language,browser_color_depth:screen.colorDepth,browser_screen_height:screen.height,browser_screen_width:screen.width,browser_time_zone:Intl.DateTimeFormat().resolvedOptions().timeZone||`America/El_Salvador`,user_agent:navigator.userAgent,device_channel:`Browser`,browser_javascript_enabled:!0}}async setupCardinal(e){return await this.loadSongbird(),this.cleanup(),new Promise((t,n)=>{try{Cardinal.configure({timeout:6e3,maxRequestRetries:3,logging:{level:`on`}}),Cardinal.on(`payments.setupComplete`,n=>{Cardinal.off(`payments.setupComplete`),this.submitCollectionForm(e),t(n.sessionId)}),Cardinal.setup(`init`,{jwt:e}),this.initialized=!0}catch(e){n(e)}})}cleanup(){let e=document.querySelector(`iframe[name="cardinalIframe"]`);e&&e.remove();let t=document.getElementById(`collectionForm`);t&&t.remove()}submitCollectionForm(e){this.cleanup();let t=document.createElement(`iframe`);t.name=`cardinalIframe`,t.height=`10`,t.width=`10`,t.style.cssText=`visibility:hidden;position:absolute;top:-1000px;left:-1000px;`,document.body.appendChild(t);let n=document.createElement(`form`);n.id=`collectionForm`,n.name=`devicedata`,n.method=`POST`,n.action=`https://centinelapistag.cardinalcommerce.com/V2/Cruise/Collect`,n.target=`cardinalIframe`;let r=document.createElement(`input`);r.type=`hidden`,r.name=`JWT`,r.value=e,n.appendChild(r),document.body.appendChild(n),n.submit()}onCardinalValidated(){return new Promise(e=>{Cardinal.on(`payments.validated`,t=>{Cardinal.off(`payments.validated`),e(t)})})}continueCardinal(e,t,n){Cardinal.continue(`cca`,{AcsUrl:e.acs_url,Payload:e.payload},{OrderDetails:{TransactionId:e.transaction_id,OrderNumber:e.order_number_client,Amount:t,CurrencyCode:e.currency_code,OrderDescription:n,OrderChannel:e.transaction_mode}})}},xt=class e{static instance;request=it.getInstance();cardinalService=bt.getInstance();registerPaymentResponse=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async registerPayment(e,t){let n={data:{...t,...this.cardinalService.getBrowserData()}},r=await this.request.post(`external/online_payments/orders/${e}/register_payment`,n,{},`api/v2`),i=await r.json();return r.ok&&(this.registerPaymentResponse=i.data),i}async validatePayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/validate_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}async confirmPayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/confirm_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}buildValidatePayloadFromCardinal(e){let t=this.registerPaymentResponse;return{validated:e.Validated,action_code:e.ActionCode,error_number:e.ErrorNumber,error_description:e.ErrorDescription,payment_type:e.Payment.Type,processor_transaction_id:e.Payment.ProcessorTransactionId,cavv:e.Payment.ExtendedData.CAVV,currency_code:e.Payment.ExtendedData.CurrencyCode,eci_flag:e.Payment.ExtendedData.ECIFlag,three_ds_version:e.Payment.ExtendedData.ThreeDSVersion,pares_status:e.Payment.ExtendedData.PAResStatus,signature_verification:e.Payment.ExtendedData.SignatureVerification,cavv_algorithm:t?.cavv_algorithm||void 0,enrolled:t?.enrolled||void 0,ds_transaction_id:t?.ds_transaction_id||void 0}}},St=class{request=it.getInstance();urlEncrypt=`resources/encryption/public_key`;token=null;async getTokenFromServer(){let e=await this.request.get(this.urlEncrypt,{},`api/v2`);if(!e.ok)throw Error(`Failed to get encryption token`);this.token=(await e.json()).data}getToken(){return this.token}encryptData(e){if(!this.token)throw Error(`Encryption token not found`);let t=JSON.stringify({...e,nonce:crypto.randomUUID(),timestamp:Math.floor(Date.now()/1e3)}),n=te.default.random.getBytesSync(32),r=te.default.random.getBytesSync(12),i=te.default.cipher.createCipher(`AES-GCM`,n);i.start({iv:r,additionalData:``,tagLength:128}),i.update(te.default.util.createBuffer(t,`utf8`)),i.finish();let a=te.default.pki.publicKeyFromPem(this.token.public_key).encrypt(n,`RSA-OAEP`);return{encrypted_data:te.default.util.encode64(i.output.getBytes()),encrypted_key:te.default.util.encode64(a),iv:te.default.util.encode64(r),tag:te.default.util.encode64(i.mode.tag.getBytes())}}},Ct=class e{static instance;cardinalToken=ht.getInstance();cardinalService=bt.getInstance();cardinalPayment=xt.getInstance();countryContent=dt.getInstance();stateContent=gt.getInstance();orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}async process(e,t,n){let r=this.cardinalToken.generateCardinalTokenPayload(e);t&&(r.subtotal_cents=t);let i=await this.cardinalToken.fetchCardinalToken(r);if(`error`in i){n.sendAlert(`Error`,i.error||`Error al procesar el pago`);return}let{id:a,token:o}=i.data,s=await this.cardinalService.setupCardinal(o),c=this.countryContent.getCountries().find(t=>t.id===e.country),l=this.stateContent.getStates().find(t=>t.id===e.region),u=vt(e.cardExpiry),d=new St;try{await d.getTokenFromServer()}catch(e){throw Error(`Failed to get encryption token: `+e)}let f=d.encryptData({card_number:yt(e.cardNumber),card_expiration_month:u.month,card_expiration_year:`20${u.year}`,cvv:e.cardCvc,expiration_date:`${u.year}${u.month}`,cardholder_name:e.cardHolder}),p={reference:s,billing_address:e.address,billing_city:e.city,billing_country_code:String(c?.number||``),billing_first_name:e.firstName,billing_last_name:e.lastName,billing_postal_code:e.postalCode,billing_state_code:l?.short_code||``,billing_country_name:c?.name||``,email:e.email,phone_number:e.phone.replace(/\s/g,``),...f},m=await this.cardinalPayment.registerPayment(a,p);if(`error`in m){n.sendAlert(`Error`,m.error||`Error al procesar el pago`);return}let h=m.data;if(h.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
23
|
+
`+d),J&&fe([O,k,A],e=>{d=be(d,e,` `)}),b&&ae?b.createHTML(d):d},t.setConfig=function(){ht(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Z=!0},t.clearConfig=function(){ft=null,Z=!1},t.isValidAttribute=function(e,t,n){return ft||ht({}),Dt(dt(e),dt(t),n)},t.addHook=function(e,t){typeof t==`function`&&he(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=pe(D[e],t);return n===-1?void 0:ge(D[e],n,1)[0]}return me(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=tt()},t}var rt=nt(),it=class e{static instance;baseUrl=`https://devapi.teip.io`;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:rt.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},at=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``),ot=async e=>{let t=new TextEncoder().encode(e);return at(await crypto.subtle.digest(`SHA-256`,t))},st=`R33xmWassTrJO5I52s6FZ_3sdQRdiOR7Vc0oDSuf7No`,ct=`urn:ietf:wg:oauth:2.0:oob`,lt=class e{static instance;authenticateAuthorize=`oauth/application/authorize`;authenticateToken=`oauth/application/token`;request=it.getInstance();pkceReady;authToken=null;constructor(){this.pkceReady=this.generatePkce()}static getInstance(){return e.instance||=new e,e.instance}getAuthToken(){return this.authToken}async generatePkce(){let e=te.util.bytesToHex(te.random.getBytesSync(32));return{verifier:e,challenge:await ot(e)}}async authorize(e){let t={client_id:st,redirect_uri:ct,response_type:`code`,code_challenge:e,code_challenge_method:`S256`};return(await this.request.post(this.authenticateAuthorize,t)).json()}async token(e,t){let n={client_id:st,code:e,code_verifier:t,redirect_uri:ct,grant_type:`authorization_code`};return(await this.request.post(this.authenticateToken,n)).json()}async authenticateAndAuthorize(){let{verifier:e,challenge:t}=await this.pkceReady;try{let n=await this.authorize(t);this.authToken=await this.token(n.redirect_uri.code,e)}catch(e){throw console.error(`Error authenticating or authorizing:`,e),e}}},ut=class e{request=it.getInstance();static instance;urlConfig=`external/online_payments/orders/configuration`;config=null;constructor(e,t){this.urlConfig=this.setURLcode(e,t)}static getInstance(t,n){return!e.instance&&t&&(e.instance=new e(t,n)),e.instance}getConfig(){return this.config}setURLcode=(e,t)=>t?`${this.urlConfig}?code=${t}&scope=order_template`:`${this.urlConfig}?code=${e}&scope=branch`;async configRequest(){let e=await this.request.get(this.urlConfig),t=await e.json();return e.ok&&(this.config=t),t}},dt=class e{request=it.getInstance();static instance;countries=[];countriesLoadError=null;urlCountries=`resources/countries`;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCountries(){return this.countries}setCountries(e){this.countries=e}getCountriesLoadError(){return this.countriesLoadError}async fetchCountries(){let e=await this.request.get(this.urlCountries),t=await e.json();return e.ok?(this.countriesLoadError=null,this.setCountries(t.data),t):(this.countriesLoadError=`No se pudo cargar la lista de países.`,t)}},ft={400:`Error al cargar orden de pago: solicitud inválida`,401:`Error al cargar orden de pago: autenticación requerida`,403:`Error al cargar orden de pago: autorización denegada`,404:`Error al cargar orden de pago: recurso no encontrado`,500:`Error al cargar orden de pago: falla interna del servicio`,502:`Error al cargar orden de pago: respuesta inválida del servicio upstream`,503:`Error al cargar orden de pago: servicio no disponible`};function pt(e,t){return ft[e]||`Error al obtener información de sucursal: ${t}`}var mt=class e{static instance;initPromise=null;auth=lt.getInstance();request=it.getInstance();branchConfig;countryContent=dt.getInstance();authToken=null;config=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async initialize(e,t){return this.initPromise||=this.boot(e,t),this.initPromise}async boot(e,t){await this.auth.authenticateAndAuthorize(),this.authToken=this.auth.getAuthToken(),this.request.setBearerToken(this.authToken?.access_token??``),this.branchConfig=ut.getInstance(e,t);let n=await this.branchConfig.configRequest();if(`error`in n)throw Error(pt(n.status,e));this.config=this.branchConfig.getConfig(),await this.countryContent.fetchCountries()}getAuthToken(){if(!this.authToken)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.authToken}getConfig(){if(!this.config)throw Error(`PaymentOrchestrator not initialized. Call initialize() first.`);return this.config}},ht=class e{request=it.getInstance();static instance;cardinalToken=null;urlCardinalToken=`external/online_payments/orders/token`;orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}getCardinalToken(){return this.cardinalToken}setCardinalToken(e){this.cardinalToken=e}generateCardinalTokenPayload(e){return{branch_id:this.orchestrator.getConfig().data.branch_id,subtotal_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),subtotal_currency:`USD`,tip_cents:0,tip_currency:`USD`,description:e.description}}async fetchCardinalToken(e){let t=await this.request.post(this.urlCardinalToken,{data:e}),n=await t.json();return t.ok,n}},gt=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await it.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},_t=e=>{let t=e[0];return Number(t)===4?`visa`:Number(t)===2||Number(t)===5?`mastercard`:Number(t)===6?`union_pay`:`not_valid`},vt=e=>{let[t,n]=e.split(`/`);return{month:t,year:n}},yt=e=>e.replace(/\s/g,``),bt=class e{static instance;songbirdUrl=`https://cas.static.client.cardinaltrusted.com/songbird/v2.0.0/songbird.js`;loaded=!1;initialized=!1;constructor(){}static getInstance(){return e.instance||=new e,e.instance}loadSongbird(){return this.loaded?Promise.resolve():new Promise((e,t)=>{let n=document.createElement(`script`);n.src=this.songbirdUrl,n.onload=()=>{this.loaded=!0,e()},n.onerror=()=>t(Error(`Failed to load Songbird script`)),document.head.appendChild(n)})}getBrowserData(){return{browser_java_enabled:!1,browser_language:navigator.language,browser_color_depth:screen.colorDepth,browser_screen_height:screen.height,browser_screen_width:screen.width,browser_time_zone:Intl.DateTimeFormat().resolvedOptions().timeZone||`America/El_Salvador`,user_agent:navigator.userAgent,device_channel:`Browser`,browser_javascript_enabled:!0}}async setupCardinal(e){return await this.loadSongbird(),this.cleanup(),new Promise((t,n)=>{try{Cardinal.configure({timeout:6e3,maxRequestRetries:3,logging:{level:`on`}}),Cardinal.on(`payments.setupComplete`,n=>{Cardinal.off(`payments.setupComplete`),this.submitCollectionForm(e),t(n.sessionId)}),Cardinal.setup(`init`,{jwt:e}),this.initialized=!0}catch(e){n(e)}})}cleanup(){let e=document.querySelector(`iframe[name="cardinalIframe"]`);e&&e.remove();let t=document.getElementById(`collectionForm`);t&&t.remove()}submitCollectionForm(e){this.cleanup();let t=document.createElement(`iframe`);t.name=`cardinalIframe`,t.height=`10`,t.width=`10`,t.style.cssText=`visibility:hidden;position:absolute;top:-1000px;left:-1000px;`,document.body.appendChild(t);let n=document.createElement(`form`);n.id=`collectionForm`,n.name=`devicedata`,n.method=`POST`,n.action=`https://centinelapistag.cardinalcommerce.com/V2/Cruise/Collect`,n.target=`cardinalIframe`;let r=document.createElement(`input`);r.type=`hidden`,r.name=`JWT`,r.value=e,n.appendChild(r),document.body.appendChild(n),n.submit()}onCardinalValidated(){return new Promise(e=>{Cardinal.on(`payments.validated`,t=>{Cardinal.off(`payments.validated`),e(t)})})}continueCardinal(e,t,n){Cardinal.continue(`cca`,{AcsUrl:e.acs_url,Payload:e.payload},{OrderDetails:{TransactionId:e.transaction_id,OrderNumber:e.order_number_client,Amount:t,CurrencyCode:e.currency_code,OrderDescription:n,OrderChannel:e.transaction_mode}})}},xt=class e{static instance;request=it.getInstance();cardinalService=bt.getInstance();registerPaymentResponse=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}async registerPayment(e,t){let n={data:{...t,...this.cardinalService.getBrowserData()}},r=await this.request.post(`external/online_payments/orders/${e}/register_payment`,n,{},`api/v2`),i=await r.json();return r.ok&&(this.registerPaymentResponse=i.data),i}async validatePayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/validate_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}async confirmPayment(e,t){let n=await this.request.post(`external/online_payments/orders/${e}/confirm_payment`,{data:t},{},`api/v2`),r=await n.json();return n.ok,r}buildValidatePayloadFromCardinal(e){let t=this.registerPaymentResponse;return{validated:e.Validated,action_code:e.ActionCode,error_number:e.ErrorNumber,error_description:e.ErrorDescription,payment_type:e.Payment.Type,processor_transaction_id:e.Payment.ProcessorTransactionId,cavv:e.Payment.ExtendedData.CAVV,currency_code:e.Payment.ExtendedData.CurrencyCode,eci_flag:e.Payment.ExtendedData.ECIFlag,three_ds_version:e.Payment.ExtendedData.ThreeDSVersion,pares_status:e.Payment.ExtendedData.PAResStatus,signature_verification:e.Payment.ExtendedData.SignatureVerification,cavv_algorithm:t?.cavv_algorithm||void 0,enrolled:t?.enrolled||void 0,ds_transaction_id:t?.ds_transaction_id||void 0}}},St=class{request=it.getInstance();urlEncrypt=`resources/encryption/public_key`;token=null;async getTokenFromServer(){let e=await this.request.get(this.urlEncrypt,{},`api/v2`);if(!e.ok)throw Error(`Failed to get encryption token`);this.token=(await e.json()).data}getToken(){return this.token}encryptData(e){if(!this.token)throw Error(`Encryption token not found`);let t=JSON.stringify({...e,nonce:crypto.randomUUID(),timestamp:Math.floor(Date.now()/1e3)}),n=te.default.random.getBytesSync(32),r=te.default.random.getBytesSync(12),i=te.default.cipher.createCipher(`AES-GCM`,n);i.start({iv:r,additionalData:``,tagLength:128}),i.update(te.default.util.createBuffer(t,`utf8`)),i.finish();let a=te.default.pki.publicKeyFromPem(this.token.public_key).encrypt(n,`RSA-OAEP`);return{encrypted_data:te.default.util.encode64(i.output.getBytes()),encrypted_key:te.default.util.encode64(a),iv:te.default.util.encode64(r),tag:te.default.util.encode64(i.mode.tag.getBytes())}}},Ct=class e{static instance;cardinalToken=ht.getInstance();cardinalService=bt.getInstance();cardinalPayment=xt.getInstance();countryContent=dt.getInstance();stateContent=gt.getInstance();orchestrator=mt.getInstance();constructor(){}static getInstance(){return e.instance||=new e,e.instance}async process(e,t,n){let r=this.cardinalToken.generateCardinalTokenPayload(e);t&&(r.subtotal_cents=t);let i=await this.cardinalToken.fetchCardinalToken(r);if(`error`in i){n.sendAlert(`Error`,i.error||`Error al procesar el pago`);return}let{id:a,token:o}=i.data,s=await this.cardinalService.setupCardinal(o),c=this.countryContent.getCountries().find(t=>t.id===e.country),l=this.stateContent.getStates().find(t=>t.id===e.region),u=vt(e.cardExpiry),d=new St;try{await d.getTokenFromServer()}catch(e){throw Error(`Failed to get encryption token: `+e)}let f=d.encryptData({card_number:yt(e.cardNumber),card_expiration_month:u.month,card_expiration_year:`20${u.year}`,cvv:e.cardCvc,expiration_date:`${u.year}${u.month}`,cardholder_name:e.cardHolder}),p={reference:s,billing_address:e.address,billing_city:e.city,billing_country_code:String(c?.number||``),billing_first_name:e.firstName,billing_last_name:e.lastName,billing_postal_code:e.postalCode,billing_state_code:l?.short_code||``,billing_country_name:c?.name||``,email:e.email,phone_number:e.phone.replace(/\s/g,``),...f},m=await this.cardinalPayment.registerPayment(a,p);if(`error`in m){n.sendAlert(`Error`,m.error||`Error al procesar el pago`);return}let h=m.data;if(h.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
24
24
|
Por favor revisa tu información e inténtalo de nuevo`);return}if(h.required_authentication&&h.acs_url!==``){this.cardinalService.continueCardinal(h,String(r.subtotal_cents),e.description);let t=await this.cardinalService.onCardinalValidated();if(t.ActionCode!==`SUCCESS`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
25
25
|
Por favor revisa tu información e inténtalo de nuevo`);return}let i=this.cardinalPayment.buildValidatePayloadFromCardinal(t),o=await this.cardinalPayment.validatePayment(a,{...i,...f});if(`error`in o){n.sendAlert(`Error`,o.error||`Error al procesar el pago`);return}if(o.data.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
26
26
|
Por favor revisa tu información e inténtalo de nuevo`);return}}else{let e=await this.cardinalPayment.validatePayment(a,{...f});if(`error`in e){n.sendAlert(`Error`,e.error||`Error al procesar el pago`);return}if(e.data.status!==`success`){n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
27
27
|
Por favor revisa tu información e inténtalo de nuevo`);return}}let g=this.buildConfirmPayload(),_=await this.cardinalPayment.confirmPayment(a,{...g,...f});if(`error`in _){n.sendAlert(`Error`,_.error||`Error al procesar el pago`);return}_.data.status===`success`?(n.sendSuccess({data:{id:a,status:_.data.status,amount_cents:parseInt(e.amount.replace(`.`,``).replace(`,`,``)),amount_currency:`USD`,response_code:_.data.response_code,authorization_number:_.data.authorization_code,reference_number:_.data.reference_code,billing_document_number:e.billingDocumentNumber,description:e.description,date:this.getCurrentDate(),time:this.getCurrentTime(),commerce_name:this.orchestrator.getConfig().data.name,branch_name:this.orchestrator.getConfig().data.branch_name,card_network:``,card_last_digits:e.cardNumber.slice(-4),invoice_serie:null}}),n.resetForm()):n.sendAlert(`Error al pagar`,`Tu compra no pudo ser procesada.
|
|
28
|
-
Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){let e=new Date,t=String(e.getFullYear()).slice(2),n=String(e.getMonth()+1).padStart(2,`0`),r=String(e.getHours()).padStart(2,`0`),i=String(e.getMinutes()).padStart(2,`0`),a=String(e.getSeconds()).padStart(2,`0`);return{invoice_number:String(Math.floor(Math.random()*90001)+1e4),terminal_id
|
|
28
|
+
Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){let e=new Date,t=String(e.getFullYear()).slice(2),n=String(e.getMonth()+1).padStart(2,`0`),r=String(e.getHours()).padStart(2,`0`),i=String(e.getMinutes()).padStart(2,`0`),a=String(e.getSeconds()).padStart(2,`0`);return{invoice_number:String(Math.floor(Math.random()*90001)+1e4),terminal_id:`00299998`,retailer_id:`000999999999999`,transaction_date:`${t}${n}`,transaction_time:`${r}${i}${a}`}}getCurrentDate(){let e=new Date,t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}getCurrentTime(){let e=new Date;return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`}};function wt(){let e=document.createElement(`div`);return e.setAttribute(`data-bizz-loading`,``),e.innerHTML=`
|
|
29
29
|
<style>
|
|
30
30
|
[data-bizz-loading] {
|
|
31
31
|
display: flex;
|
|
@@ -374,7 +374,7 @@ Por favor revisa tu información e inténtalo de nuevo`)}buildConfirmPayload(){l
|
|
|
374
374
|
<!--SCRIPT-->
|
|
375
375
|
</body>
|
|
376
376
|
</html>
|
|
377
|
-
`,zt='(function(){var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},l||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var u=b(Array.prototype.forEach),d=b(Array.prototype.lastIndexOf),ee=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(Array.prototype.splice),m=b(String.prototype.toLowerCase),h=b(String.prototype.toString),g=b(String.prototype.match),te=b(String.prototype.replace),ne=b(String.prototype.indexOf),re=b(String.prototype.trim),_=b(Object.prototype.hasOwnProperty),v=b(RegExp.prototype.test),y=ie(TypeError);function b(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return c(e,t,r)}}function ie(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return l(e,n)}}function x(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function C(t){let n=s(null);for(let[r,i]of e(t))_(t,r)&&(Array.isArray(i)?n[r]=S(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=C(i):n[r]=i);return n}function ae(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return b(n.get);if(typeof n.value==`function`)return b(n.value)}e=r(e)}function n(){return null}return n}var oe=a(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),se=a(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ce=a([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),le=a([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ue=a(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),de=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fe=a([`#text`]),pe=a(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),me=a(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),he=a(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ge=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_e=o(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm),ve=o(/<%[\\w\\W]*|[\\w\\W]*%>/gm),ye=o(/\\$\\{[\\w\\W]*/gm),be=o(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),w=o(/^aria-[\\-\\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),Se=o(/^(?:\\w+script|data):/i),Ce=o(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\\w]*(-[.\\w]+)+$/i),Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:be,DOCTYPE_NAME:we,ERB_EXPR:ve,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:_e,TMPLIT_EXPR:ye}),De={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oe=function(){return typeof window>`u`?null:window},ke=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ae=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function je(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe(),n=e=>je(e);if(n.version=`3.3.3`,n.removed=[],!t||!t.document||t.document.nodeType!==De.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:b,Element:ie,NodeFilter:S,NamedNodeMap:_e=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ve,DOMParser:ye,trustedTypes:be}=t,w=ie.prototype,Se=ae(w,`cloneNode`),Ce=ae(w,`remove`),Te=ae(w,`nextSibling`),Me=ae(w,`childNodes`),T=ae(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,D=``,{implementation:O,createNodeIterator:Ne,createDocumentFragment:Pe,getElementsByTagName:Fe}=r,{importNode:Ie}=i,k=Ae();n.isSupported=typeof e==`function`&&typeof T==`function`&&O&&O.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:A,TMPLIT_EXPR:Re,DATA_ATTR:ze,ARIA_ATTR:Be,IS_SCRIPT_OR_DATA:Ve,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:He}=Ee,{IS_ALLOWED_URI:Ue}=Ee,M=null,We=x({},[...oe,...se,...ce,...ue,...fe]),N=null,Ge=x({},[...pe,...me,...he,...ge]),P=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),F=null,I=null,L=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ke=!0,qe=!0,Je=!1,Ye=!0,R=!1,Xe=!0,z=!1,Ze=!1,B=!1,V=!1,H=!1,U=!1,W=!0,Qe=!1,$e=!0,et=!1,G={},K=null,tt=x({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),nt=null,rt=x({},[`audio`,`video`,`img`,`source`,`image`,`track`]),it=null,at=x({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ot=`http://www.w3.org/1998/Math/MathML`,st=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,ct=!1,lt=null,ut=x({},[ot,st,q],h),dt=x({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=x({},[`annotation-xml`]),pt=x({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=r.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=mt===`application/xhtml+xml`?h:m,M=_(e,`ALLOWED_TAGS`)?x({},e.ALLOWED_TAGS,Y):We,N=_(e,`ALLOWED_ATTR`)?x({},e.ALLOWED_ATTR,Y):Ge,lt=_(e,`ALLOWED_NAMESPACES`)?x({},e.ALLOWED_NAMESPACES,h):ut,it=_(e,`ADD_URI_SAFE_ATTR`)?x(C(at),e.ADD_URI_SAFE_ATTR,Y):at,nt=_(e,`ADD_DATA_URI_TAGS`)?x(C(rt),e.ADD_DATA_URI_TAGS,Y):rt,K=_(e,`FORBID_CONTENTS`)?x({},e.FORBID_CONTENTS,Y):tt,F=_(e,`FORBID_TAGS`)?x({},e.FORBID_TAGS,Y):C({}),I=_(e,`FORBID_ATTR`)?x({},e.FORBID_ATTR,Y):C({}),G=_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ke=e.ALLOW_ARIA_ATTR!==!1,qe=e.ALLOW_DATA_ATTR!==!1,Je=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,R=e.SAFE_FOR_TEMPLATES||!1,Xe=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,V=e.RETURN_DOM||!1,H=e.RETURN_DOM_FRAGMENT||!1,U=e.RETURN_TRUSTED_TYPE||!1,B=e.FORCE_BODY||!1,W=e.SANITIZE_DOM!==!1,Qe=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,et=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||xe,J=e.NAMESPACE||q,dt=e.MATHML_TEXT_INTEGRATION_POINTS||dt,ft=e.HTML_INTEGRATION_POINTS||ft,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),R&&(qe=!1),H&&(V=!0),G&&(M=x({},fe),N=s(null),G.html===!0&&(x(M,oe),x(N,pe)),G.svg===!0&&(x(M,se),x(N,me),x(N,ge)),G.svgFilters===!0&&(x(M,ce),x(N,me),x(N,ge)),G.mathMl===!0&&(x(M,ue),x(N,he),x(N,ge))),_(e,`ADD_TAGS`)||(L.tagCheck=null),_(e,`ADD_ATTR`)||(L.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?L.tagCheck=e.ADD_TAGS:(M===We&&(M=C(M)),x(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?L.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=C(N)),x(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&x(it,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.ADD_FORBID_CONTENTS,Y)),$e&&(M[`#text`]=!0),z&&x(M,[`html`,`head`,`body`]),M.table&&(x(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);E=e.TRUSTED_TYPES_POLICY,D=E.createHTML(``)}else E===void 0&&(E=ke(be,o)),E!==null&&typeof D==`string`&&(D=E.createHTML(``));a&&a(e),X=e}},yt=x({},[...se,...ce,...le]),bt=x({},[...ue,...de]),xt=function(e){let t=T(e);(!t||!t.tagName)&&(t={namespaceURI:J,tagName:`template`});let n=m(e.tagName),r=m(t.tagName);return lt[e.namespaceURI]?e.namespaceURI===st?t.namespaceURI===q?n===`svg`:t.namespaceURI===ot?n===`svg`&&(r===`annotation-xml`||dt[r]):!!yt[n]:e.namespaceURI===ot?t.namespaceURI===q?n===`math`:t.namespaceURI===st?n===`math`&&ft[r]:!!bt[n]:e.namespaceURI===q?t.namespaceURI===st&&!ft[r]||t.namespaceURI===ot&&!dt[r]?!1:!bt[n]&&(pt[n]||!yt[n]):!!(mt===`application/xhtml+xml`&<[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{T(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(V||H)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},St=function(e){let t=null,n=null;if(B)e=`<remove></remove>`+e;else{let t=g(e,/^[\\r\\n\\t ]+/);n=t&&t[0]}mt===`application/xhtml+xml`&&J===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?E.createHTML(e):e;if(J===q)try{t=new ye().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=O.createDocument(J,`template`,null);try{t.documentElement.innerHTML=ct?D:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),J===q?Fe.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Ne.call(e.ownerDocument||e,e,S.SHOW_ELEMENT|S.SHOW_COMMENT|S.SHOW_TEXT|S.SHOW_PROCESSING_INSTRUCTION|S.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof ve&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof _e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof b==`function`&&e instanceof b};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Et=function(e){let t=null;if($(k.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(k.uponSanitizeElement,e,{tagName:r,allowedTags:M}),Xe&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&v(/<[/\\w!]/g,e.innerHTML)&&v(/<[/\\w!]/g,e.textContent)||e.nodeType===De.progressingInstruction||Xe&&e.nodeType===De.comment&&v(/<[/\\w]/g,e.data))return Z(e),!0;if(!(L.tagCheck instanceof Function&&L.tagCheck(r))&&(!M[r]||F[r])){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if($e&&!K[r]){let t=T(e)||e.parentNode,n=Me(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof ie&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&v(/<\\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(R&&e.nodeType===De.text&&(t=e.textContent,u([Le,A,Re],e=>{t=te(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(k.afterSanitizeElements,e,null),!1)},Dt=function(e,t,n){if(I[t]||W&&(t===`id`||t===`name`)&&(n in r||n in gt))return!1;if(!(qe&&!I[t]&&v(ze,t))&&!(Ke&&v(Be,t))&&!(L.attributeCheck instanceof Function&&L.attributeCheck(t,e))){if(!N[t]||I[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&v(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(!it[t]&&!v(Ue,te(n,j,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ne(n,`data:`)===0&&nt[e])&&!(Je&&!v(Ve,te(n,j,``)))&&n)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&g(e,He)},kt=function(e){$(k.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:re(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,r),d=r.attrValue,Qe&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),Xe&&v(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(a,e);continue}if(c===`attributename`&&g(d,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Ye&&v(/\\/>/i,d)){Q(a,e);continue}R&&u([Le,A,Re],e=>{d=te(d,e,` `)});let f=Y(e.nodeName);if(!Dt(f,c,d)){Q(a,e);continue}if(E&&typeof be==`object`&&typeof be.getAttributeType==`function`&&!o)switch(be.getAttributeType(f,c)){case`TrustedHTML`:d=E.createHTML(d);break;case`TrustedScriptURL`:d=E.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),wt(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(k.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(k.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(k.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof c&&e(n.content);$(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(ct=!e,ct&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw y(`dirty is not a string, aborting`)}else throw y(`toString is not a function`);if(!n.isSupported)return e;if(Ze||vt(t),n.removed=[],typeof e==`string`&&(et=!1),et){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw y(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof b)r=St(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===De.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!V&&!R&&!z&&e.indexOf(`<`)===-1)return E&&U?E.createHTML(e):e;if(r=St(e),!r)return V?null:U?D:``}r&&B&&Z(r.firstChild);let l=Ct(et?e:r);for(;o=l.nextNode();)Et(o),kt(o),o.content instanceof c&&At(o.content);if(et)return e;if(V){if(H)for(s=Pe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(N.shadowroot||N.shadowrootmode)&&(s=Ie.call(i,s,!0)),s}let d=z?r.outerHTML:r.innerHTML;return z&&M[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&v(we,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`>\n`+d),R&&u([Le,A,Re],e=>{d=te(d,e,` `)}),E&&U?E.createHTML(d):d},n.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},n.clearConfig=function(){X=null,Ze=!1},n.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(k[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(k[e],t);return n===-1?void 0:p(k[e],n,1)[0]}return ee(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k=Ae()},n}var Me=je(),T=class e{static instance;baseUrl=``;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:Me.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},E=Object.defineProperty,D=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>D(e,typeof t==`symbol`?t:t+``,n),Ne={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},Pe=(e,t,n)=>e.replaceAll(t,``).replace(n,`.`).replace(`..`,`.`).replace(/[^.\\d]/g,``),Fe=(e,t,n)=>new Intl.NumberFormat(n.number?.locale??`en`,{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:`trunc`}),Ie=(e,t=!0,n)=>{let r=n.number?.unsigned!==!0&&e.startsWith(`-`)?`-`:``,i=n.number?.fraction??0,a=Fe(0,i,n),o=a.formatToParts(1000.12),s=o.find(e=>e.type===`group`)?.value??` `,c=o.find(e=>e.type===`decimal`)?.value??`.`,l=Pe(e,s,c);if(Number.isNaN(parseFloat(l)))return r;let u=l.split(`.`);u[1]!=null&&u[1].length>=1&&(a=Fe(u[1].length<=i?u[1].length:i,i,n));let d=a.format(parseFloat(l));return t?i>0&&l.endsWith(`.`)&&!l.slice(0,-1).includes(`.`)&&(d+=c):d=Pe(d,s,c),r+d},k=e=>JSON.parse(e.replaceAll(`\'`,`"`)),Le=(e,t={})=>{let n={...t};e.dataset.maska!=null&&e.dataset.maska!==``&&(n.mask=Re(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=A(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=A(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=A(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=ze(e.dataset.maskaTokens));let r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=A(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},A=e=>e===``?!0:!!JSON.parse(e),Re=e=>e.startsWith(`[`)&&e.endsWith(`]`)?k(e):e,ze=e=>{if(e.startsWith(`{`)&&e.endsWith(`}`))return k(e);let t={};return e.split(`|`).forEach(e=>{let n=e.split(`:`);t[n[0]]={pattern:Be()?new RegExp(n[1],`u`):new RegExp(n[1]),optional:n[2]===`optional`,multiple:n[2]===`multiple`,repeated:n[2]===`repeated`}}),t},Be=()=>{try{return!0}catch{return!1}},Ve=class{constructor(e={}){O(this,`opts`,{}),O(this,`memo`,new Map);let t={...e};if(t.tokens!=null){t.tokens=t.tokensReplace?{...t.tokens}:{...Ne,...t.tokens};for(let e of Object.values(t.tokens))typeof e.pattern==`string`&&(e.pattern=Be()?new RegExp(e.pattern,`u`):new RegExp(e.pattern))}else t.tokens=Ne;Array.isArray(t.mask)&&(t.mask.length>1?t.mask=[...t.mask].sort((e,t)=>e.length-t.length):t.mask=t.mask[0]??``),t.mask===``&&(t.mask=null),this.opts=t}masked(e){return this.process(String(e),this.findMask(String(e)))}unmasked(e){return this.process(String(e),this.findMask(String(e)),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(e){let t=this.findMask(String(e));if(this.opts.mask==null||t==null)return!1;let n=this.process(String(e),t).length;return typeof this.opts.mask==`string`?n>=this.opts.mask.length:n>=t.length}findMask(e){let t=this.opts.mask;if(t==null)return null;if(typeof t==`string`)return t;if(typeof t==`function`)return t(e);let n=this.process(e,t.slice(-1).pop()??``,!1);return t.find(t=>this.process(e,t,!1).length>=n.length)??``}escapeMask(e){let t=[],n=[];return e.split(``).forEach((r,i)=>{r===`!`&&e[i-1]!==`!`?n.push(i-n.length):t.push(r)}),{mask:t.join(``),escaped:n}}process(e,t,n=!0){if(this.opts.number!=null)return Ie(e,n,this.opts);if(t==null)return e;let r=`v=${e},mr=${t},m=${n?1:0}`;if(this.memo.has(r))return this.memo.get(r);let{mask:i,escaped:a}=this.escapeMask(t),o=[],s=this.opts.tokens==null?{}:this.opts.tokens,c=this.isReversed()?-1:1,l=this.isReversed()?`unshift`:`push`,u=this.isReversed()?0:i.length-1,d=this.isReversed()?()=>m>-1&&h>-1:()=>m<i.length&&h<e.length,ee=e=>!this.isReversed()&&e<=u||this.isReversed()&&e>=u,f,p=-1,m=this.isReversed()?i.length-1:0,h=this.isReversed()?e.length-1:0,g=!1;for(;d();){let t=i.charAt(m),r=s[t],d=r?.transform==null?e.charAt(h):r.transform(e.charAt(h));if(!a.includes(m)&&r!=null?(d.match(r.pattern)==null?r.multiple?g&&=(m+=c,h-=c,!1):d===f?f=void 0:r.optional&&(m+=c,h-=c):(o[l](d),r.repeated?(p===-1?p=m:m===u&&m!==p&&(m=p-c),u===p&&(m-=c)):r.multiple&&(g=!0,m-=c),m+=c),h+=c):(n&&!this.isEager()&&o[l](t),d===t&&!this.isEager()?h+=c:f=t,this.isEager()||(m+=c)),this.isEager())for(;ee(m)&&(s[i.charAt(m)]==null||a.includes(m));){if(n){if(o[l](i.charAt(m)),e.charAt(h)===i.charAt(m)){m+=c,h+=c;continue}}else i.charAt(m)===e.charAt(h)&&(h+=c);m+=c}}return this.memo.set(r,o.join(``)),this.memo.get(r)}},j=class{constructor(e,t={}){O(this,`items`,new Map),O(this,`eventAbortController`),O(this,`onInput`,e=>{if(e instanceof CustomEvent&&e.type===`input`&&!e.isTrusted&&!e.bubbles)return;let t=e.target,n=this.items.get(t);if(n===void 0)return;let r=`inputType`in e&&e.inputType.startsWith(`delete`),i=n.isEager(),a=r&&i&&n.unmasked(t.value)===``?``:t.value;this.fixCursor(t,r,()=>this.setValue(t,a))}),this.options=t,this.eventAbortController=new AbortController,this.init(this.getInputs(e))}update(e={}){this.options={...e},this.init(Array.from(this.items.keys()))}updateValue(e){e.value!==``&&e.value!==this.processInput(e)?.masked&&this.setValue(e,e.value)}destroy(){this.eventAbortController.abort(),this.items.clear()}init(e){let t=this.getOptions(this.options);for(let n of e){if(!this.items.has(n)){let{signal:e}=this.eventAbortController;n.addEventListener(`input`,this.onInput,{capture:!0,signal:e})}let e=new Ve(Le(n,t));this.items.set(n,e),queueMicrotask(()=>this.updateValue(n)),n.selectionStart===null&&e.isEager()&&console.warn("Maska: input of `%s` type is not supported",n.type)}}getInputs(e){return typeof e==`string`?Array.from(document.querySelectorAll(e)):`length`in e?Array.from(e):[e]}getOptions(e){let{onMaska:t,preProcess:n,postProcess:r,...i}=e;return i}fixCursor(e,t,n){let r=e.selectionStart,i=e.value;if(n(),r===null||r===i.length&&!t)return;let a=e.value,o=i.slice(0,r),s=a.slice(0,r),c=this.processInput(e,o)?.unmasked,l=this.processInput(e,s)?.unmasked;if(c===void 0||l===void 0)return;let u=r;o!==s&&(u+=t?a.length-i.length:c.length-l.length),e.setSelectionRange(u,u)}setValue(e,t){let n=this.processInput(e,t);n!==void 0&&(e.value=n.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(e=>e(n)):this.options.onMaska(n)),e.dispatchEvent(new CustomEvent(`maska`,{detail:n})),e.dispatchEvent(new CustomEvent(`input`,{detail:n.masked})))}processInput(e,t){let n=this.items.get(e);if(n===void 0)return;let r=t??e.value;this.options.preProcess!=null&&(r=this.options.preProcess(r));let i=n.masked(r);return this.options.postProcess!=null&&(i=this.options.postProcess(i)),{masked:i,unmasked:n.unmasked(r),completed:n.completed(r)}}},He={minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0},Ue=new Intl.NumberFormat(`en-US`,He);function M(e,t=`USD`,n=`currency`){return new Intl.NumberFormat(`en-US`,{style:n,currency:t,...He}).format(e)}function We(e){if(!e?.trim())return`—`;let t=e.trim();return t.startsWith(`#`)?t:`#${t}`}var N=(e,t)=>e.querySelector(`input[name="${t}"], select[name="${t}"]`),Ge=(e,t)=>{let n=e.querySelector(`button[type="submit"]`);if(n){n.disabled=t;let e=n.dataset.label??`Pagar`,r=n.dataset.loadingLabel??`Procesando...`;n.textContent=t?r:e}},P=e=>{e.reset();let t=e.querySelector(`select[name="documentType"]`);t&&(t.value=`dui`,t.dispatchEvent(new Event(`change`,{bubbles:!0})))},F=(e,t,n)=>{let r=e.querySelector(`.form-alert`);r&&(r.innerHTML=`<h3>`+t+`</h3><p>`+n+`</p>`,r.classList.remove(`form-alert--receipt`),r.classList.add(`visible`))},I=(e,t)=>{let n=document.querySelector(`.form-header`);if(n){let e=n.querySelector(`.commerce-logo`);e&&(n.innerHTML=``,n.appendChild(e))}let r=document.querySelector(`.divider-header`);r&&(r.style.display=`none`);let i=t.data,a=M(i.amount_cents/100,i.amount_currency),o=`${i.date}, ${i.time}`,s=We(i.reference_number),c=We(i.authorization_number);e.innerHTML=`<div class="payment-success"><p class="payment-success__amount">`+a+`</p><p class="payment-success__datetime">`+o+`</p><div class="payment-success__blocks"><div class="payment-success__block"><span class="payment-success__label">Número de referencia</span><span class="payment-success__value">`+s+`</span></div><div class="payment-success__block"><span class="payment-success__label">Número de autorización</span><span class="payment-success__value">`+c+`</span></div></div><div class="payment-success__footer"><h3 class="payment-success__done">¡Gracias por tu compra!</h3></div></div>`},L=(e,t,n)=>{let r=N(e,t);if(!r)return;let i=r.closest(`.input-wrapper`),a=i?.parentElement?.querySelector(`.field-error`);n?(i&&i.classList.add(`has-error`),a&&(a.textContent=n,a.classList.add(`visible`),Ke(a))):(i&&i.classList.remove(`has-error`),a&&(a.textContent=``,a.classList.remove(`visible`)))},Ke=e=>{e.scrollIntoView({behavior:`smooth`,block:`center`})},qe=e=>{let t=e.find(e=>e.name===`amount`);t&&(t.addEventListener(`input`,function(){let e=t.value.replace(/\\D/g,``);if(e){let n=parseInt(e,10)/100;t.value=Ue.format(n)}else t.value=``}),t.addEventListener(`blur`,()=>{parent.postMessage({type:`payment-form:validate-amount`,amount:t.value},`*`)}))},Je=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await T.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},Ye=e=>{let t=e.find(e=>e.name===`documentType`),n=e.find(e=>e.name===`billingDocumentNumber`);if(!t||!n)return;let r=new j(n);t.addEventListener(`change`,function(e){r?.destroy(),e.target.value===`dui`?(n.setAttribute(`inputmode`,`numeric`),n.setAttribute(`data-maska`,`########-#`),r=new j(n)):(n.removeAttribute(`inputmode`),n.removeAttribute(`data-maska`),n.value=``,r=null)})},R=e=>{e.forEach(function(e){e instanceof HTMLInputElement&&(e.addEventListener(`blur`,function(){let t=e.dataset.maskaValue||e.value;parent.postMessage({type:`payment-form:validate`,field:e.name,value:t},`*`)}),e.addEventListener(`input`,function(){let t=e.closest(`.input-wrapper`),n=t?.parentElement?.querySelector(`.field-error`);t&&t.classList.remove(`has-error`),n&&(n.textContent=``,n.classList.remove(`visible`))})),e instanceof HTMLSelectElement&&e.addEventListener(`change`,function(){parent.postMessage({type:`payment-form:validate`,field:e.name,value:e.value},`*`)})})},Xe=(e,t)=>{e.addEventListener(`submit`,function(e){e.preventDefault();let n={};t.forEach(function(e){n[e.name]=e.dataset.maskaValue||e.value}),parent.postMessage({type:`payment-form:submit`,value:n},`*`)})};function z(e=document.body){let t=new ResizeObserver(()=>{let{width:t,height:n}=e.getBoundingClientRect();parent.postMessage({type:`payment-form:sizing`,width:t,height:n},`*`)});return t.observe(e),t}var Ze=T.getInstance();new j(`input[data-maska]:not([name="billingDocumentNumber"])`);var B=document.getElementById(`payment-form`),V=B.querySelectorAll(`input, select`),H=Array.from(V.values());qe(H),Ye(H);var U=H.find(e=>e.name===`country`),W=H.find(e=>e.name===`region`);if(U instanceof HTMLSelectElement){let e=Je.getInstance();U.addEventListener(`change`,async function(){if(U.value===``)return;if(L(B,`region`,``),W instanceof HTMLSelectElement){W.innerHTML=``;let e=document.createElement(`option`);e.value=``,e.textContent=`Cargando...`,W.appendChild(e),W.disabled=!0}let t=await e.fetchStates(U.value);if(W instanceof HTMLSelectElement&&(W.disabled=!1,W.innerHTML=``),`error`in t){let t=e.getStatesLoadError();t&&L(B,`region`,t);return}if(e.setStates(t.data),parent.postMessage({type:`payment-form:states-loaded`,states:t.data},`*`),W instanceof HTMLSelectElement){let e=document.createElement(`option`);e.value=``,e.textContent=`Selecciona aquí`,W.appendChild(e),t.data.forEach(e=>{let t=document.createElement(`option`);t.value=e.id,t.textContent=e.name,W.appendChild(t)})}})}R(H),z(),window.addEventListener(`message`,function(e){if(!(!e.data||!e.data.type))switch(e.data.type){case`payment-form:set-submit-loading`:Ge(B,e.data.disabled);break;case`payment-form:reset`:P(B);break;case`payment-form:alert`:F(B,e.data.title,e.data.message);break;case`payment-form:validation-result`:L(B,e.data.field,e.data.error);break;case`payment-form:success`:I(B,e.data.paymentIntent);break;case`payment-form:set-token`:Ze.setBearerToken(e.data.token);break;default:break}}),Xe(B,H)})();',Bt=`data:image/svg+xml,%3csvg%20width='99'%20height='32'%20viewBox='0%200%2099%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M27.3848%200C29.8942%206.60543e-06%2031.9284%202.03883%2031.9284%204.55384V27.4462C31.9284%2029.9611%2029.8942%2032%2027.3848%2032H4.54376C2.03439%2032%203.69132e-05%2029.9611%200%2027.4462V4.55384C0%202.03882%202.03437%200%204.54376%200H27.3848ZM12.0067%205.0348C11.1292%205.03257%2010.3064%205.37037%209.68349%205.98797C9.0639%206.60335%208.70775%207.46498%208.70775%208.35337V15.4962C8.70775%2016.0154%209.12754%2016.4372%209.64666%2016.4372C10.1647%2016.4372%2010.5856%2016.0165%2010.5856%2015.4962V8.331C10.5856%207.95282%2010.7328%207.59689%2011.0008%207.32948C11.2676%207.06208%2011.6215%206.91564%2011.9978%206.91564H12.0023C12.7781%206.91791%2013.4099%207.56007%2013.4099%208.34774V13.5762C13.4099%2014.5508%2014.1982%2015.3407%2015.1705%2015.3407H18.1221C18.9695%2015.3407%2019.7934%2015.6518%2020.4119%2016.2325C21.0851%2016.8647%2021.4568%2017.7273%2021.4568%2018.647V21.6646C21.4568%2022.5473%2021.1141%2023.3776%2020.4901%2024.003C19.8672%2024.6274%2019.0387%2024.972%2018.1568%2024.972H14.0229C13.1689%2024.972%2012.3315%2024.67%2011.7063%2024.0871C11.0287%2023.4538%2010.6547%2022.5889%2010.6547%2021.6658V20.9799C10.6547%2020.7315%2010.7529%2020.4931%2010.9282%2020.3163L12.5169%2018.7242C12.6922%2018.5485%2012.93%2018.45%2013.1778%2018.45H15.6618C16.0067%2018.4501%2016.3449%2018.5688%2016.6005%2018.8004C16.8941%2019.0655%2017.056%2019.4314%2017.0549%2019.823C17.0527%2020.576%2016.4331%2021.188%2015.6729%2021.188H13.3161C12.7982%2021.188%2012.3774%2021.6087%2012.3774%2022.1289C12.3774%2022.6481%2012.797%2023.0699%2013.3161%2023.0699H15.6896C16.759%2023.0699%2017.755%2022.5518%2018.3813%2021.6355C18.6346%2021.2651%2018.8066%2020.841%2018.8825%2020.398C19.0666%2019.3273%2018.7339%2018.2823%2017.9949%2017.5338C17.3898%2016.9207%2016.5413%2016.5692%2015.6683%2016.5692H13.2045C12.9232%2016.5692%2012.643%2016.605%2012.3729%2016.6867C11.9196%2016.8243%2011.5189%2017.0638%2011.1884%2017.395L9.62652%2018.9614C9.4334%2019.1549%209.26156%2019.372%209.12983%2019.6115C8.89539%2020.0389%208.77596%2020.5021%208.77596%2020.981V21.6669C8.77597%2022.3673%208.91323%2023.0464%209.18337%2023.6864C9.44348%2024.304%209.81749%2024.859%2010.292%2025.3356C10.7664%2025.8112%2011.3202%2026.186%2011.9364%2026.4467C12.575%2026.7174%2013.2526%2026.855%2013.9514%2026.855H18.1546C18.8534%2026.855%2019.5311%2026.7174%2020.1696%2026.4467C20.7859%2026.1849%2021.3396%2025.8112%2021.8141%2025.3356C22.2885%2024.8601%2022.6626%2024.3052%2022.9227%2023.6876C23.1928%2023.0476%2023.3301%2022.3684%2023.3301%2021.668V18.6503C23.3301%2017.9499%2023.1928%2017.2708%2022.9227%2016.6309L22.9259%2016.6274C22.6647%2016.0098%2022.2918%2015.4549%2021.8174%2014.9794C21.3418%2014.5028%2020.7891%2014.1291%2020.1729%2013.8684C19.5343%2013.5976%2018.8567%2013.4598%2018.1579%2013.4598H15.2865V8.331C15.2865%207.46722%2014.9562%206.65034%2014.3545%206.03272C13.7416%205.40167%2012.8852%205.03816%2012.0067%205.0348Z'%20fill='%23121417'/%3e%3cpath%20d='M53.3405%2027.9622C52.2765%2027.9622%2051.291%2027.7244%2050.3858%2027.2507C49.4807%2026.7769%2048.7229%2026.121%2048.1143%2025.2809V25.8218C48.1143%2026.7616%2047.3527%2027.5249%2046.415%2027.5249C45.4773%2027.5249%2044.7157%2026.7616%2044.7157%2025.8218V5.70262C44.7157%204.76283%2045.4773%203.99949%2046.415%203.99949C47.3527%203.99949%2048.1143%204.76283%2048.1143%205.70262V15.6663C48.6789%2014.855%2049.408%2014.2202%2050.3055%2013.7656C51.201%2013.3092%2052.1904%2013.0809%2053.2735%2013.0809C54.6112%2013.0809%2055.8072%2013.4051%2056.8635%2014.0514C57.918%2014.6997%2058.7485%2015.5819%2059.3532%2016.6982C59.9579%2017.8144%2060.2603%2019.0898%2060.2603%2020.5206C60.2603%2021.9514%2059.9503%2023.2422%2059.3321%2024.3642C58.714%2025.4862%2057.8835%2026.3665%2056.8406%2027.0033C55.7995%2027.6419%2054.6322%2027.9603%2053.3405%2027.9603V27.9622ZM52.3722%2025.0489C53.218%2025.0489%2053.9663%2024.8552%2054.6169%2024.4677C55.2676%2024.0803%2055.7766%2023.5471%2056.1459%2022.8682C56.5133%2022.1892%2056.699%2021.4125%2056.699%2020.536C56.699%2019.6595%2056.5095%2018.8789%2056.1325%2018.1903C55.7555%2017.5018%2055.2427%2016.9648%2054.5978%2016.5754C53.951%2016.188%2053.2104%2015.9943%2052.3741%2015.9943C51.5378%2015.9943%2050.7877%2016.188%2050.1294%2016.5754C49.4692%2016.9628%2048.9525%2017.5018%2048.5813%2018.1903C48.2081%2018.8789%2048.0225%2019.6614%2048.0225%2020.536C48.0225%2021.4105%2048.2062%2022.1892%2048.5755%2022.8682C48.9449%2023.5471%2049.4577%2024.0803%2050.1179%2024.4677C50.7781%2024.8552%2051.5302%2025.0489%2052.376%2025.0489H52.3722Z'%20fill='%23121417'/%3e%3cpath%20d='M64.816%2010.647C64.4429%2010.647%2064.1003%2010.553%2063.7865%2010.367C63.4726%2010.1809%2063.2219%209.92969%2063.0363%209.61515C62.8488%209.30061%2062.7569%208.95154%2062.7569%208.56795C62.7569%208.18437%2062.8507%207.85256%2063.0363%207.54186C63.2219%207.23115%2063.4726%206.98374%2063.7865%206.79578C64.1003%206.60974%2064.4429%206.51576%2064.816%206.51576C65.1892%206.51576%2065.5413%206.60974%2065.8456%206.79578C66.1498%206.98374%2066.3967%207.23115%2066.5823%207.54186C66.7679%207.85256%2066.8617%208.19396%2066.8617%208.56795C66.8617%208.94195%2066.7679%209.30061%2066.5823%209.61515C66.3948%209.92969%2066.1498%2010.1809%2065.8456%2010.367C65.5413%2010.5549%2065.1968%2010.647%2064.816%2010.647ZM63.109%2025.8217V15.2213C63.109%2014.2815%2063.8707%2013.5182%2064.8084%2013.5182C65.746%2013.5182%2066.5077%2014.2815%2066.5077%2015.2213V25.8217C66.5077%2026.7615%2065.746%2027.5249%2064.8084%2027.5249C63.8707%2027.5249%2063.109%2026.7615%2063.109%2025.8217Z'%20fill='%23121417'/%3e%3cpath%20d='M70.9719%2025.4033L78.0104%2016.1569H71.7795C71.0523%2016.1569%2070.4629%2015.5662%2070.4629%2014.8374C70.4629%2014.1086%2071.0523%2013.5178%2071.7795%2013.5178H81.1736C82.2644%2013.5178%2082.8825%2014.7702%2082.2204%2015.6391L75.1724%2024.8835H82.1113C82.8385%2024.8835%2083.4279%2025.4743%2083.4279%2026.2031C83.4279%2026.9319%2082.8385%2027.5226%2082.1113%2027.5226H72.0187C70.9279%2027.5226%2070.3098%2026.2702%2070.9719%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3cpath%20d='M86.544%2025.4033L93.5824%2016.1569H87.3516C86.6244%2016.1569%2086.035%2015.5662%2086.035%2014.8374C86.035%2014.1086%2086.6244%2013.5178%2087.3516%2013.5178H96.7457C97.8365%2013.5178%2098.4546%2014.7702%2097.7925%2015.6391L90.7445%2024.8835H97.6834C98.4106%2024.8835%2099%2025.4743%2099%2026.2031C99%2026.9319%2098.4106%2027.5226%2097.6834%2027.5226H87.5908C86.5%2027.5226%2085.8819%2026.2702%2086.544%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3c/svg%3e`;function Vt(e){let t=`<img src="${Bt}" alt="Bizz Logo" class="bizz-logo">`;return Rt.replace(`<!--BIZZ_LOGO-->`,t).replace(`<!--HEADER-->`,e.headerHtml).replace(`<!--AMOUNT_FIELD-->`,e.amountHtml).replace(`<!--FIELDS-->`,e.fieldsHtml).replace(`<!--SUBMIT_BUTTON-->`,e.submitButtonHtml).replace(`<!--SCRIPT-->`,`<script>${zt}<\/script>`)}function Ht(e){let t=document.createElement(`iframe`);return t.style.border=`none`,t.style.display=`block`,t.style.overflow=`hidden`,t.srcdoc=e,t.style.width=`100%`,t.style.height=`100%`,t}var Ut=`<svg
|
|
377
|
+
`,zt='(function(){var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},l||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var u=b(Array.prototype.forEach),d=b(Array.prototype.lastIndexOf),ee=b(Array.prototype.pop),f=b(Array.prototype.push),p=b(Array.prototype.splice),m=b(String.prototype.toLowerCase),h=b(String.prototype.toString),g=b(String.prototype.match),te=b(String.prototype.replace),ne=b(String.prototype.indexOf),re=b(String.prototype.trim),_=b(Object.prototype.hasOwnProperty),v=b(RegExp.prototype.test),y=ie(TypeError);function b(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return c(e,t,r)}}function ie(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return l(e,n)}}function x(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function S(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function C(t){let n=s(null);for(let[r,i]of e(t))_(t,r)&&(Array.isArray(i)?n[r]=S(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=C(i):n[r]=i);return n}function ae(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return b(n.get);if(typeof n.value==`function`)return b(n.value)}e=r(e)}function n(){return null}return n}var oe=a(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),se=a(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ce=a([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),le=a([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ue=a(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),de=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),fe=a([`#text`]),pe=a(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),me=a(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),he=a(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),ge=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),_e=o(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm),ve=o(/<%[\\w\\W]*|[\\w\\W]*%>/gm),ye=o(/\\$\\{[\\w\\W]*/gm),be=o(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),w=o(/^aria-[\\-\\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),Se=o(/^(?:\\w+script|data):/i),Ce=o(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\\w]*(-[.\\w]+)+$/i),Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:be,DOCTYPE_NAME:we,ERB_EXPR:ve,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:_e,TMPLIT_EXPR:ye}),De={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oe=function(){return typeof window>`u`?null:window},ke=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ae=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function je(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe(),n=e=>je(e);if(n.version=`3.3.3`,n.removed=[],!t||!t.document||t.document.nodeType!==De.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:b,Element:ie,NodeFilter:S,NamedNodeMap:_e=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ve,DOMParser:ye,trustedTypes:be}=t,w=ie.prototype,Se=ae(w,`cloneNode`),Ce=ae(w,`remove`),Te=ae(w,`nextSibling`),Me=ae(w,`childNodes`),T=ae(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,D=``,{implementation:O,createNodeIterator:Ne,createDocumentFragment:Pe,getElementsByTagName:Fe}=r,{importNode:Ie}=i,k=Ae();n.isSupported=typeof e==`function`&&typeof T==`function`&&O&&O.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:A,TMPLIT_EXPR:Re,DATA_ATTR:ze,ARIA_ATTR:Be,IS_SCRIPT_OR_DATA:Ve,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:He}=Ee,{IS_ALLOWED_URI:Ue}=Ee,M=null,We=x({},[...oe,...se,...ce,...ue,...fe]),N=null,Ge=x({},[...pe,...me,...he,...ge]),P=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),F=null,I=null,L=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ke=!0,qe=!0,Je=!1,Ye=!0,R=!1,Xe=!0,z=!1,Ze=!1,B=!1,V=!1,H=!1,U=!1,W=!0,Qe=!1,$e=!0,et=!1,G={},K=null,tt=x({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),nt=null,rt=x({},[`audio`,`video`,`img`,`source`,`image`,`track`]),it=null,at=x({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ot=`http://www.w3.org/1998/Math/MathML`,st=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,ct=!1,lt=null,ut=x({},[ot,st,q],h),dt=x({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=x({},[`annotation-xml`]),pt=x({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=r.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=mt===`application/xhtml+xml`?h:m,M=_(e,`ALLOWED_TAGS`)?x({},e.ALLOWED_TAGS,Y):We,N=_(e,`ALLOWED_ATTR`)?x({},e.ALLOWED_ATTR,Y):Ge,lt=_(e,`ALLOWED_NAMESPACES`)?x({},e.ALLOWED_NAMESPACES,h):ut,it=_(e,`ADD_URI_SAFE_ATTR`)?x(C(at),e.ADD_URI_SAFE_ATTR,Y):at,nt=_(e,`ADD_DATA_URI_TAGS`)?x(C(rt),e.ADD_DATA_URI_TAGS,Y):rt,K=_(e,`FORBID_CONTENTS`)?x({},e.FORBID_CONTENTS,Y):tt,F=_(e,`FORBID_TAGS`)?x({},e.FORBID_TAGS,Y):C({}),I=_(e,`FORBID_ATTR`)?x({},e.FORBID_ATTR,Y):C({}),G=_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ke=e.ALLOW_ARIA_ATTR!==!1,qe=e.ALLOW_DATA_ATTR!==!1,Je=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,R=e.SAFE_FOR_TEMPLATES||!1,Xe=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,V=e.RETURN_DOM||!1,H=e.RETURN_DOM_FRAGMENT||!1,U=e.RETURN_TRUSTED_TYPE||!1,B=e.FORCE_BODY||!1,W=e.SANITIZE_DOM!==!1,Qe=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,et=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||xe,J=e.NAMESPACE||q,dt=e.MATHML_TEXT_INTEGRATION_POINTS||dt,ft=e.HTML_INTEGRATION_POINTS||ft,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),R&&(qe=!1),H&&(V=!0),G&&(M=x({},fe),N=s(null),G.html===!0&&(x(M,oe),x(N,pe)),G.svg===!0&&(x(M,se),x(N,me),x(N,ge)),G.svgFilters===!0&&(x(M,ce),x(N,me),x(N,ge)),G.mathMl===!0&&(x(M,ue),x(N,he),x(N,ge))),_(e,`ADD_TAGS`)||(L.tagCheck=null),_(e,`ADD_ATTR`)||(L.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?L.tagCheck=e.ADD_TAGS:(M===We&&(M=C(M)),x(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?L.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=C(N)),x(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&x(it,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(K===tt&&(K=C(K)),x(K,e.ADD_FORBID_CONTENTS,Y)),$e&&(M[`#text`]=!0),z&&x(M,[`html`,`head`,`body`]),M.table&&(x(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);E=e.TRUSTED_TYPES_POLICY,D=E.createHTML(``)}else E===void 0&&(E=ke(be,o)),E!==null&&typeof D==`string`&&(D=E.createHTML(``));a&&a(e),X=e}},yt=x({},[...se,...ce,...le]),bt=x({},[...ue,...de]),xt=function(e){let t=T(e);(!t||!t.tagName)&&(t={namespaceURI:J,tagName:`template`});let n=m(e.tagName),r=m(t.tagName);return lt[e.namespaceURI]?e.namespaceURI===st?t.namespaceURI===q?n===`svg`:t.namespaceURI===ot?n===`svg`&&(r===`annotation-xml`||dt[r]):!!yt[n]:e.namespaceURI===ot?t.namespaceURI===q?n===`math`:t.namespaceURI===st?n===`math`&&ft[r]:!!bt[n]:e.namespaceURI===q?t.namespaceURI===st&&!ft[r]||t.namespaceURI===ot&&!dt[r]?!1:!bt[n]&&(pt[n]||!yt[n]):!!(mt===`application/xhtml+xml`&<[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{T(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(V||H)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},St=function(e){let t=null,n=null;if(B)e=`<remove></remove>`+e;else{let t=g(e,/^[\\r\\n\\t ]+/);n=t&&t[0]}mt===`application/xhtml+xml`&&J===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?E.createHTML(e):e;if(J===q)try{t=new ye().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=O.createDocument(J,`template`,null);try{t.documentElement.innerHTML=ct?D:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),J===q?Fe.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Ne.call(e.ownerDocument||e,e,S.SHOW_ELEMENT|S.SHOW_COMMENT|S.SHOW_TEXT|S.SHOW_PROCESSING_INSTRUCTION|S.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof ve&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof _e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof b==`function`&&e instanceof b};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Et=function(e){let t=null;if($(k.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(k.uponSanitizeElement,e,{tagName:r,allowedTags:M}),Xe&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&v(/<[/\\w!]/g,e.innerHTML)&&v(/<[/\\w!]/g,e.textContent)||e.nodeType===De.progressingInstruction||Xe&&e.nodeType===De.comment&&v(/<[/\\w]/g,e.data))return Z(e),!0;if(!(L.tagCheck instanceof Function&&L.tagCheck(r))&&(!M[r]||F[r])){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if($e&&!K[r]){let t=T(e)||e.parentNode,n=Me(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof ie&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&v(/<\\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(R&&e.nodeType===De.text&&(t=e.textContent,u([Le,A,Re],e=>{t=te(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(k.afterSanitizeElements,e,null),!1)},Dt=function(e,t,n){if(I[t]||W&&(t===`id`||t===`name`)&&(n in r||n in gt))return!1;if(!(qe&&!I[t]&&v(ze,t))&&!(Ke&&v(Be,t))&&!(L.attributeCheck instanceof Function&&L.attributeCheck(t,e))){if(!N[t]||I[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&v(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(!it[t]&&!v(Ue,te(n,j,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ne(n,`data:`)===0&&nt[e])&&!(Je&&!v(Ve,te(n,j,``)))&&n)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&g(e,He)},kt=function(e){$(k.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:re(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,r),d=r.attrValue,Qe&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),Xe&&v(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(a,e);continue}if(c===`attributename`&&g(d,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Ye&&v(/\\/>/i,d)){Q(a,e);continue}R&&u([Le,A,Re],e=>{d=te(d,e,` `)});let f=Y(e.nodeName);if(!Dt(f,c,d)){Q(a,e);continue}if(E&&typeof be==`object`&&typeof be.getAttributeType==`function`&&!o)switch(be.getAttributeType(f,c)){case`TrustedHTML`:d=E.createHTML(d);break;case`TrustedScriptURL`:d=E.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),wt(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(k.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(k.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(k.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof c&&e(n.content);$(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(ct=!e,ct&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw y(`dirty is not a string, aborting`)}else throw y(`toString is not a function`);if(!n.isSupported)return e;if(Ze||vt(t),n.removed=[],typeof e==`string`&&(et=!1),et){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw y(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof b)r=St(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===De.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!V&&!R&&!z&&e.indexOf(`<`)===-1)return E&&U?E.createHTML(e):e;if(r=St(e),!r)return V?null:U?D:``}r&&B&&Z(r.firstChild);let l=Ct(et?e:r);for(;o=l.nextNode();)Et(o),kt(o),o.content instanceof c&&At(o.content);if(et)return e;if(V){if(H)for(s=Pe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(N.shadowroot||N.shadowrootmode)&&(s=Ie.call(i,s,!0)),s}let d=z?r.outerHTML:r.innerHTML;return z&&M[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&v(we,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`>\n`+d),R&&u([Le,A,Re],e=>{d=te(d,e,` `)}),E&&U?E.createHTML(d):d},n.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},n.clearConfig=function(){X=null,Ze=!1},n.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(k[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(k[e],t);return n===-1?void 0:p(k[e],n,1)[0]}return ee(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k=Ae()},n}var Me=je(),T=class e{static instance;baseUrl=`https://devapi.teip.io`;bearerToken=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}setBearerToken(e){this.bearerToken=e}async get(e,t={},n=`api/v1`){return fetch(`${this.baseUrl}/${n}/${e}`,{...t,method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...t.headers}})}async post(e,t,n={},r=`api/v1`){return fetch(`${this.baseUrl}/${r}/${e}`,{body:Me.sanitize(JSON.stringify(t)),method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${this.bearerToken}`,...n.headers},...n})}},E=Object.defineProperty,D=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>D(e,typeof t==`symbol`?t:t+``,n),Ne={"#":{pattern:/[0-9]/},"@":{pattern:/[a-zA-Z]/},"*":{pattern:/[a-zA-Z0-9]/}},Pe=(e,t,n)=>e.replaceAll(t,``).replace(n,`.`).replace(`..`,`.`).replace(/[^.\\d]/g,``),Fe=(e,t,n)=>new Intl.NumberFormat(n.number?.locale??`en`,{minimumFractionDigits:e,maximumFractionDigits:t,roundingMode:`trunc`}),Ie=(e,t=!0,n)=>{let r=n.number?.unsigned!==!0&&e.startsWith(`-`)?`-`:``,i=n.number?.fraction??0,a=Fe(0,i,n),o=a.formatToParts(1000.12),s=o.find(e=>e.type===`group`)?.value??` `,c=o.find(e=>e.type===`decimal`)?.value??`.`,l=Pe(e,s,c);if(Number.isNaN(parseFloat(l)))return r;let u=l.split(`.`);u[1]!=null&&u[1].length>=1&&(a=Fe(u[1].length<=i?u[1].length:i,i,n));let d=a.format(parseFloat(l));return t?i>0&&l.endsWith(`.`)&&!l.slice(0,-1).includes(`.`)&&(d+=c):d=Pe(d,s,c),r+d},k=e=>JSON.parse(e.replaceAll(`\'`,`"`)),Le=(e,t={})=>{let n={...t};e.dataset.maska!=null&&e.dataset.maska!==``&&(n.mask=Re(e.dataset.maska)),e.dataset.maskaEager!=null&&(n.eager=A(e.dataset.maskaEager)),e.dataset.maskaReversed!=null&&(n.reversed=A(e.dataset.maskaReversed)),e.dataset.maskaTokensReplace!=null&&(n.tokensReplace=A(e.dataset.maskaTokensReplace)),e.dataset.maskaTokens!=null&&(n.tokens=ze(e.dataset.maskaTokens));let r={};return e.dataset.maskaNumberLocale!=null&&(r.locale=e.dataset.maskaNumberLocale),e.dataset.maskaNumberFraction!=null&&(r.fraction=parseInt(e.dataset.maskaNumberFraction)),e.dataset.maskaNumberUnsigned!=null&&(r.unsigned=A(e.dataset.maskaNumberUnsigned)),(e.dataset.maskaNumber!=null||Object.values(r).length>0)&&(n.number=r),n},A=e=>e===``?!0:!!JSON.parse(e),Re=e=>e.startsWith(`[`)&&e.endsWith(`]`)?k(e):e,ze=e=>{if(e.startsWith(`{`)&&e.endsWith(`}`))return k(e);let t={};return e.split(`|`).forEach(e=>{let n=e.split(`:`);t[n[0]]={pattern:Be()?new RegExp(n[1],`u`):new RegExp(n[1]),optional:n[2]===`optional`,multiple:n[2]===`multiple`,repeated:n[2]===`repeated`}}),t},Be=()=>{try{return!0}catch{return!1}},Ve=class{constructor(e={}){O(this,`opts`,{}),O(this,`memo`,new Map);let t={...e};if(t.tokens!=null){t.tokens=t.tokensReplace?{...t.tokens}:{...Ne,...t.tokens};for(let e of Object.values(t.tokens))typeof e.pattern==`string`&&(e.pattern=Be()?new RegExp(e.pattern,`u`):new RegExp(e.pattern))}else t.tokens=Ne;Array.isArray(t.mask)&&(t.mask.length>1?t.mask=[...t.mask].sort((e,t)=>e.length-t.length):t.mask=t.mask[0]??``),t.mask===``&&(t.mask=null),this.opts=t}masked(e){return this.process(String(e),this.findMask(String(e)))}unmasked(e){return this.process(String(e),this.findMask(String(e)),!1)}isEager(){return this.opts.eager===!0}isReversed(){return this.opts.reversed===!0}completed(e){let t=this.findMask(String(e));if(this.opts.mask==null||t==null)return!1;let n=this.process(String(e),t).length;return typeof this.opts.mask==`string`?n>=this.opts.mask.length:n>=t.length}findMask(e){let t=this.opts.mask;if(t==null)return null;if(typeof t==`string`)return t;if(typeof t==`function`)return t(e);let n=this.process(e,t.slice(-1).pop()??``,!1);return t.find(t=>this.process(e,t,!1).length>=n.length)??``}escapeMask(e){let t=[],n=[];return e.split(``).forEach((r,i)=>{r===`!`&&e[i-1]!==`!`?n.push(i-n.length):t.push(r)}),{mask:t.join(``),escaped:n}}process(e,t,n=!0){if(this.opts.number!=null)return Ie(e,n,this.opts);if(t==null)return e;let r=`v=${e},mr=${t},m=${n?1:0}`;if(this.memo.has(r))return this.memo.get(r);let{mask:i,escaped:a}=this.escapeMask(t),o=[],s=this.opts.tokens==null?{}:this.opts.tokens,c=this.isReversed()?-1:1,l=this.isReversed()?`unshift`:`push`,u=this.isReversed()?0:i.length-1,d=this.isReversed()?()=>m>-1&&h>-1:()=>m<i.length&&h<e.length,ee=e=>!this.isReversed()&&e<=u||this.isReversed()&&e>=u,f,p=-1,m=this.isReversed()?i.length-1:0,h=this.isReversed()?e.length-1:0,g=!1;for(;d();){let t=i.charAt(m),r=s[t],d=r?.transform==null?e.charAt(h):r.transform(e.charAt(h));if(!a.includes(m)&&r!=null?(d.match(r.pattern)==null?r.multiple?g&&=(m+=c,h-=c,!1):d===f?f=void 0:r.optional&&(m+=c,h-=c):(o[l](d),r.repeated?(p===-1?p=m:m===u&&m!==p&&(m=p-c),u===p&&(m-=c)):r.multiple&&(g=!0,m-=c),m+=c),h+=c):(n&&!this.isEager()&&o[l](t),d===t&&!this.isEager()?h+=c:f=t,this.isEager()||(m+=c)),this.isEager())for(;ee(m)&&(s[i.charAt(m)]==null||a.includes(m));){if(n){if(o[l](i.charAt(m)),e.charAt(h)===i.charAt(m)){m+=c,h+=c;continue}}else i.charAt(m)===e.charAt(h)&&(h+=c);m+=c}}return this.memo.set(r,o.join(``)),this.memo.get(r)}},j=class{constructor(e,t={}){O(this,`items`,new Map),O(this,`eventAbortController`),O(this,`onInput`,e=>{if(e instanceof CustomEvent&&e.type===`input`&&!e.isTrusted&&!e.bubbles)return;let t=e.target,n=this.items.get(t);if(n===void 0)return;let r=`inputType`in e&&e.inputType.startsWith(`delete`),i=n.isEager(),a=r&&i&&n.unmasked(t.value)===``?``:t.value;this.fixCursor(t,r,()=>this.setValue(t,a))}),this.options=t,this.eventAbortController=new AbortController,this.init(this.getInputs(e))}update(e={}){this.options={...e},this.init(Array.from(this.items.keys()))}updateValue(e){e.value!==``&&e.value!==this.processInput(e)?.masked&&this.setValue(e,e.value)}destroy(){this.eventAbortController.abort(),this.items.clear()}init(e){let t=this.getOptions(this.options);for(let n of e){if(!this.items.has(n)){let{signal:e}=this.eventAbortController;n.addEventListener(`input`,this.onInput,{capture:!0,signal:e})}let e=new Ve(Le(n,t));this.items.set(n,e),queueMicrotask(()=>this.updateValue(n)),n.selectionStart===null&&e.isEager()&&console.warn("Maska: input of `%s` type is not supported",n.type)}}getInputs(e){return typeof e==`string`?Array.from(document.querySelectorAll(e)):`length`in e?Array.from(e):[e]}getOptions(e){let{onMaska:t,preProcess:n,postProcess:r,...i}=e;return i}fixCursor(e,t,n){let r=e.selectionStart,i=e.value;if(n(),r===null||r===i.length&&!t)return;let a=e.value,o=i.slice(0,r),s=a.slice(0,r),c=this.processInput(e,o)?.unmasked,l=this.processInput(e,s)?.unmasked;if(c===void 0||l===void 0)return;let u=r;o!==s&&(u+=t?a.length-i.length:c.length-l.length),e.setSelectionRange(u,u)}setValue(e,t){let n=this.processInput(e,t);n!==void 0&&(e.value=n.masked,this.options.onMaska!=null&&(Array.isArray(this.options.onMaska)?this.options.onMaska.forEach(e=>e(n)):this.options.onMaska(n)),e.dispatchEvent(new CustomEvent(`maska`,{detail:n})),e.dispatchEvent(new CustomEvent(`input`,{detail:n.masked})))}processInput(e,t){let n=this.items.get(e);if(n===void 0)return;let r=t??e.value;this.options.preProcess!=null&&(r=this.options.preProcess(r));let i=n.masked(r);return this.options.postProcess!=null&&(i=this.options.postProcess(i)),{masked:i,unmasked:n.unmasked(r),completed:n.completed(r)}}},He={minimumFractionDigits:2,maximumFractionDigits:2,useGrouping:!0},Ue=new Intl.NumberFormat(`en-US`,He);function M(e,t=`USD`,n=`currency`){return new Intl.NumberFormat(`en-US`,{style:n,currency:t,...He}).format(e)}function We(e){if(!e?.trim())return`—`;let t=e.trim();return t.startsWith(`#`)?t:`#${t}`}var N=(e,t)=>e.querySelector(`input[name="${t}"], select[name="${t}"]`),Ge=(e,t)=>{let n=e.querySelector(`button[type="submit"]`);if(n){n.disabled=t;let e=n.dataset.label??`Pagar`,r=n.dataset.loadingLabel??`Procesando...`;n.textContent=t?r:e}},P=e=>{e.reset();let t=e.querySelector(`select[name="documentType"]`);t&&(t.value=`dui`,t.dispatchEvent(new Event(`change`,{bubbles:!0})))},F=(e,t,n)=>{let r=e.querySelector(`.form-alert`);r&&(r.innerHTML=`<h3>`+t+`</h3><p>`+n+`</p>`,r.classList.remove(`form-alert--receipt`),r.classList.add(`visible`))},I=(e,t)=>{let n=document.querySelector(`.form-header`);if(n){let e=n.querySelector(`.commerce-logo`);e&&(n.innerHTML=``,n.appendChild(e))}let r=document.querySelector(`.divider-header`);r&&(r.style.display=`none`);let i=t.data,a=M(i.amount_cents/100,i.amount_currency),o=`${i.date}, ${i.time}`,s=We(i.reference_number),c=We(i.authorization_number);e.innerHTML=`<div class="payment-success"><p class="payment-success__amount">`+a+`</p><p class="payment-success__datetime">`+o+`</p><div class="payment-success__blocks"><div class="payment-success__block"><span class="payment-success__label">Número de referencia</span><span class="payment-success__value">`+s+`</span></div><div class="payment-success__block"><span class="payment-success__label">Número de autorización</span><span class="payment-success__value">`+c+`</span></div></div><div class="payment-success__footer"><h3 class="payment-success__done">¡Gracias por tu compra!</h3></div></div>`},L=(e,t,n)=>{let r=N(e,t);if(!r)return;let i=r.closest(`.input-wrapper`),a=i?.parentElement?.querySelector(`.field-error`);n?(i&&i.classList.add(`has-error`),a&&(a.textContent=n,a.classList.add(`visible`),Ke(a))):(i&&i.classList.remove(`has-error`),a&&(a.textContent=``,a.classList.remove(`visible`)))},Ke=e=>{e.scrollIntoView({behavior:`smooth`,block:`center`})},qe=e=>{let t=e.find(e=>e.name===`amount`);t&&(t.addEventListener(`input`,function(){let e=t.value.replace(/\\D/g,``);if(e){let n=parseInt(e,10)/100;t.value=Ue.format(n)}else t.value=``}),t.addEventListener(`blur`,()=>{parent.postMessage({type:`payment-form:validate-amount`,amount:t.value},`*`)}))},Je=class e{static instance;states=[];statesLoadError=null;constructor(){}static getInstance(){return e.instance||=new e,e.instance}getStates(){return this.states}setStates(e){this.states=e}getStatesLoadError(){return this.statesLoadError}async fetchStates(e){let t=await T.getInstance().get(`resources/countries/${e}/states`),n=await t.json();return t.ok?(this.statesLoadError=null,this.setStates(n.data),n):(this.statesLoadError=`No se pudo cargar la lista de estados.`,this.setStates([]),n)}},Ye=e=>{let t=e.find(e=>e.name===`documentType`),n=e.find(e=>e.name===`billingDocumentNumber`);if(!t||!n)return;let r=new j(n);t.addEventListener(`change`,function(e){r?.destroy(),e.target.value===`dui`?(n.setAttribute(`inputmode`,`numeric`),n.setAttribute(`data-maska`,`########-#`),r=new j(n)):(n.removeAttribute(`inputmode`),n.removeAttribute(`data-maska`),n.value=``,r=null)})},R=e=>{e.forEach(function(e){e instanceof HTMLInputElement&&(e.addEventListener(`blur`,function(){let t=e.dataset.maskaValue||e.value;parent.postMessage({type:`payment-form:validate`,field:e.name,value:t},`*`)}),e.addEventListener(`input`,function(){let t=e.closest(`.input-wrapper`),n=t?.parentElement?.querySelector(`.field-error`);t&&t.classList.remove(`has-error`),n&&(n.textContent=``,n.classList.remove(`visible`))})),e instanceof HTMLSelectElement&&e.addEventListener(`change`,function(){parent.postMessage({type:`payment-form:validate`,field:e.name,value:e.value},`*`)})})},Xe=(e,t)=>{e.addEventListener(`submit`,function(e){e.preventDefault();let n={};t.forEach(function(e){n[e.name]=e.dataset.maskaValue||e.value}),parent.postMessage({type:`payment-form:submit`,value:n},`*`)})};function z(e=document.body){let t=new ResizeObserver(()=>{let{width:t,height:n}=e.getBoundingClientRect();parent.postMessage({type:`payment-form:sizing`,width:t,height:n},`*`)});return t.observe(e),t}var Ze=T.getInstance();new j(`input[data-maska]:not([name="billingDocumentNumber"])`);var B=document.getElementById(`payment-form`),V=B.querySelectorAll(`input, select`),H=Array.from(V.values());qe(H),Ye(H);var U=H.find(e=>e.name===`country`),W=H.find(e=>e.name===`region`);if(U instanceof HTMLSelectElement){let e=Je.getInstance();U.addEventListener(`change`,async function(){if(U.value===``)return;if(L(B,`region`,``),W instanceof HTMLSelectElement){W.innerHTML=``;let e=document.createElement(`option`);e.value=``,e.textContent=`Cargando...`,W.appendChild(e),W.disabled=!0}let t=await e.fetchStates(U.value);if(W instanceof HTMLSelectElement&&(W.disabled=!1,W.innerHTML=``),`error`in t){let t=e.getStatesLoadError();t&&L(B,`region`,t);return}if(e.setStates(t.data),parent.postMessage({type:`payment-form:states-loaded`,states:t.data},`*`),W instanceof HTMLSelectElement){let e=document.createElement(`option`);e.value=``,e.textContent=`Selecciona aquí`,W.appendChild(e),t.data.forEach(e=>{let t=document.createElement(`option`);t.value=e.id,t.textContent=e.name,W.appendChild(t)})}})}R(H),z(),window.addEventListener(`message`,function(e){if(!(!e.data||!e.data.type))switch(e.data.type){case`payment-form:set-submit-loading`:Ge(B,e.data.disabled);break;case`payment-form:reset`:P(B);break;case`payment-form:alert`:F(B,e.data.title,e.data.message);break;case`payment-form:validation-result`:L(B,e.data.field,e.data.error);break;case`payment-form:success`:I(B,e.data.paymentIntent);break;case`payment-form:set-token`:Ze.setBearerToken(e.data.token);break;default:break}}),Xe(B,H)})();',Bt=`data:image/svg+xml,%3csvg%20width='99'%20height='32'%20viewBox='0%200%2099%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M27.3848%200C29.8942%206.60543e-06%2031.9284%202.03883%2031.9284%204.55384V27.4462C31.9284%2029.9611%2029.8942%2032%2027.3848%2032H4.54376C2.03439%2032%203.69132e-05%2029.9611%200%2027.4462V4.55384C0%202.03882%202.03437%200%204.54376%200H27.3848ZM12.0067%205.0348C11.1292%205.03257%2010.3064%205.37037%209.68349%205.98797C9.0639%206.60335%208.70775%207.46498%208.70775%208.35337V15.4962C8.70775%2016.0154%209.12754%2016.4372%209.64666%2016.4372C10.1647%2016.4372%2010.5856%2016.0165%2010.5856%2015.4962V8.331C10.5856%207.95282%2010.7328%207.59689%2011.0008%207.32948C11.2676%207.06208%2011.6215%206.91564%2011.9978%206.91564H12.0023C12.7781%206.91791%2013.4099%207.56007%2013.4099%208.34774V13.5762C13.4099%2014.5508%2014.1982%2015.3407%2015.1705%2015.3407H18.1221C18.9695%2015.3407%2019.7934%2015.6518%2020.4119%2016.2325C21.0851%2016.8647%2021.4568%2017.7273%2021.4568%2018.647V21.6646C21.4568%2022.5473%2021.1141%2023.3776%2020.4901%2024.003C19.8672%2024.6274%2019.0387%2024.972%2018.1568%2024.972H14.0229C13.1689%2024.972%2012.3315%2024.67%2011.7063%2024.0871C11.0287%2023.4538%2010.6547%2022.5889%2010.6547%2021.6658V20.9799C10.6547%2020.7315%2010.7529%2020.4931%2010.9282%2020.3163L12.5169%2018.7242C12.6922%2018.5485%2012.93%2018.45%2013.1778%2018.45H15.6618C16.0067%2018.4501%2016.3449%2018.5688%2016.6005%2018.8004C16.8941%2019.0655%2017.056%2019.4314%2017.0549%2019.823C17.0527%2020.576%2016.4331%2021.188%2015.6729%2021.188H13.3161C12.7982%2021.188%2012.3774%2021.6087%2012.3774%2022.1289C12.3774%2022.6481%2012.797%2023.0699%2013.3161%2023.0699H15.6896C16.759%2023.0699%2017.755%2022.5518%2018.3813%2021.6355C18.6346%2021.2651%2018.8066%2020.841%2018.8825%2020.398C19.0666%2019.3273%2018.7339%2018.2823%2017.9949%2017.5338C17.3898%2016.9207%2016.5413%2016.5692%2015.6683%2016.5692H13.2045C12.9232%2016.5692%2012.643%2016.605%2012.3729%2016.6867C11.9196%2016.8243%2011.5189%2017.0638%2011.1884%2017.395L9.62652%2018.9614C9.4334%2019.1549%209.26156%2019.372%209.12983%2019.6115C8.89539%2020.0389%208.77596%2020.5021%208.77596%2020.981V21.6669C8.77597%2022.3673%208.91323%2023.0464%209.18337%2023.6864C9.44348%2024.304%209.81749%2024.859%2010.292%2025.3356C10.7664%2025.8112%2011.3202%2026.186%2011.9364%2026.4467C12.575%2026.7174%2013.2526%2026.855%2013.9514%2026.855H18.1546C18.8534%2026.855%2019.5311%2026.7174%2020.1696%2026.4467C20.7859%2026.1849%2021.3396%2025.8112%2021.8141%2025.3356C22.2885%2024.8601%2022.6626%2024.3052%2022.9227%2023.6876C23.1928%2023.0476%2023.3301%2022.3684%2023.3301%2021.668V18.6503C23.3301%2017.9499%2023.1928%2017.2708%2022.9227%2016.6309L22.9259%2016.6274C22.6647%2016.0098%2022.2918%2015.4549%2021.8174%2014.9794C21.3418%2014.5028%2020.7891%2014.1291%2020.1729%2013.8684C19.5343%2013.5976%2018.8567%2013.4598%2018.1579%2013.4598H15.2865V8.331C15.2865%207.46722%2014.9562%206.65034%2014.3545%206.03272C13.7416%205.40167%2012.8852%205.03816%2012.0067%205.0348Z'%20fill='%23121417'/%3e%3cpath%20d='M53.3405%2027.9622C52.2765%2027.9622%2051.291%2027.7244%2050.3858%2027.2507C49.4807%2026.7769%2048.7229%2026.121%2048.1143%2025.2809V25.8218C48.1143%2026.7616%2047.3527%2027.5249%2046.415%2027.5249C45.4773%2027.5249%2044.7157%2026.7616%2044.7157%2025.8218V5.70262C44.7157%204.76283%2045.4773%203.99949%2046.415%203.99949C47.3527%203.99949%2048.1143%204.76283%2048.1143%205.70262V15.6663C48.6789%2014.855%2049.408%2014.2202%2050.3055%2013.7656C51.201%2013.3092%2052.1904%2013.0809%2053.2735%2013.0809C54.6112%2013.0809%2055.8072%2013.4051%2056.8635%2014.0514C57.918%2014.6997%2058.7485%2015.5819%2059.3532%2016.6982C59.9579%2017.8144%2060.2603%2019.0898%2060.2603%2020.5206C60.2603%2021.9514%2059.9503%2023.2422%2059.3321%2024.3642C58.714%2025.4862%2057.8835%2026.3665%2056.8406%2027.0033C55.7995%2027.6419%2054.6322%2027.9603%2053.3405%2027.9603V27.9622ZM52.3722%2025.0489C53.218%2025.0489%2053.9663%2024.8552%2054.6169%2024.4677C55.2676%2024.0803%2055.7766%2023.5471%2056.1459%2022.8682C56.5133%2022.1892%2056.699%2021.4125%2056.699%2020.536C56.699%2019.6595%2056.5095%2018.8789%2056.1325%2018.1903C55.7555%2017.5018%2055.2427%2016.9648%2054.5978%2016.5754C53.951%2016.188%2053.2104%2015.9943%2052.3741%2015.9943C51.5378%2015.9943%2050.7877%2016.188%2050.1294%2016.5754C49.4692%2016.9628%2048.9525%2017.5018%2048.5813%2018.1903C48.2081%2018.8789%2048.0225%2019.6614%2048.0225%2020.536C48.0225%2021.4105%2048.2062%2022.1892%2048.5755%2022.8682C48.9449%2023.5471%2049.4577%2024.0803%2050.1179%2024.4677C50.7781%2024.8552%2051.5302%2025.0489%2052.376%2025.0489H52.3722Z'%20fill='%23121417'/%3e%3cpath%20d='M64.816%2010.647C64.4429%2010.647%2064.1003%2010.553%2063.7865%2010.367C63.4726%2010.1809%2063.2219%209.92969%2063.0363%209.61515C62.8488%209.30061%2062.7569%208.95154%2062.7569%208.56795C62.7569%208.18437%2062.8507%207.85256%2063.0363%207.54186C63.2219%207.23115%2063.4726%206.98374%2063.7865%206.79578C64.1003%206.60974%2064.4429%206.51576%2064.816%206.51576C65.1892%206.51576%2065.5413%206.60974%2065.8456%206.79578C66.1498%206.98374%2066.3967%207.23115%2066.5823%207.54186C66.7679%207.85256%2066.8617%208.19396%2066.8617%208.56795C66.8617%208.94195%2066.7679%209.30061%2066.5823%209.61515C66.3948%209.92969%2066.1498%2010.1809%2065.8456%2010.367C65.5413%2010.5549%2065.1968%2010.647%2064.816%2010.647ZM63.109%2025.8217V15.2213C63.109%2014.2815%2063.8707%2013.5182%2064.8084%2013.5182C65.746%2013.5182%2066.5077%2014.2815%2066.5077%2015.2213V25.8217C66.5077%2026.7615%2065.746%2027.5249%2064.8084%2027.5249C63.8707%2027.5249%2063.109%2026.7615%2063.109%2025.8217Z'%20fill='%23121417'/%3e%3cpath%20d='M70.9719%2025.4033L78.0104%2016.1569H71.7795C71.0523%2016.1569%2070.4629%2015.5662%2070.4629%2014.8374C70.4629%2014.1086%2071.0523%2013.5178%2071.7795%2013.5178H81.1736C82.2644%2013.5178%2082.8825%2014.7702%2082.2204%2015.6391L75.1724%2024.8835H82.1113C82.8385%2024.8835%2083.4279%2025.4743%2083.4279%2026.2031C83.4279%2026.9319%2082.8385%2027.5226%2082.1113%2027.5226H72.0187C70.9279%2027.5226%2070.3098%2026.2702%2070.9719%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3cpath%20d='M86.544%2025.4033L93.5824%2016.1569H87.3516C86.6244%2016.1569%2086.035%2015.5662%2086.035%2014.8374C86.035%2014.1086%2086.6244%2013.5178%2087.3516%2013.5178H96.7457C97.8365%2013.5178%2098.4546%2014.7702%2097.7925%2015.6391L90.7445%2024.8835H97.6834C98.4106%2024.8835%2099%2025.4743%2099%2026.2031C99%2026.9319%2098.4106%2027.5226%2097.6834%2027.5226H87.5908C86.5%2027.5226%2085.8819%2026.2702%2086.544%2025.4014V25.4033Z'%20fill='%23121417'/%3e%3c/svg%3e`;function Vt(e){let t=`<img src="${Bt}" alt="Bizz Logo" class="bizz-logo">`;return Rt.replace(`<!--BIZZ_LOGO-->`,t).replace(`<!--HEADER-->`,e.headerHtml).replace(`<!--AMOUNT_FIELD-->`,e.amountHtml).replace(`<!--FIELDS-->`,e.fieldsHtml).replace(`<!--SUBMIT_BUTTON-->`,e.submitButtonHtml).replace(`<!--SCRIPT-->`,`<script>${zt}<\/script>`)}function Ht(e){let t=document.createElement(`iframe`);return t.style.border=`none`,t.style.display=`block`,t.style.overflow=`hidden`,t.srcdoc=e,t.style.width=`100%`,t.style.height=`100%`,t}var Ut=`<svg
|
|
378
378
|
xmlns="http://www.w3.org/2000/svg"
|
|
379
379
|
width="24"
|
|
380
380
|
height="24"
|