UNPKG

react-affiliate-program

Version:

Easily create affiliate programs for React apps

34 lines (31 loc) 48.5 kB
'use client'; (function(k,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(k=typeof globalThis<"u"?globalThis:k||self,b(k["react-affiliate-program"]={},k.React))})(this,function(k,b){"use strict";var ge=document.createElement("style");ge.textContent=`@import"https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap";/*! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com */*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}html{font-family:Nunito,system-ui,sans-serif}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.af-relative{position:relative}.af-mb-4{margin-bottom:1rem}.af-ml-3{margin-left:.75rem}.af-mr-3{margin-right:.75rem}.af-flex{display:flex}.af-grid{display:grid}.af-h-1\\/4{height:25%}.af-h-128{height:30rem}.af-h-3\\/4{height:75%}.af-h-5{height:1.25rem}.af-h-9{height:2.25rem}.af-h-full{height:100%}.af-w-96{width:24rem}.af-w-full{width:100%}.af-flex-1{flex:1 1 0%}@keyframes af-spin{to{transform:rotate(360deg)}}.af-animate-spin{animation:af-spin 1s linear infinite}.af-select-none{-webkit-user-select:none;user-select:none}.af-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.af-flex-col{flex-direction:column}.af-items-start{align-items:flex-start}.af-items-end{align-items:flex-end}.af-items-center{align-items:center}.af-items-stretch{align-items:stretch}.af-justify-end{justify-content:flex-end}.af-justify-center{justify-content:center}.af-justify-between{justify-content:space-between}.af-gap-4{gap:1rem}.af-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.af-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.af-space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.af-space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.af-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.af-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.af-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.af-overflow-auto{overflow:auto}.af-overflow-hidden{overflow:hidden}.af-overflow-y-auto{overflow-y:auto}.af-break-all{word-break:break-all}.af-rounded-full{border-radius:9999px}.af-rounded-lg{border-radius:.5rem}.af-rounded-md{border-radius:.375rem}.af-border{border-width:1px}.af-border-none{border-style:none}.af-bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.af-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.af-bg-green-300{--tw-bg-opacity: 1;background-color:rgb(134 239 172 / var(--tw-bg-opacity))}.af-bg-red-300{--tw-bg-opacity: 1;background-color:rgb(252 165 165 / var(--tw-bg-opacity))}.af-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.af-p-1{padding:.25rem}.af-p-4{padding:1rem}.af-px-16{padding-left:4rem;padding-right:4rem}.af-px-2{padding-left:.5rem;padding-right:.5rem}.af-px-3{padding-left:.75rem;padding-right:.75rem}.af-px-4{padding-left:1rem;padding-right:1rem}.af-py-1{padding-top:.25rem;padding-bottom:.25rem}.af-py-16{padding-top:4rem;padding-bottom:4rem}.af-py-2{padding-top:.5rem;padding-bottom:.5rem}.af-text-center{text-align:center}.af-text-2xl{font-size:1.5rem;line-height:2rem}.af-text-4xl{font-size:2.25rem;line-height:2.5rem}.af-text-lg{font-size:1.125rem;line-height:1.75rem}.af-text-sm{font-size:.875rem;line-height:1.25rem}.af-text-xl{font-size:1.25rem;line-height:1.75rem}.af-text-xs{font-size:.75rem;line-height:1rem}.af-font-medium{font-weight:500}.af-font-semibold{font-weight:600}.af-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.af-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.af-text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.af-text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.af-text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.af-shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.af-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.af-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\\:af-bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.focus-visible\\:af-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.disabled\\:af-pointer-events-none:disabled{pointer-events:none}.disabled\\:af-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:af-opacity-50:disabled{opacity:.5} `,document.head.appendChild(ge);var ne={exports:{}},V={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ve;function Qe(){if(ve)return V;ve=1;var t=b,i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function s(p,w,A){var E,P={},T=null,D=null;A!==void 0&&(T=""+A),w.key!==void 0&&(T=""+w.key),w.ref!==void 0&&(D=w.ref);for(E in w)c.call(w,E)&&!m.hasOwnProperty(E)&&(P[E]=w[E]);if(p&&p.defaultProps)for(E in w=p.defaultProps,w)P[E]===void 0&&(P[E]=w[E]);return{$$typeof:i,type:p,key:T,ref:D,props:P,_owner:n.current}}return V.Fragment=o,V.jsx=s,V.jsxs=s,V}var Y={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var we;function et(){return we||(we=1,process.env.NODE_ENV!=="production"&&function(){var t=b,i=Symbol.for("react.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),p=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),u=Symbol.iterator,_="@@iterator";function I(e){if(e===null||typeof e!="object")return null;var r=u&&e[u]||e[_];return typeof r=="function"?r:null}var R=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var r=arguments.length,l=new Array(r>1?r-1:0),f=1;f<r;f++)l[f-1]=arguments[f];yt("error",e,l)}}function yt(e,r,l){{var f=R.ReactDebugCurrentFrame,g=f.getStackAddendum();g!==""&&(r+="%s",l=l.concat([g]));var v=l.map(function(h){return String(h)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var bt=!1,jt=!1,kt=!1,Et=!1,_t=!1,Oe;Oe=Symbol.for("react.module.reference");function Ct(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===m||_t||e===n||e===A||e===E||Et||e===D||bt||jt||kt||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===P||e.$$typeof===s||e.$$typeof===p||e.$$typeof===w||e.$$typeof===Oe||e.getModuleId!==void 0))}function Nt(e,r,l){var f=e.displayName;if(f)return f;var g=r.displayName||r.name||"";return g!==""?l+"("+g+")":l}function Pe(e){return e.displayName||"Context"}function z(e){if(e==null)return null;if(typeof e.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case o:return"Portal";case m:return"Profiler";case n:return"StrictMode";case A:return"Suspense";case E:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var r=e;return Pe(r)+".Consumer";case s:var l=e;return Pe(l._context)+".Provider";case w:return Nt(e,e.render,"ForwardRef");case P:var f=e.displayName||null;return f!==null?f:z(e.type)||"Memo";case T:{var g=e,v=g._payload,h=g._init;try{return z(h(v))}catch{return null}}}return null}var $=Object.assign,G=0,Re,Te,ze,Le,Ae,Ie,De;function $e(){}$e.__reactDisabledLog=!0;function St(){{if(G===0){Re=console.log,Te=console.info,ze=console.warn,Le=console.error,Ae=console.group,Ie=console.groupCollapsed,De=console.groupEnd;var e={configurable:!0,enumerable:!0,value:$e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}G++}}function Ot(){{if(G--,G===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:Re}),info:$({},e,{value:Te}),warn:$({},e,{value:ze}),error:$({},e,{value:Le}),group:$({},e,{value:Ae}),groupCollapsed:$({},e,{value:Ie}),groupEnd:$({},e,{value:De})})}G<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=R.ReactCurrentDispatcher,le;function ee(e,r,l){{if(le===void 0)try{throw Error()}catch(g){var f=g.stack.trim().match(/\n( *(at )?)/);le=f&&f[1]||""}return` `+le+e}}var ce=!1,te;{var Pt=typeof WeakMap=="function"?WeakMap:Map;te=new Pt}function Fe(e,r){if(!e||ce)return"";{var l=te.get(e);if(l!==void 0)return l}var f;ce=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=se.current,se.current=null,St();try{if(r){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(N){f=N}Reflect.construct(e,[],h)}else{try{h.call()}catch(N){f=N}e.call(h.prototype)}}else{try{throw Error()}catch(N){f=N}e()}}catch(N){if(N&&f&&typeof N.stack=="string"){for(var d=N.stack.split(` `),C=f.stack.split(` `),x=d.length-1,y=C.length-1;x>=1&&y>=0&&d[x]!==C[y];)y--;for(;x>=1&&y>=0;x--,y--)if(d[x]!==C[y]){if(x!==1||y!==1)do if(x--,y--,y<0||d[x]!==C[y]){var O=` `+d[x].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&te.set(e,O),O}while(x>=1&&y>=0);break}}}finally{ce=!1,se.current=v,Ot(),Error.prepareStackTrace=g}var W=e?e.displayName||e.name:"",F=W?ee(W):"";return typeof e=="function"&&te.set(e,F),F}function Rt(e,r,l){return Fe(e,!1)}function Tt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ae(e,r,l){if(e==null)return"";if(typeof e=="function")return Fe(e,Tt(e));if(typeof e=="string")return ee(e);switch(e){case A:return ee("Suspense");case E:return ee("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case w:return Rt(e.render);case P:return ae(e.type,r,l);case T:{var f=e,g=f._payload,v=f._init;try{return ae(v(g),r,l)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Me={},Be=R.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,l=ae(e.type,e._source,r?r.type:null);Be.setExtraStackFrame(l)}else Be.setExtraStackFrame(null)}function zt(e,r,l,f,g){{var v=Function.call.bind(q);for(var h in e)if(v(e,h)){var d=void 0;try{if(typeof e[h]!="function"){var C=Error((f||"React class")+": "+l+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw C.name="Invariant Violation",C}d=e[h](r,h,f,l,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){d=x}d&&!(d instanceof Error)&&(re(g),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",f||"React class",l,h,typeof d),re(null)),d instanceof Error&&!(d.message in Me)&&(Me[d.message]=!0,re(g),j("Failed %s type: %s",l,d.message),re(null))}}}var Lt=Array.isArray;function fe(e){return Lt(e)}function At(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,l=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l}}function It(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Ve(e){if(It(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",At(e)),We(e)}var K=R.ReactCurrentOwner,Dt={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ue,ue;ue={};function $t(e){if(q.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ft(e){if(q.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Mt(e,r){if(typeof e.ref=="string"&&K.current&&r&&K.current.stateNode!==r){var l=z(K.current.type);ue[l]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',z(K.current.type),e.ref),ue[l]=!0)}}function Bt(e,r){{var l=function(){Ye||(Ye=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}}function Wt(e,r){{var l=function(){Ue||(Ue=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};l.isReactWarning=!0,Object.defineProperty(e,"ref",{get:l,configurable:!0})}}var Vt=function(e,r,l,f,g,v,h){var d={$$typeof:i,type:e,key:r,ref:l,props:h,_owner:v};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function Yt(e,r,l,f,g){{var v,h={},d=null,C=null;l!==void 0&&(Ve(l),d=""+l),Ft(r)&&(Ve(r.key),d=""+r.key),$t(r)&&(C=r.ref,Mt(r,g));for(v in r)q.call(r,v)&&!Dt.hasOwnProperty(v)&&(h[v]=r[v]);if(e&&e.defaultProps){var x=e.defaultProps;for(v in x)h[v]===void 0&&(h[v]=x[v])}if(d||C){var y=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&Bt(h,y),C&&Wt(h,y)}return Vt(e,d,C,g,f,K.current,h)}}var de=R.ReactCurrentOwner,Je=R.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,l=ae(e.type,e._source,r?r.type:null);Je.setExtraStackFrame(l)}else Je.setExtraStackFrame(null)}var pe;pe=!1;function he(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function He(){{if(de.current){var e=z(de.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function Ut(e){return""}var Ge={};function Jt(e){{var r=He();if(!r){var l=typeof e=="string"?e:e.displayName||e.name;l&&(r=` Check the top-level render call using <`+l+">.")}return r}}function qe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var l=Jt(r);if(Ge[l])return;Ge[l]=!0;var f="";e&&e._owner&&e._owner!==de.current&&(f=" It was passed a child from "+z(e._owner.type)+"."),B(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',l,f),B(null)}}function Ke(e,r){{if(typeof e!="object")return;if(fe(e))for(var l=0;l<e.length;l++){var f=e[l];he(f)&&qe(f,r)}else if(he(e))e._store&&(e._store.validated=!0);else if(e){var g=I(e);if(typeof g=="function"&&g!==e.entries)for(var v=g.call(e),h;!(h=v.next()).done;)he(h.value)&&qe(h.value,r)}}}function Ht(e){{var r=e.type;if(r==null||typeof r=="string")return;var l;if(typeof r=="function")l=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===w||r.$$typeof===P))l=r.propTypes;else return;if(l){var f=z(r);zt(l,e.props,"prop",f,e)}else if(r.PropTypes!==void 0&&!pe){pe=!0;var g=z(r);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Gt(e){{for(var r=Object.keys(e.props),l=0;l<r.length;l++){var f=r[l];if(f!=="children"&&f!=="key"){B(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",f),B(null);break}}e.ref!==null&&(B(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}var Xe={};function Ze(e,r,l,f,g,v){{var h=Ct(e);if(!h){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C=Ut();C?d+=C:d+=He();var x;e===null?x="null":fe(e)?x="array":e!==void 0&&e.$$typeof===i?(x="<"+(z(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):x=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,d)}var y=Yt(e,r,l,g,v);if(y==null)return y;if(h){var O=r.children;if(O!==void 0)if(f)if(fe(O)){for(var W=0;W<O.length;W++)Ke(O[W],e);Object.freeze&&Object.freeze(O)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(O,e)}if(q.call(r,"key")){var F=z(e),N=Object.keys(r).filter(function(ea){return ea!=="key"}),me=N.length>0?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}";if(!Xe[F+me]){var Qt=N.length>0?"{"+N.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,me,F,Qt,F),Xe[F+me]=!0}}return e===c?Gt(y):Ht(y),y}}function qt(e,r,l){return Ze(e,r,l,!0)}function Kt(e,r,l){return Ze(e,r,l,!1)}var Xt=Kt,Zt=qt;Y.Fragment=c,Y.jsx=Xt,Y.jsxs=Zt}()),Y}process.env.NODE_ENV==="production"?ne.exports=Qe():ne.exports=et();var a=ne.exports,xe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ye=b.createContext&&b.createContext(xe),tt=["attr","size","title"];function at(t,i){if(t==null)return{};var o=rt(t,i),c,n;if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(t);for(n=0;n<m.length;n++)c=m[n],!(i.indexOf(c)>=0)&&Object.prototype.propertyIsEnumerable.call(t,c)&&(o[c]=t[c])}return o}function rt(t,i){if(t==null)return{};var o={};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){if(i.indexOf(c)>=0)continue;o[c]=t[c]}return o}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(t[c]=o[c])}return t},X.apply(this,arguments)}function be(t,i){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);i&&(c=c.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),o.push.apply(o,c)}return o}function Z(t){for(var i=1;i<arguments.length;i++){var o=arguments[i]!=null?arguments[i]:{};i%2?be(Object(o),!0).forEach(function(c){nt(t,c,o[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):be(Object(o)).forEach(function(c){Object.defineProperty(t,c,Object.getOwnPropertyDescriptor(o,c))})}return t}function nt(t,i,o){return i=it(i),i in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}function it(t){var i=ot(t,"string");return typeof i=="symbol"?i:i+""}function ot(t,i){if(typeof t!="object"||!t)return t;var o=t[Symbol.toPrimitive];if(o!==void 0){var c=o.call(t,i||"default");if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(t)}function je(t){return t&&t.map((i,o)=>b.createElement(i.tag,Z({key:o},i.attr),je(i.child)))}function S(t){return i=>b.createElement(st,X({attr:Z({},t.attr)},i),je(t.child))}function st(t){var i=o=>{var{attr:c,size:n,title:m}=t,s=at(t,tt),p=n||o.size||"1em",w;return o.className&&(w=o.className),t.className&&(w=(w?w+" ":"")+t.className),b.createElement("svg",X({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},o.attr,c,s,{className:w,style:Z(Z({color:t.color||o.color},o.style),t.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),m&&b.createElement("title",null,m),t.children)};return ye!==void 0?b.createElement(ye.Consumer,null,o=>i(o)):i(xe)}function lt(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21.822 7.431A1 1 0 0 0 21 7H7.333L6.179 4.23A1.994 1.994 0 0 0 4.333 3H2v2h2.333l4.744 11.385A1 1 0 0 0 10 17h8c.417 0 .79-.259.937-.648l3-8a1 1 0 0 0-.115-.921zM17.307 15h-6.64l-2.5-6h11.39l-2.25 6z"},child:[]},{tag:"circle",attr:{cx:"10.5",cy:"19.5",r:"1.5"},child:[]},{tag:"circle",attr:{cx:"17.5",cy:"19.5",r:"1.5"},child:[]}]})(t)}function ct(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z"},child:[]}]})(t)}function ie(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M15.999 8.5h2c0-2.837-2.755-4.131-5-4.429V2h-2v2.071c-2.245.298-5 1.592-5 4.429 0 2.706 2.666 4.113 5 4.43v4.97c-1.448-.251-3-1.024-3-2.4h-2c0 2.589 2.425 4.119 5 4.436V22h2v-2.07c2.245-.298 5-1.593 5-4.43s-2.755-4.131-5-4.429V6.1c1.33.239 3 .941 3 2.4zm-8 0c0-1.459 1.67-2.161 3-2.4v4.799c-1.371-.253-3-1.002-3-2.399zm8 7c0 1.459-1.67 2.161-3 2.4v-4.8c1.33.239 3 .941 3 2.4z"},child:[]}]})(t)}function ft(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}function ut(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20.978 13.21a1 1 0 0 0-.396-1.024l-14-10a.999.999 0 0 0-1.575.931l2 17a1 1 0 0 0 1.767.516l3.612-4.416 3.377 5.46 1.701-1.052-3.357-5.428 6.089-1.218a.995.995 0 0 0 .782-.769zm-8.674.31a1 1 0 0 0-.578.347l-3.008 3.677L7.257 5.127l10.283 7.345-5.236 1.048z"},child:[]}]})(t)}function dt(t){return S({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z"},child:[]}]})(t)}const L=({children:t,leftIcon:i,rightIcon:o,...c})=>a.jsxs("button",{className:"af-h-9 af-px-4 af-py-2 af-border af-flex af-justify-center af-items-center af-font-medium af-rounded-md af-text-sm hover:af-bg-gray-100 disabled:af-pointer-events-none disabled:af-opacity-50 af-transition-colors",...c,children:[i&&a.jsx("div",{className:"af-mr-3",children:i}),t,o&&a.jsx("div",{className:"af-ml-3",children:o})]}),U=b.forwardRef(({...t},i)=>a.jsx("input",{ref:i,className:"af-h-9 af-w-full af-flex af-border af-px-3 af-py-1 af-text-sm af-shadow-sm af-rounded-md placeholder:text-muted-foreground focus-visible:af-outline-none disabled:af-cursor-not-allowed disabled:af-opacity-50",...t})),M=({icon:t,title:i,text:o})=>a.jsxs("div",{className:"af-flex af-items-center af-space-x-3 af-bg-gray-100 af-px-4 af-py-2 af-rounded-md",children:[t,a.jsxs("div",{className:"af-flex af-flex-col af-items-start",children:[a.jsx("p",{className:"af-text-sm af-text-gray-700 af-font-medium",children:i}),a.jsx("span",{className:"af-font-semibold af-text-lg af-text-gray-700 af-break-all",children:o})]})]}),pt=({status:t})=>{if(t===null)return a.jsx("div",{className:"af-bg-gray-200 text-green-950 af-rounded-full af-px-2 af-py-1 af-text-xs af-font-medium",children:"Not Approved Yet"});if(t)return a.jsx("div",{className:"af-bg-green-300 text-green-950 af-rounded-full af-px-2 af-py-1 af-text-xs af-font-medium",children:"Active"});if(!t)return a.jsx("div",{className:"af-bg-red-300 text-green-950 af-rounded-full af-px-2 af-py-1 af-text-xs af-font-medium",children:"Rejected"})};function oe(t){return S({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"},child:[]}]})(t)}function ht(t){return S({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(t)}function Q(t){return S({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function mt(t){return S({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z"},child:[]}]})(t)}function gt(t){return S({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M109.25 173.25c24.99-24.99 24.99-65.52 0-90.51-24.99-24.99-65.52-24.99-90.51 0-24.99 24.99-24.99 65.52 0 90.51 25 25 65.52 25 90.51 0zm256 165.49c-24.99-24.99-65.52-24.99-90.51 0-24.99 24.99-24.99 65.52 0 90.51 24.99 24.99 65.52 24.99 90.51 0 25-24.99 25-65.51 0-90.51zm-1.94-231.43l-22.62-22.62c-12.5-12.5-32.76-12.5-45.25 0L20.69 359.44c-12.5 12.5-12.5 32.76 0 45.25l22.62 22.62c12.5 12.5 32.76 12.5 45.25 0l274.75-274.75c12.5-12.49 12.5-32.75 0-45.25z"},child:[]}]})(t)}function vt(t){return S({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M323.9 19.81l-55.2 55.15L285 91.24 272.2 104 256 87.73 19.81 323.9l45.57 45.6c28.5-14.6 56.22-11.7 72.52 4.6 16.3 16.3 19.2 44 4.6 72.5l45.6 45.6 236.1-236.1-16.2-16.3 12.8-12.8 16.3 16.2 55.1-55.1-45.6-45.6c-28.5 14.6-56.2 11.7-72.5-4.6-16.3-16.3-19.2-44.02-4.6-72.52zm-16.2 93.99l33.9 34-12.8 12.8-33.9-34zM256 130.2L381.8 256 222.1 415.8 96.16 289.9 249.6 136.5zm0 25.4L121.6 289.9l100.5 100.5L356.4 256zm108.2 14.8l34 33.9-12.8 12.8-34-33.9z"},child:[]}]})(t)}function ke(t){let i=typeof t!="string"?JSON.stringify(t):t;try{i=JSON.parse(i)}catch{return!1}return typeof i=="object"&&i!==null}function Ee(t,i,o){try{if(!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`https://${t}`),!t.includes("."))throw new Error;const c=new URL(t);return c.searchParams.has(i)?t:(c.searchParams.append(i,o),c.href)}catch{return"Please enter a valid URL!"}}function J(t){return 0 .toLocaleString("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).replace(/\d/g,"").trim()}async function _e(t){const i=await fetch(`https://api.afficone.com/v1/public/portal/${t}`);if(i.status===200)return await i.json();throw new Error(await i.text())}async function H(t){if(!t)throw new Error("authToken is undefined.");const i=await fetch("https://api.afficone.com/affiliate/profile",{headers:{Authorization:`Bearer ${t}`}});if(i.status===200)return await i.json();throw new Error(await i.text())}function Ce(){localStorage.removeItem("afficoneAuthToken")}async function Ne({token:t,name:i,email:o,password:c,turnstileToken:n}){if(!t)return{type:"error",value:"No website token supplied."};if(n===null)return{type:"error",value:"Captcha didn't initialize properly. Please try again."};if(!i||!o||!c||i.length===0||o.length===0||c.length===0)return{type:"error",value:"Please enter your name, email and password."};const m=await fetch("https://api.afficone.com/affiliate/signup",{method:"post",body:JSON.stringify({websiteToken:t,name:i,email:o,password:c,promos:!1,token:n}),headers:{"Content-Type":"application/json"}});if(m.status===202){const p=await m.text();return console.log(p),{type:"verification",value:"Please verify your email."}}if(m.status===200)return{type:"success",value:await m.text()};const s=await m.text();return ke(s)?{type:"error",value:JSON.parse(s).status}:{type:"error",value:s}}async function Se({token:t,email:i,password:o,turnstileToken:c}){if(!t)return{type:"error",value:"Captcha didn't initialize properly. Try reloading your browser."};if(c===null)return{type:"error",value:"Captcha didn't initialize properly. Try reloading your browser."};if(!i||!o||i.length===0||o.length===0)return{type:"error",value:"Please enter your email and password."};const n=await fetch("https://api.afficone.com/affiliate/signin",{method:"post",body:JSON.stringify({websiteToken:t,email:i,password:o,token:c}),headers:{"Content-Type":"application/json"}});if(n.status===200){const s=await n.text();return localStorage.setItem("afficoneAuthToken",s),{type:"success",value:s}}const m=await n.text();return ke(m)?{type:"error",value:JSON.parse(m).status}:{type:"error",value:m}}const wt=({authToken:t,token:i,options:o={containerShadow:!0,showLogoInHeader:!0,showDescription:!0,showCallous:!0,showInfoCards:!0}})=>{var T,D;function c(){Ce(),m({...n,loaded:!0,authToken:void 0,profile:null}),p({...s,type:"choice"})}const[n,m]=b.useState({loaded:!1,msg:null,authToken:t,portal:null,profile:null}),[s,p]=b.useState({type:"choice",name:"",email:((T=o.defaultLogin)==null?void 0:T.email)??"",password:((D=o.defaultLogin)==null?void 0:D.password)??"",promos:!0,tos:!1,turnstile:null,error:null,affLink:""});b.useEffect(()=>{const u=_=>{const I=_.data;if(I.startsWith("affi_")){const R=I.replace("affi_","");p({...s,turnstile:R})}};return window.addEventListener("message",_=>u(_)),()=>window.removeEventListener("message",u)},[s]),b.useEffect(()=>{if(n.loaded)return;async function u(){let _=null;if(n.authToken)_=await H(n.authToken);else{const R=localStorage.getItem("afficoneAuthToken");R!==null&&(_=await H(R))}const I=await _e(i);m({...n,loaded:!0,portal:I,profile:_}),_!==null&&p({...s,type:"dashboard",name:"",email:"",password:"",turnstile:null,error:null,affLink:I.url.includes(window.location.host)?`https://${window.location.host}`:I.url})}u()},[]);const w=b.useRef(null);if(!n.loaded||n.portal===null)return a.jsx("div",{className:`af-flex af-justify-center af-text-black af-items-center af-bg-white af-w-96 af-h-128 af-rounded-lg${o.containerShadow?" af-shadow":""}`,children:(o==null?void 0:o.loadingAnimation)??a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"af-animate-spin",children:a.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})});if(!n.portal.active&&!n.portal.demo)return a.jsx("div",{className:`af-bg-white af-text-black af-w-96 af-h-128 af-rounded-lg${o.containerShadow?" af-shadow":""}`,children:a.jsxs("div",{className:"af-flex af-flex-col af-h-full af-justify-center af-items-center",children:[a.jsx(dt,{className:"af-text-4xl af-mb-4"}),a.jsx("p",{className:"af-text-center af-text-lg af-px-16",children:"We are currently not accepting new applications"})]})});if(n.msg!==null)return a.jsx("div",{className:`af-bg-white af-text-black af-w-96 af-h-128 af-rounded-lg${o.containerShadow?" af-shadow":""}`,children:a.jsxs("div",{className:"af-flex af-flex-col af-space-y-4 af-h-full af-justify-center af-items-center",children:[a.jsx(ft,{className:"af-text-4xl"}),a.jsx("p",{className:"af-text-center af-text-lg af-px-16",children:n.msg}),a.jsx(L,{leftIcon:a.jsx(Q,{}),onClick:()=>{p({...s,type:"signin"}),m({...n,msg:null})},children:"Back to login"})]})});async function A(){m({...n,loaded:!1});const u=await Se({token:i,email:s.email,password:s.password,turnstileToken:s.turnstile});if(u.type==="error"){p({...s,error:u.value}),m({...n,loaded:!0});return}m({...n,authToken:t,loaded:!0,profile:await H(u.value)}),p({...s,type:"dashboard",affLink:n.portal.url.includes(window.location.host)?`https://${window.location.host}`:n.portal.url,name:"",email:"",password:"",tos:!1,promos:!0,turnstile:null,error:null})}async function E(){m({...n,loaded:!1});const u=await Ne({token:i,name:s.name,email:s.email,password:s.password,turnstileToken:s.turnstile});if(u.type==="error"){p({...s,error:u.value}),m({...n,loaded:!0});return}if(u.type==="verification"){m({...n,msg:u.value});return}m({...n,authToken:t,loaded:!0,profile:await H(u.value)}),p({...s,type:"dashboard",affLink:n.portal.url.includes(window.location.host)?`https://${window.location.host}`:n.portal.url,name:"",email:"",password:"",tos:!1,promos:!0,turnstile:null,error:null})}if(n.profile===null)return a.jsx("div",{className:`af-bg-white af-text-black af-w-96 af-h-128 af-rounded-lg af-overflow-hidden${o.containerShadow?" af-shadow":""}`,children:s.type==="choice"?a.jsxs("div",{className:"af-relative af-flex af-flex-col af-h-full",children:[a.jsx("div",{style:{background:n.portal.media.background.useImage?`url(${n.portal.media.background.image})`:n.portal.media.background.color,backgroundRepeat:n.portal.media.background.backgroundRepeat,backgroundSize:n.portal.media.background.backgroundSize},className:"af-h-1/4"}),a.jsxs("div",{className:"af-h-3/4 af-p-4 af-flex af-flex-col af-space-y-2 af-items-center af-text-center",children:[a.jsxs("div",{className:"af-flex af-items-center af-space-x-2",children:[n.portal.media.logo&&a.jsx("img",{alt:"",src:n.portal.media.logo,className:"af-rounded-md",width:32,height:32}),a.jsx("p",{className:"af-text-2xl af-font-semibold",children:n.portal.name})]}),a.jsxs("div",{className:"af-flex af-flex-col af-w-full af-h-full",children:[a.jsxs("div",{className:"af-flex af-flex-col af-space-y-4 af-flex-1",children:[o.showDescription!==!1&&a.jsx("p",{className:"af-text-lg af-font-medium",children:n.portal.description}),o.customContent,o.showInfoCards!==!1&&a.jsxs("div",{className:"af-grid af-grid-cols-2 af-gap-4",children:[a.jsx(M,{icon:a.jsx(ie,{}),title:"Minimum Payout",text:n.portal.minimumBalance}),a.jsx(M,{icon:a.jsx(gt,{}),title:"Commission",text:n.portal.commissions.type===0?`${n.portal.commissions.amount}%`:n.portal.commissions.applyIndividual?`${n.portal.commissions.amount} / item`:`${J(n.portal.currency)}${n.portal.commissions.amount}`})]}),o.showCallous!==!1&&a.jsx("div",{className:"af-flex af-flex-col af-items-start text-start af-space-y-1",children:n.portal.callouts.map((u,_)=>a.jsx("li",{children:u},_))})]}),n.portal.useWatermark?a.jsxs("div",{className:"af-flex af-items-end af-justify-between",children:[a.jsxs("div",{className:"af-flex af-flex-col af-items-start af-space-y-1",children:[a.jsx("span",{className:"af-text-xs af-font-semibold",children:"Powered by"}),a.jsx("img",{alt:"Afficone logo",src:"https://api.afficone.com/cdn/static/header.png",className:"af-h-5"})]}),a.jsx(L,{onClick:()=>p({...s,type:"signin"}),rightIcon:a.jsx(oe,{}),children:"Continue"})]}):a.jsx("div",{className:"af-flex af-items-end af-justify-end",children:a.jsx(L,{onClick:()=>p({...s,type:"signin"}),rightIcon:a.jsx(oe,{}),children:"Continue"})})]})]})]}):a.jsxs("div",{className:"af-flex af-flex-col af-items-stretch af-h-full",children:[a.jsxs("div",{className:"affi-header af-w-full af-flex af-items-center af-justify-between af-p-4",children:[a.jsxs("div",{className:"af-flex af-items-center af-space-x-2",children:[a.jsx(L,{onClick:()=>p({...s,type:"choice",error:null}),className:"hover:af-bg-gray-100 af-rounded-md af-p-1 af-border-none af-transition-colors me-2",children:a.jsx(Q,{className:"af-text-sm"})}),o.showLogoInHeader!==!1&&n.portal.media.logo&&a.jsx("img",{alt:"",src:n.portal.media.logo,width:26,height:26}),a.jsx("p",{className:"af-text-xl af-font-semibold",children:s.type==="signin"?"Welcome back":"Create an account"})]}),a.jsx("div",{className:"af-bg-green-300 text-green-950 af-rounded-full af-px-2 af-py-1 af-text-xs af-font-medium",children:"Active"})]}),a.jsxs("div",{className:"affi-main af-flex af-flex-col af-space-y-3 af-flex-1 af-px-4 af-overflow-auto",children:[s.type==="signup"&&a.jsxs("div",{className:"af-flex af-flex-col af-space-y-2",children:[a.jsx("p",{className:"af-text-sm",children:"Name"}),a.jsx(U,{placeholder:"Name",value:s.name,onChange:u=>p({...s,name:u.target.value})})]}),a.jsxs("div",{className:"af-flex af-flex-col af-space-y-2",children:[a.jsx("p",{className:"af-text-sm",children:"Email"}),a.jsx(U,{placeholder:"Email",value:s.email,onChange:u=>p({...s,email:u.target.value})})]}),a.jsxs("div",{className:"af-flex af-flex-col af-space-y-2",children:[a.jsx("p",{className:"af-text-sm",children:"Password"}),a.jsx(U,{placeholder:"••••••••",type:"password",value:s.password,onChange:u=>p({...s,password:u.target.value})})]}),s.type==="signup"&&a.jsxs("div",{className:"af-flex af-space-x-2",children:[a.jsx(U,{id:"tos",className:"",type:"checkbox",value:s.email,onChange:u=>p({...s,tos:u.target.checked})}),a.jsx("label",{htmlFor:"tos",className:"af-text-sm af-select-none",children:"I agree to the Terms of Service"})]}),s.error&&a.jsx("p",{className:"af-font-medium af-text-red-500",children:s.error}),a.jsx("iframe",{width:300,height:65,src:"https://afficone.com/turnstile-iframe"})]}),a.jsxs("div",{className:"affi-footer af-w-full af-flex af-items-center af-justify-between af-p-4",children:[a.jsx("button",{onClick:()=>p({...s,type:s.type==="signin"?"signup":"signin",error:null}),className:"text-md af-font-medium",children:s.type==="signin"?"Don't have an account?":"Have an account?"}),a.jsx(L,{disabled:s.type==="signup"&&(s.name.length===0||!s.tos)||s.password.length===0||!/^([\w.-]+)@([\w-]+)((\.(\w){2,})+)$/.test(s.email),onClick:s.type==="signin"?A:E,rightIcon:a.jsx(oe,{}),children:"Continue"})]})]})});async function P(){const u=Ee(s.affLink,n.portal.trackingParameter,n.profile.coupon);await navigator.clipboard.writeText(u),w.current.focus(),p({...s,affLink:u}),w.current.select()}return a.jsx("div",{className:`af-bg-white af-text-black af-w-96 af-h-128 af-rounded-lg af-overflow-hidden${o.containerShadow?" af-shadow":""}`,children:a.jsxs("div",{className:"af-flex af-flex-col af-items-stretch af-h-full",children:[a.jsxs("div",{className:"affi-header af-w-full af-flex af-items-center af-justify-between af-p-4",children:[a.jsx(L,{onClick:s.type==="dashboard"?c:()=>p({...s,type:"dashboard"}),className:"hover:af-bg-gray-100 af-rounded-md af-p-1 af-border-none af-transition-colors",children:a.jsx(Q,{className:"af-text-sm"})}),a.jsxs("div",{className:"af-flex af-items-center af-space-x-2",children:[o.showLogoInHeader!==!1&&n.portal.media.logo&&a.jsx("img",{alt:"",src:n.portal.media.logo,width:26,height:26}),a.jsx("p",{className:"af-text-xl af-font-semibold",children:n.profile.name})]}),a.jsx(pt,{status:n.profile.approved})]}),s.type==="dashboard"?a.jsxs("div",{className:"affi-main af-flex-1 af-flex af-flex-col af-space-y-3 af-px-4",children:[a.jsxs("div",{className:"af-grid af-grid-cols-2 af-gap-4",children:[a.jsx(M,{icon:a.jsx(ie,{}),title:"Balance",text:`${J(n.portal.currency)}${n.profile.stats.balance}`}),a.jsx(M,{icon:a.jsx(lt,{}),title:"Orders",text:n.profile.stats.orders}),a.jsx(M,{icon:a.jsx(ut,{}),title:"Clicks",text:n.profile.stats.clicks}),a.jsx(M,{icon:a.jsx(vt,{}),title:"Coupon",text:n.profile.coupon})]}),a.jsxs("div",{className:"af-flex af-flex-col af-space-y-1",children:[a.jsx("p",{className:"af-font-medium",children:"Affiliate link:"}),a.jsxs("div",{className:"af-flex af-space-x-2",children:[a.jsx(U,{ref:w,value:s.affLink,onChange:u=>p({...s,affLink:u.target.value})}),a.jsx(L,{onClick:P,children:"Generate"})]})]}),a.jsx("div",{className:"af-flex af-flex-col af-space-y-1",children:a.jsxs("p",{className:"af-font-medium",children:["Commission: ",n.profile.commissions.type===0?`${n.profile.commissions.amount}% per order`:n.profile.commissions.applyIndividual?`${n.profile.commissions.amount} per item`:`${J(n.portal.currency)}${n.profile.commissions.amount} per order`]})})]}):a.jsx("div",{className:"affi-main af-flex-1 af-flex af-flex-col af-space-y-3 af-px-4 af-overflow-y-auto",children:n.profile.payouts.length>0?n.profile.payouts.map(u=>{var _;return a.jsxs("div",{className:"af-bg-gray-100 af-p-4 af-flex af-justify-between af-rounded-md",children:[a.jsxs("div",{className:"af-flex af-items-center af-space-x-4",children:[u.paid?a.jsx(ht,{className:"af-text-green-500"}):a.jsx(mt,{className:"af-text-gray-500"}),a.jsxs("div",{className:"af-flex af-flex-col af-space-y-1",children:[a.jsxs("p",{children:[(_=u.orders)==null?void 0:_.length," orders"]}),a.jsx("p",{className:"af-text-sm af-text-gray-700",children:new Date(u.updatedAt?u.updatedAt:u.createdAt).toLocaleString()})]})]}),a.jsxs("span",{className:"af-text-2xl",children:[J(n.portal.currency),u.amount]})]},u.id)}):a.jsx("p",{className:"af-text-center af-py-16",children:"You don't have any payouts."})}),s.type==="dashboard"&&a.jsxs("div",{className:"affi-footer af-w-full af-flex af-items-center af-p-4 af-justify-between",children:[a.jsx(L,{onClick:()=>p({...s,type:"payouts"}),leftIcon:s.type==="dashboard"?a.jsx(ie,{}):a.jsx(Q,{}),children:"Payouts"}),a.jsx(L,{onClick:()=>navigator.clipboard.writeText(s.affLink),disabled:s.affLink.length>0&&!s.affLink.includes(`${n.portal.trackingParameter}=${n.profile.coupon}`),leftIcon:a.jsx(ct,{}),children:"Copy Link"})]})]})})},xt=t=>{var o;const i=`https://afficone.com/scripts/sdk.js?token=${t.token}`;return a.jsxs(a.Fragment,{children:[t.children,(o=t==null?void 0:t.options)!=null&&o.nextScript?a.jsx(t.options.nextScript,{async:!0,src:i,strategy:"lazyOnload"}):a.jsx("script",{async:!0,src:i})]})};k.AffiliatePortal=wt,k.AffiliateTrackingProvider=xt,k.createAccount=Ne,k.generateAffiliateLink=Ee,k.getCurrencySymbol=J,k.getPortalData=_e,k.getProfile=H,k.logout=Ce,k.retrieveAuthToken=Se,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});