@xpert-ai/plugin-live-dashboard 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.xpertai-plugin/plugin.json +1 -1
- package/README.md +5 -5
- package/dist/lib/agent.schema.d.ts +11 -11
- package/dist/lib/agent.schema.js +3 -3
- package/dist/lib/analytics-source.d.ts +3 -0
- package/dist/lib/analytics-source.js +11 -0
- package/dist/lib/content-capability.d.ts +22 -0
- package/dist/lib/content-capability.js +33 -0
- package/dist/lib/content.provider.d.ts +23 -0
- package/dist/lib/content.provider.js +163 -0
- package/dist/lib/dashboard-icon.d.ts +2 -1
- package/dist/lib/dashboard-icon.js +10 -2
- package/dist/lib/dashboard-navigation.d.ts +24 -0
- package/dist/lib/dashboard-navigation.js +1 -1
- package/dist/lib/dashboard-queries.d.ts +11 -0
- package/dist/lib/dashboard-queries.js +20 -0
- package/dist/lib/dashboard-search.d.ts +5 -0
- package/dist/lib/dashboard-search.js +12 -0
- package/dist/lib/dashboard-sharing.js +2 -1
- package/dist/lib/dashboard-view.schema.d.ts +1249 -0
- package/dist/lib/dashboard-view.schema.js +19 -0
- package/dist/lib/dashboard.schema.d.ts +12 -12
- package/dist/lib/dashboard.schema.js +5 -3
- package/dist/lib/dashboard.service.d.ts +11 -3
- package/dist/lib/dashboard.service.js +55 -21
- package/dist/lib/definition-tools.d.ts +56 -0
- package/dist/lib/definition-tools.js +42 -0
- package/dist/lib/document-host.d.ts +4 -0
- package/dist/lib/document-host.js +13 -0
- package/dist/lib/document-network.d.ts +3 -0
- package/dist/lib/document-network.js +9 -0
- package/dist/lib/document-package.d.ts +1 -1
- package/dist/lib/document-package.js +2 -2
- package/dist/lib/html-guidance.d.ts +1 -1
- package/dist/lib/html-guidance.js +1 -1
- package/dist/lib/middleware.js +54 -18
- package/dist/lib/plugin.js +3 -1
- package/dist/lib/presentation.provider.d.ts +6 -1
- package/dist/lib/presentation.provider.js +2 -2
- package/dist/lib/preview-retry.d.ts +7 -0
- package/dist/lib/preview-retry.js +52 -0
- package/dist/lib/renderer.js +5 -0
- package/dist/lib/resource-card.js +1 -1
- package/dist/lib/save-evidence.d.ts +1 -1
- package/dist/lib/sharing.service.js +2 -0
- package/dist/lib/view.provider.d.ts +7 -2
- package/dist/lib/view.provider.js +5 -4
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +36 -36
- package/dist/remote/build-manifest.json +42 -30
- package/dist/sandbox-actions/action.json +1 -1
- package/dist/sandbox-actions/bundle/host.js +2 -2
- package/dist/sandbox-actions/bundle/validate.mjs +24 -3
- package/dist/validation/host-entry.d.ts +3 -1
- package/dist/validation/host-entry.js +5 -2
- package/docs/drafts.mdx +1 -1
- package/docs/frontend-libraries.mdx +3 -3
- package/docs/html-mode.md +5 -5
- package/docs/index.mdx +14 -0
- package/docs/team-sharing.mdx +1 -1
- package/docs/verification.mdx +3 -1
- package/examples/data-xpert-sales.json +6 -3
- package/examples/postgres-sales.json +5 -3
- package/package.json +6 -6
- package/skills/live-dashboard/SKILL.md +1 -1
- package/skills/live-dashboard/references/data-validation.md +4 -0
- package/skills/live-dashboard/references/html-runtime.md +1 -1
|
@@ -1,56 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sources": {
|
|
3
|
-
".xpertai-plugin/plugin.json": "
|
|
4
|
-
"package.json": "
|
|
3
|
+
".xpertai-plugin/plugin.json": "8b4dae57dad788202e1df7d3201b0fed111f2a3546859cce5f1a9fbcc77caf56",
|
|
4
|
+
"package.json": "0ff6c6f2749692dd7cfaf449987a741ccd2fea2c481b194beeaeb942781df570",
|
|
5
5
|
"scripts/build-action.mjs": "283f26ef3c1c2ddf7f3f2bfc7a7780229b4d7061f1e3f1b0f222d012b78583de",
|
|
6
6
|
"scripts/build-libraries.mjs": "20bd34ca3f8bb6e87df2637a3cca85496962688c8ea4ceff5bc294ebd2de704d",
|
|
7
7
|
"scripts/build-remote.mjs": "492550ac5c95eb371253d863567723d8853522013a0bcdfa0e264720206fda16",
|
|
8
8
|
"scripts/dist-manifest.mjs": "8dcca9f1e74c520171649e848f9b5570ca9cc83fb5e8d2f265be3d2e5ceb970c",
|
|
9
9
|
"scripts/renderer-asset.mjs": "e7edf2fb41f2384e838c27c2e5566f5d479135ad365ae2a99fb421433464d82a",
|
|
10
10
|
"scripts/verify-dist.mjs": "523d0fe9703a0f3d12099173d115b5145d5665b06551cfab2869a2db76d880e2",
|
|
11
|
-
"skills/live-dashboard/SKILL.md": "
|
|
11
|
+
"skills/live-dashboard/SKILL.md": "1825876a74391c2c514548b7a1b37e123d044952f9c882498dd5225950f169d0",
|
|
12
12
|
"skills/live-dashboard/agents/xpertai.yaml": "307eca084cbcaf0c250cca1bba7438e794ff4e9b039a920ad9763acfca236f82",
|
|
13
|
-
"skills/live-dashboard/references/data-validation.md": "
|
|
13
|
+
"skills/live-dashboard/references/data-validation.md": "4455240470b3456fcd7db8f0f58b040d1dceb548010414542dd5cc86f3abfe63",
|
|
14
14
|
"skills/live-dashboard/references/html-lifecycle.md": "4bf88730709ab45166425e1917610d1e618c9a0883e615ce76c0fe55488ffd51",
|
|
15
|
-
"skills/live-dashboard/references/html-runtime.md": "
|
|
15
|
+
"skills/live-dashboard/references/html-runtime.md": "5be3dc50e618b30e83ef59c2d684ceed5a3e37d63a550bdf157b0d8953af5d38",
|
|
16
16
|
"src/index.ts": "6aab2d46788fe6de8ed2671b2d1de4f0b1e4d1f2287fd3ec8b14a1610ebf0426",
|
|
17
|
-
"src/lib/agent.schema.ts": "
|
|
18
|
-
"src/lib/
|
|
19
|
-
"src/lib/
|
|
20
|
-
"src/lib/
|
|
17
|
+
"src/lib/agent.schema.ts": "1444585eab3618b985b774937309d950df99de1a1804e4caecdff8026de70297",
|
|
18
|
+
"src/lib/analytics-source.ts": "6fb5fd394fffa5a0c12f1fe32d0c9d7dbd8597052047b6122fc5b160fa7af54f",
|
|
19
|
+
"src/lib/content-capability.ts": "fa1252a539a681be9780d318b2b3710da273c4405c8e21d58ac675294cef3836",
|
|
20
|
+
"src/lib/content.provider.ts": "3cfbccec1483269c150ba3dade7aa812ee59c998c30d89a57835977027c7e622",
|
|
21
|
+
"src/lib/dashboard-icon.ts": "3f95a626e91d3ce198cdef6b05365591b6e65af4f58d6f5765ec0836a590a494",
|
|
22
|
+
"src/lib/dashboard-navigation.ts": "e014a688e916625cd89a6239f4f97ac4211e8750934c05fc1ea5ea39e4a53fb3",
|
|
23
|
+
"src/lib/dashboard-queries.ts": "85c945c0862af353b366bdbfeaafb94aa4185d35cce0f51ec39dd8c60b4fc598",
|
|
21
24
|
"src/lib/dashboard-receipt.ts": "d02b7e4e1be0a075b7f27e887ebb555684f17036ebb9442982e6725ab37a53ab",
|
|
22
|
-
"src/lib/dashboard-
|
|
23
|
-
"src/lib/dashboard.
|
|
24
|
-
"src/lib/dashboard.
|
|
25
|
+
"src/lib/dashboard-search.ts": "0cd14c0004fb078b54c095faeab3195fb7e03a20c3400b5e67aec7cb4b2442e2",
|
|
26
|
+
"src/lib/dashboard-sharing.ts": "61199f135cc53b6b9f0bef0f75f14c4d40bff6a3986e62e2823ab80c564534d3",
|
|
27
|
+
"src/lib/dashboard-view.schema.ts": "11562ce17c573611eedd5ab5d0db378c6ae676955c1b3f8606d3e60b367ed05e",
|
|
28
|
+
"src/lib/dashboard.schema.ts": "982e15591e70102ea506951cd10de9ec4864281157b0b95a7b591a8fff3da813",
|
|
29
|
+
"src/lib/dashboard.service.ts": "2a404e66ec95877ab37b55ce05dd024049c9d556e52a1a780bedcc45c425ac31",
|
|
30
|
+
"src/lib/definition-tools.ts": "ba48842396e57499331a52ca7cf5e4e1eb72e1e519b5dabfff2743fddf15947d",
|
|
31
|
+
"src/lib/document-host.ts": "3543ddb443006b90cd4689b65446b0e3b3305362d3d24d93209c094967921ffe",
|
|
25
32
|
"src/lib/document-libraries.ts": "9c228995c509dc7f606cdc70d972ddb22df0164df4e0070583d0ab901f6605d0",
|
|
26
|
-
"src/lib/document-
|
|
33
|
+
"src/lib/document-network.ts": "5a0cd34464a40e1a3ccd2e7e713df1b44655f942727492851e96607e65fb26a7",
|
|
34
|
+
"src/lib/document-package.ts": "367f51ab8b2458b6391472fbacde117603ad1a538df26079709eb17ff42e3cf4",
|
|
27
35
|
"src/lib/editing.ts": "0046dd89941511f463a43b6f7bddb9bd36dacdc144a4139faf76d5272e6b18d0",
|
|
28
36
|
"src/lib/filter-evidence.ts": "594ea9065e5c8d32c6bd4fc055e78c2df7ad2418c2019106136917c89c8ac331",
|
|
29
|
-
"src/lib/html-guidance.ts": "
|
|
37
|
+
"src/lib/html-guidance.ts": "0bd0b830b33045357a070c2079b2aedaadb57807ba366be56b767b7d55120325",
|
|
30
38
|
"src/lib/html-validation.ts": "9f342f6716d457ba1a46c9d228f3f7858dcae2c0f64a3c98bc1d28d35a8f43ac",
|
|
31
|
-
"src/lib/middleware.ts": "
|
|
32
|
-
"src/lib/plugin.ts": "
|
|
33
|
-
"src/lib/presentation.provider.ts": "
|
|
39
|
+
"src/lib/middleware.ts": "d1173e3b058778fb6e569f861ddec1ffc3c36a4fb46df71b4652bfc8fc74115a",
|
|
40
|
+
"src/lib/plugin.ts": "c2788944df7697802350cde7fcc292a49b433b5176c7f8eec6a9809fbdf4ced7",
|
|
41
|
+
"src/lib/presentation.provider.ts": "3b37387636d9e7317ee6e36c9e607fadb20002c08c24d54e424342e913b2405f",
|
|
42
|
+
"src/lib/preview-retry.ts": "55fa28cc61f11adac4dce5a2066cbdd6d529ffd5ffd3cca7dcb552c6b7299500",
|
|
34
43
|
"src/lib/remote-entry.ts": "4c760963ff099b4d9a8961c933b1a586c0ac57d85a88c745c2578e2f66bf1539",
|
|
35
|
-
"src/lib/renderer.ts": "
|
|
36
|
-
"src/lib/resource-card.ts": "
|
|
44
|
+
"src/lib/renderer.ts": "418ac7cc5f37f9d638c0b2dd3a5361464674f21dbfb801b4414a9d68f1c9edc8",
|
|
45
|
+
"src/lib/resource-card.ts": "d64f91e640a3db220b941adef4a582e011a7aea253d57cc5d70a5bdcdacd8f71",
|
|
37
46
|
"src/lib/save-evidence.ts": "458f8fe2ef74fd4809fb9543d8c31bb42e0e16b10550b2a7808ca92ec3662bda",
|
|
38
|
-
"src/lib/sharing.service.ts": "
|
|
39
|
-
"src/lib/view.provider.ts": "
|
|
40
|
-
"src/remote/bridge.ts": "
|
|
47
|
+
"src/lib/sharing.service.ts": "e52c98d967f27a2f3bc80614f31da15e373dd4450b80aea250156efe24c77f3b",
|
|
48
|
+
"src/lib/view.provider.ts": "ba4087458334cbf71a256232695f1b56858926200f9430d79e95d5ac71fe1a26",
|
|
49
|
+
"src/remote/bridge.ts": "c191bc1876e11b44397b0fb41f4a0ecd7842b9a43dbc5eeddfb05ee21df72421",
|
|
41
50
|
"src/remote/dashboard-picker.tsx": "c84c147aeaa0774bd3f2bcd8b9502be4a78111167b01867e167c9cd72d263800",
|
|
42
|
-
"src/remote/html-dashboard.tsx": "
|
|
43
|
-
"src/remote/i18n.ts": "
|
|
44
|
-
"src/remote/
|
|
51
|
+
"src/remote/html-dashboard.tsx": "3e7eba0f8f760cd5334735a790278eea51beaa33ad9ff36a31b560bf7a0ed20d",
|
|
52
|
+
"src/remote/i18n.ts": "65bb7941903e0a0e6445836cdf25f22e30d875d709fb07d60ac2d88d591b7218",
|
|
53
|
+
"src/remote/locales/en.json": "f5090ccb4f8117082d79bec2da7d508b50602151da89f5867eb22008a419a9bf",
|
|
54
|
+
"src/remote/locales/zh-Hans.json": "8df4134a625b2f1fa07c73834bc208f451dab40b0a73200bffaf025b55c51b41",
|
|
55
|
+
"src/remote/locales/zh-Hant.json": "290c2f16c915a2c648ef58b5817d4cd2b007a88ab8ce809b11dd1bb2580807d9",
|
|
56
|
+
"src/remote/main.tsx": "4c9e9ac143e8508558f5721fd9f5574a7fb6ecdda5b5b4469702d3a95b90f669",
|
|
45
57
|
"src/remote/share-dialog.tsx": "f4a78a3bbf99d49c84e10631be9a9bcd3dc11b42130ce79e00010e53fbc2af84",
|
|
46
|
-
"src/remote/style.css": "
|
|
58
|
+
"src/remote/style.css": "8491fc393bacecd73cff2295526769cf73495d7842ca1ce57fb1abd0b7b5b60f",
|
|
47
59
|
"src/remote/viewer-controls.tsx": "b55e27a8a7932575a994fe30645b535c3dd5ba7e27df1f18a1f86462a6354ca3",
|
|
48
|
-
"src/validation/host-entry.ts": "
|
|
60
|
+
"src/validation/host-entry.ts": "d48af4a2ac3f520fa2f22dae5fbf9be59486ce0a8ae2e53a8652bfe6953fa803",
|
|
49
61
|
"tsconfig.remote.json": "e0b173f885c7439dfce09d411ff97fb7511bd77f6f1d7fdd66b5adb477a1f411"
|
|
50
62
|
},
|
|
51
63
|
"outputs": {
|
|
52
|
-
"app.js": "
|
|
53
|
-
"app.css": "
|
|
64
|
+
"app.js": "fef3c4052f17a6629c6c5c57bef6daab106172e29677c4c4fb9333966406b5d6",
|
|
65
|
+
"app.css": "418aaf0742026be83a2abb385204341b9726db63a1944c936d2c8d94263f0a0b",
|
|
54
66
|
"renderer.html": "30abe65cd0d32a7596e02c5e94f2e20879fa73644507fefa35c7119a018ff7d2"
|
|
55
67
|
},
|
|
56
68
|
"libraries": {
|
|
@@ -60,5 +72,5 @@
|
|
|
60
72
|
"dist/libraries/catalog.json": "86251c358c910bcbef755e604e1be4da2b7c91d097201d7a7dd8b889cd616bd8"
|
|
61
73
|
},
|
|
62
74
|
"rendererSource": "30abe65cd0d32a7596e02c5e94f2e20879fa73644507fefa35c7119a018ff7d2",
|
|
63
|
-
"artifactDocumentSource": "
|
|
75
|
+
"artifactDocumentSource": "e2271a15ee0b58cd4742efdadc89994cef1db3523b1a8c69f118cbc7832563c4"
|
|
64
76
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var DocumentHost=(function(se){"use strict";var v;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},s.getValidEnumValues=n=>{const a=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return s.objectValues(i)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},s.find=(n,a)=>{for(const i of n)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var ke;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(ke||(ke={}));const l=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=s=>{switch(typeof s){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(s)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(s)?l.array:s===null?l.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?l.promise:typeof Map<"u"&&s instanceof Map?l.map:typeof Set<"u"&&s instanceof Set?l.set:typeof Date<"u"&&s instanceof Date?l.date:l.object;default:return l.unknown}},c=v.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 j 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(a){return a.message},r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,u=0;for(;u<i.path.length;){const f=i.path[u];u===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],u++}}};return n(this),r}static assert(e){if(!(e instanceof j))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}j.create=s=>new j(s);const ue=(s,e)=>{let t;switch(s.code){case c.invalid_type:s.received===l.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case c.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==="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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let ze=ue;function qe(){return ze}const Be=s=>{const{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function d(s,e){const t=qe(),r=Be({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});s.common.issues.push(r)}class I{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 n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t){const a=await n.key,i=await n.value;r.push({key:a,value:i})}return I.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return p;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const p=Object.freeze({status:"aborted"}),X=s=>({status:"dirty",value:s}),C=s=>({status:"valid",value:s}),we=s=>s.status==="aborted",Ie=s=>s.status==="dirty",B=s=>s.status==="valid",re=s=>typeof Promise<"u"&&s instanceof Promise;var h;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));class O{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 Te=(s,e)=>{if(B(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 j(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:n}=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:n}:{errorMap:(i,o)=>{const{message:u}=s;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:n}}class _{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(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?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Te(r,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return B(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>B(r)?{value:r.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?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(re(n)?n:Promise.resolve(n));return Te(r,a)}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:c.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new H({schema:this,typeName:m.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 V.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return A.create(this)}promise(){return ce.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new H({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ye({...g(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new ht({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ge({...g(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return _e.create(this,e)}readonly(){return ve.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Fe=/^c[^\s-]{8,}$/i,We=/^[0-9a-z]+$/,Ye=/^[0-9A-HJKMNP-TV-Z]{26}$/i,He=/^[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,Ge=/^[a-z0-9_-]{21}$/i,Je=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qe=/^[-+]?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)?)??$/,Xe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ke="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let le;const et=/^(?:(?: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])$/,tt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,st=/^(([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]))$/,rt=/^(([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])$/,nt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,at=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ee="((\\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])))",it=new RegExp(`^${Ee}$`);function Ne(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 ot(s){return new RegExp(`^${Ne(s)}$`)}function ct(s){let e=`${Ee}T${Ne(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 dt(s,e){return!!((e==="v4"||!e)&&et.test(s)||(e==="v6"||!e)&&st.test(s))}function ut(s,e){if(!Je.test(s))return!1;try{const[t]=s.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function lt(s,e){return!!((e==="v4"||!e)&&tt.test(s)||(e==="v6"||!e)&&rt.test(s))}class M extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.string,received:a.parsedType}),p}const r=new I;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")le||(le=new RegExp(Ke,"u")),le.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")He.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Fe.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")We.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ye.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?ct(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?it.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?ot(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Qe.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?ut(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?lt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?nt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?at.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(r)})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(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?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new M({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new M({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new M({...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}}M.create=s=>new M({checks:[],typeName:m.ZodString,coerce:s?.coerce??!1,...g(s)});function ft(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class F extends _{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)!==l.number){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.number,received:a.parsedType}),p}let r;const n=new I;for(const a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ft(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,n){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(n)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&v.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)}}F.create=s=>new F({checks:[],typeName:m.ZodNumber,coerce:s?.coerce||!1,...g(s)});class K extends _{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)!==l.bigint)return this._getInvalidInput(e);let r;const n=new I;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,n){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(n)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}K.create=s=>new K({checks:[],typeName:m.ZodBigInt,coerce:s?.coerce??!1,...g(s)});class fe extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.boolean,received:r.parsedType}),p}return C(e.data)}}fe.create=s=>new fe({typeName:m.ZodBoolean,coerce:s?.coerce||!1,...g(s)});class ne extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}const r=new I;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}ne.create=s=>new ne({checks:[],coerce:s?.coerce||!1,typeName:m.ZodDate,...g(s)});class Ce extends _{_parse(e){if(this._getType(e)!==l.symbol){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.symbol,received:r.parsedType}),p}return C(e.data)}}Ce.create=s=>new Ce({typeName:m.ZodSymbol,...g(s)});class Se extends _{_parse(e){if(this._getType(e)!==l.undefined){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.undefined,received:r.parsedType}),p}return C(e.data)}}Se.create=s=>new Se({typeName:m.ZodUndefined,...g(s)});class he extends _{_parse(e){if(this._getType(e)!==l.null){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.null,received:r.parsedType}),p}return C(e.data)}}he.create=s=>new he({typeName:m.ZodNull,...g(s)});class Oe extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}Oe.create=s=>new Oe({typeName:m.ZodAny,...g(s)});class Ae extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}Ae.create=s=>new Ae({typeName:m.ZodUnknown,...g(s)});class U extends _{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.never,received:t.parsedType}),p}}U.create=s=>new U({typeName:m.ZodNever,...g(s)});class Re extends _{_parse(e){if(this._getType(e)!==l.undefined){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.void,received:r.parsedType}),p}return C(e.data)}}Re.create=s=>new Re({typeName:m.ZodVoid,...g(s)});class A extends _{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:c.invalid_type,expected:l.array,received:t.parsedType}),p;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new O(t,i,t.path,o)))).then(i=>I.mergeArray(r,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new O(t,i,t.path,o)));return I.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new A({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new A({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new A({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}A.create=(s,e)=>new A({type:s,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function W(s){if(s instanceof x){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=V.create(W(r))}return new x({...s._def,shape:()=>e})}else return s instanceof A?new A({...s._def,type:W(s.element)}):s instanceof V?V.create(W(s.unwrap())):s instanceof G?G.create(W(s.unwrap())):s instanceof z?z.create(s.items.map(e=>W(e))):s}class x extends _{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=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const f=this._getOrReturnCtx(e);return d(f,{code:c.invalid_type,expected:l.object,received:f.parsedType}),p}const{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(const f in n.data)i.includes(f)||o.push(f);const u=[];for(const f of i){const y=a[f],N=n.data[f];u.push({key:{status:"valid",value:f},value:y._parse(new O(n,N,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof U){const f=this._def.unknownKeys;if(f==="passthrough")for(const y of o)u.push({key:{status:"valid",value:y},value:{status:"valid",value:n.data[y]}});else if(f==="strict")o.length>0&&(d(n,{code:c.unrecognized_keys,keys:o}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const y of o){const N=n.data[y];u.push({key:{status:"valid",value:y},value:f._parse(new O(n,N,n.path,y)),alwaysSet:y in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const f=[];for(const y of u){const N=await y.key,T=await y.value;f.push({key:N,value:T,alwaysSet:y.alwaysSet})}return f}).then(f=>I.mergeObjectSync(r,f)):I.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{const n=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new x({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof V;)a=a._def.innerType;t[r]=a}return new x({...this._def,shape:()=>t})}keyof(){return je(v.objectKeys(this.shape))}}x.create=(s,e)=>new x({shape:()=>s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...g(e)}),x.strictCreate=(s,e)=>new x({shape:()=>s,unknownKeys:"strict",catchall:U.create(),typeName:m.ZodObject,...g(e)}),x.lazycreate=(s,e)=>new x({shape:s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...g(e)});class ae extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(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 j(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),p}if(t.common.async)return Promise.all(r.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(n);{let a;const i=[];for(const u of r){const f={...t,common:{...t.common,issues:[]},parent:null},y=u._parseSync({data:t.data,path:t.path,parent:f});if(y.status==="valid")return y;y.status==="dirty"&&!a&&(a={result:y,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(u=>new j(u));return d(t,{code:c.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}ae.create=(s,e)=>new ae({options:s,typeName:m.ZodUnion,...g(e)});function me(s,e){const t=L(s),r=L(e);if(s===e)return{valid:!0,data:s};if(t===l.object&&r===l.object){const n=v.objectKeys(e),a=v.objectKeys(s).filter(o=>n.indexOf(o)!==-1),i={...s,...e};for(const o of a){const u=me(s[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===l.array&&r===l.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<s.length;a++){const i=s[a],o=e[a],u=me(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===l.date&&r===l.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class ie extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(we(a)||we(i))return p;const o=me(a.value,i.value);return o.valid?((Ie(a)||Ie(i))&&t.dirty(),{status:t.value,value:o.data}):(d(r,{code:c.invalid_intersection_types}),p)};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(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ie.create=(s,e,t)=>new ie({left:s,right:e,typeName:m.ZodIntersection,...g(t)});class z extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.array)return d(r,{code:c.invalid_type,expected:l.array,received:r.parsedType}),p;if(r.data.length<this._def.items.length)return d(r,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&r.data.length>this._def.items.length&&(d(r,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new O(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>I.mergeArray(t,i)):I.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:s,typeName:m.ZodTuple,rest:null,...g(e)})};class oe extends _{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!==l.object)return d(r,{code:c.invalid_type,expected:l.object,received:r.parsedType}),p;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)n.push({key:a._parse(new O(r,o,r.path,o)),value:i._parse(new O(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?I.mergeObjectAsync(t,n):I.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new oe({keyType:e,valueType:t,typeName:m.ZodRecord,...g(r)}):new oe({keyType:M.create(),valueType:e,typeName:m.ZodRecord,...g(t)})}}class De extends _{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!==l.map)return d(r,{code:c.invalid_type,expected:l.map,received:r.parsedType}),p;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],f)=>({key:n._parse(new O(r,o,r.path,[f,"key"])),value:a._parse(new O(r,u,r.path,[f,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const f=await u.key,y=await u.value;if(f.status==="aborted"||y.status==="aborted")return p;(f.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(f.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const f=u.key,y=u.value;if(f.status==="aborted"||y.status==="aborted")return p;(f.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(f.value,y.value)}return{status:t.value,value:o}}}}De.create=(s,e,t)=>new De({valueType:e,keyType:s,typeName:m.ZodMap,...g(t)});class ee extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.set)return d(r,{code:c.invalid_type,expected:l.set,received:r.parsedType}),p;const n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(d(r,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(d(r,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const f=new Set;for(const y of u){if(y.status==="aborted")return p;y.status==="dirty"&&t.dirty(),f.add(y.value)}return{status:t.value,value:f}}const o=[...r.data.values()].map((u,f)=>a._parse(new O(r,u,r.path,f)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new ee({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new ee({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ee.create=(s,e)=>new ee({valueType:s,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class Ze extends _{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})}}Ze.create=(s,e)=>new Ze({getter:s,typeName:m.ZodLazy,...g(e)});class pe extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}pe.create=(s,e)=>new pe({value:s,typeName:m.ZodLiteral,...g(e)});function je(s,e){return new Y({values:s,typeName:m.ZodEnum,...g(e)})}class Y extends _{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return d(t,{expected:v.joinValues(r),received:t.parsedType,code:c.invalid_type}),p}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 d(t,{received:t.data,code:c.invalid_enum_value,options:r}),p}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Y.create(e,{...this._def,...t})}exclude(e,t=this._def){return Y.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}Y.create=je;class Me extends _{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==l.string&&r.parsedType!==l.number){const n=v.objectValues(t);return d(r,{expected:v.joinValues(n),received:r.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=v.objectValues(t);return d(r,{received:r.data,code:c.invalid_enum_value,options:n}),p}return C(e.data)}get enum(){return this._def.values}}Me.create=(s,e)=>new Me({values:s,typeName:m.ZodNativeEnum,...g(e)});class ce extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:l.promise,received:t.parsedType}),p;const r=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return C(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ce.create=(s,e)=>new ce({type:s,typeName:m.ZodPromise,...g(e)});class H extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{d(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return p;const u=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?p:u.status==="dirty"||t.value==="dirty"?X(u.value):u});{if(t.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?p:o.status==="dirty"||t.value==="dirty"?X(o.value):o}}if(n.type==="refinement"){const i=o=>{const u=n.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(i))return p;const o=n.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:r.data,path:r.path,parent:r}).then(i=>B(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):p);v.assertNever(n)}}H.create=(s,e,t)=>new H({schema:s,typeName:m.ZodEffects,effect:e,...g(t)}),H.createWithPreprocess=(s,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:s},typeName:m.ZodEffects,...g(t)});class V extends _{_parse(e){return this._getType(e)===l.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(s,e)=>new V({innerType:s,typeName:m.ZodOptional,...g(e)});class G extends _{_parse(e){return this._getType(e)===l.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(s,e)=>new G({innerType:s,typeName:m.ZodNullable,...g(e)});class ye extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===l.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ye.create=(s,e)=>new ye({innerType:s,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ge extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return re(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new j(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new j(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ge.create=(s,e)=>new ge({innerType:s,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class $e extends _{_parse(e){if(this._getType(e)!==l.nan){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.nan,received:r.parsedType}),p}return{status:"valid",value:e.data}}}$e.create=s=>new $e({typeName:m.ZodNaN,...g(s)});class ht extends _{_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 _e extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),X(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new _e({in:e,out:t,typeName:m.ZodPipeline})}}class ve extends _{_parse(e){const t=this._def.innerType._parse(e),r=n=>(B(n)&&(n.value=Object.freeze(n.value)),n);return re(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}}ve.create=(s,e)=>new ve({innerType:s,typeName:m.ZodReadonly,...g(e)});var m;(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"})(m||(m={}));const R=M.create,mt=F.create,pt=fe.create,yt=he.create;U.create;const xe=A.create,te=x.create,gt=ae.create;ie.create,z.create;const _t=oe.create,q=pe.create,vt=Y.create;ce.create,V.create,G.create;function xt(s,e){if(s==null)return{};var t={},r=Object.keys(s),n,a;for(a=0;a<r.length;a++)n=r[a],!(e.indexOf(n)>=0)&&(t[n]=s[n]);return t}const Le="xpert.artifact-document",Ue=1,de=R().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,79}$/),bt=gt([R().max(4e3),mt().finite(),pt(),yt()]),Ve=_t(de,bt).refine(s=>Object.keys(s).length<=24,"Too many controls"),kt=te({type:q("query"),requestId:R().min(1).max(80),bindingId:de,controls:Ve}).strict(),wt=te({bindingIds:xe(de).max(64).refine(s=>new Set(s).size===s.length,"Duplicate binding IDs"),defaults:Ve,theme:vt(["light","dark"]),locale:R().min(1).max(80)}).strict(),It=R().min(1).max(3e5).superRefine((s,e)=>{(new TextEncoder().encode(s).byteLength>3e5||!/<html[\s>]/i.test(s)||!/<body[\s>]/i.test(s))&&e.addIssue({code:"custom",message:"Supply a complete UTF-8 HTML document, at most 300 KB"})}),Tt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=(s,e)=>s>>>e|s<<32-e;function Et(s){const e=new Uint8Array(Math.ceil((s.length+9)/64)*64);e.set(s),e[s.length]=128;const t=new DataView(e.buffer);t.setUint32(e.length-8,Math.floor(s.length/536870912)),t.setUint32(e.length-4,s.length*8>>>0);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),n=new Uint32Array(64);for(let a=0;a<e.length;a+=64){for(let b=0;b<16;b++)n[b]=t.getUint32(a+b*4);for(let b=16;b<64;b++){const E=n[b-15],Z=n[b-2],P=D(E,7)^D(E,18)^E>>>3,Q=D(Z,17)^D(Z,19)^Z>>>10;n[b]=n[b-16]+P+n[b-7]+Q>>>0}let[i,o,u,f,y,N,T,J]=r;for(let b=0;b<64;b++){const E=D(y,6)^D(y,11)^D(y,25),Z=y&N^~y&T,P=J+E+Z+Tt[b]+n[b]>>>0,Q=D(i,2)^D(i,13)^D(i,22),w=i&o^i&u^o&u,S=Q+w>>>0;J=T,T=N,N=y,y=f+P>>>0,f=u,u=o,o=i,i=P+S>>>0}r[0]=r[0]+i>>>0,r[1]=r[1]+o>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+y>>>0,r[5]=r[5]+N>>>0,r[6]=r[6]+T>>>0,r[7]=r[7]+J>>>0}return Array.from(r,a=>a.toString(16).padStart(8,"0")).join("")}const Pe=te({id:de,version:R().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),format:q("classic-script"),global:R().regex(/^[A-Za-z_$][A-Za-z0-9_$]{0,79}$/).refine(s=>!["window","self","globalThis","document","parent","top","location","xpertLiveArtifact","__proto__","constructor","prototype"].includes(s)),sha256:R().regex(/^[a-f0-9]{64}$/)}).strict(),Nt=Pe.transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256})),Ct=xe(Nt).max(8).superRefine((s,e)=>{(new Set(s.map(t=>t.id)).size!==s.length||new Set(s.map(t=>t.global)).size!==s.length)&&e.addIssue({code:"custom",message:"Duplicate dependency ID or global"})}),St=xe(Pe.extend({source:R().min(1).max(4e6)}).strict().transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256,source:s.source}))).max(8);function Ot(s,e){const t=St.parse(s);Ct.parse(t.map(n=>{var{source:a}=n,i=xt(n,["source"]);return i}));let r=0;for(const n of t){const a=new TextEncoder().encode(n.source);if(r+=a.length,a.length>4e6||r>8e6)throw new Error("DOCUMENT_DEPENDENCY_TOO_LARGE");if(Et(a)!==n.sha256)throw new Error("DOCUMENT_DEPENDENCY_INTEGRITY_FAILED")}return t.map(n=>({id:n.id,version:n.version,global:n.global,sha256:n.sha256,source:n.source,format:"classic-script"}))}function At(s){const e=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/>/g,"\\u003e");return Ot(s).map(t=>`<script>(()=>{const s=document.createElement('script');s.textContent=${e(t.source)};document.head.appendChild(s);s.remove();if(typeof window[${e(t.global)}]==='undefined')throw new Error('DOCUMENT_DEPENDENCY_GLOBAL_MISSING');})();<\/script>`).join("")}const Rt=["default-src 'none'","script-src 'unsafe-inline'","style-src 'unsafe-inline'","img-src data: blob:","font-src data:","connect-src 'none'","frame-src 'none'","worker-src 'none'","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ");function Dt(s,e,t=[]){if(It.parse(s),!/^[a-f0-9]{32}$/.test(e))throw new Error("Invalid Artifact document session ID");return`<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Rt}"><script>${Zt.replace("__XPERT_DOCUMENT_SESSION__",e)}<\/script>${At(t)}${s}`}const Zt=String.raw`
|
|
1
|
+
var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=r=>{};function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},s.getValidEnumValues=r=>{const a=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return s.objectValues(i)},s.objectValues=r=>s.objectKeys(r).map(function(a){return r[a]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},s.find=(r,a)=>{for(const i of r)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=n,s.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var we;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));const l=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=s=>{switch(typeof s){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(s)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(s)?l.array:s===null?l.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?l.promise:typeof Map<"u"&&s instanceof Map?l.map:typeof Set<"u"&&s instanceof Set?l.set:typeof Date<"u"&&s instanceof Date?l.date:l.object;default:return l.unknown}},c=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Z extends Error{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:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){const f=i.path[u];u===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],u++}}};return r(this),n}static assert(e){if(!(e instanceof Z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Z.create=s=>new Z(s);const fe=(s,e)=>{let t;switch(s.code){case c.invalid_type:s.received===l.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case c.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==="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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let Fe=fe;function We(){return Fe}const Ye=s=>{const{data:e,path:t,errorMaps:n,issueData:r}=s,a=[...t,...r.path||[]],i={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const u=n.filter(f=>!!f).slice().reverse();for(const f of u)o=f(i,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function d(s,e){const t=We(),n=Ye({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===fe?void 0:fe].filter(r=>!!r)});s.common.issues.push(n)}class I{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 r of t){if(r.status==="aborted")return p;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const a=await r.key,i=await r.value;n.push({key:a,value:i})}return I.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return p;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const p=Object.freeze({status:"aborted"}),ee=s=>({status:"dirty",value:s}),C=s=>({status:"valid",value:s}),Ie=s=>s.status==="aborted",Te=s=>s.status==="dirty",B=s=>s.status==="valid",ne=s=>typeof Promise<"u"&&s instanceof Promise;var h;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));class A{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 Ee=(s,e)=>{if(B(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 Z(s.common.issues);return this._error=t,this._error}}};function y(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;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:r}:{errorMap:(i,o)=>{const{message:u}=s;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:r}}class _{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ne(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?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Ee(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return B(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>B(n)?{value:n.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?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(ne(r)?r:Promise.resolve(r));return Ee(n,a)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue({code:c.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new H({schema:this,typeName:m.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 P.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return R.create(this)}promise(){return ce.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new H({...y(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new _e({...y(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new gt({typeName:m.ZodBranded,type:this,...y(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ve({...y(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const He=/^c[^\s-]{8,}$/i,Ge=/^[0-9a-z]+$/,Je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qe=/^[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,Xe=/^[a-z0-9_-]{21}$/i,Ke=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,et=/^[-+]?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)?)??$/,tt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,st="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let he;const nt=/^(?:(?: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])$/,rt=/^(?:(?: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])$/,at=/^(([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]))$/,it=/^(([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])$/,ot=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ne="((\\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])))",dt=new RegExp(`^${Ne}$`);function Ce(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 ut(s){return new RegExp(`^${Ce(s)}$`)}function lt(s){let e=`${Ne}T${Ce(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 ft(s,e){return!!((e==="v4"||!e)&&nt.test(s)||(e==="v6"||!e)&&at.test(s))}function ht(s,e){if(!Ke.test(s))return!1;try{const[t]=s.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function mt(s,e){return!!((e==="v4"||!e)&&rt.test(s)||(e==="v6"||!e)&&it.test(s))}class M extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.string,received:a.parsedType}),p}const n=new I;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.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&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.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)&&(r=this._getOrReturnCtx(e,r),i?d(r,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(r,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")tt.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")he||(he=new RegExp(st,"u")),he.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Qe.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Xe.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")He.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Ge.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Je.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),d(r,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"regex",code:c.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)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.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)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?lt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?dt.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ut(a).test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?et.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ft(e.data,a.version)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ht(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?mt(e.data,a.version)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ot.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ct.test(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:c.invalid_string,...h.errToObj(n)})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(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?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new M({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new M({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new M({...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}}M.create=s=>new M({checks:[],typeName:m.ZodString,coerce:s?.coerce??!1,...y(s)});function pt(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,a=Number.parseInt(s.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return a%i/10**r}class F extends _{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)!==l.number){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.number,received:a.parsedType}),p}let n;const r=new I;for(const a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?pt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_finite,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,r){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(r)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&v.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)}}F.create=s=>new F({checks:[],typeName:m.ZodNumber,coerce:s?.coerce||!1,...y(s)});class te extends _{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)!==l.bigint)return this._getInvalidInput(e);let n;const r=new I;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),d(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,n,r){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:h.toString(r)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}te.create=s=>new te({checks:[],typeName:m.ZodBigInt,coerce:s?.coerce??!1,...y(s)});class me extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.boolean,received:n.parsedType}),p}return C(e.data)}}me.create=s=>new me({typeName:m.ZodBoolean,coerce:s?.coerce||!1,...y(s)});class re extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}const n=new I;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):v.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}re.create=s=>new re({checks:[],coerce:s?.coerce||!1,typeName:m.ZodDate,...y(s)});class Se extends _{_parse(e){if(this._getType(e)!==l.symbol){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.symbol,received:n.parsedType}),p}return C(e.data)}}Se.create=s=>new Se({typeName:m.ZodSymbol,...y(s)});class Oe extends _{_parse(e){if(this._getType(e)!==l.undefined){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.undefined,received:n.parsedType}),p}return C(e.data)}}Oe.create=s=>new Oe({typeName:m.ZodUndefined,...y(s)});class pe extends _{_parse(e){if(this._getType(e)!==l.null){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.null,received:n.parsedType}),p}return C(e.data)}}pe.create=s=>new pe({typeName:m.ZodNull,...y(s)});class Ae extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}Ae.create=s=>new Ae({typeName:m.ZodAny,...y(s)});class Re extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}Re.create=s=>new Re({typeName:m.ZodUnknown,...y(s)});class U extends _{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.never,received:t.parsedType}),p}}U.create=s=>new U({typeName:m.ZodNever,...y(s)});class De extends _{_parse(e){if(this._getType(e)!==l.undefined){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.void,received:n.parsedType}),p}return C(e.data)}}De.create=s=>new De({typeName:m.ZodVoid,...y(s)});class R extends _{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==l.array)return d(t,{code:c.invalid_type,expected:l.array,received:t.parsedType}),p;if(r.exactLength!==null){const i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(d(t,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(d(t,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new A(t,i,t.path,o)))).then(i=>I.mergeArray(n,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new A(t,i,t.path,o)));return I.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new R({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new R({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new R({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}R.create=(s,e)=>new R({type:s,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...y(e)});function W(s){if(s instanceof x){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=P.create(W(n))}return new x({...s._def,shape:()=>e})}else return s instanceof R?new R({...s._def,type:W(s.element)}):s instanceof P?P.create(W(s.unwrap())):s instanceof G?G.create(W(s.unwrap())):s instanceof z?z.create(s.items.map(e=>W(e))):s}class x extends _{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=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const f=this._getOrReturnCtx(e);return d(f,{code:c.invalid_type,expected:l.object,received:f.parsedType}),p}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(const f in r.data)i.includes(f)||o.push(f);const u=[];for(const f of i){const g=a[f],N=r.data[f];u.push({key:{status:"valid",value:f},value:g._parse(new A(r,N,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof U){const f=this._def.unknownKeys;if(f==="passthrough")for(const g of o)u.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(f==="strict")o.length>0&&(d(r,{code:c.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 g of o){const N=r.data[g];u.push({key:{status:"valid",value:g},value:f._parse(new A(r,N,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const f=[];for(const g of u){const N=await g.key,T=await g.value;f.push({key:N,value:T,alwaysSet:g.alwaysSet})}return f}).then(f=>I.mergeObjectSync(n,f)):I.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const n of v.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const n of v.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new x({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};for(const n of v.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const n of v.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof P;)a=a._def.innerType;t[n]=a}return new x({...this._def,shape:()=>t})}keyof(){return Me(v.objectKeys(this.shape))}}x.create=(s,e)=>new x({shape:()=>s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...y(e)}),x.strictCreate=(s,e)=>new x({shape:()=>s,unknownKeys:"strict",catchall:U.create(),typeName:m.ZodObject,...y(e)}),x.lazycreate=(s,e)=>new x({shape:s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...y(e)});class ae extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(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 Z(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),p}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(r);{let a;const i=[];for(const u of n){const f={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:f});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,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(u=>new Z(u));return d(t,{code:c.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}ae.create=(s,e)=>new ae({options:s,typeName:m.ZodUnion,...y(e)});function ge(s,e){const t=L(s),n=L(e);if(s===e)return{valid:!0,data:s};if(t===l.object&&n===l.object){const r=v.objectKeys(e),a=v.objectKeys(s).filter(o=>r.indexOf(o)!==-1),i={...s,...e};for(const o of a){const u=ge(s[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===l.array&&n===l.array){if(s.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<s.length;a++){const i=s[a],o=e[a],u=ge(i,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===l.date&&n===l.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class ie extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(Ie(a)||Ie(i))return p;const o=ge(a.value,i.value);return o.valid?((Te(a)||Te(i))&&t.dirty(),{status:t.value,value:o.data}):(d(n,{code:c.invalid_intersection_types}),p)};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])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ie.create=(s,e,t)=>new ie({left:s,right:e,typeName:m.ZodIntersection,...y(t)});class z extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==l.array)return d(n,{code:c.invalid_type,expected:l.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return d(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new A(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>I.mergeArray(t,i)):I.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:s,typeName:m.ZodTuple,rest:null,...y(e)})};class oe extends _{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!==l.object)return d(n,{code:c.invalid_type,expected:l.object,received:n.parsedType}),p;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)r.push({key:a._parse(new A(n,o,n.path,o)),value:i._parse(new A(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?I.mergeObjectAsync(t,r):I.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof _?new oe({keyType:e,valueType:t,typeName:m.ZodRecord,...y(n)}):new oe({keyType:M.create(),valueType:e,typeName:m.ZodRecord,...y(t)})}}class je extends _{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!==l.map)return d(n,{code:c.invalid_type,expected:l.map,received:n.parsedType}),p;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],f)=>({key:r._parse(new A(n,o,n.path,[f,"key"])),value:a._parse(new A(n,u,n.path,[f,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const f=await u.key,g=await u.value;if(f.status==="aborted"||g.status==="aborted")return p;(f.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(f.value,g.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const f=u.key,g=u.value;if(f.status==="aborted"||g.status==="aborted")return p;(f.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(f.value,g.value)}return{status:t.value,value:o}}}}je.create=(s,e,t)=>new je({valueType:e,keyType:s,typeName:m.ZodMap,...y(t)});class se extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==l.set)return d(n,{code:c.invalid_type,expected:l.set,received:n.parsedType}),p;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(d(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(d(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const f=new Set;for(const g of u){if(g.status==="aborted")return p;g.status==="dirty"&&t.dirty(),f.add(g.value)}return{status:t.value,value:f}}const o=[...n.data.values()].map((u,f)=>a._parse(new A(n,u,n.path,f)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new se({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(s,e)=>new se({valueType:s,minSize:null,maxSize:null,typeName:m.ZodSet,...y(e)});class Ze extends _{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})}}Ze.create=(s,e)=>new Ze({getter:s,typeName:m.ZodLazy,...y(e)});class ye extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}ye.create=(s,e)=>new ye({value:s,typeName:m.ZodLiteral,...y(e)});function Me(s,e){return new Y({values:s,typeName:m.ZodEnum,...y(e)})}class Y extends _{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{expected:v.joinValues(n),received:t.parsedType,code:c.invalid_type}),p}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 d(t,{received:t.data,code:c.invalid_enum_value,options:n}),p}return C(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Y.create(e,{...this._def,...t})}exclude(e,t=this._def){return Y.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}Y.create=Me;class $e extends _{_parse(e){const t=v.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==l.string&&n.parsedType!==l.number){const r=v.objectValues(t);return d(n,{expected:v.joinValues(r),received:n.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=v.objectValues(t);return d(n,{received:n.data,code:c.invalid_enum_value,options:r}),p}return C(e.data)}get enum(){return this._def.values}}$e.create=(s,e)=>new $e({values:s,typeName:m.ZodNativeEnum,...y(e)});class ce extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:l.promise,received:t.parsedType}),p;const n=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return C(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ce.create=(s,e)=>new ce({type:s,typeName:m.ZodPromise,...y(e)});class H extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{d(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return p;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?p:u.status==="dirty"||t.value==="dirty"?ee(u.value):u});{if(t.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?p:o.status==="dirty"||t.value==="dirty"?ee(o.value):o}}if(r.type==="refinement"){const i=o=>{const u=r.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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"?p:(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"?p:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!B(i))return p;const o=r.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=>B(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:t.value,value:o})):p);v.assertNever(r)}}H.create=(s,e,t)=>new H({schema:s,typeName:m.ZodEffects,effect:e,...y(t)}),H.createWithPreprocess=(s,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:s},typeName:m.ZodEffects,...y(t)});class P extends _{_parse(e){return this._getType(e)===l.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P.create=(s,e)=>new P({innerType:s,typeName:m.ZodOptional,...y(e)});class G extends _{_parse(e){return this._getType(e)===l.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(s,e)=>new G({innerType:s,typeName:m.ZodNullable,...y(e)});class _e extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===l.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}_e.create=(s,e)=>new _e({innerType:s,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});class ve extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ne(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Z(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ve.create=(s,e)=>new ve({innerType:s,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});class Le extends _{_parse(e){if(this._getType(e)!==l.nan){const n=this._getOrReturnCtx(e);return d(n,{code:c.invalid_type,expected:l.nan,received:n.parsedType}),p}return{status:"valid",value:e.data}}}Le.create=s=>new Le({typeName:m.ZodNaN,...y(s)});class gt extends _{_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 xe extends _{_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"?p:a.status==="dirty"?(t.dirty(),ee(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?p:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new xe({in:e,out:t,typeName:m.ZodPipeline})}}class be extends _{_parse(e){const t=this._def.innerType._parse(e),n=r=>(B(r)&&(r.value=Object.freeze(r.value)),r);return ne(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}be.create=(s,e)=>new be({innerType:s,typeName:m.ZodReadonly,...y(e)});var m;(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"})(m||(m={}));const O=M.create,yt=F.create,_t=me.create,vt=pe.create;U.create;const de=R.create,J=x.create,xt=ae.create;ie.create,z.create;const bt=oe.create,q=ye.create,kt=Y.create;ce.create,P.create,G.create;function wt(s,e){if(s==null)return{};var t={},n=Object.keys(s),r,a;for(a=0;a<n.length;a++)r=n[a],!(e.indexOf(r)>=0)&&(t[r]=s[r]);return t}const Ue="xpert.artifact-document",Pe=1,ue=O().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,79}$/),It=xt([O().max(4e3),yt().finite(),_t(),vt()]),Ve=bt(ue,It).refine(s=>Object.keys(s).length<=24,"Too many controls"),Tt=J({type:q("query"),requestId:O().min(1).max(80),bindingId:ue,controls:Ve}).strict(),Et=J({bindingIds:de(ue).max(64).refine(s=>new Set(s).size===s.length,"Duplicate binding IDs"),defaults:Ve,theme:kt(["light","dark"]),locale:O().min(1).max(80)}).strict(),Nt=O().min(1).max(3e5).superRefine((s,e)=>{(new TextEncoder().encode(s).byteLength>3e5||!/<html[\s>]/i.test(s)||!/<body[\s>]/i.test(s))&&e.addIssue({code:"custom",message:"Supply a complete UTF-8 HTML document, at most 300 KB"})}),Ct=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=(s,e)=>s>>>e|s<<32-e;function St(s){const e=new Uint8Array(Math.ceil((s.length+9)/64)*64);e.set(s),e[s.length]=128;const t=new DataView(e.buffer);t.setUint32(e.length-8,Math.floor(s.length/536870912)),t.setUint32(e.length-4,s.length*8>>>0);const n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),r=new Uint32Array(64);for(let a=0;a<e.length;a+=64){for(let b=0;b<16;b++)r[b]=t.getUint32(a+b*4);for(let b=16;b<64;b++){const E=r[b-15],j=r[b-2],V=D(E,7)^D(E,18)^E>>>3,X=D(j,17)^D(j,19)^j>>>10;r[b]=r[b-16]+V+r[b-7]+X>>>0}let[i,o,u,f,g,N,T,Q]=n;for(let b=0;b<64;b++){const E=D(g,6)^D(g,11)^D(g,25),j=g&N^~g&T,V=Q+E+j+Ct[b]+r[b]>>>0,X=D(i,2)^D(i,13)^D(i,22),w=i&o^i&u^o&u,S=X+w>>>0;Q=T,T=N,N=g,g=f+V>>>0,f=u,u=o,o=i,i=V+S>>>0}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+u>>>0,n[3]=n[3]+f>>>0,n[4]=n[4]+g>>>0,n[5]=n[5]+N>>>0,n[6]=n[6]+T>>>0,n[7]=n[7]+Q>>>0}return Array.from(n,a=>a.toString(16).padStart(8,"0")).join("")}const ze=J({id:ue,version:O().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),format:q("classic-script"),global:O().regex(/^[A-Za-z_$][A-Za-z0-9_$]{0,79}$/).refine(s=>!["window","self","globalThis","document","parent","top","location","xpertLiveArtifact","__proto__","constructor","prototype"].includes(s)),sha256:O().regex(/^[a-f0-9]{64}$/)}).strict(),Ot=ze.transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256})),At=de(Ot).max(8).superRefine((s,e)=>{(new Set(s.map(t=>t.id)).size!==s.length||new Set(s.map(t=>t.global)).size!==s.length)&&e.addIssue({code:"custom",message:"Duplicate dependency ID or global"})}),Rt=de(ze.extend({source:O().min(1).max(4e6)}).strict().transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256,source:s.source}))).max(8);function Dt(s,e){const t=Rt.parse(s);At.parse(t.map(r=>{var{source:a}=r,i=wt(r,["source"]);return i}));let n=0;for(const r of t){const a=new TextEncoder().encode(r.source);if(n+=a.length,a.length>4e6||n>8e6)throw new Error("DOCUMENT_DEPENDENCY_TOO_LARGE");if(St(a)!==r.sha256)throw new Error("DOCUMENT_DEPENDENCY_INTEGRITY_FAILED")}return t.map(r=>({id:r.id,version:r.version,global:r.global,sha256:r.sha256,source:r.source,format:"classic-script"}))}function jt(s){const e=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/>/g,"\\u003e");return Dt(s).map(t=>`<script>(()=>{const s=document.createElement('script');s.textContent=${e(t.source)};document.head.appendChild(s);s.remove();if(typeof window[${e(t.global)}]==='undefined')throw new Error('DOCUMENT_DEPENDENCY_GLOBAL_MISSING');})();<\/script>`).join("")}const Zt=O().max(250).refine(s=>{try{const e=new URL(s);return e.protocol==="https:"&&e.origin===s&&!e.username&&!e.password&&/^(?:[a-z0-9.-]+|\[[a-f0-9:]+\])$/i.test(e.hostname)}catch{return!1}},"Use an exact HTTPS origin without a path, credentials or wildcard"),le=de(Zt).max(16),Mt=J({scripts:le.optional(),styles:le.optional(),fonts:le.optional(),images:le.optional()}).strict();function qe(s){const e=Mt.parse(s??{}),t=n=>n?.length?` ${[...new Set(n)].join(" ")}`:"";return["default-src 'none'",`script-src 'unsafe-inline'${t(e.scripts)}`,`style-src 'unsafe-inline'${t(e.styles)}`,`img-src data: blob:${t(e.images)}`,`font-src data:${t(e.fonts)}`,"connect-src 'none'","frame-src 'none'","worker-src 'none'","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ")}function $t(s,e,t){let n;try{n=new URL(t)}catch{return!1}if(n.protocol!=="https:"||n.username||n.password)return!1;const r=e==="script"?s.scripts:e==="stylesheet"?s.styles:e==="font"?s.fonts:e==="image"?s.images:void 0;var a;return(a=r?.includes(n.origin))!=null?a:!1}qe();function Lt(s,e,t=[],n){if(Nt.parse(s),!/^[a-f0-9]{32}$/.test(e))throw new Error("Invalid Artifact document session ID");return`<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${qe(n)}"><script>${Ut.replace("__XPERT_DOCUMENT_SESSION__",e)}<\/script>${jt(t)}${s}`}const Ut=String.raw`
|
|
2
2
|
;(() => {
|
|
3
3
|
'use strict'
|
|
4
4
|
const SESSION_ID = '__XPERT_DOCUMENT_SESSION__'
|
|
@@ -146,4 +146,4 @@ var DocumentHost=(function(se){"use strict";var v;(function(s){s.assertEqual=n=>
|
|
|
146
146
|
})
|
|
147
147
|
parent.postMessage({ channel: CHANNEL, version: VERSION, type: 'ready', sessionId: SESSION_ID }, '*')
|
|
148
148
|
})()
|
|
149
|
-
`,
|
|
149
|
+
`,Pt=J({channel:q(Ue),version:q(Pe),type:q("ready"),sessionId:O().regex(/^[a-f0-9]{32}$/)}).strict(),Vt=J({type:q("diagnostic"),code:q("DOCUMENT_BINDING_DENIED")}).strict();function zt(s,e){if(!s.ownerDocument.querySelector("meta[data-xpert-document-policy]"))throw new Error("Install the Artifact document frame policy before mounting a document");const t=Et.parse(e.context),n=Array.from(crypto.getRandomValues(new Uint8Array(16)),w=>w.toString(16).padStart(2,"0")).join(""),r=Lt(e.html,n,e.dependencies,e.networkPolicy),a=new MessageChannel,i=new Set(t.bindingIds),o=new Set,u=new Set,f=new Map,g=s.ownerDocument.defaultView;let N=!1,T=!1,Q=0,b=Date.now();s.setAttribute("sandbox","allow-scripts"),s.referrerPolicy="no-referrer";const E=(w,S)=>{try{w?.(S)}catch{}},j=w=>{T||a.port1.postMessage(w)},V=(w,S)=>{j({type:"result",requestId:w,ok:!1,code:S}),E(e.onError,S)};a.port1.onmessage=async w=>{if(T)return;const S=Vt.safeParse(w.data);if(S.success){E(e.onError,S.data.code);return}const $=Tt.safeParse(w.data);if(!$.success){E(e.onError,"DOCUMENT_INVALID_REQUEST");return}const k={type:$.data.type,requestId:$.data.requestId,bindingId:$.data.bindingId,controls:$.data.controls};if(!i.has(k.bindingId)){V(k.requestId,"DOCUMENT_BINDING_DENIED");return}if(Date.now()-b>=6e4&&(Q=0,b=Date.now(),o.clear()),u.has(k.requestId)||o.has(k.requestId)){V(k.requestId,"DOCUMENT_REQUEST_REPLAY");return}if(u.size>=8||++Q>60){V(k.requestId,"DOCUMENT_QUERY_LIMIT");return}o.add(k.requestId),u.add(k.requestId),f.set(k.bindingId,k.requestId),E(e.onBusy,!0);try{const ke=await e.query(k);T||(j({type:"result",requestId:k.requestId,ok:!0,dataset:ke}),f.get(k.bindingId)===k.requestId&&E(e.onResult,ke))}catch{T||(j({type:"result",requestId:k.requestId,ok:!1,code:"DOCUMENT_QUERY_FAILED"}),f.get(k.bindingId)===k.requestId&&E(e.onError,"DOCUMENT_QUERY_FAILED"))}finally{u.delete(k.requestId),T||E(e.onBusy,u.size>0)}};const X=w=>{var S;if(T||N||w.source!==s.contentWindow)return;const $=Pt.safeParse(w.data);!$.success||$.data.sessionId!==n||(N=!0,(S=s.contentWindow)==null||S.postMessage({channel:Ue,version:Pe,type:"init",sessionId:n,context:t},"*",[a.port2]))};return g.addEventListener("message",X),a.port1.start(),s.srcdoc=r,{refresh(){j({type:"refresh"})},dispose(){T||(T=!0,g.removeEventListener("message",X),a.port1.close(),a.port2.close(),E(e.onBusy,!1))}}}function qt(s){if(s.querySelector("meta[data-xpert-document-policy]"))return;const e=s.createElement("meta");e.httpEquiv="Content-Security-Policy",e.content="frame-src 'none'",e.dataset.xpertDocumentPolicy="1",s.head.prepend(e)}const Be={scripts:["https://cdn.tailwindcss.com","https://cdn.jsdelivr.net","https://cdnjs.cloudflare.com","https://unpkg.com"],styles:["https://cdn.jsdelivr.net","https://cdnjs.cloudflare.com","https://unpkg.com","https://fonts.googleapis.com"],fonts:["https://cdn.jsdelivr.net","https://cdnjs.cloudflare.com","https://unpkg.com","https://fonts.gstatic.com"]};function Bt(s,e){return zt(s,{...e,networkPolicy:Be})}function Ft(s,e){return $t(Be,s,e)}return K.installArtifactDocumentFramePolicy=qt,K.isDashboardResourceAllowed=Ft,K.mountArtifactDocument=Bt,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),K})({});
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
export async function validateDocument(input, browser, hostPath) {
|
|
2
2
|
const errors = [], addError = value => { const message = String(value).slice(0, 300); if (errors.length < 16 && !errors.includes(message)) errors.push(message) }
|
|
3
|
-
const
|
|
3
|
+
const loadedResources = new Set()
|
|
4
|
+
const context = await browser.newContext({ viewport: { width: 1280, height: 900 }, serviceWorkers: 'block' })
|
|
4
5
|
try {
|
|
5
6
|
const page = await context.newPage()
|
|
6
|
-
await page.route('**/*', route =>
|
|
7
|
+
await page.route('**/*', async route => {
|
|
8
|
+
const request = route.request()
|
|
9
|
+
const allowed = request.method() === 'GET' && await page.evaluate(({ type, url }) =>
|
|
10
|
+
DocumentHost.isDashboardResourceAllowed(type, url), { type: request.resourceType(), url: request.url() })
|
|
11
|
+
if (allowed) await route.continue()
|
|
12
|
+
else await route.abort('blockedbyclient')
|
|
13
|
+
})
|
|
14
|
+
page.on('requestfailed', request => addError(`DOCUMENT_RESOURCE_LOAD_FAILED: ${request.resourceType()} ${request.url().split('?')[0]} (${request.failure()?.errorText ?? 'request failed'})`))
|
|
15
|
+
page.on('response', response => {
|
|
16
|
+
if (response.status() >= 400) addError(`DOCUMENT_RESOURCE_HTTP_ERROR: ${response.status()} ${response.url().split('?')[0]}`)
|
|
17
|
+
else if (response.status() < 300 || response.status() === 304) {
|
|
18
|
+
for (let request = response.request(); request; request = request.redirectedFrom()) loadedResources.add(request.url().split('#')[0])
|
|
19
|
+
}
|
|
20
|
+
})
|
|
7
21
|
page.on('pageerror', error => addError(error.message))
|
|
8
22
|
page.on('console', message => { if (message.type() === 'error') addError(message.text()) })
|
|
9
23
|
await page.setContent('<!doctype html><html><head></head><body><iframe style="width:100%;height:850px"></iframe></body></html>')
|
|
@@ -47,7 +61,8 @@ const errors = [], addError = value => { const message = String(value).slice(0,
|
|
|
47
61
|
}, onError: code => window.validation.errors.push(code)
|
|
48
62
|
})
|
|
49
63
|
}, input)
|
|
50
|
-
await page.waitForFunction(() => window.validation.requestedBindings.length || window.validation.errors.length, null, { timeout:
|
|
64
|
+
await page.waitForFunction(() => window.validation.requestedBindings.length || window.validation.errors.length, null, { timeout: 15000 }).catch(() => addError('DOCUMENT_INITIAL_QUERY_MISSING'))
|
|
65
|
+
await page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => addError('DOCUMENT_RESOURCE_LOAD_TIMEOUT'))
|
|
51
66
|
await page.waitForTimeout(500)
|
|
52
67
|
await page.waitForFunction(ids => ids.every(id => window.validation.requestedBindings.includes(id)),
|
|
53
68
|
input.context.bindingIds, { timeout: 2000 }).catch(() => {})
|
|
@@ -56,6 +71,12 @@ const errors = [], addError = value => { const message = String(value).slice(0,
|
|
|
56
71
|
if (!initiallyRequested.includes(id)) addError(`DOCUMENT_INITIAL_BINDING_MISSING: ${id}. Subscribe and query every saved Binding on initial load.`)
|
|
57
72
|
}
|
|
58
73
|
const frame = page.frames().find(frame => frame !== page.mainFrame())
|
|
74
|
+
if (frame) {
|
|
75
|
+
const resources = await frame.locator('script[src], link[rel~="stylesheet"][href]').evaluateAll(elements => elements.map(element =>
|
|
76
|
+
element instanceof HTMLScriptElement ? element.src : element.href))
|
|
77
|
+
for (const url of resources) if (/^https?:/.test(url) && !loadedResources.has(url.split('#')[0]))
|
|
78
|
+
addError(`DOCUMENT_RESOURCE_NOT_LOADED: ${url.split('?')[0]}. Online scripts and styles must load successfully before saving.`)
|
|
79
|
+
}
|
|
59
80
|
// Exercise bounded native selects against the saved parameter contract; data remains the real default preview.
|
|
60
81
|
// This detects invalid filter wiring, not the upstream effect of a filter or arbitrary custom controls.
|
|
61
82
|
if (frame && input.parameters) {
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { installArtifactDocumentFramePolicy } from '@xpert-ai/plugin-sdk/artifact-document';
|
|
2
|
+
export { mountDashboardDocument as mountArtifactDocument } from '../lib/document-host';
|
|
3
|
+
export { isDashboardResourceAllowed } from '../lib/document-host';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isDashboardResourceAllowed = exports.mountArtifactDocument = exports.installArtifactDocumentFramePolicy = void 0;
|
|
4
4
|
var artifact_document_1 = require("@xpert-ai/plugin-sdk/artifact-document");
|
|
5
|
-
Object.defineProperty(exports, "mountArtifactDocument", { enumerable: true, get: function () { return artifact_document_1.mountArtifactDocument; } });
|
|
6
5
|
Object.defineProperty(exports, "installArtifactDocumentFramePolicy", { enumerable: true, get: function () { return artifact_document_1.installArtifactDocumentFramePolicy; } });
|
|
6
|
+
var document_host_1 = require("../lib/document-host");
|
|
7
|
+
Object.defineProperty(exports, "mountArtifactDocument", { enumerable: true, get: function () { return document_host_1.mountDashboardDocument; } });
|
|
8
|
+
var document_host_2 = require("../lib/document-host");
|
|
9
|
+
Object.defineProperty(exports, "isDashboardResourceAllowed", { enumerable: true, get: function () { return document_host_2.isDashboardResourceAllowed; } });
|
package/docs/drafts.mdx
CHANGED
|
@@ -24,7 +24,7 @@ Workbench 的版本菜单区分工作草稿和正式版本。点击“发布草
|
|
|
24
24
|
|
|
25
25
|
确认对话框冻结用户正在确认的修订。期间草稿变化会导致发布冲突,不会悄悄发布另一份内容。重复发布同一个已确认修订不会产生多余版本。
|
|
26
26
|
|
|
27
|
-
页面查询只发送 Artifact 身份、草稿修订号或正式版本 ID、Binding ID 和声明过的筛选值。后端读取已保存的定义并重新检查当前访问权。原始 SQL、数据源替换、任意 Binding 或新增筛选字段仍被拒绝;HTML
|
|
27
|
+
页面查询只发送 Artifact 身份、草稿修订号或正式版本 ID、Binding ID 和声明过的筛选值。后端读取已保存的定义并重新检查当前访问权。原始 SQL、数据源替换、任意 Binding 或新增筛选字段仍被拒绝;HTML 沙箱允许白名单 CDN 的脚本、样式和字体,仍禁止直接数据请求和父页面访问。
|
|
28
28
|
|
|
29
29
|
## 兼容性和范围
|
|
30
30
|
|
|
@@ -10,7 +10,7 @@ description: "ECharts、Three.js 的受控注入、版本快照和 Binding 边
|
|
|
10
10
|
创建 HTML 看板时传入 `libraries: ["echarts"]`;不使用库时省略。
|
|
11
11
|
已有看板先 `dashboard_open`,读取原 HTML,再 `dashboard_update`。
|
|
12
12
|
修改工具省略 `libraries` 会保留原依赖;显式传入完整列表表示增加、移除或升级依赖。
|
|
13
|
-
|
|
13
|
+
打包库在作者代码执行前已加载,不要重复加载相同库或复制库源码。在线依赖可使用 script/link 标签,来源须在 dashboard_libraries.online 的对应资源类型白名单内;Tailwind CDN 可使用 https://cdn.tailwindcss.com/3.4.17。在线资源不填写到 libraries 数组中。
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
16
|
const chart = echarts.init(document.querySelector('#chart'), null, { renderer: 'svg' })
|
|
@@ -40,7 +40,7 @@ WebGLRenderer 需要浏览器提供 WebGL2,必须处理 GPU 不可用并释放
|
|
|
40
40
|
平台 SDK 负责通用依赖锁、SHA-256 校验、代码大小限制和隔离注入。
|
|
41
41
|
本插件负责允许列表、打包、许可证、Agent 工具和看板版本语义,数据源插件无需感知图库。
|
|
42
42
|
|
|
43
|
-
带图库的保存文件采用 `xpert.live-dashboard.package
|
|
43
|
+
带图库的保存文件采用 `xpert.live-dashboard.package`:`manifest` 存 HTML、Binding 和依赖锁,
|
|
44
44
|
`dependencies` 存库的实际代码。它们共享一个不可变 Artifact Version 和文件摘要。
|
|
45
45
|
旧的无图库 JSON 定义继续兼容。Agent 读取工具只返回依赖元数据,避免把库源码塞进上下文。
|
|
46
46
|
历史版本从自身快照读取库,不依赖当前插件仍保留相同版本;修改默认继承该快照。
|
|
@@ -53,5 +53,5 @@ WebGLRenderer 需要浏览器提供 WebGL2,必须处理 GPU 不可用并释放
|
|
|
53
53
|
## 查询权限
|
|
54
54
|
|
|
55
55
|
图库只处理已返回的 Dataset。页面仍只能通过 `xpertLiveArtifact` 指定已保存的 Binding ID 和控件值。
|
|
56
|
-
|
|
56
|
+
在线脚本、样式和字体使用独立的 HTTPS CDN 白名单,预检和实际页面规则一致。在线资源必须在保存和查看时可访问,内容不会随 Artifact 冻结。数据网络请求、Provider 覆盖、SQL、宿主存储或其他 View Actions 仍不开放。
|
|
57
57
|
服务端继续按当前用户授权查询,旧版本不能恢复已撤销的数据访问权限。
|