@billgangcom/theme-lib 1.78.3 → 1.78.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/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -1
- package/package.json +1 -1
package/dist/builder.cjs.js
CHANGED
|
@@ -128,4 +128,4 @@
|
|
|
128
128
|
`))+1))}const a="#".repeat(o),u=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
|
|
129
129
|
`,...i.current()});return/^[\t ]/.test(d)&&(d=ir(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),u(),d}Zu.peek=oC;function Zu(e){return e.value||""}function oC(){return"<"}Ju.peek=iC;function Ju(e,t,n,r){const o=No(n),i=o==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(u=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${i}`),d+=c.move(" "+o),d+=c.move(n.safe(e.title,{before:d,after:o,...c.current()})),d+=c.move(o),u()),d+=c.move(")"),a(),d}function iC(){return"!"}el.peek=aC;function el(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const d=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,i(),o==="full"||!d||d!==h?c+=u.move(h+"]"):o==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function aC(){return"!"}tl.peek=uC;function tl(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],u=n.compilePattern(a);let c;if(a.atBreak)for(;c=u.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return o+r+o}function uC(){return"`"}function nl(e,t){const n=mo(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}rl.peek=lC;function rl(e,t,n,r){const o=No(n),i=o==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(nl(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),d+=a.move(" "+o),d+=a.move(n.safe(e.title,{before:d,after:o,...a.current()})),d+=a.move(o),c()),d+=a.move(")"),u(),d}function lC(e,t,n){return nl(e,n)?"<":"["}sl.peek=cC;function sl(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=p,i(),o==="full"||!d||d!==h?c+=u.move(h+"]"):o==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function cC(){return"["}function wo(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function dC(e){const t=wo(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function hC(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ol(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function pC(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?hC(n):wo(n);const u=e.ordered?a==="."?")":".":dC(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ol(n)===a&&p){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,o(),d}function mC(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function fC(e,t,n,r){const o=mC(n);let i=n.bulletCurrent||wo(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(i+" ".repeat(a-i.length)),u.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),p);return c(),d;function p(h,f,m){return f?(m?"":" ".repeat(a))+h:(m?i:i+" ".repeat(a-i.length))+h}}function gC(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),o(),a}const xC=ts(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function EC(e,t,n,r){return(e.children.some(function(a){return xC(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function bC(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}il.peek=IC;function il(e,t,n,r){const o=bC(n),i=n.enter("strong"),a=n.createTracker(r),u=a.move(o+o);let c=a.move(n.containerPhrasing(e,{after:o,before:u,...a.current()}));const d=c.charCodeAt(0),p=Xr(r.before.charCodeAt(r.before.length-1),d,o);p.inside&&(c=ir(d)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Xr(r.after.charCodeAt(0),h,o);f.inside&&(c=c.slice(0,-1)+ir(h));const m=a.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:p.outside},u+c+m}function IC(e,t,n){return n.options.strong||"*"}function TC(e,t,n,r){return n.safe(e.value,r)}function _C(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function CC(e,t,n){const r=(ol(n)+(n.options.ruleSpaces?" ":"")).repeat(_C(n));return n.options.ruleSpaces?r.slice(0,-1):r}const al={blockquote:V_,break:sa,code:Z_,definition:eC,emphasis:Ku,hardBreak:sa,heading:sC,html:Zu,image:Ju,imageReference:el,inlineCode:tl,link:rl,linkReference:sl,list:pC,listItem:fC,paragraph:gC,root:EC,strong:il,text:TC,thematicBreak:CC};function SC(){return{enter:{table:yC,tableData:oa,tableHeader:oa,tableRow:RC},exit:{codeText:AC,table:kC,tableData:Fs,tableHeader:Fs,tableRow:Fs}}}function yC(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function kC(e){this.exit(e),this.data.inTable=void 0}function RC(e){this.enter({type:"tableRow",children:[]},e)}function Fs(e){this.exit(e)}function oa(e){this.enter({type:"tableCell",children:[]},e)}function AC(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,NC));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function NC(e,t){return t==="|"?t:e}function wC(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
130
130
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:c,tableRow:u}};function a(m,x,g,C){return d(p(m,g,C),m.align)}function u(m,x,g,C){const b=h(m,g,C),A=d([b]);return A.slice(0,A.indexOf(`
|
|
131
|
-
`))}function c(m,x,g,C){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(m,{...C,before:i,after:i});return A(),b(),y}function d(m,x){return W_(m,{align:x,alignDelimiters:r,padding:n,stringLength:o})}function p(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("table");for(;++b<C.length;)A[b]=h(C[b],x,g);return y(),A}function h(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<C.length;)A[b]=c(C[b],m,x,g);return y(),A}function f(m,x,g){let C=al.inlineCode(m,x,g);return g.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function LC(){return{exit:{taskListCheckValueChecked:ia,taskListCheckValueUnchecked:ia,paragraph:vC}}}function jC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PC}}}function ia(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function PC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let c=al.listItem(e,t,n,{...r,...u.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function DC(){return[p_(),P_(),M_(),SC(),LC()]}function OC(e){return{extensions:[m_(),D_(e),F_(),wC(e),jC()]}}const BC={tokenize:zC,partial:!0},ul={tokenize:WC,partial:!0},ll={tokenize:qC,partial:!0},cl={tokenize:VC,partial:!0},MC={tokenize:GC,partial:!0},dl={name:"wwwAutolink",tokenize:UC,previous:pl},hl={name:"protocolAutolink",tokenize:$C,previous:ml},Pt={name:"emailAutolink",tokenize:HC,previous:fl},yt={};function FC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,hl];yt[104]=[Pt,hl];yt[87]=[Pt,dl];yt[119]=[Pt,dl];function HC(e,t,n){const r=this;let o,i;return a;function a(h){return!io(h)||!fl.call(r,r.previous)||Lo(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return io(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(MC,p,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),o=!0,c}function p(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function UC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!pl.call(r,r.previous)||Lo(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(BC,e.attempt(ul,e.attempt(ll,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function $C(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&ml.call(r,r.previous)&&!Lo(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?d:(i=!0,c)):n(h)}function d(h){return h===null||Wr(h)||Ie(h)||on(h)||Zr(h)?n(h):e.attempt(ul,e.attempt(ll,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function zC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function WC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(cl,c,u)(d):d===null||Ie(d)||on(d)||d!==45&&Zr(d)?c(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function c(d){return o||r||!i?n(d):t(d)}}function qC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(cl,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function VC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function GC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function pl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function ml(e){return!ze(e)}function fl(e){return!(e===47||io(e))}function io(e){return e===43||e===45||e===46||e===95||Me(e)}function Lo(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YC={tokenize:nS,partial:!0};function XC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JC,continuation:{tokenize:eS},exit:tS}},text:{91:{name:"gfmFootnoteCall",tokenize:ZC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QC,resolveTo:KC}}}}function QC(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const d=pt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function KC(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function ZC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(pt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function JC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(x)}function p(x){if(a>999||x===93&&!u||x===null||x===91||Ie(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=pt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(x)||(u=!0),a++,e.consume(x),x===92?h:p}function h(x){return x===91||x===92||x===93?(e.consume(x),a++,p):p(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),o.includes(i)||o.push(i),fe(e,m,"gfmFootnoteDefinitionWhitespace")):n(x)}function m(x){return t(x)}}function eS(e,t,n){return e.check(hr,t,e.attempt(YC,t,n))}function tS(e){e.exit("gfmFootnoteDefinition")}function nS(e,t,n){const r=this;return fe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function rS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},f=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],m=u.parser.constructs.insideSpan.null;m&&Ke(f,f.length,0,Jr(m,a.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),Ke(a,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,u,c){const d=this.previous,p=this.events;let h=0;return f;function f(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(x):(a.enter("strikethroughSequenceTemporary"),m(x))}function m(x){const g=_n(d);if(x===126)return h>1?c(x):(a.consume(x),h++,m);if(h<2&&!n)return c(x);const C=a.exit("strikethroughSequenceTemporary"),b=_n(x);return C._open=!b||b===2&&!!g,C._close=!g||g===2&&!!b,u(x)}}}class sS{constructor(){this.map=[]}add(t,n,r){oS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function oS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function iS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function aS(){return{flow:{null:{name:"table",tokenize:uS,resolveAll:lS}}}}function uS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const V=r.events[$][1].type;if(V==="lineEnding"||V==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?R:c;return H===R&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),p(w)}function p(w){return w===null?n(w):Q(w)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):n(w):he(w)?fe(e,p,"whitespace")(w):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(w)?(e.exit("data"),p(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function m(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),a=!1,he(w)?fe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):L(w)}function g(w){return he(w)?fe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||Q(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):L(w)}function A(w){return w===45?(e.consume(w),A):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return he(w)?fe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||Q(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function R(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||Q(w)?(e.exit("tableRow"),t(w)):he(w)?fe(e,q,"whitespace")(w):(e.enter("data"),Y(w))}function Y(w){return w===null||w===124||Ie(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:Y)}function K(w){return w===92||w===124?(e.consume(w),Y):Y(w)}}function lS(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const f=new sS;for(;++n<e.length;){const m=e[n],x=m[1];m[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(aa(f,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",p,t]])),o=x.type==="tableDelimiterRow"?2:p?3:1):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],h=Pr(f,t,i,o,n,h)):a[1]!==0&&(h=Pr(f,t,a,o,n,h)),o=0):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&aa(f,t,c,d,p),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=iS(t.events,n))}return e}function Pr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),p=gn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function aa(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cS={name:"tasklistCheck",tokenize:hS};function dS(){return{text:{91:cS}}}function hS(e,t,n){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ie(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Q(c)?t(c):he(c)?e.check({tokenize:pS},t,n)(c):n(c)}}function pS(e,t,n){return fe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function mS(e){return va([FC(),XC(),rS(e),aS(),dS()])}const fS={};function gS(e){const t=this,n=e||fS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(mS(n)),i.push(DC()),a.push(OC(n))}const jo=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(tu,{remarkPlugins:[gS],rehypePlugins:[a_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},xS="_coupon_dkjzv_1",ES="_couponApplied_dkjzv_7",bS="_discount_dkjzv_17",IS="_removeButton_dkjzv_23",TS="_removeButtonText_dkjzv_27",_S="_couponInput_dkjzv_31",CS="_couponInputContainer_dkjzv_37",Mt={coupon:xS,couponApplied:ES,discount:bS,removeButton:IS,removeButtonText:TS,couponInput:_S,couponInputContainer:CS},SS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),i&&await e(i),c(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},yS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),p=k.useMemo(()=>e.parts.map(C=>{const b=t.find(y=>y.id===C.productId),A=b==null?void 0:b.variants.find(y=>y.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:C.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:C.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=p[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),m=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.total-m)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:p.map(C=>s.jsxRuntimeExports.jsx(jo,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(SS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(m),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(cr,{formatter:f,coupon:o,total:i.total,discount:m,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},kS="_checkoutOperational_1gpn5_1",RS="_innerContainer_1gpn5_16",AS="_antistock_1gpn5_25",NS="_paymentMethodsSection_1gpn5_30",wS="_socialConnectSection_1gpn5_36",LS="_socialConnectLabel_1gpn5_39",jS="_socialConnectContent_1gpn5_43",vS="_continueButton_1gpn5_47",PS="_button_1gpn5_51",DS="_checkoutFooter_1gpn5_55",Et={checkoutOperational:kS,innerContainer:RS,antistock:AS,paymentMethodsSection:NS,socialConnectSection:wS,socialConnectLabel:LS,socialConnectContent:jS,continueButton:vS,button:PS,checkoutFooter:DS},OS="_customFields_uhcib_2",BS="_checkboxWrapper_uhcib_9",MS="_textareaWrapper_uhcib_16",FS="_inputWrapper_uhcib_17",HS="_requiredStar_uhcib_27",xn={customFields:OS,checkboxWrapper:BS,textareaWrapper:MS,inputWrapper:FS,requiredStar:HS},US=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx($S,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:xn.customFields,children:n})},$S=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};return s.jsxRuntimeExports.jsx(zS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},zS=({label:e,type:t,defaultValue:n,value:r,placeholder:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:c,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:c})})},WS="_connectedContainer_1rxr8_1",qS="_userInfo_1rxr8_10",VS="_avatar_1rxr8_16",GS="_avatarImage_1rxr8_26",Dr={connectedContainer:WS,userInfo:qS,avatar:VS,avatarImage:GS},YS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,c]=k.useState(0),[d,p]=k.useState(null),h=20,f=g=>{var C,b,A,y;return(b=(C=g==null?void 0:g.response)==null?void 0:C.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},m=(g,C)=>{o([...r,{id:s.v4(),message:g,status:C}])};k.useEffect(()=>{if(d&&i){const g=setInterval(()=>{d.closed&&(clearInterval(g),a(!1),p(null))},1e3);return()=>clearInterval(g)}},[d,i]);const x=()=>{e.trim()!==""&&(a(!0),c(0),uc({customerEmail:e,tsId:s.getTsId()}).then(({data:g})=>{const C=window.open(g.redirectUrl);p(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||C&&C.closed){u>=h&&m("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.discordId,avatar:y.avatar,username:y.username}),C&&C.close(),a(!1),p(null),m("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){m(f(y),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),m(f(g),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Sf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},XS="_paymentMethodsContainer_1pfqr_2",QS="_antistock_1pfqr_15",ua={paymentMethodsContainer:XS,antistock:QS},KS="_bottomSheet_1x8kc_1",ZS="_content_1x8kc_8",JS="_description_1x8kc_11",e3="_title_1x8kc_15",t3="_buttonGroup_1x8kc_19",n3="_buttonWrapper_1x8kc_29",r3="_fullWidthButton_1x8kc_32",s3="_modal_1x8kc_36",o3="_header_1x8kc_43",wt={bottomSheet:KS,content:ZS,description:JS,title:e3,buttonGroup:t3,buttonWrapper:n3,fullWidthButton:r3,modal:s3,header:o3},i3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},gl=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[p,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),m=x=>{x.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:m,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),p&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(i3,{setIsOpen:h,balance:d})})]})},xl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o,isAntistock:i=!1})=>{const[a,u]=k.useState(),[c,d]=k.useState(),{setPriceAdjustment:p}=s.useCartStore(),[h,f]=k.useState(null),m=(x,g)=>{var C;c!==g&&(t(g),p(((C=h==null?void 0:h.find(b=>b.name===g))==null?void 0:C.priceAdjustment)||null)),o(x),u(x),d(g)};return k.useEffect(()=>{if(h&&h.length>0){const x=h[0];if(x.name==="Balance")d(x.name),t(x.name),p(x.priceAdjustment||null);else if(x.paymentMethods&&x.paymentMethods.length>0){const g=x.paymentMethods[0];u(g),d(x.name),t(x.name),o(g),p(x.priceAdjustment||null)}}},[h]),k.useEffect(()=>{const x=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);f(g)};e.availableGateways.length&&x()},[]),k.useLayoutEffect(()=>{p(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h&&s.jsxRuntimeExports.jsx("div",{className:s.clx(ua.paymentMethodsContainer,{[ua.antistock]:i}),children:h==null?void 0:h.map(x=>x.name==="Balance"?s.jsxRuntimeExports.jsx(gl,{gateway:x.name,gatewayDisplayName:x.displayName,onSelect:g=>{d(g),c!==g&&t(g)},selected:x.name===c,total:n.total,onSignInClick:r,reversed:!0},x.name):x.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:x.name,gatewayDisplayName:x.displayName,gatewayLogoCfId:x.logoCfImageId,poweredByLogoCfId:x.poweredByImageCfImageId,onSelect:C=>m(C,x.name),selected:a===g&&c===x.name},`${x.name}-${g}`)))}),!h&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},a3="_modal_14r0b_1",u3={modal:a3},l3=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:u3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},c3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:p,isAntistock:h})=>{const f=k.useMemo(()=>n(),[]),[m,x]=k.useState([]),{balance:g,setBalance:C}=s.useCustomerDashboardStore(),{token:b}=s.useStorefrontStore(),{executeRecaptcha:A}=s.useReCaptcha(),{discordInfo:y}=s.useDiscordStore(),{customerEmail:P,setCustomerEmail:L}=s.useCartStore(),R=y!=null&&y.authorized?y.id:void 0,q=s.useNavigate(),Y=k.useMemo(()=>e(),[r.parts]),[K,w]=k.useState(!1),{setIsOpen:$}=s.useModalStore(),{notifications:B,setNotifications:H}=s.useNotificationStore();k.useEffect(()=>{const W=s.getCommonCustomFields(r.parts,o).map(J=>J.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...J,value:String(J.defaultValue)}:J);x([...W])},[]),k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,o);x(W=>{const J=new Map(W.map(T=>[T.name,T]));return G.map(T=>{const ce=J.get(T.name);return ce&&ce.value?{...T,value:ce.value}:T.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[r.parts,o]),k.useEffect(()=>{b&&(async()=>{const W=await s.getBalance();C(W)})()},[b]);function V(G){return G&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(G)}const z=()=>{const G=[];return m.forEach(W=>{var J;W.required&&!((J=W.value)!=null&&J.toString().trim())&&G.push({message:`Field "${W.name}" is required.`,status:"error",id:s.v4()})}),G.length>0?(H([...B,...G]),!1):!0},Z=async G=>{if(G.stopPropagation(),r.gateway==="Balance"&&!b){$(!0),w(!0);return}if(!z())return;const W=Object.fromEntries(m.map(T=>[T.name,T.value||""]));u({...W}),R&&f.isEnabled&&d(R);const J=await A();if(J){const T=await i(J),ce=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(ce).length>10){const ye=Date.now()-864e5;Object.keys(ce).forEach(S=>{ce[S].createdAt<=ye&&delete ce[S]})}"order"in T?ce[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:ce[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(ce)),q(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Et.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Et.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:Y,setGateway:t,setPaymentMethod:p,balance:g,totalAndDiscount:c,onSignInClick:()=>{w(!0),$(!0)},isAntistock:h}),s.jsxRuntimeExports.jsx("div",{className:s.clx(Et.paymentMethodsSection,{[Et.antistock]:h}),children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:P||"",onChange:G=>L(G),disabled:!!b,label:"Email Address"})}),s.jsxRuntimeExports.jsx(US,{customFields:m,setCustomFields:x}),f.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Et.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Et.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Et.socialConnectContent,children:s.jsxRuntimeExports.jsx(YS,{customerEmail:P||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Et.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:Z,disabled:!r.gateway||!V(P||"")||f.isRequired&&!(y!=null&&y.authorized),className:Et.button,children:"Continue to Checkout"}),!h&&s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Et.checkoutFooter})]}),K&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>w(!1),children:s.jsxRuntimeExports.jsx(l3,{setIsOpen:w})})]})},d3="_mt1_1t7v2_1",h3="_notifyBlock_1t7v2_13",p3="_notifyHeader_1t7v2_19",m3="_notifyContent_1t7v2_25",f3="_buttonBlock_1t7v2_30",g3="_imageBlock_1t7v2_34",x3="_imageContainer_1t7v2_42",E3="_sectionBlock_1t7v2_54",b3="_sectionTitle_1t7v2_61",I3="_sectionSubtitle_1t7v2_64",T3="_inputContainer_1t7v2_69",mt={mt1:d3,notifyBlock:h3,notifyHeader:p3,notifyContent:m3,buttonBlock:f3,imageBlock:g3,imageContainer:x3,sectionBlock:E3,sectionTitle:b3,sectionSubtitle:I3,inputContainer:T3},_3=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:mt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:mt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},C3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:mt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),S3=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:mt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:mt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),y3=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:mt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:mt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:mt.notifyContent,children:e.content})]}),k3=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:mt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:mt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:mt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(El,{block:n},r))]})},El=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(k3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(_3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(y3,{...e});case"Button":return s.jsxRuntimeExports.jsx(C3,{...e});case"Image":return s.jsxRuntimeExports.jsx(S3,{...e});default:return null}},R3="_bottomSheet_1x4sq_1",A3="_content_1x4sq_8",N3="_agreementList_1x4sq_11",w3="_agreementItem_1x4sq_16",L3="_warning_1x4sq_23",j3="_buttonGroup_1x4sq_31",v3="_buttonWrapper_1x4sq_41",P3="_fullWidthButton_1x4sq_44",D3="_modal_1x4sq_48",O3="_header_1x4sq_55",Je={bottomSheet:R3,content:A3,agreementList:N3,agreementItem:w3,warning:L3,buttonGroup:j3,buttonWrapper:v3,fullWidthButton:P3,modal:D3,header:O3},B3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},M3="_chargeItemsContainer_qmv3w_4",F3="_chargeItemsInner_qmv3w_20",H3="_productsContainer_qmv3w_27",U3="_chargeHeader_qmv3w_41",$3="_chargeTitle_qmv3w_49",z3="_chargeDescription_qmv3w_55",W3="_copyButton_qmv3w_61",q3="_productsList_qmv3w_73",V3="_trackingContainer_qmv3w_81",G3="_footerContainer_qmv3w_91",bt={chargeItemsContainer:M3,chargeItemsInner:F3,productsContainer:H3,chargeHeader:U3,chargeTitle:$3,chargeDescription:z3,copyButton:W3,productsList:q3,trackingContainer:V3,footerContainer:G3},Y3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var c,d,p,h,f,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((p=u.productWithVariant)==null?void 0:p.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:bt.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:bt.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(lr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:bt.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:bt.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:bt.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:bt.chargeDescription,id:"md",children:e.description})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:bt.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:bt.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(jo,{product:a},a.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:bt.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:bt.footerContainer})]})]})]})})},X3="_checkoutOrderMainData_hqf60_1",Q3="_orderDetailRow_hqf60_6",K3="_chargeIdRow_hqf60_16",Z3="_detailLabel_hqf60_25",J3="_detailValue_hqf60_29",ey="_chargeIdContainer_hqf60_33",ty="_chargeId_hqf60_16",ny="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:X3,orderDetailRow:Q3,chargeIdRow:K3,detailLabel:Z3,detailValue:J3,chargeIdContainer:ey,chargeId:ty,copyIcon:ny},bl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const p=[r],h=await s.getGatewaysDetail(p);a(h)})()},[r,i]);const c=d=>{const p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=p[d.getMonth()],m=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${m} at ${A}:${g}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},ry="_bottomSheet_1yai1_1",sy="_formContainer_1yai1_8",oy="_error_1yai1_14",iy="_buttonGroup_1yai1_18",ay="_buttonWrapper_1yai1_28",uy="_fullWidthButton_1yai1_31",ly="_modal_1yai1_41",cy="_header_1yai1_48",Ft={bottomSheet:ry,formContainer:sy,error:oy,buttonGroup:iy,buttonWrapper:ay,fullWidthButton:uy,modal:ly,header:cy},dy=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=p=>{try{return new URL(p),!0}catch{return!1}},c=async p=>{if(p.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:p=>p.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:p=>{r(p),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},hy="_container_1opbn_1",py="_productDetails_1opbn_8",my="_imageContainer_1opbn_14",fy="_image_1opbn_14",gy="_textContainer_1opbn_32",xy="_header_1opbn_40",Ey="_title_1opbn_46",by="_price_1opbn_53",Iy="_badgeContainer_1opbn_57",Ty="_description_1opbn_61",It={container:hy,productDetails:py,imageContainer:my,image:fy,textContainer:gy,header:xy,title:Ey,price:by,badgeContainer:Iy,description:Ty},_y=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:It.container,children:[s.jsxRuntimeExports.jsxs("div",{className:It.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:It.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:It.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:It.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:It.header,children:s.jsxRuntimeExports.jsx("h2",{className:It.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:It.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:It.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(tu,{className:It.description,children:e.description})]}),Cy="_card_69liy_1",Sy="_price_69liy_10",yy="_interval_69liy_17",ky="_name_69liy_22",Ry="_description_69liy_28",Ay="_currentPlan_69liy_32",Ny="_selectButton_69liy_45",wy="_progressSection_69liy_50",Ly="_progressLabel_69liy_54",jy="_bottomSheet_69liy_60",vy="_title_69liy_69",Py="_typeSelector_69liy_80",Dy="_typeOption_69liy_90",Oy="_active_69liy_100",By="_saveTag_69liy_108",My="_planSelector_69liy_117",Fy="_modal_69liy_127",Hy="_inactive_69liy_148",Uy="_notMounted_69liy_151",$y="_closeButton_69liy_157",Se={card:Cy,price:Sy,interval:yy,name:ky,description:Ry,currentPlan:Ay,selectButton:Ny,progressSection:wy,progressLabel:Ly,bottomSheet:jy,title:vy,typeSelector:Py,typeOption:Dy,active:Oy,saveTag:By,planSelector:My,modal:Fy,inactive:Hy,notMounted:Uy,closeButton:$y},zy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(fa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Wy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:p}=s.useParams(),[h,f]=k.useState(!1),[m,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&p&&(async()=>{if(d&&p){const{data:R}=await s.getSubscriptionUpgradePlans({id:d,accessToken:p});A(R)}})()},[d,p]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const R=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;R&&(c(R),a(R))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=L=>{o(L),a(null)},P=L=>{a(L),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>y(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(zy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),m&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(Pk,{setIsOpen:x,selectedVariant:i,subscription:n})})]})},qy="_container_nb625_1",Vy="_title_nb625_11",Gy="_subtitle_nb625_16",Yy="_info_nb625_20",Or={container:qy,title:Vy,subtitle:Gy,info:Yy},Xy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Or.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.info,children:[s.jsxRuntimeExports.jsx("p",{className:Or.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Or.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(Zk,{setIsOpen:o})})]})},Qy="_couponContainer_1sspa_1",Ky="_iconWrapper_1sspa_10",Zy="_details_1sspa_21",Jy="_title_1sspa_25",ek="_progress_1sspa_29",tk="_foreverText_1sspa_34",fn={couponContainer:Qy,iconWrapper:Ky,details:Zy,title:Jy,progress:ek,foreverText:tk},nk=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(fa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},rk="_paymentMethodContainer_1g0da_4",sk="_paymentMethodTitle_1g0da_15",ok="_activeMethod_1g0da_20",ik="_noMethod_1g0da_28",ak="_activeMethodPaymentMethod_1g0da_37",uk="_paymentMethodLogo_1g0da_47",lk="_paymentMethodNumber_1g0da_57",ck="_method_1g0da_61",Wt={paymentMethodContainer:rk,paymentMethodTitle:sk,activeMethod:ok,noMethod:ik,activeMethodPaymentMethod:ak,paymentMethodLogo:uk,paymentMethodNumber:lk,method:ck},dk="_paymentMethods_1gev0_1",hk="_modal_1gev0_14",pk="_header_1gev0_28",mk="_content_1gev0_37",Jt={paymentMethods:dk,modal:hk,header:pk,content:mk},fk=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:p,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function m(){if(x(),t(!0),i&&r){const{data:g}=await s.changeSubscriptionGateway(i,h.gateway);g.isReconnectPaymentNeeded?a(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:p,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>m(),children:"Continue"})})]})]})]})},gk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",xk=()=>{var x,g,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:p}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),m=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);i(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(Ek,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(gl,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=o.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=o.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:m===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),p(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(fk,{setIsLoading:u,setIsOpen:d})})]})},Ek=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:gk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},bk="_subscriptionProductContainer_83ibx_4",Ik="_subscriptionProductImage_83ibx_15",Tk="_subscriptionProductInfo_83ibx_32",_k="_name_83ibx_37",Ck="_price_83ibx_40",qn={subscriptionProductContainer:bk,subscriptionProductImage:Ik,subscriptionProductInfo:Tk,name:_k,price:Ck},Sk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:qn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:qn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:qn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},yk="_content_5ctxw_1",kk="_selectedPlan_5ctxw_37",Rk="_planName_5ctxw_44",Ak="_description_5ctxw_48",Nk="_price_5ctxw_51",wk="_buttonGroup_5ctxw_79",Lk="_buttonWrapper_5ctxw_84",jk="_modal_5ctxw_88",vk="_header_5ctxw_95",lt={content:yk,selectedPlan:kk,planName:Rk,description:Ak,price:Nk,buttonGroup:wk,buttonWrapper:Lk,modal:jk,header:vk},Pk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},Dk="_reviewMessage_1t8u4_1",Ok="_leaveReviewContainer_1t8u4_11",Bk="_leaveReviewTitle_1t8u4_20",Hs={reviewMessage:Dk,leaveReviewContainer:Ok,leaveReviewTitle:Bk},Mk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),p=async h=>{e&&"accessToken"in e&&(await ic({comment:h,rating:r,tsId:s.getTsId()},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:Hs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(Hs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:Hs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Of,{rating:r,setRating:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Vk,{setIsOpen:a,onSubmit:p})})]}):null},Fk="_bottomSheet_1bcyj_1",Hk="_content_1bcyj_7",Uk="_title_1bcyj_18",$k="_buttonGroup_1bcyj_22",zk="_buttonWrapper_1bcyj_33",Wk="_modal_1bcyj_37",qk="_header_1bcyj_44",Ht={bottomSheet:Fk,content:Hk,title:Uk,buttonGroup:$k,buttonWrapper:zk,modal:Wk,header:qk},Vk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Gk="_container_1idhv_1",Yk="_buttonGroup_1idhv_8",Xk="_buttonWrapper_1idhv_15",Qk="_header_1idhv_19",Kk="_content_1idhv_28",en={container:Gk,buttonGroup:Yk,buttonWrapper:Xk,header:Qk,content:Kk},Zk=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:p}=s.useNotificationStore(),[h,f]=k.useState(!1),m=k.useMemo(()=>n(),[o,r]),x=k.useMemo(()=>m.totalWithDiscount?m.total-m.totalWithDiscount:0,[m]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...p,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Yf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(cr,{formatter:C,coupon:o,total:m.total,discount:x,totalWithDiscount:m.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},Jk="_bottomSheet_uw5jb_1",eR="_content_uw5jb_7",tR="_radioGroup_uw5jb_11",nR="_confirmation_uw5jb_26",rR="_iconWrapper_uw5jb_33",sR="_title_uw5jb_42",oR="_message_uw5jb_48",iR="_buttonGroup_uw5jb_54",aR="_buttonWrapper_uw5jb_64",uR="_modal_uw5jb_68",lR="_header_uw5jb_77",je={bottomSheet:Jk,content:eR,radioGroup:tR,confirmation:nR,iconWrapper:rR,title:sR,message:oR,buttonGroup:iR,buttonWrapper:aR,modal:uR,header:lR},cR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},dR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[c,d]=k.useState(""),[p,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),m=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?p:c});u(!1),g&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:cR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:p,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&i(1),disabled:!c,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:m,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},hR="_checkoutContainer_wkomn_1",pR="_loaderContainer_wkomn_20",Us={checkoutContainer:hR,loaderContainer:pR},Il=()=>{const{isAntistock:e}=s.useGeneralStore(),{cart:t,products:n,pending:r,getTotalAndDiscount:o,getPossibleGateways:i,submitCart:a,setGateway:u,applyCoupon:c,setDiscordSocialConnectId:d,setCustomFields:p,applyCouponPending:h,coupon:f,removeCoupon:m,getDiscordSettings:x,setPaymentMethod:g,reset:C}=s.useCart(),b=k.useMemo(()=>o(),[f,t]),A=s.useNavigate();return k.useEffect(()=>{if(t.parts.length===0)try{A(-1)}catch{A("/")}},[t.parts]),r?s.jsxRuntimeExports.jsx("div",{className:Us.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Us.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Us.checkoutContainer,children:[s.jsxRuntimeExports.jsx(yS,{cart:t,products:n,applyCoupon:c,applyCouponPending:h,coupon:f,removeCoupon:m,totalAndDiscount:b}),s.jsxRuntimeExports.jsx(c3,{cart:t,getPossibleGateways:i,setGateway:u,getDiscordSettings:x,products:n,submitCart:a,totalAndDiscount:b,setCustomFieldsToCart:p,setDiscordSocialConnectId:d,setPaymentMethod:g,reset:C,isAntistock:e})]})},mR="_chargePageContainer_1a200_1",fR="_chargeItems_1a200_14",gR="_mainContent_1a200_25",xR="_contentWrapper_1a200_36",ER="_statusBlock_1a200_41",bR="_notPaidSection_1a200_45",IR="_footer_1a200_53",TR="_loaderContainer_1a200_63",Ut={chargePageContainer:mR,chargeItems:fR,mainContent:gR,contentWrapper:xR,statusBlock:ER,notPaidSection:bR,footer:IR,loaderContainer:TR},_R=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),p=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||o(!0);const{data:C}=await ac(x);o(!1),a(C)},m=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(m)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const m=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!p.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.status)===s.ChargeStatus.Paid&&p.current&&d(p.current,{replace:!0}),m&&p&&(p.current=m,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Y3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(bl,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,m)=>s.jsxRuntimeExports.jsx(El,{block:f},m))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(B3,{price:i.price,setIsOpen:c})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dy,{setIsOpen:c,chargeId:i.id})})]})},CR="_wrapper_o0iab_1",SR="_title_o0iab_23",yR="_container_o0iab_30",kR="_content_o0iab_41",RR="_messages_o0iab_52",AR="_input_o0iab_70",NR="_textarea_o0iab_83",wR="_message_o0iab_52",LR="_messageDate_o0iab_125",jR="_myMessage_o0iab_131",vR="_otherMessage_o0iab_138",PR="_button_o0iab_145",DR="_loadingMessage_o0iab_166",$e={wrapper:CR,title:SR,container:yR,content:kR,messages:RR,input:AR,textarea:NR,message:wR,messageDate:LR,myMessage:jR,otherMessage:vR,button:PR,loadingMessage:DR},OR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,c]=k.useState(""),[d,p]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);a(g),o(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const m=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),p(C.id),c("");try{await s.sendTicketMessage(n,t,u,g,s.getTsId()),await f()}finally{setTimeout(()=>{p(null)},1e4)}},x=g=>{const C=new Date,b=new Date(g),A=Math.floor((C.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((g,C)=>new Date(g.createdAt).getTime()-new Date(C.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),m())}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:m,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},BR="_subscriptionContainer_1j6ol_1",MR="_leftSection_1j6ol_15",FR="_content_1j6ol_26",HR="_mainContent_1j6ol_33",UR="_detailsSection_1j6ol_37",$R="_buttonGroup_1j6ol_50",zR="_detailsContent_1j6ol_57",tn={subscriptionContainer:BR,leftSection:MR,content:FR,mainContent:HR,detailsSection:UR,buttonGroup:$R,detailsContent:zR},WR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:p}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();p(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(_y,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(nk,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Sk,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(xk,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Xy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Wy,{isOpen:i,setIsOpen:a,subscription:n})]})},qR="_topUpContainer_1pag6_1",VR="_formWrapper_1pag6_15",GR="_header_1pag6_29",YR="_footer_1pag6_82",XR="_wrapper_1pag6_105",Vn={topUpContainer:qR,formWrapper:VR,header:GR,footer:YR,wrapper:XR},QR=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Vn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Vn.header}),s.jsxRuntimeExports.jsx("div",{className:Vn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Vn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Vn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},KR="_orderPage_1nvve_1",ZR="_leftSection_1nvve_15",JR="_content_1nvve_35",eA="_main_1nvve_42",tA="_statusBlock_1nvve_54",nA="_timelineBlock_1nvve_58",rA="_footer_1nvve_62",sA="_rightSection_1nvve_71",oA="_header_1nvve_84",iA="_productList_1nvve_92",aA="_mobileFooter_1nvve_99",uA="_loaderContainer_1nvve_108",lA="_orderMainData_1nvve_116",cA="_prices_1nvve_123",dA="_headerTitle_1nvve_127",hA="_headerDescription_1nvve_131",De={orderPage:KR,leftSection:ZR,content:JR,main:eA,statusBlock:tA,timelineBlock:nA,footer:rA,rightSection:sA,header:oA,productList:iA,mobileFooter:aA,loaderContainer:uA,orderMainData:lA,prices:cA,headerTitle:dA,headerDescription:hA},pA=()=>{var h,f,m;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),p=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,C,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((C=x.productWithVariant)==null?void 0:C.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(C,b=!1)=>{b||a(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),o(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(bl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Mk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:p.map(x=>s.jsxRuntimeExports.jsx(jo,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((m=r==null?void 0:r.charge)==null?void 0:m.price.amount)||0,className:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},mA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},fA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},gA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[],shopLogo:u,apiURLs:c,isAntistock:d=!1}=e,[p,h]=k.useState(null),{general:f,setIsAntistock:m}=s.useGeneralStore(),{setApiUrls:x}=s.useApiStore(),{setBlocks:g,setSourceBlocks:C,setHeader:b,setFooter:A,setAnnouncement:y,setSettings:P}=s.useBlocksStore(),{setHeader:L,setFooter:R,setAnnouncement:q}=s.useLayersStore(),{themeSettings:Y}=s.useThemeSettingsStore(),{settings:K,setSettings:w}=s.useSettingsStore(),$=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,B=localStorage.getItem("shopPassword"),H=localStorage.getItem("shopId")||"";return k.useEffect(()=>{m(d)},[d,m]),k.useEffect(()=>{H||localStorage.setItem("shopId",(f==null?void 0:f.info.id)||"")},[f]),k.useEffect(()=>{if(Y&&K){const V=hc(Y,K);Ec(Y),pc(V)}},[Y,K,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(ae=>{V[ae]=t[ae]}),C(V),g(V),b(r),A(o),y(i),P(n),c&&x(c);const z=new r,Z=JSON.parse(JSON.stringify(z));L(Z,!1);const G=new o,W=JSON.parse(JSON.stringify(G));R(W,!1);const J=new i,T=JSON.parse(JSON.stringify(J));q(T,!1);const ce=new n,ye=JSON.parse(JSON.stringify(ce));w(ye);const S=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(rf,{shopDomain:$,shopId:H,shopPassword:B||void 0,shopLogo:u,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(Zm,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(Jm,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hm,{children:s.jsxRuntimeExports.jsx(Pm,{blocks:t,settings:n,header:r,footer:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fm,{})},...a,{path:"/checkout",element:s.jsxRuntimeExports.jsx(Il,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(QR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(_R,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(pA,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(WR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xm,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(OR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);h(S)},[f]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:p})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useCart=s.useCart;exports.useReCaptcha=s.useReCaptcha;exports.App=gA;exports.Checkout=Il;exports.ColorVariables=la;exports.hotReload=bc;exports.iconNames=_l;exports.removeNotification=mA;exports.showNotification=fA;exports.useBuilderPages=Tc;exports.useCreateTicket=Ic;
|
|
131
|
+
`))}function c(m,x,g,C){const b=g.enter("tableCell"),A=g.enter("phrasing"),y=g.containerPhrasing(m,{...C,before:i,after:i});return A(),b(),y}function d(m,x){return W_(m,{align:x,alignDelimiters:r,padding:n,stringLength:o})}function p(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("table");for(;++b<C.length;)A[b]=h(C[b],x,g);return y(),A}function h(m,x,g){const C=m.children;let b=-1;const A=[],y=x.enter("tableRow");for(;++b<C.length;)A[b]=c(C[b],m,x,g);return y(),A}function f(m,x,g){let C=al.inlineCode(m,x,g);return g.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function LC(){return{exit:{taskListCheckValueChecked:ia,taskListCheckValueUnchecked:ia,paragraph:vC}}}function jC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PC}}}function ia(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vC(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const u=o[i];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function PC(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);i&&u.move(a);let c=al.listItem(e,t,n,{...r,...u.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function DC(){return[p_(),P_(),M_(),SC(),LC()]}function OC(e){return{extensions:[m_(),D_(e),F_(),wC(e),jC()]}}const BC={tokenize:zC,partial:!0},ul={tokenize:WC,partial:!0},ll={tokenize:qC,partial:!0},cl={tokenize:VC,partial:!0},MC={tokenize:GC,partial:!0},dl={name:"wwwAutolink",tokenize:UC,previous:pl},hl={name:"protocolAutolink",tokenize:$C,previous:ml},Pt={name:"emailAutolink",tokenize:HC,previous:fl},yt={};function FC(){return{text:yt}}let Zt=48;for(;Zt<123;)yt[Zt]=Pt,Zt++,Zt===58?Zt=65:Zt===91&&(Zt=97);yt[43]=Pt;yt[45]=Pt;yt[46]=Pt;yt[95]=Pt;yt[72]=[Pt,hl];yt[104]=[Pt,hl];yt[87]=[Pt,dl];yt[119]=[Pt,dl];function HC(e,t,n){const r=this;let o,i;return a;function a(h){return!io(h)||!fl.call(r,r.previous)||Lo(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return io(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(MC,p,d)(h):h===45||h===95||Me(h)?(i=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),o=!0,c}function p(h){return i&&o&&ze(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function UC(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!pl.call(r,r.previous)||Lo(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(BC,e.attempt(ul,e.attempt(ll,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function $C(e,t,n){const r=this;let o="",i=!1;return a;function a(h){return(h===72||h===104)&&ml.call(r,r.previous)&&!Lo(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ze(h)&&o.length<5)return o+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const f=o.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),i?d:(i=!0,c)):n(h)}function d(h){return h===null||Wr(h)||Ie(h)||on(h)||Zr(h)?n(h):e.attempt(ul,e.attempt(ll,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function zC(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function WC(e,t,n){let r,o,i;return a;function a(d){return d===46||d===95?e.check(cl,c,u)(d):d===null||Ie(d)||on(d)||d!==45&&Zr(d)?c(d):(i=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(o=r,r=void 0),e.consume(d),a}function c(d){return o||r||!i?n(d):t(d)}}function qC(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(cl,t,i)(a):a===null||Ie(a)||on(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function VC(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),i):u===93?(e.consume(u),o):u===60||u===null||Ie(u)||on(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Ie(u)||on(u)?t(u):r(u)}function i(u){return ze(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ze(u)?(e.consume(u),a):n(u)}}function GC(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Me(i)?n(i):t(i)}}function pl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ie(e)}function ml(e){return!ze(e)}function fl(e){return!(e===47||io(e))}function io(e){return e===43||e===45||e===46||e===95||Me(e)}function Lo(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YC={tokenize:nS,partial:!0};function XC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JC,continuation:{tokenize:eS},exit:tS}},text:{91:{name:"gfmFootnoteCall",tokenize:ZC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QC,resolveTo:KC}}}}function QC(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const c=r.events[o][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const d=pt(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function KC(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function ZC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Ie(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return o.includes(pt(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ie(h)||(a=!0),i++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),i++,d):d(h)}}function JC(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,u;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(x)}function p(x){if(a>999||x===93&&!u||x===null||x===91||Ie(x))return n(x);if(x===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=pt(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ie(x)||(u=!0),a++,e.consume(x),x===92?h:p}function h(x){return x===91||x===92||x===93?(e.consume(x),a++,p):p(x)}function f(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),o.includes(i)||o.push(i),fe(e,m,"gfmFootnoteDefinitionWhitespace")):n(x)}function m(x){return t(x)}}function eS(e,t,n){return e.check(hr,t,e.attempt(YC,t,n))}function tS(e){e.exit("gfmFootnoteDefinition")}function nS(e,t,n){const r=this;return fe(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function rS(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},f=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],m=u.parser.constructs.insideSpan.null;m&&Ke(f,f.length,0,Jr(m,a.slice(d+1,c),u)),Ke(f,f.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),Ke(a,d-1,c-d+3,f),c=d+f.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,u,c){const d=this.previous,p=this.events;let h=0;return f;function f(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(x):(a.enter("strikethroughSequenceTemporary"),m(x))}function m(x){const g=_n(d);if(x===126)return h>1?c(x):(a.consume(x),h++,m);if(h<2&&!n)return c(x);const C=a.exit("strikethroughSequenceTemporary"),b=_n(x);return C._open=!b||b===2&&!!g,C._close=!g||g===2&&!!b,u(x)}}}class sS{constructor(){this.map=[]}add(t,n,r){oS(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function oS(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function iS(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function aS(){return{flow:{null:{name:"table",tokenize:uS,resolveAll:lS}}}}function uS(e,t,n){const r=this;let o=0,i=0,a;return u;function u(w){let $=r.events.length-1;for(;$>-1;){const V=r.events[$][1].type;if(V==="lineEnding"||V==="linePrefix")$--;else break}const B=$>-1?r.events[$][1].type:null,H=B==="tableHead"||B==="tableRow"?R:c;return H===R&&r.parser.lazy[r.now().line]?n(w):H(w)}function c(w){return e.enter("tableHead"),e.enter("tableRow"),d(w)}function d(w){return w===124||(a=!0,i+=1),p(w)}function p(w){return w===null?n(w):Q(w)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):n(w):he(w)?fe(e,p,"whitespace")(w):(i+=1,a&&(a=!1,o+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(w)))}function h(w){return w===null||w===124||Ie(w)?(e.exit("data"),p(w)):(e.consume(w),w===92?f:h)}function f(w){return w===92||w===124?(e.consume(w),h):h(w)}function m(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),a=!1,he(w)?fe(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?C(w):w===124?(a=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),g):L(w)}function g(w){return he(w)?fe(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(i+=1,b(w)):w===null||Q(w)?P(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),A(w)):L(w)}function A(w){return w===45?(e.consume(w),A):w===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(w))}function y(w){return he(w)?fe(e,P,"whitespace")(w):P(w)}function P(w){return w===124?x(w):w===null||Q(w)?!a||o!==i?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function R(w){return e.enter("tableRow"),q(w)}function q(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),q):w===null||Q(w)?(e.exit("tableRow"),t(w)):he(w)?fe(e,q,"whitespace")(w):(e.enter("data"),Y(w))}function Y(w){return w===null||w===124||Ie(w)?(e.exit("data"),q(w)):(e.consume(w),w===92?K:Y)}function K(w){return w===92||w===124?(e.consume(w),Y):Y(w)}}function lS(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const f=new sS;for(;++n<e.length;){const m=e[n],x=m[1];m[0]==="enter"?x.type==="tableHead"?(u=!1,c!==0&&(aa(f,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",d,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},f.add(n,0,[["enter",p,t]])),o=x.type==="tableDelimiterRow"?2:p?3:1):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h),i=[0,0,0,0]),a[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Pr(f,t,i,o,void 0,h)),i=a,a=[i[1],n,0,0])):x.type==="tableHead"?(u=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],h=Pr(f,t,i,o,n,h)):a[1]!==0&&(h=Pr(f,t,a,o,n,h)),o=0):o&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&aa(f,t,c,d,p),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=iS(t.events,n))}return e}function Pr(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(i.end=Object.assign({},gn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=gn(t.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const d=gn(t.events,n[2]),p=gn(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,g=n[3]-n[2]-1;e.add(x,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return o!==void 0&&(i.end=Object.assign({},gn(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function aa(e,t,n,r,o){const i=[],a=gn(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function gn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cS={name:"tasklistCheck",tokenize:hS};function dS(){return{text:{91:cS}}}function hS(e,t,n){const r=this;return o;function o(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ie(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Q(c)?t(c):he(c)?e.check({tokenize:pS},t,n)(c):n(c)}}function pS(e,t,n){return fe(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function mS(e){return va([FC(),XC(),rS(e),aS(),dS()])}const fS={};function gS(e){const t=this,n=e||fS,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(mS(n)),i.push(DC()),a.push(OC(n))}const jo=({isOrder:e,product:t})=>{var i;const{shopGeneral:n}=s.useStorefrontStore(),r=t.subscriptionSettings,{cart:o}=s.useCart();return console.log(t.description),s.jsxRuntimeExports.jsxs("div",{className:`${Ne.checkoutProduct} ${e?Ne.isOrder:""}`,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:`${Ne.productImage} ${e?Ne.isOrderImage:""}`,children:t!=null&&t.image?s.jsxRuntimeExports.jsx("img",{className:Ne.image,src:s.convertCfImageIdToUrl(t.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image",fill:"var(--text-secondary)"})}),s.jsxRuntimeExports.jsx("div",{className:Ne.productInfo,children:s.jsxRuntimeExports.jsxs("div",{className:Ne.productHeader,children:[s.jsxRuntimeExports.jsx("h2",{className:Ne.productName,id:"h5",children:t.name}),s.jsxRuntimeExports.jsxs("span",{className:Ne.quantityBadge,id:"md",children:[t.price.quantity,"x"]})]})}),t.chargeType==="RECURRING"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:r&&`${s.formatPrice(r.price)} / ${s.normalizeInterval(r.recurringIntervalDays||0)}${r.entryFee?" + "+s.formatPrice(r.entryFee):""}`}),t.chargeType==="ONE_TIME"&&s.jsxRuntimeExports.jsx("p",{className:Ne.productPrice,id:"md",children:t.variantsGateways&&o.gateway&&t.variantsGateways.some(a=>a.name===o.gateway&&a.overrodePrice)?s.formatPrice(((i=t.variantsGateways.find(a=>a.name===o.gateway))==null?void 0:i.overrodePrice)||t.price):s.formatPrice(t.price)})]}),t.description&&s.jsxRuntimeExports.jsx("p",{className:Ne.productDescription,children:s.jsxRuntimeExports.jsx(tu,{remarkPlugins:[gS],rehypePlugins:[a_],components:{a:({node:a,...u})=>s.jsxRuntimeExports.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer",className:Ne.link})},children:t.description})}),t.deliveryCategories&&s.jsxRuntimeExports.jsx("div",{className:Ne.deliveryCategories,children:t.deliveryCategories.map(a=>s.jsxRuntimeExports.jsx(s.DeliveryItem,{deliveryConfiguration:a},a.id))}),t.customerNote&&s.jsxRuntimeExports.jsxs("div",{className:Ne.customerNote,children:[s.jsxRuntimeExports.jsxs("div",{className:Ne.noteHeader,children:[(n==null?void 0:n.info.logo)&&s.jsxRuntimeExports.jsx("div",{className:Ne.logoContainer,children:s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(n==null?void 0:n.info.logo.cfId)})}),s.jsxRuntimeExports.jsx("p",{className:Ne.shopName,id:"md",children:n==null?void 0:n.info.name})]}),s.jsxRuntimeExports.jsx("p",{className:Ne.noteContent,id:"md",children:t.customerNote})]})]})},xS="_coupon_dkjzv_1",ES="_couponApplied_dkjzv_7",bS="_discount_dkjzv_17",IS="_removeButton_dkjzv_23",TS="_removeButtonText_dkjzv_27",_S="_couponInput_dkjzv_31",CS="_couponInputContainer_dkjzv_37",Mt={coupon:xS,couponApplied:ES,discount:bS,removeButton:IS,removeButtonText:TS,couponInput:_S,couponInputContainer:CS},SS=({applyCoupon:e,couponData:t,discount:n,removeCoupon:r,gateway:o})=>{const[i,a]=k.useState(null),[u,c]=k.useState(!1);return s.jsxRuntimeExports.jsxs("div",{className:Mt.coupon,children:[u&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:500,height:48,viewBox:"0 0 500 48",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:Mt.skeleton,children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"48"})}),!u&&(t?s.jsxRuntimeExports.jsxs("div",{className:Mt.couponApplied,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"}),s.jsxRuntimeExports.jsxs("p",{id:"md",children:[i," is applied"," ",s.jsxRuntimeExports.jsxs("span",{className:Mt.discount,children:["-",n," ",!t.isFixed&&`(${t.discount}%)`]})]}),s.jsxRuntimeExports.jsx("button",{className:Mt.removeButton,onClick:r,children:s.jsxRuntimeExports.jsx("span",{className:Mt.removeButtonText,children:"Remove"})})]}):s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInput,children:[s.jsxRuntimeExports.jsxs("div",{className:Mt.couponInputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"Enter a discount code",value:i||"",onChange:d=>{a(d===""?null:d)}}),s.jsxRuntimeExports.jsx(s.Button$1,{onClick:async()=>{c(!0),i&&await e(i),c(!1)},disabled:!o||!i,type:"Primary",children:"Apply"})]}),!o&&s.jsxRuntimeExports.jsx(s.Tip,{type:"warning",message:"The discount is related to the method of payment. Select to enter.",id:"md"})]}))]})},yS=({cart:e,products:t,applyCoupon:n,applyCouponPending:r,coupon:o,totalAndDiscount:i,removeCoupon:a})=>{var g;const{priceAdjusment:u}=s.useCartStore(),[c,d]=k.useState(!1),p=k.useMemo(()=>e.parts.map(C=>{const b=t.find(y=>y.id===C.productId),A=b==null?void 0:b.variants.find(y=>y.id===C.productVariantId);return C.chargeType==="RECURRING"&&d(!0),{id:(b==null?void 0:b.id)||0,image:b==null?void 0:b.images[0],name:(A==null?void 0:A.name)||"",description:(A==null?void 0:A.description)||"",price:{quantity:C.quantity,amount:(A==null?void 0:A.price.amount)||0,currency:A==null?void 0:A.price.currency},subscriptionSettings:A==null?void 0:A.subscriptionSettings,chargeType:C.chargeType,variantsGateways:A==null?void 0:A.gateways}}),[e,t]),h=((g=p[0])==null?void 0:g.price.currency)||"USD",f=new Intl.NumberFormat("en-US",{style:"currency",currency:h}),m=k.useMemo(()=>o&&!o.isFixed&&o.discount===100?i.total:i.totalWithDiscount?i.total-i.totalWithDiscount:0,[i,o]),x=u?(u==null?void 0:u.fixedAmount)+Math.round((i.totalWithDiscount!==void 0?i.totalWithDiscount:i.total-m)*((u==null?void 0:u.percentage)/100)):null;return s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:Kt.innerContainer,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:Kt.headerSection,children:[s.jsxRuntimeExports.jsx("header",{className:Kt.header,children:s.jsxRuntimeExports.jsx("h1",{id:"h3",children:"Checkout"})}),s.jsxRuntimeExports.jsx("div",{className:Kt.productsContainer,children:p.map(C=>s.jsxRuntimeExports.jsx(jo,{product:C},C.id))}),s.jsxRuntimeExports.jsx("div",{className:Kt.couponContainer,children:s.jsxRuntimeExports.jsx(SS,{applyCoupon:n,applyCouponPending:r,couponData:o,discount:f.format(m),removeCoupon:a,gateway:e.gateway})}),s.jsxRuntimeExports.jsx(cr,{formatter:f,coupon:o,total:i.total,discount:m,totalWithDiscount:i.totalWithDiscount,feeOrDiscount:c?null:x})]}),s.jsxRuntimeExports.jsx("div",{className:Kt.checkoutFooter,children:s.jsxRuntimeExports.jsx(vt,{})})]})})},kS="_checkoutOperational_1gpn5_1",RS="_innerContainer_1gpn5_16",AS="_antistock_1gpn5_25",NS="_paymentMethodsSection_1gpn5_30",wS="_socialConnectSection_1gpn5_36",LS="_socialConnectLabel_1gpn5_39",jS="_socialConnectContent_1gpn5_43",vS="_continueButton_1gpn5_47",PS="_button_1gpn5_51",DS="_checkoutFooter_1gpn5_55",Et={checkoutOperational:kS,innerContainer:RS,antistock:AS,paymentMethodsSection:NS,socialConnectSection:wS,socialConnectLabel:LS,socialConnectContent:jS,continueButton:vS,button:PS,checkoutFooter:DS},OS="_customFields_uhcib_2",BS="_checkboxWrapper_uhcib_9",MS="_textareaWrapper_uhcib_16",FS="_inputWrapper_uhcib_17",HS="_requiredStar_uhcib_27",xn={customFields:OS,checkboxWrapper:BS,textareaWrapper:MS,inputWrapper:FS,requiredStar:HS},US=({customFields:e,setCustomFields:t})=>{if(e.length===0)return null;const n=e.map(r=>s.jsxRuntimeExports.jsx($S,{customField:r,setCustomFields:t},r.name));return s.jsxRuntimeExports.jsx("div",{className:xn.customFields,children:n})},$S=({customField:e,setCustomFields:t})=>{const n=r=>{t(o=>o.map(i=>i.name===e.name?{...i,value:r}:i))};return s.jsxRuntimeExports.jsx(zS,{value:e.value??"",placeholder:e.placeholder,required:e.required,defaultValue:e.defaultValue,type:e.type,onValueChange:n,label:e.name,regex:e.regex})},zS=({label:e,type:t,defaultValue:n,value:r,placeholder:o,regex:i,required:a,onValueChange:u})=>{if(k.useEffect(()=>{r===""&&n!==void 0&&u(String(n))},[]),t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox)return s.jsxRuntimeExports.jsxs("label",{className:xn.checkboxWrapper,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:r==="true",onChange:d=>u(d?"true":"false")}),s.jsxRuntimeExports.jsxs("p",{className:xn.checkboxLabel,children:[e,a&&s.jsxRuntimeExports.jsx("span",{className:xn.requiredStar,children:"*"})]})]});if(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Hidden)return s.jsxRuntimeExports.jsx("input",{type:"hidden",value:String(n??""),required:a});const c=d=>{(t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?/^\d*$/:i?new RegExp(i):/.*/).test(d)&&u(d)};return t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Textarea?s.jsxRuntimeExports.jsx("div",{className:xn.textareaWrapper,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{label:e,value:r,placeholder:o,onChange:c,required:a})}):s.jsxRuntimeExports.jsx("div",{className:xn.inputWrapper,children:s.jsxRuntimeExports.jsx(s.Input$1,{type:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"number":"text",placeholder:t===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Number?"Type something number...":o,label:e,value:r,required:a,onChange:c})})},WS="_connectedContainer_1rxr8_1",qS="_userInfo_1rxr8_10",VS="_avatar_1rxr8_16",GS="_avatarImage_1rxr8_26",Dr={connectedContainer:WS,userInfo:qS,avatar:VS,avatarImage:GS},YS=({customerEmail:e})=>{const{discordInfo:t,setDiscordInfo:n}=s.useDiscordStore(),{notifications:r,setNotifications:o}=s.useNotificationStore(),[i,a]=k.useState(!1),[u,c]=k.useState(0),[d,p]=k.useState(null),h=20,f=g=>{var C,b,A,y;return(b=(C=g==null?void 0:g.response)==null?void 0:C.data)!=null&&b.error?g.response.data.error:(y=(A=g==null?void 0:g.response)==null?void 0:A.data)!=null&&y.message?g.response.data.message:g!=null&&g.message?g.message:"Failed to connect to Discord. Please try again later."},m=(g,C)=>{o([...r,{id:s.v4(),message:g,status:C}])};k.useEffect(()=>{if(d&&i){const g=setInterval(()=>{d.closed&&(clearInterval(g),a(!1),p(null))},1e3);return()=>clearInterval(g)}},[d,i]);const x=()=>{e.trim()!==""&&(a(!0),c(0),uc({customerEmail:e,tsId:s.getTsId()}).then(({data:g})=>{const C=window.open(g.redirectUrl);p(C),(!C||C.closed||typeof C.closed>"u")&&setTimeout(()=>{const y=document.createElement("a");y.href=g.redirectUrl,y.target="_blank",y.click()});let b;const A=()=>{if(c(y=>y+1),u>=h||C&&C.closed){u>=h&&m("Authorization timeout. Please try again.","error"),a(!1),clearTimeout(b);return}lc({id:g.id,customerEmail:e}).then(({data:y})=>{n({authorized:!0,id:y.id,avatar:y.avatar,username:y.username}),C&&C.close(),a(!1),p(null),m("Discord successfully connected!","success"),clearTimeout(b)}).catch(y=>{var P;if(console.log("Waiting for authorization...",y,{newWindow:C}),C&&C.closed){a(!1),clearTimeout(b);return}if((P=y==null?void 0:y.response)!=null&&P.status&&y.response.status!==404&&y.response.status>=400){m(f(y),"error"),a(!1),clearTimeout(b);return}clearTimeout(b),b=setTimeout(A,1500)})};A()}).catch(g=>{console.log("Could not initiate Discord authorization",g),m(f(g),"error"),a(!1)}))};return t!=null&&t.authorized?s.jsxRuntimeExports.jsxs("div",{className:Dr.connectedContainer,children:[s.jsxRuntimeExports.jsxs("div",{className:Dr.userInfo,children:[s.jsxRuntimeExports.jsx("div",{className:Dr.avatar,children:t.avatar?s.jsxRuntimeExports.jsx("img",{className:Dr.avatarImage,src:`https://cdn.discordapp.com/avatars/${t.id}/${t.avatar}.png?size=256`}):s.jsxRuntimeExports.jsx(s.Icon,{name:"UserCircle"})}),s.jsxRuntimeExports.jsx("p",{children:t.username}),s.jsxRuntimeExports.jsx(Sf,{})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Reconnect"})]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px"},disabled:i,children:i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"DiscordLogo"}),s.jsxRuntimeExports.jsx(s.StableText,{children:"Connect Your Discord"})]})})},XS="_paymentMethodsContainer_1pfqr_2",QS="_antistock_1pfqr_15",ua={paymentMethodsContainer:XS,antistock:QS},KS="_bottomSheet_1x8kc_1",ZS="_content_1x8kc_8",JS="_description_1x8kc_11",e3="_title_1x8kc_15",t3="_buttonGroup_1x8kc_19",n3="_buttonWrapper_1x8kc_29",r3="_fullWidthButton_1x8kc_32",s3="_modal_1x8kc_36",o3="_header_1x8kc_43",wt={bottomSheet:KS,content:ZS,description:JS,title:e3,buttonGroup:t3,buttonWrapper:n3,fullWidthButton:r3,modal:s3,header:o3},i3=({setIsOpen:e,balance:t})=>{const n=s.useNavigate(),{setIsOpen:r}=s.useModalStore(),o=()=>{n("/top-up?redirectRoute=checkout")};function i(){r(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:wt.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:wt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:wt.title,children:"Insufficient Customer Balance"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:wt.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:wt.content,children:s.jsxRuntimeExports.jsxs("p",{className:wt.description,children:["You currently have ",t&&s.formatPrice(t)," in your balance. After topping up the required amount, you can continue to checkout."]})}),s.jsxRuntimeExports.jsxs("div",{className:wt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:wt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:wt.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:o,children:"Add Balance"})})]})]})]})},gl=({align:e,gateway:t,gatewayDisplayName:n,selected:r,onSelect:o,total:i,onSignInClick:a,reversed:u})=>{const{token:c}=s.useStorefrontStore(),{balance:d}=s.useCustomerDashboardStore(),[p,h]=k.useState(!1),{setIsOpen:f}=s.useModalStore(),m=x=>{x.stopPropagation(),o&&o(t),d&&d.amount<i&&(h(!0),f(!0))};return k.useEffect(()=>{},[d,i]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.clx(s.styles$3.paymentMethod,{[s.styles$3.selected]:r,[s.styles$3.alignColumn]:e==="column",[s.styles$3.reversed]:u}),onClick:m,children:[s.jsxRuntimeExports.jsxs("p",{className:s.styles$3.paymentText,id:"md",children:[n," ",s.jsxRuntimeExports.jsxs("span",{className:s.styles$3.balanceText,id:"md",children:["(",c?d&&s.formatPrice(d):s.jsxRuntimeExports.jsx("a",{className:s.styles$3.signInLink,onClick:a,id:"md",children:"Sign in"}),")"]})]}),s.jsxRuntimeExports.jsx("div",{className:s.styles$3.iconContainer,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Wallet",fill:"var(--text-primary)",width:20,height:20})})]}),p&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>h(!1),children:s.jsxRuntimeExports.jsx(i3,{setIsOpen:h,balance:d})})]})},xl=({possibleGateways:e,setGateway:t,totalAndDiscount:n,onSignInClick:r,setPaymentMethod:o,isAntistock:i=!1})=>{const[a,u]=k.useState(),[c,d]=k.useState(),{setPriceAdjustment:p}=s.useCartStore(),[h,f]=k.useState(null),m=(x,g)=>{var C;c!==g&&(t(g),p(((C=h==null?void 0:h.find(b=>b.name===g))==null?void 0:C.priceAdjustment)||null)),o(x),u(x),d(g)};return k.useEffect(()=>{if(h&&h.length>0){const x=h[0];if(x.name==="Balance")d(x.name),t(x.name),p(x.priceAdjustment||null);else if(x.paymentMethods&&x.paymentMethods.length>0){const g=x.paymentMethods[0];u(g),d(x.name),t(x.name),o(g),p(x.priceAdjustment||null)}}},[h]),k.useEffect(()=>{const x=async()=>{const{data:g}=await s.fetchGatewaysDetail([...e.availableGateways,...e.requiresSignInGateways]);f(g)};e.availableGateways.length&&x()},[]),k.useLayoutEffect(()=>{p(null)},[]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h&&s.jsxRuntimeExports.jsx("div",{className:s.clx(ua.paymentMethodsContainer,{[ua.antistock]:i}),children:h==null?void 0:h.map(x=>x.name==="Balance"?s.jsxRuntimeExports.jsx(gl,{gateway:x.name,gatewayDisplayName:x.displayName,onSelect:g=>{d(g),c!==g&&t(g)},selected:x.name===c,total:n.total,onSignInClick:r,reversed:!0},x.name):x.paymentMethods.map(g=>s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{paymentMethod:g,gateway:x.name,gatewayDisplayName:x.displayName,gatewayLogoCfId:x.logoCfImageId,poweredByLogoCfId:x.poweredByImageCfImageId,onSelect:C=>m(C,x.name),selected:a===g&&c===x.name},`${x.name}-${g}`)))}),!h&&s.jsxRuntimeExports.jsx(s.ContentLoader,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:s.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})})]})},a3="_modal_14r0b_1",u3={modal:a3},l3=({setIsOpen:e})=>{const{token:t}=s.useStorefrontStore(),{setIsOpen:n}=s.useModalStore();k.useEffect(()=>{t&&r()},[t]);const r=()=>{n(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsx("div",{className:u3.modal,onClick:o=>o.stopPropagation(),children:s.jsxRuntimeExports.jsx(s.Auth,{inModal:!0})})},c3=({getPossibleGateways:e,setGateway:t,getDiscordSettings:n,cart:r,products:o,submitCart:i,reset:a,setCustomFieldsToCart:u,totalAndDiscount:c,setDiscordSocialConnectId:d,setPaymentMethod:p,isAntistock:h})=>{const f=k.useMemo(()=>n(),[]),[m,x]=k.useState([]),{balance:g,setBalance:C}=s.useCustomerDashboardStore(),{token:b}=s.useStorefrontStore(),{executeRecaptcha:A}=s.useReCaptcha(),{discordInfo:y}=s.useDiscordStore(),{customerEmail:P,setCustomerEmail:L}=s.useCartStore(),R=y!=null&&y.authorized?y.id:void 0,q=s.useNavigate(),Y=k.useMemo(()=>e(),[r.parts]),[K,w]=k.useState(!1),{setIsOpen:$}=s.useModalStore(),{notifications:B,setNotifications:H}=s.useNotificationStore();k.useEffect(()=>{const W=s.getCommonCustomFields(r.parts,o).map(J=>J.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...J,value:String(J.defaultValue)}:J);x([...W])},[]),k.useEffect(()=>{const G=s.getCommonCustomFields(r.parts,o);x(W=>{const J=new Map(W.map(T=>[T.name,T]));return G.map(T=>{const ce=J.get(T.name);return ce&&ce.value?{...T,value:ce.value}:T.type===s.PRODUCT_VARIANT_EXTRA_FIELD_TYPE.Checkbox?{...T,value:String(T.defaultValue)}:T})})},[r.parts,o]),k.useEffect(()=>{b&&(async()=>{const W=await s.getBalance();C(W)})()},[b]);function V(G){return G&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(G)}const z=()=>{const G=[];return m.forEach(W=>{var J;W.required&&!((J=W.value)!=null&&J.toString().trim())&&G.push({message:`Field "${W.name}" is required.`,status:"error",id:s.v4()})}),G.length>0?(H([...B,...G]),!1):!0},Z=async G=>{if(G.stopPropagation(),r.gateway==="Balance"&&!b){$(!0),w(!0);return}if(!z())return;const W=Object.fromEntries(m.map(T=>[T.name,T.value||""]));u({...W}),R&&f.isEnabled&&d(R);const J=await A();if(J){const T=await i(J),ce=JSON.parse(localStorage.getItem("orders")||"{}");if(Object.keys(ce).length>10){const ye=Date.now()-864e5;Object.keys(ce).forEach(S=>{ce[S].createdAt<=ye&&delete ce[S]})}"order"in T?ce[T.order.id]={createdAt:Date.now(),fullAccessToken:T.order.fullAccessToken}:ce[T.id]={createdAt:Date.now(),fullAccessToken:T.fullAccessToken},localStorage.setItem("orders",JSON.stringify(ce)),q(`/orders/${"order"in T?T.order.id:T.id}/${"order"in T?T.order.fullAccessToken:T.fullAccessToken}`),setTimeout(()=>a(),0)}};return s.jsxRuntimeExports.jsxs("div",{className:Et.checkoutOperational,children:[s.jsxRuntimeExports.jsxs("div",{className:Et.innerContainer,children:[r.parts.length>0&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:Y,setGateway:t,setPaymentMethod:p,balance:g,totalAndDiscount:c,onSignInClick:()=>{w(!0),$(!0)},isAntistock:h}),s.jsxRuntimeExports.jsx("div",{className:s.clx(Et.paymentMethodsSection,{[Et.antistock]:h}),children:s.jsxRuntimeExports.jsx(s.Input$1,{placeholder:"mail@mail.com",value:P||"",onChange:G=>L(G),disabled:!!b,label:"Email Address"})}),s.jsxRuntimeExports.jsx(US,{customFields:m,setCustomFields:x}),f.isEnabled&&s.jsxRuntimeExports.jsxs("div",{className:Et.socialConnectSection,children:[s.jsxRuntimeExports.jsx("p",{className:Et.socialConnectLabel,id:"md",children:"Social Connect"}),s.jsxRuntimeExports.jsx("div",{className:Et.socialConnectContent,children:s.jsxRuntimeExports.jsx(YS,{customerEmail:P||""})})]}),s.jsxRuntimeExports.jsxs("div",{className:Et.continueButton,children:[s.jsxRuntimeExports.jsx(s.Button$1,{onClick:Z,disabled:!r.gateway||!V(P||"")||f.isRequired&&!(y!=null&&y.authorized),className:Et.button,children:"Continue to Checkout"}),!h&&s.jsxRuntimeExports.jsx(s.TermsOfService,{}),s.jsxRuntimeExports.jsx(s.SecuredBySsl,{})]}),s.jsxRuntimeExports.jsx(vt,{className:Et.checkoutFooter})]}),K&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>w(!1),children:s.jsxRuntimeExports.jsx(l3,{setIsOpen:w})})]})},d3="_mt1_1t7v2_1",h3="_notifyBlock_1t7v2_13",p3="_notifyHeader_1t7v2_19",m3="_notifyContent_1t7v2_25",f3="_buttonBlock_1t7v2_30",g3="_imageBlock_1t7v2_34",x3="_imageContainer_1t7v2_42",E3="_sectionBlock_1t7v2_54",b3="_sectionTitle_1t7v2_61",I3="_sectionSubtitle_1t7v2_64",T3="_inputContainer_1t7v2_69",mt={mt1:d3,notifyBlock:h3,notifyHeader:p3,notifyContent:m3,buttonBlock:f3,imageBlock:g3,imageContainer:x3,sectionBlock:E3,sectionTitle:b3,sectionSubtitle:I3,inputContainer:T3},_3=({props:e})=>{const t=s.useCopy();return s.jsxRuntimeExports.jsx("div",{className:mt.mt1,children:s.jsxRuntimeExports.jsxs("div",{className:mt.inputContainer,children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:e.text,disabled:!0,onChange:()=>{}}),e.shownCopyButton&&s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>t(e.text),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})})},C3=({props:e})=>s.jsxRuntimeExports.jsx(s.Button$1,{className:mt.buttonBlock,onClick:()=>window.open(e.url,"_blank","noopener"),children:e.text}),S3=({props:e})=>s.jsxRuntimeExports.jsx("div",{className:mt.imageBlock,children:s.jsxRuntimeExports.jsx("div",{className:mt.imageContainer,children:s.jsxRuntimeExports.jsx("img",{src:e.src,alt:""})})}),y3=({props:e})=>s.jsxRuntimeExports.jsxs("div",{className:mt.notifyBlock,children:[s.jsxRuntimeExports.jsxs("div",{className:mt.notifyHeader,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Info",width:24,height:24,fill:"var(--text-secondary)"}),s.jsxRuntimeExports.jsx("p",{children:e.heading})]}),s.jsxRuntimeExports.jsx("p",{className:mt.notifyContent,children:e.content})]}),k3=({props:e})=>{var t;return s.jsxRuntimeExports.jsxs("div",{className:mt.sectionBlock,children:[s.jsxRuntimeExports.jsx("p",{className:mt.sectionTitle,children:e.title}),s.jsxRuntimeExports.jsx("span",{className:mt.sectionSubtitle,children:e.subTitle}),(t=e.children)==null?void 0:t.map((n,r)=>s.jsxRuntimeExports.jsx(El,{block:n},r))]})},El=({block:e})=>{switch(e.type){case"Section":return s.jsxRuntimeExports.jsx(k3,{...e});case"ReadOnlyTextInput":return s.jsxRuntimeExports.jsx(_3,{...e});case"Notify":return s.jsxRuntimeExports.jsx(y3,{...e});case"Button":return s.jsxRuntimeExports.jsx(C3,{...e});case"Image":return s.jsxRuntimeExports.jsx(S3,{...e});default:return null}},R3="_bottomSheet_1x4sq_1",A3="_content_1x4sq_8",N3="_agreementList_1x4sq_11",w3="_agreementItem_1x4sq_16",L3="_warning_1x4sq_23",j3="_buttonGroup_1x4sq_31",v3="_buttonWrapper_1x4sq_41",P3="_fullWidthButton_1x4sq_44",D3="_modal_1x4sq_48",O3="_header_1x4sq_55",Je={bottomSheet:R3,content:A3,agreementList:N3,agreementItem:w3,warning:L3,buttonGroup:j3,buttonWrapper:v3,fullWidthButton:P3,modal:D3,header:O3},B3=({setIsOpen:e,price:t})=>{const[n,r]=k.useState({agreeToSendAsFF:!1,agreeToSend:!1,agreeToNotAddNote:!1}),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Je.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Note"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.content,children:[s.jsxRuntimeExports.jsxs("div",{className:Je.agreementList,children:[s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSendAsFF,onChange:a=>r({...n,agreeToSendAsFF:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to send the payment as friends & family"})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToSend,onChange:a=>r({...n,agreeToSend:a})}),s.jsxRuntimeExports.jsxs("p",{children:["I agree to send the payment of ",s.formatPrice(t)," ",t.currency]})]}),s.jsxRuntimeExports.jsxs("label",{className:Je.agreementItem,children:[s.jsxRuntimeExports.jsx(s.Checkbox,{value:n.agreeToNotAddNote,onChange:a=>r({...n,agreeToNotAddNote:a})}),s.jsxRuntimeExports.jsx("p",{children:"I agree to not add a note to this payment"})]})]}),s.jsxRuntimeExports.jsx("div",{className:Je.warning,children:s.jsxRuntimeExports.jsxs("p",{children:["Please note that you are required to send the exact payment of ",s.formatPrice(t)," ",t.currency,". If you were to send any amount over or below, your funds will be lost."]})})]}),s.jsxRuntimeExports.jsxs("div",{className:Je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",children:s.jsxRuntimeExports.jsx("span",{className:"text-[var(--text-secondary)]",children:"Cancel"})})}),s.jsxRuntimeExports.jsx("div",{className:Je.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!(n.agreeToSendAsFF&&n.agreeToNotAddNote&&n.agreeToSend),onClick:i,children:"Continue to Payment"})})]})]})]})},M3="_chargeItemsContainer_qmv3w_4",F3="_chargeItemsInner_qmv3w_20",H3="_productsContainer_qmv3w_27",U3="_chargeHeader_qmv3w_41",$3="_chargeTitle_qmv3w_49",z3="_chargeDescription_qmv3w_55",W3="_copyButton_qmv3w_61",q3="_productsList_qmv3w_73",V3="_trackingContainer_qmv3w_81",G3="_footerContainer_qmv3w_91",bt={chargeItemsContainer:M3,chargeItemsInner:F3,productsContainer:H3,chargeHeader:U3,chargeTitle:$3,chargeDescription:z3,copyButton:W3,productsList:q3,trackingContainer:V3,footerContainer:G3},Y3=({charge:e})=>{var i;const t=s.useCopy(),n=(e==null?void 0:e.price.currency)||"USD",r=new Intl.NumberFormat("en-US",{style:"currency",currency:n}),o=k.useMemo(()=>{var a;return((a=e==null?void 0:e.order)==null?void 0:a.partOrders.map(u=>{var c,d,p,h,f,m;return{id:(u==null?void 0:u.id)||0,image:u.productWithVariant.image,name:((c=u.productWithVariant)==null?void 0:c.variantName)||"",description:((d=u.productWithVariant)==null?void 0:d.description)||"",price:{quantity:u.quantity,amount:((p=u.productWithVariant)==null?void 0:p.price.amount)||0,currency:(h=u.productWithVariant)==null?void 0:h.price.currency},subscriptionSettings:(f=e.order)!=null&&f.subscriptionOrderId?(m=u.productWithVariant)==null?void 0:m.subscriptionSettings:null}}))||[]},[e]);return s.jsxRuntimeExports.jsx("div",{className:bt.chargeItemsContainer,children:s.jsxRuntimeExports.jsxs("div",{className:bt.chargeItemsInner,children:[s.jsxRuntimeExports.jsx(lr,{expiresAt:e==null?void 0:e.expiresAt}),s.jsxRuntimeExports.jsxs("div",{className:bt.productsContainer,children:[(e==null?void 0:e.name)&&s.jsxRuntimeExports.jsxs("header",{className:bt.chargeHeader,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:bt.chargeTitle,id:"h5",children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:bt.chargeDescription,id:"md",children:e.description})]}),((i=e.order)==null?void 0:i.id)&&s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",className:bt.copyButton,onClick:()=>{var a;return t(((a=e.order)==null?void 0:a.id)||"")},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),"Copy Order ID"]})]}),s.jsxRuntimeExports.jsxs("div",{style:{flex:1},children:[!!o.length&&s.jsxRuntimeExports.jsx("div",{className:bt.productsList,children:o.map(a=>s.jsxRuntimeExports.jsx(jo,{product:a},a.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:r,coupon:null,total:(e==null?void 0:e.price.amount)||0,discount:0,totalWithDiscount:(e==null?void 0:e.price.amount)||0,isShowSubtotal:!1})]}),s.jsxRuntimeExports.jsxs("div",{children:[e&&s.jsxRuntimeExports.jsx("div",{className:bt.trackingContainer,children:s.jsxRuntimeExports.jsx(s.TrackPayment,{timeline:e.timeline})}),s.jsxRuntimeExports.jsx(vt,{className:bt.footerContainer})]})]})]})})},X3="_checkoutOrderMainData_hqf60_1",Q3="_orderDetailRow_hqf60_6",K3="_chargeIdRow_hqf60_16",Z3="_detailLabel_hqf60_25",J3="_detailValue_hqf60_29",ey="_chargeIdContainer_hqf60_33",ty="_chargeId_hqf60_16",ny="_copyIcon_hqf60_51",Ue={checkoutOrderMainData:X3,orderDetailRow:Q3,chargeIdRow:K3,detailLabel:Z3,detailValue:J3,chargeIdContainer:ey,chargeId:ty,copyIcon:ny},bl=({lastUpdate:e,invoiceId:t,email:n,paymentType:r})=>{const o=s.useCopy(),[i,a]=k.useState(null),u=i==null?void 0:i.find(d=>d.name===r);k.useEffect(()=>{i||(async()=>{const p=[r],h=await s.getGatewaysDetail(p);a(h)})()},[r,i]);const c=d=>{const p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=d.getDate().toString().padStart(2,"0"),f=p[d.getMonth()],m=d.getFullYear(),x=d.getHours(),g=d.getMinutes().toString().padStart(2,"0"),C=d.getSeconds().toString().padStart(2,"0"),b=x>=12?"PM":"AM",A=(x%12||12).toString().padStart(2,"0");return`${f} ${h}, ${m} at ${A}:${g}:${C} ${b}`};return s.jsxRuntimeExports.jsxs("div",{className:Ue.checkoutOrderMainData,children:[s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Last Updated"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:c(new Date(e))})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Payment Type"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:u==null?void 0:u.displayName})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.orderDetailRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Email"}),s.jsxRuntimeExports.jsx("p",{className:Ue.detailValue,id:"md",children:n})]}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdRow,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.detailLabel,id:"md",children:"Charge ID"}),s.jsxRuntimeExports.jsxs("div",{className:Ue.chargeIdContainer,children:[s.jsxRuntimeExports.jsx("p",{className:Ue.chargeId,id:"md",children:t}),s.jsxRuntimeExports.jsx("div",{className:Ue.copyIcon,onClick:()=>o(t),children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"})})]})]})]})},ry="_bottomSheet_1yai1_1",sy="_formContainer_1yai1_8",oy="_error_1yai1_14",iy="_buttonGroup_1yai1_18",ay="_buttonWrapper_1yai1_28",uy="_fullWidthButton_1yai1_31",ly="_modal_1yai1_41",cy="_header_1yai1_48",Ft={bottomSheet:ry,formContainer:sy,error:oy,buttonGroup:iy,buttonWrapper:ay,fullWidthButton:uy,modal:ly,header:cy},dy=({chargeId:e,setIsOpen:t})=>{const[n,r]=k.useState(""),[o,i]=k.useState(""),{setIsOpen:a}=s.useModalStore(),u=p=>{try{return new URL(p),!0}catch{return!1}},c=async p=>{if(p.preventDefault(),!n){i("The link field cannot be empty.");return}if(!u(n)){i("Please enter a valid URL");return}await nc({url:n},e)&&(alert("CashApp successfully verified"),t(!1))},d=()=>{a(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ft.modal,onClick:p=>p.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ft.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"CashApp Verify"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:d,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsx("form",{onSubmit:c,children:s.jsxRuntimeExports.jsxs("div",{className:Ft.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.formContainer,children:s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx(s.Input$1,{value:n,onChange:p=>{r(p),i("")},label:"Enter Cashapp Link",placeholder:"https://cash.app/payments/0000"}),o&&s.jsxRuntimeExports.jsx("p",{className:Ft.error,children:o})]})}),s.jsxRuntimeExports.jsxs("div",{className:Ft.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ft.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:d,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ft.fullWidthButton,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",children:"Verify"})})]})]})})]})},hy="_container_1opbn_1",py="_productDetails_1opbn_8",my="_imageContainer_1opbn_14",fy="_image_1opbn_14",gy="_textContainer_1opbn_32",xy="_header_1opbn_40",Ey="_title_1opbn_46",by="_price_1opbn_53",Iy="_badgeContainer_1opbn_57",Ty="_description_1opbn_61",It={container:hy,productDetails:py,imageContainer:my,image:fy,textContainer:gy,header:xy,title:Ey,price:by,badgeContainer:Iy,description:Ty},_y=({subscription:e})=>s.jsxRuntimeExports.jsxs("div",{className:It.container,children:[s.jsxRuntimeExports.jsxs("div",{className:It.productDetails,children:[s.jsxRuntimeExports.jsx("div",{className:It.imageContainer,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{className:It.image,src:s.convertCfImageIdToUrl(e.image.cfId),alt:e==null?void 0:e.name}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:It.textContainer,children:[s.jsxRuntimeExports.jsx("div",{className:It.header,children:s.jsxRuntimeExports.jsx("h2",{className:It.title,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:It.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx("div",{className:It.badgeContainer,children:s.jsxRuntimeExports.jsx(s.SubscriptionStatusBadge,{status:e.status})})]}),e.description&&s.jsxRuntimeExports.jsx(tu,{className:It.description,children:e.description})]}),Cy="_card_69liy_1",Sy="_price_69liy_10",yy="_interval_69liy_17",ky="_name_69liy_22",Ry="_description_69liy_28",Ay="_currentPlan_69liy_32",Ny="_selectButton_69liy_45",wy="_progressSection_69liy_50",Ly="_progressLabel_69liy_54",jy="_bottomSheet_69liy_60",vy="_title_69liy_69",Py="_typeSelector_69liy_80",Dy="_typeOption_69liy_90",Oy="_active_69liy_100",By="_saveTag_69liy_108",My="_planSelector_69liy_117",Fy="_modal_69liy_127",Hy="_inactive_69liy_148",Uy="_notMounted_69liy_151",$y="_closeButton_69liy_157",Se={card:Cy,price:Sy,interval:yy,name:ky,description:Ry,currentPlan:Ay,selectButton:Ny,progressSection:wy,progressLabel:Ly,bottomSheet:jy,title:vy,typeSelector:Py,typeOption:Dy,active:Oy,saveTag:By,planSelector:My,modal:Fy,inactive:Hy,notMounted:Uy,closeButton:$y},zy=({variant:e,onSelect:t,isCurrent:n})=>{const r=e.subscriptionSettings.recurringIntervalDays===30?"month":e.subscriptionSettings.recurringIntervalDays===365?"year":"period",o=e.subscriptionSettings.price.amount.toFixed(2),i=e.subscriptionSettings.recurringIntervalDays,a=10;return s.jsxRuntimeExports.jsxs("div",{className:Se.card,onClick:t,children:[s.jsxRuntimeExports.jsxs("h2",{className:Se.price,children:["$",o," ",s.jsxRuntimeExports.jsxs("span",{className:Se.interval,children:["/ ",r]})]}),s.jsxRuntimeExports.jsx("h3",{className:Se.name,children:e.name}),e.description&&s.jsxRuntimeExports.jsx("p",{className:Se.description,children:e.description}),n?s.jsxRuntimeExports.jsxs("div",{className:Se.currentPlan,children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Check"}),"Your current Plan"]}):s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",className:Se.selectButton,children:"Select"}),n&&s.jsxRuntimeExports.jsxs("div",{className:Se.progressSection,children:[s.jsxRuntimeExports.jsx(fa,{percent:a/i*100,disablePercentLabel:!0}),s.jsxRuntimeExports.jsxs("p",{className:Se.progressLabel,children:["Used: ",a," of ",i," days"]})]})]})},Wy=({isOpen:e,setIsOpen:t,subscription:n})=>{const[r,o]=k.useState(null),[i,a]=k.useState(null),[u,c]=k.useState(null),{id:d,accessToken:p}=s.useParams(),[h,f]=k.useState(!1),[m,x]=k.useState(!1),{setIsOpen:g}=s.useModalStore();k.useEffect(()=>{e&&f(!0)},[e]);const C=()=>{t(!1)},[b,A]=k.useState(null);k.useEffect(()=>{d&&p&&(async()=>{if(d&&p){const{data:R}=await s.getSubscriptionUpgradePlans({id:d,accessToken:p});A(R)}})()},[d,p]),k.useEffect(()=>{var L;if(b!=null&&b.data.types[0]){const R=(L=b.data.types.flatMap(q=>q.productVariants).find(q=>q.data.id===(n==null?void 0:n.variantId)))==null?void 0:L.data;R&&(c(R),a(R))}},[b,n]),k.useEffect(()=>{b!=null&&b.data.types[0]&&o(b==null?void 0:b.data.types[0])},[b==null?void 0:b.data.types]);const y=L=>{o(L),a(null)},P=L=>{a(L),g(!0),x(!0)};return s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.modal,{[Se.active]:e,[Se.inactive]:!e&&h,[Se.notMounted]:!h}),onClick:L=>L.stopPropagation(),children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:C,hoverable:!0,className:Se.closeButton,fill:"var(--text-primary)"}),s.jsxRuntimeExports.jsxs("div",{className:Se.bottomSheet,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Se.title,children:"Change Plan"}),s.jsxRuntimeExports.jsx("p",{className:Se.description,children:b==null?void 0:b.data.description}),s.jsxRuntimeExports.jsx("div",{className:Se.typeSelector,children:b==null?void 0:b.data.types.map(L=>s.jsxRuntimeExports.jsxs("div",{className:s.clx(Se.typeOption,{[Se.active]:(r==null?void 0:r.id)===L.id}),onClick:()=>y(L),children:[L.name,L.name==="Yearly"&&s.jsxRuntimeExports.jsx("span",{className:Se.saveTag,children:"Save %"})]},L.id))}),r&&s.jsxRuntimeExports.jsx("div",{className:Se.planSelector,children:r.productVariants.map(L=>s.jsxRuntimeExports.jsx(zy,{variant:L.data,isSelected:(i==null?void 0:i.id)===L.data.id,isCurrent:(u==null?void 0:u.id)===L.data.id,onSelect:()=>P(L.data)},L.data.id))})]}),m&&i&&n&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>{x(!1)},children:s.jsxRuntimeExports.jsx(Pk,{setIsOpen:x,selectedVariant:i,subscription:n})})]})},qy="_container_nb625_1",Vy="_title_nb625_11",Gy="_subtitle_nb625_16",Yy="_info_nb625_20",Or={container:qy,title:Vy,subtitle:Gy,info:Yy},Xy=()=>{const{subscription:e}=s.useSubscriptionStore(),[t,n]=s.extractDateAndTime((e==null?void 0:e.activeTo)||""),[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Or.container,children:[s.jsxRuntimeExports.jsxs("div",{className:Or.info,children:[s.jsxRuntimeExports.jsx("p",{className:Or.title,children:"Expiration Date"}),s.jsxRuntimeExports.jsxs("p",{className:Or.subtitle,children:[t," at ",n]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.stopPropagation(),i(!0),o(!0)},children:"Extend"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(Zk,{setIsOpen:o})})]})},Qy="_couponContainer_1sspa_1",Ky="_iconWrapper_1sspa_10",Zy="_details_1sspa_21",Jy="_title_1sspa_25",ek="_progress_1sspa_29",tk="_foreverText_1sspa_34",fn={couponContainer:Qy,iconWrapper:Ky,details:Zy,title:Jy,progress:ek,foreverText:tk},nk=({coupon:e,currency:t})=>{const n=e.isFixed?s.formatPrice({amount:e.discount,currency:t}):`${e.discount}%`,r=e.initialCouponDurationForSubscriptions?s.percentageDifference(e.initialCouponDurationForSubscriptions,e.currentCouponDurationForSubscriptions||1):100;return s.jsxRuntimeExports.jsxs("div",{className:fn.couponContainer,children:[s.jsxRuntimeExports.jsx("div",{className:fn.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"CheckCircle"})}),s.jsxRuntimeExports.jsxs("div",{className:fn.details,children:[s.jsxRuntimeExports.jsxs("p",{className:fn.title,children:[e.name,", ",n," discount"]}),s.jsxRuntimeExports.jsx("div",{className:fn.progress,children:s.jsxRuntimeExports.jsx(fa,{color:"#C2C2C2",percent:r,disablePercentLabel:!0})}),s.jsxRuntimeExports.jsx("p",{className:fn.foreverText,children:"Forever discount code"})]})]})},rk="_paymentMethodContainer_1g0da_4",sk="_paymentMethodTitle_1g0da_15",ok="_activeMethod_1g0da_20",ik="_noMethod_1g0da_28",ak="_activeMethodPaymentMethod_1g0da_37",uk="_paymentMethodLogo_1g0da_47",lk="_paymentMethodNumber_1g0da_57",ck="_method_1g0da_61",Wt={paymentMethodContainer:rk,paymentMethodTitle:sk,activeMethod:ok,noMethod:ik,activeMethodPaymentMethod:ak,paymentMethodLogo:uk,paymentMethodNumber:lk,method:ck},dk="_paymentMethods_1gev0_1",hk="_modal_1gev0_14",pk="_header_1gev0_28",mk="_content_1gev0_37",Jt={paymentMethods:dk,modal:hk,header:pk,content:mk},fk=e=>{const{setIsLoading:t,setIsOpen:n}=e,{subscription:r,setSubscription:o}=s.useSubscriptionStore();if(!r)return null;const{id:i}=s.useParams(),a=s.useNavigate(),{notifications:u,setNotifications:c}=s.useNotificationStore(),{setPaymentMethod:d,setGateway:p,cart:h}=s.useCart(),{setIsOpen:f}=s.useModalStore();async function m(){if(x(),t(!0),i&&r){const{data:g}=await s.changeSubscriptionGateway(i,h.gateway);g.isReconnectPaymentNeeded?a(`/charges/${g.chargeId}`):(c([...u,{status:"success",id:s.v4(),message:"Your action has been successfully completed"}]),o({...r,gatewayName:h.gateway}))}else c([...u,{status:"error",id:s.v4(),message:"Your action has been failed. Try again!"}]);t(!1)}function x(){f(!1),setTimeout(()=>{n(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:Jt.modal,onClick:g=>{g.stopPropagation()},children:[s.jsxRuntimeExports.jsxs("div",{className:Jt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Jt.title,children:"Choose Payment Method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Jt.content,children:[(r==null?void 0:r.availableGateways)&&s.jsxRuntimeExports.jsx(xl,{possibleGateways:{availableGateways:r.availableGateways,requiresSignInGateways:r.availableGateways},setGateway:p,setPaymentMethod:d,totalAndDiscount:{total:(r==null?void 0:r.price.amount)||0,totalWithDiscount:r==null?void 0:r.price.amount},onSignInClick:()=>a("/customer-dash")}),s.jsxRuntimeExports.jsxs("div",{className:Jt.paymentMethods,children:[s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Jt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!h.gateway,onClick:()=>m(),children:"Continue"})})]})]})]})},gk="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20131.39%2086.9'%3e%3cdefs%3e%3cstyle%3e.a{opacity:0;}.b{fill:%23fff;}.c{fill:%23ff5f00;}.d{fill:%23eb001b;}.e{fill:%23f79e1b;}%3c/style%3e%3c/defs%3e%3ctitle%3eAsset%201%3c/title%3e%3cg%20class='a'%3e%3crect%20class='b'%20width='131.39'%20height='86.9'/%3e%3c/g%3e%3crect%20class='c'%20x='48.37'%20y='15.14'%20width='34.66'%20height='56.61'/%3e%3cpath%20class='d'%20d='M51.94,43.45a35.94,35.94,0,0,1,13.75-28.3,36,36,0,1,0,0,56.61A35.94,35.94,0,0,1,51.94,43.45Z'/%3e%3cpath%20class='e'%20d='M120.5,65.76V64.6H121v-.24h-1.19v.24h.47v1.16Zm2.31,0v-1.4h-.36l-.42,1-.42-1h-.36v1.4h.26V64.7l.39.91h.27l.39-.91v1.06Z'/%3e%3cpath%20class='e'%20d='M123.94,43.45a36,36,0,0,1-58.25,28.3,36,36,0,0,0,0-56.61,36,36,0,0,1,58.25,28.3Z'/%3e%3c/svg%3e",xk=()=>{var x,g,C;const{subscription:e}=s.useSubscriptionStore(),{cart:t,setPaymentMethod:n}=s.useCart(),r=s.useNavigate(),[o,i]=k.useState(null),[a,u]=k.useState(!1),[c,d]=k.useState(!1),{setIsOpen:p}=s.useModalStore();if(!e)return null;const[h,f]=k.useState(e.gatewayName||t.gateway),m=t.paymentMethod;return k.useEffect(()=>{(async()=>{const A=await s.getGatewaysDetail(e.availableGateways);i(A)})()},[]),k.useEffect(()=>{t.gateway!==h&&f(t.gateway)},[t.gateway]),s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodContainer,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("p",{className:Wt.paymentMethodTitle,children:"Active Payment Method"}),e.gatewayInfo&&Object.keys(e.gatewayInfo).length>0&&s.jsxRuntimeExports.jsx(Ek,{gatewayInfo:e.gatewayInfo}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h==="Balance"&&s.jsxRuntimeExports.jsx(gl,{gateway:h,gatewayDisplayName:h,total:(e==null?void 0:e.price.amount)||0,onSignInClick:()=>r("/customer-dash")}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&!h&&s.jsxRuntimeExports.jsx("span",{className:Wt.noMethod,children:"Payment method is not set"}),(!e.gatewayInfo||Object.keys(e.gatewayInfo).length===0)&&h&&s.jsxRuntimeExports.jsx("div",{className:Wt.activeMethod,children:o&&s.jsxRuntimeExports.jsx(s.CheckoutPaymentMethod,{align:"row",gatewayLogoCfId:(x=o.find(b=>b.name===h))==null?void 0:x.logoCfImageId,gatewayDisplayName:(g=o.find(b=>b.name===h))==null?void 0:g.displayName,gateway:h,poweredByLogoCfId:(C=o.find(b=>b.name===h))==null?void 0:C.poweredByImageCfImageId,className:Wt.activeMethodPaymentMethod,selected:m===h,onSelect:b=>{n(b)}},h)})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:b=>{b.stopPropagation(),p(!0),d(!0)},children:t.gateway?"Change":"Manage"})]}),c&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>d(!1),children:s.jsxRuntimeExports.jsx(fk,{setIsLoading:u,setIsOpen:d})})]})},Ek=({gatewayInfo:e})=>{var t,n,r,o,i;return s.jsxRuntimeExports.jsxs("div",{className:Wt.method,children:[s.jsxRuntimeExports.jsxs("div",{className:Wt.paymentMethodLogo,children:[((t=e.card)==null?void 0:t.brand.toLowerCase())==="visa"&&s.jsxRuntimeExports.jsx(s.Visa,{}),((n=e.card)==null?void 0:n.brand.toLowerCase())==="mastercard"&&s.jsxRuntimeExports.jsx("img",{src:gk,alt:"",width:22}),((r=e.card)==null?void 0:r.brand.toLowerCase())!=="visa"&&((o=e.card)==null?void 0:o.brand.toLowerCase())!=="mastercard"&&s.jsxRuntimeExports.jsx(s.Icon,{name:"CreditCard",width:22})]}),s.jsxRuntimeExports.jsxs("p",{className:Wt.paymentMethodNumber,children:["•••• •••• •••• ",(i=e.card)==null?void 0:i.last4]})]})},bk="_subscriptionProductContainer_83ibx_4",Ik="_subscriptionProductImage_83ibx_15",Tk="_subscriptionProductInfo_83ibx_32",_k="_name_83ibx_37",Ck="_price_83ibx_40",qn={subscriptionProductContainer:bk,subscriptionProductImage:Ik,subscriptionProductInfo:Tk,name:_k,price:Ck},Sk=({subscription:e,id:t,accessToken:n})=>{const[r,o]=k.useState(!1),{setIsOpen:i}=s.useModalStore();return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductContainer,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsx("div",{className:qn.subscriptionProductImage,children:e!=null&&e.image?s.jsxRuntimeExports.jsx("img",{src:s.convertCfImageIdToUrl(e.image.cfId)}):s.jsxRuntimeExports.jsx(s.Icon,{name:"Image"})}),s.jsxRuntimeExports.jsxs("div",{className:qn.subscriptionProductInfo,children:[s.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:s.jsxRuntimeExports.jsx("h2",{className:qn.name,children:e.name})}),s.jsxRuntimeExports.jsxs("p",{className:qn.price,children:[s.formatPrice(e.price)," / ",e.recurringInterval]})]}),s.jsxRuntimeExports.jsx(s.Button$1,{type:"Special",onClick:a=>{a.preventDefault(),o(!0),i(!0)},children:"Cancel"})]}),r&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dR,{accessToken:n,id:t,isOpen:r,setIsOpen:o})})]})},yk="_content_5ctxw_1",kk="_selectedPlan_5ctxw_37",Rk="_planName_5ctxw_44",Ak="_description_5ctxw_48",Nk="_price_5ctxw_51",wk="_buttonGroup_5ctxw_79",Lk="_buttonWrapper_5ctxw_84",jk="_modal_5ctxw_88",vk="_header_5ctxw_95",lt={content:yk,selectedPlan:kk,planName:Rk,description:Ak,price:Nk,buttonGroup:wk,buttonWrapper:Lk,modal:jk,header:vk},Pk=({setIsOpen:e,selectedVariant:t,subscription:n})=>{if(!t)return null;const{setIsOpen:r}=s.useModalStore(),o=()=>{i()},i=()=>{r(!1),setTimeout(()=>{e(!1)},300)},a=(t.subscriptionSettings.compareAtPrice||t.subscriptionSettings.price).amount,u=t.subscriptionSettings.compareAtPrice?t.subscriptionSettings.compareAtPrice.amount-t.subscriptionSettings.price.amount:t.subscriptionSettings.price.amount,c=a-u,d=new Intl.NumberFormat("en-US",{style:"currency",currency:n.price.currency});return s.jsxRuntimeExports.jsxs("div",{className:lt.modal,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Choose upgrade method"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:()=>i(),fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.content,children:[s.jsxRuntimeExports.jsxs("div",{className:lt.selectedPlan,children:[s.jsxRuntimeExports.jsx("h2",{className:lt.planName,children:t.name}),s.jsxRuntimeExports.jsx("p",{className:lt.description,children:t.description}),s.jsxRuntimeExports.jsxs("p",{className:lt.price,children:["$",t.subscriptionSettings.price.amount.toFixed(2)," /"," ",t.subscriptionSettings.recurringIntervalDays===30?"month":"year"]})]}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:c,discount:u})]}),s.jsxRuntimeExports.jsxs("div",{className:lt.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:()=>i(),children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:lt.buttonWrapper,children:s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Primary",onClick:o,children:["Upgrade for $",c.toFixed(2)]})})]})]})]})},Dk="_reviewMessage_1t8u4_1",Ok="_leaveReviewContainer_1t8u4_11",Bk="_leaveReviewTitle_1t8u4_20",Hs={reviewMessage:Dk,leaveReviewContainer:Ok,leaveReviewTitle:Bk},Mk=({review:e,orderId:t,className:n})=>{const[r,o]=k.useState((e==null?void 0:e.rating)||0),[i,a]=k.useState(!1),{setIsOpen:u}=s.useModalStore(),{notifications:c,setNotifications:d}=s.useNotificationStore(),p=async h=>{e&&"accessToken"in e&&(await ic({comment:h,rating:r,tsId:s.getTsId()},t,e.accessToken),d([...c,{status:"success",id:s.v4(),message:"Review left successfully"}]),a(!1))};return k.useEffect(()=>{e&&r&&"accessToken"in e&&!e.rating&&(u(!0),a(!0))},[r]),e?e.rating&&"accessToken"in e?s.jsxRuntimeExports.jsxs("div",{className:Hs.reviewMessage,children:["You left a ",e.rating," star rating"]}):s.jsxRuntimeExports.jsxs("div",{className:s.clx(Hs.leaveReviewContainer,n),children:[s.jsxRuntimeExports.jsx("p",{className:Hs.leaveReviewTitle,children:"Leave a review"}),s.jsxRuntimeExports.jsx(Of,{rating:r,setRating:o,disabled:!!e.rating||!("accessToken"in e)}),i&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>a(!1),children:s.jsxRuntimeExports.jsx(Vk,{setIsOpen:a,onSubmit:p})})]}):null},Fk="_bottomSheet_1bcyj_1",Hk="_content_1bcyj_7",Uk="_title_1bcyj_18",$k="_buttonGroup_1bcyj_22",zk="_buttonWrapper_1bcyj_33",Wk="_modal_1bcyj_37",qk="_header_1bcyj_44",Ht={bottomSheet:Fk,content:Hk,title:Uk,buttonGroup:$k,buttonWrapper:zk,modal:Wk,header:qk},Vk=({setIsOpen:e,onSubmit:t})=>{const[n,r]=k.useState(""),{setIsOpen:o}=s.useModalStore(),i=()=>{o(!1),setTimeout(()=>{e(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:Ht.modal,onClick:a=>a.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:Ht.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:Ht.title,children:"Review Description"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",hoverable:!0,onClick:i,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:Ht.bottomSheet,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.content,children:s.jsxRuntimeExports.jsx(s.Textarea$1,{placeholder:"Great product and fast checkout...",value:n,onChange:a=>r(a),label:"Describe your review in detail below"})}),s.jsxRuntimeExports.jsxs("div",{className:Ht.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:i,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:Ht.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",disabled:!n,onClick:()=>{i(),t(n)},children:"Submit"})})]})]})]})},Gk="_container_1idhv_1",Yk="_buttonGroup_1idhv_8",Xk="_buttonWrapper_1idhv_15",Qk="_header_1idhv_19",Kk="_content_1idhv_28",en={container:Gk,buttonGroup:Yk,buttonWrapper:Xk,header:Qk,content:Kk},Zk=({setIsOpen:e})=>{const{subscription:t}=s.useSubscriptionStore(),{getTotalAndDiscount:n,cart:r,coupon:o}=s.useCart(),[i,a]=k.useState(1),u=s.useNavigate(),{setIsOpen:c}=s.useModalStore(),{setNotifications:d,notifications:p}=s.useNotificationStore(),[h,f]=k.useState(!1),m=k.useMemo(()=>n(),[o,r]),x=k.useMemo(()=>m.totalWithDiscount?m.total-m.totalWithDiscount:0,[m]);if(h)return s.jsxRuntimeExports.jsx(s.ProcessingPaymentModal,{});const g=(t==null?void 0:t.price.currency)||"USD",C=new Intl.NumberFormat("en-US",{style:"currency",currency:g});async function b(){var y;f(!0);try{const{data:P}=await s.extendSubscription((t==null?void 0:t.id)||"",{});d([{id:s.v4(),message:"Order created successfully",status:"success"}]),u(`/orders/${(y=P.data)==null?void 0:y.id}/${P.data.fullAccessToken}`)}catch(P){const L=P;d([...p,{id:s.v4(),message:`Order creation failed: ${L.message}`,status:"error"}]),A()}finally{f(!1)}}function A(){c(!1),setTimeout(()=>{e(!1)},300)}return s.jsxRuntimeExports.jsxs("div",{className:en.container,onClick:y=>y.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:en.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",className:en.title,children:"Extend Subscription"}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:A,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:en.content,children:[s.jsxRuntimeExports.jsx(Yf,{step:i,totalSteps:12,onStepChange:a,label:"How long would you like to extend your subscription for?"}),s.jsxRuntimeExports.jsx(cr,{formatter:C,coupon:o,total:m.total,discount:x,totalWithDiscount:m.totalWithDiscount}),s.jsxRuntimeExports.jsxs("div",{className:en.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:A,children:"Cancel"})}),s.jsxRuntimeExports.jsx("div",{className:en.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:b,children:"Extend"})})]})]})]})},Jk="_bottomSheet_uw5jb_1",eR="_content_uw5jb_7",tR="_radioGroup_uw5jb_11",nR="_confirmation_uw5jb_26",rR="_iconWrapper_uw5jb_33",sR="_title_uw5jb_42",oR="_message_uw5jb_48",iR="_buttonGroup_uw5jb_54",aR="_buttonWrapper_uw5jb_64",uR="_modal_uw5jb_68",lR="_header_uw5jb_77",je={bottomSheet:Jk,content:eR,radioGroup:tR,confirmation:nR,iconWrapper:rR,title:sR,message:oR,buttonGroup:iR,buttonWrapper:aR,modal:uR,header:lR},cR={0:"Are you sure?",1:"Just making sure",2:"We're sorry to see you go"},dR=({isOpen:e,setIsOpen:t,id:n,accessToken:r})=>{const[o,i]=k.useState(0),[a,u]=k.useState(!1),[c,d]=k.useState(""),[p,h]=k.useState(""),{setIsOpen:f}=s.useModalStore(),m=async()=>{if(!c)return;u(!0);const g=await s.cancelSubscription(n,r,{reason:c==="Other reason"?p:c});u(!1),g&&i(2)};k.useEffect(()=>{e||(i(0),d(""),h(""))},[e]);const x=()=>{f(!1),setTimeout(()=>{t(!1)},300)};return s.jsxRuntimeExports.jsxs("div",{className:je.modal,onClick:g=>g.stopPropagation(),children:[s.jsxRuntimeExports.jsxs("div",{className:je.header,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:cR[o]||""}),s.jsxRuntimeExports.jsx(s.Icon,{name:"X",onClick:x,hoverable:!0,fill:"var(--text-primary)"})]}),s.jsxRuntimeExports.jsxs("div",{className:je.content,children:[o===0&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"Before you cancel your subscription can you tell us why?"}),s.jsxRuntimeExports.jsxs("div",{className:je.radioGroup,children:[s.jsxRuntimeExports.jsx(s.Radio,{defaultValue:c,onChange:g=>d(g),options:[{value:"Found another company",label:"Found another company"},{value:"Expensive",label:"Expensive"},{value:"Technical problems",label:"Technical problems"},{value:"Support problems",label:"Support problems"},{value:"Other reason",label:"Other reason"}],flexDirection:"column"}),c==="Other reason"&&s.jsxRuntimeExports.jsx(s.Textarea$1,{value:p,onChange:g=>h(g),placeholder:"Describe the reason..."})]}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:()=>c&&i(1),disabled:!c,children:"Continue"})})]})]}),o===1&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsx("p",{children:"You'll lose access to all of the features and content available within this subscription."}),s.jsxRuntimeExports.jsxs("div",{className:je.buttonGroup,children:[s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Stay with us"})}),s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Primary",onClick:m,disabled:a,children:"Cancel it anyway"})})]})]}),o===2&&s.jsxRuntimeExports.jsxs("div",{className:je.bottomSheet,children:[s.jsxRuntimeExports.jsxs("div",{className:`${je.confirmation}`,children:[s.jsxRuntimeExports.jsx("div",{className:je.iconWrapper,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"Check",fill:"var(--text-success)"})}),s.jsxRuntimeExports.jsx("p",{className:je.title,children:"Subscription Cancelled"}),s.jsxRuntimeExports.jsx("p",{className:je.message,children:"You'll lose access to all of the features and content available within this subscription."})]}),s.jsxRuntimeExports.jsx("div",{className:je.buttonGroup,children:s.jsxRuntimeExports.jsx("div",{className:je.buttonWrapper,children:s.jsxRuntimeExports.jsx(s.Button$1,{type:"Secondary",onClick:x,children:"Close"})})})]})]})]})},hR="_checkoutContainer_wkomn_1",pR="_loaderContainer_wkomn_20",Us={checkoutContainer:hR,loaderContainer:pR},Il=()=>{const{isAntistock:e}=s.useGeneralStore(),{cart:t,products:n,pending:r,getTotalAndDiscount:o,getPossibleGateways:i,submitCart:a,setGateway:u,applyCoupon:c,setDiscordSocialConnectId:d,setCustomFields:p,applyCouponPending:h,coupon:f,removeCoupon:m,getDiscordSettings:x,setPaymentMethod:g,reset:C}=s.useCart(),b=k.useMemo(()=>o(),[f,t]),A=s.useNavigate();return k.useEffect(()=>{if(t.parts.length===0)try{A(-1)}catch{A("/")}},[t.parts]),r?s.jsxRuntimeExports.jsx("div",{className:Us.checkoutContainer,children:s.jsxRuntimeExports.jsx("div",{className:Us.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})})}):s.jsxRuntimeExports.jsxs("div",{className:Us.checkoutContainer,children:[s.jsxRuntimeExports.jsx(yS,{cart:t,products:n,applyCoupon:c,applyCouponPending:h,coupon:f,removeCoupon:m,totalAndDiscount:b}),s.jsxRuntimeExports.jsx(c3,{cart:t,getPossibleGateways:i,setGateway:u,getDiscordSettings:x,products:n,submitCart:a,totalAndDiscount:b,setCustomFieldsToCart:p,setDiscordSocialConnectId:d,setPaymentMethod:g,reset:C,isAntistock:e})]})},mR="_chargePageContainer_1a200_1",fR="_chargeItems_1a200_14",gR="_mainContent_1a200_25",xR="_contentWrapper_1a200_36",ER="_statusBlock_1a200_41",bR="_notPaidSection_1a200_45",IR="_footer_1a200_53",TR="_loaderContainer_1a200_63",Ut={chargePageContainer:mR,chargeItems:fR,mainContent:gR,contentWrapper:xR,statusBlock:ER,notPaidSection:bR,footer:IR,loaderContainer:TR},_R=()=>{const{id:e}=s.useParams(),[t,n]=s.useSearchParams(),[r,o]=k.useState(!1),[i,a]=k.useState(),[u,c]=k.useState(!0),d=s.useNavigate(),p=k.useRef(),{setIsOpen:h}=s.useModalStore();return k.useEffect(()=>{const f=async(x,g=!1)=>{g||o(!0);const{data:C}=await ac(x);o(!1),a(C)},m=setInterval(()=>{e&&f(e,!0)},5e3);return e&&f(e),()=>{clearInterval(m)}},[]),k.useEffect(()=>{const f=setTimeout(()=>{console.log("charge timeout",i);const m=t.get("redirectRoute");(i==null?void 0:i.status)===s.ChargeStatus.Paid&&i.redirectUrl&&!p.current&&window.open(i.redirectUrl,"_self"),(i==null?void 0:i.status)===s.ChargeStatus.Paid&&p.current&&d(p.current,{replace:!0}),m&&p&&(p.current=m,t.delete("redirectRoute"),n(t))},1e3);return()=>clearTimeout(f)},[i]),k.useEffect(()=>{((i==null?void 0:i.gateway)==="PayPalFF"||(i==null?void 0:i.gateway)==="Сashapp")&&h(!0)},[i]),r?s.jsxRuntimeExports.jsx("div",{className:Ut.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:Ut.chargePageContainer,children:[s.jsxRuntimeExports.jsx("div",{className:Ut.chargeItems,children:s.jsxRuntimeExports.jsx(Y3,{charge:i})}),s.jsxRuntimeExports.jsx("div",{className:Ut.mainContent,children:s.jsxRuntimeExports.jsxs("div",{className:Ut.contentWrapper,children:[i&&(i==null?void 0:i.status)!==s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx(s.ChargeStatusBlock,{charge:i}),i&&s.jsxRuntimeExports.jsx("div",{className:`${Ut.statusBlock}`,children:s.jsxRuntimeExports.jsx(bl,{lastUpdate:i.expiresAt,email:i.customerForCharge.email,invoiceId:i.id,paymentType:i.gateway})}),(i==null?void 0:i.status)===s.ChargeStatus.NotPaid&&s.jsxRuntimeExports.jsx("div",{className:Ut.notPaidSection,children:i==null?void 0:i.displayPaymentInfo.map((f,m)=>s.jsxRuntimeExports.jsx(El,{block:f},m))}),s.jsxRuntimeExports.jsx(vt,{className:Ut.footer})]})}),(i==null?void 0:i.gateway)==="PayPalFF"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>c(!1),children:s.jsxRuntimeExports.jsx(B3,{price:i.price,setIsOpen:c})}),(i==null?void 0:i.gateway)==="Сashapp"&&u&&s.jsxRuntimeExports.jsx(s.Modal,{close:()=>o(!1),children:s.jsxRuntimeExports.jsx(dy,{setIsOpen:c,chargeId:i.id})})]})},CR="_wrapper_o0iab_1",SR="_title_o0iab_23",yR="_container_o0iab_30",kR="_content_o0iab_41",RR="_messages_o0iab_52",AR="_input_o0iab_70",NR="_textarea_o0iab_83",wR="_message_o0iab_52",LR="_messageDate_o0iab_125",jR="_myMessage_o0iab_131",vR="_otherMessage_o0iab_138",PR="_button_o0iab_145",DR="_loadingMessage_o0iab_166",$e={wrapper:CR,title:SR,container:yR,content:kR,messages:RR,input:AR,textarea:NR,message:wR,messageDate:LR,myMessage:jR,otherMessage:vR,button:PR,loadingMessage:DR},OR=()=>{const e=window.location.pathname.split("/"),t=e[e.length-1],n=e[e.length-2],[r,o]=k.useState(!0),[i,a]=k.useState(null),[u,c]=k.useState(""),[d,p]=k.useState(null),{executeRecaptcha:h}=s.useReCaptcha(),f=async()=>{if(n&&t){const{data:g}=await s.fetchTicket(n,t);a(g),o(!1)}};k.useEffect(()=>{f();const g=setInterval(()=>{f()},5e3);return()=>clearInterval(g)},[]);const m=async()=>{const g=await h();if(!n||!t||!g||!u.trim())return;const C={content:u,createdAt:new Date().toISOString(),id:Date.now(),isSellerReply:!1};a(b=>b?{...b,messages:[...b.messages,C]}:null),p(C.id),c("");try{await s.sendTicketMessage(n,t,u,g,s.getTsId()),await f()}finally{setTimeout(()=>{p(null)},1e4)}},x=g=>{const C=new Date,b=new Date(g),A=Math.floor((C.getTime()-b.getTime())/1e3);if(A<60)return"right now";if(A<3600){const y=Math.floor(A/60);return`${y} minute${y>1?"s":""} ago`}else if(A<10800){const y=Math.floor(A/3600);return`${y} hour${y>1?"s":""} ago`}else return b.getFullYear()===C.getFullYear()?b.toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):b.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return s.jsxRuntimeExports.jsx("div",{className:$e.wrapper,children:r&&!i?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs("div",{className:$e.container,children:[s.jsxRuntimeExports.jsx("div",{className:$e.title,children:`#${n} (${i==null?void 0:i.title})`}),s.jsxRuntimeExports.jsxs("div",{className:$e.content,children:[s.jsxRuntimeExports.jsx("div",{className:$e.messages,children:i==null?void 0:i.messages.sort((g,C)=>new Date(g.createdAt).getTime()-new Date(C.createdAt).getTime()).map(g=>s.jsxRuntimeExports.jsxs("div",{className:s.clx($e.message,{[$e.myMessage]:!g.isSellerReply,[$e.otherMessage]:g.isSellerReply,[$e.loadingMessage]:d===g.id}),children:[s.jsxRuntimeExports.jsx("div",{className:$e.messageContent,children:s.splitTextIntoSpans(g.content,!1)}),d!==g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:x(g.createdAt)}),d===g.id&&s.jsxRuntimeExports.jsx("div",{className:$e.messageDate,children:s.jsxRuntimeExports.jsx(s.Loader,{})})]},g.id))}),s.jsxRuntimeExports.jsxs("div",{className:$e.input,children:[s.jsxRuntimeExports.jsx("textarea",{className:$e.textarea,value:u,placeholder:"What worries you?",onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),m())}}),s.jsxRuntimeExports.jsx("div",{className:$e.button,onClick:m,children:s.jsxRuntimeExports.jsx(s.Icon,{name:"PaperPlaneRight"})})]})]})]})})},BR="_subscriptionContainer_1j6ol_1",MR="_leftSection_1j6ol_15",FR="_content_1j6ol_26",HR="_mainContent_1j6ol_33",UR="_detailsSection_1j6ol_37",$R="_buttonGroup_1j6ol_50",zR="_detailsContent_1j6ol_57",tn={subscriptionContainer:BR,leftSection:MR,content:FR,mainContent:HR,detailsSection:UR,buttonGroup:$R,detailsContent:zR},WR=()=>{const{id:e,accessToken:t}=s.useParams(),{subscription:n,setSubscription:r}=s.useSubscriptionStore(),{setIsOpen:o}=s.useModalStore(),[i,a]=k.useState(!1),[u,c]=k.useState(!1);k.useLayoutEffect(()=>{r(null)},[e,t]);const{balanceSettings:d,setBalanceSettings:p}=s.useCustomerDashboardStore();return k.useEffect(()=>{e&&t&&(async()=>{if(!e||!t)return;c(!0);const{data:f}=await s.fetchSubscription(e,t);r({...f}),c(!1)})()},[e,t]),k.useEffect(()=>{d||(async()=>{const f=await s.getBalanceSettings();p(f)})()},[d]),u?s.jsxRuntimeExports.jsx(s.Loader,{}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:tn.subscriptionContainer,children:[s.jsxRuntimeExports.jsx("div",{className:tn.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.content,children:[s.jsxRuntimeExports.jsx(lr,{}),s.jsxRuntimeExports.jsxs("div",{className:tn.mainContent,children:[n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Your Subscription"}),s.jsxRuntimeExports.jsx(_y,{subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),s.jsxRuntimeExports.jsx("div",{className:tn.buttonGroup,children:n.pricingPlanExists&&s.jsxRuntimeExports.jsx(s.Button$1,{onClick:h=>{h.stopPropagation(),o(!0),a(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),s.jsxRuntimeExports.jsx(vt,{})]})]})}),s.jsxRuntimeExports.jsx("div",{className:tn.detailsSection,children:s.jsxRuntimeExports.jsxs("div",{className:tn.detailsContent,children:[s.jsxRuntimeExports.jsx("h3",{id:"h3",children:"Details"}),(n==null?void 0:n.coupon)&&s.jsxRuntimeExports.jsx(nk,{coupon:n.coupon,currency:n.price.currency||"USD"}),n&&s.jsxRuntimeExports.jsx(Sk,{id:e||"",accessToken:t||"",subscription:{price:n.price,name:n.productName,description:n.productDescription,status:n.status,image:n.productImage,recurringInterval:n.recurringInterval}}),n&&s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(xk,{}),n.activeTo&&s.jsxRuntimeExports.jsx(Xy,{})]}),s.jsxRuntimeExports.jsx(vt,{className:"flex md:hidden"})]})})]}),s.jsxRuntimeExports.jsx(Wy,{isOpen:i,setIsOpen:a,subscription:n})]})},qR="_topUpContainer_1pag6_1",VR="_formWrapper_1pag6_15",GR="_header_1pag6_29",YR="_footer_1pag6_82",XR="_wrapper_1pag6_105",Vn={topUpContainer:qR,formWrapper:VR,header:GR,footer:YR,wrapper:XR},QR=()=>{const{gatewaysDetail:e,setGatewaysDetail:t,balanceSettings:n,setBalanceSettings:r}=s.useCustomerDashboardStore();return k.useEffect(()=>{!e&&n&&(async()=>{const i=await s.getGatewaysDetail(n!=null&&n.isEnabled?(n==null?void 0:n.topUpSettings.gateways)||[]:[]);t(i)})()},[e,n]),k.useEffect(()=>{n||(async()=>{const i=await s.getBalanceSettings();r(i)})()},[n]),s.jsxRuntimeExports.jsxs("div",{className:Vn.wrapper,children:[s.jsxRuntimeExports.jsx(lr,{className:Vn.header}),s.jsxRuntimeExports.jsx("div",{className:Vn.topUpContainer,children:n?s.jsxRuntimeExports.jsx("div",{className:Vn.formWrapper,children:s.jsxRuntimeExports.jsx(s.BalanceModal,{setIsOpen:()=>{},isModal:!1})}):s.jsxRuntimeExports.jsx(s.Loader,{})}),s.jsxRuntimeExports.jsx("div",{className:Vn.footer,children:s.jsxRuntimeExports.jsx(vt,{})})]})},KR="_orderPage_1nvve_1",ZR="_leftSection_1nvve_15",JR="_content_1nvve_35",eA="_main_1nvve_42",tA="_statusBlock_1nvve_54",nA="_timelineBlock_1nvve_58",rA="_footer_1nvve_62",sA="_rightSection_1nvve_71",oA="_header_1nvve_84",iA="_productList_1nvve_92",aA="_mobileFooter_1nvve_99",uA="_loaderContainer_1nvve_108",lA="_orderMainData_1nvve_116",cA="_prices_1nvve_123",dA="_headerTitle_1nvve_127",hA="_headerDescription_1nvve_131",De={orderPage:KR,leftSection:ZR,content:JR,main:eA,statusBlock:tA,timelineBlock:nA,footer:rA,rightSection:sA,header:oA,productList:iA,mobileFooter:aA,loaderContainer:uA,orderMainData:lA,prices:cA,headerTitle:dA,headerDescription:hA},pA=()=>{var h,f,m;const{id:e,accessToken:t}=s.useParams(),n=s.useNavigate(),[r,o]=k.useState(),[i,a]=k.useState(!1),u=s.useCopy(),c=((h=r==null?void 0:r.rawPrice)==null?void 0:h.currency)||"USD",d=new Intl.NumberFormat("en-US",{style:"currency",currency:c}),p=k.useMemo(()=>(r==null?void 0:r.partOrders.map(x=>{var g,C,b,A;return{id:(x==null?void 0:x.id)||0,image:x.productWithVariant.image,name:((g=x.productWithVariant)==null?void 0:g.name)||"",description:((C=x.productWithVariant)==null?void 0:C.description)||"",price:{quantity:x.quantity,amount:((b=x.productWithVariant)==null?void 0:b.price.amount)||0,currency:(A=x.productWithVariant)==null?void 0:A.price.currency},deliveryCategories:"deliveryCategories"in x?x.deliveryCategories:void 0,customerNote:x.customerNote,chargeType:x.chargeType||"ONE_TIME"}}))||[],[r]);return k.useLayoutEffect(()=>{if(e&&!t){const x=JSON.parse(localStorage.getItem("orders")||"{}");x[e]&&n(`/orders/${e}/${x[e].fullAccessToken}`)}},[e]),k.useEffect(()=>{const x=async(C,b=!1)=>{b||a(!0);const{data:A}=await(t?s.fetchAuthorizedOrder(`${C}/${t}`):s.fetchOrder(C));a(!1),A.charge.status===s.ChargeStatus.NotPaid&&n(`/charges/${A.charge.id}`,{replace:!0}),o(A)};e&&x(e);const g=setInterval(()=>{e&&x(e,!0)},5e3);return()=>{clearInterval(g)}},[]),i?s.jsxRuntimeExports.jsx("div",{className:De.loaderContainer,children:s.jsxRuntimeExports.jsx(s.Loader,{})}):s.jsxRuntimeExports.jsxs("div",{className:De.orderPage,children:[s.jsxRuntimeExports.jsx("div",{className:De.leftSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[s.jsxRuntimeExports.jsx(lr,{}),r&&s.jsxRuntimeExports.jsxs("div",{className:De.main,children:[s.jsxRuntimeExports.jsx(s.OrderStatusBlock,{className:De.statusBlock,orderStatus:r.status}),s.jsxRuntimeExports.jsxs("div",{className:De.orderMainData,children:[s.jsxRuntimeExports.jsx(bl,{lastUpdate:r.createdAt,paymentType:r.charge.gateway,email:r.charge.customerForCharge.email,invoiceId:r.charge.id}),"accessToken"in r.review&&s.jsxRuntimeExports.jsx(Mk,{orderId:r.id,review:r.review})]}),r.charge&&s.jsxRuntimeExports.jsx(s.TrackPayment,{className:De.timelineBlock,timeline:r.charge.timeline}),s.jsxRuntimeExports.jsx(vt,{className:De.footer})]})]})}),s.jsxRuntimeExports.jsx("div",{className:De.rightSection,children:s.jsxRuntimeExports.jsxs("div",{className:De.content,children:[(r==null?void 0:r.charge.name)&&s.jsxRuntimeExports.jsxs("header",{className:De.header,children:[s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("h1",{className:De.headerTitle,children:r.charge.name}),r.charge.description&&s.jsxRuntimeExports.jsx("p",{className:De.headerDescription,children:r.charge.description})]}),s.jsxRuntimeExports.jsxs(s.Button$1,{type:"Secondary",onClick:()=>u((r==null?void 0:r.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[s.jsxRuntimeExports.jsx(s.Icon,{name:"Copy"}),s.jsxRuntimeExports.jsx("span",{children:"Copy ID"})]})]}),s.jsxRuntimeExports.jsxs("div",{children:[s.jsxRuntimeExports.jsx("div",{className:De.productList,children:p.map(x=>s.jsxRuntimeExports.jsx(jo,{product:x,isOrder:!0},x.id))}),s.jsxRuntimeExports.jsx(cr,{formatter:d,coupon:null,total:((f=r==null?void 0:r.charge)==null?void 0:f.price.amount)||0,discount:0,totalWithDiscount:((m=r==null?void 0:r.charge)==null?void 0:m.price.amount)||0,className:De.prices,isShowSubtotal:!1}),s.jsxRuntimeExports.jsx(vt,{className:De.mobileFooter})]})]})})]})},mA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState();n(t.filter(r=>r.id!==e))},fA=e=>{const{notifications:t,setNotifications:n}=s.useNotificationStore.getState(),r=s.v4();return n([...t,{id:r,...e}]),r},gA=e=>{const{blocks:t,settings:n,header:r,footer:o,announcement:i,routes:a=[],shopLogo:u,apiURLs:c,isAntistock:d=!1}=e,[p,h]=k.useState(null),{general:f,setIsAntistock:m}=s.useGeneralStore(),{setApiUrls:x}=s.useApiStore(),{setBlocks:g,setSourceBlocks:C,setHeader:b,setFooter:A,setAnnouncement:y,setSettings:P}=s.useBlocksStore(),{setHeader:L,setFooter:R,setAnnouncement:q}=s.useLayersStore(),{themeSettings:Y}=s.useThemeSettingsStore(),{settings:K,setSettings:w}=s.useSettingsStore(),$=window.location.hostname.includes("localhost")?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,B=localStorage.getItem("shopPassword"),H=localStorage.getItem("shopId")||"";return k.useEffect(()=>{m(d)},[d,m]),k.useEffect(()=>{H||localStorage.setItem("shopId",(f==null?void 0:f.info.id)||"")},[f]),k.useEffect(()=>{if(Y&&K){const V=hc(Y,K);Ec(Y),pc(V)}},[Y,K,window.location.hostname]),k.useEffect(()=>{const V={};Object.keys(t).map(ae=>{V[ae]=t[ae]}),C(V),g(V),b(r),A(o),y(i),P(n),c&&x(c);const z=new r,Z=JSON.parse(JSON.stringify(z));L(Z,!1);const G=new o,W=JSON.parse(JSON.stringify(G));R(W,!1);const J=new i,T=JSON.parse(JSON.stringify(J));q(T,!1);const ce=new n,ye=JSON.parse(JSON.stringify(ce));w(ye);const S=s.createBrowserRouter([{element:s.jsxRuntimeExports.jsx(rf,{shopDomain:$,shopId:H,shopPassword:B||void 0,shopLogo:u,children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(Zm,{children:s.jsxRuntimeExports.jsx(s.Outlet,{})})})}),errorElement:s.jsxRuntimeExports.jsx(Jm,{}),children:[{path:"/admin/builder/*",element:s.jsxRuntimeExports.jsx(Hm,{children:s.jsxRuntimeExports.jsx(Pm,{blocks:t,settings:n,header:r,footer:o,announcement:i})}),errorElement:s.jsxRuntimeExports.jsx(Fm,{})},...a,{path:"/checkout",element:s.jsxRuntimeExports.jsx(Il,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:s.jsxRuntimeExports.jsx(QR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:s.jsxRuntimeExports.jsx(_R,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(pA,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:s.jsxRuntimeExports.jsx(WR,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Subscriptions",!0)},{path:"/customer-dash",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderAnnouncement,{}),s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:"1 1 auto"},children:s.jsxRuntimeExports.jsx(s.CustomerDashboard,{})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Customer Dashboard",!0)},{path:"/validation",element:s.jsxRuntimeExports.jsx(Xm,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:s.jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:[s.jsxRuntimeExports.jsx(s.RenderHeader,{}),s.jsxRuntimeExports.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:s.jsxRuntimeExports.jsx(s.ReCaptchaProvider,{children:s.jsxRuntimeExports.jsx(OR,{})})}),s.jsxRuntimeExports.jsx(s.RenderFooter,{})]}),errorElement:s.jsxRuntimeExports.jsx(Nt,{}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:s.jsxRuntimeExports.jsx(dc,{}),errorElement:s.jsxRuntimeExports.jsx(Nt,{})}]}]);h(S)},[f]),s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p&&s.jsxRuntimeExports.jsx(s.RouterProvider,{router:p})})};exports.ReCaptchaProvider=s.ReCaptchaProvider;exports.aspectRatioOptions=s.aspectRatioOptions;exports.formatPrice=s.formatPrice;exports.splitTextIntoSpans=s.splitTextIntoSpans;exports.useAdaptiveStyles=s.useAdaptiveStyles;exports.useCart=s.useCart;exports.useReCaptcha=s.useReCaptcha;exports.App=gA;exports.Checkout=Il;exports.ColorVariables=la;exports.hotReload=bc;exports.iconNames=_l;exports.removeNotification=mA;exports.showNotification=fA;exports.useBuilderPages=Tc;exports.useCreateTicket=Ic;
|
package/dist/builder.es.js
CHANGED
|
@@ -24478,7 +24478,7 @@ const Mi = ({ isOrder: e, product: t }) => {
|
|
|
24478
24478
|
}).then(({ data: y }) => {
|
|
24479
24479
|
n({
|
|
24480
24480
|
authorized: !0,
|
|
24481
|
-
id: y.
|
|
24481
|
+
id: y.id,
|
|
24482
24482
|
avatar: y.avatar,
|
|
24483
24483
|
username: y.username
|
|
24484
24484
|
}), S && S.close(), i(!1), f(null), p("Discord successfully connected!", "success"), clearTimeout(T);
|