@talisdev/bibliographic-resource-parsers-lib 5.34.0 → 5.35.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.
@@ -1,39 +1,39 @@
1
- (function(y,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(y=typeof globalThis<"u"?globalThis:y||self,m(y.BibliographicResourceParsersLib={}))})(this,(function(y){"use strict";function m(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=s.prototype,l=Object.keys(u);for(let f=0;f<l.length;f++){const d=l[f];d in a||(a[d]=u[d].bind(a))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;const u=r?.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class ze extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class On extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Pn={};function ye(e){return Pn}function Nn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Nt(e,t){return typeof t=="bigint"?t.toString():t}function zt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Tt(e){return e==null}function Lt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ji(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const i=r>o?r:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}const zn=Symbol("evaluating");function J(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zn)return n===void 0&&(n=zn,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ie(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function _e(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tn(e){return JSON.stringify(e)}function qi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ln="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Di=zt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Te(e){if(nt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(nt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function xn(e){return Te(e)?{...e}:Array.isArray(e)?[...e]:e}const Zi=new Set(["string","number","symbol"]);function Le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function A(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Bi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ji={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]};function Ui(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=_e(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=r.shape[a])}return Ie(this,"shape",s),s},checks:[]});return Se(e,i)}function Vi(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=_e(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Ie(this,"shape",s),s},checks:[]});return Se(e,i)}function Mi(e,t){if(!Te(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=_e(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Ie(this,"shape",i),i}});return Se(e,o)}function Fi(e,t){if(!Te(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=_e(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ie(this,"shape",n),n}});return Se(e,r)}function Wi(e,t){const r=_e(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ie(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Se(e,r)}function Gi(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=_e(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(r)for(const u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Ie(this,"shape",c),c},checks:[]});return Se(t,s)}function Xi(e,t,r){const n=_e(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return Ie(this,"shape",i),i}});return Se(t,n)}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function je(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ot(e){return typeof e=="string"?e:e?.message}function Ee(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=ot(e.inst?._zod.def?.error?.(e))??ot(t?.error?.(e))??ot(r.customError?.(e))??ot(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function xt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ue(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const jn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Nt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qn=m("$ZodError",jn),Dn=m("$ZodError",jn,{Parent:Error});function Hi(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Yi(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>n({issues:s}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;for(;a<i.path.length;){const c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return n(e),r}const jt=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new ze;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(c=>Ee(c,i,ye())));throw Ln(a,o?.callee),a}return s.value},qt=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(c=>Ee(c,i,ye())));throw Ln(a,o?.callee),a}return s.value},st=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ze;return i.issues.length?{success:!1,error:new(e??qn)(i.issues.map(s=>Ee(s,o,ye())))}:{success:!0,data:i.value}},Ki=st(Dn),it=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Ee(s,o,ye())))}:{success:!0,data:i.value}},Qi=it(Dn),ea=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jt(e)(t,r,o)},ta=e=>(t,r,n)=>jt(e)(t,r,n),ra=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qt(e)(t,r,o)},na=e=>async(t,r,n)=>qt(e)(t,r,n),oa=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return st(e)(t,r,o)},sa=e=>(t,r,n)=>st(e)(t,r,n),ia=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return it(e)(t,r,o)},aa=e=>async(t,r,n)=>it(e)(t,r,n),ca=/^[cC][^\s-]{8,}$/,ua=/^[0-9a-z]+$/,la=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pa=/^[0-9a-vA-V]{20}$/,fa=/^[A-Za-z0-9]{27}$/,ha=/^[a-zA-Z0-9_-]{21}$/,da=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ma=/^([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})$/,Zn=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)$/,ga=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,va="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ba(){return new RegExp(va,"u")}const ya=/^(?:(?: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])$/,_a=/^(([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}|:))$/,Sa=/^((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])$/,Ea=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$a=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bn=/^[A-Za-z0-9_-]*$/,Aa=/^\+[1-9]\d{6,14}$/,Jn="(?:(?:\\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])))",wa=new RegExp(`^${Jn}$`);function Un(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ra(e){return new RegExp(`^${Un(e)}$`)}function ka(e){const t=Un({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Jn}T(?:${n})$`)}const Ia=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ca=/^-?\d+$/,Vn=/^-?\d+(?:\.\d+)?$/,Oa=/^null$/i,Pa=/^[^A-Z]*$/,Na=/^[^a-z]*$/,ae=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Mn={number:"number",bigint:"bigint",object:"date"},Fn=m("$ZodCheckLessThan",(e,t)=>{ae.init(e,t);const r=Mn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wn=m("$ZodCheckGreaterThan",(e,t)=>{ae.init(e,t);const r=Mn[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),za=m("$ZodCheckMultipleOf",(e,t)=>{ae.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ji(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ta=m("$ZodCheckNumberFormat",(e,t)=>{ae.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ji[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,r&&(a.pattern=Ca)}),e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){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:n,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:n,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),La=m("$ZodCheckMaxLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const s=xt(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xa=m("$ZodCheckMinLength",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const s=xt(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ja=m("$ZodCheckLengthEquals",(e,t)=>{var r;ae.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Tt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const s=xt(o),a=i>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})}}),at=m("$ZodCheckStringFormat",(e,t)=>{var r,n;ae.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),qa=m("$ZodCheckRegex",(e,t)=>{at.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Da=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Pa),at.init(e,t)}),Za=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Na),at.init(e,t)}),Ba=m("$ZodCheckIncludes",(e,t)=>{ae.init(e,t);const r=Le(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ja=m("$ZodCheckStartsWith",(e,t)=>{ae.init(e,t);const r=new RegExp(`^${Le(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),Ua=m("$ZodCheckEndsWith",(e,t)=>{ae.init(e,t);const r=new RegExp(`.*${Le(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),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})}}),Va=m("$ZodCheckOverwrite",(e,t)=>{ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ma{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
2
- `).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
3
- `))}}const Fa={major:4,minor:3,patch:6},H=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fa;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,c)=>{let u=xe(s),l;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(u)continue;const d=s.issues.length,g=f._zod.check(s);if(g instanceof Promise&&c?.async===!1)throw new ze;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,s.issues.length!==d&&(u||(u=xe(s,d)))});else{if(s.issues.length===d)continue;u||(u=xe(s,d))}}return l?l.then(()=>s):s},i=(s,a,c)=>{if(xe(s))return s.aborted=!0,s;const u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new ze;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,s,a)):i(u,s,a)}const c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new ze;return c.then(u=>o(u,n,a))}return o(c,n,a)}}J(e,"~standard",()=>({validate:o=>{try{const i=Ki(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Qi(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Dt=m("$ZodString",(e,t)=>{H.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ia(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),G=m("$ZodStringFormat",(e,t)=>{at.init(e,t),Dt.init(e,t)}),Wa=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ma),G.init(e,t)}),Ga=m("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zn(n))}else t.pattern??(t.pattern=Zn());G.init(e,t)}),Xa=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ga),G.init(e,t)}),Ha=m("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ya=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ba()),G.init(e,t)}),Ka=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ha),G.init(e,t)}),Qa=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ca),G.init(e,t)}),ec=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ua),G.init(e,t)}),tc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=la),G.init(e,t)}),rc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pa),G.init(e,t)}),nc=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=fa),G.init(e,t)}),oc=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ka(t)),G.init(e,t)}),sc=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=wa),G.init(e,t)}),ic=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ra(t)),G.init(e,t)}),ac=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=da),G.init(e,t)}),cc=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ya),G.init(e,t),e._zod.bag.format="ipv4"}),uc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_a),G.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),lc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Sa),G.init(e,t)}),pc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ea),G.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Gn(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const fc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$a),G.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function hc(e){if(!Bn.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gn(r)}const dc=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Bn),G.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{hc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),mc=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Aa),G.init(e,t)});function gc(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const vc=m("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=r=>{gc(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Xn=m("$ZodNumber",(e,t)=>{H.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),bc=m("$ZodNumberFormat",(e,t)=>{Ta.init(e,t),Xn.init(e,t)}),yc=m("$ZodNull",(e,t)=>{H.init(e,t),e._zod.pattern=Oa,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),_c=m("$ZodUnknown",(e,t)=>{H.init(e,t),e._zod.parse=r=>r}),Sc=m("$ZodNever",(e,t)=>{H.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Hn(e,t,r){e.issues.length&&t.issues.push(...je(r,e.issues)),t.value[r]=e.value}const Ec=m("$ZodArray",(e,t)=>{H.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?i.push(c.then(u=>Hn(u,r,s))):Hn(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function ct(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...je(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Yn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Bi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Kn(e,t,r,n,o,i){const s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(const f in t){if(a.has(f))continue;if(u==="never"){s.push(f);continue}const d=c.run({value:t[f],issues:[]},n);d instanceof Promise?e.push(d.then(g=>ct(g,r,f,t,l))):ct(d,r,f,t,l)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const $c=m("$ZodObject",(e,t)=>{if(H.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=zt(()=>Yn(t));J(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const f of l.values)c[u].add(f)}}return c});const o=nt,i=t.catchall;let s;e._zod.parse=(a,c)=>{s??(s=n.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],f=s.shape;for(const d of s.keys){const g=f[d],I=g._zod.optout==="optional",v=g._zod.run({value:u[d],issues:[]},c);v instanceof Promise?l.push(v.then(P=>ct(P,a,d,u,I))):ct(v,a,d,u,I)}return i?Kn(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),Ac=m("$ZodObjectJIT",(e,t)=>{$c.init(e,t);const r=e._zod.parse,n=zt(()=>Yn(t)),o=d=>{const g=new Ma(["shape","payload","ctx"]),I=n.value,v=x=>{const Z=Tn(x);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};g.write("const input = payload.value;");const P=Object.create(null);let D=0;for(const x of I.keys)P[x]=`key_${D++}`;g.write("const newResult = {};");for(const x of I.keys){const Z=P[x],M=Tn(x),ee=d[x]?._zod?.optout==="optional";g.write(`const ${Z} = ${v(x)};`),ee?g.write(`
4
- if (${Z}.issues.length) {
5
- if (${M} in input) {
6
- payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.BibliographicResourceParsersLib={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);Object.freeze({status:`aborted`});function n(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var r=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},i=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},a={};function o(e){return e&&Object.assign(a,e),a}function s(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function c(e,t){return typeof t==`bigint`?t.toString():t}function l(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function u(e){return e==null}function d(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function f(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var p=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==p)return r===void 0&&(r=p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _(e){return JSON.stringify(e)}function v(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var y=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ee(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var te=l(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ne(e){if(ee(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ee(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function re(e){return ne(e)?{...e}:Array.isArray(e)?[...e]:e}var ie=new Set([`string`,`number`,`symbol`]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function oe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ce={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function le(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return h(this,`shape`,e),e},checks:[]}))}function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return oe(e,g(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return h(this,`shape`,r),r},checks:[]}))}function de(e,t){if(!ne(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function fe(e,t){if(!ne(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function pe(e,t){return oe(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return h(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function me(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return h(this,`shape`,i),i},checks:[]}))}function he(e,t,n){return oe(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return h(this,`shape`,i),i}}))}function ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function _e(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ve(e){return typeof e==`string`?e:e?.message}function ye(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ve(e.inst?._zod.def?.error?.(e))??ve(t?.error?.(e))??ve(n.customError?.(e))??ve(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function be(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Se=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,c,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ce=n(`$ZodError`,Se),we=n(`$ZodError`,Se,{Parent:Error});function Te(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var De=e=>(t,n,i,a)=>{let s=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new r;if(c.issues.length){let t=new(a?.Err??e)(c.issues.map(e=>ye(e,s,o())));throw y(t,a?.callee),t}return c.value},Oe=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new(i?.Err??e)(s.issues.map(e=>ye(e,a,o())));throw y(t,i?.callee),t}return s.value},ke=e=>(t,n,i)=>{let a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new r;return s.issues.length?{success:!1,error:new(e??Ce)(s.issues.map(e=>ye(e,a,o())))}:{success:!0,data:s.value}},Ae=ke(we),je=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ye(e,i,o())))}:{success:!0,data:a.value}},Me=je(we),Ne=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return De(e)(t,n,i)},Pe=e=>(t,n,r)=>De(e)(t,n,r),Fe=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Oe(e)(t,n,i)},Ie=e=>async(t,n,r)=>Oe(e)(t,n,r),Le=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ke(e)(t,n,i)},Re=e=>(t,n,r)=>ke(e)(t,n,r),ze=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return je(e)(t,n,i)},Be=e=>async(t,n,r)=>je(e)(t,n,r),Ve=/^[cC][^\s-]{8,}$/,He=/^[0-9a-z]+$/,Ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,We=/^[0-9a-vA-V]{20}$/,Ge=/^[A-Za-z0-9]{27}$/,Ke=/^[a-zA-Z0-9_-]{21}$/,qe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Je=/^([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})$/,Ye=e=>e?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)$/,Xe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ze=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Qe(){return new RegExp(Ze,`u`)}var $e=/^(?:(?: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])$/,et=/^(([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}|:))$/,tt=/^((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])$/,nt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,it=/^[A-Za-z0-9_-]*$/,at=/^\+[1-9]\d{6,14}$/,ot=`(?:(?:\\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])))`,st=RegExp(`^${ot}$`);function ct(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lt(e){return RegExp(`^${ct(e)}$`)}function ut(e){let t=ct({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ot}T(?:${r})$`)}var dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ft=/^-?\d+$/,pt=/^-?\d+(?:\.\d+)?$/,mt=/^null$/i,ht=/^[^A-Z]*$/,gt=/^[^a-z]*$/,x=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_t={number:`number`,bigint:`bigint`,object:`date`},vt=n(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yt=n(`$ZodCheckGreaterThan`,(e,t)=>{x.init(e,t);let n=_t[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=n(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):f(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xt=n(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ce[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ft)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),St=n(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=be(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ct=n(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=be(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wt=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!u(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=be(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tt=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),Et=n(`$ZodCheckRegex`,(e,t)=>{Tt.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})}}),Dt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ht,Tt.init(e,t)}),Ot=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gt,Tt.init(e,t)}),kt=n(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=ae(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),At=n(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${ae(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),jt=n(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${ae(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Mt=n(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
+ `))}},Pt={major:4,minor:3,patch:6},S=n(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pt;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let i=ge(e),a;for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new r;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||=ge(e,t))});else{if(e.issues.length===t)continue;i||=ge(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(ge(n))return n.aborted=!0,n;let s=t(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new r;return s.then(e=>t(e,i,o))}return t(s,i,o)}}m(e,`~standard`,()=>({validate:t=>{try{let n=Ae(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Me(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ft=n(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=n(`$ZodStringFormat`,(e,t)=>{Tt.init(e,t),Ft.init(e,t)}),It=n(`$ZodGUID`,(e,t)=>{t.pattern??=Je,C.init(e,t)}),Lt=n(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ye(e)}else t.pattern??=Ye();C.init(e,t)}),Rt=n(`$ZodEmail`,(e,t)=>{t.pattern??=Xe,C.init(e,t)}),zt=n(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Bt=n(`$ZodEmoji`,(e,t)=>{t.pattern??=Qe(),C.init(e,t)}),Vt=n(`$ZodNanoID`,(e,t)=>{t.pattern??=Ke,C.init(e,t)}),Ht=n(`$ZodCUID`,(e,t)=>{t.pattern??=Ve,C.init(e,t)}),Ut=n(`$ZodCUID2`,(e,t)=>{t.pattern??=He,C.init(e,t)}),Wt=n(`$ZodULID`,(e,t)=>{t.pattern??=Ue,C.init(e,t)}),Gt=n(`$ZodXID`,(e,t)=>{t.pattern??=We,C.init(e,t)}),Kt=n(`$ZodKSUID`,(e,t)=>{t.pattern??=Ge,C.init(e,t)}),qt=n(`$ZodISODateTime`,(e,t)=>{t.pattern??=ut(t),C.init(e,t)}),Jt=n(`$ZodISODate`,(e,t)=>{t.pattern??=st,C.init(e,t)}),Yt=n(`$ZodISOTime`,(e,t)=>{t.pattern??=lt(t),C.init(e,t)}),Xt=n(`$ZodISODuration`,(e,t)=>{t.pattern??=qe,C.init(e,t)}),Zt=n(`$ZodIPv4`,(e,t)=>{t.pattern??=$e,C.init(e,t),e._zod.bag.format=`ipv4`}),Qt=n(`$ZodIPv6`,(e,t)=>{t.pattern??=et,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),$t=n(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tt,C.init(e,t)}),en=n(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nt,C.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function tn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var nn=n(`$ZodBase64`,(e,t)=>{t.pattern??=rt,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function rn(e){if(!it.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var an=n(`$ZodBase64URL`,(e,t)=>{t.pattern??=it,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),on=n(`$ZodE164`,(e,t)=>{t.pattern??=at,C.init(e,t)});function sn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var cn=n(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{sn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ln=n(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??pt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),un=n(`$ZodNumberFormat`,(e,t)=>{xt.init(e,t),ln.init(e,t)}),dn=n(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=mt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),fn=n(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),pn=n(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mn(e,t,n){e.issues.length&&t.issues.push(..._e(n,e.issues)),t.value[n]=e.value}var hn=n(`$ZodArray`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>mn(t,n,e))):mn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function gn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(..._e(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _n(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=se(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gn(e,n,i,t,u))):gn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var yn=n(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=l(()=>_n(t));m(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ee,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>gn(n,t,e,s,r))):gn(i,t,e,s,r)}return i?vn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),bn=n(`$ZodObjectJIT`,(e,t)=>{yn.init(e,t);let n=e._zod.parse,r=l(()=>_n(t)),i=e=>{let t=new Nt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=_(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=_(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
4
+ if (${n}.issues.length) {
5
+ if (${o} in input) {
6
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
7
  ...iss,
8
- path: iss.path ? [${M}, ...iss.path] : [${M}]
8
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
9
9
  })));
10
10
  }
11
11
  }
12
12
 
13
- if (${Z}.value === undefined) {
14
- if (${M} in input) {
15
- newResult[${M}] = undefined;
13
+ if (${n}.value === undefined) {
14
+ if (${o} in input) {
15
+ newResult[${o}] = undefined;
16
16
  }
17
17
  } else {
18
- newResult[${M}] = ${Z}.value;
18
+ newResult[${o}] = ${n}.value;
19
19
  }
20
20
 
21
- `):g.write(`
22
- if (${Z}.issues.length) {
23
- payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
21
+ `):t.write(`
22
+ if (${n}.issues.length) {
23
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
24
  ...iss,
25
- path: iss.path ? [${M}, ...iss.path] : [${M}]
25
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
26
26
  })));
27
27
  }
28
28
 
29
- if (${Z}.value === undefined) {
30
- if (${M} in input) {
31
- newResult[${M}] = undefined;
29
+ if (${n}.value === undefined) {
30
+ if (${o} in input) {
31
+ newResult[${o}] = undefined;
32
32
  }
33
33
  } else {
34
- newResult[${M}] = ${Z}.value;
34
+ newResult[${o}] = ${n}.value;
35
35
  }
36
36
 
37
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const re=g.compile();return(x,Z)=>re(d,x,Z)};let i;const s=nt,a=!Pn.jitless,u=a&&Di.value,l=t.catchall;let f;e._zod.parse=(d,g)=>{f??(f=n.value);const I=d.value;return s(I)?a&&u&&g?.async===!1&&g.jitless!==!0?(i||(i=o(t.shape)),d=i(d,g),l?Kn([],I,d,g,f,e):d):r(d,g):(d.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),d)}});function Qn(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!xe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ee(s,n,ye())))}),t)}const wc=m("$ZodUnion",(e,t)=>{H.init(e,t),J(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),J(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Lt(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>Qn(c,o,e,i)):Qn(a,o,e,i)}}),Rc=m("$ZodIntersection",(e,t)=>{H.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>eo(r,c,u)):eo(r,i,s)}});function Zt(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(Te(e)&&Te(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=Zt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],i=t[n],s=Zt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function eo(e,t,r){const n=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(const a of r.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);const i=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),xe(e))return e;const s=Zt(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const kc=m("$ZodRecord",(e,t)=>{H.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Te(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const i=[],s=t.keyType._zod.values;if(s){r.value={};const a=new Set;for(const u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(f=>{f.issues.length&&r.issues.push(...je(u,f.issues)),r.value[u]=f.value})):(l.issues.length&&r.issues.push(...je(u,l.issues)),r.value[u]=l.value)}let c;for(const u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Vn.test(a)&&c.issues.length){const f=t.keyType._zod.run({value:Number(a),issues:[]},n);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>Ee(f,n,ye())),input:a,path:[a],inst:e});continue}const l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?i.push(l.then(f=>{f.issues.length&&r.issues.push(...je(a,f.issues)),r.value[c.value]=f.value})):(l.issues.length&&r.issues.push(...je(a,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Ic=m("$ZodEnum",(e,t)=>{H.init(e,t);const r=Nn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Zi.has(typeof o)).map(o=>typeof o=="string"?Le(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Cc=m("$ZodLiteral",(e,t)=>{if(H.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Le(n):n?Le(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Oc=m("$ZodTransform",(e,t)=>{H.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new On(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new ze;return r.value=o,r}});function to(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ro=m("$ZodOptional",(e,t)=>{H.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>to(i,r.value)):to(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Pc=m("$ZodExactOptional",(e,t)=>{ro.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Nc=m("$ZodNullable",(e,t)=>{H.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lt(r.source)}|null)$`):void 0}),J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),zc=m("$ZodDefault",(e,t)=>{H.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>no(i,t)):no(o,t)}});function no(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Tc=m("$ZodPrefault",(e,t)=>{H.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Lc=m("$ZodNonOptional",(e,t)=>{H.init(e,t),J(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>oo(i,e)):oo(o,e)}});function oo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const xc=m("$ZodCatch",(e,t)=>{H.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Ee(s,n,ye()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ee(i,n,ye()))},input:r.value}),r.issues=[]),r)}}),jc=m("$ZodPipe",(e,t)=>{H.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ut(s,t.in,n)):ut(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ut(i,t.out,n)):ut(o,t.out,n)}});function ut(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const qc=m("$ZodReadonly",(e,t)=>{H.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>t.innerType?._zod?.optin),J(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(so):so(o)}});function so(e){return e.value=Object.freeze(e.value),e}const Dc=m("$ZodCustom",(e,t)=>{ae.init(e,t),H.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>io(i,r,n,e));io(o,r,n,e)}});function io(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ue(o))}}var ao;class Zc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bc(){return new Zc}(ao=globalThis).__zod_globalRegistry??(ao.__zod_globalRegistry=Bc());const Ve=globalThis.__zod_globalRegistry;function Jc(e,t){return new e({type:"string",...A(t)})}function Uc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function co(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Vc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Wc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Xc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Hc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Yc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function Kc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Qc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function eu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function tu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function ru(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function nu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function ou(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function su(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function iu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function au(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function cu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function uu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function lu(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function pu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function fu(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function hu(e,t){return new e({type:"number",checks:[],...A(t)})}function du(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function mu(e,t){return new e({type:"null",...A(t)})}function gu(e){return new e({type:"unknown"})}function vu(e,t){return new e({type:"never",...A(t)})}function lo(e,t){return new Fn({check:"less_than",...A(t),value:e,inclusive:!1})}function Bt(e,t){return new Fn({check:"less_than",...A(t),value:e,inclusive:!0})}function po(e,t){return new Wn({check:"greater_than",...A(t),value:e,inclusive:!1})}function Jt(e,t){return new Wn({check:"greater_than",...A(t),value:e,inclusive:!0})}function fo(e,t){return new za({check:"multiple_of",...A(t),value:e})}function ho(e,t){return new La({check:"max_length",...A(t),maximum:e})}function lt(e,t){return new xa({check:"min_length",...A(t),minimum:e})}function mo(e,t){return new ja({check:"length_equals",...A(t),length:e})}function bu(e,t){return new qa({check:"string_format",format:"regex",...A(t),pattern:e})}function yu(e){return new Da({check:"string_format",format:"lowercase",...A(e)})}function _u(e){return new Za({check:"string_format",format:"uppercase",...A(e)})}function Su(e,t){return new Ba({check:"string_format",format:"includes",...A(t),includes:e})}function Eu(e,t){return new Ja({check:"string_format",format:"starts_with",...A(t),prefix:e})}function $u(e,t){return new Ua({check:"string_format",format:"ends_with",...A(t),suffix:e})}function qe(e){return new Va({check:"overwrite",tx:e})}function Au(e){return qe(t=>t.normalize(e))}function wu(){return qe(e=>e.trim())}function Ru(){return qe(e=>e.toLowerCase())}function ku(){return qe(e=>e.toUpperCase())}function Iu(){return qe(e=>qi(e))}function Cu(e,t,r){return new e({type:"array",element:t,...A(r)})}function Ou(e,t,r){const n=A(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Pu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function Nu(e){const t=zu(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ue(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ue(o))}},e(r.value,r)));return t}function zu(e,t){const r=new ae({check:"custom",...A(t)});return r._zod.check=e,r}function go(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ve,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function te(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{const d=s.schema,g=t.processors[o.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,d,l)}const f=e._zod.parent;f&&(s.ref||(s.ref=f),te(f,t,l),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),t.io==="input"&&oe(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function vo(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(s[0])?.id,d=e.external.uri??(I=>I);if(f)return{ref:d(f)};const g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${d("__shared")}#/${a}/${g}`}}if(s[1]===r)return{ref:"#"};const u=`#/${a}/`,l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);const l=a.schema;for(const f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(const s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
37
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,s=ee,c=!a.jitless,u=c&&te.value,d=t.catchall,f;e._zod.parse=(a,l)=>{f??=r.value;let p=a.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=i(t.shape),a=o(a,l),d?vn([],p,a,l,f,e):a):n(a,l):(a.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),a)}});function xn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ge(e));return i.length===1?(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=>ye(e,r,o())))}),t)}var Sn=n(`$ZodUnion`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>xn(t,i,e,a)):xn(s,i,e,a)}}),Cn=n(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,a)}});function wn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ne(e)&&ne(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=wn(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:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ge(e))return e;let o=wn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var En=n(`$ZodRecord`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ne(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],s=t.keyType._zod.values;if(s){n.value={};let o=new Set;for(let e of s)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){o.add(typeof e==`number`?e.toString():e);let s=t.valueType._zod.run({value:i[e],issues:[]},r);s instanceof Promise?a.push(s.then(t=>{t.issues.length&&n.issues.push(..._e(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(..._e(e,s.issues)),n.value[e]=s.value)}let c;for(let e in i)o.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let s of Reflect.ownKeys(i)){if(s===`__proto__`)continue;let c=t.keyType._zod.run({value:s,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof s==`string`&&pt.test(s)&&c.issues.length){let e=t.keyType._zod.run({value:Number(s),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[s]=i[s]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>ye(e,r,o())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(..._e(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(..._e(s,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Dn=n(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=s(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ie.has(typeof e)).map(e=>typeof e==`string`?ae(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),On=n(`$ZodLiteral`,(e,t)=>{if(S.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?ae(e):e?ae(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),kn=n(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.parse=(n,a)=>{if(a.direction===`backward`)throw new i(e.constructor.name);let o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n));if(o instanceof Promise)throw new r;return n.value=o,n}});function An(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var jn=n(`$ZodOptional`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>An(t,e.value)):An(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Mn=n(`$ZodExactOptional`,(e,t)=>{jn.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Nn=n(`$ZodNullable`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${d(e.source)}|null)$`):void 0}),m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Pn=n(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fn(e,t)):Fn(r,t)}});function Fn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var In=n(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ln=n(`$ZodNonOptional`,(e,t)=>{S.init(e,t),m(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Rn(t,e)):Rn(i,e)}});function Rn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var zn=n(`$ZodCatch`,(e,t)=>{S.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ye(e,n,o()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ye(e,n,o()))},input:e.value}),e.issues=[]),e)}}),Bn=n(`$ZodPipe`,(e,t)=>{S.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t.in,n)):Vn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t.out,n)):Vn(r,t.out,n)}});function Vn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Hn=n(`$ZodReadonly`,(e,t)=>{S.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Un):Un(r)}});function Un(e){return e.value=Object.freeze(e.value),e}var Wn=n(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Gn(t,n,r,e));Gn(i,n,r,e)}});function Gn(e,t,n,r){if(!e){let 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(xe(e))}}var Kn,qn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let 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)}};function Jn(){return new qn}(Kn=globalThis).__zod_globalRegistry??(Kn.__zod_globalRegistry=Jn());var Yn=globalThis.__zod_globalRegistry;function Xn(e,t){return new e({type:`string`,...b(t)})}function Zn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function Qn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function $n(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function er(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function tr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function nr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function rr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function ir(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function ar(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function or(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function sr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function cr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function lr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function ur(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function dr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function fr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function pr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function mr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function hr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function gr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function _r(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function vr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function yr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function br(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function xr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function Sr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function Cr(e,t){return new e({type:`number`,checks:[],...b(t)})}function wr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function Tr(e,t){return new e({type:`null`,...b(t)})}function Er(e){return new e({type:`unknown`})}function Dr(e,t){return new e({type:`never`,...b(t)})}function Or(e,t){return new vt({check:`less_than`,...b(t),value:e,inclusive:!1})}function kr(e,t){return new vt({check:`less_than`,...b(t),value:e,inclusive:!0})}function Ar(e,t){return new yt({check:`greater_than`,...b(t),value:e,inclusive:!1})}function jr(e,t){return new yt({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Mr(e,t){return new bt({check:`multiple_of`,...b(t),value:e})}function Nr(e,t){return new St({check:`max_length`,...b(t),maximum:e})}function Pr(e,t){return new Ct({check:`min_length`,...b(t),minimum:e})}function Fr(e,t){return new wt({check:`length_equals`,...b(t),length:e})}function Ir(e,t){return new Et({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Lr(e){return new Dt({check:`string_format`,format:`lowercase`,...b(e)})}function Rr(e){return new Ot({check:`string_format`,format:`uppercase`,...b(e)})}function zr(e,t){return new kt({check:`string_format`,format:`includes`,...b(t),includes:e})}function Br(e,t){return new At({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function Vr(e,t){return new jt({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function Hr(e){return new Mt({check:`overwrite`,tx:e})}function Ur(e){return Hr(t=>t.normalize(e))}function Wr(){return Hr(e=>e.trim())}function Gr(){return Hr(e=>e.toLowerCase())}function Kr(){return Hr(e=>e.toUpperCase())}function qr(){return Hr(e=>v(e))}function Jr(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Yr(e,t,n){let r=b(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Xr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Zr(e){let t=Qr(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(xe(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(xe(r))}},e(n.value,n)));return t}function Qr(e,t){let n=new x({check:`custom`,...b(t)});return n._zod.check=e,n}function $r(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Yn,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function w(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,w(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&T(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ei(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw 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])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
38
38
 
39
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function bo(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=s=>{const a=e.seen.get(s);if(a.ref===null)return;const c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);const d=e.seen.get(l),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(g)):Object.assign(c,g),Object.assign(c,u),s._zod.parent===l)for(const v in c)v==="$ref"||v==="allOf"||v in u||delete c[v];if(g.$ref&&d.def)for(const v in c)v==="$ref"||v==="allOf"||v in d.def&&JSON.stringify(c[v])===JSON.stringify(d.def[v])&&delete c[v]}const f=s._zod.parent;if(f&&f!==l){n(f);const d=e.seen.get(f);if(d?.schema.$ref&&(c.$ref=d.schema.$ref,d.def))for(const g in c)g==="$ref"||g==="allOf"||g in d.def&&JSON.stringify(c[g])===JSON.stringify(d.def[g])&&delete c[g]}e.override({zodSchema:s,jsonSchema:c,path:a.path??[]})};for(const s of[...e.seen.entries()].reverse())n(s[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const a=s[1];a.def&&a.defId&&(i[a.defId]=a.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:pt(t,"input",e.processors),output:pt(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function oe(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return oe(n.element,r);if(n.type==="set")return oe(n.valueType,r);if(n.type==="lazy")return oe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return oe(n.innerType,r);if(n.type==="intersection")return oe(n.left,r)||oe(n.right,r);if(n.type==="record"||n.type==="map")return oe(n.keyType,r)||oe(n.valueType,r);if(n.type==="pipe")return oe(n.in,r)||oe(n.out,r);if(n.type==="object"){for(const o in n.shape)if(oe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(oe(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(oe(o,r))return!0;return!!(n.rest&&oe(n.rest,r))}return!1}const Tu=(e,t={})=>r=>{const n=go({...r,processors:t});return te(e,n),vo(n,e),bo(n,e)},pt=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=go({...o??{},target:i,io:t,processors:r});return te(e,s),vo(s,e),bo(s,e)},Lu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xu=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=Lu[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},ju=(e,t,r,n)=>{const o=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof s=="number"&&(o.maximum=s,typeof u=="number"&&t.target!=="draft-04"&&(u<=s?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},qu=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Du=(e,t,r,n)=>{r.not={}},Zu=(e,t,r,n)=>{},Bu=(e,t,r,n)=>{const o=e._zod.def,i=Nn(o.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},Ju=(e,t,r,n)=>{const o=e._zod.def,i=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Uu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vu=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Mu=(e,t,r,n)=>{const o=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=te(i.element,t,{...n,path:[...n.path,"items"]})},Fu=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const u in s)o.properties[u]=te(s[u],t,{...n,path:[...n.path,"properties",u]});const a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{const l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=te(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Wu=(e,t,r,n)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>te(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},Gu=(e,t,r,n)=>{const o=e._zod.def,i=te(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=te(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c},Xu=(e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object";const s=i.keyType,c=s._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){const l=te(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=te(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=te(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const u=s._zod.values;if(u){const l=[...u].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l)}},Hu=(e,t,r,n)=>{const o=e._zod.def,i=te(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Yu=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},Ku=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Qu=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},el=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},tl=(e,t,r,n)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;te(i,t,n);const s=t.seen.get(e);s.ref=i},rl=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},yo=(e,t,r,n)=>{const o=e._zod.def;te(o.innerType,t,n);const i=t.seen.get(e);i.ref=o.innerType},nl=m("ZodISODateTime",(e,t)=>{oc.init(e,t),K.init(e,t)});function ol(e){return uu(nl,e)}const sl=m("ZodISODate",(e,t)=>{sc.init(e,t),K.init(e,t)});function il(e){return lu(sl,e)}const al=m("ZodISOTime",(e,t)=>{ic.init(e,t),K.init(e,t)});function cl(e){return pu(al,e)}const ul=m("ZodISODuration",(e,t)=>{ac.init(e,t),K.init(e,t)});function ll(e){return fu(ul,e)}const le=m("ZodError",(e,t)=>{qn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Yi(e,r)},flatten:{value:r=>Hi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Nt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Nt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),pl=jt(le),fl=qt(le),hl=st(le),dl=it(le),ml=ea(le),gl=ta(le),vl=ra(le),bl=na(le),yl=oa(le),_l=sa(le),Sl=ia(le),El=aa(le),Y=m("ZodType",(e,t)=>(H.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:pt(e,"input"),output:pt(e,"output")}}),e.toJSONSchema=Tu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_e(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Se(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>pl(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hl(e,r,n),e.parseAsync=async(r,n)=>fl(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>dl(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>ml(e,r,n),e.decode=(r,n)=>gl(e,r,n),e.encodeAsync=async(r,n)=>vl(e,r,n),e.decodeAsync=async(r,n)=>bl(e,r,n),e.safeEncode=(r,n)=>yl(e,r,n),e.safeDecode=(r,n)=>_l(e,r,n),e.safeEncodeAsync=async(r,n)=>Sl(e,r,n),e.safeDecodeAsync=async(r,n)=>El(e,r,n),e.refine=(r,n)=>e.check(mp(r,n)),e.superRefine=r=>e.check(gp(r)),e.overwrite=r=>e.check(qe(r)),e.optional=()=>me(e),e.exactOptional=()=>rp(e),e.nullable=()=>Co(e),e.nullish=()=>me(Co(e)),e.nonoptional=r=>cp(e,r),e.array=()=>U(e),e.or=r=>de([e,r]),e.and=r=>Hl(e,r),e.transform=r=>Po(e,ep(r)),e.default=r=>sp(e,r),e.prefault=r=>ap(e,r),e.catch=r=>lp(e,r),e.pipe=r=>Po(e,r),e.readonly=()=>hp(e),e.describe=r=>{const n=e.clone();return Ve.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ve.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ve.get(e);const n=e.clone();return Ve.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),_o=m("_ZodString",(e,t)=>{Dt.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,i)=>xu(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(bu(...n)),e.includes=(...n)=>e.check(Su(...n)),e.startsWith=(...n)=>e.check(Eu(...n)),e.endsWith=(...n)=>e.check($u(...n)),e.min=(...n)=>e.check(lt(...n)),e.max=(...n)=>e.check(ho(...n)),e.length=(...n)=>e.check(mo(...n)),e.nonempty=(...n)=>e.check(lt(1,...n)),e.lowercase=n=>e.check(yu(n)),e.uppercase=n=>e.check(_u(n)),e.trim=()=>e.check(wu()),e.normalize=(...n)=>e.check(Au(...n)),e.toLowerCase=()=>e.check(Ru()),e.toUpperCase=()=>e.check(ku()),e.slugify=()=>e.check(Iu())}),$l=m("ZodString",(e,t)=>{Dt.init(e,t),_o.init(e,t),e.email=r=>e.check(Uc(Al,r)),e.url=r=>e.check(uo(Eo,r)),e.jwt=r=>e.check(cu(Zl,r)),e.emoji=r=>e.check(Gc(Rl,r)),e.guid=r=>e.check(co(So,r)),e.uuid=r=>e.check(Vc(ft,r)),e.uuidv4=r=>e.check(Mc(ft,r)),e.uuidv6=r=>e.check(Fc(ft,r)),e.uuidv7=r=>e.check(Wc(ft,r)),e.nanoid=r=>e.check(Xc(kl,r)),e.guid=r=>e.check(co(So,r)),e.cuid=r=>e.check(Hc(Il,r)),e.cuid2=r=>e.check(Yc(Cl,r)),e.ulid=r=>e.check(Kc(Ol,r)),e.base64=r=>e.check(su(jl,r)),e.base64url=r=>e.check(iu(ql,r)),e.xid=r=>e.check(Qc(Pl,r)),e.ksuid=r=>e.check(eu(Nl,r)),e.ipv4=r=>e.check(tu(zl,r)),e.ipv6=r=>e.check(ru(Tl,r)),e.cidrv4=r=>e.check(nu(Ll,r)),e.cidrv6=r=>e.check(ou(xl,r)),e.e164=r=>e.check(au(Dl,r)),e.datetime=r=>e.check(ol(r)),e.date=r=>e.check(il(r)),e.time=r=>e.check(cl(r)),e.duration=r=>e.check(ll(r))});function h(e){return Jc($l,e)}const K=m("ZodStringFormat",(e,t)=>{G.init(e,t),_o.init(e,t)}),Al=m("ZodEmail",(e,t)=>{Xa.init(e,t),K.init(e,t)}),So=m("ZodGUID",(e,t)=>{Wa.init(e,t),K.init(e,t)}),ft=m("ZodUUID",(e,t)=>{Ga.init(e,t),K.init(e,t)}),Eo=m("ZodURL",(e,t)=>{Ha.init(e,t),K.init(e,t)});function wl(e){return uo(Eo,e)}const Rl=m("ZodEmoji",(e,t)=>{Ya.init(e,t),K.init(e,t)}),kl=m("ZodNanoID",(e,t)=>{Ka.init(e,t),K.init(e,t)}),Il=m("ZodCUID",(e,t)=>{Qa.init(e,t),K.init(e,t)}),Cl=m("ZodCUID2",(e,t)=>{ec.init(e,t),K.init(e,t)}),Ol=m("ZodULID",(e,t)=>{tc.init(e,t),K.init(e,t)}),Pl=m("ZodXID",(e,t)=>{rc.init(e,t),K.init(e,t)}),Nl=m("ZodKSUID",(e,t)=>{nc.init(e,t),K.init(e,t)}),zl=m("ZodIPv4",(e,t)=>{cc.init(e,t),K.init(e,t)}),Tl=m("ZodIPv6",(e,t)=>{uc.init(e,t),K.init(e,t)}),Ll=m("ZodCIDRv4",(e,t)=>{lc.init(e,t),K.init(e,t)}),xl=m("ZodCIDRv6",(e,t)=>{pc.init(e,t),K.init(e,t)}),jl=m("ZodBase64",(e,t)=>{fc.init(e,t),K.init(e,t)}),ql=m("ZodBase64URL",(e,t)=>{dc.init(e,t),K.init(e,t)}),Dl=m("ZodE164",(e,t)=>{mc.init(e,t),K.init(e,t)}),Zl=m("ZodJWT",(e,t)=>{vc.init(e,t),K.init(e,t)}),$o=m("ZodNumber",(e,t)=>{Xn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ju(e,n,o),e.gt=(n,o)=>e.check(po(n,o)),e.gte=(n,o)=>e.check(Jt(n,o)),e.min=(n,o)=>e.check(Jt(n,o)),e.lt=(n,o)=>e.check(lo(n,o)),e.lte=(n,o)=>e.check(Bt(n,o)),e.max=(n,o)=>e.check(Bt(n,o)),e.int=n=>e.check(wo(n)),e.safe=n=>e.check(wo(n)),e.positive=n=>e.check(po(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(lo(0,n)),e.nonpositive=n=>e.check(Bt(0,n)),e.multipleOf=(n,o)=>e.check(fo(n,o)),e.step=(n,o)=>e.check(fo(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ao(e){return hu($o,e)}const Bl=m("ZodNumberFormat",(e,t)=>{bc.init(e,t),$o.init(e,t)});function wo(e){return du(Bl,e)}const Jl=m("ZodNull",(e,t)=>{yc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qu(e,r,n)});function ht(e){return mu(Jl,e)}const Ul=m("ZodUnknown",(e,t)=>{_c.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zu()});function Ro(){return gu(Ul)}const Vl=m("ZodNever",(e,t)=>{Sc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Du(e,r,n)});function Ml(e){return vu(Vl,e)}const Fl=m("ZodArray",(e,t)=>{Ec.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mu(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(lt(r,n)),e.nonempty=r=>e.check(lt(1,r)),e.max=(r,n)=>e.check(ho(r,n)),e.length=(r,n)=>e.check(mo(r,n)),e.unwrap=()=>e.element});function U(e,t){return Cu(Fl,e,t)}const Wl=m("ZodObject",(e,t)=>{Ac.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fu(e,r,n,o),J(e,"shape",()=>t.shape),e.keyof=()=>Me(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ml()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Mi(e,r),e.safeExtend=r=>Fi(e,r),e.merge=r=>Wi(e,r),e.pick=r=>Ui(e,r),e.omit=r=>Vi(e,r),e.partial=(...r)=>Gi(Io,e,r[0]),e.required=(...r)=>Xi(Oo,e,r[0])});function k(e,t){const r={type:"object",shape:e??{},...A(t)};return new Wl(r)}const Gl=m("ZodUnion",(e,t)=>{wc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wu(e,r,n,o),e.options=t.options});function de(e,t){return new Gl({type:"union",options:e,...A(t)})}const Xl=m("ZodIntersection",(e,t)=>{Rc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gu(e,r,n,o)});function Hl(e,t){return new Xl({type:"intersection",left:e,right:t})}const Yl=m("ZodRecord",(e,t)=>{kc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xu(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ko(e,t,r){return new Yl({type:"record",keyType:e,valueType:t,...A(r)})}const Ut=m("ZodEnum",(e,t)=>{Ic.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Bu(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ut({...t,checks:[],...A(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Ut({...t,checks:[],...A(o),entries:i})}});function Me(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ut({type:"enum",entries:r,...A(t)})}const Kl=m("ZodLiteral",(e,t)=>{Cc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ju(e,r,n),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 X(e,t){return new Kl({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Ql=m("ZodTransform",(e,t)=>{Oc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vu(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new On(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ue(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Ue(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function ep(e){return new Ql({type:"transform",transform:e})}const Io=m("ZodOptional",(e,t)=>{ro.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function me(e){return new Io({type:"optional",innerType:e})}const tp=m("ZodExactOptional",(e,t)=>{Pc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rp(e){return new tp({type:"optional",innerType:e})}const np=m("ZodNullable",(e,t)=>{Nc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Co(e){return new np({type:"nullable",innerType:e})}const op=m("ZodDefault",(e,t)=>{zc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ku(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sp(e,t){return new op({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():xn(t)}})}const ip=m("ZodPrefault",(e,t)=>{Tc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ap(e,t){return new ip({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():xn(t)}})}const Oo=m("ZodNonOptional",(e,t)=>{Lc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cp(e,t){return new Oo({type:"nonoptional",innerType:e,...A(t)})}const up=m("ZodCatch",(e,t)=>{xc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>el(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lp(e,t){return new up({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const pp=m("ZodPipe",(e,t)=>{jc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tl(e,r,n,o),e.in=t.in,e.out=t.out});function Po(e,t){return new pp({type:"pipe",in:e,out:t})}const fp=m("ZodReadonly",(e,t)=>{qc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new fp({type:"readonly",innerType:e})}const No=m("ZodCustom",(e,t)=>{Dc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uu(e,r)});function dp(e,t){return Ou(No,e??(()=>!0),t)}function mp(e,t={}){return Pu(No,e,t)}function gp(e){return Nu(e)}var S=(e=>(e.Article="article",e.AudioDocument="audiodocument",e.AudioVisualDocument="audiovisualdocument",e.Book="book",e.Bookitem="bookitem",e.Conference="conference",e.Document="document",e.Image="image",e.Issue="issue",e.Journal="journal",e.Preprint="preprint",e.Proceeding="proceeding",e.Report="report",e.Unknown="unknown",e.Webpage="webpage",e))(S||{});const vp=de([X("book"),X("bookitem"),X("conference"),X("document"),X("report"),X("proceeding"),X("unknown")]),bp=de([X("article"),X("conference"),X("issue"),X("journal"),X("preprint"),X("proceeding"),X("unknown")]),ve=k({artnum:h(),atitle:h(),aufirst:h(),aulast:h(),auinit:h(),auinit1:h(),auinitm:h(),ausuffix:h(),au:U(h()),aucorp:h(),bici:h(),btitle:h(),chron:h(),coden:h(),date:h(),edition:h(),eissn:h(),epage:h(),externalDBID:h(),externalDocID:h(),genre:Me(S),id:h(),isbn:h(),issn:h(),issue:h(),jtitle:h(),pages:h(),part:h(),place:h(),pub:h(),quarter:h(),rft_id:U(h()),series:h(),sici:h(),spage:h(),ssn:h(),stitle:h(),title:h(),tpages:h(),volume:h()}).partial(),Vt=k({bibid:h(),doi:h(),uri:h()}).partial(),yp=ve.pick({atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,bici:!0,btitle:!0,date:!0,edition:!0,epage:!0,id:!0,isbn:!0,issn:!0,pages:!0,place:!0,pub:!0,rft_id:!0,title:!0,tpages:!0,series:!0,spage:!0}).partial(),_p=ve.pick({artnum:!0,atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,chron:!0,coden:!0,date:!0,epage:!0,id:!0,isbn:!0,eissn:!0,issn:!0,issue:!0,title:!0,jtitle:!0,pages:!0,part:!0,pub:!0,rft_id:!0,sici:!0,spage:!0,stitle:!0,ssn:!0,quarter:!0,volume:!0}).partial(),Sp=ve.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),Ep=ve.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),$p=ve.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),Ap=ve.pick({au:!0,date:!0,title:!0}).partial(),zo=k({...ve.shape,...Vt.shape}),V=(e,t)=>({...t,genre:e}),q=(e,t)=>({...t,genre:e}),ge=e=>({...e,genre:S.AudioVisualDocument}),To=e=>({...e,genre:S.Image}),Mt=e=>({...e,genre:S.Document}),dt=e=>({...e,genre:S.Webpage}),Lo=e=>Object.keys(e.shape),xo=Lo(ve),Ft=Lo(Vt),wp=(e,t,r)=>{if(r.length>0&&typeof r[0]=="string"){const n=t.startsWith("rft_")?t:`rft.${t}`;e.append(n,r[0])}},Rp=(e,t,r)=>{e.append(t,r)},kp=(e,t,r)=>{e.append(`rft.${t}`,r)},jo=e=>Ft.includes(e),qo=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>{Array.isArray(n)?wp(t,r,n):typeof n=="string"&&n&&(jo(r)?Rp(t,r,n):kp(t,r,n))}),t},Do=(e,t,r,n)=>{const o=t.getAll(r).filter(i=>!!i).map(i=>i.trim());return o.length===0?e:{...e,[n]:o}},Zo=e=>{const t=Ip(e),r=(o,i)=>{if(i==="au")return Do(o,t,"rft.au","au");if(i==="rft_id")return Do(o,t,"rft_id","rft_id");const s=jo(i)?i:`rft.${i}`,a=t.get(s);return a?{...o,[i]:a.trim()}:o},n=[...xo,...Ft].reduce(r,{});return Object.keys(n).length===0?null:n},Ip=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Cp(e){return typeof e!="string"?!1:Object.values(S).includes(e)}var $e=(e=>(e.CA="CA",e.EUAPAC="EUAPAC",e))($e||{});const Wt=k({id:h(),name:h(),region:Me($e)}),Op=k({tenants:U(Wt)}),Bo=9*1024*1024,Jo=k({url:wl({error:e=>e.input===void 0?'should have the required string property "url"':'"url" must be a string'}),html:h({error:e=>e.input===void 0?'should have the required string property "html"':void 0}).max(Bo,{error:`"html" should be a string with a MAX Length of ${Bo}`}),tenantCode:h({error:e=>e.input===void 0?'should have the required string property "tenantCode"':void 0}).min(1,{error:'"tenantCode" must be a string'}),region:Me([$e.EUAPAC,$e.CA],{error:e=>e.input===void 0?'should have the required string property "region"':'"region" must be a string of EUAPAC or CA'})});function Pp(e){return Jo.safeParse(e).success}const Gt=k({name:h(),region:Me($e),apps:ko(h(),h())}),Uo=ko(h(),Gt),Vo=e=>Gt.safeParse(e).success,Mo=e=>Uo.safeParse(e).success;function Fo(e){return Wt.safeParse(e).success}function Np(e){return typeof e=="string"&&Object.keys($e).includes(e)}const zp=e=>{if(!Mo(e))throw new Error("Error: the customer list data is invalid.");return{tenants:Object.entries(e).map(([r,n])=>Tp(r,n))}},Tp=(e,t)=>{if(!Vo(t))throw new Error(`Invalid customer: ${t}`);const{name:r,region:n}=t,o={id:e,name:r,region:n};if(!Fo(o))throw new Error(`Invalid tenant: ${JSON.stringify(o)}`);return o},Xt=k({parserType:h(),parserName:h().nullable(),referrer:h()}),Ht=k({bookmarkingWorkflowUrl:ht(),resource:ht()}),Yt=k({bookmarkingWorkflowUrl:h(),resource:ht()}),Kt=k({bookmarkingWorkflowUrl:ht(),resource:zo}),Qt=k({z3988SearchResult:X(!0)}),er=k({summonSearchResult:X(!0)}),tr=de([Yt,Ht,Kt,Qt,er]),Wo=k({meta:Xt}).and(tr);function Lp(e){return{bookmarkingWorkflowUrl:e,resource:null}}function L(){return{bookmarkingWorkflowUrl:null,resource:null}}function E(e){return{bookmarkingWorkflowUrl:null,resource:e}}function Go(){return{z3988SearchResult:!0}}function Xo(){return{summonSearchResult:!0}}const xp=e=>{const t=e.getAttribute("title");return t?Zo(t):null},rr=({document:e})=>{const t=Array.from(e.querySelectorAll(".Z3988"));if(t.length===0)return L();const r=t.map(xp).find(n=>n!==null);return r?E(r):L()},jp=e=>{const t=Array.from(e.querySelectorAll(".author > a")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},qp=e=>e.querySelector("#rpi-attribute-book_details-edition > .rpi-attribute-value > span")?.textContent??void 0,Dp=e=>{const t=e.querySelector("#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span")?.textContent??void 0,r=e.querySelector("#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span")?.textContent??void 0;if(t&&r)return`${t},${r}`;if(t)return t;if(r)return r},Zp=e=>e.querySelector("#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span")?.textContent??void 0,Bp=e=>e.querySelector("#rpi-attribute-book_details-publisher > .rpi-attribute-value > span")?.textContent??void 0,Jp=e=>e.querySelector("#rpi-attribute-book_details-series > .rpi-attribute-value > a")?.textContent??void 0,Up=e=>{const t=e.querySelector("#rpi-attribute-book_details-fiona_pages > .rpi-attribute-value > span")?.textContent??void 0;return(t?/\d+/.exec(t)?.[0]:null)??void 0},Vp=({document:e})=>{const t=jp(e),r=qp(e),n=Dp(e),o=Zp(e),i=Bp(e),s=Jp(e),a=e.getElementById("productTitle")?.textContent.trim()??void 0,c=Up(e);return{bookmarkingWorkflowUrl:null,resource:V(S.Book,{au:t,date:o,edition:r,isbn:n,pub:i,series:s,title:a,tpages:c})}},p=(e,t,r)=>{const n=Q(e,t,r);return n.length>0?n[0]:void 0},Q=(e,t,r)=>Array.from(e.querySelectorAll(`meta[${t}='${r}']`)).map(n=>n.getAttribute("content")).filter(n=>!!n?.trim()),Ho=e=>{const t=new Map,r=e.split(";").filter(n=>!!n);for(const n of r){const[o,i,s]=n.split(":");t.set(o,{type:i,value:s})}return t};var b=(e=>(e[e.None=0]="None",e[e.Book=1]="Book",e[e.Chapter=2]="Chapter",e[e.Journal=3]="Journal",e[e.Article=4]="Article",e[e.AudioVisual=5]="AudioVisual",e[e.Webpage=6]="Webpage",e[e.Document=7]="Document",e))(b||{});const Mp=e=>{if(!e)return;const t=/\b\d{4}\b/.exec(e);return t?t[0]:void 0},Fe=e=>{const t=e.querySelector("#publication_date p")?.textContent.trim()??p(e,"name","bepress_citation_date");return Mp(t)},Fp=e=>{const t=p(e,"name","bepress_citation_firstpage"),r=p(e,"name","bepress_citation_lastpage");return{spage:t,epage:r}},nr=e=>{const t=/https?:\/\/doi\.org\/(.+)/i,n=e.querySelector("#source p")?.textContent.trim()?.match(t);if(n?.length===2)return n[1];const i=e.querySelector("#recommended_citation p a")?.textContent.trim()?.match(t);if(i?.length===2)return i[1]},Wp=e=>{const t=[],r=e.querySelectorAll("tbody td");for(const n of r){const o=n.querySelector("strong");if(o&&!o.querySelector("a")){const i=o.textContent.trim();i&&t.push(i)}}return t},We=e=>p(e,"name","bepress_citation_title")??e.querySelector("title")?.textContent.trim(),mt=e=>Q(e,"name","author"),gt=e=>p(e,"name","bepress_citation_publisher"),or=e=>p(e,"name","bepress_citation_pdf_url"),Gp=(e,t)=>{if(t.includes("/etd/"))return b.Document;if(t.includes("/sophpm_music/")||t.includes("/streaming/"))return b.AudioVisual;if(t.includes("/vol"))return b.Article;if(t.includes("/facpub")||t.includes("/studentpub/")){const r={"book chapter":b.Book,"conference paper":b.Book,"peer-reviewed article":b.Article,other:b.Document},n=e.querySelector("#document_type p")?.textContent.toLowerCase().trim();return n?r[n]:void 0}return b.Journal},Xp=e=>{const t=We(e),r=mt(e),n=Fe(e),o=p(e,"name","bepress_citation_journal_title"),i=p(e,"name","bepress_citation_volume"),s=p(e,"name","bepress_citation_issue"),{epage:a,spage:c}=Fp(e),u=or(e),l=nr(e);return q(S.Article,{atitle:t,jtitle:o,au:r,date:n,volume:i,issue:s,epage:a,spage:c,doi:l,uri:u})},Hp=(e,t)=>{const r=e.querySelector(".inherit-title a")?.textContent.trim()??We(e),n=Wp(e),o=Fe(e),i=gt(e),s=nr(e);return q(S.Journal,{jtitle:r,au:n,date:o,pub:i,doi:s,uri:t})},Yp=e=>{const t=We(e),r=mt(e),n=Fe(e),o=gt(e),i=or(e),s=e.querySelector("#document_type p")?.textContent.toLowerCase().trim();if(s==="book chapter"){const c=e.querySelector("#source p")?.textContent.trim();return V(S.Bookitem,{pub:o,atitle:t,btitle:c,au:r,date:n,uri:i})}const a=nr(e);return s==="conference paper"?V(S.Conference,{pub:o,title:t,au:r,date:n,doi:a,uri:i}):V(S.Document,{pub:o,title:t,au:r,date:n,doi:a,uri:i})},Kp=(e,t)=>{const r=We(e),n=mt(e),o=Fe(e),i=gt(e);return ge({title:r,au:n,date:o,pub:i,uri:t})},Qp=e=>{const t=We(e),r=mt(e),n=Fe(e),o=gt(e),i=or(e);return Mt({pub:o,title:t,au:r,date:n,uri:i})},ef=({url:e,document:t})=>{switch(Gp(t,e)){case b.Article:return E(Xp(t));case b.Journal:return E(Hp(t,e));case b.Book:return E(Yp(t));case b.AudioVisual:return E(Kp(t,e));case b.Document:return E(Qp(t));default:return L()}},be=e=>{if(e)return e.replace(/[^0-9]/g,"")},Yo=e=>Array.from(e.querySelectorAll(".author-source-list li a")).filter(t=>t.childNodes.length>0).map(t=>t.childNodes[0].textContent?.trim()).filter(t=>!!t),Ko=e=>e.querySelector(".article-header")?.querySelector("h1 span")?.textContent.trim(),Qo=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:"Elsevier Inc."}),tf=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".issue")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,[o,i]=(r?.split(",")??[]).map(s=>s.trim());return{volume:be(o),issue:be(i),jtitle:n}},rf=e=>{const t=e.querySelector(".article-header .source")?.textContent,r=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],n=t?.match(/Pages (\d+-\d+)/),[o,i]=(n?.[1].split("-")??[]).map(u=>u.trim()),{jtitle:s,volume:a,issue:c}=tf(e);return E(q(S.Article,{au:Yo(e),atitle:Ko(e),spage:o,epage:i,date:r,jtitle:s,volume:a,issue:c}))},nf=e=>{const[t,r]=e.querySelectorAll(".source"),{date:n,pub:o}=Qo(r),i=e.querySelector(".browse__book-toc"),[s,a]=(i?.querySelector("h1")?.textContent.split(",")??[]).map(c=>c.trim());return E(V(S.Book,{btitle:s,edition:a,pub:o,au:t.textContent?[t.textContent]:void 0,date:n}))},of=e=>{const t=e.querySelector(".article-meta");if(!t)return{};const r=t.querySelector(".edition")?.textContent??void 0,n=t.querySelector(".title")?.textContent.trim()??void 0,o=t.querySelector(".copyright"),{date:i,pub:s}=Qo(o);return{edition:r,btitle:n,date:i,pub:s}},sf=e=>{const{edition:t,btitle:r,date:n,pub:o}=of(e),i=e.querySelector(".article-header .source")?.textContent,s=/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i,a=i?.match(s),[c,u]=(a?.[1].split("-")??[]).map(l=>l.trim());return E(V(S.Bookitem,{au:Yo(e),atitle:Ko(e),btitle:r,edition:t,pub:o,date:n,spage:c,epage:u}))},af=/^[0-9X]$/,sr=e=>{if(!e)return;let t="";for(const r of e)af.test(r)&&(t+=r);if(t)return t},cf=(e,t)=>{const r=e.querySelector(".c-cksc-content-header__title")?.textContent.trim(),n=e.querySelector(".c-cksc-content-nice__button")?.textContent.trim(),o=e.querySelector(".c-cksc-content-nice__date")?.textContent.trim(),i=e.evaluate('//p[contains(text(), "ISBN")]',e,null,XPathResult.ANY_TYPE),s=sr(i.iterateNext()?.textContent);return E({genre:S.Document,title:r,pub:n,date:o,uri:t,isbn:s})},es=e=>e.querySelector(".browse-toc")??e.querySelector(".browse__journal"),uf=e=>es(e)?.querySelector("h1")?.firstElementChild?.textContent.trim(),lf=e=>{const t=es(e),r=t?.querySelector("figure figcaption.source");if(r){const[a,c,u]=r.textContent.split(",").map(l=>l.trim());return{date:a,volume:be(c),issue:be(u)}}const n=t?.querySelector("p")?.textContent,[o,i]=n?.split(",")??[];return{date:t?.querySelector(".source span")?.textContent??void 0,volume:be(o),issue:be(i)}},pf=e=>{const{date:t,volume:r,issue:n}=lf(e);return E(q(S.Journal,{jtitle:uf(e),date:t,volume:r,issue:n}))};var ts=(e=>(e.Book="Book",e.Chapter="Book Chapter",e.Article="Full Text Article",e.Journal="Journal",e.Guideline="Guideline",e))(ts||{});const ff=e=>Object.values(ts).includes(e),hf=(e,t)=>{const r=e.querySelector(".content-type")??e.querySelector(".c-cksc-content-header__content-type");if(!r)return t.includes("journal")?"Journal":void 0;const n=r.textContent;if(n&&ff(n))return n},df=({url:e,document:t})=>{switch(hf(t,e)){case"Book":return nf(t);case"Book Chapter":return sf(t);case"Full Text Article":return rf(t);case"Journal":return pf(t);case"Guideline":return cf(t,e);case void 0:return L()}},Ce=k({"@context":h()}),mf=e=>Ce.safeParse(e).success,rs='script[type="application/ld+json"]',ns=e=>Array.from(e.querySelectorAll(rs)),vt=e=>e.querySelector(rs),Ge=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(mf(r))return r}catch{return null}return null},gf=k({"@id":h(),"@type":h(),author:k({"@id":h()}).optional(),datePublished:h().optional(),dateModified:h().optional(),description:h().optional(),inLanguage:h().optional(),isPartOf:k({"@id":h()}).optional(),name:h().optional(),url:h().optional()}),vf=Ce.extend({"@graph":U(gf)}),bf=e=>vf.safeParse(e).success,yf=e=>{const t=ns(e);if(t.length===0)return null;const r=t.map(Ge).filter(bf).map(n=>n["@graph"]);return r.length!==1?null:r[0]},_f=(e,t)=>e.find(r=>r["@type"]===t)??null,Sf=(e,t)=>e.find(r=>r["@id"]===t)??null,Ef=e=>{const t=_f(e,"WebPage");if(!t)return null;const r=t.author?Sf(e,t.author["@id"]):void 0;return dt({au:r?.name?[r.name]:void 0,date:t.datePublished,title:t.name})},$f=({document:e})=>{const t=yf(e);return t?{bookmarkingWorkflowUrl:null,resource:Ef(t)}:L()},os=()=>L(),Af=e=>{const{pathname:t}=new URL(e);return t.startsWith("/toc/")?"journal":t.startsWith("/article/")?"article":void 0},wf=e=>{const t=e.querySelector("header h1 span")?.firstChild?.textContent?.trim(),r=e.querySelector("header p span")?.textContent.trim(),n=/\d{4}-\d{3}[\dX]/g,o=r?.match(n)??[],[i,s]=[o[0],o[1]],a=e.evaluate('//dt[contains(text(), "Publisher")]/following-sibling::dd/a',e,null,XPathResult.STRING_TYPE).stringValue.trim();return E(q(S.Journal,{pub:a,jtitle:t,issn:i,eissn:s}))},Rf=e=>{let t,r;const n=Q(e,"name","citation_issn");return n.length===2?(t=n[1],r=n[0]):t=n[0],{eissn:t,issn:r}},kf=e=>{const t=p(e,"name","citation_journal_title"),r=p(e,"name","citation_title"),n=Q(e,"name","citation_author"),o=p(e,"name","citation_doi"),{eissn:i,issn:s}=Rf(e),a=p(e,"name","citation_publisher"),c=p(e,"name","citation_publication_date"),u=p(e,"name","citation_volume"),l=p(e,"name","citation_issue"),f=p(e,"name","citation_firstpage"),d=p(e,"name","citation_lastpage");return E(q(S.Article,{jtitle:t,atitle:r,au:n,doi:o,eissn:i,issn:s,pub:a,date:c,volume:u,issue:l,spage:f,epage:d}))},If=({document:e,url:t})=>{switch(Af(t)){case"journal":return wf(e);case"article":return kf(e);case void 0:return L()}},Cf=e=>{const t=p(e,"name","pbContext");if(!t)return b.None;const r=Ho(t);switch(r.has("page")?r.get("page")?.value:null){case"Article/Chapter View":return b.Article;case"Table of Contents":return b.Journal;default:return b.None}},Of=e=>{const t=e.querySelector('meta[property="article:author"]')?.getAttribute("content")?.split(",").map(r=>r.trim());return t&&t.length>0?t:void 0},ss=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".rlist>li>span")).map(i=>i.textContent.trim()).join(""),n=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);n&&t.set("issn",n[1]);const o=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(r);return o&&t.set("eissn",o[1]),t},Pf=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]')?.textContent??void 0,Nf=e=>e.querySelector('span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]')?.textContent??void 0,zf=e=>e.querySelector('meta[name="dc.Identifier"][scheme="doi"]')?.getAttribute("content")??void 0,Tf=e=>e.querySelector("h1")?.textContent??void 0,Lf=e=>{const t=new Map,r=e.querySelector("h2.heading-m")?.textContent,n=r?.match(/Issue\s+(\d+(?:-\d+)?)/);n&&t.set("issue",n[1]);const o=r?.match(/Volume\s+(\d+)/);o&&t.set("volume",o[1]);const i=r?.match(/(\d{4})$/);return i&&t.set("date",i[1]),t},xf=e=>{const t=Of(e.document),r=p(e.document,"name","dc.Date"),n=zf(e.document),o=ss(e.document),i=o.get("issn"),s=o.get("eissn"),a=Nf(e.document),c=p(e.document,"name","citation_journal_title"),u=p(e.document,"name","dc.Publisher"),l=p(e.document,"name","dc.Title"),f=Pf(e.document);return q(S.Article,{au:t,date:r,eissn:s,issn:i,issue:a,jtitle:c,pub:u,title:l,volume:f,doi:n})},jf=e=>{const t=ss(e.document),r=t.get("issn"),n=t.get("eissn"),o=Tf(e.document),i=Lf(e.document),s=i.get("issue"),a=i.get("volume"),c=i.get("date");return q(S.Journal,{eissn:n,issn:r,jtitle:o,title:o,issue:s,volume:a,date:c})},qf=e=>{switch(Cf(e.document)){case b.Article:return E(xf(e));case b.Journal:return E(jf(e));default:return L()}},Df=e=>{const t=p(e,"name","citation_type"),r=p(e,"name","citation_article_type");return t==="JOUR"&&r?b.Article:t==="CHP"?b.Chapter:e.querySelector(".book-edition-year")?.textContent.includes("Book")?b.Book:e.getElementById("journal-title")?b.Journal:b.None},ir=e=>p(e,"name","citation_doi")??p(e,"name","dc.identifier")??e.querySelector(".doi .anchor-text")?.textContent??void 0,Zf=e=>{const t=Array.from(e.querySelectorAll(".kf-details .kf-detail-item:has(h3)")),r=new Map;for(const n of t){const o=n.querySelector("h3")?.textContent,i=n.querySelector("p")?.textContent;o&&i&&r.set(o,i)}return r},ar=(e,t)=>{const r=Array.from(e.querySelectorAll(t)).map(n=>n.textContent).filter(n=>!!n);return r.length>0?r:void 0},Bf=e=>{const t=e.querySelector(".js-issn")?.textContent;if(t)return t.replace("Online ISSN: ","")},Jf=e=>{const t=e.get("DOI");if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},Uf=e=>{const t=Zf(e),r=p(e,"property","og:title"),n=p(e,"property","og:book:isbn"),o=t.get("Published"),i=ar(e,".authors-container .author-detail h3"),s=ir(e)??Jf(t);return V(S.Book,{au:i,date:o,doi:s,isbn:n,title:r})},Vf=e=>{const t=p(e,"property","og:title"),r=p(e,"property","og:book:isbn"),n=p(e,"name","citation_publication_date"),o=ar(e,".author-group .button-link-text"),i=p(e,"name","citation_firstpage"),s=p(e,"name","citation_lastpage"),a=p(e,"name","citation_publisher"),c=ir(e),u=p(e,"name","citation_inbook_title")??e.querySelector(".publication-title")?.textContent??void 0;return V(S.Bookitem,{au:o,btitle:u,date:n,doi:c,epage:s,isbn:r,pub:a,spage:i,title:t})},Mf=e=>{const t=p(e,"property","og:title"),r=p(e,"name","citation_issn"),n=p(e,"name","citation_publication_date"),o=ar(e,".author-group .button-link-text"),i=p(e,"name","citation_publisher"),s=p(e,"name","citation_firstpage"),a=p(e,"name","citation_issue"),c=p(e,"name","citation_volume"),u=ir(e),l=p(e,"name","citation_journal_title")??e.querySelector(".publication-title")?.textContent??void 0;return q(S.Article,{au:o,jtitle:l,date:n,doi:u,issn:r,issue:a,pub:i,spage:s,title:t,volume:c})},Ff=e=>{const t=e.getElementById("journal-title")?.textContent??void 0,r=Bf(e);return q(S.Journal,{issn:r,title:t})},Wf=({document:e})=>{switch(Df(e)){case b.Book:return E(Uf(e));case b.Chapter:return E(Vf(e));case b.Article:return E(Mf(e));case b.Journal:return E(Ff(e));default:return L()}},Gf=e=>{const t=p(e,"name","pbContext");return t&&Ho(t).has("article")?b.Article:b.Journal},Xf=e=>{const t=e.querySelector(".itemPageRangeHistory");if(!t)return;const n=Array.from(t.childNodes).find(o=>o.textContent?.trim().startsWith("Page"));if(n)return n.textContent?.replace(/Pages?/,"").trim()??void 0},Hf=e=>{const t=e.querySelector(".issue-heading")?.textContent;return t?t.split(",")[0]?.replace("Volume","").trim():void 0},Yf=e=>{const t=e.querySelector(".issue-heading .nav-toc-list")?.textContent;return t?t.replace("Issue","").trim():void 0},Kf=e=>{const t=p(e,"property","og:title"),r=p(e,"name","dc.Publisher"),n=p(e,"name","dc.Date"),o=p(e,"name","publication_doi"),i=p(e,"name","citation_journal_title"),s=Q(e,"name","dc.Creator"),a=Hf(e),c=Yf(e),u=Xf(e),l=u?.includes("-")?u.split("-")[0]:u,f=u?.includes("-")?u.split("-")[1]:u;return q(S.Article,{au:s,jtitle:i,date:n,doi:o,issue:c,pub:r,spage:l,epage:f,title:t,volume:a})},Qf=e=>{const t=p(e,"property","og:title"),r=p(e,"name","publication_doi");return q(S.Journal,{doi:r,title:t})},eh=({document:e})=>{switch(Gf(e)){case b.Article:return E(Kf(e));case b.Journal:return E(Qf(e));default:return L()}},th=e=>tr.safeParse(e).success,rh=e=>Wo.safeParse(e).success,nh=e=>Xt.safeParse(e).success;function oh(e){return Yt.safeParse(e).success}function bt(e){return Kt.safeParse(e).success}function is(e){return Qt.safeParse(e).success}function as(e){return er.safeParse(e).success}function sh(e){return Ht.safeParse(e).success}const ih=e=>Array.from(e.querySelectorAll("tr th")).find(n=>n.textContent.trim()==="DOI:")?.nextElementSibling?.querySelector('span[property="identifier"]')?.textContent??void 0,ah=e=>{const t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},ch=e=>{const{url:t,document:r}=e,n=rr(e);if(!bt(n))return n;const o=ih(r);return o&&(n.resource.rft_id=[`info:doi/${o}`]),n.resource.bibid=ah(t),n},uh=Ce.extend({"@type":X("VideoObject"),name:h(),author:h(),genre:h(),description:h(),uploadDate:h(),duration:h(),thumbnailUrl:U(h())}),lh=e=>uh.safeParse(e).success,ph=e=>{const t=ns(e);if(t.length===0)return null;const r=t.map(Ge).filter(lh);return r.length!==1?null:r[0]},fh=({url:e,document:t})=>{const r=ph(t);return r?{bookmarkingWorkflowUrl:null,resource:ge({au:[r.author],date:r.uploadDate,title:r.name,uri:e})}:L()},cs=e=>p(e,"name","doi")??p(e,"name","DOI")??p(e,"name","citation_doi")??p(e,"name","dc.identifier")??p(e,"name","prism.doi")??void 0,us=e=>{const t=e.editor?.map(o=>o.name)??[],n=[...e.author?.map(o=>o.name)??[],...t];if(n.length!==0)return n};var Xe=(e=>(e.Book="Book",e.Journal="Journal",e.Periodical="Periodical",e.PublicationVolume="PublicationVolume",e.ScholarlyArticle="ScholarlyArticle",e.VideoObject="VideoObject",e.WebPage="WebPage",e))(Xe||{}),Ae=(e=>(e.Article="article",e.Book="book",e.Paper="Paper",e.Video="video.other",e.Website="website",e))(Ae||{}),pe=(e=>(e.Article="/article/",e.Book="/book/",e.Chapter="/chapter/",e.Video="/video/",e.ReferenceWorkEntry="/referenceworkentry/",e.ReferenceWork="/referencework/",e.Protocol="/protocol/",e.Collections="/collections/",e.Journal="/journal/",e.JournalIssue="/volumes-and-issues/",e))(pe||{});const ls=k({"@type":X(Xe.ScholarlyArticle),author:U(k({"@type":h(),name:h()})).optional(),editor:U(k({"@type":h(),name:h()})).optional(),datePublished:h().optional(),headline:h().optional(),issn:U(h()).optional(),pageStart:h().optional(),pageEnd:h().optional(),isPartOf:k({"@type":de([h(),U(h())]),name:h(),issn:U(h()).optional(),volumeNumber:h().optional(),isbn:U(h()).optional()}),publisher:k({"@type":h(),name:h()}).optional()}),ps=e=>ls.safeParse(e).success,hh=Ce.extend({"@type":X(Xe.WebPage),mainEntity:ls}),dh=e=>hh.safeParse(e).success,mh=k({"@type":U(h()),name:h().optional(),issn:U(h()),volumeNumber:h().optional()}),fs=e=>mh.safeParse(e).success,gh=(e,t)=>p(e,"name","citation_issn")??p(e,"name","prism.issn")??(ps(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),hs=(e,t)=>{const r=us(t),n=p(e,"name","citation_online_date"),o=cs(e),i=p(e,"name","citation_issue"),s=gh(e,t),a=fs(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,u=t.pageEnd,l=t.headline,f=t.isPartOf.name,d=fs(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return q(S.Article,{au:r,date:n,doi:o,issue:i,eissn:s,issn:a,spage:c,epage:u,atitle:l,jtitle:f,volume:d})},vh=Ce.extend({"@type":X(Xe.Book),copyrightYear:h().optional(),author:U(k({"@type":h(),name:h()})).optional(),editor:U(k({"@type":h(),name:h()})).optional(),isbn:h().optional(),name:h().optional(),numberOfPages:Ao().optional(),publisher:k({"@type":h(),name:h()}).optional()}),bh=e=>vh.safeParse(e).success,yh=e=>{const t=e.querySelectorAll(".c-bibliographic-information__list-item"),r=new Map;return t.forEach(n=>{const o=n.querySelector(".u-text-bold")?.textContent.trim(),i=n.querySelector(".c-bibliographic-information__value")?.textContent.trim();o&&i&&r.set(o,i)}),r},_h=(e,t)=>{const r=yh(e),n=us(t),o=t.copyrightYear?.toString(),i=cs(e)??r.get("DOI"),s=t.name??r.get("Book Title"),a=t.isbn??r.get("Softcover ISBN"),c=t.numberOfPages?.toString()??r.get("Number of Pages"),u=t.publisher?.name??r.get("Publisher");return V(S.Book,{au:n,date:o,doi:i,title:s,isbn:a,tpages:c,pub:u})},Sh=k({"@type":X("Periodical"),name:h(),url:h(),issn:U(h()),editor:U(k({givenName:h(),familyName:h()})),publisher:k({name:h()}),description:h()}),Eh=e=>Sh.safeParse(e).success,$h=e=>{const t=e.editor.map(({givenName:s,familyName:a})=>`${s} ${a}`),r=e.name,[n,o]=e.issn,i=e.publisher.name;return q(S.Journal,{au:t,jtitle:r,eissn:n,issn:o,pub:i})},Ah=k({"@type":X(Xe.VideoObject),name:h().optional(),description:h().optional(),thumbnailUrl:h().optional(),uploadDate:h().optional(),contentUrl:h().optional(),duration:h().optional()}),wh=e=>Ah.safeParse(e).success,Rh=(e,t)=>{const r=Array.from(e.querySelectorAll('dd[data-test="video-segment-author"]')).map(s=>s.textContent.trim()).filter(s=>!!s),n=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,o=t?.name??p(e,"property","og:title")??void 0,i=e.querySelector("video-about-doi")?.textContent??void 0;return ge({au:r.length>0?r:void 0,date:n,doi:i,title:o})},kh=e=>{const t=p(e,"property","og:title");return dt({title:t})},Ih=(e,t)=>{const r=p(t,"property","og:type");return r===Ae.Article&&e.includes(pe.Article)?b.Article:r===Ae.Book&&(e.includes(pe.Book)||e.includes(pe.ReferenceWork))?b.Book:r===Ae.Paper&&e.includes(pe.Chapter)?b.Chapter:r===Ae.Paper&&(e.includes(pe.ReferenceWorkEntry)||e.includes(pe.Protocol))?b.Article:r===Ae.Video&&e.includes(pe.Video)?b.AudioVisual:r===Ae.Website&&(e.includes(pe.Collections)||e.includes(pe.JournalIssue))?b.Webpage:r===Ae.Website&&e.includes(pe.Journal)?b.Journal:b.None},Ch=(e,t,r)=>e===b.AudioVisual&&wh(r)?E(Rh(t,r)):e===b.Book&&bh(r)?E(_h(t,r)):(e===b.Chapter||e===b.Article)&&ps(r)?E(hs(t,r)):e===b.Article&&dh(r)?E(hs(t,r.mainEntity)):e===b.Journal&&Eh(r)?E($h(r)):L(),Oh=({url:e,document:t})=>{const r=Ih(e,t);if(r===b.Webpage)return E(kh(t));const n=vt(t);if(!n)return L();const o=Ge(n);return o?Ch(r,t,o):L()},Ph=new Set(["Print ISBN","Online ISBN","DOI","First published","Online ISSN","Print ISSN"]),Nh=k({content:k({item:k({title:h(),"published-date":h()}),group:k({volume:h(),issue:h()}),series:k({title:h(),type:h(),eissn:h()})}).optional()}),ds=(e,t)=>{if(!e)return;const r=e.indexOf(t);return r>-1?e.substring(0,r):e},cr=e=>{const r=/\d+/.exec(e);if(r?.[0])return r[0]},zh=e=>{const t=e.querySelectorAll("script"),n=Array.from(t).find(o=>o.textContent.includes("adobeDataLayerJson"))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(n?.length===2)try{const o=JSON.parse(n[1]);return Nh.parse(o)}catch{return}},Th=(e,t)=>{const r=p(e,"property","og:type"),n=t.includes("epdf");return r==="Book"||r==="books.book"?b.Book:r==="Chapter"?b.Chapter:r==="Journal"?b.Journal:r==="Article"||n?b.Article:b.None},yt=e=>{const t=Q(e,"name","citation_author"),r=Array.from(e.querySelectorAll("#product-details-content .product-authors")).map(o=>o.textContent).filter(o=>!!o),n=new Set([...t,...r]);return n.size>0?[...n]:void 0},Lh=e=>{const t=Array.from(e.querySelectorAll("#product-details-content .text-piped p")).map(r=>r.textContent).find(r=>r.endsWith(" pages"));if(t)return cr(t)},_t=e=>{const t=new Map,r=Array.from(e.querySelectorAll(".journal-info-container .info-block")).flatMap(n=>Array.from(n.querySelectorAll(".info_label")));for(const n of r){const o=n.nextElementSibling;if(!o?.classList.contains("info_value"))continue;const i=ds(n.textContent,":"),s=ds(o.textContent,":");!i||!s||Ph.has(i)&&t.set(i,s)}return t},St=(e,t)=>p(e,"property","books:release_date")??p(e,"name","citation_online_date")??t.get("First published")??void 0,ur=(e,t)=>p(e,"name","dc.identifier")??p(e,"name","citation_doi")??p(e,"name","publication_doi")??t.get("DOI")??void 0,ms=(e,t)=>{const r=new Set([p(e,"property","books:isbn"),t.get("Print ISBN"),t.get("Online ISBN")].filter(n=>!!n));return r.size>0?[...r].join(","):void 0},xh=e=>{let t,r;const n=e.querySelector(".cover-image__details div:first-of-type");if(n?.childNodes.length===2){const[o,i]=n.childNodes;o.textContent&&(t=cr(o.textContent)),i.textContent&&(r=cr(i.textContent))}return{volume:t,issue:r}},jh=e=>{const r=Array.from(e.querySelectorAll(".authors .author")).map(n=>n.textContent.trim().replace(",","")).filter(n=>!!n);return r.length>0?r:void 0},qh=e=>{const t=Array.from(e.querySelectorAll(".details-section .details-entry")),r=t.find(s=>s.querySelector(".details-label")?.textContent.trim()==="ISSN"),n=t.find(s=>s.querySelector(".details-label")?.textContent.trim()==="eISSN");let o,i;return r&&(o=r.querySelector(".details-value")?.textContent.trim()),n&&(i=n.querySelector(".details-value")?.textContent.trim()),{issn:o,eissn:i}},Dh=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};const t=e.content.group.volume,r=e.content.group.issue;return r==="0"&&t==="0"?{volume:void 0,issue:void 0}:{volume:t,issue:r}},Zh=e=>{const n=Array.from(e.querySelectorAll(".details-section .details-entry")).find(s=>s.querySelector(".details-label")?.textContent.trim()==="Pages")?.querySelector(".details-value")?.textContent.trim(),[o,i]=(n?.split("-")??[void 0,void 0]).map(s=>s?.trim());return o?.toLowerCase()==="n/a"&&i?.toLowerCase()==="n/a"?{spage:void 0,epage:void 0}:{spage:o,epage:i}},Bh=e=>{const t=_t(e),r=yt(e),n=p(e,"property","og:title"),o=St(e,t),i=ur(e,t),s=ms(e,t),a=Lh(e);return V(S.Book,{au:r,date:o,doi:i,isbn:s,pages:a,title:n})},Jh=e=>{const t=_t(e),r=yt(e),n=p(e,"name","citation_book_title"),o=St(e,t),i=ur(e,t),s=ms(e,t),a=p(e,"name","citation_publisher"),c=p(e,"property","og:title");return V(S.Bookitem,{au:r,btitle:n,date:o,doi:i,isbn:s,pub:a,title:c})},Uh=e=>{const t=_t(e),r=yt(e),n=St(e,t),o=t.get("Online ISSN"),i=t.get("Print ISSN"),s=p(e,"property","og:title"),{volume:a,issue:c}=xh(e);return q(S.Journal,{au:r,date:n,eissn:o,issn:i,issue:c,title:s,volume:a})},Vh=e=>{const t=_t(e),r=zh(e),n=yt(e)??jh(e),o=St(e,t)??r?.content?.item["published-date"],i=ur(e,t),{issn:s,eissn:a}=qh(e),{volume:c,issue:u}=Dh(r),l=p(e,"property","og:title")??r?.content?.item.title,f=p(e,"name","citation_journal_title")??r?.content?.series.title,{spage:d,epage:g}=Zh(e);return q(S.Article,{au:n,date:o,doi:i,eissn:a,issn:s??p(e,"name","citation_issn"),issue:u,jtitle:f,title:l,volume:c,spage:d,epage:g})},Mh=({document:e,url:t})=>{switch(Th(e,t)){case b.Book:return E(Bh(e));case b.Chapter:return E(Jh(e));case b.Journal:return E(Uh(e));case b.Article:return E(Vh(e));default:return L()}},Fh=e=>{const t=Q(e,"name","citation_author");return t.length>0?t:void 0},Wh=({document:e})=>{const t=Fh(e),r=p(e,"name","citation_publication_date"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_isbn"),i=p(e,"name","citation_publisher"),s=p(e,"name","citation_title")??e.title,a=ge({au:t,date:r,doi:n,isbn:o,pub:i,title:s});return E(a)},Gh=({document:e})=>Array.from(e.querySelectorAll(".Z3988")).length<=1?L():Go(),Et=e=>{if(!(!e||e.length===0))return e[0]};function lr(e,t){const r=t.map(n=>{const o=e.querySelector(n)?.textContent??null;if(o&&o.trim()!=="")return o}).filter(n=>n);return Et(r)??null}function Xh(e,t){const r=t.flatMap(n=>Array.from(e.querySelectorAll(n)).flatMap(i=>{const s=i.textContent;return s&&s.trim()!==""?s.split(";").map(a=>a.trim()).filter(a=>a.length>0):[]}));return r.length>0?r:null}const He=(e,t)=>lr(e,[t])?.trim(),Hh=e=>{const t=e.querySelector(".content-meta-data__authors")?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(r=>!!r)},Yh=e=>{const t=Array.from(e.querySelectorAll('.tombstone-metadata [data-qa="item-authors"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Kh=e=>{const t=Array.from(e.querySelectorAll('.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]')).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Qh=e=>{const t=Array.from(e.querySelectorAll(".contrib-type-author .name")).map(r=>r.textContent).filter(r=>!!r);return t.length?t:void 0},Oe=e=>{const t=new Set([...Kh(e)??[],...Hh(e)??[],...Qh(e)??[],...Yh(e)??[]]);return t.size?[...t]:void 0},Pe=(e,t)=>e.querySelector('[data-qa="published-date"]')?.textContent??e.querySelector(".summary-image")?.textContent??De(t?.get("date"))??De(t?.get("copyright date"))??De(t?.get("published date")),gs=e=>{const t=e.find(r=>r.startsWith("https://doi.org/"));if(t)return t.replace("https://doi.org/","")},vs=e=>{const t=e.get("local identifier");if(t?.length)return gs(t)},ed=e=>e.querySelector(".doi")?.getAttribute("href")??void 0,De=e=>{if(e?.length)return e[0]},Ne=e=>{const t=new Map;return Array.from(e.querySelectorAll(".metadata-element, .metadata")).map(r=>{const o=r.querySelector(".metadata-label")?.textContent.trim().toLowerCase(),i=Array.from(r.querySelectorAll(".metadata-value")).map(s=>s.textContent).filter(s=>!!s);return{name:o,values:i}}).forEach(({name:r,values:n})=>{!r||!n.length||t.set(r,n)}),t},bs=e=>{const t=Ne(e),r=e.querySelector(".summary-journal"),n=Array.from(r?.childNodes??[]),o=n[0]?.textContent??e.querySelector(".journal-link")?.textContent??void 0,i=n[2]?.textContent?.replace(/Published By:\s+?/i,"")??De(t.get("publisher"))??e.querySelector(".publisher-link")?.textContent??void 0;return{pub:i&&i.trim()!==""?i:void 0,jtitle:o&&o.trim()!==""?o:void 0}},td=e=>{const t=lr(e,['[data-qa="journal"]:first-child cite','[data-qa="copyright-statement"] > cite','[data-qa="collection-links"] mfe-content-details-pharos-link']);return t&&t.trim()!==""?t:void 0},$t=e=>be(e.querySelector('[data-qa="page-count"]')?.textContent),Ye=(e,t)=>e.querySelector(".publisher-link")?.textContent??De(t?.get("publisher")),we=e=>e.querySelector('[data-qa="item-title"]')?.textContent.trim()??e.querySelector("mfe-turnaway-pharos-heading")?.textContent.trim()??e.querySelector(".metadata mfe-toc-pharos-heading")?.textContent.trim()??e.querySelector(".journal_header-title")?.textContent.trim()??void 0,Re=e=>{if(!URL.canParse(e))return;const t=new URL(e);return t.origin+t.pathname},rd=e=>{const t=e.querySelector(".ccda-container > :first-child");let r,n;if(t?.textContent.includes("Volume")||t?.textContent.includes("Issue")){const o=t.textContent.trim().split(/,\s+/);for(const i of o)i.startsWith("Volume")?n=be(i):i.startsWith("Issue")&&(r=be(i))}return{issue:r,volume:n}},nd=e=>{const t=e.querySelector('[data-qa="item-src-info"]')?.textContent??p(e,"property","og:description")??p(e,"name","description");if(!t)return{};const r=/Vol\.\s*(\d+)/.exec(t),n=r?r[1]:void 0,o=/No\.\s*(\d+)/.exec(t),i=o?o[1]:void 0,s=/pp\.\s*(\d+)-(\d+)/.exec(t),a=s?s[1]:void 0,c=s?s[2]:void 0,u=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t),l=u?u[1]:void 0;return{issue:i,volume:n,spage:a,epage:c,pages:l}},od=e=>{const t=lr(e,["mfe-turnaway-pharos-link",'[data-qa="item-src-info"]']);if(!t)return;const n=/\(.+\)/.exec(t)?.map(o=>{const i=/\d{4}/.exec(o);return i?i[0]:void 0});return Et(n)},sd=(e,t)=>{const r=we(e),n=Oe(e),o=Pe(e)??od(e),i=bs(e),s=i.jtitle??td(e)??void 0,a=i.pub,c=rd(e),u=nd(e),l=c.issue??u.issue,f=c.volume??u.volume,d=$t(e)??u.pages,g=u.spage,I=u.epage,v=Re(t),P=gs(Array.from(e.querySelector(".content-meta-data-stables")?.childNodes??[]).map(D=>D.textContent??""))??ed(e);return q(S.Article,{atitle:r,au:n,date:o,doi:P,epage:I,issue:l,jtitle:s,pages:d,pub:a,spage:g,uri:v,volume:f})},id=(e,t)=>{const r=Ne(e),n=Oe(e),o=Pe(e,r),i=we(e),s=Ye(e,r),a=Re(t);return ge({au:n,date:o,pub:s,title:i,uri:a})},ad=(e,t)=>{const r=Ne(e),n=Oe(e),o=we(e),i=Pe(e),s=$t(e),a=Ye(e,r),c=Re(t),u=vs(r);return V(S.Book,{au:n,date:i,doi:u,pages:s,pub:a,title:o,uri:c})},cd=(e,t)=>{const r=Ne(e),n=Oe(e),o=we(e),i=e.querySelector(".book-title-link")?.textContent??void 0,s=Pe(e,r),a=Array.from(e.querySelectorAll('[data-qa="book"] > span')).map(d=>d.textContent),c=$t(e),u=a.find(d=>d.includes("pp."))?.match(/(\d+)-(\d+)/)??void 0,l=Ye(e,r),f=Re(t);return V(S.Bookitem,{atitle:o,au:n,btitle:i,date:s,epage:u?.[2],pub:l,pages:c,spage:u?.[1],uri:f})},ud=(e,t)=>{const r=Ne(e),n=Oe(e),o=we(e),i=Pe(e),s=$t(e),a=Ye(e,r),c=Re(t),u=vs(r);return V(S.Document,{au:n,date:i,doi:u,pages:s,pub:a,title:o,uri:c})},ld=(e,t)=>{const r=Ne(e),n=Oe(e),o=Pe(e,r),i=we(e),s=Re(t);return To({au:n,date:o,title:i,uri:s})},pd=(e,t)=>{const{pub:r}=bs(e),n=we(e),o=e.querySelector(".eissn")?.textContent.replace(/EISSN\s+/,"").trim()??void 0,i=e.querySelector(".issn")?.textContent.replace(/ISSN\s+/,"").trim()??void 0,s=Re(t);return q(S.Journal,{eissn:o,issn:i,jtitle:n,pub:r,uri:s})};var ce=(e=>(e.Article="journal article",e.Audio="audio",e.Book="book",e.Chapter="book chapter",e.Document="document",e.Image="image",e.Journal="journal",e.ResearchReport="research report",e.Serial="serial",e.Video="video",e))(ce||{});const fd=(e,t)=>{const r=Ne(e),n=Oe(e),o=Pe(e,r),i=we(e),s=Ye(e,r),a=Re(t);return ge({au:n,date:o,pub:s,title:i,uri:a})},hd=e=>Object.values(ce).includes(e),dd=e=>{if(e.querySelector(".journal_header-title"))return ce.Journal;if(e.querySelector(".journal-link"))return ce.Article;const n=e.querySelector(".content-type > span")?.textContent.toLowerCase().trim()??e.querySelector(".content-meta-data-label")?.textContent.toLowerCase().trim();return hd(n)?n:null},md=(e,t)=>{switch(dd(e)){case ce.Article:case ce.Serial:return sd(e,t);case ce.Audio:return id(e,t);case ce.Book:return ad(e,t);case ce.Chapter:case ce.ResearchReport:return cd(e,t);case ce.Document:return ud(e,t);case ce.Image:return ld(e,t);case ce.Journal:return pd(e,t);case ce.Video:return fd(e,t);default:return null}},gd=({document:e,url:t})=>{const r=md(e,t);return r?E(r):L()},Ke=e=>{if(e){if(typeof e=="string")return e;if(e.length>0)return e[0]}else return},ys=e=>{if(e)return typeof e=="string"?e:Array.isArray(e)?e.length===0?void 0:Ke(e[0].name):Ke(e.name)},At=(...e)=>{const t=new Set(e.filter(r=>!!r));if(t.size!==0)return[...t]},vd=e=>{const t=ys(e.mainEntity.creator);return t?[t]:void 0},Qe=({lcn:e,title:t})=>({bibid:e,title:t}),bd=(e,t)=>{const r=At(...(e&&vd(e))??[],...t.authors??[]),n=At(...t.eissns??[]),o=At(e?.mainEntity.isbn?sr(e.mainEntity.isbn):void 0,...t.isbns??[]),i=At(...e?.mainEntity.issn??[],...t.issns??[]),[s,a]=e?.mainEntity.pagination?.split("-")??[];return{authors:r,date:t.date,doi:Ke(t.dois),edition:e?.mainEntity.edition??t.edition,epage:a,eissn:Ke(n),lcn:t.lcn??e?.identifier.value,isbn:o?.join(","),issn:Ke(i),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,publisher:t.publisher??ys(e?.mainEntity.publisher),spage:s,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},yd=e=>q(S.Article,{...Qe(e),au:e.authors,doi:e.doi,eissn:e.eissn,epage:e.epage,issn:e.issn,issue:e.issue,jtitle:e.jtitle,pub:e.publisher,spage:e.spage,volume:e.volume}),_d=e=>ge({...Qe(e),au:e.authors,date:e.date,pub:e.publisher}),Sd=e=>V(S.Book,{...Qe(e),au:e.authors,date:e.date,doi:e.doi,edition:e.edition,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),Ed=e=>q(S.Journal,{...Qe(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),_s=k({"@type":X("Organization"),name:de([h(),U(h())])}),Ss=k({"@type":X("Person"),name:de([h(),U(h())])}),$d=Ce.extend({identifier:k({"@type":h(),propertyID:h(),value:h()}),mainEntity:k({"@type":h(),"@id":h(),creator:me(de([h(),Ss,U(Ss)])),edition:me(h()),isbn:me(h()),issn:me(U(h())),issueNumber:me(h()),pagination:me(h()),publisher:me(de([h(),_s,U(_s)])),volumeNumber:me(h())}),name:h()}),Ad=e=>{const t=vt(e);if(!t)return null;const r=Ge(t),n=$d.safeParse(r);return n.success?n.data:null},wd=e=>ge({...Qe(e),au:e.authors,date:e.date,pub:e.publisher}),Rd=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,Es=/(E?ISBN|E?ISSN|DOI)\s*:\s*/g,pr=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,kd=e=>{if(!e)return;const t=Rd.exec(e);if(t)return t.length>1?t[1]:void 0},Id=e=>{const t=Array.from(e.querySelectorAll(pr("Identifier"))),r={};return t.map(n=>n.textContent).filter(n=>!!n).forEach(n=>{const o=[];let i;for(;(i=Es.exec(n))!==null;)o.push({id:i[1].toLowerCase(),index:i.index,start:Es.lastIndex});o.forEach(({id:s,start:a},c)=>{r[s]??=[],r[s].push(n.substring(a,o[c+1]?.index))})}),r},Cd=e=>Array.from(e.querySelectorAll(pr("Author"))).filter(t=>!!t.textContent&&t.parentElement!==null&&t.parentElement.getAttribute("aria-hidden")!=="true").map(t=>t.textContent.trim()),ke=(e,t)=>e.querySelector(pr(t))?.textContent.trim(),Od=e=>{const t=ke(e,"Creation Date"),r=ke(e,"Edition"),n=ke(e,"Publication Date"),o=ke(e,"Is Part Of"),i=ke(e,"Publisher"),s=ke(e,"Title"),a=ke(e,"MMS ID")??ke(e,"Record ID"),c=Cd(e),u=Id(e),[l]=o?.split(",")??[],f=kd(n??t),d=[...u.isbn??[],...u.eisbn??[]].map(g=>sr(g)).filter(g=>!!g);return{authors:c,date:f,dois:u.doi,edition:r,eissns:u.eissn,isbns:d,issns:u.issn,jtitle:l,lcn:a,publisher:i,title:s}};var $s=(e=>(e.Article="Article",e.Book="Book",e.Periodical="Periodical",e.Journal="Journal",e.AudioCD="Audio CD",e.CreativeWork="CreativeWork",e.Movie="Movie",e.Video="Video",e))($s||{});const Pd=e=>Object.values($s).includes(e),Nd=(e,t)=>{const r=t?.mainEntity["@type"]??e.querySelector(".media-content-type")?.textContent??void 0;if(Pd(r))return r},zd=({document:e})=>{const t=Ad(e),r=Od(e),n=bd(t,r);switch(Nd(e,t)){case"Article":return E(yd(n));case"Book":return E(Sd(n));case"Periodical":case"Journal":return E(Ed(n));case"Audio CD":case"CreativeWork":return E(_d(n));case"Movie":case"Video":return E(wd(n));default:return L()}},Td=e=>{const t=e.querySelectorAll('[id="Info"] > p'),n=Array.from(t).find(i=>i.textContent.includes("Document Type"))?.textContent,o=p(e,"name","DC.identifier");return o?.startsWith("info:doi/")||n?.includes("Article")?b.Article:o?.startsWith("urn:issn:")?b.Journal:void 0},Ld=e=>{const t=p(e,"name","DCTERMS.bibliographicCitation"),[r,n,o,i]=t?.split(",")??[];return{journalTitle:r,volume:n,issue:o,pages:i}},xd=e=>{const t=p(e,"name","DC.identifier");return(t?t.split("info:doi/"):null)?.[1]??void 0},jd=e=>e.evaluate('//*[@id="altLayoutPublisherLogo"]/p/a[1]',e,null,XPathResult.STRING_TYPE,null).stringValue,qd=e=>{const[t,r]=e?e.trim().split("-"):[void 0,void 0],n=r?.replace(/\(\d+\)/,"").trim();return{spage:t,epage:n}},Dd=e=>{const t=p(e,"name","DCTERMS.issued");if(!t)return;const n=/\d{4}/.exec(t);return n?n[0]:void 0},Zd=e=>{const t=p(e,"name","DC.title"),r=p(e,"name","DC.publisher"),n=Dd(e),o=Ld(e),i=o.journalTitle?.trim(),s=o.volume?.trim(),a=o.issue?.trim(),c=o.pages?qd(o.pages):void 0,u=c?.spage,l=c?.epage,f=Q(e,"name","DC.creator"),d=xd(e);return q(S.Article,{au:f,jtitle:i,date:n,doi:d,issue:a,pub:r,spage:u,epage:l,atitle:t,volume:s})},Bd=e=>{const t=p(e,"name","DC.title"),r=p(e,"name","DC.publisher"),n=jd(e);return q(S.Journal,{issn:n,title:t,pub:r})},Jd=({document:e})=>{switch(Td(e)){case b.Article:return E(Zd(e));case b.Journal:return E(Bd(e));default:return L()}},Ud=/^\d{4}-\d{3}[\dX]$/i,Vd=e=>Ud.test(e),As=e=>{const t=e.filter(Vd);return t.length?t:void 0},fr=e=>{const t=Q(e,"name","citation_author");return t.length?t:void 0},hr=e=>p(e,"name","citation_publication_date")?.match(/^\d{4}/)?.[0],Md=e=>p(e,"name","citation_doi"),ws=e=>{const t=Q(e,"name","citation_isbn");return t.length?t.join(","):void 0},Rs=e=>As(Q(e,"name","citation_issn")),dr=e=>p(e,"name","citation_journal_title"),mr=e=>p(e,"name","citation_publisher"),wt=e=>p(e,"name","citation_title"),Fd=e=>p(e,"name","citation_doi"),gr=e=>p(e,"name","citation_firstpage"),vr=e=>p(e,"name","citation_lastpage"),Wd=e=>p(e,"name","citation_issue"),Gd=e=>p(e,"name","citation_volume"),Xd=e=>q(S.Article,{atitle:wt(e),au:fr(e),date:hr(e),doi:Md(e),issn:Rs(e)?.[0],issue:Wd(e),jtitle:dr(e),pub:mr(e),volume:Gd(e),spage:gr(e),epage:vr(e)}),Hd=e=>V(S.Bookitem,{atitle:wt(e),au:fr(e),btitle:dr(e),date:hr(e),isbn:ws(e),pub:mr(e),spage:gr(e),epage:vr(e)}),Yd=e=>Mt({title:wt(e),au:fr(e),date:hr(e),pub:mr(e),spage:gr(e),epage:vr(e)}),ks=e=>!!e.isbn,Kd=e=>!!e.issn||e.type==="Article"&&!!e.journalTitle||!ks(e)&&!!e.journalTitle,Qd=e=>!!e.title,em=e=>{const t={type:Fd(e),isbn:ws(e),issn:Rs(e),journalTitle:dr(e),title:wt(e)};return ks(t)?Hd(e):Kd(t)?Xd(e):Qd(t)?Yd(e):null},tm=({url:e,document:t})=>{const r=em(t);return r?E({...r,uri:e}):L()},rm=k({"@content":h(),datePublished:h().optional(),mainEntity:k({type:h().optional(),name:h().optional(),author:U(k({name:h()})).optional(),publisher:k({type:h(),name:h()}).optional(),isbn:h().optional()})}),nm=e=>rm.safeParse(e).success,om=e=>{const t=e.textContent;if(!t)return null;try{const r=JSON.parse(t);if(nm(r))return r}catch{return null}return null},sm=({document:e})=>{const t=vt(e);if(!t)return L();const r=om(t);if(!r)return L();const n=r.mainEntity.type,o=r.mainEntity.author?.map(u=>u.name),i=r.datePublished?.substring(0,4),s=r.mainEntity.name,a=r.mainEntity.isbn,c=r.mainEntity.publisher?.name;return n==="Book"?E(V(S.Book,{au:o,date:i,title:s,isbn:a,pub:c})):L()},im=Ce.extend({"@type":h().optional(),name:h().optional(),copyrightYear:Ao().optional(),author:U(k({name:h()})).optional(),publisher:U(k({name:h()})).optional()}),am=e=>im.safeParse(e).success,cm=({document:e,url:t})=>{const r=vt(e);if(!r)return L();const n=Ge(r);if(!n||!am(n))return L();const o=n["@type"],i=n.author?.map(l=>l.name),s=n.copyrightYear?.toString()??p(e,"property","og:book:release_date"),a=n.name,c=Et(n.publisher?.map(l=>l.name)),u=p(e,"property","og:book:isbn");return o==="Book"?E(V(S.Book,{au:i,date:s,title:a,isbn:u,pub:c,uri:t})):L()},um=e=>{const t=Array.from(e.querySelectorAll("a[rel=author]")).map(r=>r.textContent.trim()).filter(Boolean);return t.length?t:void 0},lm=e=>{const t=Array.from(e.querySelectorAll("strong")).filter(r=>r.textContent.startsWith("ISBN")).map(r=>r.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,",")},pm=({url:e,document:t})=>{const r=t.querySelector("h3.page-title")?.textContent.trim()??void 0,n=um(t),o=p(t,"property","article:published_time"),i=lm(t),s=V(S.Book,{au:n,date:o?.substring(0,4),isbn:i,pub:"Milne Open Textbooks",title:r,uri:e});return E(s)},fm=({document:e,url:t})=>{switch(hm(t)){case b.Chapter:return E(bm(e));case b.Book:return E(ym(e));case b.Article:return E(dm(e));case b.Journal:return E(mm(e));default:return L()}},hm=e=>{const{pathname:t}=new URL(e);return t.includes("/books/abs/")?b.Chapter:t.includes("/books/")?b.Book:/\/journals\/.+\/article\//.exec(t)!=null?b.Article:t.includes("/journals/")?b.Journal:b.None},dm=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_journal_title"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_volume"),i=p(e,"name","citation_issue"),s=p(e,"name","citation_firstpage"),a=p(e,"name","citation_lastpage"),c=p(e,"name","citation_publication_date")?.substring(0,4),u=p(e,"name","citation_publisher"),l=Is(e),f=As(Q(e,"name","citation_issn"));return q(S.Article,{atitle:t,au:l,jtitle:r,doi:n,volume:o,issue:i,issn:f?.[0],spage:s,epage:a,date:c,pub:u})},mm=e=>{const t=gm(e),r=vm(e),n=r.find(a=>a.type==="Print"),o=r.find(a=>a.type==="Online"),i=n?n.value:void 0,s=o?o.value:void 0;return q(S.Journal,{title:t,issn:i,eissn:s})},gm=e=>e.querySelector("h1.title")?.textContent.trim()??void 0,vm=e=>{const r=Array.from(e.querySelectorAll("span.bold")).find(i=>i.textContent.trim()==="ISSN:"),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,o=[];return r&&r.parentElement?.querySelectorAll("span.value")?.forEach(s=>{const a=s.textContent.trim(),c=n.exec(a);c&&o.push({value:c[1],type:c[2]})}),o},bm=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_inbook_title"),n=p(e,"name","citation_doi"),o=p(e,"name","citation_publication_date")?.substring(0,4),i=p(e,"name","citation_publisher");return V(S.Bookitem,{atitle:t,btitle:r,doi:n,date:o,pub:i})},ym=e=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_doi"),n=p(e,"name","citation_isbn"),o=p(e,"name","citation_publication_date")?.substring(0,4),i=p(e,"name","citation_publisher"),s=Is(e);return V(S.Book,{title:t,au:s,doi:r,isbn:n,date:o,pub:i})},Is=e=>{const t=Q(e,"name","citation_author");return t.length?t:void 0},_m=e=>{switch(p(e,"property","og:type")){case"Article":return"Article";case"Journal":return"Journal";default:return}};function Sm(e){const t=p(e,"property","og:title"),r=p(e,"name","dc.Publisher"),n=p(e,"name","publication_doi");return E(q(S.Journal,{jtitle:t,pub:r,doi:n}))}function Em(e){const t=p(e,"name","dc.Title"),r=Q(e,"name","dc.Creator"),n=p(e,"name","dc.Date")?.substring(0,4),o=p(e,"name","publication_doi"),i=p(e,"name","citation_journal_title"),s=p(e,"name","dc.Publisher");return E(q(S.Article,{atitle:t,au:r,date:n,doi:o,jtitle:i,pub:s}))}const $m=({document:e})=>{switch(_m(e)){case"Journal":return Sm(e);case"Article":return Em(e);default:return L()}},Am=e=>{if(!e)return;const[t,r]=e.trim().split("-");return{spage:t,epage:r}},wm=e=>{const{pathname:t}=new URL(e);if(t.includes("/article/"))return b.Article},Rm=e=>{const t=p(e,"name","DC.Source"),r=p(e,"name","DC.Title"),n=Q(e,"name","DC.Creator.PersonalName"),o=p(e,"name","DC.Source.ISSN"),i=p(e,"name","citation_date")?.substring(0,4),s=p(e,"name","DC.Source.Volume"),a=p(e,"name","DC.Source.Issue"),c=p(e,"name","DC.Identifier.URI"),u=p(e,"name","DC.Identifier.pageNumber"),l=u?Am(u):void 0,f=l?.spage,d=l?.epage;return q(S.Article,{jtitle:t,atitle:r,au:n,issn:o,date:i,spage:f,epage:d,volume:s,issue:a,uri:c})},km=({document:e,url:t})=>wm(t)===b.Article?E(Rm(e)):L(),Im=e=>{switch(Cm(e)){case"eBook":return"Book";case"Reference":return"Chapter";default:return}},Cm=e=>e.querySelector("#vol-contentType a")?.textContent??void 0;function Om(e,t){const r=Cs(e),n=br(e),o=Ps(e),i=Ns(e),s=zs(e),a=Ts(e),c=br(e),u=t,{startPage:l,endPage:f}=Ls(e)??{};return E(V(S.Book,{au:r,btitle:n,date:o,doi:i,epage:f,isbn:s,pub:a,spage:l,title:c,uri:u}))}function Pm(e,t){const r=Cs(e),n=Os(e),o=br(e),i=Ps(e),s=Ns(e),a=zs(e),c=Ts(e),u=Os(e),l=t,{startPage:f,endPage:d}=Ls(e)??{};return E(V(S.Book,{au:r,atitle:n,btitle:o,date:i,doi:s,epage:d,isbn:a,pub:c,spage:f,title:u,uri:l}))}const Cs=e=>{const t=e.querySelectorAll("div#article_author p.author-bio b"),r=Array.from(t).map(n=>n.textContent).filter(n=>!!n).map(n=>n.trim());return r.length>0?r:void 0},Ze=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute("value")??void 0,Nm=e=>p(e,"property","og:title"),br=e=>Ze(e,"titlevalue")??Nm(e),Os=e=>Ze(e,"chapter-title-squid"),Ps=e=>Ze(e,"pubdate-squid"),Ns=e=>Ze(e,"doi-squid"),zs=e=>Ze(e,"isbn-squid"),Ts=e=>Ze(e,"pubname-squid"),Ls=e=>{const t=e.querySelector("#pageRange")?.textContent??void 0;if(!t)return;const n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},zm=({document:e,url:t})=>{switch(Im(e)){case"Book":return Om(e,t);case"Chapter":return Pm(e,t);default:return L()}},Tm=(e,t)=>e.evaluate(`//*[@class="singleRecord_view_label"][contains(text(), "${t}")]/following-sibling::*[@class="singleRecord_view_data"]`,e,null,XPathResult.STRING_TYPE).stringValue.toLowerCase().trim(),Lm=e=>{switch(Tm(e,"Medium")){case"book":case"e-book":return S.Book;case"e-journal":return S.Journal;default:return S.Unknown}},xm=e=>{delete e.rft_id},jm=e=>{const t=rr(e);if(bt(t)){const r=Lm(e.document);t.resource.genre=r,xm(t.resource)}return t},qm=e=>{const t=p(e,"name","type")?.toLowerCase(),r=p(e,"name","og:type")?.toLowerCase(),n=p(e,"name","citation_article_type")?.toLowerCase();if(t==="article"||n==="article"||r==="article")return b.Article;const o=p(e,"name","twitter:title")?.trim(),i=p(e,"name","description")?.trim();if(o||i)return b.Webpage},Dm=e=>{const t=p(e,"name","DC.Title"),r=p(e,"name","DC.Publisher"),n=p(e,"name","DC.Date"),o=p(e,"name","DC.Identifier"),i=p(e,"name","citation_journal_title"),s=p(e,"name","citation_volume"),a=p(e,"name","citation_issn"),c=Q(e,"name","citation_author");return q(S.Article,{au:c,jtitle:i,date:n,doi:o,issn:a,pub:r,title:t,volume:s})},Zm=(e,t)=>{const r=p(t,"name","twitter:title");return dt({uri:e,title:r})},Bm=({url:e,document:t})=>{switch(qm(t)){case b.Article:return E(Dm(t));case b.Webpage:return E(Zm(e,t))}return L()},Jm=({document:e})=>Array.from(e.querySelectorAll(".availability.documentSummaryAvailability.availabilityContent")).length===0?L():Xo(),Um=/([0-9]{4})\s+at/;function Vm(e){if(!e)return;const t=Um.exec(e);if(t&&t.length>1)return t[1]}function xs(e,t){const r=e.getElementsByClassName(t);if(r.length!==0)return r[0].textContent}function Mm(e){const t={};return Array.from(e.getElementsByTagName("li")).reduce((r,n)=>{const o=xs(n,"title"),i=xs(n,"content");return o&&i&&(r[o]=i),r},t)}function Fm(e){const t=e.getElementsByClassName("information");if(t.length===0)return{};const r=Mm(t[0]),n=Vm(r.Published),o=r.Show;return{date:n,series:o}}const Wm=({url:e,document:t})=>{if(!new URL(e).searchParams.has("i"))return L();const n=S.AudioDocument,o=p(t,"property","og:site_name"),i=p(t,"property","og:title"),s=Fm(t);return E({genre:n,pub:o,title:i,uri:e,...s})},Gm=e=>{const t=p(e,"name","citation_date");return t?t.split("/").find(o=>/^\d{4}/.test(o))??void 0:void 0},Xm=e=>{const t=e.querySelector("#arxiv-doi-link")?.textContent;return t?t.replace("https://doi.org/","").trim():void 0},Hm=({document:e})=>{const t=p(e,"name","citation_title"),r=p(e,"name","citation_pdf_url"),n=Q(e,"name","citation_author"),o=Gm(e),i=Xm(e);return!t&&n.length===0&&!o&&!i?L():E(q(S.Article,{au:n,date:o,doi:i,title:t,uri:r}))},Ym=e=>{const t=He(e,"div.director-section div.term-info-section-items");if(!t)return;const r=t.split(",").map(n=>n.replace(/\s+/g," ").trim()).filter(n=>n.length>0);return r.length>0?r:void 0},Km=e=>{const t=new Map;return Array.from(e.querySelectorAll(".info-section-container")).forEach(r=>{const n=r.querySelector(".info-section-header .info-section-title")?.textContent.trim().toLowerCase();if(!n)return;const o=Array.from(r.querySelectorAll(".term-info-section-item")).map(i=>i.textContent.replace(",","").trim()).filter(i=>!!i);o.length&&t.set(n,o)}),t},Qm=({url:e,document:t})=>{const r=Km(t),n=Ym(t)??r.get("director"),o=He(t,"div.product-release-year"),i=He(t,"div.studio-section div.term-info-section-item")??De(r.get("supplier")),s=He(t,".product-title")??He(t,".movie-title"),a=ge({au:n,date:o,pub:i,title:s,uri:e});return E(a)},eg=e=>{if(p(e,"property","og:type")==="article")return b.Article};function tg(e){const t={},r=e.querySelector("[data-id=layout-form]");return r&&Array.from(r.getElementsByTagName("h2")).forEach(o=>{const i=o.textContent.toLowerCase(),a=Array.from(o.parentElement?.getElementsByTagName("span")??[]).map(c=>c.textContent||"");i&&(t[i]=a[0])}),t}function rg(e,t,r){return r.includes("publisher")?t.publisher:r.includes("place of publication, exhibition, or creation")?t["place of publication, exhibition, or creation"]:p(e,"name","DC.publisher")}function ng(e){const t=p(e,"name","citation_publication_date");return t?t.substring(0,4):p(e,"name","citation_online_date")?.substring(0,4)}const og=e=>{const t=tg(e),r=p(e,"name","DataCite.title"),n=Q(e,"name","DataCite.contributor"),o=ng(e),i=p(e,"name","DC.identifier.DOI"),s=Object.keys(t),a=rg(e,t,s),c=s.includes("journal")?t.journal:void 0,u=s.includes("volume")?t.volume:void 0,l=s.includes("issue")?t.issue:void 0,f=s.includes("issn")?t.issn:void 0,d=s.includes("electronic location (url)")?t["electronic location (url)"]:void 0;return q(S.Article,{jtitle:c,atitle:r,pub:a,au:n,date:o,doi:i,volume:u,issue:l,issn:f,uri:d})},sg=({document:e})=>eg(e)===b.Article?E(og(e)):L(),ig=e=>{const t=ue(e,"resource type");return t?t==="Other Journal Article"||t==="Journal Article"||t==="Journal Item"||t==="Book Review"?b.Article:t==="Book Chapter"||t==="Book Part"||t==="Conference Abstract"||t==="Book ChapterConference Paper"||t==="Conference Paper"||t==="Other Book Part"?b.Document:b.None:b.None},ag=e=>e.replace(":","").replace(" | ","").trim().toLowerCase(),cg=e=>{const t=new Map,r=e.querySelector("ul.rlist.publication-details__list");return r&&Array.from(r.querySelectorAll("li")).forEach(n=>{const o=Array.from(n.querySelectorAll("span.label")),i=Array.from(n.querySelectorAll("span.info"));o.forEach((s,a)=>{const c=ag(s.textContent),u=i[a]?.textContent?.trim();c&&u&&(t.has(c)||t.set(c,[]),t.get(c)?.push(u))})}),t},ue=(e,t)=>{const r=e.get(t);if(r)return Et(r)},ug=e=>Q(e,"name","dc.Creator").map(t=>t.trim()),lg=e=>{const t=Xh(e,[".loa-accordion a.author-name"]);return t?t.map(n=>n.replace("Authors:","").trim()):void 0},yr=e=>{const t=ug(e);return t.length>0?t:lg(e)},_r=e=>p(e,"name","dc.Title")??p(e,"property","og:title"),Sr=e=>p(e,"name","publication_doi"),Er=(e,t)=>ue(t,"date of publication")??p(e,"name","dc.Date"),js=e=>{const t=ue(e,"page range");let r,n;return t?.includes("-")&&(r=t?t.split("-")[0].trim():void 0,n=t?t.split("-")[1].trim():void 0),{pages:t,spage:r,epage:n}},pg=(e,t,r)=>{const n=_r(e),o=ue(t,"journal"),i=p(e,"name","citation_journal_title"),s=o??i,a=Sr(e),c=Er(e,t),u=ue(t,"publisher"),l=yr(e),f=ue(t,"volume"),d=ue(t,"issue"),g=js(t),I=ue(t,"issn (print)"),v=ue(t,"issn (electronic)");return q(S.Article,{title:n,jtitle:s,doi:a,date:c,pub:u,au:l,volume:f,issue:d,pages:g.pages,spage:g.spage,epage:g.epage,issn:I,eissn:v,uri:r})},fg=(e,t,r)=>{const n=_r(e),o=ue(t,"book title"),i=Sr(e),s=Er(e,t),a=ue(t,"publisher"),c=yr(e),u=js(t),l=ue(t,"isbn (print)");return V(S.Conference,{title:n,btitle:o,doi:i,date:s,pub:a,au:c,pages:u.pages,spage:u.spage,epage:u.epage,isbn:l,uri:r})},hg=(e,t,r)=>{const n=_r(e),o=Sr(e),i=Er(e,t),s=ue(t,"publisher"),a=yr(e),c=ue(t,"isbn (print)");return V(S.Document,{title:n,doi:o,date:i,pub:s,au:a,uri:r,isbn:c})},dg=({url:e,document:t})=>{const r=cg(t);switch(ig(r)){case b.Article:return E(pg(t,r,e));case b.Document:return E(fg(t,r,e));case b.None:return E(hg(t,r,e));default:return L()}},Be=e=>p(e,"property","og:title")?.trim()??void 0,qs=e=>p(e,"name","dc.identifier")??p(e,"name","citation_doi"),mg=e=>{const t=Be(e),r=t,n=Sg(e),o=_g(e),i=bg(e),s=yg(e),{issn:a,eissn:c}=vg(e);return E(q(S.Journal,{date:n,eissn:c,issn:a,issue:o,jtitle:r,pub:i,title:t,volume:s}))},gg=e=>e.includes("/journals/")&&e.includes("issue"),vg=e=>{const t=e.querySelector("dd.printissn.text-metadata-value > span")?.textContent.trim(),r=e.querySelector("dd.onlineissn.text-metadata-value > span")?.textContent.trim();return{issn:t,eissn:r}},bg=e=>e.querySelector("dd.publisher.text-metadata-value span")?.textContent.trim()??void 0,yg=e=>Be(e)?.match(/Volume\s+(\d+)/i)?.[1],_g=e=>Be(e)?.match(/Issue\s+(\d+)/i)?.[1],Sg=e=>Be(e)?.match(/\((\d{4})\)/)?.[1],Eg=e=>{const t=Be(e),r=p(e,"name","citation_title")??t,n=Q(e,"property","article:author"),o=$g(e),i=qs(e),s=p(e,"name","citation_lastpage"),a=p(e,"name","citation_issn"),c=p(e,"name","citation_issue"),u=p(e,"name","citation_journal_title"),l=p(e,"name","citation_publisher"),f=p(e,"name","citation_firstpage"),d=p(e,"name","citation_volume");return E(q(S.Article,{atitle:r,au:n,date:o,doi:i,epage:s,issn:a,issue:c,jtitle:u,pub:l,spage:f,title:t,volume:d}))},$g=e=>p(e,"property","article:published_time")??p(e,"name","citation_publication_date"),Ag=e=>{const t=Be(e),r=p(e,"name","citation_title")??t,n=wg(e),o=kg(e),i=qs(e),s=Ig(e),a=p(e,"name","citation_publisher");return E(V(S.Book,{au:n,btitle:r,date:o,doi:i,isbn:s,pub:a,title:t}))},wg=e=>{const t=Q(e,"property","book:author");if(t.length>0)return t;const r=Q(e,"name","citation_author");return r.length>0?r:Rg(e)},Rg=e=>Array.from(e.querySelectorAll('.contributor-details span[data-testid="author-name"]')).map(r=>(r.textContent||"").trim()).filter(r=>r.length>0),kg=e=>p(e,"property","book:release_date")??p(e,"name","citation_publication_date"),Ig=e=>p(e,"property","book:isbn")??p(e,"name","citation_isbn"),Cg=(e,t)=>{switch(p(e,"property","og:type")){case"article":return b.Article;case"book":return b.Book}return gg(t)?b.Journal:b.None},Og=({document:e,url:t})=>{switch(Cg(e,t)){case b.Article:return Eg(e);case b.Journal:return mg(e);case b.Book:return Ag(e);default:return L()}};var z=(e=>(e.NoResourceFound="NoResourceFound",e.Z3988="Z3988",e.Z3988SearchResult="Z3988SearchResult",e.Amazon="Amazon",e.CupOfJo="CupOfJo",e.IngentaConnect="IngentaConnect",e.Jstor="Jstor",e.Milne="Milne",e.Primo="Primo",e.SagePub="SagePub",e.SageVideo="SageVideo",e.ScienceDirect="ScienceDirect",e.Springer="Springer",e.Youtube="Youtube",e.TaylorFrancis="TaylorFrancis",e.Wiley="Wiley",e.VuFind="VuFind",e.ClinicalKey="ClinicalKey",e.DOAJ="DOAJ",e.Ebscohost="Ebscohost",e.OpenStax="OpenStax",e.CambridgeJournalsOnline="CambridgeJournalsOnline",e.OpenTextbook="OpenTextbook",e.AhaJournals="AhaJournals",e.Ijees="Ijees",e.BloomsburyCollections="BloomsburyCollections",e.HeritageCirqa="HeritageCirqa",e.BritishMedicalJournal="BritishMedicalJournal",e.SummonSearchResult="SummonSearchResult",e.ApplePodcasts="ApplePodcasts",e.Arxiv="Arxiv",e.KanopyVideo="KanopyVideo",e.LaTrobeOpal="LaTrobeOpal",e.BYUScholarsArchive="BYUScholarsArchive",e.Informit="Informit",e.Brill="Brill",e))(z||{});const $r={NoResourceFound:os,Z3988:rr,Z3988SearchResult:Gh,Amazon:Vp,CupOfJo:$f,Jstor:gd,Youtube:fh,SagePub:qf,SageVideo:Wh,ScienceDirect:Wf,Springer:Oh,TaylorFrancis:eh,Wiley:Mh,VuFind:ch,ClinicalKey:df,DOAJ:If,Primo:zd,IngentaConnect:Jd,Ebscohost:tm,OpenStax:sm,OpenTextbook:cm,Milne:pm,CambridgeJournalsOnline:fm,AhaJournals:$m,Ijees:km,BloomsburyCollections:zm,HeritageCirqa:jm,BritishMedicalJournal:Bm,SummonSearchResult:Jm,ApplePodcasts:Wm,Arxiv:Hm,KanopyVideo:Qm,LaTrobeOpal:sg,BYUScholarsArchive:ef,Informit:dg,Brill:Og},Pg="5.34.0",Ar=()=>Pg,Ng=["com.au","com","ca","co.uk","de","fr","nl"].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),zg={version:Ar(),siteRegistrations:[{matcher:{regexp:"^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search"},name:"Worldcat Search Results",parsers:[z.Z3988SearchResult]},{matcher:{regexp:"^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/"},name:"Summon Search Results",parsers:[z.SummonSearchResult]},{matcher:{regexp:"cupofjo[.-]com"},name:"Cup of Jo",parsers:[z.CupOfJo]},{matcher:{hostnames:["youtube.com","www.youtube.com"]},name:"Youtube",parsers:[z.Youtube]},{matcher:{regexp:"www[-.]sciencedirect[.-]com"},name:"Science Direct",parsers:[z.ScienceDirect]},{matcher:{hostnames:Ng},name:"Amazon",parsers:[z.Amazon]},{matcher:{regexp:"^https://sk\\.sagepub\\.com/video/"},name:"Sage Video",parsers:[z.SageVideo]},{matcher:{regexp:"[/.-]((www|journals)[.-])?sagepub[.-]com"},name:"Sage Publishing",parsers:[z.SagePub]},{matcher:{regexp:"www[.-]tandfonline[.-]com"},name:"Taylor & Francis",parsers:[z.TaylorFrancis]},{matcher:{regexp:"[/.-]((www|onlinelibrary)[.-])?wiley[.-]com"},name:"Wiley",parsers:[z.Wiley]},{matcher:{regexp:"^https://[a-z0-9\\-]+[.-]on[.-]worldcat[.-]org"},name:"Worldcat",parsers:[z.Z3988]},{matcher:{hostnames:["catalogue.rau.ac.uk"]},name:"Royal Agricultural University Library",parsers:[z.Z3988]},{matcher:{regexp:"link[.-]springer[.-]com"},name:"Springer",parsers:[z.Springer]},{matcher:{regexp:"^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)"},name:"VuFind",parsers:[z.VuFind]},{matcher:{regexp:"www[.-]clinicalkey[.-]com"},name:"ClinicalKey",parsers:[z.ClinicalKey]},{matcher:{regexp:"www[.-]jstor[.-]org"},name:"JSTOR",parsers:[z.Jstor]},{matcher:{regexp:"doaj[.-]org"},name:"DOAJ",parsers:[z.DOAJ]},{matcher:{regexp:"[/.-]ingentaconnect[.-]com"},name:"IngentaConnect",parsers:[z.IngentaConnect]},{matcher:{regexp:"research[.-]ebsco[.-]com"},name:"EBSCOHost",parsers:[z.Ebscohost]},{matcher:{regexp:"openstax[-.]org"},name:"OpenStax",parsers:[z.OpenStax]},{matcher:{regexp:"open[.-]umn[.-]edu"},name:"OpenTextbook",parsers:[z.OpenTextbook]},{matcher:{regexp:"milneopentextbooks[-.]org"},name:"Milne Open Textbooks",parsers:[z.Milne]},{matcher:{regexp:"www[.-]perlego[.-]com"},name:"Perlego",parsers:[z.Z3988]},{matcher:{regexp:"www[.-]ahajournals[.-]org"},name:"AHA Journals",parsers:[z.AhaJournals]},{matcher:{regexp:"www[.-]cambridge[.-]org"},name:"Cambridge Journals Online",parsers:[z.CambridgeJournalsOnline]},{matcher:{regexp:"www[.-]nieindia[.-]org"},name:"International Journal of Ecology and Environmental Sciences",parsers:[z.Ijees]},{matcher:{regexp:"www[.-]bloomsburycollections[.-]com"},name:"Bloomsbury Collections",parsers:[z.BloomsburyCollections]},{matcher:{regexp:"cirqahosting[.-]com"},name:"Heritage Cirqa",parsers:[z.HeritageCirqa]},{matcher:{regexp:"www[.-]bmj[.-]com"},name:"British Medical Journal",parsers:[z.BritishMedicalJournal]},{matcher:{regexp:"podcasts[.-]apple[.-]com"},name:"Apple Podcasts",parsers:[z.ApplePodcasts]},{matcher:{regexp:"arxiv[.-]org"},name:"arxiv",parsers:[z.Arxiv]},{matcher:{regexp:"kanopy[.-]com"},name:"Kanopy Video",parsers:[z.KanopyVideo]},{matcher:{regexp:"opal[.-]latrobe[.-]edu[.-]au"},name:"La Trobe Opal",parsers:[z.LaTrobeOpal]},{matcher:{hostnames:["scholarsarchive.byu.edu"]},name:"BYU Scholars Archive",parsers:[z.BYUScholarsArchive]},{matcher:{regexp:"informit[.-]org"},name:"Informit",parsers:[z.Informit]},{matcher:{regexp:"brill[.-]com"},name:"Brill",parsers:[z.Brill]},{matcher:{regexp:"/(discovery|primo-explore)/fulldisplay"},name:"Primo",parsers:[z.Primo]}]},wr=k({hostnames:U(h()).min(1)}),Rr=k({regexp:h()}),kr=de([wr,Rr]),Ir=k({matcher:kr,name:h(),parsers:U(h()),libraryVersionRange:h().optional()}),Ds=k({siteRegistrations:U(Ir),version:h()}),Tg=e=>Ds.safeParse(e).success,Lg=e=>Ir.safeParse(e).success,xg=e=>kr.safeParse(e).success,Zs=e=>Object.values(z).includes(e),jg=e=>typeof e=="object"&&e!==null,Bs=k({url:h(),document:dp(jg)}),qg=e=>Bs.safeParse(e).success;var Rt={exports:{}},Cr,Js;function kt(){if(Js)return Cr;Js=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,o=t-6;return Cr={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Cr}var Or,Us;function It(){return Us||(Us=1,Or=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Or}var Vs;function et(){return Vs||(Vs=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=kt(),i=It();t=e.exports={};const s=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let f=0;const d="[a-zA-Z0-9-]",g=[["\\s",1],["\\d",o],[d,n]],I=P=>{for(const[D,re]of g)P=P.split(`${D}*`).join(`${D}{0,${re}}`).split(`${D}+`).join(`${D}{1,${re}}`);return P},v=(P,D,re)=>{const x=I(D),Z=f++;i(P,Z,D),l[P]=Z,c[Z]=D,u[Z]=x,s[Z]=new RegExp(D,re?"g":void 0),a[Z]=new RegExp(x,re?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),v("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${d}+`),v("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),v("FULL",`^${c[l.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),v("LOOSE",`^${c[l.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),v("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),v("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),v("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),v("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),v("COERCERTL",c[l.COERCE],!0),v("COERCERTLFULL",c[l.COERCEFULL],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",v("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",v("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Rt,Rt.exports)),Rt.exports}var Pr,Ms;function Nr(){if(Ms)return Pr;Ms=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return Pr=n=>n?typeof n!="object"?e:n:t,Pr}var zr,Fs;function Ws(){if(Fs)return zr;Fs=1;const e=/^[0-9]+$/,t=(n,o)=>{if(typeof n=="number"&&typeof o=="number")return n===o?0:n<o?-1:1;const i=e.test(n),s=e.test(o);return i&&s&&(n=+n,o=+o),n===o?0:i&&!s?-1:s&&!i?1:n<o?-1:1};return zr={compareIdentifiers:t,rcompareIdentifiers:(n,o)=>t(o,n)},zr}var Tr,Gs;function se(){if(Gs)return Tr;Gs=1;const e=It(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=kt(),{safeRe:n,t:o}=et(),i=Nr(),{compareIdentifiers:s}=Ws();class a{constructor(u,l){if(l=i(l),u instanceof a){if(u.loose===!!l.loose&&u.includePrerelease===!!l.includePrerelease)return u;u=u.version}else if(typeof u!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof u}".`);if(u.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",u,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const f=u.trim().match(l.loose?n[o.LOOSE]:n[o.FULL]);if(!f)throw new TypeError(`Invalid Version: ${u}`);if(this.raw=u,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const g=+d;if(g>=0&&g<r)return g}return d}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(u){if(e("SemVer.compare",this.version,this.options,u),!(u instanceof a)){if(typeof u=="string"&&u===this.version)return 0;u=new a(u,this.options)}return u.version===this.version?0:this.compareMain(u)||this.comparePre(u)}compareMain(u){return u instanceof a||(u=new a(u,this.options)),this.major<u.major?-1:this.major>u.major?1:this.minor<u.minor?-1:this.minor>u.minor?1:this.patch<u.patch?-1:this.patch>u.patch?1:0}comparePre(u){if(u instanceof a||(u=new a(u,this.options)),this.prerelease.length&&!u.prerelease.length)return-1;if(!this.prerelease.length&&u.prerelease.length)return 1;if(!this.prerelease.length&&!u.prerelease.length)return 0;let l=0;do{const f=this.prerelease[l],d=u.prerelease[l];if(e("prerelease compare",l,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return s(f,d)}while(++l)}compareBuild(u){u instanceof a||(u=new a(u,this.options));let l=0;do{const f=this.build[l],d=u.build[l];if(e("build compare",l,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return s(f,d)}while(++l)}inc(u,l,f){if(u.startsWith("pre")){if(!l&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(l){const d=`-${l}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!d||d[1]!==l)throw new Error(`invalid identifier: ${l}`)}}switch(u){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",l,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",l,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",l,f),this.inc("pre",l,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",l,f),this.inc("pre",l,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const d=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let g=this.prerelease.length;for(;--g>=0;)typeof this.prerelease[g]=="number"&&(this.prerelease[g]++,g=-2);if(g===-1){if(l===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(l){let g=[l,d];f===!1&&(g=[l]),s(this.prerelease[0],l)===0?isNaN(this.prerelease[1])&&(this.prerelease=g):this.prerelease=g}break}default:throw new Error(`invalid increment argument: ${u}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Tr=a,Tr}var Lr,Xs;function Je(){if(Xs)return Lr;Xs=1;const e=se();return Lr=(r,n,o=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(i){if(!o)return null;throw i}},Lr}var xr,Hs;function Dg(){if(Hs)return xr;Hs=1;const e=Je();return xr=(r,n)=>{const o=e(r,n);return o?o.version:null},xr}var jr,Ys;function Zg(){if(Ys)return jr;Ys=1;const e=Je();return jr=(r,n)=>{const o=e(r.trim().replace(/^[=v]+/,""),n);return o?o.version:null},jr}var qr,Ks;function Bg(){if(Ks)return qr;Ks=1;const e=se();return qr=(r,n,o,i,s)=>{typeof o=="string"&&(s=i,i=o,o=void 0);try{return new e(r instanceof e?r.version:r,o).inc(n,i,s).version}catch{return null}},qr}var Dr,Qs;function Jg(){if(Qs)return Dr;Qs=1;const e=Je();return Dr=(r,n)=>{const o=e(r,null,!0),i=e(n,null,!0),s=o.compare(i);if(s===0)return null;const a=s>0,c=a?o:i,u=a?i:o,l=!!c.prerelease.length;if(!!u.prerelease.length&&!l){if(!u.patch&&!u.minor)return"major";if(u.compareMain(c)===0)return u.minor&&!u.patch?"minor":"patch"}const d=l?"pre":"";return o.major!==i.major?d+"major":o.minor!==i.minor?d+"minor":o.patch!==i.patch?d+"patch":"prerelease"},Dr}var Zr,ei;function Ug(){if(ei)return Zr;ei=1;const e=se();return Zr=(r,n)=>new e(r,n).major,Zr}var Br,ti;function Vg(){if(ti)return Br;ti=1;const e=se();return Br=(r,n)=>new e(r,n).minor,Br}var Jr,ri;function Mg(){if(ri)return Jr;ri=1;const e=se();return Jr=(r,n)=>new e(r,n).patch,Jr}var Ur,ni;function Fg(){if(ni)return Ur;ni=1;const e=Je();return Ur=(r,n)=>{const o=e(r,n);return o&&o.prerelease.length?o.prerelease:null},Ur}var Vr,oi;function fe(){if(oi)return Vr;oi=1;const e=se();return Vr=(r,n,o)=>new e(r,o).compare(new e(n,o)),Vr}var Mr,si;function Wg(){if(si)return Mr;si=1;const e=fe();return Mr=(r,n,o)=>e(n,r,o),Mr}var Fr,ii;function Gg(){if(ii)return Fr;ii=1;const e=fe();return Fr=(r,n)=>e(r,n,!0),Fr}var Wr,ai;function Gr(){if(ai)return Wr;ai=1;const e=se();return Wr=(r,n,o)=>{const i=new e(r,o),s=new e(n,o);return i.compare(s)||i.compareBuild(s)},Wr}var Xr,ci;function Xg(){if(ci)return Xr;ci=1;const e=Gr();return Xr=(r,n)=>r.sort((o,i)=>e(o,i,n)),Xr}var Hr,ui;function Hg(){if(ui)return Hr;ui=1;const e=Gr();return Hr=(r,n)=>r.sort((o,i)=>e(i,o,n)),Hr}var Yr,li;function Ct(){if(li)return Yr;li=1;const e=fe();return Yr=(r,n,o)=>e(r,n,o)>0,Yr}var Kr,pi;function Qr(){if(pi)return Kr;pi=1;const e=fe();return Kr=(r,n,o)=>e(r,n,o)<0,Kr}var en,fi;function hi(){if(fi)return en;fi=1;const e=fe();return en=(r,n,o)=>e(r,n,o)===0,en}var tn,di;function mi(){if(di)return tn;di=1;const e=fe();return tn=(r,n,o)=>e(r,n,o)!==0,tn}var rn,gi;function nn(){if(gi)return rn;gi=1;const e=fe();return rn=(r,n,o)=>e(r,n,o)>=0,rn}var on,vi;function sn(){if(vi)return on;vi=1;const e=fe();return on=(r,n,o)=>e(r,n,o)<=0,on}var an,bi;function yi(){if(bi)return an;bi=1;const e=hi(),t=mi(),r=Ct(),n=nn(),o=Qr(),i=sn();return an=(a,c,u,l)=>{switch(c){case"===":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a===u;case"!==":return typeof a=="object"&&(a=a.version),typeof u=="object"&&(u=u.version),a!==u;case"":case"=":case"==":return e(a,u,l);case"!=":return t(a,u,l);case">":return r(a,u,l);case">=":return n(a,u,l);case"<":return o(a,u,l);case"<=":return i(a,u,l);default:throw new TypeError(`Invalid operator: ${c}`)}},an}var cn,_i;function Yg(){if(_i)return cn;_i=1;const e=se(),t=Je(),{safeRe:r,t:n}=et();return cn=(i,s)=>{if(i instanceof e)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;s=s||{};let a=null;if(!s.rtl)a=i.match(s.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const g=s.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let I;for(;(I=g.exec(i))&&(!a||a.index+a[0].length!==i.length);)(!a||I.index+I[0].length!==a.index+a[0].length)&&(a=I),g.lastIndex=I.index+I[1].length+I[2].length;g.lastIndex=-1}if(a===null)return null;const c=a[2],u=a[3]||"0",l=a[4]||"0",f=s.includePrerelease&&a[5]?`-${a[5]}`:"",d=s.includePrerelease&&a[6]?`+${a[6]}`:"";return t(`${c}.${u}.${l}${f}${d}`,s)},cn}var un,Si;function Kg(){if(Si)return un;Si=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return un=e,un}var ln,Ei;function he(){if(Ei)return ln;Ei=1;const e=/\s+/g;class t{constructor(_,C){if(C=o(C),_ instanceof t)return _.loose===!!C.loose&&_.includePrerelease===!!C.includePrerelease?_:new t(_.raw,C);if(_ instanceof i)return this.raw=_.value,this.set=[[_]],this.formatted=void 0,this;if(this.options=C,this.loose=!!C.loose,this.includePrerelease=!!C.includePrerelease,this.raw=_.trim().replace(e," "),this.set=this.raw.split("||").map(w=>this.parseRange(w.trim())).filter(w=>w.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const w=this.set[0];if(this.set=this.set.filter(O=>!v(O[0])),this.set.length===0)this.set=[w];else if(this.set.length>1){for(const O of this.set)if(O.length===1&&P(O[0])){this.set=[O];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let _=0;_<this.set.length;_++){_>0&&(this.formatted+="||");const C=this.set[_];for(let w=0;w<C.length;w++)w>0&&(this.formatted+=" "),this.formatted+=C[w].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(_){const w=((this.options.includePrerelease&&g)|(this.options.loose&&I))+":"+_,O=n.get(w);if(O)return O;const R=this.options.loose,N=R?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];_=_.replace(N,In(this.options.includePrerelease)),s("hyphen replace",_),_=_.replace(c[u.COMPARATORTRIM],l),s("comparator trim",_),_=_.replace(c[u.TILDETRIM],f),s("tilde trim",_),_=_.replace(c[u.CARETTRIM],d),s("caret trim",_);let B=_.split(" ").map(ne=>re(ne,this.options)).join(" ").split(/\s+/).map(ne=>kn(ne,this.options));R&&(B=B.filter(ne=>(s("loose invalid filter",ne,this.options),!!ne.match(c[u.COMPARATORLOOSE])))),s("range list",B);const j=new Map,W=B.map(ne=>new i(ne,this.options));for(const ne of W){if(v(ne))return[ne];j.set(ne.value,ne)}j.size>1&&j.has("")&&j.delete("");const ie=[...j.values()];return n.set(w,ie),ie}intersects(_,C){if(!(_ instanceof t))throw new TypeError("a Range is required");return this.set.some(w=>D(w,C)&&_.set.some(O=>D(O,C)&&w.every(R=>O.every(N=>R.intersects(N,C)))))}test(_){if(!_)return!1;if(typeof _=="string")try{_=new a(_,this.options)}catch{return!1}for(let C=0;C<this.set.length;C++)if(Cn(this.set[C],_,this.options))return!0;return!1}}ln=t;const r=Kg(),n=new r,o=Nr(),i=Ot(),s=It(),a=se(),{safeRe:c,t:u,comparatorTrimReplace:l,tildeTrimReplace:f,caretTrimReplace:d}=et(),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:I}=kt(),v=$=>$.value==="<0.0.0-0",P=$=>$.value==="",D=($,_)=>{let C=!0;const w=$.slice();let O=w.pop();for(;C&&w.length;)C=w.every(R=>O.intersects(R,_)),O=w.pop();return C},re=($,_)=>($=$.replace(c[u.BUILD],""),s("comp",$,_),$=F($,_),s("caret",$),$=Z($,_),s("tildes",$),$=T($,_),s("xrange",$),$=Rn($,_),s("stars",$),$),x=$=>!$||$.toLowerCase()==="x"||$==="*",Z=($,_)=>$.trim().split(/\s+/).map(C=>M(C,_)).join(" "),M=($,_)=>{const C=_.loose?c[u.TILDELOOSE]:c[u.TILDE];return $.replace(C,(w,O,R,N,B)=>{s("tilde",$,w,O,R,N,B);let j;return x(O)?j="":x(R)?j=`>=${O}.0.0 <${+O+1}.0.0-0`:x(N)?j=`>=${O}.${R}.0 <${O}.${+R+1}.0-0`:B?(s("replaceTilde pr",B),j=`>=${O}.${R}.${N}-${B} <${O}.${+R+1}.0-0`):j=`>=${O}.${R}.${N} <${O}.${+R+1}.0-0`,s("tilde return",j),j})},F=($,_)=>$.trim().split(/\s+/).map(C=>ee(C,_)).join(" "),ee=($,_)=>{s("caret",$,_);const C=_.loose?c[u.CARETLOOSE]:c[u.CARET],w=_.includePrerelease?"-0":"";return $.replace(C,(O,R,N,B,j)=>{s("caret",$,O,R,N,B,j);let W;return x(R)?W="":x(N)?W=`>=${R}.0.0${w} <${+R+1}.0.0-0`:x(B)?R==="0"?W=`>=${R}.${N}.0${w} <${R}.${+N+1}.0-0`:W=`>=${R}.${N}.0${w} <${+R+1}.0.0-0`:j?(s("replaceCaret pr",j),R==="0"?N==="0"?W=`>=${R}.${N}.${B}-${j} <${R}.${N}.${+B+1}-0`:W=`>=${R}.${N}.${B}-${j} <${R}.${+N+1}.0-0`:W=`>=${R}.${N}.${B}-${j} <${+R+1}.0.0-0`):(s("no pr"),R==="0"?N==="0"?W=`>=${R}.${N}.${B}${w} <${R}.${N}.${+B+1}-0`:W=`>=${R}.${N}.${B}${w} <${R}.${+N+1}.0-0`:W=`>=${R}.${N}.${B} <${+R+1}.0.0-0`),s("caret return",W),W})},T=($,_)=>(s("replaceXRanges",$,_),$.split(/\s+/).map(C=>tt(C,_)).join(" ")),tt=($,_)=>{$=$.trim();const C=_.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return $.replace(C,(w,O,R,N,B,j)=>{s("xRange",$,w,O,R,N,B,j);const W=x(R),ie=W||x(N),ne=ie||x(B),rt=ne;return O==="="&&rt&&(O=""),j=_.includePrerelease?"-0":"",W?O===">"||O==="<"?w="<0.0.0-0":w="*":O&&rt?(ie&&(N=0),B=0,O===">"?(O=">=",ie?(R=+R+1,N=0,B=0):(N=+N+1,B=0)):O==="<="&&(O="<",ie?R=+R+1:N=+N+1),O==="<"&&(j="-0"),w=`${O+R}.${N}.${B}${j}`):ie?w=`>=${R}.0.0${j} <${+R+1}.0.0-0`:ne&&(w=`>=${R}.${N}.0${j} <${R}.${+N+1}.0-0`),s("xRange return",w),w})},Rn=($,_)=>(s("replaceStars",$,_),$.trim().replace(c[u.STAR],"")),kn=($,_)=>(s("replaceGTE0",$,_),$.trim().replace(c[_.includePrerelease?u.GTE0PRE:u.GTE0],"")),In=$=>(_,C,w,O,R,N,B,j,W,ie,ne,rt)=>(x(w)?C="":x(O)?C=`>=${w}.0.0${$?"-0":""}`:x(R)?C=`>=${w}.${O}.0${$?"-0":""}`:N?C=`>=${C}`:C=`>=${C}${$?"-0":""}`,x(W)?j="":x(ie)?j=`<${+W+1}.0.0-0`:x(ne)?j=`<${W}.${+ie+1}.0-0`:rt?j=`<=${W}.${ie}.${ne}-${rt}`:$?j=`<${W}.${ie}.${+ne+1}-0`:j=`<=${j}`,`${C} ${j}`.trim()),Cn=($,_,C)=>{for(let w=0;w<$.length;w++)if(!$[w].test(_))return!1;if(_.prerelease.length&&!C.includePrerelease){for(let w=0;w<$.length;w++)if(s($[w].semver),$[w].semver!==i.ANY&&$[w].semver.prerelease.length>0){const O=$[w].semver;if(O.major===_.major&&O.minor===_.minor&&O.patch===_.patch)return!0}return!1}return!0};return ln}var pn,$i;function Ot(){if($i)return pn;$i=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,f){if(f=r(f),l instanceof t){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),s("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(l){const f=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],d=l.match(f);if(!d)throw new TypeError(`Invalid comparator: ${l}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(s("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return i(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||i(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||i(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}pn=t;const r=Nr(),{safeRe:n,t:o}=et(),i=yi(),s=It(),a=se(),c=he();return pn}var fn,Ai;function Pt(){if(Ai)return fn;Ai=1;const e=he();return fn=(r,n,o)=>{try{n=new e(n,o)}catch{return!1}return n.test(r)},fn}var hn,wi;function Qg(){if(wi)return hn;wi=1;const e=he();return hn=(r,n)=>new e(r,n).set.map(o=>o.map(i=>i.value).join(" ").trim().split(" ")),hn}var dn,Ri;function ev(){if(Ri)return dn;Ri=1;const e=se(),t=he();return dn=(n,o,i)=>{let s=null,a=null,c=null;try{c=new t(o,i)}catch{return null}return n.forEach(u=>{c.test(u)&&(!s||a.compare(u)===-1)&&(s=u,a=new e(s,i))}),s},dn}var mn,ki;function tv(){if(ki)return mn;ki=1;const e=se(),t=he();return mn=(n,o,i)=>{let s=null,a=null,c=null;try{c=new t(o,i)}catch{return null}return n.forEach(u=>{c.test(u)&&(!s||a.compare(u)===1)&&(s=u,a=new e(s,i))}),s},mn}var gn,Ii;function rv(){if(Ii)return gn;Ii=1;const e=se(),t=he(),r=Ct();return gn=(o,i)=>{o=new t(o,i);let s=new e("0.0.0");if(o.test(s)||(s=new e("0.0.0-0"),o.test(s)))return s;s=null;for(let a=0;a<o.set.length;++a){const c=o.set[a];let u=null;c.forEach(l=>{const f=new e(l.semver.version);switch(l.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!u||r(f,u))&&(u=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${l.operator}`)}}),u&&(!s||r(s,u))&&(s=u)}return s&&o.test(s)?s:null},gn}var vn,Ci;function nv(){if(Ci)return vn;Ci=1;const e=he();return vn=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},vn}var bn,Oi;function yn(){if(Oi)return bn;Oi=1;const e=se(),t=Ot(),{ANY:r}=t,n=he(),o=Pt(),i=Ct(),s=Qr(),a=sn(),c=nn();return bn=(l,f,d,g)=>{l=new e(l,g),f=new n(f,g);let I,v,P,D,re;switch(d){case">":I=i,v=a,P=s,D=">",re=">=";break;case"<":I=s,v=c,P=i,D="<",re="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(l,f,g))return!1;for(let x=0;x<f.set.length;++x){const Z=f.set[x];let M=null,F=null;if(Z.forEach(ee=>{ee.semver===r&&(ee=new t(">=0.0.0")),M=M||ee,F=F||ee,I(ee.semver,M.semver,g)?M=ee:P(ee.semver,F.semver,g)&&(F=ee)}),M.operator===D||M.operator===re||(!F.operator||F.operator===D)&&v(l,F.semver))return!1;if(F.operator===re&&P(l,F.semver))return!1}return!0},bn}var _n,Pi;function ov(){if(Pi)return _n;Pi=1;const e=yn();return _n=(r,n,o)=>e(r,n,">",o),_n}var Sn,Ni;function sv(){if(Ni)return Sn;Ni=1;const e=yn();return Sn=(r,n,o)=>e(r,n,"<",o),Sn}var En,zi;function iv(){if(zi)return En;zi=1;const e=he();return En=(r,n,o)=>(r=new e(r,o),n=new e(n,o),r.intersects(n,o)),En}var $n,Ti;function av(){if(Ti)return $n;Ti=1;const e=Pt(),t=fe();return $n=(r,n,o)=>{const i=[];let s=null,a=null;const c=r.sort((d,g)=>t(d,g,o));for(const d of c)e(d,n,o)?(a=d,s||(s=d)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const u=[];for(const[d,g]of i)d===g?u.push(d):!g&&d===c[0]?u.push("*"):g?d===c[0]?u.push(`<=${g}`):u.push(`${d} - ${g}`):u.push(`>=${d}`);const l=u.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return l.length<f.length?l:n},$n}var An,Li;function cv(){if(Li)return An;Li=1;const e=he(),t=Ot(),{ANY:r}=t,n=Pt(),o=fe(),i=(f,d,g={})=>{if(f===d)return!0;f=new e(f,g),d=new e(d,g);let I=!1;e:for(const v of f.set){for(const P of d.set){const D=c(v,P,g);if(I=I||D!==null,D)continue e}if(I)return!1}return!0},s=[new t(">=0.0.0-0")],a=[new t(">=0.0.0")],c=(f,d,g)=>{if(f===d)return!0;if(f.length===1&&f[0].semver===r){if(d.length===1&&d[0].semver===r)return!0;g.includePrerelease?f=s:f=a}if(d.length===1&&d[0].semver===r){if(g.includePrerelease)return!0;d=a}const I=new Set;let v,P;for(const T of f)T.operator===">"||T.operator===">="?v=u(v,T,g):T.operator==="<"||T.operator==="<="?P=l(P,T,g):I.add(T.semver);if(I.size>1)return null;let D;if(v&&P){if(D=o(v.semver,P.semver,g),D>0)return null;if(D===0&&(v.operator!==">="||P.operator!=="<="))return null}for(const T of I){if(v&&!n(T,String(v),g)||P&&!n(T,String(P),g))return null;for(const tt of d)if(!n(T,String(tt),g))return!1;return!0}let re,x,Z,M,F=P&&!g.includePrerelease&&P.semver.prerelease.length?P.semver:!1,ee=v&&!g.includePrerelease&&v.semver.prerelease.length?v.semver:!1;F&&F.prerelease.length===1&&P.operator==="<"&&F.prerelease[0]===0&&(F=!1);for(const T of d){if(M=M||T.operator===">"||T.operator===">=",Z=Z||T.operator==="<"||T.operator==="<=",v){if(ee&&T.semver.prerelease&&T.semver.prerelease.length&&T.semver.major===ee.major&&T.semver.minor===ee.minor&&T.semver.patch===ee.patch&&(ee=!1),T.operator===">"||T.operator===">="){if(re=u(v,T,g),re===T&&re!==v)return!1}else if(v.operator===">="&&!n(v.semver,String(T),g))return!1}if(P){if(F&&T.semver.prerelease&&T.semver.prerelease.length&&T.semver.major===F.major&&T.semver.minor===F.minor&&T.semver.patch===F.patch&&(F=!1),T.operator==="<"||T.operator==="<="){if(x=l(P,T,g),x===T&&x!==P)return!1}else if(P.operator==="<="&&!n(P.semver,String(T),g))return!1}if(!T.operator&&(P||v)&&D!==0)return!1}return!(v&&Z&&!P&&D!==0||P&&M&&!v&&D!==0||ee||F)},u=(f,d,g)=>{if(!f)return d;const I=o(f.semver,d.semver,g);return I>0?f:I<0||d.operator===">"&&f.operator===">="?d:f},l=(f,d,g)=>{if(!f)return d;const I=o(f.semver,d.semver,g);return I<0?f:I>0||d.operator==="<"&&f.operator==="<="?d:f};return An=i,An}var wn,xi;function uv(){if(xi)return wn;xi=1;const e=et(),t=kt(),r=se(),n=Ws(),o=Je(),i=Dg(),s=Zg(),a=Bg(),c=Jg(),u=Ug(),l=Vg(),f=Mg(),d=Fg(),g=fe(),I=Wg(),v=Gg(),P=Gr(),D=Xg(),re=Hg(),x=Ct(),Z=Qr(),M=hi(),F=mi(),ee=nn(),T=sn(),tt=yi(),Rn=Yg(),kn=Ot(),In=he(),Cn=Pt(),$=Qg(),_=ev(),C=tv(),w=rv(),O=nv(),R=yn(),N=ov(),B=sv(),j=iv(),W=av(),ie=cv();return wn={parse:o,valid:i,clean:s,inc:a,diff:c,major:u,minor:l,patch:f,prerelease:d,compare:g,rcompare:I,compareLoose:v,compareBuild:P,sort:D,rsort:re,gt:x,lt:Z,eq:M,neq:F,gte:ee,lte:T,cmp:tt,coerce:Rn,Comparator:kn,Range:In,satisfies:Cn,toComparators:$,maxSatisfying:_,minSatisfying:C,minVersion:w,validRange:O,outside:R,gtr:N,ltr:B,intersects:j,simplifyRange:W,subset:ie,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},wn}var lv=uv();const pv=(e,t)=>fv(t)?t.hostnames.includes(new URL(e).hostname):hv(t)?!!e.match(t.regexp):!1,fv=e=>wr.safeParse(e).success,hv=e=>Rr.safeParse(e).success,dv=(e,t)=>t?lv.satisfies(e,t):!0,mv=(e,t,r)=>dv(t,r.libraryVersionRange)&&pv(e,r.matcher),gv=(e,t)=>e.siteRegistrations.filter(r=>mv(t,Ar(),r)),vv=(e,t)=>gv(e,t).flatMap(({parsers:o,name:i})=>o.filter(s=>Zs(s)&&s in $r).map(s=>({parser:$r[s],parserType:s,name:i}))),bv=(e,t)=>{const r=vv(e,t.url);for(const{parser:n,parserType:o,name:i}of r){const s=n(t);if(bt(s)||is(s)||as(s))return{...s,meta:{parserName:i,parserType:o,referrer:t.url}}}return{...os(),meta:{parserName:null,parserType:z.NoResourceFound,referrer:t.url}}},yv=(e,t)=>t===$e.CA?new URL(`https://${e}.rl.ca.talis.com`):new URL(`https://${e}.rl.talis.com`),_v=(e,t)=>{const r=yv(e,t);return new URL("/ui/forms/bookmarklet.html",r)},Sv=(e,t,r)=>{const n=qo(t);n.append("fast","true"),n.append("breakout","true"),r&&(r.parserName&&n.append("targetTitle",r.parserName),n.append("referrer",r.referrer));const o=new URL(e.toString());return o.search=n.toString(),o};y.BookGenresSchema=vp,y.CustomerListSchema=Uo,y.CustomerSchema=Gt,y.DirectLinkOnlyResultSchema=Yt,y.Genre=S,y.HostnamesMatcherSchema=wr,y.JournalGenresSchema=bp,y.NON_OPENURL_PROPERTIES=Ft,y.NonOpenUrlPropertiesSchema=Vt,y.NothingParsedResultSchema=Ht,y.OPENURL_KEYS=xo,y.OpenUrlAudioVisualResourceSchema=Sp,y.OpenUrlBookResourceSchema=yp,y.OpenUrlDocumentResourceSchema=$p,y.OpenUrlImageResourceSchema=Ep,y.OpenUrlJournalResourceSchema=_p,y.OpenUrlResourceSchema=ve,y.OpenUrlResultSchema=Kt,y.OpenUrlWebpageResourceSchema=Ap,y.PARSERS=$r,y.ParserRegistrySchema=Ds,y.ParserType=z,y.ParsingMetadataSchema=Xt,y.ParsingRequestSchema=Jo,y.ParsingResponseSchema=Wo,y.ParsingResultSchema=tr,y.REGISTRY=zg,y.RegExpMatcherSchema=Rr,y.ResourceDataSchema=Bs,y.ResourceSchema=zo,y.SiteRegistrationSchema=Ir,y.SummonSearchResultSchema=er,y.TenantRegion=$e,y.TenantRegistrySchema=Op,y.TenantSchema=Wt,y.UrlMatcherSchema=kr,y.Z3988SearchResultSchema=Qt,y.convertCustomerListToTenantRegistry=zp,y.createAudioVisual=ge,y.createBook=V,y.createDocument=Mt,y.createImage=To,y.createJournal=q,y.createWebpage=dt,y.directLinkOnly=Lp,y.fromOpenUrl=Zo,y.getBaseBookmarkingUrl=_v,y.getLibraryVersion=Ar,y.isCustomer=Vo,y.isCustomerList=Mo,y.isDirectLinkOnlyResult=oh,y.isGenre=Cp,y.isNothingParsedResult=sh,y.isOpenUrlResult=bt,y.isParserRegistry=Tg,y.isParserType=Zs,y.isParsingMetadata=nh,y.isParsingRequest=Pp,y.isParsingResponse=rh,y.isParsingResult=th,y.isResourceData=qg,y.isSiteRegistration=Lg,y.isSummonSearchResult=as,y.isTenant=Fo,y.isTenantRegion=Np,y.isUrlMatcher=xg,y.isZ3988SearchResult=is,y.nothingParsed=L,y.openUrlResource=E,y.parseResource=bv,y.summonSearchResult=Xo,y.toBookmarkingWorkflowUrl=Sv,y.toOpenUrl=qo,y.z3988SearchResult=Go,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ti(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ri(t,`input`,e.processors),output:ri(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function T(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return T(r.element,n);if(r.type===`set`)return T(r.valueType,n);if(r.type===`lazy`)return T(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return T(r.innerType,n);if(r.type===`intersection`)return T(r.left,n)||T(r.right,n);if(r.type===`record`||r.type===`map`)return T(r.keyType,n)||T(r.valueType,n);if(r.type===`pipe`)return T(r.in,n)||T(r.out,n);if(r.type===`object`){for(let e in r.shape)if(T(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(T(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(T(e,n))return!0;return!!(r.rest&&T(r.rest,n))}return!1}var ni=(e,t={})=>n=>{let r=$r({...n,processors:t});return w(e,r),ei(r,e),ti(r,e)},ri=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=$r({...i??{},target:a,io:t,processors:n});return w(e,o),ei(o,e),ti(o,e)},ii={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ai=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ii[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},oi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},si=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ci=(e,t,n,r)=>{n.not={}},li=(e,t,n,r)=>{let i=e._zod.def,a=s(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ui=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},pi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=w(a.element,t,{...r,path:[...r.path,`items`]})},mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=w(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=w(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},hi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>w(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},gi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=w(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},_i=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=w(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=w(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=w(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},vi=(e,t,n,r)=>{let i=e._zod.def,a=w(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},xi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Si=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ci=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;w(a,t,r);let o=t.seen.get(e);o.ref=a},wi=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ti=(e,t,n,r)=>{let i=e._zod.def;w(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ei=n(`ZodISODateTime`,(e,t)=>{qt.init(e,t),k.init(e,t)});function Di(e){return yr(Ei,e)}var Oi=n(`ZodISODate`,(e,t)=>{Jt.init(e,t),k.init(e,t)});function ki(e){return br(Oi,e)}var Ai=n(`ZodISOTime`,(e,t)=>{Yt.init(e,t),k.init(e,t)});function ji(e){return xr(Ai,e)}var Mi=n(`ZodISODuration`,(e,t)=>{Xt.init(e,t),k.init(e,t)});function Ni(e){return Sr(Mi,e)}var Pi=(e,t)=>{Ce.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ee(e,t)},flatten:{value:t=>Te(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get(){return e.issues.length===0}}})};n(`ZodError`,Pi);var E=n(`ZodError`,Pi,{Parent:Error}),Fi=De(E),Ii=Oe(E),Li=ke(E),Ri=je(E),zi=Ne(E),Bi=Pe(E),Vi=Fe(E),Hi=Ie(E),Ui=Le(E),Wi=Re(E),Gi=ze(E),Ki=Be(E),D=n(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ri(e,`input`),output:ri(e,`output`)}}),e.toJSONSchema=ni(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(g(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>oe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Fi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Li(e,t,n),e.parseAsync=async(t,n)=>Ii(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ri(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>zi(e,t,n),e.decode=(t,n)=>Bi(e,t,n),e.encodeAsync=async(t,n)=>Vi(e,t,n),e.decodeAsync=async(t,n)=>Hi(e,t,n),e.safeEncode=(t,n)=>Ui(e,t,n),e.safeDecode=(t,n)=>Wi(e,t,n),e.safeEncodeAsync=async(t,n)=>Gi(e,t,n),e.safeDecodeAsync=async(t,n)=>Ki(e,t,n),e.refine=(t,n)=>e.check(no(t,n)),e.superRefine=t=>e.check(ro(t)),e.overwrite=t=>e.check(Hr(t)),e.optional=()=>P(e),e.exactOptional=()=>za(e),e.nullable=()=>Va(e),e.nullish=()=>P(Va(e)),e.nonoptional=t=>qa(e,t),e.array=()=>A(e),e.or=t=>M([e,t]),e.and=t=>ka(e,t),e.transform=t=>Za(e,Ia(t)),e.default=t=>Ua(e,t),e.prefault=t=>Ga(e,t),e.catch=t=>Ya(e,t),e.pipe=t=>Za(e,t),e.readonly=()=>$a(e),e.describe=t=>{let n=e.clone();return Yn.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Yn.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Yn.get(e);let n=e.clone();return Yn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),qi=n(`_ZodString`,(e,t)=>{Ft.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ir(...t)),e.includes=(...t)=>e.check(zr(...t)),e.startsWith=(...t)=>e.check(Br(...t)),e.endsWith=(...t)=>e.check(Vr(...t)),e.min=(...t)=>e.check(Pr(...t)),e.max=(...t)=>e.check(Nr(...t)),e.length=(...t)=>e.check(Fr(...t)),e.nonempty=(...t)=>e.check(Pr(1,...t)),e.lowercase=t=>e.check(Lr(t)),e.uppercase=t=>e.check(Rr(t)),e.trim=()=>e.check(Wr()),e.normalize=(...t)=>e.check(Ur(...t)),e.toLowerCase=()=>e.check(Gr()),e.toUpperCase=()=>e.check(Kr()),e.slugify=()=>e.check(qr())}),Ji=n(`ZodString`,(e,t)=>{Ft.init(e,t),qi.init(e,t),e.email=t=>e.check(Zn(Yi,t)),e.url=t=>e.check(rr(Qi,t)),e.jwt=t=>e.check(vr(ma,t)),e.emoji=t=>e.check(ir(ea,t)),e.guid=t=>e.check(Qn(Xi,t)),e.uuid=t=>e.check($n(Zi,t)),e.uuidv4=t=>e.check(er(Zi,t)),e.uuidv6=t=>e.check(tr(Zi,t)),e.uuidv7=t=>e.check(nr(Zi,t)),e.nanoid=t=>e.check(ar(ta,t)),e.guid=t=>e.check(Qn(Xi,t)),e.cuid=t=>e.check(or(na,t)),e.cuid2=t=>e.check(sr(ra,t)),e.ulid=t=>e.check(cr(ia,t)),e.base64=t=>e.check(hr(da,t)),e.base64url=t=>e.check(gr(fa,t)),e.xid=t=>e.check(lr(aa,t)),e.ksuid=t=>e.check(ur(oa,t)),e.ipv4=t=>e.check(dr(sa,t)),e.ipv6=t=>e.check(fr(ca,t)),e.cidrv4=t=>e.check(pr(la,t)),e.cidrv6=t=>e.check(mr(ua,t)),e.e164=t=>e.check(_r(pa,t)),e.datetime=t=>e.check(Di(t)),e.date=t=>e.check(ki(t)),e.time=t=>e.check(ji(t)),e.duration=t=>e.check(Ni(t))});function O(e){return Xn(Ji,e)}var k=n(`ZodStringFormat`,(e,t)=>{C.init(e,t),qi.init(e,t)}),Yi=n(`ZodEmail`,(e,t)=>{Rt.init(e,t),k.init(e,t)}),Xi=n(`ZodGUID`,(e,t)=>{It.init(e,t),k.init(e,t)}),Zi=n(`ZodUUID`,(e,t)=>{Lt.init(e,t),k.init(e,t)}),Qi=n(`ZodURL`,(e,t)=>{zt.init(e,t),k.init(e,t)});function $i(e){return rr(Qi,e)}var ea=n(`ZodEmoji`,(e,t)=>{Bt.init(e,t),k.init(e,t)}),ta=n(`ZodNanoID`,(e,t)=>{Vt.init(e,t),k.init(e,t)}),na=n(`ZodCUID`,(e,t)=>{Ht.init(e,t),k.init(e,t)}),ra=n(`ZodCUID2`,(e,t)=>{Ut.init(e,t),k.init(e,t)}),ia=n(`ZodULID`,(e,t)=>{Wt.init(e,t),k.init(e,t)}),aa=n(`ZodXID`,(e,t)=>{Gt.init(e,t),k.init(e,t)}),oa=n(`ZodKSUID`,(e,t)=>{Kt.init(e,t),k.init(e,t)}),sa=n(`ZodIPv4`,(e,t)=>{Zt.init(e,t),k.init(e,t)}),ca=n(`ZodIPv6`,(e,t)=>{Qt.init(e,t),k.init(e,t)}),la=n(`ZodCIDRv4`,(e,t)=>{$t.init(e,t),k.init(e,t)}),ua=n(`ZodCIDRv6`,(e,t)=>{en.init(e,t),k.init(e,t)}),da=n(`ZodBase64`,(e,t)=>{nn.init(e,t),k.init(e,t)}),fa=n(`ZodBase64URL`,(e,t)=>{an.init(e,t),k.init(e,t)}),pa=n(`ZodE164`,(e,t)=>{on.init(e,t),k.init(e,t)}),ma=n(`ZodJWT`,(e,t)=>{cn.init(e,t),k.init(e,t)}),ha=n(`ZodNumber`,(e,t)=>{ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.gt=(t,n)=>e.check(Ar(t,n)),e.gte=(t,n)=>e.check(jr(t,n)),e.min=(t,n)=>e.check(jr(t,n)),e.lt=(t,n)=>e.check(Or(t,n)),e.lte=(t,n)=>e.check(kr(t,n)),e.max=(t,n)=>e.check(kr(t,n)),e.int=t=>e.check(va(t)),e.safe=t=>e.check(va(t)),e.positive=t=>e.check(Ar(0,t)),e.nonnegative=t=>e.check(jr(0,t)),e.negative=t=>e.check(Or(0,t)),e.nonpositive=t=>e.check(kr(0,t)),e.multipleOf=(t,n)=>e.check(Mr(t,n)),e.step=(t,n)=>e.check(Mr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ga(e){return Cr(ha,e)}var _a=n(`ZodNumberFormat`,(e,t)=>{un.init(e,t),ha.init(e,t)});function va(e){return wr(_a,e)}var ya=n(`ZodNull`,(e,t)=>{dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r)});function ba(e){return Tr(ya,e)}var xa=n(`ZodUnknown`,(e,t)=>{fn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sa(){return Er(xa)}var Ca=n(`ZodNever`,(e,t)=>{pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r)});function wa(e){return Dr(Ca,e)}var Ta=n(`ZodArray`,(e,t)=>{hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Pr(t,n)),e.nonempty=t=>e.check(Pr(1,t)),e.max=(t,n)=>e.check(Nr(t,n)),e.length=(t,n)=>e.check(Fr(t,n)),e.unwrap=()=>e.element});function A(e,t){return Jr(Ta,e,t)}var Ea=n(`ZodObject`,(e,t)=>{bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),m(e,`shape`,()=>t.shape),e.keyof=()=>Na(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Sa()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sa()}),e.strict=()=>e.clone({...e._zod.def,catchall:wa()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>de(e,t),e.safeExtend=t=>fe(e,t),e.merge=t=>pe(e,t),e.pick=t=>le(e,t),e.omit=t=>ue(e,t),e.partial=(...t)=>me(La,e,t[0]),e.required=(...t)=>he(Ka,e,t[0])});function j(e,t){return new Ea({type:`object`,shape:e??{},...b(t)})}var Da=n(`ZodUnion`,(e,t)=>{Sn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.options=t.options});function M(e,t){return new Da({type:`union`,options:e,...b(t)})}var Oa=n(`ZodIntersection`,(e,t)=>{Cn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ka(e,t){return new Oa({type:`intersection`,left:e,right:t})}var Aa=n(`ZodRecord`,(e,t)=>{En.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ja(e,t,n){return new Aa({type:`record`,keyType:e,valueType:t,...b(n)})}var Ma=n(`ZodEnum`,(e,t)=>{Dn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ma({...t,checks:[],...b(r),entries:i})}});function Na(e,t){return new Ma({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var Pa=n(`ZodLiteral`,(e,t)=>{On.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new Pa({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Fa=n(`ZodTransform`,(e,t)=>{kn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new i(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(xe(t))}};let a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n)):(n.value=a,n)}});function Ia(e){return new Fa({type:`transform`,transform:e})}var La=n(`ZodOptional`,(e,t)=>{jn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function P(e){return new La({type:`optional`,innerType:e})}var Ra=n(`ZodExactOptional`,(e,t)=>{Mn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function za(e){return new Ra({type:`optional`,innerType:e})}var Ba=n(`ZodNullable`,(e,t)=>{Nn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Va(e){return new Ba({type:`nullable`,innerType:e})}var Ha=n(`ZodDefault`,(e,t)=>{Pn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ua(e,t){return new Ha({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Wa=n(`ZodPrefault`,(e,t)=>{In.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ga(e,t){return new Wa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():re(t)}})}var Ka=n(`ZodNonOptional`,(e,t)=>{Ln.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qa(e,t){return new Ka({type:`nonoptional`,innerType:e,...b(t)})}var Ja=n(`ZodCatch`,(e,t)=>{zn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ya(e,t){return new Ja({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Xa=n(`ZodPipe`,(e,t)=>{Bn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.in=t.in,e.out=t.out});function Za(e,t){return new Xa({type:`pipe`,in:e,out:t})}var Qa=n(`ZodReadonly`,(e,t)=>{Hn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`readonly`,innerType:e})}var eo=n(`ZodCustom`,(e,t)=>{Wn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r)});function to(e,t){return Yr(eo,e??(()=>!0),t)}function no(e,t={}){return Xr(eo,e,t)}function ro(e){return Zr(e)}var F=function(e){return e.Article=`article`,e.AudioDocument=`audiodocument`,e.AudioVisualDocument=`audiovisualdocument`,e.Book=`book`,e.Bookitem=`bookitem`,e.Conference=`conference`,e.Document=`document`,e.Image=`image`,e.Issue=`issue`,e.Journal=`journal`,e.Preprint=`preprint`,e.Proceeding=`proceeding`,e.Report=`report`,e.Unknown=`unknown`,e.Webpage=`webpage`,e}({}),io=M([N(F.Book),N(F.Bookitem),N(F.Conference),N(F.Document),N(F.Report),N(F.Proceeding),N(F.Unknown)]),ao=M([N(F.Article),N(F.Conference),N(F.Issue),N(F.Journal),N(F.Preprint),N(F.Proceeding),N(F.Unknown)]),oo=j({artnum:O(),atitle:O(),aufirst:O(),aulast:O(),auinit:O(),auinit1:O(),auinitm:O(),ausuffix:O(),au:A(O()),aucorp:O(),bici:O(),btitle:O(),chron:O(),coden:O(),date:O(),edition:O(),eissn:O(),epage:O(),externalDBID:O(),externalDocID:O(),genre:Na(F),id:O(),isbn:O(),issn:O(),issue:O(),jtitle:O(),pages:O(),part:O(),place:O(),pub:O(),quarter:O(),rft_id:A(O()),series:O(),sici:O(),spage:O(),ssn:O(),stitle:O(),title:O(),tpages:O(),volume:O()}).partial(),so=j({bibid:O(),doi:O(),uri:O()}).partial(),co=oo.pick({atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,bici:!0,btitle:!0,date:!0,edition:!0,epage:!0,id:!0,isbn:!0,issn:!0,pages:!0,place:!0,pub:!0,rft_id:!0,title:!0,tpages:!0,series:!0,spage:!0}).partial(),lo=oo.pick({artnum:!0,atitle:!0,aufirst:!0,aulast:!0,auinit:!0,auinit1:!0,auinitm:!0,ausuffix:!0,au:!0,aucorp:!0,chron:!0,coden:!0,date:!0,epage:!0,id:!0,isbn:!0,eissn:!0,issn:!0,issue:!0,title:!0,jtitle:!0,pages:!0,part:!0,pub:!0,rft_id:!0,sici:!0,spage:!0,stitle:!0,ssn:!0,quarter:!0,volume:!0}).partial(),uo=oo.pick({au:!0,date:!0,isbn:!0,pub:!0,title:!0}).partial(),fo=oo.pick({au:!0,date:!0,pub:!0,title:!0}).partial(),po=oo.pick({au:!0,date:!0,pub:!0,title:!0,spage:!0,epage:!0}).partial(),mo=oo.pick({au:!0,date:!0,title:!0}).partial(),ho=j({...oo.shape,...so.shape}),I=(e,t)=>({...t,genre:e}),L=(e,t)=>({...t,genre:e}),R=e=>({...e,genre:F.AudioVisualDocument}),go=e=>({...e,genre:F.Image}),_o=e=>({...e,genre:F.Document}),vo=e=>({...e,genre:F.Webpage}),yo=e=>Object.keys(e.shape),bo=yo(oo),xo=yo(so),So=(e,t,n)=>{if(n.length>0&&typeof n[0]==`string`){let r=t.startsWith(`rft_`)?t:`rft.${t}`;e.append(r,n[0])}},Co=(e,t,n)=>{e.append(t,n)},wo=(e,t,n)=>{e.append(`rft.${t}`,n)},To=e=>xo.includes(e),Eo=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{Array.isArray(n)?So(t,e,n):typeof n==`string`&&n&&(To(e)?Co(t,e,n):wo(t,e,n))}),t},Do=(e,t,n,r)=>{let i=t.getAll(n).filter(e=>!!e).map(e=>e.trim());return i.length===0?e:{...e,[r]:i}},Oo=e=>{let t=ko(e),n=(e,n)=>{if(n===`au`)return Do(e,t,`rft.au`,`au`);if(n===`rft_id`)return Do(e,t,`rft_id`,`rft_id`);let r=To(n)?n:`rft.${n}`,i=t.get(r);return i?{...e,[n]:i.trim()}:e},r=[...bo,...xo].reduce(n,{});return Object.keys(r).length===0?null:r},ko=e=>URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e);function Ao(e){return typeof e==`string`?Object.values(F).includes(e):!1}var jo=function(e){return e.CA=`CA`,e.EUAPAC=`EUAPAC`,e}({}),Mo=j({id:O(),name:O(),region:Na(jo)}),No=j({tenants:A(Mo)}),Po=9*1024*1024,Fo=j({url:$i({error:e=>e.input===void 0?`should have the required string property "url"`:`"url" must be a string`}),html:O({error:e=>e.input===void 0?`should have the required string property "html"`:void 0}).max(Po,{error:`"html" should be a string with a MAX Length of ${Po}`}),tenantCode:O({error:e=>e.input===void 0?`should have the required string property "tenantCode"`:void 0}).min(1,{error:`"tenantCode" must be a string`}),region:Na([jo.EUAPAC,jo.CA],{error:e=>e.input===void 0?`should have the required string property "region"`:`"region" must be a string of EUAPAC or CA`})});function Io(e){return Fo.safeParse(e).success}var Lo=j({name:O(),region:Na(jo),apps:ja(O(),O())}),Ro=ja(O(),Lo),zo=e=>Lo.safeParse(e).success,Bo=e=>Ro.safeParse(e).success;function Vo(e){return Mo.safeParse(e).success}function Ho(e){return typeof e==`string`&&Object.keys(jo).includes(e)}var Uo=e=>{if(!Bo(e))throw Error(`Error: the customer list data is invalid.`);return{tenants:Object.entries(e).map(([e,t])=>Wo(e,t))}},Wo=(e,t)=>{if(!zo(t))throw Error(`Invalid customer: ${t}`);let{name:n,region:r}=t,i={id:e,name:n,region:r};if(!Vo(i))throw Error(`Invalid tenant: ${JSON.stringify(i)}`);return i},Go=j({parserType:O(),parserName:O().nullable(),referrer:O()}),Ko=j({bookmarkingWorkflowUrl:ba(),resource:ba()}),qo=j({bookmarkingWorkflowUrl:O(),resource:ba()}),Jo=j({bookmarkingWorkflowUrl:ba(),resource:ho}),Yo=j({z3988SearchResult:N(!0)}),Xo=j({summonSearchResult:N(!0)}),Zo=M([qo,Ko,Jo,Yo,Xo]),Qo=j({meta:Go}).and(Zo);function $o(e){return{bookmarkingWorkflowUrl:e,resource:null}}function z(){return{bookmarkingWorkflowUrl:null,resource:null}}function B(e){return{bookmarkingWorkflowUrl:null,resource:e}}function es(){return{z3988SearchResult:!0}}function ts(){return{summonSearchResult:!0}}var ns=e=>{let t=e.getAttribute(`title`);return t?Oo(t):null},rs=({document:e})=>{let t=Array.from(e.querySelectorAll(`.Z3988`));if(t.length===0)return z();let n=t.map(ns).find(e=>e!==null);return n?B(n):z()},is=e=>{let t=Array.from(e.querySelectorAll(`.author > a`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},as=e=>e.querySelector(`#rpi-attribute-book_details-edition > .rpi-attribute-value > span`)?.textContent??void 0,os=e=>{let t=e.querySelector(`#rpi-attribute-book_details-isbn10 > .rpi-attribute-value > span`)?.textContent??void 0,n=e.querySelector(`#rpi-attribute-book_details-isbn13 > .rpi-attribute-value > span`)?.textContent??void 0;if(t&&n)return`${t},${n}`;if(t)return t;if(n)return n},ss=e=>e.querySelector(`#rpi-attribute-book_details-publication_date > .rpi-attribute-value > span`)?.textContent??void 0,cs=e=>e.querySelector(`#rpi-attribute-book_details-publisher > .rpi-attribute-value > span`)?.textContent??void 0,ls=e=>e.querySelector(`#rpi-attribute-book_details-series > .rpi-attribute-value > a`)?.textContent??void 0,us=e=>{let t=e.querySelector(`#rpi-attribute-book_details-fiona_pages > .rpi-attribute-value > span`)?.textContent??void 0;return(t?/\d+/.exec(t)?.[0]:null)??void 0},ds=({document:e})=>{let t=is(e),n=as(e),r=os(e),i=ss(e),a=cs(e),o=ls(e),s=e.getElementById(`productTitle`)?.textContent.trim()??void 0,c=us(e);return{bookmarkingWorkflowUrl:null,resource:I(F.Book,{au:t,date:i,edition:n,isbn:r,pub:a,series:o,title:s,tpages:c})}},V=(e,t,n)=>{let r=H(e,t,n);return r.length>0?r[0]:void 0},H=(e,t,n)=>Array.from(e.querySelectorAll(`meta[${t}='${n}']`)).map(e=>e.getAttribute(`content`)).filter(e=>!!e?.trim()),fs=e=>{let t=new Map,n=e.split(`;`).filter(e=>!!e);for(let e of n){let[n,r,i]=e.split(`:`);t.set(n,{type:r,value:i})}return t},U=function(e){return e[e.None=0]=`None`,e[e.Book=1]=`Book`,e[e.Chapter=2]=`Chapter`,e[e.Journal=3]=`Journal`,e[e.Article=4]=`Article`,e[e.AudioVisual=5]=`AudioVisual`,e[e.Webpage=6]=`Webpage`,e[e.Document=7]=`Document`,e}({}),ps=e=>{if(!e)return;let t=/\b\d{4}\b/.exec(e);return t?t[0]:void 0},ms=e=>ps(e.querySelector(`#publication_date p`)?.textContent.trim()??V(e,`name`,`bepress_citation_date`)),hs=e=>({spage:V(e,`name`,`bepress_citation_firstpage`),epage:V(e,`name`,`bepress_citation_lastpage`)}),gs=e=>{let t=/https?:\/\/doi\.org\/(.+)/i,n=(e.querySelector(`#source p`)?.textContent.trim())?.match(t);if(n?.length===2)return n[1];let r=(e.querySelector(`#recommended_citation p a`)?.textContent.trim())?.match(t);if(r?.length===2)return r[1]},_s=e=>{let t=[],n=e.querySelectorAll(`tbody td`);for(let e of n){let n=e.querySelector(`strong`);if(n&&!n.querySelector(`a`)){let e=n.textContent.trim();e&&t.push(e)}}return t},vs=e=>V(e,`name`,`bepress_citation_title`)??e.querySelector(`title`)?.textContent.trim(),ys=e=>H(e,`name`,`author`),bs=e=>V(e,`name`,`bepress_citation_publisher`),xs=e=>V(e,`name`,`bepress_citation_pdf_url`),Ss=(e,t)=>{if(t.includes(`/etd/`))return U.Document;if(t.includes(`/sophpm_music/`)||t.includes(`/streaming/`))return U.AudioVisual;if(t.includes(`/vol`))return U.Article;if(t.includes(`/facpub`)||t.includes(`/studentpub/`)){let t={"book chapter":U.Book,"conference paper":U.Book,"peer-reviewed article":U.Article,other:U.Document},n=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();return n?t[n]:void 0}return U.Journal},Cs=e=>{let t=vs(e),n=ys(e),r=ms(e),i=V(e,`name`,`bepress_citation_journal_title`),a=V(e,`name`,`bepress_citation_volume`),o=V(e,`name`,`bepress_citation_issue`),{epage:s,spage:c}=hs(e),l=xs(e),u=gs(e);return L(F.Article,{atitle:t,jtitle:i,au:n,date:r,volume:a,issue:o,epage:s,spage:c,doi:u,uri:l})},ws=(e,t)=>{let n=e.querySelector(`.inherit-title a`)?.textContent.trim()??vs(e),r=_s(e),i=ms(e),a=bs(e),o=gs(e);return L(F.Journal,{jtitle:n,au:r,date:i,pub:a,doi:o,uri:t})},Ts=e=>{let t=vs(e),n=ys(e),r=ms(e),i=bs(e),a=xs(e),o=e.querySelector(`#document_type p`)?.textContent.toLowerCase().trim();if(o===`book chapter`){let o=e.querySelector(`#source p`)?.textContent.trim();return I(F.Bookitem,{pub:i,atitle:t,btitle:o,au:n,date:r,uri:a})}let s=gs(e);return I(o===`conference paper`?F.Conference:F.Document,{pub:i,title:t,au:n,date:r,doi:s,uri:a})},Es=(e,t)=>R({title:vs(e),au:ys(e),date:ms(e),pub:bs(e),uri:t}),Ds=e=>{let t=vs(e),n=ys(e),r=ms(e);return _o({pub:bs(e),title:t,au:n,date:r,uri:xs(e)})},Os=({url:e,document:t})=>{switch(Ss(t,e)){case U.Article:return B(Cs(t));case U.Journal:return B(ws(t,e));case U.Book:return B(Ts(t));case U.AudioVisual:return B(Es(t,e));case U.Document:return B(Ds(t));default:return z()}},ks=e=>{if(e)return e.replace(/[^0-9]/g,``)},As=e=>Array.from(e.querySelectorAll(`.author-source-list li a`)).filter(e=>e.childNodes.length>0).map(e=>e.childNodes[0].textContent?.trim()).filter(e=>!!e),js=e=>e.querySelector(`.article-header`)?.querySelector(`h1 span`)?.textContent.trim(),Ms=e=>({date:e?.textContent.match(/\d{4}/)?.[0],pub:`Elsevier Inc.`}),Ns=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.issue`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,[i,a]=(n?.split(`,`)??[]).map(e=>e.trim());return{volume:ks(i),issue:ks(a),jtitle:r}},Ps=e=>{let t=e.querySelector(`.article-header .source`)?.textContent,n=t?.match(/\d{4}-\d{2}-\d{2}/)?.[0],[r,i]=((t?.match(/Pages (\d+-\d+)/))?.[1].split(`-`)??[]).map(e=>e.trim()),{jtitle:a,volume:o,issue:s}=Ns(e);return B(L(F.Article,{au:As(e),atitle:js(e),spage:r,epage:i,date:n,jtitle:a,volume:o,issue:s}))},Fs=e=>{let[t,n]=e.querySelectorAll(`.source`),{date:r,pub:i}=Ms(n),[a,o]=(e.querySelector(`.browse__book-toc`)?.querySelector(`h1`)?.textContent.split(`,`)??[]).map(e=>e.trim());return B(I(F.Book,{btitle:a,edition:o,pub:i,au:t.textContent?[t.textContent]:void 0,date:r}))},Is=e=>{let t=e.querySelector(`.article-meta`);if(!t)return{};let n=t.querySelector(`.edition`)?.textContent??void 0,r=t.querySelector(`.title`)?.textContent.trim()??void 0,{date:i,pub:a}=Ms(t.querySelector(`.copyright`));return{edition:n,btitle:r,date:i,pub:a}},Ls=e=>{let{edition:t,btitle:n,date:r,pub:i}=Is(e),[a,o]=(((e.querySelector(`.article-header .source`)?.textContent)?.match(/(\d+-\d+|[IVXLCDM]+-[IVXLCDM]+)/i))?.[1].split(`-`)??[]).map(e=>e.trim());return B(I(F.Bookitem,{au:As(e),atitle:js(e),btitle:n,edition:t,pub:i,date:r,spage:a,epage:o}))},Rs=/^[0-9X]$/,zs=e=>{if(!e)return;let t=``;for(let n of e)Rs.test(n)&&(t+=n);if(t)return t},Bs=(e,t)=>{let n=e.querySelector(`.c-cksc-content-header__title`)?.textContent.trim(),r=e.querySelector(`.c-cksc-content-nice__button`)?.textContent.trim(),i=e.querySelector(`.c-cksc-content-nice__date`)?.textContent.trim(),a=zs(e.evaluate(`//p[contains(text(), "ISBN")]`,e,null,XPathResult.ANY_TYPE).iterateNext()?.textContent);return B({genre:F.Document,title:n,pub:r,date:i,uri:t,isbn:a})},Vs=e=>e.querySelector(`.browse-toc`)??e.querySelector(`.browse__journal`),Hs=e=>(Vs(e)?.querySelector(`h1`)?.firstElementChild)?.textContent.trim(),Us=e=>{let t=Vs(e),n=t?.querySelector(`figure figcaption.source`);if(n){let[e,t,r]=n.textContent.split(`,`).map(e=>e.trim());return{date:e,volume:ks(t),issue:ks(r)}}let[r,i]=(t?.querySelector(`p`)?.textContent)?.split(`,`)??[];return{date:t?.querySelector(`.source span`)?.textContent??void 0,volume:ks(r),issue:ks(i)}},Ws=e=>{let{date:t,volume:n,issue:r}=Us(e);return B(L(F.Journal,{jtitle:Hs(e),date:t,volume:n,issue:r}))},Gs=function(e){return e.Book=`Book`,e.Chapter=`Book Chapter`,e.Article=`Full Text Article`,e.Journal=`Journal`,e.Guideline=`Guideline`,e}(Gs||{}),Ks=e=>Object.values(Gs).includes(e),qs=(e,t)=>{let n=e.querySelector(`.content-type`)??e.querySelector(`.c-cksc-content-header__content-type`);if(!n)return t.includes(`journal`)?Gs.Journal:void 0;let r=n.textContent;if(r&&Ks(r))return r},Js=({url:e,document:t})=>{switch(qs(t,e)){case Gs.Book:return Fs(t);case Gs.Chapter:return Ls(t);case Gs.Article:return Ps(t);case Gs.Journal:return Ws(t);case Gs.Guideline:return Bs(t,e);case void 0:return z()}},Ys=j({"@context":O()}),Xs=e=>Ys.safeParse(e).success,Zs=`script[type="application/ld+json"]`,Qs=e=>Array.from(e.querySelectorAll(Zs)),$s=e=>e.querySelector(Zs),ec=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(Xs(e))return e}catch{return null}return null},tc=j({"@id":O(),"@type":O(),author:j({"@id":O()}).optional(),datePublished:O().optional(),dateModified:O().optional(),description:O().optional(),inLanguage:O().optional(),isPartOf:j({"@id":O()}).optional(),name:O().optional(),url:O().optional()}),nc=Ys.extend({"@graph":A(tc)}),rc=e=>nc.safeParse(e).success,ic=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rc).map(e=>e[`@graph`]);return n.length===1?n[0]:null},ac=(e,t)=>e.find(e=>e[`@type`]===t)??null,oc=(e,t)=>e.find(e=>e[`@id`]===t)??null,sc=e=>{let t=ac(e,`WebPage`);if(!t)return null;let n=t.author?oc(e,t.author[`@id`]):void 0;return vo({au:n?.name?[n.name]:void 0,date:t.datePublished,title:t.name})},cc=({document:e})=>{let t=ic(e);return t?{bookmarkingWorkflowUrl:null,resource:sc(t)}:z()},lc=()=>z(),uc=function(e){return e.Journal=`journal`,e.Article=`article`,e}(uc||{}),dc=e=>{let{pathname:t}=new URL(e);if(t.startsWith(`/toc/`))return uc.Journal;if(t.startsWith(`/article/`))return uc.Article},fc=e=>{let t=e.querySelector(`header h1 span`)?.firstChild?.textContent?.trim(),n=(e.querySelector(`header p span`)?.textContent.trim())?.match(/\d{4}-\d{3}[\dX]/g)??[],[r,i]=[n[0],n[1]],a=e.evaluate(`//dt[contains(text(), "Publisher")]/following-sibling::dd/a`,e,null,XPathResult.STRING_TYPE).stringValue.trim();return B(L(F.Journal,{pub:a,jtitle:t,issn:r,eissn:i}))},pc=e=>{let t,n,r=H(e,`name`,`citation_issn`);return r.length===2?(t=r[1],n=r[0]):t=r[0],{eissn:t,issn:n}},mc=e=>{let t=V(e,`name`,`citation_journal_title`),n=V(e,`name`,`citation_title`),r=H(e,`name`,`citation_author`),i=V(e,`name`,`citation_doi`),{eissn:a,issn:o}=pc(e),s=V(e,`name`,`citation_publisher`),c=V(e,`name`,`citation_publication_date`),l=V(e,`name`,`citation_volume`),u=V(e,`name`,`citation_issue`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_lastpage`);return B(L(F.Article,{jtitle:t,atitle:n,au:r,doi:i,eissn:a,issn:o,pub:s,date:c,volume:l,issue:u,spage:d,epage:f}))},hc=({document:e,url:t})=>{switch(dc(t)){case uc.Journal:return fc(e);case uc.Article:return mc(e);case void 0:return z()}},gc=e=>{let t=V(e,`name`,`pbContext`);if(!t)return U.None;let n=fs(t);switch(n.has(`page`)?n.get(`page`)?.value:null){case`Article/Chapter View`:return U.Article;case`Table of Contents`:return U.Journal;default:return U.None}},_c=e=>{let t=e.querySelector(`meta[property="article:author"]`)?.getAttribute(`content`)?.split(`,`).map(e=>e.trim());return t&&t.length>0?t:void 0},vc=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.rlist>li>span`)).map(e=>e.textContent.trim()).join(``),r=/^ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);r&&t.set(`issn`,r[1]);let i=/Online ISSN:\s(\d{4}-\d{3}(?:\d|X))/.exec(n);return i&&t.set(`eissn`,i[1]),t},yc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationVolume"] > span[property="volumeNumber"]`)?.textContent??void 0,bc=e=>e.querySelector(`span[property="isPartOf"][typeof="PublicationIssue"] > span[property="issueNumber"]`)?.textContent??void 0,xc=e=>e.querySelector(`meta[name="dc.Identifier"][scheme="doi"]`)?.getAttribute(`content`)??void 0,Sc=e=>e.querySelector(`h1`)?.textContent??void 0,Cc=e=>{let t=new Map,n=e.querySelector(`h2.heading-m`)?.textContent,r=n?.match(/Issue\s+(\d+(?:-\d+)?)/);r&&t.set(`issue`,r[1]);let i=n?.match(/Volume\s+(\d+)/);i&&t.set(`volume`,i[1]);let a=n?.match(/(\d{4})$/);return a&&t.set(`date`,a[1]),t},wc=e=>{let t=_c(e.document),n=V(e.document,`name`,`dc.Date`),r=xc(e.document),i=vc(e.document),a=i.get(`issn`),o=i.get(`eissn`),s=bc(e.document),c=V(e.document,`name`,`citation_journal_title`),l=V(e.document,`name`,`dc.Publisher`),u=V(e.document,`name`,`dc.Title`),d=yc(e.document);return L(F.Article,{au:t,date:n,eissn:o,issn:a,issue:s,jtitle:c,pub:l,title:u,volume:d,doi:r})},Tc=e=>{let t=vc(e.document),n=t.get(`issn`),r=t.get(`eissn`),i=Sc(e.document),a=Cc(e.document),o=a.get(`issue`),s=a.get(`volume`),c=a.get(`date`);return L(F.Journal,{eissn:r,issn:n,jtitle:i,title:i,issue:o,volume:s,date:c})},Ec=e=>{switch(gc(e.document)){case U.Article:return B(wc(e));case U.Journal:return B(Tc(e));default:return z()}},Dc=e=>{let t=V(e,`name`,`citation_type`),n=V(e,`name`,`citation_article_type`);return t===`JOUR`&&n?U.Article:t===`CHP`?U.Chapter:e.querySelector(`.book-edition-year`)?.textContent.includes(`Book`)?U.Book:e.getElementById(`journal-title`)?U.Journal:U.None},Oc=e=>V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??e.querySelector(`.doi .anchor-text`)?.textContent??void 0,kc=e=>{let t=Array.from(e.querySelectorAll(`.kf-details .kf-detail-item:has(h3)`)),n=new Map;for(let e of t){let t=e.querySelector(`h3`)?.textContent,r=e.querySelector(`p`)?.textContent;t&&r&&n.set(t,r)}return n},Ac=(e,t)=>{let n=Array.from(e.querySelectorAll(t)).map(e=>e.textContent).filter(e=>!!e);return n.length>0?n:void 0},jc=e=>{let t=e.querySelector(`.js-issn`)?.textContent;if(t)return t.replace(`Online ISSN: `,``)},Mc=e=>{let t=e.get(`DOI`);if(t)return URL.canParse(t)?new URL(t).pathname.substring(1):t},Nc=e=>{let t=kc(e),n=V(e,`property`,`og:title`),r=V(e,`property`,`og:book:isbn`),i=t.get(`Published`),a=Ac(e,`.authors-container .author-detail h3`),o=Oc(e)??Mc(t);return I(F.Book,{au:a,date:i,doi:o,isbn:r,title:n})},Pc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`property`,`og:book:isbn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_firstpage`),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_publisher`),c=Oc(e),l=V(e,`name`,`citation_inbook_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return I(F.Bookitem,{au:i,btitle:l,date:r,doi:c,epage:o,isbn:n,pub:s,spage:a,title:t})},Fc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`citation_issn`),r=V(e,`name`,`citation_publication_date`),i=Ac(e,`.author-group .button-link-text`),a=V(e,`name`,`citation_publisher`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_issue`),c=V(e,`name`,`citation_volume`),l=Oc(e),u=V(e,`name`,`citation_journal_title`)??e.querySelector(`.publication-title`)?.textContent??void 0;return L(F.Article,{au:i,jtitle:u,date:r,doi:l,issn:n,issue:s,pub:a,spage:o,title:t,volume:c})},Ic=e=>{let t=e.getElementById(`journal-title`)?.textContent??void 0,n=jc(e);return L(F.Journal,{issn:n,title:t})},Lc=({document:e})=>{switch(Dc(e)){case U.Book:return B(Nc(e));case U.Chapter:return B(Pc(e));case U.Article:return B(Fc(e));case U.Journal:return B(Ic(e));default:return z()}},Rc=e=>{let t=V(e,`name`,`pbContext`);return t&&fs(t).has(`article`)?U.Article:U.Journal},zc=e=>{let t=e.querySelector(`.itemPageRangeHistory`);if(!t)return;let n=Array.from(t.childNodes).find(e=>e.textContent?.trim().startsWith(`Page`));if(n)return n.textContent?.replace(/Pages?/,``).trim()??void 0},Bc=e=>{let t=e.querySelector(`.issue-heading`)?.textContent;if(t)return t.split(`,`)[0]?.replace(`Volume`,``).trim()},Vc=e=>{let t=e.querySelector(`.issue-heading .nav-toc-list`)?.textContent;if(t)return t.replace(`Issue`,``).trim()},Hc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`dc.Date`),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=H(e,`name`,`dc.Creator`),s=Bc(e),c=Vc(e),l=zc(e),u=l?.includes(`-`)?l.split(`-`)[0]:l,d=l?.includes(`-`)?l.split(`-`)[1]:l;return L(F.Article,{au:o,jtitle:a,date:r,doi:i,issue:c,pub:n,spage:u,epage:d,title:t,volume:s})},Uc=e=>{let t=V(e,`property`,`og:title`),n=V(e,`name`,`publication_doi`);return L(F.Journal,{doi:n,title:t})},Wc=({document:e})=>{switch(Rc(e)){case U.Article:return B(Hc(e));case U.Journal:return B(Uc(e));default:return z()}},Gc=e=>Zo.safeParse(e).success,Kc=e=>Qo.safeParse(e).success,qc=e=>Go.safeParse(e).success;function Jc(e){return qo.safeParse(e).success}function Yc(e){return Jo.safeParse(e).success}function Xc(e){return Yo.safeParse(e).success}function Zc(e){return Xo.safeParse(e).success}function Qc(e){return Ko.safeParse(e).success}var $c=e=>Array.from(e.querySelectorAll(`tr th`)).find(e=>e.textContent.trim()===`DOI:`)?.nextElementSibling?.querySelector(`span[property="identifier"]`)?.textContent??void 0,el=e=>{let t=/Record\/(\d+)/.exec(e);if(t&&t.length>1)return t[1]},tl=e=>{let{url:t,document:n}=e,r=rs(e);if(!Yc(r))return r;let i=$c(n);return i&&(r.resource.rft_id=[`info:doi/${i}`]),r.resource.bibid=el(t),r},nl=Ys.extend({"@type":N(`VideoObject`),name:O(),author:O(),genre:O(),description:O(),uploadDate:O(),duration:O(),thumbnailUrl:A(O())}),rl=e=>nl.safeParse(e).success,il=e=>{let t=Qs(e);if(t.length===0)return null;let n=t.map(ec).filter(rl);return n.length===1?n[0]:null},al=({url:e,document:t})=>{let n=il(t);return n?{bookmarkingWorkflowUrl:null,resource:R({au:[n.author],date:n.uploadDate,title:n.name,uri:e})}:z()},ol=e=>V(e,`name`,`doi`)??V(e,`name`,`DOI`)??V(e,`name`,`citation_doi`)??V(e,`name`,`dc.identifier`)??V(e,`name`,`prism.doi`)??void 0,sl=e=>{let t=e.editor?.map(e=>e.name)??[],n=[...e.author?.map(e=>e.name)??[],...t];if(n.length!==0)return n},cl=function(e){return e.Book=`Book`,e.Journal=`Journal`,e.Periodical=`Periodical`,e.PublicationVolume=`PublicationVolume`,e.ScholarlyArticle=`ScholarlyArticle`,e.VideoObject=`VideoObject`,e.WebPage=`WebPage`,e}({}),ll=function(e){return e.Article=`article`,e.Book=`book`,e.Paper=`Paper`,e.Video=`video.other`,e.Website=`website`,e}({}),W=function(e){return e.Article=`/article/`,e.Book=`/book/`,e.Chapter=`/chapter/`,e.Video=`/video/`,e.ReferenceWorkEntry=`/referenceworkentry/`,e.ReferenceWork=`/referencework/`,e.Protocol=`/protocol/`,e.Collections=`/collections/`,e.Journal=`/journal/`,e.JournalIssue=`/volumes-and-issues/`,e}({}),ul=j({"@type":N(cl.ScholarlyArticle),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),datePublished:O().optional(),headline:O().optional(),issn:A(O()).optional(),pageStart:O().optional(),pageEnd:O().optional(),isPartOf:j({"@type":M([O(),A(O())]),name:O(),issn:A(O()).optional(),volumeNumber:O().optional(),isbn:A(O()).optional()}),publisher:j({"@type":O(),name:O()}).optional()}),dl=e=>ul.safeParse(e).success,fl=Ys.extend({"@type":N(cl.WebPage),mainEntity:ul}),pl=e=>fl.safeParse(e).success,ml=j({"@type":A(O()),name:O().optional(),issn:A(O()),volumeNumber:O().optional()}),hl=e=>ml.safeParse(e).success,gl=(e,t)=>V(e,`name`,`citation_issn`)??V(e,`name`,`prism.issn`)??(dl(t.isPartOf)?t.isPartOf.issn?.[0]:void 0),_l=(e,t)=>{let n=sl(t),r=V(e,`name`,`citation_online_date`),i=ol(e),a=V(e,`name`,`citation_issue`),o=gl(e,t),s=hl(t.isPartOf)&&t.isPartOf.issn.length>0?t.isPartOf.issn[1]:void 0,c=t.pageStart,l=t.pageEnd,u=t.headline,d=t.isPartOf.name,f=hl(t.isPartOf)?t.isPartOf.volumeNumber:void 0;return L(F.Article,{au:n,date:r,doi:i,issue:a,eissn:o,issn:s,spage:c,epage:l,atitle:u,jtitle:d,volume:f})},vl=Ys.extend({"@type":N(cl.Book),copyrightYear:O().optional(),author:A(j({"@type":O(),name:O()})).optional(),editor:A(j({"@type":O(),name:O()})).optional(),isbn:O().optional(),name:O().optional(),numberOfPages:ga().optional(),publisher:j({"@type":O(),name:O()}).optional()}),yl=e=>vl.safeParse(e).success,bl=function(e){return e.BOOK_TITLE=`Book Title`,e.AUTHORS=`Authors`,e.SERIES_TITLE=`Series Title`,e.DOI=`DOI`,e.PUBLISHER=`Publisher`,e.SOFTCOVER_ISBN=`Softcover ISBN`,e.EBOOK_ISBN=`eBook ISBN`,e.SERIES_ISSN=`Series ISSN`,e.SERIES_EISSN=`Series E-ISSN`,e.EDITION_NUMBER=`Edition Number`,e.NUMBER_OF_PAGES=`Number of Pages`,e}(bl||{}),xl=e=>{let t=e.querySelectorAll(`.c-bibliographic-information__list-item`),n=new Map;return t.forEach(e=>{let t=e.querySelector(`.u-text-bold`)?.textContent.trim(),r=e.querySelector(`.c-bibliographic-information__value`)?.textContent.trim();t&&r&&n.set(t,r)}),n},Sl=(e,t)=>{let n=xl(e),r=sl(t),i=t.copyrightYear?.toString(),a=ol(e)??n.get(bl.DOI),o=t.name??n.get(bl.BOOK_TITLE),s=t.isbn??n.get(bl.SOFTCOVER_ISBN),c=t.numberOfPages?.toString()??n.get(bl.NUMBER_OF_PAGES),l=t.publisher?.name??n.get(bl.PUBLISHER);return I(F.Book,{au:r,date:i,doi:a,title:o,isbn:s,tpages:c,pub:l})},Cl=j({"@type":N(`Periodical`),name:O(),url:O(),issn:A(O()),editor:A(j({givenName:O(),familyName:O()})),publisher:j({name:O()}),description:O()}),wl=e=>Cl.safeParse(e).success,Tl=e=>{let t=e.editor.map(({givenName:e,familyName:t})=>`${e} ${t}`),n=e.name,[r,i]=e.issn,a=e.publisher.name;return L(F.Journal,{au:t,jtitle:n,eissn:r,issn:i,pub:a})},El=j({"@type":N(cl.VideoObject),name:O().optional(),description:O().optional(),thumbnailUrl:O().optional(),uploadDate:O().optional(),contentUrl:O().optional(),duration:O().optional()}),Dl=e=>El.safeParse(e).success,Ol=(e,t)=>{let n=Array.from(e.querySelectorAll(`dd[data-test="video-segment-author"]`)).map(e=>e.textContent.trim()).filter(e=>!!e),r=t?.uploadDate?new Date(t.uploadDate).getFullYear().toString():void 0,i=t?.name??V(e,`property`,`og:title`)??void 0,a=e.querySelector(`video-about-doi`)?.textContent??void 0;return R({au:n.length>0?n:void 0,date:r,doi:a,title:i})},kl=e=>vo({title:V(e,`property`,`og:title`)}),Al=(e,t)=>{let n=V(t,`property`,`og:type`);return n===ll.Article&&e.includes(W.Article)?U.Article:n===ll.Book&&(e.includes(W.Book)||e.includes(W.ReferenceWork))?U.Book:n===ll.Paper&&e.includes(W.Chapter)?U.Chapter:n===ll.Paper&&(e.includes(W.ReferenceWorkEntry)||e.includes(W.Protocol))?U.Article:n===ll.Video&&e.includes(W.Video)?U.AudioVisual:n===ll.Website&&(e.includes(W.Collections)||e.includes(W.JournalIssue))?U.Webpage:n===ll.Website&&e.includes(W.Journal)?U.Journal:U.None},jl=(e,t,n)=>e===U.AudioVisual&&Dl(n)?B(Ol(t,n)):e===U.Book&&yl(n)?B(Sl(t,n)):(e===U.Chapter||e===U.Article)&&dl(n)?B(_l(t,n)):e===U.Article&&pl(n)?B(_l(t,n.mainEntity)):e===U.Journal&&wl(n)?B(Tl(n)):z(),Ml=({url:e,document:t})=>{let n=Al(e,t);if(n===U.Webpage)return B(kl(t));let r=$s(t);if(!r)return z();let i=ec(r);return i?jl(n,t,i):z()},G=function(e){return e.PrintIsbn=`Print ISBN`,e.OnlineIsbn=`Online ISBN`,e.Doi=`DOI`,e.FirstPublished=`First published`,e.OnlineIssn=`Online ISSN`,e.PrintIssn=`Print ISSN`,e}(G||{}),Nl=new Set([G.PrintIsbn,G.OnlineIsbn,G.Doi,G.FirstPublished,G.OnlineIssn,G.PrintIssn]),Pl=j({content:j({item:j({title:O(),"published-date":O()}),group:j({volume:O(),issue:O()}),series:j({title:O(),type:O(),eissn:O()})}).optional()}),Fl=(e,t)=>{if(!e)return;let n=e.indexOf(t);return n>-1?e.substring(0,n):e},Il=e=>{let t=/\d+/.exec(e);if(t?.[0])return t[0]},Ll=e=>{let t=e.querySelectorAll(`script`),n=Array.from(t).find(e=>e.textContent.includes(`adobeDataLayerJson`))?.textContent.match(/var adobeDataLayerJson = (\{.*?});/s);if(n?.length===2)try{let e=JSON.parse(n[1]);return Pl.parse(e)}catch{return}},Rl=(e,t)=>{let n=V(e,`property`,`og:type`),r=t.includes(`epdf`);return n===`Book`||n===`books.book`?U.Book:n===`Chapter`?U.Chapter:n===`Journal`?U.Journal:n===`Article`||r?U.Article:U.None},zl=e=>{let t=H(e,`name`,`citation_author`),n=Array.from(e.querySelectorAll(`#product-details-content .product-authors`)).map(e=>e.textContent).filter(e=>!!e),r=new Set([...t,...n]);return r.size>0?[...r]:void 0},Bl=e=>{let t=Array.from(e.querySelectorAll(`#product-details-content .text-piped p`)).map(e=>e.textContent).find(e=>e.endsWith(` pages`));if(t)return Il(t)},Vl=e=>{let t=new Map,n=Array.from(e.querySelectorAll(`.journal-info-container .info-block`)).flatMap(e=>Array.from(e.querySelectorAll(`.info_label`)));for(let e of n){let n=e.nextElementSibling;if(!n?.classList.contains(`info_value`))continue;let r=Fl(e.textContent,`:`),i=Fl(n.textContent,`:`);!r||!i||Nl.has(r)&&t.set(r,i)}return t},Hl=(e,t)=>V(e,`property`,`books:release_date`)??V(e,`name`,`citation_online_date`)??t.get(G.FirstPublished)??void 0,Ul=(e,t)=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`)??V(e,`name`,`publication_doi`)??t.get(G.Doi)??void 0,Wl=(e,t)=>{let n=new Set([V(e,`property`,`books:isbn`),t.get(G.PrintIsbn),t.get(G.OnlineIsbn)].filter(e=>!!e));return n.size>0?[...n].join(`,`):void 0},Gl=e=>{let t,n,r=e.querySelector(`.cover-image__details div:first-of-type`);if(r?.childNodes.length===2){let[e,i]=r.childNodes;e.textContent&&(t=Il(e.textContent)),i.textContent&&(n=Il(i.textContent))}return{volume:t,issue:n}},Kl=e=>{let t=Array.from(e.querySelectorAll(`.authors .author`)).map(e=>e.textContent.trim().replace(`,`,``)).filter(e=>!!e);return t.length>0?t:void 0},ql=e=>{let t=Array.from(e.querySelectorAll(`.details-section .details-entry`)),n=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`ISSN`),r=t.find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`eISSN`),i,a;return n&&(i=n.querySelector(`.details-value`)?.textContent.trim()),r&&(a=r.querySelector(`.details-value`)?.textContent.trim()),{issn:i,eissn:a}},Jl=e=>{if(!e?.content?.group)return{volume:void 0,issue:void 0};let t=e.content.group.volume,n=e.content.group.issue;return n===`0`&&t===`0`?{volume:void 0,issue:void 0}:{volume:t,issue:n}},Yl=e=>{let[t,n]=((Array.from(e.querySelectorAll(`.details-section .details-entry`)).find(e=>e.querySelector(`.details-label`)?.textContent.trim()===`Pages`)?.querySelector(`.details-value`)?.textContent.trim())?.split(`-`)??[void 0,void 0]).map(e=>e?.trim());return t?.toLowerCase()===`n/a`&&n?.toLowerCase()===`n/a`?{spage:void 0,epage:void 0}:{spage:t,epage:n}},Xl=e=>{let t=Vl(e),n=zl(e),r=V(e,`property`,`og:title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=Bl(e);return I(F.Book,{au:n,date:i,doi:a,isbn:o,pages:s,title:r})},Zl=e=>{let t=Vl(e),n=zl(e),r=V(e,`name`,`citation_book_title`),i=Hl(e,t),a=Ul(e,t),o=Wl(e,t),s=V(e,`name`,`citation_publisher`),c=V(e,`property`,`og:title`);return I(F.Bookitem,{au:n,btitle:r,date:i,doi:a,isbn:o,pub:s,title:c})},Ql=e=>{let t=Vl(e),n=zl(e),r=Hl(e,t),i=t.get(G.OnlineIssn),a=t.get(G.PrintIssn),o=V(e,`property`,`og:title`),{volume:s,issue:c}=Gl(e);return L(F.Journal,{au:n,date:r,eissn:i,issn:a,issue:c,title:o,volume:s})},$l=e=>{let t=Vl(e),n=Ll(e),r=zl(e)??Kl(e),i=Hl(e,t)??n?.content?.item[`published-date`],a=Ul(e,t),{issn:o,eissn:s}=ql(e),{volume:c,issue:l}=Jl(n),u=V(e,`property`,`og:title`)??n?.content?.item.title,d=V(e,`name`,`citation_journal_title`)??n?.content?.series.title,{spage:f,epage:p}=Yl(e);return L(F.Article,{au:r,date:i,doi:a,eissn:s,issn:o??V(e,`name`,`citation_issn`),issue:l,jtitle:d,title:u,volume:c,spage:f,epage:p})},eu=({document:e,url:t})=>{switch(Rl(e,t)){case U.Book:return B(Xl(e));case U.Chapter:return B(Zl(e));case U.Journal:return B(Ql(e));case U.Article:return B($l(e));default:return z()}},tu=e=>{let t=H(e,`name`,`citation_author`);return t.length>0?t:void 0},nu=({document:e})=>B(R({au:tu(e),date:V(e,`name`,`citation_publication_date`),doi:V(e,`name`,`citation_doi`),isbn:V(e,`name`,`citation_isbn`),pub:V(e,`name`,`citation_publisher`),title:V(e,`name`,`citation_title`)??e.title})),ru=({document:e})=>Array.from(e.querySelectorAll(`.Z3988`)).length<=1?z():es(),iu=e=>{if(!(!e||e.length===0))return e[0]};function au(e,t){return iu(t.map(t=>{let n=e.querySelector(t)?.textContent??null;if(n&&n.trim()!==``)return n}).filter(e=>e))??null}function ou(e,t){let n=t.flatMap(t=>Array.from(e.querySelectorAll(t)).flatMap(e=>{let t=e.textContent;return t&&t.trim()!==``?t.split(`;`).map(e=>e.trim()).filter(e=>e.length>0):[]}));return n.length>0?n:null}var su=(e,t)=>au(e,[t])?.trim(),cu=e=>{let t=e.querySelector(`.content-meta-data__authors`)?.textContent;if(t)return t.split(/,\s+|\s+and\s+/).filter(e=>!!e)},lu=e=>{let t=Array.from(e.querySelectorAll(`.tombstone-metadata [data-qa="item-authors"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},uu=e=>{let t=Array.from(e.querySelectorAll(`.item-authors [data-qa="item-contributors"], .item-authors [data-qa="item-creators"]`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},du=e=>{let t=Array.from(e.querySelectorAll(`.contrib-type-author .name`)).map(e=>e.textContent).filter(e=>!!e);return t.length?t:void 0},fu=e=>{let t=new Set([...uu(e)??[],...cu(e)??[],...du(e)??[],...lu(e)??[]]);return t.size?[...t]:void 0},pu=(e,t)=>e.querySelector(`[data-qa="published-date"]`)?.textContent??e.querySelector(`.summary-image`)?.textContent??_u(t?.get(`date`))??_u(t?.get(`copyright date`))??_u(t?.get(`published date`)),mu=e=>{let t=e.find(e=>e.startsWith(`https://doi.org/`));if(t)return t.replace(`https://doi.org/`,``)},hu=e=>{let t=e.get(`local identifier`);if(t?.length)return mu(t)},gu=e=>e.querySelector(`.doi`)?.getAttribute(`href`)??void 0,_u=e=>{if(e?.length)return e[0]},vu=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.metadata-element, .metadata`)).map(e=>({name:e.querySelector(`.metadata-label`)?.textContent.trim().toLowerCase(),values:Array.from(e.querySelectorAll(`.metadata-value`)).map(e=>e.textContent).filter(e=>!!e)})).forEach(({name:e,values:n})=>{!e||!n.length||t.set(e,n)}),t},yu=e=>{let t=vu(e),n=e.querySelector(`.summary-journal`),r=Array.from(n?.childNodes??[]),i=r[0]?.textContent??e.querySelector(`.journal-link`)?.textContent??void 0,a=r[2]?.textContent?.replace(/Published By:\s+?/i,``)??_u(t.get(`publisher`))??e.querySelector(`.publisher-link`)?.textContent??void 0;return{pub:a&&a.trim()!==``?a:void 0,jtitle:i&&i.trim()!==``?i:void 0}},bu=e=>{let t=au(e,[`[data-qa="journal"]:first-child cite`,`[data-qa="copyright-statement"] > cite`,`[data-qa="collection-links"] mfe-content-details-pharos-link`]);return t&&t.trim()!==``?t:void 0},xu=e=>ks(e.querySelector(`[data-qa="page-count"]`)?.textContent),Su=(e,t)=>e.querySelector(`.publisher-link`)?.textContent??_u(t?.get(`publisher`)),Cu=e=>e.querySelector(`[data-qa="item-title"]`)?.textContent.trim()??e.querySelector(`mfe-turnaway-pharos-heading`)?.textContent.trim()??e.querySelector(`.metadata mfe-toc-pharos-heading`)?.textContent.trim()??e.querySelector(`.journal_header-title`)?.textContent.trim()??void 0,wu=e=>{if(!URL.canParse(e))return;let t=new URL(e);return t.origin+t.pathname},Tu=e=>{let t=e.querySelector(`.ccda-container > :first-child`),n,r;if(t?.textContent.includes(`Volume`)||t?.textContent.includes(`Issue`)){let e=t.textContent.trim().split(/,\s+/);for(let t of e)t.startsWith(`Volume`)?r=ks(t):t.startsWith(`Issue`)&&(n=ks(t))}return{issue:n,volume:r}},Eu=e=>{let t=e.querySelector(`[data-qa="item-src-info"]`)?.textContent??V(e,`property`,`og:description`)??V(e,`name`,`description`);if(!t)return{};let n=/Vol\.\s*(\d+)/.exec(t),r=n?n[1]:void 0,i=/No\.\s*(\d+)/.exec(t),a=i?i[1]:void 0,o=/pp\.\s*(\d+)-(\d+)/.exec(t),s=o?o[1]:void 0,c=o?o[2]:void 0,l=/pp\.\s*\d+-\d+\s*\((\d+)\s*pages\)/.exec(t);return{issue:a,volume:r,spage:s,epage:c,pages:l?l[1]:void 0}},Du=e=>{let t=au(e,[`mfe-turnaway-pharos-link`,`[data-qa="item-src-info"]`]);if(!t)return;let n=/\(.+\)/.exec(t)?.map(e=>{let t=/\d{4}/.exec(e);return t?t[0]:void 0});return iu(n)},Ou=(e,t)=>{let n=Cu(e),r=fu(e),i=pu(e)??Du(e),a=yu(e),o=a.jtitle??bu(e)??void 0,s=a.pub,c=Tu(e),l=Eu(e),u=c.issue??l.issue,d=c.volume??l.volume,f=xu(e)??l.pages,p=l.spage,m=l.epage,h=wu(t),g=mu(Array.from(e.querySelector(`.content-meta-data-stables`)?.childNodes??[]).map(e=>e.textContent??``))??gu(e);return L(F.Article,{atitle:n,au:r,date:i,doi:g,epage:m,issue:u,jtitle:o,pages:f,pub:s,spage:p,uri:h,volume:d})},ku=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Au=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Book,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},ju=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=e.querySelector(`.book-title-link`)?.textContent??void 0,o=pu(e,n),s=Array.from(e.querySelectorAll(`[data-qa="book"] > span`)).map(e=>e.textContent),c=xu(e),l=s.find(e=>e.includes(`pp.`))?.match(/(\d+)-(\d+)/)??void 0,u=Su(e,n),d=wu(t);return I(F.Bookitem,{atitle:i,au:r,btitle:a,date:o,epage:l?.[2],pub:u,pages:c,spage:l?.[1],uri:d})},Mu=(e,t)=>{let n=vu(e),r=fu(e),i=Cu(e),a=pu(e),o=xu(e),s=Su(e,n),c=wu(t),l=hu(n);return I(F.Document,{au:r,date:a,doi:l,pages:o,pub:s,title:i,uri:c})},Nu=(e,t)=>{let n=vu(e);return go({au:fu(e),date:pu(e,n),title:Cu(e),uri:wu(t)})},Pu=(e,t)=>{let{pub:n}=yu(e),r=Cu(e),i=e.querySelector(`.eissn`)?.textContent.replace(/EISSN\s+/,``).trim()??void 0,a=e.querySelector(`.issn`)?.textContent.replace(/ISSN\s+/,``).trim()??void 0,o=wu(t);return L(F.Journal,{eissn:i,issn:a,jtitle:r,pub:n,uri:o})},K=function(e){return e.Article=`journal article`,e.Audio=`audio`,e.Book=`book`,e.Chapter=`book chapter`,e.Document=`document`,e.Image=`image`,e.Journal=`journal`,e.ResearchReport=`research report`,e.Serial=`serial`,e.Video=`video`,e}({}),Fu=(e,t)=>{let n=vu(e),r=fu(e),i=pu(e,n),a=Cu(e);return R({au:r,date:i,pub:Su(e,n),title:a,uri:wu(t)})},Iu=e=>Object.values(K).includes(e),Lu=e=>{if(e.querySelector(`.journal_header-title`))return K.Journal;if(e.querySelector(`.journal-link`))return K.Article;let t=e.querySelector(`.content-type > span`)?.textContent.toLowerCase().trim()??e.querySelector(`.content-meta-data-label`)?.textContent.toLowerCase().trim();return Iu(t)?t:null},Ru=(e,t)=>{switch(Lu(e)){case K.Article:case K.Serial:return Ou(e,t);case K.Audio:return ku(e,t);case K.Book:return Au(e,t);case K.Chapter:case K.ResearchReport:return ju(e,t);case K.Document:return Mu(e,t);case K.Image:return Nu(e,t);case K.Journal:return Pu(e,t);case K.Video:return Fu(e,t);default:return null}},zu=({document:e,url:t})=>{let n=Ru(e,t);return n?B(n):z()},Bu=/([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}|[0-9]{4}-[0-9]{1,2}|[0-9]{4})/,Vu=/(E?ISBN|E?ISSN|DOI)\s*:\s*/gi,Hu=e=>{if(!e)return;let t=Bu.exec(e);if(t)return t.length>1?t[1]:void 0},Uu=e=>{let t={};return e.forEach(e=>{let n=[],r;for(Vu.lastIndex=0;(r=Vu.exec(e))!==null;)n.push({id:r[1].toLowerCase(),index:r.index,start:Vu.lastIndex});n.forEach(({id:r,start:i},a)=>{t[r]??=[],t[r].push(e.substring(i,n[a+1]?.index).trim())})}),t},Wu=e=>[...e.isbn??[],...e.eisbn??[]].map(e=>zs(e)).filter(e=>!!e),Gu=e=>{if(e){if(typeof e==`string`)return e;if(e.length>0)return e[0]}},Ku=e=>{if(e)return typeof e==`string`?e:Array.isArray(e)?e.length===0?void 0:Gu(e[0].name):Gu(e.name)},qu=(...e)=>{let t=new Set(e.filter(e=>!!e));if(t.size!==0)return[...t]},Ju=e=>{let t=Uu(e.identifierValues),[n]=e.isPartOf?.split(`,`)??[],r=Hu(e.publicationDate??e.creationDate),i=Wu(t);return{authors:e.authors,date:r,dois:t.doi,edition:e.edition,eissns:t.eissn,isbns:i,issns:t.issn,jtitle:n,lcn:e.lcn,publisher:e.publisher,title:e.title}},Yu=({lcn:e,title:t})=>({bibid:e,title:t}),Xu=e=>{let t=e.mainEntity.creator;if(t)return typeof t==`string`?[t]:Array.isArray(t)?t.map(e=>Gu(e.name)).filter(e=>!!e):[Gu(t.name)].filter(e=>!!e)},Zu=e=>{let t=e.mainEntity.issn;return t?typeof t==`string`?[t]:t:[]},Qu=e=>{let t=e.mainEntity.datePublished;if(t)return t.replace(/-$/,``)||void 0},$u=e=>e.replace(/[.,;]+$/,``).trim(),ed=(e,t)=>{let n=$u(e),r=$u(t);return n.startsWith(r)||r.startsWith(n)},td=e=>{let t=[];for(let n of e)n&&(t.some(e=>ed(e,n))||t.push(n));return t.length>0?t:void 0},nd=(e,t)=>{let n=td([...(e&&Xu(e))??[],...t.authors??[]]),r=qu(...t.eissns??[]),i=qu(e?.mainEntity.isbn?zs(e.mainEntity.isbn):void 0,...t.isbns??[]),a=qu(...e?Zu(e):[],...t.issns??[]),[o,s]=e?.mainEntity.pagination?.split(`-`)??[];return{authors:n,btitle:e?.mainEntity.isPartOf?.name??t.jtitle,date:t.date??(e?Qu(e):void 0),doi:Gu(t.dois),edition:e?.mainEntity.edition??t.edition,eissn:Gu(r),epage:s,isbn:i?.join(`,`),issn:Gu(a),issue:e?.mainEntity.issueNumber,jtitle:t.jtitle,lcn:t.lcn??e?.identifier.value,publisher:t.publisher??Ku(e?.mainEntity.publisher),spage:o,title:e?.name??t.title,volume:e?.mainEntity.volumeNumber}},rd=j({"@type":N(`Organization`),name:M([O(),A(O())])}),id=j({"@type":N(`Person`),name:M([O(),A(O())])}),ad=j({"@type":M([O(),A(O())]),"@id":O().optional(),issn:O().optional(),name:O().optional(),volume:O().optional()}),od=Ys.extend({identifier:j({"@type":O(),propertyID:O(),value:O()}),mainEntity:j({"@type":O(),"@id":O(),bookFormat:P(O()),creator:P(M([O(),id,A(id)])),datePublished:P(O()),description:P(M([O(),A(O())])),edition:P(O()),inLanguage:P(O()),isbn:P(O()),issn:P(M([O(),A(O())])),isPartOf:P(ad),issueNumber:P(O()),pagination:P(O()),publisher:P(M([O(),rd,A(rd)])),volumeNumber:P(O())}),name:O()}),sd=e=>{let t=$s(e);if(!t)return null;let n=ec(t),r=od.safeParse(n);return r.success?r.data:null},cd=e=>L(F.Article,{...Yu(e),au:e.authors,doi:e.doi,eissn:e.eissn,epage:e.epage,issn:e.issn,issue:e.issue,jtitle:e.jtitle,pub:e.publisher,spage:e.spage,volume:e.volume}),ld=e=>I(F.Book,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,edition:e.edition,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),ud=e=>I(F.Bookitem,{bibid:e.lcn,atitle:e.title,btitle:e.btitle,au:e.authors,date:e.date,doi:e.doi,epage:e.epage,isbn:e.isbn,pub:e.publisher,spage:e.spage}),dd=e=>I(F.Conference,{...Yu(e),au:e.authors,date:e.date,doi:e.doi,isbn:e.isbn,pub:e.publisher}),fd=e=>_o({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),pd=e=>L(F.Journal,{...Yu(e),date:e.date,doi:e.doi,eissn:e.eissn,issn:e.issn,pub:e.publisher}),md=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),hd=e=>R({...Yu(e),au:e.authors,date:e.date,pub:e.publisher}),q=function(e){return e.Article=`Article`,e.Audio=`Audio`,e.Book=`Book`,e.BookChapter=`BookChapter`,e.Conference=`Conference`,e.Dissertation=`Dissertation`,e.Journal=`Journal`,e.Video=`Video`,e}({}),gd=(e,t)=>({document:n})=>{let r=sd(n),i=nd(r,e(n));switch(t(n,r)){case q.Article:return B(cd(i));case q.Book:return B(ld(i));case q.BookChapter:return B(ud(i));case q.Conference:return B(dd(i));case q.Dissertation:return B(fd(i));case q.Journal:return B(pd(i));case q.Audio:return B(hd(i));case q.Video:return B(md(i));default:return z()}},_d=e=>`*:has([title*="${e}" i]) + .item-details-element-container prm-highlight`,vd=e=>Array.from(e.querySelectorAll(_d(`Identifier`))).map(e=>e.textContent).filter(e=>!!e),yd=e=>Array.from(e.querySelectorAll(_d(`Author`))).filter(e=>!!e.textContent&&e.parentElement!==null&&e.parentElement.getAttribute(`aria-hidden`)!==`true`).map(e=>e.textContent.trim()),bd=(e,t)=>e.querySelector(_d(t))?.textContent.trim(),xd=e=>Ju({authors:yd(e),title:bd(e,`Title`),publisher:bd(e,`Publisher`),creationDate:bd(e,`Creation Date`),publicationDate:bd(e,`Publication Date`),edition:bd(e,`Edition`),isPartOf:bd(e,`Is Part Of`),identifierValues:vd(e),lcn:bd(e,`MMS ID`)??bd(e,`Record ID`)}),Sd={Article:q.Article,Book:q.Book,"Book Chapter":q.BookChapter,Chapter:q.BookChapter,Periodical:q.Journal,Journal:q.Journal,"Audio CD":q.Audio,CreativeWork:q.Audio,Movie:q.Video,Video:q.Video},Cd=gd(xd,(e,t)=>{let n=t?.mainEntity[`@type`]??e.querySelector(`.media-content-type`)?.textContent??void 0;return n?Sd[n]:void 0}),wd=e=>{let t=e.querySelectorAll(`[id="Info"] > p`),n=Array.from(t).find(e=>e.textContent.includes(`Document Type`))?.textContent,r=V(e,`name`,`DC.identifier`);if(r?.startsWith(`info:doi/`)||n?.includes(`Article`))return U.Article;if(r?.startsWith(`urn:issn:`))return U.Journal},Td=e=>{let[t,n,r,i]=V(e,`name`,`DCTERMS.bibliographicCitation`)?.split(`,`)??[];return{journalTitle:t,volume:n,issue:r,pages:i}},Ed=e=>{let t=V(e,`name`,`DC.identifier`);return(t?t.split(`info:doi/`):null)?.[1]??void 0},Dd=e=>e.evaluate(`//*[@id="altLayoutPublisherLogo"]/p/a[1]`,e,null,XPathResult.STRING_TYPE,null).stringValue,Od=e=>{let[t,n]=e?e.trim().split(`-`):[void 0,void 0];return{spage:t,epage:n?.replace(/\(\d+\)/,``).trim()}},kd=e=>{let t=V(e,`name`,`DCTERMS.issued`);if(!t)return;let n=/\d{4}/.exec(t);return n?n[0]:void 0},Ad=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=kd(e),i=Td(e),a=i.journalTitle?.trim(),o=i.volume?.trim(),s=i.issue?.trim(),c=i.pages?Od(i.pages):void 0,l=c?.spage,u=c?.epage,d=H(e,`name`,`DC.creator`),f=Ed(e);return L(F.Article,{au:d,jtitle:a,date:r,doi:f,issue:s,pub:n,spage:l,epage:u,atitle:t,volume:o})},jd=e=>{let t=V(e,`name`,`DC.title`),n=V(e,`name`,`DC.publisher`),r=Dd(e);return L(F.Journal,{issn:r,title:t,pub:n})},Md=({document:e})=>{switch(wd(e)){case U.Article:return B(Ad(e));case U.Journal:return B(jd(e));default:return z()}},Nd=/^\d{4}-\d{3}[\dX]$/i,Pd=e=>Nd.test(e),Fd=e=>{let t=e.filter(Pd);return t.length?t:void 0},Id=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},Ld=e=>V(e,`name`,`citation_publication_date`)?.match(/^\d{4}/)?.[0],Rd=e=>V(e,`name`,`citation_doi`),zd=e=>{let t=H(e,`name`,`citation_isbn`);return t.length?t.join(`,`):void 0},Bd=e=>Fd(H(e,`name`,`citation_issn`)),Vd=e=>V(e,`name`,`citation_journal_title`),Hd=e=>V(e,`name`,`citation_publisher`),Ud=e=>V(e,`name`,`citation_title`),Wd=e=>V(e,`name`,`citation_doi`),Gd=e=>V(e,`name`,`citation_firstpage`),Kd=e=>V(e,`name`,`citation_lastpage`),qd=e=>V(e,`name`,`citation_issue`),Jd=e=>V(e,`name`,`citation_volume`),Yd=e=>L(F.Article,{atitle:Ud(e),au:Id(e),date:Ld(e),doi:Rd(e),issn:Bd(e)?.[0],issue:qd(e),jtitle:Vd(e),pub:Hd(e),volume:Jd(e),spage:Gd(e),epage:Kd(e)}),Xd=e=>I(F.Bookitem,{atitle:Ud(e),au:Id(e),btitle:Vd(e),date:Ld(e),isbn:zd(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Zd=e=>_o({title:Ud(e),au:Id(e),date:Ld(e),pub:Hd(e),spage:Gd(e),epage:Kd(e)}),Qd=e=>!!e.isbn,$d=e=>!!e.issn||e.type===`Article`&&!!e.journalTitle||!Qd(e)&&!!e.journalTitle,ef=e=>!!e.title,tf=e=>{let t={type:Wd(e),isbn:zd(e),issn:Bd(e),journalTitle:Vd(e),title:Ud(e)};return Qd(t)?Xd(e):$d(t)?Yd(e):ef(t)?Zd(e):null},nf=({url:e,document:t})=>{let n=tf(t);return n?B({...n,uri:e}):z()},rf=j({"@content":O(),datePublished:O().optional(),mainEntity:j({type:O().optional(),name:O().optional(),author:A(j({name:O()})).optional(),publisher:j({type:O(),name:O()}).optional(),isbn:O().optional()})}),af=e=>rf.safeParse(e).success,of=e=>{let t=e.textContent;if(!t)return null;try{let e=JSON.parse(t);if(af(e))return e}catch{return null}return null},sf=({document:e})=>{let t=$s(e);if(!t)return z();let n=of(t);if(!n)return z();let r=n.mainEntity.type,i=n.mainEntity.author?.map(e=>e.name),a=n.datePublished?.substring(0,4),o=n.mainEntity.name,s=n.mainEntity.isbn,c=n.mainEntity.publisher?.name;switch(r){case`Book`:return B(I(F.Book,{au:i,date:a,title:o,isbn:s,pub:c}));default:return z()}},cf=Ys.extend({"@type":O().optional(),name:O().optional(),copyrightYear:ga().optional(),author:A(j({name:O()})).optional(),publisher:A(j({name:O()})).optional()}),lf=e=>cf.safeParse(e).success,uf=({document:e,url:t})=>{let n=$s(e);if(!n)return z();let r=ec(n);if(!r||!lf(r))return z();let i=r[`@type`],a=r.author?.map(e=>e.name),o=r.copyrightYear?.toString()??V(e,`property`,`og:book:release_date`),s=r.name,c=iu(r.publisher?.map(e=>e.name)),l=V(e,`property`,`og:book:isbn`);switch(i){case`Book`:return B(I(F.Book,{au:a,date:o,title:s,isbn:l,pub:c,uri:t}));default:return z()}},df=e=>{let t=Array.from(e.querySelectorAll(`a[rel=author]`)).map(e=>e.textContent.trim()).filter(Boolean);return t.length?t:void 0},ff=e=>{let t=Array.from(e.querySelectorAll(`strong`)).filter(e=>e.textContent.startsWith(`ISBN`)).map(e=>e.nextElementSibling?.textContent.trim());if(t.length!==0)return t[0]?.replace(/\s+/,`,`)},pf=({url:e,document:t})=>{let n=t.querySelector(`h3.page-title`)?.textContent.trim()??void 0,r=df(t),i=V(t,`property`,`article:published_time`),a=ff(t);return B(I(F.Book,{au:r,date:i?.substring(0,4),isbn:a,pub:`Milne Open Textbooks`,title:n,uri:e}))},mf=({document:e,url:t})=>{switch(gf(t)){case U.Chapter:return B(xf(e));case U.Book:return B(Sf(e));case U.Article:return B(_f(e));case U.Journal:return B(vf(e));default:return z()}},hf=function(e){return e.Print=`Print`,e.Online=`Online`,e}(hf||{}),gf=e=>{let{pathname:t}=new URL(e);return t.includes(`/books/abs/`)?U.Chapter:t.includes(`/books/`)?U.Book:/\/journals\/.+\/article\//.exec(t)==null?t.includes(`/journals/`)?U.Journal:U.None:U.Article},_f=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_journal_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_volume`),a=V(e,`name`,`citation_issue`),o=V(e,`name`,`citation_firstpage`),s=V(e,`name`,`citation_lastpage`),c=V(e,`name`,`citation_publication_date`)?.substring(0,4),l=V(e,`name`,`citation_publisher`),u=Cf(e),d=Fd(H(e,`name`,`citation_issn`));return L(F.Article,{atitle:t,au:u,jtitle:n,doi:r,volume:i,issue:a,issn:d?.[0],spage:o,epage:s,date:c,pub:l})},vf=e=>{let t=yf(e),n=bf(e),r=n.find(e=>e.type===hf.Print),i=n.find(e=>e.type===hf.Online),a=r?r.value:void 0,o=i?i.value:void 0;return L(F.Journal,{title:t,issn:a,eissn:o})},yf=e=>e.querySelector(`h1.title`)?.textContent.trim()??void 0,bf=e=>{let t=Array.from(e.querySelectorAll(`span.bold`)).find(e=>e.textContent.trim()===`ISSN:`),n=/^([0-9]{4}-[0-9]{3}[0-9X]) \((Print|Online)\)/,r=[];return t&&(t.parentElement?.querySelectorAll(`span.value`))?.forEach(e=>{let t=e.textContent.trim(),i=n.exec(t);i&&r.push({value:i[1],type:i[2]})}),r},xf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_inbook_title`),r=V(e,`name`,`citation_doi`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`);return I(F.Bookitem,{atitle:t,btitle:n,doi:r,date:i,pub:a})},Sf=e=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_doi`),r=V(e,`name`,`citation_isbn`),i=V(e,`name`,`citation_publication_date`)?.substring(0,4),a=V(e,`name`,`citation_publisher`),o=Cf(e);return I(F.Book,{title:t,au:o,doi:n,isbn:r,date:i,pub:a})},Cf=e=>{let t=H(e,`name`,`citation_author`);return t.length?t:void 0},wf=function(e){return e.Journal=`Journal`,e.Article=`Article`,e}(wf||{}),Tf=e=>{switch(V(e,`property`,`og:type`)){case`Article`:return wf.Article;case`Journal`:return wf.Journal;default:return}};function Ef(e){let t=V(e,`property`,`og:title`),n=V(e,`name`,`dc.Publisher`),r=V(e,`name`,`publication_doi`);return B(L(F.Journal,{jtitle:t,pub:n,doi:r}))}function Df(e){let t=V(e,`name`,`dc.Title`),n=H(e,`name`,`dc.Creator`),r=V(e,`name`,`dc.Date`)?.substring(0,4),i=V(e,`name`,`publication_doi`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`dc.Publisher`);return B(L(F.Article,{atitle:t,au:n,date:r,doi:i,jtitle:a,pub:o}))}var Of=({document:e})=>{switch(Tf(e)){case wf.Journal:return Ef(e);case wf.Article:return Df(e);default:return z()}},kf=e=>{if(!e)return;let[t,n]=e.trim().split(`-`);return{spage:t,epage:n}},Af=e=>{let{pathname:t}=new URL(e);if(t.includes(`/article/`))return U.Article},jf=e=>{let t=V(e,`name`,`DC.Source`),n=V(e,`name`,`DC.Title`),r=H(e,`name`,`DC.Creator.PersonalName`),i=V(e,`name`,`DC.Source.ISSN`),a=V(e,`name`,`citation_date`)?.substring(0,4),o=V(e,`name`,`DC.Source.Volume`),s=V(e,`name`,`DC.Source.Issue`),c=V(e,`name`,`DC.Identifier.URI`),l=V(e,`name`,`DC.Identifier.pageNumber`),u=l?kf(l):void 0,d=u?.spage,f=u?.epage;return L(F.Article,{jtitle:t,atitle:n,au:r,issn:i,date:a,spage:d,epage:f,volume:o,issue:s,uri:c})},Mf=({document:e,url:t})=>{switch(Af(t)){case U.Article:return B(jf(e));default:return z()}},Nf=function(e){return e.Book=`Book`,e.Chapter=`Chapter`,e}(Nf||{}),Pf=e=>{switch(Ff(e)){case`eBook`:return Nf.Book;case`Reference`:return Nf.Chapter;default:return}},Ff=e=>e.querySelector(`#vol-contentType a`)?.textContent??void 0;function If(e,t){let n=Rf(e),r=Vf(e),i=Uf(e),a=Wf(e),o=Gf(e),s=Kf(e),c=Vf(e),l=t,{startPage:u,endPage:d}=qf(e)??{};return B(I(F.Book,{au:n,btitle:r,date:i,doi:a,epage:d,isbn:o,pub:s,spage:u,title:c,uri:l}))}function Lf(e,t){let n=Rf(e),r=Hf(e),i=Vf(e),a=Uf(e),o=Wf(e),s=Gf(e),c=Kf(e),l=Hf(e),u=t,{startPage:d,endPage:f}=qf(e)??{};return B(I(F.Book,{au:n,atitle:r,btitle:i,date:a,doi:o,epage:f,isbn:s,pub:c,spage:d,title:l,uri:u}))}var Rf=e=>{let t=e.querySelectorAll(`div#article_author p.author-bio b`),n=Array.from(t).map(e=>e.textContent).filter(e=>!!e).map(e=>e.trim());return n.length>0?n:void 0},zf=(e,t)=>e.querySelector(`input#${t}`)?.getAttribute(`value`)??void 0,Bf=e=>V(e,`property`,`og:title`),Vf=e=>zf(e,`titlevalue`)??Bf(e),Hf=e=>zf(e,`chapter-title-squid`),Uf=e=>zf(e,`pubdate-squid`),Wf=e=>zf(e,`doi-squid`),Gf=e=>zf(e,`isbn-squid`),Kf=e=>zf(e,`pubname-squid`),qf=e=>{let t=e.querySelector(`#pageRange`)?.textContent??void 0;if(!t)return;let n=/(\d+)–(\d+)/.exec(t);if(n)return{startPage:n[1],endPage:n[2]}},Jf=({document:e,url:t})=>{switch(Pf(e)){case Nf.Book:return If(e,t);case Nf.Chapter:return Lf(e,t);default:return z()}},Yf=(e,t)=>e.evaluate(`//*[@class="singleRecord_view_label"][contains(text(), "${t}")]/following-sibling::*[@class="singleRecord_view_data"]`,e,null,XPathResult.STRING_TYPE).stringValue.toLowerCase().trim(),Xf=e=>{switch(Yf(e,`Medium`)){case`book`:case`e-book`:return F.Book;case`e-journal`:return F.Journal;default:return F.Unknown}},Zf=e=>{delete e.rft_id},Qf=e=>{let t=rs(e);if(Yc(t)){let n=Xf(e.document);t.resource.genre=n,Zf(t.resource)}return t},$f=e=>{let t=V(e,`name`,`type`)?.toLowerCase(),n=V(e,`name`,`og:type`)?.toLowerCase(),r=V(e,`name`,`citation_article_type`)?.toLowerCase();if(t===`article`||r===`article`||n===`article`)return U.Article;let i=V(e,`name`,`twitter:title`)?.trim(),a=V(e,`name`,`description`)?.trim();if(i||a)return U.Webpage},ep=e=>{let t=V(e,`name`,`DC.Title`),n=V(e,`name`,`DC.Publisher`),r=V(e,`name`,`DC.Date`),i=V(e,`name`,`DC.Identifier`),a=V(e,`name`,`citation_journal_title`),o=V(e,`name`,`citation_volume`),s=V(e,`name`,`citation_issn`),c=H(e,`name`,`citation_author`);return L(F.Article,{au:c,jtitle:a,date:r,doi:i,issn:s,pub:n,title:t,volume:o})},tp=(e,t)=>vo({uri:e,title:V(t,`name`,`twitter:title`)}),np=({url:e,document:t})=>{switch($f(t)){case U.Article:return B(ep(t));case U.Webpage:return B(tp(e,t))}return z()},rp=({document:e})=>Array.from(e.querySelectorAll(`.availability.documentSummaryAvailability.availabilityContent`)).length===0?z():ts(),ip=/([0-9]{4})\s+at/;function ap(e){if(!e)return;let t=ip.exec(e);if(t&&t.length>1)return t[1]}function op(e,t){let n=e.getElementsByClassName(t);if(n.length!==0)return n[0].textContent}function sp(e){return Array.from(e.getElementsByTagName(`li`)).reduce((e,t)=>{let n=op(t,`title`),r=op(t,`content`);return n&&r&&(e[n]=r),e},{})}function cp(e){let t=e.getElementsByClassName(`information`);if(t.length===0)return{};let n=sp(t[0]);return{date:ap(n.Published),series:n.Show}}var lp=({url:e,document:t})=>{if(!new URL(e).searchParams.has(`i`))return z();let n=F.AudioDocument;return B({genre:n,pub:V(t,`property`,`og:site_name`),title:V(t,`property`,`og:title`),uri:e,...cp(t)})},up=e=>{let t=V(e,`name`,`citation_date`);if(t)return t.split(`/`).find(e=>/^\d{4}/.test(e))??void 0},dp=e=>{let t=e.querySelector(`#arxiv-doi-link`)?.textContent;if(t)return t.replace(`https://doi.org/`,``).trim()},fp=({document:e})=>{let t=V(e,`name`,`citation_title`),n=V(e,`name`,`citation_pdf_url`),r=H(e,`name`,`citation_author`),i=up(e),a=dp(e);return!t&&r.length===0&&!i&&!a?z():B(L(F.Article,{au:r,date:i,doi:a,title:t,uri:n}))},pp=e=>{let t=su(e,`div.director-section div.term-info-section-items`);if(!t)return;let n=t.split(`,`).map(e=>e.replace(/\s+/g,` `).trim()).filter(e=>e.length>0);return n.length>0?n:void 0},mp=e=>{let t=new Map;return Array.from(e.querySelectorAll(`.info-section-container`)).forEach(e=>{let n=e.querySelector(`.info-section-header .info-section-title`)?.textContent.trim().toLowerCase();if(!n)return;let r=Array.from(e.querySelectorAll(`.term-info-section-item`)).map(e=>e.textContent.replace(`,`,``).trim()).filter(e=>!!e);r.length&&t.set(n,r)}),t},hp=({url:e,document:t})=>{let n=mp(t);return B(R({au:pp(t)??n.get(`director`),date:su(t,`div.product-release-year`),pub:su(t,`div.studio-section div.term-info-section-item`)??_u(n.get(`supplier`)),title:su(t,`.product-title`)??su(t,`.movie-title`),uri:e}))},gp=e=>{if(V(e,`property`,`og:type`)===`article`)return U.Article};function _p(e){let t={},n=e.querySelector(`[data-id=layout-form]`);return n&&Array.from(n.getElementsByTagName(`h2`)).forEach(e=>{let n=e.textContent.toLowerCase(),r=Array.from(e.parentElement?.getElementsByTagName(`span`)??[]).map(e=>e.textContent||``);n&&(t[n]=r[0])}),t}function vp(e,t,n){return n.includes(`publisher`)?t.publisher:n.includes(`place of publication, exhibition, or creation`)?t[`place of publication, exhibition, or creation`]:V(e,`name`,`DC.publisher`)}function yp(e){let t=V(e,`name`,`citation_publication_date`);return t?t.substring(0,4):V(e,`name`,`citation_online_date`)?.substring(0,4)}var bp=e=>{let t=_p(e),n=V(e,`name`,`DataCite.title`),r=H(e,`name`,`DataCite.contributor`),i=yp(e),a=V(e,`name`,`DC.identifier.DOI`),o=Object.keys(t),s=vp(e,t,o),c=o.includes(`journal`)?t.journal:void 0,l=o.includes(`volume`)?t.volume:void 0,u=o.includes(`issue`)?t.issue:void 0,d=o.includes(`issn`)?t.issn:void 0,f=o.includes(`electronic location (url)`)?t[`electronic location (url)`]:void 0;return L(F.Article,{jtitle:c,atitle:n,pub:s,au:r,date:i,doi:a,volume:l,issue:u,issn:d,uri:f})},xp=({document:e})=>{switch(gp(e)){case U.Article:return B(bp(e));default:return z()}},J=function(e){return e.ISSN=`issn (print)`,e.EISSN=`issn (electronic)`,e.ISBN=`isbn (print)`,e.VOLUME=`volume`,e.ISSUE=`issue`,e.PUBLISHER=`publisher`,e.DATE_OF_PUBLICATION=`date of publication`,e.RESOURCE_TYPE=`resource type`,e.JOURNAL_TITLE=`journal`,e.BOOK_TITLE=`book title`,e.PAGE_RANGE=`page range`,e}(J||{}),Sp=e=>{let t=Y(e,J.RESOURCE_TYPE);return t?t===`Other Journal Article`||t===`Journal Article`||t===`Journal Item`||t===`Book Review`?U.Article:t===`Book Chapter`||t===`Book Part`||t===`Conference Abstract`||t===`Book ChapterConference Paper`||t===`Conference Paper`||t===`Other Book Part`?U.Document:U.None:U.None},Cp=e=>e.replace(`:`,``).replace(` | `,``).trim().toLowerCase(),wp=e=>{let t=new Map,n=e.querySelector(`ul.rlist.publication-details__list`);return n&&Array.from(n.querySelectorAll(`li`)).forEach(e=>{let n=Array.from(e.querySelectorAll(`span.label`)),r=Array.from(e.querySelectorAll(`span.info`));n.forEach((e,n)=>{let i=Cp(e.textContent),a=r[n]?.textContent?.trim();i&&a&&(t.has(i)||t.set(i,[]),t.get(i)?.push(a))})}),t},Y=(e,t)=>{let n=e.get(t);if(n)return iu(n)},Tp=e=>H(e,`name`,`dc.Creator`).map(e=>e.trim()),Ep=e=>{let t=ou(e,[`.loa-accordion a.author-name`]);if(t)return t.map(e=>e.replace(`Authors:`,``).trim())},Dp=e=>{let t=Tp(e);return t.length>0?t:Ep(e)},Op=e=>V(e,`name`,`dc.Title`)??V(e,`property`,`og:title`),kp=e=>V(e,`name`,`publication_doi`),Ap=(e,t)=>Y(t,J.DATE_OF_PUBLICATION)??V(e,`name`,`dc.Date`),jp=e=>{let t=Y(e,J.PAGE_RANGE),n,r;return t?.includes(`-`)&&(n=t?t.split(`-`)[0].trim():void 0,r=t?t.split(`-`)[1].trim():void 0),{pages:t,spage:n,epage:r}},Mp=(e,t,n)=>{let r=Op(e),i=Y(t,J.JOURNAL_TITLE),a=V(e,`name`,`citation_journal_title`),o=i??a,s=kp(e),c=Ap(e,t),l=Y(t,J.PUBLISHER),u=Dp(e),d=Y(t,J.VOLUME),f=Y(t,J.ISSUE),p=jp(t),m=Y(t,J.ISSN),h=Y(t,J.EISSN);return L(F.Article,{title:r,jtitle:o,doi:s,date:c,pub:l,au:u,volume:d,issue:f,pages:p.pages,spage:p.spage,epage:p.epage,issn:m,eissn:h,uri:n})},Np=(e,t,n)=>{let r=Op(e),i=Y(t,J.BOOK_TITLE),a=kp(e),o=Ap(e,t),s=Y(t,J.PUBLISHER),c=Dp(e),l=jp(t),u=Y(t,J.ISBN);return I(F.Conference,{title:r,btitle:i,doi:a,date:o,pub:s,au:c,pages:l.pages,spage:l.spage,epage:l.epage,isbn:u,uri:n})},Pp=(e,t,n)=>{let r=Op(e),i=kp(e),a=Ap(e,t),o=Y(t,J.PUBLISHER),s=Dp(e),c=Y(t,J.ISBN);return I(F.Document,{title:r,doi:i,date:a,pub:o,au:s,uri:n,isbn:c})},Fp=({url:e,document:t})=>{let n=wp(t);switch(Sp(n)){case U.Article:return B(Mp(t,n,e));case U.Document:return B(Np(t,n,e));case U.None:return B(Pp(t,n,e));default:return z()}},Ip=e=>V(e,`property`,`og:title`)?.trim()??void 0,Lp=e=>V(e,`name`,`dc.identifier`)??V(e,`name`,`citation_doi`),Rp=e=>{let t=Ip(e),n=t,r=Wp(e),i=Up(e),a=Vp(e),o=Hp(e),{issn:s,eissn:c}=Bp(e);return B(L(F.Journal,{date:r,eissn:c,issn:s,issue:i,jtitle:n,pub:a,title:t,volume:o}))},zp=e=>e.includes(`/journals/`)&&e.includes(`issue`),Bp=e=>({issn:e.querySelector(`dd.printissn.text-metadata-value > span`)?.textContent.trim(),eissn:e.querySelector(`dd.onlineissn.text-metadata-value > span`)?.textContent.trim()}),Vp=e=>e.querySelector(`dd.publisher.text-metadata-value span`)?.textContent.trim()??void 0,Hp=e=>Ip(e)?.match(/Volume\s+(\d+)/i)?.[1],Up=e=>Ip(e)?.match(/Issue\s+(\d+)/i)?.[1],Wp=e=>Ip(e)?.match(/\((\d{4})\)/)?.[1],Gp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=H(e,`property`,`article:author`),i=Kp(e),a=Lp(e),o=V(e,`name`,`citation_lastpage`),s=V(e,`name`,`citation_issn`),c=V(e,`name`,`citation_issue`),l=V(e,`name`,`citation_journal_title`),u=V(e,`name`,`citation_publisher`),d=V(e,`name`,`citation_firstpage`),f=V(e,`name`,`citation_volume`);return B(L(F.Article,{atitle:n,au:r,date:i,doi:a,epage:o,issn:s,issue:c,jtitle:l,pub:u,spage:d,title:t,volume:f}))},Kp=e=>V(e,`property`,`article:published_time`)??V(e,`name`,`citation_publication_date`),qp=e=>{let t=Ip(e),n=V(e,`name`,`citation_title`)??t,r=Jp(e),i=Xp(e),a=Lp(e),o=Zp(e),s=V(e,`name`,`citation_publisher`);return B(I(F.Book,{au:r,btitle:n,date:i,doi:a,isbn:o,pub:s,title:t}))},Jp=e=>{let t=H(e,`property`,`book:author`);if(t.length>0)return t;let n=H(e,`name`,`citation_author`);return n.length>0?n:Yp(e)},Yp=e=>Array.from(e.querySelectorAll(`.contributor-details span[data-testid="author-name"]`)).map(e=>(e.textContent||``).trim()).filter(e=>e.length>0),Xp=e=>V(e,`property`,`book:release_date`)??V(e,`name`,`citation_publication_date`),Zp=e=>V(e,`property`,`book:isbn`)??V(e,`name`,`citation_isbn`),Qp=(e,t)=>{switch(V(e,`property`,`og:type`)){case`article`:return U.Article;case`book`:return U.Book;default:break}return zp(t)?U.Journal:U.None},$p=({document:e,url:t})=>{switch(Qp(e,t)){case U.Article:return Gp(e);case U.Journal:return Rp(e);case U.Book:return qp(e);default:return z()}},em=e=>`[data-qa="detail_${e}"]`,tm=(e,t)=>{let n=e.querySelector(em(t));return n?Array.from(n.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e):[]},nm=(e,t)=>{let n=tm(e,t);return n.length>0?n[0]:void 0},rm=e=>{let t=e.querySelector(em(`creator`));if(!t)return[];let n=Array.from(t.querySelectorAll(`nde-highlight`)).map(e=>e.textContent.trim()).filter(e=>!!e).map(e=>e.replace(/,?\s*author\s*$/i,``).trim());return n.length>0?n:[]},im=e=>{let t=tm(e,`identifier`),n=tm(e,`ispartof`),r=t.find(e=>e.startsWith(`LC:`));return Ju({authors:rm(e),title:nm(e,`title`),publisher:nm(e,`publisher`),creationDate:nm(e,`creationdate`),isPartOf:n.length>0?n[0]:void 0,identifierValues:t,lcn:r?.replace(`LC:`,``).trim()})},am={Article:q.Article,Audio:q.Audio,Book:q.Book,"Book Chapter":q.BookChapter,"Conference Paper":q.Conference,Dissertation:q.Dissertation,Journal:q.Journal,"Magazine Article":q.Article,Newspaper:q.Journal,Video:q.Video},om={CreativeWork:q.Audio,Movie:q.Video,Periodical:q.Journal,Thesis:q.Dissertation},sm={...am,...om},cm=e=>{if(e)return e.mainEntity[`@type`]},lm=e=>e.querySelector(`.record-type`)?.textContent.trim()??void 0,um=gd(im,(e,t)=>{let n=lm(e)??cm(t);return n?sm[n]:void 0}),X=function(e){return e.NoResourceFound=`NoResourceFound`,e.Z3988=`Z3988`,e.Z3988SearchResult=`Z3988SearchResult`,e.Amazon=`Amazon`,e.CupOfJo=`CupOfJo`,e.IngentaConnect=`IngentaConnect`,e.Jstor=`Jstor`,e.Milne=`Milne`,e.Primo=`Primo`,e.SagePub=`SagePub`,e.SageVideo=`SageVideo`,e.ScienceDirect=`ScienceDirect`,e.Springer=`Springer`,e.Youtube=`Youtube`,e.TaylorFrancis=`TaylorFrancis`,e.Wiley=`Wiley`,e.VuFind=`VuFind`,e.ClinicalKey=`ClinicalKey`,e.DOAJ=`DOAJ`,e.Ebscohost=`Ebscohost`,e.OpenStax=`OpenStax`,e.CambridgeJournalsOnline=`CambridgeJournalsOnline`,e.OpenTextbook=`OpenTextbook`,e.AhaJournals=`AhaJournals`,e.Ijees=`Ijees`,e.BloomsburyCollections=`BloomsburyCollections`,e.HeritageCirqa=`HeritageCirqa`,e.BritishMedicalJournal=`BritishMedicalJournal`,e.SummonSearchResult=`SummonSearchResult`,e.ApplePodcasts=`ApplePodcasts`,e.Arxiv=`Arxiv`,e.KanopyVideo=`KanopyVideo`,e.LaTrobeOpal=`LaTrobeOpal`,e.BYUScholarsArchive=`BYUScholarsArchive`,e.Informit=`Informit`,e.Brill=`Brill`,e.PrimoNde=`PrimoNde`,e}({}),dm={[X.NoResourceFound]:lc,[X.Z3988]:rs,[X.Z3988SearchResult]:ru,[X.Amazon]:ds,[X.CupOfJo]:cc,[X.Jstor]:zu,[X.Youtube]:al,[X.SagePub]:Ec,[X.SageVideo]:nu,[X.ScienceDirect]:Lc,[X.Springer]:Ml,[X.TaylorFrancis]:Wc,[X.Wiley]:eu,[X.VuFind]:tl,[X.ClinicalKey]:Js,[X.DOAJ]:hc,[X.Primo]:Cd,[X.IngentaConnect]:Md,[X.Ebscohost]:nf,[X.OpenStax]:sf,[X.OpenTextbook]:uf,[X.Milne]:pf,[X.CambridgeJournalsOnline]:mf,[X.AhaJournals]:Of,[X.Ijees]:Mf,[X.BloomsburyCollections]:Jf,[X.HeritageCirqa]:Qf,[X.BritishMedicalJournal]:np,[X.SummonSearchResult]:rp,[X.ApplePodcasts]:lp,[X.Arxiv]:fp,[X.KanopyVideo]:hp,[X.LaTrobeOpal]:xp,[X.BYUScholarsArchive]:Os,[X.Informit]:Fp,[X.Brill]:$p,[X.PrimoNde]:um},fm=`5.35.0`,pm=()=>fm,mm=[`com.au`,`com`,`ca`,`co.uk`,`de`,`fr`,`nl`].flatMap(e=>[`amazon.${e}`,`www.amazon.${e}`]),hm={version:pm(),siteRegistrations:[{matcher:{regexp:`^https://[a-z0-9\\-]+\\.on\\.worldcat\\.org/search`},name:`Worldcat Search Results`,parsers:[X.Z3988SearchResult]},{matcher:{regexp:`^https://[a-z0-9\\-]+\\.summon\\.serialssolutions\\.com/`},name:`Summon Search Results`,parsers:[X.SummonSearchResult]},{matcher:{regexp:`cupofjo[.-]com`},name:`Cup of Jo`,parsers:[X.CupOfJo]},{matcher:{hostnames:[`youtube.com`,`www.youtube.com`]},name:`Youtube`,parsers:[X.Youtube]},{matcher:{regexp:`www[-.]sciencedirect[.-]com`},name:`Science Direct`,parsers:[X.ScienceDirect]},{matcher:{hostnames:mm},name:`Amazon`,parsers:[X.Amazon]},{matcher:{regexp:`^https://sk\\.sagepub\\.com/video/`},name:`Sage Video`,parsers:[X.SageVideo]},{matcher:{regexp:`[/.-]((www|journals)[.-])?sagepub[.-]com`},name:`Sage Publishing`,parsers:[X.SagePub]},{matcher:{regexp:`www[.-]tandfonline[.-]com`},name:`Taylor & Francis`,parsers:[X.TaylorFrancis]},{matcher:{regexp:`[/.-]((www|onlinelibrary)[.-])?wiley[.-]com`},name:`Wiley`,parsers:[X.Wiley]},{matcher:{regexp:`^https://[a-z0-9\\-]+[.-]on[.-]worldcat[.-]org`},name:`Worldcat`,parsers:[X.Z3988]},{matcher:{hostnames:[`catalogue.rau.ac.uk`]},name:`Royal Agricultural University Library`,parsers:[X.Z3988]},{matcher:{regexp:`link[.-]springer[.-]com`},name:`Springer`,parsers:[X.Springer]},{matcher:{regexp:`^https://vufind\\.lboro\\.ac\\.uk/(Record|PrimoRecord)`},name:`VuFind`,parsers:[X.VuFind]},{matcher:{regexp:`www[.-]clinicalkey[.-]com`},name:`ClinicalKey`,parsers:[X.ClinicalKey]},{matcher:{regexp:`www[.-]jstor[.-]org`},name:`JSTOR`,parsers:[X.Jstor]},{matcher:{regexp:`doaj[.-]org`},name:`DOAJ`,parsers:[X.DOAJ]},{matcher:{regexp:`[/.-]ingentaconnect[.-]com`},name:`IngentaConnect`,parsers:[X.IngentaConnect]},{matcher:{regexp:`research[.-]ebsco[.-]com`},name:`EBSCOHost`,parsers:[X.Ebscohost]},{matcher:{regexp:`openstax[-.]org`},name:`OpenStax`,parsers:[X.OpenStax]},{matcher:{regexp:`open[.-]umn[.-]edu`},name:`OpenTextbook`,parsers:[X.OpenTextbook]},{matcher:{regexp:`milneopentextbooks[-.]org`},name:`Milne Open Textbooks`,parsers:[X.Milne]},{matcher:{regexp:`www[.-]perlego[.-]com`},name:`Perlego`,parsers:[X.Z3988]},{matcher:{regexp:`www[.-]ahajournals[.-]org`},name:`AHA Journals`,parsers:[X.AhaJournals]},{matcher:{regexp:`www[.-]cambridge[.-]org`},name:`Cambridge Journals Online`,parsers:[X.CambridgeJournalsOnline]},{matcher:{regexp:`www[.-]nieindia[.-]org`},name:`International Journal of Ecology and Environmental Sciences`,parsers:[X.Ijees]},{matcher:{regexp:`www[.-]bloomsburycollections[.-]com`},name:`Bloomsbury Collections`,parsers:[X.BloomsburyCollections]},{matcher:{regexp:`cirqahosting[.-]com`},name:`Heritage Cirqa`,parsers:[X.HeritageCirqa]},{matcher:{regexp:`www[.-]bmj[.-]com`},name:`British Medical Journal`,parsers:[X.BritishMedicalJournal]},{matcher:{regexp:`podcasts[.-]apple[.-]com`},name:`Apple Podcasts`,parsers:[X.ApplePodcasts]},{matcher:{regexp:`arxiv[.-]org`},name:`arxiv`,parsers:[X.Arxiv]},{matcher:{regexp:`kanopy[.-]com`},name:`Kanopy Video`,parsers:[X.KanopyVideo]},{matcher:{regexp:`opal[.-]latrobe[.-]edu[.-]au`},name:`La Trobe Opal`,parsers:[X.LaTrobeOpal]},{matcher:{hostnames:[`scholarsarchive.byu.edu`]},name:`BYU Scholars Archive`,parsers:[X.BYUScholarsArchive]},{matcher:{regexp:`informit[.-]org`},name:`Informit`,parsers:[X.Informit]},{matcher:{regexp:`brill[.-]com`},name:`Brill`,parsers:[X.Brill]},{matcher:{regexp:`/nde/fulldisplay`},name:`Primo NDE`,parsers:[X.PrimoNde]},{matcher:{regexp:`/(discovery|primo-explore)/fulldisplay`},name:`Primo`,parsers:[X.Primo]}]},gm=j({hostnames:A(O()).min(1)}),_m=j({regexp:O()}),vm=M([gm,_m]),ym=j({matcher:vm,name:O(),parsers:A(O()),libraryVersionRange:O().optional()}),bm=j({siteRegistrations:A(ym),version:O()}),xm=e=>bm.safeParse(e).success,Sm=e=>ym.safeParse(e).success,Cm=e=>vm.safeParse(e).success,wm=e=>Object.values(X).includes(e),Tm=j({url:O(),document:to(e=>typeof e==`object`&&!!e)}),Em=e=>Tm.safeParse(e).success,Dm=t(((e,t)=>{var n=`2.0.0`,r=256;t.exports={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:r-6,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:n,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),Om=t(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),km=t(((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Dm(),a=Om();e=t.exports={};var o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Am=t(((e,t)=>{var n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),jm=t(((e,t)=>{var n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Z=t(((e,t)=>{var n=Om(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Dm(),{safeRe:a,t:o}=km(),s=Am(),{compareIdentifiers:c}=jm();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Mm=t(((e,t)=>{var n=Z();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Nm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Pm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Fm=t(((e,t)=>{var n=Z();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Im=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Lm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).major})),Rm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).minor})),zm=t(((e,t)=>{var n=Z();t.exports=(e,t)=>new n(e,t).patch})),Bm=t(((e,t)=>{var n=Mm();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Q=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Vm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(t,e,r)})),Hm=t(((e,t)=>{var n=Q();t.exports=(e,t)=>n(e,t,!0)})),Um=t(((e,t)=>{var n=Z();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Wm=t(((e,t)=>{var n=Um();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Gm=t(((e,t)=>{var n=Um();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Km=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>0})),qm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<0})),Jm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)===0})),Ym=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)!==0})),Xm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)>=0})),Zm=t(((e,t)=>{var n=Q();t.exports=(e,t,r)=>n(e,t,r)<=0})),Qm=t(((e,t)=>{var n=Jm(),r=Ym(),i=Km(),a=Xm(),o=qm(),s=Zm();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),$m=t(((e,t)=>{var n=Z(),r=Mm(),{safeRe:i,t:a}=km();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),eh=t(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),$=t(((e,t)=>{var n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,se(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>b(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let ee=[..._.values()];return r.set(t,ee),ee}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ce(this.set[t],e,this.options))return!0;return!1}};var r=new(eh()),i=Am(),a=th(),o=Om(),s=Z(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=km(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Dm(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ie(e,t),o(`xrange`,e),e=oe(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>re(e,t)).join(` `),re=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ie=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ae(e,t)).join(` `)),ae=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},oe=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),b=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),se=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ce=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),th=t(((e,t)=>{var n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};var r=Am(),{safeRe:i,t:a}=km(),o=Qm(),s=Om(),c=Z(),l=$()})),nh=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),rh=t(((e,t)=>{var n=$();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),ih=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),ah=t(((e,t)=>{var n=Z(),r=$();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),oh=t(((e,t)=>{var n=Z(),r=$(),i=Km();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),sh=t(((e,t)=>{var n=$();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),ch=t(((e,t)=>{var n=Z(),r=th(),{ANY:i}=r,a=$(),o=nh(),s=Km(),c=qm(),l=Zm(),u=Xm();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),lh=t(((e,t)=>{var n=ch();t.exports=(e,t,r)=>n(e,t,`>`,r)})),uh=t(((e,t)=>{var n=ch();t.exports=(e,t,r)=>n(e,t,`<`,r)})),dh=t(((e,t)=>{var n=$();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),fh=t(((e,t)=>{var n=nh(),r=Q();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),ph=t(((e,t)=>{var n=$(),r=th(),{ANY:i}=r,a=nh(),o=Q(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),mh=t(((e,t)=>{var n=km(),r=Dm(),i=Z(),a=jm();t.exports={parse:Mm(),valid:Nm(),clean:Pm(),inc:Fm(),diff:Im(),major:Lm(),minor:Rm(),patch:zm(),prerelease:Bm(),compare:Q(),rcompare:Vm(),compareLoose:Hm(),compareBuild:Um(),sort:Wm(),rsort:Gm(),gt:Km(),lt:qm(),eq:Jm(),neq:Ym(),gte:Xm(),lte:Zm(),cmp:Qm(),coerce:$m(),Comparator:th(),Range:$(),satisfies:nh(),toComparators:rh(),maxSatisfying:ih(),minSatisfying:ah(),minVersion:oh(),validRange:sh(),outside:ch(),gtr:lh(),ltr:uh(),intersects:dh(),simplifyRange:fh(),subset:ph(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),hh=(e,t)=>gh(t)?t.hostnames.includes(new URL(e).hostname):_h(t)?!!e.match(t.regexp):!1,gh=e=>gm.safeParse(e).success,_h=e=>_m.safeParse(e).success,vh=(e,t)=>t?(0,mh.satisfies)(e,t):!0,yh=(e,t,n)=>vh(t,n.libraryVersionRange)&&hh(e,n.matcher),bh=(e,t)=>e.siteRegistrations.filter(e=>yh(t,pm(),e)),xh=(e,t)=>bh(e,t).flatMap(({parsers:e,name:t})=>e.filter(e=>wm(e)&&e in dm).map(e=>({parser:dm[e],parserType:e,name:t}))),Sh=(e,t)=>{let n=xh(e,t.url);for(let{parser:e,parserType:r,name:i}of n){let n=e(t);if(Yc(n)||Xc(n)||Zc(n))return{...n,meta:{parserName:i,parserType:r,referrer:t.url}}}return{...lc(t),meta:{parserName:null,parserType:X.NoResourceFound,referrer:t.url}}},Ch=(e,t)=>{switch(t){case jo.CA:return new URL(`https://${e}.rl.ca.talis.com`);default:return new URL(`https://${e}.rl.talis.com`)}};e.BookGenresSchema=io,e.CustomerListSchema=Ro,e.CustomerSchema=Lo,e.DirectLinkOnlyResultSchema=qo,e.Genre=F,e.HostnamesMatcherSchema=gm,e.JournalGenresSchema=ao,e.NON_OPENURL_PROPERTIES=xo,e.NonOpenUrlPropertiesSchema=so,e.NothingParsedResultSchema=Ko,e.OPENURL_KEYS=bo,e.OpenUrlAudioVisualResourceSchema=uo,e.OpenUrlBookResourceSchema=co,e.OpenUrlDocumentResourceSchema=po,e.OpenUrlImageResourceSchema=fo,e.OpenUrlJournalResourceSchema=lo,e.OpenUrlResourceSchema=oo,e.OpenUrlResultSchema=Jo,e.OpenUrlWebpageResourceSchema=mo,e.PARSERS=dm,e.ParserRegistrySchema=bm,e.ParserType=X,e.ParsingMetadataSchema=Go,e.ParsingRequestSchema=Fo,e.ParsingResponseSchema=Qo,e.ParsingResultSchema=Zo,e.REGISTRY=hm,e.RegExpMatcherSchema=_m,e.ResourceDataSchema=Tm,e.ResourceSchema=ho,e.SiteRegistrationSchema=ym,e.SummonSearchResultSchema=Xo,e.TenantRegion=jo,e.TenantRegistrySchema=No,e.TenantSchema=Mo,e.UrlMatcherSchema=vm,e.Z3988SearchResultSchema=Yo,e.convertCustomerListToTenantRegistry=Uo,e.createAudioVisual=R,e.createBook=I,e.createDocument=_o,e.createImage=go,e.createJournal=L,e.createWebpage=vo,e.directLinkOnly=$o,e.fromOpenUrl=Oo,e.getBaseBookmarkingUrl=(e,t)=>{let n=Ch(e,t);return new URL(`/ui/forms/bookmarklet.html`,n)},e.getLibraryVersion=pm,e.isCustomer=zo,e.isCustomerList=Bo,e.isDirectLinkOnlyResult=Jc,e.isGenre=Ao,e.isNothingParsedResult=Qc,e.isOpenUrlResult=Yc,e.isParserRegistry=xm,e.isParserType=wm,e.isParsingMetadata=qc,e.isParsingRequest=Io,e.isParsingResponse=Kc,e.isParsingResult=Gc,e.isResourceData=Em,e.isSiteRegistration=Sm,e.isSummonSearchResult=Zc,e.isTenant=Vo,e.isTenantRegion=Ho,e.isUrlMatcher=Cm,e.isZ3988SearchResult=Xc,e.nothingParsed=z,e.openUrlResource=B,e.parseResource=Sh,e.summonSearchResult=ts,e.toBookmarkingWorkflowUrl=(e,t,n)=>{let r=Eo(t);r.append(`fast`,`true`),r.append(`breakout`,`true`),n&&(n.parserName&&r.append(`targetTitle`,n.parserName),r.append(`referrer`,n.referrer));let i=new URL(e.toString());return i.search=r.toString(),i},e.toOpenUrl=Eo,e.z3988SearchResult=es});