scordi-extension 1.14.5 → 1.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/loading-page-1924caaa.js +51 -0
- package/dist/blocks/WaitForConditionBlock.d.ts +176 -0
- package/dist/blocks/WaitForConditionBlock.d.ts.map +1 -0
- package/dist/blocks/index.cjs +4 -0
- package/dist/blocks/index.d.ts +136 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +7839 -0
- package/dist/blocks/logo.png +0 -0
- package/dist/logo.png +0 -0
- package/dist/manifest.json +55 -0
- package/dist/public/logo.png +0 -0
- package/dist/sdk/index.cjs +1 -0
- package/dist/sdk/index.js +3 -2
- package/dist/sdk/types.d.ts +1 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/service-worker-loader.js +3 -0
- package/dist/src/blocks/AiParseDataBlock.ts.js +101 -0
- package/dist/src/blocks/ClearValueFormBlock.ts.js +55 -0
- package/dist/src/blocks/DataExtractBlock.ts.js +28 -0
- package/dist/src/blocks/ElementExistsBlock.ts.js +26 -0
- package/dist/src/blocks/EventClickBlock.ts.js +143 -0
- package/dist/src/blocks/FetchApiBlock.ts.js +50 -0
- package/dist/src/blocks/GetAttributeValueBlock.ts.js +33 -0
- package/dist/src/blocks/GetElementDataBlock.ts.js +114 -0
- package/dist/src/blocks/GetTextBlock.ts.js +152 -0
- package/dist/src/blocks/GetValueFormBlock.ts.js +52 -0
- package/dist/src/blocks/KeypressBlock.ts.js +89 -0
- package/dist/src/blocks/SaveAssetsBlock.ts.js +35 -0
- package/dist/src/blocks/ScrollBlock.ts.js +111 -0
- package/dist/src/blocks/SetValueFormBlock.ts.js +56 -0
- package/dist/src/blocks/WaitBlock.ts.js +24 -0
- package/dist/src/blocks/WaitForConditionBlock.ts.js +187 -0
- package/dist/src/blocks/index.ts.js +174 -0
- package/dist/src/blocks/types.ts.js +11 -0
- package/dist/src/content/components/ConfirmationUI.tsx.js +236 -0
- package/dist/src/content/elements/finders/CssSelector.ts.js +51 -0
- package/dist/src/content/elements/finders/ElementSelector.ts.js +20 -0
- package/dist/src/content/elements/finders/IframeSelector.ts.js +32 -0
- package/dist/src/content/elements/finders/ShadowDOMSelector.ts.js +38 -0
- package/dist/src/content/elements/finders/XPathFinder.ts.js +32 -0
- package/dist/src/content/elements/index.ts.js +26 -0
- package/dist/src/content/elements/utils/CSSSelectorGenerator.ts.js +72 -0
- package/dist/src/content/elements/utils/XPathGenerator.ts.js +62 -0
- package/dist/src/content/handler/ExternalMessageHandler.ts.js +78 -0
- package/dist/src/content/handler/InternalMessageHandler.ts.js +18 -0
- package/dist/src/content/kernel/MessageKernel.ts.js +83 -0
- package/dist/src/content/main.tsx-loader.js +22 -0
- package/dist/src/content/main.tsx.js +27 -0
- package/dist/src/content/utils/index.ts.js +1 -0
- package/dist/src/content/utils/synchronizedLock.ts.js +35 -0
- package/dist/src/popup/index.html +12 -0
- package/dist/src/types/internal-messages.ts.js +15 -0
- package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--9054997c.js +45 -0
- package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--e2a1f584.js +45 -0
- package/dist/vendor/.vite-deps-chunk-EL3BNLGW.js__v--e2a1f584.js +975 -0
- package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--9054997c.js +4158 -0
- package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--e2a1f584.js +4158 -0
- package/dist/vendor/.vite-deps-chunk-XHY3JSIG.js__v--e2a1f584.js +280 -0
- package/dist/vendor/.vite-deps-jsonata.js__v--d602c657.js +5761 -0
- package/dist/vendor/.vite-deps-jsonata.js__v--e2a1f584.js +5761 -0
- package/dist/vendor/.vite-deps-react-dom.js__v--e2a1f584.js +6 -0
- package/dist/vendor/.vite-deps-react-dom_client.js__v--e2a1f584.js +18108 -0
- package/dist/vendor/.vite-deps-react.js__v--e2a1f584.js +5 -0
- package/dist/vendor/.vite-deps-react_jsx-dev-runtime.js__v--e2a1f584.js +281 -0
- package/dist/vendor/.vite-deps-zod.js__v--9e0f4cc1.js +219 -0
- package/dist/vendor/.vite-deps-zod.js__v--e2a1f584.js +219 -0
- package/dist/vendor/crx-client-port.js +66 -0
- package/dist/vendor/crx-client-preamble.js +4 -0
- package/dist/vendor/react-refresh.js +670 -0
- package/dist/vendor/vite-client.js +1134 -0
- package/dist/vendor/vite-dist-client-env.mjs.js +24 -0
- package/dist/vendor/webcomponents-custom-elements.js +47 -0
- package/package.json +4 -4
|
Binary file
|
package/dist/logo.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "scordi-extension",
|
|
4
|
+
"version": "1.14.7",
|
|
5
|
+
"icons": {
|
|
6
|
+
"48": "public/logo.png"
|
|
7
|
+
},
|
|
8
|
+
"action": {
|
|
9
|
+
"default_icon": {
|
|
10
|
+
"48": "public/logo.png"
|
|
11
|
+
},
|
|
12
|
+
"default_popup": "src/popup/index.html"
|
|
13
|
+
},
|
|
14
|
+
"permissions": [
|
|
15
|
+
"contentSettings",
|
|
16
|
+
"tabs",
|
|
17
|
+
"storage",
|
|
18
|
+
"activeTab",
|
|
19
|
+
"scripting",
|
|
20
|
+
"webNavigation",
|
|
21
|
+
"debugger"
|
|
22
|
+
],
|
|
23
|
+
"host_permissions": [
|
|
24
|
+
"<all_urls>"
|
|
25
|
+
],
|
|
26
|
+
"content_scripts": [
|
|
27
|
+
{
|
|
28
|
+
"js": [
|
|
29
|
+
"src/content/main.tsx-loader.js"
|
|
30
|
+
],
|
|
31
|
+
"matches": [
|
|
32
|
+
"<all_urls>"
|
|
33
|
+
],
|
|
34
|
+
"run_at": "document_start",
|
|
35
|
+
"match_about_blank": true,
|
|
36
|
+
"all_frames": true
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"background": {
|
|
40
|
+
"service_worker": "service-worker-loader.js",
|
|
41
|
+
"type": "module"
|
|
42
|
+
},
|
|
43
|
+
"web_accessible_resources": [
|
|
44
|
+
{
|
|
45
|
+
"matches": [
|
|
46
|
+
"<all_urls>"
|
|
47
|
+
],
|
|
48
|
+
"resources": [
|
|
49
|
+
"**/*",
|
|
50
|
+
"*"
|
|
51
|
+
],
|
|
52
|
+
"use_dynamic_url": false
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Ce=Object.defineProperty;var Se=(s,e,t)=>e in s?Ce(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var _=(s,e,t)=>Se(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class A extends Error{constructor(e,t,r){super(e),this.code=t,this.details=r,this.name="EightGError"}static extensionNotInstalled(){return new A("8G Extension is not installed or not responding","EXTENSION_NOT_FOUND")}static invalidRequest(e){return new A(`Invalid request: ${e}`,"INVALID_REQUEST")}static collectionFailed(e){return new A(`Data collection failed: ${e}`,"COLLECTION_FAILED")}static requestTimeout(){return new A("Request timeout - Extension did not respond within 30 seconds","REQUEST_TIMEOUT")}}function Oe(s){return s&&s.type==="8G_EXTENSION_RESPONSE"}class Ne{constructor(){}async checkExtension(){return new Promise((e,t)=>{const r=setTimeout(()=>{t(A.extensionNotInstalled())},5e3),a=n=>{Oe(n.data)&&(clearTimeout(r),window.removeEventListener("message",a),e(n.data))};window.addEventListener("message",a),window.postMessage({type:"8G_EXTENSION_CHECK"},"*")})}async collectWorkflow(e){return new Promise((t,r)=>{const a=`8g_wf_${Date.now()}_${Math.random()}`,n=setTimeout(()=>{r(A.requestTimeout())},6e4),i=d=>{var f,h,y,O;if(((f=d.data)==null?void 0:f.type)==="8G_COLLECT_RESPONSE"&&d.data.requestId===a){clearTimeout(n),window.removeEventListener("message",i);const T=d.data,Te=((h=T==null?void 0:T.result)==null?void 0:h.steps)??((O=(y=T==null?void 0:T.result)==null?void 0:y.result)==null?void 0:O.steps)??[];t({success:T.success,steps:Te,error:T.success?void 0:"Workflow failed",timestamp:new Date().toISOString(),targetUrl:e.targetUrl})}};window.addEventListener("message",i),window.postMessage({type:"8G_COLLECT_WORKFLOW",requestId:a,targetUrl:e.targetUrl,workflow:e.workflow,closeTabAfterCollection:e.closeTabAfterCollection!==!1,activateTab:e.activateTab===!0},"*")})}}var x;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),i={};for(const d of n)i[d]=a[d];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(x||(x={}));var re;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(re||(re={}));const u=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},o=x.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 S extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let d=r,f=0;for(;f<i.path.length;){const h=i.path[f];f===i.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(t(i))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return a(this),r}static assert(e){if(!(e instanceof S))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=s=>new S(s);const X=(s,e)=>{let t;switch(s.code){case o.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case o.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,x.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(s.keys,", ")}`;break;case o.invalid_union:t="Invalid input";break;case o.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(s.options)}`;break;case o.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;break;case o.invalid_arguments:t="Invalid function arguments";break;case o.invalid_return_type:t="Invalid function return type";break;case o.invalid_date:t="Invalid date";break;case o.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:x.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case o.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case o.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case o.custom:t="Invalid input";break;case o.invalid_intersection_types:t="Intersection results could not be merged";break;case o.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case o.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(s)}return{message:t}};let Ae=X;function Re(){return Ae}const Ee=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let d="";const f=r.filter(h=>!!h).slice().reverse();for(const h of f)d=h(i,{data:e,defaultError:d}).message;return{...a,path:n,message:d}};function c(s,e){const t=Re(),r=Ee({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===X?void 0:X].filter(a=>!!a)});s.common.issues.push(r)}class b{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return b.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),D=s=>({status:"dirty",value:s}),w=s=>({status:"valid",value:s}),ae=s=>s.status==="aborted",ne=s=>s.status==="dirty",L=s=>s.status==="valid",W=s=>typeof Promise<"u"&&s instanceof Promise;var l;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class Z{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}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 ie=(s,e)=>{if(L(e))return{success:!0,data:e.value};if(!s.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 S(s.common.issues);return this._error=t,this._error}}};function g(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,d)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??d.defaultError}:typeof d.data>"u"?{message:f??r??d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:f??t??d.defaultError}},description:a}}class v{get description(){return this._def.description}_getType(e){return N(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(W(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={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:N(e)},a=this._parseSync({data:e,path:r.path,parent:r});return ie(r,a)}"~validate"(e){var r,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return L(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>L(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:N(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(W(a)?a:Promise.resolve(a));return ie(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),d=()=>n.addIssue({code:o.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new P({schema:this,typeName:p.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 E.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return J.create(this,this._def)}or(e){return q.create([this,e],this._def)}and(e){return G.create(this,e,this._def)}transform(e){return new P({...g(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new K({...g(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new et({typeName:p.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ee({...g(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return se.create(this,e)}readonly(){return te.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ze=/^c[^\s-]{8,}$/i,Ie=/^[0-9a-z]+$/,je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$e=/^[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,Le=/^[a-z0-9_-]{21}$/i,Me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ve=/^[-+]?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)?)??$/,Pe=/^(?!\.)(?!.*\.\.)([A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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])$/,Fe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ke="((\\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])))",Ge=new RegExp(`^${ke}$`);function be(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Je(s){return new RegExp(`^${be(s)}$`)}function He(s){let e=`${ke}T${be(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xe(s,e){return!!((e==="v4"||!e)&&De.test(s)||(e==="v6"||!e)&&Be.test(s))}function Ye(s,e){if(!Me.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Qe(s,e){return!!((e==="v4"||!e)&&Ue.test(s)||(e==="v6"||!e)&&We.test(s))}class R extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.string,received:n.parsedType}),m}const r=new b;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,d=e.data.length<n.value;(i||d)&&(a=this._getOrReturnCtx(e,a),i?c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):d&&c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"email",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")H||(H=new RegExp(ze,"u")),H.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"emoji",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")$e.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"uuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")Le.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"nanoid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid2",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")je.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ulid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),c(a,{validation:"url",code:o.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"regex",code:o.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?He(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?Ge.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Je(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?Ve.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"duration",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?Xe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ip",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Ye(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"jwt",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Qe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cidr",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?Fe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?qe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64url",code:o.invalid_string,message:n.message}),r.dirty()):x.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:o.invalid_string,...l.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.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,...l.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,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...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}}R.create=s=>new R({checks:[],typeName:p.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});function Ke(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class M extends v{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)!==u.number){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.number,received:n.parsedType}),m}let r;const a=new b;for(const n of this._def.checks)n.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Ke(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_finite,message:n.message}),a.dirty()):x.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,a){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(a)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.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"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}M.create=s=>new M({checks:[],typeName:p.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class U extends v{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)!==u.bigint)return this._getInvalidInput(e);let r;const a=new b;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):x.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,a){return new U({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(a)}]})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.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}}U.create=s=>new U({checks:[],typeName:p.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});class Y extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.boolean,received:r.parsedType}),m}return w(e.data)}}Y.create=s=>new Y({typeName:p.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class F extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_date}),m}const r=new b;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):x.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.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}}F.create=s=>new F({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:p.ZodDate,...g(s)});class de extends v{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.symbol,received:r.parsedType}),m}return w(e.data)}}de.create=s=>new de({typeName:p.ZodSymbol,...g(s)});class oe extends v{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.undefined,received:r.parsedType}),m}return w(e.data)}}oe.create=s=>new oe({typeName:p.ZodUndefined,...g(s)});class ce extends v{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.null,received:r.parsedType}),m}return w(e.data)}}ce.create=s=>new ce({typeName:p.ZodNull,...g(s)});class ue extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}}ue.create=s=>new ue({typeName:p.ZodAny,...g(s)});class le extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}}le.create=s=>new le({typeName:p.ZodUnknown,...g(s)});class I extends v{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:u.never,received:t.parsedType}),m}}I.create=s=>new I({typeName:p.ZodNever,...g(s)});class fe extends v{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.void,received:r.parsedType}),m}return w(e.data)}}fe.create=s=>new fe({typeName:p.ZodVoid,...g(s)});class C extends v{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return c(t,{code:o.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,d=t.data.length<a.exactLength.value;(i||d)&&(c(t,{code:i?o.too_big:o.too_small,minimum:d?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(c(t,{code:o.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(c(t,{code:o.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>a.type._parseAsync(new Z(t,i,t.path,d)))).then(i=>b.mergeArray(r,i));const n=[...t.data].map((i,d)=>a.type._parseSync(new Z(t,i,t.path,d)));return b.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(s,e)=>new C({type:s,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...g(e)});function $(s){if(s instanceof k){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=E.create($(r))}return new k({...s._def,shape:()=>e})}else return s instanceof C?new C({...s._def,type:$(s.element)}):s instanceof E?E.create($(s.unwrap())):s instanceof z?z.create($(s.unwrap())):s instanceof j?j.create(s.items.map(e=>$(e))):s}class k extends v{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=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const h=this._getOrReturnCtx(e);return c(h,{code:o.invalid_type,expected:u.object,received:h.parsedType}),m}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(const h in a.data)i.includes(h)||d.push(h);const f=[];for(const h of i){const y=n[h],O=a.data[h];f.push({key:{status:"valid",value:h},value:y._parse(new Z(a,O,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof I){const h=this._def.unknownKeys;if(h==="passthrough")for(const y of d)f.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(h==="strict")d.length>0&&(c(a,{code:o.unrecognized_keys,keys:d}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const y of d){const O=a.data[y];f.push({key:{status:"valid",value:y},value:h._parse(new Z(a,O,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const y of f){const O=await y.key,T=await y.value;h.push({key:O,value:T,alwaysSet:y.alwaysSet})}return h}).then(h=>b.mergeObjectSync(r,h)):b.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};for(const r of x.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new k({...this._def,shape:()=>t})}omit(e){const t={};for(const r of x.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new k({...this._def,shape:()=>t})}deepPartial(){return $(this)}partial(e){const t={};for(const r of x.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new k({...this._def,shape:()=>t})}required(e){const t={};for(const r of x.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof E;)n=n._def.innerType;t[r]=n}return new k({...this._def,shape:()=>t})}keyof(){return we(x.objectKeys(this.shape))}}k.create=(s,e)=>new k({shape:()=>s,unknownKeys:"strip",catchall:I.create(),typeName:p.ZodObject,...g(e)});k.strictCreate=(s,e)=>new k({shape:()=>s,unknownKeys:"strict",catchall:I.create(),typeName:p.ZodObject,...g(e)});k.lazycreate=(s,e)=>new k({shape:s,unknownKeys:"strip",catchall:I.create(),typeName:p.ZodObject,...g(e)});class q extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const d of n)if(d.result.status==="valid")return d.result;for(const d of n)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const i=n.map(d=>new S(d.ctx.common.issues));return c(t,{code:o.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const f of r){const h={...t,common:{...t.common,issues:[]},parent:null},y=f._parseSync({data:t.data,path:t.path,parent:h});if(y.status==="valid")return y;y.status==="dirty"&&!n&&(n={result:y,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const d=i.map(f=>new S(f));return c(t,{code:o.invalid_union,unionErrors:d}),m}}get options(){return this._def.options}}q.create=(s,e)=>new q({options:s,typeName:p.ZodUnion,...g(e)});function Q(s,e){const t=N(s),r=N(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const a=x.objectKeys(e),n=x.objectKeys(s).filter(d=>a.indexOf(d)!==-1),i={...s,...e};for(const d of n){const f=Q(s[d],e[d]);if(!f.valid)return{valid:!1};i[d]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<s.length;n++){const i=s[n],d=e[n],f=Q(i,d);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return t===u.date&&r===u.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class G extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(n,i)=>{if(ae(n)||ae(i))return m;const d=Q(n.value,i.value);return d.valid?((ne(n)||ne(i))&&t.dirty(),{status:t.value,value:d.data}):(c(r,{code:o.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}G.create=(s,e,t)=>new G({left:s,right:e,typeName:p.ZodIntersection,...g(t)});class j extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:o.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return c(r,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(c(r,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,d)=>{const f=this._def.items[d]||this._def.rest;return f?f._parse(new Z(r,i,r.path,d)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>b.mergeArray(t,i)):b.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new j({...this._def,rest:e})}}j.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:s,typeName:p.ZodTuple,rest:null,...g(e)})};class he extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:o.invalid_type,expected:u.map,received:r.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([d,f],h)=>({key:a._parse(new Z(r,d,r.path,[h,"key"])),value:n._parse(new Z(r,f,r.path,[h,"value"]))}));if(r.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of i){const h=await f.key,y=await f.value;if(h.status==="aborted"||y.status==="aborted")return m;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),d.set(h.value,y.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const f of i){const h=f.key,y=f.value;if(h.status==="aborted"||y.status==="aborted")return m;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),d.set(h.value,y.value)}return{status:t.value,value:d}}}}he.create=(s,e,t)=>new he({valueType:e,keyType:s,typeName:p.ZodMap,...g(t)});class B extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:o.invalid_type,expected:u.set,received:r.parsedType}),m;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(c(r,{code:o.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(c(r,{code:o.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(f){const h=new Set;for(const y of f){if(y.status==="aborted")return m;y.status==="dirty"&&t.dirty(),h.add(y.value)}return{status:t.value,value:h}}const d=[...r.data.values()].map((f,h)=>n._parse(new Z(r,f,r.path,h)));return r.common.async?Promise.all(d).then(f=>i(f)):i(d)}min(e,t){return new B({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new B({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}B.create=(s,e)=>new B({valueType:s,minSize:null,maxSize:null,typeName:p.ZodSet,...g(e)});class me extends v{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})}}me.create=(s,e)=>new me({getter:s,typeName:p.ZodLazy,...g(e)});class pe extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}pe.create=(s,e)=>new pe({value:s,typeName:p.ZodLiteral,...g(e)});function we(s,e){return new V({values:s,typeName:p.ZodEnum,...g(e)})}class V extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:x.joinValues(r),received:t.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:o.invalid_enum_value,options:r}),m}return w(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 V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=we;class _e extends v{_parse(e){const t=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const a=x.objectValues(t);return c(r,{expected:x.joinValues(a),received:r.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=x.objectValues(t);return c(r,{received:r.data,code:o.invalid_enum_value,options:a}),m}return w(e.data)}get enum(){return this._def.values}}_e.create=(s,e)=>new _e({values:s,typeName:p.ZodNativeEnum,...g(e)});class J extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:o.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return w(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}J.create=(s,e)=>new J({type:s,typeName:p.ZodPromise,...g(e)});class P extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:d,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?D(f.value):f});{if(t.value==="aborted")return m;const d=this._def.schema._parseSync({data:i,path:r.path,parent:r});return d.status==="aborted"?m:d.status==="dirty"||t.value==="dirty"?D(d.value):d}}if(a.type==="refinement"){const i=d=>{const f=a.refinement(d,n);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(r.common.async===!1){const d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!L(i))return m;const d=a.transform(i.value,n);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>L(i)?Promise.resolve(a.transform(i.value,n)).then(d=>({status:t.value,value:d})):m);x.assertNever(a)}}P.create=(s,e,t)=>new P({schema:s,typeName:p.ZodEffects,effect:e,...g(t)});P.createWithPreprocess=(s,e,t)=>new P({schema:e,effect:{type:"preprocess",transform:s},typeName:p.ZodEffects,...g(t)});class E extends v{_parse(e){return this._getType(e)===u.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(s,e)=>new E({innerType:s,typeName:p.ZodOptional,...g(e)});class z extends v{_parse(e){return this._getType(e)===u.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(s,e)=>new z({innerType:s,typeName:p.ZodNullable,...g(e)});class K extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}K.create=(s,e)=>new K({innerType:s,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ee extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return W(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new S(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ee.create=(s,e)=>new ee({innerType:s,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class ge extends v{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}ge.create=s=>new ge({typeName:p.ZodNaN,...g(s)});class et extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class se extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),D(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new se({in:e,out:t,typeName:p.ZodPipeline})}}class te extends v{_parse(e){const t=this._def.innerType._parse(e),r=a=>(L(a)&&(a.value=Object.freeze(a.value)),a);return W(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}te.create=(s,e)=>new te({innerType:s,typeName:p.ZodReadonly,...g(e)});var p;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(p||(p={}));const ye=R.create,tt=M.create,ve=Y.create;I.create;C.create;const xe=k.create;q.create;G.create;j.create;const st=V.create;J.create;E.create;z.create;const rt=xe({name:ye(),selector:ye(),findBy:st(["cssSelector","xpath"]),option:xe({waitForSelector:ve().optional(),waitSelectorTimeout:tt().optional(),multiple:ve().optional()})});class at{constructor(){_(this,"expr");_(this,"json")}}class nt{constructor(){_(this,"template");_(this,"valueFrom");_(this,"default")}}class it{constructor(){_(this,"id");_(this,"title");_(this,"when");_(this,"block");_(this,"repeat");_(this,"next");_(this,"onSuccess");_(this,"onFailure");_(this,"switch");_(this,"timeoutMs");_(this,"retry");_(this,"delayAfterMs")}}class dt{constructor(){_(this,"version");_(this,"id");_(this,"title");_(this,"description");_(this,"start");_(this,"steps");_(this,"vars");_(this,"defaultDelayMs")}}class ot{constructor(){_(this,"stepId");_(this,"skipped");_(this,"success");_(this,"message");_(this,"result");_(this,"startedAt");_(this,"finishedAt");_(this,"attempts")}}class ct{constructor(){_(this,"success");_(this,"steps");_(this,"targetUrl");_(this,"timestamp");_(this,"error")}}exports.BaseBlockSchema=rt;exports.Binding=nt;exports.CollectWorkflowResult=ct;exports.Condition=at;exports.EightGClient=Ne;exports.EightGError=A;exports.Workflow=dt;exports.WorkflowStep=it;exports.WorkflowStepRunResult=ot;
|
package/dist/sdk/index.js
CHANGED
|
@@ -2709,7 +2709,7 @@ class dt {
|
|
|
2709
2709
|
_(this, "block");
|
|
2710
2710
|
// BlockBase 호환. 바인딩은 런타임에서 해석
|
|
2711
2711
|
_(this, "repeat");
|
|
2712
|
-
// 반복 설정 (forEach 또는 count)`
|
|
2712
|
+
// 반복 설정 (forEach 또는 count)`
|
|
2713
2713
|
_(this, "next");
|
|
2714
2714
|
_(this, "onSuccess");
|
|
2715
2715
|
_(this, "onFailure");
|
|
@@ -2717,7 +2717,6 @@ class dt {
|
|
|
2717
2717
|
_(this, "timeoutMs");
|
|
2718
2718
|
_(this, "retry");
|
|
2719
2719
|
_(this, "delayAfterMs");
|
|
2720
|
-
_(this, "setVars");
|
|
2721
2720
|
}
|
|
2722
2721
|
}
|
|
2723
2722
|
class ot {
|
|
@@ -2728,6 +2727,8 @@ class ot {
|
|
|
2728
2727
|
_(this, "description");
|
|
2729
2728
|
_(this, "start");
|
|
2730
2729
|
_(this, "steps");
|
|
2730
|
+
_(this, "vars");
|
|
2731
|
+
// 워크플로우 초기 변수
|
|
2731
2732
|
_(this, "defaultDelayMs");
|
|
2732
2733
|
}
|
|
2733
2734
|
}
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -72,7 +72,6 @@ export declare class WorkflowStep {
|
|
|
72
72
|
backoffFactor?: number;
|
|
73
73
|
};
|
|
74
74
|
delayAfterMs?: number;
|
|
75
|
-
setVars?: Record<string, Binding | BindingValue>;
|
|
76
75
|
}
|
|
77
76
|
export declare class Workflow {
|
|
78
77
|
version: '1.0';
|
|
@@ -81,6 +80,7 @@ export declare class Workflow {
|
|
|
81
80
|
description?: string;
|
|
82
81
|
start: string;
|
|
83
82
|
steps: WorkflowStep[];
|
|
83
|
+
vars?: Record<string, any>;
|
|
84
84
|
defaultDelayMs?: number;
|
|
85
85
|
}
|
|
86
86
|
export type CollectWorkflowRequest = {
|
package/dist/sdk/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sdk/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAM/B,MAAM,MAAM,gBAAgB,GAAG,MAAM,CA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AAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,SAAS,EAAG,MAAM,CAAC;IACnB,UAAU,EAAG,MAAM,CAAC;IACpB,QAAQ,EAAG,MAAM,CAAC;CACnB;AAED,qBAAa,qBAAqB,CAAC,CAAC,GAAG,GAAG;IACxC,OAAO,EAAG,OAAO,CAAC;IAClB,KAAK,EAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,SAAS,EAAG,MAAM,CAAC;IACnB,SAAS,EAAG,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
|
|
2
|
+
const ObjectSchemaDefinitionSchema = z.object({
|
|
3
|
+
type: z.literal("object"),
|
|
4
|
+
shape: z.record(z.string(), z.any())
|
|
5
|
+
});
|
|
6
|
+
const ArraySchemaDefinitionSchema = z.object({
|
|
7
|
+
type: z.literal("array"),
|
|
8
|
+
items: z.any()
|
|
9
|
+
});
|
|
10
|
+
const SchemaDefinitionSchema = z.discriminatedUnion("type", [
|
|
11
|
+
ObjectSchemaDefinitionSchema,
|
|
12
|
+
ArraySchemaDefinitionSchema
|
|
13
|
+
]);
|
|
14
|
+
export const AiParseDataBlockSchema = z.object({
|
|
15
|
+
name: z.literal("ai-parse-data"),
|
|
16
|
+
sourceData: z.any().optional(),
|
|
17
|
+
schemaDefinition: SchemaDefinitionSchema,
|
|
18
|
+
prompt: z.string().optional(),
|
|
19
|
+
model: z.string().optional(),
|
|
20
|
+
apiKey: z.string().min(1, "OpenAI API key is required")
|
|
21
|
+
// 필수
|
|
22
|
+
});
|
|
23
|
+
export function validateAiParseDataBlock(data) {
|
|
24
|
+
return AiParseDataBlockSchema.parse(data);
|
|
25
|
+
}
|
|
26
|
+
export async function handlerAiParseData(data) {
|
|
27
|
+
try {
|
|
28
|
+
const {
|
|
29
|
+
sourceData,
|
|
30
|
+
schemaDefinition,
|
|
31
|
+
prompt,
|
|
32
|
+
model = "gpt-4o-mini",
|
|
33
|
+
apiKey
|
|
34
|
+
} = data;
|
|
35
|
+
if (sourceData === void 0 || sourceData === null) {
|
|
36
|
+
throw new Error("sourceData is required for ai-parse-data block");
|
|
37
|
+
}
|
|
38
|
+
if (!apiKey || apiKey.trim() === "") {
|
|
39
|
+
throw new Error("apiKey is required for ai-parse-data block");
|
|
40
|
+
}
|
|
41
|
+
const response = await chrome.runtime.sendMessage({
|
|
42
|
+
type: "AI_PARSE_DATA",
|
|
43
|
+
data: {
|
|
44
|
+
sourceData,
|
|
45
|
+
schemaDefinition,
|
|
46
|
+
prompt,
|
|
47
|
+
model,
|
|
48
|
+
apiKey
|
|
49
|
+
// API 키 포함
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (response.$isError) {
|
|
53
|
+
throw new Error(response.message || "AI parsing failed");
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
data: response.data
|
|
57
|
+
};
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
hasError: true,
|
|
61
|
+
message: error instanceof Error ? error.message : "Unknown error in ai-parse-data handler",
|
|
62
|
+
data: null
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function createSchema(shape) {
|
|
67
|
+
return {
|
|
68
|
+
type: "object",
|
|
69
|
+
shape
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function createArraySchema(items) {
|
|
73
|
+
return {
|
|
74
|
+
type: "array",
|
|
75
|
+
items
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export const Schema = {
|
|
79
|
+
string: (options) => ({
|
|
80
|
+
type: "string",
|
|
81
|
+
...options
|
|
82
|
+
}),
|
|
83
|
+
number: (options) => ({
|
|
84
|
+
type: "number",
|
|
85
|
+
...options
|
|
86
|
+
}),
|
|
87
|
+
boolean: (options) => ({
|
|
88
|
+
type: "boolean",
|
|
89
|
+
...options
|
|
90
|
+
}),
|
|
91
|
+
array: (items, options) => ({
|
|
92
|
+
type: "array",
|
|
93
|
+
items,
|
|
94
|
+
...options
|
|
95
|
+
}),
|
|
96
|
+
object: (shape, options) => ({
|
|
97
|
+
type: "object",
|
|
98
|
+
shape,
|
|
99
|
+
...options
|
|
100
|
+
})
|
|
101
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { findElement } from "/src/content/elements/index.ts.js";
|
|
2
|
+
import { BaseBlockSchema } from "/src/blocks/types.ts.js";
|
|
3
|
+
import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
|
|
4
|
+
export const ClearValueFormsBlockSchema = BaseBlockSchema.extend({
|
|
5
|
+
name: z.literal("clear-value-form"),
|
|
6
|
+
type: z.enum(["text-field", "select", "checkbox"]).optional()
|
|
7
|
+
});
|
|
8
|
+
export function validateClearValueFormsBlock(data) {
|
|
9
|
+
return ClearValueFormsBlockSchema.parse(data);
|
|
10
|
+
}
|
|
11
|
+
export async function handlerClearValueForm(data) {
|
|
12
|
+
try {
|
|
13
|
+
const { selector = "", type = "text-field", findBy = "cssSelector" } = data;
|
|
14
|
+
if (!selector) {
|
|
15
|
+
throw new Error("Selector is required for clear-value-form block");
|
|
16
|
+
}
|
|
17
|
+
const element = await findElement({ selector, findBy, option: data.option });
|
|
18
|
+
if (!element) {
|
|
19
|
+
throw new Error("Form element not found");
|
|
20
|
+
}
|
|
21
|
+
clearFormValue(element, type);
|
|
22
|
+
return { data: "Form element cleared successfully" };
|
|
23
|
+
} catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
hasError: true,
|
|
26
|
+
message: error instanceof Error ? error.message : "Unknown error in clear-value-form handler",
|
|
27
|
+
data: null
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function clearFormValue(element, type) {
|
|
32
|
+
switch (type) {
|
|
33
|
+
case "text-field":
|
|
34
|
+
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
|
|
35
|
+
element.value = "";
|
|
36
|
+
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
37
|
+
element.dispatchEvent(new Event("change", { bubbles: true }));
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case "select":
|
|
41
|
+
if (element instanceof HTMLSelectElement) {
|
|
42
|
+
element.selectedIndex = 0;
|
|
43
|
+
element.dispatchEvent(new Event("change", { bubbles: true }));
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case "checkbox":
|
|
47
|
+
if (element instanceof HTMLInputElement && element.type === "checkbox") {
|
|
48
|
+
element.checked = false;
|
|
49
|
+
element.dispatchEvent(new Event("change", { bubbles: true }));
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(`Unsupported form element type: ${type}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
|
|
2
|
+
import __vite__cjsImport1_jsonata from "/vendor/.vite-deps-jsonata.js__v--e2a1f584.js"; const jsonata = __vite__cjsImport1_jsonata.__esModule ? __vite__cjsImport1_jsonata.default : __vite__cjsImport1_jsonata;
|
|
3
|
+
export const DataExtractBlockSchema = z.object({
|
|
4
|
+
name: z.literal("data-extract"),
|
|
5
|
+
code: z.string(),
|
|
6
|
+
inputData: z.any().optional()
|
|
7
|
+
});
|
|
8
|
+
export function validateDataExtractBlock(data) {
|
|
9
|
+
return DataExtractBlockSchema.parse(data);
|
|
10
|
+
}
|
|
11
|
+
export async function handlerDataExtract(data) {
|
|
12
|
+
try {
|
|
13
|
+
console.log("[DataExtractBlock] Executing JSONata query:", data.code);
|
|
14
|
+
const expression = jsonata(data.code);
|
|
15
|
+
const result = await expression.evaluate(data.inputData);
|
|
16
|
+
console.log("[DataExtractBlock] Data extraction successful");
|
|
17
|
+
return {
|
|
18
|
+
data: result
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("[DataExtractBlock] Data extraction error:", error);
|
|
22
|
+
return {
|
|
23
|
+
hasError: true,
|
|
24
|
+
message: error instanceof Error ? error.message : "Unknown error in data extraction",
|
|
25
|
+
data: void 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { findElement } from "/src/content/elements/index.ts.js";
|
|
2
|
+
import { BaseBlockSchema } from "/src/blocks/types.ts.js";
|
|
3
|
+
import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
|
|
4
|
+
export const ElementExistsBlockSchema = BaseBlockSchema.extend({
|
|
5
|
+
name: z.literal("element-exists")
|
|
6
|
+
});
|
|
7
|
+
export function validateElementExistsBlock(data) {
|
|
8
|
+
return ElementExistsBlockSchema.parse(data);
|
|
9
|
+
}
|
|
10
|
+
export async function handlerElementExists(data) {
|
|
11
|
+
try {
|
|
12
|
+
const { selector = "", findBy = "cssSelector", option } = data;
|
|
13
|
+
if (!selector) {
|
|
14
|
+
throw new Error("Selector is required for element-exists block");
|
|
15
|
+
}
|
|
16
|
+
const element = await findElement({ selector, findBy, option });
|
|
17
|
+
const exists = element !== null;
|
|
18
|
+
return { data: exists };
|
|
19
|
+
} catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
hasError: true,
|
|
22
|
+
message: error instanceof Error ? error.message : "Unknown error in element-exists handler",
|
|
23
|
+
data: null
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
|
|
2
|
+
import { BaseBlockSchema } from "/src/blocks/types.ts.js";
|
|
3
|
+
import { findElement } from "/src/content/elements/index.ts.js";
|
|
4
|
+
export const EventClickBlockSchema = BaseBlockSchema.extend({
|
|
5
|
+
name: z.literal("event-click"),
|
|
6
|
+
textFilter: z.object({
|
|
7
|
+
text: z.union([z.string(), z.array(z.string())]),
|
|
8
|
+
mode: z.enum(["exact", "contains", "startsWith", "endsWith", "regex"])
|
|
9
|
+
}).optional()
|
|
10
|
+
});
|
|
11
|
+
export function validateEventClickBlock(data) {
|
|
12
|
+
return EventClickBlockSchema.parse(data);
|
|
13
|
+
}
|
|
14
|
+
export async function handlerEventClick(data) {
|
|
15
|
+
try {
|
|
16
|
+
const { selector = "", findBy = "cssSelector", option, textFilter } = data;
|
|
17
|
+
if (!selector) {
|
|
18
|
+
throw new Error("Selector is required for event-click block");
|
|
19
|
+
}
|
|
20
|
+
const elements = await findElement({ selector, findBy, option });
|
|
21
|
+
if (!elements) {
|
|
22
|
+
throw new Error("Element not found for clicking");
|
|
23
|
+
}
|
|
24
|
+
let targetElement;
|
|
25
|
+
if (Array.isArray(elements)) {
|
|
26
|
+
if (textFilter) {
|
|
27
|
+
const filteredElement = selectElementByText(elements, textFilter.text, textFilter.mode);
|
|
28
|
+
if (!filteredElement) {
|
|
29
|
+
const textDisplay = Array.isArray(textFilter.text) ? textFilter.text.join(", ") : textFilter.text;
|
|
30
|
+
throw new Error(`No element found with text filter: "${textDisplay}" (mode: ${textFilter.mode})`);
|
|
31
|
+
}
|
|
32
|
+
targetElement = filteredElement;
|
|
33
|
+
} else {
|
|
34
|
+
targetElement = elements[0];
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
targetElement = elements;
|
|
38
|
+
}
|
|
39
|
+
await simulateClickElement(targetElement);
|
|
40
|
+
return { data: true };
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log(error);
|
|
43
|
+
return {
|
|
44
|
+
hasError: true,
|
|
45
|
+
message: error instanceof Error ? error.message : "Unknown error in event-click handler",
|
|
46
|
+
data: false
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function selectElementByText(elements, textFilter, mode) {
|
|
51
|
+
for (const element of elements) {
|
|
52
|
+
const text = getElementText(element);
|
|
53
|
+
const textsToCheck = Array.isArray(textFilter) ? textFilter : [textFilter];
|
|
54
|
+
for (const filterText of textsToCheck) {
|
|
55
|
+
let matches = false;
|
|
56
|
+
switch (mode) {
|
|
57
|
+
case "exact":
|
|
58
|
+
matches = text === filterText;
|
|
59
|
+
break;
|
|
60
|
+
case "contains":
|
|
61
|
+
matches = text.includes(filterText);
|
|
62
|
+
break;
|
|
63
|
+
case "startsWith":
|
|
64
|
+
matches = text.startsWith(filterText);
|
|
65
|
+
break;
|
|
66
|
+
case "endsWith":
|
|
67
|
+
matches = text.endsWith(filterText);
|
|
68
|
+
break;
|
|
69
|
+
case "regex":
|
|
70
|
+
try {
|
|
71
|
+
const regex = new RegExp(filterText);
|
|
72
|
+
matches = regex.test(text);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.warn("Invalid regex pattern:", filterText);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (matches) {
|
|
80
|
+
return element;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function getElementText(element) {
|
|
87
|
+
if (element.innerText) {
|
|
88
|
+
return element.innerText.trim();
|
|
89
|
+
}
|
|
90
|
+
if (element.textContent) {
|
|
91
|
+
return element.textContent.trim();
|
|
92
|
+
}
|
|
93
|
+
if (element instanceof HTMLInputElement && element.value) {
|
|
94
|
+
return element.value.trim();
|
|
95
|
+
}
|
|
96
|
+
const placeholder = element.getAttribute("placeholder");
|
|
97
|
+
if (placeholder) {
|
|
98
|
+
return placeholder.trim();
|
|
99
|
+
}
|
|
100
|
+
const title = element.getAttribute("title");
|
|
101
|
+
if (title) {
|
|
102
|
+
return title.trim();
|
|
103
|
+
}
|
|
104
|
+
const ariaLabel = element.getAttribute("aria-label");
|
|
105
|
+
if (ariaLabel) {
|
|
106
|
+
return ariaLabel.trim();
|
|
107
|
+
}
|
|
108
|
+
return "";
|
|
109
|
+
}
|
|
110
|
+
async function simulateClickElement(element) {
|
|
111
|
+
element.scrollIntoView({
|
|
112
|
+
behavior: "instant",
|
|
113
|
+
block: "center",
|
|
114
|
+
inline: "center"
|
|
115
|
+
});
|
|
116
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
117
|
+
if (element.focus) {
|
|
118
|
+
element.focus();
|
|
119
|
+
}
|
|
120
|
+
const rect = element.getBoundingClientRect();
|
|
121
|
+
const centerX = rect.left + rect.width / 2;
|
|
122
|
+
const centerY = rect.top + rect.height / 2;
|
|
123
|
+
try {
|
|
124
|
+
const response = await chrome.runtime.sendMessage({
|
|
125
|
+
type: "CDP_CLICK",
|
|
126
|
+
data: {
|
|
127
|
+
x: centerX,
|
|
128
|
+
y: centerY
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (response && !response.$isError) {
|
|
132
|
+
console.log("[EventClick] CDP click successful:", response);
|
|
133
|
+
} else {
|
|
134
|
+
throw new Error(response?.message || "CDP click failed");
|
|
135
|
+
}
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error("[EventClick] CDP click failed, falling back to native click:", error);
|
|
138
|
+
if (element.click) {
|
|
139
|
+
element.click();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
143
|
+
}
|