@guardian/support-dotcom-components 11.1.4 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- const e="gu.history.weeklyArticleCount",t="gu.history.articleCountsThisWeek",n=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},r=t=>t.get(e)??void 0,i=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),o=(e,t={})=>(e.forEach(e=>{i.has(e)&&(t[e]=(t[e]??0)+1)}),t),s=(r,i,s)=>{const a=((e,r)=>{const i=n(new Date),o=e.get(t);if(o?.week===i){const n=o.articles[r]||0;return e.set(t,{week:i,articles:{...o.articles,[r]:n+1}}),n>0}return e.set(t,{week:i,articles:{[r]:1}}),!1})(r,i);if(!a){const t=n(new Date),i=r.get(e)??[],a=i.length>0?i[0]:null;if(a?.week&&a.week===t)a.count+=1,a.tags=o(s,a.tags),r.set(e,i);else{i.unshift({week:t,count:1,tags:o(s,{})});const n=t-365,a=i.filter(e=>e.week>=n);r.set(e,a)}}};function a(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function u(e,t="|"){return e.map(e=>A(e)).join(t)}function c(e,t){return"bigint"==typeof t?t.toString():t}class l{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function d(e){return new l(e)}function f(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function h(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function m(e){return h(e._zod.def)??e._zod.def.shape}function g(e,t,n){Object.defineProperty(e,t,{get(){const e=n();return p(this,t,e),e},enumerable:!0,configurable:!0})}function y(e,t,n){t in e?p(e,t,n):e[t]=n}function v(e,t,n,r){const i=m(t);for(const o of n){const n=Object.getOwnPropertyDescriptor(i,o);n.enumerable&&(n.get?g(e,o,()=>{const e=t._zod.def.shape[o];return r?r(e,o):e}):y(e,o,r?r(n.value,o):n.value))}}function b(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _(e){return JSON.stringify(e)}const w="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function z(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const S=d(()=>{if(ce.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function k(e){if(!1===z(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==z(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function O(e){return k(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const $=new Set(["string","number","symbol"]);function I(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function E(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function A(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const C=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),N={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function P(e,t){const n=m(e),r=[];for(const e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw new Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function x(e,t){const n={};return v(n,e,Reflect.ownKeys(m(e))),function(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?g(e,n,()=>t[n]):y(e,n,r.value))}}(n,t),n}function Z(e,t,n,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const o=n?new Set(P(t,n)):void 0,s={};return v(s,t,Reflect.ownKeys(m(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),T(t,b(t._zod.def,{shape:s,checks:[]}))}function M(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function j(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function R(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function U(e){return"string"==typeof e?e:e?.message}function D(e){const t=[];for(const n of e??[]){const e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;const r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function F(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function L(e,t,n){var r;const i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:U(e.inst?._zod.def?.error?.(e))??U(o?.(e))??U(t?.error?.(e))??U(n.customError?.(e))??U(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}const B=/[\uD800-\uDBFF]/;function G(e){const t=e.length;if(!B.test(e))return t;let n=t;for(let r=0;r<t-1;r++)55296==(64512&e.charCodeAt(r))&&56320==(64512&e.charCodeAt(r+1))&&(n--,r++);return n}function J(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function K(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}function V(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function W(e,t,n){return V(e,t,n,!1)}function Y(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return V(this,n,r(this))},set(e){V(this,n,e)}})}return t}function H(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:V(this,t,n.bind(this))},set(e){V(this,t,e)}})}let q,Q=!1;const X={configurable:!0,get(){Q=!0}};function ee(e,t,n){const r=Object.getPrototypeOf(e._zod);t in r&&q!==e._zod?q=void 0:(q=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,X);const e=Q;Q=!1;try{const r=n(this);return Q?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Q=Q||e,r}catch(n){throw delete this[t],Q=Q||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function te(e,t,n,r){const i=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function ne(e){const t=()=>e;return t["~constantCatch"]=!0,t}var re;const ie={value:void 0,enumerable:!1};let oe="captureStackTrace"in Error?Error:null;function se(e,t,n,r){function i(e){this.def=e,this.constr=l,this.traits=new Set}i.prototype={};const o=n,s=o&&new WeakSet;function a(n,r){if(n._zod){if(n._zod.traits.has(e))return}else{ie.value=new i(r);try{Object.defineProperty(n,"_zod",ie)}finally{ie.value=void 0}}if(n._zod.traits.add(e),t(n,r),s){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);const i=r??e;s.has(i)||(s.add(i),function(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):H(e,n,r.value)}}(i,o))}const a=l.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const u=r?.Parent??Object;class c extends u{}function l(e){const t=r?.Parent?function(e){const t=oe;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return oe=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(c):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(c,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ue extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});const ce=globalThis.__zod_globalConfig;function le(e){return e&&Object.assign(ce,e),ce}const de={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,c,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},fe={value:void 0,enumerable:!1},pe=new WeakSet([Object.prototype,Error.prototype]),he=se("$ZodError",(e,t)=>{e.name="$ZodError",fe.value=t,Object.defineProperty(e,"issues",fe),fe.value=void 0,Object.defineProperty(e,"message",de);const n=Object.getPrototypeOf(e);pe.has(n)||(pe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function me(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||("__proto__"===t?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ge(e,t){return{callee:t?.callee??e,Err:t?.Err}}const ye=e=>{const t=(n,r,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ae;if(a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>L(e,s,le())));throw w(n,o?.callee??t),n}return a.value};return t},ve=e=>{const t=async(n,r,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>L(e,s,le())));throw w(n,o?.callee??t),n}return a.value};return t},be=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ae;return o.issues.length?_e(e,o.issues,i):{success:!0,data:o.value}};function _e(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>L(e,n,le()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const we=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?_e(e,o.issues,i):{success:!0,data:o.value}},ze=Symbol.for("zod.compile.invalid"),Se=Symbol.for("zod.compile.fallback"),ke=(e,t,n)=>{const r=e._zod.bag.validator;if(void 0!==r){if(r(t)!==ze)return!0;if(!0===r.definite&&void 0===n)return!1}return function(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let o;i?(r[Se]=!0,o=i({value:t,issues:[]},r)):o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new ae;return 0===o.issues.length}(e,t,n)};const Oe=e=>{const t=ye(e),n=(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return t(e,r,s,ge(n,o))};return n},$e=e=>{const t=ye(e),n=(e,r,i,o)=>t(e,r,i,ge(n,o));return n},Ie=e=>{const t=ve(e),n=async(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(e,r,s,ge(n,o))};return n},Te=e=>{const t=ve(e),n=async(e,r,i,o)=>await t(e,r,i,ge(n,o));return n},Ee=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return be(e)(t,n,i)},Ae=e=>(t,n,r)=>be(e)(t,n,r),Ce=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return we(e)(t,n,i)},Ne=e=>async(t,n,r)=>we(e)(t,n,r),Pe=/^[cC][0-9a-z]{6,}$/,xe=/^[0-9a-z]+$/,Ze=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Me=/^[0-9a-vA-V]{20}$/,je=/^[A-Za-z0-9]{27}$/,Re=/^[a-zA-Z0-9_-]{21}$/;const Ue=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,De=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Le=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Be=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ge=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Je=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ve=/^https?$/,We=/^\+[1-9]\d{6,14}$/,Ye="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function He(e){return new RegExp(`^${e}$`)}const qe=He(Ye);function Qe(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Xe=/^[\s\S]{0,}$/,et=/^-?\d+(?:\.\d+)?$/,tt=/^(?:true|false)$/i,nt=/^[^A-Z]*$/,rt=/^[^a-z]*$/,it=se("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ot=e=>{const t=e.value;return!(n=t,null==n||void 0===t.length);var n},st={number:"number",bigint:"bigint",object:"date"},at=se("$ZodCheckLessThan",(e,t)=>{it.init(e,t);const n=st[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:st[typeof r.value]??n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ut=se("$ZodCheckGreaterThan",(e,t)=>{it.init(e,t);const n=st[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:st[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ct=se("$ZodCheckMultipleOf",(e,t)=>{it.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lt=se("$ZodCheckNumberFormat",(e,t)=>{it.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=C[t.format];e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),dt=se("$ZodCheckMaxLength",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?G(r):i)<=t.maximum)return;const o=J(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ft=se("$ZodCheckMinLength",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?G(r):i)>=t.minimum)return;const o=J(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pt=se("$ZodCheckLengthEquals",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?G(r):i;if(o===t.length)return;const s=J(r),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ht=se("$ZodCheckStringFormat",(e,t)=>{var n,r;it.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mt=se("$ZodCheckRegex",(e,t)=>{ht.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gt=se("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nt),ht.init(e,t)}),yt=se("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rt),ht.init(e,t)}),vt=se("$ZodCheckIncludes",(e,t)=>{it.init(e,t);const n=I(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bt=se("$ZodCheckStartsWith",(e,t)=>{it.init(e,t);const n=new RegExp(`^${I(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),_t=se("$ZodCheckEndsWith",(e,t)=>{it.init(e,t);const n=new RegExp(`.*${I(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),wt=se("$ZodCheckOverwrite",(e,t)=>{it.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class zt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join("\n")}\n};`)(...Object.values(this.closed))}}const St={major:4,minor:6,patch:6},kt=se("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=St;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,r)=>{if(t.memo)return t;let i,o=M(t);for(const s of n){if(s._zod.def.when){if(j(t))continue;if(!s._zod.def.when(t))continue}else if(o)continue;const n=t.issues.length,a=s._zod.check(t);if(a instanceof Promise&&!1===r?.async)throw new ae;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a;t.issues.length!==n&&(F(t.issues,n,e),o||(o=M(t,n)))});else{if(t.issues.length===n)continue;F(t.issues,n,e),o||(o=M(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(M(n))return n.aborted=!0,n;const s=t(r,i,o);if(s instanceof Promise){if(!1===o.async)throw new ae;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){const t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}const s=e._zod.parse(r,o);if(s instanceof Promise){if(!1===o.async)throw new ae;return s.then(e=>t(e,i,o))}return t(s,i,o)}}},{get"~standard"(){return W(this,"~standard",$t(this))},set"~standard"(e){V(this,"~standard",e)}}),Ot=(e,t)=>e.issues.length?{issues:e.issues.map(e=>L(e,t,le()))}:{value:e.value};function $t(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ot(r,n)}catch(e){}return async function(e,t){const n={async:!0};return Ot(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}}const It=se("$ZodString",(e,t)=>{kt.init(e,t),e._zod.pattern=t.pattern??Xe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Tt=se("$ZodStringFormat",(e,t)=>{ht.init(e,t),It.init(e,t)}),Et=se("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=De),Tt.init(e,t)}),At=se("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Fe(e))}else t.pattern??(t.pattern=Fe());Tt.init(e,t)}),Ct=se("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Le),Tt.init(e,t)});function Nt(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Pt(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===Ve.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):Nt(e)||2}const xt=/[\t\n\r]/g;function Zt(e){return e.replace(xt,"")}const Mt=se("$ZodURL",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=Pt(r,t);return 1===i?void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort}):2===i?void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort}):!0===i?void(n.value=Zt(r)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),void(n.value=t.normalize?i.href:Zt(r)))}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),jt=se("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),Tt.init(e,t)}),Rt=se("$ZodNanoID",(e,t)=>{if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);var n;t.pattern??(t.pattern=void 0===t.length?Re:(n=t.length,new RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),Tt.init(e,t)}),Ut=se("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pe),Tt.init(e,t)}),Dt=se("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xe),Tt.init(e,t)}),Ft=se("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ze),Tt.init(e,t)}),Lt=se("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Me),Tt.init(e,t)}),Bt=se("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=je),Tt.init(e,t)}),Gt=se("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${Qe({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Qe({precision:e.precision})}`:n;return new RegExp(`^${Ye}T(?:${r})$`)}(t)),Tt.init(e,t)}),Jt=se("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qe),Tt.init(e,t)}),Kt=se("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Qe(t)}$`)),Tt.init(e,t)}),Vt=se("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ue),Tt.init(e,t)}),Wt=se("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Be),Tt.init(e,t)}),Yt=/^[0-9a-fA-F:.]+$/;function Ht(e){return!!Yt.test(e)&&Nt(`http://[${e}]`)}const qt=se("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ge),Tt.init(e,t),e._zod.check=n=>{Ht(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Qt=se("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Je),Tt.init(e,t)});const Xt=se("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ke),Tt.init(e,t),e._zod.check=n=>{(function(e){const t=e.split("/");if(2!==t.length)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`===r&&!(i<0||i>128)&&Ht(n)})(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function en(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const tn=/^[0-9a-zA-Z+/]*={0,2}$/,nn=se("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tn),Tt.init(e,t),e._zod.check=n=>{en(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),rn=/^[A-Za-z0-9_-]*$/;const on=se("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rn),Tt.init(e,t),e._zod.check=n=>{(function(e){if(!rn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return en(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),sn=se("$ZodE164",(e,t)=>{t.pattern??(t.pattern=We),Tt.init(e,t)});const an=se("$ZodJWT",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),un=se("$ZodNumber",(e,t)=>{kt.init(e,t),e._zod.pattern=et,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),cn=se("$ZodNumberFormat",(e,t)=>{lt.init(e,t),un.init(e,t)}),ln=se("$ZodBoolean",(e,t)=>{kt.init(e,t),e._zod.pattern=tt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),dn=se("$ZodAny",(e,t)=>{kt.init(e,t),e._zod.parse=e=>e}),fn=se("$ZodUnknown",(e,t)=>{kt.init(e,t),e._zod.parse=e=>e}),pn=se("$ZodNever",(e,t)=>{kt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});const hn=e=>Array.isArray(e)?e.length:-1;function mn(e,t,n){e.issues.length&&t.issues.push(...R(n,e.issues)),t.value[n]=e.value}const gn=se("$ZodArray",(e,t)=>{kt.init(e,t);const n=ce.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);const s=[],a=i?.abortEarly;for(let e=0;e<o.length;e++){const n=o[e],u=t.element._zod.run({value:n,issues:[]},i);if(u instanceof Promise)s.push(u.then(t=>mn(t,r,e)));else if(mn(u,r,e),a&&0!==u.issues.length&&M(u))break}return s.length?Promise.all(s).then(()=>r):r},function(e,t){const n=D(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{const s=t(n.value);if(s>r&&!o?.skipChecks&&"backward"!==o?.direction)for(const[t,r]of D(e._zod.def.checks))if(s>t&&r._zod.def.when(n)){const t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,F(n.issues,t,e),n}return i(n,o)}}(e,hn)});function yn(e,t,n,r,i,o){const s=n in r,a="optional"===o;if(s||!a||"optional"!==i){if(e.issues.length){if(void 0!==i&&a&&!s)return;t.issues.push(...R(n,e.issues))}s||void 0!==i?void 0===e.value?(s||"defaulted"===i&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const vn=[];function bn(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:vn,i=r.length?[...t,...r]:t;for(const t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const o=(s=e.shape,Object.keys(s).filter(e=>void 0!==s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function _n(e,t,n,r,i,o,s){const a=[],u=i.keySet,c=i.catchall._zod,l=c.def.type,d=c.optin,f=c.optout;let p=0;for(const i in t){if(s&&n.issues.length!==p){if(M(n,p))break;p=n.issues.length}if(u.has(i))continue;if("__proto__"===i){"never"===l&&a.push(i);continue}if("never"===l){a.push(i);continue}const o=c.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>yn(e,n,i,t,d,f))):yn(o,n,i,t,d,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const wn=se("$ZodObject",(e,t)=>{kt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const e=()=>{const n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}const i=d(()=>bn(t));ee(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||p(n,e,new Set);for(const t of r.values)n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});const o=z,s=t.catchall;let a;const u=ce.memoizer;u?.attach(e),e._zod.parse=(t,n)=>{a??(a=i.value);const r=t.value;if(!o(r))return t.issues.push({expected:"object",code:"invalid_type",input:r,inst:e}),t;t.value=u?u.alloc(e,t,{},n):{};const c=[],l=a.shape,d=n?.abortEarly;let f=t.issues.length;for(const e of a.allKeys){if(d&&t.issues.length!==f){if(M(t,f))break;f=t.issues.length}if("__proto__"===e)continue;const i=l[e],o=i._zod.optin,s=i._zod.optout,a=i._zod.run({value:r[e],issues:[]},n);a instanceof Promise?c.push(a.then(n=>yn(n,t,e,r,o,s))):yn(a,t,e,r,o,s)}return s?_n(c,r,t,n,i.value,e,!0===d):c.length?Promise.all(c).then(()=>t):t}}),zn=se("$ZodObjectJIT",(e,t)=>{wn.init(e,t);const n=e._zod.parse,r=d(()=>bn(t)),i=ce.memoizer;let o;const s=z,a=!ce.jitless,u=a&&S.value,c=t.catchall;let l;e._zod.parse=(d,f)=>{l??(l=r.value);const p=d.value;return s(p)?a&&u&&!1===f?.async&&!0!==f.jitless?(o||(o=(t=>{const n=r.value,o=n.symbolKeys,s=new zt(["payload","ctx"],{shape:t,inst:e,memo:i,syms:o}),a=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,u=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;s.write("const input = payload.value;");const c=Object.create(null);let l=0;for(const e of n.allKeys)c[e]="key_"+l++;s.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const e of n.allKeys){if("__proto__"===e)continue;const n=c[e],r="symbol"==typeof e?`syms[${o.indexOf(e)}]`:_(e),i=`${r} in input`,l=t[e],d=l?._zod?.optin,f=void 0!==d,p="optional"===l?._zod?.optout;if(s.write(`const ${n} = ${a(r)};`),f&&p){const e="optional"===d?`${n}_present`:`${n}.value !== undefined || ${n}_present`;s.write(`\n const ${n}_present = ${i};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${u(n,r)}\n }\n\n if (${e}) {\n newResult[${r}] = ${n}.value;\n }\n }\n\n `)}else f?(s.write(`\n if (${n}.issues.length) {${u(n,r)}\n }\n `),"defaulted"===d?s.write(`newResult[${r}] = ${n}.value;`):s.write(`\n if (${n}.value !== undefined || ${i}) {\n newResult[${r}] = ${n}.value;\n }\n `)):s.write(`\n const ${n}_present = ${i};\n if (${n}.issues.length) {${u(n,r)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${r}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${r}] = ${n}.value;\n }\n\n `)}return s.write("payload.value = newResult;"),s.write("return payload;"),s.compile()})(t.shape)),d=o(d,f),c?_n([],p,d,f,l,e,!0===f?.abortEarly):d):n(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function Sn(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!M(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,le())))}),t)}const kn=se("$ZodUnion",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),ee(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ee(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),ee(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){const t=e.def.options.map(e=>e._zod.pattern);return new RegExp(`^(${t.map(e=>f(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>Sn(t,r,e,i)):Sn(s,r,e,i)}});const On=se("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kn.init(e,t);const n=e._zod.parse;ee(e,"propValues",e=>{const t={};let n=0;for(const r of e.def.options){const i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(const[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||p(t,e,new Set);for(const r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{const r=h(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw new Error(`Invalid discriminated union option at index "${n}"`)});const r=d(()=>function(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const e of r)if(t.has(e)){if(void 0!==e)throw new Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}(t));e._zod.parse=(i,o)=>{const s=i.value;if(!z(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=s?.[t.discriminator],u=r.value.get(a);return!u||void 0===a&&"backward"===o.direction?t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:s,path:[t.discriminator],inst:e}),i):u._zod.run(i,o)}}),$n=se("$ZodIntersection",(e,t)=>{kt.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,o)}});function In(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(k(e)&&k(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const n of r){if("__proto__"===n)continue;const r=In(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=In(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){const r=new Map;let i;const o=new Map,s=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length){if("invalid_key"!==e.code||"record"!==e.origin||1!==e.path?.length)return!1;{const t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}}else i??(i=e),n=e.keys;for(const e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(const n of t.issues)s(n,"l")||e.issues.push(n);for(const t of n.issues)s(t,"r")||e.issues.push(t);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length){const t=i?a.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(const n of a)!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}const u=In(t.value,n.value);if(!u.valid){if(M(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}const En=se("$ZodEnum",(e,t)=>{kt.init(e,t);const n=a(t.entries),r=new Set(n);e._zod.values=r,ee(e,"pattern",e=>{const t=a(e.def.entries).filter(e=>$.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>I(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),An=se("$ZodLiteral",(e,t)=>{kt.init(e,t);const n=new Set(t.values);e._zod.values=n,ee(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?I(e):e?I(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Cn=se("$ZodTransform",(e,t)=>{kt.init(e,t),e._zod.optin="optional",ce.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new ue(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n))}if(i instanceof Promise)throw new ae;return n.value=i,n}});function Nn(e,t){return e.value=t.issues.length?void 0:t.value,e}const Pn=se("$ZodOptional",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",ee(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),ee(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${f(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Nn(e,t)):Nn(e,r)}return t.innerType._zod.run(e,n)}}),xn=se("$ZodExactOptional",(e,t)=>{Pn.init(e,t),ee(e,"values",e=>e.def.innerType._zod.values),ee(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zn=se("$ZodNullable",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>e.def.innerType._zod.optin),ee(e,"optout",e=>e.def.innerType._zod.optout),ee(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${f(t.source)}|null)$`):void 0}),ee(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Mn=se("$ZodDefault",(e,t)=>{kt.init(e,t),e._zod.optin="defaulted",ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jn(e,t)):jn(r,t)}});function jn(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Rn=se("$ZodPrefault",(e,t)=>{kt.init(e,t),e._zod.optin="defaulted",ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Un=se("$ZodNonOptional",(e,t)=>{kt.init(e,t),ee(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dn(t,e)):Dn(i,e)}});function Dn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Fn(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>L(e,r,le()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Ln=se("$ZodCatch",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),ee(e,"optout",e=>e.def.innerType._zod.optout),ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Fn(e,r,t,n)):Fn(e,r,t,n)}}),Bn=se("$ZodPipe",(e,t)=>{kt.init(e,t),ee(e,"values",e=>e.def.in._zod.values),ee(e,"optin",e=>e.def.in._zod.optin),ee(e,"optout",e=>e.def.out._zod.optout),ee(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.in,n)):Gn(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.out,n)):Gn(r,t.out,n)}});function Gn(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Jn=se("$ZodReadonly",(e,t)=>{kt.init(e,t),ee(e,"propValues",e=>e.def.innerType._zod.propValues),ee(e,"values",e=>e.def.innerType._zod.values),ee(e,"optin",e=>e.def.innerType?._zod?.optin),ee(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Kn):Kn(r)}});function Kn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Vn=se("$ZodCustom",(e,t)=>{it.init(e,t),kt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Wn(t,n,r,e));Wn(i,n,r,e)}});function Wn(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(K(e))}}class Yn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Hn="~memo",qn=[];function Qn(e){return null!==e&&"object"==typeof e}function Xn(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const er=new WeakMap;function tr(e,t,n){const r=er.get(e);if(void 0!==r)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0;const o=e=>{if(2!==i&&e?._zod){const n=tr(e,t);n>i&&(i=n)}},s=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case"object":{const e=h(a);s(e?(e=>{let n=0;for(const r of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,r);if(!i.enumerable)continue;const o=i.get?1:i.value?._zod?tr(i.value,t):0;o>n&&(n=o)}return n})(e):1),o(a.catchall);break}case"array":o(a.element);break;case"tuple":for(const e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(const e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":{const e=a._cachedInner??void 0;s(e?tr(e,t):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const e in a){const t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;const n=t.value;if(n&&"object"==typeof n)if(n._zod)o(n);else if(Array.isArray(n))for(const e of n)o(e)}}return t.delete(e),function(e,t){1!==t&&er.set(e,2===t);return t}(e,i)}let nr;const rr=[],ir={alloc(e,t,n){const r=nr;if(!r)return n;nr=void 0;const i={value:n,issues:null};return r.set(t.value,i),rr.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,n=(e,n)=>{if("backward"!==n.direction&&function(e,t){const n=e[Hn]?.backEdges;return void 0!==n&&Qn(t)&&n.has(t)}(n,e.value))throw new Yn;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,s=(a,u)=>{if(void 0===n){const r=tr(e,new Set);if(0===r)return e._zod.parse=t,e._zod.run===s&&(e._zod.run=t),t(a,u);2===r||o?n=!0:o=!0}const c=a.value;if(!Qn(c))return t(a,u);let l,d=u[Hn];d||(d={buckets:new WeakMap,backEdges:void 0},u[Hn]=d),r===u?l=i:(l=function(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}(d,e),r=u,i=l);const f=l.get(c);if(f)return a.value=f.value,f.issues?f.issues.length&&a.issues.push(...Xn(f.issues)):(a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),a;nr=l;const p=rr.length,h=t(a,u);nr=void 0;const m=rr.length>p?rr.pop():void 0;return h instanceof Promise?h.then(e=>(m&&(m.issues=e.issues.length?Xn(e.issues):qn),e)):(m&&(m.issues=h.issues.length?Xn(h.issues):qn),h)};e._zod.parse=s,e._zod.run===t&&(e._zod.run=s)})}};const or=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?r[e]??e:String(t)}return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${i(e.expected)}, received ${i(function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input),e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${A(e.values[0])}`:`Invalid option: expected one of ${u(e.values,"|")}`;case"too_big":{const n=e.exact?"exactly ":e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.exact?"exactly ":e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${u(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":if(e.options&&Array.isArray(e.options)&&e.options.length>0){return`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(" | ")}`}return!1===e.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}}};var sr;class ar{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(sr=globalThis).__zod_globalRegistry??(sr.__zod_globalRegistry=new ar);const ur=globalThis.__zod_globalRegistry;function cr(e){return e.checks&&(e.checks=[...e.checks]),e}function lr(e,t){return new at({check:"less_than",...E(t),value:e,inclusive:!1})}function dr(e,t){return new at({check:"less_than",...E(t),value:e,inclusive:!0})}function fr(e,t){return new ut({check:"greater_than",...E(t),value:e,inclusive:!1})}function pr(e,t){return new ut({check:"greater_than",...E(t),value:e,inclusive:!0})}function hr(e,t){return new ct({check:"multiple_of",...E(t),value:e})}function mr(e,t){return new dt({check:"max_length",...E(t),maximum:e})}function gr(e,t){return new ft({check:"min_length",...E(t),minimum:e})}function yr(e,t){return new pt({check:"length_equals",...E(t),length:e})}function vr(e){return new wt({check:"overwrite",tx:e})}function br(e,t){const n=function(e,t){const n=new it({check:"custom",...E(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(K(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(K(r))}},e(t.value,t)),t);return n}function _r(e,...t){for(const n of t)for(const t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&p(e,t,n[t]);return e}function wr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ur,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function zr(e,t,n,r,i){const o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw new Error(i);return Object.assign(n,o),!0}function Sr(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),Sr(o,t,r),t.seen.get(o).isParent=!0)}const u=t.metadataRegistry.get(e);u&&_r(s.schema,u),"input"===t.io&&Pr(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function kr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Or(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${kr(o)}`}}const i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};const o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+kr(o)}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;o?i(n):(r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $r(e){const t=e.anyOf;if(!Array.isArray(t)||0===t.length||void 0!==e.type)return;const n=[];for(const e of t){if(!e||"object"!=typeof e)return;$r(e);const t=Object.keys(e);if(1!==t.length||"type"!==t[0])return;const r=e.type;for(const e of Array.isArray(r)?r:[r]){if("string"!=typeof e)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=1===n.length?n[0]:n}const Ir=new Set(["type","properties","required","additionalProperties"]),Tr=["oneOf","anyOf"];function Er(e){const t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function Ar(e){const t=[];for(const n of e){if("object"!=typeof n||"object"!==n.type)return null;for(const e in n)if(!Ir.has(e))return null;t.push(n)}const n={},r=new Set;for(const e of t){for(const r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;const e=[];for(const n of t){const t=n.properties?.[r]??Er(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}p(n,r,1===e.length?e[0]:Ar(e)??{allOf:e})}for(const t of e.required??[])r.add(t)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{const e=[];for(const n of t){const t=Er(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Cr(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const t of Ir)if(t in e)return;const n=t.filter(e=>Tr.some(t=>Array.isArray(e[t])));let r=null;if(n.length){const e=n[0],i=Tr.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;const o=t.filter(t=>t!==e),s=e[i].map(e=>Ar([...o,e]));if(s.some(e=>!e))return;r={[i]:s}}else r=Ar(t);r&&(delete e.allOf,_r(e,r))}function Nr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?_r(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),_r(i,o);if(t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(const t of e.seen.entries())$r(t[1].def??t[1].schema);for(const t of e.deferred)t();if(e.intersections.length){const t=new Map;for(const n of e.seen.values())for(const e of[n.schema,n.def]){const n=e?.allOf;if(!Array.isArray(n))continue;const r=t.get(n);r?r.push(e):t.set(n,[e])}for(const n of e.intersections)for(const e of t.get(n)??[])Cr(e)}}const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}_r(i,n.defId?n.schema:n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,p(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:xr(t,"input",e.processors),output:xr(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Pr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Pr(r.element,n);if("set"===r.type)return Pr(r.valueType,n);if("lazy"===r.type)return Pr(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type||"catch"===r.type)return Pr(r.innerType,n);if("intersection"===r.type)return Pr(r.left,n)||Pr(r.right,n);if("record"===r.type||"map"===r.type)return Pr(r.keyType,n)||Pr(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(Pr(r.in,n)||Pr(r.out,n));if("object"===r.type){for(const e in r.shape)if(Pr(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Pr(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Pr(e,n))return!0;return!(!r.rest||!Pr(r.rest,n))}return!1}const xr=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=wr({...i??{},target:o,io:t,processors:n});return Sr(e,s),Or(s,e),Nr(s,e)},Zr=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},Mr=(e,t,n)=>{(void 0===e[t]||n<e[t])&&(e[t]=n)},jr=(e,t)=>{Zr(e,"minimum",t),Mr(e,"maximum",t)},Rr=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Ur=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Dr=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Fr=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Lr=(e,t)=>Zr(e,"minimum",t.minimum),Br=(e,t)=>Mr(e,"maximum",t.maximum),Gr=e=>(t,n)=>{Fr(t,n.format);const[r,i]=e[n.format];Zr(t,"minimum",r),Mr(t,"maximum",i)},Jr={greater_than:(e,t)=>Zr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Mr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rr(e,t.value),number_format:Gr(C),bigint_format:Gr(N),min_length:Lr,max_length:Br,length_equals:(e,t)=>jr(e,t.length),min_size:Lr,max_size:Br,size_equals:(e,t)=>jr(e,t.size),string_format:(e,t)=>{Fr(e,t.format),t.pattern&&Ur(e,t.pattern),"base64"!==t.format&&"base64url"!==t.format||(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>Dr(e,t.mime)};function Kr(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const e of r)Jr[e._zod.def.check]?.(t,e._zod.def);const i=e._zod.bag;void 0!==i.minimum&&Zr(t,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&Zr(t,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&Mr(t,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&Mr(t,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&Rr(t,i.multipleOf),void 0!==i.format&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Dr(t,i.mime);for(const e of i.patterns??[])Ur(t,e);return t}const Vr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wr=new Map([[tn,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rn,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),Yr=e=>Wr.get(e)??e;function Hr(e){const t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?Hr(t.out):"catch"===t.type?Hr(t.innerType):e._zod.optin}const qr=Symbol();function Qr(e,t,n,r,i){let o=!1;const s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(zr(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),qr):JSON.parse(s)}const Xr=(e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r);t.seen.get(e).ref=i.innerType},ei=new WeakSet([Object.prototype,Error.prototype]);function ti(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const ni=(e,t)=>{he.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);ei.has(n)||(ei.add(n),ti(n,"format",e=>t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i],s=i===e.length-1;if("_errors"===n){s&&r._errors.push(t(o)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const a=r[n];s&&a._errors.push(t(o)),r=a,i++}}}};return r(e),n}(e,t)),ti(n,"flatten",e=>t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?me(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)),ti(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),ti(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},ri=se("ZodError",ni,void 0,{Parent:Error}),ii=ye(ri),oi=ve(ri),si=be(ri),ai=we(ri),ui=Oe(ri),ci=$e(ri),li=Ie(ri),di=Te(ri),fi=Ee(ri),pi=Ae(ri),hi=Ce(ri),mi=Ne(ri);function gi(){ce.localeError||le({localeError:or()})}function yi(){ce.memoizer||le({memoizer:ir})}const vi=se("ZodType",(e,t)=>(gi(),kt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(b(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return T(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...E(n)})}(Co,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return br(e,t)}(e,t))},overwrite(e){return this.check(vr(e))},optional(){return _o(this)},exactOptional(){return new wo({type:"optional",innerType:this})},nullable(){return So(this)},nullish(){return _o(So(this))},nonoptional(e){return function(e,t){return new $o({type:"nonoptional",innerType:e,...E(t)})}(this,e)},array(){return oo(this)},or(e){return co([this,e])},and(e){return new po({type:"intersection",left:this,right:e})},transform(e){return Eo(this,new vo({type:"transform",transform:e}))},default(e){return t=e,new ko({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():O(t)}});var t},prefault(e){return t=e,new Oo({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():O(t)}});var t},catch(e){return new Io({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:ne(t)});var t},pipe(e){return Eo(this,e)},readonly(){return new Ao({type:"readonly",innerType:this})},describe(e){const t=this.clone();return ur.add(t,{description:e}),t},meta(...e){if(0===e.length)return ur.get(this);const t=this.clone();return ur.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return W(this,"~standard",{...$t(this),jsonSchema:{input:xr(this,"input"),output:xr(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return ii(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await oi(this,t,n,{callee:e})},safeParse(e,t){return si(this,e,t)},async safeParseAsync(e,t){return ai(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ke(this,e,t)},validateAsync(e,t){return(async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,n){return ui(this,t,n,{callee:e})},decode:function e(t,n){return ci(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await li(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await di(this,t,n,{callee:e})},safeEncode(e,t){return fi(this,e,t)},safeDecode(e,t){return pi(this,e,t)},async safeEncodeAsync(e,t){return hi(this,e,t)},async safeDecodeAsync(e,t){return mi(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{const r=wr({...n,processors:t});return Sr(e,r),Or(r,e),Nr(r,e)})(this,{})(e)},get description(){return ur.get(this)?.description},get _def(){return this._zod.def}}),bi=se("_ZodString",(e,t)=>{It.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:u,laxFormat:c}=Kr(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Vr[s]??s,""===r.format&&delete r.format,("time"===s||c)&&delete r.format),u&&(r.contentEncoding=u),a&&a.size>0){const e=[...a].map(Yr);1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},Y({format:e=>Kr(e).format??null,minLength:e=>Kr(e).minimum??null,maxLength:e=>Kr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new mt({check:"string_format",format:"regex",...E(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new vt({check:"string_format",format:"includes",...E(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new bt({check:"string_format",format:"starts_with",...E(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new _t({check:"string_format",format:"ends_with",...E(t),suffix:e})}(...e))},min(...e){return this.check(gr(...e))},max(...e){return this.check(mr(...e))},length(...e){return this.check(yr(...e))},nonempty(...e){return this.check(gr(1,...e))},lowercase(e){return this.check(function(e){return new gt({check:"string_format",format:"lowercase",...E(e)})}(e))},uppercase(e){return this.check(function(e){return new yt({check:"string_format",format:"uppercase",...E(e)})}(e))},trim(){return this.check(vr(e=>e.trim()))},normalize(...e){return this.check(function(e){return vr(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(vr(e=>e.toLowerCase()))},toUpperCase(){return this.check(vr(e=>e.toUpperCase()))},slugify(){return this.check(vr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})),_i=se("ZodString",(e,t)=>{It.init(e,t),bi.init(e,t)},{email(e){return this.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}(Ii,e))},url(e){return this.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}(Ai,e))},jwt(e){return this.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}(Ji,e))},emoji(e){return this.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}(Ci,e))},guid(e){return this.check(function(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}(Ti,e))},uuid(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}(Ei,e))},uuidv4(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}(Ei,e))},uuidv6(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}(Ei,e))},uuidv7(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}(Ei,e))},nanoid(e){return this.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}(Ni,e))},cuid(e){return this.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}(Pi,e))},cuid2(e){return this.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}(xi,e))},ulid(e){return this.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}(Zi,e))},base64(e){return this.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}(Li,e))},base64url(e){return this.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}(Bi,e))},xid(e){return this.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}(Mi,e))},ksuid(e){return this.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}(ji,e))},ipv4(e){return this.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}(Ri,e))},ipv6(e){return this.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}(Ui,e))},cidrv4(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}(Di,e))},cidrv6(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}(Fi,e))},e164(e){return this.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}(Gi,e))},datetime(e){return this.check(function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}(Si,e))},date(e){return this.check(function(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}(ki,e))},time(e){return this.check(function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}(Oi,e))},duration(e){return this.check(function(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}($i,e))}});function wi(e){return function(e,t){return new e(cr({type:"string",...E(t)}))}(_i,e)}const zi=se("ZodStringFormat",(e,t)=>{Tt.init(e,t),bi.init(e,t)}),Si=se("ZodISODateTime",(e,t)=>{Gt.init(e,t),zi.init(e,t)}),ki=se("ZodISODate",(e,t)=>{Jt.init(e,t),zi.init(e,t)}),Oi=se("ZodISOTime",(e,t)=>{Kt.init(e,t),zi.init(e,t)}),$i=se("ZodISODuration",(e,t)=>{Vt.init(e,t),zi.init(e,t)}),Ii=se("ZodEmail",(e,t)=>{Ct.init(e,t),zi.init(e,t)}),Ti=se("ZodGUID",(e,t)=>{Et.init(e,t),zi.init(e,t)}),Ei=se("ZodUUID",(e,t)=>{At.init(e,t),zi.init(e,t)}),Ai=se("ZodURL",(e,t)=>{Mt.init(e,t),zi.init(e,t)}),Ci=se("ZodEmoji",(e,t)=>{jt.init(e,t),zi.init(e,t)}),Ni=se("ZodNanoID",(e,t)=>{Rt.init(e,t),zi.init(e,t)}),Pi=se("ZodCUID",(e,t)=>{Ut.init(e,t),zi.init(e,t)}),xi=se("ZodCUID2",(e,t)=>{Dt.init(e,t),zi.init(e,t)}),Zi=se("ZodULID",(e,t)=>{Ft.init(e,t),zi.init(e,t)}),Mi=se("ZodXID",(e,t)=>{Lt.init(e,t),zi.init(e,t)}),ji=se("ZodKSUID",(e,t)=>{Bt.init(e,t),zi.init(e,t)}),Ri=se("ZodIPv4",(e,t)=>{Wt.init(e,t),zi.init(e,t)}),Ui=se("ZodIPv6",(e,t)=>{qt.init(e,t),zi.init(e,t)}),Di=se("ZodCIDRv4",(e,t)=>{Qt.init(e,t),zi.init(e,t)}),Fi=se("ZodCIDRv6",(e,t)=>{Xt.init(e,t),zi.init(e,t)}),Li=se("ZodBase64",(e,t)=>{nn.init(e,t),zi.init(e,t)}),Bi=se("ZodBase64URL",(e,t)=>{on.init(e,t),zi.init(e,t)}),Gi=se("ZodE164",(e,t)=>{sn.init(e,t),zi.init(e,t)}),Ji=se("ZodJWT",(e,t)=>{an.init(e,t),zi.init(e,t)}),Ki=se("ZodNumber",(e,t)=>{un.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=Kr(e);i.type=l?"integer":"number";const d="number"==typeof c&&c>=(o??Number.NEGATIVE_INFINITY),f="number"==typeof u&&u<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;if(d?p?(i.minimum=c,i.exclusiveMinimum=!0):i.exclusiveMinimum=c:"number"==typeof o&&(i.minimum=o),f?p?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:"number"==typeof s&&(i.maximum=s),a){const n=new Set;for(const o of a)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):zr(e,t,i,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);const[o,...s]=n;void 0!==o&&(i.multipleOf=o),s.length&&(i.allOf=[...i.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},Y({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=Kr(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=Kr(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=Kr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Kr(e).format??null},{gt(e,t){return this.check(fr(e,t))},gte(e,t){return this.check(pr(e,t))},min(e,t){return this.check(pr(e,t))},lt(e,t){return this.check(lr(e,t))},lte(e,t){return this.check(dr(e,t))},max(e,t){return this.check(dr(e,t))},int(e){return this.check(Yi(e))},safe(e){return this.check(Yi(e))},positive(e){return this.check(fr(0,e))},nonnegative(e){return this.check(pr(0,e))},negative(e){return this.check(lr(0,e))},nonpositive(e){return this.check(dr(0,e))},multipleOf(e,t){return this.check(hr(e,t))},step(e,t){return this.check(hr(e,t))},finite(){return this}}));function Vi(e){return function(e,t){return new e(cr({type:"number",checks:[],...E(t)}))}(Ki,e)}const Wi=se("ZodNumberFormat",(e,t)=>{cn.init(e,t),Ki.init(e,t)});function Yi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}(Wi,e)}const Hi=se("ZodBoolean",(e,t)=>{ln.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function qi(e){return function(e,t){return new e({type:"boolean",...E(t)})}(Hi,e)}const Qi=se("ZodAny",(e,t)=>{dn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Xi(){return new Qi({type:"any"})}const eo=se("ZodUnknown",(e,t)=>{fn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function to(){return new eo({type:"unknown"})}const no=se("ZodNever",(e,t)=>{pn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function ro(e){return function(e,t){return new e({type:"never",...E(t)})}(no,e)}const io=se("ZodArray",(e,t)=>{yi(),gn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=Kr(e);"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=Sr(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(gr(e,t))},nonempty(e){return this.check(gr(1,e))},max(e,t){return this.check(mr(e,t))},length(e,t){return this.check(yr(e,t))},unwrap(){return this.element}});function oo(e,t){return function(e,t,n){return new e({type:"array",element:t,...E(n)})}(io,e,t)}const so=se("ZodObject",(e,t)=>{yi(),zn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&zr(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const e in s)p(i.properties,e,Sr(s[e],t,{...r,path:[...r.path,"properties",e]}));const a=[];for(const e of Object.keys(s)){const n=o.shape[e];("input"===t.io?void 0===Hr(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(i.required=a),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Sr(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),te(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return mo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(b(this._zod.def,{catchall:e}))},passthrough(){return this.clone(b(this._zod.def,{catchall:to()}))},loose(){return this.clone(b(this._zod.def,{catchall:to()}))},strict(){return this.clone(b(this._zod.def,{catchall:ro()}))},strip(){return this.clone(b(this._zod.def,{catchall:void 0}))},extend(e){return function(e,t){if(!k(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=m(e);for(const e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return T(e,b(e._zod.def,{shape:x(e,t)}))}(this,e)},safeExtend(e){return function(e,t){if(!k(t))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,b(e._zod.def,{shape:x(e,t)}))}(this,e)},merge(e){return function(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};return v(n,e,Reflect.ownKeys(m(e))),v(n,t,Reflect.ownKeys(m(t))),T(e,b(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return v(i,e,P(e,t)),T(e,b(n,{shape:i,checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(P(e,t)),o={};return v(o,e,Reflect.ownKeys(m(e)).filter(e=>!i.has(e))),T(e,b(n,{shape:o,checks:[]}))}(this,e)},partial(...e){return Z(bo,this,e[0])},exactPartial(...e){return Z(wo,this,e[0],"exactPartial")},required(...e){return function(e,t,n){const r=n?new Set(P(t,n)):void 0,i={};return v(i,t,Reflect.ownKeys(m(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),T(t,b(t._zod.def,{shape:i}))}($o,this,e[0])}});function ao(e,t){const n={type:"object",shape:e??{},...E(t)};return new so(n)}const uo=se("ZodUnion",(e,t)=>{kn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>Sr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function co(e,t){return new uo({type:"union",options:e,...E(t)})}const lo=se("ZodDiscriminatedUnion",(e,t)=>{uo.init(e,t),On.init(e,t)});function fo(e,t,n){return new lo({type:"union",options:t,discriminator:e,...E(n)})}const po=se("ZodIntersection",(e,t)=>{$n.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Sr(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=Sr(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u,t.intersections.push(u)})(e,t,n,r)});const ho=se("ZodEnum",(e,t)=>{En.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=a(e._zod.def.entries);0!==r.length?(r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r):n.not={}})(e,0,n),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new ho({...t,checks:[],...E(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new ho({...t,checks:[],...E(r),entries:i})}});function mo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ho({type:"enum",entries:n,...E(t)})}const go=se("ZodLiteral",(e,t)=>{An.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(0===i.values.length)return void(n.not={});const o=[];for(const s of i.values)if(void 0===s){if(zr(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(zr(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function yo(e,t){return new go({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}const vo=se("ZodTransform",(e,t)=>{yi(),Cn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{zr(e,t,n,r,"Transforms cannot be represented in JSON Schema")})(e,t,n,r),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new ue(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(K(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=n.value),t.inst??(t.inst=e),n.issues.push(K(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});const bo=se("ZodOptional",(e,t)=>{Pn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new bo({type:"optional",innerType:e})}const wo=se("ZodExactOptional",(e,t)=>{xn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const zo=se("ZodNullable",(e,t)=>{Zn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Sr(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e){return new zo({type:"nullable",innerType:e})}const ko=se("ZodDefault",(e,t)=>{Mn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;const o=Qr(i.defaultValue,e,t,n,r);o!==qr&&(n.default=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Oo=se("ZodPrefault",(e,t)=>{Rn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;const o=Qr(i.defaultValue,e,t,n,r);o!==qr&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const $o=se("ZodNonOptional",(e,t)=>{Un.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const Io=se("ZodCatch",(e,t)=>{Ln.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{return void zr(e,t,n,r,"Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const To=se("ZodPipe",(e,t)=>{Bn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;Sr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Eo(e,t){return new To({type:"pipe",in:e,out:t})}const Ao=se("ZodReadonly",(e,t)=>{Jn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Co=se("ZodCustom",(e,t)=>{Vn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{zr(e,t,n,r,"Custom types cannot be represented in JSON Schema")})(e,t,n,r)});const No=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],Po=mo(No),xo=mo(["Include","Exclude"]),Zo=ao({targetedCountryGroups:oo(Po),targetedCountryCodes:oo(wi()).optional(),contributionsOnlyCountriesTargeting:xo.optional()}).optional(),Mo={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"}},jo={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"},Ro={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},Uo={GBP:"£",USD:"$",AUD:"$",EUR:"€",NZD:"NZ$",CAD:"CA$"},Do=e=>Object.keys(Mo).find(t=>Mo[t].countries.includes(e??""))??"International",Fo=(e,t=[],n=[])=>0===t.length&&0===n.length||!!e&&(!!t.includes(Do(e.toUpperCase()))||n.includes(e.toUpperCase())),Lo=(e,t,n)=>{const r=e?.contributionsOnlyCountriesTargeting??"Exclude";if(!t)return!0;const i=n.includes(t);return"Include"===r?i:!i},Bo=e=>{if(e){const t=Do(e);return Ro[t]}return"£"},Go=e=>{if(e)return jo[e]},Jo=e=>e.includes("subscribe/weekly/checkout"),Ko=(e,t)=>{if(t){const n=(e=>Mo[Do(e)].supportRegionId)(t);if(!Jo(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,(e,t,r)=>`${t}/${n.toLowerCase()}/${r}`)}return e},Vo=(e,t,n,r)=>{if(r){const i=r[Do(n)];return`${Bo(n)}${i[e][t].price}`}},Wo={CURRENCY_SYMBOL:({countryCode:e})=>Bo(e),COUNTRY_NAME:({countryCode:e})=>Go(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>Vo("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>Vo("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>Vo("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>Vo("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"}))()},Yo=(e,t,n)=>e?e.replace(Ho,e=>{const r=e.substring(2,e.length-2),i=Wo[r];if(i){const e=i({countryCode:t,prices:n});if(e)return e}return e}):"",Ho=/%%.*?%%/g,qo=e=>{const t=e.match(Ho)?.filter(e=>"%%ARTICLE_COUNT%%"!==e);return!!t&&t.length>0},Qo="gu.contributions.views",Xo=e=>e.get(Qo)??void 0,es=e=>{const t=JSON.parse(localStorage.getItem(Qo)??""),n=t?t.value:[];n.push({date:(new Date).getTime(),testId:e});const r={value:n.slice(-50)};localStorage.setItem(Qo,JSON.stringify(r))},ts=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},ns=(e=new Date)=>{const t=(e=>{const t=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+t),e})(e),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.toLocaleString("default",{month:"long"}),i=t.getFullYear();return{reminderCta:`Remind me in ${r}`,reminderPeriod:`${i}-${n}-01`,reminderLabel:`${r} ${i}`}},rs=new Date("2023-12-31"),is=e=>e>=(e=>new Date(e.getFullYear(),10,15))(e)&&e<ts(e.getFullYear()),os=(e,t=new Date)=>{return"US"===e&&is(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${n=t.getFullYear()}-${(ts(n).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${n}`}:"US"===e&&(e=>e>=ts(e.getFullYear())&&e<rs)(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()):ns(t);var n},ss=ao({text:wi(),baseUrl:wi()});let as=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});var us;new ho({type:"enum",entries:as,...E(us)});const cs=fo("type",[ao({type:yo(as.Custom),cta:ss}),ao({type:yo(as.ContributionsReminder)})]),ls=ao({countLabel:wi(),goalCopy:wi().optional()}),ds=ao({total:Vi(),goal:Vi()}),fs=mo(["US","AU","global"]),ps=ao({currencySymbol:wi(),copy:ls,name:fs,tickerData:ds.optional()}),hs=ao({for52Weeks:Vi(),forTargetedWeeks:Vi()}),ms=mo(["for52Weeks","forTargetedWeeks"]),gs=ao({type:yo("above"),copy:wi().optional(),countType:ms.optional()}),ys=mo(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),vs=mo(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),bs=ao({abTestName:wi(),abTestVariant:wi(),campaignCode:wi(),componentType:vs,products:oo(ys).nullish(),labels:oo(wi()).nullish(),ophanPageId:wi(),platformId:wi(),referrerUrl:wi()}),_s=ao({mainUrl:wi(),mobileUrl:wi().optional(),tabletUrl:wi().optional(),desktopUrl:wi().optional(),leftColUrl:wi().optional(),wideUrl:wi().optional(),altText:wi()}),ws=ao({name:wi(),description:wi().optional(),headshot:_s.optional()}),zs=/^[0-9A-F]{2}$/,Ss=wi().refine(e=>zs.test(e),{error:e=>`"${JSON.stringify(e.input)}" is not a valid hex value`}),ks=ao({r:Ss,g:Ss,b:Ss,kind:yo("hex")}),Os=ao({mobileUrl:wi(),tabletUrl:wi(),desktopUrl:wi(),altText:wi(),kind:yo("Image")}),$s=ao({buttonColour:ks.nullish(),buttonTextColour:ks.nullish(),buttonBorderColour:ks.nullish(),buttonSelectColour:ks.nullish(),buttonSelectTextColour:ks.nullish(),buttonSelectBorderColour:ks.nullish(),buttonSelectMarkerColour:ks.nullish(),pillTextColour:ks.nullish(),pillBackgroundColour:ks.nullish(),kind:yo("ChoiceCards")}),Is=ao({visual:fo("kind",[Os,$s]).nullish(),headerImage:ao({mobileUrl:wi(),tabletUrl:wi(),desktopUrl:wi(),altText:wi()}).nullish(),colours:ao({basic:ao({background:ks,bodyText:ks})})}),Ts=e=>`#${e.r}${e.g}${e.b}`,Es=ao({heading:wi(),subheading:wi(),primaryCta:ss.optional(),secondaryCta:ss.optional(),benefits:oo(wi()).optional()}),As=ao({content:Es,tracking:bs,mobileContent:Es.optional(),countryCode:wi().optional(),submitComponentEvent:Xi(),promoCodes:oo(wi()).nullish()}),Cs=ao({copy:wi()}),Ns=co([yo("Monthly"),yo("Annual")]),Ps=fo("supportTier",[ao({supportTier:yo("Contribution"),ratePlan:Ns}),ao({supportTier:yo("SupporterPlus"),ratePlan:Ns}),ao({supportTier:yo("DigitalSubscription"),ratePlan:Ns}),ao({supportTier:yo("OneOff")})]),xs=ao({copy:wi(),textColour:ks.nullish(),backgroundColour:ks.nullish()}),Zs=co([yo("LandingPage"),yo("Checkout")]),Ms=ao({testName:wi(),variantName:wi()}),js=ao({product:Ps,label:wi(),isDefault:qi(),defaultExpanded:qi().optional(),benefitsLabel:wi().nullish(),benefits:oo(Cs),pill:xs.nullish(),destination:Zs.nullish(),destinationTest:Ms.nullish()}),Rs=ao({choiceCards:oo(js),mobileChoiceCards:oo(js).nullish()}),Us=ao({maxViewsCount:Vi(),maxViewsDays:Vi(),minDaysBetweenViews:Vi()}),Ds=ao({reminderCta:wi(),reminderLabel:wi(),reminderPeriod:wi()});mo(["ONE_OFF","MONTHLY","ANNUAL"]);const Fs=ao({newsletterId:wi(),successDescription:wi()}),Ls=ao({name:wi(),heading:wi().optional(),paragraphs:oo(wi()),highlightedText:wi().optional(),tickerSettings:ps.optional(),cta:ss.optional(),secondaryCta:cs.optional(),newsletterSignup:Fs.optional(),image:_s.optional(),showReminderFields:Ds.optional(),separateArticleCount:gs.optional(),promoCodes:oo(wi()).nullish(),maxViews:Us.optional(),showSignInLink:qi().optional(),bylineWithImage:ws.optional(),showChoiceCards:qi().optional(),choiceCardsSettings:Rs.nullish()}),Bs=ao({variant:Ls,tracking:bs,countryCode:wi().nullish(),articleCounts:hs,onReminderOpen:Xi().nullish(),fetchEmail:Xi().nullish(),submitComponentEvent:Xi().nullish(),openCmp:Xi().nullish(),hasConsentForArticleCount:qi().nullish(),stage:wi().nullish()}),Gs=mo(["contributions","subscriptions","signIn","abandonedBasket"]),Js=ao({heading:wi().optional(),messageText:wi().optional(),paragraphs:oo(wi()).optional(),mobileMessageText:wi().optional(),highlightedText:wi().optional(),cta:ss.optional(),secondaryCta:cs.optional()}),Ks=ao({tracking:bs,bannerChannel:Gs,content:Js.nullish(),mobileContent:Js.nullish(),countryCode:wi().nullish(),tickerSettings:ps.nullish(),submitComponentEvent:Xi(),articleCounts:hs,hasOptedOutOfArticleCount:qi().nullish(),fetchEmail:Xi().nullish(),separateArticleCount:qi().nullish(),design:Is.nullish(),choiceCardsSettings:Rs.nullish(),promoCodes:oo(wi()).nullish(),isCollapsible:qi().nullish(),promotedNewsletter:ao({listId:Vi(),identityName:wi(),name:wi(),frequency:wi()}).nullish(),contributionsServiceUrl:wi().nullish()}),Vs=ao({amount:co([Vi(),yo("other")]),billingPeriod:co([yo("ONE_OFF"),yo("MONTHLY"),yo("ANNUAL")]),product:co([yo("Contribution"),yo("SupporterPlus"),yo("PremiumTier"),yo("DailyEdition"),yo("GuardianWeekly"),yo("Paper"),yo("PaperAndDigital")]),region:co([yo("uk"),yo("us"),yo("au"),yo("eu"),yo("int"),yo("nz"),yo("ca")])}),Ws=(e,t,n,r)=>{const i=(e=>new URLSearchParams(window.location.search).get(`force-${e}`))(e),o=(e=>new URLSearchParams(window.location.search).get(`preview-${e}`))(e),s=new URLSearchParams;i?s.set("force",i):o&&s.set("preview",o);const a=s.toString();return fetch(a?`${t}/${e}?${a}`:`${t}/${e}`,{method:"post",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(n)}).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())},Ys=(e,t,n)=>Ws("epic",e,t,n),Hs=(e,t)=>Ws("liveblog-epic",e,t),qs=(e,t)=>Ws("banner",e,t),Qs=(e,t)=>Ws("gutter-liveblog",e,t),Xs=(e,t)=>Ws("header",e,t);export{No as CountryGroupId,as as SecondaryCtaType,Vs as abandonedBasketSchema,Ko as addRegionIdToSupportUrl,Ks as bannerSchema,ns as buildReminderFields,qo as containsNonArticleCountPlaceholder,xo as contributionsOnlyCountriesTargetingSchema,Do as countryCodeToCountryGroupId,Po as countryGroupIdSchema,Mo as countryGroups,Bs as epicPropsSchema,qs as getBanner,Go as getCountryName,Ys as getEpic,Xo as getEpicViewLog,Qs as getGutterLiveblog,Xs as getHeader,Hs as getLiveblogEpic,Bo as getLocalCurrencySymbol,os as getReminderFields,r as getWeeklyArticleHistory,As as headerPropsSchema,Ts as hexColourToString,Fo as inTargetedCountry,s as incrementWeeklyArticleCount,Jo as isGWCheckoutUrl,Uo as isoCurrencyToCurrencySymbol,es as logEpicView,Lo as passesContributionsOnlyTargeting,Yo as replaceNonArticleCountPlaceholders,Zo as targetedRegionsSchema};
1
+ const e="gu.history.weeklyArticleCount",t="gu.history.articleCountsThisWeek",n=e=>{const t=e.getDay()||7;return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-(t-1))/864e5},r=t=>t.get(e)??void 0,i=new Set(["environment/climate-change","environment/climate-crisis","environment/environment","science/science","politics/politics","us-news/us-politics","australia-news/australian-politics","world/world","world/europe-news","world/russia","books/books","culture/culture","world/coronavirus-outbreak","world/race","inequality/inequality","technology/technology","business/business","tone/recipes","sport/sport","football/football","sport/olympic-games","sport/olympic-games-2024","tracking/commissioningdesk/uk-investigations"]),o=(e,t={})=>(e.forEach(e=>{i.has(e)&&(t[e]=(t[e]??0)+1)}),t),s=(r,i,s)=>{const a=((e,r)=>{const i=n(new Date),o=e.get(t);if(o?.week===i){const n=o.articles[r]||0;return e.set(t,{week:i,articles:{...o.articles,[r]:n+1}}),n>0}return e.set(t,{week:i,articles:{[r]:1}}),!1})(r,i);if(!a){const t=n(new Date),i=r.get(e)??[],a=i.length>0?i[0]:null;if(a?.week&&a.week===t)a.count+=1,a.tags=o(s,a.tags),r.set(e,i);else{i.unshift({week:t,count:1,tags:o(s,{})});const n=t-365,a=i.filter(e=>e.week>=n);r.set(e,a)}}};function a(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function u(e,t="|"){return e.map(e=>A(e)).join(t)}function c(e,t){return"bigint"==typeof t?t.toString():t}class l{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return void 0!==e&&(this._value=e(),this._getter=void 0),this._value}}function d(e){return new l(e)}function f(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function h(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function m(e){return h(e._zod.def)??e._zod.def.shape}function g(e,t,n){Object.defineProperty(e,t,{get(){const e=n();return p(this,t,e),e},enumerable:!0,configurable:!0})}function y(e,t,n){t in e?p(e,t,n):e[t]=n}function v(e,t,n,r){const i=m(t);for(const o of n){const n=Object.getOwnPropertyDescriptor(i,o);n.enumerable&&(n.get?g(e,o,()=>{const e=t._zod.def.shape[o];return r?r(e,o):e}):y(e,o,r?r(n.value,o):n.value))}}function b(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _(e){return JSON.stringify(e)}const w="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function z(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const S=d(()=>{if(ce.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function k(e){if(!1===z(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==z(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function O(e){return k(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const $=new Set(["string","number","symbol"]);function I(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function E(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function A(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const C=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),N={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function P(e,t){const n=m(e),r=[];for(const e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw new Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function x(e,t){const n={};return v(n,e,Reflect.ownKeys(m(e))),function(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?g(e,n,()=>t[n]):y(e,n,r.value))}}(n,t),n}function Z(e,t,n,r="partial"){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const o=n?new Set(P(t,n)):void 0,s={};return v(s,t,Reflect.ownKeys(m(t)),e&&((t,n)=>o&&!o.has(n)?t:new e({type:"optional",innerType:t}))),T(t,b(t._zod.def,{shape:s,checks:[]}))}function M(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function j(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function R(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function U(e){return"string"==typeof e?e:e?.message}function D(e){const t=[];for(const n of e??[]){const e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;const r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function F(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function L(e,t,n){var r;const i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);const o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:U(e.inst?._zod.def?.error?.(e))??U(o?.(e))??U(t?.error?.(e))??U(n.customError?.(e))??U(n.localeError?.(e))??"Invalid input",a={};for(const t of Object.keys(e))"inst"!==t&&"schema"!==t&&"continue"!==t&&"input"!==t&&"__proto__"!==t&&(a[t]=e[t]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}const B=/[\uD800-\uDBFF]/;function G(e){const t=e.length;if(!B.test(e))return t;let n=t;for(let r=0;r<t-1;r++)55296==(64512&e.charCodeAt(r))&&56320==(64512&e.charCodeAt(r+1))&&(n--,r++);return n}function J(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function K(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}function V(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function W(e,t,n){return V(e,t,n,!1)}function Y(e,t){for(const n in e){const r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return V(this,n,r(this))},set(e){V(this,n,e)}})}return t}function H(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return null==this?n:V(this,t,n.bind(this))},set(e){V(this,t,e)}})}let q,Q=!1;const X={configurable:!0,get(){Q=!0}};function ee(e,t,n){const r=Object.getPrototypeOf(e._zod);t in r&&q!==e._zod?q=void 0:(q=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,X);const e=Q;Q=!1;try{const r=n(this);return Q?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Q=Q||e,r}catch(n){throw delete this[t],Q=Q||e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function te(e,t,n,r){const i=function(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){const e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function ne(e){const t=()=>e;return t["~constantCatch"]=!0,t}var re;const ie={value:void 0,enumerable:!1};let oe="captureStackTrace"in Error?Error:null;function se(e,t,n,r){function i(e){this.def=e,this.constr=l,this.traits=new Set}i.prototype={};const o=n,s=o&&new WeakSet;function a(n,r){if(n._zod){if(n._zod.traits.has(e))return}else{ie.value=new i(r);try{Object.defineProperty(n,"_zod",ie)}finally{ie.value=void 0}}if(n._zod.traits.add(e),t(n,r),s){const e=Object.getPrototypeOf(n),t=n._zod.constr.prototype;let r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);const i=r??e;s.has(i)||(s.add(i),function(e,t){for(const n in t){const r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):H(e,n,r.value)}}(i,o))}const a=l.prototype;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&(e in n||(n[e]=a[e].bind(n)))}const u=r?.Parent??Object;class c extends u{}function l(e){const t=r?.Parent?function(e){const t=oe;if(t){const n=t.stackTraceLimit;if("number"==typeof n){try{t.stackTraceLimit=0}catch{return oe=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}(c):this;a(t,e);const n=t._zod.deferred;if(n){for(const e of n)e();t._zod.deferred=void 0}const i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(c,"name",{value:e}),Object.defineProperty(l,"init",{value:a}),Object.defineProperty(l,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ue extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});const ce=globalThis.__zod_globalConfig;function le(e){return e&&Object.assign(ce,e),ce}const de={get:function(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,c,2)),e.message},set:function(e){this._zod.message=e},enumerable:!0,configurable:!0},fe={value:void 0,enumerable:!1},pe=new WeakSet([Object.prototype,Error.prototype]),he=se("$ZodError",(e,t)=>{e.name="$ZodError",fe.value=t,Object.defineProperty(e,"issues",fe),fe.value=void 0,Object.defineProperty(e,"message",de);const n=Object.getPrototypeOf(e);pe.has(n)||(pe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function me(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||("__proto__"===t?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ge(e,t){return{callee:t?.callee??e,Err:t?.Err}}const ye=e=>{const t=(n,r,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ae;if(a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>L(e,s,le())));throw w(n,o?.callee??t),n}return a.value};return t},ve=e=>{const t=async(n,r,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const n=new(o?.Err??e)(a.issues.map(e=>L(e,s,le())));throw w(n,o?.callee??t),n}return a.value};return t},be=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ae;return o.issues.length?_e(e,o.issues,i):{success:!0,data:o.value}};function _e(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>L(e,n,le()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const we=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?_e(e,o.issues,i):{success:!0,data:o.value}},ze=Symbol.for("zod.compile.invalid"),Se=Symbol.for("zod.compile.fallback"),ke=(e,t,n)=>{const r=e._zod.bag.validator;if(void 0!==r){if(r(t)!==ze)return!0;if(!0===r.definite&&void 0===n)return!1}return function(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let o;i?(r[Se]=!0,o=i({value:t,issues:[]},r)):o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new ae;return 0===o.issues.length}(e,t,n)};const Oe=e=>{const t=ye(e),n=(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return t(e,r,s,ge(n,o))};return n},$e=e=>{const t=ye(e),n=(e,r,i,o)=>t(e,r,i,ge(n,o));return n},Ie=e=>{const t=ve(e),n=async(e,r,i,o)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(e,r,s,ge(n,o))};return n},Te=e=>{const t=ve(e),n=async(e,r,i,o)=>await t(e,r,i,ge(n,o));return n},Ee=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return be(e)(t,n,i)},Ae=e=>(t,n,r)=>be(e)(t,n,r),Ce=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return we(e)(t,n,i)},Ne=e=>async(t,n,r)=>we(e)(t,n,r),Pe=/^[cC][0-9a-z]{6,}$/,xe=/^[0-9a-z]+$/,Ze=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Me=/^[0-9a-vA-V]{20}$/,je=/^[A-Za-z0-9]{27}$/,Re=/^[a-zA-Z0-9_-]{21}$/;const Ue=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,De=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Le=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Be=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ge=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Je=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ve=/^https?$/,We=/^\+[1-9]\d{6,14}$/,Ye="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function He(e){return new RegExp(`^${e}$`)}const qe=He(Ye);function Qe(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Xe=/^[\s\S]{0,}$/,et=/^-?\d+(?:\.\d+)?$/,tt=/^(?:true|false)$/i,nt=/^[^A-Z]*$/,rt=/^[^a-z]*$/,it=se("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ot=e=>{const t=e.value;return!(n=t,null==n||void 0===t.length);var n},st={number:"number",bigint:"bigint",object:"date"},at=se("$ZodCheckLessThan",(e,t)=>{it.init(e,t);const n=st[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:st[typeof r.value]??n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ut=se("$ZodCheckGreaterThan",(e,t)=>{it.init(e,t);const n=st[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:st[typeof r.value]??n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ct=se("$ZodCheckMultipleOf",(e,t)=>{it.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):0===function(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lt=se("$ZodCheckNumberFormat",(e,t)=>{it.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=C[t.format];e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),dt=se("$ZodCheckMaxLength",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>t.maximum?G(r):i)<=t.maximum)return;const o=J(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ft=se("$ZodCheckMinLength",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length;if(("string"==typeof r&&i>=t.minimum&&i<2*t.minimum?G(r):i)>=t.minimum)return;const o=J(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pt=se("$ZodCheckLengthEquals",(e,t)=>{var n;it.init(e,t),(n=e._zod.def).when??(n.when=ot),e._zod.check=n=>{const r=n.value,i=r.length,o="string"==typeof r&&i>=t.length&&i<=2*t.length?G(r):i;if(o===t.length)return;const s=J(r),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ht=se("$ZodCheckStringFormat",(e,t)=>{var n,r;it.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mt=se("$ZodCheckRegex",(e,t)=>{ht.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gt=se("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nt),ht.init(e,t)}),yt=se("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rt),ht.init(e,t)}),vt=se("$ZodCheckIncludes",(e,t)=>{it.init(e,t);const n=I(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bt=se("$ZodCheckStartsWith",(e,t)=>{it.init(e,t);const n=new RegExp(`^${I(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),_t=se("$ZodCheckEndsWith",(e,t)=>{it.init(e,t);const n=new RegExp(`.*${I(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),wt=se("$ZodCheckOverwrite",(e,t)=>{it.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class zt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${t.join("\n")}\n};`)(...Object.values(this.closed))}}const St={major:4,minor:6,patch:6},kt=se("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=St;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(t,n,r)=>{if(t.memo)return t;let i,o=M(t);for(const s of n){if(s._zod.def.when){if(j(t))continue;if(!s._zod.def.when(t))continue}else if(o)continue;const n=t.issues.length,a=s._zod.check(t);if(a instanceof Promise&&!1===r?.async)throw new ae;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a;t.issues.length!==n&&(F(t.issues,n,e),o||(o=M(t,n)))});else{if(t.issues.length===n)continue;F(t.issues,n,e),o||(o=M(t,n))}}return i?i.then(()=>t):t},n=(n,r,o)=>{if(M(n))return n.aborted=!0,n;const s=t(r,i,o);if(s instanceof Promise){if(!1===o.async)throw new ae;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if("backward"===o.direction){const t=e._zod.parse({value:r.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}const s=e._zod.parse(r,o);if(s instanceof Promise){if(!1===o.async)throw new ae;return s.then(e=>t(e,i,o))}return t(s,i,o)}}},{get"~standard"(){return W(this,"~standard",$t(this))},set"~standard"(e){V(this,"~standard",e)}}),Ot=(e,t)=>e.issues.length?{issues:e.issues.map(e=>L(e,t,le()))}:{value:e.value};function $t(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ot(r,n)}catch(e){}return async function(e,t){const n={async:!0};return Ot(await e._zod.run({value:t,issues:[]},n),n)}(e,t)},vendor:"zod",version:1}}const It=se("$ZodString",(e,t)=>{kt.init(e,t),e._zod.pattern=t.pattern??Xe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Tt=se("$ZodStringFormat",(e,t)=>{ht.init(e,t),It.init(e,t)}),Et=se("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=De),Tt.init(e,t)}),At=se("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Fe(e))}else t.pattern??(t.pattern=Fe());Tt.init(e,t)}),Ct=se("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Le),Tt.init(e,t)});function Nt(e){try{return"undefined"!=typeof URL&&"function"==typeof URL.canParse?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Pt(e,t){return"normalize"in t||"hostname"in t||"protocol"in t?function(e,t){if(!t.normalize&&t.protocol?.source===Ve.source&&!/^https?:\/\//i.test(e))return 1;try{if("undefined"!=typeof URL){const t=URL;if("function"==typeof t.parse)return t.parse(e)??2}return new URL(e)}catch{return 2}}(e,t):Nt(e)||2}const xt=/[\t\n\r]/g;function Zt(e){return e.replace(xt,"")}const Mt=se("$ZodURL",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=Pt(r,t);return 1===i?void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort}):2===i?void n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort}):!0===i?void(n.value=Zt(r)):(t.hostname&&!function(e,t){return t.lastIndex=0,t.test(e.hostname)}(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!function(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),void(n.value=t.normalize?i.href:Zt(r)))}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),jt=se("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$","u")),Tt.init(e,t)}),Rt=se("$ZodNanoID",(e,t)=>{if(void 0!==t.length&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);var n;t.pattern??(t.pattern=void 0===t.length?Re:(n=t.length,new RegExp(`^[a-zA-Z0-9_-]{${n}}$`))),Tt.init(e,t)}),Ut=se("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pe),Tt.init(e,t)}),Dt=se("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xe),Tt.init(e,t)}),Ft=se("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ze),Tt.init(e,t)}),Lt=se("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Me),Tt.init(e,t)}),Bt=se("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=je),Tt.init(e,t)}),Gt=se("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${Qe({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Qe({precision:e.precision})}`:n;return new RegExp(`^${Ye}T(?:${r})$`)}(t)),Tt.init(e,t)}),Jt=se("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qe),Tt.init(e,t)}),Kt=se("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Qe(t)}$`)),Tt.init(e,t)}),Vt=se("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ue),Tt.init(e,t)}),Wt=se("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Be),Tt.init(e,t)}),Yt=/^[0-9a-fA-F:.]+$/;function Ht(e){return!!Yt.test(e)&&Nt(`http://[${e}]`)}const qt=se("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ge),Tt.init(e,t),e._zod.check=n=>{Ht(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Qt=se("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Je),Tt.init(e,t)});const Xt=se("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ke),Tt.init(e,t),e._zod.check=n=>{(function(e){const t=e.split("/");if(2!==t.length)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`===r&&!(i<0||i>128)&&Ht(n)})(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function en(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const tn=/^[0-9a-zA-Z+/]*={0,2}$/,nn=se("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tn),Tt.init(e,t),e._zod.check=n=>{en(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),rn=/^[A-Za-z0-9_-]*$/;const on=se("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=rn),Tt.init(e,t),e._zod.check=n=>{(function(e){if(!rn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return en(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),sn=se("$ZodE164",(e,t)=>{t.pattern??(t.pattern=We),Tt.init(e,t)});const an=se("$ZodJWT",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),un=se("$ZodNumber",(e,t)=>{kt.init(e,t),e._zod.pattern=et,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),cn=se("$ZodNumberFormat",(e,t)=>{lt.init(e,t),un.init(e,t)}),ln=se("$ZodBoolean",(e,t)=>{kt.init(e,t),e._zod.pattern=tt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),dn=se("$ZodAny",(e,t)=>{kt.init(e,t),e._zod.parse=e=>e}),fn=se("$ZodUnknown",(e,t)=>{kt.init(e,t),e._zod.parse=e=>e}),pn=se("$ZodNever",(e,t)=>{kt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});const hn=e=>Array.isArray(e)?e.length:-1;function mn(e,t,n){e.issues.length&&t.issues.push(...R(n,e.issues)),t.value[n]=e.value}const gn=se("$ZodArray",(e,t)=>{kt.init(e,t);const n=ce.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);const s=[],a=i?.abortEarly;for(let e=0;e<o.length;e++){const n=o[e],u=t.element._zod.run({value:n,issues:[]},i);if(u instanceof Promise)s.push(u.then(t=>mn(t,r,e)));else if(mn(u,r,e),a&&0!==u.issues.length&&M(u))break}return s.length?Promise.all(s).then(()=>r):r},function(e,t){const n=D(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,o)=>{const s=t(n.value);if(s>r&&!o?.skipChecks&&"backward"!==o?.direction)for(const[t,r]of D(e._zod.def.checks))if(s>t&&r._zod.def.when(n)){const t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,F(n.issues,t,e),n}return i(n,o)}}(e,hn)});function yn(e,t,n,r,i,o){const s=n in r,a="optional"===o;if(s||!a||"optional"!==i){if(e.issues.length){if(void 0!==i&&a&&!s)return;t.issues.push(...R(n,e.issues))}s||void 0!==i?void 0===e.value?(s||"defaulted"===i&&!a)&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}}const vn=[];function bn(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:vn,i=r.length?[...t,...r]:t;for(const t of i)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(t)}": expected a Zod schema`);const o=(s=e.shape,Object.keys(s).filter(e=>void 0!==s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function _n(e,t,n,r,i,o,s){const a=[],u=i.keySet,c=i.catchall._zod,l=c.def.type,d=c.optin,f=c.optout;let p=0;for(const i in t){if(s&&n.issues.length!==p){if(M(n,p))break;p=n.issues.length}if(u.has(i))continue;if("__proto__"===i){"never"===l&&a.push(i);continue}if("never"===l){a.push(i);continue}const o=c.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>yn(e,n,i,t,d,f))):yn(o,n,i,t,d,f)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const wn=se("$ZodObject",(e,t)=>{kt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const e=()=>{const n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}const i=d(()=>bn(t));ee(e,"propValues",e=>{const t=e.def.shape,n={};for(const e in t){const r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||p(n,e,new Set);for(const t of r.values)n[e].add(t);void 0!==r.optin&&n[e].add(void 0)}}return n});const o=z,s=t.catchall;let a;const u=ce.memoizer;u?.attach(e),e._zod.parse=(t,n)=>{a??(a=i.value);const r=t.value;if(!o(r))return t.issues.push({expected:"object",code:"invalid_type",input:r,inst:e}),t;t.value=u?u.alloc(e,t,{},n):{};const c=[],l=a.shape,d=n?.abortEarly;let f=t.issues.length;for(const e of a.allKeys){if(d&&t.issues.length!==f){if(M(t,f))break;f=t.issues.length}if("__proto__"===e)continue;const i=l[e],o=i._zod.optin,s=i._zod.optout,a=i._zod.run({value:r[e],issues:[]},n);a instanceof Promise?c.push(a.then(n=>yn(n,t,e,r,o,s))):yn(a,t,e,r,o,s)}return s?_n(c,r,t,n,i.value,e,!0===d):c.length?Promise.all(c).then(()=>t):t}}),zn=se("$ZodObjectJIT",(e,t)=>{wn.init(e,t);const n=e._zod.parse,r=d(()=>bn(t)),i=ce.memoizer;let o;const s=z,a=!ce.jitless,u=a&&S.value,c=t.catchall;let l;e._zod.parse=(d,f)=>{l??(l=r.value);const p=d.value;return s(p)?a&&u&&!1===f?.async&&!0!==f.jitless?(o||(o=(t=>{const n=r.value,o=n.symbolKeys,s=new zt(["payload","ctx"],{shape:t,inst:e,memo:i,syms:o}),a=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,u=(e,t)=>`\n let ${e}_ab = false;\n for (let i = 0; i < ${e}.issues.length; i++) {\n const iss = ${e}.issues[i];\n iss.path = iss.path ? [${t}, ...iss.path] : [${t}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${e}_ab = true;\n }\n if (${e}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;s.write("const input = payload.value;");const c=Object.create(null);let l=0;for(const e of n.allKeys)c[e]="key_"+l++;s.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const e of n.allKeys){if("__proto__"===e)continue;const n=c[e],r="symbol"==typeof e?`syms[${o.indexOf(e)}]`:_(e),i=`${r} in input`,l=t[e],d=l?._zod?.optin,f=void 0!==d,p="optional"===l?._zod?.optout;if(s.write(`const ${n} = ${a(r)};`),f&&p){const e="optional"===d?`${n}_present`:`${n}.value !== undefined || ${n}_present`;s.write(`\n const ${n}_present = ${i};\n if (!${n}.issues.length || ${n}_present) {\n if (${n}.issues.length) {${u(n,r)}\n }\n\n if (${e}) {\n newResult[${r}] = ${n}.value;\n }\n }\n\n `)}else f?(s.write(`\n if (${n}.issues.length) {${u(n,r)}\n }\n `),"defaulted"===d?s.write(`newResult[${r}] = ${n}.value;`):s.write(`\n if (${n}.value !== undefined || ${i}) {\n newResult[${r}] = ${n}.value;\n }\n `)):s.write(`\n const ${n}_present = ${i};\n if (${n}.issues.length) {${u(n,r)}\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${r}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${n}_present) {\n newResult[${r}] = ${n}.value;\n }\n\n `)}return s.write("payload.value = newResult;"),s.write("return payload;"),s.compile()})(t.shape)),d=o(d,f),c?_n([],p,d,f,l,e,!0===f?.abortEarly):d):n(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function Sn(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const i=e.filter(e=>!M(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,le())))}),t)}const kn=se("$ZodUnion",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>e.def.options.some(e=>"defaulted"===e._zod.optin)?"defaulted":e.def.options.some(e=>void 0!==e._zod.optin)?"optional":void 0),ee(e,"optout",e=>e.def.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ee(e,"values",e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),ee(e,"pattern",e=>{if(e.def.options.every(e=>e._zod.pattern)){const t=e.def.options.map(e=>e._zod.pattern);return new RegExp(`^(${t.map(e=>f(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>Sn(t,r,e,i)):Sn(s,r,e,i)}});const On=se("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kn.init(e,t);const n=e._zod.parse;ee(e,"propValues",e=>{const t={};let n=0;for(const r of e.def.options){const i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(const[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||p(t,e,new Set);for(const r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{const r=h(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw new Error(`Invalid discriminated union option at index "${n}"`)});const r=d(()=>function(e){const t=new Map;for(const n of e.options){const r=n._zod.propValues?.[e.discriminator];if(!r||0===r.size)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const e of r)if(t.has(e)){if(void 0!==e)throw new Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}(t));e._zod.parse=(i,o)=>{const s=i.value;if(!z(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=s?.[t.discriminator],u=r.value.get(a);return!u||void 0===a&&"backward"===o.direction?t.unionFallback||"backward"===o.direction?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>null!==r.value.get(e)),input:s,path:[t.discriminator],inst:e}),i):u._zod.run(i,o)}}),$n=se("$ZodIntersection",(e,t)=>{kt.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,o)}});function In(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(k(e)&&k(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const n of r){if("__proto__"===n)continue;const r=In(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=In(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){const r=new Map;let i;const o=new Map,s=(e,t)=>{let n;if("unrecognized_keys"!==e.code||e.path?.length){if("invalid_key"!==e.code||"record"!==e.origin||1!==e.path?.length)return!1;{const t=String(e.path[0]);o.has(t)||o.set(t,e),n=[t]}}else i??(i=e),n=e.keys;for(const e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(const n of t.issues)s(n,"l")||e.issues.push(n);for(const t of n.issues)s(t,"r")||e.issues.push(t);const a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length){const t=i?a.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(const n of a)!t.includes(n)&&o.has(n)&&e.issues.push(o.get(n))}const u=In(t.value,n.value);if(!u.valid){if(M(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}const En=se("$ZodEnum",(e,t)=>{kt.init(e,t);const n=a(t.entries),r=new Set(n);e._zod.values=r,ee(e,"pattern",e=>{const t=a(e.def.entries).filter(e=>$.has(typeof e));return new RegExp(t.length?`^(${t.map(e=>I(e.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),An=se("$ZodLiteral",(e,t)=>{kt.init(e,t);const n=new Set(t.values);e._zod.values=n,ee(e,"pattern",e=>{const t=e.def.values;return new RegExp(t.length?`^(${t.map(e=>"string"==typeof e?I(e):e?I(e.toString()):String(e)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Cn=se("$ZodTransform",(e,t)=>{kt.init(e,t),e._zod.optin="optional",ce.memoizer?.guard(e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new ue(e.constructor.name);const i=t.transform(n.value,n);if(r.async){return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n))}if(i instanceof Promise)throw new ae;return n.value=i,n}});function Nn(e,t){return e.value=t.issues.length?void 0:t.value,e}const Pn=se("$ZodOptional",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),e._zod.optout="optional",ee(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),ee(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${f(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(void 0===e.value){if("defaulted"!==t.innerType._zod.optin)return e;const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Nn(e,t)):Nn(e,r)}return t.innerType._zod.run(e,n)}}),xn=se("$ZodExactOptional",(e,t)=>{Pn.init(e,t),ee(e,"values",e=>e.def.innerType._zod.values),ee(e,"pattern",e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zn=se("$ZodNullable",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>e.def.innerType._zod.optin),ee(e,"optout",e=>e.def.innerType._zod.optout),ee(e,"pattern",e=>{const t=e.def.innerType._zod.pattern;return t?new RegExp(`^(${f(t.source)}|null)$`):void 0}),ee(e,"values",e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Mn=se("$ZodDefault",(e,t)=>{kt.init(e,t),e._zod.optin="defaulted",ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jn(e,t)):jn(r,t)}});function jn(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Rn=se("$ZodPrefault",(e,t)=>{kt.init(e,t),e._zod.optin="defaulted",ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Un=se("$ZodNonOptional",(e,t)=>{kt.init(e,t),ee(e,"values",e=>{const t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dn(t,e)):Dn(i,e)}});function Dn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Fn(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>L(e,r,le()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Ln=se("$ZodCatch",(e,t)=>{kt.init(e,t),ee(e,"optin",e=>"defaulted"===e.def.innerType._zod.optin?"defaulted":"optional"),ee(e,"optout",e=>e.def.innerType._zod.optout),ee(e,"values",e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Fn(e,r,t,n)):Fn(e,r,t,n)}}),Bn=se("$ZodPipe",(e,t)=>{kt.init(e,t),ee(e,"values",e=>e.def.in._zod.values),ee(e,"optin",e=>e.def.in._zod.optin),ee(e,"optout",e=>e.def.out._zod.optout),ee(e,"propValues",e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.in,n)):Gn(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.out,n)):Gn(r,t.out,n)}});function Gn(e,t,n){return e.issues.some(e=>"unrecognized_keys"!==e.code)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Jn=se("$ZodReadonly",(e,t)=>{kt.init(e,t),ee(e,"propValues",e=>e.def.innerType._zod.propValues),ee(e,"values",e=>e.def.innerType._zod.values),ee(e,"optin",e=>e.def.innerType?._zod?.optin),ee(e,"optout",e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Kn):Kn(r)}});function Kn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Vn=se("$ZodCustom",(e,t)=>{it.init(e,t),kt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Wn(t,n,r,e));Wn(i,n,r,e)}});function Wn(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(K(e))}}class Yn extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Hn="~memo",qn=[];function Qn(e){return null!==e&&"object"==typeof e}function Xn(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const er=new WeakMap;function tr(e,t,n){const r=er.get(e);if(void 0!==r)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0;const o=e=>{if(2!==i&&e?._zod){const n=tr(e,t);n>i&&(i=n)}},s=e=>{e>i&&(i=e)},a=e._zod.def;switch(a.type){case"object":{const e=h(a);s(e?(e=>{let n=0;for(const r of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,r);if(!i.enumerable)continue;const o=i.get?1:i.value?._zod?tr(i.value,t):0;o>n&&(n=o)}return n})(e):1),o(a.catchall);break}case"array":o(a.element);break;case"tuple":for(const e of a.items)o(e);o(a.rest);break;case"record":case"map":o(a.keyType),o(a.valueType);break;case"set":o(a.valueType);break;case"union":for(const e of a.options)o(e);break;case"intersection":o(a.left),o(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(a.innerType);break;case"pipe":o(a.in),o(a.out);break;case"function":o(a.input),o(a.output);break;case"lazy":{const e=a._cachedInner??void 0;s(e?tr(e,t):1);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const e in a){const t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;const n=t.value;if(n&&"object"==typeof n)if(n._zod)o(n);else if(Array.isArray(n))for(const e of n)o(e)}}return t.delete(e),function(e,t){1!==t&&er.set(e,2===t);return t}(e,i)}let nr;const rr=[],ir={alloc(e,t,n){const r=nr;if(!r)return n;nr=void 0;const i={value:n,issues:null};return r.set(t.value,i),rr.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,n=(e,n)=>{if("backward"!==n.direction&&function(e,t){const n=e[Hn]?.backEdges;return void 0!==n&&Qn(t)&&n.has(t)}(n,e.value))throw new Yn;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i,o=!1;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const t=e._zod.parse,s=(a,u)=>{if(void 0===n){const r=tr(e,new Set);if(0===r)return e._zod.parse=t,e._zod.run===s&&(e._zod.run=t),t(a,u);2===r||o?n=!0:o=!0}const c=a.value;if(!Qn(c))return t(a,u);let l,d=u[Hn];d||(d={buckets:new WeakMap,backEdges:void 0},u[Hn]=d),r===u?l=i:(l=function(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}(d,e),r=u,i=l);const f=l.get(c);if(f)return a.value=f.value,f.issues?f.issues.length&&a.issues.push(...Xn(f.issues)):(a.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),a;nr=l;const p=rr.length,h=t(a,u);nr=void 0;const m=rr.length>p?rr.pop():void 0;return h instanceof Promise?h.then(e=>(m&&(m.issues=e.issues.length?Xn(e.issues):qn),e)):(m&&(m.issues=h.issues.length?Xn(h.issues):qn),h)};e._zod.parse=s,e._zod.run===t&&(e._zod.run=s)})}};const or=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(t){return e[t]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(e,t){return"number"!==e||"number"!=typeof t||Number.isFinite(t)?r[e]??e:String(t)}return e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${i(e.expected)}, received ${i(function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input),e.input)}`;case"invalid_value":return 1===e.values.length?`Invalid input: expected ${A(e.values[0])}`:`Invalid option: expected one of ${u(e.values,"|")}`;case"too_big":{const n=e.exact?"exactly ":e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.exact?"exactly ":e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${u(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":if(e.options&&Array.isArray(e.options)&&e.options.length>0){return`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(" | ")}`}return!1===e.inclusive?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}}};var sr;class ar{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(sr=globalThis).__zod_globalRegistry??(sr.__zod_globalRegistry=new ar);const ur=globalThis.__zod_globalRegistry;function cr(e){return e.checks&&(e.checks=[...e.checks]),e}function lr(e,t){return new at({check:"less_than",...E(t),value:e,inclusive:!1})}function dr(e,t){return new at({check:"less_than",...E(t),value:e,inclusive:!0})}function fr(e,t){return new ut({check:"greater_than",...E(t),value:e,inclusive:!1})}function pr(e,t){return new ut({check:"greater_than",...E(t),value:e,inclusive:!0})}function hr(e,t){return new ct({check:"multiple_of",...E(t),value:e})}function mr(e,t){return new dt({check:"max_length",...E(t),maximum:e})}function gr(e,t){return new ft({check:"min_length",...E(t),minimum:e})}function yr(e,t){return new pt({check:"length_equals",...E(t),length:e})}function vr(e){return new wt({check:"overwrite",tx:e})}function br(e,t){const n=function(e,t){const n=new it({check:"custom",...E(t)});return n._zod.check=e,n}(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(K(e,t.value,n._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=t.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),t.issues.push(K(r))}},e(t.value,t)),t);return n}function _r(e,...t){for(const n of t)for(const t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&p(e,t,n[t]);return e}function wr(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ur,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function zr(e,t,n,r,i){const o="function"==typeof t.unrepresentable?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if("any"===o)return!1;if(void 0===o||"throw"===o)throw new Error(i);return Object.assign(n,o),!0}function Sr(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o){o.count++;return n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema}const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,r);else{const n=s.schema,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),Sr(o,t,r),t.seen.get(o).isParent=!0)}const u=t.metadataRegistry.get(e);u&&_r(s.schema,u),"input"===t.io&&Pr(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function kr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Or(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${kr(o)}`}}const i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:"#"};const o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+kr(o)}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){i(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}const o=e.metadataRegistry.get(n[0])?.id;o?i(n):(r.cycle||r.count>1&&"ref"===e.reused)&&i(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $r(e){const t=e.anyOf;if(!Array.isArray(t)||0===t.length||void 0!==e.type)return;const n=[];for(const e of t){if(!e||"object"!=typeof e)return;$r(e);const t=Object.keys(e);if(1!==t.length||"type"!==t[0])return;const r=e.type;for(const e of Array.isArray(r)?r:[r]){if("string"!=typeof e)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=1===n.length?n[0]:n}const Ir=new Set(["type","properties","required","additionalProperties"]),Tr=["oneOf","anyOf"];function Er(e){const t=e.additionalProperties;return void 0===t||!1===t||"object"!=typeof t||null===t?null:Object.keys(t).length?t:null}function Ar(e){const t=[];for(const n of e){if("object"!=typeof n||"object"!==n.type)return null;for(const e in n)if(!Ir.has(e))return null;t.push(n)}const n={},r=new Set;for(const e of t){for(const r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;const e=[];for(const n of t){const t=n.properties?.[r]??Er(n);null!=t&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}p(n,r,1===e.length?e[0]:Ar(e)??{allOf:e})}for(const t of e.required??[])r.add(t)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(e=>!1===e.additionalProperties))i.additionalProperties=!1;else{const e=[];for(const n of t){const t=Er(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}1===e.length?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Cr(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const t of Ir)if(t in e)return;const n=t.filter(e=>Tr.some(t=>Array.isArray(e[t])));let r=null;if(n.length){const e=n[0],i=Tr.find(t=>Array.isArray(e[t]));if(1!==Object.keys(e).length)return;const o=t.filter(t=>t!==e),s=e[i].map(e=>Ar([...o,e]));if(s.some(e=>!e))return;r={[i]:s}}else r=Ar(t);r&&(delete e.allOf,_r(e,r))}function Nr(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const i=n.def??n.schema,o={...i},s=n.ref;if(n.ref=null,s){r(s);const n=e.seen.get(s),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?_r(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),_r(i,o);if(t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const t of[...e.seen.entries()].reverse())r(t[0]);if("openapi-3.0"!==e.target)for(const t of e.seen.entries())$r(t[1].def??t[1].schema);for(const t of e.deferred)t();if(e.intersections.length){const t=new Map;for(const n of e.seen.values())for(const e of[n.schema,n.def]){const n=e?.allOf;if(!Array.isArray(n))continue;const r=t.get(n);r?r.push(e):t.set(n,[e])}for(const n of e.intersections)for(const e of t.get(n)??[])Cr(e)}}const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}_r(i,n.defId?n.schema:n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;void 0!==o&&i.id===o&&delete i.id;const s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,p(s,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?i.$defs=s:i.definitions=s);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:xr(t,"input",e.processors),output:xr(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Pr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return Pr(r.element,n);if("set"===r.type)return Pr(r.valueType,n);if("lazy"===r.type)return Pr(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type||"catch"===r.type)return Pr(r.innerType,n);if("intersection"===r.type)return Pr(r.left,n)||Pr(r.right,n);if("record"===r.type||"map"===r.type)return Pr(r.keyType,n)||Pr(r.valueType,n);if("pipe"===r.type)return!!e._zod.traits.has("$ZodCodec")||(Pr(r.in,n)||Pr(r.out,n));if("object"===r.type){for(const e in r.shape)if(Pr(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(Pr(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(Pr(e,n))return!0;return!(!r.rest||!Pr(r.rest,n))}return!1}const xr=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=wr({...i??{},target:o,io:t,processors:n});return Sr(e,s),Or(s,e),Nr(s,e)},Zr=(e,t,n)=>{(void 0===e[t]||n>e[t])&&(e[t]=n)},Mr=(e,t,n)=>{(void 0===e[t]||n<e[t])&&(e[t]=n)},jr=(e,t)=>{Zr(e,"minimum",t),Mr(e,"maximum",t)},Rr=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Ur=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Dr=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Fr=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Lr=(e,t)=>Zr(e,"minimum",t.minimum),Br=(e,t)=>Mr(e,"maximum",t.maximum),Gr=e=>(t,n)=>{Fr(t,n.format);const[r,i]=e[n.format];Zr(t,"minimum",r),Mr(t,"maximum",i)},Jr={greater_than:(e,t)=>Zr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Mr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rr(e,t.value),number_format:Gr(C),bigint_format:Gr(N),min_length:Lr,max_length:Br,length_equals:(e,t)=>jr(e,t.length),min_size:Lr,max_size:Br,size_equals:(e,t)=>jr(e,t.size),string_format:(e,t)=>{Fr(e,t.format),t.pattern&&Ur(e,t.pattern),"base64"!==t.format&&"base64url"!==t.format||(e.contentEncoding=t.format),(t.local||-1===t.precision)&&(e.laxFormat=!0)},mime_type:(e,t)=>Dr(e,t.mime)};function Kr(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const e of r)Jr[e._zod.def.check]?.(t,e._zod.def);const i=e._zod.bag;void 0!==i.minimum&&Zr(t,"minimum",i.minimum),void 0!==i.exclusiveMinimum&&Zr(t,"exclusiveMinimum",i.exclusiveMinimum),void 0!==i.maximum&&Mr(t,"maximum",i.maximum),void 0!==i.exclusiveMaximum&&Mr(t,"exclusiveMaximum",i.exclusiveMaximum),void 0!==i.multipleOf&&Rr(t,i.multipleOf),void 0!==i.format&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Dr(t,i.mime);for(const e of i.patterns??[])Ur(t,e);return t}const Vr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wr=new Map([[tn,/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/],[rn,/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/]]),Yr=e=>Wr.get(e)??e;function Hr(e){const t=e._zod.def;return"pipe"===t.type&&t.in._zod.traits.has("$ZodTransform")?Hr(t.out):"catch"===t.type?Hr(t.innerType):e._zod.optin}const qr=Symbol();function Qr(e,t,n,r,i){let o=!1;const s=JSON.stringify(e,(e,t)=>"bigint"!=typeof t?t:(o=!0,null));return o?(zr(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),qr):JSON.parse(s)}const Xr=(e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r);t.seen.get(e).ref=i.innerType},ei=new WeakSet([Object.prototype,Error.prototype]);function ti(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const ni=(e,t)=>{he.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);ei.has(n)||(ei.add(n),ti(n,"format",e=>t=>function(e,t=e=>e.message){const n={_errors:[]},r=(e,i=[])=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if("invalid_key"===o.code)r({issues:o.issues},[...i,...o.path]);else if("invalid_element"===o.code)r({issues:o.issues},[...i,...o.path]);else{const e=[...i,...o.path];if(0===e.length)n._errors.push(t(o));else{let r=n,i=0;for(;i<e.length;){const n=e[i],s=i===e.length-1;if("_errors"===n){s&&r._errors.push(t(o)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const a=r[n];s&&a._errors.push(t(o)),r=a,i++}}}};return r(e),n}(e,t)),ti(n,"flatten",e=>t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?me(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)),ti(n,"addIssue",e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),ti(n,"addIssues",e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return 0===this.issues.length}}))},ri=se("ZodError",ni,void 0,{Parent:Error}),ii=ye(ri),oi=ve(ri),si=be(ri),ai=we(ri),ui=Oe(ri),ci=$e(ri),li=Ie(ri),di=Te(ri),fi=Ee(ri),pi=Ae(ri),hi=Ce(ri),mi=Ne(ri);function gi(){ce.localeError||le({localeError:or()})}function yi(){ce.memoizer||le({memoizer:ir})}const vi=se("ZodType",(e,t)=>(gi(),kt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(b(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return T(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...E(n)})}(Co,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return br(e,t)}(e,t))},overwrite(e){return this.check(vr(e))},optional(){return _o(this)},exactOptional(){return new wo({type:"optional",innerType:this})},nullable(){return So(this)},nullish(){return _o(So(this))},nonoptional(e){return function(e,t){return new $o({type:"nonoptional",innerType:e,...E(t)})}(this,e)},array(){return oo(this)},or(e){return co([this,e])},and(e){return new po({type:"intersection",left:this,right:e})},transform(e){return Eo(this,new vo({type:"transform",transform:e}))},default(e){return t=e,new ko({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():O(t)}});var t},prefault(e){return t=e,new Oo({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():O(t)}});var t},catch(e){return new Io({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:ne(t)});var t},pipe(e){return Eo(this,e)},readonly(){return new Ao({type:"readonly",innerType:this})},describe(e){const t=this.clone();return ur.add(t,{description:e}),t},meta(...e){if(0===e.length)return ur.get(this);const t=this.clone();return ur.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return 0===t.length?e(this):e(this,...t)},get"~standard"(){return W(this,"~standard",{...$t(this),jsonSchema:{input:xr(this,"input"),output:xr(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return ii(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await oi(this,t,n,{callee:e})},safeParse(e,t){return si(this,e,t)},async safeParseAsync(e,t){return ai(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ke(this,e,t)},validateAsync(e,t){return(async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),0===i.issues.length})(this,e,t)},encode:function e(t,n){return ui(this,t,n,{callee:e})},decode:function e(t,n){return ci(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await li(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await di(this,t,n,{callee:e})},safeEncode(e,t){return fi(this,e,t)},safeDecode(e,t){return pi(this,e,t)},async safeEncodeAsync(e,t){return hi(this,e,t)},async safeDecodeAsync(e,t){return mi(this,e,t)},toJSONSchema(e){return((e,t={})=>n=>{const r=wr({...n,processors:t});return Sr(e,r),Or(r,e),Nr(r,e)})(this,{})(e)},get description(){return ur.get(this)?.description},get _def(){return this._zod.def}}),bi=se("_ZodString",(e,t)=>{It.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:u,laxFormat:c}=Kr(e);if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=Vr[s]??s,""===r.format&&delete r.format,("time"===s||c)&&delete r.format),u&&(r.contentEncoding=u),a&&a.size>0){const e=[...a].map(Yr);1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n)},Y({format:e=>Kr(e).format??null,minLength:e=>Kr(e).minimum??null,maxLength:e=>Kr(e).maximum??null},{regex(...e){return this.check(function(e,t){return new mt({check:"string_format",format:"regex",...E(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new vt({check:"string_format",format:"includes",...E(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new bt({check:"string_format",format:"starts_with",...E(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new _t({check:"string_format",format:"ends_with",...E(t),suffix:e})}(...e))},min(...e){return this.check(gr(...e))},max(...e){return this.check(mr(...e))},length(...e){return this.check(yr(...e))},nonempty(...e){return this.check(gr(1,...e))},lowercase(e){return this.check(function(e){return new gt({check:"string_format",format:"lowercase",...E(e)})}(e))},uppercase(e){return this.check(function(e){return new yt({check:"string_format",format:"uppercase",...E(e)})}(e))},trim(){return this.check(vr(e=>e.trim()))},normalize(...e){return this.check(function(e){return vr(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(vr(e=>e.toLowerCase()))},toUpperCase(){return this.check(vr(e=>e.toUpperCase()))},slugify(){return this.check(vr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}})),_i=se("ZodString",(e,t)=>{It.init(e,t),bi.init(e,t)},{email(e){return this.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}(Ii,e))},url(e){return this.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}(Ai,e))},jwt(e){return this.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}(Ji,e))},emoji(e){return this.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}(Ci,e))},guid(e){return this.check(function(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}(Ti,e))},uuid(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}(Ei,e))},uuidv4(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}(Ei,e))},uuidv6(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}(Ei,e))},uuidv7(e){return this.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}(Ei,e))},nanoid(e){return this.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}(Ni,e))},cuid(e){return this.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}(Pi,e))},cuid2(e){return this.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}(xi,e))},ulid(e){return this.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}(Zi,e))},base64(e){return this.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}(Li,e))},base64url(e){return this.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}(Bi,e))},xid(e){return this.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}(Mi,e))},ksuid(e){return this.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}(ji,e))},ipv4(e){return this.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}(Ri,e))},ipv6(e){return this.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}(Ui,e))},cidrv4(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}(Di,e))},cidrv6(e){return this.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}(Fi,e))},e164(e){return this.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}(Gi,e))},datetime(e){return this.check(function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}(Si,e))},date(e){return this.check(function(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}(ki,e))},time(e){return this.check(function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}(Oi,e))},duration(e){return this.check(function(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}($i,e))}});function wi(e){return function(e,t){return new e(cr({type:"string",...E(t)}))}(_i,e)}const zi=se("ZodStringFormat",(e,t)=>{Tt.init(e,t),bi.init(e,t)}),Si=se("ZodISODateTime",(e,t)=>{Gt.init(e,t),zi.init(e,t)}),ki=se("ZodISODate",(e,t)=>{Jt.init(e,t),zi.init(e,t)}),Oi=se("ZodISOTime",(e,t)=>{Kt.init(e,t),zi.init(e,t)}),$i=se("ZodISODuration",(e,t)=>{Vt.init(e,t),zi.init(e,t)}),Ii=se("ZodEmail",(e,t)=>{Ct.init(e,t),zi.init(e,t)}),Ti=se("ZodGUID",(e,t)=>{Et.init(e,t),zi.init(e,t)}),Ei=se("ZodUUID",(e,t)=>{At.init(e,t),zi.init(e,t)}),Ai=se("ZodURL",(e,t)=>{Mt.init(e,t),zi.init(e,t)}),Ci=se("ZodEmoji",(e,t)=>{jt.init(e,t),zi.init(e,t)}),Ni=se("ZodNanoID",(e,t)=>{Rt.init(e,t),zi.init(e,t)}),Pi=se("ZodCUID",(e,t)=>{Ut.init(e,t),zi.init(e,t)}),xi=se("ZodCUID2",(e,t)=>{Dt.init(e,t),zi.init(e,t)}),Zi=se("ZodULID",(e,t)=>{Ft.init(e,t),zi.init(e,t)}),Mi=se("ZodXID",(e,t)=>{Lt.init(e,t),zi.init(e,t)}),ji=se("ZodKSUID",(e,t)=>{Bt.init(e,t),zi.init(e,t)}),Ri=se("ZodIPv4",(e,t)=>{Wt.init(e,t),zi.init(e,t)}),Ui=se("ZodIPv6",(e,t)=>{qt.init(e,t),zi.init(e,t)}),Di=se("ZodCIDRv4",(e,t)=>{Qt.init(e,t),zi.init(e,t)}),Fi=se("ZodCIDRv6",(e,t)=>{Xt.init(e,t),zi.init(e,t)}),Li=se("ZodBase64",(e,t)=>{nn.init(e,t),zi.init(e,t)}),Bi=se("ZodBase64URL",(e,t)=>{on.init(e,t),zi.init(e,t)}),Gi=se("ZodE164",(e,t)=>{sn.init(e,t),zi.init(e,t)}),Ji=se("ZodJWT",(e,t)=>{an.init(e,t),zi.init(e,t)}),Ki=se("ZodNumber",(e,t)=>{un.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=Kr(e);i.type=l?"integer":"number";const d="number"==typeof c&&c>=(o??Number.NEGATIVE_INFINITY),f="number"==typeof u&&u<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;if(d?p?(i.minimum=c,i.exclusiveMinimum=!0):i.exclusiveMinimum=c:"number"==typeof o&&(i.minimum=o),f?p?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:"number"==typeof s&&(i.maximum=s),a){const n=new Set;for(const o of a)Number.isFinite(o)&&0!==o?n.add(Math.abs(o)):zr(e,t,i,r,`A multipleOf divisor of ${o} cannot be represented in JSON Schema`);const[o,...s]=n;void 0!==o&&(i.multipleOf=o),s.length&&(i.allOf=[...i.allOf??[],...s.map(e=>({multipleOf:e}))])}})(e,t,n,r),e.isFinite=!0},Y({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=Kr(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=Kr(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=Kr(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Kr(e).format??null},{gt(e,t){return this.check(fr(e,t))},gte(e,t){return this.check(pr(e,t))},min(e,t){return this.check(pr(e,t))},lt(e,t){return this.check(lr(e,t))},lte(e,t){return this.check(dr(e,t))},max(e,t){return this.check(dr(e,t))},int(e){return this.check(Yi(e))},safe(e){return this.check(Yi(e))},positive(e){return this.check(fr(0,e))},nonnegative(e){return this.check(pr(0,e))},negative(e){return this.check(lr(0,e))},nonpositive(e){return this.check(dr(0,e))},multipleOf(e,t){return this.check(hr(e,t))},step(e,t){return this.check(hr(e,t))},finite(){return this}}));function Vi(e){return function(e,t){return new e(cr({type:"number",checks:[],...E(t)}))}(Ki,e)}const Wi=se("ZodNumberFormat",(e,t)=>{cn.init(e,t),Ki.init(e,t)});function Yi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}(Wi,e)}const Hi=se("ZodBoolean",(e,t)=>{ln.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function qi(e){return function(e,t){return new e({type:"boolean",...E(t)})}(Hi,e)}const Qi=se("ZodAny",(e,t)=>{dn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Xi(){return new Qi({type:"any"})}const eo=se("ZodUnknown",(e,t)=>{fn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function to(){return new eo({type:"unknown"})}const no=se("ZodNever",(e,t)=>{pn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function ro(e){return function(e,t){return new e({type:"never",...E(t)})}(no,e)}const io=se("ZodArray",(e,t)=>{yi(),gn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=Kr(e);"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=Sr(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element},{min(e,t){return this.check(gr(e,t))},nonempty(e){return this.check(gr(1,e))},max(e,t){return this.check(mr(e,t))},length(e,t){return this.check(yr(e,t))},unwrap(){return this.element}});function oo(e,t){return function(e,t,n){return new e({type:"array",element:t,...E(n)})}(io,e,t)}const so=se("ZodObject",(e,t)=>{yi(),zn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&zr(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const e in s)p(i.properties,e,Sr(s[e],t,{...r,path:[...r.path,"properties",e]}));const a=[];for(const e of Object.keys(s)){const n=o.shape[e];("input"===t.io?void 0===Hr(n):void 0===n._zod.optout)&&a.push(e)}a.length>0&&(i.required=a),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Sr(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),te(e,"shape",e=>e._zod.def.shape,!1)},{keyof(){return mo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(b(this._zod.def,{catchall:e}))},passthrough(){return this.clone(b(this._zod.def,{catchall:to()}))},loose(){return this.clone(b(this._zod.def,{catchall:to()}))},strict(){return this.clone(b(this._zod.def,{catchall:ro()}))},strip(){return this.clone(b(this._zod.def,{catchall:void 0}))},extend(e){return function(e,t){if(!k(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=m(e);for(const e of Reflect.ownKeys(t))if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return T(e,b(e._zod.def,{shape:x(e,t)}))}(this,e)},safeExtend(e){return function(e,t){if(!k(t))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,b(e._zod.def,{shape:x(e,t)}))}(this,e)},merge(e){return function(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};return v(n,e,Reflect.ownKeys(m(e))),v(n,t,Reflect.ownKeys(m(t))),T(e,b(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}(this,e)},pick(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i={};return v(i,e,P(e,t)),T(e,b(n,{shape:i,checks:[]}))}(this,e)},omit(e){return function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=new Set(P(e,t)),o={};return v(o,e,Reflect.ownKeys(m(e)).filter(e=>!i.has(e))),T(e,b(n,{shape:o,checks:[]}))}(this,e)},partial(...e){return Z(bo,this,e[0])},exactPartial(...e){return Z(wo,this,e[0],"exactPartial")},required(...e){return function(e,t,n){const r=n?new Set(P(t,n)):void 0,i={};return v(i,t,Reflect.ownKeys(m(t)),(t,n)=>r&&!r.has(n)?t:new e({type:"nonoptional",innerType:t})),T(t,b(t._zod.def,{shape:i}))}($o,this,e[0])}});function ao(e,t){const n={type:"object",shape:e??{},...E(t)};return new so(n)}const uo=se("ZodUnion",(e,t)=>{kn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>Sr(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function co(e,t){return new uo({type:"union",options:e,...E(t)})}const lo=se("ZodDiscriminatedUnion",(e,t)=>{uo.init(e,t),On.init(e,t)});function fo(e,t,n){return new lo({type:"union",options:t,discriminator:e,...E(n)})}const po=se("ZodIntersection",(e,t)=>{$n.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Sr(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=Sr(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=u,t.intersections.push(u)})(e,t,n,r)});const ho=se("ZodEnum",(e,t)=>{En.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=a(e._zod.def.entries);0!==r.length?(r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r):n.not={}})(e,0,n),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const i={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);i[r]=t.entries[r]}return new ho({...t,checks:[],...E(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new ho({...t,checks:[],...E(r),entries:i})}});function mo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ho({type:"enum",entries:n,...E(t)})}const go=se("ZodLiteral",(e,t)=>{An.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(0===i.values.length)return void(n.not={});const o=[];for(const s of i.values)if(void 0===s){if(zr(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if("bigint"==typeof s){if(zr(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function yo(e,t){return new go({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}const vo=se("ZodTransform",(e,t)=>{yi(),Cn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{zr(e,t,n,r,"Transforms cannot be represented in JSON Schema")})(e,t,n,r),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new ue(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(K(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),"input"in t||(t.input=n.value),t.inst??(t.inst=e),n.issues.push(K(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});const bo=se("ZodOptional",(e,t)=>{Pn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new bo({type:"optional",innerType:e})}const wo=se("ZodExactOptional",(e,t)=>{xn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const zo=se("ZodNullable",(e,t)=>{Zn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=Sr(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e){return new zo({type:"nullable",innerType:e})}const ko=se("ZodDefault",(e,t)=>{Mn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;const o=Qr(i.defaultValue,e,t,n,r);o!==qr&&(n.default=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Oo=se("ZodPrefault",(e,t)=>{Rn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;if(Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"!==t.io)return;const o=Qr(i.defaultValue,e,t,n,r);o!==qr&&(n._prefault=o)})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const $o=se("ZodNonOptional",(e,t)=>{Un.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});const Io=se("ZodCatch",(e,t)=>{Ln.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{return void zr(e,t,n,r,"Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const To=se("ZodPipe",(e,t)=>{Bn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s="input"===t.io?o?i.out:i.in:i.out;Sr(s,t,r),t.seen.get(e).ref=s})(e,t,0,r),e.in=t.in,e.out=t.out});function Eo(e,t){return new To({type:"pipe",in:e,out:t})}const Ao=se("ZodReadonly",(e,t)=>{Jn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;Sr(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});const Co=se("ZodCustom",(e,t)=>{Vn.init(e,t),vi.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{zr(e,t,n,r,"Custom types cannot be represented in JSON Schema")})(e,t,n,r)});const No=["GBPCountries","UnitedStates","AUDCountries","EURCountries","International","NZDCountries","Canada"],Po=mo(No),xo=mo(["Include","Exclude"]),Zo=ao({targetedCountryGroups:oo(Po),targetedCountryCodes:oo(wi()).optional(),contributionsOnlyCountriesTargeting:xo.optional()}).optional(),Mo={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"}},jo={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"},Ro={GBPCountries:"£",UnitedStates:"$",AUDCountries:"$",Canada:"CA$",EURCountries:"€",NZDCountries:"NZ$",International:"$"},Uo={GBP:"£",USD:"$",AUD:"$",EUR:"€",NZD:"NZ$",CAD:"CA$"},Do=e=>Object.keys(Mo).find(t=>Mo[t].countries.includes(e??""))??"International",Fo=(e,t=[],n=[])=>0===t.length&&0===n.length||!!e&&(!!t.includes(Do(e.toUpperCase()))||n.includes(e.toUpperCase())),Lo=(e,t,n)=>{const r=e?.contributionsOnlyCountriesTargeting??"Exclude";if(!t)return!0;const i=n.includes(t);return"Include"===r?i:!i},Bo=e=>{if(e){const t=Do(e);return Ro[t]}return"£"},Go=e=>{if(e)return jo[e]},Jo=e=>e.includes("subscribe/weekly/checkout"),Ko=(e,t)=>{if(t){const n=(e=>Mo[Do(e)].supportRegionId)(t);if(!Jo(e))return e.replace(/(support\.theguardian\.com)\/(contribute-in-epic|contribute|subscribe|checkout)/,(e,t,r)=>`${t}/${n.toLowerCase()}/${r}`)}return e},Vo=(e,t,n,r)=>{if(r){const i=r[Do(n)];return`${Bo(n)}${i[e][t].price}`}},Wo={CURRENCY_SYMBOL:({countryCode:e})=>Bo(e),COUNTRY_NAME:({countryCode:e})=>Go(e),PRICE_DIGISUB_MONTHLY:({countryCode:e,prices:t})=>Vo("Digisub","Monthly",e,t),PRICE_DIGISUB_ANNUAL:({countryCode:e,prices:t})=>Vo("Digisub","Annual",e,t),PRICE_GUARDIANWEEKLY_MONTHLY:({countryCode:e,prices:t})=>Vo("GuardianWeekly","Monthly",e,t),PRICE_GUARDIANWEEKLY_ANNUAL:({countryCode:e,prices:t})=>Vo("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"}))()},Yo=(e,t,n)=>e?e.replace(Ho,e=>{const r=e.substring(2,e.length-2),i=Wo[r];if(i){const e=i({countryCode:t,prices:n});if(e)return e}return e}):"",Ho=/%%.*?%%/g,qo=e=>{const t=e.match(Ho)?.filter(e=>"%%ARTICLE_COUNT%%"!==e);return!!t&&t.length>0},Qo="gu.contributions.views",Xo=e=>e.get(Qo)??void 0,es=e=>{const t=JSON.parse(localStorage.getItem(Qo)??""),n=t?t.value:[];n.push({date:(new Date).getTime(),testId:e});const r={value:n.slice(-50)};localStorage.setItem(Qo,JSON.stringify(r))},ts=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},ns=(e=new Date)=>{const t=(e=>{const t=e.getDate()<20?1:2;return e.setMonth(e.getMonth()+t),e})(e),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.toLocaleString("default",{month:"long"}),i=t.getFullYear();return{reminderCta:`Remind me in ${r}`,reminderPeriod:`${i}-${n}-01`,reminderLabel:`${r} ${i}`}},rs=new Date("2023-12-31"),is=e=>e>=(e=>new Date(e.getFullYear(),10,15))(e)&&e<ts(e.getFullYear()),os=(e,t=new Date)=>{return"US"===e&&is(t)?{reminderCta:"Remind me on Giving Tuesday",reminderPeriod:`${n=t.getFullYear()}-${(ts(n).getMonth()+1).toString().padStart(0,"2")}-01`,reminderLabel:"on Giving Tuesday",reminderOption:`giving-tuesday-${n}`}:"US"===e&&(e=>e>=ts(e.getFullYear())&&e<rs)(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()):ns(t);var n},ss=ao({text:wi(),baseUrl:wi()});let as=function(e){return e.Custom="CustomSecondaryCta",e.ContributionsReminder="ContributionsReminderSecondaryCta",e}({});var us;new ho({type:"enum",entries:as,...E(us)});const cs=fo("type",[ao({type:yo(as.Custom),cta:ss}),ao({type:yo(as.ContributionsReminder)})]),ls=ao({countLabel:wi(),goalCopy:wi().optional()}),ds=ao({total:Vi(),goal:Vi()}),fs=mo(["US","AU","global"]),ps=ao({currencySymbol:wi(),copy:ls,name:fs,tickerData:ds.optional()}),hs=ao({for52Weeks:Vi(),forTargetedWeeks:Vi()}),ms=mo(["for52Weeks","forTargetedWeeks"]),gs=ao({type:yo("above"),copy:wi().optional(),countType:ms.optional()}),ys=mo(["CONTRIBUTION","MEMBERSHIP_SUPPORTER","DIGITAL_SUBSCRIPTION","PRINT_SUBSCRIPTION"]),vs=mo(["ACQUISITIONS_EPIC","ACQUISITIONS_ENGAGEMENT_BANNER","ACQUISITIONS_SUBSCRIPTIONS_BANNER","ACQUISITIONS_HEADER","ACQUISITIONS_OTHER"]),bs=ao({abTestName:wi(),abTestVariant:wi(),campaignCode:wi(),componentType:vs,products:oo(ys).nullish(),labels:oo(wi()).nullish(),ophanPageId:wi(),platformId:wi(),referrerUrl:wi()}),_s=ao({mainUrl:wi(),mobileUrl:wi().optional(),tabletUrl:wi().optional(),desktopUrl:wi().optional(),leftColUrl:wi().optional(),wideUrl:wi().optional(),altText:wi()}),ws=ao({name:wi(),description:wi().optional(),headshot:_s.optional()}),zs=/^[0-9A-F]{2}$/,Ss=wi().refine(e=>zs.test(e),{error:e=>`"${JSON.stringify(e.input)}" is not a valid hex value`}),ks=ao({r:Ss,g:Ss,b:Ss,kind:yo("hex")}),Os=ao({mobileUrl:wi(),tabletUrl:wi(),desktopUrl:wi(),altText:wi(),kind:yo("Image")}),$s=ao({buttonColour:ks.nullish(),buttonTextColour:ks.nullish(),buttonBorderColour:ks.nullish(),buttonSelectColour:ks.nullish(),buttonSelectTextColour:ks.nullish(),buttonSelectBorderColour:ks.nullish(),buttonSelectMarkerColour:ks.nullish(),pillTextColour:ks.nullish(),pillBackgroundColour:ks.nullish(),kind:yo("ChoiceCards")}),Is=ao({visual:fo("kind",[Os,$s]).nullish(),headerImage:ao({mobileUrl:wi(),tabletUrl:wi(),desktopUrl:wi(),altText:wi()}).nullish(),colours:ao({basic:ao({background:ks,bodyText:ks})})}),Ts=e=>`#${e.r}${e.g}${e.b}`,Es=ao({heading:wi(),subheading:wi(),primaryCta:ss.optional(),secondaryCta:ss.optional(),benefits:oo(wi()).optional()}),As=ao({content:Es,tracking:bs,mobileContent:Es.optional(),countryCode:wi().optional(),submitComponentEvent:Xi(),promoCodes:oo(wi()).nullish()}),Cs=ao({copy:wi()}),Ns=co([yo("Monthly"),yo("Annual")]),Ps=fo("supportTier",[ao({supportTier:yo("Contribution"),ratePlan:Ns}),ao({supportTier:yo("SupporterPlus"),ratePlan:Ns}),ao({supportTier:yo("DigitalSubscription"),ratePlan:Ns}),ao({supportTier:yo("OneOff")})]),xs=ao({copy:wi(),textColour:ks.nullish(),backgroundColour:ks.nullish()}),Zs=co([yo("LandingPage"),yo("Checkout")]),Ms=ao({testName:wi(),variantName:wi()}),js=ao({product:Ps,label:wi(),isDefault:qi(),defaultExpanded:qi().optional(),benefitsLabel:wi().nullish(),benefits:oo(Cs),pill:xs.nullish(),destination:Zs.nullish(),destinationTest:Ms.nullish()}),Rs=ao({choiceCards:oo(js),mobileChoiceCards:oo(js).nullish()}),Us=ao({maxViewsCount:Vi(),maxViewsDays:Vi(),minDaysBetweenViews:Vi()}),Ds=ao({reminderCta:wi(),reminderLabel:wi(),reminderPeriod:wi()});mo(["ONE_OFF","MONTHLY","ANNUAL"]);const Fs=ao({newsletterId:wi(),successDescription:wi()}),Ls=ao({name:wi(),heading:wi().optional(),paragraphs:oo(wi()),highlightedText:wi().optional(),tickerSettings:ps.optional(),cta:ss.optional(),secondaryCta:cs.optional(),newsletterSignup:Fs.optional(),image:_s.optional(),showReminderFields:Ds.optional(),separateArticleCount:gs.optional(),promoCodes:oo(wi()).nullish(),maxViews:Us.optional(),showSignInLink:qi().optional(),bylineWithImage:ws.optional(),showChoiceCards:qi().optional(),choiceCardsSettings:Rs.nullish()}),Bs=ao({variant:Ls,tracking:bs,countryCode:wi().nullish(),articleCounts:hs,onReminderOpen:Xi().nullish(),fetchEmail:Xi().nullish(),submitComponentEvent:Xi().nullish(),openCmp:Xi().nullish(),hasConsentForArticleCount:qi().nullish(),stage:wi().nullish()}),Gs=mo(["contributions","subscriptions","signIn","abandonedBasket"]),Js=ao({heading:wi().optional(),messageText:wi().optional(),paragraphs:oo(wi()).optional(),mobileMessageText:wi().optional(),highlightedText:wi().optional(),cta:ss.optional(),secondaryCta:cs.optional()}),Ks=ao({tracking:bs,bannerChannel:Gs,content:Js.nullish(),mobileContent:Js.nullish(),countryCode:wi().nullish(),tickerSettings:ps.nullish(),submitComponentEvent:Xi(),articleCounts:hs,hasOptedOutOfArticleCount:qi().nullish(),fetchEmail:Xi().nullish(),separateArticleCount:qi().nullish(),design:Is.nullish(),choiceCardsSettings:Rs.nullish(),promoCodes:oo(wi()).nullish(),isCollapsible:qi().nullish(),promotedNewsletter:ao({listId:Vi(),identityName:wi(),name:wi(),status:mo(["paused","cancelled","live","pending"]).optional(),frequency:wi(),signUpDescription:wi().optional(),illustrationCard:wi().nullish(),illustrationSquare:wi().nullish()}).nullish(),contributionsServiceUrl:wi().nullish()}),Vs=ao({amount:co([Vi(),yo("other")]),billingPeriod:co([yo("ONE_OFF"),yo("MONTHLY"),yo("ANNUAL")]),product:co([yo("Contribution"),yo("SupporterPlus"),yo("PremiumTier"),yo("DailyEdition"),yo("GuardianWeekly"),yo("Paper"),yo("PaperAndDigital")]),region:co([yo("uk"),yo("us"),yo("au"),yo("eu"),yo("int"),yo("nz"),yo("ca")])}),Ws=(e,t,n,r)=>{const i=(e=>new URLSearchParams(window.location.search).get(`force-${e}`))(e),o=(e=>new URLSearchParams(window.location.search).get(`preview-${e}`))(e),s=new URLSearchParams;i?s.set("force",i):o&&s.set("preview",o);const a=s.toString();return fetch(a?`${t}/${e}?${a}`:`${t}/${e}`,{method:"post",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(n)}).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())},Ys=(e,t,n)=>Ws("epic",e,t,n),Hs=(e,t)=>Ws("liveblog-epic",e,t),qs=(e,t)=>Ws("banner",e,t),Qs=(e,t)=>Ws("gutter-liveblog",e,t),Xs=(e,t)=>Ws("header",e,t);export{No as CountryGroupId,as as SecondaryCtaType,Vs as abandonedBasketSchema,Ko as addRegionIdToSupportUrl,Ks as bannerSchema,ns as buildReminderFields,qo as containsNonArticleCountPlaceholder,xo as contributionsOnlyCountriesTargetingSchema,Do as countryCodeToCountryGroupId,Po as countryGroupIdSchema,Mo as countryGroups,Bs as epicPropsSchema,qs as getBanner,Go as getCountryName,Ys as getEpic,Xo as getEpicViewLog,Qs as getGutterLiveblog,Xs as getHeader,Hs as getLiveblogEpic,Bo as getLocalCurrencySymbol,os as getReminderFields,r as getWeeklyArticleHistory,As as headerPropsSchema,Ts as hexColourToString,Fo as inTargetedCountry,s as incrementWeeklyArticleCount,Jo as isGWCheckoutUrl,Uo as isoCurrencyToCurrencySymbol,es as logEpicView,Lo as passesContributionsOnlyTargeting,Yo as replaceNonArticleCountPlaceholders,Zo as targetedRegionsSchema};