1import{aD as E}from"./BrSRS2Es.js";const P=/^(?=.{1,254}$)(?=.{1,64}@)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i,y=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,g=/^[A-Za-z0-9_-]{1,50}$/,k=Object.freeze(["utm_source","utm_medium","utm_campaign","utm_content","plugin_uuid","whatsapp_number","install_time","version","feature_key","entry_source","paywall_trigger","preview_entry_source","license_entry_source","source_page","source_url","billing_cycle"]);function f(e){return`${(Array.isArray(e)?e[0]:e)||""}`.trim()}function s(e,t){return`${e?.message||e?.data?.message||t}`.trim()}function m(e,t="Enter a valid transaction ID."){const r=`${e||""}`.trim();if(!y.test(r))throw new Error(t);return r}function w(e){const t=`${e||""}`.trim();try{if(new URL(t).protocol!=="https:")throw new Error("invalid protocol")}catch{throw new Error("The server did not return a secure checkout URL.")}return t}function T(e){return`${e||""}`.trim().toLowerCase().replace(/[^a-z0-9]/g,"").endsWith("email")}function R(e){const t=f(e?.transaction_id);if(t)return y.test(t)?{kind:"prepared",transactionId:t}:{kind:"invalid"};const r=f(e?.plan_code);if(g.test(r))try{return{kind:"email",planCode:r,paymentMethod:p(e?.payment_method)}}catch{return{kind:"invalid"}}return{kind:"invalid"}}function p(e){if(typeof e>"u")return"card";if(e==="card"||e==="local")return e;throw new Error("Unsupported payment method.")}function _(e){const t=`${e||""}`.trim().toLowerCase();if(t.length>254||!P.test(t))throw new Error("Enter a valid email address.");return t}function x(e){const t=`${e?.planCode||""}`.trim();if(!g.test(t))throw new Error("Choose a valid plan before continuing.");return{uuid:m(e?.uuid,"Enter a valid checkout UUID."),plan_code:t,email:_(e?.email),whatsapp_number:`${e?.whatsappNumber||""}`.trim(),payment_method:p(e?.paymentMethod)}}function I(e=A){let t=null;return{build(r){const n=`${r?.planCode||""}`.trim();if(!g.test(n))throw new Error("Choose a valid plan before continuing.");const a=_(r?.email),c=`${r?.whatsappNumber||""}`.trim(),u=p(r?.paymentMethod),l=JSON.stringify([n,a,c,u]);if(t?.fingerprint===l)return t.request;const d=x({uuid:e(),planCode:n,email:a,whatsappNumber:c,paymentMethod:u});return t={fingerprint:l,request:d},d},clear(){t=null}}}function j(e){if(e?.code!==1e5)throw new Error(s(e,"The checkout could not be prepared."));return m(e?.data?.transaction_id,"The server did not return a valid transaction.")}function q(e){return{transaction_id:m(e)}}function U(e){if(e?.code!==1e5)throw new Error(s(e,"The payment page could not be created."));return w(e?.data?.checkout_url)}function K(e){if(e?.code===1e5)try{return{kind:"success",checkoutUrl:U(e)}}catch(t){return{kind:"permanent",message:t instanceof Error?t.message:"The payment page could not be created."}}return e?.code===200012||e?.data?.retryable===!0?{kind:"processing",message:s(e,"Your payment page is still being prepared. Please check again shortly.")}:{kind:"permanent",message:s(e,"The payment page could not be created.")}}function D(e){return{kind:"retryable",message:e instanceof Error&&e.message.trim()?e.message:"The payment page could not be created. Please try again."}}function Y(e){return e?.kind==="retryable"}async function F(e,t,r={}){const n=m(e);if(typeof t!="function")throw new TypeError("Checkout polling requires a request handler.");const a=Number(r.maxAttempts),c=Number.isFinite(a)?Math.max(1,Math.floor(a)):1,u=Number(r.intervalMs),l=Number.isFinite(u)?Math.max(0,u):0,d=typeof r.wait=="function"?r.wait:o=>new Promise(i=>setTimeout(i,o)),h=typeof r.shouldContinue=="function"?r.shouldContinue:()=>!0;let C=null;for(let o=1;o<=c;o+=1){if(!h())return{kind:"cancelled"};const i=await t(n);if(!h())return{kind:"cancelled"};if(i?.kind!=="processing")return i;if(C=i,typeof r.onProcessing=="function"&&r.onProcessing(i,o),o<c&&(await d(l),!h()))return{kind:"cancelled"}}return{kind:"retryable",message:C?.message||"Your payment page is still being prepared. Please try again."}}function V(e){if(e?.kind!=="success")throw new Error("A successful checkout is required before navigation.");return{to:w(e.checkoutUrl),options:{external:!0,replace:!0}}}function A(e=globalThis.crypto){const t=typeof e?.randomUUID=="function"?e.randomUUID():"";if(y.test(t))return t.toLowerCase();if(typeof e?.getRandomValues!="function")throw new Error("A secure random source is required to start checkout.");
1const r=new Uint8Array(16);e.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;const n=[...r].map(a=>a.toString(16).padStart(2,"0"));return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10,16).join("")].join("-")}function N(e){let t=null;return(...r)=>t||(t=Promise.resolve().then(()=>e(...r)).finally(()=>{t=null}),t)}function G({submit:e,cancel:t}){if(typeof e!="function"||typeof t!="function")throw new TypeError("Checkout form actions require submit and cancel handlers.");const r=N(e);return{submit:r,enter:r,cancel:(...n)=>t(...n)}}function $(){return[...k]}function O(e){const t={};for(const r of k){const n=f(e?.[r]);n&&(t[r]=n)}return t}function M(e){const t={};for(const[r,n]of Object.entries(e||{})){if(T(r))continue;const a=f(n);a&&(t[r]=a)}return t}function Q(e){const t=`${e?.data?.active_code||""}`.trim();if(e?.code===1e5&&t){const r=Number(e?.data?.max_whatsapp);return{kind:"success",activeCode:t,maxWhatsapp:Number.isFinite(r)&&r>0?r:1}}return e?.code===200014||e?.data?.retryable===!0?{kind:"processing"}:{kind:"failed",message:s(e,"The activation result could not be recovered.")}}const v="wa_privacy_checkout_log_context_v1",L=50;function b(){try{const e=window.localStorage.getItem(v);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function S(e){try{const t=Object.entries(e).slice(-L);window.localStorage.setItem(v,JSON.stringify(Object.fromEntries(t)))}catch{}}function X(){return $()}function H(e=E()){return O(e.query)}function J(e,t){const r=`${e||""}`.trim();if(!r)return;const n=M(t),a=b();a[r]=n,S(a)}function W(e){const t=`${e||""}`.trim();return t?b()[t]||{}:{}}export{I as a,W as b,N as c,Q as d,G as e,R as f,H as g,X as h,D as i,Y as j,V as k,q as l,K as m,F as p,j as r,J as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.