@shumai-one/shumai 0.5.3 → 0.6.1
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/bin/{chunk-hsx4pns6.js → chunk-0502p2k7.js} +1 -1
- package/bin/chunk-0b0t6y8h.js +11 -0
- package/bin/{chunk-rh8dy99a.js → chunk-0tvnfy4k.js} +2 -2
- package/bin/{chunk-fpjvr3qw.js → chunk-16n160h1.js} +1 -1
- package/bin/{chunk-wbmqbpgm.js → chunk-1eqw2dpx.js} +2 -2
- package/bin/chunk-1vt9ss7d.js +2 -0
- package/bin/chunk-2cpsfc87.js +1 -0
- package/bin/{chunk-nmd1901j.js → chunk-2w0d9veg.js} +1 -1
- package/bin/{chunk-zzbn0b6c.js → chunk-2xp9prpq.js} +1 -1
- package/bin/chunk-3gqs15zq.js +2 -0
- package/bin/{chunk-929abwgr.js → chunk-3j82q2gj.js} +1 -1
- package/bin/{chunk-5bpvwv66.js → chunk-3me1v3z5.js} +2 -2
- package/bin/chunk-3pw7z25v.js +3 -0
- package/bin/{chunk-vsnq4381.js → chunk-3tx9v8kj.js} +1 -1
- package/bin/chunk-3wdtp4ht.js +1 -0
- package/bin/chunk-57axjy7y.js +1 -0
- package/bin/{chunk-6pwf7qa6.js → chunk-5aqthcm6.js} +2 -2
- package/bin/{chunk-scvepfv8.js → chunk-5gq4q1bb.js} +1 -1
- package/bin/{chunk-zq5j9wsc.js → chunk-5r1br11d.js} +1 -1
- package/bin/chunk-61hrdg0g.js +1 -0
- package/bin/chunk-6aa4xmnw.js +2 -0
- package/bin/{chunk-y5h5d5gx.js → chunk-6mrgtn78.js} +7 -7
- package/bin/chunk-6s55r0z9.js +1 -0
- package/bin/chunk-6vkfzzvt.js +5 -0
- package/bin/chunk-7dprpnm6.js +2 -0
- package/bin/chunk-7rycq6wb.js +129 -0
- package/bin/{chunk-26am2rzm.js → chunk-895gzdtp.js} +2 -2
- package/bin/chunk-8d1p8qpv.js +1 -0
- package/bin/chunk-8qdtvfx3.css +1 -0
- package/bin/chunk-8r3k84dh.js +2 -0
- package/bin/{chunk-24da4wg9.js → chunk-99sarrvt.js} +1 -1
- package/bin/{chunk-5y3kx4kk.js → chunk-9s0k533c.js} +1 -1
- package/bin/{chunk-b6dbqs39.js → chunk-acmr8v0d.js} +1 -1
- package/bin/{chunk-tqdde9bj.js → chunk-agcnbjxk.js} +1 -1
- package/bin/{chunk-y6xyc4wp.js → chunk-ahgq10a7.js} +2 -2
- package/bin/{chunk-b3tkvdfk.js → chunk-am6dg0a5.js} +2 -2
- package/bin/chunk-b21z62fj.js +1 -0
- package/bin/{chunk-zsg61vr0.js → chunk-b7qs7hxg.js} +2 -2
- package/bin/{chunk-8ts3xkme.js → chunk-b9d8xdhb.js} +1 -1
- package/bin/{chunk-rq2h2bwt.js → chunk-bg6waaf9.js} +2 -2
- package/bin/{chunk-sbyyn9yw.js → chunk-bs6saf4d.js} +2 -2
- package/bin/{chunk-b88tdt79.js → chunk-bv589v2m.js} +2 -2
- package/bin/{chunk-qjdvs1s5.js → chunk-c60j1b4w.js} +1 -1
- package/bin/{chunk-q7t5zs7n.js → chunk-c6f8x05m.js} +2 -2
- package/bin/chunk-c8kjpmfe.js +2 -0
- package/bin/chunk-c9xyejnk.js +2 -0
- package/bin/{chunk-srv5kvm4.js → chunk-cb9peqy5.js} +1 -1
- package/bin/chunk-ckczqmrz.js +5 -0
- package/bin/chunk-cr33cs6j.js +2 -0
- package/bin/chunk-cxet91kt.js +2 -0
- package/bin/{chunk-hy5ncvpf.js → chunk-d18v5vmp.js} +2 -2
- package/bin/{chunk-xdrpahym.js → chunk-d4hk62q2.js} +4 -4
- package/bin/{chunk-j420aqk8.js → chunk-d7e351jd.js} +3 -3
- package/bin/{chunk-ppb4aj0y.js → chunk-dfecgpce.js} +12 -12
- package/bin/chunk-ebcfbn00.js +2 -0
- package/bin/chunk-f0b4a9y3.js +2 -0
- package/bin/{chunk-2pt9h882.js → chunk-fkn6f4qt.js} +3 -3
- package/bin/chunk-fre31bhw.js +2 -0
- package/bin/{chunk-fxg81vtx.js → chunk-fxtzy5f5.js} +2 -2
- package/bin/{chunk-k3ds96cb.js → chunk-g78vapcm.js} +2 -2
- package/bin/{chunk-q4qqmes7.js → chunk-gdpfwxea.js} +2 -2
- package/bin/chunk-gwqqq0b1.js +32 -0
- package/bin/chunk-h3cwf9aw.js +2 -0
- package/bin/{chunk-cvfznrnt.js → chunk-h4ty530v.js} +5 -5
- package/bin/{chunk-p7zw53ep.js → chunk-h58yfx7w.js} +1 -1
- package/bin/chunk-h6f2gyt5.js +3 -0
- package/bin/chunk-h9ngpxyd.js +1 -0
- package/bin/chunk-hbr17jvr.js +13 -0
- package/bin/{chunk-4bc3gqmn.js → chunk-hc0xbmtt.js} +2 -2
- package/bin/{chunk-68xsb3t8.js → chunk-ht5rht98.js} +2 -2
- package/bin/{chunk-hn2g40r6.js → chunk-hzv1mhr5.js} +1 -1
- package/bin/{chunk-909h3qzp.js → chunk-j9t7tvt5.js} +2 -2
- package/bin/{chunk-m41tbrvt.js → chunk-jb8vbeb0.js} +2 -2
- package/bin/{chunk-wperd2h9.js → chunk-jq3pq545.js} +2 -2
- package/bin/{chunk-9ca8a5f2.js → chunk-jvt8q0eg.js} +1 -1
- package/bin/chunk-jzgtthsj.js +3 -0
- package/bin/chunk-jzjhg7ng.js +1 -0
- package/bin/{chunk-gvcjqcjf.js → chunk-k547syp2.js} +1 -1
- package/bin/chunk-k7sjpke6.js +2 -0
- package/bin/chunk-k8ct1qgv.js +3 -0
- package/bin/chunk-k9q4nn8b.js +11 -0
- package/bin/{chunk-s9sf37dv.js → chunk-keetdtxb.js} +2 -2
- package/bin/chunk-kjjw8mbg.js +1 -0
- package/bin/{chunk-pwq6dbb5.js → chunk-kywdke0y.js} +5 -5
- package/bin/chunk-mey80kv9.js +54 -0
- package/bin/chunk-n412a1hp.js +20 -0
- package/bin/chunk-nfncawpm.js +12 -0
- package/bin/chunk-nvwt8atc.js +1 -0
- package/bin/chunk-p1d500sf.js +211 -0
- package/bin/{chunk-9fyb95r5.js → chunk-p1ed0pa6.js} +1 -1
- package/bin/chunk-q0vs124k.js +2 -0
- package/bin/{chunk-fsr83nb1.js → chunk-q5795f3s.js} +1 -1
- package/bin/{chunk-b5r0be06.js → chunk-q5j3b0h5.js} +2 -2
- package/bin/chunk-qd7pvaxb.js +2 -0
- package/bin/{chunk-s0vfj06y.js → chunk-qhpt7170.js} +1 -1
- package/bin/{chunk-40tmh04g.js → chunk-qqj2m1b1.js} +2 -2
- package/bin/chunk-qt78vs3g.js +2 -0
- package/bin/{chunk-fnkkwna8.js → chunk-r5g84kj4.js} +3 -3
- package/bin/{chunk-59ayg5am.js → chunk-r9gp9yqw.js} +1 -1
- package/bin/chunk-ra6mdjr0.js +1 -0
- package/bin/{chunk-jt6v15wx.js → chunk-ryfvaz6v.js} +2 -2
- package/bin/{chunk-xbw7ffrz.js → chunk-s01p4w8d.js} +2 -2
- package/bin/{chunk-qcpeefhr.js → chunk-s22eapcc.js} +1 -1
- package/bin/chunk-sbg86tch.js +2 -0
- package/bin/chunk-sbqy6m8t.js +1 -0
- package/bin/{chunk-ncv8v6mj.js → chunk-sd6w0z6a.js} +2 -2
- package/bin/chunk-sdp9w627.js +14 -0
- package/bin/chunk-sn0nypvd.js +42 -0
- package/bin/chunk-sv92vkyh.js +2 -0
- package/bin/{chunk-mzme3m82.js → chunk-swz6v48q.js} +1 -1
- package/bin/{chunk-a8bymrv1.js → chunk-t6cn018t.js} +2 -2
- package/bin/{chunk-4nkwe7dz.js → chunk-ts4d1mxf.js} +2 -2
- package/bin/{chunk-cdk8vqeg.js → chunk-w4ydfy9d.js} +2 -2
- package/bin/chunk-wkdkc12e.js +4 -0
- package/bin/chunk-wsprap60.js +3 -0
- package/bin/chunk-xgnvktq6.js +10 -0
- package/bin/{chunk-2rrcdhkj.js → chunk-xjw3mpvx.js} +1 -1
- package/bin/{chunk-qqapw198.js → chunk-xsfy8hz3.js} +1 -1
- package/bin/chunk-xznq2axj.js +1 -0
- package/bin/chunk-y4v08wq7.js +1 -0
- package/bin/chunk-yncvy335.js +3 -0
- package/bin/chunk-ytzddcj2.js +1 -0
- package/bin/{chunk-03zkxckm.js → chunk-zxqasmvz.js} +1 -1
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +466 -458
- package/package.json +8 -11
- package/bin/chunk-04nqnkzs.js +0 -4
- package/bin/chunk-157axqz1.js +0 -1
- package/bin/chunk-1tesbv8w.js +0 -2
- package/bin/chunk-24nx3krz.js +0 -2
- package/bin/chunk-2w2bknn2.js +0 -10
- package/bin/chunk-3ahax79y.js +0 -11
- package/bin/chunk-3fjgf7eb.js +0 -3
- package/bin/chunk-3wcvema0.js +0 -32
- package/bin/chunk-45p7d22e.js +0 -2
- package/bin/chunk-461gcgrs.js +0 -2
- package/bin/chunk-5ebb2pdf.js +0 -5
- package/bin/chunk-6hs63sva.js +0 -42
- package/bin/chunk-6sq6dfa1.js +0 -3
- package/bin/chunk-87secbzy.js +0 -1
- package/bin/chunk-8pykp70z.js +0 -1
- package/bin/chunk-axeq2pq5.js +0 -2
- package/bin/chunk-bcyvxp1c.js +0 -12
- package/bin/chunk-bn0taqr3.js +0 -3
- package/bin/chunk-cb37q6t0.js +0 -1
- package/bin/chunk-cfqny70c.js +0 -3
- package/bin/chunk-cqnected.js +0 -2
- package/bin/chunk-d1q1tn36.js +0 -1
- package/bin/chunk-d1rjpbgv.js +0 -2
- package/bin/chunk-eshwjf91.js +0 -2
- package/bin/chunk-fa9yq17g.js +0 -129
- package/bin/chunk-fznchvm7.js +0 -1
- package/bin/chunk-g2z0c39g.js +0 -1
- package/bin/chunk-gnt9gewm.js +0 -2
- package/bin/chunk-hbnpx0a5.js +0 -1
- package/bin/chunk-hgy9rqt1.js +0 -1
- package/bin/chunk-hk659cg2.css +0 -1
- package/bin/chunk-k97axrc4.js +0 -13
- package/bin/chunk-m9f21ye9.js +0 -1
- package/bin/chunk-md7pgk86.js +0 -2
- package/bin/chunk-me3zmpj5.js +0 -14
- package/bin/chunk-mg6sybt0.js +0 -1
- package/bin/chunk-n08h1jgx.js +0 -2
- package/bin/chunk-np39aknv.js +0 -2
- package/bin/chunk-q1gfypy3.js +0 -2
- package/bin/chunk-qx553512.js +0 -211
- package/bin/chunk-r3s1x5wp.js +0 -1
- package/bin/chunk-s6g2mzpn.js +0 -2
- package/bin/chunk-sjbvt3wa.js +0 -2
- package/bin/chunk-srmx5z3v.js +0 -3
- package/bin/chunk-t1h12r3q.js +0 -54
- package/bin/chunk-t6myw0jf.js +0 -2
- package/bin/chunk-t8jfp3vx.js +0 -1
- package/bin/chunk-v5hz09a1.js +0 -3
- package/bin/chunk-vk9ecq8n.js +0 -2
- package/bin/chunk-w4adkd0a.js +0 -20
- package/bin/chunk-xfmnfcv2.js +0 -5
- package/bin/chunk-xhngtwn9.js +0 -1
- package/bin/chunk-xjnehexk.js +0 -2
- package/bin/chunk-xzb0t8mx.js +0 -1
- package/bin/chunk-zpk87b33.js +0 -11
- package/bin/chunk-zts21ft7.js +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qe}from"./chunk-t6cn018t.js";var cs={};qe(cs,{bigint:()=>_a,boolean:()=>Ec,date:()=>ga,number:()=>Pm,string:()=>Rm});function Fe(t){let o=Object.values(t).filter((c)=>typeof c==="number");return Object.entries(t).filter(([c,u])=>o.indexOf(+c)===-1).map(([c,u])=>u)}function ft(t,o="|"){return t.map((n)=>ht(n)).join(o)}function we(t,o){if(typeof o==="bigint")return o.toString();return o}function ke(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function eo(t){return t===null||t===void 0}function Ue(t){let o=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(o,n)}function to(t,o){let n=t/o,c=Math.round(n),u=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-c)<u)return 0;return n-c}var Qr=Symbol("evaluating");function ro(t,o,n){let c=void 0;Object.defineProperty(t,o,{get(){if(c===Qr)return;if(c===void 0)c=Qr,c=n();return c},set(u){Object.defineProperty(t,o,{value:u})},configurable:!0})}function L(t,o,n){Object.defineProperty(t,o,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ae(...t){let o={};for(let n of t){let c=Object.getOwnPropertyDescriptors(n);Object.assign(o,c)}return Object.defineProperties({},o)}function oo(t){return JSON.stringify(t)}function no(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var dt="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ge(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var io=ke(()=>{if(B.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(t){return!1}});function me(t){if(ge(t)===!1)return!1;let o=t.constructor;if(o===void 0)return!0;if(typeof o!=="function")return!0;let n=o.prototype;if(ge(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function mt(t){if(me(t))return{...t};if(Array.isArray(t))return[...t];if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);return t}var so=new Set(["string","number","symbol"]);function le(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(t,o,n){let c=new t._zod.constr(o??t._zod.def);if(!o||n?.parent)c._zod.parent=t;return c}function P(t){let o=t;if(!o)return{};if(typeof o==="string")return{error:()=>o};if(o?.message!==void 0){if(o?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");o.error=o.message}if(delete o.message,typeof o.error==="string")return{...o,error:()=>o.error};return o}function ht(t){if(typeof t==="bigint")return t.toString()+"n";if(typeof t==="string")return`"${t}"`;return`${t}`}function co(t){return Object.keys(t).filter((o)=>t[o]._zod.optin!==void 0&&t[o]._zod.optout==="optional")}var uo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))();function Zc(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={};for(let m of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,m))throw Error(`Unrecognized key: "${String(m)}"`);if(!o[m])continue;L(f,m,n.shape[m])}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Pc(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={...t._zod.def.shape};for(let m of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,m))throw Error(`Unrecognized key: "${String(m)}"`);if(!o[m])continue;delete f[m]}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Oc(t,o){if(!me(o))throw Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let p=t._zod.def.shape;for(let f of Reflect.ownKeys(o))if(Object.getOwnPropertyDescriptor(p,f)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let u=ae(t._zod.def,{get shape(){let p={...t._zod.def.shape,...o};return L(this,"shape",p),p}});return Y(t,u)}function Ic(t,o){if(!me(o))throw Error("Invalid input to safeExtend: expected a plain object");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o};return L(this,"shape",c),c}});return Y(t,n)}function Tc(t,o){if(!o?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o._zod.def.shape};return L(this,"shape",c),c},get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return Y(t,n)}function ao(t,o,n,c="partial"){let p=o._zod.def.checks;if(p&&p.length>0)throw Error(`.${c}() cannot be used on object schemas containing refinements`);let m=ae(o._zod.def,{get shape(){let _=o._zod.def.shape,g={..._};if(n)for(let b of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(_,b))throw Error(`Unrecognized key: "${String(b)}"`);if(!n[b])continue;g[b]=t?new t({type:"optional",innerType:_[b]}):_[b]}else for(let b of Reflect.ownKeys(_))g[b]=t?new t({type:"optional",innerType:_[b]}):_[b];return L(this,"shape",g),g},checks:[]});return Y(o,m)}function Ac(t,o,n){let c=ae(o._zod.def,{get shape(){let u=o._zod.def.shape,p={...u};if(n)for(let f of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(p,f))throw Error(`Unrecognized key: "${String(f)}"`);if(!n[f])continue;p[f]=new t({type:"nonoptional",innerType:u[f]})}else for(let f of Reflect.ownKeys(u))p[f]=new t({type:"nonoptional",innerType:u[f]});return L(this,"shape",p),p}});return Y(o,c)}function he(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function lo(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue===!1)return!0;return!1}function Q(t,o){return o.map((n)=>{var c;return(c=n).path??(c.path=[]),n.path.unshift(t),n})}function $e(t){return typeof t==="string"?t:t?.message}function _t(t,o,n){var c;for(let u=o;u<t.length;u++)(c=t[u]).schema??(c.schema=n)}function oe(t,o,n){var c;let u=t.inst?._zod?.traits;if(u?.has("$ZodType"))if(u.has("$ZodCheck"))(c=t).schema??(c.schema=t.inst);else t.schema=t.inst;let p=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,f=t.message?t.message:$e(t.inst?._zod.def?.error?.(t))??$e(p?.(t))??$e(o?.error?.(t))??$e(n.customError?.(t))??$e(n.localeError?.(t))??"Invalid input",{inst:m,schema:_,continue:g,input:b,...v}=t;if(v.path??(v.path=[]),v.message=f,o?.reportInput)v.input=b;return v}var Nc=/[\uD800-\uDBFF]/;function Me(t){let o=t.length;if(!Nc.test(t))return o;let n=o;for(let c=0;c<o-1;c++)if((t.charCodeAt(c)&64512)===55296&&(t.charCodeAt(c+1)&64512)===56320)n--,c++;return n}function Je(t){if(Array.isArray(t))return"array";if(typeof t==="string")return"string";return"unknown"}function po(t){let o=typeof t;switch(o){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return o}function _e(...t){let[o,n,c]=t;if(typeof o==="string")return{message:o,code:"custom",input:n,inst:c};return{...o}}function fo(t,o){for(let n in o){let c=Object.getOwnPropertyDescriptor(o,n);if(c.get)Object.defineProperty(t,n,{...c,enumerable:!1});else Cc(t,n,c.value)}}function de(t,o,n,c=!0){return Object.defineProperty(t,o,{configurable:!0,writable:!0,enumerable:c,value:n}),n}function gt(t,o,n){return de(t,o,n,!1)}function Cc(t,o,n){Object.defineProperty(t,o,{configurable:!0,get(){return this==null?n:de(this,o,n.bind(this))},set(c){de(this,o,c)}})}function jc(t,o){let n=Object.getPrototypeOf(t);return o in n?void 0:n}var pt,ue=!1,Rc={configurable:!0,get(){ue=!0;return}};function I(t,o,n){let c=Object.getPrototypeOf(t._zod);if(o in c&&pt!==t._zod){pt=void 0;return}pt=t._zod,Object.defineProperty(c,o,{configurable:!0,get(){Object.defineProperty(this,o,Rc);let u=ue;ue=!1;try{let p=n(this);if(ue)delete this[o];else Object.defineProperty(this,o,{configurable:!0,writable:!0,value:p});return ue=ue||u,p}catch(p){throw delete this[o],ue=ue||u,p}},set(u){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:u})}})}function Dc(t,o,n,c){let u=jc(t,o);if(!u)return;Object.defineProperty(u,o,{configurable:!0,get(){let p={configurable:!0,writable:!0,enumerable:c,value:void 0};return Object.defineProperty(this,o,p),p.value=n(this),Object.defineProperty(this,o,p),p.value},set(p){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:c,value:p})}})}var Lc="~constantCatch";function mo(t){let o=()=>t;return o[Lc]=!0,o}var ho,jr=Object.freeze({status:"aborted"}),xt={value:void 0,enumerable:!1},go="captureStackTrace"in Error?Error:null;function Fc(t){let o=go;if(o){let n=o.stackTraceLimit;if(typeof n==="number"){try{o.stackTraceLimit=0}catch{return go=null,new t}try{return new t}finally{o.stackTraceLimit=n}}}return new t}function z(t,o,n,c){let u={};function p(w){this.def=w,this.constr=v,this.traits=new Set}p.prototype=u;let f=n,m=f&&new WeakSet;function _(w,k){if(!w._zod){xt.value=new p(k);try{Object.defineProperty(w,"_zod",xt)}finally{xt.value=void 0}}if(w._zod.traits.has(t))return;if(w._zod.traits.add(t),o(w,k),m){let S=Object.getPrototypeOf(w),O=w._zod.constr.prototype,J=S;while(J&&J!==O)J=Object.getPrototypeOf(J);let q=J??S;if(!m.has(q))m.add(q),fo(q,f)}let Z=v.prototype;for(let S in Z){if(!Object.prototype.hasOwnProperty.call(Z,S))continue;if(!(S in w))w[S]=Z[S].bind(w)}}let g=c?.Parent??Object;class b extends g{}Object.defineProperty(b,"name",{value:t});function v(w){let k=c?.Parent?Fc(b):this;_(k,w);let Z=k._zod.deferred;if(Z){for(let O of Z)O();k._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(k);return k}return Object.defineProperty(v,"init",{value:_}),Object.defineProperty(v,Symbol.hasInstance,{value:(w)=>{if(c?.Parent&&w instanceof c.Parent)return!0;return w?._zod?.traits?.has(t)}}),Object.defineProperty(v,"name",{value:t}),v}class ne extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ze extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`);this.name="ZodEncodeError"}}(ho=globalThis).__zod_globalConfig??(ho.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function W(t){if(t)Object.assign(B,t);return B}function Uc(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,we,2)),t.message}function Mc(t){this._zod.message=t}var Jc={get:Uc,set:Mc,enumerable:!0,configurable:!0},bt={value:void 0,enumerable:!1},zt={value:void 0,enumerable:!1},xo=new WeakSet([Object.prototype,Error.prototype]),yo=(t,o)=>{t.name="$ZodError",bt.value=t._zod,Object.defineProperty(t,"_zod",bt),zt.value=o,Object.defineProperty(t,"issues",zt),bt.value=void 0,zt.value=void 0,Object.defineProperty(t,"message",Jc);let n=Object.getPrototypeOf(t);if(!xo.has(n))xo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let c=()=>this.message;return Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0})}})},ii=z("$ZodError",yo),vt=z("$ZodError",yo,void 0,{Parent:Error});function Bc(t,o,n){if(!Object.prototype.hasOwnProperty.call(t,o))if(o==="__proto__")Object.defineProperty(t,o,{value:n(),writable:!0,enumerable:!0,configurable:!0});else t[o]=n();return t[o]}function $t(t,o=(n)=>n.message){let n={},c=[];for(let u of t.issues)if(u.path.length>0)Bc(n,u.path[0],()=>[]).push(o(u));else c.push(o(u));return{formErrors:c,fieldErrors:n}}function wt(t,o=(n)=>n.message){let n={_errors:[]},c=(u,p=[])=>{for(let f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map((m)=>c({issues:m},[...p,...f.path]));else if(f.code==="invalid_key")c({issues:f.issues},[...p,...f.path]);else if(f.code==="invalid_element")c({issues:f.issues},[...p,...f.path]);else{let m=[...p,...f.path];if(m.length===0)n._errors.push(o(f));else{let _=n,g=0;while(g<m.length){let b=m[g],v=g===m.length-1;if(b==="_errors"){if(v)_._errors.push(o(f));g++;continue}if(!Object.prototype.hasOwnProperty.call(_,b))Object.defineProperty(_,b,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let w=_[b];if(v)w._errors.push(o(f));_=w,g++}}}};return c(t),n}function Vc(t){let o=[],n=t.map((c)=>typeof c==="object"?c.key:c);for(let c of n)if(typeof c==="number")o.push(`[${c}]`);else if(typeof c==="symbol")o.push(`[${JSON.stringify(String(c))}]`);else if(/[^\w$]/.test(c))o.push(`[${JSON.stringify(c)}]`);else{if(o.length)o.push(".");o.push(c)}return o.join("")}function vf(t){let o=[],n=[...t.issues].sort((c,u)=>(c.path??[]).length-(u.path??[]).length);for(let c of n)if(o.push(`\u2716 ${c.message}`),c.path?.length)o.push(` \u2192 at ${Vc(c.path)}`);return o.join(`
|
|
3
|
+
`)}function Be(t,o){return{callee:o?.callee??t,Err:o?.Err}}var Ve=(t)=>{let o=(n,c,u,p)=>{let f=u?{...u,async:!1}:{async:!1},m=n._zod.run({value:c,issues:[]},f);if(m instanceof Promise)throw new ne;if(m.issues.length){let _=new(p?.Err??t)(m.issues.map((g)=>oe(g,f,W())));throw dt(_,p?.callee??o),_}return m.value};return o};var Ke=(t)=>{let o=async(n,c,u,p)=>{let f=u?{...u,async:!0}:{async:!0},m=n._zod.run({value:c,issues:[]},f);if(m instanceof Promise)m=await m;if(m.issues.length){let _=new(p?.Err??t)(m.issues.map((g)=>oe(g,f,W())));throw dt(_,p?.callee??o),_}return m.value};return o};var Pe=(t)=>(o,n,c)=>{let u=c?{...c,async:!1}:{async:!1},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)throw new ne;return p.issues.length?{success:!1,error:new(t??ii)(p.issues.map((f)=>oe(f,u,W())))}:{success:!0,data:p.value}},bo=Pe(vt),Oe=(t)=>async(o,n,c)=>{let u=c?{...c,async:!0}:{async:!0},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)p=await p;return p.issues.length?{success:!1,error:new t(p.issues.map((f)=>oe(f,u,W())))}:{success:!0,data:p.value}},zo=Oe(vt);var vo=(t)=>{let o=Ve(t),n=(c,u,p,f)=>{let m=p?{...p,direction:"backward"}:{direction:"backward"};return o(c,u,m,Be(n,f))};return n};var $o=(t)=>{let o=Ve(t),n=(c,u,p,f)=>o(c,u,p,Be(n,f));return n};var wo=(t)=>{let o=Ke(t),n=async(c,u,p,f)=>{let m=p?{...p,direction:"backward"}:{direction:"backward"};return await o(c,u,m,Be(n,f))};return n};var ko=(t)=>{let o=Ke(t),n=async(c,u,p,f)=>await o(c,u,p,Be(n,f));return n};var Zo=(t)=>(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Pe(t)(o,n,u)};var Po=(t)=>(o,n,c)=>Pe(t)(o,n,c);var So=(t)=>async(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Oe(t)(o,n,u)};var Oo=(t)=>async(o,n,c)=>Oe(t)(o,n,c);var Io=/^[cC][0-9a-z]{6,}$/,Eo=/^[0-9a-z]+$/,To=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,No=/^[0-9a-vA-V]{20}$/,Co=/^[A-Za-z0-9]{27}$/,jo=/^[a-zA-Z0-9_-]{21}$/;function Ro(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}var Do=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Lo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zt=(t)=>{if(!t)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Fo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wc="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Uo(){return new RegExp(Wc,"u")}var Mo=/^(?:(?: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])$/,Jo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Bo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ko=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pt=/^[A-Za-z0-9_-]*$/;var Wo=/^https?$/,Go=/^\+[1-9]\d{6,14}$/;var qo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Gc(t){return new RegExp(`^${t}$`)}var Yo=Gc(qo);function kt(t){return typeof t.precision==="number"?t.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":t.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xo(t){return new RegExp(`^${kt(t)}$`)}function Ho(t){let o=["Z"];if(t.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${kt({precision:t.precision,seconds:!0})}(?:${o.join("|")})`,c=t.local?`${n}|${kt({precision:t.precision})}`:n;return new RegExp(`^${qo}T(?:${c})$`)}var Qo=(t)=>{let o=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${o}$`)},en=/^-?\d+n?$/,We=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,rn=/^null$/i;var on=/^[^A-Z]*$/,nn=/^[^a-z]*$/;var M=z("$ZodCheck",(t,o)=>{var n;t._zod??(t._zod={}),t._zod.def=o,(n=t._zod).onattach??(n.onattach=[])});var Ot=(t)=>{let o=t.value;return!eo(o)&&o.length!==void 0},Ge={number:"number",bigint:"bigint",object:"date"},It=z("$ZodCheckLessThan",(t,o)=>{M.init(t,o);let n=Ge[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(o.value<p)if(o.inclusive)u.maximum=o.value;else u.exclusiveMaximum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value<=o.value:c.value<o.value)return;c.issues.push({origin:Ge[typeof c.value]??n,code:"too_big",maximum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),Et=z("$ZodCheckGreaterThan",(t,o)=>{M.init(t,o);let n=Ge[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(o.value>p)if(o.inclusive)u.minimum=o.value;else u.exclusiveMinimum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value>=o.value:c.value>o.value)return;c.issues.push({origin:Ge[typeof c.value]??n,code:"too_small",minimum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),sn=z("$ZodCheckMultipleOf",(t,o)=>{M.init(t,o),t._zod.onattach.push((n)=>{var c;(c=n._zod.bag).multipleOf??(c.multipleOf=o.value)}),t._zod.check=(n)=>{if(typeof n.value!==typeof o.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?o.value!==BigInt(0)&&n.value%o.value===BigInt(0):to(n.value,o.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:o.value,input:n.value,inst:t,continue:!o.abort})}}),cn=z("$ZodCheckNumberFormat",(t,o)=>{M.init(t,o),o.format=o.format||"float64";let n=o.format?.includes("int"),c=n?"int":"number",[u,p]=uo[o.format];t._zod.onattach.push((f)=>{let m=f._zod.bag;if(m.format=o.format,m.minimum=u,m.maximum=p,n)m.pattern=We}),t._zod.check=(f)=>{let m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:c,format:o.format,code:"invalid_type",continue:!1,input:m,inst:t});return}if(!Number.isSafeInteger(m)){if(m>0)f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});else f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});return}}if(m<u)f.issues.push({origin:"number",input:m,code:"too_small",minimum:u,inclusive:!0,inst:t,continue:!o.abort});if(m>p)f.issues.push({origin:"number",input:m,code:"too_big",maximum:p,inclusive:!0,inst:t,continue:!o.abort})}});var un=z("$ZodCheckMaxLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=Ot),t._zod.onattach.push((c)=>{let u=c._zod.bag.maximum??Number.POSITIVE_INFINITY;if(o.maximum<u)c._zod.bag.maximum=o.maximum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>o.maximum?Me(u):p)<=o.maximum)return;let m=Je(u);c.issues.push({origin:m,code:"too_big",maximum:o.maximum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),an=z("$ZodCheckMinLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=Ot),t._zod.onattach.push((c)=>{let u=c._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(o.minimum>u)c._zod.bag.minimum=o.minimum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>=o.minimum&&p<o.minimum*2?Me(u):p)>=o.minimum)return;let m=Je(u);c.issues.push({origin:m,code:"too_small",minimum:o.minimum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),ln=z("$ZodCheckLengthEquals",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=Ot),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.minimum=o.length,u.maximum=o.length,u.length=o.length}),t._zod.check=(c)=>{let u=c.value,p=u.length,f=typeof u==="string"&&p>=o.length&&p<=o.length*2?Me(u):p;if(f===o.length)return;let m=Je(u),_=f>o.length;c.issues.push({origin:m,..._?{code:"too_big",maximum:o.length}:{code:"too_small",minimum:o.length},inclusive:!0,exact:!0,input:c.value,inst:t,continue:!o.abort})}}),Ee=z("$ZodCheckStringFormat",(t,o)=>{var n,c;if(M.init(t,o),t._zod.onattach.push((u)=>{let p=u._zod.bag;if(p.format=o.format,o.pattern)p.patterns??(p.patterns=new Set),p.patterns.add(o.pattern)}),o.pattern)(n=t._zod).check??(n.check=(u)=>{if(o.pattern.lastIndex=0,o.pattern.test(u.value))return;u.issues.push({origin:"string",code:"invalid_format",format:o.format,input:u.value,...o.pattern?{pattern:o.pattern.toString()}:{},inst:t,continue:!o.abort})});else(c=t._zod).check??(c.check=()=>{})}),pn=z("$ZodCheckRegex",(t,o)=>{Ee.init(t,o),t._zod.check=(n)=>{if(o.pattern.lastIndex=0,o.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:o.pattern.toString(),inst:t,continue:!o.abort})}}),fn=z("$ZodCheckLowerCase",(t,o)=>{o.pattern??(o.pattern=on),Ee.init(t,o)}),dn=z("$ZodCheckUpperCase",(t,o)=>{o.pattern??(o.pattern=nn),Ee.init(t,o)}),mn=z("$ZodCheckIncludes",(t,o)=>{M.init(t,o);let n=le(o.includes),c=new RegExp(typeof o.position==="number"?`^.{${o.position},}${n}`:n);o.pattern=c,t._zod.onattach.push((u)=>{let p=u._zod.bag;p.patterns??(p.patterns=new Set),p.patterns.add(c)}),t._zod.check=(u)=>{if(u.value.includes(o.includes,o.position))return;u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:o.includes,input:u.value,inst:t,continue:!o.abort})}}),hn=z("$ZodCheckStartsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`^${le(o.prefix)}.*`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.startsWith(o.prefix))return;c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:o.prefix,input:c.value,inst:t,continue:!o.abort})}}),_n=z("$ZodCheckEndsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`.*${le(o.suffix)}$`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.endsWith(o.suffix))return;c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:o.suffix,input:c.value,inst:t,continue:!o.abort})}});var gn=z("$ZodCheckOverwrite",(t,o)=>{M.init(t,o),t._zod.check=(n)=>{n.value=o.tx(n.value)}});class Tt{constructor(t=[],o={}){this.content=[],this.indent=0,this.args=t,this.closed=o}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t==="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
4
|
+
`).filter((p)=>p),c=Math.min(...n.map((p)=>p.length-p.trimStart().length)),u=n.map((p)=>p.slice(c)).map((p)=>" ".repeat(this.indent*2)+p);for(let p of u)this.content.push(p)}compile(){let t=Function,o=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
5
|
+
${o.join(`
|
|
6
|
+
`)}
|
|
7
|
+
};`)(...Object.values(this.closed))}}var yn={major:4,minor:5,patch:4};var E=z("$ZodType",(t,o)=>{var n;t??(t={}),t._zod.def=o,t._zod.bag=t._zod.bag||{},t._zod.version=yn;let c=t._zod.def.checks,u=t._zod.traits.has("$ZodCheck")?[t,...c??[]]:c?.length?[...c]:[];for(let p of u)for(let f of p._zod.onattach)f(t);if(u.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let p=(m,_,g)=>{if(m.memo)return m;let b=he(m),v;for(let w of _){if(w._zod.def.when){if(lo(m))continue;if(!w._zod.def.when(m))continue}else if(b)continue;let k=m.issues.length,Z=w._zod.check(m);if(Z instanceof Promise&&g?.async===!1)throw new ne;if(v||Z instanceof Promise)v=(v??Promise.resolve()).then(async()=>{if(await Z,m.issues.length===k)return;if(_t(m.issues,k,t),!b)b=he(m,k)});else{if(m.issues.length===k)continue;if(_t(m.issues,k,t),!b)b=he(m,k)}}if(v)return v.then(()=>m);return m},f=(m,_,g)=>{if(he(m))return m.aborted=!0,m;let b=p(_,u,g);if(b instanceof Promise){if(g.async===!1)throw new ne;return b.then((v)=>t._zod.parse(v,g))}return t._zod.parse(b,g)};t._zod.run=(m,_)=>{if(_.skipChecks)return t._zod.parse(m,_);if(_.direction==="backward"){let b=t._zod.parse({value:m.value,issues:[]},{..._,skipChecks:!0});if(b instanceof Promise)return b.then((v)=>f(v,m,_));return f(b,m,_)}let g=t._zod.parse(m,_);if(g instanceof Promise){if(_.async===!1)throw new ne;return g.then((b)=>p(b,u,_))}return p(g,u,_)}}},{get "~standard"(){return gt(this,"~standard",jt(this))},set "~standard"(t){de(this,"~standard",t)}}),bn=(t)=>t.success?{value:t.data}:{issues:t.error?.issues};function jt(t){return{validate:(o)=>{try{return bn(bo(t,o))}catch(n){return zo(t,o).then(bn)}},vendor:"zod",version:1}}var He=z("$ZodString",(t,o)=>{E.init(t,o),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Qo(t._zod.bag),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=String(n.value)}catch(u){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),j=z("$ZodStringFormat",(t,o)=>{Ee.init(t,o),He.init(t,o)}),An=z("$ZodGUID",(t,o)=>{o.pattern??(o.pattern=Lo),j.init(t,o)}),Nn=z("$ZodUUID",(t,o)=>{if(o.version){let c={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[o.version];if(c===void 0)throw Error(`Invalid UUID version: "${o.version}"`);o.pattern??(o.pattern=Zt(c))}else o.pattern??(o.pattern=Zt());j.init(t,o)}),Cn=z("$ZodEmail",(t,o)=>{o.pattern??(o.pattern=Fo),j.init(t,o)}),jn=1,Rn=2;function qc(t,o){if(!o.normalize&&o.protocol?.source===Wo.source&&!/^https?:\/\//i.test(t))return jn;try{return new URL(t)}catch{return Rn}}var Yc=/[\t\n\r]/g;function Xc(t){return t.replace(Yc,"")}function Hc(t,o){return o.lastIndex=0,o.test(t.hostname)}function Qc(t,o){return o.lastIndex=0,o.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}var Dn=z("$ZodURL",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{try{let c=n.value.trim(),u=qc(c,o);if(u===jn){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!o.abort});return}if(u===Rn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort});return}if(o.hostname&&!Hc(u,o.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:o.hostname.source,input:n.value,inst:t,continue:!o.abort});if(o.protocol&&!Qc(u,o.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:o.protocol.source,input:n.value,inst:t,continue:!o.abort});n.value=o.normalize?u.href:Xc(c);return}catch(c){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort})}}}),Ln=z("$ZodEmoji",(t,o)=>{o.pattern??(o.pattern=Uo()),j.init(t,o)}),Fn=z("$ZodNanoID",(t,o)=>{if(o.length!==void 0&&(!Number.isInteger(o.length)||o.length<1))throw Error(`Invalid nanoid length: ${o.length}`);o.pattern??(o.pattern=o.length===void 0?jo:Ro(o.length)),j.init(t,o)}),Un=z("$ZodCUID",(t,o)=>{o.pattern??(o.pattern=Io),j.init(t,o)}),Mn=z("$ZodCUID2",(t,o)=>{o.pattern??(o.pattern=Eo),j.init(t,o)}),Jn=z("$ZodULID",(t,o)=>{o.pattern??(o.pattern=To),j.init(t,o)}),Bn=z("$ZodXID",(t,o)=>{o.pattern??(o.pattern=No),j.init(t,o)}),Vn=z("$ZodKSUID",(t,o)=>{o.pattern??(o.pattern=Co),j.init(t,o)}),Kn=z("$ZodISODateTime",(t,o)=>{if(o.pattern??(o.pattern=Ho(o)),j.init(t,o),o.local||o.precision===-1)t._zod.bag.laxFormat=!0,t._zod.onattach.push((n)=>{n._zod.bag.laxFormat=!0})}),Wn=z("$ZodISODate",(t,o)=>{o.pattern??(o.pattern=Yo),j.init(t,o)}),Gn=z("$ZodISOTime",(t,o)=>{o.pattern??(o.pattern=Xo(o)),j.init(t,o)}),qn=z("$ZodISODuration",(t,o)=>{o.pattern??(o.pattern=Do),j.init(t,o)}),Yn=z("$ZodIPv4",(t,o)=>{o.pattern??(o.pattern=Mo),j.init(t,o),t._zod.bag.format="ipv4"}),eu=/^[0-9a-fA-F:.]+$/;function Xn(t){if(!eu.test(t))return!1;try{return new URL(`http://[${t}]`),!0}catch{return!1}}var Hn=z("$ZodIPv6",(t,o)=>{o.pattern??(o.pattern=Jo),j.init(t,o),t._zod.bag.format="ipv6",t._zod.check=(n)=>{if(!Xn(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!o.abort})}});var Qn=z("$ZodCIDRv4",(t,o)=>{o.pattern??(o.pattern=Bo),j.init(t,o)});function tu(t){let o=t.split("/");if(o.length!==2)return!1;let[n,c]=o;if(!c)return!1;let u=Number(c);if(`${u}`!==c)return!1;if(u<0||u>128)return!1;return Xn(n)}var ei=z("$ZodCIDRv6",(t,o)=>{o.pattern??(o.pattern=Vo),j.init(t,o),t._zod.check=(n)=>{if(!tu(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!o.abort})}});function ti(t){if(t==="")return!0;if(/\s/.test(t))return!1;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ri=z("$ZodBase64",(t,o)=>{o.pattern??(o.pattern=Ko),j.init(t,o),t._zod.bag.contentEncoding="base64",t._zod.check=(n)=>{if(ti(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!o.abort})}});function ru(t){if(!Pt.test(t))return!1;let o=t.replace(/[-_]/g,(c)=>c==="-"?"+":"/"),n=o.padEnd(Math.ceil(o.length/4)*4,"=");return ti(n)}var oi=z("$ZodBase64URL",(t,o)=>{o.pattern??(o.pattern=Pt),j.init(t,o),t._zod.bag.contentEncoding="base64url",t._zod.check=(n)=>{if(ru(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!o.abort})}}),ni=z("$ZodE164",(t,o)=>{o.pattern??(o.pattern=Go),j.init(t,o)});function ou(t,o=null){try{let n=t.split(".");if(n.length!==3)return!1;let[c]=n;if(!c)return!1;let u=JSON.parse(atob(c));if("typ"in u&&u?.typ!=="JWT")return!1;if(!u.alg)return!1;if(o&&(!("alg"in u)||u.alg!==o))return!1;return!0}catch{return!1}}var si=z("$ZodJWT",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{if(ou(n.value,o.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!o.abort})}});var Lt=z("$ZodNumber",(t,o)=>{E.init(t,o),t._zod.pattern=t._zod.bag.pattern??Ie,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Number(n.value)}catch(f){}let u=n.value;if(typeof u==="number"&&!Number.isNaN(u)&&Number.isFinite(u))return n;let p=typeof u==="number"?Number.isNaN(u)?"NaN":!Number.isFinite(u)?String(u):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:u,inst:t,...p?{received:p}:{}}),n}}),ui=z("$ZodNumberFormat",(t,o)=>{cn.init(t,o),Lt.init(t,o)}),pi=z("$ZodBoolean",(t,o)=>{E.init(t,o),t._zod.pattern=tn,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Boolean(n.value)}catch(p){}let u=n.value;if(typeof u==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:t}),n}}),fi=z("$ZodBigInt",(t,o)=>{E.init(t,o),t._zod.pattern=en,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=BigInt(n.value)}catch(u){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}});var di=z("$ZodNull",(t,o)=>{E.init(t,o),t._zod.pattern=rn,t._zod.values=new Set([null]),t._zod.parse=(n,c)=>{let u=n.value;if(u===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:u,inst:t}),n}}),mi=z("$ZodAny",(t,o)=>{E.init(t,o),t._zod.parse=(n)=>n}),hi=z("$ZodUnknown",(t,o)=>{E.init(t,o),t._zod.parse=(n)=>n}),_i=z("$ZodNever",(t,o)=>{E.init(t,o),t._zod.parse=(n,c)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),gi=z("$ZodVoid",(t,o)=>{E.init(t,o),t._zod.parse=(n,c)=>{let u=n.value;if(typeof u>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:u,inst:t}),n}}),xi=z("$ZodDate",(t,o)=>{E.init(t,o),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=new Date(n.value)}catch(m){}let u=n.value,p=u instanceof Date;if(p&&!Number.isNaN(u.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:u,...p?{received:"Invalid Date"}:{},inst:t}),n}});function zn(t,o,n){if(t.issues.length)o.issues.push(...Q(n,t.issues));o.value[n]=t.value}var yi=z("$ZodArray",(t,o)=>{E.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!Array.isArray(p))return c.issues.push({expected:"array",code:"invalid_type",input:p,inst:t}),c;c.value=n?n.alloc(t,c,Array(p.length),u):Array(p.length);let f=[];for(let m=0;m<p.length;m++){let _=p[m],g=o.element._zod.run({value:_,issues:[]},u);if(g instanceof Promise)f.push(g.then((b)=>zn(b,c,m)));else zn(g,c,m)}if(f.length)return Promise.all(f).then(()=>c);return c}});function Xe(t,o,n,c,u,p){let f=n in c,m=p==="optional";if(!f&&m&&u==="optional")return;if(t.issues.length){if(u!==void 0&&m&&!f)return;o.issues.push(...Q(n,t.issues))}if(!f&&u===void 0){if(!t.issues.length)o.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(t.value===void 0){if(f)o.value[n]=void 0}else o.value[n]=t.value}var nu=[];function bi(t){let o=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),c=n.length?n:nu,u=c.length?[...o,...c]:o;for(let f of u)if(!t.shape?.[f]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(f)}": expected a Zod schema`);let p=co(t.shape);return{...t,allKeys:u,symbolKeys:c,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(p)}}function zi(t,o,n,c,u,p){let f=[],m=u.keySet,_=u.catchall._zod,g=_.def.type,{optin:b,optout:v}=_;for(let w in o){if(m.has(w))continue;if(w==="__proto__"){if(g==="never")f.push(w);continue}if(g==="never"){f.push(w);continue}let k=_.run({value:o[w],issues:[]},c);if(k instanceof Promise)t.push(k.then((Z)=>Xe(Z,n,w,o,b,v)));else Xe(k,n,w,o,b,v)}if(f.length)n.issues.push({code:"unrecognized_keys",keys:f,input:o,inst:p,continue:!0});if(!t.length)return n;return Promise.all(t).then(()=>n)}var At=new WeakMap,iu=z("$ZodObject",(t,o)=>{if(E.init(t,o),!Object.getOwnPropertyDescriptor(o,"shape")?.get){let _=o.shape;At.set(o,_),Object.defineProperty(o,"shape",{get:()=>{let g={..._};return Object.defineProperty(o,"shape",{value:g}),At.set(o,g),g}})}let c=ke(()=>bi(o));I(t,"propValues",(_)=>{let g=_.def.shape,b={};for(let v in g){let w=g[v]._zod;if(w.values){if(!Object.prototype.hasOwnProperty.call(b,v))L(b,v,new Set);for(let k of w.values)b[v].add(k);if(w.optin!==void 0)b[v].add(void 0)}}return b});let u=ge,p=o.catchall,f,m=B.memoizer;m?.attach(t),t._zod.parse=(_,g)=>{f??(f=c.value);let b=_.value;if(!u(b))return _.issues.push({expected:"object",code:"invalid_type",input:b,inst:t}),_;_.value=m?m.alloc(t,_,{},g):{};let v=[],w=f.shape;for(let k of f.allKeys){if(k==="__proto__")continue;let Z=w[k],S=Z._zod.optin,O=Z._zod.optout,J=Z._zod.run({value:b[k],issues:[]},g);if(J instanceof Promise)v.push(J.then((q)=>Xe(q,_,k,b,S,O)));else Xe(J,_,k,b,S,O)}if(!p)return v.length?Promise.all(v).then(()=>_):_;return zi(v,b,_,g,c.value,t)}}),vi=z("$ZodObjectJIT",(t,o)=>{iu.init(t,o);let n=t._zod.parse,c=ke(()=>bi(o)),u=B.memoizer,p=(k)=>{let Z=c.value,S=Z.symbolKeys,O=new Tt(["payload","ctx"],{shape:k,inst:t,memo:u,syms:S}),J=(K)=>`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`,q=(K,R)=>`
|
|
8
|
+
for (let i = 0; i < ${K}.issues.length; i++) {
|
|
9
|
+
const iss = ${K}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${R}, ...iss.path] : [${R}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
}`;O.write("const input = payload.value;");let qr=Object.create(null),$c=0;for(let K of Z.allKeys)qr[K]=`key_${$c++}`;O.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let K of Z.allKeys){if(K==="__proto__")continue;let R=qr[K],H=typeof K==="symbol"?`syms[${S.indexOf(K)}]`:oo(K),lt=`${H} in input`,Yr=k[K],Xr=Yr?._zod?.optin,Hr=Xr!==void 0,wc=Yr?._zod?.optout==="optional";if(O.write(`const ${R} = ${J(H)};`),Hr&&wc){let kc=Xr==="optional"?`${R}_present`:`${R}.value !== undefined || ${R}_present`;O.write(`
|
|
13
|
+
const ${R}_present = ${lt};
|
|
14
|
+
if (!${R}.issues.length || ${R}_present) {
|
|
15
|
+
if (${R}.issues.length) {${q(R,H)}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (${kc}) {
|
|
19
|
+
newResult[${H}] = ${R}.value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
`)}else if(!Hr)O.write(`
|
|
24
|
+
const ${R}_present = ${lt};
|
|
25
|
+
if (${R}.issues.length) {${q(R,H)}
|
|
26
|
+
}
|
|
27
|
+
if (!${R}_present && !${R}.issues.length) {
|
|
28
|
+
payload.issues.push({
|
|
29
|
+
code: "invalid_type",
|
|
30
|
+
expected: "nonoptional",
|
|
31
|
+
input: undefined,
|
|
32
|
+
path: [${H}]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (${R}_present) {
|
|
37
|
+
newResult[${H}] = ${R}.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
`);else O.write(`
|
|
41
|
+
if (${R}.issues.length) {${q(R,H)}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (${R}.value === undefined) {
|
|
45
|
+
if (${lt}) {
|
|
46
|
+
newResult[${H}] = undefined;
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
newResult[${H}] = ${R}.value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
`)}return O.write("payload.value = newResult;"),O.write("return payload;"),O.compile()},f,m=ge,_=!B.jitless,b=_&&io.value,v=o.catchall,w;t._zod.parse=(k,Z)=>{w??(w=c.value);let S=k.value;if(!m(S))return k.issues.push({expected:"object",code:"invalid_type",input:S,inst:t}),k;if(_&&b&&Z?.async===!1&&Z.jitless!==!0){if(!f)f=p(o.shape);if(k=f(k,Z),!v)return k;return zi([],S,k,Z,w,t)}return n(k,Z)}});function vn(t,o,n,c){for(let p of t)if(p.issues.length===0)return o.value=p.value,o;let u=t.filter((p)=>!he(p));if(u.length===1)return o.value=u[0].value,u[0];return o.issues.push({code:"invalid_union",input:o.value,inst:n,errors:t.map((p)=>p.issues.map((f)=>oe(f,c,W())))}),o}var Ft=z("$ZodUnion",(t,o)=>{E.init(t,o),I(t,"optin",(c)=>c.def.options.some((u)=>u._zod.optin==="defaulted")?"defaulted":c.def.options.some((u)=>u._zod.optin!==void 0)?"optional":void 0),I(t,"optout",(c)=>c.def.options.some((u)=>u._zod.optout==="optional")?"optional":void 0),I(t,"values",(c)=>{if(c.def.options.every((u)=>u._zod.values))return new Set(c.def.options.flatMap((u)=>Array.from(u._zod.values)));return}),I(t,"pattern",(c)=>{if(c.def.options.every((u)=>u._zod.pattern)){let u=c.def.options.map((p)=>p._zod.pattern);return new RegExp(`^(${u.map((p)=>Ue(p.source)).join("|")})$`)}return});let n=o.options.length===1?o.options[0]._zod.run:null;t._zod.parse=(c,u)=>{if(n)return n(c,u);let p=!1,f=[];for(let m of o.options){let _=m._zod.run({value:c.value,issues:[]},u);if(_ instanceof Promise)f.push(_),p=!0;else{if(_.issues.length===0)return _;f.push(_)}}if(!p)return vn(f,c,t,u);return Promise.all(f).then((m)=>vn(m,c,t,u))}});var wi=z("$ZodDiscriminatedUnion",(t,o)=>{o.inclusive=!1,Ft.init(t,o);let n=t._zod.parse;I(t,"propValues",(u)=>{let p={};for(let f of u.def.options){let m=f._zod.propValues;if(!m||Object.keys(m).length===0)throw Error(`Invalid discriminated union option at index "${u.def.options.indexOf(f)}"`);for(let[_,g]of Object.entries(m)){if(!Object.prototype.hasOwnProperty.call(p,_))L(p,_,new Set);for(let b of g)p[_].add(b)}}return p}),o.options.forEach((u,p)=>{let f=At.get(u._zod.def);if(f&&!Object.prototype.hasOwnProperty.call(f,o.discriminator))throw Error(`Invalid discriminated union option at index "${p}"`)});let c=ke(()=>{let u=o.options,p=new Map;for(let f of u){let m=f._zod.propValues?.[o.discriminator];if(!m||m.size===0)throw Error(`Invalid discriminated union option at index "${o.options.indexOf(f)}"`);for(let _ of m){if(p.has(_))throw Error(`Duplicate discriminator value "${String(_)}"`);p.set(_,f)}}return p});t._zod.parse=(u,p)=>{let f=u.value;if(!ge(f))return u.issues.push({code:"invalid_type",expected:"object",input:f,inst:t}),u;let m=c.value.get(f?.[o.discriminator]);if(m)return m._zod.run(u,p);if(o.unionFallback||p.direction==="backward")return n(u,p);return u.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:o.discriminator,options:Array.from(c.value.keys()),input:f,path:[o.discriminator],inst:t}),u}}),ki=z("$ZodIntersection",(t,o)=>{E.init(t,o),t._zod.parse=(n,c)=>{let u=n.value,p=o.left._zod.run({value:u,issues:[]},c),f=o.right._zod.run({value:u,issues:[]},c);if(p instanceof Promise||f instanceof Promise)return Promise.all([p,f]).then(([_,g])=>$n(n,_,g));return $n(n,p,f)}});function Nt(t,o){if(t===o)return{valid:!0,data:t};if(t instanceof Date&&o instanceof Date&&+t===+o)return{valid:!0,data:t};if(me(t)&&me(o)){let n=Object.keys(o),c=Object.keys(t).filter((p)=>n.indexOf(p)!==-1),u={...t,...o};if(Object.prototype.hasOwnProperty.call(u,"__proto__"))delete u.__proto__;for(let p of c){if(p==="__proto__")continue;let f=Nt(t[p],o[p]);if(!f.valid)return{valid:!1,mergeErrorPath:[p,...f.mergeErrorPath]};u[p]=f.data}return{valid:!0,data:u}}if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let c=0;c<t.length;c++){let u=t[c],p=o[c],f=Nt(u,p);if(!f.valid)return{valid:!1,mergeErrorPath:[c,...f.mergeErrorPath]};n.push(f.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $n(t,o,n){let c=new Map,u,p=new Map,f=(g,b)=>{let v;if(g.code==="unrecognized_keys"&&!g.path?.length)u??(u=g),v=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){let w=String(g.path[0]);if(!p.has(w))p.set(w,g);v=[w]}else return!1;for(let w of v){if(!c.has(w))c.set(w,{});c.get(w)[b]=!0}return!0};for(let g of o.issues)if(!f(g,"l"))t.issues.push(g);for(let g of n.issues)if(!f(g,"r"))t.issues.push(g);let m=[...c].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(m.length){let g=u?m.filter((b)=>u.keys.includes(b)):[];if(g.length)t.issues.push({...u,keys:g});for(let b of m)if(!g.includes(b)&&p.has(b))t.issues.push(p.get(b))}let _=Nt(o.value,n.value);if(!_.valid){if(he(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(_.mergeErrorPath)}`)}return t.value=_.data,t}var Zi=z("$ZodTuple",(t,o)=>{E.init(t,o);let n=o.items,c=B.memoizer;c?.attach(t),t._zod.parse=(u,p)=>{let f=u.value;if(!Array.isArray(f))return u.issues.push({input:f,inst:t,expected:"tuple",code:"invalid_type"}),u;u.value=c?c.alloc(t,u,[],p):[];let m=[],_=wn(n,"optin"),g=wn(n,"optout");if(!o.rest){if(f.length<_)return u.issues.push({code:"too_small",minimum:_,inclusive:!0,input:f,inst:t,origin:"array"}),u;if(f.length>n.length)u.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:f,inst:t,origin:"array"})}let b=Array(n.length);for(let v=0;v<n.length;v++){let w=n[v]._zod.run({value:f[v],issues:[]},p);if(w instanceof Promise)m.push(w.then((k)=>{b[v]=k}));else b[v]=w}if(o.rest){let v=n.length-1,w=f.slice(n.length);for(let k of w){v++;let Z=o.rest._zod.run({value:k,issues:[]},p);if(Z instanceof Promise)m.push(Z.then((S)=>kn(S,u,v)));else kn(Z,u,v)}}if(m.length)return Promise.all(m).then(()=>Zn(b,u,n,f,g));return Zn(b,u,n,f,g)}});function wn(t,o){for(let n=t.length-1;n>=0;n--)if(!(o==="optin"?t[n]._zod.optin!==void 0:t[n]._zod.optout==="optional"))return n+1;return 0}function kn(t,o,n){if(t.issues.length)o.issues.push(...Q(n,t.issues));o.value[n]=t.value}function Zn(t,o,n,c,u){for(let p=0;p<n.length;p++){let f=t[p],m=p<c.length;if(!m&&p>=u&&n[p]._zod.optin==="optional"){o.value.length=p;break}if(f.issues.length){if(!m&&p>=u){o.value.length=p;break}o.issues.push(...Q(p,f.issues))}o.value[p]=f.value}for(let p=o.value.length-1;p>=c.length;p--)if(n[p]._zod.optout==="optional"&&o.value[p]===void 0)o.value.length=p;else break;return o}var Pi=z("$ZodRecord",(t,o)=>{E.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!me(p))return c.issues.push({expected:"record",code:"invalid_type",input:p,inst:t}),c;let f=[],m=o.keyType._zod.values;if(m&&!o.partial){c.value=n?n.alloc(t,c,{},u):{};let _=new Set;for(let b of m)if(typeof b==="string"||typeof b==="number"||typeof b==="symbol"){if(_.add(typeof b==="number"?b.toString():b),b==="__proto__")continue;let v=o.keyType._zod.run({value:b,issues:[]},u);if(v instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(v.issues.length){c.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map((Z)=>oe(Z,u,W())),input:b,path:[b],inst:t});continue}let w=v.value;if(w==="__proto__")continue;let k=o.valueType._zod.run({value:p[b],issues:[]},u);if(k instanceof Promise)f.push(k.then((Z)=>{if(Z.issues.length)c.issues.push(...Q(b,Z.issues));c.value[w]=Z.value}));else{if(k.issues.length)c.issues.push(...Q(b,k.issues));c.value[w]=k.value}}let g;for(let b in p)if(!_.has(b))if(o.mode==="loose"){if(b==="__proto__")continue;c.value[b]=p[b]}else g=g??[],g.push(b);if(g&&g.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:g,continue:!0})}else{c.value=n?n.alloc(t,c,{},u):{};let _;for(let g of Reflect.ownKeys(p)){if(g==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(p,g))continue;let b=o.keyType._zod.run({value:g,issues:[]},u);if(b instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof g==="string"&&Ie.test(g)&&b.issues.length){let Z=o.keyType._zod.run({value:Number(g),issues:[]},u);if(Z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(Z.issues.length===0)b=Z}if(b.issues.length){if(o.mode==="loose")c.value[g]=p[g];else if(m)_=_??[],_.push(g);else c.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map((Z)=>oe(Z,u,W())),input:g,path:[g],inst:t});continue}let w=b.value;if(w==="__proto__")continue;let k=o.valueType._zod.run({value:p[g],issues:[]},u);if(k instanceof Promise)f.push(k.then((Z)=>{if(Z.issues.length)c.issues.push(...Q(g,Z.issues));c.value[w]=Z.value}));else{if(k.issues.length)c.issues.push(...Q(g,k.issues));c.value[w]=k.value}}if(_&&_.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:_,continue:!0})}if(f.length)return Promise.all(f).then(()=>c);return c}});var Si=z("$ZodEnum",(t,o)=>{E.init(t,o);let n=Fe(o.entries),c=new Set(n);t._zod.values=c;let u=n.filter((p)=>so.has(typeof p));t._zod.pattern=new RegExp(u.length?`^(${u.map((p)=>le(p.toString())).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(p,f)=>{let m=p.value;if(c.has(m))return p;return p.issues.push({code:"invalid_value",values:n,input:m,inst:t}),p}}),Oi=z("$ZodLiteral",(t,o)=>{E.init(t,o);let n=new Set(o.values);t._zod.values=n,t._zod.pattern=new RegExp(o.values.length?`^(${o.values.map((c)=>typeof c==="string"?le(c):c?le(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(c,u)=>{let p=c.value;if(n.has(p))return c;return c.issues.push({code:"invalid_value",values:o.values,input:p,inst:t}),c}});var Ii=z("$ZodTransform",(t,o)=>{E.init(t,o),t._zod.optin="optional",B.memoizer?.guard(t),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);let u=o.transform(n.value,n);if(c.async)return(u instanceof Promise?u:Promise.resolve(u)).then((f)=>(n.value=f,n));if(u instanceof Promise)throw new ne;return n.value=u,n}});function Pn(t,o){return t.value=o.issues.length?void 0:o.value,t}var Ut=z("$ZodOptional",(t,o)=>{E.init(t,o),I(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",I(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c,void 0]):void 0}),I(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Ue(c.source)})?$`):void 0}),t._zod.parse=(n,c)=>{if(n.value===void 0){if(o.innerType._zod.optin!=="defaulted")return n;let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>Pn(n,p));return Pn(n,u)}return o.innerType._zod.run(n,c)}}),Ei=z("$ZodExactOptional",(t,o)=>{Ut.init(t,o),I(t,"values",(n)=>n.def.innerType._zod.values),I(t,"pattern",(n)=>n.def.innerType._zod.pattern),t._zod.parse=(n,c)=>o.innerType._zod.run(n,c)}),Ti=z("$ZodNullable",(t,o)=>{E.init(t,o),I(t,"optin",(n)=>n.def.innerType._zod.optin),I(t,"optout",(n)=>n.def.innerType._zod.optout),I(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Ue(c.source)}|null)$`):void 0}),I(t,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,c)=>{if(n.value===null)return n;return o.innerType._zod.run(n,c)}}),Ai=z("$ZodDefault",(t,o)=>{E.init(t,o),t._zod.optin="defaulted",I(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)return n.value=o.defaultValue,n;let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Sn(p,o));return Sn(u,o)}});function Sn(t,o){if(t.value===void 0)t.value=o.defaultValue;return t}var Ni=z("$ZodPrefault",(t,o)=>{E.init(t,o),t._zod.optin="defaulted",I(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)n.value=o.defaultValue;return o.innerType._zod.run(n,c)}}),Ci=z("$ZodNonOptional",(t,o)=>{E.init(t,o),I(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c].filter((u)=>u!==void 0)):void 0}),t._zod.parse=(n,c)=>{let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>On(p,t));return On(u,t)}});function On(t,o){if(!t.issues.length&&t.value===void 0)t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:o});return t}function In(t,o,n,c){if(!o.issues.length){if(t.value=o.value,o.memo)t.memo=!0;return t}return t.value=n.catchValue({...o,value:t.value,error:{issues:o.issues.map((u)=>oe(u,c,W()))},input:t.value}),t}var ji=z("$ZodCatch",(t,o)=>{E.init(t,o),I(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),I(t,"optout",(n)=>n.def.innerType._zod.optout),I(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>In(n,p,o,c));return In(n,u,o,c)}});var Mt=z("$ZodPipe",(t,o)=>{E.init(t,o),I(t,"values",(n)=>n.def.in._zod.values),I(t,"optin",(n)=>n.def.in._zod.optin),I(t,"optout",(n)=>n.def.out._zod.optout),I(t,"propValues",(n)=>n.def.in._zod.propValues),t._zod.parse=(n,c)=>{if(c.direction==="backward"){let p=o.out._zod.run(n,c);if(p instanceof Promise)return p.then((f)=>Ye(f,o.in,c));return Ye(p,o.in,c)}let u=o.in._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Ye(p,o.out,c));return Ye(u,o.out,c)}});function Ye(t,o,n){if(t.issues.some((c)=>c.code!=="unrecognized_keys"))return t.aborted=!0,t;return o._zod.run({value:t.value,issues:t.issues},n)}var Ri=z("$ZodPreprocess",(t,o)=>{Mt.init(t,o)}),Di=z("$ZodReadonly",(t,o)=>{E.init(t,o),I(t,"propValues",(n)=>n.def.innerType._zod.propValues),I(t,"values",(n)=>n.def.innerType._zod.values),I(t,"optin",(n)=>n.def.innerType?._zod?.optin),I(t,"optout",(n)=>n.def.innerType?._zod?.optout),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then(En);return En(u)}});function En(t){if(!t.memo)t.value=Object.freeze(t.value);return t}var Li=z("$ZodLazy",(t,o)=>{E.init(t,o),ro(t._zod,"innerType",()=>{let n=o;if(!n._cachedInner)n._cachedInner=o.getter();return n._cachedInner}),I(t,"pattern",(n)=>n.innerType?._zod?.pattern),I(t,"propValues",(n)=>n.innerType?._zod?.propValues),I(t,"optin",(n)=>n.innerType?._zod?.optin??void 0),I(t,"optout",(n)=>n.innerType?._zod?.optout??void 0),t._zod.parse=(n,c)=>t._zod.innerType._zod.run(n,c)}),Fi=z("$ZodCustom",(t,o)=>{M.init(t,o),E.init(t,o),t._zod.parse=(n,c)=>n,t._zod.check=(n)=>{let c=n.value,u=o.fn(c);if(u instanceof Promise)return u.then((p)=>Tn(p,n,c,t));Tn(u,n,c,t);return}});function Tn(t,o,n,c){if(!t){let u={code:"custom",input:n,inst:c,path:[...c._zod.def.path??[]],continue:!c._zod.def.abort};if(c._zod.def.params)u.params=c._zod.def.params;o.issues.push(_e(u))}}class Ji extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Bt="~memo",Ui=[];function Jt(t){return t.map((o)=>o.path?{...o,path:o.path.slice()}:{...o})}var Mi=new WeakMap;function Bi(t,o){let n=Mi.get(t);if(n!==void 0)return n;if(o.has(t))return!0;o.add(t);let c=!1,u=(m)=>{if(!c&&m?._zod&&Bi(m,o))c=!0},p=t._zod.def,f=p.type;switch(f){case"object":{for(let m of Reflect.ownKeys(p.shape))u(p.shape[m]);u(p.catchall);break}case"array":u(p.element);break;case"tuple":for(let m of p.items)u(m);u(p.rest);break;case"record":case"map":u(p.keyType),u(p.valueType);break;case"set":u(p.valueType);break;case"union":for(let m of p.options)u(m);break;case"intersection":u(p.left),u(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":u(p.innerType);break;case"pipe":u(p.in),u(p.out);break;case"function":u(p.input),u(p.output);break;case"lazy":u(t._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let m in p){let _=Object.getOwnPropertyDescriptor(p,m);if(!_||_.get)continue;let g=_.value;if(!g||typeof g!=="object")continue;if(g._zod)u(g);else if(Array.isArray(g))for(let b of g)u(b)}}return o.delete(t),Mi.set(t,c),c}function su(t,o){let n=t.buckets.get(o);if(!n)n=new Map,t.buckets.set(o,n);return n}var Qe,et=[],cu={alloc(t,o,n){let c=Qe;if(!c)return n;Qe=void 0;let u={value:n,issues:null};return c.set(o.value,u),et.push(u),n},guard(t){var o;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let n=t._zod.parse,c=(u,p)=>{if(p.direction!=="backward"&&uu(p,u.value))throw new Ji;return n(u,p)};if(t._zod.parse=c,t._zod.run===n)t._zod.run=c})},attach(t){var o;let n,c,u;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let p=t._zod.parse,f=(m,_)=>{if(n===void 0){if(n=Bi(t,new Set),!n){if(t._zod.parse=p,t._zod.run===f)t._zod.run=p;return p(m,_)}}let g=m.value;if(g===null||typeof g!=="object")return p(m,_);let b=_[Bt];if(!b)b={buckets:new Map,backEdges:void 0},_[Bt]=b;let v;if(c===_)v=u;else v=su(b,t),c=_,u=v;let w=v.get(g);if(w){if(m.value=w.value,w.issues){if(w.issues.length)m.issues.push(...Jt(w.issues))}else m.memo=!0,b.backEdges??(b.backEdges=new Set),b.backEdges.add(w.value);return m}Qe=v;let k=et.length,Z=p(m,_);Qe=void 0;let S=et.length>k?et.pop():void 0;if(Z instanceof Promise)return Z.then((O)=>{if(S)S.issues=O.issues.length?Jt(O.issues):Ui;return O});if(S)S.issues=Z.issues.length?Jt(Z.issues):Ui;return Z};if(t._zod.parse=f,t._zod.run===p)t._zod.run=f})}};function Vt(){return cu}function uu(t,o){let n=t[Bt]?.backEdges;return n!==void 0&&o!==null&&typeof o==="object"&&n.has(o)}var au=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function o(p){return t[p]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},c={nan:"NaN"};function u(p,f){if(p==="number"&&typeof f==="number"&&!Number.isFinite(f))return String(f);return c[p]??p}return(p)=>{switch(p.code){case"invalid_type":{let f=u(p.expected),m=po(p.input),_=u(m,p.input);return`Invalid input: expected ${f}, received ${_}`}case"invalid_value":if(p.values.length===1)return`Invalid input: expected ${ht(p.values[0])}`;return`Invalid option: expected one of ${ft(p.values,"|")}`;case"too_big":{let f=p.exact?"exactly ":p.inclusive?"<=":"<",m=o(p.origin);if(m)return`Too big: expected ${p.origin??"value"} to have ${f}${p.maximum.toString()} ${m.unit??"elements"}`;return`Too big: expected ${p.origin??"value"} to be ${f}${p.maximum.toString()}`}case"too_small":{let f=p.exact?"exactly ":p.inclusive?">=":">",m=o(p.origin);if(m)return`Too small: expected ${p.origin} to have ${f}${p.minimum.toString()} ${m.unit}`;return`Too small: expected ${p.origin} to be ${f}${p.minimum.toString()}`}case"invalid_format":{let f=p;if(f.format==="starts_with")return`Invalid string: must start with "${f.prefix}"`;if(f.format==="ends_with")return`Invalid string: must end with "${f.suffix}"`;if(f.format==="includes")return`Invalid string: must include "${f.includes}"`;if(f.format==="regex")return`Invalid string: must match pattern ${f.pattern}`;return`Invalid ${n[f.format]??p.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${p.divisor}`;case"unrecognized_keys":return`Unrecognized key${p.keys.length>1?"s":""}: ${ft(p.keys,", ")}`;case"invalid_key":return`Invalid key in ${p.origin}`;case"invalid_union":if(p.options&&Array.isArray(p.options)&&p.options.length>0)return`Invalid discriminator value. Expected ${p.options.map((m)=>`'${m}'`).join(" | ")}`;if(p.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${p.origin}`;default:return"Invalid input"}}};function Kt(){return{localeError:au()}}var Vi;class Ki{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...o){let n=o[0];if(this._map.set(t,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,t);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let o=this._map.get(t);if(o&&typeof o==="object"&&"id"in o)this._idmap.delete(o.id);return this._map.delete(t),this}get(t){let o=t._zod.parent;if(o){let n={...this.get(o)??{}};delete n.id;let c={...n,...this._map.get(t)};return Object.keys(c).length?c:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Wi(){return new Ki}(Vi=globalThis).__zod_globalRegistry??(Vi.__zod_globalRegistry=Wi());var pe=globalThis.__zod_globalRegistry;function Gi(t,o){return new t({type:"string",...P(o)})}function qi(t,o){return new t({type:"string",coerce:!0,...P(o)})}function Wt(t,o){return new t({type:"string",format:"email",check:"string_format",abort:!1,...P(o)})}function Yi(t,o){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...P(o)})}function Xi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...P(o)})}function Hi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(o)})}function Qi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(o)})}function es(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(o)})}function Gt(t,o){return new t({type:"string",format:"url",check:"string_format",abort:!1,...P(o)})}function ts(t,o){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...P(o)})}function rs(t,o){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(o)})}function os(t,o){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...P(o)})}function ns(t,o){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(o)})}function is(t,o){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...P(o)})}function ss(t,o){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...P(o)})}function us(t,o){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(o)})}function qt(t,o){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(o)})}function Yt(t,o){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(o)})}function as(t,o){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(o)})}function ls(t,o){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(o)})}function ps(t,o){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...P(o)})}function fs(t,o){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...P(o)})}function ds(t,o){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...P(o)})}function ms(t,o){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...P(o)})}function tt(t,o){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(o)})}function rt(t,o){return new t({type:"string",format:"date",check:"string_format",...P(o)})}function Xt(t,o){return new t({type:"string",format:"time",check:"string_format",precision:null,...P(o)})}function Ht(t,o){return new t({type:"string",format:"duration",check:"string_format",...P(o)})}function hs(t,o){return new t({type:"number",checks:[],...P(o)})}function _s(t,o){return new t({type:"number",coerce:!0,checks:[],...P(o)})}function gs(t,o){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...P(o)})}function xs(t,o){return new t({type:"boolean",...P(o)})}function ys(t,o){return new t({type:"boolean",coerce:!0,...P(o)})}function bs(t,o){return new t({type:"bigint",coerce:!0,...P(o)})}function zs(t,o){return new t({type:"null",...P(o)})}function vs(t){return new t({type:"any"})}function $s(t){return new t({type:"unknown"})}function ws(t,o){return new t({type:"never",...P(o)})}function ks(t,o){return new t({type:"void",...P(o)})}function Zs(t,o){return new t({type:"date",...P(o)})}function Ps(t,o){return new t({type:"date",coerce:!0,...P(o)})}function ye(t,o){return new It({check:"less_than",...P(o),value:t,inclusive:!1})}function ie(t,o){return new It({check:"less_than",...P(o),value:t,inclusive:!0})}function be(t,o){return new Et({check:"greater_than",...P(o),value:t,inclusive:!1})}function ce(t,o){return new Et({check:"greater_than",...P(o),value:t,inclusive:!0})}function Te(t,o){return new sn({check:"multiple_of",...P(o),value:t})}function ot(t,o){return new un({check:"max_length",...P(o),maximum:t})}function ze(t,o){return new an({check:"min_length",...P(o),minimum:t})}function nt(t,o){return new ln({check:"length_equals",...P(o),length:t})}function Qt(t,o){return new pn({check:"string_format",format:"regex",...P(o),pattern:t})}function er(t){return new fn({check:"string_format",format:"lowercase",...P(t)})}function tr(t){return new dn({check:"string_format",format:"uppercase",...P(t)})}function rr(t,o){return new mn({check:"string_format",format:"includes",...P(o),includes:t})}function or(t,o){return new hn({check:"string_format",format:"starts_with",...P(o),prefix:t})}function nr(t,o){return new _n({check:"string_format",format:"ends_with",...P(o),suffix:t})}function fe(t){return new gn({check:"overwrite",tx:t})}function ir(t){return fe((o)=>o.normalize(t))}function sr(){return fe((t)=>t.trim())}function cr(){return fe((t)=>t.toLowerCase())}function ur(){return fe((t)=>t.toUpperCase())}function ar(){return fe((t)=>no(t))}function Ss(t,o,n){return new t({type:"array",element:o,...P(n)})}function Os(t,o,n){let c=P(n);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:o,...c})}function Is(t,o,n){return new t({type:"custom",check:"custom",fn:o,...P(n)})}function Es(t,o){let n=lu((c)=>(c.addIssue=(u)=>{if(typeof u==="string")c.issues.push(_e(u,c.value,n._zod.def));else{let p=u;if(p.fatal)p.continue=!1;if(p.code??(p.code="custom"),!("input"in p))p.input=c.value;p.inst??(p.inst=n),p.continue??(p.continue=!n._zod.def.abort),c.issues.push(_e(p))}},t(c.value,c)),o);return n}function lu(t,o){let n=new M({check:"custom",...P(o)});return n._zod.check=t,n}function Ae(t,...o){for(let n of o)for(let c of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,c))L(t,c,n[c]);return t}function Ce(t){let o=t?.target??"draft-2020-12";if(o==="draft-4")o="draft-04";if(o==="draft-7")o="draft-07";return{processors:t.processors??{},metadataRegistry:t?.metadata??pe,target:o,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function F(t,o,n,c,u){let p=typeof o.unrepresentable==="function"?o.unrepresentable({zodSchema:t,path:c.path,message:u}):o.unrepresentable;if(p==="any")return!1;if(p===void 0||p==="throw")throw Error(u);return Object.assign(n,p),!0}function C(t,o,n={path:[],schemaPath:[]}){var c;let u=t._zod.def,p=o.seen.get(t);if(p){if(p.count++,n.schemaPath.includes(t))p.cycle=n.path;return p.schema}let f={schema:{},count:1,cycle:void 0,path:n.path};o.seen.set(t,f),o.sharedDefsExtractedFor=void 0,o.sharedEmitDoneFor=void 0;let m=t._zod.toJSONSchema?.();if(m)f.schema=m;else{let b={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(o,f.schema,b);else{let w=f.schema,k=o.processors[u.type];if(!k)throw Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);k(t,o,w,b)}let v=t._zod.parent;if(v){if(!f.ref)f.ref=v;C(v,o,b),o.seen.get(v).isParent=!0}}let _=o.metadataRegistry.get(t);if(_)Ae(f.schema,_);if(o.io==="input"&&V(t))delete f.schema.examples,delete f.schema.default;if(o.io==="input"&&"_prefault"in f.schema)(c=f.schema).default??(c.default=f.schema._prefault);return delete f.schema._prefault,o.seen.get(t).schema}function Ts(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function je(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let c=new Map;for(let f of t.seen.entries()){let m=t.metadataRegistry.get(f[0])?.id;if(m){let _=c.get(m);if(_&&_!==f[0])throw Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);c.set(m,f[0])}}let u=(f)=>{let m=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let v=t.external.registry.get(f[0])?.id,w=t.external.uri??((Z)=>Z);if(v)return{ref:w(v)};let k=f[1].defId??f[1].schema.id??`schema${t.counter++}`;return f[1].defId=k,{defId:k,ref:`${w("__shared")}#/${m}/${Ts(k)}`}}let _="#",g=`${_}/${m}/`;if(f[1]===n&&!f[1].schema.id)return{ref:_};let b=f[1].schema.id??`__schema${t.counter++}`;return{defId:b,ref:g+Ts(b)}},p=(f)=>{if(f[1].schema.$ref)return;let m=f[1],{ref:_,defId:g}=u(f);if(m.def={...m.schema},g)m.defId=g;let b=m.schema;for(let v in b)delete b[v];b.$ref=_};if(t.cycles==="throw")for(let f of t.seen.entries()){let m=f[1];if(m.cycle)throw Error(`Cycle detected: #/${m.cycle?.join("/")}/<root>
|
|
53
|
+
|
|
54
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let f of t.seen.entries()){let m=f[1];if(o===f[0]){p(f);continue}if(t.external){let g=t.external.registry.get(f[0])?.id;if(o!==f[0]&&g){p(f);continue}}if(t.metadataRegistry.get(f[0])?.id){p(f);continue}if(m.cycle){p(f);continue}if(m.count>1){if(t.reused==="ref"){p(f);continue}}}if(t.external)t.sharedDefsExtractedFor=t.external}function Cs(t){let o=t.anyOf;if(!Array.isArray(o)||o.length===0||t.type!==void 0)return;let n=[];for(let c of o){if(!c||typeof c!=="object")return;Cs(c);let u=Object.keys(c);if(u.length!==1||u[0]!=="type")return;let p=c.type;for(let f of Array.isArray(p)?p:[p]){if(typeof f!=="string")return;if(!n.includes(f))n.push(f)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var js=new Set(["type","properties","required","additionalProperties"]),As=["oneOf","anyOf"];function Ns(t){let o=t.additionalProperties;if(o===void 0||o===!1||typeof o!=="object"||o===null)return null;return Object.keys(o).length?o:null}function lr(t){let o=[];for(let p of t){if(typeof p!=="object"||p.type!=="object")return null;for(let f in p)if(!js.has(f))return null;o.push(p)}let n={},c=new Set;for(let p of o){for(let f in p.properties){if(Object.prototype.hasOwnProperty.call(n,f))continue;let m=[];for(let g of o){let b=g.properties?.[f]??Ns(g);if(b===null||b===void 0)continue;if(!m.some((v)=>JSON.stringify(v)===JSON.stringify(b)))m.push(b)}let _=m.length===1?m[0]:lr(m)??{allOf:m};L(n,f,_)}for(let f of p.required??[])c.add(f)}let u={type:"object",properties:n};if(c.size)u.required=[...c];if(o.every((p)=>p.additionalProperties===!1))u.additionalProperties=!1;else{let p=[];for(let f of o){let m=Ns(f);if(m&&!p.some((_)=>JSON.stringify(_)===JSON.stringify(m)))p.push(m)}if(p.length===1)u.additionalProperties=p[0];else if(p.length>1)u.additionalProperties={allOf:p}}return u}function pu(t){let o=t.allOf;if(!Array.isArray(o)||o.length<2)return;for(let u of js)if(u in t)return;let n=o.filter((u)=>As.some((p)=>Array.isArray(u[p]))),c=null;if(!n.length)c=lr(o);else{let u=n[0],p=As.find((_)=>Array.isArray(u[_]));if(Object.keys(u).length!==1)return;let f=o.filter((_)=>_!==u),m=u[p].map((_)=>lr([...f,_]));if(m.some((_)=>!_))return;c={[p]:m}}if(!c)return;delete t.allOf,Ae(t,c)}function Re(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let c=(m)=>{let _=t.seen.get(m);if(_.ref===null)return;let g=_.def??_.schema,b={...g},v=_.ref;if(_.ref=null,v){c(v);let k=t.seen.get(v),Z=k.schema;if(Z.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"))g.allOf=g.allOf??[],g.allOf.push(Z);else Ae(g,Z);if(Ae(g,b),m._zod.parent===v)for(let O in g){if(O==="$ref"||O==="allOf")continue;if(!(O in b))delete g[O]}if(Z.$ref&&k.def)for(let O in g){if(O==="$ref"||O==="allOf")continue;if(O in k.def&&JSON.stringify(g[O])===JSON.stringify(k.def[O]))delete g[O]}}let w=m._zod.parent;if(w&&w!==v){c(w);let k=t.seen.get(w);if(k?.schema.$ref){if(g.$ref=k.schema.$ref,k.def)for(let Z in g){if(Z==="$ref"||Z==="allOf")continue;if(Z in k.def&&JSON.stringify(g[Z])===JSON.stringify(k.def[Z]))delete g[Z]}}}t.override({zodSchema:m,jsonSchema:g,path:_.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let m of[...t.seen.entries()].reverse())c(m[0]);if(t.target!=="openapi-3.0")for(let m of t.seen.entries())Cs(m[1].def??m[1].schema);for(let m of t.deferred)m();if(t.intersections.length){let m=new Map;for(let _ of t.seen.values())for(let g of[_.schema,_.def]){let b=g?.allOf;if(!Array.isArray(b))continue;let v=m.get(b);if(v)v.push(g);else m.set(b,[g])}for(let _ of t.intersections)for(let g of m.get(_)??[])pu(g)}}let u={};if(t.target==="draft-2020-12")u.$schema="https://json-schema.org/draft/2020-12/schema";else if(t.target==="draft-07")u.$schema="http://json-schema.org/draft-07/schema#";else if(t.target==="draft-04")u.$schema="http://json-schema.org/draft-04/schema#";else if(t.target==="openapi-3.0");if(t.external?.uri){let m=t.external.registry.get(o)?.id;if(!m)throw Error("Schema is missing an `id` property");u.$id=t.external.uri(m)}Ae(u,n.defId?n.schema:n.def??n.schema);let p=t.metadataRegistry.get(o)?.id;if(p!==void 0&&u.id===p)delete u.id;let f=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let m of t.seen.entries()){let _=m[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;L(f,_.defId,_.def)}}if(t.external)t.sharedEmitDoneFor=t.external;if(t.external);else if(Object.keys(f).length>0)if(t.target==="draft-2020-12")u.$defs=f;else u.definitions=f;try{let m=JSON.parse(JSON.stringify(u));return Object.defineProperty(m,"~standard",{value:{...o["~standard"],jsonSchema:{input:Ne(o,"input",t.processors),output:Ne(o,"output",t.processors)}},enumerable:!1,writable:!1}),m}catch(m){throw Error("Error converting schema to JSON.")}}function V(t,o){let n=o??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return V(c.element,n);if(c.type==="set")return V(c.valueType,n);if(c.type==="lazy")return V(c.getter(),n);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault"||c.type==="catch")return V(c.innerType,n);if(c.type==="intersection")return V(c.left,n)||V(c.right,n);if(c.type==="record"||c.type==="map")return V(c.keyType,n)||V(c.valueType,n);if(c.type==="pipe"){if(t._zod.traits.has("$ZodCodec"))return!0;return V(c.in,n)||V(c.out,n)}if(c.type==="object"){for(let u in c.shape)if(V(c.shape[u],n))return!0;return!1}if(c.type==="union"){for(let u of c.options)if(V(u,n))return!0;return!1}if(c.type==="tuple"){for(let u of c.items)if(V(u,n))return!0;if(c.rest&&V(c.rest,n))return!0;return!1}return!1}var Rs=(t,o={})=>(n)=>{let c=Ce({...n,processors:o});return C(t,c),je(c,t),Re(c,t)},Ne=(t,o,n={})=>(c)=>{let{libraryOptions:u,target:p}=c??{},f=Ce({...u??{},target:p,io:o,processors:n});return C(t,f),je(f,t),Re(f,t)};var fu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dr=(t,o,n,c)=>{let u=n;u.type="string";let{minimum:p,maximum:f,format:m,patterns:_,contentEncoding:g,laxFormat:b}=t._zod.bag;if(typeof p==="number")u.minLength=p;if(typeof f==="number")u.maxLength=f;if(m){if(u.format=fu[m]??m,u.format==="")delete u.format;if(m==="time"||b)delete u.format}if(g)u.contentEncoding=g;if(_&&_.size>0){let v=[..._];if(v.length===1)u.pattern=v[0].source;else if(v.length>1)u.allOf=[...v.map((w)=>({...o.target==="draft-07"||o.target==="draft-04"||o.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},mr=(t,o,n,c)=>{let u=n,{minimum:p,maximum:f,format:m,multipleOf:_,exclusiveMaximum:g,exclusiveMinimum:b}=t._zod.bag;if(typeof m==="string"&&m.includes("int"))u.type="integer";else u.type="number";let v=typeof b==="number"&&b>=(p??Number.NEGATIVE_INFINITY),w=typeof g==="number"&&g<=(f??Number.POSITIVE_INFINITY),k=o.target==="draft-04"||o.target==="openapi-3.0";if(v)if(k)u.minimum=b,u.exclusiveMinimum=!0;else u.exclusiveMinimum=b;else if(typeof p==="number")u.minimum=p;if(w)if(k)u.maximum=g,u.exclusiveMaximum=!0;else u.exclusiveMaximum=g;else if(typeof f==="number")u.maximum=f;if(typeof _==="number")if(Number.isFinite(_)&&_!==0)u.multipleOf=Math.abs(_);else F(t,o,u,c,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`)},hr=(t,o,n,c)=>{n.type="boolean"},_r=(t,o,n,c)=>{F(t,o,n,c,"BigInt cannot be represented in JSON Schema")},Fs=(t,o,n,c)=>{F(t,o,n,c,"Symbols cannot be represented in JSON Schema")},gr=(t,o,n,c)=>{if(o.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},Us=(t,o,n,c)=>{F(t,o,n,c,"Undefined cannot be represented in JSON Schema")},xr=(t,o,n,c)=>{F(t,o,n,c,"Void cannot be represented in JSON Schema")},yr=(t,o,n,c)=>{n.not={}},br=(t,o,n,c)=>{},zr=(t,o,n,c)=>{},vr=(t,o,n,c)=>{F(t,o,n,c,"Date cannot be represented in JSON Schema")},$r=(t,o,n,c)=>{let u=t._zod.def,p=Fe(u.entries);if(p.length===0){n.not={};return}if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";n.enum=p},wr=(t,o,n,c)=>{let u=t._zod.def;if(u.values.length===0){n.not={};return}let p=[];for(let f of u.values)if(f===void 0){if(F(t,o,n,c,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof f==="bigint"){if(F(t,o,n,c,"BigInt literals cannot be represented in JSON Schema"))return;p.push(Number(f))}else p.push(f);if(p.length===0);else if(p.length===1){let f=p[0];if(n.type=f===null?"null":typeof f,o.target==="draft-04"||o.target==="openapi-3.0")n.enum=[f];else n.const=f}else{if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";if(p.every((f)=>typeof f==="boolean"))n.type="boolean";if(p.every((f)=>f===null))n.type="null";n.enum=p}},Ms=(t,o,n,c)=>{F(t,o,n,c,"NaN cannot be represented in JSON Schema")},Js=(t,o,n,c)=>{let u=n,p=t._zod.pattern;if(!p)throw Error("Pattern not found in template literal");u.type="string",u.pattern=p.source},Bs=(t,o,n,c)=>{let u=n,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:f,maximum:m,mime:_}=t._zod.bag;if(f!==void 0)p.minLength=f;if(m!==void 0)p.maxLength=m;if(_)if(_.length===1)p.contentMediaType=_[0],Object.assign(u,p);else Object.assign(u,p),u.anyOf=_.map((g)=>({contentMediaType:g}));else Object.assign(u,p)},Vs=(t,o,n,c)=>{n.type="boolean"},kr=(t,o,n,c)=>{F(t,o,n,c,"Custom types cannot be represented in JSON Schema")},Ks=(t,o,n,c)=>{F(t,o,n,c,"Function types cannot be represented in JSON Schema")},Zr=(t,o,n,c)=>{F(t,o,n,c,"Transforms cannot be represented in JSON Schema")},Ws=(t,o,n,c)=>{F(t,o,n,c,"Map cannot be represented in JSON Schema")},Gs=(t,o,n,c)=>{F(t,o,n,c,"Set cannot be represented in JSON Schema")},Pr=(t,o,n,c)=>{let u=n,p=t._zod.def,{minimum:f,maximum:m}=t._zod.bag;if(typeof f==="number")u.minItems=f;if(typeof m==="number")u.maxItems=m;u.type="array",u.items=C(p.element,o,{...c,path:[...c.path,"items"]})};function De(t){let o=t._zod.def;if(o.type==="pipe"&&o.in._zod.traits.has("$ZodTransform"))return De(o.out);if(o.type==="catch")return De(o.innerType);return t._zod.optin}var Sr=(t,o,n,c)=>{let u=n,p=t._zod.def,f=p.shape;if(Object.getOwnPropertySymbols(f).length&&F(t,o,u,c,"Symbol keys cannot be represented in JSON Schema"))return;u.type="object",u.properties={};for(let b in f)L(u.properties,b,C(f[b],o,{...c,path:[...c.path,"properties",b]}));let _=new Set(Object.keys(f)),g=new Set([..._].filter((b)=>{let v=p.shape[b];if(o.io==="input")return De(v)===void 0;else return v._zod.optout===void 0}));if(g.size>0)u.required=Array.from(g);if(p.catchall?._zod.def.type==="never")u.additionalProperties=!1;else if(!p.catchall){if(o.io==="output")u.additionalProperties=!1}else if(p.catchall)u.additionalProperties=C(p.catchall,o,{...c,path:[...c.path,"additionalProperties"]})},Or=(t,o,n,c)=>{let u=t._zod.def,p=u.inclusive===!1,f=u.options.map((m,_)=>C(m,o,{...c,path:[...c.path,p?"oneOf":"anyOf",_]}));if(p)n.oneOf=f;else n.anyOf=f},Ir=(t,o,n,c)=>{let u=t._zod.def,p=C(u.left,o,{...c,path:[...c.path,"allOf",0]}),f=C(u.right,o,{...c,path:[...c.path,"allOf",1]}),m=(g)=>("allOf"in g)&&Object.keys(g).length===1,_=[...m(p)?p.allOf:[p],...m(f)?f.allOf:[f]];n.allOf=_,o.intersections.push(_)},Er=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="array";let f=o.target==="draft-2020-12"?"prefixItems":"items",m=o.target==="draft-2020-12"?"items":o.target==="openapi-3.0"?"items":"additionalItems",_=p.items.map((S,O)=>C(S,o,{...c,path:[...c.path,f,O]})),g=p.rest?C(p.rest,o,{...c,path:[...c.path,m,...o.target==="openapi-3.0"?[p.items.length]:[]]}):null,b=p.items.length;while(b>0){let S=p.items[b-1];if(!(o.io==="input"?De(S)!==void 0:S._zod.optout==="optional"))break;b--}let v=p.items.length,w=!p.rest;if(o.target==="draft-2020-12"){if(u.prefixItems=_,w)u.items=!1;else if(g)u.items=g;if(b>0)u.minItems=b;if(w)u.maxItems=v}else if(o.target==="openapi-3.0"){if(u.items={anyOf:_},g)u.items.anyOf.push(g);if(b>0)u.minItems=b;if(w)u.maxItems=v}else{if(u.items=_,w)u.additionalItems=!1;else if(g)u.additionalItems=g;if(b>0)u.minItems=b;if(w)u.maxItems=v}let{minimum:k,maximum:Z}=t._zod.bag;if(typeof k==="number")u.minItems=k;if(typeof Z==="number")u.maxItems=Z};function pr(t,o,n){if(o.$ref){if(n.has(o))return o;n.add(o);let Z=t.get(o)?.def;if(!Z)return o;let S=pr(t,Z,n);return S===Z?o:S}for(let Z of["anyOf","oneOf"]){let S=o[Z];if(!Array.isArray(S))continue;let O=S.map((J)=>pr(t,J,n));if(O.some((J,q)=>J!==S[q]))o={...o,[Z]:O}}let c=Array.isArray(o.type)?o.type:[o.type],u=!c.includes("string")&&c.some((Z)=>Z==="number"||Z==="integer"),p=o.enum??(o.const!==void 0?[o.const]:void 0);if(!u&&!p?.some((Z)=>typeof Z==="number"))return o;let{minimum:f,maximum:m,exclusiveMinimum:_,exclusiveMaximum:g,multipleOf:b,format:v,id:w,...k}=o;if(k.enum)k.enum=k.enum.map((Z)=>typeof Z==="number"?String(Z):Z);else if(typeof k.const==="number")k.const=String(k.const);if(!u)return k;if(k.type="string",!p)k.pattern=(c.includes("number")?Ie:We).source;return k}var fr=new WeakMap;function du(t){let o=new Map;for(let c of t.seen.values())if(c.def&&!o.has(c.schema))o.set(c.schema,c);let n=new Map;for(let c of fr.get(t)??[]){let u=t.seen.get(c),p=(u?.def??u?.schema)?.propertyNames;if(!p||p===!0||n.has(p))continue;let f=pr(o,p,new Set);if(f!==p)n.set(p,f)}if(!n.size)return;for(let c of t.seen.values())for(let u of[c.schema,c.def]){let p=u&&n.get(u.propertyNames);if(p)u.propertyNames=p}}var Tr=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="object";let f=p.keyType,_=f._zod.bag?.patterns;if(p.mode==="loose"&&_&&_.size>0){let v=C(p.valueType,o,{...c,path:[...c.path,"patternProperties","*"]});u.patternProperties={};for(let w of _)L(u.patternProperties,w.source,v)}else{if(o.target==="draft-07"||o.target==="draft-2020-12"){u.propertyNames=C(p.keyType,o,{...c,path:[...c.path,"propertyNames"]});let v=fr.get(o);if(!v)v=[],fr.set(o,v),o.deferred.push(()=>du(o));v.push(t)}u.additionalProperties=C(p.valueType,o,{...c,path:[...c.path,"additionalProperties"]})}let g=f._zod.values,b=o.io==="input"&&De(p.valueType)!==void 0;if(g&&!p.partial&&!b){let v=[...g].filter((w)=>typeof w==="string"||typeof w==="number");if(v.length>0)u.required=v.map(String)}},Ar=(t,o,n,c)=>{let u=t._zod.def,p=C(u.innerType,o,c),f=o.seen.get(t);if(o.target==="openapi-3.0")f.ref=u.innerType,n.nullable=!0;else n.anyOf=[p,{type:"null"}]},Nr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},Cr=Symbol();function qs(t,o,n,c,u){let p=!1,f=JSON.stringify(t,(m,_)=>{if(typeof _!=="bigint")return _;return p=!0,null});if(!p)return JSON.parse(f);return F(o,n,c,u,"BigInt defaults cannot be represented in JSON Schema"),Cr}var Rr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f=qs(u.defaultValue,t,o,n,c);if(f!==Cr)n.default=f},Dr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);if(p.ref=u.innerType,o.io!=="input")return;let f=qs(u.defaultValue,t,o,n,c);if(f!==Cr)n._prefault=f},Lr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{F(t,o,n,c,"Dynamic catch values are not supported in JSON Schema");return}n.default=f},Fr=(t,o,n,c)=>{let u=t._zod.def,p=u.in._zod.traits.has("$ZodTransform"),f=o.io==="input"?p?u.out:u.in:u.out;C(f,o,c);let m=o.seen.get(t);m.ref=f},Ur=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType,n.readOnly=!0},Ys=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},it=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},Mr=(t,o,n,c)=>{let u=t._zod.innerType;C(u,o,c);let p=o.seen.get(t);p.ref=u},Ls={string:dr,number:mr,boolean:hr,bigint:_r,symbol:Fs,null:gr,undefined:Us,void:xr,never:yr,any:br,unknown:zr,date:vr,enum:$r,literal:wr,nan:Ms,template_literal:Js,file:Bs,success:Vs,custom:kr,function:Ks,transform:Zr,map:Ws,set:Gs,array:Pr,object:Sr,union:Or,intersection:Ir,tuple:Er,record:Tr,nullable:Ar,nonoptional:Nr,default:Rr,prefault:Dr,catch:Lr,pipe:Fr,readonly:Ur,promise:Ys,optional:it,lazy:Mr};function ai(t,o){if("_idmap"in t){let c=t,u=Ce({...o,processors:Ls}),p={};for(let _ of c._idmap.entries()){let[g,b]=_;C(b,u)}let f={},m={registry:c,uri:o?.uri,defs:p};u.external=m;for(let _ of c._idmap.entries()){let[g,b]=_;je(u,b),L(f,g,Re(u,b))}if(Object.keys(p).length>0){let _=u.target==="draft-2020-12"?"$defs":"definitions";f.__shared={[_]:p}}return{schemas:f}}let n=Ce({...o,processors:Ls});return C(t,n),je(n,t),Re(n,t)}var Xs=new WeakSet([Object.prototype,Error.prototype]);function st(t,o,n){Object.defineProperty(t,o,{configurable:!0,enumerable:!1,get(){let c=n(this);return Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0})}})}var zu=(t,o)=>{ii.init(t,o),t.name="ZodError";let n=Object.getPrototypeOf(t);if(Xs.has(n))return;Xs.add(n),st(n,"format",(c)=>(u)=>wt(c,u)),st(n,"flatten",(c)=>(u)=>$t(c,u)),st(n,"addIssue",(c)=>(u)=>{c.issues.push(u),c.message=JSON.stringify(c.issues,we,2)}),st(n,"addIssues",(c)=>(u)=>{c.issues.push(...u),c.message=JSON.stringify(c.issues,we,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var G=z("ZodError",zu,void 0,{Parent:Error});var Hs=Ve(G),Qs=Ke(G),Pu=Pe(G),Nu=Oe(G),ec=vo(G),tc=$o(G),rc=wo(G),oc=ko(G),nc=Zo(G),ic=Po(G),sc=So(G),cc=Oo(G);function $u(){if(!B.localeError)W(Kt())}function Le(){if(!B.memoizer)W({memoizer:Vt()})}var N=z("ZodType",(t,o)=>($u(),E.init(t,o),t.def=o,t.type=o.type,t),{check(...t){let o=this.def;return this.clone(ae(o,{checks:[...o.checks??[],...t.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,o){return Y(this,t,o)},brand(){return this},register(t,o){return t.add(this,o),this},refine(t,o){return this.check(fa(t,o))},superRefine(t,o){return this.check(da(t,o))},overwrite(t){return this.check(fe(t))},optional(){return Se(this)},exactOptional(){return Qu(this)},nullable(){return s(this)},nullish(){return Se(s(this))},nonoptional(t){return ia(this,t)},array(){return i(this)},or(t){return T([this,t])},and(t){return Ds(this,t)},transform(t){return ac(this,yc(t))},default(t){return ra(this,t)},prefault(t){return na(this,t)},catch(t){return ca(this,t)},pipe(t){return ac(this,t)},readonly(){return la(this)},describe(t){let o=this.clone();return pe.add(o,{description:t}),o},meta(...t){if(t.length===0)return pe.get(this);let o=this.clone();return pe.add(o,t[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...o){return o.length===0?t(this):t(this,...o)},get "~standard"(){return gt(this,"~standard",{...jt(this),jsonSchema:{input:Ne(this,"input"),output:Ne(this,"output")}})},set "~standard"(t){de(this,"~standard",t)},parse:function t(o,n){return Hs(this,o,n,{callee:t})},parseAsync:async function t(o,n){return await Qs(this,o,n,{callee:t})},safeParse(t,o){return Pu(this,t,o)},async safeParseAsync(t,o){return Nu(this,t,o)},get spa(){return this?.safeParseAsync},set spa(t){de(this,"spa",t)},encode:function t(o,n){return ec(this,o,n,{callee:t})},decode:function t(o,n){return tc(this,o,n,{callee:t})},encodeAsync:async function t(o,n){return await rc(this,o,n,{callee:t})},decodeAsync:async function t(o,n){return await oc(this,o,n,{callee:t})},safeEncode(t,o){return nc(this,t,o)},safeDecode(t,o){return ic(this,t,o)},async safeEncodeAsync(t,o){return sc(this,t,o)},async safeDecodeAsync(t,o){return cc(this,t,o)},toJSONSchema(t){return Rs(this,{})(t)},get description(){return pe.get(this)?.description},get _def(){return this._zod.def}}),lc=z("_ZodString",(t,o)=>{He.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>dr(t,c,u,p);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null},{regex(...t){return this.check(Qt(...t))},includes(...t){return this.check(rr(...t))},startsWith(...t){return this.check(or(...t))},endsWith(...t){return this.check(nr(...t))},min(...t){return this.check(ze(...t))},max(...t){return this.check(ot(...t))},length(...t){return this.check(nt(...t))},nonempty(...t){return this.check(ze(1,...t))},lowercase(t){return this.check(er(t))},uppercase(t){return this.check(tr(t))},trim(){return this.check(sr())},normalize(...t){return this.check(ir(...t))},toLowerCase(){return this.check(cr())},toUpperCase(){return this.check(ur())},slugify(){return this.check(ar())}}),Jr=z("ZodString",(t,o)=>{He.init(t,o),lc.init(t,o)},{email(t){return this.check(Wt(dc,t))},url(t){return this.check(Gt(mc,t))},jwt(t){return this.check(ms(Fu,t))},emoji(t){return this.check(ts(ku,t))},guid(t){return this.check(Yi(wu,t))},uuid(t){return this.check(Xi(ct,t))},uuidv4(t){return this.check(Hi(ct,t))},uuidv6(t){return this.check(Qi(ct,t))},uuidv7(t){return this.check(es(ct,t))},nanoid(t){return this.check(rs(Zu,t))},cuid(t){return this.check(os(Su,t))},cuid2(t){return this.check(ns(Ou,t))},ulid(t){return this.check(is(Iu,t))},base64(t){return this.check(ps(ju,t))},base64url(t){return this.check(fs(Ru,t))},xid(t){return this.check(ss(Eu,t))},ksuid(t){return this.check(us(Tu,t))},ipv4(t){return this.check(qt(hc,t))},ipv6(t){return this.check(Yt(_c,t))},cidrv4(t){return this.check(as(Au,t))},cidrv6(t){return this.check(ls(Cu,t))},e164(t){return this.check(ds(Lu,t))},datetime(t){return this.check(tt(Br,t))},date(t){return this.check(rt(Vr,t))},time(t){return this.check(Xt(pc,t))},duration(t){return this.check(Ht(fc,t))}});function e(t){return Gi(Jr,t)}var D=z("ZodStringFormat",(t,o)=>{j.init(t,o),lc.init(t,o)}),Br=z("ZodISODateTime",(t,o)=>{Kn.init(t,o),D.init(t,o)}),Vr=z("ZodISODate",(t,o)=>{Wn.init(t,o),D.init(t,o)}),pc=z("ZodISOTime",(t,o)=>{Gn.init(t,o),D.init(t,o)}),fc=z("ZodISODuration",(t,o)=>{qn.init(t,o),D.init(t,o)}),dc=z("ZodEmail",(t,o)=>{Cn.init(t,o),D.init(t,o)});function Ao(t){return Wt(dc,t)}var wu=z("ZodGUID",(t,o)=>{An.init(t,o),D.init(t,o)});var ct=z("ZodUUID",(t,o)=>{Nn.init(t,o),D.init(t,o)});var mc=z("ZodURL",(t,o)=>{Dn.init(t,o),D.init(t,o)});function li(t){return Gt(mc,t)}var ku=z("ZodEmoji",(t,o)=>{Ln.init(t,o),D.init(t,o)});var Zu=z("ZodNanoID",(t,o)=>{Fn.init(t,o),D.init(t,o)});var Su=z("ZodCUID",(t,o)=>{Un.init(t,o),D.init(t,o)});var Ou=z("ZodCUID2",(t,o)=>{Mn.init(t,o),D.init(t,o)});var Iu=z("ZodULID",(t,o)=>{Jn.init(t,o),D.init(t,o)});var Eu=z("ZodXID",(t,o)=>{Bn.init(t,o),D.init(t,o)});var Tu=z("ZodKSUID",(t,o)=>{Vn.init(t,o),D.init(t,o)});var hc=z("ZodIPv4",(t,o)=>{Yn.init(t,o),D.init(t,o)});function Sc(t){return qt(hc,t)}var _c=z("ZodIPv6",(t,o)=>{Hn.init(t,o),D.init(t,o)});function wf(t){return Yt(_c,t)}var Au=z("ZodCIDRv4",(t,o)=>{Qn.init(t,o),D.init(t,o)});var Cu=z("ZodCIDRv6",(t,o)=>{ei.init(t,o),D.init(t,o)});var ju=z("ZodBase64",(t,o)=>{ri.init(t,o),D.init(t,o)});var Ru=z("ZodBase64URL",(t,o)=>{oi.init(t,o),D.init(t,o)});var Lu=z("ZodE164",(t,o)=>{ni.init(t,o),D.init(t,o)});var Fu=z("ZodJWT",(t,o)=>{si.init(t,o),D.init(t,o)});var at=z("ZodNumber",(t,o)=>{Lt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>mr(t,c,u,p);let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),t.isFinite=!0,t.format=n.format??null},{gt(t,o){return this.check(be(t,o))},gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(ie(t,o))},max(t,o){return this.check(ie(t,o))},int(t){return this.check(h(t))},safe(t){return this.check(h(t))},positive(t){return this.check(be(0,t))},nonnegative(t){return this.check(ce(0,t))},negative(t){return this.check(ye(0,t))},nonpositive(t){return this.check(ie(0,t))},multipleOf(t,o){return this.check(Te(t,o))},step(t,o){return this.check(Te(t,o))},finite(){return this}});function a(t){return hs(at,t)}var Uu=z("ZodNumberFormat",(t,o)=>{ui.init(t,o),at.init(t,o)});function h(t){return gs(Uu,t)}var Kr=z("ZodBoolean",(t,o)=>{pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>hr(t,n,c,u)});function d(t){return xs(Kr,t)}var gc=z("ZodBigInt",(t,o)=>{fi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>_r(t,c,u,p);let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null},{gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},gt(t,o){return this.check(be(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(ie(t,o))},max(t,o){return this.check(ie(t,o))},positive(t){return this.check(be(BigInt(0),t))},negative(t){return this.check(ye(BigInt(0),t))},nonpositive(t){return this.check(ie(BigInt(0),t))},nonnegative(t){return this.check(ce(BigInt(0),t))},multipleOf(t,o){return this.check(Te(t,o))}});var Mu=z("ZodNull",(t,o)=>{di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>gr(t,n,c,u)});function _o(t){return zs(Mu,t)}var Ju=z("ZodAny",(t,o)=>{mi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>br(t,n,c,u)});function x(){return vs(Ju)}var Bu=z("ZodUnknown",(t,o)=>{hi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>zr(t,n,c,u)});function U(){return $s(Bu)}var Vu=z("ZodNever",(t,o)=>{_i.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>yr(t,n,c,u)});function xf(t){return ws(Vu,t)}var Ku=z("ZodVoid",(t,o)=>{gi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>xr(t,n,c,u)});function Rt(t){return ks(Ku,t)}var Wr=z("ZodDate",(t,o)=>{xi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>vr(t,c,u,p),t.min=(c,u)=>t.check(ce(c,u)),t.max=(c,u)=>t.check(ie(c,u));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function te(t){return Zs(Wr,t)}var Wu=z("ZodArray",(t,o)=>{Le(),yi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Pr(t,n,c,u),t.element=o.element},{min(t,o){return this.check(ze(t,o))},nonempty(t){return this.check(ze(1,t))},max(t,o){return this.check(ot(t,o))},length(t,o){return this.check(nt(t,o))},unwrap(){return this.element}});function i(t,o){return Ss(Wu,t,o)}var va=z("ZodObject",(t,o)=>{Le(),vi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Sr(t,n,c,u),Dc(t,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return A(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:U()})},loose(){return this.clone({...this._zod.def,catchall:U()})},strict(){return this.clone({...this._zod.def,catchall:xf()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return Oc(this,t)},safeExtend(t){return Ic(this,t)},merge(t){return Tc(this,t)},pick(t){return Zc(this,t)},omit(t){return Pc(this,t)},partial(...t){return ao(wa,this,t[0])},exactPartial(...t){return ao(bc,this,t[0],"exactPartial")},required(...t){return Ac(zc,this,t[0])}});function r(t,o){let n={type:"object",shape:t??{},...P(o)};return new va(n)}function se(t,o){return new va({type:"object",shape:t,catchall:U(),...P(o)})}var xc=z("ZodUnion",(t,o)=>{Ft.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Or(t,n,c,u),t.options=o.options});function T(t,o){return new xc({type:"union",options:t,...P(o)})}var Gu=z("ZodDiscriminatedUnion",(t,o)=>{xc.init(t,o),wi.init(t,o)});function re(t,o,n){return new Gu({type:"union",options:o,discriminator:t,...P(n)})}var qu=z("ZodIntersection",(t,o)=>{ki.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ir(t,n,c,u)});function Ds(t,o){return new qu({type:"intersection",left:t,right:o})}var Yu=z("ZodTuple",(t,o)=>{Le(),Zi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Er(t,n,c,u)},{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){let t=this._zod.def;if(t.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map((o)=>new wa({type:"optional",innerType:o}))})}});function $i(t,o,n){let c=o instanceof E,u=c?n:o;return new Yu({type:"tuple",items:t,rest:c?o:null,...P(u)})}var uc=z("ZodRecord",(t,o)=>{Le(),Pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Tr(t,n,c,u),t.keyType=o.keyType,t.valueType=o.valueType});function y(t,o,n){if(!o||!o._zod)return new uc({type:"record",keyType:e(),valueType:t,...P(o)});return new uc({type:"record",keyType:t,valueType:o,...P(n)})}var ut=z("ZodEnum",(t,o)=>{Si.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>$r(t,c,u,p),t.enum=o.entries,t.options=Object.values(o.entries);let n=new Set(Object.keys(o.entries));t.extract=(c,u)=>{let p={};for(let f of c)if(n.has(f))p[f]=o.entries[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...P(u),entries:p})},t.exclude=(c,u)=>{let p={...o.entries};for(let f of c)if(n.has(f))delete p[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...P(u),entries:p})}});function A(t,o){let n=Array.isArray(t)?Object.fromEntries(t.map((c)=>[c,c])):t;return new ut({type:"enum",entries:n,...P(o)})}function Dt(t,o){return new ut({type:"enum",entries:t,...P(o)})}var Xu=z("ZodLiteral",(t,o)=>{Oi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>wr(t,n,c,u),t.values=new Set(o.values),Object.defineProperty(t,"value",{get(){if(o.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return o.values[0]}})});function l(t,o){return new Xu({type:"literal",values:Array.isArray(t)?t:[t],...P(o)})}var Hu=z("ZodTransform",(t,o)=>{Le(),Ii.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Zr(t,n,c,u),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);n.addIssue=(p)=>{if(typeof p==="string")n.issues.push(_e(p,n.value,o));else{let f=p;if(f.fatal)f.continue=!1;if(f.code??(f.code="custom"),!("input"in f))f.input=n.value;f.inst??(f.inst=t),n.issues.push(_e(f))}};let u=o.transform(n.value,n);if(u instanceof Promise)return u.then((p)=>(n.value=p,n));return n.value=u,n}});function yc(t){return new Hu({type:"transform",transform:t})}var wa=z("ZodOptional",(t,o)=>{Ut.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function Se(t){return new wa({type:"optional",innerType:t})}var bc=z("ZodExactOptional",(t,o)=>{Ei.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function Qu(t){return new bc({type:"optional",innerType:t})}var ea=z("ZodNullable",(t,o)=>{Ti.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ar(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function s(t){return new ea({type:"nullable",innerType:t})}var ta=z("ZodDefault",(t,o)=>{Ai.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Rr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ra(t,o){return new ta({type:"default",innerType:t,get defaultValue(){return typeof o==="function"?o():mt(o)}})}var oa=z("ZodPrefault",(t,o)=>{Ni.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Dr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function na(t,o){return new oa({type:"prefault",innerType:t,get defaultValue(){return typeof o==="function"?o():mt(o)}})}var zc=z("ZodNonOptional",(t,o)=>{Ci.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Nr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function ia(t,o){return new zc({type:"nonoptional",innerType:t,...P(o)})}var sa=z("ZodCatch",(t,o)=>{ji.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Lr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function ca(t,o){return new sa({type:"catch",innerType:t,catchValue:typeof o==="function"?o:mo(o)})}var vc=z("ZodPipe",(t,o)=>{Mt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Fr(t,n,c,u),t.in=o.in,t.out=o.out});function ac(t,o){return new vc({type:"pipe",in:t,out:o})}var ua=z("ZodPreprocess",(t,o)=>{vc.init(t,o),Ri.init(t,o)}),aa=z("ZodReadonly",(t,o)=>{Di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ur(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function la(t){return new aa({type:"readonly",innerType:t})}var pa=z("ZodLazy",(t,o)=>{Li.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Mr(t,n,c,u),t.unwrap=()=>t._zod.def.getter()});function Ct(t){return new pa({type:"lazy",getter:t})}var Gr=z("ZodCustom",(t,o)=>{Fi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>kr(t,n,c,u)});function St(t,o){return Os(Gr,t??(()=>!0),o)}function fa(t,o={}){return Is(Gr,t,o)}function da(t,o){return Es(t,o)}function Du(t,o={}){let n=new Gr({type:"custom",check:"custom",fn:(c)=>c instanceof t,abort:!0,...P(o)});return n._zod.bag.Class=t,n._zod.check=(c)=>{if(!(c.value instanceof t))c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:n,path:[...n._zod.def.path??[]]})},n}function ci(t){let o=Ct(()=>T([e(t),a(),d(),_o(),i(o),y(e(),o)]));return o}function xa(t,o){return new ua({type:"pipe",in:yc(t),out:o})}function ee(t){return tt(Br,t)}function o0(t){return rt(Vr,t)}function Rm(t){return qi(Jr,t)}function Pm(t){return _s(at,t)}function Ec(t){return ys(Kr,t)}function _a(t){return bs(gc,t)}function ga(t){return Ps(Wr,t)}export{jr,ii,vf,ai,Pu,Nu,e,Ao,li,Sc,wf,a,h,d,_o,x,U,xf,Rt,te,i,va,r,se,T,re,Ds,$i,y,A,Dt,l,wa,Se,s,Ct,St,Du,ci,xa,ee,o0,Rm,Pm,Ec,cs};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{vo,Ot}from"./chunk-k9q4nn8b.js";import{wo,wn,sr,Ge,er,Ht}from"./chunk-6mrgtn78.js";import{w}from"./chunk-t6cn018t.js";var kf=w(function(Ns){var{hasOwn:v,fromUtf8:ur,fromHex:ls,toHex:X,toUint8Array:me,isArrayBuffer:ds}=er(),{normalizeProvider:hr}=sr(),{escapeUri:Ie,HttpRequest:gr}=Ht();class pr{format(e){let t=[];for(let i in e){if(!v(e,i))continue;let s=ur(i);t.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[i]))}let r=new Uint8Array(t.reduce((i,s)=>i+s.byteLength,0)),n=0;for(let i of t)r.set(i,n),n+=i.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":let r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":let o=ur(e.value),c=new DataView(new ArrayBuffer(3+o.byteLength));c.setUint8(0,7),c.setUint16(1,o.byteLength,!1);let a=new Uint8Array(c.buffer);return a.set(o,3),a;case"timestamp":let f=new Uint8Array(9);return f[0]=8,f.set(at.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!ms.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(ls(e.value.replace(/-/g,"")),1),u}}}var lr;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(lr||(lr={}));var ms=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class at{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;if(e<0)dr(t);return new at(t)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;if(t)dr(e);return parseInt(X(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function dr(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1;t--)if(e[t]++,e[t]!==0)break}var yr="X-Amz-Algorithm",Sr="X-Amz-Credential",ft="X-Amz-Date",wr="X-Amz-SignedHeaders",br="X-Amz-Expires",ut="X-Amz-Signature",ht="X-Amz-Security-Token",gs="X-Amz-Region-Set",lt="authorization",dt=ft.toLowerCase(),xr="date",Er=[lt,dt,xr],Nr=ut.toLowerCase(),Ue="x-amz-content-sha256",Cr=ht.toLowerCase(),ps="host",_r={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Ar=/^proxy-/,Tr=/^sec-/,ys=[/^proxy-/i,/^sec-/i],ke="AWS4-HMAC-SHA256",Ss="AWS4-ECDSA-P256-SHA256",Ir="AWS4-HMAC-SHA256-PAYLOAD",kr="UNSIGNED-PAYLOAD",Rr=50,mt="aws4_request",Mr=604800,Br=({query:e={}})=>{let t=[],r={};for(let n in e){if(!v(e,n))continue;if(n.toLowerCase()===Nr)continue;let i=Ie(n);t.push(i);let s=e[n];if(typeof s==="string")r[i]=`${i}=${Ie(s)}`;else if(Array.isArray(s))r[i]=s.slice(0).reduce((o,c)=>o.concat([`${i}=${Ie(c)}`]),[]).sort().join("&")}return t.sort().map((n)=>r[n]).filter((n)=>n).join("&")},ws=(e)=>bs(e).toISOString().replace(/\.\d{3}Z$/,"Z"),bs=(e)=>{if(typeof e==="number")return new Date(e*1000);if(typeof e==="string"){if(Number(e))return new Date(Number(e)*1000);return new Date(e)}return e};class gt{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:i,uriEscapePath:s=!0}){this.service=n,this.sha256=i,this.uriEscapePath=s,this.applyChecksum=typeof e==="boolean"?e:!0,this.regionProvider=hr(r),this.credentialProvider=hr(t)}createCanonicalRequest(e,t,r){let n=Object.keys(t).sort();return`${e.method}
|
|
3
|
+
${this.getCanonicalPath(e)}
|
|
4
|
+
${Br(e)}
|
|
5
|
+
${n.map((i)=>`${i}:${t[i]}`).join(`
|
|
6
|
+
`)}
|
|
7
|
+
|
|
8
|
+
${n.join(";")}
|
|
9
|
+
${r}`}async createStringToSign(e,t,r,n){let i=new this.sha256;i.update(me(r));let s=await i.digest();return`${n}
|
|
10
|
+
${e}
|
|
11
|
+
${t}
|
|
12
|
+
${X(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let i of e.split("/")){if(i?.length===0)continue;if(i===".")continue;if(i==="..")t.pop();else t.push(i)}let r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return Ie(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!=="object"||typeof e.accessKeyId!=="string"||typeof e.secretAccessKey!=="string")throw Error("Resolved credential object is not valid")}formatDate(e){let t=ws(e).replace(/[-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}var Y={},Re=[],Me=(e,t,r)=>`${e}/${t}/${r}/${mt}`,Ur=async(e,t,r,n,i)=>{let s=await mr(e,t.secretAccessKey,t.accessKeyId),o=`${r}:${n}:${i}:${X(s)}:${t.sessionToken}`;if(o in Y)return Y[o];Re.push(o);while(Re.length>Rr)delete Y[Re.shift()];let c=`AWS4${t.secretAccessKey}`;for(let a of[r,n,i,mt])c=await mr(e,c,a);return Y[o]=c},xs=()=>{Re.length=0,Object.keys(Y).forEach((e)=>{delete Y[e]})},mr=(e,t,r)=>{let n=new e(t);return n.update(me(r)),n.digest()},ot=({headers:e},t,r)=>{let n={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let s=i.toLowerCase();if(s in _r||t?.has(s)||Ar.test(s)||Tr.test(s)){if(!r||r&&!r.has(s))continue}n[s]=e[i].trim().replace(/\s+/g," ")}return n},Be=async({headers:e,body:t},r)=>{for(let n in e){if(!v(e,n))continue;if(n.toLowerCase()===Ue)return e[n]}if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof t==="string"||ArrayBuffer.isView(t)||ds(t)){let n=new r;return n.update(me(t)),X(await n.digest())}return kr},Dr=(e,t)=>{e=e.toLowerCase();for(let r in t){if(!v(t,r))continue;if(e===r.toLowerCase())return!0}return!1},jr=(e,t={})=>{let{headers:r,query:n={}}=gr.clone(e);for(let i in r){if(!v(r,i))continue;let s=i.toLowerCase();if(s.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(s)||t.hoistableHeaders?.has(s))n[i]=r[i],delete r[i]}return{...e,headers:r,query:n}},ct=(e)=>{e=gr.clone(e);for(let t in e.headers){if(!v(e.headers,t))continue;if(Er.indexOf(t.toLowerCase())>-1)delete e.headers[t]}return e};class zr extends gt{headerFormatter=new pr;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:i,uriEscapePath:s=!0}){super({applyChecksum:e,credentials:t,region:r,service:n,sha256:i,uriEscapePath:s})}async presign(e,t={}){let{signingDate:r=new Date,expiresIn:n=3600,unsignableHeaders:i,unhoistableHeaders:s,signableHeaders:o,hoistableHeaders:c,signingRegion:a,signingService:f}=t,u=await this.credentialProvider();this.validateResolvedCredentials(u);let h=a??await this.regionProvider(),{longDate:l,shortDate:d}=this.formatDate(r);if(n>Mr)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let p=Me(d,h,f??this.service),m=jr(ct(e),{unhoistableHeaders:s,hoistableHeaders:c});if(u.sessionToken)m.query[ht]=u.sessionToken;m.query[yr]=ke,m.query[Sr]=`${u.accessKeyId}/${p}`,m.query[ft]=l,m.query[br]=n.toString(10);let x=ot(m,i,o);return m.query[wr]=this.getCanonicalHeaderList(x),m.query[ut]=await this.getSignature(l,p,this.getSigningKey(u,h,d,f),this.createCanonicalRequest(m,x,await Be(e,this.sha256))),m}async sign(e,t){if(typeof e==="string")return this.signString(e,t);else if(e.headers&&e.payload)return this.signEvent(e,t);else if(e.message)return this.signMessage(e,t);else return this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:r=new Date,priorSignature:n,signingRegion:i,signingService:s,eventStreamCredentials:o}){let c=i??await this.regionProvider(),{shortDate:a,longDate:f}=this.formatDate(r),u=Me(a,c,s??this.service),h=await Be({headers:{},body:t},this.sha256),l=new this.sha256;l.update(e);let d=X(await l.digest()),p=[Ir,f,u,n,d,h].join(`
|
|
13
|
+
`);return this.signString(p,{signingDate:r,signingRegion:c,signingService:s,eventStreamCredentials:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:r,signingService:n,eventStreamCredentials:i}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:n,priorSignature:e.priorSignature,eventStreamCredentials:i}).then((o)=>({message:e.message,signature:o}))}async signString(e,{signingDate:t=new Date,signingRegion:r,signingService:n,eventStreamCredentials:i}={}){let s=i??await this.credentialProvider();this.validateResolvedCredentials(s);let o=r??await this.regionProvider(),{shortDate:c}=this.formatDate(t),a=new this.sha256(await this.getSigningKey(s,o,c,n));return a.update(me(e)),X(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:r,unsignableHeaders:n,signingRegion:i,signingService:s}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let c=i??await this.regionProvider(),a=ct(e),{longDate:f,shortDate:u}=this.formatDate(t),h=Me(u,c,s??this.service);if(a.headers[dt]=f,o.sessionToken)a.headers[Cr]=o.sessionToken;let l=await Be(a,this.sha256);if(!Dr(Ue,a.headers)&&this.applyChecksum)a.headers[Ue]=l;let d=ot(a,n,r),p=await this.getSignature(f,h,this.getSigningKey(o,c,u,s),this.createCanonicalRequest(a,d,l));return a.headers[lt]=`${ke} Credential=${o.accessKeyId}/${h}, SignedHeaders=${this.getCanonicalHeaderList(d)}, Signature=${p}`,a}async getSignature(e,t,r,n){let i=await this.createStringToSign(e,t,n,ke),s=new this.sha256(await r);return s.update(me(i)),X(await s.digest())}getSigningKey(e,t,r,n){return Ur(this.sha256,e,r,t,n||this.service)}}var Es={SignatureV4a:null};Ns.ALGORITHM_IDENTIFIER=ke;Ns.ALGORITHM_IDENTIFIER_V4A=Ss;Ns.ALGORITHM_QUERY_PARAM=yr;Ns.ALWAYS_UNSIGNABLE_HEADERS=_r;Ns.AMZ_DATE_HEADER=dt;Ns.AMZ_DATE_QUERY_PARAM=ft;Ns.AUTH_HEADER=lt;Ns.CREDENTIAL_QUERY_PARAM=Sr;Ns.DATE_HEADER=xr;Ns.EVENT_ALGORITHM_IDENTIFIER=Ir;Ns.EXPIRES_QUERY_PARAM=br;Ns.GENERATED_HEADERS=Er;Ns.HOST_HEADER=ps;Ns.KEY_TYPE_IDENTIFIER=mt;Ns.MAX_CACHE_SIZE=Rr;Ns.MAX_PRESIGNED_TTL=Mr;Ns.PROXY_HEADER_PATTERN=Ar;Ns.REGION_SET_PARAM=gs;Ns.SEC_HEADER_PATTERN=Tr;Ns.SHA256_HEADER=Ue;Ns.SIGNATURE_HEADER=Nr;Ns.SIGNATURE_QUERY_PARAM=ut;Ns.SIGNED_HEADERS_QUERY_PARAM=wr;Ns.SignatureV4=zr;Ns.SignatureV4Base=gt;Ns.TOKEN_HEADER=Cr;Ns.TOKEN_QUERY_PARAM=ht;Ns.UNSIGNABLE_PATTERNS=ys;Ns.UNSIGNED_PAYLOAD=kr;Ns.clearCredentialCache=xs;Ns.createScope=Me;Ns.getCanonicalHeaders=ot;Ns.getCanonicalQuery=Br;Ns.getPayloadHash=Be;Ns.getSigningKey=Ur;Ns.hasHeader=Dr;Ns.moveHeadersToQuery=jr;Ns.prepareRequest=ct;Ns.signatureV4aContainer=Es});var un=w(function(no){var{nv:Gr,NumericValue:be,calculateBodyLength:ui,generateIdempotencyToken:Wr,fromBase64:At,_parseEpochTimestamp:Se}=er(),{hasOwn:M,getSmithyContext:hi}=wo(),{HttpRequest:li,collectBody:di,SerdeContext:xe,RpcProtocol:mi}=Ht(),{NormalizedSchema:O,deref:gi,TypeRegistry:Or}=wn();function oe(e){return typeof Buffer<"u"?Buffer.alloc(e):new Uint8Array(e)}var Ee=Symbol("@smithy/core/cbor::tagSymbol");function Tt(e){return e[Ee]=!0,e}var Xr=typeof Buffer<"u",It=new TextDecoder,C=oe(0),kt=!1,L=new DataView(C.buffer,C.byteOffset,C.byteLength),E=0;function pi(e){C=e,kt=Xr&&C instanceof Buffer,L=new DataView(C.buffer,C.byteOffset,C.byteLength)}function G(e,t){if(e>=t)throw Error("unexpected end of (decode) payload.");let r=(C[e]&224)>>5,n=C[e]&31;if(n===31&&2<=r&&r<=5)return yi(e,t);switch(r){case 0:case 1:case 6:{let i,s;if(n<24)i=n,s=1;else switch(n){case 24:if(t-e<2)P(1);i=C[e+1],s=2;break;case 25:if(t-e<3)P(2);i=L.getUint16(e+1),s=3;break;case 26:if(t-e<5)P(4);i=L.getUint32(e+1),s=5;break;case 27:if(t-e<9)P(8);{let o=L.getUint32(e+1);if(o<2097152)i=o*4294967296+L.getUint32(e+5);else i=L.getBigUint64(e+1)}s=9;break;default:Mt(n)}if(r===0)return E=s,xt(i);else if(r===1){let o;if(typeof i==="bigint")o=BigInt(-1)-i;else o=-1-i;return E=s,xt(o)}else return _i(e,t,n,i,s)}case 3:return we(e,t);case 5:return wi(e,t);case 4:return Ei(e,t);case 2:return Rt(e,t);default:return Ai(e,t)}}function yi(e,t){let r=(C[e]&224)>>5;if((C[e]&31)===31)switch(r){case 3:return ki(e,t);case 5:return Ti(e,t);case 4:return Ii(e,t);case 2:return Ri(e,t)}}function Si(e,t){let r=e>>7,n=(e&124)>>2,i=(e&3)<<8|t,s=r===0?1:-1;if(n===0){if(i===0)return 0;return s*(Math.pow(2,-14)*(i/1024))}else if(n===31){if(i===0)return s*(1/0);return NaN}return s*(Math.pow(2,n-15)*(1+i/1024))}function wi(e,t){let r=Ne(e,t);if(r<25)return xi(e,t,r);return bi(e,t,r)}function bi(e,t,r){let n=E;e+=n;let i=e,s=Object.create(null);for(let o=0;o<r;++o){let c=we(e,t);if(e+=E,(C[e]&224)>>5===3)s[c]=we(e,t);else s[c]=G(e,t);e+=E}return E=n+(e-i),Object.setPrototypeOf(s,Object.prototype),s}function xi(e,t,r){let n=E;e+=n;let i=e,s={};for(let o=0;o<r;++o){let c=we(e,t);e+=E,s[c]=G(e,t),e+=E}return E=n+(e-i),s}function Ei(e,t){let r=Ne(e,t),n=E;e+=n;let i=e,s=Array(r);for(let o=0;o<r;++o)s[o]=G(e,t),e+=E;return E=n+(e-i),s}function we(e,t){let r=Ne(e,t),n=E;if(e+=n,t-e<r)P(r);if(E=n+r,r<24)return Ci(e,r);if(kt)return C.toString("utf-8",e,e+r);return It.decode(C.subarray(e,e+r))}var Lr=Array(2048),pt=new Uint16Array(2048),ge=0;function Ni(){ge=ge+1&65535}function Ci(e,t){let r=t;for(let o=0;o<t;++o)r=r*31+C[e+o]|0;let n=r>>>0&2047,i=Lr[n];if(i!==void 0){if(i.length===t){let o=!0;for(let c=0;c<t;++c)if(i.charCodeAt(c)!==C[e+c]){o=!1;break}if(o)return pt[n]=ge,i}}let s=kt?C.toString("utf-8",e,e+t):It.decode(C.subarray(e,e+t));if(pt[n]!==ge)Lr[n]=s,pt[n]=ge;return s}function Rt(e,t){let r=Ne(e,t),n=E;if(e+=n,t-e<r)P(r);let i=C.subarray(e,e+r);return E=n+r,i}function _i(e,t,r,n,i){if(r===2||r===3){let s=Ne(e+i,t),o=BigInt(0),c=e+i+E;for(let a=c;a<c+s;++a)o=o<<BigInt(8)|BigInt(C[a]);return E=i+E+s,r===3?-o-BigInt(1):o}else if(r===4){let s=G(e+i,t),[o,c]=s,a=c<0?-1:1,f=BigInt(a)*BigInt(c),u=String(f),h=c<0?"-":"",l;if(typeof o==="number"&&Math.abs(o)<=268435456){let p=o,m="0".repeat(Math.abs(p)+1)+u;if(l=p===0?m:m.slice(0,m.length+p)+"."+m.slice(p),l=l.replace(/^0+/g,""),l==="")l="0";if(l[0]===".")l="0"+l;l=h+l}else{let p=BigInt(o);if(u.length===1)l=h+u+"e"+String(p);else{let m=p+BigInt(u.length-1);l=h+u[0]+"."+u.slice(1)+"e"+String(m)}}return E=i+E,Gr(l)}else{let s=G(e+i,t);return E=i+E,Tt({tag:xt(n),value:s})}}function Ai(e,t){let r=C[e]&31;switch(r){case 21:case 20:return E=1,r===21;case 22:return E=1,null;case 23:return E=1,null;case 25:if(t-e<3)throw Error("incomplete float16 at end of buf.");return E=3,Si(C[e+1],C[e+2]);case 26:if(t-e<5)throw Error("incomplete float32 at end of buf.");return E=5,L.getFloat32(e+1);case 27:if(t-e<9)throw Error("incomplete float64 at end of buf.");return E=9,L.getFloat64(e+1);default:Mt(r)}}function Ne(e,t){let r=C[e]&31;if(r<24)return E=1,r;switch(r){case 24:if(t-e<2)P(1);return E=2,C[e+1];case 25:if(t-e<3)P(2);return E=3,L.getUint16(e+1);case 26:if(t-e<5)P(4);return E=5,L.getUint32(e+1);case 27:if(t-e<9)P(8);return E=9,Mi(L.getBigUint64(e+1));default:Mt(r)}}function Ti(e,t){e+=1;let r=e,n={};for(;e<t;){if(C[e]===255)return E=e-r+2,n;let i=we(e,t);e+=E,n[i]=G(e,t),e+=E}throw Error("expected break marker.")}function Ii(e,t){e+=1;let r=[];for(let n=e;e<t;){if(C[e]===255)return E=e-n+2,r;r.push(G(e,t)),e+=E}throw Error("expected break marker.")}function ki(e,t){e+=1;let r=[];for(let n=e;e<t;){if(C[e]===255){let a=oe(r.length);if(a.set(r,0),E=e-n+2,Xr)return a.toString("utf-8",0,a.length);return It.decode(a)}let i=(C[e]&224)>>5,s=C[e]&31;if(i!==3)Jr(i);if(s===31)throw Error("nested indefinite string.");let o=Rt(e,t);e+=E;for(let a=0;a<o.length;++a)r.push(o[a])}throw Error("expected break marker.")}function Ri(e,t){e+=1;let r=[];for(let n=e;e<t;){if(C[e]===255){let a=oe(r.length);return a.set(r,0),E=e-n+2,a}let i=(C[e]&224)>>5,s=C[e]&31;if(i!==2)Jr(i);if(s===31)throw Error("nested indefinite string.");let o=Rt(e,t);e+=E;for(let a=0;a<o.length;++a)r.push(o[a])}throw Error("expected break marker.")}function xt(e){if(typeof e==="number")return e;let t=Number(e);if(Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER)return t;return e}function Mi(e){let t=Number(e);if(t<Number.MIN_SAFE_INTEGER||Number.MAX_SAFE_INTEGER<t)console.warn(Error(`@smithy/core/cbor - truncating BigInt(${e}) to ${t} with loss of precision.`));return t}function P(e){throw Error(`length ${e} greater than remaining buf len.`)}function Mt(e){throw Error(`unexpected minor value ${e}.`)}function Jr(e){throw Error(`unexpected major type ${e} in indefinite string.`)}var Bi=typeof Buffer<"u",ee=new Map,pe=0,Et=!1,Ui=2048,S=oe(Ui),z=new DataView(S.buffer,S.byteOffset,S.byteLength),g=0;function Di(e){let t=[e];while(t.length){let r=t.pop();if(typeof r==="string"){let n=r.length;if(Bi)if(te(n*3+9),n>23)yt(3,Buffer.byteLength(r)),g+=S.write(r,g);else zi(r);else{let i=n*3;te(i+9);let s=g,c=new TextEncoder().encodeInto(r,S.subarray(g+9)).written,a;if(c<24)a=1;else if(c<256)a=2;else if(c<65536)a=3;else if(c<4294967296)a=5;else a=9;if(a<9)S.copyWithin(s+a,s+9,s+9+c);g=s,J(3,c),g+=c}continue}if(S.byteLength-g<9)te(64);if(typeof r==="number"){if(Number.isInteger(r)&&r>=-9007199254740992&&r<=9007199254740991){let n=r>=0,i=n?0:1,s=n?r:-r-1;if(s<24)S[g++]=i<<5|s;else if(s<256)S[g++]=i<<5|24,S[g++]=s;else if(s<65536)S[g++]=i<<5|25,S[g++]=s>>8,S[g++]=s&255;else if(s<4294967296)S[g++]=i<<5|26,z.setUint32(g,s),g+=4;else{S[g++]=i<<5|27;let o=s/4294967296|0,c=s-o*4294967296|0;z.setUint32(g,o),z.setUint32(g+4,c),g+=8}continue}S[g++]=251,z.setFloat64(g,r),g+=8;continue}else if(typeof r==="bigint"){let n=r>=0,i=n?0:1,s=n?r:-r-BigInt(1);if(s<BigInt("18446744073709551616")){let o=Number(s);if(o<4294967296)J(i,o);else S[g++]=i<<5|27,z.setBigUint64(g,s),g+=8}else{let o=s.toString(2),c=new Uint8Array(Math.ceil(o.length/8)),a=s,f=0;while(c.byteLength-++f>=0)c[c.byteLength-f]=Number(a&BigInt(255)),a>>=BigInt(8);te(c.byteLength*2+16),S[g++]=n?194:195,yt(2,c.byteLength),S.set(c,g),g+=c.byteLength}continue}else if(r===null){S[g++]=246;continue}else if(typeof r==="boolean"){S[g++]=224|(r?21:20);continue}else if(typeof r>"u")throw Error("@smithy/core/cbor: client may not serialize undefined value.");else if(Array.isArray(r)){J(4,r.length),te(r.length*9+64);for(let n=r.length-1;n>=0;--n)t.push(r[n]);continue}else if(typeof r.byteLength==="number"){te(r.length*2+9),J(2,r.length),S.set(r,g),g+=r.byteLength;continue}else if(typeof r==="object"){if(r instanceof be){let s=r.string,o=BigInt(0),c=s.search(/[eE]/);if(c!==-1)o=BigInt(s.slice(c+1)),s=s.slice(0,c);let a=s.indexOf("."),f=a===-1?0:s.length-a-1,u=o-BigInt(f),h=BigInt(s.replace(".",""));S[g++]=196,J(4,2),t.push(h),t.push(u>=-0x20000000000000n&&u<=0x1fffffffffffffn?Number(u):u);continue}if(r[Ee])if("tag"in r&&"value"in r){t.push(r.value),yt(6,r.tag);continue}else throw Error("tag encountered with missing fields, need 'tag' and 'value', found: "+JSON.stringify(r));let n=Object.keys(r),i=n.length;J(5,i);for(let s=i-1;s>=0;--s)t.push(r[n[s]]),t.push(n[s]);continue}throw Error(`data type ${r?.constructor?.name??typeof r} not compatible for encoding.`)}}function ji(){pe=pe+1&65535,Et=!1}function $r(){let e=oe(g);return e.set(S.subarray(0,g),0),g=0,e}function Nt(e){let t=S;if(S=oe(e),t)if(t.copy)t.copy(S,0,0,t.byteLength);else S.set(t,0);z=new DataView(S.buffer,S.byteOffset,S.byteLength)}function zi(e){let t=ee.get(e);if(t!==void 0){S.set(t.bytes,g),g+=t.bytes.length,t.epoch=pe;return}let r=g,n=Buffer.byteLength(e);J(3,n),g+=S.write(e,g);let i=Uint8Array.prototype.slice.call(S,r,g);if(ee.size>=2048){if(Et)return;let s=0;for(let[o,c]of ee){if(s>=1024)break;if(c.epoch!==pe)ee.delete(o),s++}if(s===0){Et=!0;return}}if(ee.size<2048)ee.set(e,{epoch:pe,bytes:i})}function te(e){if(S.byteLength-g<e)if(g<16000000)Nt(Math.max(S.byteLength*4,S.byteLength+e));else Nt(S.byteLength+e+16000000)}function yt(e,t){if(t<24)S[g++]=e<<5|t;else if(t<256)S[g++]=e<<5|24,S[g++]=t;else if(t<65536)S[g++]=e<<5|25,z.setUint16(g,t),g+=2;else if(t<4294967296)S[g++]=e<<5|26,z.setUint32(g,t),g+=4;else S[g++]=e<<5|27,z.setBigUint64(g,typeof t==="bigint"?t:BigInt(t)),g+=8}function J(e,t){if(t<24)S[g++]=e<<5|t;else if(t<256)S[g++]=e<<5|24,S[g++]=t;else if(t<65536)S[g++]=e<<5|25,S[g++]=t>>8,S[g++]=t&255;else if(t<4294967296)S[g++]=e<<5|26,z.setUint32(g,t),g+=4;else{S[g++]=e<<5|27;let r=t/4294967296|0,n=t-r*4294967296|0;z.setUint32(g,r),z.setUint32(g+4,n),g+=8}}var Le={deserialize(e){return Ni(),pi(e),G(0,e.length)},serialize(e){ji();try{return Di(e),$r()}catch(t){throw $r(),t}},resizeEncodingBuffer(e){Nt(e)}},Zr=(e,t)=>di(e,t).then(async(r)=>{if(r.length)try{return Le.deserialize(r)}catch(n){throw Object.defineProperty(n,"$responseBodyText",{value:t.utf8Encoder(r)}),n}return{}}),De=(e)=>Tt({tag:1,value:e.getTime()/1000}),Oi=async(e,t)=>{let r=await Zr(e,t);return r.message=r.message??r.Message,r},Yr=(e,t)=>{let r=(i)=>{let s=i;if(typeof s==="number")s=s.toString();if(s.indexOf(",")>=0)s=s.split(",")[0];if(s.indexOf(":")>=0)s=s.split(":")[0];if(s.indexOf("#")>=0)s=s.split("#")[1];return s};if(t.__type!==void 0)return r(t.__type);let n;for(let i in t){if(!M(t,i))continue;if(i.toLowerCase()==="code"){n=i;break}}if(n&&t[n]!==void 0)return r(t[n])},Li=(e)=>{if(String(e.headers["smithy-protocol"]).toLowerCase()!=="rpc-v2-cbor")throw Error("Malformed RPCv2 CBOR response, status: "+e.statusCode)},$i=async(e,t,r,n,i)=>{let s=await e.endpoint(),{hostname:o,protocol:c="https",port:a,path:f}=s,u={protocol:c,hostname:o,port:a,method:"POST",path:f.endsWith("/")?f.slice(0,-1)+r:f+r,headers:{...t}};if(n!==void 0)u.hostname=n;if(s.headers)for(let h in s.headers){if(!M(s.headers,h))continue;u.headers[h]=s.headers[h]}if(i!==void 0){u.body=i;try{u.headers["content-length"]=String(ui(i))}catch(h){}}return new li(u)};class Bt extends xe{write(e,t){b=0;let r=O.of(e);ne(r,t,void 0,this.serdeContext)}flush(){let e=N.subarray(0,b);return b=0,N=vr(Ct),Z=new DataView(N.buffer,N.byteOffset,N.byteLength),e}}var Vr=Symbol.for("@smithy/cbor-struct-cache");function Ut(e){let t=e.getSchema(),r=t[Vr];if(r)return r;let n=[],i=[];for(let[c,a]of e.structIterator())n.push(c),i.push(a);let s=Array(n.length);for(let c=0;c<n.length;++c)s[c]=Vi(n[c]);let o={memberNames:n,memberSchemas:i,encodedKeys:s};return t[Vr]=o,o}function Vi(e){let t;if($e)t=Buffer.from(e,"utf-8");else t=new TextEncoder().encode(e);let r=t.length,n;if(r<24)n=1;else if(r<256)n=2;else n=3;let i=new Uint8Array(n+r);if(n===1)i[0]=96|r;else if(n===2)i[0]=120,i[1]=r;else i[0]=121,i[1]=r>>8,i[2]=r&255;return i.set(t,n),i}var $e=typeof Buffer<"u",Fi=new TextEncoder,Ct=2048,N=$e?Buffer.allocUnsafe(Ct):new Uint8Array(Ct),Z=new DataView(N.buffer,N.byteOffset,N.byteLength),b=0,Fr=2048,re=new Map,St=0,Pr=!1;function vr(e){return $e?Buffer.allocUnsafe(e):new Uint8Array(e)}function ne(e,t,r,n){if(t==null){if(t===void 0&&e.isIdempotencyToken()){H(Wr());return}_(1),N[b++]=246;return}if(e.isUnitSchema()){_(1),R(5,0);return}if(typeof t==="object"){if(e.isBlobSchema()){if(t instanceof Uint8Array){je(t);return}}if(e.isTimestampSchema()){if(t instanceof Date){_t(t);return}}if(e.isStructSchema()){Pi(e,t,n);return}if(Array.isArray(t)&&(e.isListSchema()||e.isDocumentSchema())){Hr(e,t,e.isDocumentSchema(),n);return}if(e.isMapSchema()){wt(e,t,!1,n);return}if(t instanceof Date){_t(t);return}if(t instanceof Uint8Array){je(t);return}if(t instanceof be){rn(t);return}if(t[Ee]){let s=t;tn(s.tag,s.value);return}if(e.isDocumentSchema()){if(Array.isArray(t))Hr(e,t,!0,n);else wt(e,t,!0,n);return}if(e.isBigDecimalSchema()){se(t);return}wt(e,t,!0,n);return}if(typeof t==="string"){if(e.isBlobSchema()){let s=(n?.base64Decoder??At)(t);je(s);return}H(t);return}if(typeof t==="number"){if(_(9),Number.isInteger(t)&&t>=-9007199254740992&&t<=9007199254740991)Ve(t);else Dt(t);return}if(typeof t==="boolean"){_(1),N[b++]=224|(t?21:20);return}if(typeof t==="bigint"){Oe(t);return}H(String(t))}function Pi(e,t,r){if(e.isUnionSchema()){let h=!1;for(let[l,d]of e.structIterator()){let p=t[l];if(p!=null){_(9),R(5,1),H(l),ne(d,p,e,r),h=!0;break}}if(!h){let{$unknown:l}=t;if(Array.isArray(l))_(9),R(5,1),H(l[0]),se(l[1]);else _(9),R(5,0)}return}let n=Ut(e),{memberNames:i,memberSchemas:s,encodedKeys:o}=n,c=i.length,a;if(c<24)a=1;else if(c<256)a=2;else a=3;_(a);let f=b;b+=a;let u=0;for(let h=0;h<c;++h){let l=t[i[h]];if(l==null&&!s[h].isIdempotencyToken())continue;let d=o[h];_(d.length),N.set(d,b),b+=d.length,ne(s[h],l,e,r),++u}if(typeof t.__type==="string")for(let h in t){if(!M(t,h))continue;if(!i.includes(h))H(h),se(t[h]),++u}if(a===1)N[f]=160|u;else if(a===2)N[f]=184,N[f+1]=u;else N[f]=185,N[f+1]=u>>8,N[f+2]=u&255}function Hr(e,t,r,n){let i=!!e.getMergedTraits().sparse,s=e.getValueSchema();if(r||i){let o=[];for(let c=0;c<t.length;++c){let a=t[c];if(r){if(a!==void 0)o.push(a)}else if(a!=null||i)o.push(a)}_(9),R(4,o.length);for(let c=0;c<o.length;++c)ne(s,o[c],void 0,n)}else{let o=0;for(let c=0;c<t.length;++c)if(t[c]!=null)++o;_(9),R(4,o);for(let c=0;c<t.length;++c)if(t[c]!=null)ne(s,t[c],void 0,n)}}function wt(e,t,r,n){let i=!!e.getMergedTraits().sparse,s=e.getValueSchema(),o=[];for(let c in t){if(!M(t,c))continue;let a=t[c];if(r?a!==void 0:a!=null||i)o.push(c)}_(9),R(5,o.length);for(let c=0;c<o.length;++c){let a=o[c];H(a),ne(s,t[a],void 0,n)}}function se(e){if(e==null){_(1),N[b++]=246;return}if(typeof e==="string"){H(e);return}if(typeof e==="number"){if(_(9),Number.isInteger(e)&&e>=-9007199254740992&&e<=9007199254740991)Ve(e);else Dt(e);return}if(typeof e==="boolean"){_(1),N[b++]=224|(e?21:20);return}if(typeof e==="bigint"){Oe(e);return}if(e instanceof Uint8Array){je(e);return}if(e instanceof Date){_t(e);return}if(e instanceof be){rn(e);return}if(e[Ee]){let t=e;tn(t.tag,t.value);return}if(Array.isArray(e)){_(9),R(4,e.length);for(let t=0;t<e.length;++t)se(e[t]);return}if(typeof e==="object"){let t=Object.keys(e);_(9),R(5,t.length);for(let r=0;r<t.length;++r)H(t[r]),se(e[t[r]]);return}H(String(e))}function _(e){if(b+e>N.length){let t=N.length*2;while(t<b+e)t*=2;let r=vr(t);r.set(N.subarray(0,b)),N=r,Z=new DataView(r.buffer,r.byteOffset,r.byteLength)}}function R(e,t){if(t<24)N[b++]=e<<5|t;else if(t<256)N[b++]=e<<5|24,N[b++]=t;else if(t<65536)N[b++]=e<<5|25,N[b++]=t>>8,N[b++]=t&255;else if(t<4294967296)N[b++]=e<<5|26,Z.setUint32(b,t),b+=4;else{N[b++]=e<<5|27;let r=t/4294967296|0,n=t-r*4294967296|0;Z.setUint32(b,r),Z.setUint32(b+4,n),b+=8}}function en(e,t){let r=Number(t);if(r<4294967296){R(e,r);return}N[b++]=e<<5|27,Z.setBigUint64(b,t),b+=8}function H(e){let t=e.length;if(t<=23){let r=re.get(e);if(r){_(r.bytes.length),N.set(r.bytes,b),b+=r.bytes.length,r.epoch=St;return}let n=b;Kr(e,t);let i=b,s=Uint8Array.prototype.slice.call(N,n,i);if(re.size>=Fr){if(Pr)return;let o=0;for(let[c,a]of re){if(o>=1024)break;if(a.epoch!==St)re.delete(c),++o}if(o===0){Pr=!0;return}}if(re.size<Fr)re.set(e,{epoch:St,bytes:s});return}Kr(e,t)}function Kr(e,t){if($e){let r=t*3;_(r+9);let n=Buffer.byteLength(e);R(3,n),b+=N.write(e,b)}else{let r=t*3;_(r+9);let n=b,s=Fi.encodeInto(e,N.subarray(n+9)).written,o;if(s<24)o=1;else if(s<256)o=2;else if(s<65536)o=3;else if(s<4294967296)o=5;else o=9;if(o<9)N.copyWithin(n+o,n+9,n+9+s);b=n,R(3,s),b+=s}}function Dt(e){_(9),N[b++]=251,Z.setFloat64(b,e),b+=8}function Ve(e){_(9);let t=e>=0,r=t?0:1,n=t?e:-e-1;R(r,n)}function Oe(e){let t=e>=0,r=t?0:1,n=t?e:-e-BigInt(1);if(n<BigInt("18446744073709551616"))_(9),en(r,n);else{let i=n.toString(2),s=Math.ceil(i.length/8),o=new Uint8Array(s),c=n;for(let a=s-1;a>=0;--a)o[a]=Number(c&BigInt(255)),c>>=BigInt(8);_(s+16),N[b++]=t?194:195,R(2,s),N.set(o,b),b+=s}}function je(e){_(e.length+9),R(2,e.length),N.set(e,b),b+=e.length}function tn(e,t){if(_(9),typeof e==="bigint")en(6,e);else R(6,e);se(t)}function rn(e){let t=e.string,r=BigInt(0),n=t.search(/[eE]/);if(n!==-1)r=BigInt(t.slice(n+1)),t=t.slice(0,n);let i=t.indexOf("."),s=i===-1?0:t.length-i-1,o=r-BigInt(s),c=BigInt(t.replace(".",""));if(_(9),N[b++]=196,R(4,2),_(9),o>=-0x20000000000000n&&o<=0x1fffffffffffffn)Ve(Number(o));else Oe(o);Oe(c)}function _t(e){_(18),R(6,1);let t=e.getTime()/1000;if(Number.isInteger(t))Ve(t);else Dt(t)}class jt extends xe{read(e,t){return I=t,Lt=nn&&t instanceof Buffer,Q=new DataView(t.buffer,t.byteOffset,t.byteLength),y=0,k=t.length,ye=ye+1&65535,D(O.of(e))}readValue(e,t){return ze(O.of(e),t)}}var nn=typeof Buffer<"u",zt=new TextDecoder,I=new Uint8Array(0),Lt=!1,Q=new DataView(new ArrayBuffer(0)),y=0,k=0,$t=2048,qr=Array($t),bt=new Uint16Array($t),ye=0;function D(e){if(y>=k)throw Error("unexpected end of CBOR payload.");let t=(I[y]&224)>>5;if((I[y]&31)===31&&t>=2&&t<=5)return Gi(e,t);switch(t){case 0:return Yi();case 1:return vi();case 2:return He();case 3:return ie();case 4:return Hi(e);case 5:return Ki(e);case 6:return Qi();case 7:return to();default:throw Error(`unexpected CBOR major type ${t}.`)}}function Hi(e){let t=Pe(),r=e.isListSchema()?e.getValueSchema():e,n=Array(t);for(let i=0;i<t;++i)n[i]=D(r);return n}function Ki(e){let t=Pe();if(e.isStructSchema())return qi(e,t,y);let r=e.isMapSchema()?e.getValueSchema():e,n={};for(let i=0;i<t;++i){let s=ie();n[s]=D(r)}return n}function qi(e,t,r){let n=e.isUnionSchema(),i=Ut(e),{memberSchemas:s,encodedKeys:o,memberNames:c}=i,a=o.length,f={},u,h,l=0,d=!1,p=0;for(let m=0;m<t;++m){let x=sn(o,a,p);if(x>=0){if(p=x+1,p>=a)p=0;let A=D(s[x]);if(A!=null)f[c[x]]=A}else{let A=ie(),U=D(O.of(15));if(A==="__type"&&typeof U==="string")d=!0;else u=A,h=U,++l}}if(n){let m=!0;for(let x in f){if(!M(f,x))continue;m=!1;break}if(m&&l===1)f.$unknown=[u,h]}else if(d){y=r;let m=O.of(15);for(let x=0;x<t;++x){let A=ie(),U=D(m);if(!(A in f))f[A]=U}}return f}function Qi(e){let t=Fe(),r=typeof t==="bigint"?Number(t):t;if(r===1){let s=O.of(15),o=D(s);return Se(o)}if(r===2||r===3){let s=He(),o=BigInt(0);for(let c=0;c<s.length;++c)o=o<<BigInt(8)|BigInt(s[c]);return r===3?-o-BigInt(1):o}if(r===4){let s=O.of(15),o=D(s),[c,a]=o,f=a<0?-1:1,u=BigInt(f)*BigInt(a),h=String(u),l=a<0?"-":"",d;if(typeof c==="number"&&Math.abs(c)<=268435456){let m=c,x="0".repeat(Math.abs(m)+1)+h;if(d=m===0?x:x.slice(0,x.length+m)+"."+x.slice(m),d=d.replace(/^0+/g,""),d==="")d="0";if(d[0]===".")d="0"+d;d=l+d}else{let m=BigInt(c);if(h.length===1)d=l+h+"e"+String(m);else{let x=m+BigInt(h.length-1);d=l+h[0]+"."+h.slice(1)+"e"+String(x)}}return Gr(d)}let n=O.of(15),i=D(n);return{tag:on(t),value:i}}function Gi(e,t){switch(t){case 3:return Wi();case 2:return Xi();case 4:return Ji(e);case 5:return Zi(e);default:throw Error(`unexpected indefinite length for major ${t}.`)}}function Wi(){y+=1;let e=[],t=0;while(y<k){if(I[y]===255){y+=1;let n=new Uint8Array(t),i=0;for(let s=0;s<e.length;++s)n.set(e[s],i),i+=e[s].length;if(nn)return Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf-8");return zt.decode(n)}let r=He();e.push(r),t+=r.length}throw Error("expected break marker.")}function Xi(){y+=1;let e=[],t=0;while(y<k){if(I[y]===255){y+=1;let n=new Uint8Array(t),i=0;for(let s=0;s<e.length;++s)n.set(e[s],i),i+=e[s].length;return n}let r=He();e.push(r),t+=r.length}throw Error("expected break marker.")}function Ji(e){y+=1;let t=e.isListSchema()?e.getValueSchema():e,r=[];while(y<k){if(I[y]===255)return y+=1,r;r.push(D(t))}throw Error("expected break marker.")}function Zi(e){if(y+=1,e.isStructSchema()){let n=Ut(e),{memberSchemas:i,encodedKeys:s,memberNames:o}=n,c=s.length,a=e.isUnionSchema(),f={},u,h,l=0,d=0;while(y<k){if(I[y]===255){if(y+=1,a){let m=!0;for(let x in f){if(!M(f,x))continue;m=!1;break}if(m&&l===1)f.$unknown=[u,h]}return f}let p=sn(s,c,d);if(p>=0){if(d=p+1,d>=c)d=0;let m=D(i[p]);if(m!=null)f[o[p]]=m}else{let m=ie(),x=D(O.of(15));if(m!=="__type")u=m,h=x,++l}}throw Error("expected break marker.")}let t=e.isMapSchema()?e.getValueSchema():e,r={};while(y<k){if(I[y]===255)return y+=1,r;let n=ie();r[n]=D(t)}throw Error("expected break marker.")}function sn(e,t,r){let n=e[r];if(y+n.length<=k&&Qr(y,n))return y+=n.length,r;for(let i=0;i<t;++i){if(i===r)continue;let s=e[i];if(y+s.length<=k&&Qr(y,s))return y+=s.length,i}return-1}function Qr(e,t){let r=t.length;if(I[e]!==t[0])return!1;for(let n=1;n<r;++n)if(I[e+n]!==t[n])return!1;return!0}function Fe(){let e=I[y]&31;if(e<24)return y+=1,e;switch(e){case 24:if(k-y<2)q(1);return y+=2,I[y-1];case 25:if(k-y<3)q(2);return y+=3,Q.getUint16(y-2);case 26:if(k-y<5)q(4);return y+=5,Q.getUint32(y-4);case 27:{if(k-y<9)q(8);y+=9;let t=Q.getUint32(y-8);if(t<2097152)return t*4294967296+Q.getUint32(y-4);return Q.getBigUint64(y-8)}default:throw Error(`unexpected minor value ${e}.`)}}function Pe(){let e=Fe();return typeof e==="bigint"?Number(e):e}function Yi(){let e=Fe();return on(e)}function vi(){let e=Fe();if(typeof e==="bigint")return BigInt(-1)-e;return-1-e}function He(){let e=Pe();if(k-y<e)q(e);let t=y;return y+=e,I.subarray(t,t+e)}function ie(){let e=Pe();if(k-y<e)q(e);let t=y;if(y+=e,e<24)return eo(t,e);if(Lt)return I.toString("utf-8",t,t+e);return zt.decode(I.subarray(t,t+e))}function eo(e,t){let r=t;for(let o=0;o<t;++o)r=r*31+I[e+o]|0;let n=r>>>0&$t-1,i=qr[n];if(i!==void 0&&i.length===t){let o=!0;for(let c=0;c<t;++c)if(i.charCodeAt(c)!==I[e+c]){o=!1;break}if(o)return bt[n]=ye,i}let s=Lt?I.toString("utf-8",e,e+t):zt.decode(I.subarray(e,e+t));if(bt[n]!==ye)qr[n]=s,bt[n]=ye;return s}function to(){let e=y,t=I[e]&31;switch(t){case 21:return y=e+1,!0;case 20:return y=e+1,!1;case 22:return y=e+1,null;case 23:return y=e+1,null;case 25:{if(k-e<3)q(2);return y=e+3,ro(I[e+1],I[e+2])}case 26:{if(k-e<5)q(4);return y=e+5,Q.getFloat32(e+1)}case 27:{if(k-e<9)q(8);return y=e+9,Q.getFloat64(e+1)}default:throw Error(`unexpected minor value ${t} for major 7.`)}}function ro(e,t){let r=e>>7,n=(e&124)>>2,i=(e&3)<<8|t,s=r===0?1:-1;if(n===0){if(i===0)return 0;return s*(Math.pow(2,-14)*(i/1024))}else if(n===31){if(i===0)return s*(1/0);return NaN}return s*(Math.pow(2,n-15)*(1+i/1024))}function on(e){if(typeof e==="number")return e;let t=Number(e);if(Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER)return t;return e}function q(e){throw Error(`CBOR: length ${e} greater than remaining buffer length.`)}function ze(e,t){if(e.isTimestampSchema()){if(typeof t==="number")return Se(t);if(typeof t==="object"&&t!==null){if(t.tag===1&&"value"in t)return Se(t.value)}}if(e.isBlobSchema())return t;if(typeof t>"u"||typeof t==="boolean"||typeof t==="number"||typeof t==="string"||typeof t==="bigint"||typeof t==="symbol")return t;if(typeof t!=="object"||t===null)return t;if("byteLength"in t)return t;if(t instanceof Date)return t;if(t instanceof be)return t;if(e.isDocumentSchema())return t;if(e.isListSchema()){let n=e.getValueSchema(),i=[];for(let s of t)i.push(ze(n,s));return i}let r={};if(e.isMapSchema()){let n=e.getValueSchema();for(let i in t){if(!M(t,i))continue;r[i]=ze(n,t[i])}}else if(e.isStructSchema()){let n=e.isUnionSchema(),i;if(n){i=new Set;for(let s in t){if(!M(t,s))continue;if(s!=="__type")i.add(s)}}for(let[s,o]of e.structIterator()){if(n)i.delete(s);if(t[s]!=null)r[s]=ze(o,t[s])}if(n&&i?.size===1){let s=!0;for(let o in r){if(!M(r,o))continue;s=!1;break}if(s){let o=i.values().next().value;r.$unknown=[o,t[o]]}}else if(typeof t.__type==="string")for(let s in t){if(!M(t,s))continue;if(!(s in r))r[s]=t[s]}}return r}class Vt extends xe{createSerializer(){let e=new Bt;return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new jt;return e.setSerdeContext(this.serdeContext),e}}class cn extends mi{codec=new Vt;serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();constructor({defaultNamespace:e,errorTypeRegistries:t}){super({defaultNamespace:e,errorTypeRegistries:t})}getShapeId(){return"smithy.protocols#rpcv2Cbor"}getPayloadCodec(){return this.codec}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r);if(Object.assign(n.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":"rpc-v2-cbor",accept:this.getDefaultContentType()}),gi(e.input)==="unit")delete n.body,delete n.headers["content-type"];else{if(!n.body)this.serializer.write(15,{}),n.body=this.serializer.flush();if(n.body instanceof Uint8Array)n.headers["content-length"]=String(n.body.byteLength)}let{service:i,operation:s}=hi(r),o=`/service/${i}/operation/${s}`;if(n.path.endsWith("/"))n.path+=o.slice(1);else n.path+=o;return n}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,n,i){let s=Yr(r,n)??"Unknown",o={$metadata:i,$fault:r.statusCode<=500?"client":"server"},c=this.options.defaultNamespace;if(s.includes("#"))[c]=s.split("#");let a=this.compositeErrorRegistry,f=Or.for(c);a.copyFrom(f);let u;try{u=a.getSchema(s)}catch(x){if(n.Message)n.message=n.Message;let A=Or.for("smithy.ts.sdk.synthetic."+c);a.copyFrom(A);let U=a.getBaseException();if(U){let j=a.getErrorCtor(U);throw Object.assign(new j({name:s}),o,n)}throw Object.assign(Error(s),o,n)}let h=O.of(u),l=a.getErrorCtor(u),d=n.message??n.Message??"Unknown",p=new l({}),m={};for(let[x,A]of h.structIterator())m[x]=this.deserializer.readValue(A,n[x]);throw Object.assign(p,o,{$fault:h.getMergedTraits().error,message:d},m)}getDefaultContentType(){return"application/cbor"}}class an extends xe{value;write(e,t){this.value=this.serialize(e,t)}serialize(e,t){let r=O.of(e);if(t==null){if(r.isIdempotencyToken())return Wr();return t}if(r.isBlobSchema()){if(typeof t==="string")return(this.serdeContext?.base64Decoder??At)(t);return t}if(r.isTimestampSchema()){if(typeof t==="number"||typeof t==="bigint")return De(new Date(Number(t)/1000|0));return De(t)}if(typeof t==="function"||typeof t==="object"){let n=t;if(r.isListSchema()&&Array.isArray(n)){let s=!!r.getMergedTraits().sparse,o=[],c=0;for(let a of n){let f=this.serialize(r.getValueSchema(),a);if(f!=null||s)o[c++]=f}return o}if(n instanceof Date)return De(n);let i={};if(r.isMapSchema()){let s=!!r.getMergedTraits().sparse;for(let o in n){if(!M(n,o))continue;let c=this.serialize(r.getValueSchema(),n[o]);if(c!=null||s)i[o]=c}}else if(r.isStructSchema()){for(let[o,c]of r.structIterator()){let a=this.serialize(c,n[o]);if(a!=null)i[o]=a}if(r.isUnionSchema()&&Array.isArray(n.$unknown)){let[o,c]=n.$unknown;i[o]=c}else if(typeof n.__type==="string")for(let o in n){if(!M(n,o))continue;if(!(o in i))i[o]=this.serialize(15,n[o])}}else if(r.isDocumentSchema()){if(Array.isArray(n)){let s=[],o=0;for(let c of n)s[o++]=this.serialize(r.getValueSchema(),c);return s}for(let s in n){if(!M(n,s))continue;i[s]=this.serialize(r.getValueSchema(),n[s])}}else if(r.isBigDecimalSchema())return n;return i}return t}flush(){let e=Le.serialize(this.value);return this.value=void 0,e}}class fn extends xe{read(e,t){let r=Le.deserialize(t);return this.readValue(e,r)}readValue(e,t){let r=O.of(e);if(r.isTimestampSchema()){if(typeof t==="number")return Se(t);if(typeof t==="object"){if(t.tag===1&&"value"in t)return Se(t.value)}}if(r.isBlobSchema()){if(typeof t==="string")return(this.serdeContext?.base64Decoder??At)(t);return t}if(typeof t>"u"||typeof t==="boolean"||typeof t==="number"||typeof t==="string"||typeof t==="bigint"||typeof t==="symbol")return t;else if(typeof t==="object"){if(t===null)return null;if("byteLength"in t)return t;if(t instanceof Date)return t;if(r.isDocumentSchema())return t;if(r.isListSchema()){let i=[],s=r.getValueSchema();for(let o of t){let c=this.readValue(s,o);i.push(c)}return i}let n={};if(r.isMapSchema()){let i=r.getValueSchema();for(let s in t){if(!M(t,s))continue;let o=this.readValue(i,t[s]);n[s]=o}}else if(r.isStructSchema()){let i=r.isUnionSchema(),s;if(i){s=new Set;for(let o in t){if(!M(t,o))continue;if(o!=="__type")s.add(o)}}for(let[o,c]of r.structIterator()){if(i)s.delete(o);if(t[o]!=null)n[o]=this.readValue(c,t[o])}if(i&&s?.size===1){let o=!0;for(let c in n){if(!M(n,c))continue;o=!1;break}if(o){let c=s.values().next().value;n.$unknown=[c,t[c]]}}else if(typeof t.__type==="string")for(let o in t){if(!M(t,o))continue;if(!(o in n))n[o]=t[o]}}else if(t instanceof be)return t;return n}else return t}}no.CborCodec=Vt;no.CborShapeDeserializer=fn;no.CborShapeDeserializer2=jt;no.CborShapeSerializer=an;no.CborShapeSerializer2=Bt;no.SmithyRpcV2CborProtocol=cn;no.buildHttpRpcRequest=$i;no.cbor=Le;no.checkCborResponse=Li;no.dateToTag=De;no.loadSmithyRpcV2CborErrorCode=Yr;no.parseCborBody=Zr;no.parseCborErrorBody=Oi;no.tag=Tt;no.tagSymbol=Ee});var hn=w(function(Io){var xo=/[&<>"]/g,Eo={"&":"&","<":"<",">":">",'"':"""};function No(e){return e.replace(xo,(t)=>Eo[t])}var Co=/[&"'<>\r\n\u0085\u2028]/g,_o={"&":"&",'"':""","'":"'","<":"<",">":">","\r":"
","\n":"
","\x85":"…","\u2028":"
"};function Ao(e){return e.replace(Co,(t)=>_o[t])}class Pt{value;constructor(e){this.value=e}toString(){return Ao(""+this.value)}}class Ce{name;children;attributes={};static of(e,t,r){let n=new Ce(e);if(t!==void 0)n.addChildNode(new Pt(t));if(r!==void 0)n.withName(r);return n}constructor(e,t=[]){this.name=e,this.children=t}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){if(t!=null)this.attributes[e]=t;return this}cc(e,t,r=t){if(e[t]!=null){let n=Ce.of(t,e[t]).withName(r);this.c(n)}}l(e,t,r,n){if(e[t]!=null)n().map((s)=>{s.withName(r),this.c(s)})}lc(e,t,r,n){if(e[t]!=null){let i=n(),s=new Ce(r);i.map((o)=>{s.c(o)}),this.c(s)}}toString(){let e=Boolean(this.children.length),t=`<${this.name}`,r=this.attributes;for(let n of Object.keys(r)){let i=r[n];if(i!=null)t+=` ${n}="${No(""+i)}"`}return t+=!e?"/>":`>${this.children.map((n)=>n.toString()).join("")}</${this.name}>`}}function Ft(e){Object.defineProperty(e,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}function To(e){return new Kt(e).parse()}class Kt{x;i=0;z;constructor(e){this.x=e,this.x=e.replace(/\r\n?/g,`
|
|
14
|
+
`),this.z=this.x.length}parse(){let e=this,{z:t}=e;while(e.i<t){if(e.trim(),e.i>=t)break;if(e.isNext("<?"))e.readTo("?>"),e.trim();else if(e.isNext("<!--"))e.readTo("-->"),e.trim();else if(e.isNext("<!DOCTYPE",!1))e.skipDoctype(),e.trim();else if(e.x[e.i]==="<"){let r=e.parseTag();return{[r.tag]:r.value}}else throw Error("@aws-sdk XML parse error: unexpected content.")}throw Error("@aws-sdk XML parse error: no root element.")}isNext(e,t=!0){let r=this;if(t)return r.x.startsWith(e,r.i);return r.x.toLowerCase().startsWith(e.toLowerCase(),r.i)}readTo(e){let t=this,r=t.x.indexOf(e,t.i);if(r===-1)throw Error(`@aws-sdk XML parse error: expected "${e}" not found.`);let n=t.x.slice(t.i,r);return t.i=r+e.length,n}trim(){let e=this;while(e.i<e.z&&` \r
|
|
15
|
+
`.includes(e.x[e.i]))++e.i}readAttrValue(){let e=this,t=e.x[e.i];++e.i;let r="";while(e.i<e.z&&e.x[e.i]!==t)r+=e.x[e.i++];return++e.i,e.decodeEntities(r)}parseTag(){let e=this;++e.i;let t="";while(e.i<e.z&&!` \r
|
|
16
|
+
>/`.includes(e.x[e.i]))t+=e.x[e.i++];let r=!1,n={};while(e.i<e.z){if(e.trim(),">/".includes(e.x[e.i]))break;let f="";while(e.i<e.z&&!`= \r
|
|
17
|
+
>/?`.includes(e.x[e.i]))f+=e.x[e.i++];if(e.trim(),e.x[e.i]!=="=")break;if(++e.i,e.trim(),f==="__proto__")Ft(n);n[f]=e.readAttrValue(),r=!0}if(e.i>=e.z)throw Error("@aws-sdk XML parse error: unexpected end of input.");if(e.x[e.i]==="/"){if(++e.i,e.i>=e.z||e.x[e.i]!==">")throw Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");return++e.i,{tag:t,value:r?n:""}}if(e.x[e.i]!==">")throw Error("@aws-sdk XML parse error: expected > at the end of opening tag.");++e.i;let i=[],s=[],o=!1;while(e.i<e.z){if(e.isNext("</"))break;if(e.x[e.i]==="<")if(e.isNext("<!--"))e.readTo("-->");else if(e.isNext("<![CDATA["))e.i+=9,i.push(e.readTo("]]>"));else if(e.isNext("<?"))e.readTo("?>");else o=!0,s.push(e.parseTag());else{let f="";while(e.i<e.z&&e.x[e.i]!=="<")f+=e.x[e.i++];i.push(e.decodeEntities(f))}}if(!e.isNext("</"))throw Error(`@aws-sdk XML parse error: missing closing tag </${t}>.`);e.i+=2;let c=e.readTo(">").trim();if(c!==t)throw Error(`@aws-sdk XML parse error: mismatched tags <${t}> and </${c}>.`);if(!r&&i.length===0&&!o)return{tag:t,value:""};if(!r&&!o){let f=i.length===1?i[0]:i.join("");if(f.trim()===""&&f.includes(`
|
|
18
|
+
`))return{tag:t,value:""};return{tag:t,value:f}}let a={};for(let f of i){if(f.trim()===""&&f.includes(`
|
|
19
|
+
`))continue;a["#text"]="#text"in a?a["#text"]+f:f}for(let f of s){if(f.tag==="__proto__")Ft(a);if(f.tag in a)if(Array.isArray(a[f.tag]))a[f.tag].push(f.value);else a[f.tag]=[a[f.tag],f.value];else a[f.tag]=f.value}for(let[f,u]of Object.entries(n)){if(f==="__proto__")Ft(a);a[f]=u}return{tag:t,value:a}}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};skipDoctype(){let e=this;e.i+=9;let t=0;while(e.i<e.z){let r=e.x[e.i];if(r==="[")++t;else if(r==="]")--t;else if(r===">"&&t===0){++e.i;return}++e.i}throw Error("@aws-sdk XML parse error: unclosed DOCTYPE.")}decodeEntities(e){return e.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g,(t,r,n,i)=>{if(r)return String.fromCharCode(parseInt(r,16));if(n)return String.fromCharCode(parseInt(n,10));return Kt.ENTITIES[i]??""})}}Io.XmlNode=Ce;Io.XmlText=Pt;Io.parseXML=To});var Ls=w(function(Zo){var{SmithyRpcV2CborProtocol:Bo,loadSmithyRpcV2CborErrorCode:Uo}=un(),{TypeRegistry:ln,NormalizedSchema:T,deref:Cn}=wn(),{decorateServiceException:dn,getValueFromTextNode:_n}=sr(),{collectBody:We,determineTimestampFormat:fe,RpcProtocol:An,HttpBindingProtocol:Tn,HttpInterceptingShapeSerializer:In,HttpInterceptingShapeDeserializer:kn,FromStringShapeDeserializer:Do,extendedEncodeURIComponent:mn}=Ht(),{NumericValue:B,toUtf8:Xt,fromBase64:Jt,LazyJsonString:Ze,parseEpochTimestamp:Rn,parseRfc7231DateTime:Mn,parseRfc3339DateTimeWithOffset:Bn,generateIdempotencyToken:Ye,toBase64:ae,dateToUtcString:Ae,expectUnion:jo}=er(),{parseXML:Un,XmlNode:V,XmlText:gn}=hn();class ue{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){let r=t.getMemberSchemas(),n=Object.values(r).find((i)=>!!i.getMergedTraits().httpPayload);if(n){let i=n.getMergedTraits().mediaType;if(i)return i;else if(n.isStringSchema())return"text/plain";else if(n.isBlobSchema())return"application/octet-stream";else return e}else if(!t.isUnitSchema()){if(Object.values(r).find((s)=>{let{httpQuery:o,httpQueryParams:c,httpHeader:a,httpLabel:f,httpPrefixHeaders:u}=s.getMergedTraits();return!o&&!c&&!a&&!f&&u===void 0}))return e}}async getErrorSchemaOrThrowBaseException(e,t,r,n,i,s){let o=e;if(e.includes("#"))[,o]=e.split("#");let c={$metadata:i,$fault:r.statusCode<500?"client":"server"};if(!this.errorRegistry)throw Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:s?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:c}}catch(a){n.message=n.message??n.Message??"UnknownError";let f=this.errorRegistry,u=f.getBaseException();if(u){let d=f.getErrorCtor(u)??Error;throw this.decorateServiceException(Object.assign(new d({name:o}),c),n)}let h=n,l=h?.message??h?.Message??h?.Error?.Message??h?.Error?.message;throw this.decorateServiceException(Object.assign(Error(l),{name:o},c),n)}}compose(e,t,r){let n=r;if(t.includes("#"))[n]=t.split("#");let i=ln.for(n),s=ln.for("smithy.ts.sdk.synthetic."+r);e.copyFrom(i),e.copyFrom(s),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){let r=e.Message??t.Message,n=dn(e,t);if(r)n.message=r;let i=n.Error??{};i.Type=n.Error?.Type,i.Code=n.Error?.Code,i.Message=n.Error?.message??n.Error?.Message??r,n.Error=i;let s=n.$metadata.requestId;if(s)n.RequestId=s;return n}return dn(e,t)}setQueryCompatError(e,t){let r=t.headers?.["x-amzn-query-error"];if(e!==void 0&&r!=null){let[n,i]=r.split(";"),s=Object.keys(e),o={Code:n,Type:i};e.Code=n,e.Type=i;for(let c=0;c<s.length;c++){let a=s[c];o[a==="message"?"Message":a]=e[a]}delete o.__type,e.Error=o}}queryCompatOutput(e,t){if(e.Error)t.Error=e.Error;if(e.Type)t.Type=e.Type;if(e.Code)t.Code=e.Code}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch(r){return e.find((n)=>T.of(n).getMergedTraits().awsQueryError?.[0]===t)}}}class Dn extends Bo{awsQueryCompatible;mixin;constructor({defaultNamespace:e,errorTypeRegistries:t,awsQueryCompatible:r}){super({defaultNamespace:e,errorTypeRegistries:t});this.awsQueryCompatible=!!r,this.mixin=new ue(this.awsQueryCompatible)}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r);if(this.awsQueryCompatible)n.headers["x-amzn-query-mode"]="true";return n}async handleError(e,t,r,n,i){if(this.awsQueryCompatible)this.mixin.setQueryCompatError(n,r);let s=(()=>{let d=r.headers["x-amzn-query-error"];if(d&&this.awsQueryCompatible)return d.split(";")[0];return Uo(r,n)??"Unknown"})();this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);let{errorSchema:o,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,r,n,i,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),a=T.of(o),f=n.message??n.Message??"UnknownError",h=new(this.compositeErrorRegistry.getErrorCtor(o)??Error)({}),l={};for(let[d,p]of a.structIterator())if(n[d]!=null)l[d]=this.deserializer.readValue(p,n[d]);if(this.awsQueryCompatible)this.mixin.queryCompatOutput(n,l);throw this.mixin.decorateServiceException(Object.assign(h,c,{$fault:a.getMergedTraits().error,message:f},l),n)}}class F{serdeContext;setSerdeContext(e){this.serdeContext=e}}class ve{from;to;keys;constructor(e,t){this.from=e,this.to=t;let r=Object.keys(this.from),n=new Set(r);n.delete("__type"),this.keys=n}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}var _e;function jn(){if(_e===void 0)try{if(typeof Buffer!=="function")_e=!1;else{let e=JSON.parse(Buffer.from([123,125]));_e=e!==null&&typeof e==="object"}}catch{_e=!1}return _e}function Zt(e,t,r){if(r?.source){let n=r.source;if(typeof t==="number")if(t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER){if(Oo(n,t))return t;return new B(n,"bigDecimal")}else{if(zo(n))return new B(n,"bigDecimal");if(/[eE]/.test(n))return Lo(n);return BigInt(n)}}return t}function zo(e){let t=e.indexOf(".");if(t===-1)return!1;let r=e.search(/[eE]/);if(r===-1)return!0;let n=r-t-1;return parseInt(e.slice(r+1),10)<n}function Oo(e,t){if(e===String(t))return!0;if(Object.is(t,-0))return!0;if(/[eE]/.test(e))return qt(e)===qt(String(t));let r=e.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,""),n=String(t);if(r===n)return!0;if(/[eE]/.test(n))return r===qt(n);return!1}function qt(e){let t=e.startsWith("-"),r=t?e.slice(1):e,n=r.search(/[eE]/),i;if(n===-1)i=r;else{let s=parseInt(r.slice(n+1),10),o=r.slice(0,n),c=o.indexOf("."),a,f;if(c===-1)a=o,f=o.length;else a=o.slice(0,c)+o.slice(c+1),f=c;a=a.replace(/0+$/,"")||"0";let u=f+s;if(a==="0")i="0";else if(u<=0)i="0."+"0".repeat(-u)+a;else if(u>=a.length)i=a+"0".repeat(u-a.length);else i=a.slice(0,u)+"."+a.slice(u)}if(i.includes("."))i=i.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"");return(t?"-":"")+i}function Lo(e){let t=e.search(/[eE]/),r=parseInt(e.slice(t+1),10),n=e.startsWith("-"),i=e.slice(n?1:0,t),s=i.indexOf("."),o,c;if(s===-1)o=i,c=r;else{o=i.slice(0,s)+i.slice(s+1);let f=i.length-s-1;c=r-f}o=o.replace(/0+$/,"")||"0";let a=BigInt(o)*10n**BigInt(c+(i.replace(".","").length-o.length));return n?-a:a}var Qt=Symbol.for("@aws-sdk/reviver");function Yt(e){let t=T.of(e),r=t.getSchema();if(Array.isArray(r)&&t.isStructSchema()){if(Qt in r)return r[Qt];let n=Xe(t,new Set);return r[Qt]=n,n}return Xe(t,new Set)}function Xe(e,t){let r=e.getSchema();if(t.has(r))return!1;if(t.add(r),e.isBigIntegerSchema()||e.isBigDecimalSchema())return!0;if(e.isStructSchema()){for(let[,n]of e.structIterator())if(Xe(n,t))return!0}else if(e.isListSchema()||e.isMapSchema()){if(Xe(e.getValueSchema(),t))return!0}else if(e.isDocumentSchema())return!0;return!1}var zn=(e,t)=>We(e,t).then((r)=>(t?.utf8Encoder??Xt)(r));async function et(e,t,r){let n;if(jn()&&typeof e?.[Symbol.asyncIterator]==="function"){let s=await We(e,t);if(typeof Buffer==="function")if(Buffer.isBuffer(s))n=s;else n=Buffer.from(s.buffer,s.byteOffset,s.byteLength)}if(!n)n=await zn(e,t);if(n.length===0)return{};let i=r&&Yt(r)?Zt:void 0;try{return JSON.parse(n,i)}catch(s){if(s?.name==="SyntaxError")Object.defineProperty(s,"$responseBodyText",{value:typeof n==="string"?n:n.toString("utf8")});throw s}}var $o=async(e,t)=>{let r=await et(e,t);return r.message=r.message??r.Message,r},pn=(e,t)=>Object.keys(e).find((r)=>r.toLowerCase()===t.toLowerCase()),Gt=(e)=>{let t=e;if(typeof t==="number")t=t.toString();if(t.indexOf(",")>=0)t=t.split(",")[0];if(t.indexOf(":")>=0)t=t.split(":")[0];if(t.indexOf("#")>=0)t=t.split("#")[1];return t},On=(e,t)=>$n(e,t,["header","code","type"]),Ln=(e,t,r=!1)=>$n(e,t,r?["code","header","type"]:["type","code","header"]),$n=({headers:e},t,r)=>{while(r.length>0)switch(r.shift()){case"header":let i=pn(e??{},"x-amzn-errortype");if(i!==void 0)return Gt(e[i]);break;case"code":let s=pn(t??{},"code");if(s&&t[s]!==void 0)return Gt(t[s]);break;case"type":if(t?.__type!==void 0)return Gt(t.__type);break}};function W(e){Object.defineProperty(e,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}class vt extends F{settings;constructor(e){super();this.settings=e}async read(e,t){let r=Yt(e)?Zt:void 0,n;if(typeof t==="string"){if(t.length===0)return{};n=JSON.parse(t,r)}else if(t instanceof Uint8Array&&jn()){if(t.byteLength===0)return{};let i=Buffer.isBuffer(t)?t:Buffer.from(t.buffer,t.byteOffset,t.byteLength);n=JSON.parse(i,r)}else n=await et(t,this.serdeContext,e);return this._read(e,n)}readObject(e,t){return this._read(e,t)}_read(e,t){let r=t!==null&&typeof t==="object",n=T.of(e);if(r){if(n.isStructSchema())return this._readStruct(n,t);if(Array.isArray(t)&&n.isListSchema()){let s=n.getValueSchema();if(this.needsTransform(s))for(let o=0;o<t.length;++o)t[o]=this._read(s,t[o]);return t}if(n.isMapSchema()){let s=n.getValueSchema(),o=t;if(this.needsTransform(s))for(let c in o){if(c==="__proto__")W(o);o[c]=this._read(s,o[c])}return o}}if(n.isBlobSchema()&&typeof t==="string")return Jt(t);let i=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof t==="string"&&i){if(i==="application/json"||i.endsWith("+json"))return Ze.from(t);return t}if(n.isTimestampSchema()&&t!=null)switch(fe(n,this.settings)){case 5:return Bn(t);case 6:return Mn(t);case 7:return Rn(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(n.isBigIntegerSchema()&&(typeof t==="number"||typeof t==="string"))return BigInt(t);if(n.isBigDecimalSchema()&&t!=null){if(t instanceof B)return t;let s=t;if(s.type==="bigDecimal"&&"string"in s)return new B(s.string,s.type);return new B(String(t),"bigDecimal")}if(n.isNumericSchema()&&typeof t==="string"){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(n.isDocumentSchema()){if(r)if(Array.isArray(t))for(let s=0;s<t.length;++s){let o=t[s];if(!(o instanceof B))t[s]=this._read(n,o)}else{let s=t;for(let o in s){if(o==="__proto__")W(s);let c=s[o];if(!(c instanceof B))s[o]=this._read(n,c)}}}return t}_readStruct(e,t){let r=e.isUnionSchema(),n={},i,s=typeof t.__type==="string",{jsonName:o}=this.settings;if(o&&s)i={};let c;if(r)c=new ve(t,n);for(let[a,f]of e.structIterator()){let u=a;if(o){if(u=f.getMergedTraits().jsonName??u,s)i[u]=a}if(r)c.mark(u);if(t[u]!=null)n[a]=this._read(f,t[u])}if(r)c.writeUnknown();else if(s)for(let a in t){let f=t[a],u=o?i[a]??a:a;if(!(u in n))n[u]=f}return n}needsTransform(e){if(e.isBlobSchema()||e.isTimestampSchema()||e.isBigIntegerSchema()||e.isBigDecimalSchema())return!0;if(e.isDocumentSchema()||e.isStructSchema()||e.isListSchema()||e.isMapSchema())return!0;if(e.isStringSchema()&&e.getMergedTraits().mediaType)return!0;return!1}}class Je extends Uint8Array{string=null;static allocUnsafe(e){if(typeof Buffer==="function"){let t=Buffer.allocUnsafe(e);return new Je(t.buffer,t.byteOffset,t.byteLength)}return new Je(e)}toString(){return this.s()}valueOf(){return this.s()}includes(e,t){if(typeof e==="string")return this.s().includes(e,t);return Uint8Array.prototype.includes.call(this,e,t)}indexOf(e,t){if(typeof e==="string")return this.s().indexOf(e,t);return Uint8Array.prototype.indexOf.call(this,e,t)}lastIndexOf(e,t){if(typeof e==="string")return this.s().lastIndexOf(e,t);let r=Uint8Array.prototype.lastIndexOf;if(t!==void 0)return r.call(this,e,t);return r.call(this,e)}startsWith(e,t){return this.s().startsWith(e,t)}endsWith(e,t){return this.s().endsWith(e,t)}match(e){return this.s().match(e)}replace(e,t){return this.s().replace(e,t)}search(e){return this.s().search(e)}split(e,t){return this.s().split(e,t)}substring(e,t){return this.s().substring(e,t)}trim(){return this.s().trim()}trimStart(){return this.s().trimStart()}trimEnd(){return this.s().trimEnd()}charAt(e){return this.s().charAt(e)}charCodeAt(e){return this.s().charCodeAt(e)}padStart(e,t){return this.s().padStart(e,t)}padEnd(e,t){return this.s().padEnd(e,t)}repeat(e){return this.s().repeat(e)}toUpperCase(){return this.s().toUpperCase()}toLowerCase(){return this.s().toLowerCase()}s(){if(this.string==null){let e=Date.now();if(e>yn+60000)console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. It has been automatically converted to string. In a future version this will throw an error."),yn=e;this.string=Xt(this)}return this.string}}var yn=0,Ke=new TextEncoder,Sn=123,bn=125,Vo=91,Fo=93,ce=34,qe=58,Qe=44,xn=92,Po=new Uint8Array([116,114,117,101]),Ho=new Uint8Array([102,97,108,115,101]),Ko=new Uint8Array([110,117,108,108]),K=Array(128).fill(null);K[8]="b";K[9]="t";K[10]="n";K[12]="f";K[13]="r";K[34]='"';K[92]="\\";for(let e=0;e<32;e++)if(K[e]===null)K[e]="u00"+e.toString(16).padStart(2,"0");var En=2048;function Wt(e){return Je.allocUnsafe(e)}class tt extends F{settings;json;i=0;rootSchema;rawValue;passthrough=!1;constructor(e){super();this.settings=e,this.json=Wt(En)}write(e,t){if(this.i=0,this.rawValue=t,this.rootSchema=T.of(e),this.passthrough=this.rootSchema.isBlobSchema()||this.rootSchema.isStringSchema(),!this.passthrough)this.writeValue(this.rootSchema,t,void 0)}writeDiscriminatedDocument(e,t){this.i=0,this.rootSchema=T.of(e);let r=this.rootSchema;if(r.isStructSchema()&&t!=null&&typeof t==="object"){this.writeValue(r,t,void 0);let n=`"__type":"${r.getName(!0)??"Unknown"}",`,i=n.length;this.ensure(i),this.json.copyWithin(1+i,1,this.i),Ke.encodeInto(n,this.json.subarray(1)),this.i+=i}else this.writeValue(r,t,void 0)}flush(){this.rootSchema=void 0;let e=this.i;this.i=0;let t=this.rawValue;if(this.rawValue=void 0,e===0)return t;let r=this.json.subarray(0,e);return this.json=Wt(En),r}ensure(e){let{i:t,json:r}=this;if(t+e>r.length){let n=r.length*2;while(n<t+e)n*=2;let i=Wt(n);i.set(this.json),this.json=i}}writeAscii(e){let t=e.length;this.ensure(t);let{i:r,json:n}=this;for(let i=0;i<t;++i)n[r]=e.charCodeAt(i),r+=1;this.i=r}writeAsciiQuoted(e){let t=e.length;this.ensure(t+4);let{json:r,i:n}=this;r[n++]=ce;for(let i=0;i<t;++i)r[n++]=e.charCodeAt(i);r[n++]=ce,this.i=n}writeJsonString(e){this.ensure(e.length*3+2),this.json[this.i++]=ce;let t=e.length;for(let r=0;r<t;++r){let n=e.charCodeAt(r);if(n>34&&n<92)this.json[this.i++]=n;else if(n<128){let i=K[n];if(i!==null){this.ensure(i.length+1),this.json[this.i++]=xn;for(let s=0;s<i.length;s++)this.json[this.i++]=i.charCodeAt(s)}else this.json[this.i++]=n}else if(n>=55296&&n<=56319){let i=r+1<t?e.charCodeAt(r+1):0;if(i>=56320&&i<=57343){this.ensure(4);let{written:s}=Ke.encodeInto(e.substring(r,r+2),this.json.subarray(this.i));this.i+=s,++r}else this.ensure(6),this.writeUnicodeEscape(n)}else if(n>=56320&&n<=57343)this.ensure(6),this.writeUnicodeEscape(n);else{let{i,json:s}=this;if(n<2048)s[i++]=192|n>>6,s[i++]=128|n&63;else s[i++]=224|n>>12,s[i++]=128|n>>6&63,s[i++]=128|n&63;this.i=i}}this.json[this.i++]=ce}writeUnicodeEscape(e){let{json:t,i:r}=this;t[r++]=xn,t[r++]=117;let n=e.toString(16).padStart(4,"0");for(let i=0;i<4;++i)t[r++]=n.charCodeAt(i);this.i=r}static B64=(()=>{let t=new Uint8Array(64);for(let r=0;r<64;++r)t[r]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(r);return t})();writeBase64(e){let t=Math.ceil(e.length/3)*4;this.ensure(t+2);let r=this.json,n=tt.B64,i=this.i;r[i++]=ce;let s=e.length,o=s%3,c=s-o;for(let a=0;a<c;a+=3){let f=e[a],u=e[a+1],h=e[a+2];r[i++]=n[f>>2],r[i++]=n[(f&3)<<4|u>>4],r[i++]=n[(u&15)<<2|h>>6],r[i++]=n[h&63]}if(o===2){let a=e[c],f=e[c+1];r[i++]=n[a>>2],r[i++]=n[(a&3)<<4|f>>4],r[i++]=n[(f&15)<<2],r[i++]=61}else if(o===1){let a=e[c];r[i++]=n[a>>2],r[i++]=n[(a&3)<<4],r[i++]=61,r[i++]=61}r[i++]=ce,this.i=i}writeValue(e,t,r){if(t==null){if(r?.isStructSchema()){if(t===void 0){if(T.of(e).isIdempotencyToken()){this.writeAsciiQuoted(Ye());return}}return}this.ensure(4),this.json.set(Ko,this.i),this.i+=4;return}let n=T.of(e),i=typeof t==="object";if(n.isStringSchema()){let s=n.getMergedTraits().mediaType;if(s){if(s==="application/json"||s.endsWith("+json")){this.writeJsonString(Ze.from(t).toString());return}}}if(i){if(n.isStructSchema()){this.writeStruct(n,t);return}if(Array.isArray(t)&&(n.isListSchema()||n.isDocumentSchema())){this.writeList(n,t,n.isDocumentSchema());return}if(n.isMapSchema()){this.writeMap(n,t,!1);return}if(t instanceof Uint8Array&&(n.isBlobSchema()||n.isDocumentSchema())){this.writeBase64(t);return}if(t instanceof Date&&(n.isTimestampSchema()||n.isDocumentSchema())){this.writeTimestamp(n,t);return}if(t instanceof B){this.writeAscii(t.string);return}if(n.isDocumentSchema()){if(Array.isArray(t))this.writeList(n,t,!0);else this.writeMap(n,t,!0);return}let s=JSON.stringify(t);this.writeAscii(s);return}if(typeof t==="string"){if(n.isBlobSchema()){let s=(this.serdeContext?.base64Encoder??ae)(t);this.writeAsciiQuoted(s);return}this.writeJsonString(t);return}if(typeof t==="number"){if(Math.abs(t)===1/0||Number.isNaN(t)){this.writeAsciiQuoted(String(t));return}let s=String(t);this.writeAscii(s);return}if(typeof t==="boolean"){this.ensure(5);let{i:s,json:o}=this;if(t)o.set(Po,s),s+=4;else o.set(Ho,s),s+=5;this.i=s;return}if(typeof t==="bigint"){this.writeAscii(t.toString());return}this.writeAscii(String(t))}writeStruct(e,t){this.ensure(2),this.json[this.i++]=Sn;let r=!1,n=typeof t.__type==="string",i;if(n)i=new Set;for(let[s,o]of e.structIterator()){let c=t[s];if(c==null&&!o.isIdempotencyToken())continue;if(r)this.ensure(1),this.json[this.i++]=Qe;r=!0;let a=this.settings.jsonName?o.getMergedTraits().jsonName??s:s;if(i)i.add(s),i.add(a);this.writeAsciiQuoted(a),this.json[this.i++]=qe,this.writeValue(o,c,e)}if(!r&&e.isUnionSchema()){let{$unknown:s}=t;if(Array.isArray(s)){let[o,c]=s;this.writeAsciiQuoted(o),this.ensure(1),this.json[this.i++]=qe,this.writeValue(15,c,e)}}else if(n)for(let s in t){if(i.has(s))continue;i.add(s);let o=t[s];if(r)this.ensure(1),this.json[this.i++]=Qe;r=!0,this.writeAsciiQuoted(s),this.ensure(1),this.json[this.i++]=qe,this.writeValue(15,o,void 0)}this.ensure(1),this.json[this.i++]=bn}writeList(e,t,r){let n=!!e.getMergedTraits().sparse,i=e.getValueSchema();if(!r){if(i.isStringSchema()||i.isNumericSchema()||i.isBooleanSchema()){let o=!1;for(let a=0;a<t.length;++a){let f=t[a];if(Number.isNaN(f)||f===1/0||f===-1/0||f==null&&!n){o=!0;break}}let c;if(!o)c=JSON.stringify(t);else{let a=[];for(let f=0;f<t.length;++f){let u=t[f];if(u==null&&!n)continue;if(Number.isNaN(u)||u===1/0||u===-1/0)a.push(String(u));else a.push(u)}c=JSON.stringify(a)}this.ensure(c.length*3),this.i+=Ke.encodeInto(c,this.json.subarray(this.i)).written;return}}this.ensure(2),this.json[this.i++]=Vo;let s=!1;for(let o=0;o<t.length;++o){let c=t[o];if(r?c===void 0:c==null&&!n)continue;if(s)this.ensure(1),this.json[this.i++]=Qe;this.writeValue(i,c,void 0),s=!0}this.ensure(1),this.json[this.i++]=Fo}writeMap(e,t,r){let n=!!e.getMergedTraits().sparse,i=e.getValueSchema();if(!r){if(i.isStringSchema()||i.isNumericSchema()||i.isBooleanSchema()){let o;for(let a in t){let f=t[a];if(Number.isNaN(f)||f===1/0||f===-1/0)(o??={})[a]=f,t[a]=String(f);else if(f===null&&!n)(o??={})[a]=null,t[a]=void 0}let c=JSON.stringify(t);if(o)Object.assign(t,o);this.ensure(c.length*3),this.i+=Ke.encodeInto(c,this.json.subarray(this.i)).written;return}}this.ensure(2),this.json[this.i++]=Sn;let s=!0;for(let o in t){let c=t[o];if(r?c===void 0:c==null&&!n)continue;if(!s)this.ensure(1),this.json[this.i++]=Qe;s=!1,this.writeJsonString(o),this.ensure(1),this.json[this.i++]=qe,this.writeValue(i,c,void 0)}this.ensure(1),this.json[this.i++]=bn}writeTimestamp(e,t){switch(fe(e,this.settings)){case 5:{let n=t.toISOString().replace(".000Z","Z");this.writeAsciiQuoted(n);return}case 6:{this.writeAsciiQuoted(Ae(t));return}case 7:{let n=String(t.getTime()/1000);this.writeAscii(n);return}default:{let n=String(t.getTime()/1000);this.writeAscii(n);return}}}}class rt extends F{settings;constructor(e){super();this.settings=e}createSerializer(){let e=new tt(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new vt(this.settings);return e.setSerdeContext(this.serdeContext),e}}class nt extends An{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:r,awsQueryCompatible:n,jsonCodec:i}){super({defaultNamespace:e,errorTypeRegistries:t});this.serviceTarget=r,this.codec=i??new rt({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!n,this.mixin=new ue(this.awsQueryCompatible)}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r);if(!n.path.endsWith("/"))n.path+="/";if(n.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`,n.headers["x-amz-target"]=`${this.serviceTarget}.${e.name}`,this.awsQueryCompatible)n.headers["x-amzn-query-mode"]="true";if(Cn(e.input)==="unit"||!n.body)n.body="{}";return n}getPayloadCodec(){return this.codec}async handleError(e,t,r,n,i){let{awsQueryCompatible:s}=this;if(s)this.mixin.setQueryCompatError(n,r);let o=Ln(r,n,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,o,this.options.defaultNamespace);let{errorSchema:c,errorMetadata:a}=await this.mixin.getErrorSchemaOrThrowBaseException(o,this.options.defaultNamespace,r,n,i,s?this.mixin.findQueryCompatibleError:void 0),f=T.of(c),u=n.message??n.Message??"UnknownError",l=new(this.compositeErrorRegistry.getErrorCtor(c)??Error)({}),d={},p=this.codec.createDeserializer();for(let[m,x]of f.structIterator())if(n[m]!=null)d[m]=p.readObject(x,n[m]);if(s)this.mixin.queryCompatOutput(n,d);throw this.mixin.decorateServiceException(Object.assign(l,a,{$fault:f.getMergedTraits().error,message:u},d),n)}}class Vn extends nt{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:r,awsQueryCompatible:n,jsonCodec:i}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:r,awsQueryCompatible:n,jsonCodec:i})}getShapeId(){return"aws.protocols#awsJson1_0"}getJsonRpcVersion(){return"1.0"}getDefaultContentType(){return"application/x-amz-json-1.0"}}class Fn extends nt{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:r,awsQueryCompatible:n,jsonCodec:i}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:r,awsQueryCompatible:n,jsonCodec:i})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}class Pn extends Tn{serializer;deserializer;codec;mixin=new ue;constructor({defaultNamespace:e,errorTypeRegistries:t,jsonCodec:r}){super({defaultNamespace:e,errorTypeRegistries:t});let n={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=r??new rt(n),this.serializer=new In(this.codec.createSerializer(),n),this.deserializer=new kn(this.codec.createDeserializer(),n)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(e){this.codec.setSerdeContext(e),super.setSerdeContext(e)}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r),i=T.of(e.input);if(!n.headers["content-type"]){let s=this.mixin.resolveRestContentType(this.getDefaultContentType(),i);if(s)n.headers["content-type"]=s}if(n.body==null&&n.headers["content-type"]===this.getDefaultContentType())n.body="{}";return n}async deserializeResponse(e,t,r){let n=await super.deserializeResponse(e,t,r),i=T.of(e.output);for(let[s,o]of i.structIterator())if(o.getMemberTraits().httpPayload&&!(s in n))n[s]=null;return n}async handleError(e,t,r,n,i){let s=On(r,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);let{errorSchema:o,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,r,n,i),a=T.of(o),f=n.message??n.Message??"UnknownError",h=new(this.compositeErrorRegistry.getErrorCtor(o)??Error)({});await this.deserializeHttpMessage(o,t,r,n);let l={},d=this.codec.createDeserializer();for(let[p,m]of a.structIterator()){let x=m.getMergedTraits().jsonName??p;l[p]=d.readObject(m,n[x])}throw this.mixin.decorateServiceException(Object.assign(h,c,{$fault:a.getMergedTraits().error,message:f},l),n)}getDefaultContentType(){return"application/json"}}class tr extends F{settings;constructor(e){super();this.settings=e}async read(e,t){let r=Yt(e)?Zt:void 0;return this._read(e,typeof t==="string"?JSON.parse(t,r):await et(t,this.serdeContext,e))}readObject(e,t){return this._read(e,t)}_read(e,t){let r=t!==null&&typeof t==="object",n=T.of(e);if(r){if(n.isStructSchema()){let s=t,o=n.isUnionSchema(),c={},a=void 0,{jsonName:f}=this.settings;if(f)a={};let u;if(o)u=new ve(s,c);for(let[h,l]of n.structIterator()){let d=h;if(f)d=l.getMergedTraits().jsonName??d,a[d]=h;if(o)u.mark(d);if(s[d]!=null)c[h]=this._read(l,s[d])}if(o)u.writeUnknown();else if(typeof s.__type==="string")for(let h in s){let l=s[h],d=f?a[h]??h:h;if(!(d in c))c[d]=l}return c}if(Array.isArray(t)&&n.isListSchema()){let s=n.getValueSchema(),o=[];for(let c of t)o.push(this._read(s,c));return o}if(n.isMapSchema()){let s=n.getValueSchema(),o={};for(let c in t){if(c==="__proto__")W(o);o[c]=this._read(s,t[c])}return o}}if(n.isBlobSchema()&&typeof t==="string")return Jt(t);let i=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof t==="string"&&i){if(i==="application/json"||i.endsWith("+json"))return Ze.from(t);return t}if(n.isTimestampSchema()&&t!=null)switch(fe(n,this.settings)){case 5:return Bn(t);case 6:return Mn(t);case 7:return Rn(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(n.isBigIntegerSchema()&&(typeof t==="number"||typeof t==="string"))return BigInt(t);if(n.isBigDecimalSchema()&&t!=null){if(t instanceof B)return t;let s=t;if(s.type==="bigDecimal"&&"string"in s)return new B(s.string,s.type);return new B(String(t),"bigDecimal")}if(n.isNumericSchema()&&typeof t==="string"){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(n.isDocumentSchema())if(r){let s=Array.isArray(t)?[]:{};for(let o in t){if(o==="__proto__")W(s);let c=t[o];if(c instanceof B)s[o]=c;else s[o]=this._read(n,c)}return s}else return structuredClone(t);return t}}var Nn=String.fromCharCode(925);class Hn{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof B){let r=`${Nn+"nv"+this.counter++}_`+t.string;return this.values.set(`"${r}"`,t.string),r}if(typeof t==="bigint"){let r=t.toString(),n=`${Nn+"b"+this.counter++}_`+r;return this.values.set(`"${n}"`,r),n}return t}}replaceInJson(e){if(this.stage===0)throw Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[t,r]of this.values)e=e.replace(t,r);return e}}class rr extends F{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super();this.settings=e}write(e,t){this.rootSchema=T.of(e),this.buffer=this._write(this.rootSchema,t)}flush(){let{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);let r=new Hn;return r.replaceInJson(JSON.stringify(this.buffer,r.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,t){if(this.write(e,t),typeof this.buffer==="object")this.buffer.__type=T.of(e).getName(!0)}_write(e,t,r){let n=t!==null&&typeof t==="object",i=T.of(e);if(n){if(i.isStructSchema()){let s=t,o={},{jsonName:c}=this.settings,a=void 0;if(c)a={};let f=0;for(let[u,h]of i.structIterator()){let l=this._write(h,s[u],i);if(l!==void 0){let d=u;if(c)d=h.getMergedTraits().jsonName??u,a[u]=d;o[d]=l,f++}}if(i.isUnionSchema()&&f===0){let{$unknown:u}=s;if(Array.isArray(u)){let[h,l]=u;if(h==="__proto__")W(o);o[h]=this._write(15,l)}}else if(typeof s.__type==="string")for(let u in s){let h=s[u],l=c?a[u]??u:u;if(!(l in o))o[l]=this._write(15,h)}return o}if(Array.isArray(t)&&i.isListSchema()){let s=i.getValueSchema(),o=[],c=!!i.getMergedTraits().sparse;for(let a of t)if(c||a!=null)o.push(this._write(s,a));return o}if(i.isMapSchema()){let s=i.getValueSchema(),o={},c=!!i.getMergedTraits().sparse;for(let a in t){let f=t[a];if(c||f!=null){if(a==="__proto__")W(o);o[a]=this._write(s,f)}}return o}if(t instanceof Uint8Array&&i.isBlobSchema()){if(i===this.rootSchema)return t;return(this.serdeContext?.base64Encoder??ae)(t)}if(t instanceof Date&&(i.isTimestampSchema()||i.isDocumentSchema()))switch(fe(i,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return Ae(t);case 7:return t.getTime()/1000;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1000}if(t instanceof B)this.useReplacer=!0}if(t===null&&r?.isStructSchema())return;if(i.isStringSchema()){if(typeof t>"u"&&i.isIdempotencyToken())return Ye();let s=i.getMergedTraits().mediaType;if(t!=null&&s){if(s==="application/json"||s.endsWith("+json"))return Ze.from(t)}return t}if(typeof t==="number"){if(Math.abs(t)===1/0||isNaN(t))return String(t);return t}if(typeof t==="string"&&i.isBlobSchema()){if(i===this.rootSchema)return t;return(this.serdeContext?.base64Encoder??ae)(t)}if(typeof t==="bigint")this.useReplacer=!0;if(i.isDocumentSchema())if(n){if(t instanceof Uint8Array)return(this.serdeContext?.base64Encoder??ae)(t);let s=Array.isArray(t)?[]:{};for(let o in t){let c=t[o];if(o==="__proto__")W(s);if(c instanceof B)this.useReplacer=!0,s[o]=c;else s[o]=this._write(i,c)}return s}else return structuredClone(t);return t}}class Kn extends F{settings;constructor(e){super();this.settings=e}createSerializer(){let e=new rr(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new tr(this.settings);return e.setSerdeContext(this.serdeContext),e}}class st extends F{settings;stringDeserializer;constructor(e){super();this.settings=e,this.stringDeserializer=new Do(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,r){let n=T.of(e),i=n.getMemberSchemas();if(n.isStructSchema()&&n.isMemberSchema()&&!!Object.values(i).find((a)=>!!a.getMemberTraits().eventPayload)){let a={},f=Object.keys(i)[0];if(i[f].isBlobSchema())a[f]=t;else a[f]=this.read(i[f],t);return a}let o=(this.serdeContext?.utf8Encoder??Xt)(t),c=this.parseXml(o);return this.readSchema(e,r?c[r]:c)}readSchema(e,t){let r=T.of(e);if(r.isUnitSchema())return;let n=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(t==null)return t;if(typeof t==="object"){let i=!!n.xmlFlattened;if(r.isListSchema()){let o=r.getValueSchema(),c=[],a=o.getMergedTraits().xmlName??"member",f=i?t:(t[0]??t)[a];if(f==null)return c;let u=Array.isArray(f)?f:[f];for(let h of u)c.push(this.readSchema(o,h));return c}let s={};if(r.isMapSchema()){let o=r.getKeySchema(),c=r.getValueSchema(),a;if(i)a=Array.isArray(t)?t:[t];else a=Array.isArray(t.entry)?t.entry:[t.entry];let f=o.getMergedTraits().xmlName??"key",u=c.getMergedTraits().xmlName??"value";for(let h of a){let l=h[f],d=h[u];if(l==="__proto__")W(s);s[l]=this.readSchema(c,d)}return s}if(r.isStructSchema()){let o=r.isUnionSchema(),c;if(o)c=new ve(t,s);for(let[a,f]of r.structIterator()){let u=f.getMergedTraits(),h=!u.httpPayload?f.getMemberTraits().xmlName??a:u.xmlName??f.getName();if(o)c.mark(h);if(t[h]!=null)s[a]=this.readSchema(f,t[h])}if(o)c.writeUnknown();return s}if(r.isDocumentSchema())return t;throw Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${r.getName(!0)}`)}if(r.isListSchema())return[];if(r.isMapSchema()||r.isStructSchema())return{};return this.stringDeserializer.read(r,t)}parseXml(e){if(e.length){let t;try{t=Un(e)}catch(s){if(s&&typeof s==="object")Object.defineProperty(s,"$responseBodyText",{value:e});throw s}let r="#text",n=Object.keys(t)[0],i=t[n];if(i[r])i[n]=i[r],delete i[r];return _n(i)}return{}}}class nr extends F{settings;buffer;constructor(e){super();this.settings=e}write(e,t,r=""){if(this.buffer===void 0)this.buffer="";let n=T.of(e);if(r&&!r.endsWith("."))r+=".";if(n.isBlobSchema()){if(typeof t==="string"||t instanceof Uint8Array)this.writeKey(r),this.writeValue((this.serdeContext?.base64Encoder??ae)(t))}else if(n.isBooleanSchema()||n.isNumericSchema()||n.isStringSchema()){if(t!=null)this.writeKey(r),this.writeValue(String(t));else if(n.isIdempotencyToken())this.writeKey(r),this.writeValue(Ye())}else if(n.isBigIntegerSchema()){if(t!=null)this.writeKey(r),this.writeValue(String(t))}else if(n.isBigDecimalSchema()){if(t!=null)this.writeKey(r),this.writeValue(t instanceof B?t.string:String(t))}else if(n.isTimestampSchema()){if(t instanceof Date)switch(this.writeKey(r),fe(n,this.settings)){case 5:this.writeValue(t.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(Ae(t));break;case 7:this.writeValue(String(t.getTime()/1000));break}}else if(n.isDocumentSchema())if(Array.isArray(t))this.write(79,t,r);else if(t instanceof Date)this.write(4,t,r);else if(t instanceof Uint8Array)this.write(21,t,r);else if(t&&typeof t==="object")this.write(143,t,r);else this.writeKey(r),this.writeValue(String(t));else if(n.isListSchema()){if(Array.isArray(t))if(t.length===0){if(this.settings.serializeEmptyLists)this.writeKey(r),this.writeValue("")}else{let i=n.getValueSchema(),s=this.settings.flattenLists||n.getMergedTraits().xmlFlattened,o=1;for(let c of t){if(c==null)continue;let a=i.getMergedTraits(),f=this.getKey("member",a.xmlName,a.ec2QueryName),u=s?`${r}${o}`:`${r}${f}.${o}`;this.write(i,c,u),++o}}}else if(n.isMapSchema()){if(t&&typeof t==="object"){let i=n.getKeySchema(),s=n.getValueSchema(),o=n.getMergedTraits().xmlFlattened,c=1;for(let a in t){let f=t[a];if(f==null)continue;let u=i.getMergedTraits(),h=this.getKey("key",u.xmlName,u.ec2QueryName),l=o?`${r}${c}.${h}`:`${r}entry.${c}.${h}`,d=s.getMergedTraits(),p=this.getKey("value",d.xmlName,d.ec2QueryName),m=o?`${r}${c}.${p}`:`${r}entry.${c}.${p}`;this.write(i,a,l),this.write(s,f,m),++c}}}else if(n.isStructSchema()){if(t&&typeof t==="object"){let i=!1;for(let[s,o]of n.structIterator()){if(t[s]==null&&!o.isIdempotencyToken())continue;let c=o.getMergedTraits(),a=this.getKey(s,c.xmlName,c.ec2QueryName,"struct"),f=`${r}${a}`;this.write(o,t[s],f),i=!0}if(!i&&n.isUnionSchema()){let{$unknown:s}=t;if(Array.isArray(s)){let[o,c]=s,a=`${r}${o}`;this.write(15,c,a)}}}}else if(n.isUnitSchema());else throw Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${n.getName(!0)}`)}flush(){if(this.buffer===void 0)throw Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");let e=this.buffer;return delete this.buffer,e}getKey(e,t,r,n){let{ec2:i,capitalizeKeys:s}=this.settings;if(i&&r)return r;let o=t??e;if(s&&n==="struct")return o[0].toUpperCase()+o.slice(1);return o}writeKey(e){if(e.endsWith("."))e=e.slice(0,e.length-1);this.buffer+=`&${mn(e)}=`}writeValue(e){this.buffer+=mn(e)}}class ir extends An{options;serializer;deserializer;mixin=new ue;constructor(e){super({defaultNamespace:e.defaultNamespace,errorTypeRegistries:e.errorTypeRegistries});this.options=e;let t={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace,serializeEmptyLists:!0};this.serializer=new nr(t),this.deserializer=new st(t)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(e){this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e)}getPayloadCodec(){throw Error("AWSQuery protocol has no payload codec.")}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r);if(!n.path.endsWith("/"))n.path+="/";if(n.headers["content-type"]="application/x-www-form-urlencoded",Cn(e.input)==="unit"||!n.body)n.body="";let i=e.name.split("#")[1]??e.name;if(n.body=`Action=${i}&Version=${this.options.version}`+n.body,n.body.endsWith("&"))n.body=n.body.slice(-1);return n}async deserializeResponse(e,t,r){let n=this.deserializer,i=T.of(e.output),s={};if(r.statusCode>=300){let f=await We(r.body,t);if(f.byteLength>0)Object.assign(s,await n.read(15,f));await this.handleError(e,t,r,s,this.deserializeMetadata(r))}for(let f in r.headers){let u=r.headers[f];delete r.headers[f],r.headers[f.toLowerCase()]=u}let o=e.name.split("#")[1]??e.name,c=i.isStructSchema()&&this.useNestedResult()?o+"Result":void 0,a=await We(r.body,t);if(a.byteLength>0)Object.assign(s,await n.read(i,a,c));return s.$metadata=this.deserializeMetadata(r),s}useNestedResult(){return!0}async handleError(e,t,r,n,i){let s=this.loadQueryErrorCode(r,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);let o=this.loadQueryError(n)??{},c=this.loadQueryErrorMessage(n);o.message=c,o.Error={Type:o.Type,Code:o.Code,Message:c};let{errorSchema:a,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,r,o,i,this.mixin.findQueryCompatibleError),u=T.of(a),l=new(this.compositeErrorRegistry.getErrorCtor(a)??Error)({}),d={Type:o.Error.Type,Code:o.Error.Code,Error:o.Error};for(let[p,m]of u.structIterator()){let x=m.getMergedTraits().xmlName??p,A=o[x]??n[x];d[p]=this.deserializer.readSchema(m,A)}throw this.mixin.decorateServiceException(Object.assign(l,f,{$fault:u.getMergedTraits().error,message:c},d),n)}loadQueryErrorCode(e,t){let r=(t.Errors?.[0]?.Error??t.Errors?.Error??t.Error)?.Code;if(r!==void 0)return r;if(e.statusCode==404)return"NotFound"}loadQueryError(e){return e.Errors?.[0]?.Error??e.Errors?.Error??e.Error}loadQueryErrorMessage(e){let t=this.loadQueryError(e);return t?.message??t?.Message??e.message??e.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}class qn extends ir{options;constructor(e){super(e);this.options=e;let t={capitalizeKeys:!0,flattenLists:!0,serializeEmptyLists:!1,ec2:!0};Object.assign(this.serializer.settings,t)}getShapeId(){return"aws.protocols#ec2Query"}useNestedResult(){return!1}}var Qn=(e,t)=>zn(e,t).then((r)=>{if(r.length){let n;try{n=Un(r)}catch(c){if(c&&typeof c==="object")Object.defineProperty(c,"$responseBodyText",{value:r});throw c}let i="#text",s=Object.keys(n)[0],o=n[s];if(o[i])o[s]=o[i],delete o[i];return _n(o)}return{}}),qo=async(e,t)=>{let r=await Qn(e,t);if(r.Error)r.Error.message=r.Error.message??r.Error.Message;return r},Gn=(e,t)=>{if(t?.Error?.Code!==void 0)return t.Error.Code;if(t?.Code!==void 0)return t.Code;if(e.statusCode==404)return"NotFound"};class or extends F{settings;stringBuffer;byteBuffer;buffer;constructor(e){super();this.settings=e}write(e,t){let r=T.of(e);if(r.isStringSchema()&&typeof t==="string")this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??Jt)(t);else{this.buffer=this.writeStruct(r,t,void 0);let n=r.getMergedTraits();if(n.httpPayload&&!n.xmlName)this.buffer.withName(r.getName())}}flush(){if(this.byteBuffer!==void 0){let t=this.byteBuffer;return delete this.byteBuffer,t}if(this.stringBuffer!==void 0){let t=this.stringBuffer;return delete this.stringBuffer,t}let e=this.buffer;if(this.settings.xmlNamespace){if(!e?.attributes?.xmlns)e.addAttribute("xmlns",this.settings.xmlNamespace)}return delete this.buffer,e.toString()}writeStruct(e,t,r){let n=e.getMergedTraits(),i=e.isMemberSchema()&&!n.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():n.xmlName??e.getName();if(!i||!e.isStructSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);let s=V.of(i),[o,c]=this.getXmlnsAttribute(e,r);for(let[f,u]of e.structIterator()){let h=t[f];if(h!=null||u.isIdempotencyToken()){if(u.getMergedTraits().xmlAttribute){s.addAttribute(u.getMergedTraits().xmlName??f,this.writeSimple(u,h));continue}if(u.isListSchema())this.writeList(u,h,s,c);else if(u.isMapSchema())this.writeMap(u,h,s,c);else if(u.isStructSchema())s.addChildNode(this.writeStruct(u,h,c));else{let l=V.of(u.getMergedTraits().xmlName??u.getMemberName());this.writeSimpleInto(u,h,l,c),s.addChildNode(l)}}}let{$unknown:a}=t;if(a&&e.isUnionSchema()&&Array.isArray(a)&&Object.keys(t).length===1){let[f,u]=a,h=V.of(f);if(typeof u!=="string")if(t instanceof V||t instanceof gn)s.addChildNode(t);else throw Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");this.writeSimpleInto(0,u,h,c),s.addChildNode(h)}if(c)s.addAttribute(o,c);return s}writeList(e,t,r,n){if(!e.isMemberSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);let i=e.getMergedTraits(),s=e.getValueSchema(),o=s.getMergedTraits(),c=!!o.sparse,a=!!i.xmlFlattened,[f,u]=this.getXmlnsAttribute(e,n),h=(l,d)=>{if(s.isListSchema())this.writeList(s,Array.isArray(d)?d:[d],l,u);else if(s.isMapSchema())this.writeMap(s,d,l,u);else if(s.isStructSchema()){let p=this.writeStruct(s,d,u);l.addChildNode(p.withName(a?i.xmlName??e.getMemberName():o.xmlName??"member"))}else{let p=V.of(a?i.xmlName??e.getMemberName():o.xmlName??"member");this.writeSimpleInto(s,d,p,u),l.addChildNode(p)}};if(a){for(let l of t)if(c||l!=null)h(r,l)}else{let l=V.of(i.xmlName??e.getMemberName());if(u)l.addAttribute(f,u);for(let d of t)if(c||d!=null)h(l,d);r.addChildNode(l)}}writeMap(e,t,r,n,i=!1){if(!e.isMemberSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);let s=e.getMergedTraits(),o=e.getKeySchema(),a=o.getMergedTraits().xmlName??"key",f=e.getValueSchema(),u=f.getMergedTraits(),h=u.xmlName??"value",l=!!u.sparse,d=!!s.xmlFlattened,[p,m]=this.getXmlnsAttribute(e,n),x=(A,U,j)=>{let le=V.of(a,U),[hs,fr]=this.getXmlnsAttribute(o,m);if(fr)le.addAttribute(hs,fr);A.addChildNode(le);let de=V.of(h);if(f.isListSchema())this.writeList(f,j,de,m);else if(f.isMapSchema())this.writeMap(f,j,de,m,!0);else if(f.isStructSchema())de=this.writeStruct(f,j,m);else this.writeSimpleInto(f,j,de,m);A.addChildNode(de)};if(d)for(let A in t){let U=t[A];if(l||U!=null){let j=V.of(s.xmlName??e.getMemberName());x(j,A,U),r.addChildNode(j)}}else{let A;if(!i){if(A=V.of(s.xmlName??e.getMemberName()),m)A.addAttribute(p,m);r.addChildNode(A)}for(let U in t){let j=t[U];if(l||j!=null){let le=V.of("entry");x(le,U,j),(i?r:A).addChildNode(le)}}}}writeSimple(e,t){if(t===null)throw Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");let r=T.of(e),n=null;if(t&&typeof t==="object")if(r.isBlobSchema())n=(this.serdeContext?.base64Encoder??ae)(t);else if(r.isTimestampSchema()&&t instanceof Date)switch(fe(r,this.settings)){case 5:n=t.toISOString().replace(".000Z","Z");break;case 6:n=Ae(t);break;case 7:n=String(t.getTime()/1000);break;default:console.warn("Missing timestamp format, using http date",t),n=Ae(t);break}else if(r.isBigDecimalSchema()&&t){if(t instanceof B)return t.string;return String(t)}else if(r.isMapSchema()||r.isListSchema())throw Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead.");else throw Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${r.getName(!0)}`);if(r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())n=String(t);if(r.isStringSchema())if(t===void 0&&r.isIdempotencyToken())n=Ye();else n=String(t);if(n===null)throw Error(`Unhandled schema-value pair ${r.getName(!0)}=${t}`);return n}writeSimpleInto(e,t,r,n){let i=this.writeSimple(e,t),s=T.of(e),o=new gn(i),[c,a]=this.getXmlnsAttribute(s,n);if(a)r.addAttribute(c,a);r.addChildNode(o)}getXmlnsAttribute(e,t){let r=e.getMergedTraits(),[n,i]=r.xmlNamespace??[];if(i&&i!==t)return[n?`xmlns:${n}`:"xmlns",i];return[void 0,void 0]}}class cr extends F{settings;constructor(e){super();this.settings=e}createSerializer(){let e=new or(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new st(this.settings);return e.setSerdeContext(this.serdeContext),e}}class Wn extends Tn{codec;serializer;deserializer;mixin=new ue;constructor(e){super(e);let t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new cr(t),this.serializer=new In(this.codec.createSerializer(),t),this.deserializer=new kn(this.codec.createDeserializer(),t)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,t,r){let n=await super.serializeRequest(e,t,r),i=T.of(e.input);if(!n.headers["content-type"]){let s=this.mixin.resolveRestContentType(this.getDefaultContentType(),i);if(s)n.headers["content-type"]=s}if(typeof n.body==="string"&&n.headers["content-type"]===this.getDefaultContentType()&&!n.body.startsWith("<?xml ")&&!this.hasUnstructuredPayloadBinding(i))n.body='<?xml version="1.0" encoding="UTF-8"?>'+n.body;return n}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,n,i){let s=Gn(r,n)??"Unknown";if(this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace),n.Error&&typeof n.Error==="object"){for(let p of Object.keys(n.Error))if(n[p]=n.Error[p],p.toLowerCase()==="message")n.message=n.Error[p]}if(n.RequestId&&!i.requestId)i.requestId=n.RequestId;let{errorSchema:o,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,r,n,i),a=T.of(o),f=n.Error?.message??n.Error?.Message??n.message??n.Message??"UnknownError",h=new(this.compositeErrorRegistry.getErrorCtor(o)??Error)({});await this.deserializeHttpMessage(o,t,r,n);let l={},d=this.codec.createDeserializer();for(let[p,m]of a.structIterator()){let x=m.getMergedTraits().xmlName??p,A=n.Error?.[x]??n[x];l[p]=d.readSchema(m,A)}throw this.mixin.decorateServiceException(Object.assign(h,c,{$fault:a.getMergedTraits().error,message:f},l),n)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(e){for(let[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return!(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return!1}}var Go=(e)=>{if(e==null)return;if(typeof e==="object"&&"__type"in e)delete e.__type;return jo(e)},Wo=(e)=>{if(e==null)return e;if(typeof e==="number"||typeof e==="bigint"){let t=Error(`Received number ${e} where a string was expected.`);return t.name="Warning",console.warn(t),String(e)}if(typeof e==="boolean"){let t=Error(`Received boolean ${e} where a string was expected.`);return t.name="Warning",console.warn(t),String(e)}return e},Xo=(e)=>{if(e==null)return e;if(typeof e==="string"){let t=e.toLowerCase();if(e!==""&&t!=="false"&&t!=="true"){let r=Error(`Received string "${e}" where a boolean was expected.`);r.name="Warning",console.warn(r)}return e!==""&&t!=="false"}return e},Jo=(e)=>{if(e==null)return e;if(typeof e==="string"){let t=Number(e);if(t.toString()!==e){let r=Error(`Received string "${e}" where a number was expected.`);return r.name="Warning",console.warn(r),e}return t}return e};Zo.AwsEc2QueryProtocol=qn;Zo.AwsJson1_0Protocol=Vn;Zo.AwsJson1_1Protocol=Fn;Zo.AwsJsonRpcProtocol=nt;Zo.AwsQueryProtocol=ir;Zo.AwsRestJsonProtocol=Pn;Zo.AwsRestXmlProtocol=Wn;Zo.AwsSmithyRpcV2CborProtocol=Dn;Zo.JsonCodec=Kn;Zo.JsonCodec2=rt;Zo.JsonShapeDeserializer=tr;Zo.JsonShapeDeserializer2=vt;Zo.JsonShapeSerializer=rr;Zo.JsonShapeSerializer2=tt;Zo.QueryShapeSerializer=nr;Zo.XmlCodec=cr;Zo.XmlShapeDeserializer=st;Zo.XmlShapeSerializer=or;Zo._toBool=Xo;Zo._toNum=Jo;Zo._toStr=Wo;Zo.awsExpectUnion=Go;Zo.loadJsonRpcErrorCode=Ln;Zo.loadRestJsonErrorCode=On;Zo.loadRestXmlErrorCode=Gn;Zo.parseJsonBody=et;Zo.parseJsonErrorBody=$o;Zo.parseXmlBody=Qn;Zo.parseXmlErrorBody=qo});var Qo=w(function(qc){var{ProviderError:Xn,booleanSelector:Jn,SelectorType:Zn,loadConfig:Ic}=Ge(),{setCredentialFeature:kc}=Ot(),{normalizeProvider:he,memoizeIdentityProvider:Rc,isIdentityExpired:Mc,doesIdentityRequireRefresh:Bc}=vo(),{SignatureV4:Yn}=kf(),{HttpResponse:is,HttpRequest:os}=Ht(),vn=(e)=>is.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,es=(e)=>is.isInstance(e)?e.headers?.age??e.headers?.Age:void 0,cs=(e)=>new Date(Date.now()+e),ts=(e,t,r,n)=>{if(n!==void 0)return t;let i=Date.parse(e),s=Date.now();if(r!==void 0&&s-r>900000)return t;return r!==void 0?i-(r+s)/2:i-s},Te=(e,t)=>{if(!t)throw Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},ar=async(e)=>{let t=Te("context",e.context),r=Te("config",e.config),n=t.endpointV2?.properties?.authSchemes?.[0],s=await Te("signer",r.signer)(n),o=e?.signingRegion,c=e?.signingRegionSet,a=e?.signingName;return{config:r,signer:s,signingRegion:o,signingRegionSet:c,signingName:a}};class it{async sign(e,t,r){if(!os.isInstance(e))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await ar(r),{config:i,signer:s}=n,{signingRegion:o,signingName:c}=n,a=r.context;if(a?.authSchemes?.length??!1){let[h,l]=a.authSchemes;if(h?.name==="sigv4a"&&l?.name==="sigv4")o=l?.signingRegion??o,c=l?.signingName??c}let f=await i.disableClockSkewCorrection?.()===!0;if(r._disableClockSkewCorrection=f,!f)r._preRequestSystemClockOffset=i.systemClockOffset,r._requestSentAt=Date.now();return await s.sign(e,{signingDate:f?new Date:cs(i.systemClockOffset),signingRegion:o,signingService:c})}errorHandler(e){return(t)=>{let r=t;if(!e._disableClockSkewCorrection){let n=r.ServerTime??vn(r.$response);if(n){let i=Te("config",e.config),{_preRequestSystemClockOffset:s,_requestSentAt:o}=e,c=es(r.$response),a=ts(n,i.systemClockOffset,o,c);if(i.systemClockOffset=a,Math.abs(a)>=240000&&(a!==s||s!==void 0&&s!==a)&&r.$metadata)r.$metadata.clockSkewCorrected=!0}}throw t}}successHandler(e,t){if(t._disableClockSkewCorrection)return;let r=vn(e);if(r){let n=Te("config",t.config),i=t._requestSentAt,s=es(e);n.systemClockOffset=ts(r,n.systemClockOffset,i,s)}}}var Uc=it;class as extends it{async sign(e,t,r){if(!os.isInstance(e))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:n,signer:i,signingRegion:s,signingRegionSet:o,signingName:c}=await ar(r),f=(await n.sigv4aSigningRegionSet?.()??o??[s]).join(","),u=await n.disableClockSkewCorrection?.()===!0;if(r._disableClockSkewCorrection=u,!u)r._preRequestSystemClockOffset=n.systemClockOffset,r._requestSentAt=Date.now();return await i.sign(e,{signingDate:u?new Date:cs(n.systemClockOffset),signingRegion:f,signingService:c})}}var rs=(e)=>typeof e==="string"&&e.length>0?e.split(",").map((t)=>t.trim()):[],fs=(e)=>`AWS_BEARER_TOKEN_${e.replace(/[\s-]/g,"_").toUpperCase()}`,ns="AWS_AUTH_SCHEME_PREFERENCE",ss="auth_scheme_preference",Dc={environmentVariableSelector:(e,t)=>{if(t?.signingName){if(fs(t.signingName)in e)return["httpBearerAuth"]}if(!(ns in e))return;return rs(e[ns])},configFileSelector:(e)=>{if(!(ss in e))return;return rs(e[ss])},default:[]},jc=(e)=>(e.sigv4aSigningRegionSet=he(e.sigv4aSigningRegionSet),e),zc={environmentVariableSelector(e){if(e.AWS_SIGV4A_SIGNING_REGION_SET)return e.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((t)=>t.trim());throw new Xn("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:!0})},configFileSelector(e){if(e.sigv4a_signing_region_set)return(e.sigv4a_signing_region_set??"").split(",").map((t)=>t.trim());throw new Xn("sigv4a_signing_region_set not set in profile.",{tryNextLink:!0})},default:void 0},Oc=(e)=>(t)=>{let r=t.credentials,n=!!t.credentials,i=void 0;Object.defineProperty(t,"credentials",{set(u){if(u&&u!==r&&u!==i)n=!0;r=u;let h=Lc(t,{credentials:r,credentialDefaultProvider:t.credentialDefaultProvider}),l=$c(t,h);if(n&&!l.attributed){let d=typeof r==="object"&&r!==null;i=async(p)=>{let x=await l(p);if(d&&(!x.$source||Object.keys(x.$source).length===0))return kc(x,"CREDENTIALS_CODE","e");return x},i.memoized=l.memoized,i.configBound=l.configBound,i.attributed=!0}else i=l},get(){return i},enumerable:!0,configurable:!0}),t.credentials=r;let{signingEscapePath:s=!0,systemClockOffset:o=t.systemClockOffset||0,sha256:c}=t,a;if(t.signer)a=he(t.signer);else if(t.regionInfoProvider)a=()=>he(t.region)().then(async(u)=>[await t.regionInfoProvider(u,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},u]).then(([u,h])=>{let{signingRegion:l,signingService:d}=u;t.signingRegion=t.signingRegion||l||h,t.signingName=t.signingName||d||t.serviceId;let p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:c,uriEscapePath:s};return new(t.signerConstructor||Yn)(p)});else a=async(u)=>{u=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await he(t.region)(),properties:{}},u);let h=u.signingRegion,l=u.signingName;t.signingRegion=t.signingRegion||h,t.signingName=t.signingName||l||t.serviceId;let d={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:c,uriEscapePath:s};return new(t.signerConstructor||Yn)(d)};return Object.assign(t,{systemClockOffset:o,signingEscapePath:s,signer:a,disableClockSkewCorrection:he(t.disableClockSkewCorrection??e)})};function Lc(e,{credentials:t,credentialDefaultProvider:r}){let n;if(t)if(!t?.memoized)n=Rc(t,Mc,Bc);else n=t;else if(r)n=he(r(Object.assign({},e,{parentClientConfig:e})));else n=async()=>{throw Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return n.memoized=!0,n}function $c(e,t){if(t.configBound)return t;let r=async(n)=>t({...n,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}var Vc="AWS_DISABLE_CLOCK_SKEW_CORRECTION",Fc="disable_clock_skew_correction",Pc={environmentVariableSelector:(e)=>Jn(e,Vc,Zn.ENV),configFileSelector:(e)=>Jn(e,Fc,Zn.CONFIG),default:!1},Hc=Ic(Pc),us=Oc(Hc),Kc=us;qc.AWSSDKSigV4Signer=Uc;qc.AwsSdkSigV4ASigner=as;qc.AwsSdkSigV4Signer=it;qc.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS=Dc;qc.NODE_SIGV4A_CONFIG_OPTIONS=zc;qc.getBearerTokenEnvKey=fs;qc.resolveAWSSDKSigV4Config=Kc;qc.resolveAwsSdkSigV4AConfig=jc;qc.resolveAwsSdkSigV4Config=us;qc.validateSigningProperties=ar});
|
|
20
|
+
export{kf,Ls,Qo};
|