@pi-oxide/extension-js 0.2.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content-script.d.ts +6 -43
- package/content-script.js +2 -2
- package/extension_js.d.ts +312 -226
- package/extension_js.js +62486 -60963
- package/generated.d.ts +45 -2
- package/index.d.ts +5 -91
- package/index.js +4425 -3529
- package/package.json +1 -1
- package/runner.d.ts +2 -1
- package/schemas.d.ts +209 -20
- package/tool-registry.d.ts +60 -3
- package/worker.js +572 -195
package/content-script.d.ts
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
declare let __logLevel: number;
|
|
9
|
-
declare function __formatMeta(meta: Record<string, unknown> | undefined): string;
|
|
10
|
-
declare function __log(level: number, event: string, meta?: Record<string, unknown>): void;
|
|
11
|
-
declare const logger: {
|
|
12
|
-
debug: (event: string, meta?: Record<string, unknown>) => void;
|
|
13
|
-
info: (event: string, meta?: Record<string, unknown>) => void;
|
|
14
|
-
warn: (event: string, meta?: Record<string, unknown>) => void;
|
|
15
|
-
error: (event: string, meta?: Record<string, unknown>) => void;
|
|
16
|
-
};
|
|
17
|
-
declare function getElementByRefId(refId: string | number): Element | null;
|
|
18
|
-
declare function findElementByLabel(query: string): Element | null;
|
|
19
|
-
declare function findCandidateLabels(query: string): string[];
|
|
20
|
-
declare function asRecord(obj: unknown): Record<string, unknown>;
|
|
21
|
-
declare function getStringParam(params: unknown, key: string): string;
|
|
22
|
-
declare function getNumberParam(params: unknown, key: string, fallback: number): number;
|
|
23
|
-
declare function getAccessibleRole(el: Element): string;
|
|
24
|
-
declare function getAccessibleName(el: Element): string;
|
|
25
|
-
declare function shouldInclude(el: Element): boolean;
|
|
26
|
-
interface SnapshotNode {
|
|
27
|
-
refId: number;
|
|
28
|
-
role: string;
|
|
29
|
-
tag: string;
|
|
30
|
-
name?: string;
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
__jsNotebookSetLogLevel?: (level: string) => void;
|
|
5
|
+
__jsNotebookContentScriptInjected?: boolean;
|
|
6
|
+
}
|
|
31
7
|
}
|
|
32
|
-
interface SnapshotResult {
|
|
33
|
-
text: string;
|
|
34
|
-
nodes: SnapshotNode[];
|
|
35
|
-
url: string;
|
|
36
|
-
title: string;
|
|
37
|
-
viewport: {
|
|
38
|
-
width: number;
|
|
39
|
-
height: number;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
declare function inlineSnapshot(maxNodes: number): SnapshotResult;
|
|
43
|
-
type Handler<T = unknown, R = unknown> = (params: T) => R | Promise<R>;
|
|
44
|
-
declare const handlers: Record<string, Handler>;
|
package/content-script.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";const C={debug:0,info:1,warn:2,error:3,none:4};let k=3;function $(e){if(!e)return"";const t=[];for(const[r,n]of Object.entries(e)){let o;if(n===null)o="null";else if(n===void 0)o="undefined";else if(typeof n=="string")o=n;else if(typeof n=="number"||typeof n=="boolean")o=String(n);else try{o=JSON.stringify(n)}catch{o="[Circular]"}t.push(`${r}=${o}`)}return t.length>0?` ${t.join(" ")}`:""}function g(e,t,r){if(e<k)return;const n=$(r),o=`[extension-js][content-script] ${t}${n}`;e>=3?console.error(o):e===2?console.warn(o):console.log(o)}const b={debug:(e,t)=>{g(0,e,t)},info:(e,t)=>{g(1,e,t)},warn:(e,t)=>{g(2,e,t)},error:(e,t)=>{g(3,e,t)}};if(window.__jsNotebookSetLogLevel=e=>{k=C[e]??3},window.__jsNotebookContentScriptInjected)throw new Error("Content script already injected");window.__jsNotebookContentScriptInjected=!0;function f(e){return document.querySelector(`[data-ref-id='${CSS.escape(String(e))}']`)}function y(e){var n,o,i;const t=e.toLowerCase().trim();if(!t)return null;const r=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const l of r){const u=l.getAttribute("aria-label");if(u&&u.toLowerCase().trim()===t)return l;const c=l.placeholder;if(c&&c.toLowerCase().trim()===t)return l;const d=l.id;if(d){const w=document.querySelector(`label[for='${CSS.escape(d)}']`);if(w&&((n=w.textContent)==null?void 0:n.trim().toLowerCase())===t)return l}const a=l.closest("label");if(a&&((o=a.textContent)==null?void 0:o.trim().toLowerCase())===t||(((i=l.textContent)==null?void 0:i.trim().toLowerCase())||"")===t)return l}return null}function p(e){var o;const t=e.toLowerCase().trim(),r=new Set,n=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const i of n){const l=i.getAttribute("aria-label");l&&r.add(l.trim());const u=i.placeholder;u&&r.add(u.trim());const c=((o=i.textContent)==null?void 0:o.trim())||"";c&&r.add(c)}return Array.from(r).filter(i=>i.toLowerCase().includes(t)).slice(0,5)}function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{}}function s(e,t){const r=h(e)[t];return typeof r=="string"?r:""}function I(e,t,r){const n=h(e)[t];return typeof n=="number"?n:r}function v(e){const t=e.tagName.toLowerCase(),r=e.getAttribute("role");if(r)return r;if(t==="button"||t==="input"&&e.type==="submit")return"button";if(t==="a")return"link";if(t==="input"){const n=e.type;if(n==="text"||n==="email"||n==="password"||n==="search")return"textbox";if(n==="checkbox")return"checkbox";if(n==="radio")return"radio";if(n==="submit"||n==="button")return"button"}return t==="textarea"?"textbox":t==="select"?"combobox":t==="img"?"img":t==="h1"||t==="h2"||t==="h3"||t==="h4"||t==="h5"||t==="h6"?"heading":t==="li"?"listitem":t==="ul"||t==="ol"?"list":t==="table"?"table":t==="tr"?"row":t==="td"||t==="th"?"cell":t==="nav"?"navigation":t==="main"?"main":t==="article"?"article":t==="section"?"region":t==="aside"?"complementary":t==="form"?"form":t==="dialog"||t==="modal"?"dialog":t==="figure"?"figure":t==="figcaption"?"caption":e.getAttribute("onclick")||e.onclick?"button":"generic"}function S(e){var l,u;const t=e.getAttribute("aria-label");if(t)return t;const r=e.getAttribute("aria-labelledby");if(r){const c=document.getElementById(r);if(c)return((l=c.textContent)==null?void 0:l.slice(0,60))||""}if(e.tagName.toLowerCase()==="img"){const c=e.getAttribute("alt");if(c)return c}const o=e.title;if(o)return o;const i=v(e);return i!=="generic"&&i!=="list"&&i!=="table"&&i!=="row"&&i!=="region"&&i!=="navigation"&&i!=="main"&&((u=e.textContent)==null?void 0:u.trim().slice(0,60))||""}function _(e){const t=v(e);if(t==="generic"||t==="presentation"||t==="none"||e.hidden)return!1;const r=window.getComputedStyle(e);return!(r.display==="none"||r.visibility==="hidden")}function A(e){let t=1;const r=[],n=[];function o(l,u){if(r.length>=e)return;const c=l.tagName.toLowerCase();if(c==="script"||c==="style"||c==="noscript"||c==="template")return;const d=_(l);let a=u;if(d){const m=t++;l.setAttribute("data-ref-id",String(m));const w=v(l),E=S(l),L={refId:m,role:w,tag:c};E&&(L.name=E),r.push(L);const x=[`${" ".repeat(u)}- ${w}`];E&&x.push(`"${E.replace(/"/g,'\\"')}"`),x.push(`[ref=${m}]`),n.push(x.join(" ")),a=u+1}for(const m of l.children)o(m,a)}return document.body&&o(document.body,0),{text:[`URL: ${window.location.href}`,`Title: ${document.title}`,""].concat(n).join(`
|
|
2
|
-
`),nodes:
|
|
1
|
+
(function(){"use strict";function fe(r){return r==null?{}:r instanceof Map?Object.fromEntries([...r.entries()].map(([e,t])=>[e,fe(t)])):Array.isArray(r)?r.map(fe):r}function st(r){return r===null?"null":r===void 0?"undefined":Array.isArray(r)?"array":typeof r}function N(r,e=0){if(e>2)return"...";const t=r._def;switch(t.typeName){case"ZodObject":{const n=t.shape(),s=Object.keys(n);return s.length===0?"{ }":e>=1?"{ ... }":`{ ${s.map(i=>{const o=n[i],c=o._def.typeName==="ZodOptional",f=N(c?o._def.innerType:o,e+1);return`${i}${c?"?":""}: ${f}`}).join(", ")} }`}case"ZodUnion":return t.options.map(s=>N(s,e)).join(" or ");case"ZodString":return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodBigInt":return"bigint";case"ZodNull":return"null";case"ZodArray":return`${N(t.type,e+1)}[]`;case"ZodTuple":return`[${t.items.map(s=>N(s,e+1)).join(", ")}]`;case"ZodRecord":return"object";case"ZodOptional":return`${N(t.innerType,e)}?`;case"ZodLiteral":return JSON.stringify(t.value);case"ZodEnum":return t.values.map(n=>`"${n}"`).join(" | ");case"ZodAny":return"any";case"ZodUnknown":return"unknown";case"ZodVoid":return"void";case"ZodUndefined":return"undefined";case"ZodEffects":return N(t.schema,e);case"ZodDefault":return N(t.innerType,e);case"ZodNullable":return`${N(t.innerType,e)} | null`;case"ZodLazy":return"lazy";case"ZodPromise":return`Promise<${N(t.type,e+1)}>`;case"ZodFunction":return"function";case"ZodDate":return"Date";case"ZodMap":return"Map";case"ZodSet":return"Set";case"ZodIntersection":return`${N(t.left,e)} & ${N(t.right,e)}`;case"ZodDiscriminatedUnion":return t.options.map(s=>N(s,e)).join(" or ");case"ZodBranded":return N(t.type,e);case"ZodNaN":return"NaN";case"ZodCatch":return N(t.innerType,e);case"ZodPipeline":return N(t.in,e);case"ZodReadonly":return`readonly ${N(t.innerType,e)}`;default:return"unknown"}}function at(r,e,t,n){const s=t.filter(o=>o.path.length===0),a=t.filter(o=>o.path.length>0);if(s.length>0&&a.length===0){const o=s.some(f=>f.code==="custom"),c=s.some(f=>f.code!=="invalid_type"&&f.code!=="invalid_literal"&&f.code!=="invalid_union");if(!o&&!c){const f=N(e),b=st(n);return`Invalid parameters for ${r}: expected ${f}${f==="{ }"?" or no args":""}, received ${b}`}}const i=t.map(o=>`at '${o.path.length>0?o.path.join("."):"root"}': ${o.message}`);return`Invalid parameters for ${r}: ${i.join("; ")}`}async function it(r,e,t,n,s){const a=r.safeParse(fe(n));if(!a.success)return{ok:!1,error:{message:at(s,r,a.error.issues,n),code:"E_INVALID_PARAMS",category:"validation"}};try{const i=await t(a.data),o=e.safeParse(i);if(!o.success){const c=o.error.issues.map(f=>{const b=f.path.join(".");return`invalid return value${b?` at '${b}'`:""} (${f.message})`});return{ok:!1,error:{message:`Invalid return value for ${s}: ${c.join("; ")}`,code:"E_INVALID_RETURN",category:"validation"}}}return{ok:!0,value:o.data}}catch(i){const o=i instanceof Error?i.message:String(i),c=typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="string"?i.code:"E_HANDLER",f=typeof i=="object"&&i!==null&&"category"in i&&typeof i.category=="string"?i.category:void 0;return{ok:!1,error:{message:`${s}: ${o}`,code:c,category:f}}}}const $e=new Map,he=new Map;function ot(r){$e.set(r.registryAction,r)}function ke(r){return $e.get(r)}function ct(r){for(const e of r)ot(e);try{chrome.runtime.sendMessage({type:"contentScriptReady"})}catch{}}function lt(r){const e=he.get(r);return e?(e.abort(),he.delete(r),!0):!1}async function ut(r,e,t,n,s){const a=ke(r);if(!a)return{ok:!1,error:{message:`No schema registered for content-script action: ${r}`,code:"E_INTERNAL"}};const i=new AbortController;s&&he.set(s,i);try{return await it(a.params,a.returns,async o=>t(o,i.signal),fe(n),r)}finally{s&&he.delete(s)}}var S;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(S||(S={}));var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));const p=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),H=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},l=S.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class D extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const f=i.path[c];c===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],c++}}};return s(this),n}static assert(e){if(!(e instanceof D))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}D.create=r=>new D(r);const xe=(r,e)=>{let t;switch(r.code){case l.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case l.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,S.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:t=`Unrecognized key(s) in object: ${S.joinValues(r.keys,", ")}`;break;case l.invalid_union:t="Invalid input";break;case l.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${S.joinValues(r.options)}`;break;case l.invalid_enum_value:t=`Invalid enum value. Expected ${S.joinValues(r.options)}, received '${r.received}'`;break;case l.invalid_arguments:t="Invalid function arguments";break;case l.invalid_return_type:t="Invalid function return type";break;case l.invalid_date:t="Invalid date";break;case l.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:S.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case l.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case l.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case l.custom:t="Invalid input";break;case l.invalid_intersection_types:t="Intersection results could not be merged";break;case l.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case l.not_finite:t="Number must be finite";break;default:t=e.defaultError,S.assertNever(r)}return{message:t}};let dt=xe;function ft(){return dt}const ht=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(f=>!!f).slice().reverse();for(const f of c)o=f(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function m(r,e){const t=ft(),n=ht({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===xe?void 0:xe].filter(s=>!!s)});r.common.issues.push(n)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return v;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return R.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const v=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),$=r=>({status:"valid",value:r}),Le=r=>r.status==="aborted",Me=r=>r.status==="dirty",te=r=>r.status==="valid",me=r=>typeof Promise<"u"&&r instanceof Promise;var y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class M{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ve=(r,e)=>{if(te(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new D(r.common.issues);return this._error=t,this._error}}};function k(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return H(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(me(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Ve(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return te(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>te(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(me(s)?s:Promise.resolve(s));return Ve(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:l.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new K({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return ie.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return ve.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return ge.create(this,e,this._def)}transform(e){return new K({...k(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ie({...k(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Pt({typeName:_.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ee({...k(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ne.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mt=/^c[^\s-]{8,}$/i,pt=/^[0-9a-z]+$/,yt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_t=/^[a-z0-9_-]{21}$/i,vt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,kt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let we;const wt=/^(?:(?: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])$/,St=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Tt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ct=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,At=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,It=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,De="((\\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])))",Et=new RegExp(`^${De}$`);function ze(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Nt(r){return new RegExp(`^${ze(r)}$`)}function Zt(r){let e=`${De}T${ze(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ot(r,e){return!!((e==="v4"||!e)&&wt.test(r)||(e==="v6"||!e)&&Tt.test(r))}function Rt(r,e){if(!vt.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function jt(r,e){return!!((e==="v4"||!e)&&St.test(r)||(e==="v6"||!e)&&Ct.test(r))}class z extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),v}const n=new R;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?m(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&m(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")we||(we=new RegExp(xt,"u")),we.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")gt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")_t.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")mt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")pt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")yt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:l.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:l.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Zt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Et.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Nt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?bt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ot(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Rt(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?jt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?At.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:l.invalid_string,message:a.message}),n.dirty()):S.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:l.invalid_string,...y.errToObj(n)})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new z({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}z.create=r=>new z({checks:[],typeName:_.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});function $t(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class re extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),v}let n;const s=new R;for(const a of this._def.checks)a.kind==="int"?S.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?$t(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_finite,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,s){return new re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(s)}]})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&S.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}re.create=r=>new re({checks:[],typeName:_.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class ne extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let n;const s=new R;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:l.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,s){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(s)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ne.create=r=>new ne({checks:[],typeName:_.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});class Se extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.boolean,received:n.parsedType}),v}return $(e.data)}}Se.create=r=>new Se({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class pe extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),v}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_date}),v}const n=new R;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):S.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}pe.create=r=>new pe({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:_.ZodDate,...k(r)});class Ue extends x{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.symbol,received:n.parsedType}),v}return $(e.data)}}Ue.create=r=>new Ue({typeName:_.ZodSymbol,...k(r)});class Be extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.undefined,received:n.parsedType}),v}return $(e.data)}}Be.create=r=>new Be({typeName:_.ZodUndefined,...k(r)});class Te extends x{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.null,received:n.parsedType}),v}return $(e.data)}}Te.create=r=>new Te({typeName:_.ZodNull,...k(r)});class Fe extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return $(e.data)}}Fe.create=r=>new Fe({typeName:_.ZodAny,...k(r)});class Ce extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $(e.data)}}Ce.create=r=>new Ce({typeName:_.ZodUnknown,...k(r)});class J extends x{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:l.invalid_type,expected:p.never,received:t.parsedType}),v}}J.create=r=>new J({typeName:_.ZodNever,...k(r)});class qe extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.void,received:n.parsedType}),v}return $(e.data)}}qe.create=r=>new qe({typeName:_.ZodVoid,...k(r)});class V extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return m(t,{code:l.invalid_type,expected:p.array,received:t.parsedType}),v;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(m(t,{code:i?l.too_big:l.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new M(t,i,t.path,o)))).then(i=>R.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new M(t,i,t.path,o)));return R.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new V({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new V({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new V({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}V.create=(r,e)=>new V({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...k(e)});function se(r){if(r instanceof I){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=G.create(se(n))}return new I({...r._def,shape:()=>e})}else return r instanceof V?new V({...r._def,type:se(r.element)}):r instanceof G?G.create(se(r.unwrap())):r instanceof ie?ie.create(se(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>se(e))):r}class I extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=S.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const f=this._getOrReturnCtx(e);return m(f,{code:l.invalid_type,expected:p.object,received:f.parsedType}),v}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const f in s.data)i.includes(f)||o.push(f);const c=[];for(const f of i){const b=a[f],Z=s.data[f];c.push({key:{status:"valid",value:f},value:b._parse(new M(s,Z,s.path,f)),alwaysSet:f in s.data})}if(this._def.catchall instanceof J){const f=this._def.unknownKeys;if(f==="passthrough")for(const b of o)c.push({key:{status:"valid",value:b},value:{status:"valid",value:s.data[b]}});else if(f==="strict")o.length>0&&(m(s,{code:l.unrecognized_keys,keys:o}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const b of o){const Z=s.data[b];c.push({key:{status:"valid",value:b},value:f._parse(new M(s,Z,s.path,b)),alwaysSet:b in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const f=[];for(const b of c){const Z=await b.key,L=await b.value;f.push({key:Z,value:L,alwaysSet:b.alwaysSet})}return f}).then(f=>R.mergeObjectSync(n,f)):R.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new I({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new I({...this._def,unknownKeys:"strip"})}passthrough(){return new I({...this._def,unknownKeys:"passthrough"})}extend(e){return new I({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new I({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new I({...this._def,catchall:e})}pick(e){const t={};for(const n of S.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new I({...this._def,shape:()=>t})}omit(e){const t={};for(const n of S.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new I({...this._def,shape:()=>t})}deepPartial(){return se(this)}partial(e){const t={};for(const n of S.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new I({...this._def,shape:()=>t})}required(e){const t={};for(const n of S.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof G;)a=a._def.innerType;t[n]=a}return new I({...this._def,shape:()=>t})}keyof(){return Ge(S.objectKeys(this.shape))}}I.create=(r,e)=>new I({shape:()=>r,unknownKeys:"strip",catchall:J.create(),typeName:_.ZodObject,...k(e)}),I.strictCreate=(r,e)=>new I({shape:()=>r,unknownKeys:"strict",catchall:J.create(),typeName:_.ZodObject,...k(e)}),I.lazycreate=(r,e)=>new I({shape:r,unknownKeys:"strip",catchall:J.create(),typeName:_.ZodObject,...k(e)});class ye extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new D(o.ctx.common.issues));return m(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const f={...t,common:{...t.common,issues:[]},parent:null},b=c._parseSync({data:t.data,path:t.path,parent:f});if(b.status==="valid")return b;b.status==="dirty"&&!a&&(a={result:b,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new D(c));return m(t,{code:l.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}ye.create=(r,e)=>new ye({options:r,typeName:_.ZodUnion,...k(e)});function Ae(r,e){const t=H(r),n=H(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&n===p.object){const s=S.objectKeys(e),a=S.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Ae(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===p.array&&n===p.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Ae(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===p.date&&n===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ge extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Le(a)||Le(i))return v;const o=Ae(a.value,i.value);return o.valid?((Me(a)||Me(i))&&t.dirty(),{status:t.value,value:o.data}):(m(n,{code:l.invalid_intersection_types}),v)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ge.create=(r,e,t)=>new ge({left:r,right:e,typeName:_.ZodIntersection,...k(t)});class Y extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return m(n,{code:l.invalid_type,expected:p.array,received:n.parsedType}),v;if(n.data.length<this._def.items.length)return m(n,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new M(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>R.mergeArray(t,i)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Y({...this._def,rest:e})}}Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:_.ZodTuple,rest:null,...k(e)})};class _e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return m(n,{code:l.invalid_type,expected:p.object,received:n.parsedType}),v;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new M(n,o,n.path,o)),value:i._parse(new M(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?R.mergeObjectAsync(t,s):R.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new _e({keyType:e,valueType:t,typeName:_.ZodRecord,...k(n)}):new _e({keyType:z.create(),valueType:e,typeName:_.ZodRecord,...k(t)})}}class We extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return m(n,{code:l.invalid_type,expected:p.map,received:n.parsedType}),v;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],f)=>({key:s._parse(new M(n,o,n.path,[f,"key"])),value:a._parse(new M(n,c,n.path,[f,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const f=await c.key,b=await c.value;if(f.status==="aborted"||b.status==="aborted")return v;(f.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(f.value,b.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const f=c.key,b=c.value;if(f.status==="aborted"||b.status==="aborted")return v;(f.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(f.value,b.value)}return{status:t.value,value:o}}}}We.create=(r,e,t)=>new We({valueType:e,keyType:r,typeName:_.ZodMap,...k(t)});class le extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return m(n,{code:l.invalid_type,expected:p.set,received:n.parsedType}),v;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(m(n,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const f=new Set;for(const b of c){if(b.status==="aborted")return v;b.status==="dirty"&&t.dirty(),f.add(b.value)}return{status:t.value,value:f}}const o=[...n.data.values()].map((c,f)=>a._parse(new M(n,c,n.path,f)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new le({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new le({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}le.create=(r,e)=>new le({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...k(e)});class He extends x{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}He.create=(r,e)=>new He({getter:r,typeName:_.ZodLazy,...k(e)});class Je extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:l.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}Je.create=(r,e)=>new Je({value:r,typeName:_.ZodLiteral,...k(e)});function Ge(r,e){return new ae({values:r,typeName:_.ZodEnum,...k(e)})}class ae extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:S.joinValues(n),received:t.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{received:t.data,code:l.invalid_enum_value,options:n}),v}return $(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ae.create(e,{...this._def,...t})}exclude(e,t=this._def){return ae.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ae.create=Ge;class Ye extends x{_parse(e){const t=S.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const s=S.objectValues(t);return m(n,{expected:S.joinValues(s),received:n.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(S.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=S.objectValues(t);return m(n,{received:n.data,code:l.invalid_enum_value,options:s}),v}return $(e.data)}get enum(){return this._def.values}}Ye.create=(r,e)=>new Ye({values:r,typeName:_.ZodNativeEnum,...k(e)});class ve extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return m(t,{code:l.invalid_type,expected:p.promise,received:t.parsedType}),v;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return $(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ve.create=(r,e)=>new ve({type:r,typeName:_.ZodPromise,...k(e)});class K extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{m(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?v:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!te(i))return v;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):v);S.assertNever(s)}}K.create=(r,e,t)=>new K({schema:r,typeName:_.ZodEffects,effect:e,...k(t)}),K.createWithPreprocess=(r,e,t)=>new K({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...k(t)});class G extends x{_parse(e){return this._getType(e)===p.undefined?$(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:_.ZodOptional,...k(e)});class ie extends x{_parse(e){return this._getType(e)===p.null?$(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ie.create=(r,e)=>new ie({innerType:r,typeName:_.ZodNullable,...k(e)});class Ie extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ie.create=(r,e)=>new Ie({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class Ee extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return me(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class Ke extends x{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.nan,received:n.parsedType}),v}return{status:"valid",value:e.data}}}Ke.create=r=>new Ke({typeName:_.ZodNaN,...k(r)});class Pt extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ne extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ce(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?v:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ne({in:e,out:t,typeName:_.ZodPipeline})}}class Ze extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return me(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:_.ZodReadonly,...k(e)});var _;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(_||(_={}));const h=z.create,w=re.create,Qe=ne.create,j=Se.create,Lt=Te.create,u=Ce.create;J.create;const E=V.create,g=I.create,T=ye.create;ge.create;const Mt=Y.create,d=_e.create;ae.create,ve.create,G.create,ie.create;const U=K.createWithPreprocess,P=()=>T([Qe(),w().finite()]).transform(r=>BigInt(r));g({key:h()}),g({key:h(),value:h()}),g({key:h()}),g({});const Vt=g({items:d(u())});U(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)&&!("items"in r)?{items:r}:r,Vt);const Dt=g({keys:E(h()),defaults:d(u()).optional()});U(r=>Array.isArray(r)?{keys:r}:r,Dt),g({});const zt=g({keys:E(h())});U(r=>Array.isArray(r)?{keys:r}:r,zt),g({}),g({}),T([Mt([T([g({text:h()}),h()])]),g({text:h().optional(),value:h().optional()})]),g({url:h(),method:h().default("GET"),headers:d(h()).default({}),body:h().nullable().default(null),timeout:P().default(30000n)}),g({duration:P()});const ue=()=>h().regex(/^e\d+$/),Ut='use { refId: "e2" } or { label: "..." } object form, not positional arguments',Oe=(r,e)=>{if(r.__invalidPositional!==void 0){e.addIssue({code:l.custom,message:Ut});return}!r.refId&&!r.label&&e.addIssue({code:l.custom,message:"Either refId or label is required"})},Xe=(r,e)=>{r.x!==void 0||r.y!==void 0||Oe(r,e)},O=r=>U(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,g({__invalidPositional:T([h(),w()]).optional(),refId:ue().optional(),label:h().optional(),...r}).superRefine(Oe)),de={tabId:T([w(),Qe()]).optional()},Q=r=>U(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,g({__invalidPositional:T([h(),w()]).optional(),...de,refId:ue().optional(),label:h().optional(),...r}).superRefine(Oe)),Bt=g({}),Ft=g({});g({url:h(),timeout:P().optional()});const qt=g({});g({}),g({}),g({duration:P().default(1000n)});const Wt=O(),Ht=O({value:h()}),Jt=O({text:h()}),Gt=O({text:h()}),Yt=g({key:h()}),Kt=O({value:h()}),Qt=O({checked:j().optional()}),Xt=O(),er=g({}),tr=g({direction:h().default("down"),amount:w().default(300)}),rr=U(r=>typeof r=="string"||typeof r=="number"?{__invalidPositional:r}:r,g({__invalidPositional:T([h(),w()]).optional(),refId:ue().optional(),label:h().optional(),x:w().optional(),y:w().optional()}).superRefine(Xe)),nr=O();g({selector:h()}),g({selector:h(),timeout:P().default(30000n)});const sr=g({fields:E(h())});U(r=>Array.isArray(r)?{fields:r}:r,sr),T([w(),E(u()),d(u())]),g({}),d(u()),U(r=>typeof r=="string"?{url:r}:r,g({url:h().optional(),active:j().optional()})),T([w(),E(u()),d(u())]),T([w(),E(u()),d(u())]),d(u());const ar=Q(),ir=Q({value:h()}),or=U(r=>typeof r=="string"||typeof r=="number"?{__invalidPositional:r}:r,g({__invalidPositional:T([h(),w()]).optional(),...de,refId:ue().optional(),label:h().optional(),x:w().optional(),y:w().optional()}).superRefine(Xe)),cr=Q({text:h()}),lr=g({...de,key:h()}),ur=Q({value:h()}),dr=Q({checked:j().optional()}),fr=Q(),hr=g({...de}),mr=g({...de,direction:h().default("down"),amount:w().default(300)}),pr=Q();d(u());const yr=d(u());d(u()),d(u()),d(u()),d(u()),d(u()),O(),O(),O({value:h().optional()}),O({text:h().optional()}),g({key:h().optional()}),O({value:h().optional()}),O({checked:j().optional()}),O(),g({}),g({direction:h().optional(),amount:w().optional()}),O(),O({text:h().optional()}),g({}),g({}),g({duration:P().default(1000n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({snapshot:u(),format:h().optional()});const gr=d(u());d(u()),d(u()),g({path:h()}),g({from:h(),to:h()}),g({path:h(),data:h()}),g({path:h(),offset:P(),len:w()}),g({path:h(),offset:P(),data:h()}),g({path:h(),algo:h().default("sha256")}),d(u()),d(u()),d(u()),d(u()),T([w(),d(u())]),T([w(),d(u())]),d(u()),d(u()),d(u()),T([h(),d(u())]),d(u()),d(u()),d(u()),d(u()),d(u()),T([h(),w(),d(u())]),d(u()),d(u()),d(u()),T([w(),d(u())]),d(u()),d(u()),d(u()),d(u()),d(u()),E(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),d(u()),T([w(),d(u())]),d(u()),d(u()),T([w(),d(u())]),d(u()),T([h(),w(),d(u())]),d(u()),d(u()),d(u()),d(u()),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),d(u()),d(u()),d(u()),d(u()),g({status:w(),ok:j(),headers:d(h()),body:h()}),g({data:u(),text:h()});const _r=g({refId:ue(),role:h(),tag:h(),name:h().optional()}),vr=g({text:h(),nodes:E(_r),url:h(),title:h(),viewport:g({width:w(),height:w()})}),br=d(u());E(br);const kr=d(u());E(kr),d(u()).nullable(),E(d(u())),E(d(u())),E(d(u())),E(d(u())),h(),j(),T([h(),w()]),j();const xr=d(u());E(xr),E(d(u())),E(d(u()));const wr=d(u());E(wr),w(),d(u()),d(u()),E(d(u()));const Sr=new Set(["page_url","page_title","page_click","page_fill","page_type","page_append","page_press","page_select","page_check","page_hover","page_unhover","page_scroll","page_scroll_to","page_dblclick","page_back","tab_click","tab_fill","tab_type","tab_press","tab_select","tab_check","tab_hover","tab_unhover","tab_scroll","tab_scroll_to","tab_dblclick","tab_back"]);function Tr(r){if(r.startsWith("page_")||r.startsWith("tab_")){const e=r.indexOf("_");if(e>=0)return r.slice(e+1)}return r}const C={string:h(),null:Lt(),boolean:j()},Cr={page_url:{params:Bt,returns:C.string},page_title:{params:Ft,returns:C.string},page_click:{params:Wt,returns:C.null},page_fill:{params:Ht,returns:C.null},page_type:{params:Jt,returns:C.null},page_append:{params:Gt,returns:C.null},page_press:{params:Yt,returns:C.null},page_select:{params:Kt,returns:C.null},page_check:{params:Qt,returns:C.null},page_hover:{params:Xt,returns:C.null},page_unhover:{params:er,returns:C.null},page_scroll:{params:tr,returns:C.boolean},page_scroll_to:{params:rr,returns:C.boolean},page_dblclick:{params:nr,returns:C.null},page_back:{params:qt,returns:C.boolean},tab_click:{params:ar,returns:C.null},tab_fill:{params:ir,returns:C.null},tab_type:{params:cr,returns:C.null},tab_press:{params:lr,returns:C.null},tab_select:{params:ur,returns:C.null},tab_check:{params:dr,returns:C.null},tab_hover:{params:fr,returns:C.null},tab_unhover:{params:hr,returns:C.null},tab_scroll:{params:mr,returns:C.boolean},tab_scroll_to:{params:or,returns:C.boolean},tab_dblclick:{params:pr,returns:C.null},tab_back:{params:yr,returns:C.boolean}};function Ar(){return[{registryAction:"ping",handlerKey:"ping",params:g({}),returns:g({ok:j()})},{registryAction:"snapshot",handlerKey:"snapshot",params:gr,returns:vr}]}function Ir(){const r=[];for(const e of Sr){const t=Cr[e];if(!t)throw new Error(`Missing content-script schemas for action: ${e}`);const n=e.indexOf("_"),s=n>=0?e.slice(n+1):e;r.push({registryAction:e,handlerKey:s,params:t.params,returns:t.returns})}return r}const B={debug:0,info:1,warn:2,error:3,none:4};let et=B.error;function Er(r){if(!r)return"";const e=[];for(const[t,n]of Object.entries(r)){let s;if(n===null)s="null";else if(n===void 0)s="undefined";else if(typeof n=="string")s=n;else if(typeof n=="number"||typeof n=="boolean")s=String(n);else try{s=JSON.stringify(n)}catch{s="[Circular]"}e.push(`${t}=${s}`)}return e.length>0?` ${e.join(" ")}`:""}function be(r,e,t){if(r<et)return;const n=Er(t),s=`[extension-js][content-script] ${e}${n}`;r>=B.error?console.error(s):r===B.warn?console.warn(s):console.log(s)}const X={debug:(r,e)=>{be(B.debug,r,e)},info:(r,e)=>{be(B.info,r,e)},warn:(r,e)=>{be(B.warn,r,e)},error:(r,e)=>{be(B.error,r,e)}};function Nr(){window.__jsNotebookSetLogLevel=r=>{et=B[r]??B.error}}function F(r){return document.querySelector(`[data-ref-id='${CSS.escape(r)}']`)}function q(r){var n,s,a;const e=r.toLowerCase().trim();if(!e)return null;const t=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const i of t){const o=i.getAttribute("aria-label");if(o&&o.toLowerCase().trim()===e)return i;const c=i.placeholder;if(c&&c.toLowerCase().trim()===e)return i;const f=i.id;if(f){const L=document.querySelector(`label[for='${CSS.escape(f)}']`);if(L&&((n=L.textContent)==null?void 0:n.trim().toLowerCase())===e)return i}const b=i.closest("label");if(b&&((s=b.textContent)==null?void 0:s.trim().toLowerCase())===e||(((a=i.textContent)==null?void 0:a.trim().toLowerCase())||"")===e)return i}return null}function Zr(r){var s;const e=r.toLowerCase().trim(),t=new Set,n=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const a of n){const i=a.getAttribute("aria-label");i&&t.add(i.trim());const o=a.placeholder;o&&t.add(o.trim());const c=((s=a.textContent)==null?void 0:s.trim())||"";c&&t.add(c)}return Array.from(t).filter(a=>a.toLowerCase().includes(e)).slice(0,5)}function ee(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}function A(r,e){const t=ee(r)[e];return typeof t=="string"?t:""}function tt(r,e,t){const n=ee(r)[e];return typeof n=="number"?n:t}function W(r,e,t=!1,n){const s=r?"refId":e?"label":null,a=r||e;let i=`Element not found${s?` by ${s} "${a}"`:""}`;if(t&&a){const c=Zr(a);i+=`. Candidates: ${c.join(", ")||"none"}`}throw new Error(i)}function Re(r){const e=r.tagName.toLowerCase(),t=r.getAttribute("role");if(t)return t;if(e==="button"||e==="input"&&r.type==="submit")return"button";if(e==="a")return"link";if(e==="input"){const n=r.type;if(n==="text"||n==="email"||n==="password"||n==="search")return"textbox";if(n==="checkbox")return"checkbox";if(n==="radio")return"radio";if(n==="submit"||n==="button")return"button"}return e==="textarea"?"textbox":e==="select"?"combobox":e==="img"?"img":e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6"?"heading":e==="li"?"listitem":e==="ul"||e==="ol"?"list":e==="table"?"table":e==="tr"?"row":e==="td"||e==="th"?"cell":e==="nav"?"navigation":e==="main"?"main":e==="article"?"article":e==="section"?"region":e==="aside"?"complementary":e==="form"?"form":e==="dialog"||e==="modal"?"dialog":e==="figure"?"figure":e==="figcaption"?"caption":r.getAttribute("onclick")||r.onclick?"button":"generic"}function Or(r){var i,o;const e=r.getAttribute("aria-label");if(e)return e;const t=r.getAttribute("aria-labelledby");if(t){const c=document.getElementById(t);if(c)return((i=c.textContent)==null?void 0:i.slice(0,60))||""}if(r.tagName.toLowerCase()==="img"){const c=r.getAttribute("alt");if(c)return c}const s=r.title;if(s)return s;const a=Re(r);return a!=="generic"&&a!=="list"&&a!=="table"&&a!=="row"&&a!=="region"&&a!=="navigation"&&a!=="main"&&((o=r.textContent)==null?void 0:o.trim().slice(0,60))||""}function Rr(r){const e=Re(r);if(e==="generic"||e==="presentation"||e==="none"||r.hidden)return!1;const t=window.getComputedStyle(r);return!(t.display==="none"||t.visibility==="hidden")}function jr(r){let e=1;const t=[],n=[];function s(i,o){if(t.length>=r)return;const c=i.tagName.toLowerCase();if(c==="script"||c==="style"||c==="noscript"||c==="template")return;const f=Rr(i);let b=o;if(f){const Z="e"+e++;i.setAttribute("data-ref-id",Z);const L=Re(i),oe=Or(i),nt={refId:Z,role:L,tag:c};oe&&(nt.name=oe),t.push(nt);const je=[`${" ".repeat(o)}- ${L}`];oe&&je.push(`"${oe.replace(/"/g,'\\"')}"`),je.push(`[${Z}]`),n.push(je.join(" ")),b=o+1}for(const Z of i.children)s(Z,b)}return document.body&&s(document.body,0),{text:[`URL: ${window.location.href}`,`Title: ${document.title}`,""].concat(n).join(`
|
|
2
|
+
`),nodes:t,url:window.location.href,title:document.title,viewport:{width:window.innerWidth,height:window.innerHeight}}}const $r=3e4,Pr={click:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;return!n&&t&&(n=q(t)),n||W(e,t,!0),n.click(),null},fill:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"value");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},type:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"text");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},append:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"text");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value+=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},press:r=>{const e=A(r,"key"),t=new KeyboardEvent("keydown",{key:e,bubbles:!0});document.dispatchEvent(t);const n=new KeyboardEvent("keyup",{key:e,bubbles:!0});return document.dispatchEvent(n),null},select:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"value");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t),s instanceof HTMLSelectElement)return s.value=n,null;throw new Error("Element is not a select")},check:r=>{const e=A(r,"refId"),t=A(r,"label"),n=(()=>{const a=ee(r);return typeof a.checked=="boolean"?a.checked:!0})();let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t),s instanceof HTMLInputElement&&s.type==="checkbox")return s.checked=n,null;throw new Error("Element is not a checkbox")},hover:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;!n&&t&&(n=q(t)),n||W(e,t);const s=new MouseEvent("mouseenter",{bubbles:!0});return n.dispatchEvent(s),null},unhover:()=>{const r=new MouseEvent("mouseleave",{bubbles:!0});return document.body.dispatchEvent(r),null},scroll:r=>{const e=ee(r),t=e.direction??"down",n=typeof e.amount=="number"?e.amount:300;return window.scrollBy({top:t==="down"?n:-n,behavior:"smooth"}),!0},dblclick:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;!n&&t&&(n=q(t)),n||W(e,t);const s=new MouseEvent("dblclick",{bubbles:!0});return n.dispatchEvent(s),null},forward:()=>(window.history.forward(),!0),reload:()=>(window.location.reload(),!0),scroll_to:r=>{const e=A(r,"refId"),t=A(r,"label"),n=tt(r,"x",0),s=tt(r,"y",0);if(e||t){let a=e?F(e):null;if(!a&&t&&(a=q(t)),a)return a.scrollIntoView({behavior:"smooth"}),!0;W(e,t)}return window.scrollTo({top:s,left:n,behavior:"smooth"}),!0},evaluate:r=>{const e=A(r,"code");if(typeof e!="string")throw new Error("evaluate requires a string argument");return new Function(e)()},back:()=>(window.history.back(),!0),url:()=>window.location.href,title:()=>document.title,ping:()=>({ok:!0}),snapshot:async r=>{const e=ee(r),t=typeof e.max_nodes=="number"?e.max_nodes:500;X.debug("snapshot",{maxNodes:t,hasBody:!!document.body});const n=jr(t);return X.debug("snapshot_result",{nodeCount:n.nodes.length}),n},fetch:async(r,e)=>{const t=ee(r),n=t.url,s=(t.method||"GET").toString().toUpperCase(),a=t.headers||{},i=t.body??null,o=typeof t.timeout=="number"?t.timeout:$r,c=new AbortController,f=()=>c.abort();if(e){if(e.aborted)throw new DOMException("Aborted","AbortError");e.addEventListener("abort",f,{once:!0})}const b=setTimeout(()=>c.abort(),o);try{const Z={method:s,headers:typeof a=="object"&&a!==null?a:{},signal:c.signal};i!=null&&(Z.body=typeof i=="string"?i:String(i));const L=await fetch(n,Z),oe=await L.text();return{status:L.status,ok:L.ok,headers:Object.fromEntries(L.headers.entries()),body:oe}}catch(Z){throw Z}finally{clearTimeout(b),e==null||e.removeEventListener("abort",f)}}};function Lr(r,e){if(ke(r))return r;const t=`page_${e}`;return ke(t)?t:r}function rt(r,e,t,n,s){const a=Lr(r,e),i=Pr[e];return i?(ut(a,e,i,t,s).then(c=>{X.debug("dispatch_response",{registryAction:r,handlerAction:e,ok:c.ok}),n(c)}).catch(c=>{const f=c instanceof Error?c.message:String(c);X.debug("dispatch_error",{registryAction:r,handlerAction:e,error:f}),n({ok:!1,error:f||String(c)})}),!0):(X.debug("no_handler",{action:e,registryAction:r}),n({ok:!1,error:`Unknown content script action: ${e}`}),!1)}function Mr(){chrome.runtime.onMessage.addListener((r,e,t)=>{if(e.id!==chrome.runtime.id)return X.warn("unauthorized_sender",{senderId:e.id,expected:chrome.runtime.id}),t({ok:!1,error:"Unauthorized sender"}),!1;const n=ee(r),s=String(n.type??""),a=String(n.action??"");if(X.debug("received",{messageType:s,action:a,hasParams:!!n.params}),s==="registryCallCancel"){const i=String(n.id??"");return lt(i),t({ok:!0}),!1}if(s==="registryCall"){const i=Tr(a),o=typeof n.id=="string"?n.id:void 0;return rt(a,i,n.params,t,o)}return!a&&s==="contract-ping"?(t({ok:!0}),!1):a?rt(a,a,n.params,t):(t({ok:!1,error:"Missing action"}),!1)})}if(Nr(),window.__jsNotebookContentScriptInjected)throw new Error("Content script already injected");window.__jsNotebookContentScriptInjected=!0,ct([...Ir(),...Ar()]),Mr()})();
|