@guardian/support-dotcom-components 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- const e="gu.contributions.views",t=t=>t.get(e)||void 0,a=t=>{const a=localStorage.getItem(e),n=a?JSON.parse(a).value:[];n.push({date:(new Date).getTime(),testId:t});const s={value:n.slice(-50)};localStorage.setItem(e,JSON.stringify(s))},n="gu.history.weeklyArticleCount",s="gu.history.articleCountsThisWeek",i=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},r=e=>e.get(n)||void 0,o=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business"]),d=(e,t={})=>(e.forEach((e=>{o.has(e)&&(t[e]=(t[e]??0)+1)})),t),u=(e,t,a)=>{const r=((e,t)=>{const a=i(new Date),n=e.get(s);if(n&&n.week===a){const i=n.articles[t]||0;return e.set(s,{week:a,articles:{...n.articles,[t]:i+1}}),i>0}return e.set(s,{week:a,articles:{[t]:1}}),!1})(e,t);if(!r){const t=i(new Date),s=e.get(n)||[],r=s[0];if(r&&r.week&&r.week===t)r.count+=1,r.tags=d(a,r.tags),e.set(n,s);else{s.unshift({week:t,count:1,tags:d(a,{})});const i=t-365,r=s.filter((e=>e.week>=i));e.set(n,r)}}};var c,l;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(c||(c={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(l||(l={}));const h=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(e)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(e)?h.array:null===e?h.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?h.promise:"undefined"!=typeof Map&&e instanceof Map?h.map:"undefined"!=typeof Set&&e instanceof Set?h.set:"undefined"!=typeof Date&&e instanceof Date?h.date:h.object;default:return h.unknown}},m=c.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class f extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)a._errors.push(t(s));else{let e=a,n=0;for(;n<s.path.length;){const a=s.path[n];n===s.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(s))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},a=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}f.create=e=>new f(e);const g=(e,t)=>{let a;switch(e.code){case m.invalid_type:a=e.received===h.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,c.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:a=`Unrecognized key(s) in object: ${c.joinValues(e.keys,", ")}`;break;case m.invalid_union:a="Invalid input";break;case m.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${c.joinValues(e.options)}`;break;case m.invalid_enum_value:a=`Invalid enum value. Expected ${c.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:a="Invalid function arguments";break;case m.invalid_return_type:a="Invalid function return type";break;case m.invalid_date:a="Invalid date";break;case m.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:c.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case m.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case m.custom:a="Invalid input";break;case m.invalid_intersection_types:a="Intersection results could not be merged";break;case m.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:a="Number must be finite";break;default:a=t.defaultError,c.assertNever(e)}return{message:a}};let y=g;function v(){return y}const _=e=>{const{data:t,path:a,errorMaps:n,issueData:s}=e,i=[...a,...s.path||[]],r={...s,path:i};let o="";const d=n.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(r,{data:t,defaultError:o}).message;return{...s,path:i,message:s.message||o}};function b(e,t){const a=_({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,v(),g].filter((e=>!!e))});e.common.issues.push(a)}class k{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return x;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t)a.push({key:await e.key,value:await e.value});return k.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return x;if("aborted"===s.status)return x;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(a[t.value]=s.value)}return{status:e.value,value:a}}}const x=Object.freeze({status:"aborted"}),C=e=>({status:"valid",value:e}),S=e=>"aborted"===e.status,w=e=>"dirty"===e.status,T=e=>"valid"===e.status,N=e=>"undefined"!=typeof Promise&&e instanceof Promise;var I;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(I||(I={}));class A{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const E=(e,t)=>{if(T(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new f(e.common.issues);return this._error=t,this._error}}};function O(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:s}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=a?a:t.defaultError},description:s}}class R{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const n={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},s=this._parseSync({data:e,path:n.path,parent:n});return E(n,s)}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},n=this._parse({data:e,path:a.path,parent:a}),s=await(N(n)?n:Promise.resolve(n));return E(a,s)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:m.custom,...a(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1)))}_refinement(e){return new ye({schema:this,typeName:Te.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ve.create(this,this._def)}nullable(){return _e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this,this._def)}promise(){return ge.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new ye({...O(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new be({...O(this._def),innerType:this,defaultValue:t,typeName:Te.ZodDefault})}brand(){return new Ce({typeName:Te.ZodBranded,type:this,...O(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ke({...O(this._def),innerType:this,catchValue:t,typeName:Te.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Se.create(this,e)}readonly(){return we.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,M=/^[a-z][a-z0-9]*$/,P=/^[0-9A-HJKMNP-TV-Z]{26}$/,L=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let D;const B=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,G=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class j extends R{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==h.string){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.string,received:t.parsedType}),x}const t=new k;let a;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:m.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:m.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?b(a,{code:m.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&b(a,{code:m.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)U.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"email",code:m.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)D||(D=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"emoji",code:m.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)L.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"uuid",code:m.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Z.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"cuid",code:m.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)M.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"cuid2",code:m.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)P.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"ulid",code:m.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(n){a=this._getOrReturnCtx(e,a),b(a,{validation:"url",code:m.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"regex",code:m.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),b(a,{code:m.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),b(a,{code:m.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),b(a,{code:m.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){((i=r).precision?i.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}Z$`):0===i.precision?i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{code:m.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else"ip"===r.kind?(n=e.data,("v4"!==(s=r.version)&&s||!B.test(n))&&("v6"!==s&&s||!G.test(n))&&(a=this._getOrReturnCtx(e,a),b(a,{validation:"ip",code:m.invalid_string,message:r.message}),t.dirty())):c.assertNever(r);var n,s,i;return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement((t=>e.test(t)),{validation:t,code:m.invalid_string,...I.errToObj(a)})}_addCheck(e){return new j({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...I.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...I.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...I.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...I.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...I.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...I.errToObj(t)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new j({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function $(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=a>n?a:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}j.create=e=>{var t;return new j({checks:[],typeName:Te.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...O(e)})};class K extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==h.number){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.number,received:t.parsedType}),x}let t;const a=new k;for(const n of this._def.checks)if("int"===n.kind)c.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:m.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==$(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_finite,message:n.message}),a.dirty()):c.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&c.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}K.create=e=>new K({checks:[],typeName:Te.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...O(e)});class V extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==h.bigint){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.bigint,received:t.parsedType}),x}let t;const a=new k;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):c.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}V.create=e=>{var t;return new V({checks:[],typeName:Te.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...O(e)})};class F extends R{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.boolean,received:t.parsedType}),x}return C(e.data)}}F.create=e=>new F({typeName:Te.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...O(e)});class W extends R{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==h.date){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.date,received:t.parsedType}),x}if(isNaN(e.data.getTime())){return b(this._getOrReturnCtx(e),{code:m.invalid_date}),x}const t=new k;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:m.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:m.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):c.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}W.create=e=>new W({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Te.ZodDate,...O(e)});class Y extends R{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.symbol,received:t.parsedType}),x}return C(e.data)}}Y.create=e=>new Y({typeName:Te.ZodSymbol,...O(e)});class H extends R{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.undefined,received:t.parsedType}),x}return C(e.data)}}H.create=e=>new H({typeName:Te.ZodUndefined,...O(e)});class z extends R{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.null,received:t.parsedType}),x}return C(e.data)}}z.create=e=>new z({typeName:Te.ZodNull,...O(e)});class J extends R{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}J.create=e=>new J({typeName:Te.ZodAny,...O(e)});class q extends R{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}q.create=e=>new q({typeName:Te.ZodUnknown,...O(e)});class Q extends R{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.never,received:t.parsedType}),x}}Q.create=e=>new Q({typeName:Te.ZodNever,...O(e)});class X extends R{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.void,received:t.parsedType}),x}return C(e.data)}}X.create=e=>new X({typeName:Te.ZodVoid,...O(e)});class ee extends R{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return b(t,{code:m.invalid_type,expected:h.array,received:t.parsedType}),x;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(b(t,{code:e?m.too_big:m.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(b(t,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(b(t,{code:m.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>n.type._parseAsync(new A(t,e,t.path,a))))).then((e=>k.mergeArray(a,e)));const s=[...t.data].map(((e,a)=>n.type._parseSync(new A(t,e,t.path,a))));return k.mergeArray(a,s)}get element(){return this._def.type}min(e,t){return new ee({...this._def,minLength:{value:e,message:I.toString(t)}})}max(e,t){return new ee({...this._def,maxLength:{value:e,message:I.toString(t)}})}length(e,t){return new ee({...this._def,exactLength:{value:e,message:I.toString(t)}})}nonempty(e){return this.min(1,e)}}function te(e){if(e instanceof ae){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=ve.create(te(n))}return new ae({...e._def,shape:()=>t})}return e instanceof ee?new ee({...e._def,type:te(e.element)}):e instanceof ve?ve.create(te(e.unwrap())):e instanceof _e?_e.create(te(e.unwrap())):e instanceof de?de.create(e.items.map((e=>te(e)))):e}ee.create=(e,t)=>new ee({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...O(t)});class ae extends R{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=c.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.object,received:t.parsedType}),x}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Q&&"strip"===this._def.unknownKeys))for(const e in a.data)s.includes(e)||i.push(e);const r=[];for(const e of s){const t=n[e],s=a.data[e];r.push({key:{status:"valid",value:e},value:t._parse(new A(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof Q){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)r.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)i.length>0&&(b(a,{code:m.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=a.data[t];r.push({key:{status:"valid",value:t},value:e._parse(new A(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of r){const a=await t.key;e.push({key:a,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>k.mergeObjectSync(t,e))):k.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new ae({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var n,s,i,r;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,a).message)&&void 0!==i?i:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(r=I.errToObj(e).message)&&void 0!==r?r:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Te.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const t={};return c.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new ae({...this._def,shape:()=>t})}omit(e){const t={};return c.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new ae({...this._def,shape:()=>t})}deepPartial(){return te(this)}partial(e){const t={};return c.objectKeys(this.shape).forEach((a=>{const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()})),new ae({...this._def,shape:()=>t})}required(e){const t={};return c.objectKeys(this.shape).forEach((a=>{if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof ve;)e=e._def.innerType;t[a]=e}})),new ae({...this._def,shape:()=>t})}keyof(){return pe(c.objectKeys(this.shape))}}ae.create=(e,t)=>new ae({shape:()=>e,unknownKeys:"strip",catchall:Q.create(),typeName:Te.ZodObject,...O(t)}),ae.strictCreate=(e,t)=>new ae({shape:()=>e,unknownKeys:"strict",catchall:Q.create(),typeName:Te.ZodObject,...O(t)}),ae.lazycreate=(e,t)=>new ae({shape:e,unknownKeys:"strip",catchall:Q.create(),typeName:Te.ZodObject,...O(t)});class ne extends R{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new f(e.ctx.common.issues)));return b(t,{code:m.invalid_union,unionErrors:a}),x}));{let e;const n=[];for(const s of a){const a={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:a});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new f(e)));return b(t,{code:m.invalid_union,unionErrors:s}),x}}get options(){return this._def.options}}ne.create=(e,t)=>new ne({options:e,typeName:Te.ZodUnion,...O(t)});const se=e=>e instanceof le?se(e.schema):e instanceof ye?se(e.innerType()):e instanceof he?[e.value]:e instanceof me?e.options:e instanceof fe?Object.keys(e.enum):e instanceof be?se(e._def.innerType):e instanceof H?[void 0]:e instanceof z?[null]:null;class ie extends R{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return b(t,{code:m.invalid_type,expected:h.object,received:t.parsedType}),x;const a=this.discriminator,n=t.data[a],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const n=new Map;for(const a of t){const t=se(a.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,a)}}return new ie({typeName:Te.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...O(a)})}}function re(e,t){const a=p(e),n=p(t);if(e===t)return{valid:!0,data:e};if(a===h.object&&n===h.object){const a=c.objectKeys(t),n=c.objectKeys(e).filter((e=>-1!==a.indexOf(e))),s={...e,...t};for(const a of n){const n=re(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(a===h.array&&n===h.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const s=re(e[n],t[n]);if(!s.valid)return{valid:!1};a.push(s.data)}return{valid:!0,data:a}}return a===h.date&&n===h.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class oe extends R{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(S(e)||S(n))return x;const s=re(e.value,n.value);return s.valid?((w(e)||w(n))&&t.dirty(),{status:t.value,value:s.data}):(b(a,{code:m.invalid_intersection_types}),x)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}oe.create=(e,t,a)=>new oe({left:e,right:t,typeName:Te.ZodIntersection,...O(a)});class de extends R{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==h.array)return b(a,{code:m.invalid_type,expected:h.array,received:a.parsedType}),x;if(a.data.length<this._def.items.length)return b(a,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&a.data.length>this._def.items.length&&(b(a,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new A(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(n).then((e=>k.mergeArray(t,e))):k.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new de({...this._def,rest:e})}}de.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new de({items:e,typeName:Te.ZodTuple,rest:null,...O(t)})};class ue extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==h.map)return b(a,{code:m.invalid_type,expected:h.map,received:a.parsedType}),x;const n=this._def.keyType,s=this._def.valueType,i=[...a.data.entries()].map((([e,t],i)=>({key:n._parse(new A(a,e,a.path,[i,"key"])),value:s._parse(new A(a,t,a.path,[i,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of i){const n=await a.key,s=await a.value;if("aborted"===n.status||"aborted"===s.status)return x;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of i){const n=a.key,s=a.value;if("aborted"===n.status||"aborted"===s.status)return x;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}ue.create=(e,t,a)=>new ue({valueType:t,keyType:e,typeName:Te.ZodMap,...O(a)});class ce extends R{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==h.set)return b(a,{code:m.invalid_type,expected:h.set,received:a.parsedType}),x;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(b(a,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(b(a,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const a=new Set;for(const n of e){if("aborted"===n.status)return x;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const r=[...a.data.values()].map(((e,t)=>s._parse(new A(a,e,a.path,t))));return a.common.async?Promise.all(r).then((e=>i(e))):i(r)}min(e,t){return new ce({...this._def,minSize:{value:e,message:I.toString(t)}})}max(e,t){return new ce({...this._def,maxSize:{value:e,message:I.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ce.create=(e,t)=>new ce({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...O(t)});class le extends R{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}le.create=(e,t)=>new le({getter:e,typeName:Te.ZodLazy,...O(t)});class he extends R{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}function pe(e,t){return new me({values:e,typeName:Te.ZodEnum,...O(t)})}he.create=(e,t)=>new he({value:e,typeName:Te.ZodLiteral,...O(t)});class me extends R{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return b(t,{expected:c.joinValues(a),received:t.parsedType,code:m.invalid_type}),x}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return b(t,{received:t.data,code:m.invalid_enum_value,options:a}),x}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return me.create(e)}exclude(e){return me.create(this.options.filter((t=>!e.includes(t))))}}me.create=pe;class fe extends R{_parse(e){const t=c.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==h.string&&a.parsedType!==h.number){const e=c.objectValues(t);return b(a,{expected:c.joinValues(e),received:a.parsedType,code:m.invalid_type}),x}if(-1===t.indexOf(e.data)){const e=c.objectValues(t);return b(a,{received:a.data,code:m.invalid_enum_value,options:e}),x}return C(e.data)}get enum(){return this._def.values}}fe.create=(e,t)=>new fe({values:e,typeName:Te.ZodNativeEnum,...O(t)});class ge extends R{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&!1===t.common.async)return b(t,{code:m.invalid_type,expected:h.promise,received:t.parsedType}),x;const a=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return C(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ge.create=(e,t)=>new ge({type:e,typeName:Te.ZodPromise,...O(t)});class ye extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{b(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(a.data,s);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:a.path,parent:a}))):this._def.schema._parseSync({data:e,path:a.path,parent:a})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?x:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((a=>"aborted"===a.status?x:("dirty"===a.status&&t.dirty(),e(a.value).then((()=>({status:t.value,value:a.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!T(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>T(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}c.assertNever(n)}}ye.create=(e,t,a)=>new ye({schema:e,typeName:Te.ZodEffects,effect:t,...O(a)}),ye.createWithPreprocess=(e,t,a)=>new ye({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...O(a)});class ve extends R{_parse(e){return this._getType(e)===h.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ve.create=(e,t)=>new ve({innerType:e,typeName:Te.ZodOptional,...O(t)});class _e extends R{_parse(e){return this._getType(e)===h.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_e.create=(e,t)=>new _e({innerType:e,typeName:Te.ZodNullable,...O(t)});class be extends R{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===h.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}be.create=(e,t)=>new be({innerType:e,typeName:Te.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...O(t)});class ke extends R{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return N(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new f(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new f(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ke.create=(e,t)=>new ke({innerType:e,typeName:Te.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...O(t)});class xe extends R{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:h.nan,received:t.parsedType}),x}return{status:"valid",value:e.data}}}xe.create=e=>new xe({typeName:Te.ZodNaN,...O(e)});class Ce extends R{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class Se extends R{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new Se({in:e,out:t,typeName:Te.ZodPipeline})}}class we extends R{_parse(e){const t=this._def.innerType._parse(e);return T(t)&&(t.value=Object.freeze(t.value)),t}}var Te;we.create=(e,t)=>new we({innerType:e,typeName:Te.ZodReadonly,...O(t)}),ae.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Te||(Te={}));const Ne=j.create,Ie=K.create;xe.create,V.create;const Ae=F.create;W.create,Y.create,H.create,z.create;const Ee=J.create;q.create,Q.create,X.create;const Oe=ee.create,Re=ae.create;ae.strictCreate,ne.create;const Ze=ie.create;oe.create,de.create,ue.create,ce.create,le.create;const Me=he.create,Pe=me.create,Le=fe.create;ge.create,ye.create,ve.create,_e.create,ye.createWithPreprocess,Se.create;const Ue=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],De=Pe(Ue),Be={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},Ge={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},je={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},$e=e=>Object.keys(Be).find((t=>Be[t].countries.includes(e??"")))||"International",Ke=(e,t=[])=>0===t.length||!!e&&t.includes($e(e.toUpperCase())),Ve=e=>{if(e){const t=$e(e);return je[t]}return"£"},Fe=e=>{if(e)return Ge[e]},We=(e,t)=>{if(t){const a=(e=>Be[$e(e)]?.supportRegionId)(t);if(a)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,t,n)=>`${t}/${a.toLowerCase()}/${n}`))}return e},Ye=(e,t,a,n)=>{if(n){const s=n[$e(a)];if(s){return`${Ve(a)}${s[e][t].price}`}}},He={CURRENCY_SYMBOL:({countryCode:e})=>Ve(e),COUNTRY_NAME:({countryCode:e})=>Fe(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>Ye("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>Ye("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>Ye("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>Ye("GuardianWeekly","Annual",e,t),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},ze=(e,t,a)=>e?e.replace(Je,(e=>{const n=e.substring(2,e.length-2),s=He[n];if(s){const e=s({countryCode:t,prices:a});if(e)return e}return e})):"",Je=/%%.*?%%/g,qe=e=>{const t=e.match(Je)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!t&&t.length>0},Qe=e=>{const t=(e=>{const t=new Date(e,10,1).getDay();return new Date(e,10,22+(11-t)%7)})(e);return t.setDate(t.getDate()+5),t},Xe=(e=new Date)=>{const t=(e=>{const t=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+t),e})(e),a=(t.getMonth()+1).toString().padStart(2,"0"),n=t.toLocaleString("default",{month:"long"}),s=t.getFullYear();return{reminderCta:`Remind me in ${n}`,reminderPeriod:`${s}-${a}-01`,reminderLabel:`${n} ${s}`}},et=new Date("2023-12-31"),tt=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<Qe(e.getFullYear()),at=(e,t=new Date)=>{return"US"===e&&tt(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${a=t.getFullYear()}-${(Qe(a).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${a}`}:"US"===e&&(e=>e>=Qe(e.getFullYear())&&e<et)(t)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(t.getFullYear()):Xe(t);var a},nt=Re({text:Ne(),baseUrl:Ne()});let st=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});Le(st);const it=Ze("type",[Re({type:Me(st.Custom),cta:nt}),Re({type:Me(st.ContributionsReminder)})]);let rt=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const ot=Le(rt);let dt=function(e){return e.money="money",e}({});const ut=Le(dt),ct=Re({countLabel:Ne(),goalReachedPrimary:Ne(),goalReachedSecondary:Ne()}),lt=Re({total:Ie(),goal:Ie()}),ht=Pe(["US","AU"]),pt=Re({endType:ot,countType:ut,currencySymbol:Ne(),copy:ct,name:ht,tickerData:lt.optional()}),mt=Pe(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),ft=Pe(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),gt=Re({abTestName:Ne(),abTestVariant:Ne(),campaignCode:Ne(),componentType:ft,products:Oe(mt).nullish(),labels:Oe(Ne()).nullish(),ophanPageId:Ne(),platformId:Ne(),referrerUrl:Ne(),clientName:Ne()}),yt=Re({mainUrl:Ne(),mobileUrl:Ne().optional(),tabletUrl:Ne().optional(),desktopUrl:Ne().optional(),leftColUrl:Ne().optional(),wideUrl:Ne().optional(),altText:Ne()}),vt=Re({name:Ne(),description:Ne().optional(),headshot:yt.optional()}),_t=Pe(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),bt=Pe(["new","guest","current"]),kt=Pe(["Live","Draft","Archived"]),xt=Pe(["Mobile","Desktop","All","iOS","Android"]),Ct=Pe(["SignedIn","SignedOut","All"]),St=Re({name:Ne(),status:kt,priority:Ie(),controlProportionSettings:Re({proportion:Ie(),offset:Ie()}).optional(),deviceType:xt.optional(),signedInStatus:Ct.optional()}),wt=Pe(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),Tt=Re({minViews:Ie(),maxViews:Ie().optional(),periodInWeeks:Ie(),tagId:Ne().optional()});Re({userType:Oe(bt),product:Oe(_t)}),Re({tagIds:Oe(Ne()),sectionIds:Oe(Ne()),excludedTagIds:Oe(Ne()),excludedSectionIds:Oe(Ne())});const Nt=Pe(["for52Weeks","forTargetedWeeks"]),It=Re({for52Weeks:Ie(),forTargetedWeeks:Ie()}),At=Re({maxViewsCount:Ie(),maxViewsDays:Ie(),minDaysBetweenViews:Ie()}),Et=Re({type:Me("above"),copy:Ne().optional(),countType:Nt.optional()}),Ot=Re({reminderCta:Ne(),reminderLabel:Ne(),reminderPeriod:Ne()}),Rt=Pe(["ONE_OFF","MONTHLY","ANNUAL"]),Zt=Re({testName:Ne(),variantName:Ne(),defaultContributionType:Rt,displayContributionType:Rt.array(),amountsCardData:Re({ONE_OFF:Re({amounts:Oe(Ie()),defaultAmount:Ie(),hideChooseYourAmount:Ae().optional()}),MONTHLY:Re({amounts:Oe(Ie()),defaultAmount:Ie(),hideChooseYourAmount:Ae().optional()}),ANNUAL:Re({amounts:Oe(Ie()),defaultAmount:Ie(),hideChooseYourAmount:Ae().optional()})})}),Mt=Re({url:Ne()}),Pt=Re({name:Ne(),heading:Ne().optional(),paragraphs:Oe(Ne()),highlightedText:Ne().optional(),tickerSettings:pt.optional(),cta:nt.optional(),secondaryCta:it.optional(),newsletterSignup:Mt.optional(),image:yt.optional(),showReminderFields:Ot.optional(),separateArticleCount:Et.optional(),maxViews:At.optional(),showSignInLink:Ae().optional(),bylineWithImage:vt.optional(),showChoiceCards:Ae().optional(),choiceCardAmounts:Zt.optional(),defaultChoiceCardFrequency:Rt.optional()}),Lt=Re({variant:Pt,tracking:gt,countryCode:Ne().nullish(),articleCounts:It,onReminderOpen:Ee().nullish(),fetchEmail:Ee().nullish(),submitComponentEvent:Ee().nullish(),openCmp:Ee().nullish(),hasConsentForArticleCount:Ae().nullish(),stage:Ne().nullish()}),Ut=/^[0-9A-F]{2}$/,Dt=Ne().refine((e=>Ut.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),Bt=Re({r:Dt,g:Dt,b:Dt,kind:Me("hex")}),Gt=Re({mobileUrl:Ne(),tabletUrl:Ne(),desktopUrl:Ne(),altText:Ne(),kind:Me("Image")}),jt=Re({buttonColour:Bt.nullish(),buttonTextColour:Bt.nullish(),buttonBorderColour:Bt.nullish(),buttonSelectColour:Bt.nullish(),buttonSelectTextColour:Bt.nullish(),buttonSelectBorderColour:Bt.nullish(),kind:Me("ChoiceCards")}),$t=Re({visual:Ze("kind",[Gt,jt]).nullish(),colours:Re({basic:Re({background:Bt,bodyText:Bt})})}),Kt=Pe(["contributions","subscriptions","signIn"]),Vt=Re({heading:Ne().optional(),messageText:Ne().optional(),paragraphs:Oe(Ne()).optional(),mobileMessageText:Ne().optional(),highlightedText:Ne().optional(),cta:nt.optional(),secondaryCta:it.optional()});Re({tracking:gt,bannerChannel:Kt,content:Vt.nullish(),mobileContent:Vt.nullish(),countryCode:Ne().nullish(),isSupporter:Ae().nullish(),tickerSettings:pt.nullish(),submitComponentEvent:Ee(),numArticles:Ie().nullish(),hasOptedOutOfArticleCount:Ae().nullish(),fetchEmail:Ee().nullish(),separateArticleCount:Ae().nullish(),design:$t.nullish()});const Ft=Re({heading:Ne(),subheading:Ne(),primaryCta:nt.optional(),secondaryCta:nt.optional(),benefits:Oe(Ne()).optional()});Re({content:Ft,tracking:gt,mobileContent:Ft.optional(),countryCode:Ne().optional(),submitComponentEvent:Ee(),numArticles:Ie().optional()});const Wt=Re({maxViewsCount:Ie(),maxViewsDays:Ie(),minDaysBetweenViews:Ie()}),Yt=["ONE_OFF","MONTHLY","ANNUAL"];St.extend({name:Ne(),status:kt,locations:Oe(De),tagIds:Oe(Ne()),sections:Oe(Ne()),excludedTagIds:Oe(Ne()),excludedSections:Oe(Ne()),alwaysAsk:Ae(),maxViews:Wt.optional(),userCohort:wt,hasCountryName:Ae(),highPriority:Ae(),useLocalViewLog:Ae(),articlesViewedSettings:Tt.optional(),priority:Ie(),variants:Pt.array()});const Ht=(e,t,a)=>{const n=(e=>{if(URLSearchParams){const t=new URLSearchParams(window.location.search).get(`force-${e}`);if(t)return t}return null})(e);return fetch(`${t}/${e}${n?`?force=${n}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then((t=>{if(!t.ok)throw Error(t.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${t.status}`);return t})).then((e=>e.json()))},zt=(e,t)=>Ht("epic",e,t),Jt=(e,t)=>Ht("liveblog-epic",e,t),qt=(e,t)=>Ht("banner",e,t),Qt=(e,t)=>Ht("header",e,t);export{Ue as CountryGroupId,st as SecondaryCtaType,dt as TickerCountType,rt as TickerEndType,We as addRegionIdToSupportUrl,Xe as buildReminderFields,qe as containsNonArticleCountPlaceholder,Yt as contributionTabFrequencies,$e as countryCodeToCountryGroupId,De as countryGroupIdSchema,Lt as epicPropsSchema,qt as getBanner,Fe as getCountryName,zt as getEpic,t as getEpicViewLog,Qt as getHeader,Jt as getLiveblogEpic,Ve as getLocalCurrencySymbol,at as getReminderFields,r as getWeeklyArticleHistory,Ke as inCountryGroups,u as incrementWeeklyArticleCount,a as logEpicView,ze as replaceNonArticleCountPlaceholders};
1
+ import*as e from"zod";const n="gu.contributions.views",t=e=>e.get(n)||void 0,a=e=>{const t=localStorage.getItem(n),a=t?JSON.parse(t).value:[];a.push({date:(new Date).getTime(),testId:e});const i={value:a.slice(-50)};localStorage.setItem(n,JSON.stringify(i))},i="gu.history.weeklyArticleCount",o="gu.history.articleCountsThisWeek",r=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},s=e=>e.get(i)||void 0,l=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business"]),u=(e,n={})=>(e.forEach((e=>{l.has(e)&&(n[e]=(n[e]??0)+1)})),n),c=(e,n,t)=>{const a=((e,n)=>{const t=r(new Date),a=e.get(o);if(a&&a.week===t){const i=a.articles[n]||0;return e.set(o,{week:t,articles:{...a.articles,[n]:i+1}}),i>0}return e.set(o,{week:t,articles:{[n]:1}}),!1})(e,n);if(!a){const n=r(new Date),a=e.get(i)||[],o=a[0];if(o&&o.week&&o.week===n)o.count+=1,o.tags=u(t,o.tags),e.set(i,a);else{a.unshift({week:n,count:1,tags:u(t,{})});const o=n-365,r=a.filter((e=>e.week>=o));e.set(i,r)}}},d=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],g=e.enum(d),m={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},C={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},p={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},b=e=>Object.keys(m).find((n=>m[n].countries.includes(e??"")))||"International",S=(e,n=[])=>0===n.length||!!e&&n.includes(b(e.toUpperCase())),h=e=>{if(e){const n=b(e);return p[n]}return"£"},y=e=>{if(e)return C[e]},A=(e,n)=>{if(n){const t=(e=>m[b(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},I=(e,n,t,a)=>{if(a){const i=a[b(t)];if(i){return`${h(t)}${i[e][n].price}`}}},T={CURRENCY_SYMBOL:({countryCode:e})=>h(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>I("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>I("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>I("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>I("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},N=(e,n,t)=>e?e.replace(M,(e=>{const a=e.substring(2,e.length-2),i=T[a];if(i){const e=i({countryCode:n,prices:t});if(e)return e}return e})):"",M=/%%.*?%%/g,E=e=>{const n=e.match(M)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},G=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},U=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),i=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${i}-${t}-01`,reminderLabel:`${a} ${i}`}},R=new Date("2023-12-31"),B=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<G(e.getFullYear()),L=(e,n=new Date)=>{return"US"===e&&B(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(G(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=G(e.getFullYear())&&e<R)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):U(n);var t},D=e.object({text:e.string(),baseUrl:e.string()});let P=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});e.nativeEnum(P);const w=e.object({type:e.literal(P.Custom),cta:D}),O=e.object({type:e.literal(P.ContributionsReminder)}),f=e.discriminatedUnion("type",[w,O]);let K=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const k=e.nativeEnum(K);let F=function(e){return e.money="money",e}({});const v=e.nativeEnum(F),H=e.object({countLabel:e.string(),goalReachedPrimary:e.string(),goalReachedSecondary:e.string()}),Y=e.object({total:e.number(),goal:e.number()}),V=e.enum(["US","AU"]),j=e.object({endType:k,countType:v,currencySymbol:e.string(),copy:H,name:V,tickerData:Y.optional()}),W=e.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),Z=e.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),x=e.object({abTestName:e.string(),abTestVariant:e.string(),campaignCode:e.string(),componentType:Z,products:e.array(W).nullish(),labels:e.array(e.string()).nullish(),ophanPageId:e.string(),platformId:e.string(),referrerUrl:e.string(),clientName:e.string()}),$=e.object({mainUrl:e.string(),mobileUrl:e.string().optional(),tabletUrl:e.string().optional(),desktopUrl:e.string().optional(),leftColUrl:e.string().optional(),wideUrl:e.string().optional(),altText:e.string()}),_=e.object({name:e.string(),description:e.string().optional(),headshot:$.optional()}),J=e.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),Q=e.enum(["new","guest","current"]),z=e.enum(["Live","Draft","Archived"]),q=e.enum(["Mobile","Desktop","All","iOS","Android"]),X=e.enum(["SignedIn","SignedOut","All"]),ee=e.enum(["HasConsented","HasNotConsented","All"]),ne=e.object({name:e.string(),status:z,priority:e.number(),controlProportionSettings:e.object({proportion:e.number(),offset:e.number()}).optional(),deviceType:q.optional(),signedInStatus:X.optional(),consentStatus:ee.optional()}),te=e.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),ae=e.object({minViews:e.number(),maxViews:e.number().optional(),periodInWeeks:e.number(),tagId:e.string().optional()});e.object({userType:e.array(Q),product:e.array(J)}),e.object({tagIds:e.array(e.string()),sectionIds:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSectionIds:e.array(e.string())});const ie=e.enum(["for52Weeks","forTargetedWeeks"]),oe=e.object({for52Weeks:e.number(),forTargetedWeeks:e.number()}),re=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),se=e.object({type:e.literal("above"),copy:e.string().optional(),countType:ie.optional()}),le=e.object({reminderCta:e.string(),reminderLabel:e.string(),reminderPeriod:e.string()}),ue=e.enum(["ONE_OFF","MONTHLY","ANNUAL"]),ce=e.object({testName:e.string(),variantName:e.string(),defaultContributionType:ue,displayContributionType:ue.array(),amountsCardData:e.object({ONE_OFF:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),MONTHLY:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()}),ANNUAL:e.object({amounts:e.array(e.number()),defaultAmount:e.number(),hideChooseYourAmount:e.boolean().optional()})})}),de=e.object({url:e.string()}),ge=e.object({name:e.string(),heading:e.string().optional(),paragraphs:e.array(e.string()),highlightedText:e.string().optional(),tickerSettings:j.optional(),cta:D.optional(),secondaryCta:f.optional(),newsletterSignup:de.optional(),image:$.optional(),showReminderFields:le.optional(),separateArticleCount:se.optional(),maxViews:re.optional(),showSignInLink:e.boolean().optional(),bylineWithImage:_.optional(),showChoiceCards:e.boolean().optional(),choiceCardAmounts:ce.optional(),defaultChoiceCardFrequency:ue.optional()}),me=e.object({variant:ge,tracking:x,countryCode:e.string().nullish(),articleCounts:oe,onReminderOpen:e.any().nullish(),fetchEmail:e.any().nullish(),submitComponentEvent:e.any().nullish(),openCmp:e.any().nullish(),hasConsentForArticleCount:e.boolean().nullish(),stage:e.string().nullish()}),Ce=/^[0-9A-F]{2}$/,pe=e.string().refine((e=>Ce.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),be=e.object({r:pe,g:pe,b:pe,kind:e.literal("hex")}),Se=e.object({mobileUrl:e.string(),tabletUrl:e.string(),desktopUrl:e.string(),altText:e.string(),kind:e.literal("Image")}),he=e.object({buttonColour:be.nullish(),buttonTextColour:be.nullish(),buttonBorderColour:be.nullish(),buttonSelectColour:be.nullish(),buttonSelectTextColour:be.nullish(),buttonSelectBorderColour:be.nullish(),kind:e.literal("ChoiceCards")}),ye=e.discriminatedUnion("kind",[Se,he]),Ae=e.object({visual:ye.nullish(),colours:e.object({basic:e.object({background:be,bodyText:be})})}),Ie=e.enum(["contributions","subscriptions","signIn"]),Te=e.object({heading:e.string().optional(),messageText:e.string().optional(),paragraphs:e.array(e.string()).optional(),mobileMessageText:e.string().optional(),highlightedText:e.string().optional(),cta:D.optional(),secondaryCta:f.optional()});e.object({tracking:x,bannerChannel:Ie,content:Te.nullish(),mobileContent:Te.nullish(),countryCode:e.string().nullish(),isSupporter:e.boolean().nullish(),tickerSettings:j.nullish(),submitComponentEvent:e.any(),numArticles:e.number().nullish(),hasOptedOutOfArticleCount:e.boolean().nullish(),fetchEmail:e.any().nullish(),separateArticleCount:e.boolean().nullish(),design:Ae.nullish()});const Ne=e.object({heading:e.string(),subheading:e.string(),primaryCta:D.optional(),secondaryCta:D.optional(),benefits:e.array(e.string()).optional()});e.object({content:Ne,tracking:x,mobileContent:Ne.optional(),countryCode:e.string().optional(),submitComponentEvent:e.any(),numArticles:e.number().optional()});const Me=e.object({maxViewsCount:e.number(),maxViewsDays:e.number(),minDaysBetweenViews:e.number()}),Ee=["ONE_OFF","MONTHLY","ANNUAL"];ne.extend({name:e.string(),status:z,locations:e.array(g),tagIds:e.array(e.string()),sections:e.array(e.string()),excludedTagIds:e.array(e.string()),excludedSections:e.array(e.string()),alwaysAsk:e.boolean(),maxViews:Me.optional(),userCohort:te,hasCountryName:e.boolean(),highPriority:e.boolean(),useLocalViewLog:e.boolean(),articlesViewedSettings:ae.optional(),priority:e.number(),variants:ge.array(),isBanditTest:e.boolean().optional()});const Ge=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))},Ue=(e,n)=>Ge("epic",e,n),Re=(e,n)=>Ge("liveblog-epic",e,n),Be=(e,n)=>Ge("banner",e,n),Le=(e,n)=>Ge("header",e,n);export{d as CountryGroupId,P as SecondaryCtaType,F as TickerCountType,K as TickerEndType,A as addRegionIdToSupportUrl,U as buildReminderFields,E as containsNonArticleCountPlaceholder,Ee as contributionTabFrequencies,b as countryCodeToCountryGroupId,g as countryGroupIdSchema,me as epicPropsSchema,Be as getBanner,y as getCountryName,Ue as getEpic,t as getEpicViewLog,Le as getHeader,Re as getLiveblogEpic,h as getLocalCurrencySymbol,L as getReminderFields,s as getWeeklyArticleHistory,S as inCountryGroups,c as incrementWeeklyArticleCount,a as logEpicView,N as replaceNonArticleCountPlaceholders};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="gu.contributions.views",t="gu.history.weeklyArticleCount",a="gu.history.articleCountsThisWeek",n=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},s=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business"]),i=(e,t={})=>(e.forEach((e=>{s.has(e)&&(t[e]=(t[e]??0)+1)})),t);var r,o;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(r||(r={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(o||(o={}));const d=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),u=e=>{switch(typeof e){case"undefined":return d.undefined;case"string":return d.string;case"number":return isNaN(e)?d.nan:d.number;case"boolean":return d.boolean;case"function":return d.function;case"bigint":return d.bigint;case"symbol":return d.symbol;case"object":return Array.isArray(e)?d.array:null===e?d.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?d.promise:"undefined"!=typeof Map&&e instanceof Map?d.map:"undefined"!=typeof Set&&e instanceof Set?d.set:"undefined"!=typeof Date&&e instanceof Date?d.date:d.object;default:return d.unknown}},c=r.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class l extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)a._errors.push(t(s));else{let e=a,n=0;for(;n<s.path.length;){const a=s.path[n];n===s.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(s))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},a=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}l.create=e=>new l(e);const h=(e,t)=>{let a;switch(e.code){case c.invalid_type:a=e.received===d.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case c.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,r.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:a=`Unrecognized key(s) in object: ${r.joinValues(e.keys,", ")}`;break;case c.invalid_union:a="Invalid input";break;case c.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${r.joinValues(e.options)}`;break;case c.invalid_enum_value:a=`Invalid enum value. Expected ${r.joinValues(e.options)}, received '${e.received}'`;break;case c.invalid_arguments:a="Invalid function arguments";break;case c.invalid_return_type:a="Invalid function return type";break;case c.invalid_date:a="Invalid date";break;case c.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:r.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case c.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case c.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case c.custom:a="Invalid input";break;case c.invalid_intersection_types:a="Intersection results could not be merged";break;case c.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case c.not_finite:a="Number must be finite";break;default:a=t.defaultError,r.assertNever(e)}return{message:a}};let p=h;function m(){return p}const f=e=>{const{data:t,path:a,errorMaps:n,issueData:s}=e,i=[...a,...s.path||[]],r={...s,path:i};let o="";const d=n.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(r,{data:t,defaultError:o}).message;return{...s,path:i,message:s.message||o}};function y(e,t){const a=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,m(),h].filter((e=>!!e))});e.common.issues.push(a)}class g{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return v;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t)a.push({key:await e.key,value:await e.value});return g.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return v;if("aborted"===s.status)return v;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(a[t.value]=s.value)}return{status:e.value,value:a}}}const v=Object.freeze({status:"aborted"}),_=e=>({status:"valid",value:e}),b=e=>"aborted"===e.status,x=e=>"dirty"===e.status,k=e=>"valid"===e.status,C=e=>"undefined"!=typeof Promise&&e instanceof Promise;var S;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(S||(S={}));class T{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const w=(e,t)=>{if(k(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new l(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:s}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=a?a:t.defaultError},description:s}}class I{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return u(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:u(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new g,ctx:{common:e.parent.common,data:e.data,parsedType:u(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(C(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const n={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:u(e)},s=this._parseSync({data:e,path:n.path,parent:n});return w(n,s)}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:u(e)},n=this._parse({data:e,path:a.path,parent:a}),s=await(C(n)?n:Promise.resolve(n));return w(a,s)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:c.custom,...a(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1)))}_refinement(e){return new pe({schema:this,typeName:ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return me.create(this,this._def)}nullable(){return fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return J.create(this,this._def)}promise(){return he.create(this,this._def)}or(e){return X.create([this,e],this._def)}and(e){return ne.create(this,e,this._def)}transform(e){return new pe({...N(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ye({...N(this._def),innerType:this,defaultValue:t,typeName:ke.ZodDefault})}brand(){return new _e({typeName:ke.ZodBranded,type:this,...N(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ge({...N(this._def),innerType:this,catchValue:t,typeName:ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return be.create(this,e)}readonly(){return xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const A=/^c[^\s-]{8,}$/i,E=/^[a-z][a-z0-9]*$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/,R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Z=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let M;const P=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,L=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class U extends I{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==d.string){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.string,received:t.parsedType}),v}const t=new g;let a;for(const o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("max"===o.kind)e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("length"===o.kind){const n=e.data.length>o.value,s=e.data.length<o.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?y(a,{code:c.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&y(a,{code:c.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),t.dirty())}else if("email"===o.kind)Z.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"email",code:c.invalid_string,message:o.message}),t.dirty());else if("emoji"===o.kind)M||(M=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),M.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"emoji",code:c.invalid_string,message:o.message}),t.dirty());else if("uuid"===o.kind)R.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"uuid",code:c.invalid_string,message:o.message}),t.dirty());else if("cuid"===o.kind)A.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid",code:c.invalid_string,message:o.message}),t.dirty());else if("cuid2"===o.kind)E.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"cuid2",code:c.invalid_string,message:o.message}),t.dirty());else if("ulid"===o.kind)O.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"ulid",code:c.invalid_string,message:o.message}),t.dirty());else if("url"===o.kind)try{new URL(e.data)}catch(n){a=this._getOrReturnCtx(e,a),y(a,{validation:"url",code:c.invalid_string,message:o.message}),t.dirty()}else if("regex"===o.kind){o.regex.lastIndex=0;o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{validation:"regex",code:c.invalid_string,message:o.message}),t.dirty())}else if("trim"===o.kind)e.data=e.data.trim();else if("includes"===o.kind)e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),y(a,{code:c.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),t.dirty());else if("toLowerCase"===o.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===o.kind)e.data=e.data.toUpperCase();else if("startsWith"===o.kind)e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:c.invalid_string,validation:{startsWith:o.value},message:o.message}),t.dirty());else if("endsWith"===o.kind)e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),y(a,{code:c.invalid_string,validation:{endsWith:o.value},message:o.message}),t.dirty());else if("datetime"===o.kind){((i=o).precision?i.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}Z$`):0===i.precision?i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:c.invalid_string,validation:"datetime",message:o.message}),t.dirty())}else"ip"===o.kind?(n=e.data,("v4"!==(s=o.version)&&s||!P.test(n))&&("v6"!==s&&s||!L.test(n))&&(a=this._getOrReturnCtx(e,a),y(a,{validation:"ip",code:c.invalid_string,message:o.message}),t.dirty())):r.assertNever(o);var n,s,i;return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement((t=>e.test(t)),{validation:t,code:c.invalid_string,...S.errToObj(a)})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...S.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...S.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new U({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new U({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new U({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function D(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=a>n?a:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}U.create=e=>{var t;return new U({checks:[],typeName:ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...N(e)})};class B extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==d.number){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.number,received:t.parsedType}),v}let t;const a=new g;for(const n of this._def.checks)if("int"===n.kind)r.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==D(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_finite,message:n.message}),a.dirty()):r.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,a,n){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:S.toString(n)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&r.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}B.create=e=>new B({checks:[],typeName:ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});class G extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==d.bigint){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.bigint,received:t.parsedType}),v}let t;const a=new g;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):r.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,a,n){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:S.toString(n)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}G.create=e=>{var t;return new G({checks:[],typeName:ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...N(e)})};class j extends I{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==d.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.boolean,received:t.parsedType}),v}return _(e.data)}}j.create=e=>new j({typeName:ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});class $ extends I{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==d.date){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.date,received:t.parsedType}),v}if(isNaN(e.data.getTime())){return y(this._getOrReturnCtx(e),{code:c.invalid_date}),v}const t=new g;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:c.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),y(a,{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):r.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}$.create=e=>new $({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ke.ZodDate,...N(e)});class K extends I{_parse(e){if(this._getType(e)!==d.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.symbol,received:t.parsedType}),v}return _(e.data)}}K.create=e=>new K({typeName:ke.ZodSymbol,...N(e)});class V extends I{_parse(e){if(this._getType(e)!==d.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.undefined,received:t.parsedType}),v}return _(e.data)}}V.create=e=>new V({typeName:ke.ZodUndefined,...N(e)});class F extends I{_parse(e){if(this._getType(e)!==d.null){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.null,received:t.parsedType}),v}return _(e.data)}}F.create=e=>new F({typeName:ke.ZodNull,...N(e)});class W extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return _(e.data)}}W.create=e=>new W({typeName:ke.ZodAny,...N(e)});class H extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _(e.data)}}H.create=e=>new H({typeName:ke.ZodUnknown,...N(e)});class Y extends I{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.never,received:t.parsedType}),v}}Y.create=e=>new Y({typeName:ke.ZodNever,...N(e)});class z extends I{_parse(e){if(this._getType(e)!==d.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.void,received:t.parsedType}),v}return _(e.data)}}z.create=e=>new z({typeName:ke.ZodVoid,...N(e)});class J extends I{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==d.array)return y(t,{code:c.invalid_type,expected:d.array,received:t.parsedType}),v;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(y(t,{code:e?c.too_big:c.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(y(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(y(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>n.type._parseAsync(new T(t,e,t.path,a))))).then((e=>g.mergeArray(a,e)));const s=[...t.data].map(((e,a)=>n.type._parseSync(new T(t,e,t.path,a))));return g.mergeArray(a,s)}get element(){return this._def.type}min(e,t){return new J({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new J({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new J({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}}function q(e){if(e instanceof Q){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=me.create(q(n))}return new Q({...e._def,shape:()=>t})}return e instanceof J?new J({...e._def,type:q(e.element)}):e instanceof me?me.create(q(e.unwrap())):e instanceof fe?fe.create(q(e.unwrap())):e instanceof se?se.create(e.items.map((e=>q(e)))):e}J.create=(e,t)=>new J({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...N(t)});class Q extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=r.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==d.object){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.object,received:t.parsedType}),v}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Y&&"strip"===this._def.unknownKeys))for(const e in a.data)s.includes(e)||i.push(e);const r=[];for(const e of s){const t=n[e],s=a.data[e];r.push({key:{status:"valid",value:e},value:t._parse(new T(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof Y){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)r.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)i.length>0&&(y(a,{code:c.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=a.data[t];r.push({key:{status:"valid",value:t},value:e._parse(new T(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of r){const a=await t.key;e.push({key:a,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>g.mergeObjectSync(t,e))):g.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new Q({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var n,s,i,r;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,a).message)&&void 0!==i?i:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(r=S.errToObj(e).message)&&void 0!==r?r:o}:{message:o}}}:{}})}strip(){return new Q({...this._def,unknownKeys:"strip"})}passthrough(){return new Q({...this._def,unknownKeys:"passthrough"})}extend(e){return new Q({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Q({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Q({...this._def,catchall:e})}pick(e){const t={};return r.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new Q({...this._def,shape:()=>t})}omit(e){const t={};return r.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new Q({...this._def,shape:()=>t})}deepPartial(){return q(this)}partial(e){const t={};return r.objectKeys(this.shape).forEach((a=>{const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()})),new Q({...this._def,shape:()=>t})}required(e){const t={};return r.objectKeys(this.shape).forEach((a=>{if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof me;)e=e._def.innerType;t[a]=e}})),new Q({...this._def,shape:()=>t})}keyof(){return ue(r.objectKeys(this.shape))}}Q.create=(e,t)=>new Q({shape:()=>e,unknownKeys:"strip",catchall:Y.create(),typeName:ke.ZodObject,...N(t)}),Q.strictCreate=(e,t)=>new Q({shape:()=>e,unknownKeys:"strict",catchall:Y.create(),typeName:ke.ZodObject,...N(t)}),Q.lazycreate=(e,t)=>new Q({shape:e,unknownKeys:"strip",catchall:Y.create(),typeName:ke.ZodObject,...N(t)});class X extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new l(e.ctx.common.issues)));return y(t,{code:c.invalid_union,unionErrors:a}),v}));{let e;const n=[];for(const s of a){const a={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:a});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new l(e)));return y(t,{code:c.invalid_union,unionErrors:s}),v}}get options(){return this._def.options}}X.create=(e,t)=>new X({options:e,typeName:ke.ZodUnion,...N(t)});const ee=e=>e instanceof oe?ee(e.schema):e instanceof pe?ee(e.innerType()):e instanceof de?[e.value]:e instanceof ce?e.options:e instanceof le?Object.keys(e.enum):e instanceof ye?ee(e._def.innerType):e instanceof V?[void 0]:e instanceof F?[null]:null;class te extends I{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.object)return y(t,{code:c.invalid_type,expected:d.object,received:t.parsedType}),v;const a=this.discriminator,n=t.data[a],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const n=new Map;for(const a of t){const t=ee(a.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,a)}}return new te({typeName:ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...N(a)})}}function ae(e,t){const a=u(e),n=u(t);if(e===t)return{valid:!0,data:e};if(a===d.object&&n===d.object){const a=r.objectKeys(t),n=r.objectKeys(e).filter((e=>-1!==a.indexOf(e))),s={...e,...t};for(const a of n){const n=ae(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(a===d.array&&n===d.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const s=ae(e[n],t[n]);if(!s.valid)return{valid:!1};a.push(s.data)}return{valid:!0,data:a}}return a===d.date&&n===d.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ne extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(b(e)||b(n))return v;const s=ae(e.value,n.value);return s.valid?((x(e)||x(n))&&t.dirty(),{status:t.value,value:s.data}):(y(a,{code:c.invalid_intersection_types}),v)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ne.create=(e,t,a)=>new ne({left:e,right:t,typeName:ke.ZodIntersection,...N(a)});class se extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==d.array)return y(a,{code:c.invalid_type,expected:d.array,received:a.parsedType}),v;if(a.data.length<this._def.items.length)return y(a,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&a.data.length>this._def.items.length&&(y(a,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new T(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(n).then((e=>g.mergeArray(t,e))):g.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new se({...this._def,rest:e})}}se.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new se({items:e,typeName:ke.ZodTuple,rest:null,...N(t)})};class ie extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==d.map)return y(a,{code:c.invalid_type,expected:d.map,received:a.parsedType}),v;const n=this._def.keyType,s=this._def.valueType,i=[...a.data.entries()].map((([e,t],i)=>({key:n._parse(new T(a,e,a.path,[i,"key"])),value:s._parse(new T(a,t,a.path,[i,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of i){const n=await a.key,s=await a.value;if("aborted"===n.status||"aborted"===s.status)return v;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of i){const n=a.key,s=a.value;if("aborted"===n.status||"aborted"===s.status)return v;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}ie.create=(e,t,a)=>new ie({valueType:t,keyType:e,typeName:ke.ZodMap,...N(a)});class re extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==d.set)return y(a,{code:c.invalid_type,expected:d.set,received:a.parsedType}),v;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(y(a,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(y(a,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const a=new Set;for(const n of e){if("aborted"===n.status)return v;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const r=[...a.data.values()].map(((e,t)=>s._parse(new T(a,e,a.path,t))));return a.common.async?Promise.all(r).then((e=>i(e))):i(r)}min(e,t){return new re({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new re({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}re.create=(e,t)=>new re({valueType:e,minSize:null,maxSize:null,typeName:ke.ZodSet,...N(t)});class oe extends I{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oe.create=(e,t)=>new oe({getter:e,typeName:ke.ZodLazy,...N(t)});class de extends I{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ue(e,t){return new ce({values:e,typeName:ke.ZodEnum,...N(t)})}de.create=(e,t)=>new de({value:e,typeName:ke.ZodLiteral,...N(t)});class ce extends I{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{expected:r.joinValues(a),received:t.parsedType,code:c.invalid_type}),v}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{received:t.data,code:c.invalid_enum_value,options:a}),v}return _(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ce.create(e)}exclude(e){return ce.create(this.options.filter((t=>!e.includes(t))))}}ce.create=ue;class le extends I{_parse(e){const t=r.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==d.string&&a.parsedType!==d.number){const e=r.objectValues(t);return y(a,{expected:r.joinValues(e),received:a.parsedType,code:c.invalid_type}),v}if(-1===t.indexOf(e.data)){const e=r.objectValues(t);return y(a,{received:a.data,code:c.invalid_enum_value,options:e}),v}return _(e.data)}get enum(){return this._def.values}}le.create=(e,t)=>new le({values:e,typeName:ke.ZodNativeEnum,...N(t)});class he extends I{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==d.promise&&!1===t.common.async)return y(t,{code:c.invalid_type,expected:d.promise,received:t.parsedType}),v;const a=t.parsedType===d.promise?t.data:Promise.resolve(t.data);return _(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}he.create=(e,t)=>new he({type:e,typeName:ke.ZodPromise,...N(t)});class pe extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{y(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(a.data,s);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:a.path,parent:a}))):this._def.schema._parseSync({data:e,path:a.path,parent:a})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?v:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((a=>"aborted"===a.status?v:("dirty"===a.status&&t.dirty(),e(a.value).then((()=>({status:t.value,value:a.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!k(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>k(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}r.assertNever(n)}}pe.create=(e,t,a)=>new pe({schema:e,typeName:ke.ZodEffects,effect:t,...N(a)}),pe.createWithPreprocess=(e,t,a)=>new pe({schema:t,effect:{type:"preprocess",transform:e},typeName:ke.ZodEffects,...N(a)});class me extends I{_parse(e){return this._getType(e)===d.undefined?_(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:ke.ZodOptional,...N(t)});class fe extends I{_parse(e){return this._getType(e)===d.null?_(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fe.create=(e,t)=>new fe({innerType:e,typeName:ke.ZodNullable,...N(t)});class ye extends I{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===d.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ye.create=(e,t)=>new ye({innerType:e,typeName:ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...N(t)});class ge extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return C(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new l(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new l(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ge.create=(e,t)=>new ge({innerType:e,typeName:ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...N(t)});class ve extends I{_parse(e){if(this._getType(e)!==d.nan){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:d.nan,received:t.parsedType}),v}return{status:"valid",value:e.data}}}ve.create=e=>new ve({typeName:ke.ZodNaN,...N(e)});class _e extends I{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class be extends I{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?v:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?v:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new be({in:e,out:t,typeName:ke.ZodPipeline})}}class xe extends I{_parse(e){const t=this._def.innerType._parse(e);return k(t)&&(t.value=Object.freeze(t.value)),t}}var ke;xe.create=(e,t)=>new xe({innerType:e,typeName:ke.ZodReadonly,...N(t)}),Q.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ke||(ke={}));const Ce=U.create,Se=B.create;ve.create,G.create;const Te=j.create;$.create,K.create,V.create,F.create;const we=W.create;H.create,Y.create,z.create;const Ne=J.create,Ie=Q.create;Q.strictCreate,X.create;const Ae=te.create;ne.create,se.create,ie.create,re.create,oe.create;const Ee=de.create,Oe=ce.create,Re=le.create;he.create,pe.create,me.create,fe.create,pe.createWithPreprocess,be.create;const Ze=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],Me=Oe(Ze),Pe={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},Le={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},Ue={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},De=e=>Object.keys(Pe).find((t=>Pe[t].countries.includes(e??"")))||"International",Be=e=>{if(e){const t=De(e);return Ue[t]}return"£"},Ge=e=>{if(e)return Le[e]},je=(e,t,a,n)=>{if(n){const s=n[De(a)];if(s){return`${Be(a)}${s[e][t].price}`}}},$e={CURRENCY_SYMBOL:({countryCode:e})=>Be(e),COUNTRY_NAME:({countryCode:e})=>Ge(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>je("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>je("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>je("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>je("GuardianWeekly","Annual",e,t),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},Ke=/%%.*?%%/g,Ve=e=>{const t=(e=>{const t=new Date(e,10,1).getDay();return new Date(e,10,22+(11-t)%7)})(e);return t.setDate(t.getDate()+5),t},Fe=(e=new Date)=>{const t=(e=>{const t=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+t),e})(e),a=(t.getMonth()+1).toString().padStart(2,"0"),n=t.toLocaleString("default",{month:"long"}),s=t.getFullYear();return{reminderCta:`Remind me in ${n}`,reminderPeriod:`${s}-${a}-01`,reminderLabel:`${n} ${s}`}},We=new Date("2023-12-31"),He=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<Ve(e.getFullYear()),Ye=Ie({text:Ce(),baseUrl:Ce()});let ze=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});Re(ze);const Je=Ae("type",[Ie({type:Ee(ze.Custom),cta:Ye}),Ie({type:Ee(ze.ContributionsReminder)})]);let qe=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const Qe=Re(qe);let Xe=function(e){return e.money="money",e}({});const et=Re(Xe),tt=Ie({countLabel:Ce(),goalReachedPrimary:Ce(),goalReachedSecondary:Ce()}),at=Ie({total:Se(),goal:Se()}),nt=Oe(["US","AU"]),st=Ie({endType:Qe,countType:et,currencySymbol:Ce(),copy:tt,name:nt,tickerData:at.optional()}),it=Oe(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),rt=Oe(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),ot=Ie({abTestName:Ce(),abTestVariant:Ce(),campaignCode:Ce(),componentType:rt,products:Ne(it).nullish(),labels:Ne(Ce()).nullish(),ophanPageId:Ce(),platformId:Ce(),referrerUrl:Ce(),clientName:Ce()}),dt=Ie({mainUrl:Ce(),mobileUrl:Ce().optional(),tabletUrl:Ce().optional(),desktopUrl:Ce().optional(),leftColUrl:Ce().optional(),wideUrl:Ce().optional(),altText:Ce()}),ut=Ie({name:Ce(),description:Ce().optional(),headshot:dt.optional()}),ct=Oe(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),lt=Oe(["new","guest","current"]),ht=Oe(["Live","Draft","Archived"]),pt=Oe(["Mobile","Desktop","All","iOS","Android"]),mt=Oe(["SignedIn","SignedOut","All"]),ft=Ie({name:Ce(),status:ht,priority:Se(),controlProportionSettings:Ie({proportion:Se(),offset:Se()}).optional(),deviceType:pt.optional(),signedInStatus:mt.optional()}),yt=Oe(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),gt=Ie({minViews:Se(),maxViews:Se().optional(),periodInWeeks:Se(),tagId:Ce().optional()});Ie({userType:Ne(lt),product:Ne(ct)}),Ie({tagIds:Ne(Ce()),sectionIds:Ne(Ce()),excludedTagIds:Ne(Ce()),excludedSectionIds:Ne(Ce())});const vt=Oe(["for52Weeks","forTargetedWeeks"]),_t=Ie({for52Weeks:Se(),forTargetedWeeks:Se()}),bt=Ie({maxViewsCount:Se(),maxViewsDays:Se(),minDaysBetweenViews:Se()}),xt=Ie({type:Ee("above"),copy:Ce().optional(),countType:vt.optional()}),kt=Ie({reminderCta:Ce(),reminderLabel:Ce(),reminderPeriod:Ce()}),Ct=Oe(["ONE_OFF","MONTHLY","ANNUAL"]),St=Ie({testName:Ce(),variantName:Ce(),defaultContributionType:Ct,displayContributionType:Ct.array(),amountsCardData:Ie({ONE_OFF:Ie({amounts:Ne(Se()),defaultAmount:Se(),hideChooseYourAmount:Te().optional()}),MONTHLY:Ie({amounts:Ne(Se()),defaultAmount:Se(),hideChooseYourAmount:Te().optional()}),ANNUAL:Ie({amounts:Ne(Se()),defaultAmount:Se(),hideChooseYourAmount:Te().optional()})})}),Tt=Ie({url:Ce()}),wt=Ie({name:Ce(),heading:Ce().optional(),paragraphs:Ne(Ce()),highlightedText:Ce().optional(),tickerSettings:st.optional(),cta:Ye.optional(),secondaryCta:Je.optional(),newsletterSignup:Tt.optional(),image:dt.optional(),showReminderFields:kt.optional(),separateArticleCount:xt.optional(),maxViews:bt.optional(),showSignInLink:Te().optional(),bylineWithImage:ut.optional(),showChoiceCards:Te().optional(),choiceCardAmounts:St.optional(),defaultChoiceCardFrequency:Ct.optional()}),Nt=Ie({variant:wt,tracking:ot,countryCode:Ce().nullish(),articleCounts:_t,onReminderOpen:we().nullish(),fetchEmail:we().nullish(),submitComponentEvent:we().nullish(),openCmp:we().nullish(),hasConsentForArticleCount:Te().nullish(),stage:Ce().nullish()}),It=/^[0-9A-F]{2}$/,At=Ce().refine((e=>It.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),Et=Ie({r:At,g:At,b:At,kind:Ee("hex")}),Ot=Ie({mobileUrl:Ce(),tabletUrl:Ce(),desktopUrl:Ce(),altText:Ce(),kind:Ee("Image")}),Rt=Ie({buttonColour:Et.nullish(),buttonTextColour:Et.nullish(),buttonBorderColour:Et.nullish(),buttonSelectColour:Et.nullish(),buttonSelectTextColour:Et.nullish(),buttonSelectBorderColour:Et.nullish(),kind:Ee("ChoiceCards")}),Zt=Ie({visual:Ae("kind",[Ot,Rt]).nullish(),colours:Ie({basic:Ie({background:Et,bodyText:Et})})}),Mt=Oe(["contributions","subscriptions","signIn"]),Pt=Ie({heading:Ce().optional(),messageText:Ce().optional(),paragraphs:Ne(Ce()).optional(),mobileMessageText:Ce().optional(),highlightedText:Ce().optional(),cta:Ye.optional(),secondaryCta:Je.optional()});Ie({tracking:ot,bannerChannel:Mt,content:Pt.nullish(),mobileContent:Pt.nullish(),countryCode:Ce().nullish(),isSupporter:Te().nullish(),tickerSettings:st.nullish(),submitComponentEvent:we(),numArticles:Se().nullish(),hasOptedOutOfArticleCount:Te().nullish(),fetchEmail:we().nullish(),separateArticleCount:Te().nullish(),design:Zt.nullish()});const Lt=Ie({heading:Ce(),subheading:Ce(),primaryCta:Ye.optional(),secondaryCta:Ye.optional(),benefits:Ne(Ce()).optional()});Ie({content:Lt,tracking:ot,mobileContent:Lt.optional(),countryCode:Ce().optional(),submitComponentEvent:we(),numArticles:Se().optional()});const Ut=Ie({maxViewsCount:Se(),maxViewsDays:Se(),minDaysBetweenViews:Se()});ft.extend({name:Ce(),status:ht,locations:Ne(Me),tagIds:Ne(Ce()),sections:Ne(Ce()),excludedTagIds:Ne(Ce()),excludedSections:Ne(Ce()),alwaysAsk:Te(),maxViews:Ut.optional(),userCohort:yt,hasCountryName:Te(),highPriority:Te(),useLocalViewLog:Te(),articlesViewedSettings:gt.optional(),priority:Se(),variants:wt.array()});const Dt=(e,t,a)=>{const n=(e=>{if(URLSearchParams){const t=new URLSearchParams(window.location.search).get(`force-${e}`);if(t)return t}return null})(e);return fetch(`${t}/${e}${n?`?force=${n}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then((t=>{if(!t.ok)throw Error(t.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${t.status}`);return t})).then((e=>e.json()))};exports.CountryGroupId=Ze,exports.SecondaryCtaType=ze,exports.TickerCountType=Xe,exports.TickerEndType=qe,exports.addRegionIdToSupportUrl=(e,t)=>{if(t){const a=(e=>Pe[De(e)]?.supportRegionId)(t);if(a)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,t,n)=>`${t}/${a.toLowerCase()}/${n}`))}return e},exports.buildReminderFields=Fe,exports.containsNonArticleCountPlaceholder=e=>{const t=e.match(Ke)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!t&&t.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=De,exports.countryGroupIdSchema=Me,exports.epicPropsSchema=Nt,exports.getBanner=(e,t)=>Dt("banner",e,t),exports.getCountryName=Ge,exports.getEpic=(e,t)=>Dt("epic",e,t),exports.getEpicViewLog=t=>t.get(e)||void 0,exports.getHeader=(e,t)=>Dt("header",e,t),exports.getLiveblogEpic=(e,t)=>Dt("liveblog-epic",e,t),exports.getLocalCurrencySymbol=Be,exports.getReminderFields=(e,t=new Date)=>{return"US"===e&&He(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${a=t.getFullYear()}-${(Ve(a).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${a}`}:"US"===e&&(e=>e>=Ve(e.getFullYear())&&e<We)(t)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(t.getFullYear()):Fe(t);var a},exports.getWeeklyArticleHistory=e=>e.get(t)||void 0,exports.inCountryGroups=(e,t=[])=>0===t.length||!!e&&t.includes(De(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,s,r)=>{const o=((e,t)=>{const s=n(new Date),i=e.get(a);if(i&&i.week===s){const n=i.articles[t]||0;return e.set(a,{week:s,articles:{...i.articles,[t]:n+1}}),n>0}return e.set(a,{week:s,articles:{[t]:1}}),!1})(e,s);if(!o){const a=n(new Date),s=e.get(t)||[],o=s[0];if(o&&o.week&&o.week===a)o.count+=1,o.tags=i(r,o.tags),e.set(t,s);else{s.unshift({week:a,count:1,tags:i(r,{})});const n=a-365,o=s.filter((e=>e.week>=n));e.set(t,o)}}},exports.logEpicView=t=>{const a=localStorage.getItem(e),n=a?JSON.parse(a).value:[];n.push({date:(new Date).getTime(),testId:t});const s={value:n.slice(-50)};localStorage.setItem(e,JSON.stringify(s))},exports.replaceNonArticleCountPlaceholders=(e,t,a)=>e?e.replace(Ke,(e=>{const n=e.substring(2,e.length-2),s=$e[n];if(s){const e=s({countryCode:t,prices:a});if(e)return e}return e})):"";
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("zod"));const t="gu.contributions.views",a="gu.history.weeklyArticleCount",o="gu.history.articleCountsThisWeek",r=e=>{const n=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(n-1))/864e5},i=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business"]),s=(e,n={})=>(e.forEach((e=>{i.has(e)&&(n[e]=(n[e]??0)+1)})),n),l=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],u=n.enum(l),c={GBPCountries:{name:"United Kingdom",currency:"GBP",countries:["GB","FK","GI","GG","IM","JE","SH"],supportRegionId:"UK"},UnitedStates:{name:"United States",currency:"USD",countries:["US"],supportRegionId:"US"},AUDCountries:{name:"Australia",currency:"AUD",countries:["AU","KI","NR","NF","TV"],supportRegionId:"AU"},EURCountries:{name:"Europe",currency:"EUR",countries:["AD","AL","AT","BA","BE","BG","BL","CH","CY","CZ","DE","DK","EE","ES","FI","FO","FR","GF","GL","GP","GR","HR","HU","IE","IT","LI","LT","LU","LV","MC","ME","MF","IS","MQ","MT","NL","NO","PF","PL","PM","PT","RE","RO","RS","SE","SI","SJ","SK","SM","TF","TR","WF","YT","VA","AX","AZ","AM","GE","BY","MD","UA","MK"],supportRegionId:"EU"},International:{name:"International",currency:"USD",countries:["AE","AF","AG","AI","AO","AQ","AR","AS","AW","BB","BD","BF","BH","BI","BJ","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BZ","CC","CD","CF","CG","CI","CL","CM","CN","CO","CR","CU","CV","CW","CX","DJ","DM","DO","DZ","EC","EG","EH","ER","ET","FJ","FM","GA","GD","GH","GM","GN","GQ","GS","GT","GU","GW","GY","HK","HM","HN","HT","ID","IL","IN","IO","IQ","IR","JM","JO","JP","KE","KG","KH","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LY","MA","MG","MH","ML","MM","MN","MO","MP","MR","MS","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NG","NI","NP","NU","OM","PA","PE","PG","PH","PK","PN","PR","PS","PW","PY","QA","RU","RW","SA","SB","SC","SD","SG","SL","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TG","TH","TJ","TK","TL","TM","TN","TO","TT","TW","TZ","UG","UM","UY","UZ","VC","VE","VG","VI","VN","VU","WS","YE","ZA","ZM","ZW"],supportRegionId:"INT"},NZDCountries:{name:"New Zealand",currency:"NZD",countries:["NZ","CK"],supportRegionId:"NZ"},Canada:{name:"Canada",currency:"CAD",countries:["CA"],supportRegionId:"CA"}},d={AD:"Andorra",AE:"the UAE",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AS:"the US",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius and Saba",BR:"Brazil",BS:"the Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"the Democratic Republic of the Congo",CF:"the Central Africa Republic",CG:"the Congo",CH:"Switzerland",CI:"Côte d'Ivoire",CK:"the Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"the Czech Republic",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"the Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"the Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"the UK",FO:"the UK",FR:"France",GA:"Gabon",GB:"the UK",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"the Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IM:"the Isle of Man",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KN:"Saint Kitts and Nevis",KP:"Korea",KR:"Korea",KW:"Kuwait",KY:"the Cayman Ialnds",KZ:"Kazakhstan",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MG:"Madagascar",MK:"the Republic of North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"the Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"the Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SY:"Syrian Arab Republic",SZ:"Eswatini",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania ",UG:"Uganda",US:"the US",UY:"Uruguay",UZ:"Uzbekistan",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"the Virgin Islands",VI:"the Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},g={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(c).find((n=>c[n].countries.includes(e??"")))||"International",m=e=>{if(e){const n=p(e);return g[n]}return"£"},C=e=>{if(e)return d[e]},b=(e,n,t,a)=>{if(a){const o=a[p(t)];if(o){return`${m(t)}${o[e][n].price}`}}},S={CURRENCY_SYMBOL:({countryCode:e})=>m(e),COUNTRY_NAME:({countryCode:e})=>C(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:n})=>b("Digisub","Monthly",e,n),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:n})=>b("Digisub","Annual",e,n),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:n})=>b("GuardianWeekly","Monthly",e,n),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:n})=>b("GuardianWeekly","Annual",e,n),DAY_OF_THE_WEEK:()=>((e=new Date)=>e.toLocaleString("en-GB",{weekday:"long"}))(),DATE:()=>((e=new Date)=>e.toLocaleString("en-GB",{day:"numeric",month:"long",year:"numeric"}))()},h=/%%.*?%%/g,y=e=>{const n=(e=>{const n=new Date(e,10,1).getDay();return new Date(e,10,22+(11-n)%7)})(e);return n.setDate(n.getDate()+5),n},A=(e=new Date)=>{const n=(e=>{const n=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+n),e})(e),t=(n.getMonth()+1).toString().padStart(2,"0"),a=n.toLocaleString("default",{month:"long"}),o=n.getFullYear();return{reminderCta:`Remind me in ${a}`,reminderPeriod:`${o}-${t}-01`,reminderLabel:`${a} ${o}`}},T=new Date("2023-12-31"),I=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<y(e.getFullYear()),N=n.object({text:n.string(),baseUrl:n.string()});let M=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});n.nativeEnum(M);const E=n.object({type:n.literal(M.Custom),cta:N}),G=n.object({type:n.literal(M.ContributionsReminder)}),R=n.discriminatedUnion("type",[E,G]);let U=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const B=n.nativeEnum(U);let P=function(e){return e.money="money",e}({});const L=n.nativeEnum(P),D=n.object({countLabel:n.string(),goalReachedPrimary:n.string(),goalReachedSecondary:n.string()}),w=n.object({total:n.number(),goal:n.number()}),O=n.enum(["US","AU"]),f=n.object({endType:B,countType:L,currencySymbol:n.string(),copy:D,name:O,tickerData:w.optional()}),k=n.enum(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),K=n.enum(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),F=n.object({abTestName:n.string(),abTestVariant:n.string(),campaignCode:n.string(),componentType:K,products:n.array(k).nullish(),labels:n.array(n.string()).nullish(),ophanPageId:n.string(),platformId:n.string(),referrerUrl:n.string(),clientName:n.string()}),v=n.object({mainUrl:n.string(),mobileUrl:n.string().optional(),tabletUrl:n.string().optional(),desktopUrl:n.string().optional(),leftColUrl:n.string().optional(),wideUrl:n.string().optional(),altText:n.string()}),x=n.object({name:n.string(),description:n.string().optional(),headshot:v.optional()}),j=n.enum(["Contribution","SupporterPlus","GuardianWeekly","Paper"]),H=n.enum(["new","guest","current"]),V=n.enum(["Live","Draft","Archived"]),Y=n.enum(["Mobile","Desktop","All","iOS","Android"]),W=n.enum(["SignedIn","SignedOut","All"]),Z=n.enum(["HasConsented","HasNotConsented","All"]),_=n.object({name:n.string(),status:V,priority:n.number(),controlProportionSettings:n.object({proportion:n.number(),offset:n.number()}).optional(),deviceType:Y.optional(),signedInStatus:W.optional(),consentStatus:Z.optional()}),$=n.enum(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),J=n.object({minViews:n.number(),maxViews:n.number().optional(),periodInWeeks:n.number(),tagId:n.string().optional()});n.object({userType:n.array(H),product:n.array(j)}),n.object({tagIds:n.array(n.string()),sectionIds:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSectionIds:n.array(n.string())});const Q=n.enum(["for52Weeks","forTargetedWeeks"]),z=n.object({for52Weeks:n.number(),forTargetedWeeks:n.number()}),q=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()}),X=n.object({type:n.literal("above"),copy:n.string().optional(),countType:Q.optional()}),ee=n.object({reminderCta:n.string(),reminderLabel:n.string(),reminderPeriod:n.string()}),ne=n.enum(["ONE_OFF","MONTHLY","ANNUAL"]),te=n.object({testName:n.string(),variantName:n.string(),defaultContributionType:ne,displayContributionType:ne.array(),amountsCardData:n.object({ONE_OFF:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),MONTHLY:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()}),ANNUAL:n.object({amounts:n.array(n.number()),defaultAmount:n.number(),hideChooseYourAmount:n.boolean().optional()})})}),ae=n.object({url:n.string()}),oe=n.object({name:n.string(),heading:n.string().optional(),paragraphs:n.array(n.string()),highlightedText:n.string().optional(),tickerSettings:f.optional(),cta:N.optional(),secondaryCta:R.optional(),newsletterSignup:ae.optional(),image:v.optional(),showReminderFields:ee.optional(),separateArticleCount:X.optional(),maxViews:q.optional(),showSignInLink:n.boolean().optional(),bylineWithImage:x.optional(),showChoiceCards:n.boolean().optional(),choiceCardAmounts:te.optional(),defaultChoiceCardFrequency:ne.optional()}),re=n.object({variant:oe,tracking:F,countryCode:n.string().nullish(),articleCounts:z,onReminderOpen:n.any().nullish(),fetchEmail:n.any().nullish(),submitComponentEvent:n.any().nullish(),openCmp:n.any().nullish(),hasConsentForArticleCount:n.boolean().nullish(),stage:n.string().nullish()}),ie=/^[0-9A-F]{2}$/,se=n.string().refine((e=>ie.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),le=n.object({r:se,g:se,b:se,kind:n.literal("hex")}),ue=n.object({mobileUrl:n.string(),tabletUrl:n.string(),desktopUrl:n.string(),altText:n.string(),kind:n.literal("Image")}),ce=n.object({buttonColour:le.nullish(),buttonTextColour:le.nullish(),buttonBorderColour:le.nullish(),buttonSelectColour:le.nullish(),buttonSelectTextColour:le.nullish(),buttonSelectBorderColour:le.nullish(),kind:n.literal("ChoiceCards")}),de=n.discriminatedUnion("kind",[ue,ce]),ge=n.object({visual:de.nullish(),colours:n.object({basic:n.object({background:le,bodyText:le})})}),pe=n.enum(["contributions","subscriptions","signIn"]),me=n.object({heading:n.string().optional(),messageText:n.string().optional(),paragraphs:n.array(n.string()).optional(),mobileMessageText:n.string().optional(),highlightedText:n.string().optional(),cta:N.optional(),secondaryCta:R.optional()});n.object({tracking:F,bannerChannel:pe,content:me.nullish(),mobileContent:me.nullish(),countryCode:n.string().nullish(),isSupporter:n.boolean().nullish(),tickerSettings:f.nullish(),submitComponentEvent:n.any(),numArticles:n.number().nullish(),hasOptedOutOfArticleCount:n.boolean().nullish(),fetchEmail:n.any().nullish(),separateArticleCount:n.boolean().nullish(),design:ge.nullish()});const Ce=n.object({heading:n.string(),subheading:n.string(),primaryCta:N.optional(),secondaryCta:N.optional(),benefits:n.array(n.string()).optional()});n.object({content:Ce,tracking:F,mobileContent:Ce.optional(),countryCode:n.string().optional(),submitComponentEvent:n.any(),numArticles:n.number().optional()});const be=n.object({maxViewsCount:n.number(),maxViewsDays:n.number(),minDaysBetweenViews:n.number()});_.extend({name:n.string(),status:V,locations:n.array(u),tagIds:n.array(n.string()),sections:n.array(n.string()),excludedTagIds:n.array(n.string()),excludedSections:n.array(n.string()),alwaysAsk:n.boolean(),maxViews:be.optional(),userCohort:$,hasCountryName:n.boolean(),highPriority:n.boolean(),useLocalViewLog:n.boolean(),articlesViewedSettings:J.optional(),priority:n.number(),variants:oe.array(),isBanditTest:n.boolean().optional()});const Se=(e,n,t)=>{const a=(e=>{if(URLSearchParams){const n=new URLSearchParams(window.location.search).get(`force-${e}`);if(n)return n}return null})(e);return fetch(`${n}/${e}${a?`?force=${a}`:""}`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((n=>{if(!n.ok)throw Error(n.statusText||`Supporter Revenue ${e} | Api call returned HTTP status ${n.status}`);return n})).then((e=>e.json()))};exports.CountryGroupId=l,exports.SecondaryCtaType=M,exports.TickerCountType=P,exports.TickerEndType=U,exports.addRegionIdToSupportUrl=(e,n)=>{if(n){const t=(e=>c[p(e)]?.supportRegionId)(n);if(t)return e.replace(/(support.theguardian.com)\/(contribute-in-epic|contribute|subscribe)/,((e,n,a)=>`${n}/${t.toLowerCase()}/${a}`))}return e},exports.buildReminderFields=A,exports.containsNonArticleCountPlaceholder=e=>{const n=e.match(h)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!n&&n.length>0},exports.contributionTabFrequencies=["ONE_OFF","MONTHLY","ANNUAL"],exports.countryCodeToCountryGroupId=p,exports.countryGroupIdSchema=u,exports.epicPropsSchema=re,exports.getBanner=(e,n)=>Se("banner",e,n),exports.getCountryName=C,exports.getEpic=(e,n)=>Se("epic",e,n),exports.getEpicViewLog=e=>e.get(t)||void 0,exports.getHeader=(e,n)=>Se("header",e,n),exports.getLiveblogEpic=(e,n)=>Se("liveblog-epic",e,n),exports.getLocalCurrencySymbol=m,exports.getReminderFields=(e,n=new Date)=>{return"US"===e&&I(n)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${t=n.getFullYear()}-${(y(t).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${t}`}:"US"===e&&(e=>e>=y(e.getFullYear())&&e<T)(n)?(e=>({reminderCta:"Remind me on New Years Eve",reminderPeriod:`${e}-12-01`,reminderLabel:"on New Years Eve",reminderOption:`new-years-eve-${e}`}))(n.getFullYear()):A(n);var t},exports.getWeeklyArticleHistory=e=>e.get(a)||void 0,exports.inCountryGroups=(e,n=[])=>0===n.length||!!e&&n.includes(p(e.toUpperCase())),exports.incrementWeeklyArticleCount=(e,n,t)=>{const i=((e,n)=>{const t=r(new Date),a=e.get(o);if(a&&a.week===t){const r=a.articles[n]||0;return e.set(o,{week:t,articles:{...a.articles,[n]:r+1}}),r>0}return e.set(o,{week:t,articles:{[n]:1}}),!1})(e,n);if(!i){const n=r(new Date),o=e.get(a)||[],i=o[0];if(i&&i.week&&i.week===n)i.count+=1,i.tags=s(t,i.tags),e.set(a,o);else{o.unshift({week:n,count:1,tags:s(t,{})});const r=n-365,i=o.filter((e=>e.week>=r));e.set(a,i)}}},exports.logEpicView=e=>{const n=localStorage.getItem(t),a=n?JSON.parse(n).value:[];a.push({date:(new Date).getTime(),testId:e});const o={value:a.slice(-50)};localStorage.setItem(t,JSON.stringify(o))},exports.replaceNonArticleCountPlaceholders=(e,n,t)=>e?e.replace(h,(e=>{const a=e.substring(2,e.length-2),o=S[a];if(o){const e=o({countryCode:n,prices:t});if(e)return e}return e})):"";
@@ -421,6 +421,7 @@ export declare const bannerTestFromToolSchema: z.ZodObject<{
421
421
  }>>;
422
422
  deviceType: z.ZodOptional<z.ZodEnum<["Mobile", "Desktop", "All", "iOS", "Android"]>>;
423
423
  signedInStatus: z.ZodOptional<z.ZodEnum<["SignedIn", "SignedOut", "All"]>>;
424
+ consentStatus: z.ZodOptional<z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>>;
424
425
  userCohort: z.ZodEnum<["AllExistingSupporters", "AllNonSupporters", "Everyone", "PostAskPauseSingleContributors"]>;
425
426
  locations: z.ZodArray<z.ZodEnum<["GBPCountries", "UnitedStates", "AUDCountries", "EURCountries", "International", "NZDCountries", "Canada"]>, "many">;
426
427
  contextTargeting: z.ZodObject<{
@@ -903,6 +904,7 @@ export declare const bannerTestFromToolSchema: z.ZodObject<{
903
904
  } | undefined;
904
905
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
905
906
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
907
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
906
908
  articlesViewedSettings?: {
907
909
  minViews: number;
908
910
  periodInWeeks: number;
@@ -991,6 +993,7 @@ export declare const bannerTestFromToolSchema: z.ZodObject<{
991
993
  } | undefined;
992
994
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
993
995
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
996
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
994
997
  articlesViewedSettings?: {
995
998
  minViews: number;
996
999
  periodInWeeks: number;
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/abTests/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAEb,kBAAkB,EAErB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGH,eAAe,EAGlB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,oBAAY,cAAc;IACtB,mBAAmB,wBAAwB;IAC3C,6BAA6B,kCAAkC;IAC/D,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,0BAA0B,+BAA+B;IACzD,+BAA+B,oCAAoC;CACtE;AAED,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,KAAK,QAAQ,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAElD,wBAAgB,UAAU,CAAC,EAAE,EAAE,QAAQ,GAAG,EAAE,IAAI,gBAAgB,CAE/D;AAED,eAAO,MAAM,2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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAAC"}
@@ -82,6 +82,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
82
82
  }>>;
83
83
  deviceType: z.ZodOptional<z.ZodEnum<["Mobile", "Desktop", "All", "iOS", "Android"]>>;
84
84
  signedInStatus: z.ZodOptional<z.ZodEnum<["SignedIn", "SignedOut", "All"]>>;
85
+ consentStatus: z.ZodOptional<z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>>;
85
86
  name: z.ZodString;
86
87
  status: z.ZodEnum<["Live", "Draft", "Archived"]>;
87
88
  locations: z.ZodArray<z.ZodEnum<["GBPCountries", "UnitedStates", "AUDCountries", "EURCountries", "International", "NZDCountries", "Canada"]>, "many">;
@@ -676,6 +677,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
676
677
  } | undefined;
677
678
  defaultChoiceCardFrequency?: "ONE_OFF" | "MONTHLY" | "ANNUAL" | undefined;
678
679
  }>, "many">;
680
+ isBanditTest: z.ZodOptional<z.ZodBoolean>;
679
681
  }, "strip", z.ZodTypeAny, {
680
682
  priority: number;
681
683
  name: string;
@@ -796,6 +798,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
796
798
  } | undefined;
797
799
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
798
800
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
801
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
799
802
  maxViews?: {
800
803
  maxViewsCount: number;
801
804
  maxViewsDays: number;
@@ -807,6 +810,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
807
810
  maxViews?: number | undefined;
808
811
  tagId?: string | undefined;
809
812
  } | undefined;
813
+ isBanditTest?: boolean | undefined;
810
814
  }, {
811
815
  priority: number;
812
816
  name: string;
@@ -927,6 +931,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
927
931
  } | undefined;
928
932
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
929
933
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
934
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
930
935
  maxViews?: {
931
936
  maxViewsCount: number;
932
937
  maxViewsDays: number;
@@ -938,6 +943,7 @@ export declare const epicTestFromToolSchema: z.ZodObject<{
938
943
  maxViews?: number | undefined;
939
944
  tagId?: string | undefined;
940
945
  } | undefined;
946
+ isBanditTest?: boolean | undefined;
941
947
  }>;
942
948
  export type EpicVariant = z.infer<typeof variantSchema>;
943
949
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"epic.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/abTests/epic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,MAAM,WAAW,CAAC;AAOjE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9C,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErE,eAAO,MAAM,0BAA0B,EAAE,qBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBjC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -176,6 +176,7 @@ export declare const headerTestFromToolSchema: z.ZodObject<{
176
176
  }>>;
177
177
  deviceType: z.ZodOptional<z.ZodEnum<["Mobile", "Desktop", "All", "iOS", "Android"]>>;
178
178
  signedInStatus: z.ZodOptional<z.ZodEnum<["SignedIn", "SignedOut", "All"]>>;
179
+ consentStatus: z.ZodOptional<z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>>;
179
180
  locations: z.ZodArray<z.ZodEnum<["GBPCountries", "UnitedStates", "AUDCountries", "EURCountries", "International", "NZDCountries", "Canada"]>, "many">;
180
181
  userCohort: z.ZodEnum<["AllExistingSupporters", "AllNonSupporters", "Everyone", "PostAskPauseSingleContributors"]>;
181
182
  purchaseInfo: z.ZodOptional<z.ZodObject<{
@@ -386,6 +387,7 @@ export declare const headerTestFromToolSchema: z.ZodObject<{
386
387
  } | undefined;
387
388
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
388
389
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
390
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
389
391
  purchaseInfo?: {
390
392
  product: ("Contribution" | "SupporterPlus" | "GuardianWeekly" | "Paper")[];
391
393
  userType: ("new" | "guest" | "current")[];
@@ -431,6 +433,7 @@ export declare const headerTestFromToolSchema: z.ZodObject<{
431
433
  } | undefined;
432
434
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
433
435
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
436
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
434
437
  purchaseInfo?: {
435
438
  product: ("Contribution" | "SupporterPlus" | "GuardianWeekly" | "Paper")[];
436
439
  userType: ("new" | "guest" | "current")[];
@@ -1 +1 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/abTests/header.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;GAEG;AACH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/B,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB;IACxD,iBAAiB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IAClD,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC;CACtB"}
@@ -11,6 +11,9 @@ export declare const deviceTypeSchema: z.ZodEnum<["Mobile", "Desktop", "All", "i
11
11
  declare const SignedInStatus: readonly ["SignedIn", "SignedOut", "All"];
12
12
  export type SignedInStatus = (typeof SignedInStatus)[number];
13
13
  export declare const signedInStatusSchema: z.ZodEnum<["SignedIn", "SignedOut", "All"]>;
14
+ declare const ConsentStatus: readonly ["HasConsented", "HasNotConsented", "All"];
15
+ export type ConsentStatus = (typeof ConsentStatus)[number];
16
+ export declare const ConsentStatusSchema: z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>;
14
17
  export interface Variant {
15
18
  name: string;
16
19
  }
@@ -22,6 +25,7 @@ export interface Test<V extends Variant> {
22
25
  controlProportionSettings?: ControlProportionSettings;
23
26
  deviceType?: DeviceType;
24
27
  signedInStatus?: SignedInStatus;
28
+ consentStatus?: ConsentStatus;
25
29
  }
26
30
  export declare const testSchema: z.ZodObject<{
27
31
  name: z.ZodString;
@@ -39,6 +43,7 @@ export declare const testSchema: z.ZodObject<{
39
43
  }>>;
40
44
  deviceType: z.ZodOptional<z.ZodEnum<["Mobile", "Desktop", "All", "iOS", "Android"]>>;
41
45
  signedInStatus: z.ZodOptional<z.ZodEnum<["SignedIn", "SignedOut", "All"]>>;
46
+ consentStatus: z.ZodOptional<z.ZodEnum<["HasConsented", "HasNotConsented", "All"]>>;
42
47
  }, "strip", z.ZodTypeAny, {
43
48
  priority: number;
44
49
  name: string;
@@ -49,6 +54,7 @@ export declare const testSchema: z.ZodObject<{
49
54
  } | undefined;
50
55
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
51
56
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
57
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
52
58
  }, {
53
59
  priority: number;
54
60
  name: string;
@@ -59,6 +65,7 @@ export declare const testSchema: z.ZodObject<{
59
65
  } | undefined;
60
66
  deviceType?: "Mobile" | "Desktop" | "All" | "iOS" | "Android" | undefined;
61
67
  signedInStatus?: "All" | "SignedIn" | "SignedOut" | undefined;
68
+ consentStatus?: "All" | "HasConsented" | "HasNotConsented" | undefined;
62
69
  }>;
63
70
  export interface ControlProportionSettings {
64
71
  proportion: number;
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/abTests/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EACH,mBAAmB,EAEnB,gBAAgB,EAEnB,MAAM,iBAAiB,CAAC;AAEzB,QAAA,MAAM,UAAU,wCAAyC,CAAC;AAC1D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,gBAAgB,0CAAqB,CAAC;AAEnD,QAAA,MAAM,UAAU,yDAA0D,CAAC;AAC3E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,QAAQ,GAAG,KAAK,CAAC,CAAC;AAEnE,eAAO,MAAM,gBAAgB,2DAAqB,CAAC;AAEnD,QAAA,MAAM,cAAc,2CAA4C,CAAC;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,oBAAoB,6CAAyB,CAAC;AAE3D,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;IACtD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC;AAED,eAAO,MAAM,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sB;;;;;;;;;EAGjC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;EAKrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -19,6 +19,7 @@ export type BannerTargeting = {
19
19
  purchaseInfo?: PurchaseInfo;
20
20
  isSignedIn: boolean;
21
21
  lastOneOffContributionDate?: string;
22
+ hasConsented: boolean;
22
23
  };
23
24
  export type BannerPayload = {
24
25
  tracking: PageTracking;
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/targeting/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5E,MAAM,MAAM,eAAe,GAAG;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;CAC9B,CAAC"}
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../shared/src/types/targeting/banner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5E,MAAM,MAAM,eAAe,GAAG;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC;CAC9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/support-dotcom-components",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -17,24 +17,28 @@
17
17
  "publish": "yarn build && yarn types && npm publish"
18
18
  },
19
19
  "devDependencies": {
20
- "jest": "^29.7.0",
21
- "ts-jest": "^29.1.1",
22
- "ts-loader": "^9.2.5",
23
- "typescript": "~5.1.3",
24
20
  "@babel/core": "^7.23.2",
25
21
  "@babel/preset-env": "7.23.2",
22
+ "@changesets/cli": "^2.26.2",
23
+ "@rollup/plugin-alias": "^3.1.1",
24
+ "@rollup/plugin-babel": "^5.1.0",
25
+ "@rollup/plugin-commonjs": "^14.0.0",
26
+ "@rollup/plugin-node-resolve": "^8.4.0",
27
+ "@rollup/plugin-replace": "^2.3.3",
26
28
  "babel-loader": "^9.1.3",
29
+ "jest": "^29.7.0",
27
30
  "rollup": "^2.23.0",
28
31
  "rollup-plugin-external-globals": "^0.5.0",
29
32
  "rollup-plugin-filesize": "^9.0.2",
30
33
  "rollup-plugin-peer-deps-external": "^2.2.3",
31
34
  "rollup-plugin-terser": "^7.0.2",
32
- "@rollup/plugin-alias": "^3.1.1",
33
- "@rollup/plugin-babel": "^5.1.0",
34
- "@rollup/plugin-commonjs": "^14.0.0",
35
- "@rollup/plugin-node-resolve": "^8.4.0",
36
- "@rollup/plugin-replace": "^2.3.3",
37
- "@changesets/cli": "^2.26.2"
35
+ "ts-jest": "^29.1.1",
36
+ "ts-loader": "^9.2.5",
37
+ "typescript": "~5.1.3",
38
+ "zod": "3.23.4"
38
39
  },
39
- "dependencies": {}
40
+ "dependencies": {},
41
+ "peerDependencies": {
42
+ "zod": "^3.22.4"
43
+ }
40
44
  }