@guardian/support-dotcom-components 1.1.1 → 1.1.2

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.
@@ -14,6 +14,5 @@ export interface ModuleDataResponse {
14
14
  export declare const getEpic: (baseUrl: string, payload: EpicPayload) => Promise<ModuleDataResponse>;
15
15
  export declare const getLiveblogEpic: (baseUrl: string, payload: EpicPayload) => Promise<ModuleDataResponse>;
16
16
  export declare const getBanner: (baseUrl: string, payload: BannerPayload) => Promise<ModuleDataResponse>;
17
- export declare const getPuzzlesBanner: (baseUrl: string, payload: BannerPayload) => Promise<ModuleDataResponse>;
18
17
  export declare const getHeader: (baseUrl: string, payload: HeaderPayload) => Promise<ModuleDataResponse>;
19
18
  //# sourceMappingURL=requests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,UAAU,CAAC;QACnB,IAAI,EAAE,YAAY,CAAC;KACtB,CAAC;CACL;AA4CD,eAAO,MAAM,OAAO,YAAa,MAAM,WAAW,WAAW,KAAG,QAAQ,kBAAkB,CAC/C,CAAC;AAE5C,eAAO,MAAM,eAAe,YACf,MAAM,WACN,WAAW,KACrB,QAAQ,kBAAkB,CAAqD,CAAC;AAEnF,eAAO,MAAM,SAAS,YAAa,MAAM,WAAW,aAAa,KAAG,QAAQ,kBAAkB,CACjD,CAAC;AAE9C,eAAO,MAAM,gBAAgB,YAChB,MAAM,WACN,aAAa,KACvB,QAAQ,kBAAkB,CAA+C,CAAC;AAE7E,eAAO,MAAM,SAAS,YAAa,MAAM,WAAW,aAAa,KAAG,QAAQ,kBAAkB,CACjD,CAAC"}
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,UAAU,CAAC;QACnB,IAAI,EAAE,YAAY,CAAC;KACtB,CAAC;CACL;AA4CD,eAAO,MAAM,OAAO,YAAa,MAAM,WAAW,WAAW,KAAG,QAAQ,kBAAkB,CAC/C,CAAC;AAE5C,eAAO,MAAM,eAAe,YACf,MAAM,WACN,WAAW,KACrB,QAAQ,kBAAkB,CAAqD,CAAC;AAEnF,eAAO,MAAM,SAAS,YAAa,MAAM,WAAW,aAAa,KAAG,QAAQ,kBAAkB,CACjD,CAAC;AAE9C,eAAO,MAAM,SAAS,YAAa,MAAM,WAAW,aAAa,KAAG,QAAQ,kBAAkB,CACjD,CAAC"}
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)}}},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"}},l={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"},h={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},p=e=>Object.keys(c).find((t=>c[t].countries.includes(e??"")))||"International",m=(e,t=[])=>0===t.length||!!e&&t.includes(p(e.toUpperCase())),f=e=>{if(e){const t=p(e);return h[t]}return"£"},y=e=>{if(e)return l[e]},g=(e,t)=>{if(t){const a=(e=>c[p(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},v=(e,t,a,n)=>{if(n){const s=n[p(a)];if(s){return`${f(a)}${s[e][t].price}`}}},_={CURRENCY_SYMBOL:({countryCode:e})=>f(e),COUNTRY_NAME:({countryCode:e})=>y(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>v("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>v("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>v("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>v("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"}))()},b=(e,t,a)=>e?e.replace(k,(e=>{const n=e.substring(2,e.length-2),s=_[n];if(s){const e=s({countryCode:t,prices:a});if(e)return e}return e})):"",k=/%%.*?%%/g,x=e=>{const t=e.match(k)?.filter((e=>"%%ARTICLE_COUNT%%"!==e));return!!t&&t.length>0},C=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},S=(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}`}},w=new Date("2023-12-31"),T=e=>e>=(e=>new Date(e.getFullYear(),9,20))(e)&&e<C(e.getFullYear()),N=(e,t=new Date)=>{return"US"===e&&T(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${a=t.getFullYear()}-${(C(a).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${a}`}:"US"===e&&(e=>e>=C(e.getFullYear())&&e<w)(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()):S(t);var a};var I,E;!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}(I||(I={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(E||(E={}));const R=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=e=>{switch(typeof e){case"undefined":return R.undefined;case"string":return R.string;case"number":return isNaN(e)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(e)?R.array:null===e?R.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?R.promise:"undefined"!=typeof Map&&e instanceof Map?R.map:"undefined"!=typeof Set&&e instanceof Set?R.set:"undefined"!=typeof Date&&e instanceof Date?R.date:R.object;default:return R.unknown}},O=I.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 Z 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,I.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()}}Z.create=e=>new Z(e);const M=(e,t)=>{let a;switch(e.code){case O.invalid_type:a=e.received===R.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case O.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,I.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:a=`Unrecognized key(s) in object: ${I.joinValues(e.keys,", ")}`;break;case O.invalid_union:a="Invalid input";break;case O.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${I.joinValues(e.options)}`;break;case O.invalid_enum_value:a=`Invalid enum value. Expected ${I.joinValues(e.options)}, received '${e.received}'`;break;case O.invalid_arguments:a="Invalid function arguments";break;case O.invalid_return_type:a="Invalid function return type";break;case O.invalid_date:a="Invalid date";break;case O.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}"`:I.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case O.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 O.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 O.custom:a="Invalid input";break;case O.invalid_intersection_types:a="Intersection results could not be merged";break;case O.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case O.not_finite:a="Number must be finite";break;default:a=t.defaultError,I.assertNever(e)}return{message:a}};let P=M;function L(){return P}const U=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=U({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,L(),M].filter((e=>!!e))});e.common.issues.push(a)}class D{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 G;"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 D.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 G;if("aborted"===s.status)return G;"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 G=Object.freeze({status:"aborted"}),j=e=>({status:"valid",value:e}),K=e=>"aborted"===e.status,$=e=>"dirty"===e.status,V=e=>"valid"===e.status,F=e=>"undefined"!=typeof Promise&&e instanceof Promise;var W;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(W||(W={}));class z{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 H=(e,t)=>{if(V(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 Z(e.common.issues);return this._error=t,this._error}}};function Y(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 J{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 A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new D,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(F(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:A(e)},s=this._parseSync({data:e,path:n.path,parent:n});return H(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:A(e)},n=this._parse({data:e,path:a.path,parent:a}),s=await(F(n)?n:Promise.resolve(n));return H(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:O.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 Ze({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 Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this,this._def)}promise(){return Oe.create(this,this._def)}or(e){return ke.create([this,e],this._def)}and(e){return Ce.create(this,e,this._def)}transform(e){return new Ze({...Y(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Le({...Y(this._def),innerType:this,defaultValue:t,typeName:Ke.ZodDefault})}brand(){return new De({typeName:Ke.ZodBranded,type:this,...Y(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ue({...Y(this._def),innerType:this,catchValue:t,typeName:Ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ge.create(this,e)}readonly(){return je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const q=/^c[^\s-]{8,}$/i,Q=/^[a-z][a-z0-9]*$/,X=/^[0-9A-HJKMNP-TV-Z]{26}$/,ee=/^[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,te=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ae;const ne=/^(((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}))$/,se=/^(([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 ie extends J{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==R.string){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.string,received:t.parsedType}),G}const t=new D;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:O.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:O.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:O.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&B(a,{code:O.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)te.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"email",code:O.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)ae||(ae=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ae.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"emoji",code:O.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)ee.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"uuid",code:O.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)q.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"cuid",code:O.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Q.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"cuid2",code:O.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)X.test(e.data)||(a=this._getOrReturnCtx(e,a),B(a,{validation:"ulid",code:O.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:O.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:O.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:O.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:O.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:O.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:O.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else"ip"===r.kind?(n=e.data,("v4"!==(s=r.version)&&s||!ne.test(n))&&("v6"!==s&&s||!se.test(n))&&(a=this._getOrReturnCtx(e,a),B(a,{validation:"ip",code:O.invalid_string,message:r.message}),t.dirty())):I.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:O.invalid_string,...W.errToObj(a)})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.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,...W.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...W.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...W.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...W.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...W.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...W.errToObj(t)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new ie({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ie({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ie({...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 re(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)}ie.create=e=>{var t;return new ie({checks:[],typeName:Ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Y(e)})};class oe extends J{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)!==R.number){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.number,received:t.parsedType}),G}let t;const a=new D;for(const n of this._def.checks)if("int"===n.kind)I.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),B(t,{code:O.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:O.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:O.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==re(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),B(t,{code:O.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:O.not_finite,message:n.message}),a.dirty()):I.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,a,n){return new oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:W.toString(n)}]})}_addCheck(e){return new oe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.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&&I.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)}}oe.create=e=>new oe({checks:[],typeName:Ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Y(e)});class de extends J{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)!==R.bigint){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.bigint,received:t.parsedType}),G}let t;const a=new D;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:O.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:O.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:O.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):I.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,W.toString(t))}gt(e,t){return this.setLimit("min",e,!1,W.toString(t))}lte(e,t){return this.setLimit("max",e,!0,W.toString(t))}lt(e,t){return this.setLimit("max",e,!1,W.toString(t))}setLimit(e,t,a,n){return new de({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:W.toString(n)}]})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:W.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}}de.create=e=>{var t;return new de({checks:[],typeName:Ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Y(e)})};class ue extends J{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==R.boolean){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.boolean,received:t.parsedType}),G}return j(e.data)}}ue.create=e=>new ue({typeName:Ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Y(e)});class ce extends J{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==R.date){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.date,received:t.parsedType}),G}if(isNaN(e.data.getTime())){return B(this._getOrReturnCtx(e),{code:O.invalid_date}),G}const t=new D;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:O.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:O.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):I.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:W.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}}ce.create=e=>new ce({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ke.ZodDate,...Y(e)});class le extends J{_parse(e){if(this._getType(e)!==R.symbol){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.symbol,received:t.parsedType}),G}return j(e.data)}}le.create=e=>new le({typeName:Ke.ZodSymbol,...Y(e)});class he extends J{_parse(e){if(this._getType(e)!==R.undefined){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.undefined,received:t.parsedType}),G}return j(e.data)}}he.create=e=>new he({typeName:Ke.ZodUndefined,...Y(e)});class pe extends J{_parse(e){if(this._getType(e)!==R.null){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.null,received:t.parsedType}),G}return j(e.data)}}pe.create=e=>new pe({typeName:Ke.ZodNull,...Y(e)});class me extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}me.create=e=>new me({typeName:Ke.ZodAny,...Y(e)});class fe extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}fe.create=e=>new fe({typeName:Ke.ZodUnknown,...Y(e)});class ye extends J{_parse(e){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.never,received:t.parsedType}),G}}ye.create=e=>new ye({typeName:Ke.ZodNever,...Y(e)});class ge extends J{_parse(e){if(this._getType(e)!==R.undefined){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.void,received:t.parsedType}),G}return j(e.data)}}ge.create=e=>new ge({typeName:Ke.ZodVoid,...Y(e)});class ve extends J{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==R.array)return B(t,{code:O.invalid_type,expected:R.array,received:t.parsedType}),G;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?O.too_big:O.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:O.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:O.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 z(t,e,t.path,a))))).then((e=>D.mergeArray(a,e)));const s=[...t.data].map(((e,a)=>n.type._parseSync(new z(t,e,t.path,a))));return D.mergeArray(a,s)}get element(){return this._def.type}min(e,t){return new ve({...this._def,minLength:{value:e,message:W.toString(t)}})}max(e,t){return new ve({...this._def,maxLength:{value:e,message:W.toString(t)}})}length(e,t){return new ve({...this._def,exactLength:{value:e,message:W.toString(t)}})}nonempty(e){return this.min(1,e)}}function _e(e){if(e instanceof be){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=Me.create(_e(n))}return new be({...e._def,shape:()=>t})}return e instanceof ve?new ve({...e._def,type:_e(e.element)}):e instanceof Me?Me.create(_e(e.unwrap())):e instanceof Pe?Pe.create(_e(e.unwrap())):e instanceof Se?Se.create(e.items.map((e=>_e(e)))):e}ve.create=(e,t)=>new ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...Y(t)});class be extends J{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=I.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==R.object){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.object,received:t.parsedType}),G}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof ye&&"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 z(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ye){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:O.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 z(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=>D.mergeObjectSync(t,e))):D.mergeObjectSync(t,r)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new be({...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=W.errToObj(e).message)&&void 0!==r?r:o}:{message:o}}}:{}})}strip(){return new be({...this._def,unknownKeys:"strip"})}passthrough(){return new be({...this._def,unknownKeys:"passthrough"})}extend(e){return new be({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new be({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 be({...this._def,catchall:e})}pick(e){const t={};return I.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new be({...this._def,shape:()=>t})}omit(e){const t={};return I.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new be({...this._def,shape:()=>t})}deepPartial(){return _e(this)}partial(e){const t={};return I.objectKeys(this.shape).forEach((a=>{const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()})),new be({...this._def,shape:()=>t})}required(e){const t={};return I.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 be({...this._def,shape:()=>t})}keyof(){return Ee(I.objectKeys(this.shape))}}be.create=(e,t)=>new be({shape:()=>e,unknownKeys:"strip",catchall:ye.create(),typeName:Ke.ZodObject,...Y(t)}),be.strictCreate=(e,t)=>new be({shape:()=>e,unknownKeys:"strict",catchall:ye.create(),typeName:Ke.ZodObject,...Y(t)}),be.lazycreate=(e,t)=>new be({shape:e,unknownKeys:"strip",catchall:ye.create(),typeName:Ke.ZodObject,...Y(t)});class ke extends J{_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 Z(e.ctx.common.issues)));return B(t,{code:O.invalid_union,unionErrors:a}),G}));{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 Z(e)));return B(t,{code:O.invalid_union,unionErrors:s}),G}}get options(){return this._def.options}}ke.create=(e,t)=>new ke({options:e,typeName:Ke.ZodUnion,...Y(t)});function xe(e,t){const a=A(e),n=A(t);if(e===t)return{valid:!0,data:e};if(a===R.object&&n===R.object){const a=I.objectKeys(t),n=I.objectKeys(e).filter((e=>-1!==a.indexOf(e))),s={...e,...t};for(const a of n){const n=xe(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(a===R.array&&n===R.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const s=xe(e[n],t[n]);if(!s.valid)return{valid:!1};a.push(s.data)}return{valid:!0,data:a}}return a===R.date&&n===R.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ce extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(K(e)||K(n))return G;const s=xe(e.value,n.value);return s.valid?(($(e)||$(n))&&t.dirty(),{status:t.value,value:s.data}):(B(a,{code:O.invalid_intersection_types}),G)};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}))}}Ce.create=(e,t,a)=>new Ce({left:e,right:t,typeName:Ke.ZodIntersection,...Y(a)});class Se extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==R.array)return B(a,{code:O.invalid_type,expected:R.array,received:a.parsedType}),G;if(a.data.length<this._def.items.length)return B(a,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;!this._def.rest&&a.data.length>this._def.items.length&&(B(a,{code:O.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 z(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(n).then((e=>D.mergeArray(t,e))):D.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,...Y(t)})};class we extends J{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!==R.map)return B(a,{code:O.invalid_type,expected:R.map,received:a.parsedType}),G;const n=this._def.keyType,s=this._def.valueType,i=[...a.data.entries()].map((([e,t],i)=>({key:n._parse(new z(a,e,a.path,[i,"key"])),value:s._parse(new z(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 G;"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 G;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}we.create=(e,t,a)=>new we({valueType:t,keyType:e,typeName:Ke.ZodMap,...Y(a)});class Te extends J{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==R.set)return B(a,{code:O.invalid_type,expected:R.set,received:a.parsedType}),G;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(B(a,{code:O.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:O.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 G;"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 z(a,e,a.path,t))));return a.common.async?Promise.all(r).then((e=>i(e))):i(r)}min(e,t){return new Te({...this._def,minSize:{value:e,message:W.toString(t)}})}max(e,t){return new Te({...this._def,maxSize:{value:e,message:W.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Te.create=(e,t)=>new Te({valueType:e,minSize:null,maxSize:null,typeName:Ke.ZodSet,...Y(t)});class Ne extends J{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})}}Ne.create=(e,t)=>new Ne({getter:e,typeName:Ke.ZodLazy,...Y(t)});class Ie extends J{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return B(t,{received:t.data,code:O.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ee(e,t){return new Re({values:e,typeName:Ke.ZodEnum,...Y(t)})}Ie.create=(e,t)=>new Ie({value:e,typeName:Ke.ZodLiteral,...Y(t)});class Re extends J{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return B(t,{expected:I.joinValues(a),received:t.parsedType,code:O.invalid_type}),G}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return B(t,{received:t.data,code:O.invalid_enum_value,options:a}),G}return j(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 Re.create(e)}exclude(e){return Re.create(this.options.filter((t=>!e.includes(t))))}}Re.create=Ee;class Ae extends J{_parse(e){const t=I.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==R.string&&a.parsedType!==R.number){const e=I.objectValues(t);return B(a,{expected:I.joinValues(e),received:a.parsedType,code:O.invalid_type}),G}if(-1===t.indexOf(e.data)){const e=I.objectValues(t);return B(a,{received:a.data,code:O.invalid_enum_value,options:e}),G}return j(e.data)}get enum(){return this._def.values}}Ae.create=(e,t)=>new Ae({values:e,typeName:Ke.ZodNativeEnum,...Y(t)});class Oe extends J{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&!1===t.common.async)return B(t,{code:O.invalid_type,expected:R.promise,received:t.parsedType}),G;const a=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return j(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Oe.create=(e,t)=>new Oe({type:e,typeName:Ke.ZodPromise,...Y(t)});class Ze extends J{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=>{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?G:("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?G:("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(!V(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=>V(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}I.assertNever(n)}}Ze.create=(e,t,a)=>new Ze({schema:e,typeName:Ke.ZodEffects,effect:t,...Y(a)}),Ze.createWithPreprocess=(e,t,a)=>new Ze({schema:t,effect:{type:"preprocess",transform:e},typeName:Ke.ZodEffects,...Y(a)});class Me extends J{_parse(e){return this._getType(e)===R.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Me.create=(e,t)=>new Me({innerType:e,typeName:Ke.ZodOptional,...Y(t)});class Pe extends J{_parse(e){return this._getType(e)===R.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:Ke.ZodNullable,...Y(t)});class Le extends J{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===R.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Le.create=(e,t)=>new Le({innerType:e,typeName:Ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Y(t)});class Ue extends J{_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 F(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Z(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Z(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Ue.create=(e,t)=>new Ue({innerType:e,typeName:Ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Y(t)});class Be extends J{_parse(e){if(this._getType(e)!==R.nan){const t=this._getOrReturnCtx(e);return B(t,{code:O.invalid_type,expected:R.nan,received:t.parsedType}),G}return{status:"valid",value:e.data}}}Be.create=e=>new Be({typeName:Ke.ZodNaN,...Y(e)});class De extends J{_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 Ge extends J{_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?G:"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?G:"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 Ge({in:e,out:t,typeName:Ke.ZodPipeline})}}class je extends J{_parse(e){const t=this._def.innerType._parse(e);return V(t)&&(t.value=Object.freeze(t.value)),t}}var Ke;je.create=(e,t)=>new je({innerType:e,typeName:Ke.ZodReadonly,...Y(t)}),be.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 $e=ie.create,Ve=oe.create;Be.create,de.create;const Fe=ue.create;ce.create,le.create,he.create,pe.create;const We=me.create;fe.create,ye.create,ge.create;const ze=ve.create,He=be.create;be.strictCreate;const Ye=ke.create;Ce.create,Se.create,we.create,Te.create,Ne.create;const Je=Ie.create,qe=Re.create;Ae.create,Oe.create,Ze.create,Me.create,Pe.create,Ze.createWithPreprocess,Ge.create;const Qe=He({text:$e(),baseUrl:$e()});let Xe=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});qe(["CustomSecondaryCta","ContributionsReminderSecondaryCta"]);const et=Ye([He({type:Je("CustomSecondaryCta"),cta:Qe}),He({type:Je("ContributionsReminderSecondaryCta")})]);let tt=function(e){return e.unlimited="unlimited",e.hardstop="hardstop",e}({});const at=qe(["unlimited","hardstop"]);let nt=function(e){return e.money="money",e}({});const st=qe(["money"]),it=He({countLabel:$e(),goalReachedPrimary:$e(),goalReachedSecondary:$e()}),rt=He({total:Ve(),goal:Ve()}),ot=He({endType:at,countType:st,currencySymbol:$e(),copy:it,tickerData:rt.nullish()}),dt=qe(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),ut=qe(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),ct=He({abTestName:$e(),abTestVariant:$e(),campaignCode:$e(),componentType:ut,products:ze(dt).nullish(),labels:ze($e()).nullish(),ophanPageId:$e(),platformId:$e(),referrerUrl:$e(),clientName:$e()}),lt=He({mainUrl:$e(),mobileUrl:$e().nullish(),tabletUrl:$e().nullish(),desktopUrl:$e().nullish(),leftColUrl:$e().nullish(),wideUrl:$e().nullish(),altText:$e()}),ht=He({name:$e(),description:$e().nullish(),headshot:lt.nullish()}),pt=["ONE_OFF","MONTHLY","ANNUAL"],mt=He({for52Weeks:Ve(),forTargetedWeeks:Ve()}),ft=He({maxViewsCount:Ve(),maxViewsDays:Ve(),minDaysBetweenViews:Ve()}),yt=He({type:$e(),copy:$e().nullish()}),gt=He({reminderCta:$e(),reminderLabel:$e(),reminderPeriod:$e()}),vt=He({name:$e(),heading:$e().nullish(),paragraphs:ze($e()),highlightedText:$e().nullish(),tickerSettings:ot.nullish(),cta:Qe.nullish(),secondaryCta:et.nullish(),footer:$e().nullish(),image:lt.nullish(),showReminderFields:gt.nullish(),separateArticleCount:yt.nullish(),maxViews:ft.nullish(),showSignInLink:Fe().nullish(),bylineWithImage:ht.nullish()}),_t=He({variant:vt,tracking:ct,countryCode:$e().nullish(),articleCounts:mt,onReminderOpen:We().nullish(),fetchEmail:We().nullish(),submitComponentEvent:We().nullish(),openCmp:We().nullish(),hasConsentForArticleCount:Fe().nullish(),stage:$e().nullish()}),bt=(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()))},kt=(e,t)=>bt("epic",e,t),xt=(e,t)=>bt("liveblog-epic",e,t),Ct=(e,t)=>bt("banner",e,t),St=(e,t)=>bt("puzzles",e,t),wt=(e,t)=>bt("header",e,t);export{Xe as SecondaryCtaType,nt as TickerCountType,tt as TickerEndType,g as addRegionIdToSupportUrl,S as buildReminderFields,x as containsNonArticleCountPlaceholder,pt as contributionTabFrequencies,p as countryCodeToCountryGroupId,_t as epicPropsSchema,Ct as getBanner,y as getCountryName,kt as getEpic,t as getEpicViewLog,wt as getHeader,xt as getLiveblogEpic,f as getLocalCurrencySymbol,St as getPuzzlesBanner,N as getReminderFields,r as getWeeklyArticleHistory,m as inCountryGroups,u as incrementWeeklyArticleCount,a as logEpicView,b as replaceNonArticleCountPlaceholders};
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(["Live","Draft","Archived"]),bt=Pe(["Mobile","Desktop","All"]),kt=Pe(["SignedIn","SignedOut","All"]),xt=Re({name:Ne(),status:_t,priority:Ie(),controlProportionSettings:Re({proportion:Ie(),offset:Ie()}).optional(),deviceType:bt.optional(),signedInStatus:kt.optional()}),Ct=Pe(["AllExistingSupporters","AllNonSupporters","Everyone","PostAskPauseSingleContributors"]),St=Re({minViews:Ie(),maxViews:Ie().optional(),periodInWeeks:Ie(),tagId:Ne().optional()}),wt=Re({for52Weeks:Ie(),forTargetedWeeks:Ie()}),Tt=Re({maxViewsCount:Ie(),maxViewsDays:Ie(),minDaysBetweenViews:Ie()}),Nt=Re({type:Me("above"),copy:Ne().optional()}),It=Re({reminderCta:Ne(),reminderLabel:Ne(),reminderPeriod:Ne()}),At=Pe(["ONE_OFF","MONTHLY","ANNUAL"]),Et=Re({testName:Ne(),variantName:Ne(),defaultContributionType:At,displayContributionType:At.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()})})}),Ot=Re({name:Ne(),heading:Ne().optional(),paragraphs:Oe(Ne()),highlightedText:Ne().optional(),tickerSettings:pt.optional(),cta:nt.optional(),secondaryCta:it.optional(),footer:Ne().optional(),image:yt.optional(),showReminderFields:It.optional(),separateArticleCount:Nt.optional(),maxViews:Tt.optional(),showSignInLink:Ae().optional(),bylineWithImage:vt.optional(),showChoiceCards:Ae().optional(),choiceCardAmounts:Et.optional(),defaultChoiceCardFrequency:At.optional()}),Rt=Re({variant:Ot,tracking:gt,countryCode:Ne().nullish(),articleCounts:wt,onReminderOpen:Ee().nullish(),fetchEmail:Ee().nullish(),submitComponentEvent:Ee().nullish(),openCmp:Ee().nullish(),hasConsentForArticleCount:Ae().nullish(),stage:Ne().nullish()}),Zt=/^[0-9A-F]{2}$/,Mt=Ne().refine((e=>Zt.test(e)),(e=>({message:`"${e}" is not a valid hex value`}))),Pt=Re({r:Mt,g:Mt,b:Mt,kind:Me("hex")}),Lt=Re({mobileUrl:Ne(),tabletDesktopUrl:Ne(),wideUrl:Ne(),altText:Ne(),kind:Me("Image")}),Ut=Re({buttonColour:Pt.nullish(),buttonTextColour:Pt.nullish(),buttonBorderColour:Pt.nullish(),buttonSelectColour:Pt.nullish(),buttonSelectTextColour:Pt.nullish(),buttonSelectBorderColour:Pt.nullish(),kind:Me("ChoiceCards")}),Dt=Re({visual:Ze("kind",[Lt,Ut]).nullish(),colours:Re({basic:Re({background:Pt,bodyText:Pt})})}),Bt=Pe(["contributions","subscriptions","signIn"]),Gt=Re({heading:Ne().nullish(),messageText:Ne().nullish(),paragraphs:Oe(Ne()).nullish(),mobileMessageText:Ne().nullish(),highlightedText:Ne().nullish(),cta:nt.nullish(),secondaryCta:it.nullish()});Re({tracking:gt,bannerChannel:Bt,content:Gt.nullish(),mobileContent:Gt.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:Dt.nullish()});const jt=Re({heading:Ne(),subheading:Ne(),primaryCta:nt.nullish(),secondaryCta:nt.nullish()});Re({content:jt,tracking:gt,mobileContent:jt.nullish(),countryCode:Ne().nullish(),submitComponentEvent:Ee(),numArticles:Ie().nullish()});const $t=Re({maxViewsCount:Ie(),maxViewsDays:Ie(),minDaysBetweenViews:Ie()}),Kt=["ONE_OFF","MONTHLY","ANNUAL"];xt.extend({name:Ne(),status:_t,locations:Oe(De),tagIds:Oe(Ne()),sections:Oe(Ne()),excludedTagIds:Oe(Ne()),excludedSections:Oe(Ne()),alwaysAsk:Ae(),maxViews:$t.optional(),userCohort:Ct,hasCountryName:Ae(),highPriority:Ae(),useLocalViewLog:Ae(),articlesViewedSettings:St.optional(),priority:Ie(),variants:Ot.array()});const Vt=(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()))},Ft=(e,t)=>Vt("epic",e,t),Wt=(e,t)=>Vt("liveblog-epic",e,t),Yt=(e,t)=>Vt("banner",e,t),Ht=(e,t)=>Vt("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,Kt as contributionTabFrequencies,$e as countryCodeToCountryGroupId,De as countryGroupIdSchema,Rt as epicPropsSchema,Yt as getBanner,Fe as getCountryName,Ft as getEpic,t as getEpicViewLog,Ht as getHeader,Wt as getLiveblogEpic,Ve as getLocalCurrencySymbol,at as getReminderFields,r as getWeeklyArticleHistory,Ke as inCountryGroups,u as incrementWeeklyArticleCount,a as logEpicView,ze as replaceNonArticleCountPlaceholders};