/*! For license information please see pixel.js.LICENSE.txt */
(()=>{var t,e={138(t,e,i){"use strict";var n=i(8287).hp;Object.defineProperty(e,"__esModule",{value:!0}),e.isObject=e.getDefaultContentHeader=void 0,e.parsePublicKeyIfEncoded=function(t){return t.includes("\n")||t.includes("\r")?t.trim():"undefined"!=typeof atob?atob(t):n.from(t,"base64").toString("utf-8")};e.getDefaultContentHeader=t=>t?.method&&["post","put","patch"].includes(t.method.toLocaleLowerCase())&&t.body?{"Content-Type":"application/json"}:{};e.isObject=t=>t&&"object"==typeof t&&!Array.isArray(t)},237(t,e){"use strict";var i,n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenRole=e.LoginState=void 0,function(t){t.SUCCESS="SUCCESS",t.INITIAL="INITIAL",t.FAILURE="FAILURE",t.EMAIL_VERIFICATION_REQUIRED="EMAIL_VERIFICATION_REQUIRED",t.OWNER_APPROVAL_REQUIRED="OWNER_APPROVAL_REQUIRED",t.USER_CAPTCHA_REQUIRED="USER_CAPTCHA_REQUIRED",t.SILENT_CAPTCHA_REQUIRED="SILENT_CAPTCHA_REQUIRED"}(i||(e.LoginState=i={})),function(t){t.NONE="none",t.VISITOR="visitor",t.MEMBER="member"}(n||(e.TokenRole=n={}))},251(t,e){e.read=function(t,e,i,n,o){var a,r,p=8*o-n-1,s=(1<
>1,c=-7,l=i?o-1:0,u=i?-1:1,_=t[e+l];for(l+=u,a=_&(1<<-c)-1,_>>=-c,c+=p;c>0;a=256*a+t[e+l],l+=u,c-=8);for(r=a&(1<<-c)-1,a>>=-c,c+=n;c>0;r=256*r+t[e+l],l+=u,c-=8);if(0===a)a=1-d;else{if(a===s)return r?NaN:1/0*(_?-1:1);r+=Math.pow(2,n),a-=d}return(_?-1:1)*r*Math.pow(2,a-n)},e.write=function(t,e,i,n,o,a){var r,p,s,d=8*a-o-1,c=(1<>1,u=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:a-1,h=n?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,r=c):(r=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-r))<1&&(r--,s*=2),(e+=r+l>=1?u/s:u*Math.pow(2,1-l))*s>=2&&(r++,s/=2),r+l>=c?(p=0,r=c):r+l>=1?(p=(e*s-1)*Math.pow(2,o),r+=l):(p=e*Math.pow(2,l-1)*Math.pow(2,o),r=0));o>=8;t[i+_]=255&p,_+=h,p/=256,o-=8);for(r=r<0;t[i+_]=255&r,_+=h,r/=256,d-=8);t[i+_-h]|=128*f}},274(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ServicePluginDefinition=e.EventDefinition=void 0,e.contextualizeHostModuleV2=function(t,e){return{...t,...Object.fromEntries(e.map(e=>[e,(...i)=>{const n=(0,o.resolveContext)();if(!n)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return n.initWixModules(t)[e].apply(void 0,i)}]))}},e.contextualizeRESTModuleV2=function(t,e){return(...i)=>{const n=(0,o.resolveContext)();return n?n.initWixModules(t,e).apply(void 0,i):t.apply(void 0,i)}},e.contextualizeEventDefinitionModuleV2=function(t){const e=(...e)=>{const i=(0,o.resolveContext)();return i?i.initWixModules(t).apply(void 0,e):()=>({slug:t.type})};return e.__type=t.__type,e.type=t.type,e.isDomainEvent=t.isDomainEvent,e.transformations=t.transformations,e},e.contextualizeSerivcePluginModuleV2=function(t){const e=(...e)=>{const i=(0,o.resolveContext)();return i?i.initWixModules(t).apply(void 0,e):()=>{}};return e.__type=t.__type,e.componentType=t.componentType,e.methods=t.methods,e};const n=i(8382);Object.defineProperty(e,"EventDefinition",{enumerable:!0,get:function(){return n.EventDefinition}}),Object.defineProperty(e,"ServicePluginDefinition",{enumerable:!0,get:function(){return n.ServicePluginDefinition}});const o=i(2877)},358(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isAmbassadorModule=e.toHTTPModule=void 0;const i=t=>{switch(t){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${t}`)}};e.toHTTPModule=t=>e=>async n=>{let o;const a=e=>{if(o=t(n)(e),void 0===o.url)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");const{method:a,url:r,params:p}=o;return{...o,method:i(a),url:r,data:o.data,params:p}};try{const t=await e.request(a);if(void 0===o)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");const i=Array.isArray(o.transformResponse)?o.transformResponse:[o.transformResponse];let n=t.data;return i.forEach(e=>{e&&(n=e(t.data,t.headers))}),n}catch(t){if("object"==typeof t&&null!==t&&"response"in t&&"object"==typeof t.response&&null!==t.response&&"data"in t.response)throw t.response.data;throw t}};e.isAmbassadorModule=t=>{if(t.__isAmbassador)return!0;const e=t();return Boolean(e.__isAmbassador)}},359(){},414(){},533(t,e,i){"use strict";i.r(e),i.d(e,{CompactEncrypt:()=>me,CompactSign:()=>ye,EmbeddedJWK:()=>Pe,EncryptJWT:()=>je,FlattenedEncrypt:()=>Zt,FlattenedSign:()=>we,GeneralEncrypt:()=>ee,GeneralSign:()=>be,SignJWT:()=>Te,UnsecuredJWT:()=>He,base64url:()=>o,calculateJwkThumbprint:()=>Ae,calculateJwkThumbprintUri:()=>xe,compactDecrypt:()=>Bt,compactVerify:()=>re,createLocalJWKSet:()=>Oe,createRemoteJWKSet:()=>Ue,cryptoRuntime:()=>Je,decodeJwt:()=>Be,decodeProtectedHeader:()=>$e,errors:()=>n,experimental_jwksCache:()=>Fe,exportJWK:()=>Yt,exportPKCS8:()=>qt,exportSPKI:()=>Jt,flattenedDecrypt:()=>$t,flattenedVerify:()=>ae,generalDecrypt:()=>Gt,generalVerify:()=>pe,generateKeyPair:()=>ze,generateSecret:()=>Ve,importJWK:()=>Rt,importPKCS8:()=>Qt,importSPKI:()=>Ct,importX509:()=>It,jwksCache:()=>Me,jwtDecrypt:()=>fe,jwtVerify:()=>he});var n={};i.r(n),i.d(n,{JOSEAlgNotAllowed:()=>S,JOSEError:()=>v,JOSENotSupported:()=>T,JWEDecryptionFailed:()=>j,JWEInvalid:()=>k,JWKInvalid:()=>P,JWKSInvalid:()=>C,JWKSMultipleMatchingKeys:()=>Q,JWKSNoMatchingKey:()=>I,JWKSTimeout:()=>R,JWSInvalid:()=>A,JWSSignatureVerificationFailed:()=>O,JWTClaimValidationFailed:()=>b,JWTExpired:()=>E,JWTInvalid:()=>x});var o={};i.r(o),i.d(o,{decode:()=>Ke,encode:()=>We});const a=crypto,r=t=>t instanceof CryptoKey,p=async(t,e)=>{const i=`SHA-${t.slice(-3)}`;return new Uint8Array(await a.subtle.digest(i,e))},s=new TextEncoder,d=new TextDecoder,c=2**32;function l(...t){const e=t.reduce((t,{length:e})=>t+e,0),i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.length;return i}function u(t,e,i){if(e<0||e>=c)throw new RangeError(`value must be >= 0 and <= 4294967295. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,255&e],i)}function _(t){const e=Math.floor(t/c),i=t%c,n=new Uint8Array(8);return u(n,e,0),u(n,i,4),n}function h(t){const e=new Uint8Array(4);return u(e,t),e}function f(t){return l(h(t.length),t)}const m=t=>{let e=t;"string"==typeof e&&(e=s.encode(e));const i=[];for(let t=0;tm(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),w=t=>{const e=atob(t),i=new Uint8Array(e.length);for(let t=0;t{let e=t;e instanceof Uint8Array&&(e=d.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return w(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class v extends Error{constructor(t,e){super(t,e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}v.code="ERR_JOSE_GENERIC";class b extends v{constructor(t,e,i="unspecified",n="unspecified"){super(t,{cause:{claim:i,reason:n,payload:e}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=i,this.reason=n,this.payload=e}}b.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class E extends v{constructor(t,e,i="unspecified",n="unspecified"){super(t,{cause:{claim:i,reason:n,payload:e}}),this.code="ERR_JWT_EXPIRED",this.claim=i,this.reason=n,this.payload=e}}E.code="ERR_JWT_EXPIRED";class S extends v{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}S.code="ERR_JOSE_ALG_NOT_ALLOWED";class T extends v{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}T.code="ERR_JOSE_NOT_SUPPORTED";class j extends v{constructor(t="decryption operation failed",e){super(t,e),this.code="ERR_JWE_DECRYPTION_FAILED"}}j.code="ERR_JWE_DECRYPTION_FAILED";class k extends v{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}k.code="ERR_JWE_INVALID";class A extends v{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}A.code="ERR_JWS_INVALID";class x extends v{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}x.code="ERR_JWT_INVALID";class P extends v{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}P.code="ERR_JWK_INVALID";class C extends v{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}C.code="ERR_JWKS_INVALID";class I extends v{constructor(t="no applicable key found in the JSON Web Key Set",e){super(t,e),this.code="ERR_JWKS_NO_MATCHING_KEY"}}I.code="ERR_JWKS_NO_MATCHING_KEY";class Q extends v{constructor(t="multiple matching keys found in the JSON Web Key Set",e){super(t,e),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Symbol.asyncIterator,Q.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class R extends v{constructor(t="request timed out",e){super(t,e),this.code="ERR_JWKS_TIMEOUT"}}R.code="ERR_JWKS_TIMEOUT";class O extends v{constructor(t="signature verification failed",e){super(t,e),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}O.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";const D=a.getRandomValues.bind(a);function N(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new T(`Unsupported JWE Algorithm: ${t}`)}}const M=(t,e)=>{if(e.length<<3!==N(t))throw new k("Invalid Initialization Vector length")},L=(t,e)=>{const i=t.byteLength<<3;if(i!==e)throw new k(`Invalid Content Encryption Key length. Expected ${e} bits, got ${i} bits`)},U=(t,e)=>{if(!(t instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(e instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");if(t.length!==e.length)throw new TypeError("Input buffers must have the same length");const i=t.length;let n=0,o=-1;for(;++ot.usages.includes(e))){let t="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const i=e.pop();t+=`one of ${e.join(", ")}, or ${i}.`}else 2===e.length?t+=`one of ${e[0]} or ${e[1]}.`:t+=`${e[0]}.`;throw new TypeError(t)}}function $(t,e,...i){switch(e){case"HS256":case"HS384":case"HS512":{if(!H(t.algorithm,"HMAC"))throw F("HMAC");const i=parseInt(e.slice(2),10);if(W(t.algorithm.hash)!==i)throw F(`SHA-${i}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!H(t.algorithm,"RSASSA-PKCS1-v1_5"))throw F("RSASSA-PKCS1-v1_5");const i=parseInt(e.slice(2),10);if(W(t.algorithm.hash)!==i)throw F(`SHA-${i}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!H(t.algorithm,"RSA-PSS"))throw F("RSA-PSS");const i=parseInt(e.slice(2),10);if(W(t.algorithm.hash)!==i)throw F(`SHA-${i}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==t.algorithm.name&&"Ed448"!==t.algorithm.name)throw F("Ed25519 or Ed448");break;case"Ed25519":if(!H(t.algorithm,"Ed25519"))throw F("Ed25519");break;case"ES256":case"ES384":case"ES512":{if(!H(t.algorithm,"ECDSA"))throw F("ECDSA");const i=function(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(e);if(t.algorithm.namedCurve!==i)throw F(i,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}K(t,i)}function B(t,e,...i){switch(e){case"A128GCM":case"A192GCM":case"A256GCM":{if(!H(t.algorithm,"AES-GCM"))throw F("AES-GCM");const i=parseInt(e.slice(1,4),10);if(t.algorithm.length!==i)throw F(i,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!H(t.algorithm,"AES-KW"))throw F("AES-KW");const i=parseInt(e.slice(1,4),10);if(t.algorithm.length!==i)throw F(i,"algorithm.length");break}case"ECDH":switch(t.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw F("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!H(t.algorithm,"PBKDF2"))throw F("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!H(t.algorithm,"RSA-OAEP"))throw F("RSA-OAEP");const i=parseInt(e.slice(9),10)||1;if(W(t.algorithm.hash)!==i)throw F(`SHA-${i}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}K(t,i)}function G(t,e,...i){if((i=i.filter(Boolean)).length>2){const e=i.pop();t+=`one of type ${i.join(", ")}, or ${e}.`}else 2===i.length?t+=`one of type ${i[0]} or ${i[1]}.`:t+=`of type ${i[0]}.`;return null==e?t+=` Received ${e}`:"function"==typeof e&&e.name?t+=` Received function ${e.name}`:"object"==typeof e&&null!=e&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}const z=(t,...e)=>G("Key must be ",t,...e);function V(t,e,...i){return G(`Key for the ${t} algorithm must be `,e,...i)}const J=t=>!!r(t)||"KeyObject"===t?.[Symbol.toStringTag],q=["CryptoKey"];const Y=async(t,e,i,n,o,p)=>{if(!(r(e)||e instanceof Uint8Array))throw new TypeError(z(e,...q,"Uint8Array"));if(!n)throw new k("JWE Initialization Vector missing");if(!o)throw new k("JWE Authentication Tag missing");switch(M(t,n),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return e instanceof Uint8Array&&L(e,parseInt(t.slice(-3),10)),async function(t,e,i,n,o,r){if(!(e instanceof Uint8Array))throw new TypeError(z(e,"Uint8Array"));const p=parseInt(t.slice(1,4),10),s=await a.subtle.importKey("raw",e.subarray(p>>3),"AES-CBC",!1,["decrypt"]),d=await a.subtle.importKey("raw",e.subarray(0,p>>3),{hash:"SHA-"+(p<<1),name:"HMAC"},!1,["sign"]),c=l(r,n,i,_(r.length<<3)),u=new Uint8Array((await a.subtle.sign("HMAC",d,c)).slice(0,p>>3));let h,f;try{h=U(o,u)}catch{}if(!h)throw new j;try{f=new Uint8Array(await a.subtle.decrypt({iv:n,name:"AES-CBC"},s,i))}catch{}if(!f)throw new j;return f}(t,e,i,n,o,p);case"A128GCM":case"A192GCM":case"A256GCM":return e instanceof Uint8Array&&L(e,parseInt(t.slice(1,4),10)),async function(t,e,i,n,o,r){let p;e instanceof Uint8Array?p=await a.subtle.importKey("raw",e,"AES-GCM",!1,["decrypt"]):(B(e,t,"decrypt"),p=e);try{return new Uint8Array(await a.subtle.decrypt({additionalData:r,iv:n,name:"AES-GCM",tagLength:128},p,l(i,o)))}catch{throw new j}}(t,e,i,n,o,p);default:throw new T("Unsupported JWE Content Encryption Algorithm")}},X=(...t)=>{const e=t.filter(Boolean);if(0===e.length||1===e.length)return!0;let i;for(const t of e){const e=Object.keys(t);if(i&&0!==i.size)for(const t of e){if(i.has(t))return!1;i.add(t)}else i=new Set(e)}return!0};function Z(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||"[object Object]"!==Object.prototype.toString.call(t))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}const tt=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]];function et(t,e){if(t.algorithm.length!==parseInt(e.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${e}`)}function it(t,e,i){if(r(t))return B(t,e,i),t;if(t instanceof Uint8Array)return a.subtle.importKey("raw",t,"AES-KW",!0,[i]);throw new TypeError(z(t,...q,"Uint8Array"))}const nt=async(t,e,i)=>{const n=await it(e,t,"wrapKey");et(n,t);const o=await a.subtle.importKey("raw",i,...tt);return new Uint8Array(await a.subtle.wrapKey("raw",o,n,"AES-KW"))},ot=async(t,e,i)=>{const n=await it(e,t,"unwrapKey");et(n,t);const o=await a.subtle.unwrapKey("raw",i,n,"AES-KW",...tt);return new Uint8Array(await a.subtle.exportKey("raw",o))};async function at(t,e,i,n,o=new Uint8Array(0),d=new Uint8Array(0)){if(!r(t))throw new TypeError(z(t,...q));if(B(t,"ECDH"),!r(e))throw new TypeError(z(e,...q));B(e,"ECDH","deriveBits");const c=l(f(s.encode(i)),f(o),f(d),h(n));let u;u="X25519"===t.algorithm.name?256:"X448"===t.algorithm.name?448:Math.ceil(parseInt(t.algorithm.namedCurve.substr(-3),10)/8)<<3;return async function(t,e,i){const n=Math.ceil((e>>3)/32),o=new Uint8Array(32*n);for(let e=0;e>3)}(new Uint8Array(await a.subtle.deriveBits({name:t.algorithm.name,public:t},e,u)),n,c)}function rt(t){if(!r(t))throw new TypeError(z(t,...q));return["P-256","P-384","P-521"].includes(t.algorithm.namedCurve)||"X25519"===t.algorithm.name||"X448"===t.algorithm.name}async function pt(t,e,i,n){!function(t){if(!(t instanceof Uint8Array)||t.length<8)throw new k("PBES2 Salt Input must be 8 or more octets")}(t);const o=function(t,e){return l(s.encode(t),new Uint8Array([0]),e)}(e,t),p=parseInt(e.slice(13,16),10),d={hash:`SHA-${e.slice(8,11)}`,iterations:i,name:"PBKDF2",salt:o},c={length:p,name:"AES-KW"},u=await function(t,e){if(t instanceof Uint8Array)return a.subtle.importKey("raw",t,"PBKDF2",!1,["deriveBits"]);if(r(t))return B(t,e,"deriveBits","deriveKey"),t;throw new TypeError(z(t,...q,"Uint8Array"))}(n,e);if(u.usages.includes("deriveBits"))return new Uint8Array(await a.subtle.deriveBits(d,u,p));if(u.usages.includes("deriveKey"))return a.subtle.deriveKey(d,u,c,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}function st(t){switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new T(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}const dt=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){const{modulusLength:i}=e.algorithm;if("number"!=typeof i||i<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}};function ct(t){return Z(t)&&"string"==typeof t.kty}const lt=async t=>{if(!t.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:e,keyUsages:i}=function(t){let e,i;switch(t.kty){case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},i=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},i=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},i=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new T('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},i=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},i=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},i=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},i=t.d?["deriveBits"]:[];break;default:throw new T('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(t.alg){case"Ed25519":e={name:"Ed25519"},i=t.d?["sign"]:["verify"];break;case"EdDSA":e={name:t.crv},i=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},i=t.d?["deriveBits"]:[];break;default:throw new T('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new T('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:i}}(t),n=[e,t.ext??!1,t.key_ops??i],o={...t};return delete o.alg,delete o.use,a.subtle.importKey("jwk",o,...n)},ut=t=>y(t);let _t,ht;const ft=t=>"KeyObject"===t?.[Symbol.toStringTag],mt=async(t,e,i,n,o=!1)=>{let a=t.get(e);if(a?.[n])return a[n];const r=await lt({...i,alg:n});return o&&Object.freeze(e),a?a[n]=r:t.set(e,{[n]:r}),r},gt=(t,e)=>{if(ft(t)){let i=t.export({format:"jwk"});return delete i.d,delete i.dp,delete i.dq,delete i.p,delete i.q,delete i.qi,i.k?ut(i.k):(ht||(ht=new WeakMap),mt(ht,t,i,e))}if(ct(t)){if(t.k)return y(t.k);ht||(ht=new WeakMap);return mt(ht,t,t,e,!0)}return t},wt=(t,e)=>{if(ft(t)){let i=t.export({format:"jwk"});return i.k?ut(i.k):(_t||(_t=new WeakMap),mt(_t,t,i,e))}if(ct(t)){if(t.k)return y(t.k);_t||(_t=new WeakMap);return mt(_t,t,t,e,!0)}return t};function yt(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new T(`Unsupported JWE Algorithm: ${t}`)}}const vt=t=>D(new Uint8Array(yt(t)>>3)),bt=(t,e)=>`-----BEGIN ${e}-----\n${(t.match(/.{1,64}/g)||[]).join("\n")}\n-----END ${e}-----`,Et=async(t,e,i)=>{if(!r(i))throw new TypeError(z(i,...q));if(!i.extractable)throw new TypeError("CryptoKey is not extractable");if(i.type!==t)throw new TypeError(`key is not a ${t} key`);return bt(m(new Uint8Array(await a.subtle.exportKey(e,i))),`${t.toUpperCase()} KEY`)},St=(t,e,i=0)=>{0===i&&(e.unshift(e.length),e.unshift(6));const n=t.indexOf(e[0],i);if(-1===n)return!1;const o=t.subarray(n,n+e.length);return o.length===e.length&&(o.every((t,i)=>t===e[i])||St(t,e,n+1))},Tt=t=>{switch(!0){case St(t,[42,134,72,206,61,3,1,7]):return"P-256";case St(t,[43,129,4,0,34]):return"P-384";case St(t,[43,129,4,0,35]):return"P-521";case St(t,[43,101,110]):return"X25519";case St(t,[43,101,111]):return"X448";case St(t,[43,101,112]):return"Ed25519";case St(t,[43,101,113]):return"Ed448";default:throw new T("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},jt=async(t,e,i,n,o)=>{let r,p;const s=new Uint8Array(atob(i.replace(t,"")).split("").map(t=>t.charCodeAt(0))),d="spki"===e;switch(n){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${n.slice(-3)}`},p=d?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${n.slice(-3)}`},p=d?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(n.slice(-3),10)||1}`},p=d?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"},p=d?["verify"]:["sign"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},p=d?["verify"]:["sign"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},p=d?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const t=Tt(s);r=t.startsWith("P-")?{name:"ECDH",namedCurve:t}:{name:t},p=d?[]:["deriveBits"];break}case"Ed25519":r={name:"Ed25519"},p=d?["verify"]:["sign"];break;case"EdDSA":r={name:Tt(s)},p=d?["verify"]:["sign"];break;default:throw new T('Invalid or unsupported "alg" (Algorithm) value')}return a.subtle.importKey(e,s,r,o?.extractable??!1,p)},kt=(t,e,i)=>jt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",t,e,i);function At(t){const e=[];let i=0;for(;i=128;)i=128*i+t[e]-128,e++;i=128*i+t[e]-128,e++}let n=0;if(t[e]<128)n=t[e],e++;else{if(128===n){for(n=0;0!==t[e+n]||0!==t[e+n+1];){if(n>t.byteLength)throw new TypeError("invalid indefinite form length");n++}const i=e+n+2;return{byteLength:i,contents:t.subarray(e,e+n),raw:t.subarray(0,i)}}{const i=127&t[e];e++,n=0;for(let o=0;o{let n;try{n=Pt(t)}catch(t){throw new TypeError("Failed to parse the X.509 certificate",{cause:t})}return kt(n,e,i)})(t,e,i)}async function Qt(t,e,i){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return((t,e,i)=>jt(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",t,e,i))(t,e,i)}async function Rt(t,e){if(!Z(t))throw new TypeError("JWK must be an object");switch(e||(e=t.alg),t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw new TypeError('missing "k" (Key Value) Parameter value');return y(t.k);case"RSA":if("oth"in t&&void 0!==t.oth)throw new T('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return lt({...t,alg:e});default:throw new T('Unsupported "kty" (Key Type) Parameter value')}}const Ot=t=>t?.[Symbol.toStringTag],Dt=(t,e,i)=>{if(void 0!==e.use&&"sig"!==e.use)throw new TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==e.key_ops&&!0!==e.key_ops.includes?.(i))throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${i}`);if(void 0!==e.alg&&e.alg!==t)throw new TypeError(`Invalid key for this operation, when present its alg must be ${t}`);return!0},Nt=(t,e,i,n)=>{if(!(e instanceof Uint8Array)){if(n&&ct(e)){if(function(t){return ct(t)&&"oct"===t.kty&&"string"==typeof t.k}(e)&&Dt(t,e,i))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!J(e))throw new TypeError(V(t,e,...q,"Uint8Array",n?"JSON Web Key":null));if("secret"!==e.type)throw new TypeError(`${Ot(e)} instances for symmetric algorithms must be of type "secret"`)}};function Mt(t,e,i,n){e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?Nt(e,i,n,t):((t,e,i,n)=>{if(n&&ct(e))switch(i){case"sign":if(function(t){return"oct"!==t.kty&&"string"==typeof t.d}(e)&&Dt(t,e,i))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(function(t){return"oct"!==t.kty&&void 0===t.d}(e)&&Dt(t,e,i))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!J(e))throw new TypeError(V(t,e,...q,n?"JSON Web Key":null));if("secret"===e.type)throw new TypeError(`${Ot(e)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===i&&"public"===e.type)throw new TypeError(`${Ot(e)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===i&&"public"===e.type)throw new TypeError(`${Ot(e)} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&"verify"===i&&"private"===e.type)throw new TypeError(`${Ot(e)} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&"encrypt"===i&&"private"===e.type)throw new TypeError(`${Ot(e)} instances for asymmetric algorithm encryption must be of type "public"`)})(e,i,n,t)}const Lt=Mt.bind(void 0,!1),Ut=Mt.bind(void 0,!0);const Ft=async(t,e,i,n,o)=>{if(!(r(i)||i instanceof Uint8Array))throw new TypeError(z(i,...q,"Uint8Array"));switch(n?M(t,n):n=D(new Uint8Array(N(t)>>3)),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i instanceof Uint8Array&&L(i,parseInt(t.slice(-3),10)),async function(t,e,i,n,o){if(!(i instanceof Uint8Array))throw new TypeError(z(i,"Uint8Array"));const r=parseInt(t.slice(1,4),10),p=await a.subtle.importKey("raw",i.subarray(r>>3),"AES-CBC",!1,["encrypt"]),s=await a.subtle.importKey("raw",i.subarray(0,r>>3),{hash:"SHA-"+(r<<1),name:"HMAC"},!1,["sign"]),d=new Uint8Array(await a.subtle.encrypt({iv:n,name:"AES-CBC"},p,e)),c=l(o,n,d,_(o.length<<3));return{ciphertext:d,tag:new Uint8Array((await a.subtle.sign("HMAC",s,c)).slice(0,r>>3)),iv:n}}(t,e,i,n,o);case"A128GCM":case"A192GCM":case"A256GCM":return i instanceof Uint8Array&&L(i,parseInt(t.slice(1,4),10)),async function(t,e,i,n,o){let r;i instanceof Uint8Array?r=await a.subtle.importKey("raw",i,"AES-GCM",!1,["encrypt"]):(B(i,t,"encrypt"),r=i);const p=new Uint8Array(await a.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},r,e)),s=p.slice(-16);return{ciphertext:p.slice(0,-16),tag:s,iv:n}}(t,e,i,n,o);default:throw new T("Unsupported JWE Content Encryption Algorithm")}};const Ht=async function(t,e,i,n,o){switch(Lt(t,e,"decrypt"),e=await(wt?.(e,t))||e,t){case"dir":if(void 0!==i)throw new k("Encountered unexpected JWE Encrypted Key");return e;case"ECDH-ES":if(void 0!==i)throw new k("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!Z(n.epk))throw new k('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!rt(e))throw new T("ECDH with the provided key is not allowed or not supported by your javascript runtime");const o=await Rt(n.epk,t);let a,r;if(void 0!==n.apu){if("string"!=typeof n.apu)throw new k('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{a=y(n.apu)}catch{throw new k("Failed to base64url decode the apu")}}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new k('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{r=y(n.apv)}catch{throw new k("Failed to base64url decode the apv")}}const p=await at(o,e,"ECDH-ES"===t?n.enc:t,"ECDH-ES"===t?yt(n.enc):parseInt(t.slice(-5,-2),10),a,r);if("ECDH-ES"===t)return p;if(void 0===i)throw new k("JWE Encrypted Key missing");return ot(t.slice(-6),p,i)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===i)throw new k("JWE Encrypted Key missing");return(async(t,e,i)=>{if(!r(e))throw new TypeError(z(e,...q));if(B(e,t,"decrypt","unwrapKey"),dt(t,e),e.usages.includes("decrypt"))return new Uint8Array(await a.subtle.decrypt(st(t),e,i));if(e.usages.includes("unwrapKey")){const n=await a.subtle.unwrapKey("raw",i,e,st(t),...tt);return new Uint8Array(await a.subtle.exportKey("raw",n))}throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')})(t,e,i);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===i)throw new k("JWE Encrypted Key missing");if("number"!=typeof n.p2c)throw new k('JOSE Header "p2c" (PBES2 Count) missing or invalid');const a=o?.maxPBES2Count||1e4;if(n.p2c>a)throw new k('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new k('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let r;try{r=y(n.p2s)}catch{throw new k("Failed to base64url decode the p2s")}return(async(t,e,i,n,o)=>{const a=await pt(o,t,n,e);return ot(t.slice(-6),a,i)})(t,e,i,n.p2c,r)}case"A128KW":case"A192KW":case"A256KW":if(void 0===i)throw new k("JWE Encrypted Key missing");return ot(t,e,i);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===i)throw new k("JWE Encrypted Key missing");if("string"!=typeof n.iv)throw new k('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new k('JOSE Header "tag" (Authentication Tag) missing or invalid');let o,a;try{o=y(n.iv)}catch{throw new k("Failed to base64url decode the iv")}try{a=y(n.tag)}catch{throw new k("Failed to base64url decode the tag")}return async function(t,e,i,n,o){const a=t.slice(0,7);return Y(a,e,i,n,o,new Uint8Array(0))}(t,e,i,o,a)}default:throw new T('Invalid or unsupported "alg" (JWE Algorithm) header value')}};const Wt=function(t,e,i,n,o){if(void 0!==o.crit&&void 0===n?.crit)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(t=>"string"!=typeof t||0===t.length))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;a=void 0!==i?new Map([...Object.entries(i),...e.entries()]):e;for(const e of n.crit){if(!a.has(e))throw new T(`Extension Header Parameter "${e}" is not recognized`);if(void 0===o[e])throw new t(`Extension Header Parameter "${e}" is missing`);if(a.get(e)&&void 0===n[e])throw new t(`Extension Header Parameter "${e}" MUST be integrity protected`)}return new Set(n.crit)},Kt=(t,e)=>{if(void 0!==e&&(!Array.isArray(e)||e.some(t=>"string"!=typeof t)))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)};async function $t(t,e,i){if(!Z(t))throw new k("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new k("JOSE Header missing");if(void 0!==t.iv&&"string"!=typeof t.iv)throw new k("JWE Initialization Vector incorrect type");if("string"!=typeof t.ciphertext)throw new k("JWE Ciphertext missing or incorrect type");if(void 0!==t.tag&&"string"!=typeof t.tag)throw new k("JWE Authentication Tag incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new k("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new k("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new k("JWE AAD incorrect type");if(void 0!==t.header&&!Z(t.header))throw new k("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!Z(t.unprotected))throw new k("JWE Per-Recipient Unprotected Header incorrect type");let n;if(t.protected)try{const e=y(t.protected);n=JSON.parse(d.decode(e))}catch{throw new k("JWE Protected Header is invalid")}if(!X(n,t.header,t.unprotected))throw new k("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const o={...n,...t.header,...t.unprotected};if(Wt(k,new Map,i?.crit,n,o),void 0!==o.zip)throw new T('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');const{alg:a,enc:r}=o;if("string"!=typeof a||!a)throw new k("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof r||!r)throw new k("missing JWE Encryption Algorithm (enc) in JWE Header");const p=i&&Kt("keyManagementAlgorithms",i.keyManagementAlgorithms),c=i&&Kt("contentEncryptionAlgorithms",i.contentEncryptionAlgorithms);if(p&&!p.has(a)||!p&&a.startsWith("PBES2"))throw new S('"alg" (Algorithm) Header Parameter value not allowed');if(c&&!c.has(r))throw new S('"enc" (Encryption Algorithm) Header Parameter value not allowed');let u;if(void 0!==t.encrypted_key)try{u=y(t.encrypted_key)}catch{throw new k("Failed to base64url decode the encrypted_key")}let _,h,f,m=!1;"function"==typeof e&&(e=await e(n,t),m=!0);try{_=await Ht(a,e,u,o,i)}catch(t){if(t instanceof TypeError||t instanceof k||t instanceof T)throw t;_=vt(r)}if(void 0!==t.iv)try{h=y(t.iv)}catch{throw new k("Failed to base64url decode the iv")}if(void 0!==t.tag)try{f=y(t.tag)}catch{throw new k("Failed to base64url decode the tag")}const g=s.encode(t.protected??"");let w,v;w=void 0!==t.aad?l(g,s.encode("."),s.encode(t.aad)):g;try{v=y(t.ciphertext)}catch{throw new k("Failed to base64url decode the ciphertext")}const b={plaintext:await Y(r,_,v,h,f,w)};if(void 0!==t.protected&&(b.protectedHeader=n),void 0!==t.aad)try{b.additionalAuthenticatedData=y(t.aad)}catch{throw new k("Failed to base64url decode the aad")}return void 0!==t.unprotected&&(b.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(b.unprotectedHeader=t.header),m?{...b,key:e}:b}async function Bt(t,e,i){if(t instanceof Uint8Array&&(t=d.decode(t)),"string"!=typeof t)throw new k("Compact JWE must be a string or Uint8Array");const{0:n,1:o,2:a,3:r,4:p,length:s}=t.split(".");if(5!==s)throw new k("Invalid Compact JWE");const c=await $t({ciphertext:r,iv:a||void 0,protected:n,tag:p||void 0,encrypted_key:o||void 0},e,i),l={plaintext:c.plaintext,protectedHeader:c.protectedHeader};return"function"==typeof e?{...l,key:c.key}:l}async function Gt(t,e,i){if(!Z(t))throw new k("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(Z))throw new k("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new k("JWE Recipients has no members");for(const n of t.recipients)try{return await $t({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:n.encrypted_key,header:n.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},e,i)}catch{}throw new j}const zt=Symbol(),Vt=async t=>{if(t instanceof Uint8Array)return{kty:"oct",k:g(t)};if(!r(t))throw new TypeError(z(t,...q,"Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:e,key_ops:i,alg:n,use:o,...p}=await a.subtle.exportKey("jwk",t);return p};async function Jt(t){return(t=>Et("public","spki",t))(t)}async function qt(t){return(t=>Et("private","pkcs8",t))(t)}async function Yt(t){return Vt(t)}const Xt=async function(t,e,i,n,o={}){let p,s,d;switch(Lt(t,i,"encrypt"),i=await(gt?.(i,t))||i,t){case"dir":d=i;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!rt(i))throw new T("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:c,apv:l}=o;let{epk:u}=o;u||(u=(await async function(t){if(!r(t))throw new TypeError(z(t,...q));return a.subtle.generateKey(t.algorithm,!0,["deriveBits"])}(i)).privateKey);const{x:_,y:h,crv:f,kty:m}=await Yt(u),w=await at(i,u,"ECDH-ES"===t?e:t,"ECDH-ES"===t?yt(e):parseInt(t.slice(-5,-2),10),c,l);if(s={epk:{x:_,crv:f,kty:m}},"EC"===m&&(s.epk.y=h),c&&(s.apu=g(c)),l&&(s.apv=g(l)),"ECDH-ES"===t){d=w;break}d=n||vt(e);const y=t.slice(-6);p=await nt(y,w,d);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":d=n||vt(e),p=await(async(t,e,i)=>{if(!r(e))throw new TypeError(z(e,...q));if(B(e,t,"encrypt","wrapKey"),dt(t,e),e.usages.includes("encrypt"))return new Uint8Array(await a.subtle.encrypt(st(t),e,i));if(e.usages.includes("wrapKey")){const n=await a.subtle.importKey("raw",i,...tt);return new Uint8Array(await a.subtle.wrapKey("raw",n,e,st(t)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')})(t,i,d);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{d=n||vt(e);const{p2c:a,p2s:r}=o;({encryptedKey:p,...s}=await(async(t,e,i,n=2048,o=D(new Uint8Array(16)))=>{const a=await pt(o,t,n,e);return{encryptedKey:await nt(t.slice(-6),a,i),p2c:n,p2s:g(o)}})(t,i,d,a,r));break}case"A128KW":case"A192KW":case"A256KW":d=n||vt(e),p=await nt(t,i,d);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{d=n||vt(e);const{iv:a}=o;({encryptedKey:p,...s}=await async function(t,e,i,n){const o=t.slice(0,7),a=await Ft(o,i,e,n,new Uint8Array(0));return{encryptedKey:a.ciphertext,iv:g(a.iv),tag:g(a.tag)}}(t,i,d,a));break}default:throw new T('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:d,encryptedKey:p,parameters:s}};class Zt{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=t}setKeyManagementParameters(t){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}setContentEncryptionKey(t){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=t,this}async encrypt(t,e){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new k("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!X(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new k("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const i={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(Wt(k,new Map,e?.crit,this._protectedHeader,i),void 0!==i.zip)throw new T('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');const{alg:n,enc:o}=i;if("string"!=typeof n||!n)throw new k('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof o||!o)throw new k('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let a,r,p,c,u;if(this._cek&&("dir"===n||"ECDH-ES"===n))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${n}`);{let i;({cek:r,encryptedKey:a,parameters:i}=await Xt(n,o,t,this._cek,this._keyManagementParameters)),i&&(e&&zt in e?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...i}:this.setUnprotectedHeader(i):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...i}:this.setProtectedHeader(i))}c=this._protectedHeader?s.encode(g(JSON.stringify(this._protectedHeader))):s.encode(""),this._aad?(u=g(this._aad),p=l(c,s.encode("."),s.encode(u))):p=c;const{ciphertext:_,tag:h,iv:f}=await Ft(o,this._plaintext,r,this._iv,p),m={ciphertext:g(_)};return f&&(m.iv=g(f)),h&&(m.tag=g(h)),a&&(m.encrypted_key=g(a)),u&&(m.aad=u),this._protectedHeader&&(m.protected=d.decode(c)),this._sharedUnprotectedHeader&&(m.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(m.header=this._unprotectedHeader),m}}class te{constructor(t,e,i){this.parent=t,this.key=e,this.options=i}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addRecipient(...t){return this.parent.addRecipient(...t)}encrypt(...t){return this.parent.encrypt(...t)}done(){return this.parent}}class ee{constructor(t){this._recipients=[],this._plaintext=t}addRecipient(t,e){const i=new te(this,t,{crit:e?.crit});return this._recipients.push(i),i}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}async encrypt(){if(!this._recipients.length)throw new k("at least one recipient must be added");if(1===this._recipients.length){const[t]=this._recipients,e=await new Zt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options}),i={ciphertext:e.ciphertext,iv:e.iv,recipients:[{}],tag:e.tag};return e.aad&&(i.aad=e.aad),e.protected&&(i.protected=e.protected),e.unprotected&&(i.unprotected=e.unprotected),e.encrypted_key&&(i.recipients[0].encrypted_key=e.encrypted_key),e.header&&(i.recipients[0].header=e.header),i}let t;for(let e=0;e>3};case"RS256":case"RS384":case"RS512":return{hash:i,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:i,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:e.name};default:throw new T(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}async function ne(t,e,i){if("sign"===i&&(e=await wt(e,t)),"verify"===i&&(e=await gt(e,t)),r(e))return $(e,t,i),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(z(e,...q));return a.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[i])}throw new TypeError(z(e,...q,"Uint8Array","JSON Web Key"))}const oe=async(t,e,i,n)=>{const o=await ne(t,e,"verify");dt(t,o);const r=ie(t,o.algorithm);try{return await a.subtle.verify(r,o,i,n)}catch{return!1}};async function ae(t,e,i){if(!Z(t))throw new A("Flattened JWS must be an object");if(void 0===t.protected&&void 0===t.header)throw new A('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==t.protected&&"string"!=typeof t.protected)throw new A("JWS Protected Header incorrect type");if(void 0===t.payload)throw new A("JWS Payload missing");if("string"!=typeof t.signature)throw new A("JWS Signature missing or incorrect type");if(void 0!==t.header&&!Z(t.header))throw new A("JWS Unprotected Header incorrect type");let n={};if(t.protected)try{const e=y(t.protected);n=JSON.parse(d.decode(e))}catch{throw new A("JWS Protected Header is invalid")}if(!X(n,t.header))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...n,...t.header};let a=!0;if(Wt(A,new Map([["b64",!0]]),i?.crit,n,o).has("b64")&&(a=n.b64,"boolean"!=typeof a))throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:r}=o;if("string"!=typeof r||!r)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');const p=i&&Kt("algorithms",i.algorithms);if(p&&!p.has(r))throw new S('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof t.payload)throw new A("JWS Payload must be a string")}else if("string"!=typeof t.payload&&!(t.payload instanceof Uint8Array))throw new A("JWS Payload must be a string or an Uint8Array instance");let c=!1;"function"==typeof e?(e=await e(n,t),c=!0,Ut(r,e,"verify"),ct(e)&&(e=await Rt(e,r))):Ut(r,e,"verify");const u=l(s.encode(t.protected??""),s.encode("."),"string"==typeof t.payload?s.encode(t.payload):t.payload);let _;try{_=y(t.signature)}catch{throw new A("Failed to base64url decode the signature")}if(!await oe(r,e,_,u))throw new O;let h;if(a)try{h=y(t.payload)}catch{throw new A("Failed to base64url decode the payload")}else h="string"==typeof t.payload?s.encode(t.payload):t.payload;const f={payload:h};return void 0!==t.protected&&(f.protectedHeader=n),void 0!==t.header&&(f.unprotectedHeader=t.header),c?{...f,key:e}:f}async function re(t,e,i){if(t instanceof Uint8Array&&(t=d.decode(t)),"string"!=typeof t)throw new A("Compact JWS must be a string or Uint8Array");const{0:n,1:o,2:a,length:r}=t.split(".");if(3!==r)throw new A("Invalid Compact JWS");const p=await ae({payload:o,protected:n,signature:a},e,i),s={payload:p.payload,protectedHeader:p.protectedHeader};return"function"==typeof e?{...s,key:p.key}:s}async function pe(t,e,i){if(!Z(t))throw new A("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(Z))throw new A("JWS Signatures missing or incorrect type");for(const n of t.signatures)try{return await ae({header:n.header,payload:t.payload,protected:n.protected,signature:n.signature},e,i)}catch{}throw new O}const se=t=>Math.floor(t.getTime()/1e3),de=86400,ce=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,le=t=>{const e=ce.exec(t);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");const i=parseFloat(e[2]);let n;switch(e[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":n=Math.round(i);break;case"minute":case"minutes":case"min":case"mins":case"m":n=Math.round(60*i);break;case"hour":case"hours":case"hr":case"hrs":case"h":n=Math.round(3600*i);break;case"day":case"days":case"d":n=Math.round(i*de);break;case"week":case"weeks":case"w":n=Math.round(604800*i);break;default:n=Math.round(31557600*i)}return"-"===e[1]||"ago"===e[4]?-n:n},ue=t=>t.toLowerCase().replace(/^application\//,""),_e=(t,e,i={})=>{let n;try{n=JSON.parse(d.decode(e))}catch{}if(!Z(n))throw new x("JWT Claims Set must be a top-level JSON object");const{typ:o}=i;if(o&&("string"!=typeof t.typ||ue(t.typ)!==ue(o)))throw new b('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:a=[],issuer:r,subject:p,audience:s,maxTokenAge:c}=i,l=[...a];void 0!==c&&l.push("iat"),void 0!==s&&l.push("aud"),void 0!==p&&l.push("sub"),void 0!==r&&l.push("iss");for(const t of new Set(l.reverse()))if(!(t in n))throw new b(`missing required "${t}" claim`,n,t,"missing");if(r&&!(Array.isArray(r)?r:[r]).includes(n.iss))throw new b('unexpected "iss" claim value',n,"iss","check_failed");if(p&&n.sub!==p)throw new b('unexpected "sub" claim value',n,"sub","check_failed");if(s&&(u=n.aud,_="string"==typeof s?[s]:s,!("string"==typeof u?_.includes(u):Array.isArray(u)&&_.some(Set.prototype.has.bind(new Set(u))))))throw new b('unexpected "aud" claim value',n,"aud","check_failed");var u,_;let h;switch(typeof i.clockTolerance){case"string":h=le(i.clockTolerance);break;case"number":h=i.clockTolerance;break;case"undefined":h=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=i,m=se(f||new Date);if((void 0!==n.iat||c)&&"number"!=typeof n.iat)throw new b('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new b('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+h)throw new b('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new b('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-h)throw new E('"exp" claim timestamp check failed',n,"exp","check_failed")}if(c){const t=m-n.iat;if(t-h>("number"==typeof c?c:le(c)))throw new E('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(t<0-h)throw new b('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n};async function he(t,e,i){const n=await re(t,e,i);if(n.protectedHeader.crit?.includes("b64")&&!1===n.protectedHeader.b64)throw new x("JWTs MUST NOT use unencoded payload");const o={payload:_e(n.protectedHeader,n.payload,i),protectedHeader:n.protectedHeader};return"function"==typeof e?{...o,key:n.key}:o}async function fe(t,e,i){const n=await Bt(t,e,i),o=_e(n.protectedHeader,n.plaintext,i),{protectedHeader:a}=n;if(void 0!==a.iss&&a.iss!==o.iss)throw new b('replicated "iss" claim header parameter mismatch',o,"iss","mismatch");if(void 0!==a.sub&&a.sub!==o.sub)throw new b('replicated "sub" claim header parameter mismatch',o,"sub","mismatch");if(void 0!==a.aud&&JSON.stringify(a.aud)!==JSON.stringify(o.aud))throw new b('replicated "aud" claim header parameter mismatch',o,"aud","mismatch");const r={payload:o,protectedHeader:a};return"function"==typeof e?{...r,key:n.key}:r}class me{constructor(t){this._flattened=new Zt(t)}setContentEncryptionKey(t){return this._flattened.setContentEncryptionKey(t),this}setInitializationVector(t){return this._flattened.setInitializationVector(t),this}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}setKeyManagementParameters(t){return this._flattened.setKeyManagementParameters(t),this}async encrypt(t,e){const i=await this._flattened.encrypt(t,e);return[i.protected,i.encrypted_key,i.iv,i.ciphertext,i.tag].join(".")}}const ge=async(t,e,i)=>{const n=await ne(t,e,"sign");dt(t,n);const o=await a.subtle.sign(ie(t,n.algorithm),n,i);return new Uint8Array(o)};class we{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,e){if(!this._protectedHeader&&!this._unprotectedHeader)throw new A("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!X(this._protectedHeader,this._unprotectedHeader))throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const i={...this._protectedHeader,...this._unprotectedHeader};let n=!0;if(Wt(A,new Map([["b64",!0]]),e?.crit,this._protectedHeader,i).has("b64")&&(n=this._protectedHeader.b64,"boolean"!=typeof n))throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:o}=i;if("string"!=typeof o||!o)throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');Ut(o,t,"sign");let a,r=this._payload;n&&(r=s.encode(g(r))),a=this._protectedHeader?s.encode(g(JSON.stringify(this._protectedHeader))):s.encode("");const p=l(a,s.encode("."),r),c=await ge(o,t,p),u={signature:g(c),payload:""};return n&&(u.payload=d.decode(r)),this._unprotectedHeader&&(u.header=this._unprotectedHeader),this._protectedHeader&&(u.protected=d.decode(a)),u}}class ye{constructor(t){this._flattened=new we(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,e){const i=await this._flattened.sign(t,e);if(void 0===i.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${i.protected}.${i.payload}.${i.signature}`}}class ve{constructor(t,e,i){this.parent=t,this.key=e,this.options=i}setProtectedHeader(t){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=t,this}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addSignature(...t){return this.parent.addSignature(...t)}sign(...t){return this.parent.sign(...t)}done(){return this.parent}}class be{constructor(t){this._signatures=[],this._payload=t}addSignature(t,e){const i=new ve(this,t,e);return this._signatures.push(i),i}async sign(){if(!this._signatures.length)throw new A("at least one signature must be added");const t={signatures:[],payload:""};for(let e=0;e{if("string"!=typeof t||!t)throw new P(`${e} missing or invalid`)};async function Ae(t,e){if(!Z(t))throw new TypeError("JWK must be an object");if(e??(e="sha256"),"sha256"!==e&&"sha384"!==e&&"sha512"!==e)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let i;switch(t.kty){case"EC":ke(t.crv,'"crv" (Curve) Parameter'),ke(t.x,'"x" (X Coordinate) Parameter'),ke(t.y,'"y" (Y Coordinate) Parameter'),i={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":ke(t.crv,'"crv" (Subtype of Key Pair) Parameter'),ke(t.x,'"x" (Public Key) Parameter'),i={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":ke(t.e,'"e" (Exponent) Parameter'),ke(t.n,'"n" (Modulus) Parameter'),i={e:t.e,kty:t.kty,n:t.n};break;case"oct":ke(t.k,'"k" (Key Value) Parameter'),i={k:t.k,kty:t.kty};break;default:throw new T('"kty" (Key Type) Parameter missing or unsupported')}const n=s.encode(JSON.stringify(i));return g(await p(e,n))}async function xe(t,e){e??(e="sha256");const i=await Ae(t,e);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${i}`}async function Pe(t,e){const i={...t,...e?.header};if(!Z(i.jwk))throw new A('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const n=await Rt({...i.jwk,ext:!0},i.alg);if(n instanceof Uint8Array||"public"!==n.type)throw new A('"jwk" (JSON Web Key) Header Parameter must be a public key');return n}function Ce(t){return Z(t)}function Ie(t){return"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t))}class Qe{constructor(t){if(this._cached=new WeakMap,!function(t){return t&&"object"==typeof t&&Array.isArray(t.keys)&&t.keys.every(Ce)}(t))throw new C("JSON Web Key Set malformed");this._jwks=Ie(t)}async getKey(t,e){const{alg:i,kid:n}={...t,...e?.header},o=function(t){switch("string"==typeof t&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new T('Unsupported "alg" value for a JSON Web Key Set')}}(i),a=this._jwks.keys.filter(t=>{let e=o===t.kty;if(e&&"string"==typeof n&&(e=n===t.kid),e&&"string"==typeof t.alg&&(e=i===t.alg),e&&"string"==typeof t.use&&(e="sig"===t.use),e&&Array.isArray(t.key_ops)&&(e=t.key_ops.includes("verify")),e)switch(i){case"ES256":e="P-256"===t.crv;break;case"ES256K":e="secp256k1"===t.crv;break;case"ES384":e="P-384"===t.crv;break;case"ES512":e="P-521"===t.crv;break;case"Ed25519":e="Ed25519"===t.crv;break;case"EdDSA":e="Ed25519"===t.crv||"Ed448"===t.crv}return e}),{0:r,length:p}=a;if(0===p)throw new I;if(1!==p){const t=new Q,{_cached:e}=this;throw t[Symbol.asyncIterator]=async function*(){for(const t of a)try{yield await Re(e,t,i)}catch{}},t}return Re(this._cached,r,i)}}async function Re(t,e,i){const n=t.get(e)||t.set(e,{}).get(e);if(void 0===n[i]){const t=await Rt({...e,ext:!0},i);if(t instanceof Uint8Array||"public"!==t.type)throw new C("JSON Web Key Set members must be public keys");n[i]=t}return n[i]}function Oe(t){const e=new Qe(t),i=async(t,i)=>e.getKey(t,i);return Object.defineProperties(i,{jwks:{value:()=>Ie(e._jwks),enumerable:!0,configurable:!1,writable:!1}}),i}const De=async(t,e,i)=>{let n,o,a=!1;"function"==typeof AbortController&&(n=new AbortController,o=setTimeout(()=>{a=!0,n.abort()},e));const r=await fetch(t.href,{signal:n?n.signal:void 0,redirect:"manual",headers:i.headers}).catch(t=>{if(a)throw new R;throw t});if(void 0!==o&&clearTimeout(o),200!==r.status)throw new v("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch{throw new v("Failed to parse the JSON Web Key Set HTTP response as JSON")}};let Ne;if("undefined"==typeof navigator||!navigator.userAgent?.startsWith?.("Mozilla/5.0 ")){Ne=`${"jose"}/${"v5.10.0"}`}const Me=Symbol();class Le{constructor(t,e){if(!(t instanceof URL))throw new TypeError("url must be an instance of URL");var i,n;this._url=new URL(t.href),this._options={agent:e?.agent,headers:e?.headers},this._timeoutDuration="number"==typeof e?.timeoutDuration?e?.timeoutDuration:5e3,this._cooldownDuration="number"==typeof e?.cooldownDuration?e?.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof e?.cacheMaxAge?e?.cacheMaxAge:6e5,void 0!==e?.[Me]&&(this._cache=e?.[Me],i=e?.[Me],n=this._cacheMaxAge,"object"==typeof i&&null!==i&&"uat"in i&&"number"==typeof i.uat&&!(Date.now()-i.uat>=n)&&"jwks"in i&&Z(i.jwks)&&Array.isArray(i.jwks.keys)&&Array.prototype.every.call(i.jwks.keys,Z)&&(this._jwksTimestamp=this._cache.uat,this._local=Oe(this._cache.jwks)))}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now(){this._local=Oe(t),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=t),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(t=>{throw this._pendingFetch=void 0,t})),await this._pendingFetch}}function Ue(t,e){const i=new Le(t,e),n=async(t,e)=>i.getKey(t,e);return Object.defineProperties(n,{coolingDown:{get:()=>i.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>i.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>i.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!i._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>i._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}const Fe=Me;class He extends Se{encode(){return`${g(JSON.stringify({alg:"none"}))}.${g(JSON.stringify(this._payload))}.`}static decode(t,e){if("string"!=typeof t)throw new x("Unsecured JWT must be a string");const{0:i,1:n,2:o,length:a}=t.split(".");if(3!==a||""!==o)throw new x("Invalid Unsecured JWT");let r;try{if(r=JSON.parse(d.decode(y(i))),"none"!==r.alg)throw new Error}catch{throw new x("Invalid Unsecured JWT")}return{payload:_e(r,y(n),e),header:r}}}const We=g,Ke=y;function $e(t){let e;if("string"==typeof t){const i=t.split(".");3!==i.length&&5!==i.length||([e]=i)}else if("object"==typeof t&&t){if(!("protected"in t))throw new TypeError("Token does not contain a Protected Header");e=t.protected}try{if("string"!=typeof e||!e)throw new Error;const t=JSON.parse(d.decode(Ke(e)));if(!Z(t))throw new Error;return t}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}function Be(t){if("string"!=typeof t)throw new x("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:i}=t.split(".");if(5===i)throw new x("Only JWTs using Compact JWS serialization can be decoded");if(3!==i)throw new x("Invalid JWT");if(!e)throw new x("JWTs must contain a payload");let n,o;try{n=Ke(e)}catch{throw new x("Failed to base64url decode the payload")}try{o=JSON.parse(d.decode(n))}catch{throw new x("Failed to parse the decoded payload as JSON")}if(!Z(o))throw new x("Invalid JWT Claims Set");return o}function Ge(t){const e=t?.modulusLength??2048;if("number"!=typeof e||e<2048)throw new T("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return e}async function ze(t,e){return async function(t,e){let i,n;switch(t){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ge(e)},n=["sign","verify"];break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ge(e)},n=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Ge(e)},n=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":i={name:"ECDSA",namedCurve:"P-256"},n=["sign","verify"];break;case"ES384":i={name:"ECDSA",namedCurve:"P-384"},n=["sign","verify"];break;case"ES512":i={name:"ECDSA",namedCurve:"P-521"},n=["sign","verify"];break;case"Ed25519":i={name:"Ed25519"},n=["sign","verify"];break;case"EdDSA":{n=["sign","verify"];const t=e?.crv??"Ed25519";switch(t){case"Ed25519":case"Ed448":i={name:t};break;default:throw new T("Invalid or unsupported crv option provided")}break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{n=["deriveKey","deriveBits"];const t=e?.crv??"P-256";switch(t){case"P-256":case"P-384":case"P-521":i={name:"ECDH",namedCurve:t};break;case"X25519":case"X448":i={name:t};break;default:throw new T("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new T('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return a.subtle.generateKey(i,e?.extractable??!1,n)}(t,e)}async function Ve(t,e){return async function(t,e){let i,n,o;switch(t){case"HS256":case"HS384":case"HS512":i=parseInt(t.slice(-3),10),n={name:"HMAC",hash:`SHA-${i}`,length:i},o=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i=parseInt(t.slice(-3),10),D(new Uint8Array(i>>3));case"A128KW":case"A192KW":case"A256KW":i=parseInt(t.slice(1,4),10),n={name:"AES-KW",length:i},o=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":i=parseInt(t.slice(1,4),10),n={name:"AES-GCM",length:i},o=["encrypt","decrypt"];break;default:throw new T('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return a.subtle.generateKey(n,e?.extractable??!1,o)}(t,e)}const Je="WebCryptoAPI"},602(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthStrategy=function(t){const e=t.tokenStorage??(0,h.createLocalTokenStorage)(t.tokens??h.EMPTY_TOKENS),i=()=>e.getTokens(),p=t=>e.setTokens(t);let l={loginState:s.LoginState.INITIAL};const g=async()=>{const t=i();if(!t.accessToken?.value||(0,a.isTokenExpired)(t.accessToken)){const e=await y({refreshToken:t.refreshToken});p(e)}return Promise.resolve({headers:{Authorization:i().accessToken.value}})},w=(0,n.createClient)({modules:f,auth:{getAuthHeaders:g}}),y=async e=>{if(e?.accessToken?.value&&e?.refreshToken?.value&&!(0,a.isTokenExpired)(e.accessToken))return e;if(e?.refreshToken?.value)try{return await v(e.refreshToken)}catch(t){}const i=await m({clientId:t.clientId,grantType:"anonymous"});return{accessToken:(0,a.createAccessToken)(i.access_token,i.expires_in),refreshToken:{value:i.refresh_token,role:s.TokenRole.VISITOR}}},v=async t=>{const e=await m({refreshToken:t.value,grantType:"refresh_token"});return{accessToken:(0,a.createAccessToken)(e.access_token,e.expires_in),refreshToken:t}},b=()=>{const t=(0,u.pkceChallenge)();return{codeChallenge:t.code_challenge,codeVerifier:t.code_verifier,state:(0,u.pkceChallenge)().code_challenge}},E=(t,e)=>{const i={redirectUri:t},n=b();return{...i,originalUri:e??"",codeChallenge:n.codeChallenge,codeVerifier:n.codeVerifier,state:(0,u.pkceChallenge)().code_challenge}},S=async(e,i,n,a)=>{const{redirectSession:r}=await w.redirects.createRedirectSession({auth:{authRequest:{redirectUri:e.redirectUri,...e.redirectUri&&{redirectUri:e.redirectUri},clientId:t.clientId,codeChallenge:e.codeChallenge,codeChallengeMethod:"S256",responseMode:i,responseType:"code",scope:"offline_access",state:e.state,...a&&{sessionToken:a}},prompt:o.redirects.Prompt[n]}});return{authUrl:r.fullUrl,authorizationEndpoint:r.urlDetails.endpoint,sessionToken:r.sessionToken}},T=async(e,i,n)=>{if(!e||!i)throw new Error("Missing code or _state");if(i!==n.state)throw new Error("Invalid _state");const o=await m({clientId:t.clientId,grantType:"authorization_code",...n.redirectUri&&{redirectUri:n.redirectUri},code:e,codeVerifier:n.codeVerifier});return{accessToken:(0,a.createAccessToken)(o.access_token,o.expires_in),refreshToken:{value:o.refresh_token,role:s.TokenRole.MEMBER}}},j=t=>t.state===r.authentication.StateType.SUCCESS?{loginState:s.LoginState.SUCCESS,data:{sessionToken:t.sessionToken}}:t.state===r.authentication.StateType.REQUIRE_OWNER_APPROVAL?{loginState:s.LoginState.OWNER_APPROVAL_REQUIRED}:t.state===r.authentication.StateType.REQUIRE_EMAIL_VERIFICATION?(l={loginState:s.LoginState.EMAIL_VERIFICATION_REQUIRED,data:{stateToken:t.stateToken}},l):{loginState:s.LoginState.FAILURE,error:"Unknown _state"};return{generateVisitorTokens:y,renewToken:v,parseFromUrl:(t,e="fragment")=>{const i=new URL(t??window.location.href),n="query"===e?i.searchParams:new URLSearchParams(i.hash.substring(1)),o=n.get("code"),a=n.get("state"),r=n.get("error"),p=n.get("error_description");return{code:o,state:a,...r&&{error:r,errorDescription:p}}},getAuthUrl:async(t=E("unused://"),e={prompt:"login"})=>S(t,e.responseMode??"fragment",e.prompt??"login",e.sessionToken),getMemberTokens:T,generateOAuthData:E,getAuthHeaders:g,setTokens:p,getTokens:i,loggedIn:()=>i().refreshToken.role===s.TokenRole.MEMBER,logout:async e=>{const{redirectSession:i}=await w.redirects.createRedirectSession({logout:{clientId:t.clientId},callbacks:{postFlowUrl:e}});return p({accessToken:{value:"",expiresAt:0},refreshToken:{value:"",role:s.TokenRole.NONE}}),{logoutUrl:i.fullUrl}},register:async t=>{try{const e=await w.authentication.registerV2({email:t.email},{password:t.password,profile:t.profile,...t.captchaTokens&&{captchaTokens:[{Recaptcha:t.captchaTokens?.recaptchaToken,InvisibleRecaptcha:t.captchaTokens?.invisibleRecaptchaToken}]}});return j(e)}catch(t){const e=t.details.validationError?.fieldViolations?.find(t=>"EMAIL"===t.data.type);return e?{loginState:s.LoginState.FAILURE,error:e.description,errorCode:"invalidEmail"}:t.details.applicationError?.code===c.MISSING_CAPTCHA?{loginState:s.LoginState.FAILURE,error:t.message,errorCode:"missingCaptchaToken"}:t.details.applicationError?.code===c.EMAIL_EXISTS?{loginState:s.LoginState.FAILURE,error:t.message,errorCode:"emailAlreadyExists"}:t.details.applicationError?.code===c.INVALID_CAPTCHA?{loginState:s.LoginState.FAILURE,error:t.message,errorCode:"invalidCaptchaToken"}:{loginState:s.LoginState.FAILURE,error:t.message}}},processVerification:async(t,e)=>{const i=e??l;if(i.loginState===s.LoginState.EMAIL_VERIFICATION_REQUIRED){const e=t.verificationCode??t.code,n=await w.verification.verifyDuringAuthentication(e,{stateToken:i.data.stateToken});return j(n)}return{loginState:s.LoginState.FAILURE,error:"Unknown _state"}},login:async t=>{try{const e=await w.authentication.loginV2({email:t.email},{password:t.password,...t.captchaTokens&&{captchaTokens:[{Recaptcha:t.captchaTokens?.recaptchaToken,InvisibleRecaptcha:t.captchaTokens?.invisibleRecaptchaToken}]}});return j(e)}catch(t){return{loginState:s.LoginState.FAILURE,error:t.message,errorCode:t.details.applicationError?.code===c.MISSING_CAPTCHA?"missingCaptchaToken":t.details.applicationError?.code===c.INVALID_CAPTCHA?"invalidCaptchaToken":t.details.applicationError.code===c.INVALID_PASSWORD?"invalidPassword":t.details.applicationError.code===c.RESET_PASSWORD?"resetPassword":"invalidEmail"}}},getMemberTokensForDirectLogin:async t=>{const e=b(),{authUrl:i}=await S(e,"web_message","none",t),n=(0,d.addPostMessageListener)(e.state),o=(0,d.loadFrame)(i);return n.then(t=>T(t.code,t.state,e)).finally(()=>{document.body.contains(o)&&o.parentElement?.removeChild(o)})},getMemberTokensForExternalLogin:async(t,e)=>{const n=await m({grant_type:"authorized_client",scope:"offline_access",member_id:t},{Authorization:i().accessToken.value+","+e});return{accessToken:(0,a.createAccessToken)(n.access_token,n.expires_in),refreshToken:{value:n.refresh_token,role:s.TokenRole.MEMBER}}},sendPasswordResetEmail:async(e,i)=>{await w.recovery.sendRecoveryEmail(e,{redirect:{url:i,clientId:t.clientId}})},captchaInvisibleSiteKey:"6LdoPaUfAAAAAJphvHoUoOob7mx0KDlXyXlgrx5v",captchaVisibleSiteKey:"6Ld0J8IcAAAAANyrnxzrRlX1xrrdXsOmsepUYosy",sessions:{isSessionSynced:_.isVisitorCookieWarmedUp,syncToWixPages:_.preWarmVisitorCookie},shouldUseCDN:!0}};const n=i(9760),o=i(9609),a=i(9421),r=i(6846),p=i(8642),s=i(237),d=i(4878),c=i(3549),l=i(872),u=i(2999),_=i(680),h=i(2881),f={redirects:o.redirects,authentication:r.authentication,recovery:r.recovery,verification:r.verification};const m=async(t,e={})=>{const i=await fetch(`https://${p.DEFAULT_API_URL}/oauth2/token`,{method:"POST",body:JSON.stringify(t),headers:{...(0,l.biHeaderGenerator)({entityFqdn:"wix.identity.oauth.v1.refresh_token",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.Token",packageName:"@wix/sdk"}),"Content-Type":"application/json",...e}});if(200!==i.status){let t;try{t=await i.json()}catch{}throw new Error(`Failed to fetch tokens from OAuth API: ${i.statusText}. request id: ${i.headers.get("x-request-id")}. ${t?`Response: ${JSON.stringify(t)}`:""}`)}return await i.json()}},645(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isHostModule=void 0,e.buildHostModule=function(t,e){return t.create(e)};e.isHostModule=t=>"host"===t.__type},680(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LOCALSTORAGE_PREWARM_REDIRECT_KEY=void 0,e.isVisitorCookieWarmedUp=o,e.preWarmVisitorCookie=async function(t={}){if(!t.force&&o())return;localStorage.removeItem(e.LOCALSTORAGE_PREWARM_REDIRECT_KEY);try{await async function(){const t=await n.redirects.createRedirectSession({login:{}}),e=t.redirectSession?.fullUrl;if(!e)throw new Error("No redirect URL found");const i=document.createElement("iframe");i.style.display="none",i.src=e;const o=new Promise(t=>i.onload=t);return document.body.appendChild(i),o}(),localStorage.setItem(e.LOCALSTORAGE_PREWARM_REDIRECT_KEY,Date.now().toString())}catch(t){console.error("Error during redirect session pre-warm:",t)}};const n=i(9609);function o(){const t=localStorage.getItem(e.LOCALSTORAGE_PREWARM_REDIRECT_KEY),i=Date.now();if(t){if(i-parseInt(t,10)<6048e5)return!0}return!1}e.LOCALSTORAGE_PREWARM_REDIRECT_KEY="wixRedirectSessionLastPreWarm"},705(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transformError=function(t,e={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},i=[]){if("object"!=typeof t||null===t)throw t;if((t=>"validationError"in(t.response?.data?.details??{}))(t))return o(t,e,i);if((t=>"applicationError"in(t.response?.data?.details??{}))(t))return r(t);if((t=>(t.response?.status??-1)>=400&&(t.response?.status??-1)<500)(t)){const e=t.response?.status,i=t.response?.statusText??"UNKNOWN",o=t.response?.data?.message??i,r={applicationError:{description:i,code:(0,n.constantCase)(i),data:{}},requestId:t.requestId};return a(t,{message:JSON.stringify({message:o,details:r},null,2),extraProperties:{details:r,status:e}})}return p(t)};const n=i(3219);const o=(t,e,i)=>{const n=t.response?.data,o=t.requestId,{fieldViolations:r}=n.details.validationError,p=s(e,r,i)?.sort((t,e)=>t.field`"${t}" ${e}`)?.join(", ")}`,c={validationError:{fieldViolations:p},requestId:o};return a(t,{message:JSON.stringify({message:d,details:c},null,2),extraProperties:{details:c,status:t.response?.status,requestId:o}})},a=(t,{message:e,extraProperties:i})=>Object.assign(t,{...i,message:e}),r=t=>{const e=t.response?.status,i=t.response?.statusText??"UNKNOWN",o=t.response?.data?.message??i,r=t.response?.data?.details?.applicationError?.description??i,p=o===r?o:`${o}: ${r}`,s={applicationError:{description:r,code:t.response?.data?.details?.applicationError?.code??(0,n.constantCase)(i),data:t.response?.data?.details?.applicationError?.data??{}},requestId:t.requestId};return a(t,{message:JSON.stringify({message:p,details:s},null,2),extraProperties:{details:s,status:e,requestId:t.requestId}})},p=t=>{const e=t.requestId?`System error occurred, request-id: ${t.requestId}`:`System error occurred: ${JSON.stringify(t)}`;return a(t,{message:e,extraProperties:{requestId:t.requestId,status:t.response?.status,code:(0,n.constantCase)(t.response?.statusText??"UNKNOWN"),...!t.response&&{runtimeError:t}}})},s=({spreadPathsToArguments:t,explicitPathsToArguments:e,singleArgumentUnchanged:i},n,o)=>{const a={...t,...e},r=Object.keys(a);return n?.filter(t=>!n.some(e=>e.field.length>t.field.length&&e.field.startsWith(t.field)&&r.includes(e.field))).map(t=>{const n=e[t.field];if(n)return{...t,field:d(n,o)};const p=r?.sort((t,e)=>e.length-t.length)?.find(e=>t.field.startsWith(e));if(p){const e=a[p];if(e)return{...t,field:t.field.replace(p,d(e,o))}}return i?{...t,field:`${o[0]}.${t.field}`}:t})},d=(t,e)=>{const i=c(t);return null!=i?t.replace(`$[${i}]`,e[i]):t},c=t=>{const e=t.match(/\$\[(?\d+)\]/);return e&&e.groups&&Number(e.groups.argIndex)}},830(){},872(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WixBIHeaderName=void 0,e.biHeaderGenerator=function(t,i,n){return{[e.WixBIHeaderName]:(o={environment:"js-sdk"+(n?`-${n}`:""),"package-name":t.packageName??i?.PACKAGE_NAME,"method-fqn":t.methodFqn,entity:t.entityFqdn},Object.entries(o).filter(([t,e])=>Boolean(e)).map(([t,e])=>`${t}=${e}`).join(","))};var o},e.WixBIHeaderName="x-wix-bi-gateway"},1004(){},1338(){},1520(){},1596(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FetchErrorResponse=void 0;class i extends Error{message;response;constructor(t,e){super(t),this.message=t,this.response=e}async details(){const t=await this.response.json();return n(this.response.status,t?.message,t?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:t})}}e.FetchErrorResponse=i;const n=(t,e,i,n)=>({details:{...!i?.validationError&&{applicationError:{description:e,code:t,data:n}},...i},message:e,requestId:n?.requestId})},1657(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VideoResolution=void 0,e.getScaledToFillImageUrl=function(t,e,i,o){const a=l(t);return n.sdk.getScaleToFillImageURL(a.id,a.height,a.width,e,i,o)},e.getScaledToFitImageUrl=function(t,e,i,o){const a=l(t);return n.sdk.getScaleToFitImageURL(a.id,a.height,a.width,e,i,o)},e.getCroppedImageUrl=function(t,e,i,o,a,r,p,s){const d=l(t);return n.sdk.getCropImageURL(d.id,d.height,d.width,e,i,o,a,r,p,s)},e.getImageUrl=l,e.getShapeUrl=function(t){return u(t,"https://static.wixstatic.com/shapes/")},e.getBaseImageUrl=u,e.getVideoUrl=function(t,e){let i,n,p,s,d="";if(t.startsWith(c))i=t.split(c).pop().split("/")[0],n=`${i}.jpg`,p="50",s="50";else{const e=h(t,r),{pathname:o,hash:a}=new URL(e),c=new URLSearchParams(a.replace("#","")),[l,u]=o.replace(`${r}://v1/`,"").split("/");i=l,n=c.get("posterUri")||`${i}.jpg`,p=c.get("posterWidth")||"50",s=c.get("posterHeight")||"50",d=_(u)}const l={id:i,url:`${c}${i}/${e?`${e}/mp4/file.mp4`:"file"}`,thumbnail:`${o}${a}://v1/${n}#originWidth=${p}&originHeight=${s}`};if(!d)return l;return{...l,filename:d}},e.getAudioUrl=function(t){const e=h(t,p),{pathname:i,hash:n}=new URL(e),[o,a]=i.replace(`${p}://v1/`,"").split("/"),r=_(a),s=new URLSearchParams(n.replace("#","")),d={id:o,duration:Number(s.get("duration")||""),url:`https://static.wixstatic.com/mp3/${o}`};if(!r)return d;return{...d,filename:r}},e.getDocumentUrl=function(t){const e=h(t.replace("v1/ugd","v1"),s),{pathname:i}=new URL(e),[n,o]=i.replace(`${s}://v1/`,"").split("/"),a=_(o),r={id:n,url:`https://d945e594-8657-47e2-9cd9-e9033c3d8da0.usrfiles.com/ugd/${n}`};if(!a)return r;return{...r,filename:a}},e.decodeText=_;const n=i(7555),o="wix:",a="image",r="video",p="audio",s="document",d="https://static.wixstatic.com/media/",c="https://video.wixstatic.com/video/";function l(t){return u(t,d)}function u(t,e=d){let i,n,o,r;if(t.startsWith(e))i=t.split(e).pop().split("/")[0],r=t.split("/w_").pop().split(",")[0],o=t.split(",h_").pop().split(",")[0];else{const e=h(t,a),{hash:p,pathname:s}=new URL(e),d=new URLSearchParams(p.replace("#",""));o=d.get("originHeight"),r=d.get("originWidth"),[i,n]=s.replace(`${a}://v1/`,"").split("/")}const p=_(n),s={id:i,url:`${e}${i}`,height:Number(o),width:Number(r)};return p?{...s,altText:p,filename:p}:s}function _(t){return t?decodeURIComponent(t):t}function h(t,e){const{protocol:i}=new URL(t);return i===`${e}:`?`${o}${t}`:t}var f;!function(t){t.MOBILE="360p",t.LOW="480p",t.MID="720p",t.HIGH="1080p"}(f||(e.VideoResolution=f={}))},2375(){},2675(t,e,i){"use strict";var n,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,s={};((t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})})(s,{SubjectType:()=>g,token:()=>S,tokenInfo:()=>T}),t.exports=(n=s,((t,e,i,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let s of r(e))p.call(t,s)||s===i||o(t,s,{get:()=>e[s],enumerable:!(n=a(e,s))||n.enumerable});return t})(o({},"__esModule",{value:!0}),n));var d=i(705),c=i(6071),l=i(7928),u=i(7928),_=i(6886),h=i(4714);function f(t){return(0,h.resolveUrl)(Object.assign(t,{domainToMappings:{"manage._base_domain_":[{srcPath:"/oauth2",destPath:"/v1/oauth"}],"www.wixapis.com":[{srcPath:"/oauth2",destPath:"/v1/oauth"},{srcPath:"/oauth2/token_info",destPath:"/v1/token_info"}],"users._base_domain_":[{srcPath:"/v1/oauth/device/verify",destPath:"/v1/oauth/device/verify"},{srcPath:"/v1/oauth/manage/user-code",destPath:"/v1/oauth/manage/user-code"},{srcPath:"/v2/oauth/device/verify",destPath:"/v2/oauth/device/verify"},{srcPath:"/v1/oauth/authorize",destPath:"/v1/oauth/authorize"},{srcPath:"/v1/oauth/user-info",destPath:"/v1/oauth/user-info"},{srcPath:"/iam/wix-idp/v1/oauth/token",destPath:"/v1/oauth/token"},{srcPath:"/iam/wix-idp/v1/oauth/user-info",destPath:"/v1/oauth/user-info"}],_:[{srcPath:"/_api/oauth2",destPath:"/v1/oauth"}],"platform.rise.ai":[{srcPath:"/oauth2",destPath:"/v1/oauth"}],"api._api_base_domain_":[{srcPath:"/oauth2-ng",destPath:""}],"apps._base_domain_":[{srcPath:"/oauth2/callback",destPath:"/oauth2/callback"},{srcPath:"/oauth2",destPath:"/v1/oauth"}],"editor._base_domain_":[{srcPath:"/oauth2/callback",destPath:"/oauth2/callback"},{srcPath:"/oauth2/user-authorized",destPath:"/oauth2/user-authorized"}],"blocks._base_domain_":[{srcPath:"/oauth2/callback",destPath:"/oauth2/callback"},{srcPath:"/oauth2/user-authorized",destPath:"/oauth2/user-authorized"}],"create.editorx":[{srcPath:"/oauth2/callback",destPath:"/oauth2/callback"},{srcPath:"/oauth2/user-authorized",destPath:"/oauth2/user-authorized"}]}}))}var m="@wix/auto_sdk_identity_oauth";var g=(t=>(t.UNKNOWN="UNKNOWN",t.USER="USER",t.VISITOR="VISITOR",t.MEMBER="MEMBER",t.APP="APP",t))(g||{});async function w(t){const{httpClient:e,sideEffects:i}=arguments[1],n=function(t){return function({host:e}){const i=(0,_.transformPaths)(t,[{transformFn:l.transformSDKBytesToRESTBytes,paths:[{path:"body"}]}]);return{entityFqdn:"wix.identity.oauth.v1.refresh_token",method:"POST",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.Token",packageName:m,migrationOptions:{optInTransformResponse:!0},url:f({protoPath:"/v1/oauth/token",data:i,host:e}),data:i,transformResponse:t=>(0,_.transformPaths)(t,[{transformFn:u.transformRESTBytesToSDKBytes,paths:[{path:"body"}]}])}}}((0,c.renameKeysFromSDKRequestToRESTRequest)({body:t?.body,pathParams:t?.pathParams,queryParams:t?.queryParams,headers:t?.headers,method:t?.method,rawPath:t?.rawPath,rawQuery:t?.rawQuery}));i?.onSiteCall?.();try{const t=await e.request(n);return i?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)(t.data)}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{body:"$[0].body",pathParams:"$[0].pathParams",queryParams:"$[0].queryParams",headers:"$[0].headers",method:"$[0].method",rawPath:"$[0].rawPath",rawQuery:"$[0].rawQuery"},singleArgumentUnchanged:!1},["options"]);throw i?.onError?.(t),e}}async function y(t){const{httpClient:e,sideEffects:i}=arguments[1],n=function(t){return function({host:e}){const i=(0,_.transformPaths)(t,[{transformFn:l.transformSDKBytesToRESTBytes,paths:[{path:"body"}]}]);return{entityFqdn:"wix.identity.oauth.v1.refresh_token",method:"POST",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.TokenInfo",packageName:m,migrationOptions:{optInTransformResponse:!0},url:f({protoPath:"/v1/oauth/token-info",data:i,host:e}),data:i}}}((0,c.renameKeysFromSDKRequestToRESTRequest)({body:t?.body,pathParams:t?.pathParams,queryParams:t?.queryParams,headers:t?.headers,method:t?.method,rawPath:t?.rawPath,rawQuery:t?.rawQuery}));i?.onSiteCall?.();try{const t=await e.request(n);return i?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)(t.data)}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{body:"$[0].body",pathParams:"$[0].pathParams",queryParams:"$[0].queryParams",headers:"$[0].headers",method:"$[0].method",rawPath:"$[0].rawPath",rawQuery:"$[0].rawQuery"},singleArgumentUnchanged:!1},["options"]);throw i?.onError?.(t),e}}function v(t){return e=>w(e,{httpClient:t})}function b(t){return e=>y(e,{httpClient:t})}var E=i(4714),S=(0,E.createRESTModule)(v),T=(0,E.createRESTModule)(b)},2834(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isServicePluginModule=void 0,e.servicePluginsModules=function(t){const e=new Map,i=(0,n.createNanoEvents)(),o={...i,getRegisteredServicePlugins:()=>e,async parseJWT(e){const i=t();if(!i.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");const{decoded:n,valid:o}=await i.decodeJWT(e,!0);if(!o)throw new Error("JWT is not valid");if("object"!=typeof n.data||null===n.data||!("metadata"in n.data)||"object"!=typeof n.data.metadata||null===n.data.metadata||!("appExtensionType"in n.data.metadata)||"string"!=typeof n.data.metadata.appExtensionType)throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return n.data},async process(t){const e=await this.parseJWT(t.body);return this.executeHandler(e,t.url)},async parseRequest(t){const e=await t.text();return this.parseJWT(e)},async processRequest(t){const e=t.url,i=await t.text();try{const t=await this.process({url:e,body:i});return Response.json(t)}catch(t){if("SPI"===t.errorType&&t.applicationCode&&t.httpCode)return Response.json({applicationError:{code:t.applicationCode,data:t.data}},{status:t.httpCode});throw t}},async executeHandler(t,i){const n=t.metadata.appExtensionType.toLowerCase(),o=e.get(n)??[];if(0===o.length)throw new Error(`No service plugin implementations found for component type ${n}`);if(o.length>1)throw new Error(`Multiple service plugin implementations found for component type ${n}. This is currently not supported`);const{implementation:a,servicePluginDefinition:r}=o[0],p=r.methods.find(t=>i.endsWith(t.primaryHttpMappingPath));if(!p)throw new Error("Unexpect request: request url did not match any method: "+i);const s=a[p.name];if(!s)throw new Error(`Got request for service plugin method ${p.name} but no implementation was provided. Available methods: ${Object.keys(a).join(", ")}`);return p.transformations.toREST(await s(p.transformations.fromREST(t)))}};return{initModule:t=>n=>{const o=e.get(t.componentType.toLowerCase())??[];o.push({servicePluginDefinition:t,implementation:n}),e.set(t.componentType.toLowerCase(),o),i.emit("registered",t)},client:o}};const n=i(9984);e.isServicePluginModule=t=>"service-plugin-definition"===t.__type},2877(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(e,i);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,o)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveContext=r,e.contextualizeHostModule=function(t,e){return(...i)=>{const n=r();if(!n)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return n.initWixModules(t)[e].apply(void 0,i)}},e.getContextualAuth=function(){const t=r();if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.getAuth()},e.contextualizeRESTModule=function(t,e){return(...i)=>{const n=r();if(!n)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return n.initWixModules(t,!!i[e]?.suppressAuth).apply(void 0,i)}},e.contextualizeEventDefinitionModule=function(t){return(...e)=>{const i=r();if(!i)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return i.initWixModules(t).apply(void 0,e)}},e.contextualizeSerivcePluginModule=function(t){return(...e)=>{const i=r();if(!i)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return i.initWixModules(t).apply(void 0,e)}},e.runWithoutContext=p;const a=i(6884);function r(){const t="undefined"!=typeof $wixContext&&$wixContext.initWixModules?$wixContext.initWixModules:void 0!==globalThis.__wix_context__&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(t)return{initWixModules:(e,i)=>p(()=>t(e,i)),fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};const e="undefined"!=typeof $wixContext?$wixContext.client:void 0!==a.wixContext.client?a.wixContext.client:void 0!==globalThis.__wix_context__?globalThis.__wix_context__.client:void 0,i="undefined"!=typeof $wixContext?$wixContext.elevatedClient:void 0!==a.wixContext.elevatedClient?a.wixContext.elevatedClient:void 0!==globalThis.__wix_context__?globalThis.__wix_context__.elevatedClient:void 0;return e||i?{initWixModules(t,n){if(n){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return p(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return p(()=>e.use(t))},fetchWithAuth:(t,i)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,i)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,i,n){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,i,n)}}:void 0}function p(t){const e=globalThis.__wix_context__,i={client:a.wixContext.client,elevatedClient:a.wixContext.elevatedClient};let n;globalThis.__wix_context__=void 0,a.wixContext.client=void 0,a.wixContext.elevatedClient=void 0,"undefined"!=typeof $wixContext&&(n={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return t()}finally{globalThis.__wix_context__=e,a.wixContext.client=i.client,a.wixContext.elevatedClient=i.elevatedClient,"undefined"!=typeof $wixContext&&($wixContext.client=n.client,$wixContext.elevatedClient=n.elevatedClient)}}o(i(274),e)},2881(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_TOKENS=void 0,e.createLocalTokenStorage=function(t){let e=t;return{getTokens:()=>e,setTokens:t=>{e=t}}};const n=i(237);e.EMPTY_TOKENS={accessToken:{value:"",expiresAt:0},refreshToken:{value:"",role:n.TokenRole.NONE}}},2896(){},2914(t,e,i){"use strict";e.__esModule=!0,e.createHost=void 0;var n=i(8240);e.createHost=function(t){const e="undefined"!=typeof $wixContext&&$wixContext.clientSdk||(null==t?void 0:t.clientSdk)||window.clientSdk,{applicationId:i}=t||{};if(!i)throw new Error('"createHost" was called without a required field "applicationId"');return{channel:(0,n.createWebsiteChannel)({clientSdk:e,applicationId:i}),close:()=>{}}}},2924(t,e,i){"use strict";var n,o=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(e,i);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,o)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r=this&&this.__importStar||(n=function(t){return n=Object.getOwnPropertyNames||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[e.length]=i);return e},n(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i=n(t),r=0;rDate.now())return{headers:{Authorization:n.token}};if("refreshToken"in e||o){if(!e.appSecret)throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");const t=await fetch("https://www.wixapis.com/oauth/access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:o,client_id:e.appId,client_secret:e.appSecret,grant_type:"refresh_token"})});if(200!==t.status)throw new Error(`Failed to exchange refresh token for access token. Unexpected status code from Wix OAuth API: ${t.status}, request id: ${t.headers.get("x-wix-request-id")}`);const i=await t.json();return o=i.refresh_token,{headers:{Authorization:i.access_token}}}if("instanceId"in e){if(!e.appSecret)throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");const t=await fetch("https://www.wixapis.com/oauth2/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({instance_id:e.instanceId,client_id:e.appId,client_secret:e.appSecret,grant_type:"client_credentials"})});if(200!==t.status)throw new Error(`Failed to exchange instance ID for access token. Unexpected status code from Wix OAuth API: ${t.status}, request id: ${t.headers.get("x-wix-request-id")}`);const i=await t.json();return n={token:i.access_token,expiresAt:Date.now()+1e3*i.expires_in},{headers:{Authorization:i.access_token}}}if("accessToken"in e&&e.accessToken){const t=await fetch("https://www.wixapis.com/oauth2/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"strip_bound_session",client_secret:e.appSecret,access_token:e.accessToken})});if(200!==t.status)throw new Error(`Failed to get unbound token. Unexpected status code from Wix OAuth API: ${t.status}, request id: ${t.headers.get("x-wix-request-id")}`);const{access_token:i,expires_in:o}=await t.json();return n={token:i,expiresAt:Date.now()+1e3*o},{headers:{Authorization:i}}}throw new Error("Missing refresh token or instance ID. Either one is needed to get app level access tokens. Make sure to pass one of them to the AppStrategy")},async elevated(){if("accessToken"in e&&e.accessToken){const i=await(0,s.getTokenInfo)(e.accessToken);if(i.clientId!==e.appId)throw new Error(`Invalid access token. The token is not issued for the app with ID "${e.appId}"`);if(!i.instanceId)throw new Error("Unexpected token info. The token does not contain instance ID");return t({appId:e.appId,appSecret:e.appSecret,publicKey:e.publicKey,instanceId:i.instanceId})}throw new Error("Providing an access token is required to perform elevation. Make sure to pass it to the AppStrategy")},async decodeJWT(t,n=!1){if(!e.publicKey)throw new Error("Missing public key. Make sure to pass it to the AppStrategy");const{jwtVerify:o,importSPKI:a}=await Promise.resolve().then(()=>r(i(533))),s=await a((0,p.parsePublicKeyIfEncoded)(e.publicKey),"RS256");return{decoded:{data:(await o(t,s,n?{issuer:"wix.com",audience:e.appId}:void 0)).payload.data},valid:!0}},async getTokenInfo(){const t=o??("accessToken"in e?e.accessToken:void 0);if(!t)throw new Error("Missing token to get info for. Either pass the token as an argument or provide it when initializing the AppStrategy");return(0,s.getTokenInfo)(t)},getActiveToken:()=>"accessToken"in e?e.accessToken:o}};const p=i(138),s=i(4992)},2999(t,e,i){"use strict";var n=i(8287).hp;Object.defineProperty(e,"__esModule",{value:!0}),e.pkceChallenge=function(t){t||(t=43);if(t<43||t>128)throw new Error(`Expected a length between 43 and 128. Received ${t}.`);const e=function(t){return function(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let i="";const n=crypto.getRandomValues(new Uint8Array(t));for(let o=0;ofunction(t){return/^\d+$/.test(t)}(t)?Number(t):t)}},3219(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.alignIfLegacy=function(t,e){const{protocol:i}=new URL(t);return i===`${e}:`?`${n.WIX_PROTOCOL}${t}`:t},e.removeUndefinedKeys=function(t){return Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t))},e.constantCase=function(t){return s(t).map(t=>t.toLocaleUpperCase()).join("_")},e.split=s;const n=i(3267);const o=/([\p{Ll}\d])(\p{Lu})/gu,a=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,r="$1\0$2",p=/[^\p{L}\d]+/giu;function s(t){let e=t.trim();e=e.replace(o,r).replace(a,r),e=e.replace(p,"\0");let i=0,n=e.length;for(;"\0"===e.charAt(i);)i++;if(i===n)return[];for(;"\0"===e.charAt(n-1);)n--;return e.slice(i,n).split(/\0/g)}},3261(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ModifiedFieldsManipulator=void 0,e.attemptTransformationWithModifiedFields=function(t,e){const i=t?.modifiedFields;if(!i)return null;const n=function(t){if("object"==typeof t&&null!==t&&!Array.isArray(t))try{const e=new a(t);return{unflattenedModifiedFields:e.unflatten(),modifiedFieldsManipulator:e}}catch(t){return null}return null}(i);if(!n)return null;const{unflattenedModifiedFields:o,modifiedFieldsManipulator:r}=n;t={...t,modifiedFields:o};const p=e(t),s=p?.modifiedFields;if(!s)return null;const d=function(t,e){if("object"==typeof t&&null!==t&&!Array.isArray(t))try{return e.flatten(t)}catch(t){return null}return null}(s,r);if(null!==d)return p.modifiedFields=d,p;return null};const n=i(4714),o=i(7288);class a{BRACKET_PATTERN=/\[(\d+)\]/g;NUMERIC_PATTERN=/^\d+$/;ESCAPED_DOT_PATTERN=/\\\./g;ESCAPED_LEFT_BRACKET_PATTERN=/\\\[/g;ESCAPED_RIGHT_BRACKET_PATTERN=/\\\]/g;SPLIT_PATTERN=/\.|\[(\d+)\]/g;DOT_BEFORE_BRACKET_PATTERN=/\.\[/g;ESCAPED_DOT_PLACEHOLDER="__DOT__";ESCAPED_RIGHT_BRACKET_PLACEHOLDER="__RB__";ESCAPED_LEFT_BRACKET_PLACEHOLDER="__LB__";modifiedFields;cleanedModifiedFields;constructor(t){this.modifiedFields=t}replaceEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PLACEHOLDER,"\\.").replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,"\\]").replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,"\\[")}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([t,e])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(t)),e])),(0,o.unflatten)(this.cleanedModifiedFields)}flatten(t){let e={};for(const i of Object.keys(this.cleanedModifiedFields)){const n=this.splitPath(i),o=this.navigatePath(t,n);e={...e,...o}}return Object.fromEntries(Object.entries(e).map(([t,e])=>[this.restoreEscapedCharacters(t),e]))}splitPath(t){const e=[];let i=0;const n=Array.from(t.matchAll(this.SPLIT_PATTERN));for(const o of n)o.index>i&&e.push(t.substring(i,o.index)),o[1]&&e.push(o[1]),i=o.index+o[0].length;return i{if(!Array.isArray(i))throw new Error(`Expected array at path ${this.buildPathString(o)}, but got ${typeof i}`);o.push(`[${t}]`),i=i[parseInt(t,10)]},r=(t,e)=>{const a=t in n.RESTResponseToSDKResponseRenameMap?n.RESTResponseToSDKResponseRenameMap[t]:void 0;if(a&&a in e)return o.push(a),void(i=e[a]);const r=t.replace(/[-_\s]+(.)?/g,(t,e)=>e?e.toUpperCase():"").replace(/^./,t=>t.toLowerCase());if(r&&r in e)return o.push(r),void(i=e[r]);throw new Error(`Cannot find key '${t}' or its transformations at path ${this.buildPathString(o)}`)},p=(t,e)=>{o.push(t),i=e[t]};for(const t of e){if(this.NUMERIC_PATTERN.test(t)){a(t);continue}if(null===i||"object"!=typeof i)throw new Error(`Cannot access property '${t}' on ${typeof i} at path ${this.buildPathString(o)}`);const e=i;t in i?p(t,e):r(t,e)}return{[this.buildPathString(o)]:i}}buildPathString(t){return t.join(".").replace(this.DOT_BEFORE_BRACKET_PATTERN,"[")}bracketToDotNotation(t){return t.replace(this.BRACKET_PATTERN,(e,i,n)=>n>0&&"\\"===t[n-1]?e:"."+i)}}e.ModifiedFieldsManipulator=a},3267(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_LIMIT=e.PAGING_METADATA_RESULT_PROPERTY_NAME=e.ITEMS_RESULT_PROPERTY_NAME=e.RESTResponseToSDKResponseRenameMap=e.SDKRequestToRESTRequestRenameMap=e.WIX_PROTOCOL=void 0,e.WIX_PROTOCOL="wix:",e.SDKRequestToRESTRequestRenameMap={_id:"id",_createdDate:"createdDate",_updatedDate:"updatedDate"},e.RESTResponseToSDKResponseRenameMap={id:"_id",createdDate:"_createdDate",updatedDate:"_updatedDate"},e.ITEMS_RESULT_PROPERTY_NAME="items",e.PAGING_METADATA_RESULT_PROPERTY_NAME="pagingMetadata",e.DEFAULT_LIMIT=50},3477(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transformSDKFloatToRESTFloat=function(t){return isFinite(t)?t:t.toString()},e.transformRESTFloatToSDKFloat=function(t){if("NaN"===t)return NaN;if("Infinity"===t)return 1/0;if("-Infinity"===t)return-1/0;return t}},3487(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transformSDKTimestampToRESTTimestamp=function(t){return t?.toISOString()},e.transformRESTTimestampToSDKTimestamp=function(t){return t?new Date(t):void 0}},3549(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RESET_PASSWORD=e.INVALID_PASSWORD=e.EMAIL_EXISTS=e.INVALID_CAPTCHA=e.MISSING_CAPTCHA=void 0,e.MISSING_CAPTCHA="-19971",e.INVALID_CAPTCHA="-19970",e.EMAIL_EXISTS="-19995",e.INVALID_PASSWORD="-19976",e.RESET_PASSWORD="-19973"},3576(t,e,i){"use strict";var n,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,s={};((t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})})(s,{AttachPagesResponseStatus:()=>y,CallbackType:()=>v,LocationType:()=>m,MembersAccountSection:()=>w,Prompt:()=>g,Status:()=>b,WebhookIdentityType:()=>E,createRedirectSession:()=>x,onRedirectSessionCreated:()=>P}),t.exports=(n=s,((t,e,i,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let s of r(e))p.call(t,s)||s===i||o(t,s,{get:()=>e[s],enumerable:!(n=a(e,s))||n.enumerable});return t})(o({},"__esModule",{value:!0}),n));var d=i(6071),c=i(3487),l=i(6886),u=i(8382),_=i(705),h=i(6071),f=i(4714);var m=(t=>(t.UNDEFINED="UNDEFINED",t.OWNER_BUSINESS="OWNER_BUSINESS",t.OWNER_CUSTOM="OWNER_CUSTOM",t.CUSTOM="CUSTOM",t))(m||{}),g=(t=>(t.login="login",t.none="none",t))(g||{}),w=(t=>(t.ACCOUNT_INFO="ACCOUNT_INFO",t.BOOKINGS="BOOKINGS",t.ORDERS="ORDERS",t.SUBSCRIPTIONS="SUBSCRIPTIONS",t.EVENTS="EVENTS",t))(w||{}),y=(t=>(t.UNKNOWN="UNKNOWN",t.SUCCESS="SUCCESS",t.NO_ACTION="NO_ACTION",t.ERROR="ERROR",t))(y||{}),v=(t=>(t.UNKNOWN="UNKNOWN",t.LOGOUT="LOGOUT",t.CHECKOUT="CHECKOUT",t.AUTHORIZE="AUTHORIZE",t))(v||{}),b=(t=>(t.UNKNOWN="UNKNOWN",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(b||{}),E=(t=>(t.UNKNOWN="UNKNOWN",t.ANONYMOUS_VISITOR="ANONYMOUS_VISITOR",t.MEMBER="MEMBER",t.WIX_USER="WIX_USER",t.APP="APP",t))(E||{});async function S(t){const{httpClient:e,sideEffects:i}=arguments[1],n=function(t){return function({host:e}){var i;return{entityFqdn:"wix.headless.v1.redirect_session",method:"POST",methodFqn:"wix.headless.v1.RedirectSessionService.CreateRedirectSession",packageName:"@wix/auto_sdk_redirects_redirects",migrationOptions:{optInTransformResponse:!0},url:(i={protoPath:"/v1/redirect-session",data:t,host:e},(0,f.resolveUrl)(Object.assign(i,{domainToMappings:{"www._base_domain_":[{srcPath:"/_api/redirects-api",destPath:""}],"www.wixapis.com":[{srcPath:"/_api/redirects-api",destPath:""},{srcPath:"/redirect-session",destPath:""},{srcPath:"/headless/v1/redirect-session",destPath:"/v1/redirect-session"}],"*.dev.wix-code.com":[{srcPath:"/headless/v1/redirect-session",destPath:"/v1/redirect-session"}],_:[{srcPath:"/headless/v1/redirect-session",destPath:"/v1/redirect-session"}]}}))),data:t}}}((0,h.renameKeysFromSDKRequestToRESTRequest)({bookingsCheckout:t?.bookingsCheckout,ecomCheckout:t?.ecomCheckout,eventsCheckout:t?.eventsCheckout,paidPlansCheckout:t?.paidPlansCheckout,login:t?.login,logout:t?.logout,auth:t?.auth,storesProduct:t?.storesProduct,bookingsBook:t?.bookingsBook,callbacks:t?.callbacks,preferences:t?.preferences,origin:t?.origin}));i?.onSiteCall?.();try{const t=await e.request(n);return i?.onSuccess?.(t),(0,h.renameKeysFromRESTResponseToSDKResponse)(t.data)}catch(t){const e=(0,_.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{bookingsCheckout:"$[0].bookingsCheckout",ecomCheckout:"$[0].ecomCheckout",eventsCheckout:"$[0].eventsCheckout",paidPlansCheckout:"$[0].paidPlansCheckout",login:"$[0].login",logout:"$[0].logout",auth:"$[0].auth",storesProduct:"$[0].storesProduct",bookingsBook:"$[0].bookingsBook",callbacks:"$[0].callbacks",preferences:"$[0].preferences",origin:"$[0].origin"},singleArgumentUnchanged:!1},["options"]);throw i?.onError?.(t),e}}function T(t){return e=>S(e,{httpClient:t})}var j=(0,u.EventDefinition)("wix.headless.v1.redirect_session_created",!0,t=>(0,d.renameKeysFromRESTResponseToSDKResponse)((0,l.transformPaths)(t,[{transformFn:c.transformRESTTimestampToSDKTimestamp,paths:[{path:"metadata.eventTime"}]}])))(),k=i(4714),A=i(7866),x=(0,k.createRESTModule)(T),P=(0,A.createEventModule)(j)},3707(t,e,i){"use strict";e.__esModule=!0;var n={site:!0};e.site=void 0;var o=i(3920),a=i(2914),r=i(1338);Object.keys(r).forEach(function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===r[t]||(e[t]=r[t]))});e.site=(0,o.createWebsiteModule)({createHost:a.createHost})},3787(){},3803(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var o=Object.getOwnPropertyDescriptor(e,i);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,o)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createNanoEvents=e.DEFAULT_API_URL=void 0,o(i(9760),e),o(i(4159),e),o(i(602),e),o(i(237),e),o(i(2881),e),o(i(3852),e),o(i(2924),e),o(i(8382),e);var a=i(8642);Object.defineProperty(e,"DEFAULT_API_URL",{enumerable:!0,get:function(){return a.DEFAULT_API_URL}});var r=i(9984);Object.defineProperty(e,"createNanoEvents",{enumerable:!0,get:function(){return r.createNanoEvents}})},3852(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ApiKeyStrategy=function({siteId:t,accountId:e,apiKey:i}){const n={Authorization:i};t&&(n["wix-site-id"]=t);e&&(n["wix-account-id"]=e);return{setSiteId(t){n["wix-site-id"]=t},setAccountId(t){n["wix-account-id"]=t},getAuthHeaders:async()=>({headers:n})}}},3920(t,e,i){"use strict";e.__esModule=!0,e.createWebsiteModule=void 0;var n=i(7510);e.createWebsiteModule=({createHost:t})=>({__type:"host",create:t=>({}),host:e=>{var i,n;const{applicationId:o}=e??{},a="undefined"!=typeof window?window.wixEmbedsAPI:void 0,r=t(e),p=function(){const t="undefined"!=typeof window?window.wixEmbedsAPI:void 0,e=null==t||null==t.getExternalBaseUrl?void 0:t.getExternalBaseUrl();if(!e)return;const i=new URL(e);if(null!=i&&i.pathname&&"/"!==i.pathname)return`${i.hostname}${i.pathname}`;return i.hostname}();return{...r,apiBaseUrl:p,getMonitoringClient:null==a||null==a.getMonitoringClientFunction?void 0:a.getMonitoringClientFunction(o),essentials:{language:"undefined"!=typeof window?null==(i=window.commonConfig)?void 0:i.language:void 0,locale:"undefined"!=typeof window?null==(n=window.commonConfig)?void 0:n.locale:void 0}}},auth:t=>{const e="undefined"!=typeof window?window.wixEmbedsAPI:void 0;t||(t=null==e||null==e.getAccessTokenFunction?void 0:e.getAccessTokenFunction());let i=!1;const{resolve:o,promise:a}=(0,n.withResolvers)();return{getAuthHeaders:async()=>{if(!t&&i&&(t=await a),!t)throw new Error("Failed to resolve auth token");return{headers:{Authorization:await t()}}},getAccessTokenInjector:()=>(i=!0,t=>{o(t)})}}})},3967(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.transformSDKAddressToRESTAddress=function(t){return t&&(0,n.removeUndefinedKeys)({city:t.city,hint:t.hint,subdivision:t.subdivision,country:t.country,postalCode:t.postalCode,formattedAddress:t.formatted,geocode:t.location,addressLine:t.addressLine1,addressLine2:t.addressLine2,streetAddress:t.streetAddress&&{name:t.streetAddress.name,number:t.streetAddress.number,apt:t.streetAddress.apt}})},e.transformRESTAddressToSDKAddress=function(t){return t&&(0,n.removeUndefinedKeys)({formatted:t.formattedAddress,location:t.geocode,addressLine1:t.addressLine,addressLine2:t.addressLine2,streetAddress:t.streetAddress&&{name:t.streetAddress.name,number:t.streetAddress.number,apt:t.streetAddress.apt},hint:t.hint,city:t.city,subdivision:t.subdivision,country:t.country,postalCode:t.postalCode,countryFullname:t.countryFullname,subdivisionFullname:t.subdivisionFullname})};const n=i(3219)},4001(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildRESTDescriptor=function(t,e,i,p,d,c,l,u,_){return(0,a.runWithoutContext)(()=>t({request:async t=>{const a=t({host:l?.HTTPHost||o.DEFAULT_API_URL});let d=a;"GET"===d.method&&d.fallback?.length&&(d.params?.toString().length??0)>4e3&&(d=a.fallback[0]);const c=l?.HTTPHost??o.DEFAULT_API_URL;let h=`https://${_?o.DEFAULT_EDGE_API_URL:c}${d.url}`;d.params&&d.params.toString()&&(h+=`?${d.params.toString()}`);try{const t=(0,n.biHeaderGenerator)(a,e,u),o={method:d.method,...d.data&&{body:JSON.stringify(d.data)},headers:{...t}},c=await i(h,o);if(200!==c.status){let t=null;try{t=await c.json()}catch(t){}const e=s(c.status,t?.message,t?.details,{requestId:c.headers.get("X-Wix-Request-Id"),details:t}),i=(0,r.transformError)(e);throw p?.handleError(i,{requestOptions:{url:d.url,method:d.method,entityFqdn:a.entityFqdn,methodFqn:a.methodFqn}}),e}const l=await c.json();return{data:d.migrationOptions?.optInTransformResponse&&d.transformResponse?Array.isArray(d.transformResponse)?d.transformResponse[0](l):d.transformResponse(l):l,headers:c.headers,status:c.status,statusText:c.statusText}}catch(t){throw t.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),t}},fetchWithAuth:i,wixAPIFetch:d,getActiveToken:c}))};const n=i(872),o=i(8642),a=i(2877),r=i(705);class p extends Error{response;requestId;constructor(t){super(),this.response=t.response,this.requestId=t.requestId}}const s=(t,e,i,n)=>new p({response:{data:{details:{...!i?.validationError&&{applicationError:{description:e,code:t,data:n}},...i},message:e},status:t},requestId:n?.requestId})},4159(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.media=e.decodeText=e.VideoResolution=void 0;const n=i(1657);var o=i(1657);Object.defineProperty(e,"VideoResolution",{enumerable:!0,get:function(){return o.VideoResolution}}),Object.defineProperty(e,"decodeText",{enumerable:!0,get:function(){return o.decodeText}}),e.media={getCroppedImageUrl:n.getCroppedImageUrl,getScaledToFillImageUrl:n.getScaledToFillImageUrl,getScaledToFitImageUrl:n.getScaledToFitImageUrl,getImageUrl:n.getImageUrl,getVideoUrl:n.getVideoUrl,getAudioUrl:n.getAudioUrl,getDocumentUrl:n.getDocumentUrl,getShapeUrl:n.getShapeUrl}},4364(t,e,i){"use strict";var n,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,s={};((t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})})(s,{AddressTag:()=>A,DeliveryMethod:()=>N,EmailTag:()=>j,FactorStatus:()=>R,FactorType:()=>I,MfaReason:()=>O,PhoneTag:()=>k,PrivacyStatus:()=>T,Reason:()=>C,StateType:()=>x,Status:()=>Q,StatusName:()=>P,TenantType:()=>D,changePassword:()=>q,loginV2:()=>J,logout:()=>X,registerV2:()=>V,signOn:()=>Y}),t.exports=(n=s,((t,e,i,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let s of r(e))p.call(t,s)||s===i||o(t,s,{get:()=>e[s],enumerable:!(n=a(e,s))||n.enumerable});return t})(o({},"__esModule",{value:!0}),n));var d=i(705),c=i(6071),l=i(4714),u=i(3477),_=i(3477),h=i(7928),f=i(3487),m=i(3487),g=i(6886),w=i(4714);function y(t){return(0,w.resolveUrl)(Object.assign(t,{domainToMappings:{_:[{srcPath:"/_api/iam/authentication",destPath:""}],"users._base_domain_":[{srcPath:"/iam/wix/google",destPath:"/v1/sso/callback/root/0e6a50f5-b523-4e29-990d-f37fa2ffdd69"},{srcPath:"/authentication",destPath:""},{srcPath:"/_api/iam/authentication/v1/sso/callback",destPath:"/v1/sso/callback"},{srcPath:"/_api/iam/authentication",destPath:""}],"www.wixapis.com":[{srcPath:"/_api/iam/authentication",destPath:""},{srcPath:"/iam/authentication",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/iam/authentication",destPath:""}],"wixbo.ai":[{srcPath:"/_api/iam/authentication",destPath:""}],"wix-bo.com":[{srcPath:"/_api/iam/authentication",destPath:""}],"dev._base_domain_":[{srcPath:"/_api/iam/authentication",destPath:""}],"manage._base_domain_":[{srcPath:"/_api/authentication",destPath:""}],"www._base_domain_":[{srcPath:"/_api/iam/authentication",destPath:""}],"*.dev.wix-code.com":[{srcPath:"/iam/authentication/v2/sign-on",destPath:"/v2/sign-on"},{srcPath:"/iam/authentication/v1/logout",destPath:"/v1/logout"},{srcPath:"/iam/authentication/v2/change-password",destPath:"/v2/change-password"},{srcPath:"/iam/authentication/v2/verify",destPath:"/v2/verify"},{srcPath:"/iam/authentication/v2/login",destPath:"/v2/login"},{srcPath:"/iam/authentication/v2/register",destPath:"/v2/register"},{srcPath:"/iam/authentication/v2",destPath:"/v2"}]}}))}var v="@wix/auto_sdk_identity_authentication";var b=i(3967),E=i(3967),S=i(6886),T=(t=>(t.UNDEFINED="UNDEFINED",t.PUBLIC="PUBLIC",t.PRIVATE="PRIVATE",t))(T||{}),j=(t=>(t.UNTAGGED="UNTAGGED",t.MAIN="MAIN",t.HOME="HOME",t.WORK="WORK",t))(j||{}),k=(t=>(t.UNTAGGED="UNTAGGED",t.MAIN="MAIN",t.HOME="HOME",t.MOBILE="MOBILE",t.WORK="WORK",t.FAX="FAX",t))(k||{}),A=(t=>(t.UNTAGGED="UNTAGGED",t.HOME="HOME",t.WORK="WORK",t.BILLING="BILLING",t.SHIPPING="SHIPPING",t))(A||{}),x=(t=>(t.UNKNOWN_STATE="UNKNOWN_STATE",t.SUCCESS="SUCCESS",t.REQUIRE_OWNER_APPROVAL="REQUIRE_OWNER_APPROVAL",t.REQUIRE_EMAIL_VERIFICATION="REQUIRE_EMAIL_VERIFICATION",t.STATUS_CHECK="STATUS_CHECK",t))(x||{}),P=(t=>(t.UNKNOWN_STATUS="UNKNOWN_STATUS",t.PENDING="PENDING",t.ACTIVE="ACTIVE",t.DELETED="DELETED",t.BLOCKED="BLOCKED",t.OFFLINE="OFFLINE",t))(P||{}),C=(t=>(t.UNKNOWN_REASON="UNKNOWN_REASON",t.PENDING_ADMIN_APPROVAL_REQUIRED="PENDING_ADMIN_APPROVAL_REQUIRED",t.PENDING_EMAIL_VERIFICATION_REQUIRED="PENDING_EMAIL_VERIFICATION_REQUIRED",t))(C||{}),I=(t=>(t.UNKNOWN_FACTOR_TYPE="UNKNOWN_FACTOR_TYPE",t.PASSWORD="PASSWORD",t.SMS="SMS",t.CALL="CALL",t.EMAIL="EMAIL",t.TOTP="TOTP",t.PUSH="PUSH",t.WEBAUTHN="WEBAUTHN",t.RECOVERY_CODE="RECOVERY_CODE",t))(I||{}),Q=(t=>(t.INACTIVE="INACTIVE",t.ACTIVE="ACTIVE",t.REQUIRE_REENROLL="REQUIRE_REENROLL",t))(Q||{}),R=(t=>(t.UNKNOWN_FACTOR_STATUS="UNKNOWN_FACTOR_STATUS",t.ENABLED="ENABLED",t.REQUIRE_ACTIVATION="REQUIRE_ACTIVATION",t.REQUIRE_REENROLL="REQUIRE_REENROLL",t.ENABLED_BY_RULE="ENABLED_BY_RULE",t.DISABLED_BY_RULE="DISABLED_BY_RULE",t))(R||{}),O=(t=>(t.UNKNOWN_MFA_REASON="UNKNOWN_MFA_REASON",t.USER_SETTINGS="USER_SETTINGS",t.HIGH_RISK_LOGIN="HIGH_RISK_LOGIN",t))(O||{}),D=(t=>(t.UNKNOWN_TENANT_TYPE="UNKNOWN_TENANT_TYPE",t.ACCOUNT="ACCOUNT",t.SITE="SITE",t))(D||{}),N=(t=>(t.UNKNOWN_DELIVERY_METHOD="UNKNOWN_DELIVERY_METHOD",t.SMS="SMS",t.WHATSAPP="WHATSAPP",t))(N||{});async function M(t,e){const{httpClient:i,sideEffects:n}=arguments[2],o=function(t){return function({host:e}){const i=(0,g.transformPaths)(t,[{transformFn:u.transformSDKFloatToRESTFloat,paths:[{path:"profile.customFields.value.numValue"}]},{transformFn:f.transformSDKTimestampToRESTTimestamp,paths:[{path:"profile.customFields.value.dateValue"}]}]);return{entityFqdn:"wix.iam.authentication.v1.authentication",method:"POST",methodFqn:"wix.iam.authentication.v1.AuthenticationService.RegisterV2",packageName:v,migrationOptions:{optInTransformResponse:!0},url:y({protoPath:"/v2/register",data:i,host:e}),data:i,transformResponse:t=>(0,g.transformPaths)(t,[{transformFn:m.transformRESTTimestampToSDKTimestamp,paths:[{path:"identity.createdDate"},{path:"identity.updatedDate"},{path:"identity.identityProfile.customFields.value.dateValue"},{path:"additionalData.*.dateValue"}]},{transformFn:_.transformRESTFloatToSDKFloat,paths:[{path:"identity.identityProfile.customFields.value.numValue"},{path:"additionalData.*.numValue"}]}])}}}((0,S.transformPaths)((0,c.renameKeysFromSDKRequestToRESTRequest)({loginId:t,password:e?.password,profile:e?.profile,captchaTokens:e?.captchaTokens,clientMetaData:e?.clientMetaData}),[{transformFn:b.transformSDKAddressToRESTAddress,paths:[{path:"profile.addresses.address"}]}]));n?.onSiteCall?.();try{const t=await i.request(o);return n?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)((0,S.transformPaths)(t.data,[{transformFn:E.transformRESTAddressToSDKAddress,paths:[{path:"identity.identityProfile.addresses.address"}]}]))}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{loginId:"$[0]",password:"$[1].password",profile:"$[1].profile",captchaTokens:"$[1].captchaTokens",clientMetaData:"$[1].clientMetaData"},singleArgumentUnchanged:!1},["loginId","options"]);throw n?.onError?.(t),e}}async function L(t,e){const{httpClient:i,sideEffects:n}=arguments[2],o=function(t){return function({host:e}){return{entityFqdn:"wix.iam.authentication.v1.authentication",method:"POST",methodFqn:"wix.iam.authentication.v1.AuthenticationService.LoginV2",packageName:v,migrationOptions:{optInTransformResponse:!0},url:y({protoPath:"/v2/login",data:t,host:e}),data:t,transformResponse:t=>(0,g.transformPaths)(t,[{transformFn:m.transformRESTTimestampToSDKTimestamp,paths:[{path:"identity.createdDate"},{path:"identity.updatedDate"},{path:"identity.identityProfile.customFields.value.dateValue"},{path:"additionalData.*.dateValue"}]},{transformFn:_.transformRESTFloatToSDKFloat,paths:[{path:"identity.identityProfile.customFields.value.numValue"},{path:"additionalData.*.numValue"}]}])}}}((0,c.renameKeysFromSDKRequestToRESTRequest)({loginId:t,password:e?.password,captchaTokens:e?.captchaTokens,clientMetaData:e?.clientMetaData}));n?.onSiteCall?.();try{const t=await i.request(o);return n?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)((0,S.transformPaths)(t.data,[{transformFn:E.transformRESTAddressToSDKAddress,paths:[{path:"identity.identityProfile.addresses.address"}]}]))}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{loginId:"$[0]",password:"$[1].password",captchaTokens:"$[1].captchaTokens",clientMetaData:"$[1].clientMetaData"},singleArgumentUnchanged:!1},["loginId","options"]);throw n?.onError?.(t),e}}async function U(t){const{httpClient:e,sideEffects:i}=arguments[1],n=function(t){return function({host:e}){return{entityFqdn:"wix.iam.authentication.v1.authentication",method:"POST",methodFqn:"wix.iam.authentication.v1.AuthenticationService.ChangePassword",packageName:v,migrationOptions:{optInTransformResponse:!0},url:y({protoPath:"/v2/change-password",data:t,host:e}),data:t}}}((0,c.renameKeysFromSDKRequestToRESTRequest)({newPassword:t}));i?.onSiteCall?.();try{const t=await e.request(n);i?.onSuccess?.(t)}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{newPassword:"$[0]"},singleArgumentUnchanged:!1},["newPassword"]);throw i?.onError?.(t),e}}async function F(t,e){const{httpClient:i,sideEffects:n}=arguments[2],o=function(t){return function({host:e}){const i=(0,g.transformPaths)(t,[{transformFn:u.transformSDKFloatToRESTFloat,paths:[{path:"profile.customFields.value.numValue"}]},{transformFn:f.transformSDKTimestampToRESTTimestamp,paths:[{path:"profile.customFields.value.dateValue"}]}]);return{entityFqdn:"wix.iam.authentication.v1.authentication",method:"POST",methodFqn:"wix.iam.authentication.v1.AuthenticationService.SignOn",packageName:v,migrationOptions:{optInTransformResponse:!0},url:y({protoPath:"/v2/sign-on",data:i,host:e}),data:i,transformResponse:t=>(0,g.transformPaths)(t,[{transformFn:m.transformRESTTimestampToSDKTimestamp,paths:[{path:"identity.createdDate"},{path:"identity.updatedDate"},{path:"identity.identityProfile.customFields.value.dateValue"}]},{transformFn:_.transformRESTFloatToSDKFloat,paths:[{path:"identity.identityProfile.customFields.value.numValue"}]}])}}}((0,S.transformPaths)((0,c.renameKeysFromSDKRequestToRESTRequest)({loginId:t,profile:e?.profile,verifyEmail:e?.verifyEmail,mergeExistingContact:e?.mergeExistingContact}),[{transformFn:b.transformSDKAddressToRESTAddress,paths:[{path:"profile.addresses.address"}]}]));n?.onSiteCall?.();try{const t=await i.request(o);return n?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)((0,S.transformPaths)(t.data,[{transformFn:E.transformRESTAddressToSDKAddress,paths:[{path:"identity.identityProfile.addresses.address"}]}]))}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{loginId:"$[0]",profile:"$[1].profile",verifyEmail:"$[1].verifyEmail",mergeExistingContact:"$[1].mergeExistingContact"},singleArgumentUnchanged:!1},["loginId","options"]);throw n?.onError?.(t),e}}async function H(t){const{httpClient:e,sideEffects:i}=arguments[1],n=function(t){return function({host:e}){return{entityFqdn:"wix.iam.authentication.v1.authentication",method:"GET",methodFqn:"wix.iam.authentication.v1.AuthenticationService.Logout",packageName:v,migrationOptions:{optInTransformResponse:!0},url:y({protoPath:"/v1/logout",data:t,host:e}),params:(0,l.toURLSearchParams)(t),transformResponse:t=>(0,g.transformPaths)(t,[{transformFn:h.transformRESTBytesToSDKBytes,paths:[{path:"body"}]}])}}}((0,c.renameKeysFromSDKRequestToRESTRequest)({postLogoutRedirectUri:t?.postLogoutRedirectUri,clientId:t?.clientId}));i?.onSiteCall?.();try{const t=await e.request(n);return i?.onSuccess?.(t),(0,c.renameKeysFromRESTResponseToSDKResponse)(t.data)}catch(t){const e=(0,d.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{postLogoutRedirectUri:"$[0].postLogoutRedirectUri",clientId:"$[0].clientId"},singleArgumentUnchanged:!1},["options"]);throw i?.onError?.(t),e}}function W(t){return(e,i)=>M(e,i,{httpClient:t})}function K(t){return(e,i)=>L(e,i,{httpClient:t})}function $(t){return e=>U(e,{httpClient:t})}function B(t){return(e,i)=>F(e,i,{httpClient:t})}function G(t){return e=>H(e,{httpClient:t})}var z=i(4714),V=(0,z.createRESTModule)(W),J=(0,z.createRESTModule)(K),q=(0,z.createRESTModule)($),Y=(0,z.createRESTModule)(B),X=(0,z.createRESTModule)(G)},4472(){},4634(t){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},4714(t,e,i){"use strict";var n=i(8287).hp;Object.defineProperty(e,"__esModule",{value:!0}),e.RESTResponseToSDKResponseRenameMap=void 0,e.createRESTModule=function(t,e=!1){return(0,o.contextualizeRESTModuleV2)(t,e)},e.toURLSearchParams=function(t,e){const i=r(t),n=Object.entries(i).some(([t,e])=>t.includes(".")||Array.isArray(e)&&e.some(t=>"object"==typeof t));return e&&n?new URLSearchParams({".r":p(JSON.stringify(t))}):Object.entries(i).reduce((t,[e,i])=>((Array.isArray(i)?i:[i]).forEach(n=>{null==n||Array.isArray(i)&&"object"==typeof n||t.append(e,n)}),t),new URLSearchParams)},e.resolveUrl=function(t){const e=function(t,e){const i=e[t]||e._;if(i)return i;const n=function(t,e){return Object.entries(e).find(([e])=>{const[,...i]=t.split(".");return i.join(".")===e})?.[1]}(t,e);if(!n&&function(t){return!!t.match(/\._base_domain_$/)}(t))return e[u];return n??[]}((i=t.host,function(t){return t.replace("create.editorx.com","editor.editorx.com")}(i).replace(s,"._base_domain_").replace(c,"._api_base_domain_").replace(l,"*.dev.wix-code.com")),t.domainToMappings);var i;return function(t,e){const i=e?.find(e=>t.startsWith(e.destPath));if(!i)return t;return i.srcPath+t.slice(i.destPath.length)}((n=t.protoPath,o=t.data||{},n.split("/").map(t=>function(t,e){const i=t.match(d)||[],n=i[1];if(n){const o=t.replace(i[0],"");return function(t,e,i,n){let o=t;for(const t of e.split(".")){if(!o)return i;o=o[t]}return`${o}${n}`}(e,n,t,o)}return t}(t,o)).join("/")),e);var n,o};const o=i(274);var a=i(3267);function r(t,e=""){const i={};return Object.entries(t).forEach(([t,n])=>{const o=null!==n&&"object"==typeof n&&!Array.isArray(n),a=function(t,e){return`${t}${t?".":""}${e}`}(e,t);if(o){const t=r(n,a);Object.assign(i,t)}else i[a]=n}),i}Object.defineProperty(e,"RESTResponseToSDKResponseRenameMap",{enumerable:!0,get:function(){return a.RESTResponseToSDKResponseRenameMap}});const p=t=>("undefined"!=typeof btoa?btoa(t):n.from(t,"utf-8").toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),s=new RegExp(`\\.(${["wix.com","editorx.com"].join("|")})$`),d=/{(.*)}/,c=new RegExp(`\\.(${["42.wixprod.net","uw2-edt-1.wixprod.net"].join("|")})$`),l=new RegExp(".*\\.dev.wix-code.com$");const u="www._base_domain_"},4757(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha256=function(t){return(new a).update(t).arrayBuffer()};const i=[24,16,8,0],n=[-2147483648,8388608,32768,128],o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];class a{blocks;h0;h1;h2;h3;h4;h5;h6;h7;block;start;bytes;hBytes;finalized;hashed;first;lastByteIndex;chromeBugWorkAround;constructor(){this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}update(t){const e=this.blocks,n=t.length;let o,a,r=0;for(;r>>2]|=o<>>2]|=(192|o>>>6)<>>2]|=(128|63&o)<=57344?(e[a>>>2]|=(224|o>>>12)<>>2]|=(128|o>>>6&63)<>>2]|=(128|63&o)<>>2]|=(240|o>>>18)<>>2]|=(128|o>>>12&63)<>>2]|=(128|o>>>6&63)<>>2]|=(128|63&o)<=64?(this.block=e[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}hash(){const t=this.blocks;let e,i,n,a,r,p,s,d,c,l,u,_=this.h0,h=this.h1,f=this.h2,m=this.h3,g=this.h4,w=this.h5,y=this.h6,v=this.h7;for(e=16;e<64;++e)r=t[e-15],i=(r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3,r=t[e-2],n=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,t[e]=t[e-16]+i+t[e-7]+n|0;for(u=h&f,e=0;e<64;e+=4)this.first?(d=704751109,r=t[0]-210244248,v=r-1521486534|0,m=r+143694565|0,this.first=!1):(i=(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),d=_&h,a=d^_&f^u,s=g&w^~g&y,r=v+n+s+o[e]+t[e],p=i+a,v=m+r|0,m=r+p|0),i=(m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=m&_,a=c^m&h^d,s=v&g^~v&w,r=y+n+s+o[e+1]+t[e+1],p=i+a,y=f+r|0,f=r+p|0,i=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),l=f&m,a=l^f&_^c,s=y&v^~y&g,r=w+n+s+o[e+2]+t[e+2],p=i+a,w=h+r|0,h=r+p|0,i=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),n=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),u=h&f,a=u^h&m^l,s=w&y^~w&v,r=g+n+s+o[e+3]+t[e+3],p=i+a,g=_+r|0,_=r+p|0,this.chromeBugWorkAround=!0;this.h0=this.h0+_|0,this.h1=this.h1+h|0,this.h2=this.h2+f|0,this.h3=this.h3+m|0,this.h4=this.h4+g|0,this.h5=this.h5+w|0,this.h6=this.h6+y|0,this.h7=this.h7+v|0}finalize(){if(this.finalized)return;this.finalized=!0;const t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=n[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),e.setUint32(28,this.h7),t}}},4857(){},4878(t,e){"use strict";function i(t,e,i){t.addEventListener?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function n(t,e,i){t.removeEventListener?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}Object.defineProperty(e,"__esModule",{value:!0}),e.addListener=i,e.removeListener=n,e.loadFrame=function(t){const e=document.createElement("iframe");return e.style.display="none",e.src=t,document.body.appendChild(e)},e.addPostMessageListener=function(t){let e,o;return new Promise((n,a)=>{e=e=>{e.data&&e.data.state===t&&n(e.data)},i(window,"message",e),o=setTimeout(()=>{a(new Error("OAuth flow timed out"))},12e4)}).finally(()=>{clearTimeout(o),n(window,"message",e)})}},4954(t,e,i){function n(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i3?(o=h===n)&&(s=a[(p=a[4])?5:(p=3,3)],a[4]=a[5]=t):a[0]<=_&&((o=i<2&&_n||n>h)&&(a[4]=i,a[5]=n,u.n=h,p=0))}if(o||i>1)return r;throw l=!0,n}return function(o,c,h){if(d>1)throw TypeError("Generator is already running");for(l&&1===c&&_(c,h),p=c,s=h;(e=p<2?t:s)||!l;){a||(p?p<3?(p>1&&(u.n=-1),_(p,s)):u.n=s:u.v=s);try{if(d=2,a){if(p||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,p<2&&(p=0)}else 1===p&&(e=a.return)&&e.call(a),p<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),p=1);a=t}else if((e=(l=u.n<0)?s:i.call(n,u))!==r)break}catch(e){a=t,p=1,s=e}finally{d=1}}return{value:e,done:l}}}(i,o,a),!0),d}var r={};function p(){}function s(){}function l(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(c(e={},n,function(){return this}),e),_=l.prototype=p.prototype=Object.create(u);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,c(t,o,"GeneratorFunction")),t.prototype=Object.create(_),t}return s.prototype=l,c(_,"constructor",l),c(l,"constructor",s),s.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(_),c(_,o,"Generator"),c(_,n,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),(d=function(){return{w:a,m:h}})()}function c(t,e,i,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}c=function(t,e,i,n){function a(e,i){c(t,e,function(t){return this._invoke(e,i,t)})}e?o?o(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(a("next",0),a("throw",1),a("return",2))},c(t,e,i,n)}function l(t,e,i,n,o,a,r){try{var p=t[a](r),s=p.value}catch(t){return void i(t)}p.done?e(s):Promise.resolve(s).then(n,o)}function u(t){return function(){var e=this,i=arguments;return new Promise(function(n,o){var a=t.apply(e,i);function r(t){l(a,n,o,r,p,"next",t)}function p(t){l(a,n,o,r,p,"throw",t)}r(void 0)})}}function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}if(void 0===window.pixelAdded){var h=function(){try{if("app"!=Wi||yi("poptin_enable_console_messages")){for(var t,e=(new Error).stack.split("\n")[2].trim().replace(/^at\s+/,""),i=arguments.length,n=new Array(i),o=0;o1||1==jQ_ver_arr[0]&&jQ_ver_arr[1]>7?jQ224="noJqueryUi"==poptinAfterPageLoad?$:$.noConflict():o=!1):void 0!==window.jQuery&&(jQ_ver_arr=jQuery.fn.jquery.split("."),jQ_ver_arr[0]>1||1==jQ_ver_arr[0]&&jQ_ver_arr[1]>7?jQ224="noJqueryUi"==poptinAfterPageLoad?jQuery:jQuery.noConflict():o=!1),o||"noJqueryUi"==poptinAfterPageLoad?v():console.log("Upgrade your jQuery to atleast 1.7 to show poptins")}}catch(t){n(i)}}()},w=function(){void 0!==Li.id&&("undefined"!=typeof Storage?null==window.sessionStorage.getItem("poptin_client_id")&&window.sessionStorage.setItem("poptin_client_id",Li.id):yi("poptin_client_id")||mi("poptin_client_id",Li.id,365))},y=function(){var t=Li.id;return null==Li.id&&("undefined"!=typeof Storage&&null!=window.sessionStorage.getItem("poptin_client_id")?t=window.sessionStorage.getItem("poptin_client_id"):yi("poptin_client_id")&&(t=gi("poptin_client_id"))),t},v=function(){T(),j(),H(),W(),B(),J(),Nt(),poptin_disable_localstorage||(k(),P(),A()),b(),E()},b=function(){var t=!1;if(void 0!==window.ShopifyAnalytics&&(void 0===(t=window.ShopifyAnalytics.meta.page.customerId)&&(t=!1),t&&"product"==window.ShopifyAnalytics.meta.page.resourceType)){var e=window.ShopifyAnalytics.meta.page.resourceId.toString(),i=window.ShopifyAnalytics.meta.product.type,n=window.ShopifyAnalytics.meta.product.variants[0].name;setTimeout(function(){var o={product_id:e,product_name:n,category:i},a=yi("poptin_browse_abandonment_products")?JSON.parse(gi("poptin_browse_abandonment_products")):[];if(a.length>0)if(a.some(function(t){return t.product_id===e})){var r=a.findIndex(function(t){return t.product_id===e});a[r].category=i}else a.push(o);else a.push(o);mi("poptin_browse_abandonment_products",JSON.stringify(a)),jQ224.get(Ui+"/api/display/shopify/save/browse-abandonment?clientId="+y()+"&customer="+t.toString()+"&products="+JSON.stringify(a)+"&data_for=abandonment",{},"json")},5e3)}},E=function(){var t=!1;void 0!==window.ShopifyAnalytics&&(void 0===(t=window.ShopifyAnalytics.meta.page.customerId)&&(t=!1),t&&(yi("poptin_fetch_initial_shopify_cart_for_filter")||(S(),mi("poptin_fetch_initial_shopify_cart_for_filter",!0)),function(t,e){"function"==typeof e&&(t.fetch=function(){var t=e.apply(this,arguments),i=pt();return t.then(function(t){["".concat(window.location.origin).concat(i,"cart/add.js"),"".concat(window.location.origin).concat(i,"cart/add"),"".concat(window.location.origin).concat(i,"cart/update.js"),"".concat(window.location.origin).concat(i,"cart/update"),"".concat(window.location.origin).concat(i,"cart/change.js"),"".concat(window.location.origin).concat(i,"cart/change"),"".concat(window.location.origin).concat(i,"cart/clear.js"),"".concat(window.location.origin).concat(i,"cart/clear")].includes(t.url)&&t.clone().json().then(function(t){S()})}),t})}(window,window.fetch)))},S=function(){jQ224.ajax({url:"/cart.js",type:"get",dataType:"json",async:!1},"json").done(function(t){var e=[],i=0;t.items.length>0&&(jQ224.each(t.items,function(t,i){var n={product_id:i.product_id.toString(),product_name:i.product_title};e.push(n)}),i=t.total_price),jQ224.get(Ui+"/api/display/shopify/save/browse-abandonment?clientId="+y()+"&customer="+Jo.toString()+"&products="+JSON.stringify(e)+"&data_for=cart&total_cart_value="+i,{},"json")})},T=function(){void 0!==window.Shopify&&window.Shopify.shop&&(Shopify&&Shopify.shop&&("undefined"!=typeof Storage?null==window.sessionStorage.getItem("poptin_client_id")&&jQ224.ajax({url:"".concat(Ui,"/api/display/shopify/get-client-id/").concat(Shopify.shop),type:"GET",dataType:"json",async:!1,success:function(t){window.sessionStorage.setItem("poptin_client_id",t.client_id)}}):yi("poptin_client_id")||jQ224.ajax({url:"".concat(Ui,"/api/display/shopify/get-client-id/").concat(Shopify.shop),type:"GET",dataType:"json",async:!1,success:function(t){mi("poptin_client_id",t.client_id,365)}})),jQ224.ajax({url:pt()+"cart.js",type:"get",dataType:"json",async:!1},"json").done(function(t){var e=t.total_price/100;$o.push({tag_input:"shpfy_value",pre:1,value:e}),$o.push({tag_input:"shpfy_count",pre:1,value:t.item_count}),jQ224.ajax({url:Ui+"/api/display/shopify/get-price-rules/"+y(),type:"get",async:!1,success:function(t){Bo=t.price_rules;var i=null;jQ224(Bo).each(function(t,n){if(null==i&&("shipping_line"==n.target_type&&"each"==n.allocation_method||"line_item"==n.target_type&&"across"==n.allocation_method)&&"all"==n.target_selection){var o=(i=n)&&i.prerequisite_subtotal_range&&i.prerequisite_subtotal_range.greater_than_or_equal_to?parseFloat(i.prerequisite_subtotal_range.greater_than_or_equal_to):0;$o.push({tag_input:"shpfy_thres",pre:1,value:o}),$o.push({tag_input:"shpfy_gap",pre:1,value:o-e})}})}})}))},j=function(){var t=Ke().length>1?Ke():document.referrer,e=t&&t.startsWith("https://")?"secure":t&&t.startsWith("http://")?"unsecure":"";t=t.replace(/^https?:\/\//,""),document.referrer.length>1&&(mi("poptin_referrer",t,.00138888888888889),e&&mi("poptin_referrer_protocol",e,.00138888888888889)),setInterval(function(){mi("poptin_referrer",t,.00138888888888889),e&&mi("poptin_referrer_protocol",e,.00138888888888889)},6e4)},k=function(){if(document.referrer&&-1!==document.referrer.indexOf(window.location.host)?document.referrer:null){var t=new URL(document.referrer),e=t.pathname+t.search,i=localStorage.getItem("poptin_previous_visited_pages");if(i&&i.length>0){var n=i.split("|");if(n.includes(e)){var o=n.indexOf(e);n.splice(o,1)}n.push(e),localStorage.setItem("poptin_previous_visited_pages",n.join("|"))}else localStorage.setItem("poptin_previous_visited_pages",e)}},A=function(){var t=document.location.href,e=localStorage.getItem("poptin_all_visited_pages");if(e&&e.length>0){var i=e.split("|");if(i.includes(t)){var n=i.indexOf(t);i.length-1!=n&&i.push(t)}else i.push(t);localStorage.setItem("poptin_all_visited_pages",i.join("|"))}else localStorage.setItem("poptin_all_visited_pages",t)},P=function(){if(document.referrer&&-1!==document.referrer.indexOf(window.location.host)?document.referrer:null){var t=new URL(document.referrer),e=t.pathname+t.search+";"+C(),i=localStorage.getItem("poptin_previous_visited_pages_with_timestamp");if(i&&i.length>0){var n=i.split("|");if(n.includes(e)){var o=n.indexOf(e);n.splice(o,1)}n.push(e),localStorage.setItem("poptin_previous_visited_pages_with_timestamp",n.join("|"))}else localStorage.setItem("poptin_previous_visited_pages_with_timestamp",e)}},C=function(){return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date).reduce(function(t,e){return"literal"===e.type?t.push("-"):t.push(e.value),t},[]).join("")},I=function(t){var e=function(t){if(t){var e=jQ224("[data-poptin-id="+t.poptin_id+"]");if(e.length){var i=e.find("input#poptinDesignInputTextFieldPhone").get(0);i&&window.poptinValidationState.phoneValidationLoaded&&poptinPhoneValidation(t,i),(window.poptinValidationState.emailAutofillLoaded||window.poptinValidationState.emailValidationLoaded)&&poptinEmailValidation(t),birthdayDateValidation(t)}}};window.validatePoptinInputs=e,window.poptinValidationState.loaded&&e(t)},Q=function(){var t=window.poptinValidationState.emailAutofillNotRequired||window.poptinValidationState.emailAutofillRequested&&window.poptinValidationState.emailAutofillLoaded,e=window.poptinValidationState.emailValidationNotRequired||window.poptinValidationState.emailValidationRequested&&window.poptinValidationState.emailValidationLoaded,i=window.poptinValidationState.phoneValidationNotRequired||window.poptinValidationState.phoneValidationRequested&&window.poptinValidationState.phoneValidationLoaded;!window.poptinValidationState.loaded&&t&&e&&i&&(window.poptinInputValidations||(window.poptinInputValidations=I),window.poptinValidationState.loaded=!0,"function"==typeof window.validatePoptinInputs&&window.currentPoptin&&setTimeout(function(){window.validatePoptinInputs(window.currentPoptin)},100))},R=function(t){if(window.poptinValidationState.phoneValidationRequested&&!window.poptinValidationState.phoneValidationLoaded&&!window.poptinValidationState.phoneValidationNotRequired){if(window.intlTelInput)return window.poptinValidationState.phoneValidationLoaded=!0,Q(),void setTimeout(function(){D(t)},500);window.poptinValidationState.phoneValidationRequested=!1}if(window.poptinValidationState.phoneValidationRequested||window.poptinValidationState.phoneValidationNotRequired)window.poptinValidationState.phoneValidationRequested&&window.poptinValidationState.phoneValidationLoaded&&!window.poptinValidationState.phoneValidationNotRequired&&setTimeout(function(){D(t)},500);else{window.poptinValidationState.phoneValidationRequested=!0;try{O(t,!0)}catch(t){}Promise.all([new Promise(function(t,e){var i=document.createElement("link");i.rel="stylesheet",i.href=Hi+"/phone-validation/css/intlTelInput.css",i.onload=t,i.onerror=e,document.head.appendChild(i)}),new Promise(function(t,e){var i=document.createElement("script");i.onload=t,i.onerror=e,i.async=!0,i.src=Hi+"/phone-validation/js/intlTelInput.min.js",document.body.appendChild(i)}),new Promise(function(t,e){var i=document.createElement("script");i.onload=t,i.onerror=e,i.async=!0,i.src=Hi+"/phone-validation/js/utils.js",document.body.appendChild(i)})]).then(function(){return window.poptinValidationState.phoneValidationLoaded=!0,new Promise(function(e){setTimeout(function(){D(t),e()},500)})}).then(function(){Q()}).catch(function(t){window.poptinValidationState.phoneValidationNotRequired=!1,window.poptinValidationState.phoneValidationRequested=!1,Q(),h("Phone validation setup failed:",t)}).finally(function(){try{O(t,!1)}catch(t){}})}},O=function(t,e){if(t&&t.poptin_id){var i=jQ224('[data-poptin-id="'+t.poptin_id+'"]');if(i.length){var n=i.find(".poptin-form-submit-button"),o=i.find("input.poptin-form-submit-button"),a=n.find(".froala-editor-button");e?(n.length&&n.addClass("poptin-btn-loading").attr("aria-busy","true").attr("aria-disabled","true"),o.length&&(void 0===o.data("orig-text")&&o.data("orig-text",o.val()),o.prop("disabled",!0).addClass("poptin-btn-loading"),o.val("")),a.length&&(void 0===a.data("orig-html")&&a.data("orig-html",a.html()),a.addClass("poptin-btn-loading"),a.html(""),a.attr("aria-busy","true").attr("aria-disabled","true"))):(n.length&&n.removeClass("poptin-btn-loading").removeAttr("aria-busy").removeAttr("aria-disabled"),o.length&&(o.prop("disabled",!1).removeClass("poptin-btn-loading"),void 0!==o.data("orig-text")&&o.val(o.data("orig-text"))),a.length&&(a.removeClass("poptin-btn-loading").removeAttr("aria-busy").removeAttr("aria-disabled"),void 0!==a.data("orig-html")&&a.html(a.data("orig-html"))))}}},D=function(t){var e=jQ224('[data-poptin-id="'+t.poptin_id+'"] input[data-name="poptinDesignInputTextFieldPhone"]');e.length&&window.intlTelInput&&e.each(function(){var t=this;if(!t._iti&&!jQ224(t).parents(".iti").length)try{var e=window.intlTelInput(t,{initialCountry:"zz"!==ao.toLowerCase()?ao:"us",autoPlaceholder:"aggressive",nationalMode:!0,utilsScript:"https://cdn.jsdelivr.net/npm/intl-tel-input@18.2.1/build/js/utils.js",customPlaceholder:function(e){return t.required?e+"*":e}});t._iti=e;var i=e.getSelectedCountryData().iso2,n=!1,o=!1;t.addEventListener("open:countrydropdown",function(){n=!0}),t.addEventListener("countrychange",function(){var t=e.getSelectedCountryData().iso2;n?(i=t,n=!1):o||(o=!0,e.setCountry(i),o=!1)}),e.promise&&e.promise.then(function(){t._utilsLoaded=!0})}catch(t){h("Phone input initialization error:",t)}})},N=function(t){if(t&&Object.values(t).length){for(var e=null,i=!1,n=null,o=0,a=Object.values(t);o0){var i=e.split("|");if(i.includes(t)){var n=i.indexOf(t);i.splice(n,1)}return i.push(t),i.join("|")}return t},F=function(){var t=window.location.pathname,e=localStorage.getItem("poptin_previous_visited_pages");if(e&&e.length>0){var i=e.split("|");if(i.includes(t)){var n=i.indexOf(t);i.splice(n,1)}return i.push(t),i.join("|")}return t},H=function(){var t=null!=previous_url_spa&&poptin_single_page_app?previous_url_spa:document.referrer,e=t&&t.startsWith("https://")?"secure":t&&t.startsWith("http://")?"unsecure":"";t=t.replace(/^https?:\/\//,""),mi("poptin_previous_url",t,.00138888888888889),e&&mi("poptin_previous_url_protocol",e,.00138888888888889)},W=function(){var t="ecwid_html"===document.documentElement.id;if(t){var e=function(t){if(!t.getAttribute("data-processed")&&function(t){return-1!==t.indexOf("/APIRequest/click/")||-1!==t.indexOf("/api/display/click/")}(t.href)){var e=t.href;i(),t.addEventListener("mouseenter",i),t.setAttribute("data-processed","true")}function i(){t.removeAttribute("href"),t.style.cursor="pointer",t.role="button",t.onclick=null,t.onmousedown=null,t.onmouseup=null;var i=function(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),console.log("Blocked poptin link:",e);try{var i;i=-1!==e.indexOf("/APIRequest/click/")?e.split("APIRequest/click/")[1]:e.split("api/display/click/")[1],Y(i)}catch(t){bi("displayPoptinOnClick()->error()",t,"OK",e,!1)}return!1};t.addEventListener("click",i,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseup",i,!0),t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",i,!0)}};new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){1===t.nodeType&&("A"===t.tagName&&e(t),t.querySelectorAll("a").forEach(e))})})}).observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll("a").forEach(e)}jQ224(document).on("mouseover","a:not(.poptin-click)",function(e){t||-1===this.href.indexOf("/APIRequest/click/")&&-1===this.href.indexOf("/api/display/click/")||(jQ224(this).addClass("poptin-click"),jQ224(this).attr("data-href",jQ224(this).attr("href")),jQ224(this).attr("href","javascript:void(0);"))}),jQ224(document).on("click","a.poptin-click",function(e){if(!t){h("displayPoptinOnClick"),e.preventDefault();try{poptin_id=jQ224(this).attr("data-href").split("click/")[1],Y(poptin_id)}catch(t){bi("displayPoptinOnClick()->error()",t,"OK",this.href,!1)}}}),jQ224(document).on("click",'a[data-poptinaction="onclick"],button[data-poptinaction="onclick"]',function(e){e.preventDefault();var i=jQ224(this).attr("data-poptinid");if(13===i.length&&!t){h("displayPoptinOnClick");try{Y(i)}catch(t){bi("displayPoptinOnClick()->error()",t,"OK",i,!1)}}})},K=function(t){return!(!jQ224(".poptin-popup[data-poptin-id="+t+"] .poptin_winning_screen.poptin-visible").length&&!jQ224(".poptin-popup[data-poptin-id="+t+"] .poptin_losing_screen.poptin-visible").length)||!!jQ224(".poptin-popup[data-poptin-id="+t+"] .poptin_thank_you_screen.poptin-visible").length},B=function(){h("set: onTextClickClose()");try{jQ224(".o-close").off("click")}catch(t){h(t)}jQ224(document).on("click",".o-close",function(t){poptin_id=jQ224(t.target).parents(".poptin-popup").attr("data-poptin_id"),f(poptin_id),window.poptins[poptin_id].poptin_trigger.close_trigger="cancel_click",closePoptin(poptin_id)})},G=function(t){h(t),jQ224.when(jQ224.ajax(t.poptin_url)).then(function(e,i,n){window.all_poptins[t.poptin_id].poptin=e,window.click_poptins[t.poptin_id].poptin=e},function(t,e,i){h(t)})},z=function(t,e,i,n,o){if(i=void 0!==i&&i,n=void 0!==n&&n,o=void 0!==o&&o,h("initiatePullPoptinsRequestOnClick()"),poptin_id=t.split("click/")[1].substr(0,13),void 0!==window.click_poptins[poptin_id]&&window.click_poptins[poptin_id].display)i&&Y(poptin_id);else{var a,r,p=window.location.href,s=Be()+" "+ei(),d=Ve(),c=document.title,l=0,u=0,_=[],f="",m=window.navigator.language,g=(null===(a=window.navigator)||void 0===a||null===(a=a.userAgentData)||void 0===a?void 0:a.platform)||(null===(r=window.navigator)||void 0===r?void 0:r.platform)||"Unknown",w="";if("undefined"!=typeof Shopify){var v=V();if(l=v.total_price||0,u=v.item_count||0,(_=v.items||[]).length>0)f=_.map(function(t){return t.variant_id}).join(","),w=_.map(function(t){return t.product_id}).join(",")}"undefined"!=typeof poptin_landing_page&&"&from_landing_page=1";var b={client_id:y(),domain:p,referrer:Ke(),previous_url:$e(),cookies:s,triggers:d,if_mobile:fo,page_title:c,poptin_display:e,origin_landing_page:Je(),cancel_visitor_count:n,previous_visited_pages:M(),previous_visited_pages_with_time_stamp:U(),all_visited_pages:L(),store_integration:zo,store_integration_customer_id:Vo,cart_total_price:l,cart_total_items:u,cart_products_ids_list:f,browser_language:m,operating_system:g,cart_products_org_ids_list:w,wix_cart_id:localStorage.getItem("poptin_wix_cart_id")};jQ224.post(t.replace("app","app"),b,"json").done(function(t){if(h(t),"not_allowed"===t.display)return"not_allowed"!==t.display||"Client restricted"!==t.message&&"You have been reached the max poptins views number"!==t.message||!0,h(t.display),!1;var e;oo=t.country,ao=t.country_code,vo=t.if_freemium,yo=t.lang,tt(yo),o?Y(e):(N(t.poptins),jQ224.each(t.poptins,function(){e=this,window.click_poptins[e.poptin_id]=e,i?1==landing_page_teaser_on?mt(window.click_poptins[e.poptin_id],0):"undefined"!=typeof poptin_landing_page?window.click_poptins[poptin_id].display&&Y(e.poptin_id):Y(e.poptin_id):G(e)}))}).fail(function(t,e,i){})}},V=function(){var t={};return jQ224.ajax({url:pt()+"cart.js",type:"get",dataType:"json",async:!1},"json").done(function(e){t=e}).fail(function(t,e,i){h("Cart Error")}),t},J=function(){try{"undefined"==typeof poptin_landing_page?X():(jQ224(".landing-form").show(),z(poptin_landing_page_url,!1,!0))}catch(t){}},q=function(t,e,i){$href=Ui+"/api/display/click/"+t,z($href,!0,e,i)},Y=function(t){null!=window.click_poptins[t]?(zi=window.click_poptins[t]).display?void 0===jQ224(".poptin-popup[data-poptin-id="+zi.poptin_id+"]")[0]&&(null==_(window.all_poptins)&&(window.all_poptins=new Object),poptin_template="",null!=window.all_poptins[zi.poptin_id]&&""!=window.all_poptins[zi.poptin_id].poptin&&(poptin_template=window.all_poptins[zi.poptin_id].poptin),window.all_poptins[zi.poptin_id]=zi,window.all_poptins[zi.poptin_id].poptin=poptin_template,window.poptins[zi.poptin_id]={},it(zi),nt(zi),window.poptins[zi.poptin_id].poptin_trigger={convert:!1,shown:!1,poptin_active:!0,scroll_flag:!0,mouse_leave_flag:!0,click_counter:0,trigger:"",close_trigger:""},Mt(zi,!0),Dt(zi,!0),bt(zi,!0),"embedded"!=zi.poptin_type&&"fullpage"!=zi.poptin_type&&Di(zi),Kt(zi),Qi(zi),Ri(zi)):poptin_display_trigger||q(t,!0,!1):q(t,!0,!1)},X=function(){if(console.log("initiatePullPoptinsRequest()"),fo&&fo&&window.history&&window.history.pushState&&"undefined"==typeof Ecwid){if(!poptin_single_page_app){var t=100;window.history.state&&window.history.state.page&&(t=window.history.state.page),window.history.pushState({page:t+1},"")}setTimeout(function(){h("pop_urls",ra),(ra="object"===_(ra)?ra:JSON.parse(ra))[ra.length-1]!=window.location.href&&(ra.push(window.location.href),h("pop_urls2",ra),sessionStorage.setItem("pop_urls",JSON.stringify(ra)))},300),"undefined"==typeof Ecwid&&window.addEventListener("popstate",function(){ra.pop(),h("pop_urls",ra),sessionStorage.setItem("pop_urls",JSON.stringify(ra))})}var e=window.location.href,i=Be()+" "+oi()+" "+ni()+" "+Mi("poptin_abtest_session_")+" "+ei(),n=Ve(),o=ai(),a=Ke(),r=$e(),p=document.title;jQ224(document).ready(function(){var t=document.querySelectorAll(".poptin-embedded"),s=t.length,d=[];if(s)for(var c=0;c0)f=_.map(function(t,e,i){return t.variant_id}).join(","),m=_.map(function(t,e,i){return t.product_id}).join(",")}var w=!!Go;jQ224(".poptin-embedded").empty(),jQ224.ajax({url:Ui+"/api/display/"+y(),type:"POST",data:{domain:e,referrer:a,previous_url:r,cookies:i,triggers:n,cc:o,poptin_forms_id:d,if_mobile:fo,page_title:p,origin_landing_page:Je(),if_page_refreshed:Si(),poptin_viewed_url:qe(),previous_visited_pages:M(),previous_visited_pages_with_current_page:F(),previous_visited_pages_with_time_stamp:U(),all_visited_pages:L(),store_integration:zo,store_integration_customer_id:Vo,wix_cart_id:localStorage.getItem("poptin_wix_cart_id"),cart_total_items:u,cart_total_price:l,cart_products_ids_list:f,cart_products_org_ids_list:m,preview_poptin_id:Go,cancel_visitor_count:w,converted_email:gi("poptin_converted_email")},dataType:"json",async:!0},"json").done(function(t){var e;window.all_poptins=t.poptins,vo=t.if_freemium,oo=t.country,ao=t.country_code,h(t),"not_allowed"!==t.display?(jQ224.each(window.all_poptins,function(e,i){this.ab_test_parent_id&&jQ224(".poptin-embedded[data-id='"+this.ab_test_parent_id+"']").attr("data-id",this.poptin_id),(this.display||this.is_teasers_on)&&("embedded"==this.poptin_type&&0==jQ224(".poptin-embedded[data-id='"+this.poptin_id+"']").length||(yo=t.lang,tt(t.lang),ot(this),go=!0)),this.on_click&&(window.click_poptins[this.poptin_id]=this,this.display||(yo=t.lang,tt(t.lang),h(this),G(this)))}),void 0!==window.wixDevelopersAnalytics&&t.wix_cart_details&&(e=t.wix_cart_details,cartItems=[],e.lineItems.length>0&&(cartItems=e.lineItems.map(function(t){return{product_id:t.rootCatalogItemId,product_name:t.productName.original,category:null}})),mi("poptin_wix_cart_products",JSON.stringify(cartItems)),mi("poptin_wix_cart_total_value",e.subtotal.amount)),go&&(yo=t.lang,tt(t.lang)),poptin_single_page_app&&setTimeout(function(){setInterval(function(){jQ224(".poptin-embedded").each(function(t){if(jQ224(this).is(":empty")){var e=jQ224(this).attr("data-id");poptin_display_form(e)}})},5e3)},5e3)):t.is_client_restriction?(upgrade_popup_setting=t.client_restriction_setting,Ni(t),!0):"not_allowed"!=t.display||"Client restricted"!=t.message&&"You have been reached the max poptins views number"!=t.message||!0,Z(t),Ye()}).fail(function(t,e,i){h("initiatePullPoptinsRequest()->auto->->error()")})})},Z=function(t){yi("poptin_user_ip")||null==t.ip||mi("poptin_user_ip",t.ip,365),(!yi("poptin_user_country_code")&&null!=t.cc||gi("poptin_user_country_code")!=t.cc&&null!=t.cc)&&mi("poptin_user_country_code",t.cc,365)},tt=function(t){winie=/Windows NT 6.1/i.test(navigator.userAgent)&&(/Trident/i.test(navigator.userAgent)||/MSIE/i.test(navigator.userAgent))?"-ie":"",font_link="",jQ224("#poptin_heb_fonts_preload").remove(),jQ224("#poptin_heb_fonts").remove(),font_link+='',font_link+='',poptin_disable_fa||0==jQ224("#poptin-fa-preload").length&&0==jQ224("#poptin-fa").length&&(jQ224("#poptin-fa-preload").remove(),jQ224("#poptin-fa").remove(),font_link+='',font_link+='',font_link+='',font_link+=''),Ui.indexOf("dev")>=0?0==jQ224("#poptin-css-file-preload").length&&0==jQ224("#poptin-css-file-preload").length&&(jQ224("#poptin-css-file-preload").remove(),jQ224("#poptin-css-file").remove(),font_link+='',font_link+=''):0==jQ224("#poptin-css-file-preload").length&&0==jQ224("#poptin-css-file-preload").length&&(jQ224("#poptin-css-file-preload").remove(),jQ224("#poptin-css-file").remove(),font_link+='',font_link+=''),jQ224("#poptin_custom_fonts_preconnect, #poptin_custom_fonts_preload").remove(),jQ224("head").append(''),"en"==t?(jQ224("#poptin_poppins_font_preload").remove(),jQ224("#poptin_poppins_font_link").remove(),poptin_disable_fonts||(jQ224("head").append(''),jQ224("head").append(''))):(jQ224("#poptin_opensanshebrew_font_preload").remove(),jQ224("#poptin_opensanshebrew_font_link").remove(),jQ224("head").append(''),jQ224("head").append('')),jQ224("head").append(font_link),lt()},et=function(t){t&&t.poptin_id&&window.poptinValidationState.loaded&&function(t){try{!function(t){var e=jQ224("[data-poptin-id="+t.poptin_id+"]");if(e.length){var i=e.find("input#poptinDesignInputTextFieldPhone").get(0);if(i)if("basic"==jQ224(i).attr("data-action-validate"))jQ224(i).off("blur").on("blur",function(){if(jQ224(".poptin-input-msg").remove(),i.value&&(p=i.value,!/^\+?[0-9-\s()]*$/.test(p)||i.value.length>15)){var t=parseInt(1e10*Math.random()),n=Pt()?"יש להזין מספר טלפון תקין":"Please enter a valid phone number";jQ224(i).parent().append(''+n+"");var o=jQ224(i).parents(".draggable-container"),a=parseFloat(e.attr("data-scale"))||1;if(a>=1){o.addClass("has-poptin-input-msg"),o.append(jQ224("#m"+t).clone().attr("id","c"+t));var r=jQ224("#m"+t);r.length&&o.length&&jQ224("#c"+t).css({top:(r.offset().top-o.offset().top)/a+3,left:(r.offset().left-o.offset().left)/a,width:parseInt(r.css("width"))+10,height:parseInt(r.css("height"))})}else o.removeClass("has-poptin-input-msg")}var p}),jQ224(i).off("input").on("input",function(t){var e=i.value.replace(/[^\d()+\-\s]/g,"");i.value=e});else if("international"==jQ224(i).attr("data-action-validate")&&window.poptinValidationState.phoneValidationLoaded){jQ224(i).removeAttr("required"),jQ224(i).off("open:countrydropdown close:countrydropdown focus blur"),"en"==jQ224(e).find("#poptinDraggableContainer").attr("data-lang")?i.style.setProperty("padding-left","70px","important"):i.style.setProperty("padding-right","70px","important");var n=jQ224(i).parents(".form-input-class").get(0);if(n&&n.style.setProperty("z-index","999998","important"),jQ224(i).on("open:countrydropdown",function(){e.find(".inputs-container").css("z-index","999")}),jQ224(i).on("close:countrydropdown",function(){var t=e.find(".inputs-container");t.length&&t.css("z-index",t.attr("data-z-index"))}),jQ224(i).on("focus",function(){jQ224(".poptin-input-msg").remove()}),0==jQ224(i).parents(".iti").length&&window.intlTelInput)try{var o=window.intlTelInput(i,{initialCountry:"zz"!==ao.toLowerCase()?ao:"us",autoPlaceholder:"aggressive",nationalMode:!0,utilsScript:"https://cdn.jsdelivr.net/npm/intl-tel-input@18.2.1/build/js/utils.js"}),a=o.getSelectedCountryData().iso2,r=!1,p=!1;i.addEventListener("open:countrydropdown",function(){r=!0}),i.addEventListener("countrychange",function(){var t=o.getSelectedCountryData().iso2;r?(a=t,r=!1):p||(p=!0,o.setCountry(a),p=!1)}),o&&o.promise&&o.promise.then(function(){jQ224(i).off("blur").on("blur",function(){if("undefined"!=typeof intlTelInputUtils){var t="+"===i.value[0]?intlTelInputUtils.numberFormat.INTERNATIONAL:intlTelInputUtils.numberFormat.NATIONAL,n=e.find(".iti__selected-flag .iti__flag");if(!n.length)return;var o=n.attr("class").slice(-2),a=intlTelInputUtils.formatNumber(i.value,o,t);i.value=a;var r=intlTelInputUtils.formatNumber(i.value,o,intlTelInputUtils.numberFormat.INTERNATIONAL);jQ224(i).attr("data-int-phone",r);var p="",s=window.intlTelInputGlobals.getInstance(i);if(i.value&&(s.isValidNumber()||(p=Pt()?"מספר לא תקין – יש לנסות שוב":"Invalid number - please try again")),jQ224(".poptin-input-msg").remove(),""!=p){var d=parseInt(1e10*Math.random());jQ224(i).parent().append(''+p+"");var c=jQ224(i).parents(".draggable-container"),l=parseFloat(e.attr("data-scale"))||1;if(l>=1){c.addClass("has-poptin-input-msg"),c.append(jQ224("#m"+d).clone().attr("id","c"+d));var u=jQ224("#m"+d);u.length&&c.length&&jQ224("#c"+d).css({top:(u.offset().top-c.offset().top)/l+3,left:(u.offset().left-c.offset().left)/l,width:parseInt(u.css("width"))+10,height:parseInt(u.css("height"))})}else c.removeClass("has-poptin-input-msg")}}})}).catch(function(t){h("Phone validation initialization error:",t)})}catch(t){h("Phone validation error:",t)}jQ224(i).off("input").on("input",function(t){var e=i.value.replace(/[^0-9()\s-]/g,"");i.value=e})}}}(t),function(t){if(window.poptinValidationState.emailAutofillLoaded){var e=jQ224("[data-poptin-id="+t.poptin_id+"]");if(e.length){var i="[data-poptin-id="+t.poptin_id+'] [name="poptinDesignInputTextFieldEmail"][data-action-validate="check-typos"], [data-poptin-id='+t.poptin_id+'] [name="poptinDesignInputTextFieldEmail"][data-action-validate="typos-business"]';try{var n=new EmailAutoFill({domains:[{name:"gmail.com",autoCompleteAfter:1,misspelledVariations:["gmial.com","gmai.com","gamil.com","gmal.com","gmail.cm","mgail.com","gmil.com","gmail.om","gmaill.com","gmaiil.com","gmaiill.com","gmi.com","gmail.co","gmali.com","gml.com","gma.com"]},{name:"yahoo.com",autoCompleteAfter:2,misspelledVariations:["yaho.com","yhoo.com","yaaho.com","yaahoo.com","yahu.com","yahuo.com","yahou.com","yah00.com","yaho0.com"]},{name:"icloud.com",autoCompleteAfter:2,misspelledVariations:["iclooud.com","iclud.com","iclod.com","icloudd.com","iccloud.com","iclloud.com","iclou.com","icl0ud.com"]},{name:"me.com",autoCompleteAfter:2},{name:"mac.com",autoCompleteAfter:2},{name:"outlook.com",autoCompleteAfter:2,misspelledVariations:["outlok.com","outluk.com","outloook.com","outloo.com","outlouk.com","outluok.com","outlk.com","oulook.com","otlook.com","outlk.com","outlo.com","outllook.com","0utlook.com","outl00k.com","outlo0k.com","out0olk.com"]},{name:"protonmail.com",autoCompleteAfter:2,misspelledVariations:["protonmal.com","pr0tonmail.com","prot0nmail.com","pr0t0nmail.com","prtonmail.com","protnmail.com","prootonmail.com","protunmial.com","pr0tunmial.com","prootonmail.com","protoonmail.com"]},{name:"zohocorp.com",autoCompleteAfter:2,misspelledVariations:["z0h0c0rp.com","zohocrp.com","zohocpr.com","zoh0crop.com"]},{name:"aol.com",autoCompleteAfter:2,misspelledVariations:["aaol.com","aool.com","a0l.com"]},{name:"hotmail.com",autoCompleteAfter:2,misspelledVariations:["h0tmail.com","hotmal.com","hotmial.com","hootmail.com"]}],subscribe:function(t){if(jQ224(".poptin-input-msg").remove(),"auto-fill"==t.type){var n=jQ224(i);if(!n.length)return;var o=n.clone(),a=n.parent().css("padding-left")||0;o.addClass("poptin-input-autofill").val("").attr("placeholder",t.outValue).attr("id","").attr("data-name","").attr("name","").css({left:a}),n.parent().prepend(o),(o=n.parent().find(".poptin-input-autofill")).length&&o.get(0)&&(o.get(0).style.setProperty("width","calc(100% - "+a+" - "+a+")","important"),o.get(0).style.setProperty("min-width","auto","important")),jQ224(document).off("keydown",i).on("keydown",i,function(t){if((9==t.keyCode||39==t.keyCode)&&"poptinDesignInputTextFieldEmail"==n.attr("id")&&o.length&&n.val()!=o.attr("placeholder")&&o.attr("placeholder").includes(n.val()))return n.val(o.attr("placeholder")),o.remove(),!1})}if("suggestion"==t.type){var r=parseInt(1e10*Math.random()),p=jQ224(i);if(!p.length)return;var s="he"==yo?"האם התכוונת ל-".concat(t.outValue,"?"):"Did you mean ".concat(t.outValue,"?");p.parent().append('').concat(s,""));var d=p.parents(".draggable-container"),c=parseFloat(e.attr("data-scale"))||1;if(c>=1){d.addClass("has-poptin-input-msg"),d.append(jQ224("#m"+r).clone().attr("id","c"+r));var l=jQ224("#m"+r);l.length&&d.length&&jQ224("#c"+r).css({top:(l.offset().top-d.offset().top)/c+3,left:(l.offset().left-d.offset().left)/c,width:parseInt(l.css("width"))+10,height:parseInt(l.css("height"))})}else d.removeClass("has-poptin-input-msg")}}});jQ224(i).off("keyup").on("keyup",function(t){var i=jQ224(this).val();jQ224(".poptin-input-autofill").remove(),13==t.keyCode?setTimeout(function(){jQ224(".poptin-input-msg").remove()},3e3):jQ224(".poptin-input-msg").remove(),n.dispatch("suggestion",i),"he"!=e.find("#poptinDraggableContainer").attr("data-lang")&&n.dispatch("auto-fill",i)}),jQ224(i).off("blur").on("blur",function(t){jQ224(".poptin-input-autofill").remove(),setTimeout(function(){jQ224(".poptin-input-msg").remove()},3e3)}),jQ224(i).off("focus").on("focus",function(t){jQ224(".poptin-input-autofill").remove(),jQ224(".poptin-input-msg").remove()}),jQ224(document).off("click",".poptin-input-suggestion").on("click",".poptin-input-suggestion",function(t){t.preventDefault();var e=jQ224(this).find("span").text();return e&&jQ224(i).val(e),jQ224(this).remove(),!1})}catch(t){h("Email validation error:",t)}}}}(t),function(t){var e=jQ224("[data-poptin-id="+t.poptin_id+"]"),i=e.find("input#poptinDesignBirthdayField");i.off("blur"),i.off("focus.validation"),i.on("focus.validation",function(){jQ224(".poptin-input-msg").remove()}),i.off("blur.validation"),i.on("blur.validation",function(){jQ224(".poptin-input-msg").remove();var t=i.val();if(t&&new Date(t)>=new Date){var n=Pt()?"יש להזין תאריך לידה תקין.":"Please enter a valid birthday.",o=parseInt(1e10*Math.random());i.parent().append(''+n+"");var a=i.parents(".draggable-container"),r=parseFloat(e.attr("data-scale"));return r>=1?(a.addClass("has-poptin-input-msg"),a.append(jQ224("#m"+o).clone().attr("id","c"+o)),jQ224("#c"+o).css({top:(jQ224("#m"+o).offset().top-a.offset().top)/r+3,left:(jQ224("#m"+o).offset().left-a.offset().left)/r,width:parseInt(jQ224("#m"+o).css("width"))+10,height:parseInt(jQ224("#m"+o).css("height"))})):a.removeClass("has-poptin-input-msg"),!1}})}(t)}catch(t){h("Validation error:",t)}}(t)},it=function(t){1==t.design_properties.timer_ver||0==t.design_properties.timer_ver&&(t.poptin_type+"_"+t.poptin_format=="lightbox_format_5"||t.poptin_type+"_"+t.poptin_format=="lightbox_format_11"||t.poptin_type+"_"+t.poptin_format=="bar_format_5"||t.poptin_type+"_"+t.poptin_format=="bar_format_10")?0==jQ224("#poptin-timer-v1").length&&jQ224("head").append(''):2==t.design_properties.timer_ver&&0==jQ224("#poptin-timer-v2").length&&jQ224("head").append('')},nt=function(t){t.poptin_type+"_"+t.poptin_format=="gamified_format_3"&&jQ224("head").append('')},ot=function(t){h("downloadPoptinTemplateFromS3-poptin_id: "+t.poptin_id),""==window.all_poptins[t.poptin_id].poptin&&jQ224.when(jQ224.ajax(t.poptin_url)).then(function(e,i,n){if(h("downloadPoptinTemplateFromS3->status: "+i),t.poptin=e,window.all_poptins[t.poptin_id].poptin=e,null!=window.poptins[t.poptin_id]&&(window.poptins[t.poptin_id].poptin=e),void 0!==window.wixDevelopersAnalytics&&jQ224(t.poptin).find("input#wixProductsJSON").length>0){var o=JSON.parse(jQ224(t.poptin).find("input#wixProductsJSON").val());!o||"last_visited"!=o.category&&"product_in_cart"!=o.category?(h("show teasers if products available for collections and manual_products"),mt(t,0)):pe(t,o).then(function(e){1==e.display&&(h("show teasers if products available"),mt(t,0))})}if(void 0!==window.Shopify&&window.Shopify.shop)if(jQ224(t.poptin).find("input#shopifyProductsJSON").length>0){ae();var a=JSON.parse(jQ224(t.poptin).find("input#shopifyProductsJSON").val());!a||"last_visited"!=a.category&&"product_in_cart"!=a.category?(h("show teasers if products available for collections and manual_products"),mt(t,0)):re(t,a).then(function(e){1==e.display&&(h("show teasers if products available"),mt(t,0))})}else mt(t,0);else mt(t,0);it(t),nt(t),Lt(t.poptin_id),Mt(t),Dt(t),t.display&&at(t)},function(t,e,i){h("downloadPoptinTemplateFromS3->error: "+t)})},at=function(t){h("setPoptinTrigger for: "+t.poptin_id);var e="embedded"==t.poptin_type;if(t.display_after_sec_active=e?0:t.display_after_sec_active,window.poptins[t.poptin_id].poptin_trigger={convert:!1,poptin_active:!0,scroll_flag:!0,mouse_leave_flag:!0,click_counter:0,trigger:"",close_trigger:"",shown:!1},Go===t.poptin_id){var i=rt(t);bt(i)}else{if("yes"==t.display_after_exit_website_active)if(fo){if(window.history&&window.history.pushState){if(!poptin_single_page_app){var n=100;window.history.state&&window.history.state.page&&(n=window.history.state.page),window.history.pushState({page:n+1},"")}window.addEventListener("popstate",function(){!function(t){if(h("going back "+ra.length),ra.length<1&&""!==location.hash.split("#!/")[1]&&""===window.location.hash){var i,n,o;if(ca.ifActive()&&ca.ifRelevent(t))return h("load after back button trigger"),!1;(window.poptins[t.poptin_id]&&null!==(i=window.poptins[t.poptin_id].poptin_trigger)&&void 0!==i&&i.mouse_leave_flag&&null!==(n=window.poptins[t.poptin_id].poptin_trigger)&&void 0!==n&&n.poptin_active||null===(o=window.poptins[t.poptin_id].poptin_trigger)||void 0===o||!o.shown)&&(f(t.poptin_id),h("load after back button trigger"),window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,window.poptins[t.poptin_id].poptin_trigger.trigger="close tab",bt(t,!!e||null),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.mouse_leave_flag=!1)}}(t)})}}else jQ224(document).mouseleave(function(e){if(St(t)&&Tt(t)){var i=e.clientY,n=document.body.clientWidth-e.pageX,o=jQ224(window).height()-e.clientY;e.pageX;if("select"==e.target.tagName.toLowerCase())return!1;if(n>0&&o>0&&i<=0){var a,r,p;if(h("load after mouse leave trigger: "+t.poptin_id),ca.ifActive()&&ca.ifRelevent(t))return h("not"),!1;(window.poptins[t.poptin_id]&&null!==(a=window.poptins[t.poptin_id].poptin_trigger)&&void 0!==a&&a.mouse_leave_flag&&null!==(r=window.poptins[t.poptin_id].poptin_trigger)&&void 0!==r&&r.poptin_active||null===(p=window.poptins[t.poptin_id].poptin_trigger)||void 0===p||!p.shown)&&(h("yes"),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,window.poptins[t.poptin_id].poptin_trigger.trigger="close tab",bt(t),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.mouse_leave_flag=!1)}}});if("no"!=t.display_after_sec_active){if("website"==t.display_after_sec_active_on){if(!yi("poptin_session_account_time_"+t.account_id)){var o={set_at:Date.now(),expiry_at:Date.now()+6e4};mi("poptin_session_account_time_"+t.account_id,JSON.stringify(o),1/24/60)}setInterval(function(){if(gi("poptin_session_account_time_"+t.account_id)){var e=JSON.parse(gi("poptin_session_account_time_"+t.account_id));if((e.expiry_at-Date.now())/1e3<60){var i={set_at:e.set_at,expiry_at:Date.now()+6e4};mi("poptin_session_account_time_"+t.account_id,JSON.stringify(i),1/24/60)}}else{i={set_at:Date.now(),expiry_at:Date.now()+6e4};mi("poptin_session_account_time_"+t.account_id,JSON.stringify(i),1/24/60)}},2e4);var a=JSON.parse(gi("poptin_session_account_time_"+t.account_id)).set_at/1e3,r=Date.now()/1e3-a}var p="page"===t.display_after_sec_active_on?1e3*t.display_after_sec_active:1e3*(t.display_after_sec_active-r);poptinTimeDelayTrigger=window.setTimeout(function(){if(h("load after "+t.display_after_sec_active+" seconds trigger on "+t.display_after_sec_active_on),St(t)&&Tt(t)){var e,i;if(ca.ifActive()&&ca.ifRelevent(t))return!1;(null!==(e=window.poptins[t.poptin_id].poptin_trigger)&&void 0!==e&&e.poptin_active||null===(i=window.poptins[t.poptin_id].poptin_trigger)||void 0===i||!i.shown)&&(f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,window.poptins[t.poptin_id].poptin_trigger.trigger="after "+t.display_after_sec_active+" seconds",bt(t),f(t.poptin_id))}},p)}if("no"!=t.display_after_scroll_active&&!ea){h(t.display_after_scroll_active);jQ224(document).height(),window.innerHeight,t.display_after_scroll_active;jQ224(window).on("scroll.poptinTriggerScrollEvent",function(){var e=(jQ224(document).height()-window.innerHeight)*t.display_after_scroll_active*.01;if(f(t.poptin_id),jQ224(window).scrollTop()>=e&&window.poptins[t.poptin_id].poptin_trigger.scroll_flag&&(window.poptins[t.poptin_id].poptin_trigger.scroll_flag=!1,(window.poptins[t.poptin_id].poptin_trigger.poptin_active||!window.poptins[t.poptin_id].poptin_trigger.shown)&&(h("load after "+t.display_after_scroll_active+" scroll page trigger"),St(t)&&Tt(t)))){if(ca.ifActive()&&ca.ifRelevent(t))return!1;window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,window.poptins[t.poptin_id].poptin_trigger.trigger="after "+t.display_after_scroll_active+"% scrolling",bt(t),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.scroll_flag=!1}setTimeout(function(){f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.scroll_flag=!0},300)})}if("no"!=t.display_after_page_click_number_active&&jQ224(document).on("click tap",function(){f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.click_counter++,window.poptins[t.poptin_id].poptin_trigger.click_counter==t.display_after_page_click_number_active&&(!window.poptins[t.poptin_id].poptin_trigger.poptin_active&&window.poptins[t.poptin_id].poptin_trigger.shown||St(t)&&Tt(t)&&(h("load after "+t.display_after_page_click_number_active+" clicks page trigger"),window.poptins[t.poptin_id].poptin_trigger.trigger="after "+t.display_after_page_click_number_active+" clicks",ca.ifActive()&&ca.ifRelevent(t)||(window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,bt(t)),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.click_counter=0))}),"no"!=t.display_after_visit_page_active)if("undefined"!=typeof Storage){if("disactive"!=window.sessionStorage.getItem("display_after_visit_page_active_"+t.poptin_id)){if(window.sessionStorage.getItem("page_url_"+t.poptin_id)!=window.location.href){var s=(window.sessionStorage.getItem("page_visit_"+t.poptin_id)?Number(window.sessionStorage.getItem("page_visit_"+t.poptin_id)):0)+1;window.sessionStorage.setItem("page_visit_"+t.poptin_id,s)}window.sessionStorage.getItem("page_visit_"+t.poptin_id)==t.display_after_visit_page_active&&window.sessionStorage.getItem("page_url_"+t.poptin_id)!=window.location.href?(h("load after "+t.display_after_visit_page_active+" clicks page trigger"),St(t)&&Tt(t)&&(ca.ifActive()&&ca.ifRelevent(t)||(bt(t),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1,t.d_f_r.includes("display_everytime_everypage_5")||window.sessionStorage.setItem("display_after_visit_page_active_"+t.poptin_id,"disactive")),window.sessionStorage.setItem("page_visit_"+t.poptin_id,0),window.sessionStorage.setItem("page_url_"+t.poptin_id,window.location.href))):window.sessionStorage.setItem("page_url_"+t.poptin_id,window.location.href)}}else h("Sorry! No Web Storage support..");if("no"!=t.display_after_inactive_seconds_active){!function(){var e,i=!1;function n(){i=!0,St(t)&&Tt(t)&&(bt(t),f(t.poptin_id),window.poptins[t.poptin_id].poptin_trigger.poptin_active=!1)}function o(){clearTimeout(e),e=i?null:setTimeout(n,1e3*t.display_after_inactive_seconds_active)}window.onload=o(),window.onmousemove=o,window.onmousedown=o,window.ontouchstart=o,window.onclick=o,window.onkeypress=o,window.addEventListener("scroll",o,!0)}()}t.shopify_cart_trigger_active&&(yi("poptin_fetch_initial_shopify_cart")||jQ224.ajax({url:pt()+"cart.js",type:"get",dataType:"json",async:!1},"json").done(function(t){var e=[];jQ224.each(t.items,function(t,i){e.push(i.variant_id)}),mi("poptin_fetch_initial_shopify_cart",!0),mi("poptin_shopify_cart_product_id",e.join(","))}),function(e,i){"function"==typeof i&&(e.fetch=function(){var e=i.apply(this,arguments);return e.then(function(e){var i=pt();console.log("AJAX URL: "),console.log(e.url),["".concat(window.location.origin).concat(i,"cart/add.js"),"".concat(window.location.origin).concat(i,"cart/add"),"".concat(window.location.origin).concat(i,"cart/update.js"),"".concat(window.location.origin).concat(i,"cart/update"),"".concat(window.location.origin).concat(i,"cart/change.js"),"".concat(window.location.origin).concat(i,"cart/change"),"".concat(window.location.origin).concat(i,"cart/clear.js"),"".concat(window.location.origin).concat(i,"cart/clear")].some(function(t){return e.url.startsWith(t)})&&e.clone().json().then(function(i){dt(e,t,"fetch",i)})}),e})}(window,window.fetch),st(t)),t.wix_cart_trigger_active&&pa.push(t)}},rt=function(t){var e=document.createElement("div");e.innerHTML=t.poptin;var i=e.querySelector(".poptin-popup"),n=i.getAttribute("data-poptin-type"),o=i.getAttribute("data-poptin-location"),a="100%",r="0",p="unset",s="relative",d="0",c="-50px",l="300px",u=["browsing","bside","sside","bar"];switch(u.includes(n)&&(c=0,s="fixed",r="20px",d="50%",l="460px"),n){case"fullpage":c="10px",a="100vw";break;case"mobile":o.includes("top")&&(c=t.field_poptin_height+10+"px");break;case"social":p=0}var _='\n \n ').concat("he"===yo?"זו תצוגה מקדימה של הפופאפ. יש לשים לב כי שליחה לא תהיה פעילה.":"This is a preview of your popup. Please note that submission will not be functional.","\n
");return u.includes(n)?jQ224("body").append(_):i.innerHTML=_+i.innerHTML,t.poptin=e.innerHTML,t},pt=function(){var t="/";return"undefined"!=typeof Shopify&&Shopify.routes&&Shopify.routes.root&&(t=Shopify.routes.root),t},st=function(t){h("Initialized XHR Listener"),xhook.after(function(e,i){_url=e.url,["/cart/add.js","/cart/add","/cart/update.js","/cart/update","/cart/change.js","/cart/change","/cart/clear.js","/cart/clear"].some(function(t){return _url.startsWith(t)})&&(h("add-to-cart url found, call global listener"),dt(e,t,"xhr",i))})},dt=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=[],a=null,r=null;if(void 0!==t.isFetch&&(i="fetch"),"fetch"==i){var p=pt();o=["".concat(window.location.origin).concat(p,"cart/add.js"),"".concat(window.location.origin).concat(p,"cart/add"),"".concat(window.location.origin).concat(p,"cart/update.js"),"".concat(window.location.origin).concat(p,"cart/update"),"".concat(window.location.origin).concat(p,"cart/change.js"),"".concat(window.location.origin).concat(p,"cart/change"),"".concat(window.location.origin).concat(p,"cart/clear.js"),"".concat(window.location.origin).concat(p,"cart/clear")],a=t.url,r=n;var s=4}else{o=["/cart/add.js","/cart/add","/cart/update.js","/cart/update","/cart/change.js","/cart/change","/cart/clear.js","/cart/clear"],a=t._url;s=0}var d=setInterval(function(){"xhr"==i&&(a=t.url,s=void 0!==t.xhr.readyState?t.xhr.readyState:t.readyState),4==s&&(clearInterval(d),o.some(function(t){return a.startsWith(t)})&&"/cart.js"!=a&&jQ224.ajax({url:"/cart.js",type:"get",dataType:"json",async:!1},"json").done(function(n){if("added_product"==e.shopify_cart_trigger_action&&null!=e.shopify_cart_trigger_products){if(a.startsWith(o[0])||a.startsWith(o[1])){var p,s;if("xhr"==i)r=(null===(p=r=JSON.parse(void 0!==t.xhr.response?t.xhr.response:t.response))||void 0===p||null===(p=p.items)||void 0===p?void 0:p[0])||r;else r=(null===(s=r)||void 0===s||null===(s=s.items)||void 0===s?void 0:s[0])||r;if("any_product"==e.shopify_cart_trigger_products)bt(e);else{var d=e.shopify_cart_trigger_products.split(","),c=r.variant_id.toString()||r.product_id.toString();d.includes(c)&&bt(e)}}}else if("removed_product"==e.shopify_cart_trigger_action){if(a!=o[0]&&t!=o[1]){var l=yi("poptin_shopify_cart_product_id")?gi("poptin_shopify_cart_product_id").split(","):[],u=[];if(jQ224.each(n.items,function(t,e){u.push(e.variant_id.toString()||e.product_id.toString())}),"any_product"==e.shopify_cart_trigger_products&&u.length0&&jQ224.each(l,function(t,i){u.includes(i)||e.shopify_cart_trigger_products.split(",").includes(i)&&bt(e)})}}}else if(("cart_item"==e.shopify_cart_trigger_action||"cart_value"==e.shopify_cart_trigger_action)&&null!=e.shopify_cart_trigger_cart_spec_filter&&null!=e.shopify_cart_trigger_cart_spec_value){var _=e.shopify_cart_trigger_cart_spec_filter,h=e.shopify_cart_trigger_cart_spec_value,f="cart_item"==e.shopify_cart_trigger_action?n.item_count:n.total_price/100;switch(_){case"greater_than":f>h&&bt(e);break;case"equal":f==h&&bt(e);break;case"greater_than_or_equal":f>=h&&bt(e)}}u=[];jQ224.each(n.items,function(t,e){u.push(e.variant_id.toString())}),mi("poptin_shopify_cart_product_id",u.join(","))}).fail(function(t,e,i){h("Cart Error")}))},100)},ct=function(){var t=window.navigator.userAgent,e=t.indexOf("MSIE");return e>0?parseInt(t.substring(e+5,t.indexOf(".",e))):navigator.userAgent.match(/Trident\/7\./)?11:0},lt=function(){if(h("setPoptinStyle()"),clearTimeout(poptinTimeDelayTrigger),poptinTimeDelayTrigger=null,0==jQ224("#setPoptinStyle").length&&(poptin_style='',"he"==yo&&(poptin_style+='.draggable-container:not(.poptin-tab-container) p, .draggable-container:not(.poptin-tab-container) .inputs-container input{font-family: "Open Sans Hebrew !important";}'),jQ224("head").append(poptin_style)),!document.getElementById("poptin_animations")){var t="";Ui.indexOf("dev")>=0?(0==jQ224("#poptin_animations_preload").length&&(t=''),0==jQ224("#poptin_animations").length&&(t+='')):(0==jQ224("#poptin_animations_preload").length&&(t=''),0==jQ224("#poptin_animations").length&&(t+='')),t&&jQ224("head").append(t)}},ut=function(t,e){return!t.js_filter.display_if_specific_js_active||($js_array=function(){for(var t in array=[],this)jQ224.inArray(_(this[t]),["number","string","boolean"])>-1&&array.push({key:t,value:String(this[t])});return array}(),$result_array=[],$js_array.length>0&&(jQ224.each(t.js_filter.display_if_specific_js,function(t){this.js_name_pair.length>0&&this.js_value_pair.length>0&&this.js_show_pair.length>0&&($js_name_role_pair=this.js_name_pair.split("|:|"),$js_name_role=null!=$js_name_role_pair[0]?$js_name_role_pair[0]:"",$js_name_value=null!=$js_name_role_pair[1]?$js_name_role_pair[1]:"",$js_value_role_pair=this.js_value_pair.split("|:|"),$js_value_role=null!=$js_value_role_pair[0]?$js_value_role_pair[0]:"",$js_value_value=null!=$js_value_role_pair[1]?$js_value_role_pair[1]:"",$js_show_value=this.js_show_pair,"undefined"!==window.Function("return typeof "+$js_name_value)()?$js_name_value.indexOf(".")>-1?($js_name=!0,$js_value=ft($js_value_role,window.Function("return "+$js_name_value)(),$js_value_value),$result_array.push({rule:$js_name&&$js_value,show:$js_show_value})):jQ224.inArray(window.Function("return typeof "+$js_name_value)(),["number","string","boolean"])>-1?jQ224.each($js_array,function(t){$js_name=ft($js_name_role,this.key,$js_name_value),$js_value=ft($js_value_role,this.value,$js_value_value),$result_array.push({rule:$js_name&&$js_value,show:$js_show_value})}):"object"==window.Function("typeof "+$js_name_value)()&&($js_name=!0,$js_value=ft($js_value_role,JSON.stringify(window.Function("return typeof "+$js_name_value)()),$js_value_value),$result_array.push({rule:$js_name&&$js_value,show:$js_show_value})):jQ224.each($js_array,function(t){$js_name=ft($js_name_role,this.key,$js_name_value),$js_value=ft($js_value_role,this.value,$js_value_value),$result_array.push({rule:$js_name&&$js_value,show:$js_show_value})}))}),$js_array.length>0&&($flag=!1,$dont_show=!1,jQ224.each($result_array,function(t){if(this.rule&&"dont_show"==this.show)return $flag=!1,$dont_show=!0,!1;$flag=!0}),$dont_show||jQ224.each($result_array,function(t){if(this.rule&&"show"==this.show)return $flag=!0,!1;"show"==this.show&&($flag=!1)}),$flag)))},_t=function(t,e){return!t.cookie_filter.display_if_specific_cookie_active||($cookies_array=ze(),$result_array=[],$cookies_array.length>0&&(jQ224.each(t.cookie_filter.display_if_specific_cookie,function(t){this.cookie_name_pair.length>0&&this.cookie_value_pair.length>0&&this.cookie_show_pair.length>0&&($cookie_name_role_pair=this.cookie_name_pair.split("|:|"),$cookie_name_role=null!=$cookie_name_role_pair[0]?$cookie_name_role_pair[0]:"",$cookie_name_value=null!=$cookie_name_role_pair[1]?$cookie_name_role_pair[1]:"",$cookie_value_role_pair=this.cookie_value_pair.split("|:|"),$cookie_value_role=null!=$cookie_value_role_pair[0]?$cookie_value_role_pair[0]:"",$cookie_value_value=null!=$cookie_value_role_pair[1]?$cookie_value_role_pair[1]:"",$cookie_show_value=this.cookie_show_pair,jQ224.each($cookies_array,function(t){$c_name=ht($cookie_name_role,this.key,$cookie_name_value),$c_value=ht($cookie_value_role,this.value,$cookie_value_value),$result_array.push({rule:$c_name&&$c_value,show:$cookie_show_value})}))}),$cookies_array.length>0&&($flag=!1,$dont_show=!1,jQ224.each($result_array,function(t){if(this.rule&&"dont_show"==this.show)return $flag=!1,$dont_show=!0,!1;$flag=!0}),$dont_show||jQ224.each($result_array,function(t){if(this.rule&&"show"==this.show)return $flag=!0,!1;"show"==this.show&&($flag=!1)}),$flag)))},ht=function(t,e,i){if($flag=!1,""!=t)switch(t){case"contain":$flag=e.indexOf(i)>-1;break;case"exact":$flag=e==i;break;case"start":$flag=e.startsWith(i);break;case"end":$flag=e.endsWith(i);break;case"greater_than":$flag=parseFloat(e)>parseFloat(i);break;case"less_than":$flag=parseFloat(e)-1;break;case"exact":$flag=e==i;break;case"start":$flag=e.startsWith(i);break;case"end":$flag=e.endsWith(i);break;case"greater_than":$flag=parseFloat(e)>parseFloat(i);break;case"less_than":$flag=parseFloat(e)0&&jQ224(s).remove(),jQ224("body").append(p)):(i=i.replace('onclick="closeTabPoptinOnXclick();"',"onclick=\"closeTabPoptinOnXclick(this,'"+e.poptin_id+"');\""),jQ224(s).length>0&&jQ224(s).remove(),jQ224("body").append(i)),yt(e),jQ224(s).css("cursor","pointer"),jQ224(s+" .handle-icon").remove(),jQ224(s+" .pos-helper").remove(),jQ224(s+" .handle-icon-wrapper").remove(),jQ224(s).attr("data-load-poptin",e.poptin_id),jQ224(s).find('[contenteditable="true"]').prop("contenteditable",!1);jQ224(s).attr("data-poptin-tablocation");jQ224(s).get(0).style.setProperty("position","fixed","important"),jQ224(s).get(0).style.setProperty("z-index","999998","important"),jQ224(s).find(".draggable").each(function(t){jQ224(this).get(0).style.setProperty("position","absolute"),jQ224(this).get(0).style.setProperty("cursor","pointer"),jQ224(this).find(".fr-box").css("position","relative")}),jQ224(s).css("cursor","pointer"),jQ224(s).get(0).style.setProperty("display","none"),jQ224(s).get(0).style.setProperty("opacity","1"),setTimeout(function(){jQ224(s+" #closeTabXButton").length>0&&jQ224(s+" #closeTabXButton").get(0).style.setProperty("z-index","99","important"),gt(e),vt(e,"entry")},500),jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]:not(#closeTabXButton),#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]:not(#poptinFormCloseText)').on("click",function(t){if(jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]').is(":visible")&&"close-icon"!=jQ224(t.target).attr("class")){jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]').hasClass("triangleTab")&&jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]').hide();var i=jQ224(".poptin-popup[data-poptin-id="+e.poptin_id+"]");jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+e.poptin_id+'"]').removeClass("poptin__animated"),0==i.length?Y(e.poptin_id,!0,e):Ei(e)}})},yt=function(t){var e='#poptinDraggableContainer-tab[data-load-poptin="'+t.poptin_id+'"]';jQ224("[data-load-poptin="+t.poptin_id+"] .froala-image-wrapper").each(function(){jQ224(this).find("img").css("width",jQ224(this).css("width")),jQ224(this).find("img").css("height",jQ224(this).css("height")),jQ224(this).find("img").attr("alt",t.poptin_name)}),jQ224(e).find("p, span, div:not(.poptin-credit), button, label, ul, ol, li, img, strong, i").each(function(t){var e="";jQ224.each(this.attributes,function(t){if(this.specified&&"style"==this.name&&(e=(e=(e=(e=(e=this.value).replace(/ ?!important/g,"")).replace(/\;base64/g,":base64")).replace(/\;/g," !important;")).replace(/\:base64/g,";base64"),-1!==this.value.indexOf("font-family")))try{Ht(this.value)}catch(t){h(t)}}),jQ224(this).attr("style",e)})},vt=function(t,e){var i=jQ224('#poptinDraggableContainer-tab[data-load-poptin="'+t.poptin_id+'"]');if(i.length){i.removeClass("poptin__animated");var n="";n="entry"==e?void 0!==jQ224(i).attr("data-teaser-entry")?jQ224(i).attr("data-teaser-entry"):"entry_effect-up":void 0!==jQ224(i).attr("data-teaser-exit")?jQ224(i).attr("data-teaser-exit"):"exit_effect-none";var o={effect:null,speed:"_default",delay:"-default"};switch(n.split("-")[1]){case"none":o.effect="_none";break;case"up":o.effect="_slideInDown";break;case"down":o.effect="_slideInUp";break;case"left":o.effect="_slideInLeft";break;case"right":o.effect="_slideInRight";break;case"blind":case"fold":o.effect="_flipInX";break;case"bounce":o.effect="_bounceIn";break;case"clip":case"size":case"scale-out":o.effect="_zoomIn";break;case"explode":case"fade":o.effect="_fadeIn";break;case"highlight":o.effect="_tada";break;case"puff":o.effect="_pulse";break;case"pulsate":o.effect="_flash";break;case"scale":o.effect="_heartBeat";break;case"shake":o.effect="_shakeX"}if("exit"==e){var a=o.effect;o.effect=a.replace("In","Out"),jQ224(i).addClass("poptin__animated"),-1!==o.effect.indexOf("slide")&&jQ224(i).addClass("animate__faster"),jQ224(i).addClass("animate_"+o.effect)}else try{h("Entry Animate"),jQ224(i).addClass("poptin-visible poptin__animated"),-1!==o.effect.indexOf("slide")&&jQ224(i).addClass("animate__faster"),jQ224(i).addClass("animate_"+o.effect),jQ224(i).css({display:"block"})}catch(t){h("Entry Animate err3"),jQ224(i).addClass("poptin-visible poptin__animated"),-1!==o.effect.indexOf("slide")&&jQ224(i).addClass("animate__faster"),jQ224(i).css({display:"block"})}setTimeout(function(){jQ224(i).removeClass("poptin__animated"),jQ224(i).removeClass(function(t,e){return(e.match(/\banimate_\S+/g)||[]).join(" ")}),"exit"==e&&jQ224(i).css({display:"none"}),"entry"==e&&jQ224(i).is(":hidden")&&(jQ224(i).addClass("poptin__animated"),h("animateClass.effect:"+o.effect),jQ224(i).addClass("animate_"+o.effect),jQ224(i).css({display:"block"}))},1e3)}},bt=function(t,e){function i(){if(h("appendPoptin"),h("appendPoptin:"+e),h("poptin.poptin_type:"+t.poptin_type),null!=e)if(""==t.poptin&&""==window.all_poptins[t.poptin_id].poptin)jQ224.when(jQ224.ajax(t.poptin_url)).then(function(i,n,o){(t.poptin=i,"embedded"==t.poptin_type)?jQ224(".poptin-embedded[data-id='"+t.poptin_id+"']").append(t.poptin):jQ224("body").append(t.poptin);window.poptins[t.poptin_id].poptin=t.poptin,window.all_poptins[t.poptin_id].poptin=t.poptin,xt(t,e)},function(t,e,i){h(t)});else{if(poptin_data=""==t.poptin?window.all_poptins[t.poptin_id].poptin:t.poptin,"embedded"==t.poptin_type)jQ224(".poptin-embedded[data-id='"+t.poptin_id+"']").append(t.poptin);else jQ224("body").append(t.poptin);window.poptins[t.poptin_id].poptin=t.poptin,xt(t,e)}else _t(t)&&ut(t)&&(""==t.poptin&&""==window.all_poptins[t.poptin_id].poptin?jQ224.when(jQ224.ajax(t.poptin_url)).then(function(i,n,o){t.poptin=i,window.all_poptins[t.poptin_id].poptin=i,ca.checkQueue(t,e)},function(t,e,i){h(t)}):(t.poptin=""==t.poptin?window.all_poptins[t.poptin_id].poptin:t.poptin,ca.checkQueue(t,e)))}h("Adblock trigger:"+t.display_if_adblock_active),"yes"==t.display_if_adblock_active?jQ224.when(jQ224.getScript("https://display.popt.in/js/webads.js")).then(function(){}).fail(i):i()},Et=function(t){return yi("poptin_o_a_d_"+t.poptin_id)},St=function(t){if(!t.engagement_with_other_poptin_filter_active||null==t.engagement_with_other_poptin_filter)return!0;var e=t.engagement_with_other_poptin_filter.split("|"),i=!!e&&e[0],n=!!e&&e[1],o=!!e&&e[2],a=!!e&&e[3],r=[];"embedded"==o?jQ224.each(window.all_poptins,function(e,i){t.poptin_id!=this.poptin_id&&"embedded"==this.poptin_type&&("any"!=a?this.poptin_id==a&&r.push(this):r.push(this))}):jQ224.each(window.all_poptins,function(e,i){t.poptin_id!=this.poptin_id&&"embedded"!=this.poptin_type&&("any"!=a?this.poptin_id==a&&r.push(this):r.push(this))});var p=!1;if(r.length>0)switch(n){case"seen_poptin":jQ224.each(r,function(t,e){Et(this)&&(p=!0)});break;case"not_seen":jQ224.each(r,function(t,e){(function(t){return!yi("poptin_o_a_d_"+t.poptin_id)})(this)&&(p=!0)});break;case"closed":jQ224.each(r,function(t,e){(function(t){return yi("poptin_c_p_o_x_c_"+t.poptin_id)})(this)&&(p=!0)});break;case"converted":jQ224.each(r,function(t,e){(function(t){return yi("poptin_conversion_"+t.poptin_id)})(this)&&(p=!0)})}return p?"show"==i:"show"!=i},Tt=function(t){var e=!0;if(!t.source_code_target_active||null==t.source_code_target_html)return!0;var i=jQ224("html").html(),n=(i=i.replace(/()|()|(